Compiling LaTeX to xml with Tralics
Tralics converts LaTeX to xml, you can download it from their website or install it from the Debian repos. The last official release was in 2015 but it was modified in 2018. There’s a github page. I had some hopes for Tralics because it is mentioned on the MathJax FAQ page at the bottom.
Usage
tralics myfile.tex -noconfig -noentnames
will output a myfile.xml
document. While there’s a list of supported
LaTeX packages on their
site some of
them, amsthm for example, are marked “does nothing.” I modified the
text file to define a proof environment (which stops it compiling to
pdf) and to remove all the qedhere
. There was some issue with an
included jpg file too. There’s no support for hyperref and I just
stripped out all the \href
commands in the hope of getting some
working output.
The xml file you get won’t render will in a browser even with -noentnames
(without this it uses ∫
and so on which FF and chrome at least
don’t like in xml files, though they will accept them in html).
It seems like you’re supposed to use something like
xsltproc
to convert the xml
output to html but I couldn’t find appropriate xsl style files or any
example usage (although there are some examples of files converted to
html that look good). This page from
2008 suggests the “extra files” on
the Tralics site
might be useful, but that seems to refer to an old version. I gave up
at this point, it’s probably possible to get html conversion working but
the sample outputs didn’t look any better than the best of the other
methods I tried.