Next   Prev   Back to Table of Contents

DOCUMENT HEADERS, FOOTERS, AND PAGINATION

Introduction

Headers and footers, as defined in the section Mom's Document Processing Terms, are those parts of a document that contain information about the document itself which appear in the margins either above or below running text. They are, in all respects but two, identical. The differences are:

  1. headers appear in the margin above running text while footers appear in the margin beneath running text;
  2. the (optional) rule that separates headers from running text appears below the header while the (optional) rule that separates footers from running text appears above the footer.

Because headers and footers are virtually identical, this documentation addresses itself only to headers. In all cases, unless otherwise noted, descriptions of headers describe footers as well.

Furthermore, any control macro that begins with HEADER_ may be used to control footers, simply by replacing HEADER_ with FOOTER_.

Author's note: Left to their own devices (i.e. if you're happy with the way mom does things by default), headers are something you never have to worry about. You can skip reading this section entirely. But if you want to change them, be advised that headers have more macros to control their appearance than any other document element. The text of this documentation becomes correspondingly dense at this point.

NOTE: While the single page number that mom generates in either the top or bottom margin above or below running text is technically a kind of header/footer, mom and this documentation treat it as a separate page element.

General description of headers/footers

Headers comprise three distinct parts: a left part, a center part, and a right part. Each part contains text (a "string") that identifies some aspect of the document as a whole.

The left part ("header left") lines up with the document's left margin. The center part ("header center") is centered on the document's line length. The right part ("header right") lines up with the document's right margin. Not all parts need contain a string, and if you don't want headers at all, you can turn them off completely.

A note to groff experts: Although mom's headers resemble the three-part titles generated by .tl, they're in no way related to it, nor based upon it. .tl is not used at all in mom.

Normally, mom fills headers with strings appropriate to the document type selected with DOCTYPE. You can, however, supply whatever strings you like -- including page numbers -- to go in any part of headers. What's more, you can set the family, font, size and capitalisation style (caps or caps/lower-case) for each header part individually.

By default, mom prints a horizontal rule beneath headers to separate them visually from running text. In the case of footers, the rule is above running text. You can increase or decrease the space between the header and the rule if you like (with HEADER_RULE_GAP), or remove it completely.

Default specs for headers/footers

Mom makes small type adjustments to each part of the header (left, center, right) to achieve an aesthetically pleasing result. The defaults are listed below. (The strings mom puts by default in each part are explained in DOCTYPE.)

NOTE: Except for capitalization (all caps or caps/lower-case), these defaults apply only to PRINTSTYLE TYPESET.

TYPE SPEC    HEADER LEFT         HEADER CENTER       HEADER RIGHT
---------    -----------         -------------       ------------
Family       document default    document default    document default
Font         roman               italic              roman
All caps     no                  no                  yes
Size*        -.5 (points)        -.5 (points)        -2 (points)
            (-2 if all caps)    (-2 if all caps)    (-.5 if not all caps)

*Relative to the point size of type in paragraphs
You can, of course, change any of the defaults using the appropriate control macros. And should you wish to design headers from the ground up, mom has a special macro, HEADER_PLAIN, that removes all type adjustments to headers. The straightforward type specs for paragraphs are used instead, providing a simple reference point for any alterations you want to make to the family, font, size and capitalisation style of any header part.

Vertical placement and spacing of headers/footers

As explained in the section on typesetting macros in document processing, the top and bottom margins of a mom document are the vertical start and end positions of running text, not the vertical positions of headers or footers, which, by definition, appear in the margin above (or below) running text.

The vertical placement of headers is controlled by the macro HEADER_MARGIN, which establishes the baseline position of headers relative to the top edge of the page. The header rule, whose position is relative to the header itself, is controlled by a separate macro. FOOTER_MARGIN establishes the baseline position of footers relative to the bottom edge of the page.

