diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-10 21:56:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-10 21:56:52 +0000 |
commit | 5406b8e0ea1d596600f773e766975256e4087c51 (patch) | |
tree | 74d244f62ddcc29123ecef56e914cc0fd7bd6de3 /Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty | |
parent | 4f711ec63a6c65e74a08a634bc886ee54b2140fe (diff) |
new latex package ydoc (10apr10)
git-svn-id: svn://tug.org/texlive/trunk@17793 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty | 407 |
1 files changed, 407 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty b/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty new file mode 100644 index 00000000000..f921666ae5a --- /dev/null +++ b/Master/texmf-dist/tex/latex/ydoc/ydoc-desc.sty @@ -0,0 +1,407 @@ +%% +%% This is file `ydoc-desc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ydoc.dtx (with options: `desc') +%% +%% Copyright (c) 2010 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. +%% +\RequirePackage{svn-prov}[2010/04/03] +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackageSVN + [ydoc-desc] + {$Id: ydoc.dtx 1847 2010-04-10 10:57:11Z martin $} + [v0.1alpha] + [ydoc package to describe macros, environments, options etc.] +\RequirePackage{xcolor} +\definecolor{macrodesc}{rgb}{0.0,0.0,0.8} +\definecolor{macroimpl}{rgb}{0.0,0.0,0.4} +\definecolor{meta}{rgb}{0.0,0.4,0.4} +\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} +\def\meta#1{% + \ensuremath\langle + {\metastyle{#1\/}}% + \ensuremath\rangle +} +\def\@meta#1{% + \@ifnextchar<% + {\is@meta}% + {}% + #1% +} +\def\is@meta<#1>{% + \meta{#1}% +} +\def\marg#1{\@marg{<#1>}} +\def\oarg#1{\@oarg{<#1>}} +\def\parg#1{\@parg{<#1>}} +\def\aarg#1{\@aarg{<#1>}} +\def\@marg#1{% + {\margstyle{% + {\ttfamily\braceleft}% + \@meta{#1}% + {\ttfamily\braceright}% + }}% +} +\def\@oarg#1{% + {\oargstyle{% + {\ttfamily[}% + \@meta{#1}% + {\ttfamily]}% + }}% +} +\def\@parg#1{% + {\pargstyle{% + {\ttfamily(}% + \@meta{#1}% + {\ttfamily)}% + }}% +} +\def\@aarg#1{% + {\aargstyle{% + {\ttfamily<}% + \@meta{#1}% + {\ttfamily>}% + }}% +} +\def\sarg{{\sargstyle{*}}} +\def\pkg{\texttt} +\def\cls{\texttt} +\def\env{\texttt} +\def\cs#1{\texttt{\textbackslash #1}} +\def\opt{\textsf} +\def\macrodescstyle{\ttfamily\bfseries\color{macrodesc}} +\def\macroargsstyle{\ttfamily} +\def\envcodestyle{\ttfamily} +\def\verbstyle{\ttfamily} +\def\metastyle{\normalfont\itshape\color{meta}} +\def\margstyle{} +\def\oargstyle{\color{optional}\colorlet{meta}{metaoptional}} +\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 +} +\def\handle@Macro@arg{% + \ifcase0% + \ifx\@let@token\bgroup1\else + \ifx\@let@token[\empty2\else + \ifx\@let@token(\empty3\else + \ifx\@let@token<\empty4\else + \ifx\@let@token*\empty5\else + \ifx\@let@token'\empty6\else + \ifx\@let@token!\empty7\else + \ifx\@let@token\@sptoken8\else + \ifx\@let@token\space9\else + \ifx\@let@token~9\else + \ifx\@let@token\AlsoMacro10\else + \ifx\@let@token\DescribeMacro11\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \relax + \unskip + \expandafter\end@Macro@args%0 + \or\expandafter\read@Macro@marg%1 + \or\expandafter\read@Macro@oarg%2 + \or\expandafter\read@Macro@parg%3 + \or\expandafter\read@Macro@angle%4 + \or\expandafter\read@Macro@sarg%5 + \or\expandafter\read@Macro@verb%6 + \or\expandafter\read@Macro@cmds%7 + \or\expandafter\read@Macro@rmspace%8 + \or\expandafter\read@Macro@addtoken%9 + \else%10- + \fi +} +\def\end@Macro@args{% + \y@egroup + \after@Macro@args +} +\def\after@Macro@args{% +} +\def\read@Macro@marg#1{% + \@marg{#1}\read@Macro@arg +} +\def\read@Macro@oarg[#1]{% + \@oarg{#1}\read@Macro@arg +} +\def\read@Macro@parg(#1){% + \@parg{#1}\read@Macro@arg +} +\def\read@Macro@aarg<#1>>{% + \aarg{#1}\read@Macro@arg +} +\def\read@Macro@angle<{% + \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 +} +\def\read@Macro@sarg#1{% + \sarg\read@Macro@arg +} +\def\read@Macro@verb{% + \begingroup + \let\do\@makeother + \dospecials + \read@Macro@verb@ +} +\def\read@Macro@verb@'#1'{% + \endgroup + \ifx\relax#1\relax + {\verbstyle{\string'}}% + \else + {\verbstyle{#1}}% + \fi + \read@Macro@arg +} +\def\read@Macro@cmds!#1!{% + #1\relax + \read@Macro@arg +} +\@firstofone{\def\read@Macro@rmspace} {% + \read@Macro@arg +} +\def\read@Macro@addtoken#1{% + #1\read@Macro@arg +} +\@ifundefined{DescribeMacro}{}{% + \PackageInfo{ydoc-desc}{Redefining \string\DescribeMacro}{}% +} +\def\DescribeMacro{% + \DescribeMacros + \let\DescribeMacros\y@egroup + \def\after@Macro@args{\endDescribeMacros}% + \begingroup\makeatletter + \Describe@Macro +} +\def\Describe@Macro#1{% + \endgroup + \hbox\y@bgroup + \PrintMacroName{#1}% + \macroargsstyle + \read@Macro@arg +} +\newcommand*\Macro{\MacroArgs\AlsoMacro} +\def\@Macro{% + \begingroup\makeatletter + \Describe@Macro +} +\newcommand*\AlsoMacro{% + \begingroup\makeatletter + \AlsoMacro@ +} +\def\AlsoMacro@#1{% + \endgroup + \PrintMacroName{#1}% + \read@Macro@arg +} +\newcommand*\MacroArgs{% + \begingroup + \let\end@Macro@args\endgroup + \read@Macro@arg +} +\def\DescribeMacros{% + \begingroup + \let\Macro\@Macro + \parindent=0pt\relax + \setbox\descbox\vbox\y@bgroup +} +\def\endDescribeMacros{% + \y@egroup + \PrintMacros + \endgroup +} +\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}% + \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}}% +} +\let\PrintLengthName\PrintMacroName +\def\PrintEnvName#1#2{% + \strut + \string#1\braceleft + {\macrodescstyle#2}% + \braceright +} +\def\PrintMacros{% + \par\vspace\beforedescskip + \noindent\hspace*{\descindent}% + \ifdim\wd\descbox>\linewidth + \makebox[\linewidth][c]{\fbox{\hspace*{\descsep}\usebox{\descbox}\hspace*{\descsep}}} + \else + \fbox{\hspace*{\descsep}\usebox{\descbox}\hspace*{\descsep}}% + \fi + \par\vspace\afterdescskip +} +\let\PrintLength\PrintMacros +\def\PrintEnv{% + \par\vspace\beforedescskip + \noindent\hspace*{\descindent}% + \fbox{\hspace*{\descsep}\usebox{\descbox}\hspace*{\descsep}}% + \par\vspace\afterdescskip +} +\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} +\endinput +%% +%% End of file `ydoc-desc.sty'. |