summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-01-03 20:46:33 +0000
committerKarl Berry <karl@freefriends.org>2023-01-03 20:46:33 +0000
commitb689edbc3cc8b4c8f0db65595c7935095fbfe307 (patch)
treefd74f86861a1426813bb6400ddc5bddc49eeffbd /Master/texmf-dist/source/latex
parent4eceeb533022d0d2963095e14faa3fec9e03b821 (diff)
dtxdescribe (3jan23)
git-svn-id: svn://tug.org/texlive/trunk@65445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx1035
1 files changed, 698 insertions, 337 deletions
diff --git a/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx b/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx
index 0d3d54db2f2..e271465c21b 100644
--- a/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx
+++ b/Master/texmf-dist/source/latex/dtxdescribe/dtxdescribe.dtx
@@ -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 @@ pageanchor=true,
%<*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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
%
% \bigskip
%
-% {\small\textcopyright{} 2016--2022} Brian Dunn\\ \small \texttt{bd@BDTechConcepts.com}
+% {\small\textcopyright{} 2016--2023} Brian Dunn\\ \small \texttt{bd@BDTechConcepts.com}
%
% \vspace{.5in}
%
@@ -252,9 +233,10 @@ pageanchor=true,
% 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 @@ pageanchor=true,
%
% \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 @@ pageanchor=true,
% 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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% 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,6 +391,8 @@ pageanchor=true,
% 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.
+
@@ -436,24 +414,24 @@ pageanchor=true,
% 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 @@ pageanchor=true,
% 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 @@ pageanchor=true,
%
% 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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% 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 @@ pageanchor=true,
% 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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
%
% 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 @@ pageanchor=true,
% 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 @@ pageanchor=true,
%
% 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 @@ pageanchor=true,
%
% \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 @@ pageanchor=true,
% 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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
-% \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@hyperref
\else
@@ -1622,12 +1618,19 @@ pageanchor=true,
}{}% 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@splitidx
@@ -1653,8 +1656,70 @@ pageanchor=true,
\@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@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@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@indexnumber}
+
+\extendtheindex
+ {%
+ \addtocounter{DTXD@indexnumber}{1}%
+ \def\HD@guesstoclevel##1{0}%
+ }
+ {}
+ {}
+ {}
+
+\def\HD@@@bfseries\hfil#1\hfil{%
+ \ifx\\#1\\%
+ \else
+ \raisebox{\baselineskip}[0pt]{%
+ \kern-\HD@margin\relax
+% \pdfbookmark[\HD@toclevel@subindex]{#1}{HD.#1}}%
+ \pdfbookmark[\HD@toclevel@subindex]{#1}% dtxdescribe
+ {HD.#1.\arabic{DTXD@indexnumber}}% dtxdescribe
+ \kern\HD@margin\relax
+ }%
+ \fi
+ \hfil#1\hfil
+}%
+% \end{macrocode}
+
+% \begin{macrocode}
}{}% splitidx loaded
}{}% hypdoc loaded
+}{}% doc loaded
}% AtBeginDocument
% \end{macrocode}
@@ -1667,7 +1732,7 @@ pageanchor=true,
% 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@gobble}{2}
}{
\newcommand*{\DTXD@gobble}{0}
@@ -1694,7 +1759,7 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
}\ensuremath\rangle
}
\def\meta@font@select{\itshape}
- }% doc loaded
+ }% not doc
}% AtBeginDocument
% \end{macrocode}
@@ -1781,7 +1846,7 @@ pageanchor=true,
%
% \begin{macro}{\DTXD@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 @@ pageanchor=true,
-% \begin{macro}{\DTXD@margintag} \marg{class} \marg{name} \marg{margin tag}
+% \begin{macro}{\DTXD@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@margintag}[3]{%
@@ -1835,7 +1900,7 @@ pageanchor=true,
\hfuzz=5em%
\DTXD@printtype{%
#3% margintag
- \ifblank{#1}{}{ [#1]}% class
+ \ifblank{#1}{}{ [#1]}% category
}%
\texttt{#2}% name
}%
@@ -1847,12 +1912,12 @@ pageanchor=true,
% \begin{macro}{\DTXD@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 @@ pageanchor=true,
%
% 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 @@ pageanchor=true,
\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 @@ pageanchor=true,
\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@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 @@ pageanchor=true,
% \end{macro}
% \begin{macro}{\DTXD@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@margintagindex}[5]{%
% \@bsphack%
@@ -1974,12 +2039,12 @@ pageanchor=true,
% \end{macro}
% \begin{macro}{\DTXD@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@cmdmargintagindex}[5]{%
\@bsphack%
@@ -1996,7 +2061,7 @@ pageanchor=true,
\hfuzz=5em%
\DTXD@printtype{%
#3% margin tag
- \ifblank{#1}{}{ [#1]}% class
+ \ifblank{#1}{}{ [#1]}% category
}%
\cmd{#2}% name
}%
@@ -2006,13 +2071,13 @@ pageanchor=true,
%
% 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@origwrindex{%
-\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% class
+\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% category
\DTXD@macroname{#2}\actualchar\DTXD@verbatimcmd{#2} % name
(#4)% index tag
\encapchar #5}%
@@ -2021,13 +2086,13 @@ pageanchor=true,
% 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@origwrindex{%
#4:\levelchar% index tag
-\ifblank{#1}{}{[#1]:\levelchar}% class
+\ifblank{#1}{}{[#1]:\levelchar}% category
\DTXD@verbatimcmd{#2}% name
\encapchar #5}%
\@esphack%
@@ -2038,11 +2103,14 @@ pageanchor=true,
%
-% \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}
@@ -2064,11 +2132,13 @@ pageanchor=true,
% \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@describe#1#2{% dtxdescribe
\ifdoc@noprint\else
\@ifundefined{@captype}{% not float? dtxdescribe
@@ -2087,26 +2157,20 @@ pageanchor=true,
\fi
\@esphack
\endgroup
- \ignorespaces}
-% \end{macrocode}
-
+ \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@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 @@ pageanchor=true,
\doc@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@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@printobjectname}
+% is used when the index is read back.
+%
+% \begin{macrocode}
+\newcommand*{\DTXD@printobjectname}[2]{%
+ #1%
+ \actualchar%
+ \string\verb% %
+ \quotechar%
+ *%
+ \verbatimchar%
+ #2%
+ \verbatimchar%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\DTXD@maybecategory} If there is a category, it is added verbatim.
+% \begin{macrocode}
\newcommand*{\DTXD@maybecategory}{%
\ifdefvoid{\DTXD@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@category\verbatimchar%
]}%
}
+% \end{macrocode}
+% \end{macro}
-\newcommand*{\DTXD@macrotocsname}[1]{%
- \ifcat\relax\noexpand#1%
- \expandafter\expandafter\expandafter\@gobble\expandafter\string
- \fi
- #1%
-}
-
+% \begin{macro}{\DTXD@categorylevelname} The simplified name, without backslash.
+% \begin{macrocode}
\newcommand*{\DTXD@categorylevelname}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\DTXD@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@category}:] The name of the category, printed in brackets [],
+% such as \cs{macroname}.
+% \item [\cs{DTXD@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@maybecategorylevel}[1]{%
\ifdefvoid{\DTXD@categorylevelname}%
{}
{%
+% \end{macrocode}
+% Index: \\
+% |categorylevelname=\verb!*+[category]:+>name=\verb!*+<prefix>name+<break>(type)|
+% \begin{macrocode}
\index{%
\DTXD@categorylevelname%
\noexpand\actualchar%
- \string\verb*% %
+ \string\verb% % to fool emacs highlighting
+ \noexpand\quotechar%
+ *%
\noexpand\verbatimchar
[\DTXD@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@printobjectname{\DTXD@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@handleencap{usage}
- }%
+ }% index
}%
}
+% \end{macrocode}
+% \end{macro}
-
+% \begin{macro}{\DTXD@findcategorylevelname}
+% Given \cs{DTXD@category}, create \cs{DTXD@categorylevelname},
+% a detokenized name without backslash.
+% \begin{macrocode}
\newcommand*{\DTXD@findcategorylevelname}{%
\edef\DTXD@categorylevelname{\DTXD@category}%
\edef\DTXD@categorylevelname{\detokenize\expandafter{\DTXD@categorylevelname}}%
@@ -2210,108 +2346,341 @@ pageanchor=true,
{\StrGobbleLeft{\DTXD@categorylevelname}{1}[\DTXD@categorylevelname]}
{}
}
+% \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\DTXD@gtempa@nobackslash} A version without the leading backslash.
+% \begin{macrocode}
+\newcommand*{\DTXD@gtempa@nobackslash}{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\DTXD@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@findgtempa}[1]{%
+ \edef\@gtempa{\detokenize{#1}}%
+ \IfEndWith{\@gtempa}{ }{\StrGobbleRight{\@gtempa}{1}[\@gtempa]}{}%
+ \IfBeginWith{\@gtempa}{\DTXD@backslash}%
+ {\StrGobbleLeft{\@gtempa}{1}[\DTXD@gtempa@nobackslash]}%
+ {\edef\DTXD@gtempa@nobackslash{\@gtempa}}%
+}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\doc@createspecialindexes}
+% \marg{1: name} \marg{2: index type} \marg{3: index group}
+% \begin{macrocode}
\def\doc@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@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@gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+% \begin{macrocode}
\noexpand\@bsphack
\noexpand\DTXD@findcategorylevelname% dtxdescribe
+% \end{macrocode}
+% \begin{macrocode}
\ifdoc@toplevel
% \noexpand\special@index{##1\noexpand\actualchar
%
%
- \noexpand\special@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@maybecategory% dtxdescribe
- \noexpand\encapchar main}%
+% \end{macrocode}
+%
+% Index: \\
+% \verb?name=\verb!*+name+ (type) [category]|main?
+% \begin{macrocode}
+ \noexpand\special@index{%
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \ifx\@nil#2\@nil\else \the\@temptokena \fi
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\encapchar main%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
\noexpand\DTXD@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@index{\the\@temptokenb\noexpand\levelchar%
+ \noexpand\special@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@maybecategory% dtxdescribe
- \noexpand\encapchar main}%
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\encapchar main%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
\noexpand\DTXD@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@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@gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+% \begin{macrocode}
\noexpand\@bsphack
\noexpand\DTXD@findcategorylevelname% dtxdescribe
+% \end{macrocode}
%
-%
+% If is a top level object, index:\\
+% \verb?name=\verb!*+name+ (type) [category]|usage?
+% \begin{macrocode}
\ifdoc@toplevel
- \noexpand\doc@providetarget
+ \noexpand\doc@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@maybecategory% dtxdescribe
- \noexpand\doc@handleencap{usage}}%
- \noexpand\DTXD@maybecategorylevel{#2}% dtxdescribe
+ \noexpand\index{%
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \ifx\@nil#2\@nil\else \the\@temptokena \fi
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\doc@handleencap{usage}%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
+ \noexpand\DTXD@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@maybecategory% dtxdescribe
- \noexpand\doc@handleencap{usage}}%
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\doc@handleencap{usage}%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
\noexpand\DTXD@maybecategorylevel{#2}% dtxdescribe
\fi
%
%
\noexpand\@esphack}}
+% \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\doc@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@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@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@gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+% \begin{macrocode}
+ \noexpand\@bsphack
+ \noexpand\DTXD@findcategorylevelname% dtxdescribe
+% \end{macrocode}
+% \begin{macrocode}
+ \noexpand\ifdoc@noindex\noexpand\else
+% \end{macrocode}
+%
+% If a top level object, index:\\
+% \verb?name=\verb!*+\name+ (type) [category]|<main or usage>?
+% \begin{macrocode}
+ \ifdoc@toplevel
+ \noexpand\special@index{%
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \ifx\@nil#2\@nil\else \the\@temptokena \fi
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\encapchar ##1%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
+ \noexpand\DTXD@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@index{%
+ \the\@temptokenb\noexpand\levelchar
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\encapchar ##1%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
+ \noexpand\DTXD@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@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@gtempa@nobackslash}:] Detokenized name without backslash.
+% \end{description}
+%
+% \begin{macrocode}
+ \noexpand\@bsphack
+ \noexpand\DTXD@findcategorylevelname% dtxdescribe
+% \end{macrocode}
+% \begin{macrocode}
+ \noexpand\ifdoc@noindex\noexpand\else
+% \end{macrocode}
+%
+% If a top level object, index:\\
+% \verb?name=\verb!*+\name+ (type) [category]|usage?
+% \begin{macrocode}
+ \ifdoc@toplevel
+ \noexpand\doc@providetarget
+ \noexpand\index{%
+ \noexpand\DTXD@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \ifx\@nil#2\@nil\else \the\@temptokena \fi
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\doc@handleencap{usage}%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
+ \noexpand\DTXD@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@printobjectname% dtxdescribe
+ {\noexpand\DTXD@gtempa@nobackslash}%
+ {\noexpand\@gtempa}%
+ \noexpand\DTXD@maybecategory% dtxdescribe
+ \noexpand\doc@handleencap{usage}%
+ }%
+% \end{macrocode}
+%
+% Maybe add the category index entry:
+% \begin{macrocode}
+ \noexpand\DTXD@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 @@ pageanchor=true,
\hbadness=10000%
\hfuzz=5em%
\raggedleft%
- \ifblank{#1}{}{{\scriptsize\textsf{[#1]}} }% class
+ \ifblank{#1}{}{{\scriptsize\textsf{[#1]}} }% category
\cmd{#2}% name
}%
}% marginpar
@@ -2335,32 +2704,32 @@ pageanchor=true,
%
% 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@origwrindex{%
\DTXD@macroname{#2}\actualchar\DTXD@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@origwrindex{%
#1\actualchar[#1]:\levelchar%
\DTXD@macroname{#2}\actualchar\DTXD@verbatimcmd{#2}%
\encapchar usage}%
-}% class given
+}% category given
\@esphack%
\ignorespaces%
}
@@ -2371,7 +2740,7 @@ pageanchor=true,
-% \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 @@ pageanchor=true,
% \subsection{New \cs{Describe\dots} macros}
-% \begin{macro}{\DTX@filename} Stores the filename with a sanitized underscore.
-% \begin{macrocode}
-\newcommand*{\DTXD@filename}{}
-% \end{macrocode}
-% \end{macro}
-
-
% \begin{macro}{\DTXD@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@filename}{}
+
\newcommand*{\DTXD@filemarginparindex}[5]{%
% \end{macrocode}
% Create a detokenized version of the filename\dots
@@ -2418,7 +2783,7 @@ pageanchor=true,
% 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@margintag{#1}{#2}{#3}%
% \end{macrocode}
@@ -2432,20 +2797,33 @@ pageanchor=true,
\endgroup%
\ignorespaces%
}
+}% not doc
% \end{macrocode}
% \end{macro}
%
%
-%
-% \begin{macro}{\DTXD@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@DescribeFile}[2][]{%
-\DTXD@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}
@@ -2457,7 +2835,7 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=file,
idxgroup=Files,
printtype=\textit{file}
@@ -2465,6 +2843,10 @@ pageanchor=true,
}{% not doc
+\newcommand*{\DTXD@DescribeFile}[2][]{%
+ \DTXD@filemarginparindex{#1}{#2}{File}{file}{usage}%
+}
+
\newcommand*{\DescribeFile}{%
\begingroup\catcode`\_=12 \DTXD@DescribeFile%
}
@@ -2474,15 +2856,6 @@ pageanchor=true,
% \end{macro}
%
%
-% \begin{macro}{\DTXD@DescribeProgram} \oarg{class} \marg{name}
-%
-% The name may have underscores.
-% \begin{macrocode}
-\newcommand*{\DTXD@DescribeProgram}[2][]{%
-\DTXD@filemarginparindex{#1}{#2}{Prog}{program}{usage}%
-}
-% \end{macrocode}
-% \end{macro}
%
%
% \begin{macro}{\DescribeProgram} \marg{name}
@@ -2494,7 +2867,7 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=program,
idxgroup=Programs,
printtype=\textit{Prog}
@@ -2502,8 +2875,12 @@ pageanchor=true,
}{% not doc
+\newcommand*{\DTXD@DescribeProgram}[2][]{%
+ \DTXD@filemarginparindex{#1}{#2}{Prog}{program}{usage}%
+}
+
\newcommand*{\DescribeProgram}{%
-\begingroup\catcode`\_=12 \DTXD@DescribeProgram%
+ \begingroup\catcode`\_=12 \DTXD@DescribeProgram%
}
}% not doc
@@ -2511,16 +2888,6 @@ pageanchor=true,
% \end{macro}
-% \begin{macro}{\DTXD@DescribeCommand} \oarg{class} \marg{name}
-%
-% The name may have underscores.
-% \begin{macrocode}
-\newcommand*{\DTXD@DescribeCommand}[2][]{%
-\DTXD@filemarginparindex{#1}{#2}{Cmd}{command}{usage}%
-}
-% \end{macrocode}
-% \end{macro}
-%
%
% \begin{macro}{\DescribeCommand} \marg{name}
%
@@ -2531,7 +2898,7 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=command,
idxgroup=Commands,
printtype=\textit{Cmd}
@@ -2539,8 +2906,12 @@ pageanchor=true,
}{% not doc
+\newcommand*{\DTXD@DescribeCommand}[2][]{%
+ \DTXD@filemarginparindex{#1}{#2}{Cmd}{command}{usage}%
+}
+
\newcommand*{\DescribeCommand}{%
-\begingroup\catcode`\_=12 \DTXD@DescribeCommand%
+ \begingroup\catcode`\_=12 \DTXD@DescribeCommand%
}
}% not doc
@@ -2549,16 +2920,6 @@ pageanchor=true,
%
-% \begin{macro}{\DTXD@DescribePackage} \oarg{class} \marg{name}
-% The name may have underscores.
-% \begin{macrocode}
-\newcommand*{\DTXD@DescribePackage}[2][]{%
-\DTXD@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 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=package,
idxgroup=Packages,
printtype=\textit{Pkg}
@@ -2578,8 +2939,12 @@ pageanchor=true,
}{% not doc
+\newcommand*{\DTXD@DescribePackage}[2][]{%
+ \DTXD@filemarginparindex{#1}{#2}{Pkg}{package}{usage}%
+}
+
\newcommand*{\DescribePackage}{%
-\begingroup\catcode`\_=12 \DTXD@DescribePackage%
+ \begingroup\catcode`\_=12 \DTXD@DescribePackage%
}
}% not doc
@@ -2587,16 +2952,6 @@ pageanchor=true,
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\DTXD@DescribeClass} \oarg{class} \marg{name}
-%
-% The name may have underscores.
-% \begin{macrocode}
-\newcommand*{\DTXD@DescribeClass}[2][]{%
-\DTXD@filemarginparindex{#1}{#2}{Cls}{class}{usage}%
-}
-% \end{macrocode}
-% \end{macro}
-%
%
% \begin{macro}{\DescribeClass} \marg{name}
%
@@ -2609,7 +2964,7 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=class,
idxgroup=Classes,
printtype=\textit{Cls}
@@ -2617,21 +2972,25 @@ pageanchor=true,
}{% not doc
+\newcommand*{\DTXD@DescribeClass}[2][]{%
+ \DTXD@filemarginparindex{#1}{#2}{Cls}{class}{usage}%
+}
+
\newcommand*{\DescribeClass}{%
-\begingroup\catcode`\_=12 \DTXD@DescribeClass%
+ \begingroup\catcode`\_=12 \DTXD@DescribeClass%
}
}% not doc
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=object,
idxgroup=Objects,
printtype=,
@@ -2841,11 +3200,11 @@ pageanchor=true,
% \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 @@ pageanchor=true,
\NewDocElement[
macrolike=false,
- toplevel=false,
+ toplevel=true,
idxtype=other,
idxgroup=Other,
printtype=,
@@ -2930,7 +3289,7 @@ pageanchor=true,
%
% 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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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@ItemDescribePackage}[2][]{%
@@ -3034,7 +3393,7 @@ pageanchor=true,
% \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@ItemDescribeClass}[2][]{%
@@ -3050,7 +3409,7 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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@ItemDescribeFile}[2][]{%
@@ -3078,7 +3437,7 @@ pageanchor=true,
% \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@ItemDescribeProgram}[2][]{%
@@ -3094,7 +3453,7 @@ pageanchor=true,
% \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@ItemDescribeCommand}[2][]{%
@@ -3110,7 +3469,7 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ pageanchor=true,
% \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 @@ position=top,
% \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 @@ position=top,
{\hspace{-.1667em}\raisebox{-.5ex}{E}\hspace{-.125em}}
\AtBeginDocument{
-\@ifpackageloaded{graphics}{
+\IfPackageLoadedTF{graphics}{
\renewrobustcmd*{\XeTeXrevE}
{\hspace{-.1667em}\raisebox{-.5ex}{\reflectbox{E}}\hspace{-.125em}}
}{}