1 % indexes document style option for producing multiple indexes 2 % for use with the modified bbok style, CHbook.sty 3 % Written by F.W. Long, Version 1.1, 12 August 1991. 4 5 % Modified by F.W. Long, Version 1.1a, 29 August 1991 6 % to get the index heading correctly spaced. 7 8 % Modified by F.W. Long, Version 1.1b, 31 August 1991 9 % to remove the abbreviation \ix (which should be in the document, not here). 10 11 % Modified \makeindex and \index commands to allow multiple indexes 12 % in both cases the first parameter is the index name. 13 % They now work more like \@starttoc and \addcontentsline. 14 % \index is no longer defined inside \makeindex but determines 15 % whether the appropriate file is defined before writing to it. 16 17 \def\makeindex#1{\begingroup 18 \makeatletter 19 \if@filesw \expandafter\newwrite\csname #1@idxfile\endcsname 20 \expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax 21 \typeout{Writing index file #1.idx }\fi \endgroup} 22 23 \def\index#1{\@bsphack\begingroup 24 \def\protect##1{\string##1\space}\@sanitize 25 \@wrindex{#1}} 26 27 % \@wrindex now checks that the appropriate file is defined. 28 29 \def\@wrindex#1#2{\let\thepage\relax 30 \xdef\@gtempa{\@ifundefined{#1@idxfile}{}{\expandafter 31 \write\csname #1@idxfile\endcsname{\string 32 \indexentry{#2}{\thepage}}}}\endgroup\@gtempa 33 \if@nobreak \ifvmode\nobreak\fi\fi\@esphack} 34 35 % Modified \printindex command to allow multiple indexes. 36 % This now takes over much of the work of \theindex. 37 % Again, the first parameter is the index name. 38 % The second parameter is the index title (as printed). 39 40 \newif\if@restonecol 41 \def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi 42 \columnseprule \z@ \columnsep 35pt 43 \newpage \twocolumn[{\Large\bf #2 \vskip4ex}] 44 \markright{\uppercase{#2}} 45 \addcontentsline{toc}{section}{#2} 46 \@input{#1.ind}} 47 48 % The following index commands are taken from book.sty. 49 % \theindex is modified to not start a chapter. 50 51 \def\theindex{\parindent\z@ 52 \parskip\z@ plus .3pt\relax\let\item\@idxitem} 53 \def\@idxitem{\par\hangindent 40pt} 54 \def\subitem{\par\hangindent 40pt \hspace*{20pt}} 55 \def\subsubitem{\par\hangindent 40pt \hspace*{30pt}} 56 \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi} 57 \def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax} 58 59 % the command \ix allows an abbreviation for the general index 60 61 %\def\ix#1{#1\index{general}{#1}} 62 63 % define the \see command from makeidx.sty 64 65 \def\see#1#2{{\em see\/} #1} 66