Jump to: navigation, search

If you are looking for information on the <math> syntax, see MetaWiki:Help:Formula . Other ways of rendering math in Mediawiki are listed here.

MediaWiki supports embedding mathematical formulas using TeX syntax in <math> tags.

Installation[edit | edit source]

To use TeX formulas in MediaWiki 1.18 and higher, you have to install the Math extension and build the texvc program, which uses LaTeX to render the formulas. It is located in the extensions/Math/math directory in your MediaWiki installation directory, see Manual:Enable TeX and the README file in that directory for instructions. When the texvc program is built, you have to enable it by adding the extension to your LocalSettings.php file.

In MediaWiki 1.17 and earlier, the texvc program is included in the main distribution under the math subdirectory. When the texvc program is built, you have to enable it using the $wgUseTeX setting.

Usage[edit | edit source]

Once texvc is installed, end users can enter LaTeX formulae between <math> tags in the wikitext of any page.

If texvc is not installed, the graphics output is not visible, and you will see a red-coloured error message text instead.

An extensive user guide with examples of LaTeX output produced in this manner can be found here: MetaWiki:Help:Formula . One example follows here for completeness:

  \operatorname{erfc}(x) =
  \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2}\,dt =
  \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n)!}{n!(2x)^{2n}}


   \operatorname{erfc}(x) =
   \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2}\,dt =
   \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n)!}{n!(2x)^{2n}}

Configuration[edit | edit source]

The behavior of the tools that support the <math> tag can be changed by various configuration settings. Visit the TeX section of the configuration settings page for more details.

Issues[edit | edit source]

Changes in $wgTexvcBackgroundColor not reflected in existing images[edit | edit source]

The $wgTexvcBackgroundColor configuration variable sets the global background color for formulas generated from the contents of <math> tags.

Changes to the value of $wgTexvcBackgroundColor will not be reflected in formulas that have already be generated. An untested way to deal with this issue is to remove the existing generated images and force MediaWiki to generate new images.

First, ensure that $wgMathCheckFiles is set to true.

Next, move the image files for formulas that have already been generated to another directory. (You could simply delete the files, but moving is safer.) Check the $wgMathDirectory configuration variable to find the path to this directory.

The formulas generated from the <math> tags should display as broken images. If this is not the case, try clearing the cache for the page.

To re-generate the formulas from the <math> tags, you'll need to save each page that has a <math> tag on it.

A discussion on this issue can be found on the Mediawiki-l mailing list here Note: This is rather inconvenient. Zakgreant is researching better options for this issue.

Language: English  • Deutsch • русский