1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
%%% ====================================================================
%%% @LaTeX-file{
%%% filename = "amsmidx.dtx",
%%% version = "2.01",
%%% date = "2004/08/03",
%%% time = "14:45:42 EDT",
%%% checksum = "63234 241 948 8307",
%%% author = "American Mathematical Society",
%%% copyright = "Copyright 1995, 2004 American Mathematical Society,
%%% all rights reserved. Copying of this file is
%%% authorized only if either:
%%% (1) you make absolutely no changes to your copy,
%%% including name; OR
%%% (2) if you do make changes, you first rename it
%%% to some other name.",
%%% address = "American Mathematical Society,
%%% Technical Support,
%%% Publications Technical Group,
%%% 201 Charles Street,
%%% Providence, RI 02904,
%%% USA",
%%% telephone = "401-455-4080 or (in the USA and Canada)
%%% 800-321-4AMS (321-4267)",
%%% FAX = "401-331-3842",
%%% email = "tech-support@ams.org (Internet)",
%%% codetable = "ISO/ASCII",
%%% keywords = "latex, amslatex, multiple indexes",
%%% supported = "yes",
%%% abstract = "This is part of the AMS-\LaTeX{} distribution.
%%% It contains code to support the creation and
%%% typesetting of multiple indexes with AMS-LaTeX{}
%%% document classes, superseding the single-index
%%% facilities built into those document classes.
%%% It also provides a facility to insert a paragraph
%%% of comments between the title and the index proper",
%%% docstring = "The checksum field above contains a CRC-16
%%% checksum as the first value, followed by the
%%% equivalent of the standard UNIX wc (word
%%% count) utility output of lines, words, and
%%% characters. This is produced by Robert
%%% Solovay's checksum utility.",
%%% }
%%% ====================================================================
% \iffalse
%<*driver>
\documentclass{amsdtx}
\begin{document}
\title{The \pkg{amsmidx} package}
\author{American Mathematical Society\\Barbara Beeton}
\date{Version \fileversion, \filedate}
\hDocInput{amsmidx.dtx}
\end{document}
%</driver>
% \fi
%
% \maketitle
%
% \MakeShortVerb\|
%
% \section{Introduction}
%
% This package provides the facility to produce multiple indexes
% with \amslatex/ document classes (particularly \fn{amsbook} and
% the AMS author packages for books), superseding the built-in
% index facility which can accommodate only one index. This may
% in the future be incorporated as an option into the \amslatex/
% document classes.
%
% This package is based on \pkg{multind.sty} by F.W. Long.
%
% \StopEventually{}
%
% Standard file identification.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{amsmidx}[2004/08/03 v2.01 multiple indexes for AMS classes]
% \end{macrocode}
%
% \section{User instructions}
%
% In the preamble, invoke \cn{makeindex} with a file name to provide
% as many indexes as desired:
%\begin{verbatim}
% \makeindex{filename-a}
% \makeindex{filename-b}
%\end{verbatim}
% This will initiate the creation of \fn{filename-a.idx} etc.
%
% In the body of the text, use the \cn{index} command with two
% arguments
%\begin{verbatim}
% \index{filename-a}{index term}
%\end{verbatim}
% as appropriate to populate the \fn{.idx} files.
%
% In the \cn{backmatter} segment of the driver file, insert the
% \cn{Printendex} command to print the indexes; the second argument
% gives the title to be printed at the top of the index:
%\begin{verbatim}
% \Printindex{filename-a}{First Index}
% \Printindex{filename-b}{Second Index}
%\end{verbatim}
%
% On the first pass, the \fn{.idx} files will be created. Process
% each \fn{.idx} file with \textit{MakeIndex} to generate an \fn{.ind}
% file, which will then be read in by \cn{Printindex}. Whenever any
% page references change, be sure to run \textit{MakeIndex} again,
% and process the entire job with \latex/ once more to get the correct
% page references in the indexes.
%
% To include a paragraph of comments below the index title, insert
% the text as an \cn{indexcomment} before the relevant \cn{Printindex}:
%\begin{verbatim}
% \indexcomment{Text of comments}
% \Printindex{...}{...}
%\end{verbatim}
% The \cn{indexcomment} text will be cleared after use.
%
%
% \section{Implementation}
%
% \begin{macro}{makeindex}
% Redefine \cn{makeindex} to create a new \fn{.idx} file with the
% name provided by argument |#1|.
% \begin{macrocode}
\renewcommand{\makeindex}[1]{%
\begingroup
\makeatletter
\if@filesw \expandafter\newwrite\csname #1@idxfile\endcsname
\expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax
\typeout{Writing index file #1.idx }\fi
\endgroup}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{index}
% Redefine \cn{index} to specify into which file/index the term is
% to be placed. Argument |#1| identifies the file, |#2| provides
% the text of the term to be indexed.
% \begin{macrocode}
\renewcommand{\index}[1]{%
\@bsphack
\begingroup
\def\protect##1{\string##1\space}\@sanitize\@wrindex{#1}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{@wrindex}
% \cs{@wrindex} checks to make sure that the requested file is available,
% and writes an entry into the file or emits an error message.
% \begin{macrocode}
\renewcommand{\@wrindex}[2]{%
\let\thepage\relax
\xdef\@gtempa{%
\@ifundefined{#1@idxfile}{%
\PackageError{\@packagename}{%
The requested file, #1@idxfile.idx, does not exist;\MessageBreak
index term #2 will not be be written out.%
}%
}{%
\expandafter\write\csname #1@idxfile\endcsname
{\string\indexentry{#2}{\thepage}}%
}%
}%
\endgroup\@gtempa
\if@nobreak \ifvmode\nobreak\fi\fi
\@esphack
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{printindex}
% \begin{macro}{Printindex}
% Redefine \cs{printindex} to specify the file to be included; provide
% an alternate command \cs{Printindex} that specifies both the file and
% the index title to be printed. Argument |#1| identifies the file,
% |#2| provides the title. Also modify some formatting commands to
% improve the appearance of index entries, especially long ones in
% the presence of three index levels.
% \begin{macrocode}
\renewcommand{\printindex}[1]{\@input{#1.ind}}
\newcommand{\Printindex}[2]{%
\begingroup
\cleardoublepage
\def\indexname{#2}%
\raggedright
\hyphenpenalty=10000
\renewcommand{\seename}{see~also}
\renewcommand{\subitem}{\par\hangindent 3em\hspace*{1em}}
\@input{#1.ind}%
\endgroup
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{indexcomment}
% \begin{macro}{indexchap}
% Format comments in a block somewhat narrower than the full page
% width, and redefine \cn{indexchap} to insert the block below the
% title, before starting the two-column index. Clear out
% \cs{indexcomment} after use.
% \begin{macrocode}
\newdimen\@indexcommentwidth
\@indexcommentwidth=\textwidth
\ifdim\@indexcommentwidth > 26pc
\advance\@indexcommentwidth-6pc
\else
\advance\@indexcommentwidth-4pc
\fi
\newcommand{\indexcomment}[1]{%
\def\theindexcomment{%
\vskip\baselineskip
\parbox[t]{\@indexcommentwidth}{\normalsize\mdseries#1}%
}%
}
\let\theindexcomment\@empty
\renewcommand{\indexchap}[1]{%
\global\topskip 7.5pc\relax
\twocolumn[\fontsize{\@xivpt}{18}%
\vskip\topskip\vskip-\baselineskip\hbox{}% adjust top space
\bfseries\centering #1\par
\ifx\theindexcomment\@empty
\else \theindexcomment
\global\let\theindexcomment\@empty
\fi
]%
\global\topskip 34\p@
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% The usual \cs{endinput} to ensure that random garbage at the end of
% the file doesn't get copied by \fn{docstrip}.
% \begin{macrocode}
\endinput
% \end{macrocode}
%
% \CheckSum{131}
% \Finale
|