Extension:MathJax

Updated
The extension has now been updated for MediaWiki 1.18.2 and MathJax 2.0 and some small modifications were made.

What is this?
Extension:MathJax enables MathJax (http://www.mathjax.org/), a Javascript library, for typesetting TeX and LaTeX formulae in MediaWiki inside math environments. The following math environments are defined for inline style math: And the following math environments are defined for display style math: MathJax produces nice and scalable mathematics, see their website (http://www.mathjax.org/) for a demonstration. This extension also enables the usage of  and   tags with automatic formula numbering. If needed you can still hand label by using.
 * and
 * and
 * and
 * and
 * and

Usage
This extension allows for typical LaTeX math integration. For example: (Which comes from a preprint of Jon M. Borwein, Dirk Nuyens, Armin Straub, and James Wan. Random walk integrals.)

This renders as http://www.cs.kuleuven.be/~dirkn/Extension_MathJax/MathJaxExample.png.

An alternative for the default + math handling
If you but still want to render math, then this extension could be a solution for you.
 * don't want to use  because you
 * want scalable nicer mathematics,
 * the comfort of a real LaTeX like environment,
 * transparent backgrounds, or
 * find having LaTeX on your server too inconvenient; or
 * can't use
 * as you have trouble configuring and compiling, or
 * can't easily write png files (because of ) or
 * for some other reason,

Note that you could as well load the MathJax JavaScript library by customizing your WM skin or account, but there is still one major advantage of this extension over such a method: E.g., writing $$ \sum f(x) = F(x) + g(x) $$ does what you want it to do using this extension, but not when using a customization method as the whitespace at the beginning of line 2 will make WM introduce a  tag and thus break the formula environment for MathJax.
 * this extension allows you to use as many whitespace in your formula as you want.

Installation instructions
To install Extension:MathJax you need to put the  code on your server as well as a MathJax Javascript configuration file:. These files should be placed in a directory called  from the root of your MediaWiki installation. To enable the extension you then need to modify your  MediaWiki configuration file: add the following to LocalSettings.php: require_once("$IP/extensions/MathJax/MathJax.php"); The MathJax library will be used over the CDN, so you do not have to install MathJax yourself. (You still could: read the documentation in .)

It doesn't matter if you have  set to   or  ; Extension:MathJax will take over rendering of the standard   math tags.

Changelog

 * 0.5 (20101116)
 * Initial public release.


 * 0.5.1 (20101201)
 * Modifications to allow integration with Extension:Semantic_MediaWiki.
 * Compatability code for Parser::MARKER_SUFFIX added.


 * 0.5.2 (20110203)
 * Kind of revert move away from the markers used by MW as it does no really matter which ones we use (so no need for the SMW fix from 0.5.1 anymore).
 * Allowed \label and \tag at the same time as one would expect.
 * Added clickable links for the formula references, this currently assumes the used label or tag is a valid XHTML id.


 * 0.5.2b (20110215)
 * Removed redundant comma's in the MathJax configuration hub file to please IE...


 * 0.6 (20120418)
 * Updates for MediaWiki 1.18 (tested with 1.18.2) and MathJax 2.0, amonst others incorporating a patch from EvanChou (thanks!) and the CDN modification of Evan. This is mainly a maintenance update to get the extension back on track for 1.18.2.