summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/ydoc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-01-11 00:40:15 +0000
committerKarl Berry <karl@freefriends.org>2011-01-11 00:40:15 +0000
commita91307c2f17b5b11a02a758bae9548f24ea3e844 (patch)
tree124f70c8668c3f03d0d467b1e87fe7c8bfaec399 /Master/texmf-dist/source/latex/ydoc
parent69b48db5779580145aee8c957250d4556a2c5d91 (diff)
ydoc (10jan11)
git-svn-id: svn://tug.org/texlive/trunk@21019 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/ydoc')
-rw-r--r--Master/texmf-dist/source/latex/ydoc/ydoc.dtx182
1 files changed, 128 insertions, 54 deletions
diff --git a/Master/texmf-dist/source/latex/ydoc/ydoc.dtx b/Master/texmf-dist/source/latex/ydoc/ydoc.dtx
index 7855ff07a42..be3645188bb 100644
--- a/Master/texmf-dist/source/latex/ydoc/ydoc.dtx
+++ b/Master/texmf-dist/source/latex/ydoc/ydoc.dtx
@@ -35,8 +35,8 @@
%<expl> [ydoc-expl]
%<doc> [ydoc-doc]
%<*driver|class|package|code|desc|expl|doc>
- {$Id: ydoc.dtx 2004 2011-01-03 22:51:32Z martin $}
- [v0.3alpha]
+ {$Id: ydoc.dtx 2035 2011-01-09 17:22:24Z 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]
@@ -74,7 +74,7 @@
%</driver>
% \fi
%
-% \CheckSum{1238}
+% \CheckSum{1459}
%
% \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
@@ -229,9 +229,13 @@
% follow. Macros which are not part of the syntax but normal arguments should be written as
% |<\textbackslash name>| (yielding \MacroArgs<\textbackslash name>) instead.
%
-% \subsubsection*{Example:}
+% \subsubsection*{Examples:}
% |\Macro\@for<\textbackslash var> ':=' <list> \AlsoMacro\do {<code>}|\\
-% \Macro\@for<\textbackslash var> ':=' <list> \AlsoMacro\do {<code>}\\
+% \Macro\@for<\textbackslash var> ':=' <list> \AlsoMacro\do {<code>}
+% \par\medskip\noindent
+% |\Macro\pgfkeys{<key1>'='<value1>','<key2>'/.code='{<code>}}|\\
+% \Macro\pgfkeys{<key1>'='<value1>','<key2>'/.code='{<code>}}\\
+%
%
% \begin{DescribeEnv}{DescribeMacros}
% \Macro\Macro<\textbackslash name><arguments>\\
@@ -273,15 +277,15 @@
% \toprule
% Description & Syntax & Result & Macro$^{a}$ \\
% \midrule
-% Meta text & |<text>| & \MacroArgs<text> & |\meta| \\
-% Mandatory Argument & |{<text>}| & \MacroArgs{<text>} & |\marg| \\
-% ---, without meta text & |{text}| & \MacroArgs{text} & \\
-% Optional Argument & |[<text>]| & \MacroArgs[<text>] & |\oarg| \\
-% ---, without meta text & |[text]| & \MacroArgs[text] & \\
-% Picture Argument & |(<text>)| & \MacroArgs(<text>) & |\parg| \\
-% ---, without meta text & |(text)| & \MacroArgs(text) & \\
-% Beamer Overlay Argument & |<<text>>| & \MacroArgs<<text>> & |\aarg| \\
-% ---, without meta text & |'<'text'>'| & \MacroArgs'<'text'>' \\
+% Meta text & |<text>| & \MacroArgs<text> & \Macro\meta{<text>} \\
+% Mandatory Argument & |{args}| & \MacroArgs{args} & \\
+% ---, with meta text & |{<text>}| & \MacroArgs{<text>} & \Macro\marg{<text>} \\
+% Optional Argument & |[args]| & \MacroArgs[args] & \\
+% ---, with meta text & |[<text>]| & \MacroArgs[<text>] & \Macro\oarg{<text>} \\
+% Picture Argument & |(args)| & \MacroArgs(args) & \\
+% ---, with meta text & |(<text>)| & \MacroArgs(<text>) & \Macro\parg{<text>} \\
+% Beamer Overlay Argument & |<<args>>| & \MacroArgs<<args>> \\
+% ---, with meta text & |<< <text> >>| & \MacroArgs<<<text> >> & \Macro\aarg{<text>} \\
% Star & |*| & \MacroArgs* \\
% \midrule
% Verbatim content & |'$&^%_#$\'| & \MacroArgs'$&^%_#$\' \\
@@ -292,7 +296,8 @@
% \midrule
% Second macro (e.g.\ endmarker) & |\AlsoMacro\macro| & \MacroArgs\AlsoMacro\macro \\
% \bottomrule
-% \multicolumn{4}{l}{{\Large\strut}$^{a}$) As alternative to be used inside normal text.}
+% \multicolumn{4}{l}{{\Large\strut}$^{a}$) As alternative to be used inside normal text.} \\
+% \multicolumn{4}{l}{Note that `|args|' can itself be further macro arguments except true verbatim.}
% \end{tabular}
% \end{table}
%
@@ -729,7 +734,7 @@
\def\CheckSum#1{%
\gdef\ydoc@checksum{#1}%
}
-\let\ydoc@checksum\z@
+\let\ydoc@checksum\m@ne
% \end{macrocode}
% \end{macro}
%
@@ -777,9 +782,51 @@
%
% \begin{macro}{\CharacterTable}
% \begin{macrocode}
-\providecommand*\CharacterTable[1]{%
- \PackageWarning{ydoc}{Ignoring Character Table - not implemented yet!}{}{}%
+\providecommand*\CharacterTable{%
+ \begingroup
+ \CharTableChanges
+ \@CharacterTable
+}
+\def\@CharacterTable#1{%
+ \def\ydoc@used@CharacterTable{#1}%
+ \@onelevel@sanitize\ydoc@used@CharacterTable
+ \ifx\ydoc@used@CharacterTable\ydoc@correct@CharacterTable
+ \typeout{***************************}%
+ \typeout{* Character table correct *}%
+ \typeout{***************************}%
+ \else
+ \PackageError{ydoc}{Character table corrupted}
+ {\the\wrong@table}
+ \show\ydoc@used@CharacterTable
+ \show\ydoc@correct@CharacterTable
+ \fi
+ \endgroup
}
+\newhelp\wrong@table{Some of the ASCII characters are corrupted.^^J
+ I now \string\show\space you both tables for comparison.}
+\newcommand*\CharTableChanges{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ydoc@correct@CharacterTable}
+% \begin{macrocode}
+\def\ydoc@correct@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
+ Lower-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
+ Digits \0\1\2\3\4\5\6\7\8\9
+ Exclamation \! Double quote \" Hash (number) \#
+ Dollar \$ Percent \% Ampersand \&
+ Acute accent \' Left paren \( Right paren \)
+ Asterisk \* Plus \+ Comma \,
+ Minus \- Point \. Solidus \/
+ Colon \: Semicolon \; Less than \<
+ Equals \= Greater than \> Question mark \?
+ Commercial at \@ Left bracket \[ Backslash \\
+ Right bracket \] Circumflex \^ Underscore \_
+ Grave accent \` Left brace \{ Vertical bar \|
+ Right brace \} Tilde \~}
+\@onelevel@sanitize\ydoc@correct@CharacterTable
+%
% \end{macrocode}
% \end{macro}
%
@@ -860,8 +907,16 @@
\ifnum\ydoc@checksum=\m@ne
\message{^^J}%
\message{**********************^^J}%
- \message{* No Checksum found! *^^J}%
+ \message{* No checksum found! *^^J}%
\message{**********************^^J}%
+ \GenericWarning{No checksum found}{Correct checksum is \the\ydoc@bslashcnt^^J}{}{}%
+ \else
+ \ifnum\ydoc@checksum=\z@
+ \message{^^J}%
+ \message{*********************^^J}%
+ \message{* Checksum disabled *^^J}%
+ \message{*********************^^J}%
+ \GenericWarning{Checksum disabled}{Correct checksum is \the\ydoc@bslashcnt^^J}{}{}%
\else
\ifnum\ydoc@checksum=\ydoc@bslashcnt
\message{^^J}%
@@ -873,7 +928,8 @@
\message{****************************^^J}%
\message{* Checksum wrong (\ydoc@checksum<>\the\ydoc@bslashcnt) ^^J}%
\message{****************************^^J}%
- \GenericError{Checksum wrong}{}{}{}%
+ \GenericError{Checksum wrong}{Correct checksum is \the\ydoc@bslashcnt^^J}{}{}%
+ \fi
\fi
\fi
}
@@ -925,28 +981,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@meta}
-% Checks if |#1| is surrounded by angles |< >|.
-% If so it calls \cs{is@meta} which removes the angles and calls \cs{meta}.
-% \begin{macrocode}
-\def\@meta#1{%
- \@ifnextchar<%
- {\is@meta}%
- {}%
- #1%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\is@meta}
-% Only removes the |< >| ands calls \cs{meta}.
-% \begin{macrocode}
-\def\is@meta<#1>{%
- \meta{#1}%
-}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\marg}
% Calls \cs{marg} with angles added to force meta format.
% \begin{macrocode}
@@ -976,12 +1010,13 @@
% \end{macro}
%
% \begin{macro}{\@marg}
-% Sets style and adds braces. Text is formatted with \cs{@meta} which might add meta format.
+% Sets style and adds braces.
+% The text is formatted as separate set of macro arguments.
% \begin{macrocode}
\def\@marg#1{%
{\margstyle{%
{\ttfamily\braceleft}%
- \@meta{#1}%
+ {\def\end@Macro@args{}\read@Macro@arg#1}%
{\ttfamily\braceright}%
}}%
}
@@ -989,12 +1024,13 @@
% \end{macro}
%
% \begin{macro}{\@oarg}
-% Sets style and adds brackets. Text is formatted with \cs{@meta} which might add meta format.
+% Sets style and adds brackets.
+% The text is formatted as separate set of macro arguments.
% \begin{macrocode}
\def\@oarg#1{%
{\oargstyle{%
{\ttfamily[}%
- \@meta{#1}%
+ {\def\end@Macro@args{}\read@Macro@arg#1}%
{\ttfamily]}%
}}%
}
@@ -1002,12 +1038,12 @@
% \end{macro}
%
% \begin{macro}{\@parg}
-% Sets style and adds parentheses. Text is formatted with \cs{@meta} which might add meta format.
+% Sets style and adds parentheses.
% \begin{macrocode}
\def\@parg#1{%
{\pargstyle{%
{\ttfamily(}%
- \@meta{#1}%
+ {\def\end@Macro@args{}\read@Macro@arg#1}%
{\ttfamily)}%
}}%
}
@@ -1015,12 +1051,12 @@
% \end{macro}
%
% \begin{macro}{\@aarg}
-% Sets style and adds angles. Text is formatted with \cs{@meta} which might add meta format.
+% Sets style and adds angles.
% \begin{macrocode}
\def\@aarg#1{%
{\aargstyle{%
{\ttfamily<}%
- \@meta{#1}%
+ {\def\end@Macro@args{}\read@Macro@arg#1}%
{\ttfamily>}%
}}%
}
@@ -1264,7 +1300,7 @@
% \begin{macro}{\read@Macro@aarg}
% \begin{macrocode}
\def\read@Macro@aarg<#1>>{%
- \aarg{#1}\read@Macro@arg
+ \@aarg{#1}\read@Macro@arg
}
% \end{macrocode}
% \end{macro}
@@ -1443,6 +1479,7 @@
\newcommand*\MacroArgs{%
\begingroup
\def\end@Macro@args{\endgroup\xspace}%
+ \macroargsstyle
\read@Macro@arg
}
\RequirePackage{xspace}
@@ -1826,7 +1863,7 @@
%
% \begin{macro}{\exampleprintsettings}
% \begin{macrocode}
-\def\exampleprintsettings{frame=lines}%
+\def\exampleprintsettings{numbers=left,numberstyle=\tiny\color{gray}\sffamily,numbersep=5pt}%
% \end{macrocode}
% \end{macro}
%
@@ -1843,16 +1880,17 @@
\expandafter\expandafter\expandafter[%
\expandafter\exampleprintsettings\expandafter,\thisexampleprintsettings]%
{\ydoc@exafile}%
- \color@endgroup}%
+ \unskip\color@endgroup}%
\setbox\exampleresultbox\hbox{\color@setgroup
\@@input\ydoc@exafile\relax
- \color@endgroup}%
+ \unskip\color@endgroup}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PrintExample}
% \begin{macrocode}
+%<*DISABLED>
\RequirePackage{showexpl}
\def\PrintExample{%
\begingroup
@@ -1861,6 +1899,38 @@
\LTXinputExample[varwidth]{\ydoc@exafile}%
\endgroup
}
+%</DISABLED>
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\PrintExample}
+% \begin{macrocode}
+\def\PrintExample{%
+ \begingroup
+ \BoxExample
+ \@tempdima=\textwidth
+ \advance\@tempdima by -\wd\examplecodebox\relax
+ \advance\@tempdima by -\wd\exampleresultbox\relax
+ \advance\@tempdima by -15pt\relax
+ \ifdim\@tempdima>\bigskipamount
+ \hbox to \textwidth{%
+ \null\hss
+ \minipage[c]{\wd\exampleresultbox}\fbox{\usebox\exampleresultbox}\endminipage
+ \hfill\hfill\hskip\bigskipamount\hskip15pt\hfill\hfill
+ \minipage[c]{\wd\examplecodebox}\usebox\examplecodebox\endminipage
+ \hss\null
+ }%
+ \else
+ \vbox{%
+ \centerline{\fbox{\usebox\exampleresultbox}}%
+ \vspace{\bigskipamount}%
+ \centerline{\usebox\examplecodebox}%
+ }%
+ \fi
+ \endgroup
+}
% \end{macrocode}
% \end{macro}
%
@@ -1880,7 +1950,11 @@
{%
\lst@EndWriteFile
\egroup
+ \begingroup
+ \MakePercentComment
+ \catcode`\^^M=5\relax
\PrintExample
+ \endgroup
}
% \end{macrocode}
% \end{environment}