Titles, Pages and Numbering
This is an area where things get tougher,
because nothing is done for you automatically.
Of necessity, some of this section is a cookbook,
to be copied literally until you get some experience.
Suppose you want a title at the top of each page,
.tl '~~~~left top'center top'right top~~~~'
^he 'left top'center top'right top'
^fo 'left bottom'center bottom'right bottom'
to get headers and footers automatically on every page.
Alas, this doesn't work in
a serious hardship for the novice.
Instead you have to do a lot of specification.
You have to say what the actual title is (easy);
when to print it (easy enough);
and what to do at and around the title line (harder).
Taking these in reverse order,
(for `new page') to process
titles and the like at the end of one page
and the beginning of the next:
\&.tl 'left top'center top'right top'
To make sure we're at the top of a page,
we issue a `begin page' command
which causes a skip to top-of-page
Then we space down half an inch,
should be self explanatory; later we will discuss parameterizing the titles),
space another 0.3 inches,
at the bottom of each page,
we have to say something like
`when the text is within an inch
of the bottom of the page,
This is done with a `when' command
(No `.' is used before NP;
this is simply the name of a macro, not a macro call.)
`measure up from the bottom of the page',
`\-1i' means `one inch from the bottom'.
command appears in the input outside the definition of
typically the input would be
As text is actually being output,
keeps track of its vertical position on the page,
and after a line is printed within one inch from the bottom,
which is `sprung' when that point is passed.)
causes a skip to the top of the next page
then prints the title with the appropriate margins.
like several other commands,
That is, all the input text collected but not yet printed
is flushed out as soon as possible,
and the next input line is guaranteed to start
this would cause a break in the middle
of the current output line when a new page is started.
The effect would be to print the left-over part of that line
at the top of the page, followed by the next input line on a new output line.
no break is to take place _
be forced out before the space or new page.
The list of commands that cause a break
^bp ^br ^ce ^fi ^nf ^sp ^in ^ti
regardless of whether you use a
If you really need a break, add a
command at the appropriate place.
One other thing to beware of _
if you're changing fonts or point sizes a lot,
if you cross a page boundary
in an unexpected font or size,
your titles come out in that size and font
instead of what you intended.
Furthermore, the length of a title is independent of the current line length,
so titles will come out at the default length of 6.5 inches
There are several ways to fix the problems of point sizes
For the simplest applications, we can change
to set the proper size and font for the title,
then restore the previous values, like this:
^ft R \e" set title font to roman
^ps 10 \e" and size to 10 point
^lt 6i \e" and length to 6 inches
^ps \e" revert to previous size
^ft P \e" and to previous font
work if the fields in the
command contain size or font changes.
which we will discuss in Section 13.
To get a footer at the bottom of a page,
or split the job into a footer macro invoked
at the bottom margin and a header macro invoked
These variations are left as exercises.
Output page numbers are computed automatically
as each page is produced (starting at 1),
but no numbers are printed unless you ask for them explicitly.
To get page numbers printed,
the position where you want the number to appear.
centers the page number inside hyphens, as on this page.
You can set the page number at any time
which immediately starts a new page numbered
which sets the page number for the next page
but doesn't cause a skip to the new page.
more than its current value;