Installing Extension:Math with LaTeX rendering engine

From Fyzix
Jump to: navigation, search

Reference: http://www.mediawiki.org/wiki/Extension:Math#Installation

Download source

cd /var/www/wiki/extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git

Server-side rendering with LaTeX

Prerequisites

apt-get install build-essential texlive texlive-bibtex-extra texlive-font-utils texlive-fonts-extra texlive-latex-extra texlive-math-extra texlive-pictures texlive-pstricks texlive-publishers dvipng gsfonts make ocaml ploticus

Compile texvc

cd /var/www/wiki/extensions/Math/math
make

Add to LocalSettings.php

Add the following code to the bottom of LocalSettings.php

/var/www/wiki/LocalSettings.php

# Math Extension parameters
require_once "$IP/extensions/Math/Math.php";
$wgUploadPath = "{$wgScriptPath}/images";
$wgUploadDirectory = "{$IP}/images";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

Create directory structure

mkdir -p /var/www/wiki/images/math
mkdir -p /var/www/wiki/images/tmp

Fix permissions

Change ownership to www-data users.

cd /var/www
chown -R www-data:www-data wiki

Make Images globally accessible.

chmod 777 -R /var/www/wiki/images

Run update script

Reference: http://www.mediawiki.org/wiki/Manual:Update.php

cd /var/www/wiki/maintenance
php update.php

Verify Installation

Browse to "Special:Version" on your wiki to verify the extension is successfully installed.

Example:

http://hostaddress/wiki/index.php?title=Special:Version

Testing

 <math>
  \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}}
 </math>