LaTeX on mediawiki on a shared host
For a couple of weeks I have been trying hard to put my NereidesWiki to work on my website hosted at ixwebhosting, which is a shared host.
The idea behind this wiki was that it could be a place to start collecting ideas and things that I learn during my phd, so that, in the end, it would be easier to write down the thesis. Since it is a scientific related wiki it is mandatory that it is able to show mathematical expressions. MediaWiki is able to do that making use of texvc, LaTeX, dvips and convert from the ImageMagick software suit, the problem lies in configuring it.
Of course, at the first attempt it did not work and I sent a ticket to the host and they replyed with a kind: “we don’t support 3rd party software”. I was on my own. After googling alot I found that I had to start by putting texvc to work, that ment compiling it for the OS of the host. After too many tickets sent to them and too many live chats with them and with a help of a friend of mine, I managed to compile it. It did not work either. Later they told me they did not hat LaTeX nor dvips installed on the server.
I was about to give up, thinking “why isn’t there a service that one could use instead of going through all this trouble?”. Instead of running it locally on our own server, run LaTeX and dvips remotely on another server. Hopefully I found it: mimeTeX! Very simple to use. Here I show you how to do it, or you can follow the original link here:
- Install MediaWiki
- Take a backup of your MediaWiki installation.
- 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.dreamhost.com/mimetex.cgi or http://www.forkosh.dreamhost.com/mathtex.cgi (for prettier rendering using mathTeX)
- Open Math.php in $WikiPath/includes/Math.php and find this function:
1 2 3 4 5 6 | function renderMath( $tex ) { global $wgUser; $math = new MathRenderer( $tex ); $math->setOutputMode( $wgUser->getOption('math')); return $math->render(); } |
Replace it with:
1 2 3 4 5 6 7 8 | function renderMath( $tex ) { ###Hacking Math.php #global $wgUser; #$math = new MathRenderer( $tex ); #$math->setOutputMode( $wgUser->getOption('math')); #return $math->render(); return "<img src="http://blog.palha.org/wp-admin/%5C%22http://your_host/cgi-bin/mimetex.cgi?$tex%5C%22" class="tex" alt="\"LaTex:" />"; } |
Where http://your_host/cgi-bin/mimetex.cgi is the URL of your mimeTeX installation or the public one. I used a public one, and it works, at least with MediaWiki v1.11.1. Note that you must have texvc compiled, but that is not very difficult to solve.
February 1st, 2008 at 6:16 pm
Fogo pá… acho mal..tenho preguiça de ler o inglês por isso resume!!!
Jokas
February 6th, 2008 at 10:25 pm
Muito fixe isto do mimetex! e do mathtex!
Aproveito para deixar-te com este link similar no texify.com
http://www.texify.com/\frac{1}{2}$
Tambem aproveito para relembrar-vos do WebMathematica:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Main_Page
Vou fazer um javascript bookmark que permite facilmente escrever uma linha de latex e retornar a imagem…
Para consolidares podes sempre manter 2 blogs tematicos: 1 +pessoal e outro mais techy.
Abraços e continua a postar estas boas noticias
August 13th, 2011 at 5:14 pm
Thank you for writing one of the best informational articles I’ve read in a long time. You make sound points that I can relate to and grasp. This is great!