Hacker News new | past | comments | ask | show | jobs | submit login

MathML is as human readable and writable as SVG, and that is by design. Now that all browsers support MathML natively we no longer need MathJaX to read it (the browser does a much better job) however we still need to be able to write it. MathJaX can certainly help there, though I would argue there are better libraries then MathJaX for that purpose.

MathJaX had a good run, they did a good job, I would say their job is done however.




The point of MathJax is so that users can type math the way they are used to—typically TeX syntax, though MathJax also supports AsciiMath and MathML itself—and get nicely typeset output (MathJax has three output formats: MathML, SVG, and HTML+CSS). At most you could say that MathJax's MathML input and HTML+CSS output are no longer needed, but that's not the bulk of the need that MathJax serves. Also:

1. [Input] Even if only targeting MathML output, you still need some way to take the user's TeX input and generate MathML, which is what MathJax provides here. What are the alternatives to MathJax that you have in mind? The closest competitor I'm aware of is KaTeX, and while it is fast when it works, there are still some holes in its support (relative to MathJax). (Another comment in this discussion points out Temml, which indeed looks good: https://temml.org https://github.com/ronkok/Temml https://temml.org/docs/en/comparison.html )

2. [Output] The MathML output rendering in browsers is not yet 100% identical to TeX's typesetting (they're certainly aware of it / thinking of the right things, looking at the mentions of [TEXBOOK] at https://w3c.github.io/mathml-core ), and this may even be intentional. In particular, looking at various MathML demo pages I found online (http://eyeasme.com/Joe/MathML/MathML_browser_test.html https://fred-wang.github.io/MathFonts/mozilla_mathml_test https://www-archive.mozilla.org/projects/mathml/demo/texvsmm... and Temml's useful demo pages: https://temml.org/tests/wiki-tests https://temml.org/tests/latexml-tests https://temml.org/tests/mozilla-tests) it appears that in all three of Chrome/Firefox/Safari the rendering of nested square roots is a bit suboptimal, while Safari has some more serious issues (example 9 of the Mozilla MathML Test looks poor in Safari). But clearly the Igalia (for Chrome) and Mozilla folks have done great work, and it's pretty close, but in the meantime I imagine at least some authors would prefer the more deterministic (across browsers) output of SVG or HTML+CSS.

(Also, on a lot of these MathML demo pages, selecting and copy-pasting the math produces junk, while with MathJax there's a right-click menu providing the TeX source and also some accessibility options… it seems that accessibility is actually higher with MathJax under certain circumstances at least.)


My main beef with MathJax is how it searches for equation on the entire page and renders it in place instead of using something like a custom element. E.g. in TeXZilla you can write something like:

    <la-tex>x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}</la-tex>
In my own mathup library I have a similar functionality:

    <math-up>x = -b+-sqrt(b^2 - 4ac) / 2a</math-up>
For MathJax to continue staying relevant it should probably do something similar (note that it is not that hard [1]).

As for the output. This is in large part due to the font being used. The default math font for me using firefox on ubuntu is indeed rather ugly. If you want something similar to the TeX output you can simply use the TeX-Gyre font face. In my documentation for mathup[2] I use Libertinus Math, which pairs very nicely with the other font faces on the page (Libertinus and Libertinus Mono). Aside: here is another example of why MathML is a superior target output then HTML+CSS as you actually have control over the font face.

And finally, as for the copy-pasting. You can download numerous browser add-ons that make copy-pasting formulas as easy as MathJax’s. I will admit this is a handy feature of MathJax, and if you want user to be able to copy-paste your expressions while not assuming they will download an add-on to do so, then MathJax is probably your number 1 choice.

1: https://github.com/mathjax/MathJax/issues/2292#issuecomment-...

2: https://runarberg.github.io/mathup/ - Note, I haven’t updated the software to target the newer MathML Core, so many expressions will not work in Chrome. You should definitely use MathJax over my library.


Thanks for these helpful links. Looking at the Mozilla examples in mobile Safari just now and the MathML rendering is pretty dreadful for almost all of them. It looks like there is still a long way to go.


> MathML is as human readable and writable as SVG, and that is by design.

From what you're writing I'm not entirely sure you think MathML has good or bad readability then ;)

But in case you don't find MathML's presentational syntax convincing for authoring, you can pickup SGML shortref syntax (a technique even older than MathML itself [1]) for at least eg. a highscool math subset in order to cut down on excessive <mo>, <mi> tags.

[1]: https://www.w3.org/MarkUp/html3/maths.html


MathML was designed to be an easy target for other authoring tools. This includes graphical editor (just like inkscape is for SVG) or libraries (just like D3 is to SVG).

I actually don’t like writing MathML, and I actually wrote a library my self that targets MathML.


Isn't it like saying that now when all browsers can natively render SVG, the job of Inkscape is done forever?

I'd say the opposite: now we can safely use MathJAX to translate TeX syntax to an efficient rendering representation.


Inkscape is purely an SVG editor, yes you can also view SVG images using inkscape but that is not its primary function. MathJaX’s primary function on the other hand is to find mathexpressions on a web page and then use javascript to turn them into HTML+CSS rendered equation.

If you want to write LaTeX and include the equivalent MathML in your webpage, then something like Temml is a lot better choice, as that is it’s primary function.

https://temml.org/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: