summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/etextools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-30 00:03:01 +0000
committerKarl Berry <karl@freefriends.org>2009-09-30 00:03:01 +0000
commit2315b3cb5d99fbbf5379973f08d9c6e25d0c5c0e (patch)
treefc5fa493c9a7d31e7ffc0a0bff0eadff99ea50d6 /Master/texmf-dist/tex/latex/etextools
parent26c0b6b2251a275d65a16e87f78acd53c25c683a (diff)
etextools update (29sep09)
git-svn-id: svn://tug.org/texlive/trunk@15564 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/etextools')
-rw-r--r--Master/texmf-dist/tex/latex/etextools/etextools.sty188
1 files changed, 115 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/latex/etextools/etextools.sty b/Master/texmf-dist/tex/latex/etextools/etextools.sty
index 35f78a71ff1..bced95b159e 100644
--- a/Master/texmf-dist/tex/latex/etextools/etextools.sty
+++ b/Master/texmf-dist/tex/latex/etextools/etextools.sty
@@ -21,10 +21,10 @@
%% etextools.sty, etextools.pdf, etextools.ins,
%% and etextools-examples.tex
%%
-%%% etextools : e-TeX tools for LaTeX Users and package Writers (v.3.0)
+%%% etextools : e-TeX tools for LaTeX Users and package Writers (v.3.1)
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesPackage{etextools}
- [2009/08/27 v3.0 e-TeX more useful tools for LaTeX package writers]
+ [2009/09/30 v3.1 e-TeX more useful tools for LaTeX package writers]
\csname ettl@onlyonce\endcsname\let\ettl@onlyonce\endinput
\RequirePackage{etex,etoolbox,letltxmacro}
\let\ettl@AtEnd\@empty
@@ -57,7 +57,7 @@
\AtEndOfPackage{\ettl@AtEnd\undef\ettl@AtEnd}
% A few helper macros
-\let\ettl@ifdefined\iffalse%\ifdefined% turn to \iffalse to test other implementation on pdfTeX
+\let\ettl@ifdefined\ifdefined%\ifdefined% turn to \iffalse to test other implementation on pdfTeX
\long\def\ettl@fi#1\fi{\fi#1}
\long\def\ettl@else#1\else#2\fi{\fi#1}
\long\def\ettl@or#1\or#2\fi{\fi#1}
@@ -119,7 +119,7 @@
\long\def\@gobblespace#1 {#1}
%% \@gobblescape \cs-token
-\newcommand*\@gobblescape{\romannumeral0\expandafter\@gobble\string}
+\newcommand*\@gobblescape{\romannumeral-`\q\expandafter\@gobble\string}
% The swap macros
\newcommand\@swap[2]{#2#1}
@@ -172,6 +172,10 @@
% noexpandafter
\newcommand*\noexpandafter{\noexpand\expandafter}
+%% \thefontname
+\newcommand\thefontname{{\expandafter\ettl@thefontname\expandafter\strip@meaning\the\font}}
+\font\ettl@thefontname=ecrm1000
+
%% \showcs { csname }
\providecommand*\showcs[1]{\expandafter\show\csname#1\endcsname}
@@ -257,7 +261,7 @@
oftwo\endcsname{\z@#2}{\z@\csname#3\endcsname}}
%% The ifx-test and the character-test
-\long\def\ettl@ifx#1#2#3#4{\ifx#1#2#3\else#4\fi}
+\long\def\ettl@ifx#1#2{\csname ettl@\ifx#1#21\else2\fi of2\endcsname}
\long\def\ettl@ifchar#1#2{\csname ettl@\if\noexpand#2\string#11of2\ettl@csname\fi
\unless\ifcat\noexpand#1\noexpand#22of2\ettl@csname\fi
\ifx#1#21\else2\fi of2\endcsname}
@@ -279,7 +283,7 @@
first\else second\fi}oftwo\endcsname}
%% \ifsinglechar character{ string }{ true }{ false }
-\newcommand\ifsinglechar[2]{\romannumeral\csname rmn@\ettl@firstspace{#2}
+\long\def\ifsinglechar#1#2{\romannumeral\csname rmn@\ettl@firstspace{#2}
{\ettl@nbk#2//{second}{\if\relax\detokenize{#1#2}\relax first\else\ifx#1#2first\else second\fi\fi}//}
{\if\relax\detokenize\expandafter{\ettl@cdr#2\@nil}\relax
\expandafter\ettl@ifchar
@@ -334,7 +338,7 @@
%% \detokenizeChars { list of single tokens }
\newcommand\detokenizeChars[1]{\expandafter\ettl@dosinglelist
- \expandafter\ettl@do@detokenChars\expandafter{\romannumeral0\protectspace{#1}}}
+ \expandafter\ettl@do@detokenChars\expandafter{\romannumeral\protectspace{\z@#1}}}
\long\def\ettl@do@detokenChars#1{\ifOneChar{#1}\detokenize\unexpanded{#1}}
%% \protectspace { string }
@@ -417,7 +421,7 @@
\ettl@ifdefined\pdfmatch
\newcommand\ifstrnum[1]{\romannumeral\csname rmn@\ifnum\pdfmatch
{\detokenize{^([[:space:]]*-?)*+[[:digit:]]+[[:space:]]*$}}{\detokenize{#1}}=1 %
- first\else second\fi oftwo\endcsname}
+ first\else second\fi oftwo\endcsname}
\else
\newcommand\ifstrnum[1]{\romannumeral\csname rmn@\ettl@nbk#1//%
{\expandafter\ettl@numberminus\detokenize{#1}-/End§String/}{second}//oftwo\endcsname}
@@ -532,14 +536,10 @@
\long\def\ettl@FE@ifstar#1*#2/End§String/{#1/#2}
%% \FE@charequal{ #1 } { \MacroWith= }{ \NormalMacro } % used by the string filters
-\ettl@ifdefined\pdfmatch% use \ettl@ifdefined to test both on pdfTeX (make \ettl@ifdefined=\iffalse)
-\newcommand\FE@ifcharequal[3]{\ifsinglechar ={#1}{#2}{#3{#1}}}
-\else
\newcommand\FE@ifcharequal[3]{\csname\ettl@BasicFilter\ettl@FE@charequal=#1/End§String/\endcsname
{#2}%
{#3{#1}}}
\long\def\ettl@FE@charequal#1=#2/End§String/{#1/#2}
-\fi
%% \FE@ifchar{ <Character> }{ #1 }{ \SpecialFormMacro }{ \NormalMacro }
\newcommand\FE@ifchar[4]{\ifsinglechar{#1}{#2}{#3}{#4{#2}}}
@@ -610,6 +610,7 @@
\expandafter\aftergroup\csname ettl@ftergroup@def\the\ettl@fter\endcsname
\aftergroup\global \aftergroup\undef
\expandafter\aftergroup\csname ettl@ftergroup@def\the\ettl@fter\endcsname}
+\let\ettl@aftergroup@def\aftergroup@def
%----------------------------------------------------------------------------
%% \@ifchar{ single token }{ true }{ false }
@@ -656,9 +657,9 @@
%% \futuredef*=[list of allowed tokens]{ command }{ commands to expand after } (or \futuredef=*[...] )
\newrobustcmd*\futuredef{\begingroup\ettl@futdef\ettl@futuredef\detokenize}
\protected\def\ettl@futdef#1#2{\@ifstar%
- {\ettl@futdef\ettl@futurd@f#2}
+ {\ettl@futdef\ettl@futured@f#2}
{\@ifchar={\ettl@futdef#1\unexpanded}
- {\@testopt{\ettl@futur@def#1#2}}}}
+ {\@testopt{\ettl@futur@def#1#2}{}}}}
\long\def\ettl@futur@def#1#2[#3]{%
\csname ettl@\if\relax\detokenize{#3}\relax1\else2\fi of2\endcsname
{\let \ettl@x \@empty \letcs \ettl@futur@def@collect{\@gobblescape#1@collectall}}%
@@ -684,7 +685,8 @@
\fi{#5}{#3}
{\def\ettl@futuredef@loop{\ettl@futuredef@test{#4#5}}\futurelet\ettl@x\ettl@futuredef@loop}
{\ettl@futuredef@end{#5}/Ne¤t/{}{#4}}/Ne¤t/}
-\long\def\ettl@futuredef@space#1#2/Ne¤t/#3#4 {\ettl@futur@def@collect#1#2/Ne¤t/{#3}{#4}{ }}
+\long\def\ettl@futuredef@space#1#2/Ne¤t/#3#4 {%
+ \ettl@futur@def@collect#1#2/Ne¤t/{#3}{#4}{ }}
\long\def\ettl@futuredef@collectall#1#2/Ne¤t/#3#4#5{#2%
\def\ettl@futuredef@loop{\ettl@futuredef@test{#4#5}}\futurelet\ettl@x\ettl@futuredef@loop}
\long\def\ettl@futur@def@filt#1#2{% #1=token to check, #2=allowed list
@@ -692,37 +694,46 @@
\ettl@futdef@filt#2#1//}
\long\def\ettl@futuredef@filt#1#2\fi#3#4{\fi % #1=detokenize/unexpanded, #2=discard, #3=token,#4=allowed list
\expandafter\ettl@futur@def@filt\expandafter{#1{#3}}{#4}}
-\long\def\ettl@futured@f#1#2#3#4{\begingroup%#1=test macro,#2=list,#3=macro,#4=code-next
- \let\ettl@y\@undefined
+\long\def\ettl@futured@f#1#2#3#4{% #1=detokenize #2=list, #3=macro result, #4=code-next
+ \let \ettl@y \@undefined
\def \ettl@futured@f@loop{\ettl@futured@f@test{}}%
\long \def \ettl@futured@f@test##1{%
- \csname @\ettl@ifinsinglelist#1\ettl@x#2/End§List/oftwo\endcsname
- {\ifcat\noexpand\ettl@x\bgroup\ettl@futuredef@end{##1}\fi
- \ifcat\noexpand\ettl@x\egroup\ettl@futuredef@end{##1}\fi
- \ifcat\noexpand\ettl@x\ettl@sptoken\ettl@futured@f@space{##1}{ }\fi
- \ettl@futured@f@collect{##1}/Ne¤t/}
- {\ettl@futured@f@expand{##1}}}%
- \long \def \ettl@futuredef@end##1\fi##2/Ne¤t/{\fi\endgroup\def#3{##1}#4}%
+ \ifcat\noexpand\ettl@x\bgroup\ettl@futured@f@end\else
+ \ifcat\noexpand\ettl@x\egroup\ettl@futured@f@end\else
+ \ifcat\noexpand\ettl@x\ettl@sptoken\ettl@futured@f@space#1\else
+ \ettl@futur@def@collect#1\fi\fi\fi/Ne¤t/{##1}{#2}{}}%
+ \long \def \ettl@futured@f@end##1/Ne¤t/##2##3##4{##1\endgroup\def#3{##2}#4##4}%
\futurelet \ettl@x \ettl@futured@f@loop}
-\long\def\ettl@futured@f@collect#1#2/Ne¤t/#3{%
- #2\def\ettl@futured@f@loop{\ettl@futured@f@test{#1#3}}\let\ettl@y\@undefined%
- \futurelet\ettl@x\ettl@futured@f@loop}
-\long\def\ettl@futured@f@expand@nbk#1{%
- \ifcat\noexpand\ettl@x\ettl@sptoken\ettl@futured@f@space{#1}{}\fi
- \ifx\ettl@x\ettl@y\ettl@futuredef@end{#1}%
- \else\let\ettl@y\ettl@x\ettl@futured@f@exp@nd\fi/Ne¤t/}
-\long\def\ettl@futured@f@expand@bk#1{%
- \ifcat\noexpand\ettl@x\bgroup\ettl@futuredef@end{#1}\fi
- \ifcat\noexpand\ettl@x\egroup\ettl@futuredef@end{#1}\fi
- \ifcat\noexpand\ettl@x\ettl@sptoken\ettl@futured@f@space{#1}{ }\fi
- \ifx\ettl@x\ettl@y\ettl@futured@f@collect{#1}%
- \else\let\ettl@y\ettl@x\ettl@futured@f@exp@nd%
- \fi/Ne¤t/}
-\long\def\ettl@futured@f@exp@nd#1/Ne¤t/{%
- #1\expandafter\futurelet\expandafter\ettl@x\expandafter\ettl@futured@f@loop}
-\csdef{ettl@futured@f@space}#1#2\fi#3/Ne¤t/ {%
- \def\ettl@futured@f@loop{\ettl@futured@f@test{#1#2}}\let\ettl@y\@undefined
- \futurelet\ettl@x\ettl@futured@f@loop}
+\long\def\ettl@futured@f@space#1#2/Ne¤t/#3#4#5 {%
+ \ettl@futur@def@collect#1#2/Ne¤t/{#3}{#4}{#5}{ }}
+\long\def\ettl@futured@f@collect#1#2/Ne¤t/#3#4#5#6{#2%
+ \ifcat\noexpand\ettl@x\relax \ettl@futuredef@filt\unexpanded
+ \else \ettl@futuredef@filt#1
+ \fi{#6}{#4}
+ {\let \ettl@y \@undefined \ettl@futured@f@append/Ne¤t/{#3}{}{#6}}%
+ {\ettl@futured@f@try@expand{#3}\ettl@futured@f@end{#6}}/Ne¤t/}
+\long\def\ettl@futured@f@collectall#1#2/Ne¤t/#3#4#5#6{#2%
+ \ettl@futured@f@try@expand{#3}\ettl@futured@f@append{#6}}
+\long\def\ettl@futured@f@space#1#2/Ne¤t/#3#4#5 {%
+ \ettl@futur@def@collect#1#2/Ne¤t/{#3}{#4}{#5}{ }}
+\long\def\ettl@futured@f@try@expand#1#2#3{%
+ \expandafter\ifx\noexpand\ettl@x\ettl@x
+ \let\ettl@y=#2%
+ \else\ettl@futured@f@CheckSpecials{#3}%
+ {\let \ettl@y=#2}%
+ {\ifx\ettl@x\ettl@y \let \ettl@y \ettl@futured@f@end\else
+ \let \ettl@y \ettl@futured@f@expand\fi}%
+ \fi\ettl@y/Ne¤t/{#1}{}{#3}}
+\long\def\ettl@futured@f@expand/Ne¤t/#1#2#3{\let\ettl@y\ettl@x
+ \expandafter\futurelet\expandafter\ettl@x\expandafter\ettl@futured@f@loop#3}
+\long\def\ettl@futured@f@CheckSpecials#1{\ifintokslist{#1}{%
+ \@undefined\if\ifcat\ifnum\ifdim\ifodd%
+ \ifvmode\ifhmode\ifmmode\ifinner\ifvoid\ifhbox\ifvbox%
+ \ifx\ifeof\iftrue\iffalse\ifcase\ifdefined\ifcsname\iffontchar%
+ \else\fi\or}}
+\def\ettl@futured@f@append/Ne¤t/#1#2#3{%
+ \def\ettl@futured@f@loop{\ettl@futured@f@test{#1#3}}%
+ \futurelet\ettl@x\ettl@futured@f@loop}%
%----------------------------------------------------------------------------
@@ -738,19 +749,19 @@
\fi}
%% \ifinttokslist{ item }{ list of tokens }{ true }{ false }
-\newcommand\ifintokslist[4]{\romannumeral\csname @%
- \expandafter\ettl@nbk\romannumeral\ettl@dosinglelist{\ettl@ifintokslist{#1}}{#2}//{first}{second}//%
- oftwo\endcsname{\z@#3}{\z@#4}}
-\long\def\ettl@ifintokslist#1#2{\ettl@ifx{#1}{#2}{\expandafter\z@\ettl@breakloop}{}}
-\newcommand\ifincharlist[4]{\romannumeral\csname @%
- \expandafter\ettl@nbk\romannumeral\ettl@dosinglelist{\ettl@ifincharlist{#1}}{#2}\z@//{first}{second}//%
- oftwo\endcsname{\z@#3}{\z@#4}}
-\long\def\ettl@ifincharlist#1#2{\ettl@ifchar{#1}{#2}{\expandafter\z@\ettl@breakloop}{}}
+\newcommand\ifintokslist[2]{\romannumeral\csname rmn@%
+ \expandafter\ettl@nbk\romannumeral\ettl@dosinglelist{\ettl@ifintokslist{#1}}{#2}\z@//%
+ {first}{second}//oftwo\endcsname}
+\long\def\ettl@ifintokslist#1#2{\ifx#1#2\ettl@breakloop\z@\fi}
+\newcommand\ifincharlist[2]{\romannumeral\csname rmn@%
+ \expandafter\ettl@nbk\romannumeral\ettl@dosinglelist{\ettl@ifincharlist{#1}}{#2}\z@//%
+ {first}{second}//oftwo\endcsname}
+\long\def\ettl@ifincharlist#1#2{\ettl@ifchar{#1}{#2}{\ettl@breakloop\z@}{}}
\long\def\ettl@dosinglelist#1#2{\ettl@nbk#2//%
- {\ettl@dosinglelist@loop{#1}#2//{\ettl@dosinglelist@loop{#1}}\ettl@breakloop}
- \ettl@breakloop///End§List/}
+ {\ettl@dosinglelist@loop{#1}#2//{\ettl@dosinglelist@loop{#1}}{\ettl@breakloop{}}}
+ {\ettl@breakloop{}}///End§List/}
\long\def\ettl@dosinglelist@loop#1#2#3#4/#5#6#7/End§List/{%
- #1{#2}#6{#3}#4//{#6}#7/End§List/}
+ #1{#2}#6{#3}#4//{#6}{#7}/End§List/}
%% \gettokslistindex { item }{ list of tokens }
%% \gettokslistcount { item }{ list of tokens }
@@ -772,15 +783,19 @@
\newcommand\getcharlisttoken[2]{\ifnotempty{#2}{\ettl@nbk#1//%
{\ExpandAftercmds{\ettl@setresult 3of3><}{\ettl@getsinglelist{\ettl@ifchar{#1}}{#2}}}
{}//}{}}
-\long\def\ettl@getsinglelist#1#2{\ettl@singlelist@loop{#1}{-1}{-1}{}#2//%
- \ettl@singlelist@loop\ettl@singlelist@result/End§List/}
-\long\def\ettl@singlelist@loop#1#2#3#4#5#6/#7#8#9/End§List/{%
- \csname @#1#5{first}{second}oftwo\endcsname
- {#8{#1}{#2+1}{#3+1+0*(0}{#5}#6//#8#9}
- {#8{#1}{#2+1}{#3+1}{#4}#6//#8#9}/End§List/}
-
-\def\ettl@singlelist@result#1#2#3#4#5/End§List/{\ExpandNextTwo\@swaptwo%
- {\number\numexpr\ifempty{#4}{-1}{#3)}}{\number\numexpr#2}{#4}}
+\long\def\ettl@getsinglelist#1#2{\ettl@singlelist@loop{-1}{-1}{}#2//%
+ {\ettl@expandafthree\ettl@singlelist@loop#1}%
+ {\expandafter\ettl@singlelist@result\@thirdofthree}/End§List/}
+\long\def\ettl@singlelist@loop#1#2#3#4#5/#6#7#8/End§List/{%
+ #7{#4}
+ {{#1+1}{#2+1+0*(0}{#4}}
+ {{#1+1}{#2+1}{#3}}#5//{#7}{#8}/End§List/}
+ % \csname @#1#5{first}{second}oftwo\endcsname
+ % {#8{#1}{#2+1}{#3+1+0*(0}{#5}#6//#8#9}
+ % {#8{#1}{#2+1}{#3+1}{#4}#6//#8#9}/End§List/}
+
+\def\ettl@singlelist@result#1#2#3#4/End§List/{\ExpandNextTwo\@swaptwo%
+ {\number\numexpr\ifempty{#3}{-1}{#2)}}{\number\numexpr#1}{#3}}
\def\ettl@setresult#1of#2>#3<{\ettl@nbk #3//%
{\ifdefcount{#3}{#3=\csname ettl@#1of#2\endcsname}
{\edef#3{\csname ettl@#1of#2\endcsname}}}%
@@ -803,18 +818,18 @@
##2{##4}% ifiscs or @thirdofthree
{\expandafter\@swaparg\expandafter{##4}{#4{##1}\@thirdofthree[{##3}]}}
{\ettl@nbk##4//%
- {\ifcase##1 \ettl@or\@swaplast{#60{\ettl@lst@count}}#6%
+ {\ifcase##1 \ettl@or\@swaplast{\number\numexpr#60{\ettl@lst@count}}#6%
\or \ettl@or\@swaplast{#60{\ettl@lst@getitem{##3}}}#6%
\or \ettl@or\@swaplast{#5{##3}}#5%
\or \ettl@fi\@swaplast{#60{##3}}#6%
- \fi{##4#3//}\ettl@breakloop
- }\ettl@breakloop///End§List/}}%
+ \fi{##4#3//}{\ettl@breakloop{}}%
+ }{\ettl@breakloop{}}///End§List/}}%
#1\long\def#5##1##2#3##3##4/##5##6##7/End§List/{%
\if\relax\detokenize{##2}\relax\expandafter\@gobbletwo\fi\@firstofone{##1{##2}}%
- ##6{##1}##3##4//{##6}##7/End§List/}
+ ##6{##1}##3##4//{##6}{##7}/End§List/}
#1\long\def#6##1##2##3#3##4##5/##6##7##8/End§List/{%
\if\relax\detokenize{##3}\relax\expandafter\@gobbletwo\fi\@firstofone{##2[##1]{##3}}%
- \expandafter##7\expandafter{\number\numexpr##1+1}{##2}##4##5//{##7}##8/End§List/}
+ \expandafter##7\expandafter{\number\numexpr##1+1}{##2}##4##5//{##7}{##8}/End§List/}
#1\protected\def#7{\@ifchar*%
{\@ifchar+{\ettl@forloop{\expandafter#2\expandafter*\expandafter+}{[####1]####2}}
{\ettl@forloop{\expandafter#2\expandafter*\expandafter+}{####1}}}
@@ -824,18 +839,18 @@
{\ettl@forloop{\expandafter#2}{####1}}}}
#1\def#2{\ettl@lst@modif#423\ifiscs}}
\long\def\ettl@lst@getitem#1[#2]#3{%
- \ifnum\numexpr#1<0 \expandafter\breakloop\fi
- \ifnum\numexpr#1=#2 \ettl@fi#3\breakloop\fi}
+ \ifnum\numexpr#1<0 \@swap{\breakloop{}}\fi
+ \ifnum\numexpr#1=#2 \@swap{\breakloop{#3}}\fi}
\long\def\ettl@lst@count[#1]#2{+\ettl@nbk#2//10//}
\long\def\ettl@lst@modif#1#2#3#4#5{\FE@modifiers{*+![}{#5}%
{\ettl@lst@modif{#1}#2#3\@thirdofthree}% * case
{\ettl@lst@modif{#1}#3#2{#4}}% + (case 3/default 2)
- {\ettl@lst@modif{\number\numexpr#1}00{#4}}% ! (case 0)
+ {\ettl@lst@modif{#1}00{#4}}% ! (case 0)
{\ettl@lst@opt{#1}{#2}{#4}#5}% [ (option)
{\ettl@lst@opt{#1}{#2}{#4}[\do]}}% (default option)
\long\def\ettl@lst@opt#1#2#3[#4]{%
\expandafter#1\expandafter{\number\ifnum#2=0 0\else\ifstrnum{#4}{1}{#2}\fi}{#3}[{#4}]}
-\long\def\ettl@breakloop#1/End§List/{}
+\long\def\ettl@breakloop#1#2/End§List/{#1}
\let\breakloop\ettl@breakloop
\globcount\ettl@for@nested
\long\def\ettl@forloop#1#2#3\do{%
@@ -910,7 +925,7 @@
\edef\ettl@RemoveInList####1####2{%
\ettl@Rem@veInList{####1}####2\noexpandcs{##1->remove}\noexpandcs{##1->result}%
}\ettl@RemoveInList{#1}#2%
- }\expandafter\ettl@RemoveInList\expandafter{\romannumeral0\@gobblescape#2}}
+ }\expandafter\ettl@RemoveInList\expandafter{\romannumeral-`\q\@gobblescape#2}}
\protected\long\def\ettl@Rem@veInList#1#2#3#4#5#6#7#8{%
\long\def#3[##1]##2#5#8#5##3##4/##5##6##7/End§List/{##6[##1+1]##2#5##3##4//##6##7/End§List/}%
\ifnotempty{#5}%% special case if no separator
@@ -998,6 +1013,33 @@
\ettl@xif@inlist\xifincsvlist{,}
\undef\ettl@if@inlist
\undef\ettl@xif@inlist
+
+%% \interval{ number }{ sorted comma separated list of numbers }
+\newcommand\interval[2]{\romannumeral-`\q%
+ \ExpandNext{\avoidvoid[\csvloop!{#2}]}{\csvloop+[\ettl@do@interval{#1}]{#2}}}
+\def\ettl@do@interval#1[#2]#3{\ifdim#1\p@<#3\p@ \@swap{\breakloop{#2}}\fi}
+
+%% \interplin{ number }{ sorted comma separated list of numbers }{ comma separated liist of numbers }
+\newcommand\locinterplin[3]{\romannumeral-`\q
+ \unless\ifnum\numexpr(\csvloop!{#2})-(\csvloop!{#3})=0
+ \PackageError{etextools}{Using \string\locinterplin\space the lists in argument 1 and 2\MessageBreak
+ must have the same number of elements}
+ {You're in trouble here and I cannot proceed...}
+ \fi
+ \ExpandNextTwo{\ettl@locinterplin{#1}{#3}{#2}}{\interval{#1}{#2}}{\csvloop!{#2}}}
+\begingroup\catcode`\/ 12%
+\gdef\ettl@locinterplin#1#2#3#4#5{%
+ \ifnum#4=0 \csvloop[#4]{#2}%
+ \else\ifnum#4=#5 \expandafter\csvloop\expandafter[\number\numexpr#5-1]{#2}%
+ \else\ifdim#1\p@=\expandafter\csvloop\expandafter[\number\numexpr#4-1]{#3}\p@
+ \expandafter\csvloop\expandafter[\number\numexpr#4-1]{#2}%
+ \else\strip@pt\dimexpr%
+ \expandafter\csvloop\expandafter[\number\numexpr#4-1]{#2}\p@+%
+ (#1\p@-\expandafter\csvloop\expandafter[\number\numexpr#4-1]{#3}\p@)*%
+ (\expandafter\csvloop\expandafter[\number\numexpr#4-1]{#2}-\csvloop[#4]{#2})/%
+ (\expandafter\csvloop\expandafter[\number\numexpr#4-1]{#3}-\csvloop[#4]{#3})\relax
+ \fi\fi\fi}
+\endgroup% catcode group
\DeclareOption{etoolbox}{%
\renewcommand\ifblank[3]{\ettl@nbk #1//{#2}{#3}//}
\renewcommand\ifdef[1]{\csname @\ifdefined#1first\else second\fi oftwo\endcsname}