HEADER_GAP establishes the distance between headers and the start of running text (effectively making HEADER_MARGIN + HEADER_GAP the top margin of running text unless you give mom a literal top margin (with T_MARGIN), in which case she ignores HEADER_GAP and starts running text at whatever top margin you gave. FOOTER_GAP and B_MARGIN work similarly, except they determine where running text ends on the page.

Confused? Mom apologizes. It's really quite simple. By default, mom sets headers 4-1/2 picas down from the top of the page and starts running text 3 picas (the HEADER_GAP) beneath that, which means the effective top margin of running text is 7-1/2 picas (visually approx. 1 inch). If you give mom a literal top margin (with T_MARGIN), she ignores the HEADER_GAP and starts running text at whatever top margin you gave.

Footers are treated the same way, the only difference being the default distances. Mom sets footers 3 picas up from the bottom of the page, and interrupts the processing of running text 3 picas (the FOOTER_GAP) above that (again, visually approx. 1 inch). If you give mom a literal bottom margin (with B_MARGIN), she ignores the FOOTER_GAP and interrupts the processing of running text at whatever bottom margin you gave.

If mom is paginating your document (she does, by default, at the bottom of each page), the vertical spacing and placement of page numbers, whether at the top or the bottom of the page, is managed exactly as if the page numbers were headers (or footers), and are controlled by the same macros. See Pagination control.


Managing headers/footers

The following are the basic macros for turning headers or footers on or off. They should be invoked prior to START.

By default, mom prints page headers. If you turn them off, she will begin running text on each page with a default top margin of 6 picas unless you have requested a different top margin (with T_MARGIN) prior to START.

Please note that headers and footers are mutually exclusive. If headers are on, footers (but NOT bottom-of-page numbering) are automatically turned off. Equally, if footers are on, headers (but NOT top-of-page numbering) are automatically turned off. Thus, if you'd prefer footers in a document, you need only invoke FOOTERS; there's no need to turn headers off first.


Macro: HEADERS toggle

Page headers are on by default. If you don't want them, turn them off by invoking HEADERS with any argument (OFF, QUIT, END, X...), e.g.

	.HEADERS OFF

NOTE: HEADERS automatically disables footers (you can't have both), but not the page numbers that normally appear at the bottom of the page.

ADDITIONAL NOTE: If HEADERS are OFF, mom's normal top margin for running text (7.5 picas) changes to 6 picas (visually approx. 1 inch). This does NOT apply to the situation where footers have been explicitly turned on (with FOOTERS). Explicitly invoking footers moves page numbering to the top of the page, where its placement and spacing are the same as for headers. (I.e. the top margin of running text remains 7.5 picas.)


Macro: FOOTERS toggle

Page footers are off by default. If you want them instead of headers (you can't have both), turn them on by invoking FOOTERS without an argument, e.g.

	.FOOTERS

FOOTERS automatically disables headers, and mom shifts the placement of page numbers from their normal position at page bottom to the top of the page.

NOTE: By default, when footers are on, mom does not print a page number on the first page of a document, nor on first pages after COLLATE. If you don't want this behaviour, you can change it with PAGENUM_ON_FIRST_PAGE.


Macro: FOOTER_ON_FIRST_PAGE toggle

If you invoke FOOTERS, mom, by default, does not print a footer on the first page of the document. (The docheader on page makes it redundant.) However, should you wish a footer on page 1, invoke FOOTER_ON_FIRST_PAGE without any argument.


Control macros for headers/footers

Virtually every part of headers (see the paragraph on how "headers" means "footers" in the introduction to headers/footers) can be designed to your own specifications.

Header/footer control macros


Header/footer strings

Macro: HEADER_LEFT "<text of header left>" | #
Macro: HEADER_CENTER "<text of header center>" | #
Macro: HEADER_RIGHT "<text of header right>" | #

To change the text (the "string") of the left, center, or right part of headers, invoke the appopriate macro above with the string you want. For example, mom, by default, prints the document's author in the header-left position. If your document has, say, two authors, and you want both their names to appear header-left, change HEADER_LEFT like this:

	.HEADER_LEFT "R. Stallman, E. Raymond"
Because the arguments to HEADER_LEFT, _CENTER, and _RIGHT are string arguments, they must be enclosed in double-quotes.

NOTE: Replace HEADER_, above, with FOOTER_ to change the strings in footers.

Replacing header-left, -center or -right with the page number

If you would like the current page number to appear header-left, -center, or -right instead of a text string, invoke the appropriate macro, above, with the single argument # (the "number" or "pound" sign). Do NOT use double-quotes. For example,

	.HEADER_CENTER #
will print the current page number in the center part of headers.

Including the page number in header-left, -center or -right

If you would like to include the current page number in the string you pass to HEADER_LEFT, _CENTER, or _RIGHT, use the special inline escape \*[PAGE#] in the string argument.

For example, say you have a document that's ten pages long, and you want header-right to say "page <whichever> of 10", invoke HEADER_RIGHT as follows:

	.HEADER_RIGHT "page \*[PAGE#] of 10"
Header-right of page two will read "page 2 of 10", header-right of page three will read "page 3 of 10", and so on.

Header/footer style

Global changes

The following macros allow you to make changes that affect all parts of the header at once.


Macro: HEADER_FAMILY <family>

By default, mom uses the default document family for headers. If you would like her to use another family in headers, invoke HEADER_FAMILY with the identifier for the family you want. The argument is the same as for the typesetting macro FAMILY.

NOTE: Replace HEADER_, above, with FOOTER_ to change the footer family.


Macro: HEADER_SIZE <+|-number of points>
*Argument is relative to the point size of type in paragraphs

By default, mom makes small adjustments to the size of each part of a header to achieve an aesthetically pleasing result. If you'd like her to continue to do so, but would like the overall appearance of headers to be a little smaller or a little larger, invoke HEADER_SIZE with + or - the number of points (fractions allowed) by which you want her to in/decrease the size of headers. For example,

	.HEADER_SIZE +.75
increases the size of every part of a header by 3/4 of a point while respecting mom's own little size changes.

See Arguments to the control macros for an explanation of how control macros ending in _SIZE work.

Normally, macros that control headers have no effect on PRINTSTYLE TYPEWRITE. HEADER_SIZE is an exception. While all parts of a header in PRINTSTYLE TYPEWRITE are the same size, you can use HEADER_SIZE to reduce the header's point size. You'll most likely require this when the COPYSTYLE is DRAFT, since portions of the header may overprint if, say, the title of your document is very long.

NOTE: Replace HEADER_, above, with FOOTER_ to change the footer size.


Macro: HEADER_PLAIN

By default, mom makes adjustments to the font, size, and capitalization style of each part of headers to achieve an aesthetically pleasing look. Should you wish to design your own headers from the ground up without worrying how changes to the various elements of header style interact with mom's defaults, invoke HEADER_PLAIN by itself, with no argument. Mom will disable her default behaviour for headers, and reset all elements of header style to the same family, font, and point size as she uses in text paragraphs.

NOTE: Replace HEADER_, above, with FOOTER_ to disable mom's default behaviour for the various elements of footer style.


Part by part changes

NOTE: When using the following control macros, replace "<POSITION>" by LEFT, CENTER, or RIGHT as appropriate.


Macro: HEADER_<POSITION>_FAMILY <family>

Use HEADER_<POSITION>_FAMILY to change the family of any part of headers. See Arguments to the control macros for an explanation of how control macros ending in _FAMILY work.

NOTE: Replace HEADER_, above, with FOOTER_ to change a footer part's family.


Macro: HEADER_<POSITION>_FONT <font>

Use HEADER_<POSITION>_FONT to change the font of any part of headers. See Arguments to the control macros for an explanation of how control macros ending in _FONT work.

NOTE: Replace HEADER_, above, with FOOTER_ to change a footer part's font.


Macro: HEADER_<POSITION>_SIZE <+|-number of points>

Use HEADER_<POSITION>_SIZE to change the size of any part of headers (relative to the point size of type in paragraphs). See Arguments to the control macros for an explanation of how control macros ending in _SIZE work.

NOTE: Replace HEADER_, above, with FOOTER_ to change a footer part's size.


Macro: HEADER_<POSITION>_CAPS toggle

HEADER_<POSITION>_CAPS is a toggle macro. If you want any part of headers to be set in all caps, regardless of the capitalization of that part's string as given to the reference macros or as defined by you with the header string control macros, simply invoke this macro (using the appropriate position) with no argument. If you wish to turn capitalization off (say, for the header-right string that mom capitalizes by default), invoke the argument with any argument (e.g. OFF, QUIT, END, X...).

NOTE: Replace HEADER_, above, with FOOTER_ to change a footer part's capitalization style.


Header/footer vertical placement and spacing

See Vertical placement and spacing of headers/footers for an explanation of how mom deals with headers, footers, and top/bottom page margins.


Macro: HEADER_MARGIN <distance to baseline of header>
*Requires a unit of measure

Use HEADER_MARGIN to set the distance from the top edge of the page to the baseline of type in headers. A unit of measure is required, and decimal fractions are allowed.

Mom's default header margin is 4-1/2 picas, but if you want a different margin, say, 1/2-inch, do

	.HEADER_MARGIN .5i
If your document uses footers, replace HEADER_, above, with FOOTER_. The argument to FOOTER_MARGIN is the distance from the bottom edge of the page to the baseline of type in footers.

Mom's default footer margin is 3 picas.

NOTE: Mom uses HEADER_MARGIN and FOOTER_MARGIN to establish the baseline position of page numbers in addition to headers and footers.

By default, page numbers appear at the bottom of the page, therefore if you want the default position (bottom), but want to change the baseline placement, use FOOTER_MARGIN. Conversely, if page numbers are at the top of the page, either because you turned FOOTERS on or because you instructed mom to put them there with PAGENUM_POS, you'd use HEADER_MARGIN to change their baseline placement.


Macro: HEADER_GAP <distance from header to start of running text>
*Requires a unit of measure

Use HEADER_GAP to set the distance from the baseline of type in headers to the start of running text. A unit of measure is required, and decimal fractions are allowed.

As explained in Vertical placement and spacing of headers/footers, HEADER_MARGIN + HEADER_GAP determine the default vertical starting position of running text on the page UNLESS you have given mom your own top margin (with T_MARGIN). If you give a top margin, mom ignores HEADER_GAP; running text starts at your stated top margin.

Mom's default header gap is 3 picas, but if you want a different gap, say, 2 centimeters, do

	.HEADER_GAP 2c
If your document uses footers, replace HEADER_, above, with FOOTER_. The argument to FOOTER_GAP is the distance from the baseline of type in footers to the last baseline of running text on the page.

As explained in Vertical placement and spacing of headers/footers, FOOTER_MARGIN + FOOTER_GAP determine the default vertical end position of running text on the page UNLESS you have given mom a bottom margin (with B_MARGIN). If you give a bottom margin, mom ignores FOOTER_GAP; running text ends at your stated bottom margin.

Mom's default footer gap is 3 picas.

NOTE: Mom uses HEADER_GAP and FOOTER_GAP to establish the start and end baseline positions of running text with respect to both headers and footers AND page numbers. If you wish to change the gap between the last line of running text and a bottom page number, use FOOTER_GAP. If page numbers are at the top of the page, change the gap between the number and the first line of running text with HEADER_GAP.


Header/footer separator rule

The header/footer separator rule is a modest horizontal rule, set slightly below the header (or above the footer), that runs the length of the header and helps separate it visually from running text. If you don't want the rule, you can turn it off. If you want it, but at a different vertical position relative to the header (or footer), you can alter its placement.


Macro: HEADER_RULE toggle

By default, mom prints a header separator rule underneath headers (or above footers). If you don't want the rule, turn it off by invoking HEADER_RULE with any argument (OFF, QUIT, END, X...), e.g.

	.HEADER_RULE OFF
To turn the rule (back) on, invoke HEADER_RULE without any argument.

NOTE: Replace HEADER_, above, with FOOTER_ to enable/disable the printing of the footer separator rule. (Most likely, if you're using FOOTERS, you'll want it off.)


Macro: HEADER_RULE_GAP distance of rule beneath header
*Requires a unit of measure

HEADER_RULE_GAP is the distance from the baseline of type in headers to the rule underneath. A unit of measure is required, and decimal fractions are allowed. Please note that HEADER_RULE_GAP has no effect on HEADER_GAP (i.e. HEADER_RULE_GAP is NOT added to HEADER_GAP when mom calculates the space between headers and the start of running text.

By default, the header rule gap is 4 points. If you'd like to change it to, say, 1/4 em, do

	.HEADER_RULE_GAP .25m
NOTE: Replace HEADER_, above, with FOOTER_ if you're using footers and want to change the separator rule gap. In footers, the gap is measured from the top of the tallest ascender in the footer.

Pagination

By default, mom paginates documents. Page numbers appear in the bottom margin of the page, centered between two hyphens. As with all elements of mom's document processing, most aspects of pagination style can be altered to suit your taste with control macros.

Pagination macros list



Macro: PAGINATE toggle
Alias: PAGINATION

By default, mom paginates documents (in the bottom margin). If you'd prefer she not paginate, turn pagination off by invoking PAGINATE with any argument (OFF, NO, QUIT, END, X...), e.g.

	.PAGINATE NO 
To (re)start pagination, invoke PAGINATE without any argument.

Macro: PAGENUMBER <number>

As is to be expected, pagination of documents begins at page 1. If you'd prefer that mom begin with a different number on the first page of a document, invoke PAGENUMBER with the number you want.

PAGENUMBER need not be used only to give mom a "first page" number. It can be used at any time to tell mom what number you want a page to have. Subsequent page numbers will, of course, be incremented by 1 from that number.


Macro: PAGENUM_STYLE DIGIT | ROMAN | roman | ALPHA | alpha

PAGENUM_STYLE lets you tell mom what kind of page numbering you want.

DIGIT=arabic digits (1, 2, 3...)
ROMAN=upper case roman numerals (I, II, III...)
roman=lower case roman numerals (i, ii, iii...)
ALPHA=upper case letters (A, B, C...)
alpha=lower case letters (a, b, c...)


Macro: PAGENUM_ON_FIRST_PAGE toggle

This macro applies only if you've enabled FOOTERS. If FOOTERS are on, mom automatically places page numbers at the tops of pages except on the first page of a document (or on first pages after COLLATE). If you'd like the page number to appear on "first" pages when footers are on, invoke PAGENUM_ON_FIRST_PAGE with no argument. Any other argument turns the feature off (OFF, QUIT, END, X...).

As with most of the control macros, PAGENUM_ON_FIRST_PAGE can be invoked at any time, meaning that if you don't want a page number on the very first page of a document, but do want one on pages that appear after COLLATE, omit it before the first START of the document, then invoke it either just before or after your first COLLATE.


Pagination control macros

  1. Family/font/size
  2. Page number position (vertical and horizontal)
  3. Enclose page numbers with hyphens (on or off)

1. Page number family/font/size

See Arguments to the control macros.

.PAGENUM_FAMILY default = prevailing document family; default is Times Roman
.PAGENUM_FONT   default = roman
.PAGENUM_SIZE   default = 0 (i.e. same size as paragraph text)

2. Page number position

Macro: PAGENUM_POS TOP | BOTTOM  LEFT | CENTER | RIGHT

Use PAGENUM_POS to change the default position of automatic page numbering. PAGENUM_POS requires two arguments: a vertical position (TOP or BOTTOM) and a horizontal position (LEFT or CENTER or RIGHT).

For example, if you turn both headers and footers off (with .HEADERS OFF and .FOOTERS OFFmom to number your pages at the top right position, enter

	.PAGENUM_POS TOP RIGHT

3. Enclose page numbers with hyphens (on or off)

By default, mom encloses page numbers between hyphens. If you don't want this behaviour, invoke the macro PAGENUM_HYPHENS with any argument (OFF, QUIT, END, X...), like this:

	.PAGENUM_HYPHENS OFF
If, for some reason, you want to turn page number hyphens back on, invoke the macro without an argument.


Next   Prev   Top   Back to Table of Contents