In this approach, each command that marks an index term defines a unique
destination and passes its label on to the .idx file as part of
the \indexentry command. The \indexentry line that Eplain
writes to the .idx file becomes
\indexentry{entry|hlidx{label}{cs}}{pageno}
where \hlidx is the command that is defined by Eplain
to take three arguments: a hyperlink label (label), a name of
page number encapsulator (cs) and a page number (pageno).
In the .ind file that MakeIndex will generate, the page number
will now appear as
\hlidx{label}{cs}{pageno}
The result of this command is
\cs{pageno}, wrapped up into a link pointing to
label destination.
The hyperlink labels for the index terms are generated by the
\hlidxlabel command, by default in the format
`IDXnumber', where number is the value of the count
register
\hlidxlabelnumber. This count register is incremented at each
index term.
The advantage of this approach, as compared to the second approach
described below, is that links in the index point to exact locations of
the indexed terms on the page. The disadvantage of this approach is
that MakeIndex will regard all index entries as distinct, because
each one contains a (unique) hyperlink label. This disadvantage can be
partially overcome by the script
idxuniq distributed with Eplain in the util directory.
This script filters out \indexentry lines differing only in the
hyperlink label but identical otherwise. You should process the
.idx with this script before passing it on to MakeIndex. For
example:
prompt$ ./idxuniq file.idx | makeindex > file.ind
Still, this solution is not ideal, as the page-range formation ability of MakeIndex will not work, and there will be problems of apparently identical index entries clashing (e.g., when a range-end entry appears on the same page as another entry with the same definition; idxuniq will not filter out the second entry).