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

There's no question that MathJax is a great project. But... pretty much all the major browsers have native support for MathML now, so hopefully we can start seeing most (most?) math on the Web in that format. This should bring advantages for folks who rely on additional technology for accessibility purposes, and for search.



MathML is technically human read/write-able, but not efficiently. Something like Mathjax (which targets mathml) is also necessary, to allow humans to read/write raw math expressions in a simpler format.


A heavy, slow client-side script like MathJax seems like an unpleasant way to target MathML—why not precompile offline from something like AsciiMath?


MathJax can be used on the server / wherever you generate HTML, too.


To make it interactive for example.


Mathjax can output MathML, actually. It's as easy as linking to tex-mml.js


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/


For those as confused as me, Chrome finally supports MathML as of January 2023.

(insert starcraft "about time" meme)


To be precise, they support MathML Core, which is a subset of MathML 4. Your expressions that you wrote for MathML 3 and worked in Firefox may not (and probably will not) work in Chrome. I actually wrote a library a little while ago which doesn’t work in Chrome because of this.

That said, I think MathML Core is an excellent standard, and Chrome made the right choice to support it (or rather to allow Igalia to develop it for them). Going forward I’m certainly going to update my library to target MathML Core only.


People would much rather write LaTeX than MathML.


Use Temml to convert LaTeX to MathML: http://temml.org/


I don't doubt that, and thankfully there are tools to convert LaTeX to MathML. So one can continue to write in LaTeX if that's what they're comfortable with, and still publish to the Web in MathML as desired.


> thankfully there are tools to convert LaTeX to MathML

For example MathJax!




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

Search: