JezK
Edit File: Custom-Headings.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- This manual is for GNU Texinfo (version 6.8, 8 June 2021), a documentation system that can produce both online information and a printed manual from a single source using semantic markup. Copyright (C) 1988, 1990-1993, 1995-1999, 2001-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". --> <title>Custom Headings (GNU Texinfo 6.8)</title> <meta name="description" content="Custom Headings (GNU Texinfo 6.8)"> <meta name="keywords" content="Custom Headings (GNU Texinfo 6.8)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2any"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="index.html" rel="start" title="Top"> <link href="Command-and-Variable-Index.html" rel="index" title="Command and Variable Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Headings.html" rel="up" title="Headings"> <link href="Heading-Format.html" rel="prev" title="Heading Format"> <style type="text/css"> <!-- a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em} a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} span:hover a.copiable-anchor {visibility: visible} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <div class="subsection" id="Custom-Headings"> <div class="header"> <p> Previous: <a href="Heading-Format.html" accesskey="p" rel="prev">Standard Heading Formats</a>, Up: <a href="Headings.html" accesskey="u" rel="up">Page Headings</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> <hr> <span id="How-to-Make-Your-Own-Headings"></span><h4 class="subsection">E.2.3 How to Make Your Own Headings</h4> <p>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. </p> <p>Texinfo provides six commands for specifying headings and footings: </p><ul> <li> <code>@everyheading</code> and <code>@everyfooting</code> generate page headers and footers that are the same for both even- and odd-numbered pages. </li><li> <code>@evenheading</code> and <code>@evenfooting</code> commands generate headers and footers for even-numbered (left-hand) pages. </li><li> <code>@oddheading</code> and <code>@oddfooting</code> generate headers and footers for odd-numbered (right-hand) pages. </li></ul> <p>Write custom heading specifications in the Texinfo file immediately after the <code>@end titlepage</code> command. You must cancel the predefined heading commands with the <code>@headings off</code> command before defining your own specifications. </p> <p>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: </p> <div class="example"> <pre class="example">@headings off @everyheading @thischapter @| @thispage @| @today{} </pre></div> <p>You need to divide the left part from the central part and the central part from the right part by inserting ‘<samp>@|</samp>’ between parts. Otherwise, the specification command will not be able to tell where the text for one part ends and the next part begins. </p> <p>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. </p> <p>Here are the six heading and footing commands: </p> <dl compact="compact"> <dt id='index-everyheading'><span><code>@everyheading <var>left</var> @| <var>center</var> @| <var>right</var></code><a href='#index-everyheading' class='copiable-anchor'> ¶</a></span></dt> <dt><span><code>@everyfooting <var>left</var> @| <var>center</var> @| <var>right</var></code></span></dt> <dd><span id="index-everyfooting"></span> <p>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. </p> </dd> <dt id='index-evenheading'><span><code>@evenheading <var>left</var> @| <var>center</var> @| <var>right</var></code><a href='#index-evenheading' class='copiable-anchor'> ¶</a></span></dt> <dt><span><code>@oddheading <var>left</var> @| <var>center</var> @| <var>right</var></code></span></dt> <dt><span><code>@evenfooting <var>left</var> @| <var>center</var> @| <var>right</var></code></span></dt> <dt><span><code>@oddfooting <var>left</var> @| <var>center</var> @| <var>right</var></code></span></dt> <dd><span id="index-evenfooting"></span> <span id="index-oddheading"></span> <span id="index-oddfooting"></span> <p>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. </p></dd> </dl> <p>Use the ‘<samp>@this…</samp>’ series of @-commands to provide the names of chapters and sections and the page number. You can use the ‘<samp>@this…</samp>’ 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 <code>@iftex</code> and <code>@end iftex</code> commands. </p> <p>Here are the ‘<samp>@this…</samp>’ commands: </p> <dl compact="compact"> <dt id='index-thispage'><span><code>@thispage</code><a href='#index-thispage' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the current page number. </p> </dd> <dt id='index-thissectionname'><span><code>@thissectionname</code><a href='#index-thissectionname' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the name of the current section. </p> </dd> <dt id='index-thissectionnum'><span><code>@thissectionnum</code><a href='#index-thissectionnum' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the number of the current section. </p> </dd> <dt id='index-thissection'><span><code>@thissection</code><a href='#index-thissection' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the number and name of the current section, in the format ‘Section 1: Title’. </p> </dd> <dt id='index-thischaptername'><span><code>@thischaptername</code><a href='#index-thischaptername' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the name of the current chapter. </p> </dd> <dt id='index-thischapternum'><span><code>@thischapternum</code><a href='#index-thischapternum' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the number of the current chapter, or letter of the current appendix. </p> </dd> <dt id='index-thischapter'><span><code>@thischapter</code><a href='#index-thischapter' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the number and name of the current chapter, in the format ‘Chapter 1: Title’. </p> </dd> <dt id='index-thistitle'><span><code>@thistitle</code><a href='#index-thistitle' class='copiable-anchor'> ¶</a></span></dt> <dd><p>Expands to the name of the document, as specified by the <code>@settitle</code> command. </p> </dd> <dt id='index-thisfile'><span><code>@thisfile</code><a href='#index-thisfile' class='copiable-anchor'> ¶</a></span></dt> <dd><p>For <code>@include</code> files only: expands to the name of the current <code>@include</code> file. If the current Texinfo source file is not an <code>@include</code> file, this command has no effect. This command does <em>not</em> provide the name of the current Texinfo source file unless it is an <code>@include</code> file. (See <a href="Include-Files.html">Include Files</a>, for more information about <code>@include</code> files.) </p></dd> </dl> <p>You can also use the <code>@today{}</code> command, which expands to the current date, in ‘1 Jan 1900’ format. <span id="index-today"></span> </p> <p>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: </p> <div class="example"> <pre class="example">@headings off @everyheading @emph{Draft!} @| @thispage @| @thischapter @everyfooting @| @| Version: 0.27: @today{} </pre></div> <p>Beware of overlong titles: they may overlap another part of the header or footer and blot it out. </p> <p>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 <code>@thischapter</code>, <code>@thissection</code> and other such macros to refer to on such pages as follows: </p> <dl compact="compact"> <dt id='index-everyheadingmarks'><span><code>@everyheadingmarks <var>ref</var></code><a href='#index-everyheadingmarks' class='copiable-anchor'> ¶</a></span></dt> <dt><span><code>@everyfootingmarks <var>ref</var></code></span></dt> <dd><span id="index-everyfootingmarks"></span> <p>The <var>ref</var> argument can be either <code>top</code> (the <code>@this...</code> commands will refer to the chapter/section at the top of a page) or <code>bottom</code> (the commands will reflect the situation at the bottom of a page). These ‘<samp>@every...</samp>’ commands specify what to do on both even- and odd-numbered pages. </p> </dd> <dt id='index-evenheadingmarks'><span><code>@evenheadingmarks <var>ref</var></code><a href='#index-evenheadingmarks' class='copiable-anchor'> ¶</a></span></dt> <dt><span><code>@oddheadingmarks <var>ref</var></code></span></dt> <dt><span><code>@evenfootingmarks <var>ref</var></code></span></dt> <dt><span><code>@oddfootingmarks <var>ref</var></code></span></dt> <dd><span id="index-oddheadingmarks"></span> <span id="index-evenfootingmarks"></span> <span id="index-oddfootingmarks"></span> <p>These ‘<samp>@even...</samp>’ and ‘<samp>@odd...</samp>’ commands specify what to do on only even- or odd-numbered pages, respectively. The <var>ref</var> argument is the same as with the ‘<samp>@every...</samp>’ commands. </p></dd> </dl> <p>Write these commands immediately after the <code>@...contents</code> commands, or after the <code>@end titlepage</code> command if you don’t have a table of contents or if it is printed at the end of your manual. </p> <p>By default the <code>@this...</code> commands reflect the situation at the bottom of a page both in headings and in footings. </p> </div> <hr> <div class="header"> <p> Previous: <a href="Heading-Format.html">Standard Heading Formats</a>, Up: <a href="Headings.html">Page Headings</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> </body> </html>