Last modified: 2014-10-19 18:25:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T50036, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48036 - Add option for all visitors to toggle Math modes
Add option for all visitors to toggle Math modes
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
Math (Other open bugs)
master
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 35038 35480 53992
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-03 09:11 UTC by Matthew Flaschen
Modified: 2014-10-19 18:25 UTC (History)
10 users (show)

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


Attachments

Description Matthew Flaschen 2013-05-03 09:11:52 UTC
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.
Comment 1 Peter Krautzberger 2013-05-03 21:06:42 UTC
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.
Comment 2 physikerwelt 2013-05-04 07:49:06 UTC
Hi Peter,

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

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

Best
Moritz
Comment 3 Peter Krautzberger 2013-05-06 02:18:42 UTC
Hi Moritz,

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

Peter.
Comment 4 Frédéric Wang 2013-07-25 13:55:12 UTC
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?
Comment 5 Matthew Flaschen 2013-07-26 04:11:41 UTC
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.
Comment 6 Frédéric Wang 2013-08-10 06:58:52 UTC
(In reply to comment #5)
> 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.
Comment 7 Frédéric Wang 2013-09-09 10:50:39 UTC
So to summarize the status here:

- The localization should be ready with MathJax 2.3. We are waiting for MathJax be accepted by TranslateWiki, but they agree that the JSON data will work: http://translatewiki.net/wiki/Thread:Support/Adding_MathJax

- I've submitted an easy patch to merge the output of the texvc and MathJax modes as well as using the PNG images as a preview before MathJax rendering: https://gerrit.wikimedia.org/r/#/c/83399/

- 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?
Comment 8 Yuvi Panda 2013-09-29 07:07:16 UTC
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?
Comment 9 physikerwelt 2013-09-30 01:34:16 UTC
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.
Comment 10 Matthew Flaschen 2013-09-30 18:13:27 UTC
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.
Comment 11 Peter Krautzberger 2013-09-30 18:23:41 UTC
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.
Comment 12 Matthew Flaschen 2013-09-30 18:31:16 UTC
(In reply to comment #11)
> 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.

I'm not working on Math, so I don't want to be a bottleneck.  But a good next step might be to suggest a user interface on the design list (https://lists.wikimedia.org/mailman/listinfo/design-l).  That's open to everyone, not just WMF people.
Comment 13 physikerwelt 2014-10-19 18:25:58 UTC
It's a task of the Math extension to chose which rendering is best for the device of the user. The user should not be bothered with this decision.

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


Navigation
Links