Thanks everyone for the help. I have finally got the math support on my wiki working.
I have written a summary of what I have learned. I think it would be useful to post it on
the MediaWiki documentation pages, but I'm not sure where to create the page for it.
Could someone who is more familiar with the structure of the documentation pages please
create it, or suggest where to put it?
Here is my summary. I don't claim to understand everything perfectly, but it's
got to be better than the meager documentation which currently exists. In particular,
I'm not sure of exactly what modules are required at each step in the process, but I
guessed.
==Math Support in MediaWiki==
These instructions assume that the wiki is otherwise operational. See other instructions
for installing the wiki. For examples of mathematical expressions and the syntax for
writing them within a wiki see
http://meta.wikimedia.org/wiki/Help:Formula
The math support for MediaWiki requires several modules to be installed, and tex
processing to be enabled. It is designed to be run on Linux, and may not run on other
operating systems.
==How Math Support Works==
Here is an outline of how the math support works - several steps are involved, and a
problem could arise if any one of the steps is broken or missing.
Step 1: recognize that the <math></math> tags are special
requires: Tex processing enabled in LocalSettings.php file
Step 2: convert expressions between <math></math> tags to .tex files
requires: texvc
Step 3: convert .tex files to .dvi files
requires: texvc, latex
Step 4: convert .dvi files to .ps files
requires: texvc, dvips
Step 5: convert .ps files to .png files
requires: texvc, ghostscript, convert, ImageMagick
Step 6: display png files on page
requires: texvc
--
Alternatively, texvc can output mathematical expressions as HTML or MathML instead of as
PNG images.
==Installation==
Steps that must be done:
1) Enable Tex proccessing in LocalSettings.php file:
In the LocalSettings.php file there should be these lines:
## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
# $wgUseTeX = true;
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
Uncomment that $wgUseTeX line.
2) Install texvc
The texvc source code is included with the MediaWiki software, in the math subdirectory.
It requires OCaml 3.06 or later in order to compile. There are two options for installing
it:
i) compile it yourself, and leave it in the math subdirectory
OR
ii) download the precompiled binary and put it in the math subdirectory
A precompiled binary for Linux/x86 is available for download at:
http://prdownloads.sourceforge.net/wikipedia/texvc-linux-x86-20040107.tar.g…
The file is "texvc" without a file extension. Make sure it has the executable
bit set. (That is, the permissions are set to allow it to execute.)
3) Install any further modules that are required, and that are not already installed.
This includes TeTeX, Ghostscript, ImageMagick, and AMS fonts.
TeTex
http://www.tug.org/teTeX/
Ghostscript
http://www.ghostscript.com/
ImageMagick
http://www.imagemagick.org/
AMS fonts
http://www.ams.org
==TroubleShooting==
Troubleshooting mostly consists of checking to see if the correct things are installed.
Here are some things to try.
1) if you do not have command line access, you can check the availability of commands by
uploading a PHP file with this code to your wiki directory. The commands 'latex',
'dvips', 'gs' and 'convert' must be installed and in the PATH.
The path for each command should appear when you view the PHP file in your browser. If it
is missing, then chances are the module is not installed correctly.
<?php
header("Content-type: text/plain");
echo "latex is at: ";
system("which latex");
echo "dvips is at: ";
system("which dvips");
echo "convert is at: ";
system("which convert");
echo "gs is at: ";
system("which gs");
?>
2) check the subdirectories 'math' and 'tmp' in the upload subdirectory
(usually 'images') to see if they contain any files. Sometimes if the conversion
process halts at a certain step, files of that type will remain in the 'tmp'
directory. PNG files for mathematical expressions are stored in the 'math'
directory, once they have been created.
3) check to see if the version of Ghostscript you're using has a conflict with
ImageMagick. Versions of Ghostscript later than 7.05 may have problems. See this bug
report:
http://ghostscript.com/pipermail/bug-gs/2002-July/001451.html
Ellen