Go to the first, previous, next, last section, table of contents.


A Short Sample Texinfo File

Here is a complete but very short Texinfo file, in 6 parts. The first three parts of the file, from `\input texinfo' through to `@end titlepage', look more intimidating than they are. Most of the material is standard boilerplate; when you write a manual, simply insert the names for your own manual in this segment. (See section Beginning a Texinfo File.)

In the following, the sample text is indented; comments on it are not. The complete file, without any comments, is shown in section A Sample Texinfo File.

Part 1: Header

The header does not appear in either the Info file or the
printed output. It sets various parameters, including the
name of the Info file and the title used in the header.

\input texinfo   @c -*-texinfo-*-
@c %**start of header
@setfilename sample.info
@settitle Sample Document
@c %**end of header

@setchapternewpage odd

Part 2: Summary Description and Copyright

The summary description and copyright segment does not
appear in the printed document.

@ifinfo
This is a short example of a complete Texinfo file.

Copyright @copyright{} 1990 Free Software Foundation, Inc.
@end ifinfo

Part 3: Titlepage and Copyright

The titlepage segment does not appear in the Info file.

@titlepage
@sp 10
@comment The title is printed in a large font.
@center @titlefont{Sample Title}

@c The following two commands start the copyright page.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1990 Free Software Foundation, Inc.
@end titlepage

Part 4: `Top' Node and Master Menu

The `Top' node contains the master menu for the Info file.
Since a printed manual uses a table of contents rather than
a menu, the master menu appears only in the Info file.

@node    Top,       First Chapter, (dir),    (dir)
@comment node-name, next,          previous, up
@menu
* First Chapter::    The first chapter is the
                     only chapter in this sample.
* Concept Index::    This index has two entries.
@end menu

Part 5: The Body of the Document

The body segment contains all the text of the document, but not the indices or table of contents. This example illustrates a node and a chapter containing an enumerated list.

@node    First Chapter, Concept Index, Top,      Top
@comment node-name,     next,          previous, up
@chapter First Chapter
@cindex Sample index entry

This is the contents of the first chapter.
@cindex Another sample index entry

Here is a numbered list.

@enumerate
@item
This is the first item.

@item
This is the second item.
@end enumerate

The @code{makeinfo} and @code{texinfo-format-buffer}
commands transform a Texinfo file such as this into
an Info file; and @TeX{} typesets it for a printed
manual.

Part 6: The End of the Document

The end segment contains commands both for generating an index in a node and unnumbered chapter of its own and for generating the table of contents; and it contains the @bye command that marks the end of the document.

@node    Concept Index,    ,  First Chapter, Top
@comment node-name,    next,  previous,      up
@unnumbered Concept Index

@printindex cp

@contents
@bye

The Results

Here is what the contents of the first chapter of the sample look like:

This is the contents of the first chapter.

Here is a numbered list.

  1. This is the first item.
  2. This is the second item.

The makeinfo and texinfo-format-buffer commands transform a Texinfo file such as this into an Info file; and TeX typesets it for a printed manual.


Go to the first, previous, next, last section, table of contents.