Back to Table of Contents | Next: Recto/verso printing, collating

# Page headers/footers, pagination

- Introduction – VERY IMPORTANT; read me!
- An important note on pagination
- General description of headers/footers
- Default specs for headers/footers
- Vertical placement and spacing of headers/footers

## Table of contents

### Managing page headers and footers

### Control macros for headers/footers

### User-defined, single string recto/verso headers/footers

### Headers and footers on the same page

### Pagination

### Inserting blank pages into a document

## Managing page headers and footers

Note: 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_.

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.

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.

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.

### General description of headers/footers

Headers comprise three distinct parts: a left part, a centre 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 centre part (“header centre“) is centred 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.

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, colour and capitalization 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. 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, centre, 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 Colour (black) (black) (black) 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 capitalization style of any header part.

### Vertical placement and spacing of headers/footers

As explained in the section, Typesetting macros during 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 margins 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 is the counterpart to HEADER_MARGIN, and establishes the baseline position of footers relative to the bottom edge of the page.

The distance between headers and the start of running text can be controlled with the macro, HEADER_GAP (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 begins the running text at whatever top margin you give.

FOOTER_GAP and B_MARGIN work similarly, except they determine where running text ends on the page. (See Important – footer margin and bottom margins for a warning about possible conflicts between the footer margin and the bottom margin.)

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 begins the running text 3 picas (the HEADER_GAP) beneath that, which means the effective top margin of the running text is 7-1/2 picas (visually approx. 1 inch). However, if you give mom a literal top margin (with T_MARGIN), she ignores the HEADER_GAP and starts the running text at whatever top margin you give.

Footers are treated similarly. 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). However, 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 give.

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 the 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.

Note: 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.

If you need both headers and footers, there’s a special macro, HEADERS_AND_FOOTERS, that allows you to set it up.

### Header/footer macros

- HEADERS – on or off
- FOOTERS – on or off
- FOOTER_ON_FIRST_PAGE
- User-defined, single string recto/verso headers/footers
  - HEADER_RECTO, HEADER_VERSO
    - User-defined, single string headers/footers (no recto/verso)
  - Using mom’s reserved strings in header/footer definitions (title, author, etc.)
- HEADERS_AND_FOOTERS – putting both headers and footers on document pages
- Header and footer control macros

### Headers

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.)

### Footers

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`.

### Footer 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 1 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 (and footers; see the note on how “headers” means “footers” in the Introduction to headers/footers) can be designed to your own specifications.

### Header/footer control macros and defaults

1. Header/footer strings
   - HEADER_LEFT
   - HEADER_CENTER
     - Padding the header-centre string
   - HEADER_RIGHT
   - Using mom’s reserved strings in header/footer definitions (e.g. `\E*[$TITLE]` when you want
     the title, `\E*[$AUTHOR]` when you want the author, etc.)
   - Replacing header-left, centre or right with the page number
   - Including the page number in header-left, centre or right
2. Header/footer style
   - Global changes
     - HEADER_FAMILY – family for entire header
     - HEADER_SIZE – size for entire header
     - HEADER_PLAIN – disable default adjustments to header parts
     - HEADER_COLOR – colourize the header
   - Part-by-part changes
     - _FAMILY – left, centre or right family
     - _FONT – left, centre or right font
     - _SIZE – left, centre or right size
     - _CAPS – left, centre or right all caps
     - _COLOR – left, centre or right colour
3. Header/footer vertical placement and spacing
   - HEADER_MARGIN
   - HEADER_GAP
4. Header/footer separator rule
   - HEADER_RULE
   - HEADER_RULE_WEIGHT
   - HEADER_RULE_GAP
   - HEADER_RULE_COLOR

#### 1. Header/footer strings

”Macro: HEADER_LEFT `“<text of header-left> | #`
”Macro: HEADER_CENTER `“<text of header-centre> | #`
”Macro: HEADER_RIGHT `“<text of header-right> | #`

To change the text (the “string”) of the left, centre, or right part of headers, invoke the appropriate 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.

### Padding the header/footer centre string

