diff options
author | Karl Berry <karl@freefriends.org> | 2012-11-22 00:51:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-11-22 00:51:04 +0000 |
commit | ac225c92964fc1f94322e26a4edc729528882bcb (patch) | |
tree | a8da670546bd0acf1141edc0bd0e6b620ce4334a /Master/texmf-dist/tex | |
parent | 31cb4a9239c6be1c8e24250668182e12a7bc8b74 (diff) |
dowit (21nov12)
git-svn-id: svn://tug.org/texlive/trunk@28325 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/dowith/domore.sty | 136 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/dowith/dowith.RLS | 21 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/dowith/dowith.sty | 63 |
3 files changed, 177 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/generic/dowith/domore.sty b/Master/texmf-dist/tex/generic/dowith/domore.sty new file mode 100644 index 00000000000..4650db60e61 --- /dev/null +++ b/Master/texmf-dist/tex/generic/dowith/domore.sty @@ -0,0 +1,136 @@ + \input plainpkg +\ProvidesPackage{domore}[2012/11/19 v0.3 dowith extended (UL)] +%% Copyright (C) 2012 Uwe Lueck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% == With \LaTeX, extend 'dowith''s \cs{setdo} == +%% %% mod. 2012/11/06: +%% The original 'dowith' offers |\setdo{<do>}| +%% for defining a one-parameter macro `\do' expanding to <do>. +%% The present package allows applying a <digit>-parameter macro +%% (maybe `\do', <digit> being 2, 3, or ...) +%% to a list of "brace groups" where each brace group +%% contains <digit> arguments. If \LaTeX\ is present ... +\ifltx +%% ... the following extension +%% \[|\setdo[<digit>]{<do>}]|\] +%% of the basic 'dowith' version +%% can be used to define a <digit>-parameter macro `\do'. +%% You also can equip `\do' with an initial optional argument by +%% \[|\setdo[<digit>][<default>]{<do>}]|\] +%% The next two moves allow loading the package +%% independently of 'dowith' (overriding its definition of `\setdo') +%% as well as using the package +%% with a format that has not defined `\do' before. +%% The first parameter of `\do' may even be \emph{optional.} + \let\setdo\relax \let\do\empty + \newcommand*{\setdo}[1][1]{\renewcommand\do[#1]} +\fi +%% +%% == Auxiliaries == +%% |\@firstsecondoftwo{<balanced-1>}{<balanced-2>}| \ +%% is a variant of \LaTeX's `\@firstofone{<balanced>}' for +%% \emph{two} arguments. It just removes outer braces +%% from each of the two arguments (provided it has outer braces), +%% resulting in \[<balanced-1><balanced-2>\] +\long\def\@firstsecondoftwo#1#2{#1#2} +%% % |\@secondfirstoftwo<arg-1><arg-2>| results in <ark-2><ark-1> +%% % where <ark-1> is ... +%% % [TODO declare "meta-function removing braces"---in 'dowith' documentation] +%% % (<arg-1>, <arg-2> must not contain `\par' tokens so far---TODO): +%% |\@secondfirstoftwo{<balanced-1>}{<balanced-2>}| +%% \emph{additionally} interchanges the two arguments +%% (after removing braces): +\long\def\@secondfirstoftwo#1#2{#2#1} +%% Our main application is using it as an extended `\expandafter' +%% before `\fi': +%% \[`\@secondfirstoftwo{<do>}\fi'\] +%% will expand to +%% \[`\fi<do>'\] +%% This won't work with `\else' in place of `\fi'. +%% +%% == Enhanced \cs{DoWith} == +%% Here comes a more powerful variant of 'dowith''s `\DoWith'. +%% Instead of iterating a single "command" <cmd> +%% on an arglist <args> by +%% \[`\DoWith{<cmd>}<args>\StopDoing'\] +%% (cf. `dowith.pdf'), the present `\DoWith' can have a +%% more complex first argument. If <args> consists +%% of some brace groups the first of which is {<farg>} +%% so that <args> is +%% \[`{<farg>}<rgs>'\] +%% ---<rgs> being the remaining arglist--- +%% \[|\DoWith{<repeat>}<args>\StopDoing|\] +%% works like +%% \[`<repeat>{<farg>}\DoWith{<repeat>}<rgs>\StopDoing'\] +%% and so on---a recursive explanation. Or if <args> is +%% \[`{<arg-1>}{<arg-2>}'\dots`{<arg-n>}'\] +%% ($n$ items), the result is like +%% \[`<repeat>{<arg-1>}<repeat>{<arg-2>}'\dots`<repeat>{<arg-n>}'\] +%% The actual definition is: +\def\DoWith#1#2{% + \ifx\StopDoing#2\empty %% not \@empty for Plain 2012/11/05 + \else\@secondfirstoftwo{#1{#2}\DoWith{#1}}\fi} +%% In order to \strong{use} the remaining definitions from \strong{'dowith' +%% together with the present package}, %% \strong 2012/11/06 +%% load `dowith.sty' before `domore.sty'. +%% +%% == Applications of \cs{DoWith} == +%% `\DoWith' still is somewhat auxiliary. What I have used in practice, +%% are the following definitions. +%% +%% |\DoMore{<repeat>}<args>\StopDoing| with <args> as above +%% "unpacks" each arglist item so that <repeat> may be a macro +%% with more than one argument---say, <digit> arguments. +%% Then <f-arg> or <arg-1>, as well as <arg-2> $\dots$ <arg-n>, +%% should provide an arglist consisting of <digit> items. +\def\DoWithMore#1{\DoWith{\@firstsecondoftwo{#1}}} +%% Now I use metavariable <do> instead of <repeat>. +%% We consider some "separator" material <sep> to be inserted +%% between instances of applying <do> to an item of <args>. +%% We want to get +%% \[`<do>{<arg-1>}<sep><do>{<arg-2>}<sep>'\dots`<sep><do>{<arg-n>}'\] +%% This is achieved simply by starting with +%% \[`<do>{<farg>}'\] +%% and then proceeding as with +%% \[`\DoWith{<sep><do>}<rgs>\StopDoing'\] +%% And that's what |\DoSeparateWith{<do>}{<sep>}<args>\StopDoing| does: +\def\DoSeparateWith#1#2#3{#1{#3}\DoWith{#2#1}} +%% |\DoSeparateWithMore{<do>}{<sep>}<args>\StopDoing| combines +%% the two previous things, inserting separator material <sep> +%% and unpacking the nested arg\-lists: +\def\DoSeparateWithMore#1#2{% %% wieder 2012/06/05 + \DoSeparateWith{\@firstsecondoftwo{#1}}{#2}} +%% My main application is that <do> is a link macro with arguments +%% <target> and <text> and that <sep> is \qtdcode{~\string|~} +%% (or some tie variant) to get a horizontal list of links like +%% \[\def|{$\vert$}\mbox{<text-1> | <text-2> | \dots | <text-n>}\] +%% +%% == Leaving and History == +\PopLetterCatAt +\endinput + +VERSION HISTORY +v0.1 2012/01/17 developed in `texblog.fdf' + (using \[re]newcommand*) +v0.2 2012/08/07 own file `domore.sty', \def's only + 2012/08/08 dealing with "more" \setdo +v0.3 2012/11/05 using `plainpkg'; removing old % code + (see stored v0.2); auxiliaries \long + 2012/11/06 doc.: more on \setdo (<digit>, opt. arg.), + usage with `dowith' \strong + 2012/11/18 doc.: adjusted for `catchdq'; reworking for + \DoWith; \DoWithMore, \DoSeparateWith + 2012/11/19 doc.: \DoSeparateWithMore diff --git a/Master/texmf-dist/tex/generic/dowith/dowith.RLS b/Master/texmf-dist/tex/generic/dowith/dowith.RLS index e96cee91760..24eeaed1f20 100644 --- a/Master/texmf-dist/tex/generic/dowith/dowith.RLS +++ b/Master/texmf-dist/tex/generic/dowith/dowith.RLS @@ -1,11 +1,14 @@ -\ProvidesFile{dowith.RLS} %% RELEASE INFO - [2012/06/03 r0.22 v0.22 arg. {}; doc.: catoptions] -% [2012/06/03 r0.21f v0.21a; doc.: catoptions] -% [2012/05/22 r0.21e v0.21a; doc.: Kabelschacht vs. TeXbook] -% [2012/05/20 r0.21d v0.21a discussing other cmds ] -% [2012/05/18 v0.21 r0.21c @ fix, new doc., .RLS] -% [2012/05/14 r0.21 @ fix, .RLS, README/title typo...] +\ProvidesFile{dowith.RLS} %% >RELEASE INFO< + [2012/11/20 r0.3a doc. mouth -> gullet, `domore.sty'; + TDS corr.] + [2012/11/19 r0.3 doc. mouth -> gullet, `domore.sty'] + [2012/06/03 r0.22 v0.22 arg. {}; doc.: catoptions] + [2012/06/03 r0.21f v0.21a; doc.: catoptions] + [2012/05/22 r0.21e v0.21a; doc.: Kabelschacht vs. TeXbook] + [2012/05/20 r0.21d v0.21a discussing other cmds ] + [2012/05/18 v0.21 r0.21c @ fix, new doc., .RLS] + [2012/05/14 r0.21 @ fix, .RLS, README/title typo...] %% <- FAILED -% [2012/05/10 r0.2a corr. generic dir.] -% [2012/05/10 r0.2 first on CTAN] + [2012/05/10 r0.2a corr. generic dir.] + [2012/05/10 r0.2 first on CTAN] diff --git a/Master/texmf-dist/tex/generic/dowith/dowith.sty b/Master/texmf-dist/tex/generic/dowith/dowith.sty index 6f75654b984..a4625aade39 100644 --- a/Master/texmf-dist/tex/generic/dowith/dowith.sty +++ b/Master/texmf-dist/tex/generic/dowith/dowith.sty @@ -1,6 +1,7 @@ \def\filename{dowith} \def\fileinfo{simple list loop (UL)} -\def\filedate{2012/06/04} \def\fileversion{v0.22} -%% Copyright (C) 2011 Uwe Lueck, +\def\filedate{2012/11/05} \def\fileversion{v0.3} +%% +%% Copyright (C) 2011 2012 Uwe Lueck, %% http://www.contact-ednotes.sty.de.vu %% -- author-maintained in the sense of LPPL below -- %% @@ -15,39 +16,30 @@ %% %% http://www.contact-ednotes.sty.de.vu %% -%% % \pagebreak %% 2012/05/19 %% == Proceeding without \LaTeX == -%% A little \LaTeX\ as in Bernd Raichle's %% 2011/11/19 -%% \CtanPkgRef{ngerman}{ngerman.sty}: -%% %% moved 2 lines here 2012/05/14 v0.21: -\chardef\atcode=\catcode`\@ -\catcode`\@=11 % \makeatletter -\begingroup\expandafter\expandafter\expandafter\endgroup -%% I need `\ProvidesPackage' for \ctanpkgref{fileinfo}, -%% my package version tools. -\expandafter\ifx\csname ProvidesPackage\endcsname\relax -%% %% 2011/11/07: -%% When `\ProvidesPackage' is not defined, we provide -%% a version of \LaTeX's `\in@' -%% (an old version that may wrongly -%% claim to have found an occurrence of a sequence, -%% but is correct for single tokens) -%% for checking token list macros. -%% \LaTeX\ must not see `\ifin@' when it parses the -%% `\ifx' conditional: +%% v0.3 mainly replaces imitating the +%% \CtanPkgRef{german}{german.sty} approach to genericity +%% by \ctanpkgref{plainpkg}: +\input plainpkg +\ProvidesPackage{\filename}[\filedate\space + \fileversion\space \fileinfo] +\PushCatMakeLetterAt +%% If \LaTeX\ is not present ... +\ifltx \else +%% ... an old version of its `\in@' is introduced. +%% It is bad as a subword test +%% (false positive cases, cf. \CtanPkgRef{nicetext}{fifinddo} +%% documentation), but 'dowith' will check for single tokens only. +%% If \LaTeX\ \emph{is} present, +%% on the other hand, `\ifin@' is recognized while skipping +%% `false' parts of conditionals, without being matched +%% by some `\fi' before the next `\else', so I hide it by `\csname': \expandafter\newif\csname ifin@\endcsname \def\in@#1#2{% \def\in@@##1#1##2##3\in@@{% \ifx\in@##2\in@false\else\in@true\fi}% \in@@#2#1\in@\in@@} -%% 'readprov' stops reading the file at `\Provides'\texttt{...}, -%% therefore ... - \long\def\@gobble#1{} \expandafter\@gobble -\else - \expandafter\@firstofone \fi -{ \ProvidesPackage{\filename}[\filedate\space - \fileversion\space \fileinfo] } %% %% == Applying a Command == %% 2011/11/07 %% \label{sec:apply} @@ -58,7 +50,8 @@ %% may be either a single token or a group `{<balanced>}'. \def\DoWith#1#2{% \ifx\StopDoing#2\empty -%% The previous `\empty' (replacing `%') is a bug fix as of v0.22, +%% The previous `\empty' (replacing `%') is a bug fix as of v0.22 +%% (June 2012), %% 2012/11/05 %% while in my extension draft I already had it in January 2012. %% It allows ``empty" arglist items \qtd{\lbtok\rbtok}. %% Before v0.22, such an empty brace group would have resulted @@ -134,16 +127,16 @@ %% complains when <list-macro> seems to have been used earlier %% while the second complains when <list-macro> seems \emph{not} to %% have been used before: -\expandafter\ifx\csname @latex@error\endcsname\relax - \def\InitializeListMacro#1{\let#1\empty} %% not \@empty 2011/11/07 - \let\ReInitializeListMacro\InitializeListMacro -\else +\ifltx %% v0.3 \def\InitializeListMacro#1{\@ifdefinable#1{\let#1\empty}} \def\ReInitializeListMacro#1{% \edef\@tempa{\expandafter\@gobble\string#1}% \expandafter\@ifundefined\expandafter{\@tempa}% {\@latex@error{\noexpand#1undefined}\@ehc}% {\let#1\empty}} +\else + \def\InitializeListMacro#1{\let#1\empty} %% not \@empty 2011/11/07 + \let\ReInitializeListMacro\InitializeListMacro \fi %% |\ToListMacroAdd{<list-macro>}{<cmd-or>}| %% appends <cmd-or> to the replacement token list of <list-macro>. @@ -193,7 +186,7 @@ %% %% %% == Leaving and History == -\catcode`\@=\atcode +\PopLetterCatAt %% v0.3 \endinput VERSION HISTORY @@ -207,3 +200,5 @@ v0.21 2012/05/14 fix for "generic" and `typeoutfileinfo': @ before ...! v0.21a 2012/05/19 \labels sec:apply, sec:core; \pagebreak? v0.22 2012/06/04 allow {} items +v0.3 2012/11/05 updating copyright, using `plainpkg', + rewording documentation there |