opencollab / jlatexmath

A Java API to render LaTeX
Other
514 stars 109 forks source link

\neq incorrect After running for a while #51

Closed Sean2358 closed 5 years ago

Sean2358 commented 5 years ago

I have a strange problem. The command \neq work fine at the beginning,looks like this: image

But after running for a while, i don't know when and how, it is changed: image

Is it because of some other command that changed the environment?

Sean2358 commented 5 years ago

Lib version is 1.0.7, and the code i use

private BufferedImage latex2Img(String latex, float size) {
        TeXFormula formula = new TeXFormula(latex);
        TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, size);
        BufferedImage image = new BufferedImage(icon.getIconWidth(),
                icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        g2.setStroke(new BasicStroke(1));
        g2.setColor(Color.BLACK);
        JLabel jl = new JLabel();
        jl.setForeground(new Color(0, 0, 0));
        synchronized (this) {
            icon.paintIcon(jl, g2, 0, 0);
        }
        return image;
    }
...
murkle commented 5 years ago

Is it better with the experimental branch? https://github.com/opencollab/jlatexmath/tree/experimental

Sean2358 commented 5 years ago

Is it better with the experimental branch? https://github.com/opencollab/jlatexmath/tree/experimental Thanks for suggestions! I will try it. But i don't know the trigger condition for this situation, so it's hard for me to judge whether it is better。