diff options
author | Karl Berry <karl@freefriends.org> | 2015-09-20 22:31:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-09-20 22:31:12 +0000 |
commit | 9280f63533af6460c33dbfcf486a5e5368afed53 (patch) | |
tree | 4d9646df783056a13bfdfe201d510c6fe07c5858 /Master | |
parent | bf941dd6fd9a67534bf00d114908c151b5fd1606 (diff) |
multiexpand (20sep15)
git-svn-id: svn://tug.org/texlive/trunk@38416 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/generic/multiexpand/README.md | 41 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/multiexpand/multiexpand.pdf (renamed from Master/texmf-dist/doc/latex/multiexpand/multiexpand.pdf) | bin | 375421 -> 376183 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/multiexpand/multiexpand001.lvt | 116 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/multiexpand/multiexpand001.tlg | 40 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/multiexpand/multiexpand002.lvt | 117 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/multiexpand/multiexpand002.tlg | 40 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/multiexpand/README | 31 | ||||
-rw-r--r-- | Master/texmf-dist/source/generic/multiexpand/multiexpand.dtx (renamed from Master/texmf-dist/source/latex/multiexpand/multiexpand.dtx) | 64 | ||||
-rw-r--r-- | Master/texmf-dist/source/generic/multiexpand/multiexpand.ins | 71 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/multiexpand/multiexpand.sty (renamed from Master/texmf-dist/tex/latex/multiexpand/multiexpand.sty) | 20 |
10 files changed, 472 insertions, 68 deletions
diff --git a/Master/texmf-dist/doc/generic/multiexpand/README.md b/Master/texmf-dist/doc/generic/multiexpand/README.md new file mode 100644 index 00000000000..decdfd06ff8 --- /dev/null +++ b/Master/texmf-dist/doc/generic/multiexpand/README.md @@ -0,0 +1,41 @@ +Variations on the `\expandafter` TeX primitive +============================================== +* E-mail: blflatex@gmail.com +* Released under the LaTeX Project Public License v1.3c or later + See http://www.latex-project.org/lppl.txt + +The package defines `\multiexpand`, `\multiexpandafter`, `\MultiExpand` +and `\MultiExpandAfter`, replacing large chains of `\expandafter`. +These four commands take as an argument the number of expansion to be +done. If eTeX is available, this number is evaluated using `\numexpr`. + +Say we want to expand `\C` five times before `\A` and `\B` in `\A\B\C`. +The traditional approach would be to insert 31 `\expandafter` before +`\A` and the same number before `\B`. With this package one can use +any of + + \expandafter\A\expandafter\B\romannumeral\multiexpand{5}\C + + \expandafter\A\romannumeral\multiexpandafter{5}\B\C + + \MultiExpandAfter{2}\A\MultiExpandAfter{5}\B\C + + \MultiExpandAfter{2}\A\MultiExpandAfter{2}\B\MultiExpand{5}\C + +In one step of expansion (triggered by the `\expandafter`'s), +`\romannumeral\multiexpand{5}` expands the following token 5 times, +whereas `\romannumeral\multiexpandafter{5}` expands the token after +that 5 times. The macros `\MultiExpandAfter` and `\MultiExpand` +take two steps of expansion, but do not require `\romannumeral`. +Another example is that in two steps of expansion, + + \MultiExpandAfter{2}\a\MultiExpandAfter{3}{% + \MultiExpandAfter{9}\b\MultiExpandAfter{10}\c\d} + +expands `\d` 10 times, then `\c` 7 times (9-2), then `\b` once (3-2). + +The package can be built from the file `multiexpand.dtx' by running + + pdflatex multiexpand.dtx + pdflatex multiexpand.dtx + diff --git a/Master/texmf-dist/doc/latex/multiexpand/multiexpand.pdf b/Master/texmf-dist/doc/generic/multiexpand/multiexpand.pdf Binary files differindex 9a87dcd6da0..5ae7d2171e2 100644 --- a/Master/texmf-dist/doc/latex/multiexpand/multiexpand.pdf +++ b/Master/texmf-dist/doc/generic/multiexpand/multiexpand.pdf diff --git a/Master/texmf-dist/doc/generic/multiexpand/multiexpand001.lvt b/Master/texmf-dist/doc/generic/multiexpand/multiexpand001.lvt new file mode 100644 index 00000000000..6e886043334 --- /dev/null +++ b/Master/texmf-dist/doc/generic/multiexpand/multiexpand001.lvt @@ -0,0 +1,116 @@ +%% +%% This is file `multiexpand001.lvt', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% multiexpand.dtx (with options: `lvt') +%% ---------------------------------------------------------------- +%% multiexpand --- trigger multiple expansions in one expansion step. +%% E-mail: blflatex@gmail.com +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------- +%% + \input regression-test.tex\relax + \START + \AUTHOR{Bruno Le Floch} + \input multiexpand.sty\relax + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Introduce commands that expand to each other, to count how many times + % things were expanded. + \OMIT + \def\i{} + \def\v{\i\i\i\i} + \def\x{\i\i\i\i\v} + \def\l{\i\i\i\i\v\x\x\x\x} + \def\c{\i\i\i\i\v\x\x\x\x\l} + \def\d{\i\i\i\i\v\x\x\x\x\l\c\c\c\c} + \def\m{\i\i\i\i\v\x\x\x\x\l\c\c\c\c\d} + \TIMO + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % We test |\MultiExpand|, which needs two expansions. In particular, we see + % that the implementation is reasonably quick, and we get the $2345$-th + % expansion of |\m\m\m\m|. + % 4000-2345 = 1655 = mdclv + \TEST{MultiExpand many times (vlcdm)}{% + \toks0\expandafter\expandafter\expandafter{\MultiExpand{2345}\m\m\m\m}% + \TYPE{\the\toks0.}% + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Test |\MultiExpandAfter|, two expansions to get the specified expansion. + % The results indirectly show that expansions happen in the expected order. + % 100 = c + % 100-(27-2) = 75 = lxxv + % 100-(14-2) = 88 = lxxxviii + % 100-38 = 62 = lxii + \TEST{MultiExpandAfter chain (c vxxl iiivxxxl iixl)}{% + \toks0\expandafter\expandafter\expandafter{% + \MultiExpandAfter{27}\c + \MultiExpandAfter{14}\c + \MultiExpandAfter{38}\c\c}% + \TYPE{\the\toks0.}% + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Test the order of expansion. The example was given in the original + % question that led to writing this package. For the record, this + % package (at some point) used 32 |\expandafter| to do the expansion + % in the right order, which was better than other approaches; however + % this counting ignores the large overheads due to other primitives. + \OMIT + \def\a#1.{#1} + \def\b#1:{#1.} + \def\c#1,{#1:} + \def\d{Hello world!,} + \TIMO + % + \TEST{MultiExpandAfter order}{% + \toks0\MultiExpandAfter{3}{% + \MultiExpandAfter{3}\a + \MultiExpandAfter{3}\b + \MultiExpandAfter{1}\c + \d}% + \TYPE{\the\toks0}% + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % The other example from the same question (expanding seven tokens once + % each in the reverse order) takes 74 \expandafter. + \OMIT + \def\b.{.b} \def\c.{.c} \def\d.{.d} + \def\e.{.e} \def\f.{.f} \def\g.{.g} + \TIMO + % + \TEST{MultiExpandAfter order (2)}{% + \toks0\MultiExpandAfter{2}{% + \MultiExpandAfter3\a \MultiExpandAfter3\b + \MultiExpandAfter3\c \MultiExpandAfter3\d + \MultiExpandAfter3\e \MultiExpandAfter1\f\g.}% + \TYPE{\the\toks0}% + } + + \END +%% +%% Copyright (C) 2011-2015 by Bruno Le Floch <blflatex@gmail.com> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License (LPPL), either +%% version 1.3c of this license or (at your option) any later +%% version. The latest version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Bruno Le Floch. +%% +%% This work consists of the file multiexpand.dtx +%% and the derived files multiexpand.ins, +%% multiexpand.pdf and +%% multiexpand.sty. +%% +%% +%% End of file `multiexpand001.lvt'. diff --git a/Master/texmf-dist/doc/generic/multiexpand/multiexpand001.tlg b/Master/texmf-dist/doc/generic/multiexpand/multiexpand001.tlg new file mode 100644 index 00000000000..d8059b4c79f --- /dev/null +++ b/Master/texmf-dist/doc/generic/multiexpand/multiexpand001.tlg @@ -0,0 +1,40 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +%% \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 \~} +%% +Author: Bruno Le Floch +(multiexpand.sty) +============================================================ +TEST 1: MultiExpand many times (vlcdm) +============================================================ +\v \l \c \d \m . +============================================================ +============================================================ +TEST 2: MultiExpandAfter chain (c vxxl iiivxxxl iixl) +============================================================ +\c \v \x \x \l \i \i \i \v \x \x \x \l \i \i \x \l . +============================================================ +============================================================ +TEST 3: MultiExpandAfter order +============================================================ +Hello world! +============================================================ +============================================================ +TEST 4: MultiExpandAfter order (2) +============================================================ +\a .bcdefg +============================================================ diff --git a/Master/texmf-dist/doc/generic/multiexpand/multiexpand002.lvt b/Master/texmf-dist/doc/generic/multiexpand/multiexpand002.lvt new file mode 100644 index 00000000000..8271c1347c2 --- /dev/null +++ b/Master/texmf-dist/doc/generic/multiexpand/multiexpand002.lvt @@ -0,0 +1,117 @@ +%% +%% This is file `multiexpand002.lvt', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% multiexpand.dtx (with options: `lvt,lvt002') +%% ---------------------------------------------------------------- +%% multiexpand --- trigger multiple expansions in one expansion step. +%% E-mail: blflatex@gmail.com +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------- +%% + \input regression-test.tex\relax + \START + \AUTHOR{Bruno Le Floch} + \let\numexpr\relax + \input multiexpand.sty\relax + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Introduce commands that expand to each other, to count how many times + % things were expanded. + \OMIT + \def\i{} + \def\v{\i\i\i\i} + \def\x{\i\i\i\i\v} + \def\l{\i\i\i\i\v\x\x\x\x} + \def\c{\i\i\i\i\v\x\x\x\x\l} + \def\d{\i\i\i\i\v\x\x\x\x\l\c\c\c\c} + \def\m{\i\i\i\i\v\x\x\x\x\l\c\c\c\c\d} + \TIMO + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % We test |\MultiExpand|, which needs two expansions. In particular, we see + % that the implementation is reasonably quick, and we get the $2345$-th + % expansion of |\m\m\m\m|. + % 4000-2345 = 1655 = mdclv + \TEST{MultiExpand many times (vlcdm)}{% + \toks0\expandafter\expandafter\expandafter{\MultiExpand{2345}\m\m\m\m}% + \TYPE{\the\toks0.}% + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Test |\MultiExpandAfter|, two expansions to get the specified expansion. + % The results indirectly show that expansions happen in the expected order. + % 100 = c + % 100-(27-2) = 75 = lxxv + % 100-(14-2) = 88 = lxxxviii + % 100-38 = 62 = lxii + \TEST{MultiExpandAfter chain (c vxxl iiivxxxl iixl)}{% + \toks0\expandafter\expandafter\expandafter{% + \MultiExpandAfter{27}\c + \MultiExpandAfter{14}\c + \MultiExpandAfter{38}\c\c}% + \TYPE{\the\toks0.}% + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Test the order of expansion. The example was given in the original + % question that led to writing this package. For the record, this + % package (at some point) used 32 |\expandafter| to do the expansion + % in the right order, which was better than other approaches; however + % this counting ignores the large overheads due to other primitives. + \OMIT + \def\a#1.{#1} + \def\b#1:{#1.} + \def\c#1,{#1:} + \def\d{Hello world!,} + \TIMO + % + \TEST{MultiExpandAfter order}{% + \toks0\MultiExpandAfter{3}{% + \MultiExpandAfter{3}\a + \MultiExpandAfter{3}\b + \MultiExpandAfter{1}\c + \d}% + \TYPE{\the\toks0}% + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % The other example from the same question (expanding seven tokens once + % each in the reverse order) takes 74 \expandafter. + \OMIT + \def\b.{.b} \def\c.{.c} \def\d.{.d} + \def\e.{.e} \def\f.{.f} \def\g.{.g} + \TIMO + % + \TEST{MultiExpandAfter order (2)}{% + \toks0\MultiExpandAfter{2}{% + \MultiExpandAfter3\a \MultiExpandAfter3\b + \MultiExpandAfter3\c \MultiExpandAfter3\d + \MultiExpandAfter3\e \MultiExpandAfter1\f\g.}% + \TYPE{\the\toks0}% + } + + \END +%% +%% Copyright (C) 2011-2015 by Bruno Le Floch <blflatex@gmail.com> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License (LPPL), either +%% version 1.3c of this license or (at your option) any later +%% version. The latest version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Bruno Le Floch. +%% +%% This work consists of the file multiexpand.dtx +%% and the derived files multiexpand.ins, +%% multiexpand.pdf and +%% multiexpand.sty. +%% +%% +%% End of file `multiexpand002.lvt'. diff --git a/Master/texmf-dist/doc/generic/multiexpand/multiexpand002.tlg b/Master/texmf-dist/doc/generic/multiexpand/multiexpand002.tlg new file mode 100644 index 00000000000..d8059b4c79f --- /dev/null +++ b/Master/texmf-dist/doc/generic/multiexpand/multiexpand002.tlg @@ -0,0 +1,40 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +%% \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 \~} +%% +Author: Bruno Le Floch +(multiexpand.sty) +============================================================ +TEST 1: MultiExpand many times (vlcdm) +============================================================ +\v \l \c \d \m . +============================================================ +============================================================ +TEST 2: MultiExpandAfter chain (c vxxl iiivxxxl iixl) +============================================================ +\c \v \x \x \l \i \i \i \v \x \x \x \l \i \i \x \l . +============================================================ +============================================================ +TEST 3: MultiExpandAfter order +============================================================ +Hello world! +============================================================ +============================================================ +TEST 4: MultiExpandAfter order (2) +============================================================ +\a .bcdefg +============================================================ diff --git a/Master/texmf-dist/doc/latex/multiexpand/README b/Master/texmf-dist/doc/latex/multiexpand/README deleted file mode 100644 index 160664a37ee..00000000000 --- a/Master/texmf-dist/doc/latex/multiexpand/README +++ /dev/null @@ -1,31 +0,0 @@ -Variations on the `\expandafter` TeX primitive -============================================== -* E-mail: blflatex@gmail.com -* Released under the LaTeX Project Public License v1.3c or later - See http://www.latex-project.org/lppl.txt - -Every TeX programmer knows `\expandafter`, and how messy it can become -when trying to expand several times a very deeply hidden token. For -example, say we want to expand `\C` four times before `\A` and `\B` in -`\A\B\C`. The traditional approach would be to insert 15 `\expandafter` -before `\A` and the same number before `\B`. With this package one can -do either of the following - - \expandafter\A\expandafter\B\romannumeral\multiexpand{4}\C - \expandafter\A\romannumeral\multiexpandafter{4}\B\C - -In one step of expansion (triggered by the `\expandafter`'s), -`\romannumeral\multiexpand{4}` expands the following token 4 times, -whereas `\romannumeral\multiexpandafter{4}` expands the token after -that 4 times. For more complicated cases, use `\MultiExpandAfter`: - - \MultiExpandAfter{2}\a\MultiExpandAfter{3}{% - \MultiExpandAfter{10}\b\MultiExpandAfter{10}\c\d} - -expands `\d` 10 times, then `\c` 8 times, then `\b` once. -The whole process only takes two steps of expansion. - -The package can be built from the file `multiexpand.dtx' by running - - pdflatex multiexpand.dtx - pdflatex multiexpand.dtx diff --git a/Master/texmf-dist/source/latex/multiexpand/multiexpand.dtx b/Master/texmf-dist/source/generic/multiexpand/multiexpand.dtx index 11f36e608ec..e28291565d0 100644 --- a/Master/texmf-dist/source/latex/multiexpand/multiexpand.dtx +++ b/Master/texmf-dist/source/generic/multiexpand/multiexpand.dtx @@ -9,26 +9,35 @@ Variations on the `\expandafter` TeX primitive * Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt -Every TeX programmer knows `\expandafter`, and how messy it can become -when trying to expand several times a very deeply hidden token. For -example, say we want to expand `\C` four times before `\A` and `\B` in -`\A\B\C`. The traditional approach would be to insert 15 `\expandafter` -before `\A` and the same number before `\B`. With this package one can -do either of the following +The package defines `\multiexpand`, `\multiexpandafter`, `\MultiExpand` +and `\MultiExpandAfter`, replacing large chains of `\expandafter`. +These four commands take as an argument the number of expansion to be +done. If eTeX is available, this number is evaluated using `\numexpr`. - \expandafter\A\expandafter\B\romannumeral\multiexpand{4}\C - \expandafter\A\romannumeral\multiexpandafter{4}\B\C +Say we want to expand `\C` five times before `\A` and `\B` in `\A\B\C`. +The traditional approach would be to insert 31 `\expandafter` before +`\A` and the same number before `\B`. With this package one can use +any of + + \expandafter\A\expandafter\B\romannumeral\multiexpand{5}\C + + \expandafter\A\romannumeral\multiexpandafter{5}\B\C + + \MultiExpandAfter{2}\A\MultiExpandAfter{5}\B\C + + \MultiExpandAfter{2}\A\MultiExpandAfter{2}\B\MultiExpand{5}\C In one step of expansion (triggered by the `\expandafter`'s), -`\romannumeral\multiexpand{4}` expands the following token 4 times, -whereas `\romannumeral\multiexpandafter{4}` expands the token after -that 4 times. For more complicated cases, use `\MultiExpandAfter`: +`\romannumeral\multiexpand{5}` expands the following token 5 times, +whereas `\romannumeral\multiexpandafter{5}` expands the token after +that 5 times. The macros `\MultiExpandAfter` and `\MultiExpand` +take two steps of expansion, but do not require `\romannumeral`. +Another example is that in two steps of expansion, \MultiExpandAfter{2}\a\MultiExpandAfter{3}{% - \MultiExpandAfter{10}\b\MultiExpandAfter{10}\c\d} + \MultiExpandAfter{9}\b\MultiExpandAfter{10}\c\d} -expands `\d` 10 times, then `\c` 8 times, then `\b` once. -The whole process only takes two steps of expansion. +expands `\d` 10 times, then `\c` 7 times (9-2), then `\b` once (3-2). The package can be built from the file `multiexpand.dtx' by running @@ -246,9 +255,9 @@ and the derived files multiexpand.ins, %</driver> % \fi % -% \CheckSum{127} +% \CheckSum{126} % -% \def\fileversion{v1.3} \def\filedate{2015/03/03} +% \def\fileversion{v1.4} \def\filedate{2015/09/20} %\title{\texttt{multiexpand}\\ % Trigger multiple expansions \\ in one expansion step\thanks{This file % describes version \fileversion, last revised \filedate.}} @@ -262,8 +271,9 @@ and the derived files multiexpand.ins, % \tableofcontents % \changes{v1.0}{2011/02/15}{First version with documentation} % \changes{v1.1}{2013/01/08}{Version submitted to CTAN} -% \changes{v1.2}{2013/01/09}{Use less expandafter for large arguments} +% \changes{v1.2}{2013/01/09}{Use fewer expandafter for large arguments} % \changes{v1.2}{2013/01/09}{Change ME prefix to multiexpand} +% \changes{v1.4}{2015/09/20}{Clarify that eTeX is not required} % % \section{Two user commands} % @@ -336,19 +346,19 @@ and the derived files multiexpand.ins, % |\numexpr| from being set to |\relax|, because we are already in a % group. % \begin{macrocode} -\expandafter\ifx\csname numexpr\endcsname\relax +\expandafter \ifx \csname numexpr\endcsname \relax % \end{macrocode} % % A helper. % \begin{macrocode} -\long\gdef\multiexpand@gobble#1{} +\long \gdef \multiexpand@gobble #1{} % \end{macrocode} % % The user commands |\multiexpand| and |\multiexpandafter|, to be used % after |\romannumeral|. They only differ a little bit. % \begin{macrocode} -\gdef\multiexpand{\multiexpand@aux\multiexpand@} -\gdef\multiexpandafter{\multiexpand@aux\multiexpand@after} +\gdef \multiexpand {\multiexpand@aux \multiexpand@ } +\gdef \multiexpandafter {\multiexpand@aux \multiexpand@after } % \end{macrocode} % The user commands receives a number, and to accept various forms of % numbers we hit it with |\number|. If it is non-positive, stop the @@ -357,7 +367,7 @@ and the derived files multiexpand.ins, % \begin{macrocode} \long \gdef \multiexpand@aux #1#2% {\expandafter \multiexpand@test \number #2;#1} -\long \gdef \multiexpand@test #1;#2% +\gdef \multiexpand@test #1;#2% {% \ifnum #1>0 \multiexpand@reverse #1{?\multiexpand@reverse@end }?;;#2% @@ -421,14 +431,14 @@ and the derived files multiexpand.ins, \ifcase #3 \or 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\fi #1% } -\gdef\multiexpand@zero#1#2\number1#3\ifcase#4\fi#5% - {#1\multiexpand@iterate#59#31} -\gdef\multiexpand@end#1#2\ifcase#3\fi#4{#10 } +\gdef \multiexpand@zero #1#2\number 1#3\ifcase #4\fi #5% + {#1\multiexpand@iterate #59#31} +\gdef \multiexpand@end #1#2\ifcase #3\fi #4{#10 } % \end{macrocode} % Finally, the two different expansion commands. % \begin{macrocode} -\gdef\multiexpand@#1;{#1\expandafter;} -\gdef\multiexpand@after#1;{#1\expandafter;\expandafter} +\gdef \multiexpand@ #1;{#1\expandafter ;} +\gdef \multiexpand@after #1;{#1\expandafter ;\expandafter } % \end{macrocode} % % \subsection{With \hologo{eTeX}} diff --git a/Master/texmf-dist/source/generic/multiexpand/multiexpand.ins b/Master/texmf-dist/source/generic/multiexpand/multiexpand.ins new file mode 100644 index 00000000000..956f082a98d --- /dev/null +++ b/Master/texmf-dist/source/generic/multiexpand/multiexpand.ins @@ -0,0 +1,71 @@ +%% +%% This is file `multiexpand.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% multiexpand.dtx (with options: `install') +%% ---------------------------------------------------------------- +%% multiexpand --- trigger multiple expansions in one expansion step. +%% E-mail: blflatex@gmail.com +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------- +%% +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +---------------------------------------------------------------- +multiexpand --- trigger multiple expansions in one expansion step. +E-mail: blflatex@gmail.com +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt +---------------------------------------------------------------- + +\endpreamble +\postamble + +Copyright (C) 2011-2015 by Bruno Le Floch <blflatex@gmail.com> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License (LPPL), either +version 1.3c of this license or (at your option) any later +version. The latest version of this license is in the file: + +http://www.latex-project.org/lppl.txt + +This work is "maintained" (as per LPPL maintenance status) by +Bruno Le Floch. + +This work consists of the file multiexpand.dtx +and the derived files multiexpand.ins, + multiexpand.pdf and + multiexpand.sty. + +\endpostamble +\usedir{tex/latex/multiexpand} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +\endbatchfile +%% +%% Copyright (C) 2011-2015 by Bruno Le Floch <blflatex@gmail.com> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License (LPPL), either +%% version 1.3c of this license or (at your option) any later +%% version. The latest version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Bruno Le Floch. +%% +%% This work consists of the file multiexpand.dtx +%% and the derived files multiexpand.ins, +%% multiexpand.pdf and +%% multiexpand.sty. +%% +%% +%% End of file `multiexpand.ins'. diff --git a/Master/texmf-dist/tex/latex/multiexpand/multiexpand.sty b/Master/texmf-dist/tex/generic/multiexpand/multiexpand.sty index 23ef936a250..7bbad01a38f 100644 --- a/Master/texmf-dist/tex/latex/multiexpand/multiexpand.sty +++ b/Master/texmf-dist/tex/generic/multiexpand/multiexpand.sty @@ -16,13 +16,13 @@ \catcode `\@=11 \gdef \MultiExpand {\romannumeral \multiexpand } \gdef \MultiExpandAfter {\romannumeral \multiexpandafter } -\expandafter\ifx\csname numexpr\endcsname\relax -\long\gdef\multiexpand@gobble#1{} -\gdef\multiexpand{\multiexpand@aux\multiexpand@} -\gdef\multiexpandafter{\multiexpand@aux\multiexpand@after} +\expandafter \ifx \csname numexpr\endcsname \relax +\long \gdef \multiexpand@gobble #1{} +\gdef \multiexpand {\multiexpand@aux \multiexpand@ } +\gdef \multiexpandafter {\multiexpand@aux \multiexpand@after } \long \gdef \multiexpand@aux #1#2% {\expandafter \multiexpand@test \number #2;#1} -\long \gdef \multiexpand@test #1;#2% +\gdef \multiexpand@test #1;#2% {% \ifnum #1>0 \multiexpand@reverse #1{?\multiexpand@reverse@end }?;;#2% @@ -43,11 +43,11 @@ \ifcase #3 \or 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\fi #1% } -\gdef\multiexpand@zero#1#2\number1#3\ifcase#4\fi#5% - {#1\multiexpand@iterate#59#31} -\gdef\multiexpand@end#1#2\ifcase#3\fi#4{#10 } -\gdef\multiexpand@#1;{#1\expandafter;} -\gdef\multiexpand@after#1;{#1\expandafter;\expandafter} +\gdef \multiexpand@zero #1#2\number 1#3\ifcase #4\fi #5% + {#1\multiexpand@iterate #59#31} +\gdef \multiexpand@end #1#2\ifcase #3\fi #4{#10 } +\gdef \multiexpand@ #1;{#1\expandafter ;} +\gdef \multiexpand@after #1;{#1\expandafter ;\expandafter } \else \gdef \multiexpand@ #1;% {% |