2 Using LaTeXML

§2.5 Individual Formula

For cases where you’d just like to convert a single formula to, say, MathML, and don’t mind the overhead, we’ve combined the pre- and post-processing into a single, handy, command latexmlmath. For example,

  latexmlmath --pmml=- \\frac{b\\pm\\sqrt{b^2-4ac}}{2a}

will print the MathML to standard output. To convert the formula to a png image, say quad.png, use the option --mathimage=quad.png.

Note that this involves putting TeX code on the command line. You’ve got to ‘slashify’ your code in whatever way is necessary so that after your shell is finished with it, the string that is passed to latexmlmath sees is normal TeX. In the example above, in most unix-like shells, we only needed to double-up the backslashes.