LaTeX on a shared host

It is possible to run LaTeX under a shared host. It might not be beautiful, but it works. If you wish to do this, be aware that this is not an official hack.

I am writing this because I had a hard time finding the information. I found it on google's cache of an old forum which did not exist outside google's cache. Therefore I'm writing it here, so that other people might also find it.


 * 1) Install MediaWiki
 * 2) Take a backup of your MediaWiki installation.
 * 3) Find a LaTeX engine:
 * 4) If you have CGI support on your host install mimeTeX, which can be found at: http://www.forkosh.com/mimetex.html
 * 5) If you don't have CGI support, use a public mimeTeX server: http://www.forkosh.com/mimetex.cgi or http://www.forkosh.com/mathtex.cgi (for prettier rendering using mathTeX)
 * 6) Open Math.php (or Math.body.php on 1.18 and above) in $WikiPath/includes/Math.php (or Math.body.php) and find this function (at the bottom):

public static function renderMath( $tex, $params=array ) { global $wgUser; $math = new MathRenderer( $tex, $params ); $math->setOutputMode( $wgUser->getOption('math')); return $math->render; }

Add this line after the first line: return '';

Result:

public static function renderMath( $tex, $params=array ) { return ''; global $wgUser; $math = new MathRenderer( $tex, $params ); $math->setOutputMode( $wgUser->getOption('math')); return $math->render; }

Where http://www.example.com/cgi-bin/mimetex.cgi? is the URL of your mimeTeX installation or the public one.

Then enable TeX in LocalSettings.php

'''Remember this is not official, and may not work with some versions. I've tried version 1.5.5.'''
 * Also working on version 1.5.6 --80.62.185.50 00:03, 7 February 2006 (UTC)
 * Work fine on Mediawiki 1.6.3 --82.50.10.47 12:23, 17 April 2006 (UTC)
 * Commented out all existing lines of renderMath. $math and $wgUser are obviously not used in the patched version. This change has not been tested.  See page history for old version. --Archimerged 02:58, 27 May 2006 (UTC)
 * Tried on MediaWiki 1.12 and it does not work. Do you have a patch?
 * Works on my 1.12. I used the external mimetex server, cose I have problems with my cgi-bin.
 * Working on version 1.13.1 with external mathtex server.
 * Working on version 1.14 with external mathtex server.
 * Working on version 1.15.1 with external mathtex server.
 * Working on version 1.16.0, :) thanks alot for this great help
 * Working on version 1.17.0, using mathtex server and this fix

Mediawiki 1.18
In Mediawiki 1.18 there is no more script incl/Math. In 1.18 install Mediawiki:Math Extension seperately.Math.php is present in extensions/math/math.body.php. Replace the function renderMath here and it works.


 * You may set the server running the mathtex or mimetex cgi script by setting in LocalSettings.php e.g.
 * $wgTrustedMathMimetexUrl = 'http://localhost/cgi-bin/mimetex.cgi?';