r/LaTeX • u/guizzmoloul • 1d ago
Maintaining both HTML and PDF versions of LaTeX documents is now surprisingly easy
TL;DR: It is now surprisingly easy to maintain both a web version and a PDF version of your latex content. Here is an example of a website (in french) I maintain this way.
Most of the stuff I see here relating to AI is negative (often for good reason). I wanted to share something that I find genuinely positive about it.
Several times over the past 15 years, I have tried to find a way to maintain both a web version and a PDF version of my courses.
Since I am familiar with Latex, I wanted an automated way to turn the content I write in latex into a properly readable web version.
I had managed to get something somewhat workable using a static site generator and tex4ht, but I always ran into issues with tex4ht not properly handling certain packages, compatibility issues with mathjax and whatnot.
I never managed to get anything I was really satisfied with. With the help of AI, however, it has become surprisingly easy to get something that work well.
Here is what i actually did:
PDFs use lualatex; HTML uses tex4ht, with custom configuration and shared styling. Custom macros have web adaptations where needed, tikz figures become SVG images. AI is not involved in compilation at all. It was just used to build the tools (all the custom web adaptations stuff): ordinary scripts and tex tools run the build.
So, a little PSA for the teachers out there: it is now quite easy to make your courses available in a web format without having to maintain two separate versions of your content. The git repo is accessible via the landing page of the website.


