Remix.run Logo
Smaug123 3 days ago

On the layout side rather than the "what spaces are available" side, I really recommend https://gwern.net/doc/design/typography/tex/1981-knuth.pdf , the paper in which the Knuth-Plass algorithm for paragraph layout is defined. (The Knuth-Plass algorithm decides how wide spaces should be on each line and which choices of hyphenation out of some predefined set should be used to lay out a paragraph.) It's super readable and generally quite joyful. Knuth describes TeX as a "labor of love", and it shines through that paper.

bayesnet 3 days ago | parent [-]

For those interested in typst, Laurenz wrote[0] about the differences between the typst and TeX layout algorithms a while ago. The paragraph layout algorithm is the same but the way it interacts with page placement is quite different.

[0]: https://laurmaedje.github.io/posts/layout-models/

WillAdams 3 days ago | parent [-]

Yeah, one of the things which I always wished for when doing page composition was a way to visualize which paragraphs could be set a line or two longer or shorter while still being set reasonably nicely.

In decades of typesetting, I've had a chapter fall out almost perfectly with nicely pages and appropriately placed figures exactly once (fastest 40 minutes of my life) --- for the rest, it was:

- style the text and place the figures

- check the last page and see if it would be helped by paging tight or loose

- review all the pages and their figure placement to see which was the most problematic/egregious --- fix it

- starting at the beginning, adjust paragraph tightness as necessary, trying to get pages to balance and if need be, figures and references to be placed where the specs call for them --- if need be, adjust figure size/height/placement/style

- if one reaches the end and the selected strategy did not have the desired result, revert back to the initially styled and placed version and try the other strategy

- repeat until everything worked and everything panned out and all pages are balanced and all references/figure placements

gucci-on-fleek 2 days ago | parent [-]

> Yeah, one of the things which I always wished for when doing page composition was a way to visualize which paragraphs could be set a line or two longer or shorter while still being set reasonably nicely.

I wrote a LaTeX package [0] that does exactly this. The default settings automatically lengthen paragraphs as necessary, but you can configure it to only tell you which paragraphs can be easily lengthened [1] without actually lengthening any of them.

[0]: https://www.ctan.org/pkg/lua-widow-control

[1]: https://tug.org/TUGboat/tb43-3/tb135chernoff-lwc.pdf

WillAdams 2 days ago | parent | next [-]

Looking forward to trying this out! (not sure how I missed it...) Thanks!

zvr 2 days ago | parent | prev [-]

That's awesome! Thank you very much!