What advice do you have for writing "docs are code" LaTeX?
I find LaTeX to be the lesser of evils when creating PDFs. However, I rarely deal with LaTeX issues these days because all of the pain points have been patched away in my tooling that converts md to tex. However, I keep thinking something more modern or faster (like Typst) might make my life as an author easier. Compiling LaTeX with tools like rubber is still painful and slow.
1. Separate each part of a document into different TeX files and include them in the main document. Each file should be a separate unit of the work. Only compile the main document when you need to.
2. Generally write with readability in mind and use newlines and other whitespace in the source a lot more than you think you should.
3. If you have common boilerplate that you frequently use at the top of docs, make your own package(s) for those commands and maintain that separately.
4. Refs and labels everywhere you possibly can. Also, prefixing your label names helps a lot, so \label{clouds} on a picture of clouds becomes \label{fig:clouds}. If you are writing a book, and this is the chapter on the sky, consider \label{fig:sky:clouds}.
Overleaf has several examples that are not bad. I am currently working on a book and the Krantz template is a pretty decent example of how you might structure things (although the package itself is total spaghetti). The ACM and IEEE paper examples are also both OK, but are short so they cut some corners.
I'm not sure if there is a good book on LaTeX, ironically.
I find LaTeX to be the lesser of evils when creating PDFs. However, I rarely deal with LaTeX issues these days because all of the pain points have been patched away in my tooling that converts md to tex. However, I keep thinking something more modern or faster (like Typst) might make my life as an author easier. Compiling LaTeX with tools like rubber is still painful and slow.