At 2024-12-04T00:08:23+0100, onf wrote: > On Tue Dec 3, 2024 at 11:56 PM CET, Tadziu Hoffmann wrote: > > I was thinking of something similar to > > > > .ne d Advance drawing position to the next vertical > > position trap and spring the trap, if it is > > nearer than distance d (default scaling unit v). [...] > > Reversing their order might make the intended meaning more obvious: > .ne d If the next vertical position trap is nearer than > distance d (default scaling unit v), advance drawing > position to it and spring it.
The phrase "and spring it" occurred to me as well. I think I'll go with something much (exactly?) like this. I might as well cross reference register .trunc while I'm there. While we're on the subject, I was careful to say "vertical position trap" instead of "page location trap", because `ne` interacts with diversion traps as well. I am sorely tempted to describe `ne` as "not a conditional `bp`, but a conditional `sp`". `sp` has a noteworthy limitation. .sp dist Break and move the next text baseline down by dist, or until springing a page location trap (default scaling unit v). A negative dist will not reduce the position of the text baseline below zero. Prefixing dist with the | operator moves to a position relative to the page top for positive N, and the bottom if N is negative; in all cases, one line height (vee) is added to dist. dist is ignored inside a diversion. Check the final sentence. `ne` inherits this limitation. In a diversion, you can ask `ne` for tons of space, but you'll only get 1v at a time. Even if you invoke it more than once. Input: $ groff -ww <<EOF .de trap . tm BOING (.d=\\n[.d]u) .. .di div .tm JUST GOT STARTED (.d=\n[.d]u) .dt 5v trap .nf 1 .tm FIRST LINE OUT (.d=\n[.d]u) 2 .ne 3v 3 4 .tm ALMOST DONE (.d=\n[.d]u) .ne .tm JUST A BIT MORE (.d=\n[.d]u) .ne .tm I KEEP MASHING THIS THING BUT NOTHING HAPPENS (.d=\n[.d]u) 5 .tm DONE (.d=\n[.d]u) .di EOF Output: JUST GOT STARTED (.d=0u) FIRST LINE OUT (.d=12000u) ALMOST DONE (.d=48000u) JUST A BIT MORE (.d=48000u) I KEEP MASHING THIS THING BUT NOTHING HAPPENS (.d=48000u) BOING (.d=-1u) DONE (.d=60000u) Regards, Branden
signature.asc
Description: PGP signature