Next: , Previous: , Up: ms Page Layout   [Contents][Index]


4.6.6.1 Headers and footers

There are multiple ways to produce headers and footers. One is to define the strings LH, CH, and RH to set the left, center, and right headers, respectively; and LF, CF, and RF to set the left, center, and right footers. This approach suffices for documents that do not distinguish odd- and even-numbered pages.

Another method is to call macros that set headers or footers for odd- or even-numbered pages. Each such macro takes a delimited argument separating the left, center, and right header or footer texts from each other. You can replace the neutral apostrophes (') shown below with any character not appearing in the header or footer text. These macros are Berkeley extensions.

Macro: .OH 'left'center'right'
Macro: .EH 'left'center'right'
Macro: .OF 'left'center'right'
Macro: .EF 'left'center'right'

The OH and EH macros define headers for odd- (recto) and even-numbered (verso) pages, respectively; the OF and EF macros define footers for them.

With either method, a percent sign % in header or footer text is replaced by the current page number. By default, ms places no header on a page numbered “1” (regardless of its number format).

Macro: .P1

Typeset the header even on page 1. To be effective, this macro must be called before the header trap is sprung on any page numbered “1”; in practice, unless your page numbering is unusual, this means that you should call it early, before TL or any heading or paragraphing macro. This is a Berkeley extension.

For even greater flexibility, ms is designed to permit the redefinition of the macros that are called when the groff traps that ordinarily cause the headers and footers to be output are sprung. PT (“page trap”) is called by ms when the header is to be written, and BT (“bottom trap”) when the footer is to be. The groff page location trap that ms sets up to format the header also calls the (normally undefined) HD macro after PT; you can define HD if you need additional processing after setting the header (for example, to draw a line below it). The HD hook is a Berkeley extension. Any such macros you (re)define must implement any desired specialization for odd-, even-, or first numbered pages.


Next: , Previous: , Up: ms Page Layout   [Contents][Index]