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:

math

 

And there is a lot of more advances latex formulas you can use.

Install Mediawiki Math Extension

  1. Download Mediawiki Math Extension from  here. Choose the newest stable version and press Continue.
  2. Copy the content of the packed file into a folder called “Math” in the Extension directory of your Mediawiki installation.
  3. Copy the following line to the bottom of your LocalSettings.php file.
    require_once( "$IP/extensions/Math/Math.php" );
    
    
  4. Then navigate to your website to the adress:
    http://www.yourwiki.com/wiki/mw-config/
  5. This is the installation and update script. Select your language and click continue.
  6. 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.

  1. Open LocalSettings.php and change the following settings:
    $wgUseMathJax = true;
    $wgDefaultUserOptions['math'] = MW_MATH_MATHJAX;
  2. Then add the following line:
    $wgMathValidModes[] = MW_MATH_MATHJAX;
  3. 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:

math

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.

 

0 0 votes
Article Rating

Andreas Andersen

Forfatter og grundlægger af IT-blogger.dk, der har blogget om IT-emner siden 2012. Findes på Mastodon på @aphandersen@ansico.dk

Abonner
Giv besked ved
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x