LATEXMLMATH(1p)
โจ NAME โจ
latexmlmath โ she takes a TeX/LaTeX math expression and transforms it into a whole bunch of different formats. it's the LATEXMLMATH(1p) page bestie, section 1p, User Contributed Perl Documentation, and she's lowkey a genius ๐งฎ๐
๐ธ SYNOPSIS ๐ธ
latexmlmath [options] texmath
the options, in her natural habitat ๐
--mathimage=fileโ converts to image in file--mathsvg=fileโ converts to svg image in file--magnification=magโ specifies magnification factor--presentationmathml=fileโ converts to Presentation MathML--pmml=fileโ alias for--presentationmathml--linelength=nโ do linewrapping of pMML--contentmathml=fileโ convert to Content MathML--cmml=fileโ alias for--contentmathml--openmath=fileโ convert to OpenMath--om=fileโ alias for--openmath--unicodemath=fileโ convert to UnicodeMath--XMath=fileโ output LaTeXML's internal format--noparseโ disables parsing of math (not useful for cMML or openmath)--preload=fileโ loads a style file.--includestylesโ allows processing raw*.styfiles (normally it avoids this)--path=dirโ adds a search path for style files.--quietโ reduces verbosity (can repeat)--verboseโ increases verbosity (can repeat)--strictโ be more strict about errors.--documentid=idโ assign an id to the document root.--debug=packageโ enables debugging output for the named package--inputencoding=encโ specify the input encoding.--VERSIONโ show version number and exit.--helpโ shows this help message.--โ ends options
okay so if texmath is -, then latexmlmath reads the TeX from standard input ๐ซถ. and if any of the output files are -, the result gets printed on standard output. no cap.
๐ Input notes ๐
heads up bestie: unless you're reading texmath from standard input, that texmath string is gonna get processed by whatever shell you're using before latexmlmath even lays eyes on it. which means a lot of so-called meta characters โ think backslash and star โ may confuse the shell or just get changed on you ๐ญ. so you're gonna need to quote and/or slashify the input appropriately. most particularly, \ will need to be doubled to \\ for latexmlmath to see it as a control sequence. it's giving "why is my backslash gone" and the answer is always the shell.
using -- to explicitly end the option list is super useful for cases when the math starts with a minus (and would otherwise be interpreted as an option, probably an unrecognized one ๐). alternatively, wrapping the texmath with {} will hide the minus. both are valid, pick your fighter.
simple examples, as promised:
latexmlmath \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}
echo "\\sqrt{b^2-4ac}" | latexmlmath --pmml=quad.mml -
๐ OPTIONS AND ARGUMENTS ๐
๐ฆ Conversion Options ๐ฆ
these options specify what formats the math should be converted to. in each case, the destination file is given โจ. except for mathimage, the file can be given as -, in which case the result is printed to standard output.
if no conversion option is specified, the default is to output presentation MathML to standard output. periodt.
--mathimage=file requests conversion to png images ๐ผ๏ธ--mathsvg=file requests conversion to svg images ๐- *
--magnification=factor* specifies the magnification used for math image. default is1.75. ๐ --presentationmathml=file requests conversion to Presentation MathML.--linelength=number (Experimental) line-breaks the generated Presentation MathML so that it is no longer than numbercharacters. โ ๏ธ experimental, so, yk, careful.--plane1converts the content of Presentation MathML token elements to the appropriate Unicode Plane-1 codepoints according to the selected font, when applicable.--hackplane1converts the content of Presentation MathML token elements to the appropriate Unicode Plane-1 codepoints according to the selected font, but only for the mathvariants double-struck, fraktur and script. this gives support for current (as of August 2009) versions of Firefox and MathPlayer, provided a sufficient set of fonts is available (eg. STIX). yes it's literally called hack, yes she means it ๐--contentmathml=file requests conversion to Content MathML. note that this conversion is only partially implemented. not fully cooked bestie ๐ฅฒ--openmath=file requests conversion to OpenMath. note that this conversion is only partially implemented. same vibe, same caveat.--unicodemath=file requests conversion to UnicodeMath (an unstructured Unicode string).--XMath=file requests conversion to LaTeXML's internal format.
๐ Other Options ๐
--preload=module requests the loading of an optional module or package. this may be useful if the TeX code does not specifically require the module (eg. through input or usepackage). for example, use--preload=LaTeX.poolto force LaTeX mode. ๐--includestylesthis optional allows processing of style files (files with extensionssty,cls,clo,cnf). by default, these files are ignored unless a latexml implementation of them is found (with an extension ofltxml).
these style files generally fall into two classes: those that merely affect document style are ignorable in the XML. others define new markup and document structure, often using deeper LaTeX macros to achieve their ends. although the omission will lead to other errors (missing macro definitions), it is unlikely that processing the TeX code in the style file will lead to a correct document. so like, temper your expectations ๐ซ
--path=dir add dir to the search paths used when searching for files, modules, style files, etc; somewhat likeTEXINPUTS. this option can be repeated. ๐--documentid=id assigns an ID to the root element of the XML document. this ID is generally inherited as the prefix of ID's on all other elements within the document. this is useful when constructing a site of multiple documents so that all nodes have unique IDs. main character energy for the root element fr fr ๐--quietreduces the verbosity of output during processing, used twice is pretty silent. ๐คซ--verboseincreases the verbosity of output during processing, used twice is pretty chatty. can be useful for getting more details when errors occur. ๐ฃ๏ธ--strictspecifies a strict processing mode. by default, undefined control sequences and invalid document constructs (that violate the DTD) give warning messages, but attempt to continue processing. using--strictmakes them generate fatal errors. no more gentle warnings, she's done being nice ๐--inputencoding=encoding specify the input encoding, eg.--inputencoding=iso-8859-1. the encoding must be one known to Perl's Encode package. note that this only enables the translation of the input bytes to UTF-8 used internally by LaTeXML, but does not affect catcodes. it is usually better to use LaTeX's inputenc package. note that this does not affect the output encoding, which is always UTF-8. โจ--VERSIONshows the version number of the LaTeXML package..--debug=package enables debugging output for the named package. the package is given without the leadingLaTeXML::. ๐--helpshows this help message. ๐
๐ BUGS ๐
this program runs much slower than would seem justified ๐ญ. this is a result of the relatively slow initialization including loading TeX and LaTeX macros and the schema. normally, this cost would be ammortized over large documents, whereas, in this case, we're processing a single math expression. so yeah, she takes a sec to wake up for one tiny little equation. not me waiting on startup ๐ซ
๐ซถ SEE ALSO ๐ซถ
latexml, latexmlpost, LaTeXML
and that's the whole page bestie, you ate ๐
โจ this was LATEXMLMATH(1p), brought to you by perl v5.40.1, dated 2025-11-16 ๐ go forth and convert some math, ily ๐ฆ๐
๐ฆ where this page comes from
- ubuntu resolute: latexml 0.8.8-4 ยท PD
- ubuntu stonking: latexml 0.8.8-4 ยท PD
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms