MathJax preview available

MathJax preview available

by Marc Grober -
Number of replies: 18
January 12, 2009 the folks at MathJax finally released a preview of MathJax Beta 1, which is available at http://www.mathjax.org/?page_id=13. The good news is that the display appears excellent, it is supposed to be browser independent and you can make use of it via web server or locally on your own machine. The bad news is that it takes forever to display (users of jsMath are accustomed to that) and of course you will have to install the application fonts. Documentation is available here: http://www.mathjax.org/?page_id=259

Among other matters flogged on the MathJax blog is the involvement of Elsevier, evidencing additional corporate involvement in the project.

I will be doing some testing with Moodle 1.9.7 and encourage others to post any experiences in this thread.

Some presentations on usage of MathJax:

http://www.math.union.edu/~dpvc/talks/2010-01-15.mathjax/

http://www.mathjax.org/ext/miner-jmm2010/
Average of ratings: -
In reply to Marc Grober

Re: MathJax preview available

by Davide Cervone -
Marc:

Just a few clarifications on what you said: first the beta version of MathJax has not been compressed, so downloading the JavaScript is slower than it will be in the final version, and since these files will be cached, it should be faster for subsequent pages.

Second, you do NOT need to install the fonts, as MathJax used @font-face to access web-based font files, when the browser supports that. (But if you do install the fonts, it will help, since that will be one less thing that needs to be downloaded when you view the age). Also, MathJax will use the STIX fonts, if you have them installed, so that will help some users to not need to wait for web-based fonts.

Finally, MathJax is also supported by the AMS, SIAM, Design Science, and APS, in addition to Elsevier.

Davide
In reply to Davide Cervone

Re: MathJax preview available

by Marc Grober -
Lol, just tweeting with Paul about this. I was referring to server side font install, not client side, but am curious as to what happens if fonts not available either on local
machine nor webserver based on your note. Will be excited to see compression results.
In reply to Marc Grober

Re: MathJax preview available

by Davide Cervone -
OK, sorry for the misunderstanding. If the fonts are not installed on the server and neither the STIX nor MathJax TeX fonts are installed on the client, then MathJax will either try to load the (non-existent) web-based fonts, and the client will see a long delay as this times out for each needed font, and then uses the default browser font, which will look terrible, or MathJax will try to load the image fonts, and will fail to load the needed data file, then probably crash when it attempts to access the non-existent data. MathJax does expect you to have a complete installation on your site.

I haven't done any compression yet, so can't tell you what the difference will be. But with jsMath, the compression was about 50% (in file size), and I expect it will be similar for MathJax. So that should help substantially.

Davide
In reply to Marc Grober

Re: MathJax preview available

by Stuart Anderson -
Well I'm happy to share my evaluation of MathJax (and a few other such systems). My institution runs Blackboard, but I used to run a moodle service and still miss it.

My testing area is a little ad-hoc, but it is primarily intended for me. Sorry if these links break in the distant future!

http://aiss-007-066.csist.manchester.ac.uk/~stuart/web-maths/index.html

Of interest might be some testing which compares a a number of systems (and yes, I know it is really just two families of script).

http://aiss-007-066.csist.manchester.ac.uk/~stuart/web-maths/testing/all-results/all-results-table.html


MathJax has impressed me most and Davide has been most helpful in helping me understand how to get the best out of it. You might find my testing of AMS-LaTeX support useful to get a quick overview of how complete the system is:

http://aiss-007-066.csist.manchester.ac.uk/~stuart/web-maths/further-testing/test-ams-latex/index.html

Regards,

Stuart.
In reply to Stuart Anderson

Re: MathJax preview available

by Marc Grober -
Thank you for sharing your analysis, Stuart.

In some respects though I think you are not comparing apples and apples ;) By this I mean that you are comparing a corporate financed everything but the kitchen sink app "solution" with various projects which were never intended as comprehensive solutions.

I run a version of asciimathml that contains Peter's work, David's fallback, some fixes from Mauno and others and a couple of tweaks of my own. I can view equations quickly, even on my iPhone, while mathjax having spent a minute loading tells me it can't load a file and then advises it's processed 0% forever....

Don't get me wrong. Mathjax is very exciting, it still early in it's development, and compression is not implemented yet, but to decide at this point to choose mathjax without for example looking at some of the work Mauno has done integrating google chart API, latexmathml, asciimathml and jsxgraph would be unfortunate I think.

In reply to Marc Grober

Re: MathJax preview available

