Path: utzoo!attcan!utgpu!watmath!iuvax!rutgers!cmcl2!esquire!yost From: yost@esquire.UUCP (David A. Yost) Newsgroups: comp.text Subject: Re: page numbering between chapters in nroff Message-ID: <1387@esquire.UUCP> Date: 31 Aug 89 14:38:55 GMT References: <5689@ttidca.TTI.COM> <124007@sun.Eng.Sun.COM> Reply-To: yost@esquire.DPW.COM (David A. Yost) Organization: DP&W, New York, NY Lines: 54 In article <5689@ttidca.TTI.COM>, kevin@ttidca.TTI.COM (Kevin Carothers) writes: > > I have a very large document, consisting of multiple > chapters, and I would like to pass the ending page from > the previous chapter to the first page of the next > chapter (plus 1, of course). I don't have my solution online, but it's one of the few things I ever did with troff that was easier than I thought it would be, in fact much easier. * Make a directory called pn for page number files * Make a file called pn/ch1.end. * Link it to pn/ch2.begin. * At the end of chapter one, .tm or .sy out the chapter number into pn/ch1.end. * At the beginning of chapter 2, .so pn/ch2.begin. Why the tricky linking, you ask. For full automation. You want to simply call .BEGIN_FILE at the beginning of the file, and .END_FILE at the end, without hard coding the file's name in itself (why worry about editing the file just because you've changed its name.) When your makefile runs troff, it sets a string variable to the filename, so those macros can do their work with the appropriate external files. Now make a master file containing the names of the source files in the order they appear in the book, then write a shell script that ensures that the right pn files exist and that they are properly linked. .PUTREF refs In a similar vein, it is amazingly easy to do page-numbered cross references in troff (see p. \ .GETREF refs ). You pick a name for each reference target, and you have at least two macros, one that outputs the current page number to a file of that name and another that reads the page number in. Now the trick is to take the time to learn TeX and apply all this technology to that environment so I never have to touch troff again. --dave yost