%% %% This is file `ydoc-code.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% ydoc.dtx (with options: `ydoc-code.sty') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ydoc-code}[% 2011/11/19 v0.6alpha ydoc package to document macro code] \RequirePackage{hyperref} \hypersetup{colorlinks=true,pdfborder=0 0 0,pdfborderstyle={}} \IfFileExists{needspace.sty}{% \RequirePackage{needspace} }{% \def\Needspace{\@ifstar\@gobble\@gobble} } \RequirePackage{xcolor} \definecolor{macroimpl}{rgb}{0.0,0.0,0.4} \@ifundefined{ydocwrite}{% \newwrite\ydocwrite }{} \@ifundefined{ydocfname}{% \def\ydocfname{\jobname.cod}% }{} \def\ydoc@catcodes{% \let\do\@makeother \dospecials \catcode`\\=\active \catcode`\^^M=\active \catcode`\ =\active } \def\macrocode{% \par\noindent \begingroup \ydoc@catcodes \macro@code } \def\endmacrocode{} \begingroup \endlinechar\m@ne \@firstofone{% \catcode`\|=0\relax \catcode`\(=1\relax \catcode`\)=2\relax \catcode`\*=14\relax \catcode`\{=12\relax \catcode`\}=12\relax \catcode`\ =12\relax \catcode`\%=12\relax \catcode`\\=\active \catcode`\^^M=\active \catcode`\ =\active }* |gdef|macro@code#1^^M% \end{macrocode}(* |endgroup|expandafter|macro@@code|expandafter(|ydoc@removeline#1|noexpand|lastlinemacro)* )* |gdef|ydoc@removeline#1^^M(|noexpand|firstlinemacro)* |gdef|ydoc@defspecialmacros(* |def^^M(|noexpand|newlinemacro)* |def (|noexpand|spacemacro)* |def\(|noexpand|bslashmacro)* )* |gdef|ydoc@defrevspecialmacros(* |def|newlinemacro(|noexpand^^M)* |def|spacemacro(|noexpand )* |def|bslashmacro(|noexpand\)* )* |endgroup \def\macro@@code#1{% {\ydoc@defspecialmacros \xdef\themacrocode{#1}}% \PrintMacroCode \end{macrocode}% } \def\newlinemacro{\\\null} \def\spacemacro{\ } \def\bslashmacro{\char92} \def\lastlinemacro{} \def\firstlinemacro{\linenumberbox} \def\newlinemacro{\\\linenumberbox} \newcounter{linenumber} \def\linenumberbox{% \hbox to 1.25em{}% \llap{% \stepcounter{linenumber}% {\footnotesize\color{gray}\thelinenumber~}% }% } \def\PrintMacroCode{% \begingroup \ttfamily \noindent\themacrocode \endgroup } \RequirePackage{listings} \def\PrintMacroCode{% \begingroup \let\firstlinemacro\empty \let\lastlinemacro\empty \def\newlinemacro{^^J}% \let\bslashmacro\bslash \let\spacemacro\space \immediate\openout\ydocwrite=\ydocfname\relax \immediate\write\ydocwrite{\themacrocode}% \immediate\closeout\ydocwrite \@nameuse{ydoc@countbslashes}% \ydoclistingssettings \let\input\@input \lstinputlisting{\ydocfname}% \endgroup } \def\ydoclistingssettings{% \lstset{% language=[latex]tex,basicstyle=\ttfamily, numbers=left,numberstyle=\tiny\color{gray},firstnumber=last, breaklines,prebreak={\mbox{\tiny$\swarrow$}}, commentstyle=\color{black!60}, }% } \ydoclistingssettings \def\macro@impl@args[#1]{% \begingroup \parindent=10pt\relax \let\macro@impl@argcnt\@tempcnta \let\macro@impl@curarg\@tempcntb \macro@impl@argcnt=#1\relax \macro@impl@curarg=0\relax \ifnum\macro@impl@curarg<\macro@impl@argcnt\relax \expandafter\macro@impl@arg \else \expandafter\macro@impl@endargs \fi } \def\macro@impl@endargs{% \endgroup \unskip\par\noindent\ignorespaces } \def\macro@impl@argline#1#2{% \par{\texttt{\##1}:~#2\strut}% } \def\macro@impl@arg#1{% \advance\macro@impl@curarg by\@ne\relax \macro@impl@argline{\the\macro@impl@curarg}{#1}% \ifnum\macro@impl@curarg<\macro@impl@argcnt\relax \expandafter\macro@impl@arg \else \expandafter\macro@impl@endargs \fi } \def\macro#1{% \PrintMacroImpl{#1}% \@ifnextchar[%] {\macro@impl@args}% {}% } \def\endmacro{} \def\key#1#2{% \PrintMacroImpl{KV@#1@#2}% \@ifnextchar[%] {\macro@impl@args}% {}% } \def\endkey{} \def\environment#1{% \PrintEnvImplName{#1}% \@ifnextchar[%] {\macro@impl@args}% {}% } \def\endenvironment{} \def\style#1{% \PrintStyleImplName{#1}% \@ifnextchar[%] {\macro@impl@args}% {}% } \def\endstyle{} \def\PrintStyleImplName{\PrintEnvImplName} \def\PrintMacroImpl#1{% \par\bigskip\noindent \Needspace*{3\baselineskip}% \hbox{% \edef\name{\expandafter\@gobble\string#1}% \global\@namedef{href@impl@\name}{}% \immediate\write\@mainaux{% \global\noexpand\@namedef{href@impl@\name}{}% }% \raisebox{4ex}[4ex]{\hypertarget{impl:\name}{}}% \hspace*{\descindent}\fbox{% \hspace*{\descsep}% \@ifundefined{href@desc@\name}{}{\hyperlink{desc:\name}}% {\PrintMacroImplName{#1}}% \hspace*{\descsep}% }% }% \par\medskip\noindent } \def\PrintMacroImplName#1{% \implstyle{\string#1\strut}% } \def\PrintEnvImplName#1{% \par\bigskip\noindent \hbox{\hspace*{\descindent}\fbox{{\implstyle{#1}}}}% \par\medskip } \def\implstyle{\ttfamily\bfseries\color{macroimpl}} {% \@firstofone{% \catcode`\\=12 \gdef\bslash }{\} }%} \endinput %% %% End of file `ydoc-code.sty'.