texlive[65445] Master/texmf-dist: dtxdescribe (3jan23)

commits+karl at tug.org commits+karl at tug.org
Tue Jan 3 21:46:34 CET 2023


Revision: 65445
          http://tug.org/svn/texlive?view=revision&revision=65445
Author:   karl
Date:     2023-01-03 21:46:33 +0100 (Tue, 03 Jan 2023)
Log Message:
-----------
dtxdescribe (3jan23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/dtxdescribe/README.txt
    trunk/Master/texmf-dist/doc/latex/dtxdescribe/dtxdescribe.pdf
    trunk/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx
    trunk/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty

Modified: trunk/Master/texmf-dist/doc/latex/dtxdescribe/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/dtxdescribe/README.txt	2023-01-03 20:46:13 UTC (rev 65444)
+++ trunk/Master/texmf-dist/doc/latex/dtxdescribe/README.txt	2023-01-03 20:46:33 UTC (rev 65445)
@@ -1,8 +1,8 @@
 The LaTeX dtxdescribe package
 Describe additional object types in dtx source files.
 
-v1.06 — 2022/12/07
-Copyright 2016–2022 Brian Dunn — www.BDTechConcepts.com
+v1.07 — 2023/01/03
+Copyright 2016–2023 Brian Dunn — www.BDTechConcepts.com
 
 LaTeX Project Public License, version 1.3
 

Modified: trunk/Master/texmf-dist/doc/latex/dtxdescribe/dtxdescribe.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx	2023-01-03 20:46:13 UTC (rev 65444)
+++ trunk/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx	2023-01-03 20:46:33 UTC (rev 65445)
@@ -1,7 +1,7 @@
 
 % \iffalse meta-comment
 %
-% Copyright 2016-2022 Brian Dunn
+% Copyright 2016-2023 Brian Dunn
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -17,7 +17,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{dtxdescribe}
-%<package>    [2022/12/07 v1.06 Describe additional object types in source files.]
+%<package>    [2023/01/03 v1.07 Describe additional object types in source files.]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -175,26 +175,6 @@
 %<*package>
 % \fi
 %
-% ^^A *88* remove:
-% \CheckSum{1704}
-%
-% ^^A *88* remove:
-%
-% \CharacterTable
-% {Upper-case     \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-%   Digits        \0\1\2\3\4\5\6\7\8\9
-%   Exclamation   \!     Double quote \"      Hash (number) \#
-%   Dollar        \$     Percent       \%     Ampersand     \&
-%   Acute accent \'      Left paren    \(     Right paren   \)
-%   Asterisk      \*     Plus          \+     Comma         \,
-%   Minus         \-     Point         \.     Solidus       \/
-%   Colon         \:     Semicolon     \;     Less than     \<
-%   Equals        \=     Greater than \>      Question mark \?
-%   Commercial at \@     Left bracket \[      Backslash     \\
-%   Right bracket \]     Circumflex    \^     Underscore    \_
-%   Grave accent \`      Left brace    \{     Vertical bar \|
-%   Right brace   \}     Tilde         \~}
 
 % \changes{v0.10}{2016/12/08}{\ 2016/12/08 Initial ver}
 % \changes{v0.11}{2018/03/30}{\ 2018/03/30}
@@ -206,6 +186,7 @@
 % \changes{v1.04}{2022/02/01}{\ Corrected copyright date.}
 % \changes{v1.05}{2022/09/08}{\ 2022/09/08}
 % \changes{v1.06}{2022/12/07}{\ 2022/12/07}
+% \changes{v1.07}{2023/01/03}{\ 2023/01/03}
 
 
 
@@ -230,7 +211,7 @@
 %
 % \bigskip
 %
-% {\small\textcopyright{} 2016--2022} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
+% {\small\textcopyright{} 2016--2023} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
 %
 % \vspace{.5in}
 %
@@ -252,9 +233,10 @@
 % who do not wish to use the \pkg{ltxdoc} class and \filenm{.dtx} files.
 %
 % Each described item is given a margin tag similar to \cs{DescribeEnv},
-% and is listed in the index by itself and also by category.
-% Each item may be sorted further by an optional class.
-% All index entries except code lines are hyperlinked.
+% and is listed in the index by itself and also by type of object
+% displayed in parentheses (length, filename, etc).
+% Each item may be sorted further by an optional category displayed in brackets,
+% such as |[category_name]|.
 %
 % The \env{dtxexample} environment is provided for typesetting example code and its results.
 % Contents are displayed verbatim along with a caption and cross-referencing.
@@ -279,13 +261,7 @@
 %
 % \vfill
 %
-% \textcolor{red}{The \pkg{doc} package has changed, and
-% \pkg{dtxdescribe} is not yet fully compatible.
-% When \pkg{dtxdescribe} is used with \pkg{doc},
-% the optional object ``class'' is currently ignored for macros,
-% and not all classes are indexed.}
-%
-% \textcolor{red}{Also, see change in setup of \pkg{hyperref} and \pkg{cleveref}:
+% \textcolor{red}{See change in setup of \pkg{hyperref} and \pkg{cleveref}:
 %       \Cref{sec:usage} on \cpageref{sec:usage}.}
 %
 % \clearpage
@@ -317,7 +293,7 @@
 % added to the name, such as ``Env'', ``Bool'', or ``Key''.
 % These new objects are also listed in the index with the same tag
 % shown after their names, and also by group.
-% Optional classes may be used to further categories index entries.
+% Optional categories may be used to further sort index entries.
 %
 % Modifications have been made to interact with \pkg{hyperref} to
 % provide hyper links for regular index entries as well as the new
@@ -338,7 +314,7 @@
 % \section{Using \pkg{dtxdescribe}}
 % \label{sec:usage}
 
-% To use \pkg{dtxdescribe} with the \pkg{ltxdoc} classa and \filenm{.dtx} files:
+% To use \pkg{dtxdescribe} with the \pkg{ltxdoc} class and \filenm{.dtx} files:
 % \begin{sourceverb}
 % %<*driver>
 % \documentclass{ltxdoc}
@@ -391,10 +367,10 @@
 % macros such as \cs{DescribeBoolean}, \cs{DescribeLength}, \cs{DescribeCounter},
 % similar to the already-familiar \cs{DescribeMacro} and \cs{DescribeEnv}.
 
-% Optional ``classes'' may be assigned to the objects being described,
+% Optional ``categories'' may be assigned to the objects being described,
 % including the new versions of \cs{DescribeMacro} and \cs{DescribeEnv}.
-% These classes are printed in the margin tag and index entry for each item,
-% and also generate additional index entries sorted by class.  This is
+% These categories are printed in the margin tag and index entry for each item,
+% and also generate additional index entries sorted by category.  This is
 % especially useful for key/value sets, where several sets may appear in the same
 % document.
 %
@@ -415,9 +391,11 @@
 % The \env{dtxexample} environment may be used to typeset and execute small pieces of \LaTeX\ code
 % as examples of its use.  Optional cross-referencing notes may be used to refer to any
 % example float being generated.
+% \cs{listofdtxexamplefloats} prints the list of examples.
 
 
 
+
 % \clearpage
 % \section{The macros, and the \env{dtxexample} environment}
 
@@ -436,24 +414,24 @@
 % and \cs{DescribeMacro} and \cs{DescribeEnv} should be used instead.
 %
 %
-% \DescribeMacro{\DescribeMacro} \oarg{class} \marg{\cs{name}}
+% \DescribeMacro{\DescribeMacro} \oarg{category} \marg{\cs{name}}
 %
 % The preexisting macro from the \pkg{doc} package is redefined to
-%	create hyperlinked index entries, and include an optional class.
+%	create hyperlinked index entries, and include an optional category.
 %	A margin tag is created and an index entry is made.
-%	When the optional class is used, it is displayed in front of
+%	When the optional category is used, it is displayed along with
 %	the margin tag, and is used to group an index entry by
-%	macro name and another index entry by class.
+%	macro name and another index entry by category.
 %	An example would be to describe
-%	the float creation and caption setup for a new class of float,
+%	the float creation and caption setup for a new category of float,
 %	such as the |dtxexample| float and the example ``photograph'' float
 %	both found in the index for this document.
 %	See \cref{ex:macro} on \cpageref{ex:macro} for examples.
 %
-% \DescribeMacro{\DescribeEnv} \oarg{class} \marg{environment name}
+% \DescribeMacro{\DescribeEnv} \oarg{category} \marg{environment name}
 %
 % The preexisting macro from the \pkg{doc} package is redefined to
-%	create hyperlinked index entries, include an optional class, and also to place
+%	create hyperlinked index entries, include an optional category, and also to place
 %	an `Env' tag in front of the name in the margin.
 %	See \cref{ex:environment} on \cpageref{ex:environment}.
 %
@@ -486,11 +464,11 @@
 % The result looks like \parg{coordinate}.
 % 
 
-% \DescribeMacro{\DescribeArgument} \oarg{class} \marg{argument}
+% \DescribeMacro{\DescribeArgument} \oarg{category} \marg{argument}
 %
 % May be used to describe actions taken when given certain macro arguments.
 % These will be given an `Arg' margin tag and will appear in the index.
-% The |class| may be used to categorize arguments by their macro or environment name.
+% The |category| may be used to categorize arguments by their macro or environment name.
 % See \cref{ex:arguments} on \cpageref{ex:arguments}.
 
 
@@ -498,71 +476,74 @@
 %
 % See \cref{ex:common} on \cpageref{ex:common}.
 %
-% \DescribeMacro{\DescribeBoolean} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeBoolean} \oarg{category} \marg{name}
 %
 % Describes a boolean.  Given a `Bool' tag in the margin and index.
 %
 %
-% \DescribeMacro{\DescribeLength} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeLength} \oarg{category} \marg{name}
 % 
 % Describes a length.  Given a `Len' tag in the margin and index.
 %
 %
-% \DescribeMacro{\DescribeCounter} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeCounter} \oarg{category} \marg{name}
 % 
 % Describes a counter.  Given a `Ctr' tag in the margin and index.
 %
 %
-% \DescribeMacro{\DescribeHook} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeHook} \oarg{category} \marg{name}
 % 
 % Describes a hook.  Given a `Hook' tag in the margin and index.
-% The |class| may be used to categorize hooks by package.
+% The |category| may be used to categorize hooks by package.
+% The hook name may or may not have a backslash.
 % Example:
 % \begin{sourceverb}
+% \DescribeHook{\hookname}
 % \DescribeHook[LaTeX]{para/begin}
 % \end{sourceverb}
 %
 %
-% \DescribeMacro{\DescribeKey} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeKey} \oarg{category} \marg{name}
 % 
 % Describes a key.  Given a `Key' tag in the margin and index.
-% The |class| may be used to categorize keys by their kev/value group.
+% The |category| may be used to categorize keys by their kev/value group.
 % See \cref{ex:key} on \cpageref{ex:key}.
 
 
 % \subsection{Packages, classes, options}
 %
-% \DescribeMacro{\DescribePackage} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribePackage} \oarg{category} \marg{name}
 % 
 % Describes a package.  Given a `Pkg' tag in the margin and index.
 %
 %
-% \DescribeMacro{\DescribeClass} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeClass} \oarg{category} \marg{name}
 % 
 % Describes a \LaTeX\ class.  Given a `Cls' tag in the margin and index.
 %
 %
-% \DescribeMacro{\DescribeOption} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeOption} \oarg{category} \marg{name}
 % 
-% Describes a \LaTeX\ package or class option.  Given an `Opt' tag in the margin and index.
+% Describes a \LaTeX\ package or class option.
+% Given an `Opt' tag in the margin and index.
 %
 %
 
 % \subsection{Files, programs, commands}
 %
-% \DescribeMacro{\DescribeFile} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeFile} \oarg{category} \marg{name}
 % 
 % Describes an operating-system file.  Given a `File' tag in the margin and index.
 % The filename may have underscores.
 %
 %
-% \DescribeMacro{\DescribeProgram} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeProgram} \oarg{category} \marg{name}
 % 
 % Describes an operating-system program.  Given a `Prog' tag in the margin and index.
 % The program name may have underscores.
 %
 %
-% \DescribeMacro{\DescribeCommand} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeCommand} \oarg{category} \marg{name}
 % 
 % Describes an operating-system command.  Given a `Cmd' tag in the margin and index.
 % The command name may have underscores.
@@ -572,22 +553,22 @@
 
 % \subsection{Other source objects}
 %
-% \DescribeMacro{\DescribeObject} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeObject} \oarg{category} \marg{name}
 %
 % Describes an arbitrary programming object, such as a color definition or caption setup.
 % A margin tag and index entry are created with \cs{ttfamily} type.
-% When a class is used, it is pre-pended to the margin tag, appended to the
-% index entry, and a second index entry is created grouped by class.
+% When a category is used, it is added to the margin tag, appended to the
+% index entry, and a second index entry is created grouped by category.
 % If a macro name is to be described, use \cs{DescribeMacro} instead.
 % See \cref{ex:object} on \cpageref{ex:object}.
 %
 %
-% \DescribeMacro{\DescribeOther} \oarg{class} \marg{name}
+% \DescribeMacro{\DescribeOther} \oarg{category} \marg{name}
 %
 % Describes an arbitrary non-programming object, such as a license agreement
 % or credits.  A margin tag and index entry are created in roman type.
-% When a class is used, it is pre-pended to the margin tag, appended to the
-% index entry, and a second index entry is created grouped by class.
+% When a category is used, it is added to the margin tag, appended to the
+% index entry, and a second index entry is created grouped by category.
 % See \cref{ex:other} on \cpageref{ex:other}.
 
 
@@ -596,37 +577,37 @@
 % To describe an object using a \env{description} environment, use the following.
 % See \cref{ex:description} on \cpageref{ex:description}.
 
-% \DescribeMacro{\ItemDescribeMacro} \oarg{class} \marg{\cs{name}} A description.
+% \DescribeMacro{\ItemDescribeMacro} \oarg{category} \marg{\cs{name}} A description.
 %
-% \DescribeMacro{\ItemDescribeEnv} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeEnv} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribeArgument} \oarg{class} \marg{argument} A description.
+% \DescribeMacro{\ItemDescribeArgument} \oarg{category} \marg{argument} A description.
 %
-% \DescribeMacro{\ItemDescribeBoolean} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeBoolean} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribeLength} \oarg{class} \marg{\cs{name}} A description.
+% \DescribeMacro{\ItemDescribeLength} \oarg{category} \marg{\cs{name}} A description.
 %
-% \DescribeMacro{\ItemDescribeCounter} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeCounter} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribeHook} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeHook} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribeKey} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeKey} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribePackage} \oarg{class} \marg{package\_name} With underscores.
+% \DescribeMacro{\ItemDescribePackage} \oarg{category} \marg{package\_name} With underscores.
 %
-% \DescribeMacro{\ItemDescribeClass} \oarg{class} \marg{class\_name} With underscores.
+% \DescribeMacro{\ItemDescribeClass} \oarg{category} \marg{class\_name} With underscores.
 %
-% \DescribeMacro{\ItemDescribeOption} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeOption} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribeFile} \oarg{class} \marg{file\_name} With underscores.
+% \DescribeMacro{\ItemDescribeFile} \oarg{category} \marg{file\_name} With underscores.
 %
-% \DescribeMacro{\ItemDescribeProgram} \oarg{class} \marg{program\_name} With underscores.
+% \DescribeMacro{\ItemDescribeProgram} \oarg{category} \marg{program\_name} With underscores.
 %
-% \DescribeMacro{\ItemDescribeCommand} \oarg{class} \marg{command\_name} With underscores.
+% \DescribeMacro{\ItemDescribeCommand} \oarg{category} \marg{command\_name} With underscores.
 %
-% \DescribeMacro{\ItemDescribeObject} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeObject} \oarg{category} \marg{name} A description.
 %
-% \DescribeMacro{\ItemDescribeOther} \oarg{class} \marg{name} A description.
+% \DescribeMacro{\ItemDescribeOther} \oarg{category} \marg{name} A description.
 
 
 % \subsection{Defaults}
@@ -713,8 +694,13 @@
 % version does not use a minipage. This is required when the code is too large to fit
 % on a single page.
 %
+% \DescribeMacro{listofdtxexamplefloats} Prints the list of examples.
+%
 % See \cref{ex:dtxexample} for a demonstration of how \env{dtxexample} works.
 %
+% The examples may be customized by redefining the following,
+% perhaps for another language:
+
 % \DescribeMacro{\dtxexamplecodename}
 % \DescribeDefault{Code:}
 %   The text name of the code section.
@@ -1031,9 +1017,9 @@
 % \end{dtxexample}
 %
 %
-% The optional class is used to label and group tags and index entries.
+% The optional category is used to label and group tags and index entries.
 % See this document's index entries for examples of this ``photograph''
-% class and the \env{dtxexample} class of macros.
+% category and the \env{dtxexample} category of macros.
 %
 % The re-defined \cs{DescribeMacro}, \cs{DescribeEnv}, and
 % all the following macros create hyperlinked index entries,
@@ -1068,7 +1054,7 @@
 %
 % The \env{otherenvironment} will be indexed by itself and also
 % with \env{myenvironment} under the index entry ``environments'',
-% and also under the class |kindofenvironment|.
+% and also under the category |kindofenvironment|.
 %
 %
 % \clearpage
@@ -1093,6 +1079,16 @@
 % the same as the rest of the objects.
 
 
+% \begin{dtxexample}{Hooks\label{ex:hook}}
+% \DescribeHook{\hookname} A hook with a backslash.
+
+% \DescribeHook{para/begin} A hook without a backslash.
+% \end{dtxexample}
+
+% Hooks may or may not have a leading backslash.
+
+
+
 % \clearpage
 %
 %
@@ -1122,7 +1118,7 @@
 %
 % Filenames, program names, and command names may have underscores,
 % such as tested here.
-% A class is used to group ``bigfiles'' together in the index.
+% A category is used to group ``bigfiles'' together in the index.
 
 
 % \clearpage
@@ -1138,7 +1134,7 @@
 %
 % \DescribeKey[examples]{sampletwokey} About another key of |otherkeys|.
 %
-% \DescribeKey{lonekey} A key without a class.
+% \DescribeKey{lonekey} A key without a category.
 % \end{dtxexample}
 %
 % See the index key groups.
@@ -1157,7 +1153,7 @@
 % What happens when \cs{mymacro} is given the |bold| argument.
 % \end{dtxexample}
 %
-% Arguments behave like keys, and may have an optional class to
+% Arguments behave like keys, and may have an optional category to
 % identify their macro or environment, and group their entries
 % in the index.
 %
@@ -1187,9 +1183,9 @@
 % \DescribeOther{Before myenvironment}
 % 	Actions to be done \cs{BeforeBeginEnvironment}.
 %
-% \DescribeOther[otherclass]{Other Item} About the other item.
+% \DescribeOther[othercategory]{Other Item} About the other item.
 %
-% \DescribeOther[otherclass]{Additional Item} About the add'l item.
+% \DescribeOther[othercategory]{Additional Item} About the add'l item.
 % \end{dtxexample}
 %
 % Describes an arbitrary non-programming object, using roman text.
@@ -1207,7 +1203,7 @@
 % \ItemDescribeClass[descexamples]{class_name} Describe the class.
 % \ItemDescribeFile[descexamples]{file_name} Describe the file.
 % \ItemDescribeProgram[descexamples]{program_name} Describe the program.
-% \ItemDescribeCommand[descexamples]{command_name} Describe the class.
+% \ItemDescribeCommand[descexamples]{command_name} Describe the command.
 % \end{description}
 % \end{dtxexample}
 %
@@ -1416,8 +1412,8 @@
 % \changes{v1.02}{2019/07/14}{Fix if not \pkg{ltxdoc} class.}
 %    \begin{macrocode}
 \AtBeginDocument{
-    \@ifpackageloaded{makeidx}{}{
-    \@ifpackageloaded{splitidx}{}{
+    \IfPackageLoadedTF{makeidx}{}{
+    \IfPackageLoadedTF{splitidx}{}{
         \RequirePackage{makeidx}
         \makeindex
     }}
@@ -1482,7 +1478,7 @@
 % \changes{v1.02}{2019/07/14}{Fix if not \pkg{hyperref} package.}
 %    \begin{macrocode}
 \AtBeginDocument{
-    \@ifpackageloaded{hyperref}{
+    \IfPackageLoadedTF{hyperref}{
         \pdfstringdefDisableCommands{%
             \def\quad{ }%
             \def\\{ }%
@@ -1602,14 +1598,14 @@
 
 
 
-% \subsection{Patching \pkg{hypdoc}}
+% \subsection{Patching \pkg{hypdoc}, \pkg{splitidx}, \pkg{doc}}
 %
 % If \pkg{hyperref} is disabled (by \pkg{lwarp}) then define the
 % missing \cs{hdclindex}.
 % \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
 %    \begin{macrocode}
-\@ifpackageloaded{doc}{
-\@ifpackageloaded{hypdoc}{
+\IfPackageLoadedTF{doc}{
+\IfPackageLoadedTF{hypdoc}{
 \AddToHook{begindocument/before}[doc/hyperref]{%
  \ifdoc at hyperref
  \else
@@ -1622,12 +1618,19 @@
 }{}% doc loaded
 %    \end{macrocode}
 
+
+% Several changes for when \pkg{hypdoc} and \pkg{splitidx} are used together:
+%    \begin{macrocode}
+\AtBeginDocument{
+\IfPackageLoadedTF{doc}{
+\IfPackageLoadedTF{hypdoc}{
+\IfPackageLoadedTF{splitidx}{
+%    \end{macrocode}
+%
+%
 % \pkg{splitidx} is modified to add \verb+|hdpindex{}+ to work with \pkg{hypdoc}.
 % \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
 %    \begin{macrocode}
-\AtBeginDocument{
-\@ifpackageloaded{hypdoc}{
-\@ifpackageloaded{splitidx}{
 \renewcommand*{\@wrsindex}[2][]{%
   \ifx\relax#1\relax
     \if at splitidx
@@ -1653,8 +1656,70 @@
     \@esphack
   \fi
 }
+%    \end{macrocode}
+
+
+% \pkg{hypdoc} guesses the \TOC\ level for the \PDF\ bookmarks,
+% but its algorithm seems to fail at \cs{StopEventually} for split indices.
+%
+% ``|Paragraph ended before \HD@@guesstoclevel was complete.|''
+%
+% Its guess is fixed to level 1 until \cs{PrintChanges} or \cs{printindex}.
+%
+% \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
+%    \begin{macrocode}
+\def\HD at guesstoclevel#1{1}
+%    \end{macrocode}
+
+% \changes{v1.07}{2022/12/19}{Improved \PDF\ bookmarks.}
+% Patch \pkg{doc}'s \cs{PrintChanges} to reset the \TOC\ guess to top level.
+%    \begin{macrocode}
+\preto\PrintChanges{\def\HD at guesstoclevel#1{0}}
+%    \end{macrocode}
+
+
+% \pkg{hypdoc} adds \PDF\ bookmarks to letter groups in the index.
+% \pkg{hypdoc} must take into account multiple indexes,
+% otherwise, followup indices will have duplicate bookmarks.
+%
+% Increment the index number at the start of each index,
+% and append the index number to the \PDF\ bookmark.
+%
+% Also, change the \TOC\ guess to top level from now on, presuming that
+% the indices are at the end.
+%
+% \changes{v1.07}{2022/12/19}{Improved \PDF\ bookmarks.}
+%    \begin{macrocode}
+\newcounter{DTXD at indexnumber}
+
+\extendtheindex
+    {%
+        \addtocounter{DTXD at indexnumber}{1}%
+        \def\HD at guesstoclevel##1{0}%
+    }
+    {}
+    {}
+    {}
+
+\def\HD@@@bfseries\hfil#1\hfil{%
+  \ifx\\#1\\%
+  \else
+    \raisebox{\baselineskip}[0pt]{%
+      \kern-\HD at margin\relax
+%      \pdfbookmark[\HD at toclevel@subindex]{#1}{HD.#1}}%
+      \pdfbookmark[\HD at toclevel@subindex]{#1}%      dtxdescribe
+        {HD.#1.\arabic{DTXD at indexnumber}}%          dtxdescribe
+      \kern\HD at margin\relax
+    }%
+  \fi
+  \hfil#1\hfil
+}%
+%    \end{macrocode}
+
+%    \begin{macrocode}
 }{}% splitidx loaded
 }{}% hypdoc loaded
+}{}% doc loaded
 }% AtBeginDocument
 %    \end{macrocode}
 
@@ -1667,7 +1732,7 @@
 % code to be in the documentation only.  Other classes do not.
 % \changes{v1.02}{2019/07/16}{Fix if not \pkg{doc} package.}
 %    \begin{macrocode}
-\@ifpackageloaded{doc}{
+\IfPackageLoadedTF{doc}{
     \newcommand*{\DTXD at gobble}{2}
 }{
     \newcommand*{\DTXD at gobble}{0}
@@ -1694,7 +1759,7 @@
 %    \end{macrocode}
 
 
-% \subsection{\pkg{ltxdoc} emulation}
+% \subsection{Not \pkg{ltxdoc}: \pkg{ltxdoc} emulation}
 %
 % If the \pkg{ltxdoc} class is not used, some of its macros are replicated here.
 % \changes{v1.02}{2019/07/14}{Fix if not \pkg{ltxdoc} class.}
@@ -1714,13 +1779,13 @@
 %    \end{macrocode}
 
 
-% \subsection{\pkg{doc} emulation}
+% \subsection{Not \pkg{doc}: \pkg{doc} emulation}
 %
 % If the \pkg{doc} class is not used, some of its macros are replicated here.
 % \changes{v1.02}{2019/07/14}{Fix if not \pkg{doc} package.}
 %    \begin{macrocode}
 \AtBeginDocument{
-    \@ifpackageloaded{doc}{}{
+    \IfPackageLoadedTF{doc}{}{% not doc
         \newenvironment*{macro}[1]{%
             \PackageError{dtxdescribe}
                 {The 'macro' environment is only\MessageBreak
@@ -1761,7 +1826,7 @@
             }\ensuremath\rangle
         }
         \def\meta at font@select{\itshape}
-    }% doc loaded
+    }% not doc
 }% AtBeginDocument
 %    \end{macrocode}
 
@@ -1781,7 +1846,7 @@
 %
 % \begin{macro}{\DTXD at printtype} \marg{text}
 %
-% Used to print the object class in the margin:
+% Used to print the object category in the margin:
 %
 % \changes{v1.00}{2019/01/09}{Sans tag font.}
 %    \begin{macrocode}
@@ -1817,13 +1882,13 @@
 
 
 
-% \begin{macro}{\DTXD at margintag} \marg{class} \marg{name} \marg{margin tag}
+% \begin{macro}{\DTXD at margintag} \marg{category} \marg{name} \marg{margin tag}
 %
 % Creates the margin tag for the object being described.
 %
-% The |class| is used to sub-categorize keys into their key/value groups.
+% The |category| is used to sub-categorize keys into their key/value groups.
 %
-% \changes{v1.01}{2019/01/20}{Put margin tag class in brackets.}
+% \changes{v1.01}{2019/01/20}{Put margin tag category in brackets.}
 % \changes{v1.03}{2022/01/08}{Reduce hbox warnings.}
 %    \begin{macrocode}
 \newcommand*{\DTXD at margintag}[3]{%
@@ -1835,7 +1900,7 @@
                 \hfuzz=5em%
                 \DTXD at printtype{%
                     #3% margintag
-                    \ifblank{#1}{}{ [#1]}% class
+                    \ifblank{#1}{}{ [#1]}% category
                 }%
                 \texttt{#2}% name
             }%
@@ -1847,12 +1912,12 @@
 
 
 % \begin{macro}{\DTXD at index}
-%	\marg{class} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
+%	\marg{category} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
 %
 % Creates the index entries for the object being described, where
 % name has no backslash or underscore.
 %
-% The |class| is used to sub-categories keys into their key/value groups.
+% The |category| is used to sub-categorize keys into their key/value groups.
 % |main| prints code lines in the index, and |usage| prints page numbers.
 %
 %    \begin{macrocode}
@@ -1884,7 +1949,7 @@
 %
 % Index by name:
 %
-% Write the name, the formatted name, the index tag, and the class:
+% Write the name, the formatted name, the index tag, and the category:
 %    \begin{macrocode}
 #2\actualchar{\protect\ttfamily#2} % name
 (#4)% index tag
@@ -1892,9 +1957,9 @@
 \encapchar #5}%
 %    \end{macrocode}
 %
-% Index by tag and class:
+% Index by tag and category:
 %
-% Write the tag and class as a group, under which is the name and the formatted name.
+% Write the tag and category as a group, under which is the name and the formatted name.
 % \changes{v0.11}{2018/02/05}{Index tag no longer plural.}
 %    \begin{macrocode}
 \begingroup%
@@ -1905,16 +1970,16 @@
 \encapchar #5}%
 %    \end{macrocode}
 %
-% Possibly index by class and name:
+% Possibly index by category and name:
 %    \begin{macrocode}
-\ifblank{#1}{}{% class given
+\ifblank{#1}{}{% category given
 \begingroup%
 \DTXD at origwrindex{%
-#1\actualchar[#1]:\levelchar% class
+#1\actualchar[#1]:\levelchar% category
 #2\actualchar{\protect\ttfamily#2} % name
 (#4)% index tag
 \encapchar #5}%
-}% class given
+}% category given
 % \@esphack%
 \@esphack%
 \ignorespaces%
@@ -1923,10 +1988,10 @@
 % \end{macro}
 
 % \begin{macro}{\DTXD at margintagindex}
-%	\marg{class} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
+%	\marg{category} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
 %
 % Creates the margin tag and the index entries.
-% The |class| is used to sub-categories keys into their key/value groups.
+% The |category| is used to sub-categorize keys into their key/value groups.
 %    \begin{macrocode}
 \newcommand*{\DTXD at margintagindex}[5]{%
 % \@bsphack%
@@ -1974,12 +2039,12 @@
 % \end{macro}
 
 % \begin{macro}{\DTXD at cmdmargintagindex}
-%	\marg{class} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
+%	\marg{category} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
 %
 % Creates the margin tag and index entries where name is a \cs{macro}.
 %
 % \changes{v1.00}{2019/01/09}{Sans tag font.}
-% \changes{v1.01}{2019/01/20}{Put margin tag class in brackets.}
+% \changes{v1.01}{2019/01/20}{Put margin tag category in brackets.}
 %    \begin{macrocode}
 \newcommand*{\DTXD at cmdmargintagindex}[5]{%
 \@bsphack%
@@ -1996,7 +2061,7 @@
         \hfuzz=5em%
         \DTXD at printtype{%
             #3% margin tag
-            \ifblank{#1}{}{ [#1]}% class
+            \ifblank{#1}{}{ [#1]}% category
         }%
         \cmd{#2}% name
     }%
@@ -2006,13 +2071,13 @@
 %
 % Create an index entry sorted by the name without its leading backslash,
 % followed by the macro name with the backslash, and the tag.
-% Prepend with the class if given.
+% Prepend with the category if given.
 %
-% Write (class):>name=csname (indextag)\verb+|usage+
+% Write [category]:>name=csname (indextag)\verb+|usage+
 %    \begin{macrocode}
 \begingroup%
 \DTXD at origwrindex{%
-\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% class
+\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% category
 \DTXD at macroname{#2}\actualchar\DTXD at verbatimcmd{#2} % name
 (#4)% index tag
 \encapchar #5}%
@@ -2021,13 +2086,13 @@
 % Create an index entry grouped by the tag,
 %	then printed and sorted by the macro name with the backslash, and the tag.
 %
-% Write indextag:>(class):>csname\verb+|usage+
+% Write indextag:>[category]:>csname\verb+|usage+
 % \changes{v0.11}{2018/02/05}{Index tag no longer plural.}
 %    \begin{macrocode}
 \begingroup%
 \DTXD at origwrindex{%
 #4:\levelchar% index tag
-\ifblank{#1}{}{[#1]:\levelchar}% class
+\ifblank{#1}{}{[#1]:\levelchar}% category
 \DTXD at verbatimcmd{#2}% name
 \encapchar #5}%
 \@esphack%
@@ -2038,12 +2103,15 @@
 %
 
 
-% \subsection{Key handling for object classes}
+% \subsection{\pkg{doc}: Key handling for object categories}
 
 % If using \pkg{doc}, the optional key \Slash value argument may also
-% include an object class.  This is supported by assigning any unknown
-% key to be the class.
+% include an object category.  This is supported by assigning any unknown
+% key to be the category.
 %
+% The category may be given using the key |c|, or as the default action
+% when an unknown key is given.
+%
 % \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
 %    \begin{macrocode}
 \ExplSyntaxOn
@@ -2064,11 +2132,13 @@
 %    \end{macrocode}
 
 
-% \subsection{Handling \cs{marginpar} inside a float}
+% \subsection{\pkg{doc}: Handling \cs{marginpar} inside a float}
 
 % To avoid a floats lost error, do not print margin tags if inside a float.
 % \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
 %    \begin{macrocode}
+\IfPackageLoadedTF{doc}{
+
 \def\@doc at describe#1#2{%                    dtxdescribe
     \ifdoc at noprint\else
       \@ifundefined{@captype}{% not float?  dtxdescribe
@@ -2087,26 +2157,20 @@
     \fi
   \@esphack
   \endgroup
-  \ignorespaces}
+  \ignorespaces%
+}
+
+}{}% doc loaded
 %    \end{macrocode}
 
 
 
-% \subsection{Handling glossary}
 
-% Fix for \cs{StopEventually} in some conditions:
-% \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
-%    \begin{macrocode}
-\AtBeginDocument{
-\def\HD at guesstoclevel#1{1}
-}
-%    \end{macrocode}
-
-
-% \subsection{Catcode handling to support underscores}
+% \subsection{\pkg{doc}: Handling categories and detokenizing names}
 %
-% File names and such may include underscores, so they must be neutralized
-% before processing.
+% \begin{macro}{\@NewDocElement}
+% File names and such may include underscores or other characters,
+% so patch \pkg{doc} to neutralized while processing.
 %
 % \changes{v1.06}{2022/12/06}{Fixed for updated \pkg{doc}.}
 %    \begin{macrocode}
@@ -2158,51 +2222,123 @@
       \doc at createenv{TF}{#2}{#3}%
     \fi
 }
+%    \end{macrocode}
+% \end{macro}
 
+
+% \begin{macro}{\DTXDbreak} Inserts a possible line break point.
+%       Used in the index to allow line breaks before verbatim category names.
+% \changes{v1.07}{2022/12/24}{Improved line breaks.}
+%    \begin{macrocode}
+\newcommand*{\DTXDbreak}{\space\penalty200}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\DTXD at printobjectname} \marg{name w/o backslash} \marg{name} \quad
+% Adds the object name to the index in verbatim.
+% These are passed as arguments instead of directly used here because they must
+% have their value when the index is written instead of when \cs{DTXD at printobjectname}
+% is used when the index is read back.
+%
+%    \begin{macrocode}
+\newcommand*{\DTXD at printobjectname}[2]{%
+    #1%
+    \actualchar%
+    \string\verb% %
+    \quotechar%
+    *%
+    \verbatimchar%
+    #2%
+    \verbatimchar%
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\DTXD at maybecategory} If there is a category, it is added verbatim.
+%    \begin{macrocode}
 \newcommand*{\DTXD at maybecategory}{%
     \ifdefvoid{\DTXD at category}%
         {}%
-        {\space[%
+        {
+%    \end{macrocode}
+%
+% \cs{DTXDbreak} inserts a possible line break here,
+% allowing a break if the following verbatim is too long.
+% \changes{v1.07}{2022/12/24}{Improved line breaks.}
+%    \begin{macrocode}
+            \string\DTXDbreak
+%    \end{macrocode}
+%    \begin{macrocode}
+            [%
             \string\verb%
+            \noexpand\quotechar%
+%    \end{macrocode}
+% \changes{v1.07}{2022/12/19}{\cs{verb}*.}
+%    \begin{macrocode}
+            *%
             \verbatimchar\DTXD at category\verbatimchar%
         ]}%
 }
+%    \end{macrocode}
+% \end{macro}
 
-\newcommand*{\DTXD at macrotocsname}[1]{%
-  \ifcat\relax\noexpand#1%
-    \expandafter\expandafter\expandafter\@gobble\expandafter\string
-  \fi
-  #1%
-}
-
+% \begin{macro}{\DTXD at categorylevelname} The simplified name, without backslash.
+%    \begin{macrocode}
 \newcommand*{\DTXD at categorylevelname}
+%    \end{macrocode}
+% \end{macro}
 
+
+% \begin{macro}{\DTXD at maybecategorylevel} \marg{object\_type}
+%       \quad If a category is assigned, index by category.
+%
+% \begin{description}
+% \item [arg 1:] Type of object, shown between parens (), such as |macro|, |boolean|, etc.
+% \item [\cs{DTXD at category}:] The name of the category, printed in brackets [],
+%                                   such as \cs{macroname}.
+% \item [\cs{DTXD at categorylevelname}:] The simplified name of the category, such as |macroname|.
+% \item [\cs{@gtempa}:] The name of this particular object.
+% \end{description}
+%
+% \changes{v1.07}{2022/12/19}{\cs{verb}*.}
+%    \begin{macrocode}
 \newcommand*{\DTXD at maybecategorylevel}[1]{%
     \ifdefvoid{\DTXD at categorylevelname}%
         {}
         {%
+%    \end{macrocode}
+% Index: \\
+% |categorylevelname=\verb!*+[category]:+>name=\verb!*+<prefix>name+<break>(type)|
+%    \begin{macrocode}
             \index{%
                 \DTXD at categorylevelname%
                 \noexpand\actualchar%
-                \string\verb*% %
+                \string\verb% % to fool emacs highlighting
+                \noexpand\quotechar%
+                *%
                 \noexpand\verbatimchar
                 [\DTXD at category]:%
                 \verbatimchar%
                 \noexpand\levelchar%
-\@gtempa\noexpand\actualchar%
-\string\verb% % to fool emacs highlighting
-\noexpand\quotechar%
-%*
-\noexpand\verbatimchar%
-%\noexpand\bslash
-\@gtempa\noexpand\verbatimchar%
-    \ifx\@nil#1\@nil\else \the\@temptokena \fi
+                \noexpand\DTXD at printobjectname{\DTXD at gtempa@nobackslash}{\@gtempa}%
+                \ifblank{#1}{}{\string\DTXDbreak (#1)}%
+%    \end{macrocode}
+%
+% \cs{the}\cs{@temptokena} is not used here.
+% \changes{v1.07}{2022/12/19}{Fix occasional crash.}
+%
+%    \begin{macrocode}
            \noexpand\doc at handleencap{usage}                
-            }%
+            }% index
         }%
 }
+%    \end{macrocode}
+% \end{macro}
 
-
+% \begin{macro}{\DTXD at findcategorylevelname}
+%       Given \cs{DTXD at category}, create \cs{DTXD at categorylevelname},
+%       a detokenized name without backslash.
+%    \begin{macrocode}
 \newcommand*{\DTXD at findcategorylevelname}{%
     \edef\DTXD at categorylevelname{\DTXD at category}%
     \edef\DTXD at categorylevelname{\detokenize\expandafter{\DTXD at categorylevelname}}%
@@ -2210,108 +2346,341 @@
         {\StrGobbleLeft{\DTXD at categorylevelname}{1}[\DTXD at categorylevelname]}
         {}
 }
+%    \end{macrocode}
+% \end{macro}
 
+
+% \begin{macro}{\DTXD at gtempa@nobackslash} A version without the leading backslash.
+%    \begin{macrocode}
+\newcommand*{\DTXD at gtempa@nobackslash}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\DTXD at findgtempa} Detokenize \cs{@gtempa} and
+%   also find another version without any leading backslash.
+% \changes{v1.07}{2022/12/19}{Detokenized names.}
+%    \begin{macrocode}
+\newcommand*{\DTXD at findgtempa}[1]{%
+    \edef\@gtempa{\detokenize{#1}}%
+    \IfEndWith{\@gtempa}{ }{\StrGobbleRight{\@gtempa}{1}[\@gtempa]}{}%
+    \IfBeginWith{\@gtempa}{\DTXD at backslash}%
+        {\StrGobbleLeft{\@gtempa}{1}[\DTXD at gtempa@nobackslash]}%
+        {\edef\DTXD at gtempa@nobackslash{\@gtempa}}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\doc at createspecialindexes}
+%       \marg{1: name} \marg{2: index type} \marg{3: index group}
+%    \begin{macrocode}
 \def\doc at createspecialindexes#1#2#3{%
   \@temptokena{\space (#2)}%
   \@temptokenb{#3:}%
+%    \end{macrocode}
+%
+% \textbf{Define \cs{SpecialMain<name>Index} \marg{1: name}}
+%    \begin{macrocode}
   \@nameedef{SpecialMain#1Index}##1{%
-    \noexpand\@SpecialIndexHelper@##1\noexpand\@nil%        dtxdescribe
+%    \end{macrocode}
+%
+% Find \cs{@gtempa}, the name of the object.
+%    \begin{macrocode}
+    \noexpand\DTXD at findgtempa{##1}%
+%    \end{macrocode}
+%
+% \begin{description}
+% \item[\cs{@temptokena}:] Index (type).
+% \item[\cs{@temptokenb}:] Index group.
+% \item[\cs{@gtempa}:] Detokenized name of the particular object.
+% \item[\cs{DTXD at gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+%    \begin{macrocode}
     \noexpand\@bsphack
     \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
+%    \end{macrocode}
+%    \begin{macrocode}
   \ifdoc at toplevel
 %    \noexpand\special at index{##1\noexpand\actualchar
 %
 %
-    \noexpand\special at index{\noexpand\@gtempa\noexpand\actualchar%
-%    {\string\ttfamily\space##1}%
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar%
-%*
-\noexpand\verbatimchar%                                     dtxdescribe
-%\noexpand\bslash
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \ifx\@nil#2\@nil\else \the\@temptokena \fi
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-    \noexpand\encapchar main}%
+%    \end{macrocode}
+%
+% Index: \\
+% \verb?name=\verb!*+name+ (type) [category]|main?
+%    \begin{macrocode}
+    \noexpand\special at index{%
+        \noexpand\DTXD at printobjectname%                     dtxdescribe
+            {\noexpand\DTXD at gtempa@nobackslash}%
+            {\noexpand\@gtempa}%
+        \ifx\@nil#2\@nil\else \the\@temptokena \fi
+        \noexpand\DTXD at maybecategory%                       dtxdescribe
+        \noexpand\encapchar main%
+    }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
     \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
   \fi
 %
 %
+%    \end{macrocode}
+%
+% If group is not empty, index: \\
+% \verb?group:>name=\verb!*+name+ [category]|main?
+%
+%    \begin{macrocode}
   \ifx\@nil#3\@nil\else
-    \noexpand\special at index{\the\@temptokenb\noexpand\levelchar%
+    \noexpand\special at index{%
+        \the\@temptokenb\noexpand\levelchar%
 %      ##1\noexpand\actualchar{\string\ttfamily\space##1}%
-\noexpand\@gtempa\noexpand\actualchar%                      dtxdescribe
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar%
-%*
-\noexpand\verbatimchar%                                     dtxdescribe
-%\noexpand\bslash
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-      \noexpand\encapchar main}%
+        \noexpand\DTXD at printobjectname%                     dtxdescribe
+            {\noexpand\DTXD at gtempa@nobackslash}%
+            {\noexpand\@gtempa}%
+        \noexpand\DTXD at maybecategory%                       dtxdescribe
+        \noexpand\encapchar main%
+    }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
     \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
   \fi
-    \noexpand\@esphack}%
+  \noexpand\@esphack}%
+%    \end{macrocode}
 %
+% \textbf{Define \cs{Special<name>Index}  \marg{1: name}}
 %
+%    \begin{macrocode}
   \@nameedef{Special#1Index}##1{%
-    \noexpand\@SpecialIndexHelper@##1\noexpand\@nil%        dtxdescribe
+    \noexpand\DTXD at findgtempa{##1}%
+%    \end{macrocode}
+%
+% \begin{description}
+% \item[\cs{@temptokena}:] Index (type).
+% \item[\cs{@temptokenb}:] Index group.
+% \item[\cs{@gtempa}:] Detokenized name of the particular object.
+% \item[\cs{DTXD at gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+%    \begin{macrocode}
     \noexpand\@bsphack
     \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
+%    \end{macrocode}
 %
-%
+% If is a top level object, index:\\
+% \verb?name=\verb!*+name+ (type) [category]|usage?
+%    \begin{macrocode}
   \ifdoc at toplevel
-    \noexpand\doc at providetarget
+        \noexpand\doc at providetarget
+%    \end{macrocode}
+%    \begin{macrocode}
 %    \noexpand\index{##1\noexpand\actualchar{\string\ttfamily\space##1}%
-      \noexpand\index{\noexpand\@gtempa\noexpand\actualchar%    dtxdescribe
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar%
-%*
-\noexpand\verbatimchar%                                     dtxdescribe
-%\noexpand\bslash
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \ifx\@nil#2\@nil\else \the\@temptokena \fi
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-           \noexpand\doc at handleencap{usage}}%
-    \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
+        \noexpand\index{%
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \ifx\@nil#2\@nil\else \the\@temptokena \fi
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\doc at handleencap{usage}%
+        }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
+        \noexpand\DTXD at maybecategorylevel{#2}%              dtxdescribe
   \fi
 %
 %
+%    \end{macrocode}
+%
+% If group is not empty, index: \\
+% \verb?group:>name=\verb!*+name+ [category]|usage?
+%    \begin{macrocode}
   \ifx\@nil#3\@nil\else
-    \noexpand\index{\the\@temptokenb\noexpand\levelchar%
+    \noexpand\index{%
+        \the\@temptokenb\noexpand\levelchar%
 %       ##1\noexpand\actualchar{\string\ttfamily\space##1}
-\noexpand\@gtempa\noexpand\actualchar%                      dtxdescribe
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar
-%*
-\noexpand\verbatimchar%                                     dtxdescribe
-%\noexpand\bslash
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe    
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-           \noexpand\doc at handleencap{usage}}%
+        \noexpand\DTXD at printobjectname%                     dtxdescribe
+            {\noexpand\DTXD at gtempa@nobackslash}%
+            {\noexpand\@gtempa}%
+        \noexpand\DTXD at maybecategory%                       dtxdescribe
+        \noexpand\doc at handleencap{usage}%
+    }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
     \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
   \fi
 %
 %
     \noexpand\@esphack}}
+%    \end{macrocode}
+% \end{macro}
 
+
+% \begin{macro}{\doc at createspecialmacrolikeindexes}
+%       \marg{1: name} \marg{2: index type} \marg{3: index group}
+% \changes{v1.07}{2022/12/24}{Added category names for macros.}
+%    \begin{macrocode}
+\def\doc at createspecialmacrolikeindexes#1#2#3{%
+  \@temptokena{\space (#2)}%
+  \@temptokenb{#3:}%
+%    \end{macrocode}
+%
+% \textbf{Define \cs{Code<name>Index} \marg{1: |main| or |usage|} \marg{2: name}}
+%
+%    \begin{macrocode}
+  \@nameedef{Code#1Index}##1##2{%
+    \noexpand\DTXD at findgtempa{##2}%
+%    \end{macrocode}
+%
+% \begin{description}
+% \item[\cs{@temptokena}:] Index type.
+% \item[\cs{@temptokenb}:] Index group.
+% \item[\cs{@gtempa}:] Detokenized name of the particular object.
+% \item[\cs{DTXD at gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+%    \begin{macrocode}
+    \noexpand\@bsphack
+    \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
+%    \end{macrocode}
+%    \begin{macrocode}
+  \noexpand\ifdoc at noindex\noexpand\else
+%    \end{macrocode}
+%
+% If a top level object, index:\\
+% \verb?name=\verb!*+\name+ (type) [category]|<main or usage>?
+%    \begin{macrocode}
+    \ifdoc at toplevel
+      \noexpand\special at index{%
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \ifx\@nil#2\@nil\else \the\@temptokena \fi
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\encapchar ##1%
+      }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
+      \noexpand\DTXD at maybecategorylevel{#2}%                dtxdescribe
+    \fi
+%    \end{macrocode}
+%
+% If group is not empty, index: \\
+% \verb?group:>name=\verb!*+\name+ [category]|<main or usage>?
+%    \begin{macrocode}
+    \ifx\@nil#3\@nil\else
+      \noexpand\special at index{%
+            \the\@temptokenb\noexpand\levelchar
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\encapchar ##1%
+      }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
+      \noexpand\DTXD at maybecategorylevel{#2}%                dtxdescribe
+    \fi
+  \noexpand\fi
+    \noexpand\@esphack}%
+%    \end{macrocode}
+%
+% \textbf{Define \cs{SpecialMain<name>Index} \marg{1: name}}
+%    \begin{macrocode}
+  \@nameedef{SpecialMain#1Index}##1{%
+    \expandafter\noexpand\csname Code#1Index\endcsname
+        {main}{##1}}%
+%    \end{macrocode}
+%
+% \textbf{Define \cs{Special<name>Index} \marg{1: name}}
+%    \begin{macrocode}
+  \@nameedef{Special#1Index}##1{%
+    \noexpand\DTXD at findgtempa{##1}%
+%    \end{macrocode}
+%
+% \begin{description}
+% \item[\cs{@temptokena}:] Index type.
+% \item[\cs{@temptokenb}:] Index group.
+% \item[\cs{@gtempa}:] Detokenized name of the particular object.
+% \item[\cs{DTXD at gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+%    \begin{macrocode}
+    \noexpand\@bsphack
+    \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
+%    \end{macrocode}
+%    \begin{macrocode}
+  \noexpand\ifdoc at noindex\noexpand\else
+%    \end{macrocode}
+%
+% If a top level object, index:\\
+% \verb?name=\verb!*+\name+ (type) [category]|usage?
+%    \begin{macrocode}
+    \ifdoc at toplevel
+      \noexpand\doc at providetarget
+      \noexpand\index{%
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \ifx\@nil#2\@nil\else \the\@temptokena \fi
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\doc at handleencap{usage}%
+      }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
+    \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
+    \fi
+%    \end{macrocode}
+%
+% If group is not empty, index: \\
+% \verb?group:>name=\verb!*+\name+ [category]|usage?
+%    \begin{macrocode}
+    \ifx\@nil#3\@nil\else
+      \noexpand\index{%
+            \the\@temptokenb\noexpand\levelchar
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\doc at handleencap{usage}%
+      }%
+%    \end{macrocode}
+%
+% Maybe add the category index entry:
+%    \begin{macrocode}
+      \noexpand\DTXD at maybecategorylevel{#2}%                dtxdescribe
+    \fi
+  \noexpand\fi
+    \noexpand\@esphack}}
+
 }{}% doc loaded
 %    \end{macrocode}
+% \end{macro}
 
 
-% \subsection{\cs{DescribeMacro} and \cs{DescribeEnvironment}}
+% \subsection{Not \pkg{doc}: \cs{DescribeMacro} and \cs{DescribeEnvironment}}
 
-% \begin{macro}{\DescribeMacro} \oarg{class} \marg{\cs{name}}
+% \begin{macro}{\DescribeMacro} \oarg{category} \marg{\cs{name}}
 %
-% Redefined to allow hyperlinked index entries and an optional class:
+% Redefined to allow hyperlinked index entries and an optional category:
 %
 % \changes{v1.00}{2019/01/09}{Sans tag font.}
-% \changes{v1.01}{2019/01/20}{Put margin tag class in brackets.}
+% \changes{v1.01}{2019/01/20}{Put margin tag category in brackets.}
 % \changes{v1.02}{2019/07/14}{Fix if not \pkg{ltxdoc} class.}
 % \changes{v1.03}{2022/01/08}{Reduce hbox warnings.}
 %    \begin{macrocode}
-\IfPackageLoadedTF{doc}{
-}{% not doc
+\IfPackageLoadedTF{doc}{}{% not doc
 
 \providecommand*{\DescribeMacro}{}
 \renewcommand*{\DescribeMacro}[2][]{%
@@ -2326,7 +2695,7 @@
         \hbadness=10000%
         \hfuzz=5em%
         \raggedleft%
-        \ifblank{#1}{}{{\scriptsize\textsf{[#1]}} }% class
+        \ifblank{#1}{}{{\scriptsize\textsf{[#1]}} }% category
         \cmd{#2}% name
     }%
 }% marginpar
@@ -2335,25 +2704,25 @@
 %
 % Write the index sorted by the name without the backslash,
 % followed by the actual name with the backslash.
-% Append the class if given.
+% Append the category if given.
 %
-% Write name=csname>(class)\verb+|usage+
+% Write name=csname>[category]\verb+|usage+
 %    \begin{macrocode}
 \begingroup%
 \DTXD at origwrindex{%
     \DTXD at macroname{#2}\actualchar\DTXD at verbatimcmd{#2}% name
-    \ifblank{#1}{}{\levelchar[#1]}% class
+    \ifblank{#1}{}{\levelchar[#1]}% category
     \encapchar usage%
 }%
 %    \end{macrocode}
-% Only if a class was given:
+% Only if a category was given:
 %    \begin{macrocode}
 \ifblank{#1}%
-{}% no class
-{% class given
-% Again, and prepend the class:
+{}% no category
+{% category given
+% Again, and prepend the category:
 %
-% Write class=(class):>name=csname\verb+|usage+
+% Write category=[category]:>name=csname\verb+|usage+
 %    \begin{macrocode}
     \begingroup%
     \DTXD at origwrindex{%
@@ -2360,7 +2729,7 @@
     #1\actualchar[#1]:\levelchar%
     \DTXD at macroname{#2}\actualchar\DTXD at verbatimcmd{#2}%
     \encapchar usage}%
-}% class given
+}% category given
 \@esphack%
 \ignorespaces%
 }
@@ -2371,7 +2740,7 @@
 
 
 
-% \begin{macro}{\DescribeEnv} \oarg{class} \marg{environment name}
+% \begin{macro}{\DescribeEnv} \oarg{category} \marg{environment name}
 %
 % Redefined to allow hyperlinked index entries:
 % \changes{v1.02}{2019/07/14}{Fix if not \pkg{ltxdoc} class.}
@@ -2392,18 +2761,14 @@
 % \subsection{New \cs{Describe\dots} macros}
 
 
-% \begin{macro}{\DTX at filename} Stores the filename with a sanitized underscore.
-%    \begin{macrocode}
-\newcommand*{\DTXD at filename}{}
-%    \end{macrocode}
-% \end{macro}
-
-
 % \begin{macro}{\DTXD at filemarginparindex}
-%	\marg{class} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
+%	\marg{category} \marg{name} \marg{margin tag} \marg{index tag} \marg{main/usage}
 %
 % The name may have underscores.
 %    \begin{macrocode}
+\IfPackageLoadedTF{doc}{}{% not doc
+\newcommand*{\DTXD at filename}{}
+
 \newcommand*{\DTXD at filemarginparindex}[5]{%
 %    \end{macrocode}
 % Create a detokenized version of the filename\dots
@@ -2418,7 +2783,7 @@
 % The original filename is printed in the margin.
 % Any underscore characters have already been disabled
 % by the \cs{catcode} change.
-% \changes{v1.00}{2019/01/10}{Fix: File class.}
+% \changes{v1.00}{2019/01/10}{Fix: File category.}
 %    \begin{macrocode}
 \DTXD at margintag{#1}{#2}{#3}%
 %    \end{macrocode}
@@ -2432,22 +2797,35 @@
 \endgroup%
 \ignorespaces%
 }
+}% not doc
 %    \end{macrocode}
 % \end{macro}
 %
 %
-%
-% \begin{macro}{\DTXD at DescribeFile} \oarg{class} \marg{name}
-%
-% The name may have underscores.
+% \begin{macro}{\DescribeMacro}             \quad Redefine with new definitions.
+% \begin{macro}{\DescribeEnvironment}       \quad Redefine with new definitions.
 %    \begin{macrocode}
-\newcommand*{\DTXD at DescribeFile}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{File}{file}{usage}%
-}
+\IfPackageLoadedTF{doc}{% doc
+
+\RenewDocElement[macrolike = true ,
+                idxtype   = ,
+                idxgroup  = ,
+                printtype =
+               ]{Macro}{macro}
+
+\RenewDocElement[macrolike = false ,
+                idxtype   = env.  ,
+                idxgroup  = environments ,
+                printtype = \textit{env.}
+               ]{Env}{environment}
+
+}{}% doc
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 %
+%
 % \begin{macro}{\DescribeFile} \marg{name}
 %
 % The underscore character is temporarily disabled, then
@@ -2457,7 +2835,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=file,
     idxgroup=Files,
     printtype=\textit{file}
@@ -2465,6 +2843,10 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeFile}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{File}{file}{usage}%
+}
+
 \newcommand*{\DescribeFile}{%
     \begingroup\catcode`\_=12 \DTXD at DescribeFile%
 }
@@ -2474,17 +2856,8 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\DTXD at DescribeProgram} \oarg{class} \marg{name}
 %
-% The name may have underscores.
-%    \begin{macrocode}
-\newcommand*{\DTXD at DescribeProgram}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Prog}{program}{usage}%
-}
-%    \end{macrocode}
-% \end{macro}
 %
-%
 % \begin{macro}{\DescribeProgram} \marg{name}
 %
 % The underscore character is temporarily disabled, then
@@ -2494,7 +2867,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=program,
     idxgroup=Programs,
     printtype=\textit{Prog}
@@ -2502,8 +2875,12 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeProgram}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Prog}{program}{usage}%
+}
+
 \newcommand*{\DescribeProgram}{%
-\begingroup\catcode`\_=12 \DTXD at DescribeProgram%
+    \begingroup\catcode`\_=12 \DTXD at DescribeProgram%
 }
 }% not doc
 
@@ -2511,17 +2888,7 @@
 % \end{macro}
 
 
-% \begin{macro}{\DTXD at DescribeCommand} \oarg{class} \marg{name}
 %
-% The name may have underscores.
-%    \begin{macrocode}
-\newcommand*{\DTXD at DescribeCommand}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Cmd}{command}{usage}%
-}
-%    \end{macrocode}
-% \end{macro}
-%
-%
 % \begin{macro}{\DescribeCommand} \marg{name}
 %
 % The underscore character is temporarily disabled, then
