import org.scilab.forge.jlatexmath.TeXConstants; import org.scilab.forge.jlatexmath.TeXFormula; import org.scilab.forge.jlatexmath.TeXIcon; import java.io.*; import java.awt.Color; class ShowMath { public static void main (String[] args) { if ((args.length < 3) || (args[2].equals(""))) { System.out.println("Need 3 arguments: texstring size filename"); System.exit(1) ;} String math = args[0]; int sz = Integer.parseInt(args[1]); TeXFormula formula = new TeXFormula(math); TeXIcon ti = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, Integer.parseInt(args[1])); int height = ti.getIconHeight(); int newdepth = ti.getIconDepth(); if ((2*height) > (3*sz)) { newdepth = newdepth + 10 ; // this is a hack around the jlatexmath bug formula = formula.addStrut(TeXConstants.UNIT_PIXEL, 4, 1, newdepth); } formula.createPNG(TeXConstants.STYLE_DISPLAY, sz, args[2], java.awt.Color.WHITE, java.awt.Color.BLACK) ; System.out.println("" + newdepth); } }