6 ms·
MathML in Chromium
- bjoli 8y agoNot in any way affiliated, but Igalia is a cool company. They pay their employees to work on OSS projects as a part of their job. Andy Wingo work(ed?)there and they financed quite a bit of guile development as a way to make him develop his compiler and runtime skills.
- sanxiyn 8y agoMy personal opinion is that MathML should die. MathJax is here today and works.
- sdan 8y agoOr KaTex, which I believe is superior to MathJax.
- ttoinou 8y agoIs MathML even made to be written by hand ? Or should we use another tool that translates our formulae into MathML ? The syntax is awful and redondant
- Tajnymag 8y agoMathml is not important for being a latex replacement, it's important for being a unified and native way to render mathematical formulas in browsers. With mathml supported by Chrome, you could instead of the whole Mathjax renderer use only a lightweight "latex/asciimath to mathml" translater and let the browser do the rendering job.
- sanxiyn 8y agoMathJax is a unified way to render mathematical formulas in browsers. So that only leaves "native". Why is it desirable to have "native" implementation? The usual answer is performance, but I am not aware of much performance complaint of MathJax. If not performance, how does it make sense to add more C++ code to browsers to be exploited, when memory safe JavaScript implementation is already available?
- detaro 8y agoPeople regularly recommend other solutions over MathJax due to performance, and at least on complex pages there's a noticeable delay for it finish processing everything on the page. Is it worth it to do a native implementation because of that? maybe not, but there are issues with it.
- sanxiyn 8y agoI'd much prefer optimizing MathJax over writing new C++ code in Chromium.
- xg15 8y agoEven the most optimized JavaScript code will be less performant than a fully declarative language that can be directly interpreted by the layout engine. From a user standpoint, it's ridiculous that I need to have JavaScript enabled, so the browser can download and compile a separate runtime, that itself reparses the page, just so I can look at a static documents with some math symbols. Lastly, I think a common standard for math representation is valuable for the same reasons "official" <section> and <article> elements are valuable: They offer a common data model that tools, extensions and search engines can work on to provide extra functionality. A "de-facto standard" like MathJax doesn't provide this, because there is no requirement that two different sites use the same representation. The only requirement is that they put up something which the particular version of MathJax they embedded can understand. This makes things a lot harder for tools.
- est31 8y agoPages with lots of MathJax formulas take a lot of time to load.
- aplaice 8y agoIn addition to the already mentioned performance issue with client-side MathJax, having native MathML makes it conceptually far simpler to do more complex things with equations, both for the end user and for the developer. For instance, as a user, if you want to scale the equations by some amount or use a different maths font, it's a couple of lines of CSS, using exactly the same method you'd use to make any other changes to the appearance of a web-page. (Yes, you can easily do the former with MathJax, but I don't think the latter is possible user-side). As a developer, if you'd want to interactively highlight parts of an equation, for educational purposes, it'd be trivial with MathML, but rather hard to do nicely with MathJax (statically coloured elements are possible with MathJax, with the "color.js" extension, but not dynamically coloured ones — and no, swapping out the entire equation to make colour changes is neither nice nor scalable). Alternatively, if you want to embed equations in a diagram or a graph, it's pretty easy with MathML[0][1], but would be difficult otherwise. Obviously, all of the above is in principle possible with JavaScript implementations, but it's far harder. You might argue that this extra effort is worth the smaller attack surface. IMO, given the importance of maths and science, it isn't. Also, why do we, say, have the CSS flexbox layout? After all, we could have used javascript to arrange elements into an appropriate table or even just set the x and y positions of all elements... [0] http://fred-wang.github.io/MathUI2014/demos/2-mathml-in-svg.svg http://fred-wang.github.io/MathUI2014/demos/2-mathml-in-svg.... [1] http://fred-wang.github.io/MathUI2014/demos/6-mathml-in-webgl.html http://fred-wang.github.io/MathUI2014/demos/6-mathml-in-webg...
- saagarjha 8y agoMathJax requires JavaScript, though; MathML doesn't.
- posix_me_less 8y agoUsing MathML notation directly isn't a bright idea and MathJax rendering kind of works, but having a formulae renderer directly in browsers/document viewers is much better. Using a javascript library or even remote http calls (!) to render static formulae on client side is extremely slow, wasteful and limiting way to render mathematical formulae.
- laxd 8y agoMathJax is too slow for more appy and interactive use cases. With firefox's native implementation I have seen nothing but "instant" rendering.
- coldtea 8y agoSo, because we have a JS library, we should drop an effort to natively support first class math rendering in the browser? That's why we can't have nice things.
- jacobolus 8y agoIt’s not first class. It’s cross-browser-inconsistent garbage layout largely unsuitable for anything but the simplest mathematical expressions, and a horrible markup syntax for authors. If MathJax or KaTeX is too slow for some purpose, someone should try to compile a more streamlined TeX renderer to wasm.
- baq 8y agoThe article is about fixing all those issues.
- coldtea 8y agoFirst of all, it can be used as a target for any markup syntax if authors don't like it. The syntax is an irrelevant part of the feature (in fact MathJax already supports it). Second, it is first class. "cross-browser-inconsistent" is not an argument that it's not first class, tons of things are inconsistent (JS features, CSS implementations, etc). Third, you missed the whole idea that the proposal is about enhancing the rendering, and also has buy-in from Mozilla people. >If MathJax or KaTeX is too slow for some purpose, someone should try to compile a more streamlined TeX renderer to wasm. That's not even wrong. It's beyond right and wrong, into the realm of crazy.
- jacobolus 8y agoIt’s confusing to use the term “first class” when what you mean is “mediocre but built in”. The standard English definition of that term is “highest quality”. There are certainly many parts of CSS that I would not consider first class. > The syntax is an irrelevant part of the feature This viewpoint explains a lot about web technology. The syntax doesn’t matter. The visual output doesn’t matter. Practical adoption by users doesn’t matter. All that matters is ticking features down on a checklist somewhere.
- aplaice 8y agoMathML is here today and works in Firefox. I use it on Wikipedia[0], which is the only major ("non-niche"[1]) website that provides it, and it's much nicer than the image-based equations (and much, much faster than MathJax would be). [0] https://www.mediawiki.org/wiki/Extension:Math/advancedSettings#CSS_for_the_MathML_with_SVG_fallback_mode https://www.mediawiki.org/wiki/Extension:Math/advancedSettin... [1] not that "niche" websites like nLab[2] should be disregarded, since the web was originally designed to help scientists... [2] https://ncatlab.org/nlab/show/HomePage https://ncatlab.org/nlab/show/HomePage
- deleted 8y ago[deleted]
- xorand 8y agoarXiv.org uses MathJax. https://arxiv.org/help/mathjax https://arxiv.org/help/mathjax
- snicker7 8y agoMathjax is slow and requires client side JavaScript.
- gwern 8y agoYou can render Mathjax offline for non-interactive purposes (ie most use-cases) using 'mathjax-node-page'. I recently implemented this for my website; now pages like https://www.gwern.net/Embryo-selection https://www.gwern.net/Embryo-selection display math instantly (instead of requiring ~5s - it's a big page), and also no longer require the MathJax JS, just the fonts/CSS.
- dtf 8y agoHere's an example of why MathML is attractive as a rendering layer (try Firefox vs Chrome, and look at native MathML latency vs MathJax emulation): https://runarberg.github.io/ascii2mathml/ https://runarberg.github.io/ascii2mathml/ (it helps to have the LaTeX Computer Modern fonts installed locally, which for some reason aren't imported on this page)
- SimeVidas 8y agoI’m getting “main.js:100 Uncaught ReferenceError: MathJax is not defined” in Chrome.
- runarberg 8y agohmm, here is a project I haven’t given nearly as much love as it deserves. ascii2mathml was the first compiler I ever wrote (and have written since). I wrote it because I wanted authors from a non math background to be able to write short expressions in forums or comment threads without having to know latex. I tried to make it as intuitive as possible. Even going as far as making `1+2 / 3+4` a different expression from `1 + 2/3 + 4`. But I know some people started integrate the library in their notebook apps, mainly used by math students taking notes in lectures in a markdown format (writing the expressions in ascii2mathml). Ascii2mathml might be a better fit then then the original asciimath for that purpose as the original is no expressive enough to capture advanced math expressions. I bailed on it a couple of years ago because it looked like MathML was a dying. Chrome wasn’t going to implement it. Also I haven’t been using it for anything either. Perhaps it is now time I revisit it and give it some love.
- cotelletta 8y agoExcept MathJax isn't the bar to beat, it's Katex which doesn't rely on a measurement of DOM layout.
- notthingnill 8y agoYou can also use a computer algebra system (CAS) to perform computations and get the output in mathml, for example the free CAS maxima. wxMaxima is something like jupyter notebook but developed with wxWindows by a solo developer. ?? is help for command I just copy pasted: (%i2) ?? mathml; -- Function: mathml_display (<form>) Produces MathML output. (%i1) load("alt-display.mac")$ (%i2) set_alt_display(2,mathml_display); <math xmlns="http://www.w3.org/1998/Math/MathML"> http://www.w3.org/1998/Math/MathML"> <mi>mlabel</mi> <mfenced separators=""><msub><mi>%o</mi> <mn>2</mn></msub> <mo>,</mo><mi>done</mi> </mfenced> </math> (%o2) true
- deleted 8y ago[deleted]
- est31 8y agoIt's very good news that this has finally started. Wikipedia, probably the biggest website that displays formulas, still renders them to SVG images. Igalia had already been improving WebKit's [1] MathML renderer and they had a fundraiser for the Chromium MathML work for a long time. Now they seem to collected enough to start with it. It's one of the great advantages of open source that a small company like Igalia can just go and improve multiple rendering engines used by billions of people. [1]: https://webkit.org/blog/6803/improvements-in-mathml-rendering/ https://webkit.org/blog/6803/improvements-in-mathml-renderin...
- gdy 8y ago"Wikipedia, probably the biggest website that displays formulas, still renders them to SVG images." Not exactly. https://en.m.wikipedia.org/wiki/Help:Displaying_a_formula#Native_MathML https://en.m.wikipedia.org/wiki/Help:Displaying_a_formula#Na...
- est31 8y agoEven users on Firefox only get to see the SVG images per default.
- omaranto 8y agoThat's probably because MathML support is pretty poor in most browsers and even on Firefox, which has the best support, it isn't really good enough for all uses. MathJax has various backends to render LaTeX formulas, including SVG, MathML and HTML-CSS. Here's what the MathJax documentation says about the MathML backend: "The NativeMML output processor uses the browser’s internal MathML support (if any) to render the mathematics. Currently, Firefox has native support for MathML, and IE has the MathPlayer plugin for rendering MathML. Safari has some support for MathML since version 5.1, but the quality is not as high as either Firefox’s implementation or IE with MathPlayer. Chrome, Konqueror, and most other browsers don’t support MathML natively, but this may change in the future, since MathML is part of the HTML5 specification." "The advantage of the NativeMML output processor is its speed, since native MathML support is usually faster than converting to HTML-with-CSS and SVG. The disadvantage is that you are dependent on the browser’s MathML implementation for your rendering, and these vary in quality of output and completeness of implementation. MathJax relies on features that are not available in some renderers (for example, Firefox’s MathML support does not implement the features needed for labeled equations). While MathJax’s NativeMML output processor works around various limitations of Firefox/Gecko and Safari/WebKit, the results using the NativeMML output processor may have spacing, font, or other rendering problems that are outside of MathJax’s control."
- 75dvtwin 8y agothis is great news. Does anybody know if this will translate to chromium based web toolkits (eg QT), and MS Edge (soon to be based on chromium), and therefore, React-XP [1] ? [1]https://github.com/Microsoft/reactxp https://github.com/Microsoft/reactxp
- fdej 8y agoI really wish browsers would just render formulas directly from TeX. Let me write <tex>\sqrt{1+x}</tex> or whatever. TeX is the de facto standard for writing mathematical formulas. That browsers don't render it natively just screams of NIH syndrome on the part of browser and web standards developers. MathML still hasn't caught on after two decades, for three reasons: 1) not working in all browsers; 2) even when it worked, the rendering was often buggy or plain ugly; 3) no one wants to write MathML directly. MathJax instantly solved all problems, which made it an overnight success. MathML might be able to overcome 1) and 2), but 3) should not be underestimated. MathJax will be around as long as it is the most convenient solution for showing equations in a browser (no user-side compilation required), and rendering times and network traffic will suffer accordingly.
- saagarjha 8y agoAlthough that does bring up the question of which subset of TeX browsers are willing to support.
- aplaice 8y agoWhen you write web-pages, do you usually write the raw HTML or do you use something like Markdown or Wikitext and have it converted to HTML? If the latter, then why would having LaTeX as part of the input and MathML as part of the output, be any different? Also, directly converting TeX to MathML, even client-side, is much easier and faster than MathJax's many-to-many approach (I'm not criticising MathJax — given the constraints, they're doing the best possible job).[0][1][2] (See also the Ascii to MathML converter[3] that has already been mentioned in another comment.) [0] http://fred-wang.github.io/MathUI2014/demos/7-web-component.html http://fred-wang.github.io/MathUI2014/demos/7-web-component.... [1] https://github.com/fred-wang/MathUI2014/blob/master/demos/7-web-component.html https://github.com/fred-wang/MathUI2014/blob/master/demos/7-... [2] https://github.com/fred-wang/x-tex https://github.com/fred-wang/x-tex [3] https://runarberg.github.io/ascii2mathml/ https://runarberg.github.io/ascii2mathml/
- ronsor 8y agoI do write the raw HTML actually
- mymythisisthis 8y agoI hope MathML gets more support. It is a bit unwieldy, but it seems like a simple solution to displaying maths on a simple HTML page, here is my example. http://gron.ca/algebra/023.html http://gron.ca/algebra/023.html