7 ms·
MathJax
- orange3xchicken 6y agoIf you are at all concerned with performance and can sacrifice a couple features (fewer supported text formatting options & mathematical elements, less legacy support for some browsers). Katex is a great alternative. https://katex.org/ https://katex.org/
- williamstein 6y agoLast time I compared Katex to MathJax, I was also very pleased by Katex's synchronous rendering support, as compared to mathjax. In CoCalc.com I made it use Katex, but if there is an error it falls back to MathJax.
- raphlinus 6y agoMathJax can do synchronous also, but it's a config option. The fact that it defaults to async really saddles it with the perception that it's incredibly slow. The async operation basically forces the browser to through many, many rounds of relayout, when in most cases it would be much more efficient to do it in one batch.
- webmaven 6y ago> In CoCalc.com I made it use Katex, but if there is an error it falls back to MathJax. What % of Katex's rendering attempts fail over to MathJax?
- williamstein 6y agoI don't track that, but based on last time when I broke the fallback... it is important to have the fallback. There are cases where MathJax can handle input that is technically not valid in modern latex, and the katex devs explicitly decide not to support that input. My users don't care and have lots of content that works in mathjax only, so I have to support it (since Jupyter compatibility is important, and Jupyter uses mathjax).
- 0-_-0 6y agoActually, the recent MathJax 3 is quite fast as you can see in this benchmark: https://www.intmath.com/cg5/katex-mathjax-comparison.php?processor=MathJax https://www.intmath.com/cg5/katex-mathjax-comparison.php?pro... Still not as fast as KaTeX though.
- qqii 6y agoWow! That's a really impressive difference. My android phone gets ~2700ms for KaTeX, ~3100ms for MathJax 3, ~17000ms for MathJax 2.7. There were times KaTeX and MathJax traded which I'm guessing is due to page size differences and my poor Internet connection.
- vbernat 6y agoKaTeX can also work without JavaScript as the generated code is browser-independent.
- hatmatrix 6y agoThis looks promising, but are there plans to include packages like siunitx or it's meant to be kept simple?
- ampdepolymerase 6y agoMathJax is probably the poster child for Next.js/Gatsby SSR.
- jimhefferon 6y agoWhat do you mean? I'm not familiar with Gatsby.
- applecrazy 6y agoI think they're referring to how rendering of equations is a good reason to use SSR, given how slow they render on the client.
- fizixer 6y ago(edit 4: my comment is off-topic, sorry) Mathjax reminds me of the AJAX hype. What happened to it? These days no one talks about AJAX. There was material design a few years later but that was just the looks. Is AJAX now replaced with React.js? or a combination of other stuff (like HTML5 and modern-JS and React.js and stuff)? edit: I just looked up Angular and apparently it was rewritten in Typescript, a strict superset of JS. This doesn't make sense. JS is known for massive amounts of cruft. An improvement would've been a scripting language that compiles to "JS: the good parts", i.e., a subset of JS. But now we should have "Typescript: the good parts" because TS inherited all the bad parts of JS? edit 2: It turns out, there is valid JS that is invalid TS [0]. And yet, TS is described on wikipedia as "a strict superset of JS" [1]. (invalid TS == non-error-free TS). edit 3: Further confirmation about error-free TS not being a strict superset of JS [2]. Such a lie can only be expected from a company like micro$hit. edit 5: even with-error TS is not a superset of JS (the behavior is different) [3]. edit 6: Typescript is an opinionated-yet-spineless Javascript! [0] https://github.com/microsoft/TypeScript/issues/38546 https://github.com/microsoft/TypeScript/issues/38546 [1] https://en.wikipedia.org/wiki/TypeScript https://en.wikipedia.org/wiki/TypeScript [2] https://stackoverflow.com/a/53698835 https://stackoverflow.com/a/53698835 [3] https://news.ycombinator.com/item?id=18942886 https://news.ycombinator.com/item?id=18942886
- jszymborski 6y agoFWIW, Mathjax doesn't have much to do with AJAX calls. AJAX is just ubiquitous and it's easier to use without frameworks nowadays. React is a library that solves different problems from the frameworks that made AJAX easier like Prototype and jQuery. React helps folk build UIs through interesting data-models and the ShadowDOM. AJAX is required by anything but the most trivial React projects to make server-side requests. Hope that helps :)
- strikelaserclaw 6y agoAJAX is just a set of principles to make client side web applications more dynamic by getting all the data async and updating the DOM. AJAX is very much alive in modern client side js frameworks like Angular, react etc... It is just abstracted away a little (or a lot).
- 6y ago
- compumike 6y agoI use MathJax for rendering equations on https://ultimateelectronicsbook.com/ https://ultimateelectronicsbook.com/ and it's worked very well from a rendering quality perspective. I looked at Katex for performance, but it didn't support all of the LaTeX formatting that I use. You can scroll through https://ultimateelectronicsbook.com/systems-of-equations/ https://ultimateelectronicsbook.com/systems-of-equations/ for a particularly formatting-heavy example with lots of matrix equations and augmented matrices, working through Gaussian decomposition and LU factorization examples. Instead, for performance, I wrote a small Ruby / Jekyll plugin to do MathJax server-side rendering. It calls the mathjax-node npm package, with some caching on top because it's so slow. This outputs static HTML and CSS with a few math fonts. The mathjax-node-sre npm package even populates aria-label fields for each equation: <span class="mjx-math" aria-label="y left-parenthesis x right-parenthesis equals StartFraction 1 Over 1 plus x EndFraction">...</span> If you have the option to consider server-side equation rendering, your users may thank you.
- lethologica 6y agoSlightly off-topic, but I really like the layout and feel of your website. I find the fonts and colours to be quite pleasing, and the site loads incredibly quickly.
- compumike 6y agoThanks! I am not a designer so that's accidental -- and much credit is probably due to the default Jekyll theme (https://github.com/jekyll/minima https://github.com/jekyll/minima). But performance optimization is something I enjoy and something I do as a break from writing the actual content.
- thangalin 6y ago> If you have the option to consider server-side equation rendering, your users may thank you. I'm developing KeenWrite[0], a desktop-based text editor that provides real-time rendering of TeX. It has two TeX-related HTML export formats: SVG (no rendering for either client or server) or TeX (requires client-side rendering). Behind the scenes it uses a highly-optimized version of JMathTeX[1] that includes a custom renderer to handle translating math font glyphs into SVG paths. [0]: https://github.com/DaveJarvis/keenwrite https://github.com/DaveJarvis/keenwrite [1]: https://github.com/DaveJarvis/JMathTeX https://github.com/DaveJarvis/JMathTeX
- abhinav22 6y agoI use MathJax and it is great. Thank you for the great work.
- ezequiel-garzon 6y agoCheck out the impressive list of sponsors behind NumFOCUS [1], in turn the main sponsor of MathJax. [1] https://numfocus.org/ https://numfocus.org/
- boogies 6y agoI’m amazed at how well MathJax works in CodiMD/HedgeDoc, not just math, but importing and using eg. chemical equation support (`$\require{mhchem}$`) as well. Kudos.
- hashtagmarkup 6y agoI used to use Mathematica or MatLab to export image files of equations or matrices, and embed those images into my papers. I would already have those equations loaded into the software as part of the research, so it really wasn't any extra work, and ensured they were copied over as they were actually used. Why is so much time spent trying to get complex math rendering added to text editors, especially when math research may define new renderings? /get off my lawn
- teruakohatu 6y agoThis is a math rendering engine. It has nothing to do with text editors anymore than any other software. Mathematica can export to Latex which is definitely preferable to embedding images into papers.
- gostsamo 6y agoAccessibility. Your nice images are someone blind's nightmare when the most important parts of a stem web page or pdf are actually just an empty alt tag.
- hashtagmarkup 6y agoI really hate to engage further on this as no one seems receptive, but, believe me... accessibility was a must as NSF grants through the university were involved. LaTex and illegible raw ASCII were also embedded in the PDF. There were other diagrams and charts and graphs, but at some point, no text editor could process and render everything natively, or be fully accessible to every disability.
- gostsamo 6y agoThat's why standards. Partial implementations are always a best attempt at something and having it in a uniform way makes it easier for everyone. NSF grands are only part of the picture. Knowledge is dispersed among arxive.org papers, pdf textbooks and random blog articles with each of them doing different thing and very often this thing is just slap an image of the formula and go on.
- jlokier 6y agoI really enjoyed this interview: https://mathml.igalia.com/news/2019/12/03/igalia-chats-with-neil-soiffer-on-mathml/ https://mathml.igalia.com/news/2019/12/03/igalia-chats-with-... It's mostly about MathML implementation in browsers, but a fair amount talks about MathJax as well and how good it is, including for accessibility.
- runarberg 6y agoI you want to quickly write some math to your website without necessarily knowing latex, then I wrote a tool called MathUp[1] which takes quick to write and easy to read math expressions and translates them to native MathML. MathJax can take native MathML as an input so you can feed it to MathJax to render it beautifully. 1: https://runarberg.github.io/mathup/ https://runarberg.github.io/mathup/
- thdc 6y agoYou might also be interested in tikzjax (https://github.com/kisonecat/tikzjax https://github.com/kisonecat/tikzjax) for diagrams which works "good enough". I use them together but there is a pretty noticeable delay with tikzjax - I'm not sure of any alternatives at this point.
- qubyte 6y agoI found the documentation hard to follow to get server rendering to work, so here’s an example of MathJax integrated with marked [1], and an example of it in action [2] (scroll down). 1: https://github.com/qubyte/qubyte-codes/blob/main/lib/render.js https://github.com/qubyte/qubyte-codes/blob/main/lib/render.... 2: https://qubyte.codes/blog/advent-of-code-2017-day-20-task-2 https://qubyte.codes/blog/advent-of-code-2017-day-20-task-2