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


Format using tex and texindex

Format the Texinfo file with the shell command tex followed by the name of the Texinfo file. This command produces a formatted DVI file as well as several auxiliary files containing indices, cross references, etc. The DVI file (for DeVice Independent file) can be printed on a wide variety of printers.

The tex formatting command itself does not sort the indices; it writes an output file of unsorted index data. This is a misfeature of TeX. (The texi2dvi command automatically generates indices; see section Format using texi2dvi.) To generate a printed index after running the tex command, you first need a sorted index to work from. The texindex command sorts indices. (The source file `texindex.c' comes as part of the standard GNU distribution and is usually installed when Emacs is installed.)

The tex formatting command outputs unsorted index files under names that obey a standard convention. These names are the name of your main input file to the tex formatting command, with everything after the first period thrown away, and the two letter names of indices added at the end. For example, the raw index output files for the input file `foo.texinfo' would be `foo.cp', `foo.vr', `foo.fn', `foo.tp', `foo.pg' and `foo.ky'. Those are exactly the arguments to give to texindex.

Or else, you can use `??' as "wild-cards" and give the command in this form:

texindex foo.??

This command will run texindex on all the unsorted index files, including any that you have defined yourself using @defindex or @defcodeindex. (You may execute `texindex foo.??' even if there are similarly named files with two letter extensions that are not index files, such as `foo.el'. The texindex command reports but otherwise ignores such files.)

For each file specified, texindex generates a sorted index file whose name is made by appending `s' to the input file name. The @printindex command knows to look for a file of that name. texindex does not alter the raw index output file.

After you have sorted the indices, you need to rerun the tex formatting command on the Texinfo file. This regenerates a formatted DVI file with up-to-date index entries.(11)

To summarize, this is a three step process:

  1. Run the tex formatting command on the Texinfo file. This generates the formatted DVI file as well as the raw index files with two letter extensions.
  2. Run the shell command texindex on the raw index files to sort them. This creates the corresponding sorted index files.
  3. Rerun the tex formatting command on the Texinfo file. This regenerates a formatted DVI file with the index entries in the correct order. This second run also corrects the page numbers for the cross references. (The tables of contents are always correct.)

You need not run texindex each time after you run the tex formatting. If you do not, on the next run, the tex formatting command will use whatever sorted index files happen to exist from the previous use of texindex. This is usually OK while you are debugging.


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