Extension:MathJax

The MathJax extension 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.
 * (can be turned off, even per page),
 * and
 * (can be turned off, even per page),
 * and
 * and

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

Configuration
Note: By default the extension is configured to use the MathJax CDN. The following are optional and must be placed after the :


 * : Location of the public javascript entry-point. By default this points to the MathJax CDN. If you don't want to rely on a third party, or can't share traffic information with a third party, you could install it locally: read the documentation in
 * : The MathJax configuration file to use, defaults to  that comes with the extension. This is a file you need to download and save as well.
 * : Disable the extension unless marked on the page to enable it by putting  somewhere. You can disable by using   on a wiki page.
 * : Turn on or off numbering and  linking by this extension, also by   and.
 * : Turn on or off processing of inline math delimited by dollar sign: . Also by   and.
 * : Turn on or off processing of display math delimited by double dollar sign: . Also by   and.

Easy configuration (using the MathJax CDN)

 * This is the default

By default the MathJax library will be loaded from the MathJax CDN, so you do not have to install the MathJax library (not to confuse with the MathJax MediaWiki extension) yourself.

MathJax also provides a CDN over HTTPS, see http://www.mathjax.org/docs/2.0/start.html#secure-access-to-the-cdn for the current URL. To use it set  to the provided url in LocalSettings.

Installing locally

 * 1) Acquire the MathJax files as described here in the section 'Downloads for Local Installation'. In this example, we'll assume you placed it in  . Go to   in your web browser to see that the installation works.
 * 2) Add this configuration after the   line in your LocalSettings file:

Usage
This extension allows for typical LaTeX math integration. For example: (Which comes from a preprint of Jon M. Borwein, et. al. Some arithmetic properties of short random walk integrals.)

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

MathJax 2.0
The extension has been updated for MediaWiki 1.18.2 and MathJax 2.0 and has undergone a complete rewrite. Changes include:
 * Per page control of options (e.g., turn on or off parsing of ).
 * New  tag to exclude certain parts from MathJax.
 * Consistent numbering among different formula environments.
 * Numbering can be turned on and off.
 * Use of content delivery network for MathJax, this means you don't have to install MathJax yourself.
 * Zero configuration for default use (except including MathJax in your configuration).

Difference with the default + math handling
Note: The default Extension:Math now also includes experimental support for MathJax but only through the  tags.

In standard mode math handling on mediawiki is done using  from Extension:Math. But, 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,
 * find having LaTeX on your server too inconvenient (or a security risk); 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,

The main reason to use this extension is to have a natural way to write mathematics on your wiki without having to type  when you can just type.

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 much white space in your formula as you want.

Known issues

 * The following will render incorrectly  as   is executed in between the   and   hooks. A solution is to add a space as in.


 * This anonymous comment was placed here: "Our wiki had a page the had a dollar sign " $ " in it. When we installed MathJax the page refused to load.  I suspect that we need one of the parser functions in localsettings, but that should be clearly laid out in the install instructions. Please put comments and queries on the  Discussion page of this extension and be more specific." There is not enough information in this message to guess at what the problem is. My guess is that you either installed the extension with an older version of MediaWiki or with an older version of PHP installed. Please enable the extension once more and then check both the php error log and the webserver error log to see what is going on.


 * The work of this extension may interfere with the expansion MagnetLinks


 * The work of this extension may by make bad $wgArticlePath and $wgScriptPath. It see on Special.Pages

Change log

 * 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.


 * 0.7 (20120422)
 * Complete rewrite, $ and $$ can now be turned on and off, much better protection and detection, numbering is consistent among different environments, no global variables anymore (everything is now in one class), new tag, magic words to turn on and off features: __MATHJAX__ and __NOMATHJAX__ , __MATHJAX_NUMBER__ and __MATHJAX_NONUMBER__ , __MATHJAX_DOLLAR__ and __MATHJAX_NODOLLAR__ , and __MATHJAX_DOLLARDOLLAR__ and __MATHJAX_NODOLLARDOLLAR__.