groff
[Top][All Lists]
Advanced

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

[Groff] End-of-page macro problem at end of input file...


From: Clarke Echols
Subject: [Groff] End-of-page macro problem at end of input file...
Date: Fri, 06 Jan 2012 16:32:25 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111109 Thunderbird/3.1.16

I've been using some macros I wrote to produce certain types
of reports, and to print transcripts of presentations, etc.
But I've encountered a problem that puzzles me.

I set a top-of-page trap to handle the page-headings before
continuing normal content text, and a bottom-of-page trap
to set the page number (this code is contained in the
start-up macro before processing the input text file):

>.  wh 0 set_up_page_header   \" Set top-of-page location for first line
>.                        \" (This also happens at start of first page)
>.                            \" Set bottom-of-page traps
>.  wh -1i print_page_number    \"

The "set_up_page_header" macro does little other than space down to
one inch below top-of-page before processing input text.

The bottom-of-page macro spaces down .5v after the trap is sprung,
then prints the page number (centered) before beginning a new page:

>.de print_page_number
>.ev pr_print_pageno
>.\"              Register `XX' is defined in the text source file:
>.\"              XX=1 means title page which has no printed page >number.
>.\" XX=0 means other pages which all have printed page >numbers.
>.
>.  if !\\n(XX \{\
>.sp .5v
>.  nf                        \" No fill for page number
>.  ce 1                      \" Center page number at bottom of page
>\(mi \\n% \(mi
>.  fi                        \" Back to normal fill
>\}
>.ev
>\}
>'bp
>.
>..

If XX is non-zero, the page number is not printed, and the 'bp request
is executed.

This all works fine until I get to end-of-file.

At end of file (usually in the middle of the page somewhere), the 'bp
request kicks out a new page, and I get new top-of-page processing
plus a new bottom-of-page page number with an extra blank page at the
end instead of quitting at the bottom of the page where EOF occurred.

I know the 'bp is the cause, but don't know how to handle page
numbering at the bottom of the page while suppressing the 'bp
request after EOF is reached.  As it is now, groff ejects the page
where EOF occurs, but the 'bp in the bottom-of-page macro starts
a new page which is blank except for the page number at the bottom.

I haven't seen this problem before when using these macros, and it's
not clear to me what I should be doing differently to get the desired
end-of-page page number at the bottom of the last page, without
causing a final, extra blank page due to the 'bp.

It has to be something very simple (and very obvious), but I haven't
been able to find any documentation to explain it.

Any clues?

Thanks,

Clarke



reply via email to

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