summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex')
-rw-r--r--Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex100
1 files changed, 100 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex
index d44bae56932..4c8736fa396 100644
--- a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex
+++ b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex
@@ -9,6 +9,7 @@
\usepackage[margin=3cm]{geometry}
\usepackage{fancybox}
\usepackage{xcolor}
+\usepackage{listings,MnSymbol}
\def\listofitems{\textsf{\loiname}\xspace}
\def\eTeX{\hbox{$\varepsilon$-\TeX}}
\makeatletter
@@ -485,4 +486,103 @@ And returned on the previous night.}
A word = \word|
The macro \verb|\gitemtomacro| makes a global assignment.
+
+\section{Balanced Tokens}
+
+For the parsing of items, it is possible, with version 1.6, to take into
+ account the presence of \emph{balanced tokens}.
+Thus, if a list of paired tokens is defined, then each parsed item
+ in the list will extend to the first \verb|<separator>|, while assuring
+ that any paired tokens are balanced (i.e., occur in matched pairs within
+ the item).
+
+To define a list of balanced-token pairs, we use
+
+\code|\defpair{<tok1><tok2><tok3><tok4>...}|
+
+where the token list is read in pairs to form each matched-token pair.
+A \verb|<token>| that serves within a matched pair must consist of
+ a single character---%
+macros, primitives, spaces, braces, the token
+ "\verb|#|", as well as sets of several-tokens-between-%
+ braces are all forbidden.
+The two tokens which form a pair \emph{must} be different from
+ each other.
+
+\exemple/\setsepchar{+||-}
+\defpair{()[]}
+\readlist\terms{1+2*[3+4*(5+6-7)+8]-9+10}
+\showitems\terms/
+
+To return to the package's default behavior, that is, without
+ paired tokens, you must execute
+
+\code|\defpair{}|
+
+In an expression, in order to store in a macro that which
+ is between two matched tokens, we can call on
+
+\code|\insidepair<tok1><tok2>{<expression>}\macro|
+
+which will put in the \verb|\macro| that which lies between the pair
+ \verb|<tok1><tok2>| in the \verb|<expression>|.
+
+\exemple/\setsepchar{+||-}
+\defpair{()}
+\readlist\terms{1+2*(3+4*(5+6-7)+8)-9+10}
+\showitems\terms
+
+\itemtomacro\terms[2]\parenterm
+In the outer parenthesis:
+\insidepair()\parenterm\inbigparen
+"\inbigparen"
+
+In the inner parenthesis:
+\insidepair()\inbigparen\insmallparen
+"\insmallparen"/
+
+\section{The Code}
+
+Any suggestion, bug report, remark, request, addition or modification
+ of functionality is welcome; in this case, I invite users of
+ \listofitems to send me an email to \verb|unbonpetit@netc.fr|.\medbreak
+
+The code below is the exact verbatim of the file \verb|listofitems.tex|.
+I hope that the few comments scattered throughout it will
+ be enough for the user or the curious to understand the internal
+ machinery of this package:
+
+
+\lstinputlisting[
+ language=TeX,
+ inputencoding=latin1,
+ moretexcs={unless,ifcsname,ifdefined,detokenize,numexpr,dimexpr,glueexpr,unexpanded},
+ basicstyle=\small\ttfamily\color{black!25},
+ identifierstyle=\bfseries\color{white},%
+ backgroundcolor=\color{black!85},
+ keywordstyle=\bfseries\color{orange},
+ commentstyle=\color{cyan!66},
+ columns=fixed,
+ alsoletter={\_},
+ tabsize=2,
+ extendedchars=true,
+ showspaces=false,
+ showstringspaces=false,
+ numbers=left,
+ numberstyle=\tiny\ttfamily\color{black},
+ breaklines=true,
+ prebreak={\hbox{$\rhookswarrow$}},
+ breakindent=3em,
+ breakautoindent=true,
+ xleftmargin=1em,
+ xrightmargin=0pt,
+ lineskip=0pt,
+ numbersep=1em,
+ classoffset=1,
+ alsoletter={\_},
+ morekeywords={defpair,insidepair,setsepchar,greadlist,readlist,listlen,foreachitem,%
+ showitems,showitemsmacro,itemtomacro,gitemtomacro,ignoreemptyitems,reademptyitems},
+ keywordstyle=\bfseries\color{red!85!black},
+ classoffset=0,
+ ]{listofitems.tex}
\end{document} \ No newline at end of file