[comp.text] troff indexes

ao06+@andrew.cmu.edu (Ayami Ogura) (08/05/87)

Has anybody out there ever created an index with troff?  Or had success using
the ptx program?

kathy@bakerst.UUCP (Kathy Vincent) (08/07/87)

In article <MV5siey00Vs6c7E0Nt@andrew.cmu.edu> ao06+@andrew.cmu.edu.UUCP writes:
>
>Has anybody out there ever created an index with troff?  Or had success using
>the ptx program?


I don't know anything about ptx, and I have not personally made
an index with troff, but people in my group do it all the time.

But.  If you're looking for a method, one way is to create a macro
that will collect an indexing key or keys and the current page number.
At any given point in the text, say you want to create an index 
entry for some information about - let's be original here -
indexing macros.  You could have one macro that takes multiple keys
or use more than one macro call for each (using mm):

	.P
	Lots of interesting
	text about indexing macros.
	.Ix indexing \nP
	.Ix macros \nP
	.Ix "indexing macros" \nP
	More text about other stuff.

The macro code involves reading the arguments to the macro and popping
the key and the page number into a diversion that can then be printed
out and used later to make the index.  You may also be able to
dump directly into a file.

I don't know of a method off hand - a GOOD and USEFUL indexing
method - that can be done in that one step, though.  You'll
end up having to do some sorting and arranging and reformatting
from that raw information, grouping items under major indexing
headings and so forth.

Forget permuted indexes.  They are convenient only for the people
making the index.  They are of limited or no usefulness to people
who really need to find information.


Kathy Vincent                          kathy@bakerst.UUCP
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Home:     {ihnp4|mtune|ptsfa} _____
        {hplabs|seismo}!kitty _____\__ !bakerst!kathy
            {mcnc|duke}!ethos _____/
AT&T:  ihnp4!wruxe!unix
       {mtune|burl|ihnp4}!wrcola!kathy

kathy@bakerst.UUCP (Kathy Vincent) (08/07/87)

In article <834@bakerst.UUCP> I wrote:
>
>	.Ix indexing \nP
>

Amendment:  To my own comments about indexing macros ...  
You don't need to include the \nP .  Your macro definition
should pick up the current page number.


Kathy                                  kathy@bakerst.UUCP
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
         {ihnp4|mtune|ptsfa} _____
       {hplabs|seismo}!kitty _____\__ !bakerst!kathy
           {mcnc|duke}!ethos _____/

andy@ist.UUCP (Andy Greener) (08/07/87)

In article <MV5siey00Vs6c7E0Nt@andrew.cmu.edu>, ao06+@andrew.cmu.edu (Ayami Ogura) writes:
> 
> Has anybody out there ever created an index with troff?  Or had success using
> the ptx program?

I wrote a filter a while back to post process ditroff output to generate
a list of words and page numbers, and optionally the original font
as specified in the input text. This can then be further massaged
as you please to generate an index. Doing it this way gets you the
actual page number for each word, and includes words from pic input,
tables, etc. It is also independent of any particular macro package.

However, the technical author for whom I did this felt that this
approach generated very "noisy" indexes, even when we went to the
trouble of "intelligently" filtering this output to concatenate words
into phrases and suppress common words. He finally opted for marked-up
index entries appearing explicitly in the input text along with
keywords from titles, glossary entries, etc (this was in a home-grown
macro package so I had control over these things).

I tend to agree with him. Its very difficult, if not impossible, to
generate a useful index totally automatically, but it's helpful
if you've got some automated support.

Thus the indexing filter lies unused somewhere in my archives, but if
anyone desperately wants it I expect I could revive it.

	Andy Greener			Imperial Software Technology
					London, England.

					andy@ist.co.uk
					..mcvax!ukc!ist!andy

+================================================================+
|You can always tell when politicians are lying - their lips move|
+================================================================+

tim@ora.UUCP (Tim O'Reilly) (08/10/87)

In article <MV5siey00Vs6c7E0Nt@andrew.cmu.edu>, ao06+@andrew.cmu.edu (Ayami Ogura) writes:
> 
> Has anybody out there ever created an index with troff?  Or had success using
> the ptx program?

In our book, UNIX Text Processing, (Hayden Books/Howard
Sams, April 1987), Dale Dougherty and I discuss this topic
in detail.  You can write a macro that prints out an index
entry plus a page number; this data can either be collected
into a diversion, or preferably written to stderr with the
.tm request (in otroff or ditroff) or directly into a file
with .sy echo (ditroff only).

This file can be postprocessed with sort, awk and sed to combine
multiple entries, and to format the index properly.

Ptx is not all that useful, but if you need to make one, you
need it.  The process is too long to go into here (since I'm
reading news early one morning over a long-distance phone
link while ostensibly on vacation), but if
you send me mail, I'll send you out details when I get back
to the office in a couple of weeks.  

If there is sufficient interest, I'll post the discussion to
the net.  (Note:  ptx is not covered in our book.  Sorry.)
-- 
Tim O'Reilly (617) 527-4210
O'Reilly & Associates, Inc., Publishers of Nutshell Handbooks
981 Chestnut Street, Newton, MA 02164
UUCP:	seismo!uunet!ora!tim      ARPA:   tim@ora.uu.net

rab@munnari.oz (Rainer Berger) (08/13/87)

In article <MV5siey00Vs6c7E0Nt@andrew.cmu.edu>, andrew.cmu.edu (Ayami Ogura) writes:
> 
> Has anybody out there ever created an index with troff?  Or had success using
> the ptx program?



	I have seen a copy of a technical report published by AT&T on 
	creating indexes using troff. The reference is:

                    "Tools for Printing Indexes"
		Jon L. Bentley and Brian W. Kernighan
		       AT&T Bell Laboratories
		    Murray Hill, New Jersey 07974
			  October 1986

	Sorry, but I don't have the technical report number.

	The report contains a few macro definitions and quite a few 
	awk scripts which come in useful for creating indexes.

===========================
UUCP:	{seismo,mcvax,ukc,ubc-vision}!munnari!rab
ARPA:	rab%mulga.oz@seismo.css.gov
CSNET:	rab%mulga.oz@australia