@brodriguesco Thanks for the pointer. That's very useful in general, I'm not sure whether it will be the solution here. It's a 500-page introductory math book, originally written fully in LaTeX.
Getting everything into Quarto with HTML and PDF in sync was already a bit of work...