summaryrefslogtreecommitdiff
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
parent26c0b6b2251a275d65a16e87f78acd53c25c683a (diff)
etextools update (29sep09)
git-svn-id: svn://tug.org/texlive/trunk@15564 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/etextools/README1
-rw-r--r--Master/texmf-dist/doc/latex/etextools/etextools-examples.tex2
-rw-r--r--Master/texmf-dist/doc/latex/etextools/etextools.pdfbin1041283 -> 1088124 bytes
-rw-r--r--Master/texmf-dist/source/latex/etextools/etextools.drv18
-rw-r--r--Master/texmf-dist/source/latex/etextools/etextools.dtx508
-rw-r--r--Master/texmf-dist/source/latex/etextools/etextools.ins4
-rw-r--r--Master/texmf-dist/tex/latex/etextools/etextools.sty188
7 files changed, 460 insertions, 261 deletions
diff --git a/Master/texmf-dist/doc/latex/etextools/README b/Master/texmf-dist/doc/latex/etextools/README
index 4e4ce44b417..ad8c5ac1b84 100644
--- a/Master/texmf-dist/doc/latex/etextools/README
+++ b/Master/texmf-dist/doc/latex/etextools/README
@@ -1,3 +1,4 @@
+% etextools v3.1 - stable - 2009/09/30
% This work consists of the main source file etextools.dtx
% and the derived files
% etextools.sty, etextools.pdf, etextools.ins,
diff --git a/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex
index 6d86965ec67..6347cb5c36d 100644
--- a/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex
+++ b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex
@@ -21,7 +21,7 @@
%% 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)
\documentclass[11pt,french,a4paper,oneside]{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
diff --git a/Master/texmf-dist/doc/latex/etextools/etextools.pdf b/Master/texmf-dist/doc/latex/etextools/etextools.pdf
index 407f03693cd..cd2f66ab4ae 100644
--- a/Master/texmf-dist/doc/latex/etextools/etextools.pdf
+++ b/Master/texmf-dist/doc/latex/etextools/etextools.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/etextools/etextools.drv b/Master/texmf-dist/source/latex/etextools/etextools.drv
index 96465ed4e6c..69c06212923 100644
--- a/Master/texmf-dist/source/latex/etextools/etextools.drv
+++ b/Master/texmf-dist/source/latex/etextools/etextools.drv
@@ -21,18 +21,22 @@
%% 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)
\edef\thisfile{\jobname}
\def\thisinfo{The \thispackage\ package -- an \eTeX{} package for \LaTeX{}}
-\def\thisrevision{3.0}
+\def\thisrevision{3.1}
\def\thisdate{27 August 2009}
\newcommand\makebookmark[1]{}
\documentclass[a4paper,oneside]{ltxdockit}
\usepackage[latin1]{inputenc}
\usepackage[american]{babel}
-\usepackage{doc,tocloft,stmaryrd,amsmath,amssymb,xspace,graphics,geometry,fancyhdr,titlesec,framed,bbding,ltxnew,enumitem,embedfile,etoolbox,marvosym,wasysym,soul,makecell,arydshln,numprint}
+\usepackage{doc,tocloft,stmaryrd,amsmath,amssymb,xspace,graphics,geometry,fancyhdr,titlesec,relsize,framed,bbding,enumitem,embedfile,etoolbox,marvosym,wasysym,soul,makecell,arydshln,numprint}
\CodelineNumbered\CodelineIndex
-\usepackage{fancyvrb}
+\usepackage{fancyvrb,microtype}
+\makeatletter\let\org@newif\newif\def\newif#1{\ifx#1\ifnotempty\else\expandafter\org@newif\fi}
+\usepackage{umrand}
+\let\newif\org@newif
+\makeatother
\newrobustcmd*\cmdLabel[1]{\csgdef{cmdlabel->#1}{}}
\embedfile{\thisfile.dtx}
\geometry{left=4.5cm,marginparwidth=14pt,right=1.5cm,top=3mm,headsep=3mm,bottom=3mm,footskip=8mm,includeheadfoot}
@@ -40,10 +44,10 @@
title={The \Thispackage macros},
subtitle={An \etex package providing useful (purely expandable) tools \\ for LaTeX Users and package Writers},
url={http://www.ctan.org/tex-archive/macros/latex/contrib/etextools/},
- author={Florent CHERVET},
+ author={\footnotesize Florent CHERVET},
email={\footnotesize\mdseries florent.chervet@free.fr},
- revision={\thisrevision},
- date={\thisdate}}
+ revision={\footnotesize\thisrevision},
+ date={\footnotesize\thisdate}}
\hypersetup{%
hyperindex=true,
pdftitle={The etextools package},
diff --git a/Master/texmf-dist/source/latex/etextools/etextools.dtx b/Master/texmf-dist/source/latex/etextools/etextools.dtx
index cf15fe5d34d..c8c8520b0f2 100644
--- a/Master/texmf-dist/source/latex/etextools/etextools.dtx
+++ b/Master/texmf-dist/source/latex/etextools/etextools.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-%%% 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)
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -38,7 +38,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: etextools 2009/07/14 v.3.0 e-TeX tools for LaTeX Users and package Writers}
+\Msg{* Package: etextools 2009/07/14 v.3.1 e-TeX tools for LaTeX Users and package Writers}
\Msg{************************************************************************}
\keepsilent
@@ -98,16 +98,20 @@ and etextools-examples.tex
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{The \thispackage\ package -- an \eTeX{} package for \LaTeX{}}
-\def\thisrevision{3.0}
+\def\thisrevision{3.1}
\def\thisdate{27 August 2009}
\newcommand\makebookmark[1]{}
%-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\documentclass[a4paper,oneside]{ltxdockit}
\usepackage[latin1]{inputenc}
\usepackage[american]{babel}
-\usepackage{doc,tocloft,stmaryrd,amsmath,amssymb,xspace,graphics,geometry,fancyhdr,titlesec,framed,bbding,ltxnew,enumitem,embedfile,etoolbox,marvosym,wasysym,soul,makecell,arydshln,numprint}
+\usepackage{doc,tocloft,stmaryrd,amsmath,amssymb,xspace,graphics,geometry,fancyhdr,titlesec,relsize,framed,bbding,enumitem,embedfile,etoolbox,marvosym,wasysym,soul,makecell,arydshln,numprint}
\CodelineNumbered\CodelineIndex
-\usepackage{fancyvrb}
+\usepackage{fancyvrb,microtype}
+\makeatletter\let\org@newif\newif\def\newif#1{\ifx#1\ifnotempty\else\expandafter\org@newif\fi}
+\usepackage{umrand}
+\let\newif\org@newif
+\makeatother
\newrobustcmd*\cmdLabel[1]{\csgdef{cmdlabel->#1}{}}
\embedfile{\thisfile.dtx}
\geometry{left=4.5cm,marginparwidth=14pt,right=1.5cm,top=3mm,headsep=3mm,bottom=3mm,footskip=8mm,includeheadfoot}
@@ -115,10 +119,10 @@ and etextools-examples.tex
title={The \Thispackage macros},
subtitle={An \etex package providing useful (purely expandable) tools \\ for LaTeX Users and package Writers},
url={http://www.ctan.org/tex-archive/macros/latex/contrib/etextools/},
- author={Florent CHERVET},
+ author={\footnotesize Florent CHERVET},
email={\footnotesize\mdseries florent.chervet@free.fr},
- revision={\thisrevision},
- date={\thisdate}}
+ revision={\footnotesize\thisrevision},
+ date={\footnotesize\thisdate}}
\hypersetup{%
hyperindex=true,
pdftitle={The etextools package},
@@ -201,7 +205,8 @@ and etextools-examples.tex
% \protected\def\X@package[#1]#2{\xpackage {#2\footnotemark}\footnotetext {\noindent \xpackage{#2}: \CTAN{macros/latex/contrib/#1}}}
% \newrobustcmd*\CTAN[1]{\href{http://www.ctan.org/tex-archive/#1}{\nolinkurl{CTAN:#1}}}
% \font\ding=dingbat scaled 800
-% \new\font\manual=manfnt
+% \font\manual=manfnt
+% \font\umranda=umranda \font\umrandasmall=umranda scaled800
% \robustify\footnotesize \robustify\mdseries
% \catcode`\§\active\def§{\par\nobreak\vspace*{-\parskip}\nobreak}
% \catcode`\¤\active\let¤\quad
@@ -292,9 +297,11 @@ and etextools-examples.tex
% \definecolor{cream}{rgb}{1.00,1.00,0.77} \definecolor{db}{rgb}{0.00,0.00,0.25}
% \newrobustcmd\black{\color{black}} \newrobustcmd\blue{\color{blue}}
% \renewcommand*\MacroFont{\usefont{T1}{lmtt}{m}{n}\macrocodecolor}
-% \pretocmd\macrocode{\def§{\IeC{\S}}}{}{} \apptocmd\macro@font{\macrocodecolor\let\AltMacroFont\macro@font}{}{}
+% \pretocmd\macrocode{\def§{\IeC{\S}}\let¤\textcurrency}{}{}
+% \apptocmd\macro@font{\macrocodecolor\let\AltMacroFont\macro@font}{}{}
% \definecolor{reflink}{rgb}{1.00,0.00,0.00} \definecolor{reflinkabstract}{rgb}{0.79,0.00,0.00}
-% \definecolor{rmklink}{rgb}{.2,.2,.2} \let\reflink\rmklink
+% \definecolor{rmklink}{rgb}{.2,.2,.2}
+% \def\reflink{\ifx\current@color\default@color \rmklink\else\let\current@color\reflink@color\set@color\fi}\let\reflink@color\current@color
% \definecolor[\rmkcolor]{rmk}{gray}{.35} \definecolor{copper}{rgb}{0.71,0.45,0.02}
% \definecolor{dg}{rgb}{0.16,0.33,0.00} \definecolor{ddg}{rgb}{0.11,0.21,0.00}
% \definecolor{shadecolor}{rgb}{0.93,0.94,0.81}^^A for framed
@@ -304,7 +311,7 @@ and etextools-examples.tex
% \newrobustcmd\hint{\rmk\everypar{\marginpar{\footnotesize\textcolor{rmk}{hint}$\bigstar$}\everypar{}}}
% ^^A\setul{2pt}{1pt}
% \newrobustcmd\eol{\textcolor[gray]{.5}{$\hookleftarrow$}}
-% \newrobustcmd\mysep[1][\blue]{\PRM[#1]{sep}}
+% \newrobustcmd\mysep[1][\blue]{{\smaller[2]\PRM[#1]{sep}}}
% \newrobustcmd\itemitemitem{\@ifstar\itemitemitem@star\itemitemitem@nost}
% \newrobustcmd\itemitemitem@star[1][\mysep]{\textvb{item}#1\textvb{item}#1\textvb{item}}
% \newrobustcmd\itemitemitem@nost[1][\mysep]{\{\textvb{item}#1\textvb{item}#1\textvb{item}\}}
@@ -316,7 +323,8 @@ and etextools-examples.tex
% \xdef\cmdlabel@name{\cmdlabel@name}\endgroup
% \cslet{\detokenize{cmdlabel->}\cmdlabel@name}\@empty
% \immediate\write\@mainaux{\cmdLabel{\cmdlabel@name}} \hyperdef{cmdlabel}{\cmdlabel@name}{}}
-% \newrobustcmd*\cmdref{\@ifstar{\@dblarg\cmdrefst}{\@ifchar={\@dblarg\cmdrefeq}{\@dblarg\@cmdref}}}
+% \newrobustcmd*\cmdref{\let\reflink@color\current@color
+% \@ifstar{\@dblarg\cmdrefst}{\@ifchar={\@dblarg\cmdrefeq}{\@dblarg\@cmdref}}}
% \def\cmdrefst[#1]#2{\@cmdref[impl:#1]{#2}}
% \def\cmdrefeq[#1]#2{\def\cmdref@display##1{\underline{\mbox{\reflink\vb ##1}}}\cmd@hyper[#1]{#2}}
% \newcommand\cmdrefdisplay[1]{\underline{\mbox{\reflink\vb\textbackslash #1}}}
@@ -458,7 +466,7 @@ and etextools-examples.tex
% {\llap{\hbox to\thesecwidth{I\textbullet\arabic{subsection}\hfil{\fecc\manerrarrow}\hfil}}}\z@{}%
% \titlespacing\subsection\z@{6pt plus4pt minus2pt}{3pt plus2pt minus1pt}%
% \titleformat\subsubsection[hang]{\large\bfseries}
-% {\llap{\hbox to\thesecwidth{I\textbullet\arabic{subsection}\textbullet\arabic{subsubsection}\hfil{\fecc--}\hfil}}}\z@{}%
+% {\llap{\hbox to\thesecwidth{I\textbullet\arabic{subsection}\textbullet\arabic{subsubsection}\hfil{\fecc--}\hfil}}}\z@{}%
% }%
% ^^A\renewcommand\sectionmark[1]{\addcontentsline{cmd}{section}{\protect\numberline{I.\arabic{subsection}}##1}}}
% \newrobustcmd\firstsubsecformat{%
@@ -489,21 +497,35 @@ and etextools-examples.tex
% \begingroup \movepage{2cm}\voffset-1.5\baselineskip \skip\footins=-1.5cm
% \tocloftpagestyle{toc}
% \pretocmd\pagenumberdisplay{\vspace*{1cm}}{}{} \enlargethispage{1.5cm}
-%
-% \definecolor{reflink}{gray}{0}
-% \printtitlepage
+% \definecolor{reflink}{gray}{0}\makeatletter
+% \newrobustcmd\corner[2][\spot\umranda]{\hbox{#1\rlap{\char'115}\char'#2}}
+% \setbox\helpbox\vbox to\z@{\lineskip-1.3pt\baselineskip\lineskip
+% \parshape 9 -1.5ex \z@ -3ex \z@ -4.3ex \z@ -5ex \z@ -5.6ex \z@ -5ex \z@ -4.3ex \z@ -3ex \z@ -1.5ex \z@\relax
+% \noindent\rlap{\Large\leftmoon\corner[\spot\umrandasmall]{17}}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon}\strut\linebreak
+% \rlap{\Large\leftmoon\corner[\spot\umrandasmall]{21}}\vss}
+% \newsavebox\myb \setbox\myb\vtop to\z@{\hbox{\rlap{\lower1.9ex\hbox{\spot\umranda\char'111}}\lower17.2ex\hbox{\lower1.9ex\hbox{\spot\umranda\char'111}}}\vss}
+% \setbox\helpboxx\vbox{\hbox to\z@{\hbox to\hsize{\hfil\copy\helpbox\cleaders\copy\myb\hskip14cm\reflectbox{\copy\helpbox}\hfil}\hss}\printtitlepage}
+% \box\helpboxx
+% ^^A\printtitlepage
% \AddBookMark{attr{/F 2}goto page 1{/FitH}{etextools}}
%
% \begingroup\makeatletter\parfillskip\z@
% ^^A\cftsetpnumwidth{0pt}
% \renewcommand\cfttoctitlefont{\mydotleader{.5ex}\hfill\kern.5em\Large\bfseries}
-% \renewcommand\cftaftertoctitle{\kern.5em\mydotleader{.5ex}\hfill\kern\z@\par\vskip-8pt}
+% \renewcommand\cftaftertoctitle{\kern.5em\mydotleader{.5ex}\hfill\kern\z@\par\vskip-12pt}
% \renewcommand\cftpartleader{\kern.4em\mydotleader{.4ex}\hfill\hbox to\z@{\mydotleader{.4ex}\hskip\@pnumwidth\kern\z@\hss}}
% \cftbeforesubsecskip=-.7ptplus.01fil
-% \cftbeforesecskip=3ptplus.01fil
+% \cftbeforesecskip=2ptplus.01fil
% \definecolor{reflink}{rgb}{0.37,0.00,0.37}
% ^^A\immediate\write18{copy \jobname.tocc \jobname.toc}
-% \vskip-6pt\tableofcontents
+% \vskip-2pt\tableofcontents
% \vskip-2\parskip\leavevmode\mydotleader{0pt}\hfill\kern0pt\par\vskip-\parskip
% \endgroup ^^A\the\pagetotal
%
@@ -545,7 +567,7 @@ and etextools-examples.tex
% ^^A END OF FIRST PAGE ----------------------------------------------------------------------------------------------
% \clearpage
% \endgroup
-%
+% ^^A\stop
% \begingroup \movepage{1cm}
% \Section*{Introduction}
% \addcontentsline{toc}{section}{\hskip\cftsecnumwidth\texorpdfstring\dr{} Introduction}
@@ -628,10 +650,10 @@ and etextools-examples.tex
% \renewcommand\listcommandname{\makecellbox[bc]{\thispackage\\[-1ex]List of Commands Provided}}
% \cftaftercmdtitleskip=6pt
% \cftbeforesecskip=2pt plus.1fil
-% \cftbeforecommandskip=2.2pt plus.1fil
+% \cftbeforecommandskip=2pt plus.1fil
% \tocloftpagestyle{empty}\catcode`\+ 12 \catcode`\! 12
% \pdfdest name{ListOfCommands} xyz\hyperdef{Part}{ListOfCommands}{}
-% \addtocontents{toc}{\protect\contentsline{part}{\protect\colorbox[rgb]{1.00,1.00,0.79}{\protect\hyperref{}{Part}{ListOfCommands}{\blue List of commands}}}{}{}}
+% \addtocontents{toc}{\protect\contentsline{part}{\protect\colorbox[rgb]{1.00,1.00,0.79}{\protect\hyperref{}{Part}{ListOfCommands}{\blue List of commands}}}{}{}}
% \vspace*{-18mm}\listofcommand
% \AddBookMark{attr{/F 2/C[0 0 1]}goto name{ListOfCommands}{List of commands}}
% \clearpage
@@ -860,6 +882,12 @@ and etextools-examples.tex
%
% \begin{ltxsyntax}
%
+% \cmditem+{thefontname}
+%
+% \csbf{thefontname} will display (in Computer Modern font at 10 points) the name of the current font selected.
+% Something like:§
+% \qquad|select font musix11 at 10.0pt|
+%
% \cmditem{showcs}{ csname }
%
% \cs{showcs}\FE does \cs{show} on the named control sequence.
@@ -1110,7 +1138,7 @@ and etextools-examples.tex
% \end{VerbLines}
%
% {\rmk \cs{ifOneChar} is used in \cmdref{detokenizeChars} }
-%
+%
% \cmditem-{ifOneCharWithBlanks}{ string }{ true }{ false }
%
% \csbf{ifOneCharWithBlanks}\FEII switches to \prm{true} if and only if \prm{string} contains a single \textsfbf{character}
@@ -1326,8 +1354,8 @@ and etextools-examples.tex
%
% To tell all the truth, \cs{ifstrnum} expands \prm{true} even if digits have a category code$\neq 12$ whereas
% |\number| throws an error or stops.
-% But if numbers and minus signs are of category 12 (more than recommended after all...) \cs{ifstrnum} may be
-% a test to check if it is possible to expand |\number| (or |\romannumeral|) onto \prm{string}.
+% But if numbers and minus signs are of category 12 (more than recommended after all...) {\sfbf\spot\csbf{ifstrnum} may be
+% a test to check if it is possible to expand \csbf{number} {\md(or \cs{romannumeral})} onto \prmb{string}.}
% \bigbreak
%
% \ClearPage
@@ -1405,7 +1433,9 @@ and etextools-examples.tex
% {\rmk \cs{CompareYES} and each of its form are purely expandable thank to \cmdref{FE@modifiers}.}
%
% You should not test a \prm{string} which contains the following sequence:§
-% \hfill\colorbox{ly}{$/__3$E$__{11}$n$__{11}$d$__{11}\S__8$S$__{11}$t$__{11}$r$__{11}$i$__{11}$n$__{11}$g$__{11}/__3$}\hfill\kern0pt\par
+% \hfill\colorbox{ly}{$/__8$E$__{11}$n$__{11}$d$__{11}\S__7$S$__{11}$t$__{11}$r$__{11}$i$__{11}$n$__{11}$g$__{11}/__8$}\hfill\kern0pt\par
+%
+% {\rmk nor a string which contains \CH{\chcat/8} because \chcat/8 has a special meaning for \thispackage-\cmdref*{ettl@nbk}.}
%
% \end{ltxsyntax}
%
@@ -1490,7 +1520,7 @@ and etextools-examples.tex
% If you don't care on pure-expandability, you may define macros with modifiers yet more easily with
% the \cmdref={macromodifiers} environment.
% \fi
-%
+%
% \cs{FE@modifiers} works as follow:\par\nobreak
% \begin{enumerate}[label=\arabic*)~,beginpenalty=10000]
% \item it checks if \#1 is a single character (\cmdref{ifOneToken} does the job)
@@ -1546,7 +1576,7 @@ and etextools-examples.tex
%
% The \stform* star form of \cs{AfterGroup} does the same, but expands its argument with |\edef|:§§
% \begin{VerbLines}[commandchars=!()]
-%!md \newcommand(!copper\macro)[1]{\textbf{Just to see...!#1}}
+%!md \newcommand(!copper\macro)[1]{\textbf{Just to see...!#1}}
% (!dg\begingroup)
%!md \newcommand(!copper\othermacro)[1]{\textbf{will we see...!#1}}
% (!red\AfterGroup)!md{(!copper\macro){if it works}}
@@ -1630,17 +1660,17 @@ and etextools-examples.tex
%
% \cmditem+{futuredef}[ list of allowed tokens ]{ \cs{macro} }{ commands to expand after }
% \cmditem-{futuredef\stform*}[ list of allowed tokens ]{ \cs{macro} }{ commands to expand after }
-% \end{ltxsyntax}
%
-% \csbf{futuredef}\notFE\ will read the following token with \csbf{futurelet}. If that token is in the
+% \csbf{future\spot def}\notFE\ will read the following token with \csbf{future\blue let}. If that token is in the
% \prm{list of allowed tokens}, then it will append it to \cs{macro} and continue, scanning the tokens one after another.
-%
+% \end{ltxsyntax}
+%
% Until it founds a token which is not in the \prm{list of allowed tokens}. Then it stops reading
% and executes the \prm{commands to expand after}. Those commands may use the \cs{macro}
% just defined for analyse or whatever the user want.
%
% The space token must be \textbfsf{explicitly specified} in the \prm{list of allowed tokens}:
-% otherwise \cs{futuredef} stops at a space (and execute the \prm{commands to expand after}).
+% otherwise \cs{futuredef} stops at a space (and executes the \prm{commands to expand after}).
%
% \textbfsf{A token is in the \prmb{list of allowed tokens} \textcolor{blue}{if it can be found in this list using
% the \cmdref={character-test}}.} This means that if \cs[\blue]{relax} is in the \prmb{list of allowed tokens}, then it will
@@ -1699,21 +1729,19 @@ and etextools-examples.tex
% \endswitch
% \end{VerbLines}
%
-% \CSbf{switch} is purely expandable when used with \cs{pdfstrcmp} (pdf\TeX{}).
-%
-% See \xpackage{boolexpr} (\CTAN{macros/latex/contrib/boolexpr/}) for more information on \cs{switch}.
+% \CSbf{switch} is purely expandable. See \Xpackage{boolexpr} for more information on \cs{switch}.
%
% \begin{ltxsyntax}
% \cmditem{futuredef\stform=}[ list of allowed tokens ]{ \cs{macro} }{ commands to expand after }
% \cmditem-{futuredef\stform*\stform=}[ list of allowed tokens ]{ \cs{macro} }{ commands to expand after }
-% \end{ltxsyntax}
%
% The \CH{\stform=} form\notFE\ of \cs{futuredef} is the same as \cs{futuredef} but the checking of single characters
% is sensitive to their category code. If a control sequence is in the \prm{list of allowed tokens} it is appended to \cs{macro}
% (if encountered) just like the normal \cs{futuredef} does. But if it is a single character token, then it is appended to \cs{macro}
% only if the same character with the same ccategory code is found in the \prm{list of allowed tokens}: otherwise, \cs{futuredef}
-% stops reading and execute the \prm{commands to expand after}.
-%
+% stops reading and executes the \prm{commands to expand after}.
+% \end{ltxsyntax}
+%
% In general, we are not willing this behaviour and the \stform= form of \cs{futuredef} would probably never be used, unless you know
% that the \prm{list of allowed tokens} is already detokenized...
% Anyway, it was not difficult at all to \cmdref=[impl:futuredef=]{implement}.
@@ -1878,7 +1906,7 @@ and etextools-examples.tex
% itself, but for the last token in the list, this parameter is the \textsl{give-result-macro}.
% \end{enumerate}
%
-% Definition of \cs{ettl@gettokslist} worth a close look!
+% Definition of \cmdref*{ettl@getsinglelist} worth a close look!
%
% Back to the begining: lists of single tokens are also lists without separator. Therefore, the other standard
% macros \cmdref{toksloop} is provided by the general constructor
@@ -1929,9 +1957,9 @@ and etextools-examples.tex
% \ClearPage
%
% \cmditem+{DeclareCmdListParser}[\cs{global}]{ command }{ separator }
-% \cmditem-{breakloop} \FE*
+% \cmditem-{breakloop}{ code } \FE*
%
-% |\DeclareCmdListParser| acts in the same way as \xpackage{etoolbox}-|\DeclareListParser| and the
+% |\DeclareCmdListParser| acts\notFE\ in the same way as \xpackage{etoolbox}-|\DeclareListParser| and the
% command-list-parsers defined are sensitive to the category codes of the \prm{separator}. This
% \prm{separator} may be any sequence of tokens, but the special sequence:§
% \hfill\colorbox{ly}{$/__8$E$__{11}$n$__{11}$d$__{11}\S__7$L$__{11}$i$__{11}$s$__{11}$t$__{11}$/$__8$}\hfill\kern0pt§
@@ -1990,8 +2018,8 @@ and etextools-examples.tex
% ($nnn or:) ($copper\MyParser)$stform+ $itemitemitem
% ($nnn or:) ($copper\MyParser)$stform+ $UserCmd$itemitemitem
% ($nnn or:) ($copper\MyParser) [$stform(n)]\myList ($nnn expands to item$textsubscript(n))
-% ($nnn or:) ($copper\MyParser) [$stform(n)]$itemitemitem ($nnn expands to item$textsubscript(n))
-% ($nnn or:) ($copper\MyParser)$stform! \myList ($nnn expands to the number of elements)
+% ($nnn or:) ($copper\MyParser) [$stform(n)]$itemitemitem ($nnn expands to item$textsubscript(n))
+% ($nnn or:) ($copper\MyParser)$stform! \myList ($nnn expands to the number of elements)
% ($nnn or:) ($copper\MyParser)$stform! $itemitemitem ($nnn expands to the number of items)
%
% ($nnn or:) $mdfs($copper\MyParser)$stform* $itemitemitem
@@ -2001,7 +2029,10 @@ and etextools-examples.tex
% ($nnn or:) $mdfs($copper\MyParser)$stform*$stform!$UserCmd$itemitemitem
% \end{VerbLines}
%
-% It's possible to break the loop by saying \csbf[\red]{breakloop} in your \cs[\dg]{UserCommands}.
+% It's possible to break the loop by saying \csbf[\red]{breakloop} in your \cs[\dg]{UserCommands}. \csbf{breakloop} will
+% gobble anything until the end-of-list delimiter
+% (\footnotesize\colorbox{ly}{$/__8$E$__{11}$n$__{11}$d$__{11}\S__7$L$__{11}$i$__{11}$s$__{11}$t$__{11}$/$__8$})
+% and will append the \textbf{mandatory} parameter \prmb{code} after.
%
% \CH{\stform+\stform*} and \CH{\stform*\stform+} are identical, as well as \CH{\stform!\stform*} and \CH{\stform*\stform!}.
% \ClearPage
@@ -2023,7 +2054,7 @@ and etextools-examples.tex
% very close to \LaTeX's |\@for|: see \cmdref{forcsvloop} for more explanation.
%
% \end{ltxsyntax}
-%
+%
% \ClearPage
% \Subsection{Loops into lists}
%
@@ -2049,11 +2080,11 @@ and etextools-examples.tex
% ($nnn and applies ($blue$CSbf(do)) sequentially to each element of the comma-separated list.)
% ($nnn($blue$CSbf(do)) is a user command of the form:)
% macro: $#1 -> {($nnn something to do with ($vbbf$#1 = item)) }
-% ($nnn The star form ($red$vbbf\csvloop$stform[$rred]*) ($nbf may be) used when ($vbbf$copper\mylist) is already expanded.)
-% ($nnn The plus form ($red$vbbf\csvloop$stform[$rred]+) ($nbf is) used when) $CSbf[$blue](do) ($nnn is of the form:)
+% ($nnn The star form ($red$vbbf\csvloop$stform[$rred]*) ($nitbf may be) used when ($vbbf$copper\mylist) is already expanded.)
+% ($nnn The plus form ($red$vbbf\csvloop$stform[$rred]+) ($nitbf is) used when) $CSbf[$blue](do) ($nnn is of the form:)
% macro: [$#1]$#2 -> {($nnn something to do with ($vbbf$#1=index) and ($vbbf$#2=item)) }
% ($nnn If) $CSbf[$blue](do) ($nnn is in fact a number:)
-% ($red\csvloop)[($blue4)]($copper\mylist) ($nnn will expand to the($nbf fifth) element of )($copper\mylist)
+% ($red\csvloop)[($blue4)]($copper\mylist) ($nnn will expand to the($nitbf fifth) element of )($copper\mylist)
% ($red$vbbf\csvloop$stform[$rred]!)($copper\mylist) ($nnn will expand to the number of elements in) ($copper\mylist)
% \end{VerbLines}
%
@@ -2070,6 +2101,7 @@ and etextools-examples.tex
% \csbf{listloop}\FE is designed to work with \xpackage{etoolbox} lists (lists with \CH{\stform[\blue]\textbar$_3$} as separator).
% \cs{listloop} enhances \xpackage{etoolbox}-|\dolistloop| with an optional argument to change
% the default auxiliary command |\do| to apply to each item of the list, a \stform+ form a \stform! form and a \stform* form.
+% It behaves exactly as \cmdref{csvloop} does.
%
% \cmditem[toksloop]@{toksloop\tsptb toksloop\stform+\tsptb toksloop\stform!}
% \cmditem-{toksloop}[ auxiliary commands ]{ tokenslistmacro or list of single tokens } \FE*
@@ -2078,6 +2110,12 @@ and etextools-examples.tex
% \cmditem[toksloop*]-{toksloop\stform*(\stform+)(\stform!)}[ auxiliary commands ]{ list of single tokens } \FE*
%
% \csbf{toksloop}\FE is a list parser for lists without separator (\cmdref={list of single tokens}).
+%
+% With \cs{toksloop} you are able to count the number of characters in a string:§§
+% \begin{VerbLines}[commandchars=$()]
+% ($red\toksloop$stform[$rred]!){abcdef} $smex 6
+% \end{VerbLines}
+% Spaces are not counted, however...
% \ClearPage*
%
% \cmditem[forcsvloop]+@{forcsvloop\tsptb forcsvloop\stform+}
@@ -2106,9 +2144,9 @@ and etextools-examples.tex
%
% Of course, those macros are NOT purely expandable... They are automatically defined by \cmdref{DeclareCmdListParser}
% with the name: \csbf{\red for\md\copper name-of-parser}.
-%
-% The \stform+ form of \cs{forcsvloop} et al. are relative to the \stform+ form of \cs{csvloop} et al.:
-% \#1 is the index and \#2 the element.
+%
+% The \stform+ form of \cs{forcsvloop} et al. are relative to the \stform+ form of \cs{csvloop} et al.:
+% \#1 is the index and \#2 the element. There is no \stform! form.
%
% \end{ltxsyntax}
%
@@ -2125,12 +2163,12 @@ and etextools-examples.tex
% \csbf{csvlistadd}\notFE adds an item to a csvlist. \cs{csvlisteadd} expands the \prm{item}
% (with |\protected@edef|) \textsfbf{before} appending it to \prm{csvListmacro}, whilst with \cs{csvlistgadd}
% the final assignment to \prm{csvListmacro} is global. Finally, \cs{csvlistxadd} both expands the \prm{item}
-% and make the assignment global.
+% and makes the assignment global.
%
% These macros are robust.
% \end{ltxsyntax}
% \ClearPage\enlargethispage{2\baselineskip}
-%
+%
% \Subsection{Converting lists}
%
% Since \cmdref=[DeclareStringFilter]{string filters} are sensitive to the category code of the caracters, it is always possible
@@ -2151,12 +2189,14 @@ and etextools-examples.tex
% (!dg\edef)(!copper\myNewList){\csvloop[(!red\do)](!copper\mycsvlist)}
% \end{VerbLines}
%
-% Nevertheless, some conversion could be used very often and \thispackage provides a few macros to convert
+% Nevertheless, some conversions could be used very often and \thispackage provides a few macros to convert
% lists easily:
%
% \begin{ltxsyntax}
% \ClearPage
-% \cmditem{csvtolist}[ target: Listmacro ]{ source: csvlistmacro \textsfsl{or} \itemitemitem*[{\stform[\blue],}]}
+%
+% \cmditem[csvtolist]@{csvtolist\tsptb tokstolist\tsptb listtocsv}
+% \cmditem-{csvtolist}[ target: Listmacro ]{ source: csvlistmacro \textsfsl{or} \itemitemitem*[{\stform[\blue],}]}
% \cmditem-{csvtolist\stform*}[ target: Listmacro ]{ source: \itemitemitem*[{\stform[\blue],}] } \FE*
%
% \csbf{csvtolist}\FE converts a comma separated list into an internal \xpackage{etoolbox} list. It is useful to insert more than one item
@@ -2169,24 +2209,15 @@ and etextools-examples.tex
%(!nnn!rmk* N.B.: the items are not expanded.)
% \end{VerbLines}
%
-% The \stform* star form is seldom used: it is there to inhibits the expansion of \prm{source: item,item,item}. But expansion
-% occurs only if this parameter is a single control word...
+% The \stform* star form is seldom used: it is there to inhibits the expansion of \prm{source: \itemitemitem*[{\stform[\blue],}]}.
+% But expansion occurs only if this parameter is a single control word...
% \ClearPage
%
-% \cmditem{csvtolistadd}{ target: Listmacro }{ source: csvlistmacro \textsfsl{or} \itemitemitem*[{\stform[\blue],}]}
-% \cmditem-{csvtolistadd\stform*}{ target: Listmacro }{ source: \itemitemitem*[{\stform[\blue],}] }
-%
-% \csbf{csvtolistadd}\notFE\ acts similarly but both arguments are mandatory:§§ \def\etbsep{\stform[\blue]\textbar$__3$\!\!\!}
-% \begin{VerbLines}[commandchars=!(),codes={\catcode`\$=3}]
-% \listadd(!copper\myList){one} \listadd(!copper\myList){two}
-% (!red\csvtolistadd)(!copper\myList){three,four,five}
-% \meaning\myList: macro:->one!etbsep two!etbsep three!etbsep four!etbsep five!etbsep
-% \end{VerbLines}
-%
-% \cmditem{tokstolist} [ target: Listmacro ]{ source: tokenslistmacro \textsfsl{or} list of single tokens }
+% \cmditem[listtocsv]-{tokstolist} [ target: Listmacro ]{ source: tokenslistmacro \textsfsl{or} list of single tokens }
% \cmditem-{tokstolist\stform*}[ target: Listmacro ]{ source: list of single tokens } \FE*
%
% \csbf{tokstolist}\FE converts a list of tokens (no separator) into an internal \xpackage{etoolbox} list:§§
+% \newcommand\etbsep{\stform[\blue]\textbar$__3$\!\!\!}
% \begin{VerbLines}[commandchars=!()]
% (!red\tokstolist)[(!copper\myList)]{\alpha\beta\gamma\ifeof+*$}
% (!nnn is the same as:)
@@ -2198,16 +2229,8 @@ and etextools-examples.tex
%
% This is also the first application of the \cmdref{toksloop} macro just defined.
%
-% \cmditem{tokstolistadd} { target: Listmacro }{ source: tokenslistmacro \textsfsl{or} list of single tokens}
-% \cmditem-{tokstolistadd\stform*}{ target: Listmacro }{ source: list of single tokens }
-%
-% \csbf{tokstolistadd}\notFE\ acts similarly but both arguments are mandatory.
-%
-% The \stform* star-form inhibits the expansion of \prm{source} (which otherwise occurs only if \prm{source}
-% is a single control word).
-%
-% \cmditem{listtocsv}[ target: csvlistmacro ]{ source: Listmacro \textsfsl{or} expanded List }
-% \cmditem-{listtocsv\stform*}[ target: csvlistmacro ]{ source: Listmacro \textsfsl{or} expanded List }
+% \cmditem[listtocsv]-{listtocsv}[ target: csvlistmacro ]{ source: Listmacro \textsfsl{or} expanded List }
+% \cmditem-{listtocsv\stform*}[ target: csvlistmacro ]{ source: Listmacro \textsfsl{or} expanded List } \FE*
%
% \csbf{listtocsv}\FE converts an \xpackage{etoolbox}-List into a comma separated list. Be aware that the items in the
% list does not contain commas (\cs{listtocsv} does not check this point!):§§
@@ -2218,6 +2241,25 @@ and etextools-examples.tex
%(!nnn!rmk* N.B.: the items are not expanded.)
% \end{VerbLines}
%
+% \cmditem[csvtolistadd]@{csvtolistadd\tsptb tokstolistadd}
+% \cmditem-{csvtolistadd}{ target: Listmacro }{ source: csvlistmacro \textsfsl{or} \itemitemitem*[{\stform[\blue],}]}
+% \cmditem-{csvtolistadd\stform*}{ target: Listmacro }{ source: \itemitemitem*[{\stform[\blue],}] }
+%
+% \csbf{csvtolistadd}\notFE\ acts similarly but both arguments are mandatory:§§
+% \begin{VerbLines}[commandchars=!(),codes={\catcode`\$=3}]
+% \listadd(!copper\myList){one} \listadd(!copper\myList){two}
+% (!red\csvtolistadd)(!copper\myList){three,four,five}
+% \meaning\myList: macro:->one!etbsep two!etbsep three!etbsep four!etbsep five!etbsep
+% \end{VerbLines}
+%
+% \cmditem[tokstolistadd]-{tokstolistadd} { target: Listmacro }{ source: tokenslistmacro \textsfsl{or} list of single tokens}
+% \cmditem-{tokstolistadd\stform*}{ target: Listmacro }{ source: list of single tokens }
+%
+% \csbf{tokstolistadd}\notFE\ acts similarly but both arguments are mandatory.
+%
+% The \stform* star-form inhibits the expansion of \prm{source} (which otherwise occurs only if \prm{source}
+% is a single control word).
+%
% \end{ltxsyntax}
% \ClearPage*
%
@@ -2255,13 +2297,13 @@ and etextools-examples.tex
% \cmditem-{listedel}[ deleted $n$ times ]{ Listmacro }{ item }
% \cmditem-{listxdel}[ deleted $n$ times ]{ Listmacro }{ item }
%
-% The \cs{listdel}\notFE\ command removes the element \prm{item} from the list \prm{Listmacro}. Note that the
+% The \csbf{listdel}\notFE\ command removes the element \prm{item} from the list \prm{Listmacro}. Note that the
% \prm{Listmacro} is redefined after deletion. If the list contains more than one element equal to \prm{item}
% each is removed.
%
-% \cs{listedel} expands the \prm{item} (with |\protected@edef|) \textsfbf{before} deletion, whilst with \cs{listgdel}
-% the final assignment to (the \emph{shortened}) \prm{Listmacro} is global. Finally, \cs{listxdel} both expands the \prm{item}
-% and make the assignment global.
+% \csbf{listedel} expands the \prm{item} (with |\protected@edef|) \textsfbf{before} deletion, whilst with \csbf{listgdel}
+% the final assignment to (the \emph{shortened}) \prm{Listmacro} is global. Finally, \csbf{listxdel} both expands the \prm{item}
+% and makes the assignment global.
%
% If the optional parameter \prm{deleted $n$ times} is specified as a control sequence, the macro does the same but
% but assigns to this control sequence the number of times \prm{item} has been found in the list. If this parameter
@@ -2312,7 +2354,7 @@ and etextools-examples.tex
%
% \end{ltxsyntax}
%
-% Sometimes it is interesting to know at which offset in a list lies a given item. |\getlistindex| answers to this question.
+% Sometimes\notFE\ it is interesting to know at which offset in a list lies a given item. |\getlistindex| answers to this question.
% |\xgetlistindex| does the same thing but expands the \prm{item} while looking for it in the list.
%
% As for the command-list-parser, the star versions are designed in case the list (in the second argument) is already expanded.
@@ -2335,12 +2377,42 @@ and etextools-examples.tex
% \cmditem-{xgetcsvlistindex*}[result-index(counter or macro)]{item}{item,item,item,...}
% \end{ltxsyntax}
%
-% This is the same as \cmdref{getlistindex} but for comma-separated lists.
+% This\notFE\ is the same as \cmdref{getlistindex} but for comma-separated lists.
%
% As for the command-list-parser, the star versions are designed in case the list (in the second argument) is already expanded.
%
% If \prm{result-index} is not a counter it is (possibly \textit{re-})defined as macro.
%
+% \subsection[\texorpdfstring\blue{}Arithmetic: lists of numbers]{Arithmetic: lists of numbers}
+%
+% \begin{ltxsyntax}
+% \cmditem+{interval}{ number }{ sorted comma separated list of numbers }
+%
+% \csbf{interval}\FE will expand to the interval of \prm{number} into the \prm{sorted csv list of numbers}:§§
+% \begin{VerbLines}[commandchars=!()]
+% (!red\interval){0}{3,5,12,20} (!nnn will expand to ) 0
+% (!red\interval){3}{3,5,12,20} (!nnn will expand to ) 1
+% (!red\interval){4}{3,5,12,20} (!nnn will expand to ) 1
+% (!red\interval){5}{3,5,12,20} (!nnn will expand to ) 2
+% (!red\interval){19}{3,5,12,20} (!nnn will expand to ) 3
+% (!red\interval){20}{3,5,12,20} (!nnn will expand to ) 4
+% (!red\interval){21}{3,5,12,20} (!nnn will expand to ) 4
+% \end{VerbLines}
+%
+% \cmditem+{locinterplin}{ number }{ sorted csv list of numbers }{ csv list of numbers }
+%
+% \abovedisplayskip=2pt \belowdisplayskip=2pt
+%
+% \csbf{locinterplin}\FE will locally and linearly interpolate the series $Y_i$ in \prm{csv list of numbers}:§
+% \hfill \csbf[\red]{locinterplin}\mprm{\dg$X$}\mprm{\dg$X_i$}\mprm{\blue$Y_i$} \hfill\null
+% $$\llap{finds $i$ such that:¤¤} \dg X_i\leqslant X\leqslant X_{i+1}$$
+% and expands to the local linear interpolation $\blue Y$:
+% $${\blue Y} = {\blue Y_i} + \dfrac{\dg X-X_i}{\dg X_{i+1}-X_i} \left({\blue Y_{i+1}-Y_i}\right)$$
+%
+% $\dg X_i$ and $\blue Y_i$ must have the same number of elements.
+%
+% \end{ltxsyntax}
+%
% \StopEventually{
% }
%
@@ -2351,7 +2423,8 @@ and etextools-examples.tex
% \Section*{Implementation} \refstepcounter{section}%
% ^^A\addcontentsline{toc}{section}{\texorpdfstring\dr{}\hskip\dimexpr\cftsecnumwidth-4pt Implementation}^^A do not add to .cmd file
% \addcontentsline{toc}{section}{\protect\numberline{I}\cftsecfont Implementation}^^A do not add to .cmd file
-% \addtocontents{toc}{\cftbeforesubsecskip=-2pt plus\gluestretch\cftbeforesubsecskip\relax}
+% \addtocontents{toc}{\cftbeforesubsecskip=-2pt plus\gluestretch\cftbeforesubsecskip\relax
+% \renewrobustcmd\noexpand\cftsubsecfont{\footnotesize}}
% \renewcommand\thesubsection{I.\arabic{subsection}}^^A for toc
%
% \Subsection{Package identification}
@@ -2360,7 +2433,7 @@ and etextools-examples.tex
%<*package>
\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
% \end{macrocode}
%
@@ -2419,7 +2492,7 @@ and etextools-examples.tex
}
\AtEndOfPackage{\ettl@AtEnd\undef\ettl@AtEnd}
% \end{macrocode}
-%
+%
% \Subsection{Some ``helper'' macros}
%
% \iffalse
@@ -2429,7 +2502,7 @@ and etextools-examples.tex
%
%\begin{macro}{helper macros} \FE
% \begin{macrocode}
-\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}
@@ -2479,7 +2552,7 @@ and etextools-examples.tex
% \begin{macro}{\ettl@onlypdfTeX}
% This is an \textit{internal macro} used by the package: if the \prm{primitive}
% in \#1 is available (\eg \cs{pdfstrcmp}) then the \prm{command} in \#2
-% can be defined, otherwise, the \prm{command} is \cs{let} to the optional argument \#3.
+% can be defined, otherwise, the \prm{command} is \cs{let} to the optional argument \#3.
% If there is no such optional argument, the \prm{command} throws an error (\eg \cs{ifstrmatch}).
% \begin{macrocode}
\def\ettl@onlypdfTeX#1#2{\@testopt{\ettl@only@pdfTeX{#1}{#2}}{}}
@@ -2594,7 +2667,7 @@ and etextools-examples.tex
% it appears to be better to put it in a macro. It's aim is to reverse the
% mechanism of |\csname|...|\endcsname|:
% \begin{macrocode}
-\newcommand*\@gobblescape{\romannumeral0\expandafter\@gobble\string}
+\newcommand*\@gobblescape{\romannumeral-`\q\expandafter\@gobble\string}
% \end{macrocode}
% {\rmk May be we could do better, testing first if the next token is a control sequence...}
% \end{Macro}
@@ -2761,6 +2834,18 @@ and etextools-examples.tex
%
% \iffalse
%<package>
+%<package>%% \thefontname
+% \fi
+%
+%\begin{Macro}{thefontname}
+% \begin{macrocode}
+\newcommand\thefontname{{\expandafter\ettl@thefontname\expandafter\strip@meaning\the\font}}
+\font\ettl@thefontname=ecrm1000
+% \end{macrocode}
+%\end{Macro}
+%
+% \iffalse
+%<package>
%<package>%% \showcs { csname }
% \fi
%
@@ -2953,7 +3038,7 @@ and etextools-examples.tex
% inside |\csname|...|\endcsname| like:§
% ¤¤|\ettl@ifx|\prm{tokenA}\prm{tokenB}{first}{second}:
% \begin{macrocode}
-\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}
% \end{macrocode}
% \end{Macro*}
%
@@ -3004,11 +3089,11 @@ and etextools-examples.tex
%<package>
%<package>%% \ifsinglechar character{ string }{ true }{ false }
% \fi
-%
+%
% \begin{Macro}{ifsinglechar}
% Test if \#2 is a single character equal to \#1:
% \begin{macrocode}
-\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
@@ -3071,7 +3156,7 @@ and etextools-examples.tex
\ettl@nbk#2//%
{\ettl@nbk#1//%
{\expandnexttwo\ettl@ifchar{\ettl@car#2\@nil}{\ettl@car#1\@nil}{first}{second}}
- {\if\relax\detokenize{#1}\relax secondoftwo\ettl@csname\fi
+ {\if\relax\detokenize{#1}\relax secondoftwo\ettl@csname\fi
\ettl@firstspace{#2}{first}{second}}//}%
{\ettl@nbk#1//%
{\if\relax\detokenize{#2}\relax secondoftwo\ettl@csname\fi
@@ -3108,7 +3193,7 @@ and etextools-examples.tex
% detokenized while control sequences remain the same:
% \begin{macrocode}
\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}}
% \end{macrocode}
%\end{Macro}
@@ -3143,7 +3228,7 @@ and etextools-examples.tex
first\else second\fi oftwo\endcsname}
% \end{macrocode}
% \end{Macro}
-%
+%
% \iffalse
%<package>
%<package>%% \ifnotempty{ text }{ true }{ false }
@@ -3156,7 +3241,7 @@ and etextools-examples.tex
second\else first\fi oftwo\endcsname}
% \end{macrocode}
% \end{Macro}
-%
+%
% \iffalse
%<package>
%<package>%% \xifempty{ text }{ true }{ false }
@@ -3173,7 +3258,7 @@ and etextools-examples.tex
%<package>
%<package>%% \ifnotblank{ text }{ true }{ false }
% \fi
-%
+%
% \begin{Macro}{ifnotblank}
% \cs{ifnotblank} \CS{ifnotblank} |\ifnotblank| \CSbf{ifnotblank} \textvb{ifnotblank} reverses the test of \cs{ifblank}.
%
@@ -3345,7 +3430,7 @@ and etextools-examples.tex
\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}
@@ -3361,8 +3446,7 @@ and etextools-examples.tex
\fi%\pdfmatch
% \end{macrocode}
%\end{Macro}
-%
-%
+%
% \iffalse
%<package>
%<package>%% \DeclareStringFilter[\global]{ \StringFilterMacro }{ string }
@@ -3576,14 +3660,10 @@ and etextools-examples.tex
%\begin{macro}{\FE@ifcharequal} \FE
% This is the same as \cs{FE@ifstar} but for \CH{=} character (used in \cmdref*{DeclareStringFilter}):
% \begin{macrocode}
-\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
% \end{macrocode}
%\end{macro}
%
@@ -3617,7 +3697,7 @@ and etextools-examples.tex
\expandafter[\romannumeral-`\q\ifnum#2<0 {#3}\fi]{#2}{#1+1}}
% \end{macrocode}
%\end{Macro}
-%
+%
% \iffalse
%<package>
%<package>%% \ettl@supergobble{ p }{ q }{token_1}{token_2}...{token_p}{TOKEN_p+1}{token_p+2}...{token_p+q+1}
@@ -3721,6 +3801,7 @@ and etextools-examples.tex
\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
% \end{macrocode}
% \end{Macro}
%
@@ -3837,9 +3918,9 @@ and etextools-examples.tex
% \begin{macrocode}
\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}}%
@@ -3869,7 +3950,7 @@ and etextools-examples.tex
\long \def \ettl@futuredef@end##1##2/Ne¤t/##3##4{##2\endgroup\def#3{##4}#4##1}%
\futurelet \ettl@x \ettl@futuredef@loop}
% \end{macrocode}
-% \cs{ettl@futuredef@collect} captures the next token (because it was found in the list) and
+% \cs{ettl@futuredef@collect} captures the next token (because it was found in the list) and selectively
% append it to the \textsfsl{result} (the argument of \cs{ettl@futuredef@test}). Then it loops:
% \begin{macrocode}
\long\def\ettl@futuredef@collect#1#2/Ne¤t/#3#4#5{#2%
@@ -3881,7 +3962,8 @@ and etextools-examples.tex
% \end{macrocode}
% \cs{ettl@futuredef@space} gobbles the space token and append a space to the \textsfsl{result}. Then it loops:
% \begin{macrocode}
-\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}{ }}
% \end{macrocode}
% \cs{ettl@futuredef@collectall} is used when no option (no \prm{list of allowed tokens}) has been given to \cs{futuredef}.
% In this case, \cs{futuredef} will stop only at the next begin-group or end-group token:
@@ -3905,54 +3987,72 @@ and etextools-examples.tex
% \begin{macro}{futured@f (starred)}
% \cs{ettl@futured@f} defines the \textsfsl{test-macro} (which is entitled to break the loop) and the \textsfsl{loop-macro}:
% \begin{macrocode}
-\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@space#1#2/Ne¤t/#3#4#5 {%
+ \ettl@futur@def@collect#1#2/Ne¤t/{#3}{#4}{#5}{ }}
% \end{macrocode}
-% \cs{ettl@futured@f@collect} collects the next token which is appended to the argument of \cs{ettl@futured@f@test} (the \textsfsl{result}):
+% \cs{ettl@futured@f@collect} collects the next token which is appended to the argument of \cs{ettl@futured@f@test} (the \textsfsl{result})
+% if it is in the \prm{list of allowed tokens}, otherwise expansion is tried:
% \begin{macrocode}
-\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@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/}
+% \end{macrocode}
+% \cs{ettl@futured@f@collectall} is used when \cs{futuredef*} is called with an empty optional argument:
+% \begin{macrocode}
+\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}}
% \end{macrocode}
-% \cs{ettl@futured@f@expand@nbk} is used when \cs{futuredef*} is called with a non empty optional argument:
+% \cs{ettl@futured@f@space} is used in case the token is a space token:
% \begin{macrocode}
-\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@space#1#2/Ne¤t/#3#4#5 {%
+ \ettl@futur@def@collect#1#2/Ne¤t/{#3}{#4}{#5}{ }}
% \end{macrocode}
-% \cs{ettl@futured@f@expand@bk} is used when \cs{futuredef*} is called with an empty optional argument:
+% \cs{ettl@futured@f@try@expand} checks if the token shall be expanded, or if the loop shall be broken (in case the
+% \prm{list of allowed tokens} is specified) or if this token shall be appended to the result
+% (in case the \prm{list of allowed token} is empty):
% \begin{macrocode}
-\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@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}}
% \end{macrocode}
-% \cs{ettl@futured@f@exp@nd} expands the next token because it is not in the list and
+% \cs{ettl@futured@f@expand} expands the next token because it is not in the list and
% goes back to the loop:
% \begin{macrocode}
-\long\def\ettl@futured@f@exp@nd#1/Ne¤t/{%
- #1\expandafter\futurelet\expandafter\ettl@x\expandafter\ettl@futured@f@loop}
+\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}
% \end{macrocode}
-% \cs{ettl@futured@f@space} gobbles the space token, append it to the result (the argument of \cs{ettl@futured@f@test})
-% and goes further in the loop:
+% \cs{ettl@futured@f@CheckSpecials} checks if the token is undefined or a |\if|... or |\else| etc. This is compulsory
+% because we do not have to attempt expansion of such tokens (unless we want to get an error from \TeX):
% \begin{macrocode}
-\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@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}}
+% \end{macrocode}
+% Finally, \cs{ettl@futured@f@append} appends the token to the result and goes back to the loop:
+% \begin{macrocode}
+\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}%
% \end{macrocode}
% \end{macro}
%
@@ -4000,14 +4100,14 @@ and etextools-examples.tex
% \cs{ifincharlist}\prm{character or token}\prm{list of single characters or tokens} is the same, with a
% different test macro: \cs{ettl@ifchar} is used instead of \cs{ettl@ifx}:
% \begin{macrocode}
-\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@}{}}
% \end{macrocode}
%\end{Macro}
%\end{Macro*}
@@ -4017,10 +4117,10 @@ and etextools-examples.tex
% avoids overhead due to the parsing of modifiers:
% \begin{macrocode}
\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/}
% \end{macrocode}
%\end{macro}
%
@@ -4069,15 +4169,19 @@ and etextools-examples.tex
% \end{macrocode}
% \cs{ettl@getsinglelist} initiates the loop (we test if the list or the \prm{item} is empty first):
% \begin{macrocode}
-\long\def\ettl@getsinglelist#1#2{\ettl@singlelist@loop{#1}{-1}{-1}{}#2//%
- \ettl@singlelist@loop\ettl@singlelist@result/End§List/}
+\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/}
% \end{macrocode}
% \cs{ettl@singlelist@loop} tests each token and update registers:
% \begin{macrocode}
-\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/}
+\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/}
% \end{macrocode}
% Well! \#1 is the \textsl{test-macro} to test against \#5, the current token of the list.
@@ -4093,8 +4197,8 @@ and etextools-examples.tex
%
% \cs{ettl@tokslist@result} extracts the |count|, the |index| and the |token| from the parameters of the \textsl{test-macro}:
% \begin{macrocode}
-\def\ettl@singlelist@result#1#2#3#4#5/End§List/{\ExpandNextTwo\@swaptwo%
- {\number\numexpr\ifempty{#4}{-1}{#3)}}{\number\numexpr#2}{#4}}
+\def\ettl@singlelist@result#1#2#3#4/End§List/{\ExpandNextTwo\@swaptwo%
+ {\number\numexpr\ifempty{#3}{-1}{#2)}}{\number\numexpr#1}{#3}}
% \end{macrocode}
% Then \cs{ettl@setresult} finishes the job:
% \begin{macrocode}
@@ -4149,18 +4253,18 @@ and etextools-examples.tex
##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}}}
@@ -4175,8 +4279,8 @@ and etextools-examples.tex
% \cs{etttl@lst@count} is as basic as it can be!
% \begin{macrocode}
\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//}
% \end{macrocode}
%\end{Macro}
@@ -4192,7 +4296,7 @@ and etextools-examples.tex
\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]{%
@@ -4203,7 +4307,7 @@ and etextools-examples.tex
% \begin{Macro}{breakloop}
% \cs{breakloop} gobbles anything until the \CH{/End§List/} delimiter:
% \begin{macrocode}
-\long\def\ettl@breakloop#1/End§List/{}
+\long\def\ettl@breakloop#1#2/End§List/{#1}
\let\breakloop\ettl@breakloop
% \end{macrocode}
% \end{Macro}
@@ -4385,7 +4489,7 @@ and etextools-examples.tex
\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
@@ -4413,7 +4517,7 @@ and etextools-examples.tex
% \begin{Macro}{listxdel}
% \cs{listdel} removes an \prm{item} from a list, \cs{listedel} expands the \prm{item} (with |\protected@edef|) first,
% \cs{listgdel} make the assignment to the (shorter-)list global and \cs{listxdel} both expands the \prm{item} and
-% make the assignment global:
+% makes the assignment global:
% \begin{macrocode}
\begingroup\catcode`\|=3
\newrobustcmd\listdel[1][]{\ettl@RemoveInList{}\listdel|{#1}}
@@ -4447,7 +4551,7 @@ and etextools-examples.tex
% \begin{Macro}{csvxdel}
% \cs{csvdel} removes an \prm{item} from a list, \cs{csvedel} expands the \prm{item} (with |\protected@edef|) first,
% \cs{csvgdel} make the assignment to the (shorter-)list global and \cs{csvxdel} both expands the \prm{item} and
-% make the assignment global:
+% makes the assignment global:
% \begin{macrocode}
\newrobustcmd\csvdel[1][]{\ettl@RemoveInList{}\csvdel,{#1}}
\newrobustcmd\csvgdel[1][]{\ettl@RemoveInList\global\csvdel,{#1}}
@@ -4473,7 +4577,7 @@ and etextools-examples.tex
% \begin{Macro}{toksxdel}
% \cs{toksdel} removes an \prm{item} from a list, \cs{toksedel} expands the \prm{item} (with |\protected@edef|) first,
% \cs{toksgdel} make the assignment to the (shorter-)list global and \cs{toksxdel} both expands the \prm{item} and
-% make the assignment global:
+% makes the assignment global:
% \begin{macrocode}
\newrobustcmd\toksdel[1][]{\ettl@RemoveInList{}\toksdel{}{#1}}
\newrobustcmd\toksgdel[1][]{\ettl@RemoveInList\global\toksdel{}{#1}}
@@ -4566,6 +4670,50 @@ and etextools-examples.tex
% \end{Macro}
% \end{Macro*}
%
+% \iffalse
+%<package>
+%<package>%% \interval{ number }{ sorted comma separated list of numbers }
+% \fi
+%
+%\begin{Macro}{interval}
+% \cs{interval} will expand to the number of the interval of \prm{number} into the \prm{sorted comma separated list of integers}:
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%\end{Macro}
+%
+% \iffalse
+%<package>
+%<package>%% \interplin{ number }{ sorted comma separated list of numbers }{ comma separated liist of numbers }
+% \fi
+%
+%\begin{Macro}{locinterplin}
+% \begin{macrocode}
+\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
+% \end{macrocode}
+%\end{Macro}
+%
% \Subsection*{\thispackage package options (undocumented - not tested, not to be used)}
%
% \textsl{Undocumented option \xpackage{etoolbox}}.
@@ -4935,8 +5083,12 @@ category code of \# to 12 (other):
%
% \begin{changelog}\footnotesize
%
+% \begin{release}{3.1}{2009-09-30}
+% \item Stabilisation of some commands. the package sould now be OK.
+% \end{release}
+%
% \begin{release}{3.0}{2009-09-09}
-% \item Definition of \cmdref{DeclareStringFilter}, \cmdref{[FE@modifiers} and \cmdref{ettl@supergobble}.
+% \item Definition of \cmdref{DeclareStringFilter}, \cmdref{[FE@modifiers} and \cmdref{ettl@supergobble}
%
% \end{release}
%
diff --git a/Master/texmf-dist/source/latex/etextools/etextools.ins b/Master/texmf-dist/source/latex/etextools/etextools.ins
index 23d0eaf5a73..4c709f3330a 100644
--- a/Master/texmf-dist/source/latex/etextools/etextools.ins
+++ b/Master/texmf-dist/source/latex/etextools/etextools.ins
@@ -21,11 +21,11 @@
%% 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)
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: etextools 2009/07/14 v.3.0 e-TeX tools for LaTeX Users and package Writers}
+\Msg{* Package: etextools 2009/07/14 v.3.1 e-TeX tools for LaTeX Users and package Writers}
\Msg{************************************************************************}
\keepsilent
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}