trt@rti-sel.UUCP (Tom Truscott) (08/08/85)
Has anyone added the ability to 'index' a troff document? The '-me' package includes the .(x ... .)x table of contents generator, but it does not sort the table or permit multi-level index entries. Other text processing packages such as 'SCRIPT' do provide these capabilities. 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 If someone has something like this please let me know, otherwise I am going to have to write one. Tom Truscott
lj@ewj01.UUCP (Leonard Jacobs) (08/13/85)
> 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