@@ -2531,7 +2898,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=command,
     idxgroup=Commands,
     printtype=\textit{Cmd}
@@ -2539,8 +2906,12 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeCommand}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Cmd}{command}{usage}%
+}
+
 \newcommand*{\DescribeCommand}{%
-\begingroup\catcode`\_=12 \DTXD at DescribeCommand%
+    \begingroup\catcode`\_=12 \DTXD at DescribeCommand%
 }
 
 }% not doc
@@ -2549,16 +2920,6 @@
 %
 
 
-% \begin{macro}{\DTXD at DescribePackage} \oarg{class} \marg{name}
-% The name may have underscores.
-%    \begin{macrocode}
-\newcommand*{\DTXD at DescribePackage}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Pkg}{package}{usage}%
-}
-%    \end{macrocode}
-% \end{macro}
-%
-%
 % \begin{macro}{\DescribePackage} \marg{name}
 %
 % The underscore character is temporarily disabled, then
@@ -2570,7 +2931,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=package,
     idxgroup=Packages,
     printtype=\textit{Pkg}
@@ -2578,8 +2939,12 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribePackage}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Pkg}{package}{usage}%
+}
+
 \newcommand*{\DescribePackage}{%
-\begingroup\catcode`\_=12 \DTXD at DescribePackage%
+    \begingroup\catcode`\_=12 \DTXD at DescribePackage%
 }
 
 }% not doc
