From ac225c92964fc1f94322e26a4edc729528882bcb Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 22 Nov 2012 00:51:04 +0000 Subject: dowit (21nov12) git-svn-id: svn://tug.org/texlive/trunk@28325 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/generic/dowith/domore.sty | 136 ++++++++++++++++++++++++ Master/texmf-dist/tex/generic/dowith/dowith.RLS | 21 ++-- Master/texmf-dist/tex/generic/dowith/dowith.sty | 63 +++++------ 3 files changed, 177 insertions(+), 43 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/dowith/domore.sty (limited to 'Master/texmf-dist/tex') 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{}| +%% for defining a one-parameter macro `\do' expanding to . +%% The present package allows applying a -parameter macro +%% (maybe `\do', being 2, 3, or ...) +%% to a list of "brace groups" where each brace group +%% contains arguments. If \LaTeX\ is present ... +\ifltx +%% ... the following extension +%% \[|\setdo[]{}]|\] +%% of the basic 'dowith' version +%% can be used to define a -parameter macro `\do'. +%% You also can equip `\do' with an initial optional argument by +%% \[|\setdo[][]{}]|\] +%% 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{}{}| \ +%% is a variant of \LaTeX's `\@firstofone{}' for +%% \emph{two} arguments. It just removes outer braces +%% from each of the two arguments (provided it has outer braces), +%% resulting in \[\] +\long\def\@firstsecondoftwo#1#2{#1#2} +%% % |\@secondfirstoftwo| results in +%% % where is ... +%% % [TODO declare "meta-function removing braces"---in 'dowith' documentation] +%% % (, must not contain `\par' tokens so far---TODO): +%% |\@secondfirstoftwo{}{}| +%% \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{}\fi'\] +%% will expand to +%% \[`\fi'\] +%% 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" +%% on an arglist by +%% \[`\DoWith{}\StopDoing'\] +%% (cf. `dowith.pdf'), the present `\DoWith' can have a +%% more complex first argument. If consists +%% of some brace groups the first of which is {} +%% so that is +%% \[`{}'\] +%% --- being the remaining arglist--- +%% \[|\DoWith{}\StopDoing|\] +%% works like +%% \[`{}\DoWith{}\StopDoing'\] +%% and so on---a recursive explanation. Or if is +%% \[`{}{}'\dots`{}'\] +%% ($n$ items), the result is like +%% \[`{}{}'\dots`{}'\] +%% 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{}\StopDoing| with as above +%% "unpacks" each arglist item so that may be a macro +%% with more than one argument---say, arguments. +%% Then or , as well as $\dots$ , +%% should provide an arglist consisting of items. +\def\DoWithMore#1{\DoWith{\@firstsecondoftwo{#1}}} +%% Now I use metavariable instead of . +%% We consider some "separator" material to be inserted +%% between instances of applying to an item of . +%% We want to get +%% \[`{}{}'\dots`{}'\] +%% This is achieved simply by starting with +%% \[`{}'\] +%% and then proceeding as with +%% \[`\DoWith{}\StopDoing'\] +%% And that's what |\DoSeparateWith{}{}\StopDoing| does: +\def\DoSeparateWith#1#2#3{#1{#3}\DoWith{#2#1}} +%% |\DoSeparateWithMore{}{}\StopDoing| combines +%% the two previous things, inserting separator material +%% and unpacking the nested arg\-lists: +\def\DoSeparateWithMore#1#2{% %% wieder 2012/06/05 + \DoSeparateWith{\@firstsecondoftwo{#1}}{#2}} +%% My main application is that is a link macro with arguments +%% and and that is \qtdcode{~\string|~} +%% (or some tie variant) to get a horizontal list of links like +%% \[\def|{$\vert$}\mbox{ | | \dots | }\] +%% +%% == 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 (, 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 `{}'. \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 seems to have been used earlier %% while the second complains when 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{}{}| %% appends to the replacement token list of . @@ -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 -- cgit v1.2.3