groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Question about .trunc


From: Tadziu Hoffmann
Subject: Re: [Groff] Question about .trunc
Date: Fri, 4 Nov 2016 01:06:04 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

> Should it say, instead:
> 
> "...the amount of vertical space truncated from a .sp request
>                                            ^^^^^^^^^^^^^^^^^^
> by the most recently sprung vertical position trap..."

I believe that's how it was meant.

The info file has this to say:

  [...] at the point a trap is sprung, [.trunc] represents
  the difference of what the vertical position would have been
  but for the trap, and what the vertical position actually is.

If a position trap is sprung from a .sp request, the excess
space is truncated, and the current vertical position is now
the position of the trap -- if the trap were not there, the
vertical position would be different.  If normal text is output
that springs the trap, *nothing is actually truncated* -- the
vertical position is still the bottom of the text that was
output, and would be the same if the trap were not there.


> However, my diagnostics show that nl and .h are not always
> identical, and I can't figure out how to tell groff
> "sometimes use nl, sometimes use .h".

Which one to use depends on what you are trying to do.  nl is
the "current vertical position", .h is the largest vertical
position of any text that has ever been output on the current
page, i.e., the "high-water mark".

The manual page says that nl is "the vertical position of the
last printed text base-line", but that appears to be not quite
correct -- if you space vertically without outputting text, nl
will still change.  However, once you do output text (and you
never space backwards), nl and .h should be the same.
If you space backwards, nl will decrease, .h won't.


> The only other choice for calculating a value equal to the
> last .t is to use nl or .h, subtract it from the page length,
> then get the difference between the nl/.h and the location
> of the trap.

That sounds like a reasonable approach to me, and it's
basically how I do it, too: when enough text for a page
has been gathered into a diversion (I normally set the trap
position at textheight-1v+1u, so that excess space is usually
zero or slightly positive), I divide the difference between
textheight and .h proportionally among the stretchable spaces
(embedded requests in the diversion), and replay the diversion
onto the page.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]