Macro: HEADER_CENTER_PAD `LEFT | RIGHT <amount of space by which to pad centre string left or right>`

• Requires a unit of measure

By default, mom centres the header-centre string on the line length in effect for page headers.

In some cases, notably when the header-left or header-right strings are particularly long, the effect isn’t pretty. The offendingly long header-left or right crowds, or even overprints, the header-centre. That’s where HEADER_CENTER_PAD comes in. With a bit of experimentation (yes, you have to preview the document), you can use HEADER_CENTER_PAD to move the header-centre string left or right until it looks acceptably centred between the two other strings.

For example, say your document is an outline for a novel called By the Shores of Lake Attica. You’ve told mom you want
.DOCTYPE NAMED "Outline" but when you preview your work, you see that “Outline”, in the centre of the page header, is uncomfortably close to the title, which is to the right. By invoking
.HEADER_CENTER_PAD RIGHT 3P you can scoot the word "Outline" over three picas to the left (because the padding is added onto the right of the string) so that your head looks nicely spaced out. Invoking `.HEADER_CENTER_PAD` with the `LEFT` argument puts the padding on the left side of the string so that it scoots right.

Most reassuring of all is that if you use HEADER_CENTER_PAD conjunction with RECTO_VERSO, mom will pad the centre string appropriately left OR right, depending on which page you’re on, without you having to tell her to do so.

### Using mom’s reserved strings in header/footer definitions

As pointed out in the Author’s note in the introduction to headers/footers, headers and footers are something you don’t normally have to worry much about. Mom usually knows what to do.

However, situations do arise where you need to manipulate what goes in the header/footer strings, setting and resetting them as you go along.

A case where you might want to do this would be if you want to output endnotes at the end of each document in a series of collated documents, and you want the word "Endnotes" to go in the header centre position of the endnotes, but want, say, the TITLE to go back into the centre position for the next output document.

In scenarios like the above, mom has a number of reserved strings you can plug into the HEADER_LEFT, _CENTER and _RIGHT macros. They are:
\E*[$TITLE] —the current argument passed to .TITLE \E*[$DOCTITLE] —the current argument passed to .DOCTITLE \E*[$AUTHOR] —the current first argument passed to .AUTHOR \E*[$AUTHOR_1...9] —the current arguments passed to .AUTHOR \E*[$AUTHORS] —a comma-separated concatenated string of all the current arguments passed to .AUTHOR (i.e. a list of authors) \E*[$CHAPTER_STRING] —the current argument passed to .CHAPTER_STRING, if invoked, otherwise, "Chapter" \E*[$CHAPTER] —the current argument (typically a number) passed to .CHAPTER \E*[$CHAPTER_TITLE] —the current argument passed to .CHAPTER_TITLE Returning to the scenario above, first, you’d define a centre string for the endnotes page:
.HEADER_CENTER "Endnotes" Then, you’d output the endnotes:
.ENDNOTES Then, you’d prepare mom for the next document:
.COLLATE .TITLE "New Doc Title" .AUTHOR "Josephine Blough" Then, you’d redefine the header-centre string using the reserved string `\*[$TITLE]`, like this:
.HEADER_CENTER "\E*[$TITLE]" And last, you’d do:
.START Voilà! Any argument you pass to TITLE from here on in (say, for subsequent documents) is back in the header-centre position. Here’s the whole routine again:
.HEADER_CENTER "Endnotes" .ENDNOTES .COLLATE .TITLE "New Doc Title" .AUTHOR "Josephine Blough" .HEADER_CENTER "\E*[$TITLE]" .START

If need be, you can concatenate the strings, as in the following example.
.HEADER_CENTER "\E*[$CHAPTER_STRING] \E*[$CHAPTER]" which, assuming a `.CHAPTER_STRING` of `"Chapter"` and a `.CHAPTER` of `"2"`, would put “Chapter 2” in the header-centre position.

### Replacing header-left, -centre or -right with the page number

