# ActionsSet \$wgUseMathJax = true on Wikimedia wikisClosed, ResolvedPublic

Description

Author: hardy

Description:
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:

QUOTE:

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.

END OF QUOTE

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?

Version: unspecified
Severity: enhancement
URL: http://www.mathjax.org/

bzimport set Reference to bz31406.
bzimport created this task.Via LegacyOct 6 2011, 2:40 AM
He7d3r added a comment.Via ConduitOct 6 2011, 2:52 AM

From your description I believe this is a request to enable the extension on Wikimedia wikis, so I'm changing the summary accordingly.

Reedy added a comment.Via ConduitOct 6 2011, 11:26 AM

Looking at the code, it would need at least a minimal extension creating for it to include the JS

He7d3r added a comment.Via ConduitOct 8 2011, 5:23 PM

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]].

bzimport added a comment.Via ConduitOct 14 2011, 3:21 AM

nmichalo wrote:

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 $, 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. bzimport added a comment.Via ConduitOct 14 2011, 6:53 PM hardy wrote: 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.) brion added a comment.Via ConduitNov 29 2011, 12:56 AM I've made an initial experimental commit on Math extension to use MathJax (if enabled): r104521 Also some notes on wikitech-l: http://lists.wikimedia.org/pipermail/wikitech-l/2011-November/056636.html will probably start bundling up notes & concerns into an RFC page on mediawiki.org 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! TheDJ added a comment.Via ConduitNov 29 2011, 8:43 PM 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. bzimport added a comment.Via ConduitNov 30 2011, 5:11 AM hardy wrote: I am very pleased to hear this is progressing. brion added a comment.Via ConduitDec 6 2011, 1:19 AM 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. He7d3r added a comment.Via ConduitFeb 5 2012, 6:54 PM 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? He7d3r added a comment.Via ConduitFeb 6 2012, 9:14 AM If I understood correctly, the concerns raised on https://www.mediawiki.org/wiki/Special:Code/MediaWiki/104521#code-comments 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? brion added a comment.Via ConduitFeb 7 2012, 7:15 PM 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. DarTar added a comment.Via ConduitMar 1 2012, 12:44 AM MathJax 2.0 was released this week: http://www.mathjax.org/2012/02/26/news/mathjax-version-2-0-now-available/ The developers asked me whether they can help move things forward with this request. brion added a comment.Via ConduitMar 1 2012, 1:03 AM 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. SalixAlba added a comment.Via ConduitMar 1 2012, 6:08 PM This now seems to be live on wikipedia. This has created some problems related to bug #32694 as simple equation like [itex]x^2$ 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 http://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Mathematics#.27New.27_math_rendering_options

brion added a comment.Via ConduitMar 1 2012, 6:23 PM

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.

brion added a comment.Via ConduitMar 5 2012, 8:48 PM

(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...

TheDJ added a comment.Via ConduitApr 1 2012, 11:56 AM

It might be wise to use mtextFontInherit = true, to make sure that text inside math has access to our webfonts etc.

Eloquence added a comment.Via ConduitApr 17 2012, 10:44 PM

Enabled on MediaWiki.org (as opt-in user preference), initial testing here:

http://www.mediawiki.org/wiki/Extension:Math/MathJax_testing

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.

bzimport added a comment.Via ConduitApr 18 2012, 11:51 AM

mal.malego wrote:

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.

MarkAHershberger added a comment.Via ConduitApr 19 2012, 10:08 PM

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.

I just found the MathJax extension http://www.mediawiki.org/wiki/Extension:MathJax, 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.

SalixAlba added a comment.Via ConduitApr 19 2012, 11:04 PM

I think Nageh referring to the scripts on en wikipedia at
http://en.wikipedia.org/wiki/User:Nageh/mathJax
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
http://en.wikipedia.org/wiki/User:Nageh/mathJax/config/TeX-AMS-texvc_HTML.js
where most of the fixes are. The talk page
http://en.wikipedia.org/wiki/User_talk:Nageh/mathJax
has most of the problems people have found in the last year.

Eloquence added a comment.Via ConduitMay 3 2012, 12:55 AM

After initial testing on MediaWiki.org 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.

Reedy added a comment.Via ConduitMay 3 2012, 4:06 PM

After initial testing on MediaWiki.org 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.

Done

He7d3r added a comment.Via ConduitMay 3 2012, 7:40 PM

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.

SalixAlba added a comment.Via ConduitMay 4 2012, 8:07 AM

This was really a to early a roll out, Bug 36059, breaks all matrices, case statements, multiline equations and tables. See http://en.wikipedia.org/wiki/Help:Formula#Fractions.2C_matrices.2C_multilines for a plethora of broken examples.

bzimport added a comment.Via ConduitNov 20 2012, 7:33 PM

benson_muite wrote:

Is it possible to set up defaults for a particular page rather than for a particular user? Have been testing mathjax here:

http://en.wikibooks.org/w/index.php?title=Parallel_Spectral_Numerical_Methods

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:

http://en.wikipedia.org/wiki/Help:Displaying_a_formula#Equation_numbering

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