openjournals / joss

The Journal of Open Source Software
https://joss.theoj.org
MIT License
1.54k stars 186 forks source link

LaTeX in article titles isn't properly rendered on home page nor article page #1382

Open cthoyt opened 1 week ago

cthoyt commented 1 week ago

I was just looking at recent articles on the homepage (https://joss.theoj.org/) and saw that PyXAB - A Python Library for $\mathcal{X}$-Armed Bandit and Online Blackbox Optimization Algorithms did not get rendered correctly. There's some LaTeX / TeX / MathTeX in between the dollar sign $ delimiters that should get rendered beautifully on the homepage.

Screenshot 2024-10-29 at 13 22 23

The same thing happens when navigating to its page https://joss.theoj.org/papers/10.21105/joss.06507

Screenshot 2024-10-29 at 13 24 11

A silver lining is that it seems to be rendered beautifully in the article title in the PDF!

I'm on Firefox v131 on Mac OS 14. I also checked this was happening on Safari v17.6 on the same machine

sneakers-the-rat commented 6 days ago

oh joy do we have to do a mathjax thing...

edit: oh wait looks like there's a serverside latex math renderer, that sounds better than bundling 1MB of js https://katex.org/docs/api

edit2: ok i checked this out - all the serverside rendering for latex math in ruby just uses katex or some other older js rendering engine. the gems are at least 2 years unmaintained, but they are literally just wrappers around the execjs gem and katex, so we could borrow that code (with attribution) and vendor our own katex so we can update it periodically? then we add a note in the docs saying any latex in titles needs to have the $'s touching the first and last characters with whitespace on either side like $x = y$ so we can write regex that matches it but not if someone is using a dollar sign as a currency symbol (which always has whitespace before it).

OR

we can repurpose some of mathstodon's code that we borrowed at neuromatchstodon to replace common latex commands with unicode symbols

but at that point we might as well say "no latex in titles" which is no fun