Re: Poor hyphenation for runts?

"G. Branden Robinson" <[email protected]> Fri, 8 May 2026 02:44:26 -0500
Newsgroups gmane.comp.printing.groff.general
Message-ID <20260508074426.tyuunq4lh6hucoi7@illithid>
At 2026-05-08T04:20:46-0300, Sebastien Peterson-Boudreau wrote:
> Recently, while writing a document, I noticed that groff hyphenated
> the last word of the last line of a paragraph. This looked very ugly,
> so I inserted a \% before the word to prevent it, but that made me
> realize this left a runt at the end of the paragraph. I was wondering:
> is this intentional by the hyphenation algorithm?

Yes.  There's no mechanism in any troff any I know of that penalizes or
assigns a score to this outcome.  (There _is_ one to prevent a
hyphenation break on a line before a vertical position trap; see the
`hy` request description.)

> Does it do this to avoid runts? Because I think leaving half of a word
> on the last line is worse than leaving an entire word on the last line
> :p (personally, I don't even find runts that bothersome... maybe I'm a
> bad typographer...)

I agree with you, but to the best of my knowledge no *roff is designed
to penalize such situations.  Automatic detection and prevention of this
outcome is one of the features touted of the Knuth-Plass algorithm
(K/P), which however is difficult to implement in GNU _troff_ (and I
assume other *roffs) because *roffs are designed around the principle of
formatting one output line, delivering it to the output device, and then
forgetting about it utterly.  Early *roffs were designed to work on
computers that were so resource-constrained that today we'd find them
fit only to serve as microcontrollers for elevators or microwave ovens.

To do K/P, the formatter has to keep an entire paragraph "in mind" at
once.  A breaking decision can propagate backward through its lines,
altering their adjustment and breaking to minimize their "badness".  I
don't know how K/P handles a paragraph that exceeds the page height.

Regards,
Branden
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmn9lFIACgkQ0Z6cfXEm
bc5M/w/7BN6TiJaKzhWtHJjg22qdVDUuONwqFnGct3Lr+kXoIZ00Oev1B/WAxxLY
hme/eoJGgGAdyVW+yzGq6QrX0YDyFNAIP9hI2mjDbBKYUWAUXY2JaIArnFLI1IBY
p+jm3/6aB7Yir3oRdkfBTv0qx4l92LTiLffBHj5x2Tj/Kx4ghxt5H0n9TUHxNigJ
wXXC7H7jd0zdPWC+CfY33wSKavGy6yLxgGQcV568DJ9fcJHs1cSejx9ttHUsCDkm
PsDoEwLivaed2dfQE0GuP0mfhKLFrMssDwiDGMfPNYGIrE8sv7YoF4QcdQlfN7LQ
6nGB7+rac5yLVyojpY9ql+tsgUgh9GaKl5HvYxxTL1tHu8+CCjXbrV8sPeNsMDsg
R1dpotixohEh2ufqXnGtVt+nRg2qam1Qs++h0GsUSmuiJxOSuVELhvoR+81jW0y7
pUK5taqQIwgAdujfp0gsMrSke26gfLlbpEIskeoSdUo66mJEy2S1RpEr8uAG/3Nx
i9//YH0hcxjpGiy7gSgi4DeSVnP0HE6z03zJ3SGQfuS5sjsjDzWiCbZ8wBf3PknY
mIvPLVnzpr59dRpF68wFnw4/r598XwHeoY7ahRYN72P9qWApJkFblE1MfbYTwVIb
arjwPoVvQ6j4JPH6dWZEfgSGDxxY54Zm89lTEW3j7I3GUrUWC28=
=sOn5
-----END PGP SIGNATURE-----