Description

Peter Krautzberger of the MathJax team suggested a way for all visitors (included anonymous ones) to enable or disable MathJax. He said:

"I believe this has some advantages.

• All users can get better math rendering but are not forced to have it
• Wikipedia would become accessible to all math-capable screen readers

(I've heard complaints that user registration is not not very accessible).

• Users get to vote with their feet -- usage data could indicate if MathJax

rendering quality is worth it."

This could be a intermediate step, exploring whether it makes sense to enable it by default (bug 36496).

See http://news.gmane.org/gmane.science.linguistics.wikipedia.technical/ for the full post.

However, there are some issues we'd probably want to resolve first, including i18n (bug 35038).

I also don't think the minified files in the source tree are ideal (some of which overlap), but apparently it's because MathJax has its own loading system that clashes with ResourceLoader.

Version: master
Severity: enhancement
https://bugzilla.wikimedia.org/show_bug.cgi?id=36496
https://bugzilla.wikimedia.org/show_bug.cgi?id=20151

Reference
bz48036

Related ObjectsSearch...

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:35 AM
bzimport set Reference to bz48036.
bzimport added a subscriber: Unknown Object (MLST).

Hi Matthew

Thanks for posting this here.

Just to repeat it hear: MathJax v2.2 beta has been released, which includes a full localization module. http://www.mathjax.org/mathjax-v2-2-beta-now-available/

To repost the jquery code for experimenting:

$('img.tex').wrap('<span class="MathJax_Preview" />'); // this will allow MathJax to replace the images with its rendering on the fly$('.MathJax_Preview').after(function() {

	  tex = $(this).find('img').attr("alt"); //grab the TeX code return " <script type='math/tex'>" + tex + "</script>" ; //add the script behind the MathJax_preview TODO handle display style });$.getScript('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.1-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); //run MathJax

People can put this into a bookmarklet to give it a test run. It's missing a) the correct configuration file for Wikipedia and b) support for display math. Maybe somebody can correct that.

Note that this way, the user will always see math on the page -- MathJax will typeset an equation and replace the image only with the final output.

There's a configuration option in MathJax called EqnChunk that allows you to specify how many equations get typeset before placing them in the page. The default is relatively high to avoid "flickering", but in this case it might be worth exploring a low setting.

Peter.

physik wrote:

Hi Peter,

I created a roadmap for the future of the Math extension.
Maybe we can get a coherent vision there.

Best
Moritz

Hi Moritz,

Thanks for pointing to that document. My proposal here doesn't really affect the roadmap though, no?

Peter.

So from the "see also" bug 20151, it seems that this feature is very unlikely to happen. Or are WikiMedia people inclined to do an exception for the Math extension?

I think the main concern in bug 20151 is that the HTML cache for anons would be fragmented.

If we can serve the same HTML to all anons, but use a cookie (which the server doesn't even need to look at) to determine what JS runs (MathJax vs. no MathJax), it shouldn't cause Squid or Varnish fragmentation.

This should be possible, since the math images currently served to all anons already contain TeX as an alt attribute.

If we can serve the same HTML to all anons, but use a cookie (which the
server
doesn't even need to look at) to determine what JS runs (MathJax vs. no
MathJax), it shouldn't cause Squid or Varnish fragmentation.

This should be possible, since the math images currently served to all anons
already contain TeX as an alt attribute.

To follow-up on this, my experimental commit

https://gerrit.wikimedia.org/r/#/c/78466/

generates the following HTML code:

<span class="MathJax_Preview"><img ...></span><script type="math/tex">...</script>

so this can be used for both the MathJax and no-MathJax modes:

• In the no-MathJax mode, the image will be rendered and the <script> hidden.
• In the MathJax mode, the image will be rendered as a preview until MathJax replaces it by its HTML output.

So to summarize the status here:

• With MathJax 2.3, it should be possible to use MathJax's "unpacked" version and load them with the ResourceLoader. I didn't really want to submit a patch for the master branch since MathJax 2.3 is still in development but Moritz told me to send one to the dev branch: https://gerrit.wikimedia.org/r/#/c/83117/ (apparently, this "dev" branch is actually just Moritz's LaTeXML branch that has been renamed and IIUC the patches are directly reviewed and accepted on the master branch. So I'll probably need to rewrite a patch for the master branch when MathJax 2.3 is released)

After these points are addressed, I think the MathJax option could be exposed to all visitors.

Any thoughts?

I see that MathJax has been added for TWN, and the patches linked to have been merged. Are we closer to getting this to be more widely toggleable?

physik wrote:

https://gerrit.wikimedia.org/r/#/c/85801/ Removes the rendering mode MathJaX and adds an orthogonal option to use MathJaX (a check-box) independent of the rendering mode. Thus the user will see the the images immediately before MathJaX is loaded and tries to replace them with something better.
Technically, we introduce the user option 'mathJax' in the following way to the preferences.

			\$defaultPreferences['mathJax'] = array(
'type' => 'toggle',
'label-message' => 'mw_math_mathjax',
'section' => 'rendering/math',
);

I'm not sure if users that are not signed in can somehow find that option... At least I did not found the section 'rendering/math' when I logged out.

Maybe we can add a context menu to the png images in a later step... once MathJaX 2.3 is released.

No, the preferences system (e.g. Special:Preferences) can not be used when logged out (see above and bug 20151).

If this is implemented, it will probably work with a cookie (or perhaps localStorage in supported browsers, to avoid unnecessarily sending it to the server).

If they are logged in, though, the toggle could also change the preference (even though they're not on the main preference screen) through the API.

Matthew, is there support for this feature at WMF? Since this would have to integrate into the UI, a design decision from WMF seems required. Perhaps those with an interest could meet up on IRC to collect ideas.