Last modified: 2013-04-25 18:26:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 31406 - Set $wgUseMathJax = true on Wikimedia wikis
Set $wgUseMathJax = true on Wikimedia wikis
Product: Wikimedia
Classification: Unclassified
Site requests (Other open bugs)
All All
: High enhancement with 6 votes (vote)
: ---
Assigned To: Sam Reed (reedy)
: shell
Depends on: 35186 34826 34827 34828 34900 34902 35038 35190 35191 35498 36059
Blocks: 36464 make-mathjax-default
  Show dependency treegraph
Reported: 2011-10-06 02:40 UTC by Michael Hardy
Modified: 2013-04-25 18:26 UTC (History)
19 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Michael Hardy 2011-10-06 02:40:53 UTC
Again, this is a feature request rather than a bug report.

A lot of work has gone into making it possible to use MathJax to view TeX on Wikipedia.  Probably more than 20,000 article use TeX (or whichever variant of TeX Wikipedia uses).  I have corresponded with Robert Miner, MathJax Project Director and Vice President or Research and Development at Design Science, Inc. about the fact that MathJax could now be used.  I told him that possibly in coming months MathJax would be adopted as the default means of viewing TeX on Wikipedia.  He wrote:


First of all, congratulations on you and your fellow contributors' monumental achievement with Wikipedia. As a mathematician by training, I have been blown away on several occasions by the depth of your coverage.

On the subject at hand, we have been corresponding with nageh a fair amount on the MathJax lists, but we will take a look at the page you cite in detail.  I just skimmed it and I see there are a number of issues, some of which we know about but some that look new.

Supporting Wikipedia is very important to us, so we will definitely want to do some triage and see what we can do.  Is updating the page you referenced the best way to communicate with you folks?  Also, you said "in coming months" but anything more specific you can tell us about the timing (or how the decision about timing is made) will help.  We will may have to rethink our release schedule depending on your timing.


I told him him I was just guessing when I said "in coming months" and I don't work on software development.  But it would be nice if we could tell him something more specific.  Brion Vibber has recently said this will happen whenever someone gets to it.

