%% %% This is file `ydoc-desc.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% ydoc.dtx (with options: `ydoc-desc.sty') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ydoc-desc}[% 2022/10/26 v0.7alpha ydoc package to describe macros, environments, options etc.] \IfFileExists{needspace.sty}{% \RequirePackage{needspace} }{% \def\Needspace{\@ifstar\@gobble\@gobble} } \RequirePackage{shortvrb} \RequirePackage{etoolbox} \RequirePackage{xcolor} \expandafter\def\csname\string\color@none\endcsname{% \xcolor@ {}{}{}{} } \definecolor{macrodesc}{rgb}{0,0.2,0.6} \definecolor{keydesc}{rgb}{0,0.4,0.9} \definecolor{macroimpl}{rgb}{0,0.1,0.3} \definecolor{meta}{rgb}{0,0.25,0.75} \definecolor{scriptcolor}{rgb}{0.2,0.6,0.2} \definecolor{optioncolor}{rgb}{0.3.0.2,0} \colorlet{optional}{black!65!white} \colorlet{metaoptional}{optional!50!meta} \providecolor{urlcolor}{named}{blue} \providecolor{linkcolor}{named}{blue} \providecolor{filecolor}{named}{blue} \providecolor{citecolor}{named}{blue} \providecolor{anchorcolor}{named}{blue} \providecolor{menucolor}{named}{blue} \providecolor{runcolor}{named}{blue} \RequirePackage{hyperref} \hypersetup{% colorlinks=true, pdfborder=0 0 0, pdfborderstyle={}, urlcolor=urlcolor, linkcolor=linkcolor, filecolor=filecolor, citecolor=citecolor, anchorcolor=anchorcolor, menucolor=menucolor, runcolor=runcolor, } \newrobustcmd*\meta[1]{% {\metastyle{% \ensuremath\langle #1\/% \ensuremath\rangle }}% } \newrobustcmd*{\marg}[1]{% {\margstyle{% {\ttfamily\braceleft}% \meta{#1}% {\ttfamily\braceright}% }}% } \newrobustcmd*{\oarg}[1]{% {\oargstyle{% {\ttfamily[}% \meta{#1}% {\ttfamily]}% }}% } \newrobustcmd*{\parg}[1]{% {\pargstyle{% {\ttfamily(}% \meta{#1}% {\ttfamily)}% }}% } \newrobustcmd*{\aarg}[1]{% {\aargstyle{% {\ttfamily<}% \meta{#1}% {\ttfamily>}% }}% } \newrobustcmd*{\sarg}{{\sargstyle{*}}} \newrobustcmd*\pkg[1]{{\pkgstyle{#1}}} \newrobustcmd*\cls[1]{{\clsstyle{#1}}} \newrobustcmd*\lib[1]{{\libstyle{#1}}} \newrobustcmd*\env[1]{{\envstyle{#1}}} \newrobustcmd*\opt{\@ifstar\ys@opt\y@opt} \def\y@opt#1{{\optstyle{#1}}} \def\ys@opt#1{{\optstyle{#1}}\optpar{#1}} \newrobustcmd*\optpar[1]{\marginpar{\hbox to \marginparwidth{\hss\y@opt{#1}}}} \newrobustcmd*\file[1]{{\filestyle{#1}}} \newcommand*\pkgstyle[1]{\texttt{\textcolor{pkg}{#1}}} \newcommand*\clsstyle[1]{\texttt{\textcolor{cls}{#1}}} \newcommand*\libstyle[1]{\texttt{\textcolor{lib}{#1}}} \newcommand*\envstyle[1]{\texttt{\textcolor{env}{#1}}} \newcommand*\optstyle[1]{\textsf{\textcolor{opt}{#1}}} \newcommand*\filestyle[1]{\texttt{\textcolor{file}{#1}}} \colorlet{cls}{none} \colorlet{lib}{none} \colorlet{env}{none} \colorlet{file}{none} \colorlet{pkg}{none} \definecolor{opt}{rgb}{0.5,0.16666,0} \newrobustcmd*\cs[1]{\texttt{\textbackslash #1}} \newrobustcmd*\cmd[1]{\texttt{{\escapechar=92\string#1}}} \newrobustcmd*\Key[1]{\PrintKeyName{#1}\MacroArgs} \def\macrodescstyle{\ttfamily\bfseries\color{macrodesc}} \def\keydescstyle{\ttfamily\bfseries\color{keydesc}} \def\macroargsstyle{\ttfamily} \def\envcodestyle{\ttfamily} \def\verbstyle{\verbatim@font} \def\metastyle{\normalfont\itshape\color{meta}} \def\margstyle{} \protected\def\Optional{\optionalon\optional} \def\optionalstyle{\blendcolors*{!60!white}\color{black!75}} \def\optionalon{\protected\def\optional{\optionalstyle}} \def\optionaloff{\let\optional\relax} \optionalon \def\oargstyle{\optional} \def\pargstyle{} \def\aargstyle{} \def\sargstyle{\ttfamily\color{optional}} \newdimen\descindent \descindent=-\parindent \newdimen\beforedescskip \beforedescskip=\bigskipamount \newdimen\afterdescskip \afterdescskip=\medskipamount \newdimen\descsep \begingroup \ttfamily \global\descsep=1em\relax \endgroup \def\read@Macro@arg{% \futurelet\@let@token\handle@Macro@arg } \newcommand*\AlsoMacro{% \begingroup\makeatletter \AlsoMacro@ } \def\AlsoMacro@#1{% \endgroup \PrintMacroName{#1}% \read@Macro@arg } \begingroup \catcode`\|\active \gdef\ydoc@short@AlsoMacro{% \catcode`\|\active \let|\AlsoMacro } \endgroup \def\ydoc@macrocatcodes{% \ydoc@short@AlsoMacro \@makeother\'% \@makeother\!% \@makeother\[% \@makeother\]% \@makeother\(% \@makeother\)% } \def\handle@Macro@arg{% \expandafter\let\expandafter\handler\csname handle@Macro@token@\meaning\@let@token\endcsname \ifx\handler\relax \def\handler{\ifhmode\unskip\fi\end@Macro@args}% \fi \handler } \def\define@Macro@handler{% \begingroup \ydoc@macrocatcodes \define@Macro@handler@ } \def\define@Macro@handler@#1{% \endgroup \@namedef{handle@Macro@token@\meaning#1}% } \def\end@Macro@args{% \y@egroup \after@Macro@args } \def\after@Macro@args{% } \define@Macro@handler{\bgroup}{% \begingroup \afterassignment\read@Macro@marg@ \let\@let@token=% } \def\read@Macro@marg@{% \bgroup \margstyle{}% \let\end@Macro@args\empty% {\ttfamily\braceleft}% \aftergroup\read@Macro@marg@@ \read@Macro@arg } \def\read@Macro@marg@@{% {\ttfamily\braceright}% \endgroup \read@Macro@arg } \define@Macro@handler{[}[{% \begingroup \let\read@Macro@oarg@end\read@Macro@oarg@@end \let\end@Macro@args\read@Macro@oarg@end \oargstyle{}% {\ttfamily[}%] \read@Macro@arg } \define@Macro@handler{]}{% \read@Macro@oarg@end } \def\read@Macro@oarg@@end#1]{% #1% {\ttfamily]}% \endgroup \read@Macro@arg } \def\read@Macro@oarg@end{\end@Macro@args} \let\read@Macro@aarg@end\read@Macro@oarg@end \let\read@Macro@parg@end\read@Macro@oarg@end \define@Macro@handler{(}({% \begingroup \let\read@Macro@parg@end\read@Macro@parg@@end \let\end@Macro@args\read@Macro@parg@end \pargstyle{}% {\ttfamily(}%) \read@Macro@arg } \define@Macro@handler{)}{% \read@Macro@parg@end } \def\read@Macro@parg@@end#1){% #1% {\ttfamily)}% \endgroup \read@Macro@arg } \def\read@Macro@aarg<{% \begingroup \let\read@Macro@aarg@end\read@Macro@aarg@@end \let\end@Macro@args\read@Macro@aarg@end \aargstyle{}% {\ttfamily<}% \read@Macro@arg } \define@Macro@handler{>}{% \read@Macro@aarg@end } \def\read@Macro@aarg@@end#1>>{% #1% {\ttfamily>}% \endgroup \read@Macro@arg } \define@Macro@handler{<}<{% \futurelet\@let@token\read@Macro@angle@ } \def\read@Macro@angle@{% \ifx\@let@token<% \expandafter\read@Macro@aarg \else \expandafter\read@Macro@meta \fi } \def\read@Macro@meta#1>{% \meta{#1}\read@Macro@arg } \define@Macro@handler**{% \sarg\read@Macro@arg } \define@Macro@handler{=}={% =\read@Macro@arg } \define@Macro@handler{'}'{% \begingroup \let\do\@makeother \dospecials \@noligs \@makeother\'% \obeyspaces \read@Macro@verb@ } \begingroup \@makeother\'% \gdef\read@Macro@verb@#1'{% \endgroup \ifx\relax#1\relax {\verbstyle{\string'}}% \else {% \frenchspacing \@noligs\verbstyle{#1}}% \fi \read@Macro@arg } \endgroup \define@Macro@handler!!#1!{% #1\relax \read@Macro@arg } \define@Macro@handler{\@sptoken} {% \read@Macro@arg } \define@Macro@handler{~}#1{% #1\read@Macro@arg } \AtBeginDocument{% \define@Macro@handler{~}#1{% #1\read@Macro@arg } } \define@Macro@handler{\space}#1{% #1\read@Macro@arg } \@ifundefined{DescribeMacro}{}{% \PackageInfo{ydoc-desc}{Redefining \string\DescribeMacro}{}% } \def\DescribeMacro{% \DescribeMacros \let\DescribeMacros\y@egroup \optionalon \def\after@Macro@args{\endDescribeMacros}% \begingroup\makeatletter \Describe@Macro } \def\DescribeScript#1{% \DescribeMacros \let\DescribeMacros\y@egroup \optionalon \def\after@Macro@args{\endDescribeMacros}% \hbox\y@bgroup \texttt{#1}% \ydoc@macrocatcodes \macroargsstyle \read@Macro@arg~% } \def\DescribeKey{% \DescribeKeys \let\DescribeKeys\y@egroup \optionalon \def\after@Macro@args{\endDescribeKeys}% \begingroup\makeatletter \Describe@Macro } \def\Describe@Macro#1{% \endgroup \edef\name{\expandafter\@gobble\string#1}% \global\@namedef{href@desc@\name}{}% \immediate\write\@mainaux{% \global\noexpand\@namedef{href@desc@\name}{}% }% \hbox\y@bgroup \@ifundefined{href@impl@\name}{}{\hyperlink{impl:\name}}% {% \hbox{\vbox to 0pt{\vss\hbox{\raisebox{4ex}{\hypertarget{desc:\name}{}}}}% \PrintMacroName{#1}}% }% \ydoc@macrocatcodes \macroargsstyle \read@Macro@arg } \newcommand*\MakeShortMacroArgs{% \@ifstar {\@MakeShortMacroArgs\Macro}% {\@MakeShortMacroArgs\MacroArgs}% } \def\@MakeShortMacroArgs#1#2{% \MakeShortVerb{#2} \catcode`#2\active \begingroup \catcode`\~\active \lccode`\~`#2\relax \lowercase{\endgroup\gdef~{\bgroup\let~\egroup#1}}% } \newcommand*\DeleteShortMacroArgs[1]{% \DeleteShortVerb{#1}% } \newcommand*\Macro{\MacroArgs\AlsoMacro} \def\@Macro{% \begingroup\makeatletter \Describe@Macro } \define@Macro@handler\AlsoMacro{} \define@Macro@handler\DescribeMacro{} \define@Macro@handler\DescribeKey{} \define@Macro@handler\DescribeScript{} \newcommand*\MacroArgs{% \begingroup \def\end@Macro@args{\endgroup\xspace}% \ydoc@macrocatcodes \macroargsstyle \read@Macro@arg } \RequirePackage{xspace} \def\DescribeMacros{% \begingroup \let\Macro\@Macro \parindent=0pt\relax \setbox\descbox\vbox\y@bgroup } \def\endDescribeMacros{% \y@egroup \PrintMacros \endgroup } \def\DescribeKeys{% \begingroup \let\PrintMacroName\PrintKeyName \let\Key\@Macro \parindent=0pt\relax \setbox\descbox\vbox\y@bgroup } \def\endDescribeKeys{% \y@egroup \PrintKeys \endgroup } \def\PrintKeys{\PrintMacros} \def\DescribeMacrosTabcolsep{\tabcolsep} \def\DescribeMacrosTab{% \DescribeMacros \hbox\y@bgroup \tabcolsep=\DescribeMacrosTabcolsep\relax \DescribeMacrosTab@ } \def\DescribeMacrosTab@#1{\tabular{@{}#1@{}}} \def\endDescribeMacrosTab{% \endtabular\y@egroup \endDescribeMacros } \newcommand*\DescribeLength{% \begingroup \let\DescribeLength\Describe@Length \setbox\descbox\hbox\y@bgroup \tabular{@{}l@{\hspace{2em}}l@{}}% \Describe@Length } \newcommand*\Describe@Length[2]{% \PrintLengthName{#1}& (Default: {\macroargsstyle#2\unskip})% \@ifnextchar\DescribeLength {\\}% {% \endtabular \y@egroup \PrintLength \endgroup }% } \@ifundefined{DescribeEnv}{}{% \PackageInfo{ydoc-desc}{Redefining \string\DescribeEnv}{}% } \let\DescribeEnv\relax \newcommand*\DescribeEnv[2][]{% \begingroup \def\DescribeEnv@name{#2}% \let\\\DescribeEnv@newline \ifx\@currenvir\DescribeEnv@string \def\after@Macro@args{% \let\after@Macro@args\empty \setbox\@tempboxa\hbox\y@bgroup \@ifnextchar\end{}% {\DescribeEnv@newline}% #1% }% \else \ifx\relax#1\relax \def\after@Macro@args{% \y@bgroup \endDescribeEnv }% \else \def\after@Macro@args{% \setbox\@tempboxa\hbox\y@bgroup \DescribeEnv@newline\MacroArgs#1% \endDescribeEnv }% \fi \fi \setbox\descbox\vbox\y@bgroup \envcodestyle \let\PrintEnv\PrintSubEnv \hbox\y@bgroup \PrintEnvName{\begin}{\DescribeEnv@name}% \ydoc@macrocatcodes \macroargsstyle \read@Macro@arg } \newcommand*\DescribeEnv@newline[1][0pt]{% \strut\y@egroup {\vskip#1}% \hbox\y@bgroup\strut \hspace*{\descsep}% \ignorespaces }% \def\DescribeEnv@string{DescribeEnv} \newbox\descbox \def\endDescribeEnv{% \y@egroup \begingroup \setbox\@tempboxa\lastbox \ifcase0% \ifdim\wd\@tempboxa>\descsep1\fi \ifdim\ht\@tempboxa>\ht\strutbox1\fi \ifdim\dp\@tempboxa>\dp\strutbox1\fi \else \box\@tempboxa \fi \endgroup \hbox\y@bgroup \PrintEnvName{\end}{\DescribeEnv@name} \y@egroup \y@egroup \PrintEnv \endgroup } \def\PrintMacroName#1{% {\macrodescstyle{\strut \texttt{\char92}% \escapechar\m@ne \string#1\strut}}% } \def\PrintKeyName#1{% {\keydescstyle{\strut #1\strut}}% } \let\PrintLengthName\PrintMacroName \def\PrintEnvName#1#2{% \strut \string#1\braceleft {\macrodescstyle#2\strut}% \braceright } \def\PrintMacros{% \par\vspace\beforedescskip \begingroup \sbox\@tempboxa{\descframe{\usebox{\descbox}}}% \Needspace*{\dimexpr\ht\@tempboxa+3\baselineskip\relax}% \par\noindent \ifdim\wd\@tempboxa>\dimexpr\linewidth-2\descindent\relax \makebox[\linewidth][c]{\usebox\@tempboxa}% \else \hspace*{\descindent}% \usebox\@tempboxa \fi \endgroup \par \vspace\afterdescskip \par\noindent } \def\descframe#1{% \fbox{\hspace*{\descsep}#1\hspace*{\descsep}}% } \let\PrintLength\PrintMacros \let\PrintEnv\PrintMacros \def\PrintSubEnv{% \hbox{\hbox{\usebox{\descbox}}}% } {% \@firstofone{% \catcode`\\=12 \gdef\bslash }{\} }%} \begingroup \catcode`\%=12 \gdef\percent{%} \endgroup \begingroup \catcode`\<=1 \catcode`\>=2 \catcode`\{=12 \catcode`\}=12 \gdef\braceleft <{> \gdef\braceright<}> \endgroup \def\y@bgroup{\bgroup\color@setgroup} \def\y@egroup{\color@endgroup\egroup} \newcommand*{\codeline}[1][c]{% \codelinebefore \hbox to \hsize\bgroup \ifx i#1\hspace*{\leftmargin}\else \ifx l#1\else\hss\fi \fi \let\xspace\relax \hbox\bgroup \aftergroup\codeline@end \aftergroup#1% \afterassignment\MacroArgs \let\@let@token=% } \def\codeline@end#1{% \ifx r#1\else\hss\fi \egroup \codelineafter } \newcommand*\codelinebefore{\par\smallskip\noindent} \newcommand*\codelineafter {\par\smallskip\noindent} \newenvironment{codequote}{% \def\\{\newline\relax\MacroArgs}% \par\smallskip\bgroup\leftskip=\leftmargin\rightskip=\rightmargin\noindent\MacroArgs} {\par\egroup\smallskip\noindent\ignorespacesafterend} \newenvironment{macroquote}{% \def\\{\newline\relax\Macro}% \par\smallskip\bgroup\leftskip=\leftmargin\rightskip=\rightmargin\noindent\Macro} {\par\egroup\smallskip\noindent\ignorespacesafterend} \endinput %% %% End of file `ydoc-desc.sty'.