summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-19 22:51:25 +0000
committerKarl Berry <karl@freefriends.org>2010-04-19 22:51:25 +0000
commite381628d4f928231935fdce7a37ae90e3a2a1131 (patch)
tree929af4cafd86661c260dfa56592f03114fb8e496 /Master/texmf-dist
parent6f50f6bd304c69abef2c051ee1aa83b602027143 (diff)
etextools update (18apr10)
git-svn-id: svn://tug.org/texlive/trunk@17928 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/etextools/README15
-rw-r--r--Master/texmf-dist/doc/latex/etextools/etextools-examples.pdfbin0 -> 105622 bytes
-rw-r--r--Master/texmf-dist/doc/latex/etextools/etextools-examples.tex304
-rw-r--r--Master/texmf-dist/doc/latex/etextools/etextools.pdfbin1060019 -> 1093008 bytes
-rw-r--r--Master/texmf-dist/source/latex/etextools/etextools.drv8
-rw-r--r--Master/texmf-dist/source/latex/etextools/etextools.dtx448
-rw-r--r--Master/texmf-dist/source/latex/etextools/etextools.ins5
-rw-r--r--Master/texmf-dist/tex/latex/etextools/etextools.sty75
8 files changed, 774 insertions, 81 deletions
diff --git a/Master/texmf-dist/doc/latex/etextools/README b/Master/texmf-dist/doc/latex/etextools/README
index 5974e936ff6..7274a965d8b 100644
--- a/Master/texmf-dist/doc/latex/etextools/README
+++ b/Master/texmf-dist/doc/latex/etextools/README
@@ -1,8 +1,8 @@
-% etextools v3.1 - (pretty stable ;) - 2009/09/30
+% etextools v3.14159 (stable) - 2010/04/20
% This work consists of the main source file etextools.dtx
% and the derived files
% etextools.sty, etextools.pdf, etextools.ins,
-% examples will be uploaded later...
+% etextools-examples.tex
% Unpacking:
% (a) If etextools.ins is present:
% etex etextools.ins
@@ -13,13 +13,14 @@
% (quote the arguments according to the demands of your shell)
% Documentation: (pdf)latex etextools.dtx; ...
% -----------------------------------------------------------------------------------------
- *** The List of Commands is in page 3 of the documentation. ***
-etextools provides many (purely expandable) tools for LaTeX -------------------------------
+etextools provides many (purely expandable) tools for LaTeX:
- Extensive list management (csv lists, lists of single tokens/characters, etoolbox lists):
. purely expandable loops (csvloop, forcsvloop etc.)
. conversion (csvtolist etc.))
. addition/deletion (csvadd, listdel etc.)
-- Tests on strings (among them \ifstrnum to check if a string could be parsed by eTeX's \number)
-- Selective detokenization (\detokenizeChars) and character-test
-- Purely expandable macros with options (\FE@testopt) or modifiers (\FE@modifiers)
+- Expansion and groups control : \expandnext, \ExpandAfterCmds, \AfterGroup...
+- Tests on tokens, characters and control sequences (\iffirstchar, \ifiscs, \ifdefcount, \@ifchar...)
+- Tests on strings (\ifstrnum, \ifuppercase, \DeclareStringFilter...)
+- Purely expandable macros with options (\FE@testopt, \FE@ifstar) or modifiers (\FE@modifiers)
+- Some purely expandable numerics (\interval, \locinterplin)
% -----------------------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf b/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf
new file mode 100644
index 00000000000..1a30dfb35ac
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex
new file mode 100644
index 00000000000..2308477a1f2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex
@@ -0,0 +1,304 @@
+%%
+%% This is file `etextools-examples.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% etextools.dtx (with options: `example')
+%%
+%% This is a generated file.
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This work consists of the main source file etextools.dtx
+%% and the derived files
+%% etextools.sty, etextools.pdf, etextools.ins,
+%% and etextools-examples.tex
+%%
+%%% etextools : e-TeX tools for LaTeX Users and package Writers (v.3.14159 - 2010/04/20)
+\documentclass[11pt,french,a4paper,oneside]{scrartcl}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[american]{babel}
+\usepackage{geometry,doc,ltxdockit,txfonts,fancyhdr,stmaryrd,graphicx,enumitem}
+\usepackage{etextools}
+\usepackage{fancyvrb}
+\makeatletter
+\let\org@newif\newif
+\def\newif#1{\ifx#1\ifnotempty\else\expandafter\org@newif\fi}
+\usepackage{umrand}
+\renewcommand\ifne[1]{\csname @\if\relax\detokenize{#1}\relax first\else second\fi oftwo\endcsname\iffalse\iftrue}
+\let\newif\org@newif
+\font\umranda=umranda \def\Ch{\char'}
+\def\textvb#1{{\usefont{T1}{txtt}{m}{n}#1}}
+\newrobustcmd\thispackage{\xpackage{\spot etextools}\xspace}
+\newrobustcmd\xpackage[1]{{\usefont{T1}{lmss}{bx}{n}\db\mbox{#1}}}
+\hypersetup{colorlinks,pdfstartview={FitH}}
+\geometry{top=1.5cm,bottom=1.2cm,left=2.5cm,right=1cm}
+\fancyhf{}
+\fancyhead[L]{Examples for the \thispackage package}
+\pagestyle{fancy}
+\DefineShortVerb{\|}
+\catcode`\^^a7 \active\def^^a7{\par\nobreak\vskip-\parskip}
+\DefineVerbatimEnvironment{VerbLines}{Verbatim}
+ {gobble=1,commandchars=!(),frame=lines,framesep=6pt,fontfamily=txtt,fontseries=m}
+\apptocmd\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@}{}{}
+\def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}}
+\def\FE{\setbox8\hbox{$\m@th\bindnasrepma$}%
+ \textcolor{fecc}{\scalebox{2}{$\copy8\mkern-13.5mu\copy8\mkern-13.5mu\copy8$}}}
+\def\pdfFE{\setbox8\hbox{$\m@th\bindnasrepma$}%
+ \textcolor{fecc}{\llap{\textsf{pdf}\TeX{}\,}\scalebox{2}{$\copy8\mkern-13.5mu\copy8\mkern-13.5mu\copy8$}}}
+\definecolor{fecc}{rgb}{.2,.6,.2}
+\definecolor{dg}{rgb}{0.00,0.37,0.00} \newrobustcmd\dg{\color{dg}} \newrobustcmd\dgbf{\dg\bfseries}
+\definecolor{spot}{rgb}{1.00,0.33,0.00} \newrobustcmd\spot{\color{spot}}
+\definecolor{db}{rgb}{0.00,0.00,0.25} \newrobustcmd\db{\color{db}}
+\newrobustcmd\blue{\color{blue}}
+\newrobustcmd\nnn{\normalfont\mdseries\upshape}
+\newrobustcmd\ClearPage{\@ifstar\clearpage{}}
+\def\make@macro#1{\string\def\string#1\parameters@meaning#1\string{\strip@meaning#1\string}}
+\newcommand\preline{\@ifstar{\@preline}{\hrulefill\par\@preline}}
+\newcommand\@preline[2][1.5ex]{\noindent\hskip6pt\textvb{\make@macro#2}\par\ifblank{#1}{}{\vskip#1}}
+\ifdef\pdfstrcmp{\let\ifpdfTeX\iffalse}{\let\ifpdfTeX\iftrue}
+\newcommand*\test{\@ifstar{\let\fe\pdfFE\testi}{\let\fe\FE\testi}}
+\newcommand\testi[1]{%
+ \csname test#1\endcsname
+ \edef\usercmd{\strip@meaningcs{test#1}}\edef\result{\meaningcs{#1Test}}\noindent
+ \begin{tabular}{lp{15cm}}
+ \multicolumn{2}{l}{\textcolor{blue}{\llap{\fe\,\smex}\tt \usercmd}} \\[1.5ex]
+ \cmd{#1Test}= & \tt\bfseries\result
+ \end{tabular}\par\nobreak\hrulefill\null\goodbreak}
+\begin{document}
+\title{\vskip-2cm\thispackage\ examples}
+\subtitle{Examples for some macros provided by the \thispackage package}
+\author{\small<FC -- April 20, 2010>}
+\date{}
+\newsavebox\helpbox \newsavebox\helpboxx
+\newrobustcmd*\mydotleader[2][\z@]{\leavevmode\xleaders\hbox to\dimexpr1.7pt+#1{\hss\raise#2\hbox{$\scriptscriptstyle\cdotp$}\hss}}
+\begingroup\let\clearpage\@empty
+\setbox\helpbox\hbox to13cm{\hss\lower3cm\vbox to1.8cm{\maketitle\vss}\hss}
+\fboxsep\z@
+\newrobustcmd\corner[2][\spot\umranda]{\hbox{#1\rlap{\char'115}\char'#2}}
+\null\vskip-1cm\hskip-1cm\null\hfil\RandBox {\fbox{\copy\helpbox}}
+ font {\umranda} [0pt]
+ (\corner{17}) ([\Ch111]) (\corner{14})
+ ([\Ch112]) ([\Ch112])
+ (\corner{21}) ([\Ch111]) (\corner{11})
+\endgroup
+\tableofcontents\hyperdef{ettlex}{toc}{}
+\section{\cmd{expandnext} examples}
+\subsection{Test if the replacement text of macro is really empty}
+\def\xx{ }
+\def\testexpandnext{%
+ \edef\expandnextTest{\string\xx\ is \expandnext\ifempty{\xx}{}{not} empty}
+}
+\preline\xx
+\test{expandnext}
+\def\xx{}
+\preline\xx
+\test{expandnext}
+\ClearPage*
+\subsection{Test if the replacement text of a macro is blank (empty or spaces)}
+\def\xx{something}
+\def\testexpandnext{%
+ \edef\expandnextTest{\string\xx\ is \expandnext\ifblank{\xx}{}{not} blank}
+}
+\preline\xx
+\test{expandnext}
+\def\xx{ }
+\preline\xx
+\test{expandnext}
+\section{\cmd{ExpandNext} examples}
+Example of the main documentation file to reverse the order of the characters in a string:
+\def\swap#1#2{{#2#1}} \def\do[#1]#2{\swap #2}% \do{abcdef} -> \swap ab + cdef -> {ba}cdef
+ % \do{{ba}cdef} -> \swap {ba}c + def -> {cba}def
+\edef\result{\naturalloop[\do]{4}{12345}}
+\ExpandNext{\def\RESULT}{\naturalloop[\do]{4}{12345}}
+\begin{VerbLines}
+\def\swap#1#2{{#2#1}} \def\do[#1]#2{\swap #2}
+\edef\result{\naturalloop[\do]{4}{12345}}
+\meaning\result = !bfseries!meaning!result
+\ExpandNext{\def\RESULT}{\naturalloop[\do]{4}{12345}}
+\meaning\RESULT = !bfseries!meaning!RESULT
+\end{VerbLines}
+\subsection{Test the parameter string of a macro}
+The following commands create the filter for the string: "\textvb{[\#1]\#2"}":^^a7
+\begin{VerbLines}[commandchars=!()]
+\ExpandNext{(!blue\DeclareStringFilter\ParaFilt)}
+ {\ExpandAftercmds\@gobblescape{\expandafter\string\csname(!blue[#1]#2)\endcsname}}
+\end{VerbLines}
+\ExpandNext{\DeclareStringFilter\ParaFilt}
+ {\ExpandAftercmds\@gobblescape{\expandafter\string\csname[#1]#2\endcsname}}
+\begin{enumerate}[label=\arabic*)~,noitemsep,nolistsep]
+\item |\csname[#1]#2\endcsname| is expanded first
+\item Immediately after: |\string|
+\item At this stage: |\[#1]#2| (everything in category code other) is no more expandable
+\item Then |\ExpandAftercmds| expands |\@gobblescape|
+\item |[#1]#2| is no more expandable
+\item Then |\ExpandNext| expands its first argument: |\DeclareStringFilter\ParaFilt{[#1]#2}|
+\end{enumerate}
+Remark: |\detokenize| would have doubled the \# characters. Another possibility is to temporarily change the
+category code of \# to 12 (other):
+\begin{VerbLines}[commandchars=!()]
+\begingroup\catcode`\#=12
+ (!blue\DeclareStringFilter\ParaFilt{[#1]#2}) !nnn global declaration
+\endgroup
+\end{VerbLines}
+\def\macroA#1#2{Something to do with #1 and #2}
+\def\macroB[#1]#2{Something to do with #1 and #2}
+\preline[]\macroA
+\preline*[]\macroB
+\begin{Verbatim}[commandchars=!()]
+ !blue\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroA}{macro complies with [\#1]\#2}
+ !blue{macro does not comply }
+\end{Verbatim}
+\hfill\textvb{\dgbf\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroA}{macro complies with [\#1]\#2}
+ {macro does not comply }}
+\begin{Verbatim}[commandchars=!()]
+ !blue\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroB}{macro complies with [\#1]\#2}
+ !blue{macro does not comply }
+\end{Verbatim}
+\hfill\textvb{\dgbf\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroB}{macro complies with [\#1]\#2}
+ {macro does not comply }}
+\par\hrulefill\par
+\ClearPage*
+\section{Testing characters}
+\subsection{\cmd{ifsinglechar} versus \cmd{iffirstchar}}
+\def\testifsinglechar{%
+ \edef\ifsinglecharTest{\ifsinglechar *{*hello*}{ single star }{ something else }}
+}\hrulefill\par
+\test{ifsinglechar}
+\def\testifsinglechar{%
+ \edef\ifsinglecharTest{\ifsinglechar *{ *}{ single star }{ something else }}
+}\hrulefill\par
+\test{ifsinglechar}
+\def\testifsinglechar{%
+ \edef\ifsinglecharTest{\ifsinglechar *{ * }{ single star }{ something else }}
+}\hrulefill\par
+\test{ifsinglechar}
+{\small Note the space \textbf{after} the star $\uparrow$.}
+\def\testiffirstchar{%
+ \edef\iffirstcharTest{\iffirstchar *{*hello*}{ first char is star }{ something else }}
+}\hrulefill\par
+\test{iffirstchar}
+\subsection{Fully Expandable starred macros}
+\def\starmacro#1{\FE@ifstar{#1}\starred\notstarred}
+\def\starred#1{your "#1" will be processed by the STAR form}
+\def\notstarred#1{your "#1" will be processed by the NORMAL form}
+\def\testFE@ifstar{%
+ \edef\FE@ifstarTest{\starmacro{sample text}}}
+\preline\starmacro
+\preline*\starred
+\preline*\notstarred
+\test{FE@ifstar}
+\def\testFE@ifstar{%
+ \edef\FE@ifstarTest{\starmacro*{sample text}}}
+\hrulefill\par
+\test{FE@ifstar}
+\subsection{Fully Expandable macros with options}
+\def\optmacro#1{\FE@testopt{#1}\OPTmacro{Mr.}}
+\def\OPTmacro[#1]#2{#1 #2}
+\def\testFE@testopt{%
+ \edef\FE@testoptTest{\optmacro{Woody Allen}}}
+\preline\optmacro
+\preline*\OPTmacro
+\test{FE@testopt}
+\def\testFE@testopt{%
+ \edef\FE@testoptTest{\optmacro[Ms.]{Vanessa Paradis}}}
+\hrulefill\par
+\test{FE@testopt}
+\ClearPage*
+\section{Lists management}
+\subsection{\cmd{csvloop} and \cmd{csvloop*} examples}
+\subsubsection{\cmd{makequotes}}
+\def\makequotes#1{"#1"\space}
+\def\testcsvloop{%
+ \edef\csvloopTest{\csvloop*[\makequotes]{hello,world}}
+}
+\preline\makequotes
+\test{csvloop}
+\subsubsection{\cmd{detokenize}}
+\def\testcsvloop{%
+ \edef\csvloopTest{\csvloop*[\detokenize]{\un,\deux}}
+}\hrulefill\par
+\test{csvloop}
+\subsubsection{\cmd{numexpr}}
+\def\mylist{1,2,3,4,5}\def\BySeven#1{$#1\times 7 = \number\numexpr#1*7\relax$\par}
+\def\testcsvloop{%
+ \edef\csvloopTest{\csvloop[\BySeven]\mylist}}
+\preline\mylist
+\preline*\BySeven
+\test{csvloop}
+\subsubsection{protected \cmd{textbf}}
+\def\testcsvloop{%
+ \protected@edef\csvloopTest{\csvloop*[\textbf]{hello ,my ,friends}}
+}\hrulefill\par
+\test{csvloop}
+\subsection{Index in lists and items by index}
+\subsubsection{\cmd{listloop}: getting specific item}
+\csvtolist*[\mylist]{one,two,three,four,five,alpha,beta,gamma}
+\def\testgetlistitem{%
+ \edef\getlistitemTest{\listloop[4]\mylist}
+}\hrulefill\par
+\noindent\hskip6pt|\csvtolist*[\mylist]{one,two,three,four,five,alpha,beta,gamma}|\par\vskip1.5ex
+\test{getlistitem}
+\ClearPage*
+\subsubsection{\cmd{getlistindex}}
+\ifpdfTeX
+\leavevmode\vadjust{\textsl{Require the }\string\pdfstrcmp\ \textsl{primitive (pdf\TeX{}) :}}
+\def\testgetlistindex{%
+ \edef\getlistindexTest{\getlistindex{alpha}\mylist}
+}\hrulefill\par
+\noindent\hskip6pt|\csvtolist*[\mylist]{one,two,three,four,five,alpha,beta,gamma}|\par\vskip1.5ex
+\test*{getlistindex}
+\leavevmode\vadjust{\textsl{Require the }\string\pdfstrcmp\ \textsl{primitive (pdf\TeX{}) :}}
+\def\testgetlistindex{%
+ \edef\getlistindexTest{\getcsvlistindex*{alpha}{one,two,three,four,five,alpha,beta}}
+}\hrulefill\par
+\test*{getlistindex}
+\fi
+\hrulefill\par
+\getlistindex[\myindex]{alpha}\mylist
+{\color{blue}\noindent\hskip6pt\llap\smex|\getlistindex[\myindex]{alpha}\mylist|\par\vskip1.5ex}
+{\tt\string\myindex=\quad\textbf{\meaning\myindex}}
+\par\hrulefill\par\vskip.5ex
+\hrulefill\par
+\newcount\myindex
+\getcsvlistindex*[\myindex]{alpha}{one,two,three,four,five,alpha,beta}
+\noindent\hskip6pt|\newcount\myindex|\par
+{\color{blue}\noindent\hskip6pt\llap\smex|\getcsvlistindex*[\myindex]{alpha}{one,two,three,four,five,alpha,beta}|}\par\vskip.5ex
+{\tt\string\the\string\myindex=\qquad\textbf{\the\myindex}}
+\par\hrulefill\par\vskip.5ex
+\ClearPage
+\subsubsection{\cmd{gettokslistindex} with \cmd{ifcase}}
+\hrulefill\par\vskip2ex\noindent
+\llap{\FE\,\smex}\par\vskip-2.5\baselineskip\strut
+\leavevmode\vadjust{Always purely expandable (no need of |\pdfstrcmp|, comparison done by |\ifx|):}
+\begin{Verbatim}
+ \ifcase \gettokslistindex{D}{LRDF\relax O}
+ What do to if L
+ \or What do to if R
+ \or What do to if D
+ \or What do to if F
+ \or What do to if \relax
+ \or What do to if O
+ \else Problem
+ \fi
+\end{Verbatim}
+{\tt Result=\qquad\bfseries
+\ifcase\gettokslistindex{D}{LRDF}
+ What do to if L
+\or What do to if R
+\or What do to if D
+\or What do to if F
+\else Problem
+\fi}\par
+\hrulefill\par\vskip.5ex
+\end{document}\endinput
+
+\endinput
+%%
+%% End of file `etextools-examples.tex'.
diff --git a/Master/texmf-dist/doc/latex/etextools/etextools.pdf b/Master/texmf-dist/doc/latex/etextools/etextools.pdf
index 1a1207830a4..aad64e09dce 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 16f7d00391f..9df2cae29be 100644
--- a/Master/texmf-dist/source/latex/etextools/etextools.drv
+++ b/Master/texmf-dist/source/latex/etextools/etextools.drv
@@ -19,11 +19,11 @@
%% 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)
\edef\thisfile{\jobname}
\def\thisinfo{The \thispackage\ package -- an \eTeX{} package for \LaTeX{}}
-\def\thisrevision{3.1415}
-\def\thisdate{14 October 2009}
+\def\thisrevision{3.14159}
+\def\thisdate{20 April 2010}
\newcommand\makebookmark[1]{}
\documentclass[a4paper,oneside]{ltxdockit}
\usepackage[latin1]{inputenc}
@@ -40,7 +40,7 @@
\geometry{left=4.5cm,marginparwidth=14pt,right=1.5cm,top=3mm,headsep=3mm,bottom=3mm,footskip=8mm,includeheadfoot}
\csdef{ltd@email}#1{\href{mailto:#1}{\footnotesize\mdseries#1}}
\titlepage{%
- title={The \Thispackage macros},
+ title={The \thispackage\footnotemark 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={\footnotesize Florent CHERVET},
diff --git a/Master/texmf-dist/source/latex/etextools/etextools.dtx b/Master/texmf-dist/source/latex/etextools/etextools.dtx
index 01ed377c72f..162490638c1 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.1415 - 2009/10/14)
+%%% etextools : e-TeX tools for LaTeX Users and package Writers (v.3.14159 - 2010/04/20)
%
% 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/10/14 v.3.1415 e-TeX tools for LaTeX Users and package Writers *}
+\Msg{* Package: etextools 2010/04/20 v.3.14159 e-TeX tools for LaTeX Users and package Writers *}
\Msg{************************************************************************}
\keepsilent
@@ -70,6 +70,7 @@ and etextools-examples.tex
\askforoverwritefalse
\generate{%
\file{etextools.drv}{\from{etextools.dtx}{driver}}%
+ \file{etextools-examples.tex}{\from{etextools.dtx}{example}}%
}
\obeyspaces
@@ -95,8 +96,8 @@ and etextools-examples.tex
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{The \thispackage\ package -- an \eTeX{} package for \LaTeX{}}
-\def\thisrevision{3.1415}
-\def\thisdate{14 October 2009}
+\def\thisrevision{3.14159}
+\def\thisdate{20 April 2010}
\newcommand\makebookmark[1]{}
%-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\documentclass[a4paper,oneside]{ltxdockit}
@@ -114,7 +115,7 @@ and etextools-examples.tex
\geometry{left=4.5cm,marginparwidth=14pt,right=1.5cm,top=3mm,headsep=3mm,bottom=3mm,footskip=8mm,includeheadfoot}
\csdef{ltd@email}#1{\href{mailto:#1}{\footnotesize\mdseries#1}}
\titlepage{%
- title={The \Thispackage macros},
+ title={The \thispackage\footnotemark 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={\footnotesize Florent CHERVET},
@@ -135,7 +136,7 @@ and etextools-examples.tex
%</driver>
% \fi
%
-% \CheckSum{2899}
+% \CheckSum{3752}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -512,7 +513,7 @@ and etextools-examples.tex
% \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
+% \box\helpboxx \footnotetext {\noindent \thispackage: \CTAN{macros/latex/contrib/\thisfile}}
% ^^A\printtitlepage
% \AddBookMark{attr{/F 2}goto page 1{/FitH 1000}{etextools}}
%
@@ -2364,9 +2365,9 @@ and etextools-examples.tex
% \begin{ltxsyntax}
%
% \cmditem{getlistindex}[result-index(counter or macro)]{item}{Listmacro}
-% \cmditem-{xgetlistindex}[result-index(counter or macro)]{item}{Listmacro}
+% ^^A\cmditem-{xgetlistindex}[result-index(counter or macro)]{item}{Listmacro}
% \cmditem-{getlistindex*}[result-index(counter or macro)]{item}{list}
-% \cmditem-{xgetlistindex*}[result-index(counter or macro)]{item}{list}
+% ^^A\cmditem-{xgetlistindex*}[result-index(counter or macro)]{item}{list}
%
% \end{ltxsyntax}
%
@@ -2388,9 +2389,9 @@ and etextools-examples.tex
%
% \begin{ltxsyntax}
% \cmditem{getcsvlistindex}[result-index(counter or macro)]{item}{csvlistmacro}
-% \cmditem-{xgetcsvlistindex}[result-index(counter or macro)]{item}{csvlistmacro}
+% ^^A\cmditem-{xgetcsvlistindex}[result-index(counter or macro)]{item}{csvlistmacro}
% \cmditem-{getcsvlistindex*}[result-index(counter or macro)]{item}{item,item,item,...}
-% \cmditem-{xgetcsvlistindex*}[result-index(counter or macro)]{item}{item,item,item,...}
+% ^^A\cmditem-{xgetcsvlistindex*}[result-index(counter or macro)]{item}{item,item,item,...}
% \end{ltxsyntax}
%
% This\notFE\ is the same as \cmdref{getlistindex} but for comma-separated lists.
@@ -2449,7 +2450,7 @@ and etextools-examples.tex
%<*package>
\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
% \end{macrocode}
%
@@ -2856,8 +2857,16 @@ and etextools-examples.tex
%
%\begin{Macro}{thefontname}
% \begin{macrocode}
-\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
% \end{macrocode}
%\end{Macro}
%
@@ -2977,7 +2986,7 @@ and etextools-examples.tex
% \begin{macrocode}
\def\ettl@ifdef[#1]{\expandafter\ettl@ifd@f\expandafter{#1}}
\def\ettl@ifd@f#1#2{%
- \csdef{ettl@ifdef#2}##1#1##2/End§Meaning/{\ettl@nbk##2//{\rmn@firstoftwo}{\rmn@secondoftwo}//}
+ \csdef{ettl@ifdef#2}##1#1##2/End§Meaning/{\ettl@nbk##2//\rmn@firstoftwo\rmn@secondoftwo//}
\csedef{ifdef#2}##1{\noexpand\romannumeral\noexpandafter%
\noexpandcs{ettl@ifdef#2}\noexpand\meaning##1#1/End§Meaning/}%//{##2}{##3}//}
}
@@ -4267,9 +4276,12 @@ and etextools-examples.tex
% Then \cs{ettl@setresult} finishes the job:
% \begin{macrocode}
\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}}}%
+}
% \end{macrocode}
% \end{Macro}
% \end{Macro*}
@@ -4558,9 +4570,9 @@ and etextools-examples.tex
\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
{\long\def#4[##1]#5##2#5#5##3//##4/End§List/{\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§List/{\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§List/}%
\edef#7{\endgroup\expandafter#2\expandafter{#7}}#7}
\def\ettl@gobble@relax#1\relax{}
@@ -4583,16 +4595,13 @@ and etextools-examples.tex
% \cs{listgdel} make the assignment to the (shorter-)list global and \cs{listxdel} both expands the \prm{item} and
% makes the assignment global:
% \begin{macrocode}
-\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}}
% \end{macrocode}
@@ -4667,16 +4676,21 @@ and etextools-examples.tex
%
% We first need to get into a group where delimiter \CH{\textbar} and \CH{\&} have catcode 3:
% \begin{macrocode}
-\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§List/{\endgroup
- \romannumeral-`\q\ettl@setresult 1of1>#1<{\ettl@nbk##2//{#3*!{##1}}{-1}//}%
- }#2\ettl@getlistindex#2#5#4#6#4/End§List/}
-\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
+\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§List/{\endgroup
+ \ExpandAftercmds{\ettl@setresult 1of1>#1<}{\ettl@nbk##2//{#3*!{##1}}{-1}//}%
+ }#2\ettl@getlistindex#5#4#6#4/End§List/}
+\newrobustcmd\getlistindex{\@ifstar
+ {\@testopt{\ettl@get@listindex\relax}{}}
+ {\@testopt{\ettl@get@listindex\expandafter}{}}}
+\begingroup\catcode`\|=3% etb catcode
+\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
% \end{macrocode}
% \end{Macro}
@@ -4689,10 +4703,16 @@ and etextools-examples.tex
% \begin{Macro}{getcsvlistindex}
% The command is robust, not purely expandable:
% \begin{macrocode}
-\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}
% \end{macrocode}
% \end{Macro}
%
@@ -4811,11 +4831,359 @@ and etextools-examples.tex
% \begin{macrocode}
%</package>
% \end{macrocode}
+%
+% \section{Examples}
+% \label{sec:examples}
%
+% \begin{macrocode}
+%<*example>
+\documentclass[11pt,french,a4paper,oneside]{scrartcl}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[american]{babel}
+\usepackage{geometry,doc,ltxdockit,txfonts,fancyhdr,stmaryrd,graphicx,enumitem}
+\usepackage{etextools}
+%
+\usepackage{fancyvrb}
+%
+\makeatletter
+\let\org@newif\newif
+\def\newif#1{\ifx#1\ifnotempty\else\expandafter\org@newif\fi}
+\usepackage{umrand}
+\renewcommand\ifne[1]{\csname @\if\relax\detokenize{#1}\relax first\else second\fi oftwo\endcsname\iffalse\iftrue}
+\let\newif\org@newif
+\font\umranda=umranda \def\Ch{\char'}
+%
+\def\textvb#1{{\usefont{T1}{txtt}{m}{n}#1}}
+\newrobustcmd\thispackage{\xpackage{\spot etextools}\xspace}
+\newrobustcmd\xpackage[1]{{\usefont{T1}{lmss}{bx}{n}\db\mbox{#1}}}
+\hypersetup{colorlinks,pdfstartview={FitH}}
+\geometry{top=1.5cm,bottom=1.2cm,left=2.5cm,right=1cm}
+\fancyhf{}
+\fancyhead[L]{Examples for the \thispackage package}
+\pagestyle{fancy}
+\DefineShortVerb{\|}
+\catcode`\^^a7 \active\def^^a7{\par\nobreak\vskip-\parskip}
+\DefineVerbatimEnvironment{VerbLines}{Verbatim}
+ {gobble=1,commandchars=!(),frame=lines,framesep=6pt,fontfamily=txtt,fontseries=m}
+\apptocmd\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@}{}{}
+%
+\def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}}
+\def\FE{\setbox8\hbox{$\m@th\bindnasrepma$}%
+ \textcolor{fecc}{\scalebox{2}{$\copy8\mkern-13.5mu\copy8\mkern-13.5mu\copy8$}}}
+\def\pdfFE{\setbox8\hbox{$\m@th\bindnasrepma$}%
+ \textcolor{fecc}{\llap{\textsf{pdf}\TeX{}\,}\scalebox{2}{$\copy8\mkern-13.5mu\copy8\mkern-13.5mu\copy8$}}}
+\definecolor{fecc}{rgb}{.2,.6,.2}
+\definecolor{dg}{rgb}{0.00,0.37,0.00} \newrobustcmd\dg{\color{dg}} \newrobustcmd\dgbf{\dg\bfseries}
+\definecolor{spot}{rgb}{1.00,0.33,0.00} \newrobustcmd\spot{\color{spot}}
+\definecolor{db}{rgb}{0.00,0.00,0.25} \newrobustcmd\db{\color{db}}
+\newrobustcmd\blue{\color{blue}}
+\newrobustcmd\nnn{\normalfont\mdseries\upshape}
+%
+\newrobustcmd\ClearPage{\@ifstar\clearpage{}}
+\def\make@macro#1{\string\def\string#1\parameters@meaning#1\string{\strip@meaning#1\string}}
+\newcommand\preline{\@ifstar{\@preline}{\hrulefill\par\@preline}}
+\newcommand\@preline[2][1.5ex]{\noindent\hskip6pt\textvb{\make@macro#2}\par\ifblank{#1}{}{\vskip#1}}
+%
+\ifdef\pdfstrcmp{\let\ifpdfTeX\iffalse}{\let\ifpdfTeX\iftrue}
+%
+\newcommand*\test{\@ifstar{\let\fe\pdfFE\testi}{\let\fe\FE\testi}}
+\newcommand\testi[1]{%
+ \csname test#1\endcsname
+ \edef\usercmd{\strip@meaningcs{test#1}}\edef\result{\meaningcs{#1Test}}\noindent
+ \begin{tabular}{lp{15cm}}
+ \multicolumn{2}{l}{\textcolor{blue}{\llap{\fe\,\smex}\tt \usercmd}} \\[1.5ex]
+ \cmd{#1Test}= & \tt\bfseries\result
+ \end{tabular}\par\nobreak\hrulefill\null\goodbreak}
+%
+\begin{document}
+\title{\vskip-2cm\thispackage\ examples}
+\subtitle{Examples for some macros provided by the \thispackage package}
+\author{\small<FC -- April 20, 2010>}
+\date{}
+%
+\newsavebox\helpbox \newsavebox\helpboxx
+\newrobustcmd*\mydotleader[2][\z@]{\leavevmode\xleaders\hbox to\dimexpr1.7pt+#1{\hss\raise#2\hbox{$\scriptscriptstyle\cdotp$}\hss}}
+\begingroup\let\clearpage\@empty
+\setbox\helpbox\hbox to13cm{\hss\lower3cm\vbox to1.8cm{\maketitle\vss}\hss}
+\fboxsep\z@
+\newrobustcmd\corner[2][\spot\umranda]{\hbox{#1\rlap{\char'115}\char'#2}}
+\null\vskip-1cm\hskip-1cm\null\hfil\RandBox {\fbox{\copy\helpbox}}
+ font {\umranda} [0pt]
+ (\corner{17}) ([\Ch111]) (\corner{14})
+ ([\Ch112]) ([\Ch112])
+ (\corner{21}) ([\Ch111]) (\corner{11})
+\endgroup
+%
+\tableofcontents\hyperdef{ettlex}{toc}{}
+%
+\section{\cmd{expandnext} examples}
+%
+\subsection{Test if the replacement text of macro is really empty}
+%
+\def\xx{ }
+\def\testexpandnext{%
+ \edef\expandnextTest{\string\xx\ is \expandnext\ifempty{\xx}{}{not} empty}
+}
+\preline\xx
+\test{expandnext}
+%
+\def\xx{}
+\preline\xx
+\test{expandnext}
+%
+\ClearPage*
+\subsection{Test if the replacement text of a macro is blank (empty or spaces)}
+%
+\def\xx{something}
+\def\testexpandnext{%
+ \edef\expandnextTest{\string\xx\ is \expandnext\ifblank{\xx}{}{not} blank}
+}
+\preline\xx
+\test{expandnext}
+%
+\def\xx{ }
+\preline\xx
+\test{expandnext}
+%
+\section{\cmd{ExpandNext} examples}
+%
+Example of the main documentation file to reverse the order of the characters in a string:
+%
+\def\swap#1#2{{#2#1}} \def\do[#1]#2{\swap #2}% \do{abcdef} -> \swap ab + cdef -> {ba}cdef
+ % \do{{ba}cdef} -> \swap {ba}c + def -> {cba}def
+%
+\edef\result{\naturalloop[\do]{4}{12345}}
+\ExpandNext{\def\RESULT}{\naturalloop[\do]{4}{12345}}
+%
+\begin{VerbLines}
+\def\swap#1#2{{#2#1}} \def\do[#1]#2{\swap #2}
+\edef\result{\naturalloop[\do]{4}{12345}}
+\meaning\result = !bfseries!meaning!result
+\ExpandNext{\def\RESULT}{\naturalloop[\do]{4}{12345}}
+\meaning\RESULT = !bfseries!meaning!RESULT
+\end{VerbLines}
+%
+\subsection{Test the parameter string of a macro}
+%
+The following commands create the filter for the string: "\textvb{[\#1]\#2"}":^^a7
+\begin{VerbLines}[commandchars=!()]
+\ExpandNext{(!blue\DeclareStringFilter\ParaFilt)}
+ {\ExpandAftercmds\@gobblescape{\expandafter\string\csname(!blue[#1]#2)\endcsname}}
+\end{VerbLines}
+%
+\ExpandNext{\DeclareStringFilter\ParaFilt}
+ {\ExpandAftercmds\@gobblescape{\expandafter\string\csname[#1]#2\endcsname}}
+%
+\begin{enumerate}[label=\arabic*)~,noitemsep,nolistsep]
+\item |\csname[#1]#2\endcsname| is expanded first
+\item Immediately after: |\string|
+\item At this stage: |\[#1]#2| (everything in category code other) is no more expandable
+\item Then |\ExpandAftercmds| expands |\@gobblescape|
+\item |[#1]#2| is no more expandable
+\item Then |\ExpandNext| expands its first argument: |\DeclareStringFilter\ParaFilt{[#1]#2}|
+\end{enumerate}
+%
+Remark: |\detokenize| would have doubled the \# characters. Another possibility is to temporarily change the
+category code of \# to 12 (other):
+\begin{VerbLines}[commandchars=!()]
+\begingroup\catcode`\#=12
+ (!blue\DeclareStringFilter\ParaFilt{[#1]#2}) !nnn global declaration
+\endgroup
+\end{VerbLines}
+%
+\def\macroA#1#2{Something to do with #1 and #2}
+\def\macroB[#1]#2{Something to do with #1 and #2}
+%
+\preline[]\macroA
+\preline*[]\macroB
+\begin{Verbatim}[commandchars=!()]
+ !blue\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroA}{macro complies with [\#1]\#2}
+ !blue{macro does not comply }
+\end{Verbatim}
+%
+\hfill\textvb{\dgbf\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroA}{macro complies with [\#1]\#2}
+ {macro does not comply }}
+\begin{Verbatim}[commandchars=!()]
+ !blue\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroB}{macro complies with [\#1]\#2}
+ !blue{macro does not comply }
+\end{Verbatim}
+\hfill\textvb{\dgbf\ExpandNext{\ParaFilt=.}{\parameters@meaning\macroB}{macro complies with [\#1]\#2}
+ {macro does not comply }}
+\par\hrulefill\par
+%
+\ClearPage*
+\section{Testing characters}
+\subsection{\cmd{ifsinglechar} versus \cmd{iffirstchar}}
+\def\testifsinglechar{%
+ \edef\ifsinglecharTest{\ifsinglechar *{*hello*}{ single star }{ something else }}
+}\hrulefill\par
+\test{ifsinglechar}
+%
+\def\testifsinglechar{%
+ \edef\ifsinglecharTest{\ifsinglechar *{ *}{ single star }{ something else }}
+}\hrulefill\par
+\test{ifsinglechar}
+%
+\def\testifsinglechar{%
+ \edef\ifsinglecharTest{\ifsinglechar *{ * }{ single star }{ something else }}
+}\hrulefill\par
+\test{ifsinglechar}
+{\small Note the space \textbf{after} the star $\uparrow$.}
+%
+\def\testiffirstchar{%
+ \edef\iffirstcharTest{\iffirstchar *{*hello*}{ first char is star }{ something else }}
+}\hrulefill\par
+\test{iffirstchar}
+%
+\subsection{Fully Expandable starred macros}
+\def\starmacro#1{\FE@ifstar{#1}\starred\notstarred}
+\def\starred#1{your "#1" will be processed by the STAR form}
+\def\notstarred#1{your "#1" will be processed by the NORMAL form}
+\def\testFE@ifstar{%
+ \edef\FE@ifstarTest{\starmacro{sample text}}}
+\preline\starmacro
+\preline*\starred
+\preline*\notstarred
+\test{FE@ifstar}
+%
+\def\testFE@ifstar{%
+ \edef\FE@ifstarTest{\starmacro*{sample text}}}
+\hrulefill\par
+\test{FE@ifstar}
+%
+\subsection{Fully Expandable macros with options}
+\def\optmacro#1{\FE@testopt{#1}\OPTmacro{Mr.}}
+\def\OPTmacro[#1]#2{#1 #2}
+\def\testFE@testopt{%
+ \edef\FE@testoptTest{\optmacro{Woody Allen}}}
+\preline\optmacro
+\preline*\OPTmacro
+\test{FE@testopt}
+%
+\def\testFE@testopt{%
+ \edef\FE@testoptTest{\optmacro[Ms.]{Vanessa Paradis}}}
+\hrulefill\par
+\test{FE@testopt}
+%
+\ClearPage*
+\section{Lists management}
+%
+\subsection{\cmd{csvloop} and \cmd{csvloop*} examples}
+%
+\subsubsection{\cmd{makequotes}}
+\def\makequotes#1{"#1"\space}
+\def\testcsvloop{%
+ \edef\csvloopTest{\csvloop*[\makequotes]{hello,world}}
+}
+\preline\makequotes
+\test{csvloop}
+%
+\subsubsection{\cmd{detokenize}}
+\def\testcsvloop{%
+ \edef\csvloopTest{\csvloop*[\detokenize]{\un,\deux}}
+}\hrulefill\par
+\test{csvloop}
+%
+\subsubsection{\cmd{numexpr}}
+\def\mylist{1,2,3,4,5}\def\BySeven#1{$#1\times 7 = \number\numexpr#1*7\relax$\par}
+\def\testcsvloop{%
+ \edef\csvloopTest{\csvloop[\BySeven]\mylist}}
+\preline\mylist
+\preline*\BySeven
+\test{csvloop}
+%
+\subsubsection{protected \cmd{textbf}}
+\def\testcsvloop{%
+ \protected@edef\csvloopTest{\csvloop*[\textbf]{hello ,my ,friends}}
+}\hrulefill\par
+\test{csvloop}
+%
+\subsection{Index in lists and items by index}
+%
+\subsubsection{\cmd{listloop}: getting specific item}
+\csvtolist*[\mylist]{one,two,three,four,five,alpha,beta,gamma}
+\def\testgetlistitem{%
+ \edef\getlistitemTest{\listloop[4]\mylist}
+}\hrulefill\par
+\noindent\hskip6pt|\csvtolist*[\mylist]{one,two,three,four,five,alpha,beta,gamma}|\par\vskip1.5ex
+\test{getlistitem}
+%
+\ClearPage*
+\subsubsection{\cmd{getlistindex}}
+\ifpdfTeX
+\leavevmode\vadjust{\textsl{Require the }\string\pdfstrcmp\ \textsl{primitive (pdf\TeX{}) :}}
+\def\testgetlistindex{%
+ \edef\getlistindexTest{\getlistindex{alpha}\mylist}
+}\hrulefill\par
+\noindent\hskip6pt|\csvtolist*[\mylist]{one,two,three,four,five,alpha,beta,gamma}|\par\vskip1.5ex
+\test*{getlistindex}
+%
+\leavevmode\vadjust{\textsl{Require the }\string\pdfstrcmp\ \textsl{primitive (pdf\TeX{}) :}}
+\def\testgetlistindex{%
+ \edef\getlistindexTest{\getcsvlistindex*{alpha}{one,two,three,four,five,alpha,beta}}
+}\hrulefill\par
+\test*{getlistindex}
+\fi
+\hrulefill\par
+%
+\getlistindex[\myindex]{alpha}\mylist
+{\color{blue}\noindent\hskip6pt\llap\smex|\getlistindex[\myindex]{alpha}\mylist|\par\vskip1.5ex}
+{\tt\string\myindex=\quad\textbf{\meaning\myindex}}
+\par\hrulefill\par\vskip.5ex
+%
+\hrulefill\par
+\newcount\myindex
+\getcsvlistindex*[\myindex]{alpha}{one,two,three,four,five,alpha,beta}
+\noindent\hskip6pt|\newcount\myindex|\par
+{\color{blue}\noindent\hskip6pt\llap\smex|\getcsvlistindex*[\myindex]{alpha}{one,two,three,four,five,alpha,beta}|}\par\vskip.5ex
+{\tt\string\the\string\myindex=\qquad\textbf{\the\myindex}}
+\par\hrulefill\par\vskip.5ex
+%
+\ClearPage
+\subsubsection{\cmd{gettokslistindex} with \cmd{ifcase}}
+%
+\hrulefill\par\vskip2ex\noindent
+\llap{\FE\,\smex}\par\vskip-2.5\baselineskip\strut
+\leavevmode\vadjust{Always purely expandable (no need of |\pdfstrcmp|, comparison done by |\ifx|):}
+\begin{Verbatim}
+ \ifcase \gettokslistindex{D}{LRDF\relax O}
+ What do to if L
+ \or What do to if R
+ \or What do to if D
+ \or What do to if F
+ \or What do to if \relax
+ \or What do to if O
+ \else Problem
+ \fi
+\end{Verbatim}
+%
+{\tt Result=\qquad\bfseries
+\ifcase\gettokslistindex{D}{LRDF}
+ What do to if L
+\or What do to if R
+\or What do to if D
+\or What do to if F
+\else Problem
+\fi}\par
+\hrulefill\par\vskip.5ex
+%
+\end{document}\endinput
+%</example>
+% \end{macrocode}
+%
+% \phantomsection
% \Section*{Revision history}
% \addcontentsline{toc}{section}{\texorpdfstring\dr{}\hskip\dimexpr\cftsecnumwidth-4pt Revision history}^^A not in .cmd file
%
% \begin{changelog}\footnotesize
+%
+% \begin{release}{3.14159}{2010-04-20}
+% \item \cs{ettl@thefontname} overwrote \cs{T1/cmr/m/n/10} on the log file when the font \sty{ecmr1000} was used.\\
+% Fixed + modification of \cmdref{thefontname} in order to get both \TeX{} and \LaTeX{} font names.
+% \item Correction of bugs into \cmdref{listdel}
+% \item Joining the example file \sty{etextools-examples.tex} to this \sty{.dtx} file.
+% \end{release}
%
% \begin{release}{3.1415}{2009-10-14}
% \item Correction of a bug in \cmdref{locinterplin}.
@@ -4888,7 +5256,7 @@ and etextools-examples.tex
% \cmdref{ifempty}, \cmdref{toksloop}, \cmdref{tokstolist} and \cmdref{tokstolistadd}
% \item
% Modification of \cmdref{ifsinglechar}\\
-% |\ifsinglechar| now works with |\ifempty| so that:\\
+% \cmdref{ifsinglechar} now works with \cmdref{ifempty} so that:\\
% \begin{tabbing}
% \quad\=|\macro{ * }|\quad\= is no more considered as a starred form \\
% \>\>because of the spaces following the |*| \\
diff --git a/Master/texmf-dist/source/latex/etextools/etextools.ins b/Master/texmf-dist/source/latex/etextools/etextools.ins
index 400c7eb666d..4026cb2ada4 100644
--- a/Master/texmf-dist/source/latex/etextools/etextools.ins
+++ b/Master/texmf-dist/source/latex/etextools/etextools.ins
@@ -19,11 +19,11 @@
%% 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)
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation *}
-\Msg{* Package: etextools 2009/10/14 v.3.1415 e-TeX tools for LaTeX Users and package Writers *}
+\Msg{* Package: etextools 2010/04/20 v.3.14159 e-TeX tools for LaTeX Users and package Writers *}
\Msg{************************************************************************}
\keepsilent
@@ -55,6 +55,7 @@ and etextools-examples.tex
\askforoverwritefalse
\generate{%
\file{etextools.drv}{\from{etextools.dtx}{driver}}%
+ \file{etextools-examples.tex}{\from{etextools.dtx}{example}}%
}
\obeyspaces
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{%