@code{sample-code}
@kbd{keyboard-characters}
@key{key-name}
@samp{text}
@verb{<char>text<char>}
@var{metasyntactic-variable}
@env{environment-variable}
@file{file-name}
@command{command-name}
@option{option-name}
@dfn{term}
@cite{reference}
@acronym{acronym}
@url{uniform-resource-locator}
@email{email-address[, displayed-text]}
@quotation
@example: Example Text
@verbatim: Literal Text
@verbatiminclude file: Include a File Verbatim
@lisp: Marking a Lisp Example
@small... Block Commands
@display and @smalldisplay
@format and @smallformat
@exdent: Undoing a Line's Indentation
@flushleft and @flushright
@noindent: Omitting Indentation
@cartouche: Rounded Rectangles Around Examples
tex and texindex
texi2dvi
lpr -d
@pagesizes [width][, height]: Custom Page Sizes
Copyright (C) 1988, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 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.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being "A GNU Manual," and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled "GNU Free Documentation License."(a) The FSF's Back-Cover Text is: "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development."
The first part of this master menu lists the major nodes in this Info document, including the @-command and concept indices. The rest of the menu lists all the lower level nodes in the document.
Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. --Dick Brandon
The programs currently being distributed that relate to Texinfo include
makeinfo, info, texindex, and texinfo.tex.
These programs are free; this means that everyone is free to use
them and free to redistribute them on a free basis. The Texinfo-related
programs are not in the public domain; they are copyrighted and there
are restrictions on their distribution, but these restrictions are
designed to permit everything that a good cooperating citizen would want
to do. What is not allowed is to try to prevent others from further
sharing any version of these programs that they might get from you.
Specifically, we want to make sure that you have the right to give away copies of the programs that relate to Texinfo, that you receive source code or else can get it if you want it, that you can change these programs or use pieces of them in new free programs, and that you know you can do these things.
To make sure that everyone has such rights, we have to forbid you to deprive anyone else of these rights. For example, if you distribute copies of the Texinfo related programs, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights.
Also, for our own protection, we must make certain that everyone finds out that there is no warranty for the programs that relate to Texinfo. If these programs are modified by someone else and passed on, we want their recipients to know that what they have is not what we distributed, so that any problems introduced by others will not reflect on our reputation.
The precise conditions of the licenses for the programs currently being distributed that relate to Texinfo are found in the General Public Licenses that accompany them. This manual specifically is covered by the GNU Free Documentation License (see GNU Free Documentation License).
Texinfo1 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.
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 Overview) and include ChangeLog entries (see Change Log).
When sending patches, if possible please do not encode or split them in any way; it's much easier to deal with one plain text message, however large, than many small ones. GNU shar is a convenient way of packaging multiple and/or binary files for email.
Using Texinfo, you can create a printed document with the normal features of a book, including chapters, sections, cross references, and indices. From the same Texinfo source file, you can create a menu-driven, online Info file with nodes, menus, cross references, and indices. You can also create from that same source file an HTML output file suitable for use with a web browser, or an XML file. The GNU Emacs Manual is a good example of a Texinfo file, as is this manual.
To make a printed document, you process a Texinfo source file with the TeX typesetting program (but the Texinfo language is very different and much stricter than TeX's usual language, plain TeX). This creates a DVI file that you can typeset and print as a book or report (see Hardcopy).
To output an Info file, process your Texinfo source with the
makeinfo utility or Emacs's texinfo-format-buffer command.
You can install the result in your Info tree (see Installing an Info File).
To output an HTML file, run makeinfo --html on your Texinfo
source. You can (for example) install the result on your web site.
To output an XML file, run makeinfo --xml on your Texinfo source.
To output DocBook (a particular form of XML), run makeinfo
--docbook. If you want to convert from Docbook to Texinfo,
please see http://docbook2X.sourceforge.net/.
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, as it does now for
Info, plain text, HTML, XML, and DocBook.
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 and
@-commands (words preceded by an @) that tell the
typesetting and formatting programs what to do. You may edit a Texinfo
file with any text editor; but it is especially convenient to use GNU
Emacs since that editor has a special mode, called Texinfo mode, that
provides various Texinfo-related features. (See Texinfo Mode.)
Before writing a Texinfo source file, you should learn about nodes, menus, cross references, and the rest, for example by reading this manual.
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.
From time to time, proposals are made to generate traditional Unix man
pages from Texinfo source. This is not likely to ever be supported,
because man pages have a very strict conventional format. Merely
enhancing makeinfo to output troff format would be
insufficient. Generating a good man page therefore requires a
completely different source than the typical Texinfo applications of
writing a good user tutorial 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, the
program help2man may 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 Texinfo programs
themselves. It is GNU software written by Brendan O'Dea, available from
ftp://ftp.gnu.org/gnu/help2man/.
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.
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 Top).
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.)
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/emacs#Dissociated%20Press
info:emacs#Dissociated%20Press
info://localhost/usr/info/emacs#Dissociated%20Press
The info program itself does not follow URI's of any kind.
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
ftp://ftp.gnu.org/gnu/texinfo.tex.
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 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 TeX Mode, 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.
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.
Please note: All the @-commands, with the exception of the
@TeX{} command, must be written entirely in 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 arguments4 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 dots ...)
@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, at the 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 make it easier to write and read Texinfo files than if all commands followed exactly the same syntax. (For details about @-command syntax, see @-Command Syntax.)
This section describes the general conventions used in all Texinfo documents.
@, { and
} can appear in a Texinfo file and stand for themselves.
@ is the escape character which introduces commands, while
{ and } are used to surround arguments to certain
commands. To put one of these special characters into the document, put
an @ character in front of it, like this: @@,
@{, and @}.
---, for a dash--like this. In
TeX, a single or double hyphen produces a printed dash that is
shorter than the usual typeset dash. Info reduces three hyphens to two
for display on the screen.
@noindent
@iftex
and @end iftex commands, that region will appear only in
the printed copy; in that region, you can use certain commands
borrowed from plain TeX that you cannot use in Info. Conversely,
text surrounded by @ifnottex and @end ifnottex will
appear in all output formats except TeX.
Each of the other output formats (html, info,
plaintext) have an analogous pair of commands. See Conditionals.
Caution: Do not use tab characters in a Texinfo file (except in verbatim modes)! TeX uses variable-width fonts, which means that it is impractical at best to define a tab to work in all circumstances. Consequently, TeX treats tabs like single spaces, and that is not what they look like. Furthermore,makeinfodoes nothing special with tabs, and thus a tab character in your input file may appear differently in the output, for example, in indented text.To avoid this problem, Texinfo mode causes GNU Emacs to insert multiple spaces when you press the <TAB> key.
Also, you can run
untabifyin Emacs to convert tabs in a region to multiple spaces.
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.
By convention, the namea 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:
\input texinfo line tells TeX to use the
texinfo.tex file, which tells TeX how to translate the Texinfo
@-commands into TeX typesetting commands. (Note the use of the
backslash, \; this is correct for TeX.)
@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 Emacs 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 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.
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.
@copying command.
@titlepage and @end titlepage commands. The title and
copyright page appear only in the printed manual.
@bye command on a line
of its own.
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 Beginning a File, for full documentation on the commands listed here. See 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 Texinfo File.
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 GNU Sample Texts.
@copying
This is a short example of a complete Texinfo file, version 1.0.
Copyright @copyright{} 2002 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 a printed manual uses a table of contents rather than a menu, the master menu appears only in online output. We also include the copying text again for the benefit of online readers. And since the copying text begins with a brief description of the manual, no other text is needed.
@ifnottex
@node Top
@end ifnottex
@insertcopying
@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.
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 strived 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.
You may edit a Texinfo file with any text editor you choose. A Texinfo file is no different from any other ASCII file. However, GNU Emacs comes with a special mode, called Texinfo mode, that provides Emacs commands and tools to help ease your work.
This chapter describes features of GNU Emacs' Texinfo mode but not any features of the Texinfo formatting language. So if you are reading this manual straight through from the beginning, you may want to skim through this chapter briefly and come back to it after reading succeeding chapters which describe the Texinfo formatting language in detail.
Texinfo mode provides special features for working with Texinfo files. You can:
@node lines.
Perhaps the two most helpful features are those for inserting frequently used @-commands and for creating node pointers and menus.
In most cases, the usual Text mode commands work the same in Texinfo
mode as they do in Text mode. Texinfo mode adds new editing commands
and tools to GNU Emacs' general purpose editing features. The major
difference concerns filling. In Texinfo mode, the paragraph
separation variable and syntax table are redefined so that Texinfo
commands that should be on lines of their own are not inadvertently
included in paragraphs. Thus, the M-q (fill-paragraph)
command will refill a paragraph but not mix an indexing command on a
line adjacent to it into the paragraph.
In addition, Texinfo mode sets the page-delimiter variable to
the value of texinfo-chapter-level-regexp; by default, this is
a regular expression matching the commands for chapters and their
equivalents, such as appendices. With this value for the page
delimiter, you can jump from chapter title to chapter title with the
C-x ] (forward-page) and C-x [
(backward-page) commands and narrow to a chapter with the
C-x p (narrow-to-page) command. (See Pages, for details about the page commands.)
You may name a Texinfo file however you wish, but the convention is to
end a Texinfo file name with one of the extensions
.texinfo, .texi, .txi, or .tex. A longer
extension is preferred, since it is explicit, but a shorter extension
may be necessary for operating systems that limit the length of file
names. GNU Emacs automatically enters Texinfo mode when you visit a
file with a .texinfo, .texi or .txi
extension. Also, Emacs switches to Texinfo mode
when you visit a
file that has -*-texinfo-*- in its first line. If ever you are
in another mode and wish to switch to Texinfo mode, type M-x
texinfo-mode.
Like all other Emacs features, you can customize or enhance Texinfo mode as you wish. In particular, the keybindings are very easy to change. The keybindings described here are the default or standard ones.
Texinfo mode provides commands to insert various frequently used @-commands into the buffer. You can use these commands to save keystrokes.
The insert commands are invoked by typing C-c twice and then the first letter of the @-command:
@code{} and put the
cursor between the braces.
@dfn{} and put the
cursor between the braces.
@end and attempt to insert the correct following word,
such as example or table. (This command does not handle
nested lists correctly, but inserts the word appropriate to the
immediately preceding list.)
@item and put the
cursor at the beginning of the next line.
@kbd{} and put the
cursor between the braces.
@node and a comment line
listing the sequence for the `Next',
`Previous', and `Up' nodes.
Leave point after the @node.
@noindent and put the
cursor at the beginning of the next line.
@samp{} and put the
cursor between the braces.
@table followed by a <SPC>
and leave the cursor after the <SPC>.
@var{} and put the
cursor between the braces.
@example and put the
cursor at the beginning of the next line.
{} and put the cursor between the braces.
To put a command such as @code{...} around an
existing word, position the cursor in front of the word and type
C-u 1 C-c C-c c. This makes it easy to edit existing plain text.
The value of the prefix argument tells Emacs how many words following
point to include between braces--1 for one word, 2 for
two words, and so on. Use a negative argument to enclose the previous
word or words. If you do not specify a prefix argument, Emacs inserts
the @-command string and positions the cursor between the braces. This
feature works only for those @-commands that operate on a word or words
within one line, such as @kbd and @var.
This set of insert commands was created after analyzing the frequency
with which different @-commands are used in the GNU Emacs
Manual and the GDB Manual. If you wish to add your own insert
commands, you can bind a keyboard macro to a key, use abbreviations,
or extend the code in texinfo.el.
C-c C-c C-d (texinfo-start-menu-description) is an insert
command that works differently from the other insert commands. It
inserts a node's section or chapter title in the space for the
description in a menu entry line. (A menu entry has three parts, the
entry name, the node name, and the description. Only the node name is
required, but a description helps explain what the node is about.
See The Parts of a Menu.)
To use texinfo-start-menu-description, position point in a menu
entry line and type C-c C-c C-d. The command looks for and copies
the title that goes with the node name, and inserts the title as a
description; it positions point at beginning of the inserted text so you
can edit it. The function does not insert the title if the menu entry
line already contains a description.
This command is only an aid to writing descriptions; it does not do the whole job. You must edit the inserted text since a title tends to use the same words as a node name but a useful description uses different words.
You can show the section structure of a Texinfo file by using the
C-c C-s command (texinfo-show-structure). This command
shows the section structure of a Texinfo file by listing the lines
that begin with the @-commands for @chapter,
@section, and the like. It constructs what amounts
to a table of contents. These lines are displayed in another buffer
called the *Occur* buffer. In that buffer, you can position
the cursor over one of the lines and use the C-c C-c command
(occur-mode-goto-occurrence), to jump to the corresponding spot
in the Texinfo file.
@chapter, @section, and such lines of a
Texinfo file.
*Occur* buffer.
If you call texinfo-show-structure with a prefix argument by
typing C-u C-c C-s, it will list not only those lines with the
@-commands for @chapter, @section, and the like, but
also the @node lines. You can use texinfo-show-structure
with a prefix argument to check whether the `Next', `Previous', and `Up'
pointers of an @node line are correct.
Often, when you are working on a manual, you will be interested only
in the structure of the current chapter. In this case, you can mark
off the region of the buffer that you are interested in by using the
C-x n n (narrow-to-region) command and
texinfo-show-structure will work on only that region. To see
the whole buffer again, use C-x n w (widen).
(See Narrowing, for more
information about the narrowing commands.)
In addition to providing the texinfo-show-structure command,
Texinfo mode sets the value of the page delimiter variable to match
the chapter-level @-commands. This enables you to use the C-x
] (forward-page) and C-x [ (backward-page)
commands to move forward and backward by chapter, and to use the
C-x p (narrow-to-page) command to narrow to a chapter.
See Pages, for more information
about the page commands.
Texinfo mode provides commands for automatically creating or updating
menus and node pointers. The commands are called "update" commands
because their most frequent use is for updating a Texinfo file after you
have worked on it; but you can use them to insert the `Next',
`Previous', and `Up' pointers into an @node line that has none
and to create menus in a file that has none.
If you do not use the updating commands, you need to write menus and node pointers by hand, which is a tedious task.
You can use the updating commands to:
You can also use the commands to update all the nodes and menus in a region or in a whole Texinfo file.
The updating commands work only with conventional Texinfo files, which
are structured hierarchically like books. In such files, a structuring
command line must follow closely after each @node line, except
for the `Top' @node line. (A structuring command line is
a line beginning with @chapter, @section, or other
similar command.)
You can write the structuring command line on the line that follows
immediately after an @node line or else on the line that
follows after a single @comment line or a single
@ifinfo line. You cannot interpose more than one line between
the @node line and the structuring command line; and you may
interpose only an @comment line or an @ifinfo line.
Commands which work on a whole buffer require that the `Top' node be
followed by a node with an @chapter or equivalent-level command.
The menu updating commands will not create a main or master menu for a
Texinfo file that has only @chapter-level nodes! The menu
updating commands only create menus within nodes for lower level
nodes. To create a menu of chapters, you must provide a `Top'
node.
The menu updating commands remove menu entries that refer to other Info files since they do not refer to nodes within the current buffer. This is a deficiency. Rather than use menu entries, you can use cross references to refer to other Info files. None of the updating commands affect cross references.
Texinfo mode has five updating commands that are used most often: two
are for updating the node pointers or menu of a single node (or a
region); two are for updating every node pointer and menu in a file;
and one, the texinfo-master-menu command, is for creating a
master menu for a complete file, and optionally, for updating every
node and menu in the whole Texinfo file.
The texinfo-master-menu command is the primary command:
With an argument (prefix argument, C-u, if interactive), first create or update all the nodes and all the regular menus in the buffer before constructing the master menu. (See The Top Node and Master Menu, for more about a master menu.)
For texinfo-master-menu to work, the Texinfo file must have a
`Top' node and at least one subsequent node.
After extensively editing a Texinfo file, you can type the following:
C-u M-x texinfo-master-menu
or
C-u C-c C-u m
This updates all the nodes and menus completely and all at once.
The other major updating commands do smaller jobs and are designed for the person who updates nodes and menus as he or she writes a Texinfo file.
The commands are:
@node line preceding point). If the
@node line has pre-existing `Next', `Previous', or `Up'
pointers in it, the old pointers are removed and new ones inserted.
With an argument (prefix argument, C-u, if interactive), this command
updates all @node lines in the region (which is the text
between point and mark).
Whenever texinfo-make-menu updates an existing menu, the
descriptions from that menu are incorporated into the new menu. This
is done by copying descriptions from the existing menu to the entries
in the new menu that have the same node names. If the node names are
different, the descriptions are not copied to the new menu.
If a master menu exists, the texinfo-all-menus-update command
updates it; but the command does not create a new master menu if none
already exists. (Use the texinfo-master-menu command for
that.)
When working on a document that does not merit a master menu, you can type the following:
C-u C-c C-u C-a
or
C-u M-x texinfo-all-menus-update
This updates all the nodes and menus.
The texinfo-column-for-description variable specifies the
column to which menu descriptions are indented. By default, the value
is 32 although it is often useful to reduce it to as low as 24. You
can set the variable with the M-x edit-options command
(see Editing Variable Values) or with the M-x set-variable command (see Examining and Setting Variables).
Also, the texinfo-indent-menu-description command may be used to
indent existing menu descriptions to a specified column. Finally, if
you wish, you can use the texinfo-insert-node-lines command to
insert missing @node lines into a file. (See Other Updating Commands, for more information.)
To use the updating commands, you must organize the Texinfo file hierarchically with chapters, sections, subsections, and the like. When you construct the hierarchy of the manual, do not `jump down' more than one level at a time: you can follow the `Top' node with a chapter, but not with a section; you can follow a chapter with a section, but not with a subsection. However, you may `jump up' any number of levels at one time--for example, from a subsection to a chapter.
Each @node line, with the exception of the line for the `Top'
node, must be followed by a line with a structuring command such as
@chapter, @section, or
@unnumberedsubsec.
Each @node line/structuring-command line combination
must look either like this:
@node Comments, Minimum, Conventions, Overview
@comment node-name, next, previous, up
@section Comments
or like this (without the @comment line):
@node Comments, Minimum, Conventions, Overview
@section Comments
or like this (without the explicit node pointers):
@node Comments
@section Comments
In this example, `Comments' is the name of both the node and the
section. The next node is called `Minimum' and the previous node is
called `Conventions'. The `Comments' section is within the `Overview'
node, which is specified by the `Up' pointer. (Instead of an
@comment line, you may also write an @ifinfo line.)
If a file has a `Top' node, it must be called top or Top
and be the first node in the file.
The menu updating commands create a menu of sections within a chapter, a menu of subsections within a section, and so on. This means that you must have a `Top' node if you want a menu of chapters.
Incidentally, the makeinfo command will create an Info file for a
hierarchically organized Texinfo file that lacks `Next', `Previous' and
`Up' pointers. Thus, if you can be sure that your Texinfo file will be
formatted with makeinfo, you have no need for the update node
commands. (See Creating an Info File, for more information about
makeinfo.) However, both makeinfo and the
texinfo-format-... commands require that you insert menus in
the file.
In addition to the five major updating commands, Texinfo mode possesses several less frequently used updating commands:
@node lines before the @chapter,
@section, and other sectioning commands wherever they are
missing throughout a region in a Texinfo file.
With an argument (C-u as prefix argument, if interactive), the
texinfo-insert-node-lines command not only inserts
@node lines but also inserts the chapter or section titles as
the names of the corresponding nodes. In addition, it inserts the
titles as node names in pre-existing @node lines that lack
names. Since node names should be more concise than section or
chapter titles, you must manually edit node names so inserted.
For example, the following marks a whole buffer as a region and inserts
@node lines and titles throughout:
C-x h C-u M-x texinfo-insert-node-lines
This command inserts titles as node names in @node lines; the
texinfo-start-menu-description command (see Inserting Frequently Used Commands) inserts titles as descriptions in
menu entries, a different action. However, in both cases, you need to
edit the inserted text.
texinfo-multiple-files-update command is
described in the appendix on @include files.
texinfo-indent-menu-description command indents
every description in every menu in the region. However, this command
does not indent the second and subsequent lines of a multi-line
description.
texinfo-sequential-node-update command
sequentially updates all the nodes in the region.
Texinfo mode provides several commands for formatting part or all of a Texinfo file for Info. Often, when you are writing a document, you want to format only part of a file--that is, a region.
You can use either the texinfo-format-region or the
makeinfo-region command to format a region: