Previous: , Up: Index   [Contents][Index]


11.3 Using the idxmerge utility to merge indexes

In a large project, one may maintain and work with several FWEB files. It may be useful to produce a global index that spans all of those files. To this end, the utility idxmerge and associated LaTeX package idxmerge are supplied with the FWEB distribution.

11.3.1 Using idxmerge: Summary

As quick reference for those who have already plowed through the following details, here is a summary of the procedure. To print a stand-alone index by merging the indexes from several web sources, do the following. First, create, if necessary, a file index.tex that \inputs index.ind. Then:

fweave -XI test1.web
fweave -XI test2.web
fweave -XI test3.web

idxmerge -oindex test1.idx test2.idx test3.idx 
        % Creates index.ind and index-names.tex.
makeindex -s test1.sty index
latex index

Note the use of the ‘-XI’ option. For further background, see the previous section, Using makeindex.

11.3.2 Using idxmerge: Details

Suppose one has three files, test1.web, test2.web, and test3.web. To use idxmerge, weave each of the files separately, using the ‘-XI’ option to create test*.idx and test*.sty. Then say

idxmerge -oindex test1.idx test2.idx test3.idx

This creates two output files: index.idx, and index-names.tex. idxmerge first sorts the list of file names. It then writes one entry into index-names.tex for each file, of the form

\idxname{n}{file_namen}

This file can be \input by the \topofindex command (for an example, see the LaTeX2e package idxmerge) (supplied with the FWEB distribution) and used to create a list of the merged files.

Then it merges the \indexentry commands from each of the input files into index.idx, filling in the integer file identifier n (the position of the file in the sorted list) into the first argument of the \pg macro. One can now say

makeindex -s test1.sty index

This creates index.ind, which can be processed by, for example, a simple modification of the simple LaTeX template given above in Using makeindex. The only difference is that the package idxmerge was used; in that file, the macros \topofindex and \idxname are appropriately defined to print out a numbered list of the merged files to cross-reference into the numerical file- and page-number entries in the body of the index. Here is an example (provided in the FWEB distribution):

% index.tex --- skeleton for printing a stand-alone index.
\documentclass{article}
\usepackage{fwebmac,idxmerge}

\begin{document}

\input{\jobname.ind}

\end{document}

Previous: , Up: Index   [Contents][Index]