groff
[Top][All Lists]
Advanced

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

Re: [Groff] Desable and enable page numbers with ms


From: Robert Thorsby
Subject: Re: [Groff] Desable and enable page numbers with ms
Date: Tue, 16 Oct 2012 08:20:54 +1100

On 16/10/12 06:56:03, trebol wrote:
> I would like to start a chapter without page number, simply starting 
> the paragraph a few lines below normal, and then restore the page 
> numbers.
> 
> There is a simple way to disable and enable the page numbers, without
> touch the headers?  I'm new in troff/groff, maybe I'm doing a useless
> mess.
> Also, I found the PN register in utp, but neither in the groff_ms page 
> or in the info manual.  There are other interesting undocumented 
> registers?

I had a situation where the first page of each chapter had no header and 
the page number was printed as a footer centred; the remaining pages had 
no footer but the page numbers were printed flush against the outer 
margin in the header. This is a fairly common layout.

I created two number registers at the beginning of the file:
Print*Page*Hdr
Print*Page*Ftr
with initial values of 0

In the macro for the header I used a conditional to test if 
Print*Page*Hdr>0 before printing the header and , as the last step in the 
header macro, I incremented Print*Page*Hdr by 1. This ensured that the 
header was never printed on the first page but was always printed on 
subsequent pages.

I similar manner I tested Print*Page*Ftr=0 to create the reverse effect.

It gave me the added bonus that I could suppress the printing of either 
the next header or the next footer (for example, for a full page bleed) 
by resetting the Print*Page register(s) to 0 in the copy.

I was also able to combine chapters into a single file because the 
Print*Page registers were reset to 0 at the beginning of each chapter. 
From there it was a simple task to include at the beginning of each 
chapter a conditional to add an initial blank page to ensure that 
chapters always started on a recto.

The gurus may come up with a definitive answer but this worked for me.

Robert




reply via email to

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