Mathjax needs review

56 views
Skip to first unread message

jason...@creativetrax.com

unread,
Jan 13, 2012, 5:44:21 PM1/13/12
to sage-notebook, sage-devel
Hi everyone,

I've put up a patch to Sage and a SageNB spkg for review which upgrades
the notebook from jsMath to MathJax. If you are interested in reviewing
this, please follow the directions in the description of
http://trac.sagemath.org/sage_trac/ticket/9774. Basically, you need to
apply two patches and install one spkg.

The spkg uses the almost-reviewed new flask sage notebook. If the
mathjax changes pass positive review, then we can merge the changes into
the master flask sagenb tree and make an official sagenb spkg release.

Thanks,

Jason

William Stein

unread,
Jan 13, 2012, 6:04:06 PM1/13/12
to sage-n...@googlegroups.com, sage-devel

Are you planning to install mathjax on any *.sagenb.org?

> Thanks,
>
> Jason

Jason Grout

unread,
Jan 14, 2012, 1:11:55 AM1/14/12
to sage-n...@googlegroups.com, William Stein, sage-devel
On 1/13/12 5:04 PM, William Stein wrote:
> Are you planning to install mathjax on any *.sagenb.org <http://sagenb.org>?

I cleared off some space and installed this as well as the jmol update
at #11503 on test.sagenb.org.

So please, everyone, try mathjax and the new jmol out at
test.sagenb.org. Please note that a lot of the user-visible changes to
jmol are coming in a later ticket; #11503 is mainly about upgrading jmol
and making it an independent spkg.

Thanks,

Jason

Jason Grout

unread,
Jan 14, 2012, 1:13:33 AM1/14/12
to sage-n...@googlegroups.com, William Stein, sage-devel

Oh, and test.sagenb.org is also running 5.0.beta1, which includes the
python 2.7 upgrade and many other things, so feel free to test those as
well.

Thanks,

Jason


P Purkayastha

unread,
Jan 14, 2012, 2:17:36 AM1/14/12
to sage-n...@googlegroups.com, William Stein, sage-devel


On Saturday, January 14, 2012 2:11:55 PM UTC+8, Jason Grout wrote:
On 1/13/12 5:04 PM, William Stein wrote:
> Are you planning to install mathjax on any *.sagenb.org <http://sagenb.org>?

I cleared off some space and installed this as well as the jmol update
at #11503 on test.sagenb.org.


There is one glitch in mathjax with "<" and ">" signs.  See http://test.sagenb.org/home/pub/19/
I have tested it in firefox-8 and in opera-11.60 (Gentoo, 64bits). Jmol is working.

Dima Pasechnik

unread,
Jan 14, 2012, 7:41:58 AM1/14/12
to sage-...@googlegroups.com, sage-n...@googlegroups.com
looks good (chrome on MacOSX). 
What about making jmol request permission to run without explicit page reloading?
Is it a bug or a feature?


Dima Pasechnik

unread,
Jan 14, 2012, 7:50:31 AM1/14/12
to sage-n...@googlegroups.com, William Stein, sage-devel
I am not sure if this is Sage's bug. Similar things happen on mathoverflow.net...
On the other hand it might just mean that the mathjax settings need to adjusted.
Or could it be tinymce?

Jason Grout

unread,
Jan 14, 2012, 1:19:39 PM1/14/12
to sage-n...@googlegroups.com, P Purkayastha, William Stein, sage-devel
On 1/14/12 1:17 AM, P Purkayastha wrote:
>
>
> On Saturday, January 14, 2012 2:11:55 PM UTC+8, Jason Grout wrote:
>
> On 1/13/12 5:04 PM, William Stein wrote:
> > Are you planning to install mathjax on any *.sagenb.org
> <http://sagenb.org> <http://sagenb.org>?

>
> I cleared off some space and installed this as well as the jmol update
> at #11503 on test.sagenb.org <http://test.sagenb.org>.

>
>
> There is one glitch in mathjax with "<" and ">" signs. See
> http://test.sagenb.org/home/pub/19/
> I have tested it in firefox-8 and in opera-11.60 (Gentoo, 64bits). Jmol
> is working.


I've fixed the problem and updated test.sagenb.org.

I've fixed it by getting rid of the math_parse function and conditional
typesetting we were doing. We've configured MathJax to make the
math_parse function obsolete, and it's inconsistent to typeset only
conditionally. See
https://github.com/jasongrout/sagenb/commit/6a4eed4d6baf78cd19fe634144c727843d1af08d
and
https://github.com/jasongrout/sagenb/commit/8d6b0a071c13850cea983faaa6b910be498cd0ae

Thanks for the feedback; please test the fixes.

Jason

William Stein

unread,
Jan 14, 2012, 2:49:39 PM1/14/12
to Jason Grout, sage-n...@googlegroups.com, P Purkayastha, sage-devel
On Sat, Jan 14, 2012 at 10:19 AM, Jason Grout
<jason...@creativetrax.com> wrote:
> Thanks for the feedback; please test the fixes.

I really hate to write this, but it's important. Evidently, I have
never seriously looked at MathJax before just now, I guess, because my
first reaction is that Mathjax looks like "crap" compared to jsmath,
at least with Chrome 16.0.912.75 on OS X 10.7. The very first thing I
tried was "show(2/3* x^(3/2 + pi))". On sagenb.org with jsmath it
looks amazing -- just like pdflatex output. On test.sagenb.org it
looks horrible to my eye -- definitely nowhere close to tex or even
jsmath.

