diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty b/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty index a9e69681788..8419a02a597 100644 --- a/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty +++ b/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty @@ -4,34 +4,13 @@ %% %% The original source files were: %% -%% ydoc.dtx (with options: `desc') +%% ydoc.dtx (with options: `ydoc-desc.sty') %% -%% -%% Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de> -%% WWW: http://latex.scharrer-online.de/ -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `maintained'. -%% -%% The Current Maintainer of this work is Martin Scharrer. -%% -%% This work consists of the files ydoc.dtx and ydoc.ins -%% and the derived file ydoc.cls, ydoc.sty, ydoc-code.sty, -%% ydoc-expl.sty and ydoc-desc.sty. -%% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\RequirePackage{svn-prov}[2010/04/03] -\ProvidesPackageSVN[ydoc-desc] - {$Id: ydoc_desc_sty.dtx 2369 2011-03-20 00:04:45Z martin $} - [v0.5alpha] - [ydoc package to describe macros, environments, options etc.] +\ProvidesPackage{ydoc-desc}[% + 2011/08/11 + v0.5alpha + ydoc package to describe macros, environments, options etc.] \IfFileExists{needspace.sty}{% \RequirePackage{needspace} }{% @@ -41,6 +20,7 @@ \RequirePackage{etoolbox} \RequirePackage{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} @@ -130,7 +110,9 @@ \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} @@ -357,6 +339,14 @@ \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}% @@ -397,6 +387,7 @@ } \define@Macro@handler\AlsoMacro{} \define@Macro@handler\DescribeMacro{} +\define@Macro@handler\DescribeKey{} \newcommand*\MacroArgs{% \begingroup \def\end@Macro@args{\endgroup\xspace}% @@ -416,6 +407,19 @@ \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 @@ -520,6 +524,10 @@ \escapechar\m@ne \string#1\strut}}% } +\def\PrintKeyName#1{% + {\keydescstyle{\strut + #1\strut}}% +} \let\PrintLengthName\PrintMacroName \def\PrintEnvName#1#2{% \strut @@ -531,7 +539,7 @@ \par\vspace\beforedescskip \begingroup \sbox\@tempboxa{\descframe{\usebox{\descbox}}}% - \Needspace*{\dimexpr\ht\@tempboxa+2\baselineskip\relax}% + \Needspace*{\dimexpr\ht\@tempboxa+3\baselineskip\relax}% \par\noindent \ifdim\wd\@tempboxa>\dimexpr\linewidth-2\descindent\relax \makebox[\linewidth][c]{\usebox\@tempboxa}% |