blob: ed43f831fe3b26e2e379968bf3fa8e68ed58dc34 (
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
|
% GENINDEX.STY -- version 1.0 -- 5 August 1993 -- Cameron Smith
% \newindex{NAME}{\FILEIDENTIFIER}{EXTENSION}{\CONSTRUCTOR}
% defines two macros, \makeNAME and \NAME. If \makeNAME is
% executed in the preamble of a document, executing \NAME{ENTRY} writes
% the line \CONSTRUCTOR{ENTRY}{PAGENUM} to the file \jobname.EXTENSION,
% where PAGENUM is the number of the page on which the \NAME command was
% given. If \makeNAME is not executed, then calls to \NAME are no-ops.
% \FILEIDENTIFIER is a control sequence used internally to
% identify the output channel allocated to the file.
% \FILEIDENTIFIER and \CONSTRUCTOR should be control sequences;
% NAME and EXTENSION should not. EXTENSION should not include a period.
% Example: \newindex{index}{\@indexfile}{idx}{\indexentry}
% defines the macros \makeindex and \index. If \makeindex is
% executed in the preamble of a document, then \index{ENTRY} causes
% the line \indexentry{ENTRY}{PAGENUM} to be written to the file
% \jobname.idx, which is identified internally as channel \@indexfile.
% If \makeindex is not executed, \index{ENTRY} is a no-op.
% The effect of \newindex{glossary}{\@glossaryfile}{glo}{\glossaryentry}
% is similar.
\def\newindex#1#2#3#4{%
\@namedef{make#1}{%
\if@filesw
\newwrite#2%
\immediate\openout#2=\jobname.#3
\@namedef{#1}{\@bsphack\begingroup
\def\protect########1{\string########1\space}\@sanitize
\@@wrindex#2#4}%
\typeout{Writing #1 file \jobname.#3 }%
\fi
}%
\@namedef{#1}{\@bsphack\begingroup \@sanitize\@index}%
}
\def\@@wrindex#1#2#3{\let\thepage\relax
\edef\@tempa{\write#1{\string#2{#3}{\thepage}}}%
\expandafter\endgroup\@tempa
\if@nobreak\ifvmode\nobreak\fi\fi\@esphack
}
\def\@index#1{\endgroup\@esphack}
|