Fulfilling the potential of maths online
Hylke Koers describes an open-source project that aims to simplify and enhance the experience of publishing and using mathematical formulae online
Anybody involved in publishing or reading mathematical formulae online will know that this is not always straightforward. Mathematical expressions are a key building block for scientific communication on the web, yet a good technology to display these across viewing devices has been lacking so far.
The traditional solution for reading and writing mathematics on the web is to use images of the equations and link those into the page to represent the mathematics. This is a cumbersome approach that has a number of drawbacks: images do not display well at large zoom, do not print at full resolution, and do not consistently align well with the surrounding text. This is particularly problematic on tablets and other mobile viewing devices with small screens. On top of that, images of equations cannot readily be interpreted by other software and are thus hardly an adequate representation of mathematical knowledge on the web.
The Mathematical Markup Language (MathML) was intended to solve this problem, but native browser support for MathML is still very limited. A new project, called MathJax, aims to bridge this gap by bringing MathML support to all modern browsers, making it possible for publishers to finally take full advantage of the MathML standard.
The MathJax project was initiated in 2009 by the American Mathematical Society (AMS), Design Science, and the Society for Industrial and Applied Mathematics (SIAM). MathJax grew out of the popular jsMath, an earlier maths rendering system for LaTeX developed by Davide Cervone in 2004. In the intervening time, there have been many significant developments relevant for web publication of mathematics. These included consolidation of browser support for CSS 2.1, Web Font technology, adoption of math accessibility standards, and increasing usage of XML workflows for scientific publication.
In 2007, a discussion following from a chance meeting at an NSF-sponsored workshop between people associated with DSI and SIAM led to the idea of a project with institutional support to further develop the ideas introduced by jsMath using newer technology. In 2008, MathJax was organised as a joint project, with AMS, DSI and SIAM providing major support and project oversight. Davide Cervone was engaged to lead the development, and work began to design and develop MathJax from the ground up as a “next-generation platform”.
Soon several other organisations began providing additional support to the project, and a website was launched. A prototype of MathJax was unveiled in 2009 and the initial 1.0 release was in 2010.
MathJax aims to be a universal, standards-based ‘maths on the web’ solution that displays mathematics beautifully, and also allows it to interact with other applications and environments. Its goal is to provide high-quality, consistent display of mathematics in all major browsers and mobile viewing devices without plugins or other special set-up requirements, as well as an interface to allow users to copy maths to the clipboard so they can use it in other applications (for example, calculation or visualisation tools).
An extensible, modular design with a rich API for easy integration into web applications is also important. This provides the infrastructure to make online mathematics machine-interpretable, which can be used for advanced functionality such as maths search engines.
Another feature of MathJax is that it aims to improve the accessibility of online mathematics for readers with print disabilities. The ability to scale all maths in a page or zoom in on a particular equation, are built in to MathJax. In addition, MathJax works with programs like MathPlayer to make maths accessible to screen readers, to screen magnifiers, and to learning disability software.
How it works
When MathJax is called from a webpage, it looks through that page to search for mathematical expressions in either MathML or LaTeX format. When it finds such an expression, MathJax interprets it and determines the glyphs that are needed for display. MathJax then collects the necessary fonts and typesets the expression in the browser. Because the rendering is done dynamically and with scalable fonts, the mathematics is well integrated into the surrounding text – with matching size, baseline, and margins at all levels of zoom.
In most cases, MathJax will fetch the required font elements from a server using Web Fonts. For older browsers that lack this functionality, MathJax can fall back to image-based rendering. MathJax also supports the STIX fonts, a collection of specialised Unicode fonts for mathematics, and will use these fonts when they are installed on the computer of the reader.
If you are an author and want to use MathJax to typeset the mathematics in your web pages, you need only include a single tag in your HTML file that points to the public MathJax content distribution network (MathJax CDN) web service, which was launched together with the release of MathJax 1.1. The CDN enables users to take advantage of MathJax software without installing or maintaining the software themselves. It can be accessed from any web page and delivered from fast local servers no matter where in the world readers are located. With the link in place, authors can just include MathML or LaTeX source in their HTML documents and MathJax will take care of the maths display.
MathJax can be used on stand-alone webpages but, thanks to the CDN service, it is also easy to use MathJax with many online publication platforms such as WordPress or Moodle.
Standardisation and industry acceptance
MathJax accepts both LaTeX and MathML as input. The former is not a formal standard but is a very mature technology, and a de facto standard particularly in certain scholarly communities such as research mathematics and physics. MathML is a mature standard published by the World Wide Web Consortium, currently in its third revision. It is also part of HTML5, which means that documents using MathML for equations can be in a standard format, using MathJax as an enabling technology to reach all browsers including those that don’t support MathML in HTML5 directly.
MathJax itself is rapidly becoming a vital part of the scientific communication infrastructure. MathJax adoption continues to accelerate, and MathJax is increasingly being used in many different contexts, including scholarly communication, e-learning, web platforms (blogs, forums, wikis) large and small, and in several web applications – including online algebra systems, calculators, and even a MathJax plugin for Gmail.
After three months of operation, the MathJax CDN service was serving more than 2,000 distinct web domains with at least one request per week (see box for some of today’s users). At the other end of the spectrum, the MathSciNet database of reviews and abstracts contains over two million items, most of which contain MathJax-displayed notation.
Keeping up to date
The internet is a rapidly-changing environment, with frequent browser updates and a proliferation of tablets, smartphones, and e-book readers. Keeping MathJax a reliable and easy-to-use product requires thorough testing and monitoring performance on all these devices, and organising a rapid response when problems appear. To this end, we have set up a thorough automated testing framework and continue to strengthen testing procedures.
Authors want to be able to use MathJax in all their favourite web platforms, without worrying about installing and maintaining it on a server of their own. The centralised installation of MathJax on a CDN brings easy and dependable access to MathJax to many more users in many more contexts.
MathJax is an open-source project, and we are glad to see many useful contributions from the community. At the same time, the ability to have paid technical staff and open source contributions makes it possible to keep moving forward rapidly with critical issues such as automated testing procedures and maintaining professional-quality software development standards. This costs time, effort and money and the CDN services cost money too.
So far the founding organisations, AMS, SIAM, and Design Science, have been very generous in providing funding. However, as the benefit to the community is growing, we are aiming to broaden the base of support and we have revamped our sponsorship programme. So far this has been very successful, and we have recently announced support from Stack Exchange, The Optical Society, WebAssign, American Institute of Physics and IOP Publishing, in addition to ongoing support from APS, Elsevier, and Project Euclid.
In the near future technical plans include an enhanced user interface for accessing advanced functionality for equations, performance enhancements and better integration with e-books via support for SVG rendering of mathematics, and expanded maths typesetting capabilities for linewrapping long equations and for elementary mathematics constructions like long division.
We also hope to see continued growth in MathJax usage. We will encourage usage by continuing outreach activities and by working with organisations to discuss how they can benefit from MathJax. In addition, we hope to increase the base of support for MathJax by attracting new friends, supporters and partners.
Another plan is to create a central repository for third-party contributions to MathJax. There are many very useful contributions by the community, for example in integrating MathJax with other software. To better utilise these contributions we plan to create a central repository where such contributions are collected, documented, and promoted.
We are currently planning a new release cycle, and incorporating feedback from the community on development priorities.
Hylke Koers was business development manager for MathJax, although she has recently begun working for Elsevier