Rendering Mathematics in LaTeX in HTML

EDIT: This is going to work until I fix up a DNS issue. Current I recommend using MathJax now in any case.

If you plan to blog about anything scientific, especially in the mathematical sciences, there’s a good chance you’re going to need to render some equations. Since \LaTeX is the de facto standard for typesetting mathematics, that’s what you’re going to want to use.

this is just test a test of inline.

If you’re using Drupal, then a module like DruTeX is the perfect solution. That is, if you’re hosting the implementation yourself or have the rights to install on the box running Drupal. If, however, this isn’t the case, then you might want to consider mimeTeX. mimeTeX is a minimal rendering engine which takes mathematics expressions as input and generates gifs as ouput. Since mimeTeX is accessible via CGI, gifs can be generated on the fly each time your page is accessed.

Everything you need to know to get mimeTeX up and running is available in the mimeTeX manual. Essentially, all you have to do is download the source and compile as follows.

cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi

There are also some precompiled binaries available here (sadly not for 64bit Linux though).

Once you’ve got a binary, you just need to dump it in the cgi-bin directory and then you can easily generate mathematics by invoking the mimeTeX build. For example, entering the following into your browser address bar should generate .

pascalbrandt.net/cgi-bin/mimetex.cgi?e^x=\lim_{n\to\infty}\left(1+\frac xn\right)^n

Here are a few more examples.

comments powered by Disqus