Live data from Hacker News

MathML is a failed web standard

peterkrautzberger.org

21–30 of 177 posts

Re: MathML is a failed web standard

#21

Blargh. It annoys me that MathML was even a thing. We've already had a perfectly-fine and widely-used markup language for mathematical formulae; it's called TeX. Ideally, I'd prefer that HTML5 include a tag, or something similar, that takes TeX as input and produces formatted output. A side benefit would mean that every browser, and every system, in the world would have TeX installed! At least MathJax can take TeX as…

> A side benefit would mean that every browser, and every system, in the world would have TeX installed!

TeX doesn't have dynamic reflow, is defined by a macro system that involves essentially monkey patching the parser as it goes, lacks anything resembling a DOM, wasn't designed with Unicode or internationalization in mind, is completely unparallelizable, doesn't interoperate with CSS, has its own concept of block and inline layout that doesn't allow for text wrapping around floats without hacks, requires multiple passes to compute various things like tables of contents, and wasn't designed for interactive-level performance. Something syntactically like TeX may well be the solution, but jamming TeX itself into the Web platform wouldn't end well.

Re: MathML is a failed web standard

#22
It’s instructive to see how different MathML is from other math markup languages. Here’s the quadratic formula:

In troff, x = {-b +- sqrt { b sup 2 - 4ac}} over 2a

In TeX, x = {-b \pm \sqrt{b^2-4ac}} \over {2a}

In plain Unicode, 𝑥 = (−𝑏 ± √(𝑏² − 4𝑎𝑐))⁄2𝑎

In MathML, x=−b±b2−4ac2a

MathML is simply unreasonable to write by hand. Most of the time it’s only ever used as an interchange format, automatically generated by tools.

Indeed, the only time I ever use it is with mandoc(1), the default manpage formatter on BSD, Illumos, and some Linuxes, which converts equations to MathML when converting manpages to HTML.

Re: MathML is a failed web standard

#23
post #22

It’s instructive to see how different MathML is from other math markup languages. Here’s the quadratic formula: In troff, x = {-b +- sqrt { b sup 2 - 4ac}} over 2a In TeX, x = {-b \pm \sqrt{b^2-4ac}} \over {2a} In plain Unicode, 𝑥 = (−𝑏 ± √(𝑏² − 4𝑎𝑐))⁄2𝑎 In MathML, x = − b ± b 2 − 4ac 2a MathML is simply unreasonable to write by hand. Most of the time it’s only ever used as an interchange format, automatically…

Yeah. I think that's inevitable with an XML syntax. XML is good at some things, but representing math expressions clearly is not one of them.

Re: MathML is a failed web standard

#24
post #6

MathJax looks excellent.

MathJax is very flexible and its output is certainly high-quality. However, it is difficult to configure and package in my experience, and it's pretty slow. We used it for a few years at Khan Academy before building KaTeX ( https://khan.github.io/KaTeX/ ) which is around 50x faster to render in our experience, not even counting download size. We ran an A/B test for MathJax vs. KaTeX on the Khan Academy site and peopl…

Thanks for making KaTex. Love the ease of installation, API and performance!

Re: MathML is a failed web standard

#25
post #9
post #5

Earlier quoted context omitted.

TeX is analogous to Presentation MathML but doesn't solve the accessibility concerns because the semantic intent of the TeX source isn't always clear. (How do you read a \phantom{}? Or how can you know that "\left( 7 \atop 3 \right)" should be read as "7 choose 3"?)

The same way a sighted person does?

I'd imagine any real solution would actually be akin to ruby markup, with the author of the content needing to supply it since there will be cases where it simply cannot be usefully deduced by a browser.

Re: MathML is a failed web standard

#26

Blargh. It annoys me that MathML was even a thing. We've already had a perfectly-fine and widely-used markup language for mathematical formulae; it's called TeX. Ideally, I'd prefer that HTML5 include a tag, or something similar, that takes TeX as input and produces formatted output. A side benefit would mean that every browser, and every system, in the world would have TeX installed! At least MathJax can take TeX as…

> A side benefit would mean that every browser, and every system, in the world would have TeX installed!

Is to run that giant heap of probably not sandboxed or security-audited code in every client actually a thing I would want to have? I mean people are paranoid about js doing unwanted things, but a large distribution of tex code running inside the browser, really?

Re: MathML is a failed web standard

#27
post #4

One big advantage of MathML is the ability to copy-paste from webpages directly into software like Mathematica. I don't think there is currently any alternative to MathML in that respect. The author argues (rightly) about styling and presentation of MathML, but doesn't propose an alternative to this copy-paste problem. May be TeX, when you're using MathJax at least ?

Wikipedia seems to be using a mechanism where TeX code is rendered into images, but on marking and copying into an editor becomes TeX again, wouldn't that be a sufficient solution for copying?

Re: MathML is a failed web standard

#29

MathJax looks excellent.

MathJax works reasonably well, but I can almost read the TeX source out loud faster than the browser renders it (together with PDF.js, this has been my go-to counterexample whenever someone claims that JavaScript is performant).

With formula-heavy text, I'm forced to split documents artificially into multiple short pages to make rendering reasonably fast.

KaTeX looks quite promising, but it was missing support for quite a bit of basic markup the last time I checked. Perhaps it's better now.

Re: MathML is a failed web standard

#30
post #4

One big advantage of MathML is the ability to copy-paste from webpages directly into software like Mathematica. I don't think there is currently any alternative to MathML in that respect. The author argues (rightly) about styling and presentation of MathML, but doesn't propose an alternative to this copy-paste problem. May be TeX, when you're using MathJax at least ?

The syntax is pretty much the same in Mathematica:

- ToExpression[string, TeXForm] for expressions coming from TeX

- ToExpression[string, MathML] for expressions coming from MathML

But how do you grab the TeX formula? TeX'd up formulae usually have the TeX form in the alt-text portion for the image. For example, the first formula in https://en.wikipedia.org/wiki/Calculus#Fundamental_theorem has the alt-text \int_{a}^{b} f(x)\,dx = F(b) - F(a).

Post reply on HN