import org.scilab.forge.jlatexmath.TeXConstants;
import org.scilab.forge.jlatexmath.TeXFormula;
import org.scilab.forge.jlatexmath.TeXIcon;
// 渲染 LaTeX 公式为图像
String latex = "\\frac{a}{b} = c";
TeXFormula formula = new TeXFormula(latex);
TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(null, image.getGraphics(), 0, 0);
ImageIO.write(image, "PNG", new File("formula.png"));