Extension talk:Math/Archive 2011 to 2014

From MediaWiki.org
Jump to: navigation, search


Difficulty Installing in Mediawiki 1.19.2, head version of Math extension incompatible, must use version from 2012-08-20

I have a freshly installed mediawiki with the following settings, as reported by the special version page.

Product Version
MediaWiki 1.19.2
PHP 5.3.10-1ubuntu3.4 (apache2handler)
MySQL 5.5.24-0ubuntu0.12.04.1

with only the math, and vector extensions enabled, and showing up on the special version page

I have successfully compiled texvc.

The problem comes about when I try to use the math extension. As soon as I try adding the following


to a page and try to save it I immediately get the error

Error resulting from using <math>\theta</math>

I have checked /var/log/apache2/error.log and found

[Thu Oct 11 15:53:25 2012] [error] [client]
 PHP Fatal error:  Call to undefined method TempFSFile::autocollect()
 in /home/cgeroux/public_html/notes/extensions/Math/Math.body.php on line 129,

It seems that some function definition is missing, but I have no idea why, I followed the installation instructions as closely as possibly but there are some gabs that I had to fill in with, which I think, were fairly reasonable assumptions.

The version of the math extension I downloaded is

author     Translation updater bot <l10n-bot@translatewiki.net>      
Sat, 6 Oct 2012 21:29:28 +0000 (21:29 +0000)
committer       Translation updater bot <l10n-bot@translatewiki.net>      
Sat, 6 Oct 2012 21:29:28 +0000 (21:29 +0000)
commit  5bbee223c4e3e2de7cb5a9b20298bb7ff0bb498b
tree    7453c887642980b34ca900523365f9d9423d70f8        tree | snapshot
parent  22a09c87d3895c6e23dab09539ff5887c24eb81f        commit | diff

I have read that this extension is incompatible with mediawiki 1.19.1, but what about 1.19.2? If not compatible with these version of media wiki, which version is it compatible with? I also found a link that said there was a version that was compatible with media wiki version 1.19, but the link didn't produce any downloadable version, or useful information. Is there a working version of the math extension for 1.19.2? This is a huge feature for me, without it, it almost makes mediawiki, for my purposes, useless (I working in a field that uses math formulas heavily). Any help with getting this extension working with mediawiki would be greatly appreciated.

I have also tried version 1.18.5 with similar errors. If this is a result of picking an unstable version of the extension from the head, perhaps a clear link to a stable version should be added to the download section of the extension page.

Cgeroux (talk) 21:27, 12 October 2012 (UTC)

After doing some hunting around I found that there was a fairly recent change on the git repository that had to do with added file backend support which seems to have added code which uses function calls to undefined methods, at least in mediawiki 1.19.2. After some googling, I found a Doxygen page for some version of mediawiki, which clearly showed function definitions for these missing functions. I am not sure which version of mediawiki it was as it didn't clearly indicate, perhaps it is an up and coming release.

author     Aaron <aschulz@wikimedia.org>     
Mon, 20 Aug 2012 22:11:16 +0000 (15:11 -0700)
committer       Aaron <aschulz@wikimedia.org>     
Thu, 23 Aug 2012 00:16:49 +0000 (17:16 -0700)
commit  ae9e0d989b744996ac2229b0dfeb740921f642f4
tree    ffe09c16ae00daa6dcb7bcf60b801bf876896e8b        tree | snapshot
parent  29a0a80e8fbb2d33507760075e4da9103439cbd9        commit | diff
Added file backend support via $wgMathFileBackend.
* Also removed old legacy migration code.
Change-Id: I43cfd7f0da49690a2d0b4eb2daab9b8a110137b7

after I went to a snapshot just before this commit it worked :). At least my simple <math>\theta</math> test worked. If it is simply a case of not picking the right version of this extension which is compatible with my mediawiki 1.19.2 install, it should really be much more clearly indicated which git snapshots are compatible with which mediawiki versions.

Cgeroux (talk) 21:45, 14 October 2012 (UTC)

How to retrieve a compatible version with 1.19.2

Thank you Cgeroux for your research. I was able to get Math running using your guidelines.

Here are the commands to get i work on 1.19.2.

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git
cd Math
git reset --hard 29a0a80e8fbb2d33507760075e4da9103439cbd9

Jgrocha (talk) 12:30, 15 October 2012 (WEST)

Thanks guys, this really helped me. Was also getting an error about "TempFSFile::autocollect". --Romanski (talk) 13:12, 18 October 2012 (UTC)
This solved the problem for me too (mediawiki 1.18) 19:27, 27 January 2013 (UTC)
This also save me a lot of time as well, I'm using (mediawiki 1.19.2). Thanks a lot!
This fixed my problem as well (1.19.2) Niubrad (talk) 03
24, 13 May 2013 (UTC)

About the old texvc

hi, I have compiled a texvc.exe when I used the version 15.1 of Mediawiki. it works very well. May I upload the former texvc.exe to my website of version 18.1? --Simonlsw (talk) 14:08, 15 March 2012 (UTC)

Would be great to have a place where you can define the absolute path for the various TeX functions

Math is calling among other the following TeX functions: dvips, latex, dvipng. It assumes that those functions are located in a directory on a web server which is loaded in the PATH of the web user (usr/bin). If this is not the case, the extension will give the following error message:

"Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert)"

I don't want to clutter up usr/bin by adding a symbolic links to each of the funcions so it would be nice to have a file where you can define a variable for the installation path of TeX (so before you actually do the 'make' command.
A work around (what I did) would be to edit the render.ml file and add the absolute path to the various dvips, latex and diving functions. But remember that you have to set this every time you update the math extension.

