Extension:MathJax
Other languages:  English 

MathJax Release status: beta 


Implementation  Extended syntax 
Description  Allows math rendering for TeX/LaTeX with the JavaScript library MathJax, including LaTeX style formula references. 
Author(s)  Michaël Peeters hbshim Dirk Nuyens (for ver <0.7) (xeyownt^{talk}) 
Latest version  1.1 (20190501) 
MediaWiki  1.26+ (tested on 1.27) 
License  GNU General Public License 3.0 
Download  GitHub:
Note: 
Translate the MathJax extension if it is available at translatewiki.net  
Check usage and version matrix. 
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<math>...</math>
.
And the following math environments are defined for display style math:
\[...\]
,\begin{...}...\end{...}
and:<math>...</math>
.
MathJax produces nice and scalable mathematics, see their website (http://www.mathjax.org/) for a demonstration. This extension also enables the usage of \label{}
and \eqref{}
tags with automatic formula numbering. If needed you can still hand label by using \tag{}
.
Installation[edit]
 Download and place the file(s) in a directory called
MathJax
in yourextensions/
folder.
 Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'MathJax' ); # Change default font size (default: 100) #$wgMjSize = 100; # Use local MathJax installation (default: false, use CDN) #$wgMjUseCDN = true;
 Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To users running MediaWiki 1.24 or earlier:
The instructions above describe the new way of installing this extension using wfLoadExtension()
. If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'MathJax' );
, you need to use:
require_once "$IP/extensions/MathJax/MathJax.php";
Comparison with previous versions[edit]
It seems that almost all functionality of previous version, especially auto numbering and equation referencing, can be directly implemented by MathJax. This extension simply keeps math expressions in an article from parsed by MediaWiki so that MathJax could do the last minute rendering.
Following the previous versions by Dirk Nuyens, I kept <nomathjax></nomathjax> tag that actually is nothing but <span class="tex2jax_ignore"></span> from MathJax with the code inside being parsed as usual.
The dollar($) symbol in nonmathematical context can be escaped as \$.
Usage[edit]
This extension allows for typical LaTeX math integration, with the exception that single dollar $
must be replaced with double dollars $$
.
For example:
<! some LaTeX macros we want to use: >
$$\newcommand{\Re}{\mathrm{Re}\,}
\newcommand{\pFq}[5]{{}_{#1}\mathrm{F}_{#2} \left( \genfrac{}{}{0pt}{}{#3}{#4} \bigg {#5} \right)}$$
We consider, for various values of $$s$$, the $$n$$dimensional integral
\begin{align}
\label{def:Wns}
W_n (s)
&:=
\int_{[0, 1]^n}
\left \sum_{k = 1}^n \mathrm{e}^{2 \pi \mathrm{i} \, x_k} \right^s \mathrm{d}\boldsymbol{x}
\end{align}
which occurs in the theory of uniform random walk integrals in the plane,
where at each step a unitstep is taken in a random direction. As such,
the integral \eqref{def:Wns} expresses the $$s$$th moment of the distance
to the origin after $$n$$ steps.
By experimentation and some sketchy arguments we quickly conjectured and
strongly believed that, for $$k$$ a nonnegative integer
\begin{align}
\label{eq:W3k}
W_3(k) &= \Re \, \pFq32{\frac12, \frac k2, \frac k2}{1, 1}{4}.
\end{align}
Appropriately defined, \eqref{eq:W3k} also holds for negative odd integers.
The reason for \eqref{eq:W3k} was long a mystery, but it will be explained
at the end of the paper.
(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.
Change log[edit]
 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 <nomathjax>, 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__.
 1.0 (2015)
 Version before archival in 2017.
 1.1 (20190601)
 Restored. Update for MediaWiki 1.27, using script loading method done in extension Extension:SimpleMathJax. Disable support for
$...$
. Use Cloudflare CDN by default. Configuration parameter for font size.
See also[edit]
 Extension:JsMath: Predecessor of MathJax (uses jsMath)
 Extension:SimpleMathJax
 r112835: Brion's Extension:Math comes with an experimental MathJax 2.0 implementation, but no further LaTeX constructs.