% \iffalse meta-comment
% ======================================================================
% scrkernel-index.dtx
% Copyright (c) Markus Kohm, 2002-2023
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% ======================================================================
%%% From File: $Id: scrkernel-index.dtx 4052 2023-05-05 11:41:51Z kohm $
%
% \end{macrocode}
% \end{option}
%
%
% \subsection{User commands and macros}
%
% \begin{command}{\setindexpreamble}
% \changes{v2.6c}{2000/06/10}{added}
% \changes{v2.6d}{2000/07/20}{\cs{let} replaced by \cs{newcommand*}}
% \changes{v2.95}{2002/07/01}{\cs{let} and \cs{def}}
% \begin{macro}{\index@preamble}
% \changes{v2.6c}{2000/06/10}{added}
% The index preamble is placed between the heading an the index itself. The
% user can define it using \cs{setindexpreamble}. \cs{index@preamble} is the
% storage. Note: \cs{setindexpreamble} does read the argument itself. This
% makes it easier to patch the user level command. But because of this it has
% to long.
% \begin{macrocode}
%<*body>
\newcommand*{\index@preamble}{}
\let\index@preamble=\relax
\newcommand{\setindexpreamble}[1]{\def\index@preamble{#1}}
% \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{macro}{\idx@heading}
% \changes{v2.3h}{1995/01/21}{added}
% \changes{v2.4c}{1996/04/04}{handling of running heads fixed}
% \changes{v2.4g}{1996/11/04}{two-columned index with \cls*{scrartcl} fixed}
% \changes{v2.6c}{2000/06/10}{support for index preamble after heading}
% \changes{v2.7j}{2001/05/27}{output of preamble moved to \env{theindex}}
% \changes{v2.9l}{2003/01/19}{\cs{if@twoside} replaced by \cs{if@openright}}
% \changes{v2.98c}{2008/03/04}{using \cs{idx@@heading}}
% \changes{v3.10}{2011/08/31}{using \cs{MakeMarkcase}}
% \changes{v3.10a}{2012/03/08}{brackets from previous change fixed}
% \changes{v3.12}{2013/09/24}{never make an index entry to the other ToC but
% the table of contents}
% \changes{v3.25}{2017/10/13}{using \cs{@mkright} and \cs{@mkdouble}}
% \changes{v3.26}{2018/09/03}{usage of \cs{addsecmark} or \cs{subsectionmark}
% instead of \cs{@mkright}}
% \changes{v3.41}{2023/05/05}{using \cs{idx@@mark}}
% \changes{v3.41}{2023/05/05}{\cs{cleardoublepage} or \cs{clearpage} only, if
% not \opt{leveldown}}
% Macro to make the index heading and preamble.
% \begin{macrocode}
\newcommand*{\idx@heading}{%
% \ifidx@leveldown\else\if@openright\cleardoublepage\else\clearpage\fi\fi
\twocolumn[%
% \@chaptertolistsfalse
\idx@@heading{\indexname}]%
\idx@@mark{\indexname}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{theindex}
% \changes{v2.8d}{2001/07/05}{\cs{indexpagestyle} instead of \pstyle{plain}}
% \changes{v2.3h}{1995/01/21}{using \cs{idx@heading}}
% \changes{v2.7j}{2001/05/27}{output of preamble added}
% \changes{v3.19}{2015/08/25}{using \cs{indexpagestyle} only if not empty}
% This definition is similar to the definition of the standard classes. As
% addition it supports a preamble text, a variable heading, and resets the
% paragraph end line fill.
% \begin{macrocode}
\newenvironment{theindex}{%
\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\columnseprule \z@
\columnsep 35\p@
% \setchapterpreamble{\index@preamble}%
\idx@heading
% \index@preamble\par\nobreak
\ifx\indexpagestyle\@empty\else\thispagestyle{\indexpagestyle}\fi
\parindent\z@
\setlength{\parskip}{\z@ \@plus .3\p@}%
\setlength{\parfillskip}{\z@ \@plus 1fil}%
\let\item\@idxitem
}{%
\if@restonecol\onecolumn\else\clearpage\fi
}
% \end{macrocode}
% \begin{macro}{\@idxitem}
% A new index entry
% \begin{command}{\subitem,\subsubitem}
% \changes{v2.3g}{1996/01/14}{using \cs{@idxitem} saves memory}
% sub-entry, sub-sub-entry,
% \begin{command}{\indexspace}
% or (vertical) distance.
% \begin{macrocode}
\newcommand*\@idxitem{\par\hangindent 40\p@}
% \begin{macrocode}
\newcommand*\subitem{\@idxitem \hspace*{20\p@}}
\newcommand*\subsubitem{\@idxitem \hspace*{30\p@}}
\newcommand*\indexspace{%
\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax
}
% \end{macrocode}
% \end{command}^^A \indexspace
% \end{command}^^A \subitem,\subsubitem
% \end{macro}^^A \@idxitem
% \end{environment}^^A theindex
%
%
% \subsection{Language dependent terms}
%
% \begin{command}{\indexname}
% \changes{v3.36}{2022/02/15}{explicit definition for English languages}
% The name of the index (used by \cs{idx@heading}).
% \begin{macrocode}
\newcommand*\indexname{Index}
\providecaptionname{american,australian,british,canadian,english,newzealand,%
UKenglish,ukenglish,USenglish,usenglish}\indexname{Index}
%
% \end{macrocode}
% \end{command}
%
%
% \begin{macrocode}
%!letter>
% \end{macrocode}
%
% \Finale
% \PrintChanges
%
\endinput
% Local Variables:
% mode: doctex
% ispell-local-dictionary: "en_US"
% eval: (flyspell-mode 1)
% TeX-master: t
% TeX-engine: luatex-dev
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
% End: