> `sp` has a noteworthy limitation.
> 
>   .sp dist  [...]
>             dist is ignored inside a diversion.

This is not true.  (See below.)

> 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.

.sp works inside a diversion exactly like it works in the
top-level diversion.  Take a look at the attached example.
There is precisely 10v between "foo" and "bar".  However, .sp
will not space beyond a trap, so "trap sprung" occurs with
15v above it.  You can replace the ".sp 100v" with ".ne 100v"
and the result will be exactly the same.

> .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)

I'm not sure what you are trying to show here.  .ne means
"I need this much space".  If that space is available,
nothing happens.  If you invoke it a second time with the
same argument and without having output something in the
meantime, that space is still available, so again nothing
happens.  The effect of .ne is not cumulative.


>  .sp dist  Break and move the next text baseline down by dist
>            [...];
>            in all cases, one line height (vee) is added to dist.

Thinking in terms of the positions of baselines may be
tempting because that's how Postscript and PDF work,
but I don't think it's the best mental model for troff.
Interpreting the behavior of .sp as in metal typesetting
seems more appropriate.  That is, ".sp dist" means "leave
this much space *between* the last line and the next".


.\"
.\" ----------------------------------------------------------------
.de YY
.gcolor red
trap sprung
.br
.gcolor
..
.\" ----------------------------------------------------------------
.de ZZ
\t\v'0.3m'\\ni\v'-0.3m' \t\D'l 80p 0'
.br
.if \\n+i<26 .ZZ
..
.\" ----------------------------------------------------------------
.ps 12
.vs 14
.fcolor yellow
.nr dy 15*\n(.v
.vs 0
\D'P 100p 0 0 \n(dyu -100p 0'
.br
.vs
.mk
.ta 15pR
.nr i 1 1
.gcolor grey
.ps 8
.ZZ
.ps
.rt
.di XX
.dt 15v YY
.gcolor blue
foo
.br
.sp 10v
bar
.br
.sp 100v
baz
.br
.di
.in 3n
.nf
.XX

Attachment: diversiontrap.pdf
Description: Adobe PDF document

Reply via email to