用Java生成LaTeX输出

时间:2010-11-19 20:42:17

标签: java latex

是否有用于从Java生成LaTeX输出的Java库?

2 个答案:

答案 0 :(得分:10)

渲染Latex:

JLatexMath:http://forge.scilab.org/index.php/p/jlatexmath/

生产乳胶:

JTex:http://jtex.sourceforge.net/

答案 1 :(得分:1)

我将从JLaTeXMath开始:

“ JLaTeXMath是显示LaTeX代码的最佳Java库。”


import org.scilab.forge.jlatexmath.TeXConstants;
import org.scilab.forge.jlatexmath.TeXFormula;

public class Example5 {

    public static void main(String[] args) {

        String latex = "\\begin{array}{|c|l|||r|c|}";
        latex += "\\hline";
        latex += "\\text{Matrix}&\\multicolumn{2}{|c|}{\\text{Multicolumns}}&\\text{Font sizes commands}\\cr";
        latex += "\\hline";
        latex += "\\begin{pmatrix}\\alpha_{11}&\\cdots&\\alpha_{1n}\\cr\\hdotsfor{3}\\cr\\alpha_{n1}&\\cdots&\\alpha_{nn}\\end{pmatrix}&\\Large \\text{Large Right}&\\small \\text{small Left}&\\tiny \\text{tiny Tiny}\\cr";
        latex += "\\hline";
        latex += "\\multicolumn{4}{|c|}{\\Huge \\text{Huge Multicolumns}}\\cr";
        latex += "\\hline";
        latex += "\\end{array}";

        TeXFormula formula = new TeXFormula(latex);
        formula.createPNG(TeXConstants.STYLE_DISPLAY, 20, "target/Example5.png", Color.white, Color.black);
    }
}

其他评估方案

(部分基于https://tex.stackexchange.com/q/41609/9075