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.

Find a LaTeX engine

 * If you have CGI support on your host install mimeTeX, which can be found at: http://www.forkosh.com/mimetex.html.
 * 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).


 * Download Extension:Math and place the files in extensions/Math
 * Add the following line to your LocalSetting.php:

Do the code changes described below, then set the server running the mathtex or mimetex cgi script by setting in LocalSettings.php e.g.

MediaWiki 1.20
On MediaWiki 1.20 and shared hosting:

The function then looks as follows:
 * Add the following line to the function renderMath in the file extensions\Math\MathRenderer.php:

This has been successfully tested on 1.20.2 - --Tosfos (talk) 23:54, 13 December 2012 (UTC)

MediaWiki 1.19
The function then looks as follows:
 * Add the following line to the function renderMath in the file extensions\Math\Math.body.php:

This has been successfully tested on 1.19.2 - Stefahn (talk) 23:24, 4 December 2012 (UTC)

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

Older than 1.18 MediaWiki
Open Math.php 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