# MathTran: Translation of mathematical content as a web service

Last modified 29 Jan, 2008

Published 29 Jan, 2008

MathTran [1] provides translation of mathematical content as a web service. The low-level interface is simple: One sends a suitable URL (encoding a formula in TeX notation) to the public MathTran server, and it returns a rendered bit-map image. There are higher level and more convenient interfaces. For example, if you follow the instructions here, to get a formula in the web page all you have to write is

Here is some background, Mathematical notation is a symbolic language (as is musical and much of chemical notation). Considered one way, mathematical notation is a special form of text, and considered another way it is a graphic, diagram or drawing. Software for rendering (transforming text to graphics) is special, and in general is not incorporated into text processing systems such as editors and web-browsers. Hence it is very common to treat this special content as graphics, which ignores its textual aspect. Bringing these two sides together is one of the major goals of the MathTran project.

The development of MathTran was funded by JISC [2] and The Open University [3], and took place from November 2006 to August 2007. At present (January 2008) it is serving about 30,000 images a day, out of a potential capacity on the current hardware of perhaps 2,000,000. Due to the OU's associations with the Moodle community [4], most of the early adopters and the heavy users are Moodle sites. However, a new class of users is emerging. This is small scale wikis, where the administrator can use MathTran and thus avoid the trouble of installing TeX and the required associated tools.

One of the most exciting adopters of MathTran is Enso TeX
Anywhere [5], which is a "desktop assistant" that allows you to put
MathTran images into HTML-styled emails. All one has to do is type the
formula in TeX notation, highlight it, summon the assistant and issue
the *render tex* command. The assistant will then replace the text
with an image. This assistant can also *unrender* MathTran images.
It can do this, not by magic, but because MathTran generates images that
contain rich metadata, which includes the original TeX notation formula.

The interface to Google Charts [6] is in some ways similar to that of MathTran, and wide interest Google Charts has received is a sign of the soundness of the URL-encoded web service approach it shares with MathTran. My blog article compares the two systems.

The MathTran project has three major components

- Translation of TeX encoded mathematics into images
- Translation of TeX encoded mathematics into MathML [7]
- Translation of MathML encoded mathematics into TeX

all to be provided both as a web service for public use and as open source server software. The project has delivered on (1), but (2) and (3) have proved harder. With the encouragement of JISC (the major funder), the project's emphasis switched from (2) and (3) to providing demonstrators and useful interfaces to (1).

The Open University has appointed me, for the period October 2007 to December 2009 a COLMSCT fellow [8], which will give me time to apply MathTran to problems in the learning and teaching of mathematics. Enso TeX Anywhere is already a tool that can be used to help students and teachers communicate. My COLMSCT project is more on the usability, application and deployment side. It builds on the system accomplishments of MathTran.

Since submitting the original proposal to JISC in autumn 2006 it has become clear to me that translation of TeX to MathML is required not only server-side, but also client-side in the web browser. Both Peter Jipsen's AsciiMath [9] and Davide Cervone's JsMath [10] are examples of what can be done client-side. There are differences: AsciiMath translates a TeX-like syntax to MathMl, for display on a MathML enabled browser, while JsMath provides an approximation to LaTeX syntax and TeX typesetting, all written in JavaScript.

The two major visual electronic media are HTML for web browsers, and PDF for print. Each media has its own "favourite" mathematics markup language, namely MathML and TeX/LaTeX respectively. And JavaScript is by far the major language on web browsers, while ordinary applications are written in a wide range of languages which are, mostly, interoperable. Roughly speaking, AsciiMath has started with browser MathML and has added a TeX-like input language, while JsMath has started with the LaTeX language and TeX's typesetting algorithms, and ported both to browser JavaScript. MathTran's provision of TeX as a web service is again an infusion of HTML standards and expectations into the world of TeX.

It is worth mentioning here that the PyPy project [11], which has been funded by the European Union, seems to provide a bridge between the JavaScript and C-compiled worlds, by means of its restricted Python or RPython subset of Python. It seems that RPython source can be translated to both JavaScript and to C.

Building bridges between web-browser and print worlds and *de
facto* standards will be an essential component of solving the
present problems of mathematics in electronic media. The MathTran
project has already made TeX available as a high-performance web
service, and as resources allow, is working on the MathML side of the
divide.