Previous: Heading Choice, Up: Headings


E.4 How to Make Your Own Headings

You can use the standard headings provided with Texinfo or specify your own. By default, Texinfo has no footers, so if you specify them, the available page size for the main text will be slightly reduced.

Texinfo provides six commands for specifying headings and footings:

Write custom heading specifications in the Texinfo file immediately after the @end titlepage command. 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:

     @headings off
     @everyheading @thischapter @| @thispage @| @today{}

You need to divide the left part from the central part and the central part from the right 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
The `every' commands specify the format for both even- and odd-numbered pages. These commands are for documents that are printed on one side of each sheet of paper, or for documents in which you want symmetrical headers or footers.


@evenheading left @| center @| right
@oddheading left @| center @| right
@evenfooting left @| center @| right
@oddfooting left @| center @| right
The `even' and `odd' commands specify the format for even-numbered pages and odd-numbered pages. These commands are for books and manuals that are printed on both sides of each sheet of paper.

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
Expands to the current page number.


@thischaptername
Expands to the name of the current chapter.


@thischapter
Expands to the number and name of the current chapter, in the format `Chapter 1: Title'.


@thistitle
Expands to the name of the document, as specified by the @settitle command.


@thisfile
For @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 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:

     @headings off
     @everyheading @emph{Draft!} @| @thispage @| @thischapter
     @everyfooting @| @| Version: 0.27: @today{}

Beware of overlong titles: they may overlap another part of the header or footer and blot it out.