Can anyone make it possible to say something more specific?
Comment 1 Helder 2011-10-06 02:52:12 UTC
From your description I believe this is a request to enable the extension on Wikimedia wikis, so I'm changing the summary accordingly.
Comment 2 Sam Reed (reedy) 2011-10-06 11:26:58 UTC
Looking at the code, it would need at least a minimal extension creating for it to include the JS
Comment 3 Helder 2011-10-08 17:23:23 UTC
(In reply to comment #2)
> Looking at the code, it would need at least a minimal extension creating for it
> to include the JS

There is already a MediaWiki extension at [[mw:Extension:MathJax]].
Comment 4 Nicholas Longo 2011-10-14 03:21:36 UTC
I think mathjax is probably the way to go in the future.  Texvc is not very well maintained because on one wants to deal with the ocaml portion.  Mathjax could solve several serious issues.  

For example there is the question of when/how to expire texvc cached math images.  Currently nothing is done and if something originally rendered incorrectly then it will be that way forever after, even after texvc is later able to produce the correct image.  

There is the inline vs displayed math, I am not sure how this is handled by Mathjax, but it cannot be any worse then texvc.

Mathjax doesn't have a baseline issue that I am aware of.

There is also server load, this transfers work that the servers have to do over to the client side.

And no unimportantly Mathjax is widely used and actively developed.

Some issues to think about.  Texvc supports some commands that are not latex commands, and sanitizes latex input so that we now there are now existing in WMF wiki's non-standard latex that people have come to expect to render, which may have some issues under Mathjax.

Also, and perhaps this is a bit naive, but the extension above uses just dollars instead of <math>, if there is a WMF page with randomly lots of dollar signs running around will there be portions of the text that are inadvertently treated as math?

I am sure there are many more issues, but I want to add my voice to the idea that we should test out mathjax.
Comment 5 Michael Hardy 2011-10-14 18:53:05 UTC
Some months ago the Wikipedia user known as Nageh made it known on the math WikiProject talk page that there is some rigamarole that you can go through (maybe it was just setting preferences a certain way and installing a certain file?) so that you would always be using mathJax when you viewed Wikipedia articles that have math tags.  I've been doing that since then.  It seems to solve both the "baseline" problem and the problem of buffoonish-looking size mismatches between text and stuff in math tags.

(By the way, a funny new (actually new) issue with texvc was just discovered.  After I put in a feature request here some months ago, we acquired the ability to use some archaic Greek letters (no longer used by the time of Plato, Aristotle, etc., I think).  These are useful for writing about certain ancient numeral systems, and I've started working on a draft to get incorporated into an article on ancient mathematical astronomy.  It turns out that if you're not using mathJax, then the use of those archaic letters causes all letters within \text{} to get transliterated into Greek.  For now, \mathrm{} can be used to work around that problem.  But the new archaic ("new archaic"?) letters work fine when mathJax is used.)
Comment 6 Brion Vibber 2011-11-29 00:56:09 UTC
I've made an initial experimental commit on Math extension to use MathJax (if enabled): r104521

Also some notes on wikitech-l:

will probably start bundling up notes & concerns into an RFC page on in a bit.

Note that the existing [[mw:Extension:MathJax]] doesn't look suitable because we still need math rendering to PNG as a fallback, at least for the time being. But as a progressive enhancement to (in most cases) replace them? Heck yesssssssss please!
Comment 7 Derk-Jan Hartman 2011-11-29 20:43:18 UTC
Thanx a lot for putting effort into this Brion ! I think MathJax is the way forward. Now I think we need to figure out what the best 'output' mode is for our purposes, but at least this is real progress.
Comment 8 Michael Hardy 2011-11-30 05:11:54 UTC
I am very pleased to hear this is progressing.
Comment 9 Brion Vibber 2011-12-06 01:19:57 UTC
r105268 is an initial attempt to pull in the MathJax source and Some of Nageh's customizations for the initialization & conversion tweaks.

With $wgUseMathJax set to true, *and* setting to 'leave as latex' in your preferences, the text-form math gets replaced at runtime. Neat!

PNG forms don't get replaced yet, but this shouldn't be too hard.

Further work to make sure things get initialized when loaded via ajax etc without heavyweight loading when not needed is probably advisable.
Comment 10 Helder 2012-02-05 18:54:45 UTC
I know it is a bit late, bug I suppose r104498 is going to be live when MW 1.19 is deployed so, is there any change of getting this Mathjax option enabled on Wikimedia wikis (even if in a "experimental mode") to serve as a replacement for the (old) default option "HTML if very simple or else PNG" which was deprecated?
Comment 11 Helder 2012-02-06 09:14:05 UTC
If I understood correctly, the concerns raised on
were solved by r105268.

Is there anything else that needs to be corrected before this request can be implemented? E.g., for WMF wikis:
* Do we need those "112 megabytes of PNG 'fonts'" which Brion didn't commit when adding MathJax source files on r105268?
* On commit summary of r104521, Brion mentioned a "couple of problems for us". Is any of them a blocker for deployment on WMF wikis?

BTW: Can we have this MathJax option enabled on some wiki (Labs, Prototype, etc) so users can test it?
Comment 12 Brion Vibber 2012-02-07 19:15:13 UTC
At the moment the mathjax option is a server-side switch and not user-switchable; so if we did have a live test we'd want it on a prototype or labs wiki definitely, not one of the main ones.

We'll probably want to hold off on a real deployment until both more real-world testing and updating to the coming MathJax 2.0... being able to switch in on the wiki (like with the current gadget, but as a plain option) would likely also be useful.
Comment 13 Dario Taraborelli 2012-03-01 00:44:01 UTC
MathJax 2.0 was released this week:

The developers asked me whether they can help move things forward with this request.
Comment 14 Brion Vibber 2012-03-01 01:03:51 UTC
I've made some preliminary stabs at updating Math extension to MathJax 2.0, but so far it's not loading correctly. I'll take another stab at it in a bit (it may be simpler to *not* try to override MathJax's native way of preloading files).

