[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Texinfo(1) is a documentation system that uses a single source file to produce both online information and printed output. This means that instead of writing two different documents, one for the online information and the other for a printed work, you need write only one document. Therefore, when the work is revised, you need revise only that one document.
Manuals for most GNU packages are written in Texinfo, and available online at http://www.gnu.org/doc.
1.1 Reporting Bugs | Submitting effective bug reports. | |
1.2 Using Texinfo | Create printed or online output. | |
1.3 Output Formats | Overview of the supported output formats. | |
1.4 Info Files | What is an Info file? | |
1.5 Printed Books | Characteristics of a printed book or manual. | |
1.6 @-commands | @-commands are used for formatting. | |
1.7 General Syntactic Conventions | General rules for writing a Texinfo file. | |
1.8 Comments | Writing comments and ignored text in general. | |
1.9 What a Texinfo File Must Have | What a Texinfo file must have. | |
1.10 Six Parts of a Texinfo File | Usually, a Texinfo file has six parts. | |
1.11 A Short Sample Texinfo File | A short sample Texinfo file. | |
1.12 History | Acknowledgements, contributors and genesis. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We welcome bug reports and suggestions for any aspect of the Texinfo system, programs, documentation, installation, anything. Please email them to bug-texinfo@gnu.org. You can get the latest version of Texinfo from ftp://ftp.gnu.org/gnu/texinfo/ and its mirrors worldwide.
For bug reports, please include enough information for the maintainers to reproduce the problem. Generally speaking, that means:
configure
.
When in doubt whether something is needed or not, include it. It’s better to include too much than to leave out something important.
Patches are most welcome; if possible, please make them with ‘diff -c’ (see (diff)Top section ‘Overview’ in Comparing and Merging Files) and include ‘ChangeLog’ entries (see (xemacs)Change Log section ‘Change Log’ in XEmacs User’s Manual), and follow the existing coding style.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Using Texinfo, you can create a printed document (via the TeX typesetting system) the normal features of a book, including chapters, sections, cross references, and indices. From the same Texinfo source file, you can create an Info file with special features to make documentation browsing easy. You can also create from that same source file an HTML output file suitable for use with a web browser, or an XML file. See the next section (see section Output Formats) for details and the exact commands to generate output from the source.
TeX works with virtually all printers; Info works with virtually all computer terminals; the HTML output works with virtually all web browsers. Thus Texinfo can be used by almost any computer user.
A Texinfo source file is a plain ASCII file containing text interspersed with @-commands (words preceded by an ‘@’) that tell the typesetting and formatting programs what to do. You can edit a Texinfo file with any text editor, but it is especially convenient to use XEmacs since that editor has a special mode, called Texinfo mode, that provides various Texinfo-related features. (See section Using Texinfo Mode.)
You can use Texinfo to create both online help and printed manuals; moreover, Texinfo is freely redistributable. For these reasons, Texinfo is the official documentation format of the GNU project. More information is available at the GNU documentation web page.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here is a brief overview of the output formats currently supported by Texinfo.
(Generated via makeinfo
.) This format is essentially a
plain text transliteration of the Texinfo source. It adds a few
control characters to separate nodes and provide navigational
information for menus, cross-references, indices, and so on. See the
next section (see section Info Files) for more details on this format.
The XEmacs Info subsystem (see (info)Top section ‘Getting Started’ in Info),
and the standalone info
program (see (info-stnd)Top section ‘Info Standalone’ in GNU Info), among others, can read these
files. See section Creating and Installing Info Files.
(Generated via makeinfo --no-headers
.) This is almost the
same as Info output, except the navigational control characters are
omitted. Also, standard output is used by default.
(Generated via makeinfo --html
.) This is the Hyper Text
Markup Language that has become the most commonly used language for
writing documents on the World Wide Web. Web browsers, such as
Mozilla, Lynx, and Emacs-W3, can render this language online. There
are many versions of HTML; makeinfo
tries to use a subset
of the language that can be interpreted by any common browser. For
details of the HTML language and much related information, see
http://www.w3.org/MarkUp/. See section Generating HTML.
(Generated via texi2dvi
.) This DeVice Independent binary
format is output by the TeX typesetting program
(http://tug.org). This is then read by a DVI ‘driver’, which
writes the actual device-specific commands that can be viewed or
printed, notably Dvips for translation to PostScript (see (dvips)Invoking Dvips section ‘Invoking Dvips’ in Dvips) and Xdvi for viewing on an X display
(http://sourceforge.net/projects/xdvi/). See section Formatting and Printing Hardcopy.
Be aware that the Texinfo language is very different from and much stricter than TeX’s usual languages, plain TeX and LaTeX. For more information on TeX in general, please see the book TeX for the Impatient, available from http://savannah.gnu.org/projects/teximpatient.
(Generated via texi2dvi --pdf
or texi2pdf
.) This
format was developed by Adobe Systems for portable document
interchange, based on their previous PostScript language. It can
represent the exact appearance of a document, including fonts and
graphics, and supporting arbitrary scaling. It is intended to be
platform-independent and easily viewable, among other design goals;
http://tug.org/TUGboat/Articles/tb22-3/tb72beebe-pdf.pdf has
some background. Texinfo uses the pdftex
program, a variant
of TeX, to output PDF; see
http://tug.org/applications/pdftex. See section PDF Output.
(Generated via makeinfo --xml
.) XML is a generic syntax
specification usable for any sort of content (see, for example,
http://www.w3.org/XML/). The makeinfo
XML output,
unlike all the formats above, interprets very little of the Texinfo
source. Rather, it merely translates the Texinfo markup commands into
XML syntax, for processing by further XML tools. The particular
syntax output is defined in the file ‘texinfo.dtd’ included in
the Texinfo source distribution.
(Generated via makeinfo --docbook
.) This is an XML-based
format developed some years ago, primarily for technical
documentation. It therefore bears some resemblance, in broad
outlines, to Texinfo. See http://www.docbook.org. If you want
to convert from Docbook to Texinfo, please see
http://docbook2X.sourceforge.net.
From time to time, proposals are made to generate traditional Unix man pages from Texinfo source. However, because man pages have a very strict conventional format, generating a good man page requires a completely different source than the typical Texinfo applications of writing a good user tutorial and/or a good reference manual. This makes generating man pages incompatible with the Texinfo design goal of not having to document the same information in different ways for different output formats. You might as well just write the man page directly.
Man pages still have their place, and if you wish to support them, you
may find the program help2man
to be useful; it generates a
traditional man page from the ‘--help’ output of a program. In
fact, this is currently used to generate man pages for the programs in
the Texinfo distribution. It is GNU software written by Brendan
O’Dea, available from ftp://ftp.gnu.org/gnu/help2man/.
If you are a programmer and would like to contribute to the GNU project
by implementing additional output formats for Texinfo, that would be
excellent. But please do not write a separate translator texi2foo for
your favorite format foo! That is the hard way to do the job, and makes
extra work in subsequent maintenance, since the Texinfo language is
continually being enhanced and updated. Instead, the best approach is
modify makeinfo
to generate the new format.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An Info file is a Texinfo file formatted so that the Info documentation
reading program can operate on it. (makeinfo
and texinfo-format-buffer
are two commands that convert a Texinfo file
into an Info file.)
Info files are divided into pieces called nodes, each of which contains the discussion of one topic. Each node has a name, and contains both text for the user to read and pointers to other nodes, which are identified by their names. The Info program displays one node at a time, and provides commands with which the user can move to other related nodes.
See (info)Top section ‘Top’ in GNU Info, for more information about using Info.
Each node of an Info file may have any number of child nodes that describe subtopics of the node’s topic. The names of child nodes are listed in a menu within the parent node; this allows you to use certain Info commands to move to one of the child nodes. Generally, an Info file is organized like a book. If a node is at the logical level of a chapter, its child nodes are at the level of sections; likewise, the child nodes of sections are at the level of subsections.
All the children of any one parent are linked together in a bidirectional chain of ‘Next’ and ‘Previous’ pointers. The ‘Next’ pointer provides a link to the next section, and the ‘Previous’ pointer provides a link to the previous section. This means that all the nodes that are at the level of sections within a chapter are linked together. Normally the order in this chain is the same as the order of the children in the parent’s menu. Each child node records the parent node name as its ‘Up’ pointer. The last child has no ‘Next’ pointer, and the first child has the parent both as its ‘Previous’ and as its ‘Up’ pointer.(2)
The book-like structuring of an Info file into nodes that correspond to chapters, sections, and the like is a matter of convention, not a requirement. The ‘Up’, ‘Previous’, and ‘Next’ pointers of a node can point to any other nodes, and a menu can contain any other nodes. Thus, the node structure can be any directed graph. But it is usually more comprehensible to follow a structure that corresponds to the structure of chapters and sections in a printed book or report.
In addition to menus and to ‘Next’, ‘Previous’, and ‘Up’ pointers, Info provides pointers of another kind, called references, that can be sprinkled throughout the text. This is usually the best way to represent links that do not fit a hierarchical structure.
Usually, you will design a document so that its nodes match the structure of chapters and sections in the printed output. But occasionally there are times when this is not right for the material being discussed. Therefore, Texinfo uses separate commands to specify the node structure for the Info file and the section structure for the printed output.
Generally, you enter an Info file through a node that by convention is named ‘Top’. This node normally contains just a brief summary of the file’s purpose, and a large menu through which the rest of the file is reached. From this node, you can either traverse the file systematically by going from node to node, or you can go to a specific node listed in the main menu, or you can search the index menus and then go directly to the node that has the information you want. Alternatively, with the standalone Info program, you can specify specific menu items on the command line (see (info)Top section ‘Top’ in Info).
If you want to read through an Info file in sequence, as if it were a printed manual, you can hit <SPC> repeatedly, or you get the whole file with the advanced Info command g *. (See Advanced Info commands: (info)Advanced.)
The ‘dir’ file in the ‘info’ directory serves as the departure point for the whole Info system. From it, you can reach the ‘Top’ nodes of each of the documents in a complete Info system.
If you wish to refer to an Info file in a URI, you can use the (unofficial) syntax exemplified in the following. This works with Emacs/W3, for example:
info:///usr/info/xemacs#Dissociated%20Press info:xemacs#Dissociated%20Press info://localhost/usr/info/xemacs#Dissociated%20Press |
The info
program itself does not follow URIs of any kind.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A Texinfo file can be formatted and typeset as a printed book or manual. To do this, you need TeX, a powerful, sophisticated typesetting program written by Donald Knuth.(3)
A Texinfo-based book is similar to any other typeset, printed work: it can have a title page, copyright page, table of contents, and preface, as well as chapters, numbered or unnumbered sections and subsections, page headers, cross references, footnotes, and indices.
You can use Texinfo to write a book without ever having the intention of converting it into online information. You can use Texinfo for writing a printed novel, and even to write a printed memo, although this latter application is not recommended since electronic mail is so much easier.
TeX is a general purpose typesetting program. Texinfo provides a file ‘texinfo.tex’ that contains information (definitions or macros) that TeX uses when it typesets a Texinfo file. (‘texinfo.tex’ tells TeX how to convert the Texinfo @-commands to TeX commands, which TeX can then process to create the typeset document.) ‘texinfo.tex’ contains the specifications for printing a document. You can get the latest version of ‘texinfo.tex’ from the Texinfo home page, http://www.gnu.org/software/texinfo/.
In the United States, documents are most often printed on 8.5 inch by 11
inch pages (216mm by 280mm); this is the default size. But
you can also print for 7 inch by 9.25 inch pages (178mm by
235mm, the @smallbook
size; or on A4 or A5 size paper
(@afourpaper
, @afivepaper
). (See section Printing “Small” Books. Also, see Printing on A4 Paper.)
By changing the parameters in ‘texinfo.tex’, you can change the size of the printed document. In addition, you can change the style in which the printed document is formatted; for example, you can change the sizes and fonts used, the amount of indentation for each paragraph, the degree to which words are hyphenated, and the like. By changing the specifications, you can make a book look dignified, old and serious, or light-hearted, young and cheery.
TeX is freely distributable. It is written in a superset of Pascal called WEB and can be compiled either in Pascal or (by using a conversion program that comes with the TeX distribution) in C. (See (xemacs)TeX Mode section ‘TeX Mode’ in XEmacs User’s Manual, for information about TeX.)
TeX is very powerful and has a great many features. Because a Texinfo file must be able to present information both on a character-only terminal in Info form and in a typeset book, the formatting commands that Texinfo supports are necessarily limited.
To get a copy of TeX, see How to Obtain TeX.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In a Texinfo file, the commands that tell TeX how to typeset the
printed manual and tell makeinfo
and
texinfo-format-buffer
how to create an Info file are preceded
by ‘@’; they are called @-commands. For example,
@node
is the command to indicate a node and @chapter
is the command to indicate the start of a chapter.
Note: Almost all @ command names are entirely lower case.
The Texinfo @-commands are a strictly limited set of constructs. The strict limits make it possible for Texinfo files to be understood both by TeX and by the code that converts them into Info files. You can display Info files on any terminal that displays alphabetic and numeric characters. Similarly, you can print the output generated by TeX on a wide variety of printers.
Depending on what they do or what arguments(4) they take, you need to write @-commands on lines of their own or as part of sentences:
@quotation
at the beginning of a line as
the only text on the line. (@quotation
begins an indented
environment.)
@chapter
at the beginning of a line
followed by the command’s arguments, in this case the chapter title, on
the rest of the line. (@chapter
creates chapter titles.)
@dots{}
wherever you wish but usually
within a sentence. (@dots{}
creates an ellipsis …)
@code{sample-code}
wherever you
wish (but usually within a sentence) with its argument,
sample-code in this example, between the braces. (@code
marks text as being code.)
@example
on a line of its own; write the
body-text on following lines; and write the matching @end
command, @end example
in this case, on a line of its own
after the body-text. (@example
… @end example
indents and typesets body-text as an example.) It’s usually ok to
indent environment commands like this, but in complicated and
hard-to-define circumstances the extra spaces cause extra space to
appear in the output, so beware.
As a general rule, a command requires braces if it mingles among other
text; but it does not need braces if it starts a line of its own. The
non-alphabetic commands, such as @:
, are exceptions to the rule;
they do not need braces.
As you gain experience with Texinfo, you will rapidly learn how to write the different commands: the different ways to write commands actually make it easier to write and read Texinfo files than if all commands followed exactly the same syntax. See section @-Command Syntax, for all the details.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes the general conventions used in all Texinfo documents.
@noindent
to inhibit
paragraph indentation if required (see section @noindent
).
@code
and @example
.
makeinfo
does nothing special with tabs, and thus a tab
character in your input file will usually appear differently in the
output.
To avoid this problem, Texinfo mode in XEmacs inserts
multiple spaces when you press the <TAB> key. Also, you can run
untabify
in XEmacs to convert tabs in a region to multiple
spaces, or use the unexpand
command from the shell.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can write comments in a Texinfo file that will not appear in
either the Info file or the printed manual by using the
@comment
command (which may be abbreviated to @c
).
Such comments are for the person who revises the Texinfo file. All the
text on a line that follows either @comment
or @c
is a
comment; the rest of the line does not appear in either the Info file
or the printed manual.
Often, you can write the @comment
or @c
in the middle of
a line, and only the text that follows after the @comment
or
@c
command does not appear; but some commands, such as
@settitle
and @setfilename
, work on a whole line. You
cannot use @comment
or @c
in a line beginning with such
a command.
You can write long stretches of text that will not appear in either
the Info file or the printed manual by using the @ignore
and
@end ignore
commands. Write each of these commands on a line
of its own, starting each command at the beginning of the line. Text
between these two commands does not appear in the processed output.
You can use @ignore
and @end ignore
for writing
comments.
Text enclosed by @ignore
or by failing @ifset
or
@ifclear
conditions is ignored in the sense that it will not
contribute to the formatted output. However, TeX and makeinfo must
still parse the ignored text, in order to understand when to stop
ignoring text from the source file; that means that you may still get
error messages if you have invalid Texinfo commands within ignored text.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
By convention, the name of a Texinfo file ends with (in order of preference) one of the extensions ‘.texinfo’, ‘.texi’, ‘.txi’, or ‘.tex’. The longer extensions are preferred since they describe more clearly to a human reader the nature of the file. The shorter extensions are for operating systems that cannot handle long file names.
In order to be made into a printed manual and an Info file, a Texinfo file must begin with lines like this:
\input texinfo @setfilename info-file-name @settitle name-of-manual |
The contents of the file follow this beginning, and then you must end a Texinfo file with a line like this:
@bye |
Here’s an explanation:
@setfilename
line provides a name for the Info file and
tells TeX to open auxiliary files. All text before
@setfilename
is ignored!
@settitle
line specifies a title for the page headers (or
footers) of the printed manual, and the default document description for
the ‘<head>’ in HTML format. Strictly speaking, @settitle
is optional—if you don’t mind your document being titled ‘Untitled’.
@bye
line at the end of the file on a line of its own tells
the formatters that the file is ended and to stop formatting.
Typically, you will not use quite such a spare format, but will include mode setting and start-of-header and end-of-header lines at the beginning of a Texinfo file, like this:
\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename info-file-name @settitle name-of-manual @c %**end of header |
In the first line, ‘-*-texinfo-*-’ causes XEmacs to switch into Texinfo mode when you edit the file.
The @c
lines which surround the @setfilename
and
@settitle
lines are optional, but you need them in order to
run TeX or Info on just part of the file. (See section Start of Header.)
Furthermore, you will usually provide a Texinfo file with a title page, indices, and the like, all of which are explained in this manual. But the minimum, which can be useful for short documents, is just the three lines at the beginning and the one line at the end.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Generally, a Texinfo file contains more than the minimal beginning and end described in the previous section—it usually contains the six parts listed below. These are described fully in the following sections.
The Header names the file, tells TeX which definitions file to use, and other such housekeeping tasks.
The Summary and Copyright segment describes the document and
contains the copyright notice and copying permissions. This is done
with the @copying
command.
The Title and Copyright segment contains the title and copyright
pages for the printed manual. The segment must be enclosed between
@titlepage
and @end titlepage
commands. The title and
copyright page appear only in the printed manual.
The ‘Top’ node starts off the online output; it does not appear in the printed manual. We recommend including the copying permissions here as well as the segments above. And it contains at least a top-level menu listing the chapters, and possibly a Master Menu listing all the nodes in the entire document.
The Body of the document is typically structured like a traditional book or encyclopedia, but it may be free form.
The End segment may contain commands for printing indices, and
closes with the @bye
command on a line of its own.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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.
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 Manual 1.0 @c %**end of header |
A real manual includes more text here, according to the license under which it is distributed. See section GNU Sample Texts.
@copying This is a short example of a complete Texinfo file, version 1.0. Copyright @copyright{} 2005 Free Software Foundation, Inc. @end copying |
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.
@titlepage @title Sample Title @c The following two commands start the copyright page. @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c Output the table of contents at the beginning. @contents |
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.
@ifnottex @node Top @top Short Sample This is a short sample Texinfo file. @end ifnottex @menu * First Chapter:: The first chapter is the only chapter in this sample. * Index:: Complete index. @end menu |
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. @enumerate @item This is the first item. @item This is the second item. @end enumerate |
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 @bye |
Here is what the contents of the first chapter of the sample look like:
This is the first chapter.
Here is a numbered list.
- This is the first item.
- This is the second item.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Richard M. Stallman invented the Texinfo format, wrote the initial
processors, and created Edition 1.0 of this manual. Robert J.
Chassell greatly revised and extended the manual, starting with
Edition 1.1. Brian Fox was responsible for the standalone Texinfo
distribution until version 3.8, and wrote the standalone
makeinfo
and info
programs. Karl Berry has
continued maintenance since Texinfo 3.8 (manual edition 2.22).
Our thanks go out to all who helped improve this work, particularly the indefatigable Eli Zaretskii and Andreas Schwab, who have provided patches beyond counting. François Pinard and David D. Zuhn, tirelessly recorded and reported mistakes and obscurities. Zack Weinberg did the impossible by implementing the macro syntax in ‘texinfo.tex’. Special thanks go to Melissa Weisshaus for her frequent reviews of nearly similar editions. Dozens of others have contributed patches and suggestions, they are gratefully acknowledged in the ‘ChangeLog’ file. Our mistakes are our own.
A bit of history: in the 1970’s at CMU, Brian Reid developed a program
and format named Scribe to mark up documents for printing. It used the
@
character to introduce commands, as Texinfo does. Much more
consequentially, it strove to describe document contents rather than
formatting, an idea wholeheartedly adopted by Texinfo.
Meanwhile, people at MIT developed another, not too dissimilar format called Bolio. This then was converted to using TeX as its typesetting language: BoTeX. The earliest BoTeX version seems to have been 0.02 on October 31, 1984.
BoTeX could only be used as a markup language for documents to be printed, not for online documents. Richard Stallman (RMS) worked on both Bolio and BoTeX. He also developed a nifty on-line help format called Info, and then combined BoTeX and Info to create Texinfo, a mark up language for text that is intended to be read both online and as printed hard copy.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.