LaTeX and HTMLThe philosophy of logical markupPutting LaTeX documents on the Web

Putting LaTeX documents on the Web

How can you make LaTeX documents available on the World-Wide Web? The simplest way is to put either the .dvi file or the .ps file in the directory where your web files live (on a Unix system, the public_html directory), make the file world-readable, and put a link to it on your homepage. Since not everybody has a viewer for .dvi or .ps files, a better method is to produce PDF from the LaTeX document, since PDF is almost universally readable. The objection to each of these methods is that your document is frozen in format.

Various methods have been proposed for translating LaTeX documents into a format such as HTML that is more natural for display on the World-Wide Web. Each method has its own strengths and weaknesses. This section discusses a few of these methods. For links to other methods, see a list from the TeX Users' Group and the foot of the TeX4ht home page.

Perhaps the best known conversion program is LaTeX2HTML. After running latex filename, you run latex2html filename, and after the program finishes running (which may take quite a while), you should have an HTML document. Mathematical formulas are automatically converted into gif files and linked into the HTML document.

LaTeX2HTML is the closest thing there is to a standard mechanism for putting LaTeX documents with mathematics onto the World-Wide Web. However, there are disadvantages to displaying formulas as gif files. The formulas do not resize if the user changes the size of the browser's fonts, and transferring many gif files across the Internet can be slow.

A somewhat different approach is taken by  Hyperlatex. This program does not attempt to be a universal converter from LaTeX to HTML. Instead, it allows you to write a LaTeX document (with a restricted subset of LaTeX commands) that can be used either to produce a normal printed document by running the command latex or to produce a corresponding HTML document by running the command hyperlatex. Hyperlatex supports conditional text that is processed only in LaTeX mode or only in HTML mode. It can optionally turn mathematical formulas into gif images. The pages you are currently reading were formatted with Hyperlatex.

A radically different approach is taken by TTH. It attempts to translate LaTeX into HTML while rendering formulas with ordinary characters instead of with gif images. Unfortunately, TTH works only if the browser is configured in a nonstandard way.

The basic difficulty in converting LaTeX to HTML is that World-Wide Web browsers have limited support for sophisticated display of mathematics. Although the World Wide Web Consortium formalized the Mathematical Markup Language MathML in 1998, the mainstream browsers had only limited support for MathML as of the fall of 2001.

Both Mathematica and Maple are supporting MathML, and browser support should improve soon. The W3C testbed browser Amaya can read and edit MathML. The PC equation editor MathType can translate into both LaTeX and MathML.


logo The Math 696 course pages were last modified April 5, 2005.
These pages are copyright © 1995-2005 by Harold P. Boas. All rights reserved.
 
LaTeX and HTMLThe philosophy of logical markupPutting LaTeX documents on the Web