MediaWiki math rendering support

To enable the MediaWiki math rendering engine, perform the following steps:

Install the mediawiki-math package and a couple of other dependancies

apt-get update
apt-get install mediawiki-math texlive-latex-extra dvipng

Create the math image and temp directories and change ownership to the web server user

mkdir -p /var/lib/mediawiki/images/{math,tmp}
chown www-data:www-data /var/lib/mediawiki/images/{math,tmp}

Add the following to /etc/mediawiki/LocalSettings.php or /etc/mediawiki/extensions.php

# Math engine
$wgUseTeX = true;
$wgUploadPath = "/images";
$wgUploadDirectory = "images";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

Enable the extension and update MW DB

mwenext Math.php
php /usr/share/mediawiki/maintenance/update.php 

Go create your math formulas...

Note: if you added the above to /etc/mediawiki/extensions.php you might have to clear mediawiki page cache.

More resources:


Neil Parker's picture

I followed the above instructions but math rendering is not working. Help !

Jeremy Davis's picture

And confirmed working on TKL v13.0 Mediawiki appliance! :)
Neil Parker's picture

Many thanks - my test page is now displaying the square root of 2 correctly so I'm as excited as this Babylonian author:

DrLulz's picture

I followed the instructions, and confirmed the installation of texvc, but raw tags are being displayed.

The troubleshooting page only askes to check the below, however, its already there per the instructions.

$wgUseTeX = true;