Hacking Wikimedia Tex

This page is in english and explains how to hack wikimedia and show LaTex on a shared host.

I am writing this because I had a hard time finding the information, I found in on google's catch of an old forum which does not exist outside google's catch. Therefore I am writing this, maybe posting it on mediawiki.org later.

  1. Install wikimedia and make it work.
  2. Take a backup, things might get dirty!
  3. Find LaTex engine
    1. if you have cgi support on your host install mimetex can be found on: htto://www.forkosh.com/mimetex.html (there's also precompiled onthe page).
    2. If you don't have cgi support use a public mimetex server: http://www.forkosh.com/mimetex.cgi? (Found at http://www.forkosh.com/mimetex.html)
  4. Open Math.php in $WikiPath/includes/Math.php and find this functions:
function renderMath( $tex ) {
   global $wgUser;
   $math = new MathRenderer( $tex );
   $math->setOutputMode( $wgUser->getOption('math'));
   return $math->render();
}
Replace it with
function renderMath( $tex ) {
   global $wgUser;
   $math = new MathRenderer( $tex );
   $math->setOutputMode( $wgUser->getOption('math'));
   ###Hacking Math.php
   #return $math->render();
   return "<img class='tex' src=\"http://your_host/cgi-bin/mimetex.cgi?$tex\" alt=\"LaTex: $tex\">";
}

Where http://your_host/cgi-bin/mimetex.cgi? is the adresse of you mimetex installation or the public one.

Then enable Tex in LocalSettings.php


Remember this is not an official wikimedia hack, and may not work with some versions, I've tried version 1.5.5.