Previous: , Up: Page Headings   [Contents][Index]


E.2.3 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.

@thissectionname

Expands to the name of the current section.

@thissectionnum

Expands to the number of the current section.

@thissection

Expands to the number and name of the current section, in the format ‘Section 1: Title’.

@thischaptername

Expands to the name of the current chapter.

@thischapternum

Expands to the number of the current chapter, or letter of the current appendix.

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

If you have very short chapters and/or sections, several of them can appear on a single page. You can specify which chapters and sections you want @thischapter, @thissection and other such macros to refer to on such pages as follows:

@everyheadingmarks ref
@everyfootingmarks ref

The ref argument can be either top (the @this... commands will refer to the chapter/section at the top of a page) or bottom (the commands will reflect the situation at the bottom of a page). These ‘@every...’ commands specify what to do on both even- and odd-numbered pages.

@evenheadingmarks ref
@oddheadingmarks ref
@evenfootingmarks ref
@oddfootingmarks ref

These ‘@even...’ and ‘@odd...’ commands specify what to do on only even- or odd-numbered pages, respectively. The ref argument is the same as with the ‘@every...’ commands.

Write these commands immediately after the @...contents commands, or after the @end titlepage command if you don’t have a table of contents or if it is printed at the end of your manual.

By default the @this... commands reflect the situation at the bottom of a page both in headings and in footings.


Previous: Standard Heading Formats, Up: Page Headings   [Contents][Index]