MediaWiki + LaTeX + Bluehost
So I just thought I'd add a little information to what's already out there on getting LaTeX functionality added to your BlueHost MediaWiki.
My explanation below assumes that you have SSH access to your blue host account.
(1) Secure shell into your account.
The only programs that you will have installed on you BlueHost account are:
- ImageMagick
- Ghostscript
If you feel uncertain you can double check by typing
which gs
which convert
for which you should see something like:
/usr/bin/gs
/usr/bin/convert
You need to a workaround for LaTeX and dvips since neither of them are on the server. The solution for this is mimeTeX .
(2) Create directory where you would like to store mimeTeX, download the zip, and compile it, e.g.
mkdir ~/public_html/mimtex
cd ~/public_html/mimetex
wget http://www.forkosh.com/mimetex.zip
unzip mimetex.zip
cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi
(3) Now, double check the permissions on mimetex.cgi
ls -l mimetex.cgi
You should see a line starting with the permissions -rwxr-xr-x these are read write and execute permissions for the owner/group/everybody. If your output looks different change the permissions on this file by entering the command.
chmod 755 mimetex.cgi
(4) Move your newly created mimetex.cgi file into your cgi-bin.
mv mimetex.cgi ../cgi-bin
(5) Now we need to edit your Math.php file.
(5.1) Pick your favorite editor and open your YourMediaWikiDirectory/includes/Math.php file.
(5.2) Find the line that says public static function renderMath( $tex, $params=array() ) { and in the line below add
return '<img src="http://www.example.com/cgi-bin/mimetex.cgi?' . rawurlencode($tex) . '" alt="LaTeX: ' . htmlspecialchars($tex) . '" />';
Be sure to change http://www.example.com to your actual sites name. Also, Note: The above code is a single line of code but Wordpress has inserted breaks in it.
The renderMath function should now look like:
public static function renderMath( $tex, $params=array() ) {
return '<img src="http://www.example.com/cgi-bin/mimetex.cgi?' . rawurlencode($tex) . '" alt="LaTeX: ' . htmlspecialchars($tex) . '" />';
global $wgUser;
$math = new MathRenderer( $tex, $params );
$math->setOutputMode( $wgUser->getOption('math'));
return $math->render();
}
(6) In your MediaWiki installation directory go and edit LocalSettings.php so that the line $wgUseTeX = false; now reads $wgUseTeX = true;
(7) The last step is to add the texvc binary to your MediaWiki directories math directory.
(7.1.) If you have the option of compiling this from the source that's great, but BlueHost doesn't have OCaml installed. So you can download the pre-compiled binary from my site taylorgroves.com//download/texvc-linux-x86-20040107.tar.gz or sourceforge http://prdownloads.sourceforge.net/wikipedia/texvc-linux-x86-20040107.tar.gz?
wget http://prdownloads.sourceforge.net/wikipedia/texvc-linux-x86-20040107.tar.gz?
tar -xvf texvc-linux-x86-2004-01-07.tar.gz
mv texvc-linux-x86-20040107/texvc YourMediaWikiDirectory/math/
Be sure to replace YourMediaWikiDirectory with the appropriate name.
That should be it! Test it out by putting <math>\LaTeX</math> on one of your pages.
This is a compilation of resources including: