Saturday, January 29, 2011

firefox4 and mathml - firefox needs font

MathML is a great idea and, in my opinion, offers the possibility for a 'light' way of achieving mathematics rendering on smartphones and netbooks.

To render Mathematics should we require javascript or some ajax plugin/component? The whole point of html5 is to create a web experience that requires *fewer* plugins, and MathML can play it's part here.


What does MathML look like?


...provided you have the full MathML font support installed on your computer!

It is not enough to just install Firefox and expect every MathML site to work.

Mozilla Firefox does an excellent job of bringing down (in 15MB) a full browsing experience suitable for a mid-range user. Yes it will browse regular html, yes it will browse open media. It has a great javascript engine.

What it does not [ necessarily ] cater for, straight from the box, is some 'power users'. If your type of typical web browsing is niche or specialist, then you might have to do a little work yourself, to help Firefox meet your 'power' needs.


How much mathematics do you browse?
  • Hardly ever
  • Once in a while
  • Several times a week
The answer for most users might well be 'Hardly ever', however if you view mathematics more regularly, then you will want full MathML support on your computer, and here is how.

For GNU/Linux you will likely search in your package manager for mathml, and ttf and lyx and otf and stix, or in convenient command line:

apt-get install xfonts-mathml ttf-lyx otf-stix

[ Non debian (and derivatives) might look for similar in yum or whatever auto tool is available ]

Taken together the three packages xfonts-mathml ttf-lyx otf-stix enable your computer to render a large amount of technical / mathematical text.

Here is a list of what ttf-lyx brings:
  • cmex10 - Computer Modern math extension
  • cmmi10 - Computer Modern math italic
  • cmr10 - Computer Modern Roman
  • cmsy10 - Computer Modern math symbols
  • esint10 - Alternate integrals
  • eufm10 - Euler Fraktur (medium-weight)
  • msam10 - Extra math symbols, first series
  • msbm10 - Extra math symbols, second series, including Blackboard Bold
  • wasy10 - Waldi symbol fonts
Those lyx files come down as .ttf, by contrast the stix files come down as .otf as shown here.

The Debian page for xfonts-mathml is quite instructive here:
You will also need to install the packages: otf-stix (STIX fonts) and ttf-lyx (TeX's Computer Modern fonts) to view MathML properly.
For other operating systems, you will need to find equivalent fonts, and should certainly know a little about where (on your system) to install .ttf and .otf files.


Smartphones and netbooks - power and bandwidth considerations:

What MathML offers for smartphones and netbooks is an efficient 'markup based' way of rendering.

This has the advantage of using less power and bandwidth, as compared with an iteration heavy protocol such as ajax.

( Ajax also requires a powerful and stable javascript engine, which sort of limits choice in those low power environments. )

My personal preference would be for all mathematics to be viewable on mid-range phones in developing countries. After all why limit the knowledge of mathematics to just high end smartphones in the Western world?

Hopefully in 2011 and 2012, a range of mid-range MeeGo phones will have support for MathML font addition to the standard browser.


But how do I create the markup myself?:

Firstly let me state that MathML is not aiming to be a wild 'data interchange' format. It concentrates on presentation, and does it rather well (as the image at the start of this article shows)

It is not necessarily 'concise' or 'compact' which is why using an editing tool that generates MathML output for you, is a good idea.


latex2html for those whose native tongue is Tex (Latex)

There are other editors that do similar tasks also.

If you are a web developer who knows a bit of html, then coming to MathML should give you a somewhat familiar markup feel, but you will probably tire quickly of writing all the markup.

( Latex if you are on a project which requires months worth of Mathematics in web documents, perhaps Lyx if you are on a small project. )


Links and Further reading:

3 comments:

Gary said...

I think my article makes it clear that I am very much in favour of MathML, and (I repeat) not a fan of any plugin approach. My reasons are explained in the article.

You may or may not agree with this - that is up to you.

If you are in the business of providing plugins, please do not attempt to comment on this posting. You probably already have a blog which would be the ideal place to write your excellent alternative take on things.

All comments are moderated and I hope my position is now clear.

If you have anything reasonable (positive or negative) to say about MathML then I will reasonably look at such a comment.

You will note specifically from the final link in the 'further reading' section that I am not against somebody else thinking MathML is not perfect. However I will not allow this blog to be used as a feeder for anyone else's plugin product.

Gary said...

I think I made my comment policy pretty clear before, please re-read my previous comment again if you have missed it.

Despite my previous comment, it seems that some plugin company, with offices in Long Beach and Minnesota, is unhappy that I fail to mention their product in my article.

Apparently my article gives "Incomplete information". That is a very subjective opinion on an article which is clearly about Firefox4+MathML.

If that company would prefer me instead to write an article (by commission) to your exact specification, then please forward a four figure remittance and I will happily take on the commission, whilst being obliged to mention the financial interest involved.

Gary said...

In 2012 the MathML support in Firefox is improving. There is an addon named Firemath http://www.firemath.info/ to help

By 2013 (Firefox 14/15) the requirement to have local fonts installed extra to Firefox itself should no longer be required: http://is.gd/18TyL3
http://www.maths-informatique-jeux.com/blog/frederic/?post/2012/04/21/Mozilla-MathML-Project%3A-about-mathematical-fonts