71.3 Indexes


Listing
Fonts
Hypertext Tags

<..th4 indexes..>
 \:CheckOption{index} \if:Option
    <.indexes.>
 \fi
 -_-_-

An entry takes the form ‘\--#1/#2/#3/’. The first parameter ‘#1’ is the major entry, the second parameter ‘#2’ is the secodary entry, and the third parameter ‘#3’ is a range entry (empty, the character ‘<’, or the character ‘>’).

The current approach is a variant of the definition in section 17.8 of Writing with TeX. It uses a direct approach in which the full entries and subentries are recorded at each location, and so eliminating the need for the <tag>. It also eliminates the format entry, but one can always merge this entry into the range entry by employing an appropriate encoding scheme.

<..indexes..>
 \let\mi:nus=\-
 \def\-{\futurelet\:temp\:idxentry}
 \def\:idxentry{\ifx \:temp- \expandafter\:addidx
    \else\expandafter\mi:nus\fi}
 \def\:addidx-#1/#2/#3/{{\def\:ii{#2}%
    <.html index target.>%
    \ifx\:ii\empty
       \edef\:temp{\write\:idx{\string\--{#1}{ }{#3}%
         {<.html index source.>}\relax}}%
    \else
       \edef\:temp{\write\:idx{\string\--{#1}{#2}{#3}%
         {<.html index source.>}\relax}}%
    \fi  \:temp}}
 -_-_-

The relax at the end of each line is a ‘comment’ for eliminating the spaces at the end of the lines.

<..indexes..>+
 \csname newwrite\endcsname\:idx
 \openout\:idx=\jobname.idx
 -_-_-