If you would like to have the current page number appear in the header-left, -centre, or -right position instead of a text string, invoke the appropriate macro, above, with the single argument `#` (the “number” or “pound” sign). Do not surround the pound size with double-quotes, as you would normally do if the argument to `.HEADER_CENTER` were a string. For example,
.HEADER_CENTER # (notice, no double-quotes) will print the current page number in the centre 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, (as opposed to replacing the string with the page number), 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" The header-right of page two will read “page 2 of 10”, the header-right of page three will read “page 3 of 10”, and so on.

#### 2. Header/footer style

##### Global changes

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

- HEADER_FAMILY
- HEADER_SIZE
- HEADER_PLAIN
- HEADER_COLOR

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.

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. See Arguments to the control macros for an explanation of how control macros ending in _SIZE work.

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.

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

Note: 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 always the same size, you can use HEADER_SIZE with PRINTSTYLE `TYPEWRITE` to reduce the header’s overall 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.

Macro: HEADER_COLOR `<colorname>`

If you want your headers in a colour different from the document default (usually black), invoke `.HEADER_COLOR` with the name of a colour pre-defined (or “initialized”) with NEWCOLOR or XCOLOR.

HEADER_COLOR will set all the parts of the header plus the header rule in the colour you give it as an argument. If you wish finer control over colour in headers, you can use HEADER_<POSITION>_COLOR to colourize each part of the header separately, as well as HEADER_RULE_COLOR to change the colour of the header rule.

Replace HEADER_, above, with FOOTER_ to colourize footers.

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, point size and colour as she uses in paragraphs.

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

#### 3. Part by part changes

When using the following control ”macros, replace “<POSITION> by LEFT, CENTER, or RIGHT as appropriate.

- HEADER_<POSITION>_FAMILY
- HEADER_<POSITION>_FONT
- HEADER_<POSITION>_SIZE
- HEADER_<POSITION>_CAPS
- HEADER_<POSITION>_COLOR

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.

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.

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.

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 macro with any argument (e.g. `OFF, QUIT, END, X`...).

Replace HEADER_, above, with FOOTER_ to change a footer part’s capitalization style.

Macro: HEADER_<POSITION>_COLOR `<colorname>`

HEADER_<POSITION>_COLOR allows you to set a colour for each of the three possible parts of a page header separately. For example, say you want the right part of the header (by default, the document title) in red, this is how you’d get it:
.HEADER_RIGHT_COLOR red The other parts of the header will be in the default header colour (usually black, but that can be changed with HEADER_COLOR).

Remember that you have to define (or “initialize”) a colour with NEWCOLOR or XCOLOR before you can use the colour.

If you create a user-defined header with HEADER_RECTO or HEADER_VERSO, and you want various elements within the header to be colourized, embed the colours in the string passed to HEADER_RECTO or HEADER_VERSO with the `\*[<colorname>]` inline escape.

Replace HEADER_, above, with FOOTER_ to set the colours for the various elements of footers.

#### 3. 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.

- HEADER_MARGIN
- HEADER_GAP

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.

### Header/footer margins and page numbering

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

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 centimetres, 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, subject to the restriction outlined here.

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.

#### 4. 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.

- HEADER_RULE – on or off
- HEADER_RULE_WEIGHT – weight of the rule
- HEADER_RULE_GAP – distance of rule from header
- HEADER_RULE_COLOR – color of rule header

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_WEIGHT `<weight in points>`

• Argument must NOT have a unit of measure appended

HEADER_RULE_WEIGHT controls the weight (“thickness”) of the header rule. Like RULE_WEIGHT, it takes a single argument: the weight of the header rule expressed in points but without the unit of measure, `p`, appended. The argument to HEADER_RULE_WEIGHT must be greater than 0 and less than 100; decimal fractions are allowed.

Say, for example, you want a really strong header separator rule.
.HEADER_RULE_WEIGHT 4 which sets the separator rule weight to 4 points, is how you’d do it.

Mom’s default header rule weight is 1/2 point.

Note: Replace HEADER_, above, with FOOTER_ to set the weight of the footer separator rule.

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 top edge of the rule underneath. (If FOOTER_RULE_GAP, the gap is the distance from the top of the highest ascender to the bottom edge of the rule.) 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.

