Customized Exporting of Browser-Readable Content from Mathematica

Phil Ramsden

Imperial College London

Abstract

It is possible, using Save As..., to export documents authored in Mathematica in a variety of formats suitable for reading by web browsers; these formats include HTML and XHTML+MATHML. In the former case, equations and images are exported as GIF files; in the latter case, equations are exported as MathML and images as GIF files.

There is a need at Imperial College to create (a) HTML documents with PNG graphics in which equations appear as TeX (for rendering using jsMath), and (b) XHTML documents with SVG graphics in which equations appear as MathML. The latter are especially suitable for browsers such as Firefox, in which MathML and SVG are native, and the former are needed where users have browsers such as Internet Explorer.

Few options exist for authoring technical content for the Web, and Mathematica is ideal for the purpose. But where there is a need, as at Imperial, for combinations of formats that are not currently supported, there is a significant barrier in the way of achieving this.

A natural approach to exporting typeset content as TeX would be to use the built-in TeXForm function, but the difficulty is that such content is typically evaluated first, and may therefore end up rather different from what the author intended.

We present a package that enables customized exporting of Mathematica documents in a variety of formats, including a suite of relatively low-level functions that convert BoxData expressions into TeX.