jsMath: A Method of Including Mathematics in Web Pages

The jsMath package provides a method of including mathematics in HTML pages that works across multiple browsers under Windows, Macintosh OS X, Linux and other flavors of unix. It overcomes a number of the shortcomings of the traditional method of using images to represent mathematics: jsMath uses native fonts, so they resize when you change the size of the text in your browser, they print at the full resolution of your printer, and you don't have to wait for dozens of images to be downloaded in order to see the mathematics in a web page. There are also advantages for web-page authors, as there is no need to preprocess your web pages to generate any images, and the mathematics is entered in TeX form, so it is easy to create and maintain your web pages.

Although it works best with the TeX fonts installed, jsMath will fall back on a collection of image-based fonts (which can still be scaled or printed at high resolution) or unicode fonts when the TeX fonts are not available. There is a control panel connected to a small floating button that lets the user select which fallback method to use or change some other settings like a scaling factor to use for the mathematics compared to the other text on the page.





The jsMath package is based on the TeX mathematics layout engine as described in Appendix G of Donald Knuth's The TeXbook. Since jsMath uses the TeX fonts, it also has the font metric information from the associated .tfm files at its disposal, so it handles italic correction and kerning in essentially the same way as TeX. This makes the output of jsMath as nearly identical to that of TeX as I could manage.

JsMath does not use MathML, but this is not intended to indicate that MathML is not a good or useful thing, because it is, and I know that. But MathML is not designed to be written directly by human beings, and I wanted a format that I could easily write by hand and include in quick, non-archival web pages like homework assignments, while not having to require students to use a particular browser or download extra software to be able to view it. At the time I wrote jsMath, only Mozilla on the PC implemented MathML directly, and MSIE on the PC could do it with a plugin, but there wasn't a Mac-based browser that handled MathML adequately (it looks like Mozilla 1.5 might finally have it working), and I'm not sure what the situation is for unix. I wanted a solution that worked out-of-the-box with a wider range of browsers, and on the Mac in particular since that is what I use. Thus jsMath was born.



