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

21.2 Format with tex/texindex

You can format the Texinfo file with the shell command tex followed by the name of the Texinfo file. For example:

tex foo.texi

TeX will produce a DVI file as well as several auxiliary files containing information for indices, cross references, etc. The DVI file (for DeVice Independent file) can be printed on virtually any device (see the following sections).

The tex formatting command itself does not sort the indices; it writes an output file of unsorted index data. 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 Texinfo distribution, among other places.) (texi2dvi runs tex and texindex as necessary.)

tex formatting command outputs unsorted index files under names that obey a standard convention: the name of your main input file with any ‘.texinfo’ (or similar, see section What a Texinfo File Must Have), followed by the two letter names of indices. 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.

Instead of specifying all the unsorted index file names explicitly, you can use ‘??’ as shell wildcards and give the command in this form:

texindex foo.??

This command will run texindex on all the unsorted index files, including any two letter indices that you have defined yourself using @defindex or @defcodeindex. You can safely run ‘texindex foo.??’ even if there are 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 looks for a file with that name (see section Printing Indices and Menus). texindex does not alter the raw index output file.

After you have sorted the indices, you need to rerun tex on the Texinfo file. This regenerates the DVI file, this time with up-to-date index entries.

Finally, you may need to run tex one more time, to get the page numbers in the cross references correct.

To summarize, this is a five step process:

  1. Run tex on your Texinfo file. This generates a DVI file (with undefined cross references and no indices), and the raw index files (with two letter extensions).
  2. Run texindex on the raw index files. This creates the corresponding sorted index files (with three letter extensions).
  3. Run tex again on your Texinfo file. This regenerates the DVI file, this time with indices and defined cross references, but with page numbers for the cross references from the previous run, generally incorrect.
  4. Sort the indices again, with texindex.
  5. Run tex one last time. This time the correct page numbers are written for the cross references.

Alternatively, it’s a one-step process: run texi2dvi (see section Format with texi2dvi).

You need not run texindex each time after you run tex. 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.

Sometimes you may wish to print a document while you know it is incomplete, or to print just one chapter of a document. In that case, the usual auxiliary files that TeX creates and warnings TeX gives when cross references are not satisfied are just nuisances. You can avoid them with the @novalidate command, which you must give before the @setfilename command (see section @setfilename: Set the Output File Name). Thus, the beginning of your file would look approximately like this:

\input texinfo
@novalidate
@setfilename myfile.info
…

@novalidate also turns off validation in makeinfo, just like its --no-validate option (see section Pointer Validation).


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

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

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.