@@ -2587,17 +2952,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\DTXD at DescribeClass} \oarg{class} \marg{name}
 %
-% The name may have underscores.
-%    \begin{macrocode}
-\newcommand*{\DTXD at DescribeClass}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Cls}{class}{usage}%
-}
-%    \end{macrocode}
-% \end{macro}
-%
-%
 % \begin{macro}{\DescribeClass} \marg{name}
 %
 % The underscore character is temporarily disabled, then
@@ -2609,7 +2964,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=class,
     idxgroup=Classes,
     printtype=\textit{Cls}
@@ -2617,8 +2972,12 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeClass}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Cls}{class}{usage}%
+}
+
 \newcommand*{\DescribeClass}{%
-\begingroup\catcode`\_=12 \DTXD at DescribeClass%
+    \begingroup\catcode`\_=12 \DTXD at DescribeClass%
 }
 
 }% not doc
@@ -2625,13 +2984,13 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\DescribeOption} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeOption} \oarg{category} \marg{name}
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=option,
     idxgroup=Options,
     printtype=\textit{Opt}
@@ -2646,15 +3005,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\DescribeArgument} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeArgument} \oarg{category} \marg{name}
 %
-% The |class| may be used to categorize arguments by their macro or environment name.
+% The |category| may be used to categorize arguments by their macro or environment name.
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=argument,
     idxgroup=Arguments,
     printtype=\textit{Arg}
