[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Explanation for .BP ?
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] Explanation for .BP ? |
Date: |
Tue, 05 Mar 2013 11:50:10 +0100 (CET) |
> To generate a page break within a table, one is supposed to use
>
> .de BP
> . ie ā\\n(.zāā .bp \\$1
> . el \!.BP \\$1
> ..
>
> Could some kind soul explain the working of this macro? The else
> branch looks like a recursive call. And why does plain .bp not
> work?
A table is normally built-up within a diversion, and page breaks don't
work within a diversion. This diversion gets emitted right before the
table definition ends.
The macro BP first tests whether we are within a diversion. The
number register \n[.z] contains the name of the current diversion
(yes, a number register which contains a string); if it is empty, we
are not within a diversion. While defining a table, \n[.z] is *not*
empty, so the macro embeds a call to `.BP' uninterpreted into the
diversion (due to the leading `\!' escape). As soon as the diversion
is emitted, it now interprets the `.BP' macro. Since \n[.z] is empty
this time, the call to `.bp' gets executed.
Note that `.BP' even works with GNU tbl's option `nokeep'.
Werner