summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltidxglo.dtx
blob: 75a80cd439024d8354ed23099dc004db003862b7 (plain)
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
% \iffalse meta-comment
%
% Copyright (C) 1993-2021
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%%% From File: ltidxglo.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltidxglo.dtx}
             [2019/08/27 v1.1f LaTeX Kernel (Index and Glossary)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltidxglo.dtx}
\title{\filename}
\date{\filedate}
 \author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Leslie Lamport\and
  Frank Mittelbach\and
  Chris Rowley\and
  Rainer Sch\"opf}

\begin{document}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
% \section{Index and Glossary Generation}
%  Index and Glossary commands.
%
% \DescribeMacro{\makeindex} A preamble command to turn on indexing.
%
% \DescribeMacro{\makeglossary} A preamble command to turn on making
% glossary entries.
%
% \DescribeMacro{\index} Make an index entry for |#1|.
%
% \DescribeMacro{\glossary} Make a glossary entry for |#1|.
%
% \StopEventually{}
%
%
% \changes{v1.0a}{1994/03/31}{Initial version of ltidxbib.dtx,
%                             split from ltherest.dtx}
% \changes{v1.1a}{1994/05/19}{Initial version of ltidxglo.dtx,
%                             split from ltidxbib.dtx}
% \changes{v1.1d}{1995/10/25}{Doc cleanup}
% \changes{v1.1f}{2019/08/27}{Make \cs{index} and \cs{gloassary} robust}
%
%
% \begin{oldcomments}
% \makeindex ==
%   BEGIN
%             \index ==  BEGIN \@bsphack
%                              \begingroup
%                                 \protect{X} == \string X\space
%                                  %% added 3 Feb 87 for \index commands
%                                  %% in \footnotes
%                                  re-\catcode special characters
%                                  to 'other'
%                                  \@wrindex
%   END
%
%  \@wrindex{ITEM} ==
%    BEGIN
%        write of {\indexentry{ITEM}{page number}}
%      \endgroup
%      \@esphack
%    END
%
%  INITIALIZATION:
%
%  \index == BEGIN \@bsphack
%                  \begingroup
%                     re-\catcode special characters (in case '%' there)
%                     \@index
%            END
%
%  \@index{ITEM} == BEGIN \endgroup \@esphack END
%
% Changes made 14 Apr 89 to write \glossaryentry's instead of
% \indexentry's on the .glo file.
% \end{oldcomments}
%
%    \begin{macrocode}
%<*2ekernel>
\message{index,}
%    \end{macrocode}
%
% \changes{v1.1b}{1994/11/04}{Removed \cs{if@filesw} from
%    \cs{makeindex}.}
%
% \begin{macro}{\makeindex}
%    \begin{macrocode}
\def\makeindex{%
  \newwrite\@indexfile
  \immediate\openout\@indexfile=\jobname.idx
  \def\index{\@bsphack\begingroup
             \@sanitize
             \@wrindex}\typeout
    {Writing index file \jobname.idx}%
%    \end{macrocode}
% \changes{v1.1e}{1996/01/20}{Make no-op after use pr/2048}
%    Opening the write channel should be done only once
%    since on some OS multiple opens are forbidden and in
%    any case it is useless. So we turn this into a no-op after
%    use.
%    \begin{macrocode}
  \let\makeindex\@empty
}
\@onlypreamble\makeindex
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@wrindex}
% \changes{v1.1b}{1994/11/04}{Added \cs{protected@write} to
%    \cs{@wrindex}.}
%    \begin{macrocode}
\def\@wrindex#1{%
   \protected@write\@indexfile{}%
      {\string\indexentry{#1}{\thepage}}%
 \endgroup
 \@esphack}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\index}
%    \begin{macrocode}
\def\index{\@bsphack\begingroup \@sanitize\@index}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@index}
%    \begin{macrocode}
\def\@index#1{\endgroup\@esphack}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makeglossary}
% \changes{v1.1b}{1994/11/04}{Removed \cs{if@filesw} from
%    \cs{makeglossary}.}
%    \begin{macrocode}
\def\makeglossary{%
  \newwrite\@glossaryfile
  \immediate\openout\@glossaryfile=\jobname.glo
  \def\glossary{\@bsphack\begingroup
                \@sanitize
                \@wrglossary}\typeout
    {Writing glossary file \jobname.glo }%
%    \end{macrocode}
% \changes{v1.1e}{1996/01/20}{Make no-op after use pr/2048}
%    Opening the write channel should be done only once
%    since on some OS multiple opens are forbidden and in
%    any case it is useless. So we turn this into a no-op after
%    use.
%    \begin{macrocode}
  \let\makeglossary\@empty
}
\@onlypreamble\makeglossary
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@wrglossary}
% \changes{v1.1b}{1994/11/04}{Added \cs{protected@write} to
%    \cs{@wrglossary}.}
%    \begin{macrocode}
\def\@wrglossary#1{%
   \protected@write\@glossaryfile{}%
      {\string\glossaryentry{#1}{\thepage}}%
 \endgroup
 \@esphack}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\glossary}
%    \begin{macrocode}
\def\glossary{\@bsphack\begingroup\@sanitize\@index}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
%
%
% \Finale
%