@@ -2669,13 +3028,13 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\DescribeBoolean} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeBoolean} \oarg{category} \marg{name}
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=boolean,
     idxgroup=Booleans,
     printtype=\textit{bool}
@@ -2690,13 +3049,13 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\DescribeLength} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeLength} \oarg{category} \marg{name}
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=true,
-    toplevel=false,
+    toplevel=true,
     idxtype=length,
     idxgroup=Lengths,
     printtype=\textit{Len}
@@ -2711,13 +3070,13 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\DescribeCounter} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeCounter} \oarg{category} \marg{name}
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=counter,
     idxgroup=Counters,
     printtype=\textit{Ctr}
@@ -2732,14 +3091,14 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\DescribeHook} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeHook} \oarg{category} \marg{name}
 % \changes{v1.03}{2021/12/18}{Added.}
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
-    macrolike=false,
-    toplevel=false,
+    macrolike=true,
+    toplevel=true,
     idxtype=hook,
     idxgroup=Hooks,
     printtype=\textit{Hook}
@@ -2755,15 +3114,15 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\DescribeKey} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeKey} \oarg{category} \marg{name}
 %
-% The |class| may be used to categorize keys by their kev/value group.
+% The |category| may be used to categorize keys by their kev/value group.
 %    \begin{macrocode}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=key,
     idxgroup=Keys,
     printtype=\textit{Key}
@@ -2779,12 +3138,12 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\DescribeObject} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeObject} \oarg{category} \marg{name}
 %
 % May be used to describe an arbitrary piece of code.
 % Creates a margin tag and index entries with \cs{ttfamily}.
 %
-% \changes{v1.01}{2019/01/20}{Put margin tag class in brackets.}
+% \changes{v1.01}{2019/01/20}{Put margin tag category in brackets.}
 % \changes{v1.02}{2019/07/14}{Added \cs{ignorespaces}.}
 % \changes{v1.02}{2019/07/16}{\cs{raggedleft} margin par.}
 % \changes{v1.03}{2022/01/08}{Reduce hbox warnings.}
@@ -2793,7 +3152,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=object,
     idxgroup=Objects,
     printtype=,
@@ -2841,11 +3200,11 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\DescribeOther} \oarg{class} \marg{name}
+% \begin{macro}{\DescribeOther} \oarg{category} \marg{name}
 %
 % May be used to describe an arbitrary non-programming object.
 % Creates a margin tag and index entries with roman type.
-% \changes{v1.01}{2019/01/20}{Put margin tag class in brackets.}
+% \changes{v1.01}{2019/01/20}{Put margin tag category in brackets.}
 % \changes{v1.02}{2019/07/14}{Added \cs{ignorespaces}.}
 % \changes{v1.02}{2019/07/16}{\cs{raggedleft} margin par.}
 % \changes{v1.03}{2022/01/08}{Reduce hbox warnings.}
@@ -2854,7 +3213,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=other,
     idxgroup=Other,
     printtype=,
@@ -2930,7 +3289,7 @@
 %
 % The following are for use inside a \env{description}.
 %
