Most printed manuals contain headings along the top of every page except the title and copyright pages. Some manuals also contain footings. (Headings and footings have no meaning to Info, which is not paginated.)
Texinfo provides standard page heading formats for manuals that are printed on one side of each sheet of paper and for manuals that are printed on both sides of the paper. Usually, you will use one or other of these formats, but you can specify your own format, if you wish.
In addition, you can specify whether chapters should begin on a new page, or merely continue the same page as the previous chapter; and if chapters begin on new pages, you can specify whether they must be odd-numbered pages.
By convention, a book is printed on both sides of each sheet of paper. When you open a book, the right-hand page is odd-numbered, and chapters begin on right-hand pages--a preceding left-hand page is left blank if necessary. Reports, however, are often printed on just one side of paper, and chapters begin on a fresh page immediately following the end of the preceding chapter. In short or informal reports, chapters often do not begin on a new page at all, but are separated from the preceding text by a small amount of whitespace.
The @setchapternewpage
command controls whether chapters begin
on new pages, and whether one of the standard heading formats is used.
In addition, Texinfo has several heading and footing commands that you
can use to generate your own heading and footing formats.
In Texinfo, headings and footings are single lines at the tops and bottoms of pages; you cannot create multiline headings or footings. Each header or footer line is divided into three parts: a left part, a middle part, and a right part. Any part, or a whole line, may be left blank. Text for the left part of a header or footer line is set flushleft; text for the middle part is centered; and, text for the right part is set flushright.
Texinfo provides two standard heading formats, one for manuals printed on one side of each sheet of paper, and the other for manuals printed on both sides of the paper.
By default, nothing is specified for the footing of a Texinfo file, so the footing remains blank.
The standard format for single-sided printing consists of a header line in which the left-hand part contains the name of the chapter, the central part is blank, and the right-hand part contains the page number.
A single-sided page looks like this:
_______________________ | | | chapter page number | | | | Start of text ... | | ... | | |
The standard format for two-sided printing depends on whether the page number is even or odd. By convention, even-numbered pages are on the left- and odd-numbered pages are on the right. (TeX will adjust the widths of the left- and right-hand margins. Usually, widths are correct, but during double-sided printing, it is wise to check that pages will bind properly--sometimes a printer will produce output in which the even-numbered pages have a larger right-hand margin than the odd-numbered pages.)
In the standard double-sided format, the left part of the left-hand
(even-numbered) page contains the page number, the central part is
blank, and the right part contains the title (specified by the
@settitle
command). The left part of the right-hand
(odd-numbered) page contains the name of the chapter, the central part
is blank, and the right part contains the page number.
Two pages, side by side as in an open book, look like this:
_______________________ _______________________ | | | | | page number title | | chapter page number | | | | | | Start of text ... | | More text ... | | ... | | ... | | | | |
The chapter name is preceded by the word `Chapter', the chapter number and a colon. This makes it easier to keep track of where you are in the manual.
TeX does not begin to generate page headings for a standard Texinfo
file until it reaches the @end titlepage
command. Thus, the
title and copyright pages are not numbered. The @end
titlepage
command causes TeX to begin to generate page headings
according to a standard format specified by the
@setchapternewpage
command that precedes the
@titlepage
section.
There are four possibilities:
@setchapternewpage
command
@setchapternewpage on
.
@setchapternewpage on
@setchapternewpage off
@headings double
command; see
section The @headings
Command.)
@setchapternewpage odd
Texinfo lacks an @setchapternewpage even
command.
You can use the standard headings provided with Texinfo or specify your own.
Texinfo provides six commands for specifying headings and
footings. The @everyheading
command and
@everyfooting
command generate page headers and footers
that are the same for both even- and odd-numbered pages.
The @evenheading
command and @evenfooting
command generate headers and footers for even-numbered
(left-hand) pages; and the @oddheading
command and
@oddfooting
command generate headers and footers for
odd-numbered (right-hand) pages.
Write custom heading specifications in the Texinfo file immediately
after the @end titlepage
command. Enclose your specifications
between @iftex
and @end iftex
commands since the
texinfo-format-buffer
command may not recognize them. Also,
you must cancel the predefined heading commands with the
@headings off
command before defining your own
specifications.
Here is how to tell TeX to place the chapter name at the left, the page number in the center, and the date at the right of every header for both even- and odd-numbered pages:
@iftex @headings off @everyheading @thischapter @| @thispage @| @today{} @end iftex
You need to divide the left part from the central part and the central part from the right had part by inserting `@|' between parts. Otherwise, the specification command will not be able to tell where the text for one part ends and the next part begins.
Each part can contain text or @-commands. The text is printed as if the part were within an ordinary paragraph in the body of the page. The @-commands replace themselves with the page number, date, chapter name, or whatever.
Here are the six heading and footing commands:
@everyheading left @| center @| right
@everyfooting left @| center @| right
@evenheading left @| center @| right
@oddheading left @| center @| right
@evenfooting left @| center @| right
@oddfooting left @| center @| right
Use the `@this...' series of @-commands to
provide the names of chapters
and sections and the page number. You can use the
`@this...' commands in the left, center, or right portions
of headers and footers, or anywhere else in a Texinfo file so long as
they are between @iftex
and @end iftex
commands.
Here are the `@this...' commands:
@thispage
@thischaptername
@thischapter
@thistitle
@settitle
command.
@thisfile
@include
files only: expands to the name of the current
@include
file. If the current Texinfo source file is not an
@include
file, this command has no effect. This command does
not provide the name of the current Texinfo source file unless
it is an @include
file. (See section Include Files, for more
information about @include
files.)
You can also use the @today{}
command, which expands to the
current date, in `1 Jan 1900' format.
Other @-commands and text are printed in a header or footer just as if they were in the body of a page. It is useful to incorporate text, particularly when you are writing drafts:
@iftex @headings off @everyheading @emph{Draft!} @| @thispage @| @thischapter @everyfooting @| @| Version: 0.27: @today{} @end iftex
Beware of overlong titles: they may overlap another part of the header or footer and blot it out.