--Albert Ke (talk) 22:36, 27 February 2012 (UTC)

MathAfterTexvc Hook

I was wondering about the MathAfterTexvc hook. I downloaded MediaWiki 1.18, installed everything I needed and built everything. MediaWiki creates the .tex files using texvc and puts them in the directory I specified, but nothing else happens from there. I was looking in the PHP files and it calls MathAfterTexvc hook, but it seems there is no definition anywhere for that hook. Blahtex has that function, but I was under the impression that this extension would take the .tex file and call latex and dvipng somewhere to generate the PNG file. I can call latex and dvipng from the command line and generate the PNG, so I'm pretty sure I've got everything installed right. Is that hook the problem, or is it something else I've overlooked?

Mac OS X 10.6.8 (Snow Leopard), MAMP 2.0.5

--Capoeirista.muralha 14:24, 17 January 2012 (MST)

MathAfterTexvc was removed completely in version 1.18.0

this issue is an general issue, it has nothing to do with OS.

This feature was removed completely in version 1.18.0. pls refer to http://www.mediawiki.org/wiki/Manual:Hooks/MathAfterTexvc


Note about location of texvc during upgrade from Mediawiki 1.18 before extension

If you had customized the location of TeX parser in $wgTexvc in LocalSettings.php for previous version of this service, that global is not read in from the extension in Math.php so it complains about not finding texvc. The extension should check to see if the variable is already set in LocalSettings.php and use that value is present. Instead, that value is now hard coded in the extension. Ubuntu installed with Mediawiki math, for example, has the texvc file located at '/usr/bin/texvc'. One can manually set it, as a workaround, in Math.php in the extension.

Gary Anderson 01:20, 30 April 2011 (UTC)

It is sufficient to define $wgTexvc in LocalSettings.php after calling require_once("$IP/extensions/Math/Math.php"); --Moejoe000 07:41, 18 May 2011 (UTC)

Localization malfunction


I'm having some trouble when non-Englhish characters are place in formulas, like ç, á, ó, é and others. Is that a bug or is it possible for a simple user to fix that?

Thanks in advance.

Paulo.s.lima 13:11, 28 September 2011 (UTC)

Take a look on meta:Help:Displaying_a_formula#Rendering and bugzilla:798. Helder 12:03, 29 September 2011 (UTC)
I am interested in fixing this but being a native English speaker with little experience in latex'ing non-english formulas. I could use examples of things that should work. The current examples in the bug reports only international characters in \mbox{}'s. When I personally try to switch to a utf-8 input encoding and latex something like $$á$$ I get errors. Any thoughts welcome. Thenub314 16:58, 13 October 2011 (UTC)

Bugs and Roadmap and random thoughts

Feature Requests

3840 Looks for high math images printing. The only thoughts I have here are to switch form dvipng to dvisvg and use svg images which would look better at all scales and hopefully would print better. Related bugzilla:15777

4915 This bug looks to tweak the size of the images produced by texvc. I think this should simply be a WONTFIX. While it may look nice on his browser, at some scale. The real issue is to get the fonts of the math and the surrounding text to match. That would be a lot f work to make texvc do something like that. Mathml/Mathjax are better suited to these tasks.

5856, 10186 and 6722 are related to mhchem package. Users seem to be very interested in this. Perhaps this should looked into.

12223 Desperately needed and long overdue inline math tags. Probably would only make sense if base line issue is sorted out. Should we use a slightly smaller font for inline math? Not done in latex but may look nice on the web.

28258 It would be nice to have some commutative diagram packages. xy-pic may be a good option.

HTML Rendering

1594 Change the way - is rendered in HTML. Complication unary vs. binary minus are spaced differently, and not currently distinguished by texvc because automatically handled by LaTeX.

25645 Suggests we need a better algorithm for deciding about which mathematics is not render-able as HTML. Makes a good point, but rather nebulous and requires some thought.

10434 Don't italicize variables, but mark them as variables in HTML. Low priority, as it has no visible impact in most setups but is mostly a matter of "doing it right".

11663 Problems with ρ on safari browser, upstream seems to be a wontfix, actually it seems more of a "we do it right". Low priority.

Backwards compatibility issues

31442 Should be fixed now. Some non-standard LaTeX and AMS-LaTeX work under texvc. Must be careful not to break texvc features.

Security and Misc

6248 Permissions issues on some machines. Very old bug, not sure if it still an issue. Not clear which configurations should be tested to confirm/reproduce.

Visual Appearance Issues

15777 I have to agree this looks fairly bad. Curious if switching to dvisvg would straighten this out.

Can we move that to Extension:Math/Roadmap ? ... I'll just copy and paste it --Schubi87 (talk) 17:15, 17 April 2013 (UTC)

Script to generate test corpus

The following flex grammar run on a dump generates an XML document of use cases. It probably doesn't cover some corner cases and doesn't eliminate duplicates, but it should be useful to some developers interested in having a larger test corpus.

#include <stdio.h>
#include <stdlib.h>

int sampleCount;

%option outfile="gentestcorpus.c" nodefault noyywrap nounput noinput


MATHSTART   "&lt;math&gt;"
MATHEND     "&lt;/math&gt;"
.|\n    /* ignore */
{MATHSTART}   printf ("  <math>"); BEGIN(IN_MATH);
  {MATHEND}   { printf ("</math>\n"); if (--sampleCount > 0) { BEGIN(INITIAL); } else { yyterminate (); } }
  .|\n   ECHO;