Additional note: When using FOOTER_RECTO and FOOTER_VERSO, make sure that the default size for footers (FOOTER_SIZE) is set to the largest size of type that will be used in the footer or mom may not get the rule gap right. Inline changes to the size of type in FOOTER_RECTO and FOOTER_VERSO should always be negative (smaller) than the default.

Macro: HEADER_RULE_COLOR `<colorname>`

If you wish to change the colour of the header rule, invoke `.HEADER_RULE_COLOR` with the name of a colour pre-defined (or “initialized”) with NEWCOLOR or XCOLOR.

HEADER_RULE_COLOR overrides the colour set with HDRFTR_COLOR, so it’s possible to have the heads entirely in, say, blue (set with HEADER_COLOR), and the header rule in, say, red.

Note: Replace HEADER_, above, with FOOTER_ to change the colour of the footer rule.

## User-defined, single string recto/verso headers/footers

Sometimes, you’ll find you can’t get mom’s handling of 3-part headers or footers to do exactly what you want in the order you want. This is most likely happen when you want the information contained in the headers/footers split over two pages, as is often the case with recto/verso documents.

Say, for example, you want recto page headers to contain a document’s author, centred, and verso page headers to contain the document’s title, also centred, like this:
+------------------------+ +------------------------+ | Author | | Title | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +------------------------+ +------------------------+ With mom’s standard 3-part headers, this isn’t possible, even when RECTO_VERSO is enabled. RECTO_VERSO switches the left and right parts of headers on alternate pages, but the centre part remains unchanged.

Any time you need distinctly different headers on alternate pages, mom has macros that let you manually design and determine what goes into headers on recto pages, and what goes into headers on verso pages. The macros are HEADER_RECTO and HEADER_VERSO. Both allow you to state whether the header is flush left, centred, or flush right, and both take a single string argument with which, by combining text and inline escapes, you can make the headers come out just about any way you want. Use of the `\*[PAGE#]` escape is permitted in the string argument (see Including the page number in header-left, -centre or -right), and, as an added bonus, mom provides a special mechanism whereby it’s possible to pad the string as well. The padding mechanism lets you create headers that contain left, centre and right parts like mom's defaults but entirely of your own design.

- HEADER_RECTO
- HEADER_VERSO
  - User-defined single string headers/footers (no recto/verso)
  - Padding the header-recto/header-verso string

Macro: HEADER_RECTO `LEFT | CENTER | RIGHT [ CAPS ] "<header recto string>"`
Macro: HEADER_VERSO `LEFT | CENTER | RIGHT [ CAPS ] "<header verso string>"`

User-defined single string headers/footers (no recto/verso)
HEADER_RECTO may be used to create user-defined, single string headers (or footers, with FOOTER_RECTO), even when recto/verso is not enabled (with RECTO_VERSO). In such cases, the header/footer you create is the one used on every page, making HEADER_RECTO your “I need to design my own headers from scratch” solution.

HEADER_RECTO and HEADER_VERSO behave identically, hence all references to HEADER_RECTO in this section also refer to HEADER_VERSO. Furthermore, FOOTER_ can be used instead of HEADER_ to set up recto/verso footers.

The first argument to HEADER_RECTO is the direction in which you want the header quadded. `L, C` and `R` may be used in place of `LEFT, CENTER` and `RIGHT`.

The second argument (optional) tells mom to capitalize the text of the header. Please note: Do not use `\*[UC]...\*[LC]` inside the string passed to HEADER_RECTO.

The final argument is a string, surrounded by double-quotes, containing what you want in the header. HEADER_RECTO disables mom’s normal 3-part headers, therefore anything you want in the headers must be entered by hand in the string, including colours (via the inline escape `\*[<colorname>]`).

By default, HEADER_RECTO is set at the same size, and in the same family and font, as paragraph text. The control macros HEADER_FAMILY and HEADER_SIZE may be used to change the default family and size. Changes to the font(s) within the string must be accomplished with the inline escapes `\*[ROM], \*[IT], \*[BD], \*[BDI]` and `\*[PREV]` (see Changing fonts). Additional refinements to the style of the header-recto string, including horizontal spacing and/or positioning, can also be made with inline escapes.

To include the current page number in the string, use the `\*[PAGE#]` inline escape.

### Padding the header-recto/header-verso string

You can “pad” the header-recto string, a convenience you’ll appreciate in circumstances such as the following.
VERSO RECTO +------------------------+ +------------------------+ | Author Page# | | Page# Title | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +------------------------+ +------------------------+

There are two steps to padding the string argument passed to HEADER_RECTO (if you’re unsure what padding is, see Insert space into lines).

1. Begin and end the string (inside the double-quotes) with the caret character (`^`).
2. Enter the pound sign (`#`) at any point in the string where you want an equalized amount of whitespace inserted.

The situation depicted above is accomplished like this:
.HEADER_RECTO LEFT "^\*[PAGE#]#\E*[$TITLE]^" .HEADER_VERSO LEFT "^\E*[$AUTHOR]#\*[PAGE#]^" Notice that the quad argument, `LEFT`, is used in both cases. When padding a header, it doesn’t matter which quad argument you use, although you must be sure to supply one. Also note that mom does not interpret the `#` in `\*[PAGE#]` as a padding marker (i.e. as a place to insert whitespace).

Important: The PAD_MARKER macro, which changes the default pad marker (`#`) used by PAD, has no effect on the pad marker used in the HEADER_RECTO string. If you absolutely must have a literal pound sign in your HEADER_RECTO string, use the escape sequence for the pound sign ( `\[sh]` ) where you want the pound sign to go.

## Headers and footers on the same page

Normally, mom prints either a header or a footer, but not both, depending on whether HEADERS or FOOTERS is enabled. (Page numbering, whether in the top margin or the bottom, is not considered a header or a footer.) Should you need both headers and footers on the same page, the single macro, HEADERS_AND_FOOTERS, is the way to set it up.

Macro: HEADERS_AND_FOOTERS `(see Invocation)`

Invocation:
.HEADERS_AND_FOOTERS \ <L | C | R> "<header-recto string>" \ <L | C | R> "<footer-recto string>" \ <L | C | R> "<header-verso string>" \ <L | C | R> "<header-verso string>" or .HEADERS_AND_FOOTERS <anything>

Unlike the macros, HEADERS and FOOTERS, which are toggle macros, HEADERS_AND_FOOTERS requires that you supply the information you want in the headers and footers yourself. Mom does no automatic generation of things like the title and the author in headers and footers when you’re using HEADERS_AND_FOOTERS. Furthermore, style changes—family, font, pointsize, colour, capitalization, etc —are entirely your responsibility and must be made with inline escapes in the arguments passed to `“<recto ”header string>“`, `<recto footer string>“`, etc. By default, mom sets the headers and footers created with HEADERS_AND_FOOTERS in the same family, font, point size, capitalization style and colour as running text.

The manner of entering what you want is identical to the way you input single string headers and footers. I suggest reading up on them, as well as looking at the entries, `HEADER_RECTO` and Using mom’s reserved strings in header/footer definitions.

The same padding mechanism used in HEADER_RECTO and HEADER_VERSO is available in the string arguments passed to HEADERS_AND_FOOTERS, allowing you to simulate two- and three-part headers and footers.

`L | C | R` in the arguments to HEADERS_AND_FOOTERS refers to whether you want the specific header or footer set flush left, centered, or flush right. (You can also use the longer forms, `LEFT`, `CENTER` and `RIGHT`.) The string you give afterwards is whatever text you want, including mom’s reserved strings, and whatever inline escapes you need to change things like family and font, pointsize, colour, etc. as you go along.

Note the backslashes in the invocation, above. Every set of arguments given this way to HEADERS_AND_FOOTERS except the last requires a backslash after it. The use of backslashes isn’t required if you want to put the entire argument list on the same (very long!) line as the macro itself; I recommend sticking to the style shown above to keep things manageable.

If you want to disable having both headers and footers on the same page, invoke `.HEADERS_AND_FOOTERS` with any argument you want (e.g. `OFF, QUIT, END, X...`). Mom will restore her default behaviour of setting automatically generated page headers, with the page number, centered, at the bottom of the page. If you would prefer footers instead of headers after turning HEADERS_AND_FOOTERS off, invoke `.FOOTERS` afterwards.