I'll add some preliminary bug entries as blockers on this one.
Comment 15 Richard Morris 2012-03-01 18:08:14 UTC
This now seems to be live on wikipedia. This has created some problems  related to bug #32694 as simple equation like <math>x^2</math> now renders using PNG rather than simple HTML. The consequence of this is that the baseline is now wrong with it displaying lower than it should.

There is some discussion on this at
Comment 16 Brion Vibber 2012-03-01 18:23:01 UTC
MathJax is not yet enabled, but the removal of the HTML rendering options has gone through. Initial tests with baseline adjustment per bug 32694 were not successful, so for the meantime we may need to live with this.
Comment 17 Brion Vibber 2012-03-05 20:48:22 UTC
(updated var name in summary)

Getting closer! MathJax, once enabled in the extension, now is available as a third rendering mode (beyond PNG and 'leave as tex'), so won't interfere with other things when turned on.

It can then be opted-in by anybody who wants to help try it out while we continue poking at things...
Comment 18 Derk-Jan Hartman 2012-04-01 11:56:40 UTC
It might be wise to use mtextFontInherit = true, to make sure that text inside math has access to our webfonts etc.
Comment 19 Erik Moeller 2012-04-17 22:44:14 UTC
Enabled on (as opt-in user preference), initial testing here:

In-place opt-in testing on production wikis can be enabled once 1.20wmf1 is stable and rolled out everywhere, which should also give us enough time to identify any showstoppers.
Comment 20 nageh 2012-04-18 11:51:00 UTC
I wished MediaWiki devs would correspond a bit with the primary author of the MathJax Wikipedia extension so a lot of the bugs reported on bugzilla could be avoided.
Comment 21 Mark A. Hershberger 2012-04-19 22:08:40 UTC
(In reply to comment #20)
> I wished MediaWiki devs would correspond a bit with the primary author of the
> MathJax Wikipedia extension so a lot of the bugs reported on bugzilla could be
> avoided.

Brion has corresponded with the mathjax people:

I just found the MathJax extension, though, by [[User:Dirk Nuyens]].  It seems like Dirk should have spoken up when Brion asked there.  But, yes, it would be nice if Brion had asked Dirk directly.  Maybe he did... I don't know.

Looking at your other comments, though, it looks like you are upset that no one talked to you about your user script.  Since you guys have already hashed that out, I won't comment further.
Comment 22 Richard Morris 2012-04-19 23:04:17 UTC
I think Nageh referring to the scripts on en wikipedia at
This script is probably the most mature and well tested mathJax implementation on wikipedia and its been used extensively by many of the en-mathematics community for about a year now. Nageh has fixed quite a number of issues arising from the non standard nature of texvc. It might be worth examining
where most of the fixes are. The talk page
has most of the problems people have found in the last year.
Comment 23 Erik Moeller 2012-05-03 00:55:42 UTC
After initial testing on and completion of the 1.20wmf1 deployment this is now ready to be enabled site-wide as an opt-in preference so that it can receive more eyeballs.
Comment 24 Sam Reed (reedy) 2012-05-03 16:06:49 UTC
(In reply to comment #23)
> After initial testing on and completion of the 1.20wmf1
> deployment this is now ready to be enabled site-wide as an opt-in preference so
> that it can receive more eyeballs.

Comment 25 Helder 2012-05-03 19:40:04 UTC
I created Bug 36496 to request the change of the default math mode from PNG to MathJax.

It is likely that some of the blockers for this bug should actually be blockers for the new one.
Comment 26 Richard Morris 2012-05-04 08:07:00 UTC
This was really a to early a roll out, Bug 36059, breaks all matrices, case statements, multiline equations and tables. See for a plethora of broken examples.
Comment 27 benson_muite 2012-11-20 19:33:52 UTC
Is it possible to set up defaults for a particular page rather than for a particular user? Have been testing mathjax here:

It seems to work well when selected as a user preference, but if this is not done, then one must revert to regular math expressions for correct rendering.

Also is it possible to integrate automatic equation referencing? Regular equation referencing as indicated here:

is good since it allows for hyperlinks, but requires manual updates to the equation numbers when new formulae are entered.

Note You need to log in before you can comment on or make changes to this bug.