The definition of insanity is doing the same thing twice and expecting different results.

By coincidence, this is the basic way to compile latex.

TBF Typst internally also recompiles a bunch of times until a fixpoint is reached, however it is designed to limit what parts can depend on the previous iterations and to reuse previous results for parts that definitely didn't change.

My makefiles ran it 4 times, i think. I still preferred it to Word.

Anything is preferable to Microsoft Word.

Last time I checked, flipping a coin twice gave different results.

Did you flip the coin in the exact same way? Probably not.

If you flip it an infinite number of times, you will get the same results anyway. Call when you're finished :P

Aren’t getting different results the norm in programming anyway? Developers usually don’t make the effort to include idempotency and make builds reproducible.

Normally, if you compile the same code twice on the same machine, you'll get the same result, even if it's not truly reproducible across machines or large gaps in time. And differences between machines or across time are usually small enough that they don't impact the observed behavior of the code, especially if you pin your dependencies.

However, with LaTeX, the output of the first run is often an input to the second run, so you get notably different results if you only compile it once vs. compiling twice. When I last wrote LaTeX about ten years ago, I usually encountered this with page numbers and tables of context, since the page numbers couldn't be determined until the layout was complete. So the first pass would get the bulk of the layout and content in place, and then the second pass would do it all again, but this time with real page numbers. You would never expect to see something like this in a modern compiler, at least not in a way that's visible to the user.

(That said, it's been ten years, and I never compiled anything as long or complex as a PhD thesis, so I could be wrong about why you have to compile twice.)

I wrote my PhD (physics) in LaTeX and I indeed needed to compile twice (at least) to have a correct DVI file.

It was 25 years ago, though, but apparently this part did not change.

This said, I was at least sure that I would get an excellent result and not be like my friend who used MS Word and one day his file was "locked". He could not add a letter to it and had to retype everything.

Compared to that my concern about where a figure would land in the final document was nothing.

That's not the definition of insanity, that's the definition of practicing.

Almost every compiler is a multipass compiler.

But in this case the passes are manual!

so?

Dunno - to me it feels like the latex compiler should just run whatever it needs to for however many times until the output is done/usable, like basically all other compilers?