latexidx.icn: Program to process LaTeX idx file

April 19, 1989; David S. Cargo
This file is in the public domain.
 Input:

    A latex .idx file containing the \indexentry lines.

 Output:

    \item lines sorted in order by entry value,
 with page references put into sorted order.

Processing:

    While lines are available from standard input
        Read a line containing an \indexentry
        Form a sort key for the indexentry
        If there is no table entry for it
        Then create a subtable for it and assign it an initial value
        If there is a table entry for it,
        But not an subtable entry for the actual indexentry
        Then create an initial page number set for it
        Otherwise add the page number to the corresponding page number set
   Sort the table of subtables by sort key value
   For all subtables in the sorted list
        Sort the subtables by indexentry values
        For all the indexentries in the resulting list
            Sort the set of page references
            Write an \item entry for each indexentry and the page references

 Limitations:

    Length of index handled depends on implementation limits of memory alloc.
 Page numbers must be integers (no roman numerals).  Sort key formed by
 mapping to lower case and removing leading articles (a separate function
 is used to produce the sort key, simplifying customization) -- otherwise
 sorting is done in ASCII order.

Source code | Program Library Page | Icon Home Page