Logo IMG
HOME > PAST ISSUE > May-June 2009 > Article Detail


Writing Math on the Web

The Web would make a dandy blackboard if only we could scribble an equation

Brian Hayes

From Author to Server to Reader

Translating%20from%20one%20markup%20language%20to%20anotherClick to Enlarge ImageFor mathematical prose written in TeX, one Web-publishing strategy is to translate the entire document in advance, creating an HTML version that can then be displayed in a browser without further special handling. Two programs for this purpose are LaTeX2HTML (written in 1995 by Nikos Drakos, now of Gartner Research) and TeX4HT (by Eitan M. Gurari of Ohio State University). In essence, the translation programs replace the “back end” of a TeX system with software that generates HTML and bitmap images rather than output intended for printing.

A translator of this kind runs on the author’s own computer; the HTML files and accompanying images are then uploaded to a Web server for distribution. This work flow is suited to long-lived and seldom-modified documents written in TeX. The arrangement is less convenient with frequently updated content or Web sites maintained by multiple authors in collaboration. It’s also not ideal for documents that are written mostly in HTML rather than TeX, with just occasional snippets of mathematics.

A second strategy is to perform the translation not on the author’s computer but on the Web server. Two programs created by John Forkosh adopt this modus operandi. MathTeX relies on a separate TeX system to do the actual rendering of mathematical notation; MimeTeX is self-contained, with its own TeX interpreter. Both programs generate bitmap images of entire equations. This scheme is not meant for processing complete TeX documents; it works with HTML documents that have interspersed TeX expressions. Processing mathematics on the server works particularly well for collaborative Web sites, since the translation software has to be installed on only one machine. Wikipedia and many similar sites rely on this approach. (The math processor for Wikipedia is a program called texvc, which generates images for complex expressions but outputs HTML for simple ones.)

The drawbacks of server-side software are those that afflict all image-based solutions—clumsy typography and a profusion of tiny image files. But if the result falls short of elegance, at least it works reliably for most readers, no matter what browser they choose.

comments powered by Disqus


Subscribe to American Scientist