Install Math extension on Mediawiki
Mediawiki is the system that Wikipedia is build on – and it is free for all to use. With the math extension for Mediawiki, you can insert math formulas using Latex to your wiki posts. This means that if you enter this latex code:
<math>x=frac{-b+sqrt{d}}{2*a}</math>
This will be showed on your website like this:
And there is a lot of more advances latex formulas you can use.
Install Mediawiki Math Extension
- Download Mediawiki Math Extension from here. Choose the newest stable version and press Continue.
- Copy the content of the packed file into a folder called “Math” in the Extension directory of your Mediawiki installation.
- Copy the following line to the bottom of your LocalSettings.php file.
require_once( "$IP/extensions/Math/Math.php" );
- Then navigate to your website to the adress:
http://www.yourwiki.com/wiki/mw-config/
- This is the installation and update script. Select your language and click continue.
- Follow the remaining guide to update the database. When it ask for a “upgrade key” go to LocalSettings.php and find the key at $wgUpgradeKey.
Install MathJax
Normally you would compile the math extension, but this is not possible when you have a shared host (unless you use an external hosted compiler). Instead you can on shared hosts install MathJax, which use Javascript to represent the formula. MathJax is already installed on the Math extension, but it need to be activated.
- Open LocalSettings.php and change the following settings:
$wgUseMathJax = true;
$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX;
- Then add the following line:
$wgMathValidModes[] = MW_MATH_MATHJAX;
- Then save and upload the file.
Test Math Extension
Then you can test Math Extension by creating a new post and insert the following code:
<math>x=frac{-b+sqrt{d}}{2*a}</math>
If this gives the result below, then you have succesfully installed the extension:
You can of course also choose to compile the Math extension, which also would give you the formulas as PNG images, instead of just Javascripts. But I think that MathJax is a very elegant way to easy install the Math extension.