[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: *roff hyphenation trivia challenge
From: |
G. Branden Robinson |
Subject: |
Re: *roff hyphenation trivia challenge |
Date: |
Sun, 31 Mar 2024 05:40:18 -0500 |
At 2024-03-29T15:55:43+0100, Tadziu Hoffmann wrote:
>
> > Predict the output of the following *roff input.
> > [...]
>
> I guessed wrong. And Heirloom nroff behaves differently
> from groff.
DWB and Seventh Edition Unix nroff behave the same as each other but
differently from _both_ groff and Heirloom.
> Some more unexpected behavior can be seen by shortening the line
> length to just 1 en.
Yes. It's enough to cut it down to 8n.
Three buggy implementations.
> I also tried the same thing in TeX and learned that by
> default TeX doesn't hyphenate the first word of a paragraph.
> (I didn't know this before, but I also never yet had to deal
> with a document where this was necessary.)
And you're from the country where this is most likely to happen! ;-)
> Also interesting to see that in this word, the hyphenation
> patterns don't suggest a hyphenation opportunity after "anti".
The leading `\%` prevents that.
-- Escape sequence: \%
-- Escape sequence: \:
To tell GNU 'troff' how to hyphenate words as they occur in input,
use the '\%' escape sequence; it is the default "hyphenation
character". Each instance within a word indicates to GNU 'troff'
that the word may be hyphenated at that point, while prefixing a
word with this escape sequence prevents it from being otherwise
hyphenated. This mechanism affects only that occurrence of the
word; to change the hyphenation of a word for the remainder of
input processing, use the 'hw' request.
Heirloom and groff treat the dummy character in a sensible way here, I
think. But I also don't think this facet of its meaning is documented
anywhere. I perceive a task...
The real shocker to me is that, in groff, automatic hyphenation roars
back to life after the explicit hyphenation point.
Seventh Edition and DWB never kill it in the first place.
Heirloom goes too far the other way and doesn't just have a leading `\%`
kill hyphenation but salts the earth so no hyphens grow from the corpse,
even when planted there.
Regards,
Branden
signature.asc
Description: PGP signature