interesting how Knuth dealt with layouts. maybe tex was more sensible than CSS.
tex is fundamentally a rectangle management language.
you have rectangles that are there to contain stuff and then it goes in and splits them up in to smaller rectangles.
so you just have a whole box where text goes in general.
this becomes smaller boxes for each line aligned to the baseline.
and then it does word wrapping to put smaller boxes (letters) on each of these lines.
https://en.wikibooks.org/wiki/LaTeX/Boxesi bet if you combined these with cool constraint stuff like auckland layout manager that would be an absurdly powerful publishing layout system that is probably pretty straightforward to understand.