Mathematical formulae with MathJax

Back to home page

I sometimes need to put formulae into my web pages, and I've been exploring the use of MathJax.

In the past I've inserted the formula into MS Word with MS Equation 3.0, doing a screen capture, cropping the image to the formula I want, saving as a .GIF file, and then displaying it on the web page as an image. So I get something like this for the Poisson distribution:

 

That's not ideal. If I want to change anything, I have to start all over again from Word. It's also messy if I want to put something like into the text; for a start it doesn't line up properly. MathJax allows me to type the formula in LaTeX style directly into the HTML code for my web page. Now I get this:

\[P(x) = \frac {\lambda^x}{x!}e^{-\lambda} \]

or in the text \( \hat \lambda \). I think it looks better, and I can easily make changes just by changing the HTML code. Eg. it's easy to make it smaller and blue:

\[P(x) = \frac {\lambda^x}{x!}e^{-\lambda} \]

or big and red: do not confuse \( \hat \lambda \) with \(\lambda\) !

or to change the symbols used:

\[ {\rm I\!P}(T=t) = \frac {\theta^t}{t!}e^{-\theta} \]

Not being familiar with LaTeX syntax, I found Carol Fisher's page on TeX commands very useful.

 

Updated 10 Dec 2012 by Mike Meredith