Extension:PhpMathPublisher alternative

PhpMathPublisher is an alternative which needs only PHP with the GD library and some fonts. No need for LaTeX or CGI, the latter is needed for the Mimetex alternative. (Also the graphical output looks better.)

PhpMathPublisher can be found at.

How to install PhpMathPublisher as an extension
MediaWiki and PhpMathPublisher need to be installed of course. (This has been tested with MediaWiki 1.6.10 and PhpMathPublisher 0.3.) Save the text below, which is an adaption of the Mimetex extension, in a file called phpmathpublisher.php and put the file into your extension folder.

setHook( "m", "render_PhpMathPublisher" ); }

/** function render_PhpMathPublisher($input, $argv, $parser = null) {
 * Renders $text in PhpMathPublisher

if (!$parser) $parser =& $GLOBALS['wgParser']; // $img_url is the url the PhpMathPublisher will be sent to. // IMPORTANT!! The URL below should be the link to YOUR PhpMathPublisher directory $img_url = "http://urltowhereyouputthephpmathpublisherfiles/rendermaths.php?message=".$input.""; // Sets the output of the tex tag using the url from above. $output = " ";

return $output; } ?>

and add the line:

require("extensions/phpmathpublisher.php");

to the end of your LocalSettings.php file in your MediaWiki root directory.

Now you can output PhpMathPublisher syntax with ... tags. To put those tags into your Edit Toolbar, edit Editpage.php in your /includes/ directory. (You should make a backup of this file first just in case.)

Search for the following lines: array(	'image'	=>'button_math.png',	'open'	=>	"\\",	'close'	=>	"",	'sample'=>	wfMsg('math_sample'),	'tip'	=>	wfMsg('math_tip'),	'key'	=>	'C' And replace them with: array(	'image'	=>'button_math.png', 'open'	=>	"\\", 'close'	=>	"\\", 'sample'=>	wfMsg('math_sample'), 'tip'	=>	wfMsg('math_tip'), 'key'	=>	'C'

Since this is an adaption of the Mimetex extension the code is also licensed under the GNU General Public License.