ltidxglo.dtx

Johannes Braams  David Carlisle  Alan Jeffrey
Leslie Lamport  Frank Mittelbach  Chris Rowley

Rainer Schöpf

1995/10/25

1 Index and Glossary Generation

Index and Glossary commands.

\makeindex A preamble command to turn on indexing. \makeglossary A preamble command to turn on making glossary entries.

\index Make an index entry for #1. \glossary Make a glossary entry for #1.

\makeindex ==

BEGIN

if \@filesw = T
then open file \jobname.IDX as \@indexfile
\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

fi 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.

1 ⟨∗2ekernel⟩

 2 \message{index,}
\makeindex
 3 \def\makeindex{%
 4 \newwrite\@indexfile
 5 \immediate\openout\@indexfile=\jobname.idx
 6 \def\index{\@bsphack\begingroup
 7  \@sanitize
 8  \@wrindex}\typeout
 9  {Writing index file \jobname.idx}%

10 }

11 \@onlypreamble\makeindex
\@wrindex
12 \def\@wrindex#1{%
13 \protected@write\@indexfile{}%
14  {\string\indexentry{#1}{\thepage}}%
15 \endgroup
16 \@esphack}
\index
17 \def\index{\@bsphack\begingroup \@sanitize\@index}
\@index
18 \def\@index#1{\endgroup\@esphack}
\makeglossary
19 \def\makeglossary{%
20 \newwrite\@glossaryfile
21 \immediate\openout\@glossaryfile=\jobname.glo
22 \def\glossary{\@bsphack\begingroup
23  \@sanitize
24  \@wrglossary}\typeout
25 {Writing glossary file \jobname.glo }}
26 \@onlypreamble\makeglossary

\@wrglossary
27 \def\@wrglossary#1{%
28 \protected@write\@glossaryfile{}%
29  {\string\glossaryentry{#1}{\thepage}}%
30 \endgroup
31 \@esphack}
\glossary
32 \def\glossary{\@bsphack\begingroup\@sanitize\@index}

33 ⟨/2ekernel⟩