int main (void)
    printf ("<?xml version=\"1.0\"?>\n\n<maths>\n");
    sampleCount = 1000;
    yylex ();
    printf ("</maths>\n");

    return EXIT_SUCCESS;

--Tim Landscheidt 18:02, 10 January 2012 (UTC)

I get an error after installing the extension

My Wiki is in german and I got the error "Fehler beim Parsen (Das texvc-Programm wurde nicht gefunden. Bitte zur Konfiguration die Hinweise in der Datei math/README beachten.)" after installing the extension. Can someone help me. In english, french or german? --Carl Soehne 16:56, 25 January 2012 (UTC)

I get the same error too here.
  • MediaWiki: 1.19.1
  • PHP: 5.2.17 (apache2handler)
  • MySQL: 5.1.57
--Luca Ghio (talk) 20:24, 5 July 2012 (UTC)
Generally means that texvc is not compiled, texvc is not located in the right place, or you have some permission error. Did you read the README? Bawolff (talk) 13:17, 6 July 2012 (UTC)
As the README says, I installed ocaml-native-compilers and I compiled texvc, then I put it into /extensions/Math/math/. How can I check for permission errors?--Luca Ghio (talk) 13:29, 6 July 2012 (UTC)
In LocalSettings.php I added only the line: require_once("$IP/extensions/Math/Math.php");. Is something missing?--Luca Ghio (talk) 13:34, 6 July 2012 (UTC)
First step to check is can you from the command line run the texvc executable. Can you succesfully run the executable if you su to whatever user apache is running under. Bawolff (talk) 14:43, 6 July 2012 (UTC)
Please explain yourself better: should I open the Ubuntu terminal and enter my FTP folder?--Luca Ghio (talk) 14:56, 6 July 2012 (UTC)
Basically you can only do that test if you have shell access (So when you say unbuntu terminal, if unbuntu is where your website is hosted, that works, but you cannot do this test over ftp). If you enable MW's logging facilities (see How_to_debug#Write_debug_data_to_a_debug_log_file), and render a page with a math tag on it, the debug log will say exactly what commands are executed. (you'll probably want to disable the debug log directly after that. the log file grows very fast). Once you have the individual commands, try them out from the command line to see if they work. p.s. For the permission issue, make sure the apache user has permission to read/execute the texvc command (See docs for chmod command if you don't know how to do that). Bawolff (talk) 16:26, 8 July 2012 (UTC)
I changed the permissions of the texvc file from 644 to 744 (see https://goput.it/bby.png). But... now there is another error!--Luca Ghio (talk) 19:43, 8 July 2012 (UTC)
Unfortunately I think I have to change my web host.--Luca Ghio (talk) 21:56, 8 July 2012 (UTC)

Supporting Arabic Digit

Hello. Anyone have an idea about supporting Arabic digits in this extension? a package (Arabi) has been released in 2005 in most of LaTeX distributions such as MiKTeX.(See User Guide here). For viewing it's output go to this link and insert these codes in blank area:


%due to a bug in ARABI in which the command \textRL is not
%changed to write Farsi though the main TOC language is Farsi.

%due to a bug in ARABI in which the quotaion marks are not
%assigned to their counterpart font-glyphs in lfeenc.def

%a paragraph in Farsi
%to write a number use \I{NUMBER}
%to write some phrases in English use \textLR{English phrase}
سلام. بالاخره یک سرور \textLR{On Line}  پیدا شد که از فارسی نویسی در \textLR{ \LaTeX\ } حمایت کند!

$$\sum^{+ \infty}_{i=1} \frac{1}{i^2} = \frac{\pi^2}{6}$$


Any help is appreciated.--وحید قاسمیان 18:39, 13 February 2012 (UTC)

get independent of texvc


I extended the math extension in the way that one can choose which tool to use to convert tex to image, html and mathml. In the code there are just a few lines which work as a driver for the texvc program. The other things can be used for any other converter like LaTeXML for example. Therefore I restructured the code of the math plugin and added two new classes.

$wgAutoloadClasses['MathTexvc'] = $dir . 'Math.texvc.php';

$wgAutoloadClasses['MathLaTeXML'] = $dir . 'Math.LaTeXML.php';

Now I'd like to share that code and discuss what can be improved. I'm not sure if that's the right place for the discussion, but I didn't found a better place...

--Schubi87 (talk) 13:47, 7 April 2012 (UTC)

MathJax doesn’t work on IE9

MathJax doesn’t work on IE9 on wikipedia. It works on Firefox. A:-)Brunuś (talk) 15:03, 2 June 2012 (UTC)

I did not test on Wikipeda, but tested on my wiki with IE8 with Math (47e3cdb) of 2012-10-22 and everything seems to be fluffy. Cheers --[[kgh]] (talk) 12:27, 3 February 2013 (UTC)

"LaTeX on a shared host" instructions outdated; possible feature request

The given instructions no longer seem to be applicable to the current versions of Math. I am on a shared host, and I installed mimetex.cgi and got it working (tested ok from the command line at least). I went to the next section of instructions where it tells me to modify the function in Math.php that returns the <img> tag instead of doing the stuff the function normally does. I opened up Math.php, and I see that it has been completely rewritten and converted into OOP using classes and stuff. I followed the logic to Math.body.php where the actual rendering appears to happen, hoping that I could find a similar section of code to modify. Sadly, I could not. It seems that there are several places within the code that generate the URL to display the image. There also seems to be a detailed validation that Math is configured correctly. Even if I tweak the outputs to use my CGI path, I think the validations will fail prior to that point, and it will not work.

So, if it is easier to fix the docs to explain how to edit a MW 1.19+ installation with the current version of the Math extension, please do so. Otherwise, I'd like to request that the extension be updated to permit the site owner to simply add a configuration variable to LocalSettings.php with a full URL to the mimetex.cgi script, and then end-users will not have to edit anything else (once they get the CGI working or use a public server). Personally, I like this idea the best, because otherwise I will be very leery of updating my extension, because I had editing core files within extensions. Thanks! Willscrlt (Talk) 00:15, 1 July 2012 (UTC)

You could try Extension:Mimetex alternative Bawolff (talk) 16:29, 8 July 2012 (UTC)

Fatal error on the latest git version

On the pages include formulas I get fatal error:

Fatal error: Call to undefined method FSFileBackend::getRootStoragePath() in /home/wiki/psylab.info/public_html/extensions/Math/Math.body.php on line 361

MW 1.19.1, PHP 5.3.10. Artem Klevtsov (talk) 10:06, 27 August 2012 (UTC)

  • I confirm that the following commit is not compatible with MW 1.19.1. --Rineau (talk) 10:57, 14 September 2012 (UTC)
 commit ae9e0d989b744996ac2229b0dfeb740921f642f4
 Author: Aaron <aschulz@wikimedia.org>
 Date:   Mon Aug 20 15:11:16 2012 -0700
     Added file backend support via $wgMathFileBackend.
     * Also removed old legacy migration code.
     Change-Id: I43cfd7f0da49690a2d0b4eb2daab9b8a110137b7
  • Can anyone check whether the version of the Math extension that was available on, say, August 19th works with MediaWiki core 1.19? 2012-06-13: 1.19.1 released. The offending commit: August 20th. 2012-08-31: 1.19.2 released I believe the extension should work on 1.19.1 sites but not 1.19.2 or 1.19.3 sites, or sites running off git master. Sharihareswara (WMF) (talk) 16:26, 21 November 2012 (UTC)
  • broken with 1.19.3 any ideas?
    For me it's not broken with MW 1.19.2 on shared hosting. Here is how I got LaTex running. Maybe this problem is related only to not-shared hosting? Stefahn (talk) 23:31, 4 December 2012 (UTC)
    No problems here (MW 1.19.3), too. However I am using the MathJax implementation. Perhaps you switch to this one, too for the time being. --[[kgh]] (talk) 12:29, 3 February 2013 (UTC)

Quick fix to a fatal error accessing Special:SpecialPages after switching Math from master to LaTeXML

Fatal error: Class 'SpecialMathDebug' not found in includes/SpecialPageFactory.php on line 345


Downloading the Math extension using git is not working properly for me. I get the following errors:

Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): x + y

Failed to parse (unknown function\large): \large a_2 + a^2

After a

git checkout LaTeXML

functions, sums, derivatives, integrals look ok.

LaTeXML is working very well using Firefox 19 on a KDE desktop and it doesn't require MathJax.

Then attempting to visit SpecialPages from the sidebar, I get the above fatal error.

Quick fix:

I added the missing Class in includes/SpecialPage.php as a quick fix:

class SpecialMathDebug extends SpecialPage
 function __construct( $name = '', $restriction = '', $function = false, $file = 'default' )
  parent::__construct( $name, $restriction, false, $function, $file );

 public function isListed()
  return false;

I'm not sure if this is the right thing to do, at least it heals the error.

Oh I didn't see this comment. I just fixed this bug. --Schubi87 (talk) 17:11, 17 April 2013 (UTC)

eqnarray vs align

I seems that eqnarray dose not work in png mode, but align works, so it is not a big problem. Both works in MathJax.

Is it a known problem. Is there somewhere of a list of LaTex (and amsart) commands that dose not supported? Can you put a link to this list from this page? can you add this one to the list?

Thank you very much, Aizenr (talk) 00:18, 17 May 2013 (UTC)

Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert)

Installed the Math extension with git clone ... under Debian 7 and got the above error message when using a <math>...</math>.

MediaWiki 1.21.1
PHP 5.4.4-14+deb7u4 (apache2handler)
MySQL 5.5.31-0+wheezy1

Solution: apt-get install texlive-latex-extra. --Sigbert (talk) 15:53, 31 August 2013 (UTC)

Also see Manual:Enable_TeX/problems#Error : Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert). --Felipe (talk) 06:35, 18 July 2014 (UTC)


Would it be possible to add the --truecolor tag to the dvipng command in render.ml. Currently, colors may render wrong if there are a lot of them - see Color Problems on Wikipedia for an example of the problem and My Fixed Color Problems on my site when I went in and changed the render.ml to include the --truecolors tag (and then re-rendered all the math...). DukeEgr93 (talk) 03:38, 17 September 2013 (UTC)

Installation problems

I've just installed mediawiki v.1.20.3 on a Mac 10.6.8 server and have been having problems getting the Math extension to work. I'm getting the following error at the top of wiki pages with LaTex:

"Notice: Warning: XML Type check skipped! Check if your MediaWiki installation is version wmf/1.22wmf7 or newer. in /Library/WebServer/Documents/w/extensions/Math/MathRenderer.php on line 150"

I get this in addition to the problematic "Failed to parse(PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)):" error. I have hard coded the paths for latex, dvipng, etc. into the render.ml file and recompiled.

Any suggestions?

-- 21:24, 24 September 2013 (UTC)

Math PDF Export

I have a wiki set up with the following:

  • MediaWiki 1.21.2
  • PHP 5.3.10-1ubuntu3.8 (apache2handler)
  • MySQL 5.5.32-0ubuntu0.12.04.1

