diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-15 23:34:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-15 23:34:56 +0000 |
commit | 27f9cb520563a0b8df6d876f02cdb267be5b6116 (patch) | |
tree | 9ad3871f8a40fcf6450053e16e3f6f8b1addfb8a /Master/texmf-dist/doc/latex/etextools | |
parent | bf8d9b1bb7480816950fe25c98685724d843378e (diff) |
etextools update (15aug09)
git-svn-id: svn://tug.org/texlive/trunk@14694 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/etextools')
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf | bin | 79220 -> 80209 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/etextools-examples.tex | 97 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/etextools.pdf | bin | 564537 -> 635108 bytes |
3 files changed, 86 insertions, 11 deletions
diff --git a/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf b/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf Binary files differindex 2ed2e95f2c5..3906cf7c21e 100644 --- a/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf +++ b/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf diff --git a/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex index 97c800e3fe3..572e76e479d 100644 --- a/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex +++ b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex @@ -21,15 +21,16 @@ %% etextools.sty, etextools.pdf, etextools.ins, %% and etextools-examples.tex %% -%%% etextools : more e-TeX useful tools for LaTeX package writers +%%% etextools : more e-TeX useful tools for LaTeX package writers (v. + \documentclass[11pt,french,a4paper,oneside]{scrartcl} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage[american]{babel} -\usepackage{geometry,doc,ltxdockit,txfonts,fancyhdr} +\usepackage{geometry,doc,ltxdockit,txfonts,fancyhdr,stmaryrd,graphicx,fancyvrb} \usepackage{etextools} \hypersetup{colorlinks,pdfstartview={FitH}} -\geometry{top=2cm,bottom=2cm,left=2.5cm,right=1cm} +\geometry{top=1.5cm,bottom=1.2cm,left=2.5cm,right=1cm} \fancyhf{} \fancyhead[L]{Examples for the \sty{etextools} package} \pagestyle{fancy} @@ -37,6 +38,9 @@ \makeatletter \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$}}} +\definecolor{fecc}{rgb}{.2,.6,.2} \def\strip@meaning{\expandafter\strip@prefix\meaning} \def\strip@macro{\expandafter\strip@macroprefix\meaning} \def\get@params#1{\expandafter\@get@params\meaning#1\@nil} @@ -49,12 +53,14 @@ \def\meaningcs#1{\expandafter\meaning\csname#1\endcsname} \def\Meaningcs#1{\expandafter\strip@meaning\csname #1\endcsname} +\@ifundefined{pdfstrcmp}{\let\ifpdfTeX\iffalse}{\let\ifpdfTeX\iftrue} -\newcommand\test[1]{% +\newcommand*\test{\@ifstar{\let\fe\relax\testi}{\let\fe\FE\testi}} +\newcommand\testi[1]{% \csname test#1\endcsname \edef\usercmd{\Meaningcs{test#1}}\edef\result{\meaningcs{#1Test}}\noindent \begin{tabular}{lp{15cm}} - \multicolumn{2}{l}{\textcolor{blue}{\llap\smex\tt \usercmd}} \\[1.5ex] + \multicolumn{2}{l}{\textcolor{blue}{\llap{\fe\,\smex}\tt \usercmd}} \\[1.5ex] \cmd{#1Test}= & \tt\bfseries\result \end{tabular}\par\nobreak\hrulefill\null\goodbreak} @@ -157,7 +163,9 @@ \test{FE@testopt} \section{Lists management} + \subsection{\cmd{csvloop} and \cmd{csvloop*} examples} + \subsubsection{\cmd{makequotes}} \def\makequotes#1{"#1"\space} \def\testcsvloop{% @@ -165,11 +173,13 @@ } \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{% @@ -177,26 +187,91 @@ \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{\cmd{getlistitem}} +\subsection{Index in lists and items by index} + +\subsubsection{\cmd{getlistitem}} \csvtolist*\mylist{one,two,three,four,five,alpha,beta,gamma} \def\testgetlistitem{% - \edef\getlistitemTest{\getlistitem\mylist{4}} + \edef\getlistitemTest{\getlistitem{4}\mylist} }\hrulefill\par \noindent\hskip6pt|\csvtolist*\mylist{one,two,three,four,five,alpha,beta,gamma}|\par\vskip1.5ex \test{getlistitem} -\subsection{\cmd{getlistindex} {\mdseries(not expandable)}} -\getlistindex{four}\mylist +\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}} +\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}} +\hrulefill\par\vskip.5ex + +\subsubsection{\cmd{xgetlistindex}} +\ifpdfTeX +\leavevmode\vadjust{\textsl{Require the }\string\pdfstrcmp\ \textsl{primitive (pdf\TeX{}) :}} +\def\x{beta} +\def\testxgetlistindex{% + \edef\xgetlistindexTest{\xgetlistindex{\x}\mylist} +}\hrulefill\par \noindent\hskip6pt|\csvtolist*\mylist{one,two,three,four,five,alpha,beta,gamma}|\par\vskip1.5ex -\noindent\hskip6pt\textcolor{blue}{\llap\smex\cmd{getlistindex}\string{four\string}\cmd{mylist}}\par\vskip1.5ex -\noindent\hskip6pt\cmd{indexinlist}=\quad{\bfseries\meaning\indexinlist}\par\hrulefill\par +\preline*\x +\test{xgetlistindex} +\fi + +\subsubsection{\cmd{getlistindex} with \cmd{ifcase}} + +\leavevmode\vadjust{Always purely expandable (no need of |\pdfstrcmp|, comparison done by |\ifx|):} +\hrulefill\par\noindent +\llap{\FE\,\smex}\par\vskip-2.5\baselineskip\strut +\begin{Verbatim} + \ifcase \gettokslistindex*{D}{LRDF\relax O} + Problem + \or 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 + \fi +\end{Verbatim} + +{\tt Result=\qquad\bfseries +\ifcase\gettokslistindex*{D}{LRDF} + Problem +\or What do to if L +\or What do to if R +\or What do to if D +\or What do to if F +\fi}\par +\hrulefill\par\vskip.5ex \end{document} diff --git a/Master/texmf-dist/doc/latex/etextools/etextools.pdf b/Master/texmf-dist/doc/latex/etextools/etextools.pdf Binary files differindex 1a20a8f26f6..5e82e254a98 100644 --- a/Master/texmf-dist/doc/latex/etextools/etextools.pdf +++ b/Master/texmf-dist/doc/latex/etextools/etextools.pdf |