[Replying to his message, I had mailed Jon directly instead of the groff list. With his permission, I'm posting his reply here.]
> > > I do exactly what Werner is suggesting for my TOC, and it > > > works out very well. My chapter and section macros write out > > > title and page information to a file. This file is processed > > > by a script to generate exactly the type of TOC needed for > > > the document in question (rather than a one type fits all). > > > This does, of course, take two passes, but so what? The > > > whole thing is controlled by a makefile so I just type ``make > > > book'' and everything is taken care of automagically. I also > > > generate cross references in a similar way, so I need a total > > > of 3 passes, but typesetting a 450 page book takes less than > > > 30 seconds. > > > > I assume if you handled TOC entries similar to cross-references > > (with .write instead of with .tm) you would in general also > > need only two passes instead of three. Correct? > > Probably not. In the first pass, I collect all the cross > references. There will be forward references, so I need to > collect them all before I can substitute the actual reference for > the marker. Notice that the pagination may change due to this > substitution. In the second pass, I collect the pagination > information for the TOC (as well as data for index and running > heads). Between the second and third pass, troff input is > generated for the TOC. On the third pass, the TOC is added to > the front of the text, and the final typesetting is completed. > > > Why are you processing the TOC file by an external script > > instead of using different TOC formatting macros when reading > > the file? (Barring, of course, things like sorting that you > > would need for an index but not normally for a TOC.) > > Well, I'm a programmer, so it's a natural thing for me to do. > Actually, I often generate troff input programmatically on the > fly, so I just did it without thinking. I *could* output macros > and then change their definition for different types of TOC, but > this seems marginally harder to me. Besides, I use that chapter > and section data to generate the running heads, so it's > convenient to just have entries of the form: > > ch: 1 Introduction 3 > > > By the way, how are all you ms, me, and mm users currently > > handling forward cross-references? > > For what it's worth, I use ms, but have additional macros that > handle chapter and section headings and all the rest. _______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff