Headers and footers

There are four contexts for headers/footers. The "header" context defines what will be printed at the top of the first page. The "footer" context defines what what will be on the bottom of the first page. The "header2" and "footer2" contexts define what goes on the top and bottom of subsequent pages. All are optional. These contexts can only contain printing commands or settings of the font, fontfamily, and size parameters.

Headers and footers are conceptually in a separate coordinate space, which will be overlaid on each page coordinate space. When in a header or footer context, the _win special tag applies to the header or footer window rather than the space between the header and footer as it does in the music context.

When printed, headers are bounded by the top, left, and right margins, and extend as far downward as necessary to include the items defined in the header context. At the beginning of a header context, the current location is at the upper left of the header, which will be printed at the page coordinate (leftmargin, pageheight - topmargin).

Likewise, the footer contexts are bounded by the left, right, and bottom margins, and extend upward as far as necessary to include the items defined in the context. At the beginning of a footer context, the current location is at top of the footer, which will be printed at page coordinate (leftmargin, botmargin + height_of_footer).

A typical header might look something like this:

header
	title (18) "This is the Title of the Song"
	title (12) "This is a subtitle"
	title (9)  ""  "I. M. Author (1991)"

You can also use the "print," "left," "right," or "center" commands. In most cases you will want to use "nl" for the location on those commands to place things. If you don't specify a location for the first of these commands in a header or footer, Mup will start at the left margin, just far enough down from the top to accommodate the text string to be printed.

Since headers or footers will expand as necessary, the value of _win.s and _win.y may be changed by any of the statements in the context. At any given time, they refer to the boundaries as defined by what has been printed so far. Thus, in the example above, after the first "title" statement, _win.s would be 18 points below _win.n. After the second title statement, it would be 31 points below _win.n (12 points for the title string, plus 1 point of padding that is added between lines printed).

A \% inside a string in a header or footer context will be replaced by the current page number.* Thus, to number subsequent pages at the top of each page, something like the following would suffice:

header2
	title "- \% -"


* Actually, the \% will be converted to the current page number in any context, but this feature is unlikely to be useful anywhere except inside a header or footer.

Mup User's Guide Table of Contents