#### Examples of HEADERS_AND_FOOTERS usage

Example 1: Header and footer the same on every page
.HEADERS_AND_FOOTERS \ +-----------------------+ C "\E*[$TITLE]" \ | Title | L "^\E*[$AUTHOR]#\*[PAGE#]^" | | | | | | | | | | | | | | | | | | | | | | | | | Author Pg. # | +-----------------------+

`\E*[$TITLE]` and `\E*[$AUTHOR]` will print the strings you pass to TITLE and AUTHOR; `\*[PAGE#]` is how you include the page number in a header or footer string. (For a list of special strings you can use in headers and footers, see here.)

You don’t have to use these special strings. You can type in anything you like. I’ve only used them here to show that they’re available.

Example 2: Different headers and footers on recto/verso pages
.HEADERS_AND_FOOTERS \ C "BOOK TITLE" \ L "^\*[PAGE#]#\E*[$AUTHOR]^" \ C "Story Title" \ L "^\E*[$AUTHOR]#\*[PAGE#]^" +-----------------------+ +------------------------+ | BOOK TITLE | | Story Title | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pg. # Author | | Author Pg.# | +-----------------------+ +------------------------+

## Pagination

By default, mom paginates documents. Page numbers appear in the bottom margin of the page, centred 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

- PAGINATE – pagination on or off
- PAGENUMBER – user-defined (starting) page number
- PAGENUM_STYLE – digits, roman numerals, etc
- PAGENUM_ON_FIRST_PAGE – applies only when footers are enabled
- DRAFT_WITH_PAGENUMBER – attach draft/revision information to page numbers
- Pagination control macros and defaults

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`, etc).

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.

Macro: DRAFT_WITH_PAGENUMBER

Sometimes, in COPYSTYLE `DRAFT`, the CENTER part of page headers gets overcrowded because of the draft and revision information that go there by default. DRAFT_WITH_PAGENUMBER is one way to fix the problem.

Invoked without an argument, `.DRAFT_WITH_PAGENUMBER` removes draft/revision information from the page headers and attaches it instead to the document’s page numbering, in the form
Draft #, Rev. # / <pagenumber> If you have not supplied mom with a draft number (with DRAFT) DRAFT_WITH_PAGENUMBER will assume “Draft 1“, and will print it before the page number.

See the note in COPYSTYLE `DRAFT` for other ways of dealing with crowded page headers when formatting draft-style copy.

### Pagination control macros and defaults

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

#### 1. Page number family/font/size/colour

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) .PAGENUM_COLOR default = black

#### 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 OFF`) and you want mom to number your pages at the top right position, enter
.PAGENUM_POS TOP RIGHT

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

Macro: PAGENUM_HYPHENS `toggle`

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`, etc), like this:
.PAGENUM_HYPHENS OFF If, for some reason, you want to turn page number hyphens back on, invoke the macro without an argument.

## Inserting blank pages into a document

Macro: BLANKPAGE `<# of blank pages to insert> [DIVIDER [NULL]]`

This one does exactly what you’d expect—inserts a blank page (or pages) into a document. Unless you give the optional argument, `NULL`, mom silently increments the page number of every blank page and keeps track of recto/verso stuff, but otherwise does nothing. This is useful for forcing new sections of a document onto recto pages, but may have other applications as well.

The required argument to BLANK_PAGE is the number of blank pages to insert. The argument is not optional, hence even if you only want one blank page, you have to tell mom:
.BLANKPAGE 1 The optional argument, `DIVIDER`, must be given if you’re inserting a blank page before the start of any new document section (i.e. a new chapter, or endnotes, a bibliography, or table of contents). Without the `DIVIDER` argument, mom simply inserts the blank pages and prepares the next page to receive running text.

`NULL`, which is also optional, allows you to output the specified number of pages without mom incrementing the page number for each blank page. She will, however, continue to keep track of which pages are recto/verso if recto/verso printing has been enabled.

Back to Table of Contents | Top | Next: Recto/verso printing, collating