<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass{article}
\setlength\textwidth{260pt}
\setlength\marginparwidth{90pt}
\usepackage{makeidx,showidx}
\newcommand\bs{\symbol{'134}}% print backslash
\newcommand\Com[1]{\texttt{\bs#1}%
                   \index{#1@\texttt{\bs#1}}}
\newcommand\Prog[1]{\texttt{#1}%
                    \index{#1@\texttt{#1} program}}
\makeindex
\begin{document}
\section{Generating an Index}
Using the \textsf{showidx} package users can
see where they define index entries.
\par Entries are entered into the index by the
\Com{index} command. More precisely, the argument
of the \Com{index} command is written literally into
the auxiliary file \texttt{idx}. Note, however, that
information is actually written into that file only
when the \Com{makeindex} command was given in the
document preamble.

\section{Preparing the Index}
To prepare the index for printing, the
\texttt{idx} file has to be transformed by an external
program, such as \Prog{makeindex}.
This program writes the \texttt{ind} file.
\begin{verbatim}
makeindex filename
\end{verbatim}

\section{Printing the Index}

During the final production run of a document the
index can be included by putting a \Com{printindex}
command at the position in the text where you want
the index to appear (normally at the end).
This command will input the \texttt{ind} file
prepared by the index processor and \LaTeX{} will
typeset the information.
\printindex
\end{document}
</pre></body></html>