Opened 10 years ago

Last modified 7 years ago

#9774 closed enhancement

Upgrade the notebook to use MathJax instead of jsMath — at Version 9

Reported by: mpatel Owned by: jason, was
Priority: major Milestone: sage-5.4
Component: notebook Keywords: sd41
Cc: rbeezer, robert.marik, jhpalmieri, rkirov, kcrisman, kini Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, but not in a stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jason)

MathJax is the successor to jsMath.

This will also fix #1608

Jason Grout says:

I have a half-finished patch up at http://sage.math.washington.edu/home/jason/sagenb-mathjax.patch.gz (gzipped because it's so big).

I had a mathjax_imagefonts-1.0.spkg somewhere, but I think I deleted it. Sorry! The mathjax patch above does not include the large fonts directory in mathjax (following these instructions), which the mathjax_imagefonts spkg restores.

Change History (9)

comment:1 Changed 10 years ago by rbeezer

  • Cc rbeezer added

comment:2 follow-up: Changed 10 years ago by rbeezer

  • Cc robert.marik added

I've been experimenting a bit with MathJax, outside of the notebook. Mostly thinking about how it will handle tex4ht output in jsMath mode, but here are some some observations that might be useful:

  1. Easier in most ways to structure a page to use MathJax. Just insert something like
<script type="text/javascript" src="path-to-MathJax/MathJax.js"></script>

No need for a "process()" call at the end, etc.

  1. Default is to not recognize single dollar-signs as delimiters. Alternative is \(..\). This would be a good thing, since if a user adds text (via TinyMCE) right now jsMath tries to parse the following as math. $$..$$ and \[..\] both work for display math. We would break lots of old worksheets if we stopped recognizing $..$.
  1. There is a jsMath compatibility mode. I believe I've found one bug in this already (reported upstream). I'd imagine this is not a development priority, but who knows?
  1. Modes and configuration is controlled globally by config/MathJax.js which is just one huge well-commented Javascript object. It can be overridden in a web page by adding a new version into the script block mentioned above. Maybe we want to make this easy for users to access, or maybe it is easy already, or maybe we don't want to bother.
  1. This looks to me like the best introduction to the types of decisions we will want to make about what to cut over to:

http://www.mathjax.org/resources/docs/?configuration.html

  1. MathJax is HUGE. Fonts for lots of Unicode points, I guess. SVN checkout is 53 MB, after unzipping fonts.zip it all occupies 171 MB.
  1. I just noticed this morning that html.table() uses class="math" which is a jsMath way to tag span's or div's for processing. I haven't found how to do something similiar in MathJax, though this will work in jsMath compatibility mode. A very small test would indicate that the two modes can be used at the same time.
  1. Consonant with (2) and (7), I'd love to see the notebook formatting move to something closer to rigorous XML (ie XHTML, I guess). Certain types of processing would be easier if we did, but that is not really what this ticket is all about.

comment:3 Changed 10 years ago by robert.marik

Thanks for comment, I feel that MathJax? is much slower on cheap/older computer. This could be an important issue for using Sage in highschools and universities. Is it possible to keep both MathJax? and jsMath and let the notebook admin to choose, which one will be used?

comment:4 in reply to: ↑ 2 Changed 10 years ago by jason

Replying to rbeezer:

  1. MathJax is HUGE. Fonts for lots of Unicode points, I guess. SVN checkout is 53 MB, after unzipping fonts.zip it all occupies 171 MB.

I think MathJax? includes the equivalent of our jsmath-image-fonts spkg. If we added MathJax? to Sage, it might be good to strip out the image fonts and distribute them separately as a mathjax-image-fonts spkg (mathjax faq tells how to do this, I believe). Somewhere I have a half-finished prototype of this solution.

comment:5 Changed 10 years ago by jhpalmieri

  • Cc jhpalmieri added

comment:6 Changed 10 years ago by jason

  • Description modified (diff)

comment:7 Changed 10 years ago by jason

  • Description modified (diff)

comment:8 Changed 10 years ago by jason

  • Status changed from new to needs_work

comment:9 Changed 10 years ago by jason

  • Description modified (diff)
Note: See TracTickets for help on using tickets.