diff options
author | Karl Berry <karl@freefriends.org> | 2011-03-21 21:59:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-03-21 21:59:45 +0000 |
commit | 4f243e567cce42bca2f019edec58026baf5b6162 (patch) | |
tree | cdb5dd12a2a25edea2f45413f5a0610fae01a888 /Master/texmf-dist/source | |
parent | bd9ed7a519b6dce70bfb60a035fa991fe5861c17 (diff) |
ydoc (21mar11)
git-svn-id: svn://tug.org/texlive/trunk@21787 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/ydoc/ydoc.dtx | 872 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/ydoc/ydoc.ins | 26 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/ydoc/ydocstrip.tex | 70 |
3 files changed, 745 insertions, 223 deletions
diff --git a/Master/texmf-dist/source/latex/ydoc/ydoc.dtx b/Master/texmf-dist/source/latex/ydoc/ydoc.dtx index ff27403fa81..0e8cccfa53c 100644 --- a/Master/texmf-dist/source/latex/ydoc/ydoc.dtx +++ b/Master/texmf-dist/source/latex/ydoc/ydoc.dtx @@ -1,4 +1,5 @@ -% \iffalse +% \iffalse COPYRIGHT +%% %% Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de> %% WWW: http://latex.scharrer-online.de/ %% @@ -21,41 +22,81 @@ % \fi % % \iffalse -%<*driver|class|package|code|desc|expl|doc> -\RequirePackage{svn-prov}[2010/04/03] -%</driver|class|package|code|desc|expl|doc> -%<*driver> -\ProvidesFileSVN[ydoc.dtx] -%</driver> -%<package|code|desc|expl|doc>\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%<class>\ProvidesClassSVN -%<package|code|desc|expl|doc>\ProvidesPackageSVN -%<code> [ydoc-code] -%<desc> [ydoc-desc] -%<expl> [ydoc-expl] -%<doc> [ydoc-doc] -%<*driver|class|package|code|desc|expl|doc> - {$Id: ydoc.dtx 2163 2011-02-16 17:19:27Z martin $} - [v0.4alpha] -%</driver|class|package|code|desc|expl|doc> -%<class> [ydoc class: document LaTeX class and packages] -%<package> [ydoc package: document LaTeX class and packages] -%<code> [ydoc package to document macro code] -%<desc> [ydoc package to describe macros, environments, options etc.] -%<expl> [ydoc package to insert live examples of LaTeX code] -%<doc> [ydoc package to provide 'doc' macros] +%<*dtx> +\begingroup +\expandafter\ifx\csname install\endcsname\relax\fi +\expandafter\ifx\csname endinstall\endcsname\relax\fi +\install +%</dtx> +%<*install> +\input ydocstrip.tex + +\preamble +\endpreamble + +\keepsilent +\askforoverwritefalse + +\generate{% + \file{ydoc.cls} {\from{ydoc.dtx}{class}}% + \file{ydoc.sty} {\from{ydoc.dtx}{package}}% + \file{ydoc.cfg} {\from{ydoc.dtx}{cfg}}% + \file{ydoc-code.sty}{\from{ydoc.dtx}{code}}% + \file{ydoc-desc.sty}{\from{ydoc.dtx}{desc}}% + \file{ydoc-expl.sty}{\from{ydoc.dtx}{expl}}% + \file{ydoc-doc.sty} {\from{ydoc.dtx}{doc}}% +} + +\begingroup +\expandafter\obeyspaces +\csname AtEndDocument\endcsname{% +\ifx\Msg\undefined\let\Msg\typeout\fi +\Msg{*************************************************************}% +\Msg{* *}% +\Msg{* To finish the installation you have to move the following *}% +\Msg{* file into a directory searched by TeX: *}% +\Msg{* *}% +\Msg{* ydoc.cls *}% +\Msg{* ydoc.sty *}% +\Msg{* ydoc-code.sty *}% +\Msg{* ydoc-desc.sty *}% +\Msg{* ydoc-expl.sty *}% +\Msg{* ydoc-doc.sty *}% +\Msg{* *}% +\Msg{* To produce the documentation run the file standalone.dtx *}% +\Msg{* through LaTeX. *}% +\Msg{* *}% +\Msg{* Happy TeXing! *}% +\Msg{* *}% +\Msg{*************************************************************}% +}% +\endgroup + +%<install>\endbatchfile +%</install> +%<*dtx> +\endinstall +\endgroup +%</dtx> +%<install>% vim: ft=tex +% \fi % +% \iffalse %<*driver> +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\RequirePackage{svn-prov}[2010/04/03] +\ProvidesFileSVN[ydoc.dtx] + {$Id: ydoc_doc.dtx 2378 2011-03-20 20:34:27Z martin $} +%<=*VERSION> + [v0.5alpha] +%<=/VERSION> + [DTX file of ydoc] + \DefineFileInfoSVN \GetFileInfoSVN* \documentclass{ydoc}[\filedate] -\usepackage{xcolor} -\usepackage{hyperref} -\usepackage{lmodern} -\usepackage{listings} -\usepackage{booktabs} - \newdimen\tempskip \def\tablecaption{% @@ -65,7 +106,7 @@ \caption } -\hypersetup{colorlinks=true,linkcolor=green} +\OnlyDescription \begin{document} \DocInput{ydoc.dtx} \PrintChanges @@ -74,7 +115,7 @@ %</driver> % \fi % -% \CheckSum{1535} +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -99,7 +140,7 @@ % % \GetFileInfoSVN{ydoc.dtx} % -% \title{The \textsf{ydoc} Class and Packages} +% \title{The \textsf{\textbf{ydoc}} Class and Packages} % \author{Martin Scharrer \\ \href{mailto:martin@scharrer-online.de}{martin@scharrer-online.de} \\ % \url{http://latex.scharrer-online.de/ydoc/}\\ % CTAN: \url{http://tug.ctan.org/pkg/ydoc}} @@ -159,7 +200,7 @@ % % \subsection{Code Documentation Environments} % -% \begin{DescribeEnv}{macro}{<macro>}[<number of arguments>]!\color{optional}\colorlet{meta}{metaoptional}!{<arg~1~description>}!\ldots!{<arg~$n$~description>} +% \begin{DescribeEnv}{macro}{<macro>}[<\# of args>]!\optional!{<arg~1~description>}!\ldots!{<arg~$n$~description>} % \MacroArgs<macro documentation>\\ % \begin{DescribeEnv}{macrocode} % \MacroArgs<macro code> @@ -180,7 +221,7 @@ % This environment wraps around any \TeX\ code and types it verbatim. The environment end is read verbatim as well and must be written on a separate % line beginning with a percent followed by exactly four spaces: `\verb*+% \end{macrocode}+'. % -% \begin{DescribeEnv}{environment}{<environment name>}[<number of arguments>]!\color{optional}\colorlet{meta}{metaoptional}!{<arg~1~description>}!\ldots!{<arg~$n$~description>} +% \begin{DescribeEnv}{environment}{<name>}[<\# of args>]!\optional!{<arg~1~description>}!\ldots!{<arg~$n$~description>} % \MacroArgs<environment documentation>\\ % \begin{DescribeEnv}{macrocode} % \MacroArgs<macro code> @@ -385,11 +426,29 @@ %<*class> % \fi % \subsection{Class File} +% % \begin{macrocode} -\LoadClassWithOptions{article} -%%\RequirePackage{doc} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\RequirePackage{svn-prov}[2010/04/03] +\ProvidesClassSVN + {$Id: ydoc_cls.dtx 2336 2011-03-18 00:56:07Z martin $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [ydoc class: document LaTeX class and packages] +% \end{macrocode} +% +% At the moment simply load \cls{article} class with \opt{a4paper} option +% and load the \pkg{ydoc} package. +% \begin{macrocode} +\PassOptionsToClass{a4paper}{article} +\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{article}} +\ProcessOptions\relax +\LoadClass{article} \RequirePackage{ydoc} % \end{macrocode} +% % \iffalse %</class> % \fi @@ -398,7 +457,21 @@ %<*package> % \fi % \subsection{Package File} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\RequirePackage{svn-prov}[2010/04/03] +\ProvidesPackageSVN[ydoc] + {$Id: ydoc_sty.dtx 2332 2011-03-17 17:12:35Z martin $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [ydoc package: document LaTeX class and packages] +% \end{macrocode} +% % \begin{macrocode} +\RequirePackage{svn-prov}[2010/04/03] \RequirePackage{ydoc-code} \RequirePackage{ydoc-expl} \RequirePackage{ydoc-desc} @@ -407,11 +480,82 @@ \RequirePackage{newverbs} \MakeSpecialShortVerb{\qverb}{\"} \AtBeginDocument{\catcode`\^^A=14\relax} + +\input{ydoc.cfg} % \end{macrocode} % \iffalse %</package> % \fi % +% +% \iffalse +%<*cfg> +% \fi +% \subsection{Config File} +% \begin{macrocode} +%% Please delete the following line on manual changes: +\ProvidesFileSVN[ydoc.cfg]{$Id: ydoc_cfg.dtx 2338 2011-03-18 01:14:34Z martin $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [Default config file for ydoc] +% \end{macrocode} +% +% Use 'Linux Libertine' font as main font if installed. +% Define "\/" to some fixed italic corrections +% as long there is none defined by the font. +% \begin{macrocode} +\usepackage[T1]{fontenc} +\IfFileExists{libertine.sty}{% + \usepackage{libertine} + \begingroup + \setbox0\hbox{\it g\/} + \setbox1\hbox{\it g} + \ifnum\wd0>\wd1\else + \gdef\/{\kern 0.8864pt} + \fi + \endgroup +}{} +% \end{macrocode} +% +% Only use 'lmodern' for the 'tt' font if installed. +% \begin{macrocode} +\IfFileExists{lmodern.sty}{% + %\usepackage{lmodern} + \renewcommand{\ttdefault}{lmtt} +}{} +% \end{macrocode} +% +% +% \begin{macrocode} +\urlstyle{sf} +% \end{macrocode} +% +% Use micro-typesetting if pdftex is used: +% \begin{macrocode} +\usepackage{ifpdf} +\ifpdf +\usepackage{microtype} +\fi +% \end{macrocode} +% \begin{macrocode} +\usepackage{array} +\usepackage{booktabs} +\usepackage{multicol} +\usepackage{xcolor} +\usepackage{listings} +\usepackage{booktabs} +\usepackage{hyperref} +% \end{macrocode} +% +% \begin{macrocode} +\reversemarginpar +% \end{macrocode} +% \iffalse +%</cfg> +% \fi +% % \iffalse %<*code> % \fi @@ -419,10 +563,30 @@ % \subsection{Macros and Environments to document Implementations} % % \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\RequirePackage{svn-prov}[2010/04/03] +\ProvidesPackageSVN + {$Id: ydoc_code_sty.dtx 2339 2011-03-18 20:18:09Z martin $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [ydoc package to document macro code] +% \end{macrocode} +% +% \begin{macrocode} \RequirePackage{hyperref} \hypersetup{colorlinks=true,pdfborder=0 0 0,pdfborderstyle={}} % \end{macrocode} % +% \begin{macrocode} +\IfFileExists{needspace.sty}{% + \RequirePackage{needspace} +}{% + \def\Needspace{\@ifstar\@gobble\@gobble} +} +% \end{macrocode} +% % \subsubsection{Color and style definitions} % \begin{macrocode} \RequirePackage{xcolor} @@ -579,9 +743,11 @@ \lstset{% language=[latex]tex,basicstyle=\ttfamily, numbers=left,numberstyle=\tiny\color{gray},firstnumber=last, - breaklines,prebreak={\mbox{\tiny$\swarrow$}}% + breaklines,prebreak={\mbox{\tiny$\swarrow$}}, + commentstyle=\color{black!60}, }% } +\ydoclistingssettings % \end{macrocode} % \end{macro} % @@ -662,6 +828,7 @@ % \begin{macrocode} \def\PrintMacroImpl#1{% \par\bigskip\noindent + \Needspace*{3\baselineskip}% \hbox{% \edef\name{\expandafter\@gobble\string#1}% \global\@namedef{href@impl@\name}{}% @@ -723,12 +890,21 @@ %</code> % \fi % -% -% \subsection{Provide \pkg{doc} macros} -% % \iffalse %<*doc> % \fi +% \subsection{Provide \pkg{doc} macros} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\RequirePackage{svn-prov}[2010/04/03] +\ProvidesPackageSVN[ydoc] + {$Id: ydoc_doc_sty.dtx 2378 2011-03-20 20:34:27Z martin $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [ydoc package to provide 'doc' macros] +% \end{macrocode} % % \begin{macro}{\ydoc@countbslashes} % Reads the macro code into a temp box. The backslashes are defined to increase a counter. @@ -959,6 +1135,92 @@ \AtBeginDocument{\MakeShortVerb{\|}} % \end{macrocode} % +% \begin{macrocode} +\RequirePackage{url} + +\def\package{\def\@package} +\package{\jobname} + +\def\ctanlocation{\def\@ctanlocation##1} +\ctanlocation{http://www.ctan.org/pkg/#1} + +\date{Version \fileversion\space -- \filedate} + +\def\@homepage{% + \begingroup + \edef\@tempa{% + \endgroup + \noexpand\url + {\@ctanlocation{\@package}}% + }% + \@tempa +} + +\protected\def\homepage{\urldef\@homepage\url} +\protected\def\email{\hyper@normalise\email@} +\def\email@#1{\def\@plainemail{#1}\def\@email{\hyper@linkurl{\Hurl{#1}}{mailto:#1}}} + +\let\@email\empty + +\let\@plainemail\empty +\title{The \texorpdfstring{\pkgtitle{\@package}}{\@package} Package} + +\protected\def\pkgtitle#1{% + \texorpdfstring{\textsf{#1}}{#1}% +} + +\def\@maketitle{% + \newpage + \null\vskip 2em + \begin{center}% + \let\footnote\thanks + {\LARGE \@title \par }\vskip 1.5em% + {\large \lineskip .5em% + \begin{tabular}[t]{c}% + \@author + \end{tabular}% + \par}% + \ifx\@plainemail\empty\else + {\large \lineskip .5em% + \begin{tabular}[t]{c}% + \@email + \end{tabular}% + \par}% + \fi + \vskip 1em + {\large \lineskip .5em% + \begin{tabular}[t]{c}% + \@homepage + \end{tabular}% + \par}% + \vskip 1em + {\large \@date }% + \end{center}% + \par\vskip 1.5em + \aftergroup\ydocpdfsettings +} + +\ifpdf +\def\ydocpdfsettings{% + \hypersetup{% + pdfauthor = {\@author\space<\@plainemail>}, + pdftitle = {\@title}, + pdfsubject = {Documentation of LaTeX package \@package}, + pdfkeywords = {\@package, LaTeX, TeX} + }% +} +\else +\let\ydocpdfsettings\empty +\fi + +\let\orig@maketitle\maketitle +\def\maketitle{% + \ydocpdfsettings + \orig@maketitle + \let\orig@maketitle\relax +} +% \end{macrocode} +% % \iffalse %</doc> % \fi @@ -969,8 +1231,23 @@ % \subsection{Description Macros and Environments} % % \begin{macrocode} -\RequirePackage{hyperref} -\hypersetup{colorlinks=true,pdfborder=0 0 0,pdfborderstyle={}} +\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 $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [ydoc package to describe macros, environments, options etc.] +% \end{macrocode} +% +% \begin{macrocode} +\IfFileExists{needspace.sty}{% + \RequirePackage{needspace} +}{% + \def\Needspace{\@ifstar\@gobble\@gobble} +} % \end{macrocode} % % The short verbatim code is required for the similar macros provided here. @@ -978,108 +1255,111 @@ \RequirePackage{shortvrb} % \end{macrocode} % +% The \pkg{etoolbox} package is used mainly for |\newrobustcmd|. +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} +% % \subsubsection{Color and style definitions} % \begin{macrocode} \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{macrodesc}{rgb}{0,0.2,0.6} +\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} + % \end{macrocode} % +% \begin{macrocode} +\RequirePackage{hyperref} +\hypersetup{% + colorlinks=true, + pdfborder=0 0 0, + pdfborderstyle={}, + urlcolor=urlcolor, + linkcolor=linkcolor, + filecolor=filecolor, + citecolor=citecolor, + anchorcolor=anchorcolor, + menucolor=menucolor, + runcolor=runcolor, +} + +% \end{macrocode} % % \subsubsection{Text Formatting Macros} % % \begin{macro}{\meta} % Prints \meta{meta text}. % \begin{macrocode} -\def\meta#1{% +\newrobustcmd*\meta[1]{% + {\metastyle{% \ensuremath\langle - {\metastyle{#1\/}}% + #1\/% \ensuremath\rangle + }}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\marg} -% Calls \cs{marg} with angles added to force meta format. -% \begin{macrocode} -\def\marg#1{\@marg{<#1>}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\oarg} -% Calls \cs{oarg} with angles added to force meta format. -% \begin{macrocode} -\def\oarg#1{\@oarg{<#1>}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\parg} -% Calls \cs{parg} with angles added to force meta format. -% \begin{macrocode} -\def\parg#1{\@parg{<#1>}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\aarg} -% Calls \cs{aarg} with angles added to force meta format. -% \begin{macrocode} -\def\aarg#1{\@aarg{<#1>}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@marg} % Sets style and adds braces. % The text is formatted as separate set of macro arguments. % \begin{macrocode} -\def\@marg#1{% +\newrobustcmd*{\marg}[1]{% {\margstyle{% {\ttfamily\braceleft}% - {\def\end@Macro@args{}\read@Macro@arg#1}% + \meta{#1}% {\ttfamily\braceright}% }}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@oarg} +% \begin{macro}{\oarg} % Sets style and adds brackets. % The text is formatted as separate set of macro arguments. % \begin{macrocode} -\def\@oarg#1{% +\newrobustcmd*{\oarg}[1]{% {\oargstyle{% {\ttfamily[}% - {\def\end@Macro@args{}\read@Macro@arg#1}% + \meta{#1}% {\ttfamily]}% }}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@parg} +% \begin{macro}{\parg} % Sets style and adds parentheses. % \begin{macrocode} -\def\@parg#1{% +\newrobustcmd*{\parg}[1]{% {\pargstyle{% {\ttfamily(}% - {\def\end@Macro@args{}\read@Macro@arg#1}% + \meta{#1}% {\ttfamily)}% }}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@aarg} +% \begin{macro}{\aarg} % Sets style and adds angles. % \begin{macrocode} -\def\@aarg#1{% +\newrobustcmd*{\aarg}[1]{% {\aargstyle{% {\ttfamily<}% - {\def\end@Macro@args{}\read@Macro@arg#1}% + \meta{#1}% {\ttfamily>}% }}% } @@ -1089,25 +1369,47 @@ % \begin{macro}{\sarg} % Prints star with given style. % \begin{macrocode} -\def\sarg{{\sargstyle{*}}} +\newrobustcmd*{\sarg}{{\sargstyle{*}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\pkg} % \begin{macro}{\cls} +% \begin{macro}{\lib} % \begin{macro}{\env} % \begin{macro}{\opt} +% \begin{macro}{\file} % \begin{macrocode} -\RequirePackage{etoolbox} -\newrobustcmd*\pkg{\texttt} -\newrobustcmd*\cls{\texttt} -\newrobustcmd*\env{\texttt} -\newrobustcmd*\opt{\textsf} +\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}{black} +\colorlet{lib}{black} +\colorlet{env}{black} +\colorlet{file}{black} +\colorlet{pkg}{black} +\definecolor{opt}{rgb}{0.5,0.16666,0} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\cs} % \begin{macro}{\cmd} @@ -1144,7 +1446,7 @@ % \begin{macro}{\verbstyle} % Style for verbatim text inside macro argument list. % \begin{macrocode} -\def\verbstyle{\ttfamily} +\def\verbstyle{\verbatim@font} % \end{macrocode} % \end{macro} % @@ -1163,10 +1465,31 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\Optional} +% \begin{macro}{\optional} +% \begin{macro}{\optionalstyle} +% \begin{macrocode} +\protected\def\Optional{\optionalon\optional} +\def\optionalstyle{\blendcolors*{!60!white}\color{black!75}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\optionalon} +% \begin{macro}{\optionaloff} +% \begin{macrocode} +\def\optionalon{\protected\def\optional{\optionalstyle}} +\def\optionaloff{\let\optional\relax} +\optionalon +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\oargstyle} % Style for \cs{oarg}. A special color is set to show the `optional' status. % \begin{macrocode} -\def\oargstyle{\color{optional}\colorlet{meta}{metaoptional}} +\def\oargstyle{\optional} % \end{macrocode} % \end{macro} % @@ -1237,46 +1560,91 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\AlsoMacro} +% Reads argument while |@| is a letter, +% prints the macro name and reads further arguments. +% \begin{macrocode} +\newcommand*\AlsoMacro{% + \begingroup\makeatletter + \AlsoMacro@ +} +\def\AlsoMacro@#1{% + \endgroup +%<*DEBUG> + \typeout{DEBUG: Macro: \string#1}% +%</DEBUG> + \PrintMacroName{#1}% + \read@Macro@arg +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ydoc@short@AlsoMacro} +% Makes |&| an alias for |\AlsoMacro|. +% \begin{macrocode} +\begingroup +\catcode`\|\active +\gdef\ydoc@short@AlsoMacro{% + \catcode`\|\active + \let|\AlsoMacro +} +\endgroup +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\ydoc@macrocatcodes} +% Sets the catcodes inside for |read@Macro@arg| material. +% \begin{macrocode} +\def\ydoc@macrocatcodes{% + \ydoc@short@AlsoMacro + \@makeother\'% + \@makeother\!% + \@makeother\[% + \@makeother\]% + \@makeother\(% + \@makeother\)% +} +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\handle@Macro@arg} % Checks if next token is the begin of a valid macro argument and calls % the appropriate read macro or the end macro otherwise. % \begin{macrocode} \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- + \expandafter\let\expandafter\handler\csname handle@Macro@token@\meaning\@let@token\endcsname + \ifx\handler\relax + \def\handler{\ifhmode\unskip\fi\end@Macro@args}% +%<*DEBUG> + \typeout{DEBUG: Stopped at: \expandafter\meaning\csname @let@token\endcsname}% + \typeout{}% + \else + \expandafter\ifx\csname @let@token\endcsname\AlsoMacro + \typeout{DEBUG: TOKEN: \string\AlsoMacro}% + \else + \typeout{DEBUG: TOKEN: \expandafter\meaning\csname @let@token\endcsname}% + \fi +%</DEBUG> \fi + \handler +} +\def\define@Macro@handler{% + \begingroup + \ydoc@macrocatcodes + \define@Macro@handler@ +} +\def\define@Macro@handler@#1{% + \endgroup + \@namedef{handle@Macro@token@\meaning#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\end@Macro@args} % Closes box as calls hook. Might be locally redefined by some -% macros calling \cs{read@Macro@args}. +% macros calling \cs{read@Macro@arg}. % \begin{macrocode} \def\end@Macro@args{% \y@egroup @@ -1298,55 +1666,99 @@ % % \begin{macro}{\read@Macro@marg} % \begin{macrocode} -\def\read@Macro@marg{% +\define@Macro@handler{\bgroup}{% \begingroup - \afterassignment\read@Macro@marg@ - \let\@let@token=% + \afterassignment\read@Macro@marg@ + \let\@let@token=% } \def\read@Macro@marg@{% - \setbox\@tempboxa\hbox\bgroup - \color@setgroup\bgroup - \aftergroup\color@endgroup - \aftergroup\egroup - \aftergroup\read@Macro@marg@@ + \bgroup + \margstyle{}% \let\end@Macro@args\empty% + {\ttfamily\braceleft}% + \aftergroup\read@Macro@marg@@ \read@Macro@arg } \def\read@Macro@marg@@{% - \@marg{\usebox\@tempboxa}% - \endgroup - \read@Macro@arg + {\ttfamily\braceright}% + \endgroup + \read@Macro@arg } % \end{macrocode} % \end{macro} % % \begin{macro}{\read@Macro@oarg} % \begin{macrocode} -\def\read@Macro@oarg[#1]{% - \@oarg{#1}\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 % \end{macrocode} % \end{macro} % % \begin{macro}{\read@Macro@parg} % \begin{macrocode} -\def\read@Macro@parg(#1){% - \@parg{#1}\read@Macro@arg +\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 } % \end{macrocode} % \end{macro} % % \begin{macro}{\read@Macro@aarg} % \begin{macrocode} -\def\read@Macro@aarg<#1>>{% - \@aarg{#1}\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 } % \end{macrocode} % \end{macro} % % \begin{macro}{\read@Macro@angle} % \begin{macrocode} -\def\read@Macro@angle<{% +\define@Macro@handler{<}<{% \futurelet\@let@token\read@Macro@angle@ } % \end{macrocode} @@ -1374,7 +1786,7 @@ % % \begin{macro}{\read@Macro@sarg} % \begin{macrocode} -\def\read@Macro@sarg#1{% +\define@Macro@handler**{% \sarg\read@Macro@arg } % \end{macrocode} @@ -1383,10 +1795,12 @@ % \begin{macro}{\read@Macro@verb} % Sets up verbatim mode calls second macro. % \begin{macrocode} -\def\read@Macro@verb{% +\define@Macro@handler{'}'{% \begingroup \let\do\@makeother \dospecials + \@noligs + \@makeother\'% \obeyspaces \read@Macro@verb@ } @@ -1397,22 +1811,27 @@ % Closes verbatim mode and formats text. % If |#1| is empty (|''|) than a single |'| is printed. % \begin{macrocode} -\def\read@Macro@verb@'#1'{% +\begingroup +\@makeother\'% +\gdef\read@Macro@verb@#1'{% \endgroup \ifx\relax#1\relax {\verbstyle{\string'}}% \else - {\verbstyle{#1}}% + {% + \frenchspacing + \@noligs\verbstyle{#1}}% \fi \read@Macro@arg } +\endgroup % \end{macrocode} % \end{macro} % % \begin{macro}{\read@Macro@cmds} % Simply executes given code. % \begin{macrocode} -\def\read@Macro@cmds!#1!{% +\define@Macro@handler!!#1!{% #1\relax \read@Macro@arg } @@ -1422,7 +1841,7 @@ % \begin{macro}{\read@Macro@rmspace} % Removes space. The |\@firstofone| is used to preserve the space in the macro definition. % \begin{macrocode} -\@firstofone{\def\read@Macro@rmspace} {% +\define@Macro@handler{\@sptoken} {% \read@Macro@arg } % \end{macrocode} @@ -1431,7 +1850,15 @@ % \begin{macro}{\read@Macro@addtoken} % Takes token over from input to output `stream'. This is used for |\space| and |~|. % \begin{macrocode} -\def\read@Macro@addtoken#1{% +\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 } % \end{macrocode} @@ -1454,6 +1881,7 @@ \def\DescribeMacro{% \DescribeMacros \let\DescribeMacros\y@egroup + \optionalon \def\after@Macro@args{\endDescribeMacros}% \begingroup\makeatletter \Describe@Macro @@ -1461,6 +1889,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\DescribeScript} +% \begin{macrocode} +\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~% +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\Describe@Macro} % \begin{macrocode} \def\Describe@Macro#1{% @@ -1472,7 +1916,10 @@ }% \hbox\y@bgroup \@ifundefined{href@impl@\name}{}{\hyperlink{impl:\name}}% - {\hypertarget{desc:\name}{\PrintMacroName{#1}}}% + {% + \hbox{\vbox to 0pt{\vss\hbox{\raisebox{4ex}{\hypertarget{desc:\name}{}}}}% + \PrintMacroName{#1}}% + }% \ydoc@macrocatcodes \macroargsstyle \read@Macro@arg @@ -1480,15 +1927,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\ydoc@macrocatcodes} -% Sets the catcodes inside for |read@Macro@arg| material. -% \begin{macrocode} -\def\ydoc@macrocatcodes{% - \ydoc@short@AlsoMacro -} -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\MakeShortMacroArgs} % Defines the given character as short version for |\MacroArgs|. % It is first define to be a short verbatim character to take @@ -1538,34 +1976,10 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\AlsoMacro} -% Reads argument while |@| is a letter, -% prints the macro name and reads further arguments. -% \begin{macrocode} -\newcommand*\AlsoMacro{% - \begingroup\makeatletter - \AlsoMacro@ -} -\def\AlsoMacro@#1{% - \endgroup - \PrintMacroName{#1}% - \read@Macro@arg -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ydoc@short@AlsoMacro} -% Makes |&| an alias for |\AlsoMacro|. % \begin{macrocode} -\begingroup -\catcode`\|\active -\gdef\ydoc@short@AlsoMacro{% - \catcode`\|\active - \let|\AlsoMacro -} -\endgroup +\define@Macro@handler\AlsoMacro{} +\define@Macro@handler\DescribeMacro{} % \end{macrocode} -% \end{macro} % % \begin{macro}{\MacroArgs} % Uses the normal macro argument reading mechanism from \cs{DescribeMacro}. @@ -1576,6 +1990,10 @@ \def\end@Macro@args{\endgroup\xspace}% \ydoc@macrocatcodes \macroargsstyle +%<*DEBUG> + \typeout{}% + \typeout{DEBUG: Start MacroArgs}% +%</DEBUG> \read@Macro@arg } \RequirePackage{xspace} @@ -1785,7 +2203,7 @@ {\macrodescstyle{\strut \texttt{\char92}% \escapechar\m@ne - \string#1}}% + \string#1\strut}}% } % \end{macrocode} % \end{macro} @@ -1817,13 +2235,23 @@ % \begin{macrocode} \def\PrintMacros{% \par\vspace\beforedescskip - \noindent\hspace*{\descindent}% - \ifdim\wd\descbox>\linewidth - \makebox[\linewidth][c]{\fbox{\hspace*{\descsep}\usebox{\descbox}\hspace*{\descsep}}} + \begingroup + \sbox\@tempboxa{\descframe{\usebox{\descbox}}}% + \Needspace*{\dimexpr\ht\@tempboxa+2\baselineskip\relax}% + \par\noindent + \ifdim\wd\@tempboxa>\dimexpr\linewidth-2\descindent\relax + \makebox[\linewidth][c]{\usebox\@tempboxa}% \else - \fbox{\hspace*{\descsep}\usebox{\descbox}\hspace*{\descsep}}% + \hspace*{\descindent}% + \usebox\@tempboxa \fi - \par\vspace\afterdescskip + \endgroup + \par + \vspace\afterdescskip + \par\noindent +} +\def\descframe#1{% + \fbox{\hspace*{\descsep}#1\hspace*{\descsep}}% } % \end{macrocode} % \end{macro} @@ -1839,12 +2267,7 @@ % Prints \env{DescribeEnv} environments. % The actual content was stored inside \cs{descbox}. % \begin{macrocode} -\def\PrintEnv{% - \par\vspace\beforedescskip - \noindent\hspace*{\descindent}% - \fbox{\hspace*{\descsep}\usebox{\descbox}\hspace*{\descsep}}% - \par\vspace\afterdescskip -} +\let\PrintEnv\PrintMacros % \end{macrocode} % \end{macro} % @@ -1913,6 +2336,49 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\codeline} +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{codequote} +% \begin{macrocode} +\newenvironment{codequote}{% + \def\\{\newline\relax\MacroArgs}% + \par\smallskip\bgroup\leftskip=\leftmargin\rightskip=\rightmargin\noindent\MacroArgs} + {\par\egroup\smallskip\noindent\ignorespacesafterend} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{macroquote} +% \begin{macrocode} +\newenvironment{macroquote}{% + \def\\{\newline\relax\Macro}% + \par\smallskip\bgroup\leftskip=\leftmargin\rightskip=\rightmargin\noindent\Macro} + {\par\egroup\smallskip\noindent\ignorespacesafterend} +% \end{macrocode} +% \end{environment} +% % \iffalse %</desc> % \fi @@ -1922,6 +2388,18 @@ % \fi % \subsection{Include Code Examples} % +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\RequirePackage{svn-prov}[2010/04/03] +\ProvidesPackageSVN[ydoc] + {$Id: ydoc_expl_sty.dtx 2332 2011-03-17 17:12:35Z martin $} +%<!VERSION> +%<*DRIVER> + [develop] +%</DRIVER> + [ydoc package to insert live examples of LaTeX code] +% \end{macrocode} +% % \iffalse %<*dontinclude> % \begin{macrocode} @@ -2083,4 +2561,4 @@ %</expl> % \fi % \Finale -\endinput +% \endinput diff --git a/Master/texmf-dist/source/latex/ydoc/ydoc.ins b/Master/texmf-dist/source/latex/ydoc/ydoc.ins deleted file mode 100644 index eead38f53ef..00000000000 --- a/Master/texmf-dist/source/latex/ydoc/ydoc.ins +++ /dev/null @@ -1,26 +0,0 @@ -% ydoc.ins -% Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de> -% WWW: http://latex.scharrer-online.de/ - -% See file 'ydoc.dtx' for copyright and licence information. -% $Id: ydoc.ins 1846 2010-04-10 10:41:21Z martin $ - -\input docstrip - -\keepsilent -\askforoverwritefalse - -\preamble -\endpreamble - -\generate{% - \file{ydoc.cls}{\from{ydoc.dtx}{class}}% - \file{ydoc.sty}{\from{ydoc.dtx}{package}}% - \file{ydoc-code.sty}{\from{ydoc.dtx}{code}}% - \file{ydoc-desc.sty}{\from{ydoc.dtx}{desc}}% - \file{ydoc-expl.sty}{\from{ydoc.dtx}{expl}}% - \file{ydoc-doc.sty}{\from{ydoc.dtx}{doc}}% -} - -\endbatchfile -% vim: ft=tex diff --git a/Master/texmf-dist/source/latex/ydoc/ydocstrip.tex b/Master/texmf-dist/source/latex/ydoc/ydocstrip.tex new file mode 100644 index 00000000000..25ec2c5e63f --- /dev/null +++ b/Master/texmf-dist/source/latex/ydoc/ydocstrip.tex @@ -0,0 +1,70 @@ +%&pdflatex +\input docstrip + +\def\checkOption<#1{% + \ifcase + \ifx*#10\else \ifx/#11\else + \ifx+#12\else \ifx-#13\else + \ifx<#14\else + \ifx=#15\else + \ifx!#16\else + 10\fi\fi\fi\fi\fi\fi\fi\relax + \expandafter\starOption\or + \expandafter\slashOption\or + \expandafter\plusOption\or + \expandafter\minusOption\or + \expandafter\verbOption\or + \expandafter\varOption\or + \expandafter\valueOption\else + \expandafter\doOption\fi + #1} + +\def\varOption =#1#2>#3\endLine{{% + \ifx*#1\relax + \edef\varStop{\perCent<=/#2>}% + \global\expandafter\let\csname ydocstrip@var@#2\endcsname\empty% + \expandafter\def\csname ydocstrip@var@#2\endcsname##1{}% + \loop + \ifeof\inFile + \errmessage{Source file ended while reading a multi-line variable content!}% + \fi + \read\inFile to \inLine + \if 1\ifx\inLine\varStop 0\fi 1% if not inLine==varStop + \expandafter\xdef\csname ydocstrip@var@#2\endcsname{\csname ydocstrip@var@#2\endcsname^^J\inLine}% + \maybeMsg{.}% + \repeat + \else + \ifx/#1\relax + \errmessage{Error in expression: spurious '<=/#2>'}% + \else + \ifx+#1\relax + \expandafter\ifx\csname ydocstrip@var@#2\endcsname\relax + \expandafter\xdef\csname ydocstrip@var@#2\endcsname{#3}% + \else + \expandafter\xdef\csname ydocstrip@var@#2\endcsname{\csname ydocstrip@var@#2\endcsname^^J#3}% + \fi + \else + \expandafter\gdef\csname ydocstrip@var@#1#2\endcsname{#3}% + \fi + \fi + \fi +}} + + +\def\valueOption !#1>#2\endLine{% + \begingroup + \expandafter\let\expandafter\var\csname ydocstrip@var@#1\endcsname + \ifx\var\relax + \errmessage{Used variable '#1' was never defined!}% + \else + \ifx\var\empty\else + \def\do##1##2##3{% + \StreamPut##1{\csname ydocstrip@var@#1\endcsname}% + }% + \activefiles + \fi + \fi + \endgroup +} + + |