Peter Krautzberger on the web

What's the best TeX-to-HTML or TeX-to-ePUB converter?

What do I do when I don’t find the time to properly write here? I needlessly double post stuff I’ve written elsewhere.

Somebody asked the title question on LinkedIn. My reply was as follows (well, I’ll do the links properly here).

What’s the best TeX-to-HTML or TeX-to-ePUB converter?

I don’t have that much experience with this, but it might be better than nothing.

I think the two main contenders for TeX-to-html are TeX4ht (which most LaTeX distributions ship) and LaTeXML.

TeX4ht is really a dvi-to-html converter so it behaves accordingly. In my limited experience, it is easier to get results.

LaTeXML seems more powerful, but I could never get it to produce results from “arbitrary” TeX (again, not a lot of time spent on this). On the other hand, LaTeXML is used systematically to convert the arXiv with reasonable success rates.

With respect to epub3 (ignoring html-to-epub3), I’m only aware of pandoc (disclaimer: my personal favorite).

The current development branch has an epub3 writer with MathML support. This works reliably in a handful of tests. Pandoc does not have complete TeX support but John McFarlane is just a fantastic guy who built a strong community around pandoc – something the two others seem to lack.

Addendum: TeX.SE has lots of expertise on tex4ht and latexml, of course. See this example

Since the blog has to have something extra

Bonus observation

the two posts that regularly drive traffic this way are about Markdown and epub. Just saying.

Bonus bonus

That last sentence about John McFarlane got shortened too much and doesn’t quite make sense anymore. So I finally have a reason to embed the most important comic strip on the internet.

Are you coming to bed? -- I can't. This is important. -- What?  -- Someone is _wrong_ on the internet.
Duty Calls (© xkcd, cc-by-nc).


  • Joerg Sixt, 2013/01/23 Many thanks for this…although this answer made me lock myself in the basement for a week to get tex4ht to work(lol). It is probably powerful but a very badly documented piece of software. It is even unclear if MikTeX 2.9 contains a correct installation. It would love to get high-quality images for equations (PNG and SVG) out of tex4ht just to see how far you can go without MathML and MathJax but I failed so far. Probably will try PanDoc next…
    • Peter, 2013/01/26 I would suggest latexml first. pandoc is not on the level you expect.