-% \begin{macro}{\ItemDescribeMacro} \oarg{class} \marg{\cs{name}}
+% \begin{macro}{\ItemDescribeMacro} \oarg{category} \marg{\cs{name}}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeMacro}[2][]{%
@@ -2941,7 +3300,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeEnv} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeEnv} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeEnv}[2][]{%
@@ -2952,7 +3311,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeArgument} \oarg{class} \marg{argument}
+% \begin{macro}{\ItemDescribeArgument} \oarg{category} \marg{argument}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeArgument}[2][]{%
@@ -2963,7 +3322,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeBoolean} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeBoolean} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeBoolean}[2][]{%
@@ -2974,7 +3333,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeLength} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeLength} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeLength}[2][]{%
@@ -2985,7 +3344,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeCounter} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeCounter} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeCounter}[2][]{%
@@ -2996,7 +3355,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeHook} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeHook} \oarg{category} \marg{name}
 % \changes{v1.03}{2021/12/18}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeHook}[2][]{%
@@ -3007,7 +3366,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeKey} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeKey} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeKey}[2][]{%
@@ -3018,7 +3377,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribePackage} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribePackage} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\DTXD at ItemDescribePackage}[2][]{%
@@ -3034,7 +3393,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeClass} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeClass} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\DTXD at ItemDescribeClass}[2][]{%
@@ -3050,7 +3409,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeOption} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeOption} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeOption}[2][]{%
@@ -3062,7 +3421,7 @@
 % \end{macro}
 
 
-% \begin{macro}{\ItemDescribeFile} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeFile} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\DTXD at ItemDescribeFile}[2][]{%
@@ -3078,7 +3437,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeProgram} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeProgram} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\DTXD at ItemDescribeProgram}[2][]{%
@@ -3094,7 +3453,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeCommand} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeCommand} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\DTXD at ItemDescribeCommand}[2][]{%
@@ -3110,7 +3469,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeObject} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeObject} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeObject}[2][]{%
@@ -3121,7 +3480,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\ItemDescribeOther} \oarg{class} \marg{name}
+% \begin{macro}{\ItemDescribeOther} \oarg{category} \marg{name}
 % \changes{v1.00}{2019/01/09}{Added.}
 %    \begin{macrocode}
 \newcommand{\ItemDescribeOther}[2][]{%
@@ -3353,7 +3712,8 @@
 %    \end{macrocode}
 
 
-% \DescribeMacro[dtxexamplefloat]{\DeclareFloatingEnvironment} A new float type for the examples.
+% \DescribeMacro[dtxexamplefloat]{\DeclareFloatingEnvironment}
+%       A new float type for the examples.
 %    \begin{macrocode}
 \DeclareFloatingEnvironment[
 fileext=lox,
@@ -3379,7 +3739,8 @@
 % \DescribeMacro[dtxexamplefloat]{\crefname} Name for \pkg{cleveref}.
 % \cs{crefname} here is required for documents not using the doc class:
 %    \begin{macrocode}
-\AddToHook{begindocument/before}{% Before .aux file is loaded.
+%\AddToHook{begindocument/after}{% Before .aux file is loaded.
+\AtBeginDocument{
     \ifdef{\crefname}{
         \crefname{dtxexamplefloat}{example}{examples}
     }{}
@@ -3929,7 +4290,7 @@
     {\hspace{-.1667em}\raisebox{-.5ex}{E}\hspace{-.125em}}
 
 \AtBeginDocument{
-\@ifpackageloaded{graphics}{
+\IfPackageLoadedTF{graphics}{
     \renewrobustcmd*{\XeTeXrevE}
         {\hspace{-.1667em}\raisebox{-.5ex}{\reflectbox{E}}\hspace{-.125em}}
 }{}

Modified: trunk/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty	2023-01-03 20:46:13 UTC (rev 65444)
+++ trunk/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty	2023-01-03 20:46:33 UTC (rev 65445)
@@ -18,7 +18,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{dtxdescribe}
-    [2022/12/07 v1.06 Describe additional object types in source files.]
+    [2023/01/03 v1.07 Describe additional object types in source files.]
 
 
 
@@ -101,9 +101,13 @@
 
 
 
+
+
+
+
 \AtBeginDocument{
-    \@ifpackageloaded{makeidx}{}{
-    \@ifpackageloaded{splitidx}{}{
+    \IfPackageLoadedTF{makeidx}{}{
+    \IfPackageLoadedTF{splitidx}{}{
         \RequirePackage{makeidx}
         \makeindex
     }}
@@ -129,7 +133,7 @@
 \RequirePackage{xstring}
 
 \AtBeginDocument{
-    \@ifpackageloaded{hyperref}{
+    \IfPackageLoadedTF{hyperref}{
         \pdfstringdefDisableCommands{%
             \def\quad{ }%
             \def\\{ }%
@@ -208,8 +212,8 @@
 |gdef|DTXD at backslash{\}
 |endgroup
 
-\@ifpackageloaded{doc}{
-\@ifpackageloaded{hypdoc}{
+\IfPackageLoadedTF{doc}{
+\IfPackageLoadedTF{hypdoc}{
 \AddToHook{begindocument/before}[doc/hyperref]{%
  \ifdoc at hyperref
  \else
@@ -222,8 +226,9 @@
 }{}% doc loaded
 
 \AtBeginDocument{
-\@ifpackageloaded{hypdoc}{
-\@ifpackageloaded{splitidx}{
+\IfPackageLoadedTF{doc}{
+\IfPackageLoadedTF{hypdoc}{
+\IfPackageLoadedTF{splitidx}{
 \renewcommand*{\@wrsindex}[2][]{%
   \ifx\relax#1\relax
     \if at splitidx
@@ -246,11 +251,41 @@
     \@esphack
   \fi
 }
+
+\def\HD at guesstoclevel#1{1}
+
+\preto\PrintChanges{\def\HD at guesstoclevel#1{0}}
+
+\newcounter{DTXD at indexnumber}
+
+\extendtheindex
+    {%
+        \addtocounter{DTXD at indexnumber}{1}%
+        \def\HD at guesstoclevel##1{0}%
+    }
+    {}
+    {}
+    {}
+
+\def\HD@@@bfseries\hfil#1\hfil{%
+  \ifx\\#1\\%
+  \else
+    \raisebox{\baselineskip}[0pt]{%
+      \kern-\HD at margin\relax
+      \pdfbookmark[\HD at toclevel@subindex]{#1}%      dtxdescribe
+        {HD.#1.\arabic{DTXD at indexnumber}}%          dtxdescribe
+      \kern\HD at margin\relax
+    }%
+  \fi
+  \hfil#1\hfil
+}%
+
 }{}% splitidx loaded
 }{}% hypdoc loaded
+}{}% doc loaded
 }% AtBeginDocument
 
-\@ifpackageloaded{doc}{
+\IfPackageLoadedTF{doc}{
     \newcommand*{\DTXD at gobble}{2}
 }{
     \newcommand*{\DTXD at gobble}{0}
@@ -279,7 +314,7 @@
 }
 
 \AtBeginDocument{
-    \@ifpackageloaded{doc}{}{
+    \IfPackageLoadedTF{doc}{}{% not doc
         \newenvironment*{macro}[1]{%
             \PackageError{dtxdescribe}
                 {The 'macro' environment is only\MessageBreak
@@ -320,7 +355,7 @@
             }\ensuremath\rangle
         }
         \def\meta at font@select{\itshape}
-    }% doc loaded
+    }% not doc
 }% AtBeginDocument
 
 
@@ -349,7 +384,7 @@
                 \hfuzz=5em%
                 \DTXD at printtype{%
                     #3% margintag
-                    \ifblank{#1}{}{ [#1]}% class
+                    \ifblank{#1}{}{ [#1]}% category
                 }%
                 \texttt{#2}% name
             }%
@@ -371,14 +406,14 @@
 \ifblank{#1}{}{[#1]:\levelchar}%
 #2\actualchar{\protect\ttfamily#2}% name
 \encapchar #5}%
-\ifblank{#1}{}{% class given
+\ifblank{#1}{}{% category given
 \begingroup%
 \DTXD at origwrindex{%
-#1\actualchar[#1]:\levelchar% class
+#1\actualchar[#1]:\levelchar% category
 #2\actualchar{\protect\ttfamily#2} % name
 (#4)% index tag
 \encapchar #5}%
-}% class given
+}% category given
 \@esphack%
 \ignorespaces%
 }
@@ -405,7 +440,7 @@
         \hfuzz=5em%
         \DTXD at printtype{%
             #3% margin tag
-            \ifblank{#1}{}{ [#1]}% class
+            \ifblank{#1}{}{ [#1]}% category
         }%
         \cmd{#2}% name
     }%
@@ -413,7 +448,7 @@
 }{}% not float?
 \begingroup%
 \DTXD at origwrindex{%
-\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% class
+\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% category
 \DTXD at macroname{#2}\actualchar\DTXD at verbatimcmd{#2} % name
 (#4)% index tag
 \encapchar #5}%
@@ -420,7 +455,7 @@
 \begingroup%
 \DTXD at origwrindex{%
 #4:\levelchar% index tag
-\ifblank{#1}{}{[#1]:\levelchar}% class
+\ifblank{#1}{}{[#1]:\levelchar}% category
 \DTXD at verbatimcmd{#2}% name
 \encapchar #5}%
 \@esphack%
@@ -445,6 +480,8 @@
 \ExplSyntaxOff
 
 
+\IfPackageLoadedTF{doc}{
+
 \def\@doc at describe#1#2{%                    dtxdescribe
     \ifdoc at noprint\else
       \@ifundefined{@captype}{% not float?  dtxdescribe
@@ -463,13 +500,11 @@
     \fi
   \@esphack
   \endgroup
-  \ignorespaces}
+  \ignorespaces%
+}
 
+}{}% doc loaded
 
-\AtBeginDocument{
-\def\HD at guesstoclevel#1{1}
-}
-
 \IfPackageLoadedTF{doc}{%
 
 \def\@NewDocElement#1#2#3{%
@@ -519,22 +554,32 @@
     \fi
 }
 
+\newcommand*{\DTXDbreak}{\space\penalty200}
+
+\newcommand*{\DTXD at printobjectname}[2]{%
+    #1%
+    \actualchar%
+    \string\verb% %
+    \quotechar%
+    *%
+    \verbatimchar%
+    #2%
+    \verbatimchar%
+}
+
 \newcommand*{\DTXD at maybecategory}{%
     \ifdefvoid{\DTXD at category}%
         {}%
-        {\space[%
+        {
+            \string\DTXDbreak
+            [%
             \string\verb%
+            \noexpand\quotechar%
+            *%
             \verbatimchar\DTXD at category\verbatimchar%
         ]}%
 }
 
-\newcommand*{\DTXD at macrotocsname}[1]{%
-  \ifcat\relax\noexpand#1%
-    \expandafter\expandafter\expandafter\@gobble\expandafter\string
-  \fi
-  #1%
-}
-
 \newcommand*{\DTXD at categorylevelname}
 
 \newcommand*{\DTXD at maybecategorylevel}[1]{%
@@ -544,19 +589,17 @@
             \index{%
                 \DTXD at categorylevelname%
                 \noexpand\actualchar%
-                \string\verb*% %
+                \string\verb% % to fool emacs highlighting
+                \noexpand\quotechar%
+                *%
                 \noexpand\verbatimchar
                 [\DTXD at category]:%
                 \verbatimchar%
                 \noexpand\levelchar%
-\@gtempa\noexpand\actualchar%
-\string\verb% % to fool emacs highlighting
-\noexpand\quotechar%
-\noexpand\verbatimchar%
-\@gtempa\noexpand\verbatimchar%
-    \ifx\@nil#1\@nil\else \the\@temptokena \fi
+                \noexpand\DTXD at printobjectname{\DTXD at gtempa@nobackslash}{\@gtempa}%
+                \ifblank{#1}{}{\string\DTXDbreak (#1)}%
            \noexpand\doc at handleencap{usage}
-            }%
+            }% index
         }%
 }
 
@@ -568,70 +611,145 @@
         {}
 }
 
+\newcommand*{\DTXD at gtempa@nobackslash}{}
+
+\newcommand*{\DTXD at findgtempa}[1]{%
+    \edef\@gtempa{\detokenize{#1}}%
+    \IfEndWith{\@gtempa}{ }{\StrGobbleRight{\@gtempa}{1}[\@gtempa]}{}%
+    \IfBeginWith{\@gtempa}{\DTXD at backslash}%
+        {\StrGobbleLeft{\@gtempa}{1}[\DTXD at gtempa@nobackslash]}%
+        {\edef\DTXD at gtempa@nobackslash{\@gtempa}}%
+}
+
 \def\doc at createspecialindexes#1#2#3{%
   \@temptokena{\space (#2)}%
   \@temptokenb{#3:}%
   \@nameedef{SpecialMain#1Index}##1{%
-    \noexpand\@SpecialIndexHelper@##1\noexpand\@nil%        dtxdescribe
+    \noexpand\DTXD at findgtempa{##1}%
     \noexpand\@bsphack
     \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
   \ifdoc at toplevel
-    \noexpand\special at index{\noexpand\@gtempa\noexpand\actualchar%
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar%
-\noexpand\verbatimchar%                                     dtxdescribe
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \ifx\@nil#2\@nil\else \the\@temptokena \fi
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-    \noexpand\encapchar main}%
+    \noexpand\special at index{%
+        \noexpand\DTXD at printobjectname%                     dtxdescribe
+            {\noexpand\DTXD at gtempa@nobackslash}%
+            {\noexpand\@gtempa}%
+        \ifx\@nil#2\@nil\else \the\@temptokena \fi
+        \noexpand\DTXD at maybecategory%                       dtxdescribe
+        \noexpand\encapchar main%
+    }%
     \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
   \fi
   \ifx\@nil#3\@nil\else
-    \noexpand\special at index{\the\@temptokenb\noexpand\levelchar%
-\noexpand\@gtempa\noexpand\actualchar%                      dtxdescribe
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar%
-\noexpand\verbatimchar%                                     dtxdescribe
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-      \noexpand\encapchar main}%
+    \noexpand\special at index{%
+        \the\@temptokenb\noexpand\levelchar%
+        \noexpand\DTXD at printobjectname%                     dtxdescribe
+            {\noexpand\DTXD at gtempa@nobackslash}%
+            {\noexpand\@gtempa}%
+        \noexpand\DTXD at maybecategory%                       dtxdescribe
+        \noexpand\encapchar main%
+    }%
     \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
   \fi
-    \noexpand\@esphack}%
+  \noexpand\@esphack}%
   \@nameedef{Special#1Index}##1{%
-    \noexpand\@SpecialIndexHelper@##1\noexpand\@nil%        dtxdescribe
+    \noexpand\DTXD at findgtempa{##1}%
     \noexpand\@bsphack
     \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
   \ifdoc at toplevel
-    \noexpand\doc at providetarget
-      \noexpand\index{\noexpand\@gtempa\noexpand\actualchar%    dtxdescribe
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar%
-\noexpand\verbatimchar%                                     dtxdescribe
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \ifx\@nil#2\@nil\else \the\@temptokena \fi
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-           \noexpand\doc at handleencap{usage}}%
-    \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
+        \noexpand\doc at providetarget
+        \noexpand\index{%
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \ifx\@nil#2\@nil\else \the\@temptokena \fi
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\doc at handleencap{usage}%
+        }%
+        \noexpand\DTXD at maybecategorylevel{#2}%              dtxdescribe
   \fi
   \ifx\@nil#3\@nil\else
-    \noexpand\index{\the\@temptokenb\noexpand\levelchar%
-\noexpand\@gtempa\noexpand\actualchar%                      dtxdescribe
-\string\verb% % to fool emacs highlighting%                 dtxdescribe
-\noexpand\quotechar
-\noexpand\verbatimchar%                                     dtxdescribe
-\noexpand\@gtempa\noexpand\verbatimchar%                    dtxdescribe
-    \noexpand\DTXD at maybecategory%                           dtxdescribe
-           \noexpand\doc at handleencap{usage}}%
+    \noexpand\index{%
+        \the\@temptokenb\noexpand\levelchar%
+        \noexpand\DTXD at printobjectname%                     dtxdescribe
+            {\noexpand\DTXD at gtempa@nobackslash}%
+            {\noexpand\@gtempa}%
+        \noexpand\DTXD at maybecategory%                       dtxdescribe
+        \noexpand\doc at handleencap{usage}%
+    }%
     \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
   \fi
     \noexpand\@esphack}}
 
+\def\doc at createspecialmacrolikeindexes#1#2#3{%
+  \@temptokena{\space (#2)}%
+  \@temptokenb{#3:}%
+  \@nameedef{Code#1Index}##1##2{%
+    \noexpand\DTXD at findgtempa{##2}%
+    \noexpand\@bsphack
+    \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
+  \noexpand\ifdoc at noindex\noexpand\else
+    \ifdoc at toplevel
+      \noexpand\special at index{%
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \ifx\@nil#2\@nil\else \the\@temptokena \fi
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\encapchar ##1%
+      }%
+      \noexpand\DTXD at maybecategorylevel{#2}%                dtxdescribe
+    \fi
+    \ifx\@nil#3\@nil\else
+      \noexpand\special at index{%
+            \the\@temptokenb\noexpand\levelchar
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\encapchar ##1%
+      }%
+      \noexpand\DTXD at maybecategorylevel{#2}%                dtxdescribe
+    \fi
+  \noexpand\fi
+    \noexpand\@esphack}%
+  \@nameedef{SpecialMain#1Index}##1{%
+    \expandafter\noexpand\csname Code#1Index\endcsname
+        {main}{##1}}%
+  \@nameedef{Special#1Index}##1{%
+    \noexpand\DTXD at findgtempa{##1}%
+    \noexpand\@bsphack
+    \noexpand\DTXD at findcategorylevelname%                   dtxdescribe
+  \noexpand\ifdoc at noindex\noexpand\else
+    \ifdoc at toplevel
+      \noexpand\doc at providetarget
+      \noexpand\index{%
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \ifx\@nil#2\@nil\else \the\@temptokena \fi
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\doc at handleencap{usage}%
+      }%
+    \noexpand\DTXD at maybecategorylevel{#2}%                  dtxdescribe
+    \fi
+    \ifx\@nil#3\@nil\else
+      \noexpand\index{%
+            \the\@temptokenb\noexpand\levelchar
+            \noexpand\DTXD at printobjectname%                 dtxdescribe
+                {\noexpand\DTXD at gtempa@nobackslash}%
+                {\noexpand\@gtempa}%
+            \noexpand\DTXD at maybecategory%                   dtxdescribe
+            \noexpand\doc at handleencap{usage}%
+      }%
+      \noexpand\DTXD at maybecategorylevel{#2}%                dtxdescribe
+    \fi
+  \noexpand\fi
+    \noexpand\@esphack}}
+
 }{}% doc loaded
 
 
-\IfPackageLoadedTF{doc}{
-}{% not doc
+\IfPackageLoadedTF{doc}{}{% not doc
 
 \providecommand*{\DescribeMacro}{}
 \renewcommand*{\DescribeMacro}[2][]{%
@@ -643,7 +761,7 @@
         \hbadness=10000%
         \hfuzz=5em%
         \raggedleft%
-        \ifblank{#1}{}{{\scriptsize\textsf{[#1]}} }% class
+        \ifblank{#1}{}{{\scriptsize\textsf{[#1]}} }% category
         \cmd{#2}% name
     }%
 }% marginpar
@@ -651,18 +769,18 @@
 \begingroup%
 \DTXD at origwrindex{%
     \DTXD at macroname{#2}\actualchar\DTXD at verbatimcmd{#2}% name
-    \ifblank{#1}{}{\levelchar[#1]}% class
+    \ifblank{#1}{}{\levelchar[#1]}% category
     \encapchar usage%
 }%
 \ifblank{#1}%
-{}% no class
-{% class given
+{}% no category
+{% category given
     \begingroup%
     \DTXD at origwrindex{%
     #1\actualchar[#1]:\levelchar%
     \DTXD at macroname{#2}\actualchar\DTXD at verbatimcmd{#2}%
     \encapchar usage}%
-}% class given
+}% category given
 \@esphack%
 \ignorespaces%
 }
@@ -678,6 +796,7 @@
 }% not doc
 
 
+\IfPackageLoadedTF{doc}{}{% not doc
 \newcommand*{\DTXD at filename}{}
 
 \newcommand*{\DTXD at filemarginparindex}[5]{%
@@ -688,14 +807,27 @@
 \endgroup%
 \ignorespaces%
 }
-\newcommand*{\DTXD at DescribeFile}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{File}{file}{usage}%
-}
+}% not doc
 \IfPackageLoadedTF{doc}{% doc
 
+\RenewDocElement[macrolike = true ,
+                idxtype   = ,
+                idxgroup  = ,
+                printtype =
+               ]{Macro}{macro}
+
+\RenewDocElement[macrolike = false ,
+                idxtype   = env.  ,
+                idxgroup  = environments ,
+                printtype = \textit{env.}
+               ]{Env}{environment}
+
+}{}% doc
+\IfPackageLoadedTF{doc}{% doc
+
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=file,
     idxgroup=Files,
     printtype=\textit{file}
@@ -703,19 +835,20 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeFile}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{File}{file}{usage}%
+}
+
 \newcommand*{\DescribeFile}{%
     \begingroup\catcode`\_=12 \DTXD at DescribeFile%
 }
 
 }% not doc
-\newcommand*{\DTXD at DescribeProgram}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Prog}{program}{usage}%
-}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=program,
     idxgroup=Programs,
     printtype=\textit{Prog}
@@ -723,20 +856,21 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeProgram}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Prog}{program}{usage}%
+}
+
 \newcommand*{\DescribeProgram}{%
-\begingroup\catcode`\_=12 \DTXD at DescribeProgram%
+    \begingroup\catcode`\_=12 \DTXD at DescribeProgram%
 }
 }% not doc
 
 
-\newcommand*{\DTXD at DescribeCommand}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Cmd}{command}{usage}%
-}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=command,
     idxgroup=Commands,
     printtype=\textit{Cmd}
@@ -744,20 +878,21 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeCommand}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Cmd}{command}{usage}%
+}
+
 \newcommand*{\DescribeCommand}{%
-\begingroup\catcode`\_=12 \DTXD at DescribeCommand%
+    \begingroup\catcode`\_=12 \DTXD at DescribeCommand%
 }
 
 }% not doc
 
-\newcommand*{\DTXD at DescribePackage}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Pkg}{package}{usage}%
-}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=package,
     idxgroup=Packages,
     printtype=\textit{Pkg}
@@ -765,21 +900,22 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribePackage}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Pkg}{package}{usage}%
+}
+
 \newcommand*{\DescribePackage}{%
-\begingroup\catcode`\_=12 \DTXD at DescribePackage%
+    \begingroup\catcode`\_=12 \DTXD at DescribePackage%
 }
 
 }% not doc
 
 
-\newcommand*{\DTXD at DescribeClass}[2][]{%
-\DTXD at filemarginparindex{#1}{#2}{Cls}{class}{usage}%
-}
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=class,
     idxgroup=Classes,
     printtype=\textit{Cls}
@@ -787,8 +923,12 @@
 
 }{% not doc
 
+\newcommand*{\DTXD at DescribeClass}[2][]{%
+    \DTXD at filemarginparindex{#1}{#2}{Cls}{class}{usage}%
+}
+
 \newcommand*{\DescribeClass}{%
-\begingroup\catcode`\_=12 \DTXD at DescribeClass%
+    \begingroup\catcode`\_=12 \DTXD at DescribeClass%
 }
 
 }% not doc
@@ -797,7 +937,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=option,
     idxgroup=Options,
     printtype=\textit{Opt}
@@ -813,7 +953,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=argument,
     idxgroup=Arguments,
     printtype=\textit{Arg}
@@ -829,7 +969,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=boolean,
     idxgroup=Booleans,
     printtype=\textit{bool}
@@ -845,7 +985,7 @@
 
 \NewDocElement[
     macrolike=true,
-    toplevel=false,
+    toplevel=true,
     idxtype=length,
     idxgroup=Lengths,
     printtype=\textit{Len}
@@ -861,7 +1001,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=counter,
     idxgroup=Counters,
     printtype=\textit{Ctr}
@@ -876,8 +1016,8 @@
 \IfPackageLoadedTF{doc}{% doc
 
 \NewDocElement[
-    macrolike=false,
-    toplevel=false,
+    macrolike=true,
+    toplevel=true,
     idxtype=hook,
     idxgroup=Hooks,
     printtype=\textit{Hook}
@@ -893,7 +1033,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=key,
     idxgroup=Keys,
     printtype=\textit{Key}
@@ -909,7 +1049,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=object,
     idxgroup=Objects,
     printtype=,
@@ -958,7 +1098,7 @@
 
 \NewDocElement[
     macrolike=false,
-    toplevel=false,
+    toplevel=true,
     idxtype=other,
     idxgroup=Other,
     printtype=,
@@ -1228,7 +1368,7 @@
 position=top,
 }
 
-\AddToHook{begindocument/before}{% Before .aux file is loaded.
+\AtBeginDocument{
     \ifdef{\crefname}{
         \crefname{dtxexamplefloat}{example}{examples}
     }{}
@@ -1418,7 +1558,7 @@
     {\hspace{-.1667em}\raisebox{-.5ex}{E}\hspace{-.125em}}
 
 \AtBeginDocument{
-\@ifpackageloaded{graphics}{
+\IfPackageLoadedTF{graphics}{
     \renewrobustcmd*{\XeTeXrevE}
         {\hspace{-.1667em}\raisebox{-.5ex}{\reflectbox{E}}\hspace{-.125em}}
 }{}



More information about the tex-live-commits mailing list.