Re:Using eqn for static website equation generation
by svat on Saturday February 01, 2025 @03:05PM
(#42901705)
I appreciate the author's goal of not requiring readers' browsers to run Javascript to render the mathematics. The tradeoffs between images, SVG, and MathML are also unfortunately as stated.
Note though that another option is to use MathJax or KaTeX at build time (e.g. as preprocessing or postprocessing to the Hugo build here), to generate a static page that does not require Javascript to render.
Re:Using eqn for static website equation generation
by eichin on Saturday February 01, 2025 @03:18PM
(#42901829)
Hmm, looks like https://savannah.gnu.org/bugs/?40720 is just lengthy explanations of how the unicode issues are hard to fix in the current code base; savannah doesn't seem to have bug search, but I didn't see any more specific tickets for the other unicode problems mentioned. (On a whim, I tried eqn -T MathML -d'«»' but it failed in a goofy but unsurprising way.)
Re:Using eqn for static website equation generation
by elashri on Saturday February 01, 2025 @03:51PM
(#42902140)
If you want to render LaTeX without JS and converting files to SVG. There are two options in my experience (Anyone feel free to correct me or add another option)
1- Rely on MathJS or KeTeX to render server side. Svat comment contains links to docs.
2- Hugo can use Pandoc as a Markdown renderer, which allows you to write LaTeX equations inside Markdown and convert them to pure HTML during build time. It would give MathML code.
Another option would be use tex4ht but this is actually more used to convert whole LaTeX documents to HTML and would need to manually insert the parts you want into hugo source.
Re:Using eqn for static website equation generation
by defanor on Saturday February 01, 2025 @05:19PM
(#42903024)
I guess that authoring in MathML, and rendering MathML into images for browsers that do not support it, would have helped to avoid the mentioned inconsistency.
Re:Using eqn for static website equation generation
by jmwilson on Saturday February 01, 2025 @06:02PM
(#42903417)
I use KaTex (https://katex.org/) as part of static site generation, and I get LaTeX quality output (because it duplicates LaTeX's algorithm) using only CSS.
Using the eqn and troff suite in 2025 ... I'll just say there's a better way. LaTeX is arcane enough, but at least it is a universal standard in mathematical publication that it pays off to learn a little.
Re:Using eqn for static website equation generation
by dbrumbaugh on Monday February 03, 2025 @10:08AM
(#42918888)
Oh, absolutely. I just have an unhealthy fascination with old tech, so I went into this with the specific goal of using eqn, rather than LaTex. I write LaTex all day for my day job, and I wanted a reason to use something else.
Re:Using eqn for static website equation generation
by dbrumbaugh on Monday February 03, 2025 @10:17AM
(#42918996)
Hey all--the author here.
I just want to clarify one thing that I didn't think to mention (but probably should have) in the article itself. I went out of my way to use eqn specifically because I wanted to use that particular tool here. I write LaTex a lot on a day to day basis, and wanted to play around with something else. So this wasn't a case of picking eqn because I thought it was the best tool for the job.
Note though that another option is to use MathJax or KaTeX at build time (e.g. as preprocessing or postprocessing to the Hugo build here), to generate a static page that does not require Javascript to render.
MathJax: https://docs.mathjax.org/en/latest/server/start.html
KaTeX: https://katex.org/docs/api#server-side-rendering-or-renderin...
1- Rely on MathJS or KeTeX to render server side. Svat comment contains links to docs.
2- Hugo can use Pandoc as a Markdown renderer, which allows you to write LaTeX equations inside Markdown and convert them to pure HTML during build time. It would give MathML code.
Another option would be use tex4ht but this is actually more used to convert whole LaTeX documents to HTML and would need to manually insert the parts you want into hugo source.
Using the eqn and troff suite in 2025 ... I'll just say there's a better way. LaTeX is arcane enough, but at least it is a universal standard in mathematical publication that it pays off to learn a little.
I just want to clarify one thing that I didn't think to mention (but probably should have) in the article itself. I went out of my way to use eqn specifically because I wanted to use that particular tool here. I write LaTex a lot on a day to day basis, and wanted to play around with something else. So this wasn't a case of picking eqn because I thought it was the best tool for the job.