manpagez: man pages & more
info texinfo
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.13 A Short Sample Texinfo File

Here is a very short but complete Texinfo file, in the six conventional parts enumerated in the previous section, so you can see how Texinfo source appears in practice. 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 writing a manual, you simply change the names as appropriate.

See section Beginning a Texinfo File, for full documentation on the commands listed here. See section GNU Sample Texts, for the full texts to be used in GNU manuals.

In the following, the sample text is indented; comments on it are not. The complete file, without interspersed comments, is shown in Short Sample.

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
@settitle Sample Manual 1.0
@c %**end of header

Part 2: Summary Description and Copyright

A real manual includes more text here, according to the license under which it is distributed. See section GNU Sample Texts.

This is a short example of a complete Texinfo file, version 1.0.

Copyright @copyright{} 2013 Free Software Foundation, Inc.
@end copying

Part 3: Titlepage, Contents, Copyright

The titlepage segment does not appear in the online output, only in the printed manual. We use the @insertcopying command to include the permission text from the previous section, instead of writing it out again; it is output on the back of the title page. The @contents command generates a table of contents.

@title Sample Title
@c The following two commands start the copyright page.
@vskip 0pt plus 1filll
@end titlepage
@c Output the table of contents at the beginning.

Part 4: ‘Top’ Node and Master Menu

The ‘Top’ node contains the master menu for the Info file. Since the printed manual uses a table of contents rather than a menu, it excludes the ‘Top’ node. We repeat the short description from the beginning of the ‘@copying’ text, but there’s no need to repeat the copyright information, so we don’t use ‘@insertcopying’ here. The ‘@top’ command itself helps makeinfo determine the relationships between nodes.

@node Top
@top Short Sample

This is a short sample Texinfo file.
@end ifnottex

* First Chapter::    The first chapter is the
                       only chapter in this sample.
* Index::            Complete index.
@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
@chapter First Chapter

@cindex chapter, first
This is the first chapter.
@cindex index entry, another
Here is a numbered list.

This is the first item.

This is the second item.
@end enumerate

Part 6: The End of the Document

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

@node Index
@unnumbered Index
@printindex cp


Some Results

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

This is the first chapter.

Here is a numbered list.

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

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on October 2, 2013 using texi2html 5.0.

© 2000-2021
Individual documents may contain additional copyright information.