by Stuart Anderson -
Hi Marc,

Yes, performance of mathjax is a concern at the moment. I certainly am aware of short comings of my analysis. The criteria during testing which was most important to me was "does it work on LaTeX fragments without the LaTeX needing any alteration". I deal with a very unforgiving audience in my job and if something doesn't give results straight away, people turn away and don't come back.

I've not deciding anything definite on what I recommend to my colleagues in the University I work at. The concerns you have raised about the commercial associations of MathJax are playing on my mind a little. It may be the case that more than one solutions is offered with the strengths and weaknesses of each made clear. For example, the graphs and charting stuff sounds very useful.

I think it would be very useful to me if you could post up some likes to your own asciimathml/latexmathml scripts which perform better than the default ones. I would also like to double check if asciimathml/latexmathml are actively being developed any more as I found it hard to tell. I'm more than happy to change the javascript libraries in my tests and do the comparison again.

One aspect of the scripts which does bother me is the mathml output. The lack of native support in current versions of IE and webkit bothers me. Though the MathML project in webkit seems to have been rekindled, I have heard no suggestions that IE9 with natively support MathML. Whilst I know you can install the MathPlayer plugin to get around the problem for IE users, it is still an extra barrier to use. It's hard enough getting our students to engage with on-line notes let alone install a plugin as well. I would appreciate any thoughts or experiences you can share on this.

Anyway, please send me links to the work Mauno has done. I've ended up putting more effort into looking at MathJax simply because of lack of knowledge on how to get the best out of other systems such as the asciimathml/latexmathml scripts. AMS-LaTeX compatibility is quite important to me.

Thanks for your comments,

Stuart.
In reply to Stuart Anderson

Re: MathJax preview available

by Mauno Korpelainen -

Hi Stuart,

you can see some examples about modified asciimathml and latexmathml scripts in http://korpelainen.net/plugindemo (demo user: username test, password test) and some basic examples with Google Chart API Tex fallback (Mimetex type code) in http://korpelainen.net/gmoodle (only limited access to post some forum posts with username test, password test to test the editor plugin)

Both of these scripts use fallback for other browsers than FF and installing of MathPlayer is not required - first one to Mathtex & TexLive and second one to Google Chart API Tex. In plugindemo you can add pure Latex with double @:s ("forced fallback to Mathtex"), use Tex filter with double dollars (TexLive), use a little modified LatexMathML with single dollars and use AsciimathML with backticks.

My demo site is made mainly for testing editor plugins - not for testing Latex syntax... we already have a good renderer for Latex syntax - full package of TexLive. I agree with Marc - it is possible to modify AsciimathML/LatexMathML scripts to output any kind of Latex code but it was not the original meaning of creating those scripts. AsciimathML was created to help students in using typical "school maths" with a little simpler syntax than traditional Latex. You can take a simple example about nth roots to show that some scripts fail in some expressions because (La)TeX, Mimetex, MathTran, AsciimathML, LatexMathML or MathJax may just use different syntax and you need to know what syntax to use to get correct result...

I have not tested yet MathJax but the quality of output is nice and if the performance of those scripts gets better MathJax could be as well used together with other math scripts in moodle, editor plugins etc. Different users of moodle have different needs and therefore all new scripts that help teaching and writing of maths (online) are welcome.

But AsciiMathML scripts will never output images like attached image from your site wink

Attachment xymatrix.png
In reply to Mauno Korpelainen

Re: MathJax preview available

by Stuart Anderson -
Hi Mauno,

Many thanks for all this information. It's interesting that you make the point that the ASCIImathML scripts were created to help students using what you call "school maths". From my perspective, I am trying to get academic staff in a Higher Education institute engaged with using web based tools, particularly for feedback. I feel I need to go with a syntax which they are all already familiar (LaTeX) and allow them to use their existing LaTeX mathematics largely unmodified. Although a few would spend time to learn something new, there will also be plenty who will refuse to. The majority in the middle of these two groups might give something new a go if it is really, really straight forward.

As the ASCIIMathML, the graph features are interesting and I will investigate further. As for the XY Matrix you spotted on the testing site, I had no expectations that any of the systems would render it! I put an invite out to academic staff to send me LaTeX examples of mathematical equations you use in everyday teaching. Some of course ignored me and I got sent some pointless examples others misunderstood me and sent examples such as the XY Matrix which were clearly beyond the aims of any of the tested systems. I included it really to just manage expectations so that there was a clear example of something such systems *can't* do!


Thanks for your info,

