Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site ewj01.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!harvard!bbnccv!ewj01!lj
From: lj@ewj01.UUCP (Leonard Jacobs)
Newsgroups: net.text
Subject: Re: Building an Index with Troff
Message-ID: <179@ewj01.UUCP>
Date: Mon, 12-Aug-85 21:01:32 EDT
Article-I.D.: ewj01.179
Posted: Mon Aug 12 21:01:32 1985
Date-Received: Thu, 15-Aug-85 00:22:50 EDT
References: <335@rti-sel.UUCP>
Distribution: net
Organization: East West Journal, Brookline, Mass.
Lines: 35

> Has anyone added the ability to 'index' a troff document?
> For example, here is an indexing example from the 'SCRIPT' manual:
> 
> 	Sentence in which cats
> 	.ix cats
> 	are mentioned in general terms. ...
> 	Sentence in which Siamese cats
> 	.ix cats Thai
> 	are discussed. ...
> 	.ix cats . 'see also "felines"'
> 
> 
> The index would appear as:
> 
> 	cats, 5, see also "felines"
> 	    Thai, 37

Try using a macro something like the following, .IX instead of .ix. 

.de IX
.tm IX|\\$1|\\$2|\\$3|\\$4|\\$5|\\$6|\\$7|\\$8|\\$9|\\n%
..

As you run troff, .tm's will produce error output which can be redirected
to another file.  The n% will give you the page number.  You then need
some awk/sort filter to create the page you want.  It is also possible
to use an awk script to insert all the .IX's on the lines which have the
words you want indexed so you do not have to do this by hand.  
The trick would be in finding all the topics and subjects you want
indexed without giving the complete list of words needed.
-- 

	Len Jacobs
	East West Journal
	harvard!bbnccv!ewj01!lj