Live data from Hacker News

MathML is a failed web standard

peterkrautzberger.org

121–130 of 177 posts

Re: MathML is a failed web standard

#121
post #116
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…

Does anyone else prefer writing troff/tbl/pic/eqn? I always felt that the language of TeX/LaTex was a step backward in user-friendliness.

I found troff syntax to be very hard to debug for parse errors, while you can easily fit the tex tokenizer into your head. There is also much less control in eg alignment of complex tables.

Re: MathML is a failed web standard

#122
post #90

Earlier quoted context omitted.

Why does this have to turn into an XML bashing thread? Writing the above equation in JSON would be just as terrible.

> Writing the above equation in JSON would be just as terrible Not quite as bad as XML.. I think the problem is more the verbose, overly-nested format that was chosen for MathML than XML itself though. { "mrow": { "mi": [ "x", "=" ], "mfrac": { "mrow": { "mi": [ "−", "b", "±" ], "msqrt": { "mrow": { "msup": { "mi": [ "b", "2" ] }, "mi": [ "−", "4ac" ] } } }, "mi": "2a" } } }

What you have doesn't work. What if I have "mi, mo, mfrac, mo, mi" at the top level? So something like "a - b/c + d". You can't specify the same key twice in JSON. Also, keys are technically unordered, so there's no guarantee that a parser will put that top-level "mi" before the "mfrac".

JSON is great at many things, but polymorphic substructures are AFAIK only really possible with everything being an object defining the "type" that it is. And that looks significantly uglier than what you have above:

    {
        "type": "mrow",
        "children": [
            {
                "type": "mi",
                "identifier": "x"
            },
            {
                "type": "mo",
                "operator": "="
            },
            {
                "type": "mfrac",
                "rows": [
                    {
                        "type": "mrow",
                        "children": [
                            {
                                "type": "mo",
                                "operator": "-"
                            },
                            {
                                "type": "mi",
                                "identifier": "b"
                            },
                            {
                                "type": "mo",
                                "operator": "±"
                            },
                            {
                                "type": "sqrt",
                                "expression": {
                                    "type": "mrow",
                                    "children": [
                                        {
                                            "type": "mi",
                                            "identifier": "b"
                                        },
                                        {
                                            "type": "msup",
                                            "expression": {
                                                "type": "mi",
                                                "identifier": 2
                                            }
                                        },
                                        {
                                            "type": "mo",
                                            "operator": "-"
                                        },
                                        {
                                            "type": "mi",
                                            "identifier": "4ac"
                                        }
                                    ]
                                }
                            }
                        ]
                    },
                    {
                        "type": "mi",
                        "identifier": "2a"
                    }
                ]
            }
        ]
    }

Re: MathML is a failed web standard

#123
post #116
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…

Does anyone else prefer writing troff/tbl/pic/eqn? I always felt that the language of TeX/LaTex was a step backward in user-friendliness.

I’m also one of those who prefers troff. I read all five volumes of Knuth’s Computers and Typesetting cover to cover, and TeX is a beautiful piece of work. But in my preferred alternate universe, two things would be different: Joe Ossanna would not have died young, and AT&T would have been more open with licensing in time for Knuth to use troff as a base for his improvements to the world of typesetting.

Re: MathML is a failed web standard

#124
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…

Shouldn't the '=' and the minus and the other signs be inside , rather than , because they are binary operators, not identifiers? TeX for example, makes a clear distinction in terms of how much whitespace it would surround operators with, vs. identifiers. In any case, I suspect MathML was intended as an intermediate computer-readable representation, not something that anyone would write by hand (MathJax can compile y…

>Shouldn't the '=' and the minus and the other signs be inside , rather than , because they are binary operators, not identifiers?

You’re right; I should have marked those up with instead.

Re: MathML is a failed web standard

#125
post #29

Earlier quoted context omitted.

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 qu…

Is there a way to pre-render MathJax, say, for static blogs?

Apparently SVG output is an option since MathJax v2.0: https://docs.mathjax.org/en/v2.5-latest/output.html

Re: MathML is a failed web standard

#126
post #120
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…

In AsciiMath[1], x = (-b +- sqrt(b^2 - 4ac)) / (2a) [1]: http://asciimath.org/

Good, you caught that he was only dividing by 2, not 2a

Re: MathML is a failed web standard

#127
post #120
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…

In AsciiMath[1], x = (-b +- sqrt(b^2 - 4ac)) / (2a) [1]: http://asciimath.org/

also, thanks for the pointer to ascii math, looks like a nice way to render

Re: MathML is a failed web standard

#128

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 a…

OMG.

If your equations require concurrency to render, you're either a genius or insane. Or both.

Re: MathML is a failed web standard

#129
post #90

Earlier quoted context omitted.

> Writing the above equation in JSON would be just as terrible Not quite as bad as XML.. I think the problem is more the verbose, overly-nested format that was chosen for MathML than XML itself though. { "mrow": { "mi": [ "x", "=" ], "mfrac": { "mrow": { "mi": [ "−", "b", "±" ], "msqrt": { "mrow": { "msup": { "mi": [ "b", "2" ] }, "mi": [ "−", "4ac" ] } } }, "mi": "2a" } } }

What you have doesn't work. What if I have "mi, mo, mfrac, mo, mi" at the top level? So something like "a - b/c + d". You can't specify the same key twice in JSON. Also, keys are technically unordered, so there's no guarantee that a parser will put that top-level "mi" before the "mfrac". JSON is great at many things, but polymorphic substructures are AFAIK only really possible with everything being an object defining…

While this format is more generic, an abbreviated encoding can sometimes accomplish the same thing. For example, just moving the "type" to be the object key and removing the implied secondary name gets you this far:

    { "mrow": [
        { "mi": "x" },
        { "mo": "=" },
        { "mfrac": [
            { "mrow": [
                { "mo": "-" },
                { "mi": "b" },
                { "mo": "±" },
                { "sqrt": {
                    { "mrow": [
                        {"mi": "b"},
                        {"msup": { "mi": 2 }},
                        {"mo": "-"},
                        {"mi", "4ac"}
                    ]}
                }}
            },
            { "mrow": [
                {"mi": "2a"}
            ]}
        ]}
    }
It's not as general, but works if you know your syntax is similarly bounded. I don't know how certain static languages would handle serial/deserializing, but makes construction via javascript literals much more pleasant.

Re: MathML is a failed web standard

#130
post #116
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…

Does anyone else prefer writing troff/tbl/pic/eqn? I always felt that the language of TeX/LaTex was a step backward in user-friendliness.

I usually use OpenOffice / LibreOffice Equation Editor which is based on eqn. Ironically the on disk format it uses is MathML.
Post reply on HN