groff
[Top][All Lists]
Advanced

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

Re: [Groff] odd interaction between .bl and .(c in -me macros


From: Tadziu Hoffmann
Subject: Re: [Groff] odd interaction between .bl and .(c in -me macros
Date: Fri, 30 Dec 2011 14:47:37 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

> .bl, which ordinarily works at the top of a page, does not
> seem to do so when inside a .(c block.  I am not sure if
> this is a bug, or if I'm misunderstanding some subtlety
> of the interaction between these two macros.

This behavior is a natural consequence of the way troff
works, so it's definitely a feature, not a bug.  Actually,
it's an interaction with the page header macro.  The key
to understanding it is given in the Troff User's Manual:
"A pseudo-page transition onto the first page occurs either
when the first break occurs or when the first non-diverted
text processing occurs."

(c/)c work by collecting text in a diversion and then outputting
that diversion with the appropriate indent. So the sequence of
events is the following:

 1. (c starts to collect your text, *including* the blank space
    at the top.
 2. )c ends the diversion, computes the indent, and starts
    outputting the diversion.
 3. The top-of-page trap (set up by the macro package) is
    triggered, and the page header macro sets no-space mode.
 4. Your diversion is output, but the space at the beginning
    is ignored, since we are now in no-space mode.

Since no-space mode is set by the page-header macro, a ".rs"
before ".(c" is useless: no-space mode is turned on after you
have turned it off.

There are two ways to solve your problem.  One is to trigger
the top-of-page trap and only then turn off no-space mode:

  .br \" or .bp
  .rs
  .(c
  .bl 20
  center me
  .bl 20
  .)c
  .pp
  Here is text.

The problem with this is that it is explicitly designed to work
only at the top of the page.

The other one (which I think is better) is to turn off no-space
mode from within the diversion itself:

  .(c
  \!.rs
  .bl 20
  center me
  .bl 20
  .)c
  .pp
  Here is text.





reply via email to

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