groff
[Top][All Lists]
Advanced

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

Re: [Groff] question about .rs and .nop


From: Peter Schaffter
Subject: Re: [Groff] question about .rs and .nop
Date: Tue, 3 Sep 2013 13:07:03 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Aug 26, 2013, Tadziu Hoffmann wrote:
> 
> > > The problem you see is related to header traps.  [...]  and
> > > this behaviour is not controllable by `rs'.  It seems that
> > > after the top header trap mom plants other, probably unused
> > > vertical traps.
> 
> > Any suggestion for a clean solution?
> 
> How about this:
> 
>   .MAC MyNewPage END
>   .NEWPAGE
>   .ch address@hidden
>   address@hidden
>   .rs
>   .END
> 
> which removes the trap planted there by mom (and appears to work
> for me in a simple example), but Peter will have to comment on
> whether this will have any unwanted side effects (and maybe
> enlighten us to the original purpose of setting the trap).

Just before page ejection, register @TOP is created.  @TOP is used
for page elements whose placement at the top of the page requires
tweaking.

An example is blockquotes, which are usually leaded
differently from running text.  In order for the first line of
blockquote text at the top of a page to fall precisely on the
same baseline as all other pages, the compensation applied to the
absolute spacing request that precedes resumption of running text
needs to be tweaked.  Normally, it's

  .sp |\n[#TOP_MARGIN]u-\n[#DOC_LEAD]u

but for blockquotes, it's

  .sp |\n[#TOP_MARGIN]u-\n[#BQ_LEAD]u

The trap, 1u below the first baseline, simply removes the register
because it's no longer needed.

Other macros testing for @TOP are HEADING, FLOAT, and PDF_IMAGE.

Some years ago, I wrote about the annoyance of absolute .sp
requests, which do not, contrary to intuition and logic, take the top
of the page as their starting point but rather the top of the page
plus 1v.  Classic example:

  .vs 12p
  .sp |6P
  foo

"foo" is printed 6 picas plus an additional 12 points below the top
of the page, requiring .sp |6P-1v to place it correctly at 6 picas.

In the normal course of affairs, it's easy enough to add the
compensation ('-1v', or, in mom's case, '-\n[#DOC_LEAD]u'), but
when diversions are being output whose leading differs from running
text, the issue gets complicated, since '1v', after a page header is
finished, means "1 linespace at the leading of running text", not "1
linespace at the leading of the diversion being output."

There'd be no need for complications like @TOP if groff had
an absolute spacing request that spaced sensibly to the requested
absolute position on the page; in other words, |6P means "6P from
the top of the page", end of story.

-- 
Peter Schaffter
http://www.schaffter.ca



reply via email to

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