# LaTeX to MathML using itex2MML

November 4, 2008

I posted the following notes to the pandoc-discuss mailing list on November 4, 2008:

There was some discussion a few days ago regarding LaTeX to MathML conversion. There is a text filter called itex2MML that might be useful. I’m new to the list so perhaps people know about it already but I didn’t see it mentioned anywhere in the archives.

While it isn’t exactly LaTeX, itex contains pretty much everything LaTeX does, with some slight differences, but it also provides some additional macros like \tensor and \multiscripts.

At present, one can include inline LaTeX expressions, delimited by `\$..\$`, `\$\$..\$\$`, or `\[..\]` in Markdown and produce XHTML + MathML by doing something like this:

``````\$ cat doc.txt | itex2MML | pandoc > doc.xhtml
``````

This more or less works, but there are a lot of named entities that itex2MML emits that Pandoc doesn’t support (which get converted to question marks). If you’re working in Perl you can use MathML::Entities in between to convert the named entities to numeric references before handing the content off to pandoc.

It seems pretty straightforward to port the entity hash in MathML::Entities to CharacterReferences.hs. That would at least allow a simple pipe to work. A Pandoc command-line option for calling itex2MML could be useful too.