diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex-dev/base/doc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex-dev/base/doc.sty | 879 |
1 files changed, 686 insertions, 193 deletions
diff --git a/Master/texmf-dist/tex/latex-dev/base/doc.sty b/Master/texmf-dist/tex/latex-dev/base/doc.sty index b0fe0860f01..752263a72f1 100644 --- a/Master/texmf-dist/tex/latex-dev/base/doc.sty +++ b/Master/texmf-dist/tex/latex-dev/base/doc.sty @@ -13,7 +13,7 @@ %% (but please observe conditions on bug reports sent to that address!) %% %% -%% Copyright (C) 1993-2021 +%% Copyright (C) 1993-2022 %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -42,15 +42,127 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. \NeedsTeXFormat{LaTeX2e}[1994/12/01] - \ProvidesPackage{doc} - [2021/10/04 v2.1n - Standard LaTeX documentation package (FMi)] + +\providecommand\DeclareRelease[3]{} +\providecommand\DeclareCurrentRelease[2]{} + +\DeclareRelease{v2.1g}{2016-02-15} + {doc-2016-02-15.sty} +\DeclareRelease{v2}{2021-06-01} + {doc-2021-06-01.sty} +\DeclareCurrentRelease{v3}{2022-06-01} + +\ProvidesPackage{doc} + [2022/06/01 v3.0g + Standard LaTeX documentation package V3 (FMi)] %% %% Package `doc' to use with LaTeX 2e -%% Copyright (C) 1989-2020 Frank Mittelbach, all rights reserved. +%% Copyright (C) 1989-2022 Frank Mittelbach, all rights reserved. + + + + + \@ifundefined{macro@cnt}{}{\endinput} \catcode`\^^A=14 -\AtBeginDocument{\catcode`\^^A=14\relax} +\catcode`\^^X=14 +\AtBeginDocument{\catcode`\^^A=14\relax\catcode`\^^X=14\relax} +\RequirePackage{l3keys2e} +\ExplSyntaxOn +\newif \ifdoc@noprint +\newif \ifdoc@noindex +\newif \ifdoc@hyperref \doc@hyperreftrue +\newif \ifdoc@multicol \doc@multicoltrue +\newif \ifdoc@debugshow +\newif \ifdoc@reportchangedates +\keys_define:nn {doc} + { + noprint .choice:, + noprint / true .code:n = { \legacy_if_set_true:n { doc@noprint } }, + noprint / false .code:n = { \legacy_if_set_false:n { doc@noprint } }, + noprint .default:n = { true }, + noindex .choice:, + noindex / true .code:n = { \legacy_if_set_true:n { doc@noindex } }, + noindex / false .code:n = { \legacy_if_set_false:n { doc@noindex } }, + noindex .default:n = { true }, + hyperref .choice:, + hyperref / true .code:n = { \legacy_if_set_true:n { doc@hyperref } }, + hyperref / false .code:n = { \legacy_if_set_false:n { doc@hyperref } }, + hyperref .default:n = { true }, + hyperref .choice:, + nohyperref / true .code:n = { \legacy_if_set_false:n { doc@hyperref } }, + nohyperref / false .code:n = { \legacy_if_set_true:n { doc@hyperref } }, + nohyperref .default:n = { true }, + multicol .choice:, + multicol / true .code:n = { \legacy_if_set_true:n { doc@multicol } }, + multicol / false .code:n = { \legacy_if_set_false:n { doc@multicol } }, + multicol .default:n = { true }, + nomulticol .choice:, + nomulticol / true .code:n = { \legacy_if_set_false:n { doc@multicol } }, + nomulticol / false .code:n = { \legacy_if_set_true:n { doc@multicol } }, + multicol .default:n = { true }, + debugshow .choice:, + debugshow / true .code:n = { \legacy_if_set_true:n { doc@debugshow } }, + debugshow / false .code:n = { \legacy_if_set_false:n { doc@debugshow } }, + debugshow .default:n = { true }, + reportchangedates .choice:, + reportchangedates / true .code:n = { \legacy_if_set_true:n { doc@reportchangedates } }, + reportchangedates / false .code:n = { \legacy_if_set_false:n { doc@reportchangedates } }, + reportchangedates .default:n = { true }, + } +\newif \ifdoc@toplevel \doc@topleveltrue +\keys_define:nn {doc} + { + toplevel .choice:, + toplevel / true .code:n = { \legacy_if_set_true:n { doc@toplevel } }, + toplevel / false .code:n = { \legacy_if_set_false:n { doc@toplevel } }, + toplevel .default:n = { true }, + notoplevel .choice:, + notoplevel / true .code:n = { \legacy_if_set_false:n { doc@toplevel } }, + notoplevel / false .code:n = { \legacy_if_set_true:n { doc@toplevel } }, + notoplevel .default:n = { true } + } +\newif \ifdoc@macrolike +\keys_define:nn {doc} + { + macrolike .choice:, + macrolike / true .code:n = { \legacy_if_set_true:n { doc@macrolike } }, + macrolike / false .code:n = { \legacy_if_set_false:n { doc@macrolike } }, + macrolike .default:n = { true }, + envlike .choice:, + envlike / true .code:n = { \legacy_if_set_false:n { doc@macrolike } }, + envlike / false .code:n = { \legacy_if_set_true:n { doc@macrolike } }, + envlike .default:n = { true } + } + +\keys_define:nn { doc } + { + idxtype .tl_set:N = \doc@idxtype, + idxgroup .tl_set:N = \doc@idxgroup, + printtype .tl_set:N = \doc@printtype + } +\newif\ifdoc@outer +\keys_define:nn {doc} + { + outer .choice:, + outer / true .code:n = { \legacy_if_set_true:n { doc@outer } }, + outer / false .code:n = { \legacy_if_set_false:n { doc@outer } }, + outer .default:n = { true }, + } +\ExplSyntaxOff +\ProcessKeysOptions {doc} +\newif\ifscan@allowed \scan@allowedtrue +\def\SetupDoc#1{% + \csname keys_set:nn\endcsname{doc}{#1}% + \edef\doc@noprintdefault{\ifdoc@noprint true\else false\fi}% + \ifdoc@noindex + \def\doc@noindexdefault{true}% + \scan@allowedfalse + \else + \def\doc@noindexdefault{false}% + \fi +} +\SetupDoc{} % just save the default values \def\macrocode{\macro@code \frenchspacing \@vobeyspaces \xmacro@code} @@ -181,6 +293,7 @@ \endgroup \newcounter{StandardModuleDepth} \newcount \guard@level + \@ifundefined{Module}{% \def\Module#1{\mod@math@codes$\langle\mathsf{#1}\rangle$} }{} @@ -229,18 +342,10 @@ |endgroup !% \end{macrocode} \catcode`\!=12 -\def\DescribeMacro{\leavevmode\@bsphack - \begingroup\MakePrivateLetters\Describe@Macro} -\def\Describe@Macro#1{\endgroup - \marginpar{\raggedleft\PrintDescribeMacro{#1}}% - \SpecialUsageIndex{#1}\@esphack\ignorespaces} -\def\DescribeEnv{\leavevmode\@bsphack\begingroup\MakePrivateLetters - \Describe@Env} -\def\Describe@Env#1{\endgroup - \marginpar{\raggedleft\PrintDescribeEnv{#1}}% - \SpecialEnvIndex{#1}\@esphack\ignorespaces} + \reversemarginpar \setlength\marginparpush{0pt} \setlength\marginparwidth{8pc} +\setlength\marginparsep{\labelsep} {\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} \def\verbatim{\@beginparpenalty \predisplaypenalty \@verbatim @@ -267,14 +372,12 @@ \ttfamily \verb@eol@error \let\do\@makeother \dospecials \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}} \let\verb@balance@group\@empty - \def\verb@egroup{\global\let\verb@balance@group\@empty\egroup} - \begingroup \obeylines% \gdef\verb@eol@error{\obeylines% \def^^M{\verb@egroup\@latex@error{% - \noexpand\verb ended by end of line}\@ehc}}% + \noexpand\verb command ended by end of line}\@ehc}}% \endgroup \def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-} \def\do@noligs#1{% @@ -283,56 +386,7 @@ \lccode`\~=`#1\relax \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}} \newcount\macro@cnt \macro@cnt=0 -\def\macro{\begingroup - \catcode`\\12 - \MakePrivateLetters \m@cro@ \iftrue} -\def\environment{\begingroup - \catcode`\\12 - \MakePrivateLetters \m@cro@ \iffalse} -\long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist - \edef\saved@macroname{\string#2}% - #1 - \let\saved@indexname\saved@macroname - \else - \edef\saved@indexname{\expandafter\@gobble\string#2}% - \fi - \def\makelabel##1{\llap{##1}}% - \if@inlabel - \let\@tempa\@empty \count@\macro@cnt - \loop \ifnum\count@>\z@ - \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat - \edef\makelabel##1{\llap{\vtop to\baselineskip - {\@tempa\hbox{##1}\vss}}}% - \advance \macro@cnt \@ne - \else \macro@cnt\@ne \fi - \edef\@tempa{\noexpand\item[% - #1% - \noexpand\PrintMacroName - \else - \noexpand\PrintEnvName - \fi - {\string#2}]}% - \@tempa - \global\advance\c@CodelineNo\@ne - #1% - \SpecialMainIndex{#2}\nobreak - \DoNotIndex{#2}% - \else - \SpecialMainEnvIndex{#2}\nobreak - \fi - \global\advance\c@CodelineNo\m@ne - \ignorespaces} -\let\endmacro \endtrivlist -\let\endenvironment\endmacro \newskip\MacroTopsep \MacroTopsep = 7pt plus 2pt minus 2pt -\@ifundefined{PrintMacroName} - {\def\PrintMacroName#1{\strut \MacroFont \string #1\ }}{} -\@ifundefined{PrintDescribeMacro} - {\def\PrintDescribeMacro#1{\strut \MacroFont \string #1\ }}{} -\@ifundefined{PrintDescribeEnv} - {\def\PrintDescribeEnv#1{\strut \MacroFont #1\ }}{} -\@ifundefined{PrintEnvName} - {\def\PrintEnvName#1{\strut \MacroFont #1\ }}{} \begingroup \catcode`\~\active \gdef\SpecialEscapechar#1{% @@ -360,7 +414,6 @@ \def\next{\futurelet\next\macro@switch}% \else \let\next\@empty \fi \next} -\newif\ifscan@allowed \scan@allowedtrue \def\DisableCrossrefs{\@bsphack\scan@allowedfalse\@esphack} \def\EnableCrossrefs{\@bsphack\scan@allowedtrue \def\DisableCrossrefs{\@bsphack\@esphack}\@esphack} @@ -374,24 +427,10 @@ \uccode`\&=\expandafter`\string#1% \uppercase{\def\x{\def\macro@namepart{&}}}% \expandafter\endgroup\x - \ifnot@excluded - \produce@index{#1}\fi + \maybe@index@short@macro\macro@namepart \scan@allowedfalse#1% \scan@allowedtrue } \endgroup -\def\produce@index#1{% - \if\noexpand#1\special@escape@char - \scan@allowedfalse \it@is@a\special@escape@char \else - \if\noexpand#1\bslash \it@is@a\bslash \else - \if\noexpand#1\space \it@is@a\space \else - \ifx#1\par - \it@is@a\space \else - \ifx#1\relax \else - \if\noexpand#1\bgroup \LeftBraceIndex \else - \if\noexpand#1\egroup \RightBraceIndex \else - \if\noexpand#1\percentchar \PercentIndex \else - \it@is@a{\string#1}% - \fi \fi \fi \fi \fi \fi \fi \fi} \def\macro@name#1{\edef\macro@namepart{\macro@namepart#1}% \futurelet\next\more@macroname} \def\more@macroname{\ifcat\noexpand\next a% @@ -400,41 +439,166 @@ \next} \def\macro@finish{% \macro@namepart - \ifnot@excluded - \edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}% - \@tempa \fi} -\def\DoNotIndex{\begingroup \MakePrivateLetters - \catcode`\\12 - \do@not@index} -\long\def\do@not@index#1{% - \endgroup - \addto@hook\index@excludelist{#1,}} -\long\def\addto@hook#1#2{#1\expandafter{\the#1#2}} -\newtoks\index@excludelist -\index@excludelist{} -\begingroup -\catcode`\|=0% -\catcode`\\=12 -|gdef|ifnot@excluded{|expandafter - |expanded@notin|expandafter{|expandafter - \|macro@namepart,}{|the|index@excludelist}} -|endgroup -\def\expanded@notin#1#2{% - \def\in@@##1#1##2##3\in@@{% - \ifx\expanded@notin##2}% - \expandafter\in@@#2#1\expanded@notin\in@@} + \maybe@index@macro \macro@namepart +} + +\ExplSyntaxOn +\seq_new:N \l__doc_donotindex_seq +\prop_new:N \g__doc_idxtype_prop +\cs_new:Npn\__doc_trace:x { + \legacy_if:nTF{ doc@debugshow }{ \iow_term:x } { \use_none:n } +} +\cs_new:Npn \doc_dont_index:n { + \group_begin: + \MakePrivateLetters + \__doc_dont_index:n +} +\cs_new:Npn \__doc_dont_index:n #1 { + \group_end: + \__doc_trace:x{Disable~ indexing~ for~ '\tl_to_str:n{#1}' } + \clist_map_function:nN {#1} \__doc_dont_index_aux:n +} +\cs_new:Npn \__doc_dont_index_aux:n #1 { + \seq_put_right:Nx \l__doc_donotindex_seq {\expandafter\@gobble \string#1} +} +\cs_set_eq:NN \DoNotIndex \doc_dont_index:n +\def \ShowIndexingState { + \__doc_trace:x{Show~ doc~ indexing~ state:} + \seq_show:N \l__doc_donotindex_seq + \prop_show:N \g__doc_idxtype_prop +} + +\cs_new:Npn \__doc_idxtype_put:Nn #1#2 { + \exp_args:Nx \__doc_idxtype_put:nn { \cs_to_str:N #1 }{#2} + \protected@write\@auxout{} + {\string\RecordIndexTypeAux {\string#1 }{#2} } +} +\cs_new:Npn \RecordIndexTypeAux #1#2 { + \exp_args:Nx \__doc_idxtype_put:nn { \cs_to_str:N #1 }{#2} +} +\AtEndDocument{ + \cs_set_eq:NN \RecordIndexTypeAux \use_none:nn +} +\cs_set_eq:NN \RecordIndexType \__doc_idxtype_put:Nn +\cs_new:Npn \__doc_idxtype_put_scan:nn #1#2 { + \exp_args:Nf \__doc_idxtype_put:nn { \tl_to_str:n {#1} }{#2} + \protected@write\@auxout{} + {\string\RecordIndexTypeAux {\bslash #1 }{#2} } +} +\cs_generate_variant:Nn \__doc_idxtype_put_scan:nn {o} +\cs_set_eq:NN \record@index@type@save \__doc_idxtype_put_scan:on +\cs_new:Npn \__doc_idxtype_put:nn #1#2 { + \exp_args:NNf + \seq_if_in:NnTF \l__doc_donotindex_seq {\tl_to_str:n{#1}} + { + \__doc_trace:x{Not~ recording~ index~ type~ for~ '\bslash #1' } + } + { + \__doc_trace:x{Recording~ index~ type~ for~ '\bslash #1' ~ as~ #2 } + \prop_gput:Nnn \g__doc_idxtype_prop {#1}{#2} + } +} +\cs_new:Npn \exp_args:co #1#2 + { \cs:w #1 \exp_after:wN \cs_end:\exp_after:wN {#2} } +\cs_generate_variant:Nn \tl_to_str:n {o} + +\cs_new:Npn \__doc_maybe_index:o #1 { + \exp_args:Nf \__doc_maybe_index_aux:nN { \tl_to_str:o {#1} } + \SpecialIndex +} +\cs_set_eq:NN \maybe@index@macro \__doc_maybe_index:o +\cs_new:Npn \__doc_maybe_index_short:o #1 { + \exp_args:Nf \__doc_maybe_index_aux:nN { \tl_to_str:o {#1} } + \SpecialShortIndex +} +\cs_set_eq:NN \maybe@index@short@macro \__doc_maybe_index_short:o +\cs_new:Npn \__doc_maybe_index_aux:nN #1#2 { + \__doc_trace:x{Searching~ for~ '\bslash #1'} + \seq_if_in:NnTF \l__doc_donotindex_seq {#1} + { + \__doc_trace:x{Not~ indexing~ '\bslash #1' } + } + { + \prop_get:NnNTF \g__doc_idxtype_prop {#1} \l__doc_idxtype_tl + { + \exp_args:Ncno \__doc_maybe_index_aux:Nnn + { Code \tl_use:N \l__doc_idxtype_tl Index } + {code} {\bslash #1} + } + { + \__doc_trace:x{Indexing~ '\bslash #1'\space (\string #2)} + \exp_args:No #2 {\bslash #1} + } + } +} +\cs_new:Npn \SpecialShortIndex #1 { + \@SpecialIndexHelper@ #1\@nil + \@bsphack + \ifdoc@noindex \else + \str_case_e:nnF {\@gtempa } + { + {\cs_to_str:N \^^M } {\def\reserved@a{ \string \space \actualchar } + \def\reserved@b { \space } + \let\reserved@c \@empty } + { } {\def\reserved@a{ \string \space \actualchar } + \def\reserved@b { \space } + \let\reserved@c \@empty } + {\c_left_brace_str} { \def\reserved@a{ \bgroup \actualchar } + \def\reserved@b { \c_left_brace_str } + \def\reserved@c { \noexpand\iffalse + \c_right_brace_str + \noexpand\fi } } + {\c_right_brace_str} { \def\reserved@a{ \egroup \actualchar + \noexpand\iffalse + \c_left_brace_str + \noexpand\fi } + \def\reserved@b { \c_right_brace_str } + \let\reserved@c \@empty } + {\verbatimchar} { \def\reserved@a{ \quotechar\verbatimchar + \actualchar } + \let\reserved@b \@empty + \def\reserved@c + { \string\texttt{\string\string\verbatimchar} } } + } + { \def\reserved@a {\quotechar \@gtempa \actualchar } + \def\reserved@b {\quotechar \@gtempa } + \let\reserved@c \@empty } + \special@index { + \reserved@a + \string\verb + \quotechar *\verbatimchar \quotechar \bslash + \reserved@b + \verbatimchar + \reserved@c + \encapchar code} + \fi + \@esphack +} + +\cs_new:Npn \__doc_maybe_index_aux:Nnn #1#2#3 { + \cs_if_exist:NTF #1 + { + \__doc_trace:x{Indexing~ '#3'\space as~ + \tl_use:N \l__doc_idxtype_tl } + #1{#2}{#3} + } + { + \PackageError{doc}{Doc~ element~ + '\tl_use:N \l__doc_idxtype_tl'~ unknown}% + + {When~ using~ '\string\RecordIndexType'~ the~ type~ must~ + be~ known~\MessageBreak + to~ the~ system,~ i.e.,~ declared~ via~ + '\string\NewDocElement'\MessageBreak + before~ it~ can~ be~ used~ in~ indexing.} + } +} +\ExplSyntaxOff \@ifundefined{actualchar}{\def\actualchar{=}}{} \@ifundefined{quotechar}{\def\quotechar{!}}{} \@ifundefined{levelchar}{\def\levelchar{>}}{} \@ifundefined{encapchar}{\def\encapchar{|}}{} \@ifundefined{verbatimchar}{\def\verbatimchar{+}}{} -\def\SpecialIndex#1{\@bsphack\special@index{\expandafter\@gobble - \string#1\actualchar - \string\verb\quotechar*\verbatimchar\string#1\verbatimchar}% - \@esphack} - -\def\SpecialMainIndex#1{\@bsphack\SpecialIndex@{#1}{\encapchar main}% - \@esphack} \begingroup \catcode`\|=0 \catcode`\\=12 @@ -448,75 +612,43 @@ |endgroup |fi} |endgroup -\def\SpecialIndex@#1#2{% - \@SpecialIndexHelper@#1\@nil - \def\@tempb{ }% - \ifcat \@tempb\@gtempa - \special@index{\quotechar\space\actualchar - \string\verb\quotechar*\verbatimchar - \quotechar\bslash\quotechar\space\verbatimchar#2}% - \else - \def\@tempb##1##2\relax{\ifx\relax##2\relax - \def\@tempc{\special@index{\quotechar##1\actualchar - \string\verb\quotechar*\verbatimchar - \quotechar\bslash\quotechar##1\verbatimchar#2}}% - \else - \def\@tempc{\special@index{##1##2\actualchar - \string\verb\quotechar*\verbatimchar - \bslash##1##2\verbatimchar#2}}% - \fi}% - \expandafter\@tempb\@gtempa\relax - \@tempc - \fi} -\def\SpecialMainEnvIndex#1{\@bsphack\special@index{% - #1\actualchar - {\string\ttfamily\space#1} - (environment)% - \encapchar main}% - \special@index{environments:\levelchar#1\actualchar{% - \string\ttfamily\space#1}\encapchar - main}\@esphack} -\def\SpecialUsageIndex#1{\@bsphack - {\let\special@index\index\SpecialIndex@{#1}{\encapchar usage}}% - \@esphack} -\def\SpecialEnvIndex#1{\@bsphack - \index{#1\actualchar{\protect\ttfamily#1} - (environment)\encapchar usage}% - \index{environments:\levelchar#1\actualchar - {\protect\ttfamily#1}\encapchar usage}\@esphack} -\def\SortIndex#1#2{\index{#1\actualchar#2}} -\def\it@is@a#1{\special@index{\quotechar #1\actualchar - \string\verb\quotechar*\verbatimchar - \quotechar\bslash\quotechar#1\verbatimchar}} +\def\SortIndex#1#2{% + \ifdoc@noindex\else + \index{#1\actualchar#2}% + \fi +} \@ifundefined{LeftBraceIndex}{\def\LeftBraceIndex{% - \special@index{\bgroup\actualchar\string\verb\quotechar*\verbatimchar - \quotechar\bslash{\verbatimchar\string\iffalse}\string\fi}}}{} + \special@index{\bgroup\actualchar + \string\verb% % to fool emacs highlighting + \quotechar*\verbatimchar + \quotechar\bslash{\verbatimchar\string\iffalse}\string\fi}}}{} \@ifundefined{RightBraceIndex}{\def\RightBraceIndex{% - \special@index{\egroup\actualchar\string\iffalse{\string\fi\string\verb + \special@index{\egroup\actualchar\string\iffalse{\string\fi + \string\verb% % to fool emacs highlighting \quotechar*\verbatimchar\quotechar\bslash}\verbatimchar}}}{} \@ifundefined{PercentIndex} {\def\PercentIndex{\it@is@a\percentchar}}{} \def\OldMakeindex{\def\PercentIndex{% - \special@index{\quotechar\percentchar\actualchar\string\verb + \special@index{\quotechar\percentchar\actualchar + \string\verb% % to fool emacs highlighting \quotechar*\verbatimchar\quotechar\bslash \percentchar\percentchar\verbatimchar}}} {\catcode`\%=12 \gdef\percentchar{%}} -\newif\ifhave@multicol -\IfFileExists{multicol.sty}{\have@multicoltrue - \RequirePackage{multicol}% - }{} +\def\it@is@a#1{\special@index{\quotechar #1\actualchar + \string\verb% % to fool emacs highlighting + \quotechar*\verbatimchar + \quotechar\bslash\quotechar#1\verbatimchar}} \newdimen\IndexMin \IndexMin = 80pt \newcount\c@IndexColumns \c@IndexColumns = 3 -\ifhave@multicol +\ifdoc@multicol + \RequirePackage{multicol} \renewenvironment{theindex} {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]% \IndexParms \let\item\@idxitem \ignorespaces}% {\end{multicols}} \else - \typeout{Can't find multicol.sty -- will use normal index layout if - necessary.} \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi \columnseprule \z@ \columnsep 35\p@ \twocolumn[\index@prologue]% @@ -556,32 +688,38 @@ \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}% }}{} \def\efill{\hfill\nopagebreak}% -\def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill\kern\z@}% -\def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hfil\kern\z@}% -\def\pfill{\unskip~\dotfill\penalty500\strut\nobreak - \dotfil~\ignorespaces}% +\def\pfill{\unskip~% + \leaders\hbox to.6em{\hss .\hss}\hfill + \penalty500\strut\nobreak + \leaders\hbox to.6em{\hss .\hss}\hfil + ~\ignorespaces}% \def\*{\leavevmode\lower.8ex\hbox{$\,\widetilde{\ }\,$}} \@ifundefined{main}{\def\main#1{\underline{#1}}}{} \@ifundefined{usage}{\def\usage#1{\textit{#1}}}{} +\@ifundefined{code}{\def\code#1{#1}}{} \def\PrintIndex{\@input@{\jobname.ind}% \global\let\PrintIndex\@empty} \def\changes{\@bsphack\begingroup\@sanitize \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore \changes@} \def\changes@#1#2#3{% - \protected@edef\@tempa{\noexpand\glossary{#1\levelchar - \ifx\saved@macroname\@empty - \space - \actualchar - \generalname - \else - \saved@indexname - \actualchar - \string\verb\quotechar*% - \verbatimchar\saved@macroname - \verbatimchar - \fi - :\levelchar #3}}% + \protected@edef\@tempa{\noexpand\glossary{#1% + \ifdoc@reportchangedates + \space -- #2\fi + \levelchar + \ifx\saved@macroname\@empty + \quotechar!% + \actualchar + \generalname + \else + \saved@indexname + \actualchar + \string\verb% % to fool emacs highlighting + \quotechar*% + \verbatimchar\saved@macroname + \verbatimchar + \fi + :\levelchar #3}}% \@tempa\endgroup\@esphack} \def\saved@macroname{} \def\saved@indexname{} @@ -589,7 +727,7 @@ \let\RecordChanges\makeglossary \newdimen\GlossaryMin \GlossaryMin = 80pt \newcount\c@GlossaryColumns \c@GlossaryColumns = 2 -\ifhave@multicol +\ifdoc@multicol \newenvironment{theglossary}{% \begin{multicols}\c@GlossaryColumns [\glossary@prologue][\GlossaryMin]% @@ -618,15 +756,16 @@ \def\PrintChanges{\@input@{\jobname.gls}% \global\let\PrintChanges\@empty} \newcommand\AlsoImplementation{% - \long\def\StopEventually##1{\@bsphack\gdef\Finale{##1% + \long\def\MaybeStop##1{\@bsphack\gdef\Finale{##1% \check@checksum}% \init@checksum \@esphack}% } \AlsoImplementation -\def\OnlyDescription{\@bsphack\long\def\StopEventually##1{% +\def\OnlyDescription{\@bsphack\long\def\MaybeStop##1{% ##1\endinput}\@esphack} \let\Finale\relax +\def\StopEventually{\MaybeStop} \ifx\l@nohyphenation\undefined \newlanguage\l@nohyphenation \fi @@ -682,13 +821,20 @@ \endgroup \global\catcode`#1\active \else - \@shortvrbinfo\@empty{#1 already}{\@empty\verb(*)}% + \@shortvrbinfo\@empty{#1 already}% + {\@empty\verb% % to fool emacs highlighting + (*)}% \fi} \def\DeleteShortVerb#1{% \expandafter\ifx\csname cc\string#1\endcsname\relax - \@shortvrbinfo\@empty{#1 not}{\@empty\verb(*)}% + \@shortvrbinfo\@empty{#1 not}% + {\@empty\verb% % to fool emacs highlighting + (*)}% \else - \@shortvrbinfo{Deleted }{#1 as}{\@empty\verb(*)}% + \@shortvrbinfo{Deleted }{#1 as}% + {\@empty\verb% % to fool emacs + % highlighting + (*)}% \rem@special{#1}% \global\catcode`#1\csname cc\string#1\endcsname \global \expandafter\let \csname cc\string#1\endcsname \relax @@ -718,10 +864,6 @@ \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}% \xdef\@sanitize{\@sanitize}% \endgroup} -\def\MakeShortverb{\typeout{*** Switch to \noexpand\MakeShortVerb - syntax, this is obsolete ***}\MakeShortVerb} -\def\DeleteShortverb{\typeout{*** Switch to \noexpand\DeleteShortVerb - syntax, this is obsolete ***}\DeleteShortVerb} \def\init@checksum{\relax \global\bslash@cnt\z@} \def\check@checksum{\relax @@ -787,9 +929,13 @@ \newif\ifcodeline@index \codeline@indexfalse \let\CodelineNumbered\codeline@indextrue \def\codeline@wrindex#1{\if@filesw + \begingroup + \set@display@protect \immediate\write\@indexfile {\string\indexentry{#1}% - {\number\c@CodelineNo}}\fi} + {\number\c@CodelineNo}}% + \endgroup + \fi} \let\special@index = \@gobble \def\CodelineIndex{\makeindex \codeline@indextrue @@ -833,6 +979,353 @@ \def\fileinfo{##3}}% \edef\@tempa{\csname ver@#1\endcsname}% \expandafter\@tempb\@tempa\relax? ? \relax\relax} + +\AddToHook{begindocument/before}[doc/hyperref]{% + \ifdoc@hyperref + \expandafter\let\expandafter\doc@eoph@@k\csname doc.sty-h@@k\endcsname + \RequirePackage{hypdoc} + \expandafter\let\csname doc.sty-h@@k\endcsname\doc@eoph@@k + \let\PrintDescribeMacro \@@PrintDescribeMacro + \let\PrintDescribeEnv \@@PrintDescribeEnv + \let\PrintMacroName \@@PrintMacroName + \let\PrintEnvName \@@PrintEnvName + \let\SpecialUsageIndex \@@SpecialUsageIndex + \let\SpecialEnvIndex \@@SpecialEnvIndex + \let\SortIndex \@@SortIndex + \let\DescribeMacro \@@DescribeMacro + \let\DescribeEnv \@@DescribeEnv + \ifx\special@index\@gobble % do we write index entries at all? + \else + \ifcodeline@index + \let\special@index\HD@codeline@wrindex + \else + \let\special@index\HD@page@wrindex + \fi + \fi + \AddToHook{class/amsdtx/after}{% + \pdfstringdefDisableCommands{\let\env\@empty }}% + \def\doc@providetarget{\HD@target}% + \def\doc@handleencap#1{\encapchar hdclindex{\the\c@HD@hypercount}{#1}}% + \else + \let\doc@providetarget\@empty + \def\doc@handleencap#1{\encapchar #1}% + \def\hdclindex#1#2{\ifx\@nil#2\@nil\else\csname #2\expandafter\endcsname\fi}% + \def\hdpindex #1{\ifx\@nil#1\@nil\else\csname #1\expandafter\endcsname\fi}% +\fi +} + +\ExplSyntaxOn +\long\def\@doc@env#1#2#3{ + \endgroup + \clist_map_inline:nn {#3} { \@doc@env@{#1}{#2}{##1} } +} + +\ExplSyntaxOff +\long\def\@doc@env@#1#2#3{% + \topsep\MacroTopsep + \trivlist + \edef\saved@macroname{\string#3}% + \if #1% + \edef\saved@indexname{\expandafter\@gobble\saved@macroname}% + \expandafter\ifx + \csname Code#2Index\endcsname + \CodeMacroIndex + \else + \record@index@type@save + {\saved@indexname}{#2}% + \fi + \else + \let\saved@indexname\saved@macroname + \fi + \def\makelabel##1{\llap{##1}}% + \if@inlabel + \let\@tempa\@empty + \count@\macro@cnt + \loop\ifnum\count@>\z@ + \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne + \repeat + \edef\makelabel##1{\llap{\vtop to\baselineskip{\@tempa\hbox{##1}\vss}}}% + \advance\macro@cnt\@ne + \else + \macro@cnt\@ne + \fi + \ifdoc@noprint + \item + \else + \edef\@tempa{% + \noexpand\item[% + \noexpand\doc@providetarget + \noexpand\strut + \noexpand\@nameuse{Print#2Name}{\saved@macroname}]}% + \@tempa + \fi + \ifdoc@noindex\else + \global\advance\c@CodelineNo\@ne + \csname SpecialMain#2Index\expandafter\endcsname + \expandafter{\saved@macroname}\nobreak + \global\advance\c@CodelineNo\m@ne + \fi + \if#1\expandafter\DoNotIndex \expandafter {\saved@macroname}\fi + \ignorespaces} +\def\doc@env#1#2[#3]{% + \@nameuse{doc@noprint\doc@noprintdefault}% + \@nameuse{doc@noindex\doc@noindexdefault}% + \csname keys_set:nn\endcsname{doc}{#3}% + \begingroup + \ifdoc@outer + \catcode`\\12 + \fi + \MakePrivateLetters + \@doc@env{#1}{#2}% +} + +\def\@doc@describe#1#2{% + \ifdoc@noprint\else + \marginpar{\raggedleft + \strut + \doc@providetarget + \@nameuse{PrintDescribe#1}{#2}}% + \fi + \ifdoc@noindex\else + \@nameuse{Special#1Index}{#2}% + \fi + \@esphack + \endgroup + \ignorespaces} +\def\doc@describe#1[#2]{% + \leavevmode\@bsphack + \csname keys_set:nn\endcsname{doc}{#2}% + \@doc@describe{#1}} +\@ifundefined{temptokenb}{\newtoks\@temptokenb}{} +\def\doc@createspecialindexes#1#2#3{% + \@temptokena{\space (#2)}% + \@temptokenb{#3:}% + \@nameedef{SpecialMain#1Index}##1{% + \noexpand\@bsphack + \ifdoc@toplevel + \noexpand\special@index{##1\noexpand\actualchar + {\string\ttfamily\space##1}% + \ifx\@nil#2\@nil\else \the\@temptokena \fi + \noexpand\encapchar main}% + \fi + \ifx\@nil#3\@nil\else + \noexpand\special@index{\the\@temptokenb\noexpand\levelchar + ##1\noexpand\actualchar{\string\ttfamily\space##1}% + \noexpand\encapchar main}% + \fi + \noexpand\@esphack}% + \@nameedef{Special#1Index}##1{% + \noexpand\@bsphack + \ifdoc@toplevel + \noexpand\doc@providetarget + \noexpand\index{##1\noexpand\actualchar{\string\ttfamily\space##1}% + \ifx\@nil#2\@nil\else \the\@temptokena \fi + \noexpand\doc@handleencap{usage}}% + \fi + \ifx\@nil#3\@nil\else + \noexpand\index{\the\@temptokenb\noexpand\levelchar + ##1\noexpand\actualchar{\string\ttfamily\space##1}% + \noexpand\doc@handleencap{usage}}% + \fi + \noexpand\@esphack}} +\def\doc@createspecialmacrolikeindexes#1#2#3{% + \@temptokena{\space (#2)}% + \@temptokenb{#3:}% + \@nameedef{Code#1Index}##1##2{% + \noexpand\@SpecialIndexHelper@##2\noexpand\@nil + \noexpand\@bsphack + \noexpand\ifdoc@noindex\noexpand\else + \ifdoc@toplevel + \noexpand\special@index{\noexpand\@gtempa\noexpand\actualchar +\string\verb% % to fool emacs highlighting +\noexpand\quotechar*\noexpand\verbatimchar +\noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar +\ifx\@nil#2\@nil\else \the\@temptokena \fi +\noexpand\encapchar ##1}% + \fi + \ifx\@nil#3\@nil\else + \noexpand\special@index{\the\@temptokenb\noexpand\levelchar +\noexpand\@gtempa\noexpand\actualchar +\string\verb% % to fool emacs highlighting +\noexpand\quotechar*\noexpand\verbatimchar +\noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar +\noexpand\encapchar ##1}% + \fi + \noexpand\fi + \noexpand\@esphack}% + \@nameedef{SpecialMain#1Index}##1{% + \expandafter\noexpand\csname Code#1Index\endcsname + {main}{##1}}% + \@nameedef{Special#1Index}##1{% + \noexpand\@SpecialIndexHelper@##1\noexpand\@nil + \noexpand\@bsphack + \noexpand\ifdoc@noindex\noexpand\else + \ifdoc@toplevel + \noexpand\doc@providetarget + \noexpand\index{\noexpand\@gtempa\noexpand\actualchar +\string\verb% % to fool emacs highlighting +\noexpand\quotechar*\noexpand\verbatimchar +\noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar +\ifx\@nil#2\@nil\else \the\@temptokena \fi +\noexpand\doc@handleencap{usage}}% + \fi + \ifx\@nil#3\@nil\else + \noexpand\index{\the\@temptokenb\noexpand\levelchar +\noexpand\@gtempa\noexpand\actualchar +\string\verb% % to fool emacs highlighting +\noexpand\quotechar*\noexpand\verbatimchar +\noexpand\bslash\noexpand\@gtempa\noexpand\verbatimchar +\noexpand\doc@handleencap{usage}}% + \fi + \noexpand\fi + \noexpand\@esphack}} + +\def\doc@createdescribe#1{% + \@namedef{Describe#1}{% + \begingroup + \MakePrivateLetters + \@ifnextchar[%] + {\doc@describe{#1}}{\doc@describe{#1}[]}}} +\def\doc@createenv#1#2#3{% + \@namedef{#3}{% + \@ifnextchar[%] + {\doc@env{#1}{#2}}{\doc@env{#1}{#2}[]}}% + \@namedef{end#3}{\endtrivlist}% +} + +\def\@nameedef#1{\expandafter\edef\csname #1\endcsname} + + +\def\doc@declareerror#1#2{% + \PackageError{doc}{Doc element '#1/#2' already defined?\@gobble}% + {There is already a definition for + '\string\Print#1Name',\MessageBreak + '\string\PrintDescribe#1' + or the environment '#2'.\MessageBreak + Maybe you are overwriting something by mistake!\MessageBreak + Otherwise use '\string\RenewDocElement' instead.}% +} + +\def\doc@notdeclarederror#1#2{% + \PackageError{doc}{Doc element '#1/#2' unknown}% + {I expected an existing definition for + '\string\Print#1Name',\MessageBreak + '\string\PrintDescribe#1' and + the environment '#2' but\MessageBreak + not all of them are defined.\MessageBreak + Maybe you wanted to use + '\string\NewDocElement'?}% +} +\newcommand\NewDocElement[3][]{% + \@ifundefined{Print#2Name}% + {\@ifundefined{PrintDescribe#2}% + {\@ifundefined{#3}% + {\@ifundefined{end#3}% + {\@NewDocElement{#1}}% + \doc@declareerror + }\doc@declareerror + }\doc@declareerror + }\doc@declareerror + {#2}{#3}% +} +\newcommand\RenewDocElement[3][]{% + \@ifundefined{Print#2Name}\doc@notdeclarederror + {\@ifundefined{PrintDescribe#2}\doc@notdeclarederror + {\@ifundefined{#3}\doc@notdeclarederror + {\@ifundefined{end#3}\doc@notdeclarederror + {\@NewDocElement{#1}}% + }% + }% + }% + {#2}{#3}% +} +\def\@NewDocElement#1#2#3{% + \doc@macrolikefalse + \doc@topleveltrue + \def\doc@idxtype{#3}% + \def\doc@idxgroup{#3s}% + \let\doc@printtype\@empty + \csname keys_set:nn\endcsname{doc}{#1}% + \ifx\doc@printtype\@empty + \@temptokena{}% + \else + \@temptokena\expandafter{\expandafter + \textnormal\expandafter{\expandafter + \space\expandafter + (\doc@printtype)}}% + \fi + \@nameedef{Print#2Name}##1{% + {\noexpand\MacroFont + \ifdoc@macrolike + \noexpand\string + \fi + ##1% + \the\@temptokena + }}% + \expandafter\let\csname PrintDescribe#2\expandafter\endcsname + \csname Print#2Name\endcsname + \edef\doc@expr{% + \ifdoc@macrolike + \noexpand\doc@createspecialmacrolikeindexes + \else + \noexpand\doc@createspecialindexes + \fi + {#2}% + }% + \expandafter\expandafter\expandafter + \doc@expr + \expandafter\expandafter\expandafter + {\expandafter\doc@idxtype\expandafter}\expandafter + {\doc@idxgroup}% + \doc@createdescribe{#2}% + \ifdoc@macrolike + \doc@createenv{TT}{#2}{#3}% + \else + \doc@createenv{TF}{#2}{#3}% + \fi +} + + +\NewDocElement[macrolike = true , + idxtype = , + idxgroup = , + printtype = + ]{Macro}{macro} + +\def\SpecialMainIndex{\SpecialMainMacroIndex} + +\def\SpecialUsageIndex{\SpecialMacroIndex} + +\def\SpecialIndex {\CodeMacroIndex{code}} + +\NewDocElement[macrolike = false , + idxtype = env. , + idxgroup = environments , + printtype = \textit{env.} + ]{Env}{environment} + \let\@@PrintDescribeMacro \PrintDescribeMacro + \let\@@PrintDescribeEnv \PrintDescribeEnv + \let\@@PrintMacroName \PrintMacroName + \let\@@PrintEnvName \PrintEnvName + \let\@@SpecialUsageIndex \SpecialUsageIndex + \let\@@SpecialEnvIndex \SpecialEnvIndex + \let\@@SortIndex \SortIndex + \let\@@DescribeMacro \DescribeMacro + \let\@@DescribeEnv \DescribeEnv + +\DeclareRobustCommand\cs[1]{\texttt{\bslash #1}} +\AddToHook{class/amsdtx/after}{% + \DeclareRobustCommand\cs[1]{% + \@boxorbreak{% + \ntt + \addbslash#1\@empty + \@xp\@xp\@xp\@indexcs\@xp\@nobslash\string#1\@nil + }% + }% + \def\cn{\cs}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \endinput %% %% End of file `doc.sty'. |