summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/etextools/etextools.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/etextools/etextools.sty')
-rw-r--r--Master/texmf-dist/tex/latex/etextools/etextools.sty75
1 files changed, 47 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/etextools/etextools.sty b/Master/texmf-dist/tex/latex/etextools/etextools.sty
index f6d54d4572d..485d402da68 100644
--- a/Master/texmf-dist/tex/latex/etextools/etextools.sty
+++ b/Master/texmf-dist/tex/latex/etextools/etextools.sty
@@ -19,10 +19,10 @@
%% etextools.sty, etextools.pdf, etextools.ins,
%% and etextools-examples.tex
%%
-%%% etextools : e-TeX tools for LaTeX Users and package Writers (v.3.1415 - 2009/10/14)
+%%% etextools : e-TeX tools for LaTeX Users and package Writers (v.3.14159 - 2010/04/20)
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesPackage{etextools}
- [2009/10/14 v3.1415 e-TeX more useful tools for LaTeX package writers]
+ [2010/04/20 v3.14159 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
@@ -172,8 +172,16 @@
\newcommand*\noexpandafter{\noexpand\expandafter}
%% \thefontname
-\newcommand\thefontname{{\expandafter\ettl@thefontname\expandafter\strip@meaning\the\font}}
-\font\ettl@thefontname=ecrm1000
+\newcommand\thefontname{{\expandafter\expandafter\expandafter\ettl@thefontname
+ \expandafter\expandafter\expandafter\meaning
+ \expandafter\the\expandafter\font
+ \expandafter\string\expandafter(%
+ \expandafter\string\the\font\string)}}
+\ifcsname T1/cmr/m/n/10\endcsname
+ \letcs\ettl@thefontname{T1/cmr/m/n/10}%
+\else
+ \font\ettl@thefontname=ecrm1000
+\fi
%% \showcs { csname }
\providecommand*\showcs[1]{\expandafter\show\csname#1\endcsname}
@@ -223,7 +231,7 @@
%% \ifdefmathchar { cs-token }{ true }{ false } \FEII
\def\ettl@ifdef[#1]{\expandafter\ettl@ifd@f\expandafter{#1}}
\def\ettl@ifd@f#1#2{%
- \csdef{ettl@ifdef#2}##1#1##2/End^^a7Meaning/{\ettl@nbk##2//{\rmn@firstoftwo}{\rmn@secondoftwo}//}
+ \csdef{ettl@ifdef#2}##1#1##2/End^^a7Meaning/{\ettl@nbk##2//\rmn@firstoftwo\rmn@secondoftwo//}
\csedef{ifdef#2}##1{\noexpand\romannumeral\noexpandafter%
\noexpandcs{ettl@ifdef#2}\noexpand\meaning##1#1/End^^a7Meaning/}%//{##2}{##3}//}
}
@@ -821,9 +829,12 @@
\def\ettl@singlelist@result#1#2#3#4/End^^a7List/{\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}}}%
+ {\ettl@set@result#1of#2>#3<}
{\csname ettl@#1of#2\endcsname}//}
+\def\ettl@set@result#1of#2>#3<#4{\ifdefcount{#3}
+ {#3=\csname ettl@#1of#2\endcsname#4}
+ {\expandafter\edef\noexpand#3{\csname ettl@#1of#2\endcsname{#4}}}%
+}
%% \DeclareCmdListParser : general constructor for command-list parsers
%% \DeclareCmdListParser\ParserName{separator}
@@ -954,9 +965,9 @@
\long\def#3[##1]##2#5#8#5##3##4/##5##6##7/End^^a7List/{##6[##1+1]##2#5##3##4//##6##7/End^^a7List/}%
\ifnotempty{#5}%% special case if no separator
{\long\def#4[##1]#5##2#5#5##3//##4/End^^a7List/{\unexpanded{#1\def#7{##2#5}}%
- \ettl@nbk#6//\ettl@setresult 1of1>#6<{\number\numexpr##1-1\relax}{}//}}%
+ \ettl@nbk#6//{\ettl@setresult 1of1>#6<{\number\numexpr##1-1\relax}}{}//}}%
{\long\def#4[##1]##2//##3/End^^a7List/{\unexpanded{#1\def#7{##2}}%
- \ettl@nbk#6//\ettl@setresult 1of1>#6<{\number\numexpr##1-1\relax}{}//}}%
+ \ettl@nbk#6//{\ettl@setresult 1of1>#6<{\number\numexpr##1-1\relax}}{}//}}%
\long\def#2##1{#3[0]#5##1#5#5#8#5//#3#4/End^^a7List/}%
\edef#7{\endgroup\expandafter#2\expandafter{#7}}#7}
\def\ettl@gobble@relax#1\relax{}
@@ -965,16 +976,13 @@
%% \listgdel \listMacro { item }
%% \listedel \listMacro { item }
%% \listxdel \listMacro { item }
-\begingroup\catcode`\|=3
+\edef\ettl@restore@catcode{\catcode124 \the\catcode124}% |=124
+\catcode`\|=3
\newrobustcmd\listdel[1][]{\ettl@RemoveInList{}\listdel|{#1}}
\newrobustcmd\listgdel[1][]{\ettl@RemoveInList\global\listdel|{#1}}
\newrobustcmd\listedel[1][]{\ettl@listedel{}\listdel|{#1}}
\newrobustcmd\listxdel[1][]{\ettl@listedel\global\listdel|{#1}}
-\aftergroup@def\listdel
-\aftergroup@def\listgdel
-\aftergroup@def\listedel
-\aftergroup@def\listxdel
-\endgroup% \catcode group
+\ettl@restore@catcode\undef\ettl@restore@catcode
\newrobustcmd\ettl@listedel[6]{\begingroup\protected@edef#5{#6}\expandafter\endgroup
\expandafter\@swaparg\expandafter{#5}{\ettl@RemoveInList#1#2{#3}{#4}#5}}
@@ -999,24 +1007,35 @@
%% \getlistindex[\indexmacro]{ \Listmacro }
%% \getlistindex*[\indexmacro]{ expanded List }
-\newrobustcmd\ettl@getlistindex[6][]{% #1=result, #2=\expandafter, #3=loop macro, #4=separator, #5=list of list macro, #6=item
- \begingroup\def\ettl@getlistindex##1#4#6#4##2/End^^a7List/{\endgroup
- \romannumeral-`\q\ettl@setresult 1of1>#1<{\ettl@nbk##2//{#3*!{##1}}{-1}//}%
- }#2\ettl@getlistindex#2#5#4#6#4/End^^a7List/}
+\newrobustcmd\ettl@getlistindex[6]{% #1=result, #2=\expandafter, #3=loop macro, #4=separator, #5=list of list macro, #6=item
+ \begingroup\long\def\ettl@getlistindex##1#4#6#4##2/End^^a7List/{\endgroup
+ \ExpandAftercmds{\ettl@setresult 1of1>#1<}{\ettl@nbk##2//{#3*!{##1}}{-1}//}%
+ }#2\ettl@getlistindex#5#4#6#4/End^^a7List/}
+\newrobustcmd\getlistindex{\@ifstar
+ {\@testopt{\ettl@get@listindex\relax}{}}
+ {\@testopt{\ettl@get@listindex\expandafter}{}}}
\begingroup\catcode`\|=3% etb catcode
-\newrobustcmd\getlistindex[3][]{\@ifstar%
- {\ettl@getlistindex{}\listloop{|}{#1}{#2}{#3}}
- {\ifiscs{#1}{\ettl@getlistindex\expandafter\listloop|{#1}{#2}{#3}}
- {\ettl@getlistindex{}\listloop|{#1}{#2}{#3}}}}
-\aftergroup@def\getlistindex
+\protected\long\gdef\ettl@get@listindex#1[#2]#3#4{%
+ \ifx#1\relax
+ \ettl@getlistindex{#2}{}\listloop|{#4}{#3}%
+ \else \ifiscs{#4}
+ {\ettl@getlistindex{#2}#1\listloop|{#4}{#3}}
+ {\ettl@getlistindex{#2}\listloop|{#4}{#3}}%
+ \fi}
\endgroup%\catcode group
%\getcsvlistindex [\result]{ item }{ csvlistmacro }
%\getcsvlistindex*[\result]{ item }{ item,item,item }
-\newrobustcmd\getcsvlistindex[3][]{\@ifstar%
- {\ettl@getlistindex{}\csvloop{,}{#1}{#2}}
- {\ifiscs{#1}{\ettl@getlistindex\expandafter\csvloop,{#1}{#2}}
- {\ettl@getlistindex{}\csvloop,{#1}{#2}}}}
+\newrobustcmd\getcsvlistindex{\@ifstar
+ {\@testopt{\ettl@get@csvlistindex\relax}{}}
+ {\@testopt{\ettl@get@csvlistindex\expandafter}{}}}
+\protected\long\gdef\ettl@get@csvlistindex#1[#2]#3#4{%
+ \ifx#1\relax
+ \ettl@getlistindex{#2}{}\csvloop,{#4}{#3}%
+ \else \ifiscs{#4}
+ {\ettl@getlistindex{#2}#1\csvloop,{#4}{#3}}
+ {\ettl@getlistindex{#2}\csvloop,{#4}{#3}}%
+ \fi}
\def\ettl@if@inlist#1#2{%#1=macro,#2=separator
\newrobustcmd*#1{\@ifstar{\ettl@ifinlist{#2}{}}{\ettl@ifinlist{#2}\expandafter}}}
\def\ettl@xif@inlist#1#2{%