Extension:Math/en

The Math extension provides support for rendering mathematical formulas on-wiki via texvc and other backends. An overview of what can currently be done with this extension is found at the English Wikipedia's documentation.

Installation
Alternatively, multiple linux distributions provide this extension as packages, see Comparison of extensions in distributions.

Installation requirements Mathml/LaTeXML

 * Set "$wgMathDisableTexFilter = true;" in your LocalSettings.php or compile texvccheck (it comes already built for linux mediawiki math packages):


 * Note if MW_MATH_MATHML or MW_MATH_LATEXML are selected at a later stage, the mediawiki database update script must be rerun (to prevent a "database query error has occurred" error)

Configuration settings
Text mode displays math as the raw LaTeX source. This may be useful for troubleshooting or for text only browsers. Text mode is enabled as an option by default, as MW_MATH_SOURCE in $wgMathValidModes.

Client-side rendering with MathJax
From 1.19/1.20, the Math extension supports rendering via MathJax, a client-side JavaScript library for parsing latex or mathml code and producing in-browser representation using the browser's native support for HTML+CSS, or MathML, or SVG.

This can render math expressions more sharply (using subpixel antialiasing) and larger (scaling up for zoomed view, printing, or high-resolution screens).

Set $wgUseMathJax to enable MathJax rendering mode; it is still somewhat experimental. Users will have a check box on their preferences that will enable MathJax, or set MathJax to the default mode as shown below.


 * Settings (Math 1.1 // MW 1.19 - 1.22)


 * Settings (Math 1.2 // MW 1.23+)

How to modify the MathJax contextual menu?

Server-side rendering with Mathoid (MathML)
Beginning from Math 1.2 // MW 1.23+ you can use a Mathoid server that uses MathJax to convert texvc input on the server side to MathML+SVG rendering. Mathoid is the rendering mode that is going to be used on future Wikipedia. For that the following settings are recommended:

Check out Mathoid to find instructions how to run your own Mathoid server. After enabling the MathML rendering mode you have to run the database update script again to create the required table.

Server-side rendering with LaTeXML
A convenient option to render LaTeX is to use the LaTeXML web service. This service converts LaTeX to high quality MathML.


 * Settings (MW 1.22) most or all of the 1.23+ settings also work


 * Settings (Math 1.2 // MW 1.23+)

A short guide to install LaTeXML on your own server can be found here: Install LaTeXML

After enabling the LaTeXML rendering mode you have to run the database update script again to create the required table.

Local LaTeX image rendering
Local LaTeX image rendering (default in Math 1.0, 1.1), is now deprecated.

Installation requirements

 * If mediawiki does not have write permissions to $wgUploadDirectory, see config items below $wgMathPath $wgMathDirectory $wgMathPath.
 * give your webserver write permissions to these folders (e.g. sudo chown -R www-data:www-data *)
 * Compile texvc (it comes with linux mediawiki math packages):

List of all configuration settings
The following variables can be defined in LocalSettings.php after calling :

Purging pages that contain equations
Specifying the URL-parameter action=purge does not force the math equation to re-render the math tags. If a complete re-rendering of the math tags is desired the URL-parameter action=purge&mathpurge=true has to be passed. Be aware that this might cause side effects with other pages since the math extension uses the hash of the input TeX-input-string as the caching key. e.g. if you would force the re-rending with mathpurge option for a page containing the equation $E=mc^2$, the new rendering result would be used on all other pages containing $E=mc^2$ after the individual page caches are invalidated.

Error reporting
If something is wrong with the math extension you can report that at bugzilla. In addition you should check how your problem relates to the automated unit tests that are generated from the page CoverageTest.

MathJax errors
MathJax has more bugs than latex. So please check it it's an MediaWiki Bug or a MathJax problem. If it's a MathJax problem that has been fixed you might consider to port the change to MediaWiki version of MathJax. Therefore a development environment is required. Just cherrypick the change from MathJax and apply it to the modules/MathJax folder in the Math extension. Afterwards you can submit your change for review.

History
The Math extension was a part of the core MediaWiki software until MediaWiki 1.18. See the related bug #14202 on Bugzilla.

MW_MATH_MATHML/MW_MATH_LATEXML was implemented to perform MathML generation instead of texvc because texvc is very poor at creating MathML. See the historic option "MathML if possible (experimental)".