Latex to HTML Converters

I’ve been using LaTeX for many years, I should say quickly for the freaks out there that it doesn’t mean I’m into vinyl or other strangeness. LaTeX is a document processing system that creates good quality documents
from text source, no hamsters or chains involved at all.

The standard processors you get with LaTeX are good at converting the source into Postscript or PDF (Acrobat) documents and for most of the time this will do. However there are occasions when you want to have your document output in HTML. In this case you need to have a different processor.

This page is about the various types of LaTeX to HTML converters out there. It is not an exhaustive list but should help other people looking around for converters. The main problem with them all is they are not
maintained that well.

Hyperlatex

Hyperlatex is the converter I have used the most. It does most jobs quite well and you get reasonable results from it. My major gripes with it is that it is written in Lisp so I cannot extend it (I don’t know Lisp) and that it doesn’t do CSS that well.

Despite those shortcomings, Hyperlatex is a good start for document conversion. Unlike most program on this page, it is actively maintained and keeps up with HTML standards. For example there is work for
Hyperlatex output to be in XHTML.

TTH

TTH has put a lot of effort into the formula conversion. Most converters make an image for the formulas while TTH generates HTML for it, giving the formulas a more consistent look in the document rather than looking like they were “pasted in” later.

TTH has a funny license in that (roughly) it is free for non-commercial use only. Depending on where you are going to use it, this may be a problem. You can buy a commercial license of TTF too.

Heava

HeVeA is one converter I haven’t used, but will try out soon. It looks like it would get confused by some of my documents, especially anything with nested environments.

The program is written in a language called Objective Caml which I know even less about than Lisp. That means no way of extending it for me.

LaTeX2HTML

At first I thought this would be the converter for me. It looks like it converts it pages rather well and it is written in a programming language I understand (Perl).

The main problem with this program is that it has not been maintained for years. A consequence of that is the HTML rendering is a bit old and doesn’t keep up with the latest standards.

text4ht

Another one I’ve not tried yet. This one does look recently maintained and I will be trying it out.

LaTeXML

This converter takes LaTeX as an input and instead of having an output file format of DVI makes it XML. It is written in Perl and was developed with a particular focus on the mathematical equations. To get HTML you use a post-processor.

12 thoughts on “Latex to HTML Converters

  1. itex2MML is worth serious consideration. It can run as a binary
    and also one can build libraries for, e.g., ruby, java, and php that
    are easily integrated as part of a webserver or wordpress installation.

    The TeX part comprises basically everything except for sectioning,
    which can be added or converted to standard HTML breaks and headers.

  2. I tried Latexml and could get an html file but could never get the bibtex working on it. It would run and then never give the expected output but would show no errors.

    I then tried tex4ht on a Kubuntu system. tex4ht was already on my system and the command htlatex [file] worked just fine right out of the box. I got exactly what I wanted with no need to mess with anything else. I didn’t have any formulas in my text and didn’t do any figures either.

    Thanks for putting up this post.
    Kyle

  3. I got TTH to work – it quite easily integrates into WinEdt and thankfully does not require ellaborate installation like some of the other options mentioned in your post. However, I am having trouble rendering parenthesis of type \left( and \right). The HTML file displays empty square in place of parentheses in the browser (I am using Google Chrome).

  4. Having tested all of the converters (with the intention of getting some mathematical documents readable on ebook readers), I am sorry to say that none of them did what I wanted.

    Hyperlatex does not deal well with custom operators (DeclareMathOperator stopped it). When I changed that it returned another error that I could not understand.

    TTH was very satisfactory in all respects except equations. They convert equations to html directly (not using images), which works for simple equations. However, many of the equations in my case were converted in a way as to make them unreadable. Sum signs were not displayed, instead of subscripts _ signs are displayed. If you don’t need equations or need only very simple equations this works great, but otherwise it is unfortunately not good enough.

    As the OP guessed, Hevea had problems with nested environments. This meant that the document was not completely converted.

    tex4ht works similarly to TTH in that it converts equations to HTML. It does a decent job in that, but again some subscripts are not in appropriate places, some symbols (like large oplus) are too small. Thus equations do not quite capture their original meaning and often-times their misprint serves to confuse the reader. However, this one worked best out of the ones mentiond thus far.

    Latex2HTML worked rather well. It converted equations to images which meant there were no problems with their display. However, images were too small and the latex document was generated into a fully fledged website with a table of contents and hyperlinks joining the various documents together. This is great if you want a website, but for something to be converted into an ebook it is unfortunately again not appropriate.

    The one that I find worked best of all was latexml. Equations were readable and correctly understood. But, unfortunately, at some point it decided that all the text should be centred. I cannot find what in my Tex file triggers this behaviour. Otherwise really liked this one, it’s probably the most promising of all. It can also be used to convert equations straight into images with a command line option.

  5. Couldn’t get Hyperlatex working. But latex2html did the task. Of course the tex file must be very simple, still output HTML looks fine.

Leave a Reply

Your email address will not be published. Required fields are marked *