summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/multiexpand/multiexpand.sty
blob: 19ec9d1b5737da1395205ad6b117e96209986163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
%%
%% This is file `multiexpand.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% multiexpand.dtx  (with options: `package')
%% ----------------------------------------------------------------
%% 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
%% ----------------------------------------------------------------
%% 
\begingroup
\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 }
\long \gdef \multiexpand@aux #1#2%
  {\expandafter \multiexpand@test \number #2;#1}
\gdef \multiexpand@test #1;#2%
  {%
    \ifnum #1>0
      \multiexpand@reverse #1{?\multiexpand@reverse@end }?;;#2%
    \fi
    0 %
  }
\gdef \multiexpand@reverse #1#2;%
  {\multiexpand@gobble #1\multiexpand@reverse #2;#1}
\gdef \multiexpand@reverse@end #1;?#2#3;#4#50
  {#5\multiexpand@iterate #41#3;}
\gdef \multiexpand@iterate #1#21#3%
  {%
    \ifx ;#3\multiexpand@end \fi
    \ifx 0#3\multiexpand@zero \fi
    \expandafter \multiexpand@iterate
    \expandafter #1%
    \number 1#2%
      \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\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;%
  {%
    \ifnum #1<2 \multiexpand@end \fi
    \expandafter \multiexpand@
    \the \numexpr #1-1\expandafter ;%
  }
\gdef \multiexpand@after #1;%
  {%
    \ifnum #1<2 \multiexpand@end \fi
    \expandafter \multiexpand@after
    \the \numexpr #1-1\expandafter ;\expandafter
  }
\gdef \multiexpand@end #1#2#3;{#10#2 }
\long \gdef \multiexpand #1%
  {\expandafter \multiexpand@ \the \numexpr #1;}
\long \gdef \multiexpandafter #1%
  {\expandafter \multiexpand@after \the \numexpr #1;}
\fi
\endgroup
%% 
%% Copyright (C) 2011-2017 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.sty'.