[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Table-of-Contents and Index Generation
From: |
joerg van den hoff |
Subject: |
Re: [Groff] Table-of-Contents and Index Generation |
Date: |
Tue, 09 Mar 2004 16:16:27 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031007 |
Andrew J. Piziali wrote:
Might any of my esteemed fellow Unix text processors care to offer
some advice on generating a table-of-contents and index for a book
written using the MS macros? I suppose the ToC could be written into a
diversion from .NH/.SH wrappers but I have never attempted this. I'm
not sure how to tackle an index. The word list is easy but associating
a sequence of page numbers with each seems daunting.
Thank you in advance.
within the ms macros, you know of the existing TOC functionality via
.XS, .XE, .PX?
only problem is, in single pass you always have the TOC at the end of
the document. one crude way
to solve this, is to edit the *.dit file (manually or with a awk or perl
script)
to shift the TOC to the front in this file. probably there a better ways
to achieve this.
index: there is a macro .IX (which takes {index term} as an argument)
in the ms package which dumps pairs of {index term}/{page number} to
stderr. under some cicrumstances(I forgot which, have'nt used IX for
some time)
it might be neccessary to process the document 2 times to get an
up-to-date index list.
this list can be collected from stderr (and redirected into a text
file) and massaged into an appropriate layout afterwards (alphabetically
sorting, possibly rotation of multi word entries, 2 column layout, etc.).
when I used it in the past, I simply sorted the index file with the unix
'sort' und added a heading und 2-column mode to the file and finally
sourced the result from within the complete document. this sufficed to
produce
a useful index.
joerg