| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% The LaTeX Project and any individual authors listed elsewhere |
| 5 |
% in this file. |
| 6 |
% |
| 7 |
% This file is part of the LaTeX base system. |
| 8 |
% ------------------------------------------- |
| 9 |
% |
| 10 |
% It may be distributed and/or modified under the |
| 11 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 12 |
% of this license or (at your option) any later version. |
| 13 |
% The latest version of this license is in |
| 14 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2008 or later. |
| 17 |
% |
| 18 |
% This file has the LPPL maintenance status "maintained". |
| 19 |
% |
| 20 |
% The list of all files belonging to the LaTeX base distribution is |
| 21 |
% given in the file `manifest.txt'. See also `legal.txt' for additional |
| 22 |
% information. |
| 23 |
% |
| 24 |
% The list of derived (unpacked) files belonging to the distribution |
| 25 |
% and covered by LPPL is defined by the unpacking scripts (with |
| 26 |
% extension .ins) which are part of the distribution. |
| 27 |
% |
| 28 |
% \fi |
| 29 |
%\iffalse |
| 30 |
% Copyright (C) 1985 by Leslie Lamport |
| 31 |
% Copyright (C) 1994-98 by LaTeX Project and Johannes Braams |
| 32 |
%\fi |
| 33 |
% |
| 34 |
% \changes{1.0b}{1994/01/21}{added a missing \cs{end\{macro\}}, a |
| 35 |
% missing docstrip end of module and corrected a few typos} |
| 36 |
% \changes{1.0d}{1994/02/11}{Corrected a few documentation errors; |
| 37 |
% added \cs{Checksum}} |
| 38 |
% \changes{1.0e}{1994/02/22}{Another documentation flaw fixed} |
| 39 |
% \changes{1.0f}{1994/03/01}{Moved driver further up; corrected a few |
| 40 |
% errors} |
| 41 |
% \changes{1.0f}{1994/03/01}{Added overview of {\sc docstrip} modules} |
| 42 |
% \changes{1.0i}{1994/11/11}{(DPC) Removed spurious \cs{wlog}} |
| 43 |
% \changes{1.0k}{1998/08/17}{(RmS) Minor documentation corrections.} |
| 44 |
% \changes{1.0m}{2000/03/29}{(RmS) Added macros \cs{seealso} and \cs{alsoname}.} |
| 45 |
% |
| 46 |
%\title{Standard \LaTeXe\ packages \texttt{makeidx} and |
| 47 |
% \texttt{showidx}} |
| 48 |
% |
| 49 |
% \author{% |
| 50 |
% Johannes Braams\and |
| 51 |
% David Carlisle\and |
| 52 |
% Alan Jeffrey\and |
| 53 |
% Leslie Lamport\and |
| 54 |
% Frank Mittelbach\and |
| 55 |
% Chris Rowley\and |
| 56 |
% Rainer Sch\"opf} |
| 57 |
% |
| 58 |
% \date{2014/09/29} |
| 59 |
% \MaintainedByLaTeXTeam{latex} |
| 60 |
% \maketitle |
| 61 |
% |
| 62 |
% \section{Description} |
| 63 |
% |
| 64 |
% \subsection{Makeidx} |
| 65 |
% |
| 66 |
% The package \texttt{makeidx} provides two new commands, |\see| |
| 67 |
% and |\printindex|. |
| 68 |
% |
| 69 |
% \DescribeMacro\see |
| 70 |
% The command |\see| can used in the index to cross reference to |
| 71 |
% other items. |
| 72 |
% |
| 73 |
% \DescribeMacro\printindex |
| 74 |
% This command can be used to include the sorted and formatted |
| 75 |
% index in the document. |
| 76 |
% |
| 77 |
% \subsection{Showidx} |
| 78 |
% |
| 79 |
% The package \texttt{showidx} changes a number of internal |
| 80 |
% \LaTeXe\ commands in such a way that each index entry is shown in |
| 81 |
% the margin on the page where the entry appears. This package was |
| 82 |
% originally meant to be used with the \texttt{report} and |
| 83 |
% \texttt{book} document classes, but works with other classes as |
| 84 |
% well. It makes |\flushbottom| the default. |
| 85 |
% |
| 86 |
% \MaybeStop{} |
| 87 |
% |
| 88 |
% \section{The {\sc docstrip} modules} |
| 89 |
% |
| 90 |
% The following modules are used in the implementation to direct |
| 91 |
% {\sc docstrip} in generating the external files: |
| 92 |
% \begin{center} |
| 93 |
% \begin{tabular}{ll} |
| 94 |
% makeidx & produce makeidx.sty\\ |
| 95 |
% showidx & produce showidx.sty\\ |
| 96 |
% driver & produce a documentation driver file \\ |
| 97 |
% \end{tabular} |
| 98 |
% \end{center} |
| 99 |
% |
| 100 |
% \section{The documentation driver file} |
| 101 |
% |
| 102 |
% The next bit of code contains the documentation driver file for |
| 103 |
% \TeX{}, i.e., the file that will produce the documentation you are |
| 104 |
% currently reading. It can be extracted from this file by the |
| 105 |
% {\sc docstrip} program. |
| 106 |
% \begin{macrocode} |
| 107 |
%<*driver> |
| 108 |
\documentclass{ltxdoc} |
| 109 |
\begin{document} |
| 110 |
\DocInput{makeindx.dtx} |
| 111 |
\end{document} |
| 112 |
%</driver> |
| 113 |
% \end{macrocode} |
| 114 |
% |
| 115 |
% \section{Implementation} |
| 116 |
% |
| 117 |
% \subsection{Identification} |
| 118 |
% |
| 119 |
% Announce the package and its version: |
| 120 |
% \changes{v1.0h}{1994/05/01}{Removed use of variables} |
| 121 |
% \begin{macrocode} |
| 122 |
%<makeidx>\ProvidesPackage{makeidx} |
| 123 |
%<showidx>\ProvidesPackage{showidx} |
| 124 |
[2021/10/04 v1.0m Standard LaTeX package] |
| 125 |
% \end{macrocode} |
| 126 |
% |
| 127 |
% \subsection{Makeidx} |
| 128 |
% |
| 129 |
% \begin{macro}{\see} |
| 130 |
% This macro discards its second argument (typically a page number) |
| 131 |
% and just prints |\seename| together with the entry the reader is |
| 132 |
% pointed to. |
| 133 |
% \changes{v1.0j}{1995/04/19}{Use \cs{emph} instead of \cs{em}} |
| 134 |
% \changes{v1.0j}{1995/04/19}{Disallow \cs{par} in argument} |
| 135 |
% \begin{macrocode} |
| 136 |
%<*makeidx> |
| 137 |
\newcommand*\see[2]{\emph{\seename} #1} |
| 138 |
% \end{macrocode} |
| 139 |
% \end{macro} |
| 140 |
% |
| 141 |
% \begin{macro}{\seealso} |
| 142 |
% \changes{v1.0m}{2000/03/29}{Macro added (see PR 3133).} |
| 143 |
% This macro discards its second argument (typically a page number) |
| 144 |
% and just prints |\alsoname| together with the entry the reader is |
| 145 |
% pointed to. We use |\providecommand| to retain compatibility with |
| 146 |
% existing files that define this macro. |
| 147 |
% \begin{macrocode} |
| 148 |
\providecommand*\seealso[2]{\emph{\alsoname} #1} |
| 149 |
% \end{macrocode} |
| 150 |
% \end{macro} |
| 151 |
% |
| 152 |
% \begin{macro}{\printindex} |
| 153 |
% This command simply inputs the (formatted) index if it exists, |
| 154 |
% otherwise a warning is issued. |
| 155 |
% \changes{1.0c}{1994/02/08}{Use \cs{@input@} instead of \cs{@input} to |
| 156 |
% get the index listed by \cs{listfiles}} |
| 157 |
% \begin{macrocode} |
| 158 |
\newcommand\printindex{\@input@{\jobname.ind}} |
| 159 |
% \end{macrocode} |
| 160 |
% \end{macro} |
| 161 |
% |
| 162 |
% \begin{macro}{\seename} |
| 163 |
% This package is for documents prepared in the English language. |
| 164 |
% To prepare a version for another language, various English words |
| 165 |
% must be replaced. All the English words that require replacement |
| 166 |
% are% defined below in command names. |
| 167 |
% \changes{1.0g}{1994/03/07}{Replaced \cs{newcommand} by \cs{providecommand}.} |
| 168 |
% \begin{macrocode} |
| 169 |
\providecommand\seename{see} |
| 170 |
% \end{macrocode} |
| 171 |
% We used |\providecommand| in case the command is already defined |
| 172 |
% by a package loaded earlier. |
| 173 |
% \end{macro} |
| 174 |
% |
| 175 |
% \begin{macro}{\alsoname} |
| 176 |
% \changes{v1.0m}{2000/03/29}{Macro added (see PR 3133).} |
| 177 |
% This macro discards its second argument (typically a page number) |
| 178 |
% and just prints |\alsoname| together with the entry the reader is |
| 179 |
% pointed to. We use |\providecommand| to retain compatibility with |
| 180 |
% existing files that define this macro. |
| 181 |
% \begin{macrocode} |
| 182 |
\providecommand*\alsoname{see also} |
| 183 |
%</makeidx> |
| 184 |
% \end{macrocode} |
| 185 |
% \end{macro} |
| 186 |
% |
| 187 |
% \subsection{showidx} |
| 188 |
% |
| 189 |
% \begin{macro}{\indexbox} |
| 190 |
% This package uses \TeX's insert mechanism, therefore it needs to |
| 191 |
% allocate an insert register. |
| 192 |
% \begin{macrocode} |
| 193 |
%<*showidx> |
| 194 |
\newinsert\indexbox |
| 195 |
\dimen\indexbox=\maxdimen |
| 196 |
% \end{macrocode} |
| 197 |
% \end{macro} |
| 198 |
% |
| 199 |
% \begin{macro}{\index} |
| 200 |
% This is a modified default definition for the user level |\index| |
| 201 |
% command. The difference is the change of the category code of the |
| 202 |
% space character. |
| 203 |
% \begin{macrocode} |
| 204 |
\renewcommand\index{\@bsphack\begingroup |
| 205 |
\@sanitize\catcode32=10\relax\@index} |
| 206 |
% \end{macrocode} |
| 207 |
% \end{macro} |
| 208 |
% |
| 209 |
% \begin{macro}{\makeindex} |
| 210 |
% The same change has to be included in the user level |\makeindex| |
| 211 |
% command, which changes the definition of |\index| to actually |
| 212 |
% write index entries to an external file. |
| 213 |
% \begin{macrocode} |
| 214 |
\renewcommand\makeindex{\if@filesw \newwrite\@indexfile |
| 215 |
\immediate\openout\@indexfile=\jobname.idx |
| 216 |
\def\index{\@bsphack\begingroup |
| 217 |
\def\protect####1{\string####1\space}\@sanitize |
| 218 |
\catcode32=10 \@wrindex\@indexfile}\typeout |
| 219 |
{Writing index file \jobname.idx }\fi} |
| 220 |
% \end{macrocode} |
| 221 |
% \end{macro} |
| 222 |
% |
| 223 |
% \begin{macro}{\@wrindex} |
| 224 |
% This macro takes care of writing the index entries to a file. The |
| 225 |
% definition is modified to call |\@showidx|. |
| 226 |
% \begin{macrocode} |
| 227 |
\def\@wrindex#1#2{\let\thepage\relax |
| 228 |
\xdef\@gtempa{\write#1{\string |
| 229 |
\indexentry{#2}{\thepage}}}\endgroup\@gtempa |
| 230 |
\@showidx{#2}\if@nobreak \ifvmode\nobreak\fi\fi\@esphack} |
| 231 |
% \end{macrocode} |
| 232 |
% \end{macro} |
| 233 |
% |
| 234 |
% \begin{macro}{\@index} |
| 235 |
% When the user didn't use the |\makeindex| command, the |\index| |
| 236 |
% macro calls |\@index|, which normally does basically nothing. |
| 237 |
% This package changes the definition to call |\@showidx|, which |
| 238 |
% includes the entry in the list of indexentries on the current page. |
| 239 |
% \begin{macrocode} |
| 240 |
\def\@index#1{\@showidx{#1}\endgroup\@esphack} |
| 241 |
% \end{macrocode} |
| 242 |
% \end{macro} |
| 243 |
% |
| 244 |
% \begin{macro}{\@showidx} |
| 245 |
% This macro adds the current index entry to the insert |
| 246 |
% |\indexbox|. The |\indexbox| is typeset as a flushleft paragraph. |
| 247 |
% \begin{macrocode} |
| 248 |
\def\@showidx#1{% |
| 249 |
\insert\indexbox{\small |
| 250 |
\hsize\marginparwidth |
| 251 |
\hangindent\marginparsep \parindent\z@ |
| 252 |
\everypar{}\let\par\@@par \parfillskip\@flushglue |
| 253 |
\lineskip\normallineskip |
| 254 |
\baselineskip .8\normalbaselineskip\sloppy |
| 255 |
\raggedright \leavevmode |
| 256 |
\vrule \@height .7\normalbaselineskip \@width \z@\relax |
| 257 |
#1\relax |
| 258 |
\vrule \@height \z@ \@depth .3\normalbaselineskip \@width \z@}} |
| 259 |
% \end{macrocode} |
| 260 |
% \end{macro} |
| 261 |
% |
| 262 |
% \begin{macro}{\raggedbottom} |
| 263 |
% \begin{macro}{\flushbottom} |
| 264 |
% The definitions of these macros from the \LaTeX{} format are changed |
| 265 |
% here to add the execution of |\@mkidx| to |\@texttop|, which is |
| 266 |
% executed at the top of each page. |
| 267 |
% \begin{macrocode} |
| 268 |
\renewcommand\raggedbottom{\def\@textbottom{\vskip |
| 269 |
\z@ plus.0001fil}\let\@texttop\@mkidx} |
| 270 |
\renewcommand\flushbottom{\let\@textbottom\relax |
| 271 |
\let\@texttop\@mkidx} |
| 272 |
% \end{macrocode} |
| 273 |
% \end{macro} |
| 274 |
% \end{macro} |
| 275 |
% |
| 276 |
% \begin{macro}{\@mkidx} |
| 277 |
% This macro actually typesets the box containing all the index |
| 278 |
% entries on the current page. They will occur on the left or the |
| 279 |
% right side of the text, or both, depending on the setting of the |
| 280 |
% switches |\if@twocolumn| and |\if@twoside|. |
| 281 |
% \begin{macrocode} |
| 282 |
\def\@mkidx{\vbox to \z@{\hbox{\if@twocolumn |
| 283 |
\if@firstcolumn \@leftidx \else \@rightidx \fi |
| 284 |
\else \if@twoside \ifodd\c@page \@rightidx |
| 285 |
\else \@leftidx \fi |
| 286 |
\else \@rightidx \fi |
| 287 |
\fi |
| 288 |
\box\indexbox}\vss}} |
| 289 |
% \end{macrocode} |
| 290 |
% \end{macro} |
| 291 |
% |
| 292 |
% \begin{macro}{\@leftidx} |
| 293 |
% \begin{macro}{\@rightidx} |
| 294 |
% These macros give the amount of displacement for the |\indexbox|. |
| 295 |
% \begin{macrocode} |
| 296 |
\def\@leftidx{\hskip-\marginparsep \hskip-\marginparwidth} |
| 297 |
\def\@rightidx{\hskip\columnwidth \hskip\marginparsep} |
| 298 |
% \end{macrocode} |
| 299 |
% \end{macro} |
| 300 |
% \end{macro} |
| 301 |
% |
| 302 |
% To make this work we have to execute either |\raggedbottom| or |
| 303 |
% |\flushbottom|. Assuming this package is used most often with the |
| 304 |
% document classes \texttt{report} and \texttt{book}, we execute |
| 305 |
% |\flushbottom|. |
| 306 |
% \begin{macrocode} |
| 307 |
\flushbottom |
| 308 |
%</showidx> |
| 309 |
% \end{macrocode} |
| 310 |
% |
| 311 |
% \Finale |
| 312 |
% |
| 313 |
\endinput |