A Greasemonkey user script to display LaTeX on Web pages

[This article has been translated to Slovak by Margareta Sliwka.] — updated 12 July 2018.

[This article has been translated to Serbo-Croatian by Jovana Milutinovich from Webhostinggeeks.com.]

This is a computer program, suitable for use with Mozilla Firefox 1.5 equipped with the Greasemonkey extension, that displays mathematical formulae written in the LaTeX language.

It works by translating the LaTeX into MathML, which Firefox 1.5 can render.

When this program — the “Display LaTeX user script” — is activated, any text appearing inside dollar signs $...$ is assumed to be LaTeX markup and is parsed.

The user script is free software available under a MIT-style license.

Usage instructions

  1. First, you may need to install some TrueType fonts for mathematical symbols.

    If you are using the Debian or Ubuntu Linux distribution, an alternative is to just install the latex-xft-fonts package; this package has an advantage that it is free software, and the fonts in this package have fewer bugs. The type faces are also in the traditional TeX style rather than in Mathematica’s strange style.

  2. Load up the Mozilla Firefox browser (At least version 1.5). (Display LaTeX does not work with other Web browsers.)
  3. Install the Greasemonkey extension. (More information) When you click on this link, your browser will ask you permission to install. Authorize it to do so.
  4. View this Display LaTeX script. Click on the “Install” button that will appear to install it.
  5. Come back to this page, or head over to PlanetMath to see it in action.
  6. The script by default does not activate on any other pages, to avoid problems with pages that have $ text but are not actually LaTeX. But you can change this by going into the Greasemonkey configuration menu. You can also easily uninstall the script entirely in the same menu.


There are many undeveloped features; do not expect full LaTeX support yet. In particular, it does not yet fully support displayed equations.

These features will eventually be filled in.

Display LaTeX is written using my own literate programming system. You can read the source. The XSLT stylesheets used to format the source is xhtml2to1, still under development.


2007-06-03: Unfortunately, I have not found much time to work on this plug-in. But I hope to be able to before the end of this year. In the meantime, I can take any suggestions or bug reports that you have. Also, thank you for all the positive comments that I have received.

2006-03-10: For now, I will be working on my XHTML 2.0 to 1.0 XSLT stylesheets, and then I will continue working on Display LaTeX. The limitedness of the stylesheets is right now hindering my work on the latter.

2006-05-06: My log of the development can be read on AsteroidMeta.


$1 = \frac{1}{\sqrt{2\pi} \sigma} \left( \int_{-\infty}^\infty e^{-\frac{1}{2\sigma^2} (x-\mu)^2} \, dx \right)$.

$\frac{1}{1-x} = 1 + x + x^2 + x^3 + \dotsb = \sum_{n=0}^\infty x^n$.

$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.

$df = \frac{\partial f}{\partial x^1} \, dx^1 + \frac{\partial f}{\partial x^2} \, dx^2 + \dotsb + \frac{\partial f}{\partial x^n} \, dx^n$.

$\sin \pi z = \pi z \prod_{n=1}^\infty \left( 1 - \frac{z^2}{n^2} \right)$.

$\lVert y \rVert = \left( y_1^2 + y_2^2 + \dotsb + y_k^2 \right)^{1/2}$.


The following snapshot was taken on April 5, 2006, on the PlanetMath encyclopedia entry on Orthogonal groups, on Mozilla Firefox 1.5 on Windows XP. The PlanetMath web site displays LaTeX equations by converting them to images with LaTeX2HTML. The Display LaTeX user script is able to convert such images back to MathML. Although the LaTeX conversion still requires some development, it already shows some promising results: compared to HTML images, the text appears a lot less staggered.

Other questions

Any chance of this working in Internet Explorer?

Possibly. There’s a Greasemonkey work-alike for Internet Explorer, called Turnabout, and the MathPlayer plug-in will display MathML. However, when adapting the user script I encountered a showstopper bug with MathPlayer — it crashes with dynamically generated MathML. So no go for now, until the MathPlayer developers fix this bug.

Steve Cheng <stevecheng@users.sourceforge.net>