Stuart
In reply to Stuart Anderson

Re: MathJax preview available

by Marc Grober -
While I know there will be substantial performance improvement in mathjax, one will always have to balance performance hit vs the comprehensiveness of the solution. Asciimathml could use a major makeover I think, and that may not happen, mores the pity, but as you can see by visiting MA's site at asciimathml.com, it is alive and kicking (despite claims by some, as well, that mathml dev for FF is dead).

Mauno speaks for himself-lol-and it looks like he provided links to his test beds, which probably contain some of the most comprehensive explorations of math tools for moodle 2. I think that deconstructing asciimathml offers the possibility of using it as an API for a wide range of math tools, but that would likely require that some university take such development on, and I have seen no takers.

Re IE9, I can only argue that there is no reason to use it, or any MS products. Indeed, refusing to use MS products is actually good for MS as for way too long MS has been driving users, not the other way round. I think webkit will have mathml support by end of year and FF could not be simpler to install (though there is still the matter of stix fonts, but that is no more difficult than ff install and I think may also be resolved by end of year.)

The US took major steps to create profit centers out of education during the Bush years and it may take many more years to undo what was done. One could easily argue that the greatest beneficiary of NCLB was Pearson et al, not students, of whom it could also be argued were to benefit only via nclb's school failure options (ie nclb was regarded by some as a national voucher tool.) I can argue four sides on those issues (but won't-lol) but point is that I bet Pearson has more development cash than goes into webworks or stack or asciimathml.

Even when we tout openoffice, we have to recognize that it's corporate sponsor has had an axe to grind, and while using google chart API is great, google is as interested in purchasing your soul as Microsoft, and I am STILL waiting for my wolfram alpha appid-lol !!

If we are ever going to put an end to getting bent over in the marketplace only to thank our corporate masters for the beneficence they took from our pockets, we are going to have to do some suffering, and I don't think we have the heart, and we will not go raging against the night, but with a whimper..

In reply to Marc Grober

Re: MathJax preview available

by Stuart Anderson -
Hi Marc,

Sadly, I know were you are coming from. There I was happily looking after a moodle service in the School of Computer Science when with very short notice I was restructured into a more central University team to look after a Blackboard 8.0 service. And yes, I did make my dissatisfaction clear.

On the browser wars argument, whilst I loath IE from both a web and a general user experience developer point of view. I am stuck with it and have to expect my audience to use it with annoying regularity. It is the default browser across campus, although Firefox is also installed. Until last September, the installed version was IE6 we are now way ahead and moved to IE7! So my point is that whether I like it or not, IE is a big issue and does hold back what I can do. To be honest, I move between Chrome and Firefox on a daily basis because Chrome has a faster javascript engine to alleviate some of the frustration with Blackboard's slow loading times.

Thanks for highlighting your concerns about the corporate links to MathJax. I think I was naive not to consider it too much. I shall certainly raise it as a "risk".

Regards,

Stuart.
In reply to Marc Grober

Re: MathJax preview available

by Marc Grober -
The current version of MathJax available from the SourceForge SVN outputs MathML. Experimenting with the code indicates that outputting MathML with local STIX fonts will give you very quick responses (I am still working on understanding MathJax's browser differentiation features.) MathJax will easily work alongside asciimathml. Indeed the discussion on the mathjax forums has already touched on an asciimathml processor for mathjax- lol. There are some cross domain issues with web fonts usage which caught me by surprise but the sourceforge discussion forum suggests a work around.
In reply to Marc Grober

Re: MathJax in Moodle

by Marc Grober -
I have MathJax working alongside ASCIIMathML in Moodle. At presentI have MathJax doing both native MathML and TeX using double @s for tokens. The next phase will be turning off the LatexMathML and having MathJax handle dollar tokens. I was surprised how much speeder MathJax was even without compression using the newly rolled out option to render as MathML - using this option and with the STIX fonts installed the response is very nice.
In reply to Marc Grober

Re: MathJax preview available

by Marc Grober -
For those wanting to get MathJax running with Moodle, I have been working with David and with the latest svn of MathJax not only does MathJax perform well, it plays nicely with asciimathml. As appended, the file allows ASCIIMathML to parse dollar signs, but my guess is that if you are going to have both running you may want to turn processing of dollar signs off in ASCIIMathML and set MathJax to process them, and that is easily tweaked in MathJax in the Hub config, and can be set for ASCIIMath at the head of the js file.

Attached hopefully is the meta.php file I used to implement MathJax.
In reply to Marc Grober

Re: MathJax preview available

by Marc Grober -
For comparison vis-a-vis equation editor, here is a recent constructor in php using MathJax:

http://fpg87.netsons.org/eq_editor/editor_eq.php
In reply to Marc Grober

Re: MathJax preview available

by Mauno Korpelainen -

MathJax version of http://www.codecogs.com/components/equationeditor/equationeditor.php

I will try to start testing mathJax next week (have been lazy all year...) - there seem to be some problems with rendering MathJax in IE8 but that equation editor might not use the latest code of mathJax...

By the way - did you check http://tracker.moodle.org/browse/MDL-19524 ?

In reply to Mauno Korpelainen

Re: MathJax preview available

by Marc Grober -
Hey Mauno,

I will try to start testing mathJax next week (have been lazy all year...) - there seem to be some problems with rendering MathJax in IE8 but that equation editor might not use the latest code of mathJax...


I am pretty sure the author was working with Beta1. I installed via SVN so have been trying to stay current especially as Davide has been doing some tweaks to address the asciimathml conflicts over innerHtml. I suggest you do the same. There were some initial issues with displaying across domains, but I have not seen those problems for some time.

This week I was going to test your latest asciimath files against mathjax and jsxgraph, with asciimath's latexmathml off as well as look at filter options as there are those who need a "filter" as oppose to the meta.php invocation. If you have specific versions of asciimathml you'd like me to use point me to them. I did mention jsxgraph to Davide as Mathjax is specifically built along the lines I have been pushing (i.e. preprocessor etc) and Davide thinks this is certainly doable, but I am still a bit nervous about the corporate funding..... But I was going to suggest that Alfred & Co consider the MathJax structure and how jsxgraph might be integrated..... Certainly MathJax could also handle asciimath and asciisvg text expressions.

BTW, I did note that Alfred has included one of your asciimath versions in jsxgraph v80 smile

MathJax version of http://www.codecogs.com/components/equationeditor/equationeditor.php

Precisely.... I posted it because there was discussion of the above version earlier on the forum.

By the way - did you check http://tracker.moodle.org/browse/MDL-19524 ?

LOL, how would I find out about that MDL? I did post there (a couple of times now) and I have been corresponding with Alex and Chris over the recent confusion over the confusion experienced by the recent post who downloaded the sourceforge version but followed their link and di the moodle install, and brought MD's post to their attention. I have a better understanding of the problem now and have offered to spend the time to run it down, but we shall see what develops.... As I pointed out to Petr, it would be easy enough to simply include the integration files in core, and leave the GPL issues to be resolved when they are resolved, but based on prior discussions, I am thinking that Moodle HQ may not look upon my suggestions favorably....

In reply to Marc Grober

Re: MathJax preview available

by Mauno Korpelainen -

Marc,

I made some tests with MathJax and basicly it looks very good in all major browsers - IE8 is still slow but after some months MS folks have updated to IE9 which should be at the same speed level as Chrome, Opera, Firefox and Safari so for sites using math MathJax is a good option.

One thing that may cause some headache is the huge number of images (almost 30000 files) when you install MathJax locally - people using CPanel with FTP may spend some time in unzipping and uploading files to their sites - but most people need to do this operation only once.

It will be easy to create different kinds of plugins for adding MathJax type (TeX) maths through editor plugins - current HTMLArea (most likely) strips < and > tags so adding MathML directly may require some changes to editor plugins.

I am very optimistic about moodle 2 with flexibility to change editor/configurations even if actual files of DragMath were not included - still it would be ideal to have those GPL2/3 issues solved and full package of DragMath in moodle 2 by default. The only thing I am a little worried is that we are in May now... http://docs.moodle.org/en/Roadmap ... we may need to wait the stable release of moodle 2.0 a little longer than expected. wink

In reply to Mauno Korpelainen

Re: MathJax preview available

by Marc Grober -
Remember, this is beta code w/o compression. Mathml usage was just rolled out a couple of weeks ago. However, perhaps a more important issue is present limitations on extending TeX of mathjax (\longdiv problem)

I did svn install (recommended) in 2-3 minutes and then unzipped fonts. I imagine that at some point the svn will include unzipped fonts. Cpanel has a cron feature, doesn't it? This can be used to run svn or wget commands.

Chris is working on resolving the hang up w dragmath (I have been corresponding with him on this) but if m2 simply includes integration files it won't bstruct development and the gpl issue will be resolved soon. I have yet to see Petr agree to this.