If I may chime in...

On Fri May 8, 2026 at 9:44 AM CEST,  G. Branden Robinson wrote:
> 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. [...]

Actually, Heirloom troff has `hypp` which allows assigning a penalty to
hyphenating the last word of a paragraph.

neatroff has `pmll` which allows setting the desired minimal line length
of a paragraph (in % of the line length) and an associated penalty for
lines which are shorter. This can be used to avoid too short last line
of a paragraph, such as one consisting of only a single word.

All of the above works only when formatting of entire paragraphs is
enabled, as noted below.

> [...] *roffs are designed around the principle of
> formatting one output line, delivering it to the output device, and then
> forgetting about it utterly. [...]

As has already been noted, Heirloom troff _and also_ neatroff implement
formatting of entire paragraphs. For backwards compatibility reasons
this is not the default, but has to be manually enabled by prefixing
the desired `ad` mode by `p` (e.g. `ad b` -> `ad pb`).

Cheers,
onf

PS: I am not subscribed to the list. Please Cc me when replying.

Reply via email to