Math in the browser
Mathjax project — a Javascript library to display math on web pages which is also used in Fidus Writer. Krautzberger elaborates on why Mathjax is needed and the problems he and his community face with convincing the world that a special language to describe mathematical formulas on webpages is needed. You are the project manager for MathJax which can be used to show mathematical formulas on web pages. Why did you guys start that project? Couldn’t you just as well have used an image with the formula laid out perfectly? MathJax grew out of Davide Cervone’s popular jsMath project which revolutionized math on the web by implementing the TeX layout algorithm in JavaScript. The goal of MathJax is to enable native mathematical content on the web, using established web standards like CSS and webfonts instead of image renderings, Java, Flash or any external plugins. MathJax works in all browsers (starting with Internet Explorer 6) and users don’t have to jump through any hoops to get beautiful, accessible mathematics. No plugins or fonts to install — it just works. Image renderings on the other hand are a huge problem for mathematical and scientific content on the web. They are low quality, inherently static, not accessible, and a pain to integrate and align. Math is text and text should never be rendered as images on the web. What kinds of people use MathJax and what do they use it for if not in a web based editor like Fidus Writer? The most exciting thing for us at MathJax is to see what amazing ideas people have realized using MathJax. MathJax has allowed math on the web to come alive, and you can see how quickly it’s catching up to regular text. Revolutionizing mathematics education? You got it. Changing the way researchers communicate? No problem. Computational publications? Check and check. Ebook readers with native math support? Yup. Computer algebra systems as an Android app? Why not. 3D graphics reference guides on your iPhone? You bet. Chat with math support? Easy. Just writing a blog? We got you covered. One often hears about MathML, which is supposed to be a special language to show formulas on the web. What’s up with that? Why do you mathematicians think there should be a special language just for you? Won’t musicians be the next ones asking for a special language for musical nodes on web pages, chemists asking for a special language to show molecules and biologists asking for a special language to show the stages of growth of trees? The challenge with mathematics is that it’s two-dimensional text — sub- and superscripts, fractions, matrices, equation arrays, it spreads all over the place. But MathML isn’t all that special, it started as the `<math>` tag when HTML 3.2 was still a draft in the 1990s, and finally came back into the fold with HTML5. So it’s more like asking: why do you need an extra syntax for tables? Well, the answer is: because it’s a natural part of text layout. Personally, I believe that the future of the web must be inclusive, supporting all (and new!) forms of communication — not just governed by what’s best for selling ads. I think most people will agree that a statistical plot or chemical data have no more reason to be static images than an equation. Whenever you have structured data, the browser should render it and enable the reader to fit it to their needs. Of course, most of this is well on the way, so we can be very optimistic! The MathML 3.0 standard was released in 2010. So surely by 2013 it is available in any major browser, right? Any lack of support would surely have to be attributed to a weakness on the part of your lobby, correct? All standards face the problem of adoption but MathML has an especially complex history. MathML has seen 15 years of active development, has been adopted in publishing workflows for over a decade, and has been an important exchange format for everything from office products to computer algebra systems. Yet browser vendors have been hesitant and never seriously invested in MathML development. Firefox and Safari have relied entirely on the work for volunteers to move their implementations forward. It’s unclear at this point if MathML seems too difficult or just not hip enough for their engineers. MathJax enables everyone to put MathML on the web today but we also strongly believe that browsers have to catch up to move us to the next level. If you think about it, every school child spends years learning math and science. Soon, this learning process will happen exclusively in HTML driven environments. Creating proper support for native, accessible and reusable math for our kids seems like the coolest thing in the world, don’t you think? There was somewhat of a drama concerning the inclusion of MathML in Google Chrome a few months ago. What happened and how did you respond? How do you think the Chromium team looks upon your interest group? In 2012, when Chrome and Safari were still using the same rendering engine called Webkit, a volunteer spent 9 months improving WebKit’s MathML support with the specific goal to finally get it activated in Chrome. As it goes with volunteers, they eventually have to go back to making a living. Unfortunately, despite everyone’s attempt to change their minds, the Chrome team did not take on ownership of the code base. So when a security bug showed up in Chrome 24, Google deactivated MathML, despite existing community patches. Recently, the MathML code was deleted from Chrome’s code base. It’s clear to everyone that security comes first. But personally I couldn’t help but wonder: if browser vendors will neither implement nor accept good contributions for official standards, where does that leave us? In much of the industrialized part of the world education levels are going down, especially in the sciences. If somewhat good students and professors in 2013 can get along without MathML support in their browsers, what makes you think that much less educated students and professors in 2023 will need it? The web has revolutionized and expanded human communication like no other invention since the printing press. In many ways, browsers are the new printing press. But while early printers had little more than astronomical charts to worry about, browsers face a more complex situation. The question is not: will we need it? The question is: how much will it improve education, research and our communities as a whole when we have it? Mathematics and science have missed out on 20 years of improving communication, remix, search, and accessibility of content. Without MathML, we will “only” be stuck where we are. I don’t know about you, but I would love to find out what the math&science equivalent of twitter chatter is, what interactive story telling can do for education, what an accessible Wikipedia could mean for users around the globe. The thing is: using MathJax means using MathML. From StackExchange to Physics Forums, from KhanAcademy to edX, everyone in education uses MathJax and therefore MathML. If MathML eventually is included in every browser, does that mean that one will be able to throw away Mathjax? If so, would the time have been better invested in improving the MathML support of the different browsers rather than writing a complex javascript system to do the same? Like any good polyfill — a javascript replacement for something that could be made part of the browser itself — we would love to be standardized out of existence! But MathJax is about more than MathML 3 support, it’s about enabling the next generation of mathematical and scientific content on the web. MathML 3 is no more final than HTML 3 was or HTML5 is. But with MathML 3 in HTML5, mathematics finally has a chance to catch up to the revolution of communication that the web has created. From basic problems like reflow and responsive equations, to new forms of writing, blending textual, graphical and animated content into new ways of “speaking mathematics” — we ain’t seen nothing yet. So while we are pushing for MathML support in all browsers, MathJax’s mission will continue to push the boundaries of mathematics on the web and enable everyone to participate. Before MathML for decades there was an advanced way of setting formulas for print as part of the LaTeX package. Would it not have made more sense to just copy that to the web instead? Why was it necessary to reinvent everything? TeX/LaTeX is a fantastic tool that will continue to serve its community. Its syntax is great for authoring and MathJax’s modular input model provides an excellent TeX converter. But TeX is simply a different tool for a different job. MathML is math for HTML. If you start with TeX-syntax and you try to come up with something that fits in HTML, then you’ll most likely arrive at something like MathML. Don’t get me wrong, there are obvious differences (for starters, TeX is actually a programming language), but there’s no competition here! In fact, the MathML Working Group and the LaTeX3 group have very strong ties. To put it differently, MathML wasn’t re-invention, but simply the adaptation of math to a new environment. And if we all work together, we won’t have to wait for another 15 years for math & science to become first class citizens on the web.
We reccently decided we want to reach out to other projects and people operating in the same space as Fidus Writer and let them present issues important to the space we all operate in here — be it article creation, browser technologies or book design. We here start out by interviewing Peter Krautzberger of the
Hi ,
Recently i have used mathjax in my android application,i facing one issue after render the text its not showing in “center” of the webview,its showing horizantally need to scroll webview for that.I want all element “center” after rendering it.