Extension:WikiTex/Installation

WikiTex Installation and Source code

The worker program
This external program is called with three arguments: texconvert The worker program should erase and not create the picture if there is any error in the TeX file. Otherwise the output should be OK:12.34 where the number after OK is the depth of the formula below the base line measured in points. See the Extension:WikiTex/Documentation for a description how the TeX file was prepared.
 * texfile is a fully qualified random filename without extension which contains the plain tex file to be processed. It resides in a directory which is writeable by the process, thus a temp directory can be generated there. (Very handy as TeX loves to leave a lot of garbages around.)
 * dpi is the resolution for the generated picture; the default is 120.
 * resultpicture is the fully qualified filename without the .png extension where the resulting png picture should be generated. The picture might exist prior to the call.

The bash script below makes calls to tex and dvipng. On a debian based linux distribution (such as UBUNTU) you can get these programs by issuing sudo apt-get install tetex-bin tetex-base tetex-extra dvipng If you have math extension enabled on your wiki, with all probability TeX is installed. Locate and change the location of these program in the script below.

The extension program
Cut and copy the program below into the extension directory just below your main Mediawiki files, and name it ''WikiTex.php".

LocalSettings.php
Put the following line somewhere at the end in your LocalSettings.php file: require_once( "extensions/WikiTex.php" );

Default CSS file
Formula numbers in displayed formulas use a special CSS setting which should be defined. Edit, as sysop, the MediaWiki:Common.css file. CSS placed there will be applied to all skins. Add the following CSS:

Default Tex Include file
Predefined macros will be prepended to the text. Edit the file MediaWiki:TexInclude as a sysop where you can define the most frequently used LaTeX macros. In the example below the \frac, \mathcal, \frak, and \mathbb is defined. The macro \eqno is used as formula numbering, and should be defined to avoid TeX complains. Other tips and tricks are in Extension:WikiTex/Documentation.