Installed the Math renderer (and set up a local MathJax server) to render my equations on my wiki, where they look great. I run into a problem when I try to export the wiki page as a PDF. Some of the equations do not print (there is just blank space in the PDF where equation should be) and the equations that do print are not very good quality. Anybody know why they may be missing and how I can improve the quality?

Thanks! SpartanGuy07 (talk) 19:49, 2 October 2013 (UTC)

Hello. What are you using to generate the PDF's? --Jongfeli (talk) 09:38, 3 October 2013 (UTC)
The PDF is generated using PDF_Writer from the Extension:Collection. This is also run by a local server.SpartanGuy07 (talk) 18:49, 3 October 2013 (UTC)
Ok. I am not familiar with Extension:PDF Writer we use Extension:Collection. The reason we do is because it is used on "all" Wikimedia sites, the output can be customized and it is relative easy to setup when you want to run your own render server (see: Setup a render server on Ubuntu 12.04 LTS). When you use MathJax the math formulas look indeed great but it is not a picture it is code (when i am correct). Pdf export extensions like PDF Writer & Collection don't use MathJax to create the formulas. I don't know if that is even possible. I did try to increase the quality of the formulas in the pdf's but had no luck yet.
As for the not printing (showing) part, we noticed that some syntax is not handled well when exporting to pdf. It works fine in the browser when handled by MathJax but on the pdf output there is just empty space.
Example (set your Preferences to MathJax):
  • This <math>E=mc^2</math> shows on the page and in the pdf output.
  • This <math>E \space =mc^2</math> shows Failed to parse (unknown function "\space"): E \space =mc^2 on the page with the extra empty space but there noting to be seen in the pdf output, just empty space.
We did not investigate any further we just don't use \space anymore. There is probably more syntax that does work with MathJax and not when rendered to pdf. --Jongfeli (talk) 06:59, 4 October 2013 (UTC)
I think there is some confusion as to the problems I am experiencing, so I am attaching some screenshots that I made to demonstrate the problems. First off, I am using the Extension:Collection, I was just referring to the PDF_Writer as being the function that generates the PDFs. Note: All these images are uploaded to the wiki, they are not really external links, I just didn't want to embed them to this page due to their size.
  • Bad quality in PDF
Quality in wiki and quality in PDF
  • Equations not rendering in PDF
Normal equations, rendered in wiki but not in PDF
Inline equations, rendered in wiki but not in PDF
As I mentioned, certain equations (such as ) do render in both the wiki and the PDF, but they have poor quality. Since I am using the Extension:Collection, the same used as the rest of the Wikimedia sites, I don't know why the quality of my equations is worse in PDF form. Others just don't show up at all, as demonstrated by the quadratic equation.
Hope this clarifies things. Thank you. -SpartanGuy07 (talk) 16:38, 4 October 2013 (UTC)
Ok. The quality difference between browser and pdf is there because your wiki is setup to use MathJax to generate the formula's. I do not know what the Collection extension is using to generate the formula's but it is not using MathJax. The quality of the formula's in the pdf is indeed poor. We also tried to increase the quality but we did not find a solution yet (see comparison on: Math formulas). You can test pdf output on the MediaWiki site, when your math formula's also fail to show up in the pdf's generated by the render server at PediaPress there is probably something wrong with the math syntax. You can post the actual math syntax on this page and export this page to pdf to see if it shows up. --Jongfeli (talk) 19:09, 4 October 2013 (UTC)

fix error in extension math

hi please fix an error with extension:math my error says

[2a2a6828] /mw-config/?page=ExistingWiki Exception from line 181 of /home/paladox/public_html/en/includes/Hooks.php: Invalid callback in hooks for ParserFirstCallInit


#0 /home/paladox/public_html/en/includes/GlobalFunctions.php(4031): Hooks::run(string, array)
#1 /home/paladox/public_html/en/includes/parser/Parser.php(275): wfRunHooks(string, array)
#2 /home/paladox/public_html/en/includes/parser/Parser.php(287): Parser->firstCallInit()
#3 /home/paladox/public_html/en/includes/parser/Parser.php(4823): Parser->clearState()
#4 /home/paladox/public_html/en/includes/parser/Parser.php(367): Parser->startParse(Title, ParserOptions, integer, boolean)
#5 /home/paladox/public_html/en/includes/installer/Installer.php(591): Parser->parse(string, Title, ParserOptions, boolean)
#6 /home/paladox/public_html/en/includes/installer/WebInstaller.php(668): Installer->parse(string, boolean)
#7 /home/paladox/public_html/en/includes/installer/WebInstallerPage.php(358): WebInstaller->getInfoBox(string)
#8 /home/paladox/public_html/en/includes/installer/WebInstallerPage.php(346): WebInstaller_ExistingWiki->showKeyForm()
#9 /home/paladox/public_html/en/includes/installer/WebInstaller.php(275): WebInstaller_ExistingWiki->execute()
#10 /home/paladox/public_html/en/mw-config/index.php(61): WebInstaller->execute(array)
#11 /home/paladox/public_html/en/mw-config/index.php(29): wfInstallerMain()
#12 {main}

when going to mw-config and using update script in browser I have tested my other extension and they work but when I have extension:math enabled it seems to stop the update in the browser from working please fix it. 15:42, 22 December 2013 (UTC)

