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: Tadziu Hoffmann
Subject: Re: [Groff] question about .rs and .nop
Date: Tue, 27 Aug 2013 00:12:15 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

> BTW, I never understood why the formatting macro packages
> don't like the user to put space at the top of their pages.

It's not about not wanting the user to put space at the top
if the user wants it, but rather about not putting space
there if it's not wanted.

Example: usually you want section headings to be separated
from the last paragraph of the preceding section by a bit of
space, so sectioning macros normally begin by flushing out
any partially collected line and then spacing a bit before
outputting the section header:

  .de mysection \" expects heading text as argument
  .br
  .ne 6v \" (crude!)
  .sp 2.5v
  .ft B
  \\$*
  .ft R
  .sp .5v
  .ti 0
  ..

However, that space before the section header is unnecessary
(and probably even ugly -- imagine a fluttery top margin!)
if the section header is the first text on a new page.

No-space mode is a convenient way of achieving this without
having the section macro jumping through hoops to figure
out whether it is the first thing on the page, in order
to decide if it should or should not output the space.
And in those cases where you really want the space,
spacing can be explicitly reinstated using "rs".

Otherwise, how would you do it?  Well, the section macro could
perhaps query register "nl" (vertical position of last printed
text base-line), but that may be a bit chancy (depending on,
for example, whether you output or not a page header on that
page).  Or the new-page macro could set a flag to indicate
that a new page has just been started, and that flag could be
queried by the section macros.  However, you would then also
need a mechanism to automatically reset the flag once text
has been output.  This could be achieved by setting a trap
at the top which is sprung once text is actually printed.
(And it appears mom is trying to do exactly that.)

But I feel this is much more complicated than simply using
no-space mode (and educating the user to its existence).
After all, it was probably invented for precisely this purpose.





reply via email to

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