multind.sty 2.4 KB

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