5 ms·
I use MathJax for rendering equations on https://ultimateelectronicsbook.com/ https://ultimateelectronicsbook.com/ and it's worked very well from a rendering qu
by compumike 6y ago
I 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
- krjt 6y agoI hooked up something similar when I was writing "julia as a cli calculator" [1], but it uses real TeX behind the scene, which gives me the opportunity to utilize existing TeX ecosystem such as TikZ and typography. Accessibility can be a problem, but I think it's possible to include some hints via the title attributes with some work. I hope to see more server-side solutions. The customizability and client-side overhead (you only need to render once on the server, possibly with caching) is not something a client-side library can achieve. [1]: https://krasjet.com/rnd.wlk/julia/ https://krasjet.com/rnd.wlk/julia/
- chloerei 6y agotry https://github.com/gjtorikian/mathematical https://github.com/gjtorikian/mathematical