Typesetting formuals with MathJax

      No Comments on Typesetting formuals with MathJax

Most hosting providers don’t have LaTeX packages installed on their servers and installing LaTeX yourself is usually only possible on rootservers, which are quite a bit more expensive (and therefore much less common) than regular hosting plans.

However, there is a great project called MathJax, that enables you to display formulas directly inside your wordpress posts without the need to install any LaTeX packages on your server. While you can install the javascript that is used to typeset your formula from either LaTeX or MathML code locally, the easiest way to use MathJax is probably to their content delivery network. For even more convenience, there is even a wordpress plugin that makes typesetting formulas easy as pie.

First, enable the CDN option in MathJax-Latex Plugin Options:


Enable "Use MathJax CDN Server" and save the changes

You can now use regular LaTeX code within your post:

[latex] S = \frac{1}{(1 - P) + \frac{P}{N}}\leq\frac{1}{1-P} [/latex]

will be typesettet as

\(S = \frac{1}{(1 – P) + \frac{P}{N}}\leq\frac{1}{1-P}\)

For a more detailed explanation, have a look at the plugin’s description.

Of course, there are quite a few other CDNs, that will typeset your LaTeX formulas. But usually, they just render an image that can be embedded in your post or use flash.
The main advantage of MathJax is that you get your formula as scalable instance that will fit nicely even if you resize your text. You can also access a formula’s source and copy and paste it into your math application (like Mathematica). Have you tried right-clicking the formula above?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.