diff options
author | Karl Berry <karl@freefriends.org> | 2009-07-22 22:47:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-07-22 22:47:01 +0000 |
commit | 20e5e430bf97131e6017ba654705d49ec2cf28dd (patch) | |
tree | 07bfcc17686230714473425269a8cdbf52561e0e /Master/texmf-dist/doc | |
parent | 586bef91a24aca48fc2fe6f6d122746585d2baa5 (diff) |
etextools 2e (22jul09)
git-svn-id: svn://tug.org/texlive/trunk@14372 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/README | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf | bin | 0 -> 76753 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/etextools-examples.tex | 182 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/etextools/etextools.pdf | bin | 443463 -> 531368 bytes |
4 files changed, 184 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/etextools/README b/Master/texmf-dist/doc/latex/etextools/README index a15dfe9ca60..3a58e58ebe2 100644 --- a/Master/texmf-dist/doc/latex/etextools/README +++ b/Master/texmf-dist/doc/latex/etextools/README @@ -1,6 +1,7 @@ % This work consists of the main source file etextools.dtx % and the derived files -% etextools.sty, etextools.pdf, etextools.ins, +% etextools.sty, etextools.pdf, etextools.ins, +% and etextools-examples.tex % % Unpacking: % (a) If etextools.ins is present: diff --git a/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf b/Master/texmf-dist/doc/latex/etextools/etextools-examples.pdf Binary files differnew file mode 100644 index 00000000000..12efa0070df --- /dev/null +++ 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 new file mode 100644 index 00000000000..a8b96ae1837 --- /dev/null +++ b/Master/texmf-dist/doc/latex/etextools/etextools-examples.tex @@ -0,0 +1,182 @@ +%% +%% 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. +%% +%% Copyright (C) 2009 by Florent Chervet <florent.chervet@free.fr> +%% +%% 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 : more e-TeX useful tools for LaTeX package writers +%%% Florent CHERVET +\documentclass[11pt,french,a4paper,oneside]{scrartcl} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[american]{babel} +\usepackage{geometry,doc,ltxdockit,txfonts,fancyhdr} +\usepackage{etextools} +\hypersetup{colorlinks,pdfstartview={FitH}} +\geometry{top=2cm,bottom=2cm,left=2.5cm,right=1cm} +\fancyhf{} +\fancyhead[L]{Examples for the \sty{etextools} package} +\pagestyle{fancy} +\MakeShortVerb{\|} + +\makeatletter +\def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} +\def\strip@meaning{\expandafter\strip@prefix\meaning} +\def\strip@macro{\expandafter\strip@macroprefix\meaning} +\def\get@params#1{\expandafter\@get@params\meaning#1\@nil} +\edef\@get@params{% + \def\noexpand\@get@params\detokenize{macro:}##1\detokenize{->}##2\noexpand\@nil{##1}% +}\@get@params +\def\make@macro#1{\string\def\string#1\get@params#1\string{\strip@meaning#1\string}} +\newcommand\preline{\@ifstar{\@preline}{\hrulefill\par\@preline}} +\def\@preline#1{\noindent\hskip6pt\texttt{\make@macro#1}\par\vskip1.5ex} + +\def\meaningcs#1{\expandafter\meaning\csname#1\endcsname} +\def\Meaningcs#1{\expandafter\strip@meaning\csname #1\endcsname} + +\newcommand\test[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] + \cmd{#1Test}= & \tt\bfseries\result + \end{tabular}\par\nobreak\hrulefill\null\goodbreak} + +\begin{document} +\title{etextools examples} +\subtitle{Examples for some macros provided by the \sty{etextools} package} +\author{Florent Chervet} +\date{July 22, 2009} +\maketitle + +\tableofcontents + +\section{\cmd{expandnext} examples} + +\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} + +\clearpage +\subsection{Detokenize the replacement text of a named-sequence} +\def\detokenizecs#1{\expandnext\expandnext\detokenize{\csname #1\endcsname}} +\def\testexpandnext{% + \edef\expandnextTest{\detokenizecs{document}}} +\preline\detokenizecs +\test{expandnext} + +\section{Testing characters} +\subsection{\cmd{ifsinglechar} versus \cmd{iffirstchar}} +\def\testifsinglechar{% + \edef\ifsinglecharTest{\ifsinglechar *{*hello*}{ single star }{ something else }} +}\hrulefill\par +\test{ifsinglechar} + +\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} + +\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{testbf}} +\def\testcsvloop{% + \protected@edef\csvloopTest{\csvloop*[\textbf]{hello ,my ,friends}} +}\hrulefill\par +\test{csvloop} + +\subsection{\cmd{getlistitem}} +\csvtolist*\mylist{one,two,three,four,five,alpha,beta,gamma} +\def\testgetlistitem{% + \edef\getlistitemTest{\getlistitem\mylist{4}} +}\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 +\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}{four}\cmd{mylist}}\par\vskip1.5ex +\noindent\hskip6pt\cmd{indexinlist}=\quad{\bfseries\meaning\indexinlist}\par\hrulefill\par + +\end{document} + +\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 Binary files differindex 345e0745102..77103fd7539 100644 --- a/Master/texmf-dist/doc/latex/etextools/etextools.pdf +++ b/Master/texmf-dist/doc/latex/etextools/etextools.pdf |