bob@brspyr1.BRS.Com (Bob Armao) (10/03/88)
We use nroff with our own customized macros to construct and format a permuted index -- similar to that appearing in standard UNIX manuals. Essentially, we create the index from words appearing in section headings, sub-section headings, etc. This works nicely from the production point of view, but the index is not as comprehensive, usable, or attractive as it should be. I'm looking for an approach (public domain or otherwise) that will enable us to produce a more traditional-looking and effective index. For now we have to live within the restrictions of nroff and family. Any ideas or leads out there? Thanks in advance. -- Bob Armao (bob@brspyr1) | If u cn rd ths sgntr, UUCP: ihnp4!dartvax!brspyr1!bob | u cn mk Bg $$ induh xitng BRS Information Technologies | wrld ov dkumntshun. Phone: (518) 783-1161 |--------------------------------------
jpr@dasys1.UUCP (Jean-Pierre Radley) (10/05/88)
In article <4597@brspyr1.BRS.Com> bob@brspyr1.BRS.Com (Bob Armao) writes: >We use nroff with our own customized macros to construct and format a >permuted index... > >I'm looking for an approach (public domain or otherwise) that will >enable us to produce a more traditional-looking and effective index. >For now we have to live within the restrictions of nroff and family. S.R.Bourne (author of /bin/sh) in his book "The Unix Shell", published by International Computer Science Series, ISBN 0-201-13791-7, might have what you want on pages 171-175. I've elaborated on what he did a bit, and I get very nice indices. Generally speaking, you insert a macro with index words here and there in your text. This gets printed with '.tm' to stderr diverted to a file which is later processed by sed, sort, tbl, and nroff. -- Time is nature's way of Jean-Pierre Radley making sure that everything jpr@dasys1.UUCP doesn't happen all at once. CIS: 76120,1341
wnp@dcs.UUCP (Wolf N. Paul) (10/06/88)
In article <6829@dasys1.UUCP> jpr@dasys1.UUCP (Jean-Pierre Radley) writes: >S.R.Bourne (author of /bin/sh) in his book "The Unix Shell", published by >International Computer Science Series, ISBN 0-201-13791-7, might have >what you want on pages 171-175. I've elaborated on what he did a bit, >and I get very nice indices. Why don't you post your elaborations for all of us to benefit :-) Thanks in advance! -- Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101 UUCP: killer!dcs!wnp ESL: 62832882 DOMAIN: dcs!wnp@killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD
jpr@dasys1.UUCP (Jean-Pierre Radley) (10/18/88)
In article <4597@brspyr1.BRS.Com> bob@brspyr1.BRS.Com (Bob Armao) writes: > We use nroff with our own customized macros to construct and > format a permuted index... > > I'm looking for an approach (public domain or otherwise) that > will enable us to produce a more traditional-looking and > effective index. For now we have to live within the > restrictions of nroff and family. Apologies to all if I am double-posting this, but I am still a bit of a novice at netnews... Here is how I handle indexing from nroff sources. The scheme is originally described in Bourne's "The UNIX System". I define these two macros and include them in a file .macros (along with other macros pertinent to the project at hand): .deIX \" index macro .tm \\$1\a.. \\n(H1-\\nP .. .deCX \" choose index item macro .IX "\\$1, \\$2" .IX "\\$2, \\$1" The first line in each source file is: .if!\w@\*(tL@ .so .macros This shell script (where <TAB> is shown here in place of the actual tab character itself, i.e. hex 09) assembles all my chapters: : broff # run files through nroff with jpr's mm macros to # `book', including index at end nroff -rO0 -rW64 -mmjpr ch.* > .book 2> .index sed " s/.*/&~+~&/ :repeat s/\\\\[fs][+-]*.\(.*~+~\)/\1/ t repeat " .index | sort -fd | sed "s/.*~+~//" | awk ' BEGIN { print ".af P a" print ".PH @@\fBINDEX\fR@@" print ".PF @@\\\\\\\\nP@@" print ".TS" print "l r." print } { print } END { print ".TE" } ' | tbl | nroff -rO0 -rW64 -mmjpr >> .book sed " s/^\(.\)/<TAB>\1/ :spc2tab s/<TAB> /<TAB><TAB>/ t spc2tab " .book > book rm .book .index At any place in the source file where I judge an index reference would be useful, I imbed a call to the CX macro. Here's a fragment from one of my source files: .P In that case why have to refer to the files on that drive as "/hdN/appl/.../.../..."? Why not dispense with the "/hdN" part? .CX "/appl" "changing /hdN to" .CX "/hdN" "changing to /appl" .P .I Case 1: Changing mount directory /hdN to /appl .R The .index file will have in it (where <SOH> represents ^A, hex 01): \fB/etc/default/pfpath\fR, secondary drive name<SOH>.. 1-4 secondary drive name, \fB/etc/default/pfpath\fR<SOH>.. 1-4 /appl, changing /hdN to<SOH>.. 1-4 changing /hdN to, /appl<SOH>.. 1-4 /hdN, changing to /appl<SOH>.. 1-4 changing to /appl, /hdN<SOH>.. 1-4 tar, moving hierarchies<SOH>.. 1-4 moving hierarchies, tar<SOH>.. 1-4 which are various index references I have created. As the source is being formatted, these entries get created with the chapter number (1), and with the output page number (4) within that chapter. Finally, all the chapters are assembled into one file, at the end of which appear these fragments: 512 bytes, blocking....................................... 1-6 /appl, changing /hdN to................................... 1-4 background processes, wait................................ 7-4 .... blocking, key segment..................................... 1-7 changing /hdN to, /appl................................... 1-4 changing to /appl, /hdN................................... 1-4 ... fortune cookies, /etc/rc.user............................. 1-5 /hdN, changing to /appl................................... 1-4 index, 13-byte overhead................................... 3-7 ... Should any of the arguments to .CX contain font-change stuff, this will carry through to the final index. In the actual case, I have /etc/rc.user in boldface in the final text, and in the index as well. -- Time is nature's way of Jean-Pierre Radley making sure that everything jpr@dasys1.UUCP doesn't happen all at once. CIS: 76120,1341