Showing posts with label MathJax. Show all posts
Showing posts with label MathJax. Show all posts

Saturday, June 18, 2016

MathJax Whiplash

Technology is continuously evolving, and for the most part that's good. Every now and then, though, the evolution starts to look like a random mutation ... the kind that results in an apocalyptic virus, or mutants with superpowers, or something else that is much more appealing as a plot device in a movie or TV show than in real life.

Back in 2010 I switched math rendering in this blog to MathJax, and things went swimmingly ... for a while. Then rendering got glitchy in Firefox (I forget exactly when), and I ended up installing a trio of Firefox extensions (MathML-Fonts, MathML Font Settings, and Native MathML), which fixed things ... for a while.

Last December things got goofy again. Math formulas were causing excess vertical space to appear between lines. Google Chrome was unaffected; I only saw this in Firefox. (I never use Internet Exploder, Safari or Opera, and don't use Chromium very often, so I have no idea if any of them were affected.) As I noted in an otherwise unrelated post, the problem seemed to cure itself while I was busy searching for help, so I never knew what caused it or, for that matter, what cured it. No matter; rendering once again worked properly ... for a while.

A week or so ago, I noticed that the vertical spacing issue had returned. Today I finally took the time to go looking for help. The closest I came to a fix was finding information in a MathJax FAQ that the configuration I was using in the blog had been deprecated as of MathJax v2.6. In particular, I had been using a configuration that defaulted to native MathML where possible, given that Firefox supports MathML. One sentence in the FAQ caught my eye:
While MathJax’s NativeMML output processor works around various limitations of Firefox/Gecko and Safari/WebKit, the results using the NativeMML output processor may have spacing or other rendering problems that are outside of MathJax’s control.
So I changed the blog configuration to the option now "preferred" by MathJax ("CommonHTML"), but that did not help. Screwing around with the font choices provided by the MathML Font Settings extension, I found exactly one font that displayed correctly. (I forget now which it was, but it was not what I would call an obvious choice.)

I'm not sure what inspired me to try it, but I disabled all three extensions on my desktop machine ... and, lo and behold, the problem disappeared. Apparently some change either in MathJax (circa version 2.6?) or Firefox made the font overrides done by the extensions an enemy rather than an ally. I confirmed that disabling the extensions on my laptop also fixed the problem there.

So rendering of math in Firefox is once again working properly ... for a while. But I'm leaving those extensions installed, just in case.

Tuesday, December 29, 2015

Oracle Java 8 Update

For quite a while, I was getting security nags from Firefox every time a web site wanted to run a Java applet. Firefox would tell me I needed to upgrade to the latest version of Java. That would have been fine, except that I was already running the latest Java (1.8.0_66 as of this writing). I manually downloaded and installed the SDK (which includes the JRE). So apparently there was something about the installation that was confusing Firefox into using an earlier version (?).

Anyway, long story short, I found a PPA from the ever helpful folks at Web Upd8 that makes it easy to get the installation correct, at least on Ubuntu and derivatives (including Mint). The PPA installs a package that downloads the binaries from Oracle, installs them, makes them the defaults etc.

On an unrelated note, this was not the post I started to write. I enter the math notation in this blog in LaTeX and rely on MathJax to translate it to MathML for browsers that understand MathML (Firefox being one). I noticed a week or so ago when viewing an old post that Firefox was inserting copious unnecessary (and unwanted) vertical space on either side of any line containing math, whether the math was "inline" or "display mode". Horizontal spacing was fine; only vertical spacing was munged. Checking around, I found that (a) it was happening on every page with MathJax content, not just on my blog, (b) it depended to some extent on which font was being used (with the XITS font, no extra space was inserted), and (c) Google Chrome was unaffected. So it appeared to be something involving the combination of Firefox and specific fonts. I did some research on Firefox extensions and was literally half way through typing up a post with a solution when, by chance, I discovered that the problem apparently went away. I don't know what changed, but suddenly Firefox is getting the vertical spacing correct again.

So my new tool for all technical problems is to write half a blog post about them and then see if that is enough to cure the problems. :-)