[comp.text] Indexing in TeX?

mao@blipyramid.UUCP (01/27/87)

i've yet to see one issue addressed in the discussion of relative merits
between tex and various roff packages.  does tex make any provision for the
generation of a sorted index of terms?  we've managed to provide automatic
indexing under ditroff -- a writer flags a term to be indexed with a special
macro, and it's saved until the end of the document.  all terms are sorted
alphabetically, and the list (with page numbers) is printed separately.  the
actual processing path is convoluted, and involves bourne shell scripts,
stderr redirection, troff postprocessors...  but it works.

is it easier to generate an index in tex?

					mike olson
					britton lee inc.

jon@gaia.UUCP (01/29/87)

mao@blipyramid.BLI.COM (Mike Olson):
> does tex make any provision for the
>generation of a sorted index of terms?

Generating indexes in TeX is a royal pain.  Knuth doesn't like automatic
index generation.  Somewhere deep in the TeXbook, he talks about how he likes
to do them by hand, after the book is done.  He claims it helps him produce
good indexes.  Having spent massive amounts of time trying to find things
in the TeXbook, I disagree with him.

RMS put together a nice index package that he used to typeset the GNU
emacs manual.  The process that one ends up with is (1) run TeX, generating
a raw index file, (2) run "texindex" on that file, which sorts the entries,
and puts multiple entries together, and (3) run TeX again with the sorted
file.

There is also apparently an index scheme in the first issue of TUGboat, but
I haven't seen it.

-- 
Jonathan Corbet
{hao | nbires}!gaia!jon

pwp@iuvax.UUCP (01/29/87)

I wrote my book with Cynthia Brown, The Analysis of Algorithms, with
TeX and used automated assistance with indexing. I wrote three macros
that did the following:
1. Put the item in the text and in the index.
2. Put the item in the text in italic type and in the index (in Roman) ---
   useful for definitions.
3. Put the item in the index but not in the text --- useful for putting
   full names in the index and last names in the text.
These macros wrote an indexing macro,
the item, and the page number to a file. The item could
have special punctation to indicate main item and subitem. The file was next
merged with a file of entries that did not appear in the text (such as
``Difference equation, see Recurrence equation''). This file was sorted
with the unix sort command. The sorted file was printed by TeX. The indexing
macros took care of the problem of formating the index entry, so that
multiple references to the same item would appear in the index as one
entry with multiple page numbers.

In addition, it was possible to print proof pages with the index items for
the page in the margin of the upper outside courner. Most of these techniques
were originally developed by Knuth, but after seeing one of his pages I was
able to reproduce them with just a day or two of work. My friends use these
macros with no trouble.

kuo@skatter.UUCP (02/02/87)

In article <13@blipyramid.BLI.COM>, mao@blipyramid.BLI.COM (Mike Olson) writes:
> 
> is it easier to generate an index in tex?
> 
Plain TeX does not allow you to do "high" lebel stuff like that. But the
LaTeX macro package does. It also numbers your references automatically
(if you set it up that way) so when you insert/delete a reference, you don't
have to manually re-number; I think this is also done with troff but I am not
sure. ... it is hard to learn troff once you become a 0.5-TeXpert (8-)

... Peter/
uucp: {ihnp4, alberta}!sask!skatter!kuo

kjp@well.UUCP (02/02/87)

I've been working at software and hardware houses that have to get
out indexed books, often very quickly after the product is finalized,
anl the indexing capabilities made possible by combining the tm command
in troff with other utilities remove 99% of the last-minute insanity
from this process.  At my most recent job, I reworked an exisiting
awk script that did 2-level indexes into a 3-level indexer.  Unless/until
TeX can manage this, these people are not going to switch!

ken@rochester.UUCP (02/03/87)

If you look at at pages 77 and 78 of the LaTeX book, you will see how
index entries are specified in LaTeX. As the book says, you need an
auxiliary program to generate the index from the .idx file. There are
several freebies around.

	Ken