[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Table-of-Contents and Index Generation

From: Jon Snader
Subject: Re: [Groff] Table-of-Contents and Index Generation
Date: Tue, 9 Mar 2004 09:13:18 -0500
User-agent: Mutt/

On Mon, Mar 08, 2004 at 04:20:23PM -0600, 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.

I've found it's best to avoid trying to automate these things with
diversions.  Instead, I use some tricks I learned from Rich Stevens.
For TOC I have my chapter and section macros write a line to stderr
using the .tm command.  For example, my chapter macro outputs a line
of the form:
    ch:<tab><chapter number><tab><chapter title><tab><page>
I collect these lines in a file and postprocess them with an AWK
script that generates troff source for the TOC.

The hard part of indexing is marking up your text.  Once that's done,
I use Brian Kernighan's indexing tools (available on his web site
<>) to actually type-
set the index.  The tools are described in Bentley and Kernighan's
paper CSTR #128 <>.

Finally, you might want to check out Rich Stevens' page on how he
typeset his books--it's got a wealth of information.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]