TurnKey Linux Virtual Appliance Library

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:


Guest's picture

Math rendering

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

Jeremy's picture

Content updated

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

Maths rendering

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


Guest's picture

Raw Tags Displayed

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;