Hi Doug,

At 2025-05-02T19:47:45-0400, Douglas McIlroy wrote:
>   > To illustrate, in the following "A" means an output line requiring
>    > adjustment; "F" a line that is "full" and does not; and "L" and "R"
>    > indicate distribution of adjustment spaces from the left and right,
>    > respectively.
> 
>    > groff 1.22.4    groff 1.23.0
>    > ------------    ------------
>    > A    L          A    L
>    > A    R          A    R
>    > F    L          F    R
>    > A   R          A    L
> 
> Possibly ambiguous wording.

Very likely.  Unfortunately commit messages are unrevisable, so when
trying to explain myself in them, I get stuck with my first draft
forever--and few writers benefit from aggressive editorial attention
more than I.

> Does a line that is exactly full before adjustment "require
> adjustment?" My guess is yes.

As I conceptualize it, no.  The line is already in perfect adjustment.

Relatedly, the `distribute_space()` function in GNU troff returns early
if (1) there amount of space required to bring the output line up to the
configured line length is zero; (2) no adjustable spaces exist on the
output line; or (3) the output line is already overset.

https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/env.cpp?id=d96a9c58bbe296b065fa250e3ea1e1a410cdde81#n2185

(If we implemented a "squeezing" algorithm, and condition (2) did not
hold, we could instead proceed with it.)

> On the other hand, a partially full line at the end of an adjusted
> paragraph does not require adjustment.

Agreed.

> If my yes guess is wrong, I would call the situation a violation of
> Kernighan's rul, "Do nothing gracefully."

I don't _think_ we're violating it, and I think my 2023 change to the
formatter hews to the principle better.  If a line is adequately full
(because it either matches the line length or ends a paragraph), then
its presence does not perturb "adjustment parity".

I guess another way of saying this is that, as I conceive it, a line
that is "adequately full" contributes to the page's uniformity of
grayness by definition.

The foregoing is my understanding of the relevant typographical
principles as I learned them from GNU troff's source code and behavior,
not a vociferous prescription.  I brought relatively few "priors" in the
Bayesian sense to his domain.

Incidentally, I recently changed GNU troff to tell you by how much
adjusted lines are over- or underset, when that eventuates.[1]

I dare say that these diagnostics are more readily apprehended by the
non-expert than TeX's (notorious?) "overfull hbox" messages.

Yeah, that's right--I'm droppin' my Donald Knuth diss track.

Regards,
Branden

[1] Test script output:

$ ../src/roff/groff/tests/warn-on-overset-adjusted-line.sh
verifying that overset filled line warns in nroff mode
<beginning of page>
###
troff:<standard input>:4: warning [page 1, line 2]: cannot adjust line; overset 
by 1n
ABCD
verifying that overset filled line warns in troff mode
<beginning of page>
###
troff:<standard input>:4: warning [page 1, 0.2i]: cannot adjust line; overset 
by 0.1775i
ABCD
$ ../src/roff/groff/tests/warn-on-overset-unadjusted-line.sh
verifying that overset left-aligned line warns in nroff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, line 2]: cannot break line; overset 
by 1n
ABCD
verifying that overset left-aligned line warns in troff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, 0.2i]: cannot break line; overset by 
0.1775i
ABCD
verifying that overset right-aligned line warns in nroff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, line 2]: cannot break line; overset 
by 1n
ABCD
verifying that overset right-aligned line warns in troff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, 0.2i]: cannot break line; overset by 
0.1775i
ABCD
verifying that overset center-aligned line warns in nroff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, line 2]: cannot break line; overset 
by 1n
ABCD
verifying that overset center-aligned line warns in troff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, 0.2i]: cannot break line; overset by 
0.1775i
ABCD
$ ../src/roff/groff/tests/warn-on-underset-adjusted-line.sh
verifying that underset filled line warns in nroff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, line 2]: cannot adjust line; 
underset by 1n
 A
B
verifying that underset filled line warns in troff mode
<beginning of page>
###
troff:<standard input>:5: warning [page 1, 0.2i]: cannot adjust line; underset 
by 0.0733333i
 A
B

Attachment: signature.asc
Description: PGP signature

Reply via email to