At 2024-12-02T13:05:50-0500, Douglas McIlroy wrote: > > I have discovered recently that `ne` and `bp` behave differently in > > regards to pending input lines. `bp` breaks such lines, while `ne` > > does not. In practice this means that `ne` does not behave like a > > conditional `bp` as one would reasonably expect. > > I invented .ne 55 years ago and have never heard a complaint about its > design before. It is not a conditional .bp, because that would case a > line break, which .ne never does, nor should.
Thanks for speaking to the issue, Doug. I came up with the following demonstrator. It produces the same (nroff) output on groff 1.22.3, groff Git, DWB 3.3, and Heirloom Doctools.[1] $ cat ATTIC/need.roff .na .de TT Pilaf\(emI'm trapped under rice! (nl=\\n(nl) .. .wh \n(.pu/2u TT \" Plant trap at half the page length. .ne 1v (nl=\n(nl) Hold my beer .ne 6i and watch this. .br I encourage the interested reader to predict the output of the foregoing. I'll use the rest of this message as "spoiler space" before disclosing my output below.[2] I therefore think our description of `ne` in groff(7) pretty badly needs revision. Here's what it says now. .ne Break page if distance to next page location trap is less than one vee. .ne d Break page if distance to next page location trap is less than distance d (default scaling unit v). Here's what I propose. .ne Advance drawing position to the next vertical position trap if it is nearer than one vee. .ne d Advance drawing position to the next vertical position trap if it is nearer than distance d (default scaling unit v). How do people feel about that wording? Returning to the exercise for the reader, I'll offer a hint by quoting our Texinfo manual. ---snip--- Output line properties like page offset, indentation, adjustment, and even the location of its text baseline, are not determined until the line has been broken. An output line is said to be "pending" if some input has been collected but an output line corresponding to it has not yet been written; such an output line is also termed "partially collected". If no output line is pending, it is as if a break has already happened; additional breaks, whether explicit or implicit, have no effect. If the vertical drawing position is negative--as it is when the formatter starts up--a break starts a new page (even if no output line is pending) unless an end-of-input macro is being interpreted. *Note End-of-input Traps::. ---end snip--- These facts are important to know; it'd be good to get that paragraph into groff(7) somewhere--or roff(7), since as far as I know they apply to pretty much every *roff ever. Regards, Branden [1] ...with a difference in how the em dash is rendered on a terminal. DWB nroff writes a single hyphen; Heirloom and groff write two. [2] Answer to exercise: $ nroff -T ascii ATTIC/need.roff | nl -ba 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 (nl=0) Hold my beer Pilaf--I'm trapped under rice! (nl=1320) and 35 watch this. 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
signature.asc
Description: PGP signature