Even the example in the upper right of http://www.mathjax.org/ (at
that site) looks bad to me (which is also in the screenshot).

In Safari things look equally bad. In Firefox they look... a bit better.

Do I have to install special fonts? What am I doing wrong? If this
is really what MathJax looks like, I definitely don't want to switch
to MathJax.

-- William

Screen Shot 2012-01-14 at 11.40.00 AM.png

Harald Schilly

unread,
Jan 14, 2012, 3:11:39 PM1/14/12
to sage-n...@googlegroups.com
On Sat, Jan 14, 2012 at 20:49, William Stein <wst...@gmail.com> wrote:
> On sagenb.org with jsmath it
> looks amazing -- just like pdflatex output.  On test.sagenb.org it
> looks horrible to my eye -- definitely nowhere close to tex or even
> jsmath.

I just tried it with a bit different formulas, screenshot attached.
For me, the jsmath rendering has issues, e.g. the 0 at the integral
isn't aligned at the bottom, and the superscript numbers for the
powers are easier to read. So, just from my perspective, mathjax wins.
Maybe there are css settings interfering in your case? I don't know.

H

mathjax-vs-jsmath-chrome16-linux.png

Jason Grout

unread,
Jan 14, 2012, 5:37:34 PM1/14/12
to sage-n...@googlegroups.com, William Stein, P Purkayastha, sage-devel
On 1/14/12 1:49 PM, William Stein wrote:
> Do I have to install special fonts? What am I doing wrong? If this
> is really what MathJax looks like, I definitely don't want to switch
> to MathJax.


I pushed a fix to test.sagenb.org. The default now should be to use TeX
local fonts, then TeX web fonts. When Lion is fixed, or MathJax 2.0 is
released, we can re-enable STIX fonts and look at them then.

Davide also pointed out how I incorrectly turned off image fonts. I
fixed that, so selecting image fonts should now just fall back to
unicode if you don't have the image fonts installed, instead of giving
an error.

Thanks,

Jason

P Purkayastha

unread,
Jan 14, 2012, 6:24:13 PM1/14/12
to Jason Grout, sage-n...@googlegroups.com, William Stein, sage-devel

Thanks a lot for the fix. This works here now on firefox. It also works
on opera as long as I am using the worksheet. The _published_ worksheet
on the other hand only half-works in opera. See the attached screenshot
for the glitch. Can anyone else confirm if the published worksheets work
in $browser in $OS?

FYI, my opera is 11.60 on Gentoo linux 64bits. I upgraded firefox today
and it is at version 9.0.1 (published worksheet works well in firefox).

opera-top-worksheet-bottom-published.png

Jason Grout

unread,
Jan 14, 2012, 11:11:31 PM1/14/12
to P Purkayastha, sage-n...@googlegroups.com, William Stein, sage-devel
On 1/14/12 5:24 PM, P Purkayastha wrote:
> Thanks a lot for the fix. This works here now on firefox. It also works
> on opera as long as I am using the worksheet. The _published_ worksheet
> on the other hand only half-works in opera. See the attached screenshot
> for the glitch. Can anyone else confirm if the published worksheets work
> in $browser in $OS?

It works fine for me (OSX 10.6.8) in FF 9.0.1, Chrome (current), and
Safari 5.1.2. I fixed one bug in the javascript code which seemed to
help Opera, but Opera still has problems displaying equations inside
text cells. It's weird; I can get it to display inside text cells on my
local machine when I switch rendering engines by right-clicking on a
MathJax expression. Sometimes, I can also get it to display by manually
running the MathJax processing command again. But I can't get it
consistently display typeset text cells (local or on test.sagenb.org).

Thanks,

Jason

P Purkayastha

unread,
Jan 15, 2012, 3:22:42 AM1/15/12
to Jason Grout, sage-n...@googlegroups.com, William Stein, sage-devel

Looking at the MathJax code (v1.1a downloaded from Mathjax website), it
seems that MathJax uses MathML to render stuff in firefox and IE but
HTML+CSS in opera and others. I looked at the MathML output in opera
from these two pages (which test MathML):

http://xml-maiden.com/userjs/mathml/examples/torture.xhtml
http://xml-maiden.com/userjs/mathml/examples/stress.xhtml

and it "looks" fine to me. I don't know the rationale behind not using
MathML with opera. I have a suspicion that this is done because opera
probably can not handle all forms of math properly.

Dima Pasechnik

unread,
Jan 16, 2012, 11:14:41 PM1/16/12
to sage-n...@googlegroups.com, sage-devel


On Sunday, 15 January 2012 06:37:34 UTC+8, Jason Grout wrote:
On 1/14/12 1:49 PM, William Stein wrote:
> Do I have to install special fonts?  What am I doing wrong?   If this
> is really what MathJax looks like, I definitely don't want to switch
> to MathJax.


I pushed a fix to test.sagenb.org.  The default now should be to use TeX
local fonts, then TeX web fonts.  When Lion is fixed, or MathJax 2.0 is
released, we can re-enable STIX fonts and look at them then.

AFAIK this is only configurable at the server side.
IMHO it must be at least client-side tweakable: e.g., it's totally unclear
to me how TeX local fonts are looked for on the client side.

For me with MacOSX and TeXLive installed at some not so standard location I never see
local fonts used.
How does one deal with this?

Thanks,
Dima
Reply all
Reply to author
Forward
0 new messages