# Extension:MathJax

Jump to: navigation, search
The "MathJax display engine" is used experimentally on Wikimedia wikis BUT in combination with the Math extension and not with the MathJax extension documented on this page! If you want to give the "MathJax display engine" on the Wikimedia sites a try you can set this up in your preferences.
MediaWiki extensions manual
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) Dirk Nuyens (Dirk Nuyenstalk)
Latest version 0.7 (2013-04-22)
MediaWiki 1.18+
Database changes No
License GPLv3
Download See external source

Translate the MathJax extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

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:

• $...$ (can be turned off, even per page),
• $$...$$ and
• $...$.

And the following math environments are defined for display style math:

• $$...$$ (can be turned off, even per page),
• $...$,
• \begin{...}...\end{...} and
• :$...$.

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

• Download and extract the file(s) in a directory called MathJax in your extensions/ folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository.
• Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/MathJax/MathJax.php"; /** There is a bug in Extension:MathJax with MediaWiki 1.19.0, 1.20.0 and 1.21.1 * If you are using any form of PHP caching on your wiki and you have setup * your wiki to use variable caching like$wgMainCacheType = CACHE_ACCEL;
*   you could encounter issues with rendering of formulas.
*   If so uncomment the last line.
*/

In standard mode math handling on mediawiki is done using texvc from Extension:Math. But, if you

• don't want to use texvc because you
• want scalable nicer mathematics,
• miss the comfort of a real LaTeX like environment,
• find having LaTeX on your server too inconvenient (or a security risk); or
• can't use texvc
• as you have trouble configuring and compiling, or
• can't easily write png files (because of safe_mode) or
• for some other reason,

but still want to render math, then this extension could be a solution for you.

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

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:

• this extension allows you to use as much white space in your formula as you want.

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 <pre> tag and thus break the formula environment for MathJax.

## Known issues

• The following will render incorrectly $a<b\&d>c$ as Sanitizer::removeHTMLtags is executed in between the ParserBeforeInternalParse and InternalParseBeforeLinks hooks. A solution is to add a space as in $a<b \& d>c$.

## See also

Language: English  • русский