ifundefined{main}{\def\main#1{\underline{#1}}}{}
%    \end{macrocode}
% \end{imacro}
%
% \begin{imacro}{\usage}
%    The |\usage| macro is used to indicate entries describing
%    the usage of a macro. The corresponding page number(s) will be
%    set in \textit{italics}.
%    \begin{macrocode}
\@ifundefined{usage}{\def\usage#1{\textit{#1}}}{}
%    \end{macrocode}
% \end{imacro}
%
% \begin{imacro}{\code}
%    The |\code| macro is used to indicate index entries to code lines
%    that aren't main entries.
%    By default we do nothing special with them
%    the usage of a macro.
%    \begin{macrocode}
\@ifundefined{code}{\def\code#1{#1}}{}
%    \end{macrocode}
% \end{imacro}
%
%
% \begin{imacro}{\PrintIndex}
% \changes{v1.5k}{1989/09/04}{\cs{printindex} changed to
%                             \cs{PrintIndex}}
% \changes{v1.7a}{1992/02/26}{Documentation moved to interface section.}
% \changes{v1.9h}{1994/02/10}{Use \cs{@input@} instead of \cs{@input}.}
% \changes{v1.9w}{1995/12/29}{Turn the cmd into a noop after use.}
%    This is the same as |\printindex| in the \pkg{makeidx} package.
%    \begin{macrocode}
\def\PrintIndex{\@input@{\jobname.ind}%
                \global\let\PrintIndex\@empty}
%    \end{macrocode}
% \end{imacro}
%
%
% We want headings in the index (and changes list) according to the
% initial character of the next block of entries and have to instruct
% \prg{makeindex} appropriately.  Unfortunately the specification
% for this changed sometime between versions 2.4 and 2.11 of
% \prg{makeindex}.  We provide both ways of doing it but
% unfortunately this will always produce a warning message from
% \prg{makeindex}.  This is for older versions:
% \changes{v1.7h}{1992/07/01}{Turn off headings in gls file}
%    \begin{macrocode}
%</package>
%<+gind,gglo>% The next lines will produce some warnings when
%<+gind,gglo>% running Makeindex as they try to cover two different
%<+gind,gglo>% versions of the program:
%<+gind,gglo>lethead_prefix   "{\\bfseries\\hfil "
%<+gind,gglo>lethead_suffix   "\\hfil}\\nopagebreak\n"
%<+gind>lethead_flag       1
%<+gglo>lethead_flag       0
%    \end{macrocode}
% This works for newer ones:
%    \begin{macrocode}
%<+gind,gglo>heading_prefix   "{\\bfseries\\hfil "
%<+gind,gglo>heading_suffix   "\\hfil}\\nopagebreak\n"
%<+gind>headings_flag       1
%<+gglo>headings_flag       0
%<*package>
%    \end{macrocode}
%
%
%
% \subsection[Dealing with the change history]
%            {Dealing with the change history\footnotemark}
% \footnotetext{The whole section was proposed by Brian \textsc{Hamilton
%               Kelly}. He also documented and debugged the macros as
%               well as many other parts of this package.}
%
% To provide a change history log, the |\changes| command has
% been introduced.  This takes three arguments, respectively, the
% version number of the file, the date of the change, and some detail
% regarding what change has been made.  The second of these arguments
% is otherwise ignored, but the others are written out and may be used
% to generate a history of changes, to be printed at the end of the
% document.  However, note that older versions of Chen's standard
% \prg{makeindex}
% program limit any textual field to just 64 characters; therefore,
% is important that the number of characters in the second and third
% parameters should not exceed 61 altogether (to allow for the
% parentheses placed around the date).
%
% \begin{imacro}{\changes}
% \changes{BHK}{1989/04/26}{Documented \texttt{\protect\bslash changes}
%                         command.}
% \changes{BHK}{1989/04/26}{Changed definition of
%    \texttt{\protect\bslash protect}.} The output of the |\changes|
%    command goes into the \meta{Glossary\_File} and therefore uses
%    the normal |\glossaryentry| commands.\footnote{Note that a recent
%    change in \LaTeX{} 2.09 changed the command name in the
%    \texttt{.glo} file from \texttt{\bslash indexentry} to
%    \texttt{\bslash glossaryentry}.  It is therefore necessary to
%    have a special \prg{makeindex} style file called
%    \texttt{gglo.ist} to process this file correctly.} Thus
%    \prg{makeindex} or a similar program can be used to process
%    the output into a sorted ``glossary''.  The |\changes| command
%    commences by taking the usual measures to hide its spacing, and
%    then redefines |\protect| for use within the argument of the
%    generated |\indexentry| command.
%
%    We re-code nearly all chars found in |\sanitize| to letter
%    since the use of special package which make some characters
%    active might upset the |\changes| command when writing its
%    entries to the file. However we have to leave |%| as comment
%    and \verb*+ + as \meta{space} otherwise chaos will happen.
%    And, of course the |\| should be available as escape
%    character.
% \changes{v1.5v}{1990/01/28}{`Re-code a lot of chars.}
% \changes{v1.5m}{1989/09/20}{\cs{actualchar} in second level removed.}
% \changes{v1.5o}{1989/09/24}{New sorting.}
% \changes{v1.6c}{1990/06/29}{Again new sorting.}
% \changes{v1.9u}{1995/08/06}{Use \cs{protected@edef}}
%    \begin{macrocode}
\def\changes{\@bsphack\begingroup\@sanitize
   \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore
   \changes@}
\def\changes@#1#2#3{%
  \protected@edef\@tempa{\noexpand\glossary{#1\levelchar
%    \end{macrocode}
% \changes{v1.9u}{1995/08/06}{Use value of \cs{saved@macroname} to
%          find out about change entries at outer level}
%    If the macro |\saved@macroname| doesn't contain any macro name
%    (ie is empty) the current changes entry was done at top-level.
%    In this case we precede it by |\generalname|.
%    \begin{macrocode}
                   \ifx\saved@macroname\@empty
%    \end{macrocode}
%    Putting a |!| at the beginning of the entry hopefully moves this
%    entry to the very beginning during sorting.
%    \begin{macrocode}
                      \quotechar!%
                      \actualchar
                      \generalname
                   \else
%    \end{macrocode}
% \changes{v2.1g}{2016/02/15}{Use \cs{saved@indexname}}
%    \begin{macrocode}
                      \saved@indexname
                      \actualchar
                      \string\verb% % to fool emacs highlighting
                      \quotechar*%
                      \verbatimchar\saved@macroname
                      \verbatimchar
                   \fi
                   :\levelchar #3}}%
  \@tempa\endgroup\@esphack}
%    \end{macrocode}
% \end{imacro}
%
%
% \begin{macro}{\saved@macron