@section, and other structuring commands
(see Chapter Structuring) supply the information to make up a
table of contents, but they do not cause an actual table to appear in
the manual. To do this, you must use the
Generates a table of contents in a printed manual, including all
chapters, sections, subsections, etc., as well as appendices and
unnumbered chapters. Headings generated by
@chapheading, and the other
do not appear in the table of contents (see Structuring Command Types).
@summarycontents is a synonym for
Generates a short or summary table of contents that lists only the chapters, appendices, and unnumbered chapters. Sections, subsections and subsubsections are omitted. Only a long manual needs a short table of contents in addition to the full table of contents.
Both contents commands should be written on a line by themselves, and
placed near the beginning of the file, after the
titlepage (see @titlepage), before any sectioning
command. The contents commands automatically generate a chapter-like
heading at the top of the first table of contents page, so don’t
include any sectioning command such as
Since an Info file uses menus instead of tables of contents, the Info
formatting commands ignore the contents commands. But the contents
are included in plain text output (generated by
--plaintext) and in other output formats, such as HTML.
makeinfo writes a short table of contents while producing
HTML output, the links in the short table of contents point to
corresponding entries in the full table of contents rather than the text
of the document. The links in the full table of contents point to the
main text of the document.
In the past, the contents commands were sometimes placed at the end of
the file, after any indices and just before the
@bye, but we
no longer recommend this.
However, since many existing Texinfo documents still do have the
@contents at the end of the manual, if you are a user printing
a manual, you may wish to force the contents to be printed after the
title page. You can do this by specifying
@setshortcontentsaftertitlepage. The first prints only the
main contents after the
@end titlepage; the second prints both
the short contents and the main contents. In either case, any
@shortcontents is ignored.
You need to include the
commands early in the document (just after
example). We recommend using
texi2dvi (see Format with texi2dvi) to specify this without altering the source file at
all. For example:
texi2dvi --texinfo=@setcontentsaftertitlepage foo.texi
An alternative invocation, using
texi2any --dvi --Xopt --texinfo=@setcontentsaftertitlepage foo.texi