% \iffalse meta-comment
%
% Copyright (C) 1993-2025
% 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|.
%
% \MaybeStop{}
%
%
% \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{glossary} 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
%
