%%% ==================================================================== %%% @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} % % \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