I've installed MediaWiki 1.22.0, added Math extension, and re-run the installer again: I don't see this error happening. Please always provide what MediaWiki version are you running --Ciencia Al Poder (talk) 19:57, 22 December 2013 (UTC)
hi I am now using mediawiki 1.23 wmf 11 but all I did is run update.php in my browser and so it only add the table to my database and I have installed the extension but is there anything elease I need to add to localsettings.php or and other maintenice scripts I need to run 17:24, 25 January 2014 (UTC)
update.php can't run on your browser. --Ciencia Al Poder (talk) 10:37, 27 January 2014 (UTC)

installing math on Windows for mere mortals...

A few years ago using mediaWiki 1.15 I have installed math and used it a lot since then. I don't recall much problems to get it working. Now, using v1.22, I am getting nowhere. Where can I find a clear step-by-step tutorial which tells me what to do to get it to run on Windows?

For the time being I found a zero-installation option:
template: equation

<IMG src='http://latex.codecogs.com/gif.latex?{{{eqn}}}'>

== purpose ==
Poor man's equation parser

== usage ==

enter {{equation|1=e=m\cdot{c^{2}} 

to get {{equation|eqn=e=m\cdot{c^{2}} 

(requires $wgAllowImageTag)

Wim WimW 15:40, 7 January 2014 (UTC)

On my user page I present an update of the old math.php that worked in the pre 1.18 (?) versions until it had to become an extension. This math-version does not use texvc and therefore is much easier to install. WimW (talk) 15:00, 9 January 2014 (UTC)

Installation guidelines unclear

  • // Set this if you don't use MediaWiki Math's texvc: - what is MediaWiki Math's texvc? How I should know wether I am using it or no?
  • // Be sure to have a math directory with writing

// permission and that these two variables are set or // default to that directory:

This means I have two options. One is to set the two variables below, the other one is to set a default directory. What does it mean? Where and how I can set the default directory?--Juandev (talk) 19:53, 11 January 2014 (UTC)


It would be nic to write down the way how to uninstall this extension.--Juandev (talk) 16:48, 16 January 2014 (UTC)

How to keep the documentation up to date

A new version of the Math extension aka Math 2.0 is planned. What do you think is the best practice to keep the documentation up to date with the current version. For example


changed the name of some globals. We tried to document the most important changes in


unfortunately some of the changes are already live now in Wikipedia also Math-2.0 was not released. My new proposal is now to develop the changes in a different branch


and merge it once everything is tested and reviewed by the community. --Physikerwelt (talk) 12:21, 10 February 2014 (UTC)

As I expected changes were just incorporated before actual release. :| Yeah, I think it is best to develop in a different branch and merge this one with master. However I would develop in smaller chucks, so instead of doing a big change, incorporate smaller changes step by step. Useful changes e.g. translation updates to master should somehow end up in the special development branch too so syncing them somehow will be necessary. I would ask another developer on how to do this best. Cheers --[[kgh]] (talk) 16:02, 10 February 2014 (UTC)


I changed the line

   require_once __DIR__ . "/extensions/Math/Math.php";


   require_once "$IP/extensions/Math/Math.php";

because __DIR__ was added in PHP v.5.3.0 and so crashes on hosts such as DreamHost that (still!) run older versions of PHP, while "$IP" apparently works both on old and new versions of PHP. (See Manual:$IP and template talk:ExtensionInstall ).

Please revert if there is a good reason to use "__DIR__" rather than "$IP". --DavidCary (talk) 18:52, 18 February 2014 (UTC)

Alignment of formulas

The MathJax extension centers formulas instead of aligning them to the left. This behavior is different from the PNG mode. While I don't mind centering in general, there are some cases where it looks really bad, which is when multiple formulas are listed below one another. This makes the first centered and the latter left-aligned. See https://en.wikipedia.org/wiki/Greatest_common_divisor for some examples of that.

There are at least two possible fixes:

  • Make all formulas centered. One problem with this is that pages are probably authored for math on the left so it could lead to other problems.
  • Align formulas to the left like with PNGs. This can be done with MathJax.Hub.Config({displayAlign: "left"}), and possibly other ways. See http://docs.mathjax.org/en/latest/options/hub.html for more info. 18:31, 20 February 2014 (UTC)


The documentation on this parameter is rather unclear. I've been looking on how colors are defined in the \special command in Latex, but I'm not really getting anywhere. So I have no idea how to set this variable... An example or two and/or a link to a page explaining how colors are set in the \special command would be very much appreciated! 08:37, 10 May 2014 (UTC)

Terrible documentation - just had a hard time to make it work

Just wanted to give you guys some user feedback.

I just had a terrible time trying to make this extension to work. I am using MediaWiki 1.19.11 on shared hosting at Dreamhost.com, and it took me the best part of three hours to get an equation to be displayed. Hopefully this comment will help others in a similar situation and help improvement of the docs.

This is how I finally got my math notation going:

  • Downloaded Math extension, added require_once( "$IP/extensions/Math/Math.php" ); to Localsettings.php ; updated the database structure (I skipped it, but a full wiki backup is always recommended prior to update)
  • Dreamhost doesn't have a specific cgi folder (didn't know that) so I ended up creating a /usr/home/myusername/cgi-bin directoy and placing mimetex.cgi there with the proper (755) permissions.
  • My LocalSettings.php, after several attemps, ended up keeping only:
 require_once( "$IP/extensions/Math/Math.php" );
 $wgTrustedMathMimetexUrl = '/cgi-bin/mimetex.cgi?';
  • I used this (as of today) awfully written page to guess the changes I had to do the the extension code, and edited my Math.body.php, although the code I had here for function renderMath was not exactly the same as the one shown there. I simply added the following line as the first line of the function:
return '<img class="tex" src="/cgi-bin/mimetex.cgi?' . rawurlencode($tex) . '" alt="LaTeX: ' . htmlspecialchars($tex) . '">';

This got me going. Equations are displayed albeit quite pixelated.

Things I wanted to do, but couldn't, no matter what:

  • To download and install texvc on my shared hosting server
  • To understand a little better what texvc actually does
  • To use MathJax
  • To use any other render method other than mimetex.cgi
  • To get top quality equation renders
  • To have a nicer user experience

Hope it helps,

Rbirmann (talk) 22:27, 16 May 2014 (UTC)

Installation instructions for LaTeXML incorrect/out of date?

I'm currently trying to get LaTeXML support working (I don't have TeX installed on my server and would rather not commit the disk space for an installation of it, which IIRC from last time I used it was quite significant), but am having problems following the instructions. I initially followed the simplified guide to installing the Math extension (I downloaded the version provided in the download link below, which is in a folder in the archive called `wikimedia-mediawiki-extensions-Math-d0e998f` and is therefore I presume a snapshot version...?):

  • Download and place the file(s) in a directory called Math in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/Math/Math.php";
    $wgUseLaTeXML = true;
    $wgUseMathJax = true;
    $wgDefaultUserOptions['math'] = MW_MATH_LATEXML;
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

but this didn't work. I wasn't getting math rendering correctly (I got a warning about `texvc` not being installed), and navigating to my user preferences page showed an error message (apparently "MW_MATH_LATEXML" is defined as "7" which is not a valid value for the user option "math").

Looking at the source code I have, I can see *why* this doesn't work -- the variable `$wgUseLaTeXML` is never read, so I wouldn't expect setting it to achieve anything -- but I don't see how to actually make it work. Any ideas? 00:14, 29 June 2014 (UTC)

Unable to compile texvc, for literally years

  • Environment: SuSE 13.1-64 including ocaml 4.01.0
    • Math-REL1_23-d0e998f.tar.gz
  • Result of make:
/srv/www/htdocs/ddw3/extensions/Math/math # make
ocamlopt -c util.ml
sh: as: command not found
File "util.ml", line 1:
Error: Assembler error, input left in file /tmp/camlasm001200.s
make: *** [util.cmx] Error 2 
  • Line 1 of util.ml reads:
(* vim: set sw=8 ts=8 et: *)
  • So I have no idea where the missing "as" is to be found.
    • camlasm001200.s is 7846 bytes in length and contains nothing I can use to identify the problem.
    • This error was generated today, 8/8/14. I believe it is the same that I got when I first tried to install 1.19.
  • I have been using MediaWiki at home since about 2007 as my journal. The Math extension is an essential part of it. I have been using 1.16 since I first failed to compile texvc. I would like to move from 1.16 on a 32-bit CPU to a more current version of MediaWiki on a 64-bit platform. Who can diagnose this problem?
    • Incidentally, SuSE has an assembler which it calls asl. A search on "assembler" also finds bin86, hping, nasm and yasm. I am certainly not prepared to guess which of these should be given the synonym "as."
  • This is clearly in SuSE's court. I found a "Hello world" example that works in ocaml, but fails in ocamlopt.
  • SuSE has analyzed it and a fix for the package is in the pipeline. In the meantime, updating the compiler solves the problem.

--Docduke (talk) 21:48, 14 October 2014 (UTC)

Upgrade broke MathJax

I just upgraded MediaWiki from 1.21 to 1.23. Got a fresh install of the Math extension. Ran the makefile to build texvc, texvccheck. Changed my LocalSettings.php to look like this:

$wgMathValidModes = array( MW_MATH_MATHML, MW_MATH_SOURCE );
$wgUseMathJax = true;
$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX;

All math in the wiki (http://math.slu.edu/escher) is now broken. Instead of rendered output like , I see (with Safari and Chrome):

$ \alpha _{1}+\delta _{1}+\gamma =180^{\circ } $

My apache server log reports this error:

[Tue Aug 12 11:43:35 2014] [error] [client] File does not exist:

And indeed, that file does not exist. It did in the old version of the Math extension. Here's the contents of the Math/modules/MathJax directory:

fonts  images  LICENSE     README-branch.txt  README.md  unpacked

Suspiciously, the 'unpacked' directory does contain a subdirectory called 'extensions'.

If I disable MathJax and revert to PNG rendering, things do work. But before the upgrade, MathJax was working fine and looks considerably better.

Bryanclair (talk) 19:06, 12 August 2014 (UTC)


This was cleared up by Ian Kelling, who has also fixed the page to reflect the correct settings. The issue is that

 $wgDefaultUserOptions['math'] = MW_MATH_MATHJAX;  //INCORRECT

is incorrect. You can list $wgMathValidModes which will show up as radio buttons in user preferences, but MathJax apparently doesn't work as one of these radio buttons. Instead, you turn it on with $wgUseMathJax, which creates a checkbox in the user preferences that overrides the radio button setting. Then, to make MathJax the default, you use

 $wgDefaultUserOptions['mathJax'] = true;  //CORRECT

It seems like not very clear behavior, and that it would make sense to make MathJax just another radio button, defaulted with $wgDefaultUserOptions['math']. Maybe in the future. Bryanclair (talk) 04:28, 15 August 2014 (UTC)

At 13:25, 16 October 2014 (UTC), the correct setting is:
$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX; //CORRECT
The solution above didn't work for me.
--Papapasan (talk) 13:25, 16 October 2014 (UTC)

texvccheck with empty result

I'm currently testing an upgrade of my Wiki to 1.23. The problem with Math is that some of the equations are not rendered but I get Failed to parse (unknown error). When the page is purged some of the equations (but not necessarily the same as before) are rendered.

I set $wgDebugLogFile and in the log files for all the equations that are rendered the output of texvccheck is an empty string. For the rendered equations there is a non-empty (correct) result. Copy/pasting the the command from the log to the command line and executing gives a non-empty result

When I switch off checking with $wgMathDisableTexFilter all equations are rendered.

No idea what is happening here. Don't think that it is a permission-thing as the equations are sometimes rendered. Also tried the current official release of Math and the git version. The same happens for both of them --Bgschaid (talk) 08:18, 27 August 2014 (UTC)

Addition: It is my impression that this only happens if more than one equation is on the page. Is it possible that the PHP executes more than one instance of texvccheck at once and there is some kind of race-condition (temporary file etc)?

MathJax (MW_MATH_MATHJAX) depreciated

When looking at the code I realised that MathJax is now a depreciated rendering method. On shared hosting this seems however to be the only way to get this extension working at all. Thus it will be cool to continue support for this mode for all the ("unfortunate") people out there who have no command line access to their server (shared hosting). --[[kgh]] (talk) 15:40, 4 September 2014 (UTC)

On a shared host with a limited shell access

The section On a shared host with a limited shell access describes installing dependencies using sudo apt-get but then goes on to describe fetching and compiling texvc with wget, make, etc. It would be better if the process were described once for on Ubuntu/Debian using sudo apt-get and again for other systems where using make would be necessary. -- Rob Kam (talk) 20:33, 5 September 2014 (UTC)

MathJax extensions

How to add MathJax third-Party extensions? For example XyJax to draw various graphs and diagrams. -- Rob Kam (talk) 23:20, 7 September 2014 (UTC)

MathJax on the same server

To have MathJax on the same server as the wiki is it really necessary to download and unpack all 53Mb of the the latest distribution? -- Rob Kam (talk) 16:29, 8 September 2014 (UTC)

Yes, it is. I've done that and MathJax is running OK in my wiki. Andreluciani (talk) 16:34, 12 September 2014 (UTC)

Math folder doesn't contain texvc

I've installed the extension Math in my wiki(1.23) and when I try to render by PNG method (texvc) I get the error: Failed to parse (Missing texvc executable); please see math/README to configure.). I've checked the math directory in my server, and I figured out there actually isn't a folder texvc, which I guess is necessary to get things working. How can I solve this problem? I've done some research and couldn't find anything helpful. Thanks Andreluciani (talk) 16:31, 12 September 2014 (UTC)

I've the same problem. MediaWiki 1.23.5 Installed Extension Math, used 7-zip to extact the folder Math, but it does not contain the texvc file.

Math rendering with MathJax not working with Mediawiki 1.23

I've upgraded my wiki to version 1.23 and also upgraded the Math extension to version 1.2.0

After that, the Math extension doesn't seems to be working.

Here's my configuration

   $wgMathValidModes[] = MW_MATH_MATHJAX; // Define MathJax as one of the valid math rendering modes
   $wgUseMathJax = true; // Enable MathJax as a math rendering option for users to pick
   $wgDefaultUserOptions['math'] = MW_MATH_MATHJAX; // Set MathJax as the default rendering option for all users (optional)
   $wgMathDisableTexFilter = true; // or compile "texvccheck"
   $wgMathJaxUrl = "$IP/extensions/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML";

I even tried to change the value of $wgMathJaxUrl to "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" but no changes.

Nothing seems to working, and my formula is not parsed and displayed as it is.

I even tried to install the older version 1.0 Math but that throws some error with the class name not found (related MathRenderer).

One difference I found before upgrading and after upgrading is the js fils like /extensions/Math/modules/MathJax/config/TeX-AMS-texvc_HTML.js are not loading now. And I'm not even seeing the config folder under MathJax folder.

Any reason why this is not working?

Same here ... no Rendering using MW1.23.6 and Math 1.2/MathJax ... need some help -- 14:24, 2 December 2014 (UTC)

I also have the same issue. I'm new to all this and using MW but I feel I did everything right. Also I have observed that when I activate the MathJax settings in LocalSettings.php, I can't get to the user preference page of the wiki. Disabeling the option in LocalSettings.php reopens the user settings page. I've tried what was stated above on setting the default mode but it didn't work. Could the problem be in the adding of the mathjax option of the settings menu? I'm using MW 1.24.0. Thanks with to anyone who can help. Letartean (talk) 18:32, 17 December 2014 (UTC)
Same settings, same issue here as well. 05:57, 24 February 2015 (UTC)
I'm completely new to this. I have installed MediaWiki 1.24.1 and I am using MathJax "latest distribution". I did all changes in LocalSettings.php but it does not work. Any idea? Are there any other settings? --2003:63:3E0E:E900:C4B7:7013:A7B5:BB1B 19:15, 23 March 2015 (UTC)
I found a solution. Install http://www.mediawiki.org/wiki/Extension:SimpleMathJax/en and edit SimpleMathJax.class.php like you wish. It works fine for me! --2003:63:3E0E:E900:C4B7:7013:A7B5:BB1B 19:35, 23 March 2015 (UTC)

\not in MathJax puts the slash in the wrong place

I'm seeing bad rendering with \not followed by a digit, e.g. , in MathJax but not in other math rendering modes. This affects the en.wikipedia article en:Anomalous cancellation; see en:Wikipedia talk:WikiProject Mathematics#\not in MathJax puts the slash in the wrong place for more details. —David Eppstein (talk) 05:09, 7 December 2014 (UTC)