Hi,

Here's an idea somebody suggested to me.

I would like to propose a way for any visitor to opt-in to MathJax on the
fly. (Oh, maybe I should add a disclaimer: I work for MathJax.)

This would be simply a button on pages with math that would switch MathJax
on (and possibly off via a cookie).


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.

I think this idea would be relatively simple to implement. Since the math
images already contain their own TeX code as alt-text, MathJax can replace
the images on the fly.

Excuse my poor javascript skill, but something like the following

$('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

should be an approximation.

Of course, this should really use Wikipedia's MathJax configuration file. A
real solution also should handle displaystyle math -- I couldn't figure out
how Wikipedia handles this in the images but the MathJax side would simply
need <script type="math/tex; mode=display">.

I'd be very interested to hear what people think.

Best regards,
Peter.
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to