Extension:Math/advancedSettings
The Math extension provides support for rendering mathematical formulas onwiki via Mathoid and other backends. An overview of what can currently be done with this extension is found at the English Wikipedia's documentation.
ConfigurationEdit
Serverside rendering with MathoidEdit
Beginning from 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:
// ensure 'mathml'; is added to the $wgMathValidModes array;
$wgMathValidModes[] = 'mathml';
// Set Mathoid as default rendering option;
$wgDefaultUserOptions['math'] = 'mathml';
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.
Serverside rendering with LaTeXMLEdit
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
// Enable LaTeXML as rendering option
$wgUseLaTeXML = true; // this became an unused setting around 1.23
 Settings (MW 1.23+)
$wgMathValidModes[] = 'latexml'; // adding LaTeXML as rendering option
// Set LaTeXML as default rendering option;
$wgDefaultUserOptions['math'] = 'latexml';
// Specify the path to your LaTeXML instance that converts the \TeX commands to MathML (optional)
$wgLaTeXMLUrl = 'http://example.com/';
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.
Historical noteEdit
texvc used to be a rendering option before version 1.32. It is now completely replaced by Mathoid, but the subset of AMSLaTeX it supports remains the basis of this extension.
List of all configuration settingsEdit
The following variables can be defined in LocalSettings.php after calling require_once "$IP/extensions/Math/Math.php";
:
Setting name  Default value  Description 

$wgUseTeX  true

Backward compatibility global; no longer does anything. 
$wgTexvc  dirname( __FILE__ ) . '/math/texvc'

Location of the texvc binary (Removed in MW 1.32 due to texvc being gone.) 
$wgTexvcBackgroundColor  'transparent'

Texvc background color; use LaTeX color format as used in \special function. For transparent background use value 'Transparent' for alpha transparency or 'transparent' for binary transparency. (Removed in MW 1.32 due to texvc being gone.) 
$wgMathCheckFiles  true

Normally when generating math images, we doublecheck that the directories we want to write to exist, and that files that have been generated still exist when we need to bring them up again.
This lets us give useful error messages in case of permission problems, and automatically rebuild images that have been lost. On a big site with heavy NFS traffic this can be slow and flaky, so sometimes we want to shortcircuit it by setting this to false. 
$wgMathPath  false

The URL path of the math directory. Defaults to "{$wgUploadPath }/math". 
$wgMathDirectory  false

The filesystem path of the math directory. Defaults to "{$wgUploadDirectory }/math". 
$wgUseMathJax  false

Enables MathJax as rendering option. 
$wgMathJaxUrl  '$IP/extensions/MathJax/MathJax.js?config=TeXAMSMML_HTMLorMML'

The url to MathJax if not using the default default parser at http://cdn.mathjax.org/. 
$wgMathValidModes  [ 'png', 'source', 'mathml' ]

Defines the mode allowed on the server. 
$wgMathMathMLUrl  'https://mathoidbeta.wmflabs.org'

The url of the mathoid server. 
$wgMathMathMLTimeout  20

The timeout for the HTTPRequest sent to the MathML to render an equation, in seconds. 
$wgMathLaTeXMLUrl  'https://latexml.formulasearchengine.com/convert'

Use of LaTeXML.
If you want or need to run your own server, follow these installation instructions and override If you expect heavy load you can specify multiple servers. In that case one server is randomly chosen for each rendering process. Specify the list of servers in an array e.g:

$wgMathLaTeXMLTimeout  240

The timeout for the HTTPRequest sent to the LaTeXML to render an equation, in seconds. 
$wgMathDefaultLaTeXMLSetting  [
'format' => 'xhtml',
'whatsin' => 'math',
'whatsout' => 'math',
'pmml',
'cmml',
'mathtex',
'nodefaultresources',
'preload' => [
'LaTeX.pool',
'article.cls',
'amsmath.sty',
'amsthm.sty',
'amstext.sty',
'amssymb.sty',
'eucal.sty',
'[dvipsnames]xcolor.sty',
'url.sty',
'hyperref.sty',
'[ids]latexml.sty',
'texvc'
],
'linelength': 90
}

Setting for the LaTeXML renderer for details. 
$wgMathDisableTexFilter  'new'

Option to disable the tex filter. If set to true any LaTeX expression is parsed this can be a potential security risk. If set to false only a subset of the TeX commands is allowed. See Help:Displaying a formula for details. 
$wgMathEnableExperimentalInputFormats  false

Enables experimental MathML and AsciiMath input format support 
CSS for the MathML with SVG fallback modeEdit
By default, MathML is only exposed to accessibility tools. However, you can force visual rendering with the following MediaWiki stylesheets:
.mwemathmathmla11y {
clip: auto !important;
overflow: visible !important;
position: static !important;
width: auto !important;
height: auto !important;
opacity: 1 !important;
}
.mwemathfallbackimageinline,
.mwemathfallbackimagedisplay {
display: none !important;
}
You can then easily change the style of MathML formulas e.g. to set the math font:
.mwbody, mtext {
fontfamily: Latin Modern Roman;
}
math {
fontfamily: Latin Modern Math;
}
.mwbody,
is added to get the same font appearance for the entire article text. If you do not want to change your main font, then leave this out. Do not forget to remove the comma, as well!CSS for dark backgroundEdit
The Extension always renders formulae in black text by default, which can throw off users and wikis running a dark background color. A skin author can add the following code to invert the lightness of formula images using CSS filters:
.mwemathfallbackimageinline,
.mwemathfallbackimagedisplay {
filter: huerotate(180deg) invert(1);
}