diff options
author | Karl Berry <karl@freefriends.org> | 2009-03-14 22:24:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-03-14 22:24:54 +0000 |
commit | 522c6836e3d77dffdd3ed6cebaef5d4bf24153bd (patch) | |
tree | 91124b9800b8147357eaea1aafca55bf30d30a58 /Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex | |
parent | 08d1f478c9d52e98ea8b2c89882f7f6db1d448d0 (diff) |
xstring 1,5b (14mar09)
git-svn-id: svn://tug.org/texlive/trunk@12389 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex b/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex index c0c292dadd8..f304d37a87f 100644 --- a/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex +++ b/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex @@ -17,9 +17,9 @@ \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} -\usepackage[dvips,colorlinks=true,hyperfootnotes=false,citecolor=black,filecolor=black,linkcolor=blue,urlcolor=blue,bookmarks=false,pdfauthor={Christian Tellechea},pdftitle={xstring},pdfsubject={package for strings of tokens},pdfkeywords={xstring,latex,string},pdfcreator={LaTeX}]{hyperref} +\usepackage[dvips,colorlinks=true,hyperfootnotes=false,citecolor=black,filecolor=black,linkcolor=blue,urlcolor=magenta,bookmarks=false,pdfauthor={Christian Tellechea},pdftitle={xstring},pdfsubject={package for strings of tokens},pdfkeywords={xstring,latex,string},pdfcreator={LaTeX}]{hyperref} \usepackage[a4paper,dvips,margin=1.9cm]{geometry} -\usepackage{amsmath,amssymb,amsfonts,textcomp} +\usepackage{amsmath,amssymb,amsfonts} \usepackage{color} \usepackage{lmodern} \usepackage{eurosym} @@ -171,7 +171,9 @@ This manual is a translation of the french manual. I apologize for my poor english but I did my best\footnote{Any email to tell me errors would be appreciated!}, and I hope that the following is comprehensible! \section{Presentation} \subsection{Description} -This extension\footnote{This extension does not require \LaTeX{} and can be compiled with Plain $\varepsilon$-\TeX{}.} provides macros and tests operating on strings of tokens, i.e. \TeX{} code, as other programmation languages have. They provides the usual strings operations, such as: test if a string contains another, begins or ends with another, extractions of strings, calculation of the position of a substring, of the number of occurrences, etc.\medskip +This extension\footnote{This extension does not require \LaTeX{} and can be compiled with Plain $\varepsilon$-\TeX{}.} provides macros and tests operating on "strings of tokens", as other programmation languages have. They provides the usual strings operations, such as: test if a string contains another, begins or ends with another, extractions of strings, calculation of the position of a substring, of the number of occurrences, etc.\medskip + +A "string of tokens" is a list of tokens of any nature, except that braces must be balanced and tokens catcode 6 and 14 (usualy \verb|%| et \verb|#|) are not allowed. Apart from this, any token is allowed, in any order in the list, whatever be the resulting code.\medskip \Xstring reads the arguments of the macros \US by \US\footnote{In the \TeX{} code, a \US is a control sequence, a group between brace or a single char. See also page~\pageref{developpementarguments}.} : when \USs are \guill{simple} chars (catcode 10, 11 and 12), \Xstring logically read the argument char by char. \Xstring can also be used for programming purpose, including in arguments other tokens such as control sequences, braces and tokens with other catcodes. See chapter on reading mode and arguments expansion (page~\pageref{developpementarguments}), the command \verbinline|\verbtocs| (page~\pageref{verbtocs}) and the command \verbinline|\scancs| (page~\pageref{scancs}).\medskip @@ -197,7 +199,7 @@ In the following chapters, all the macros will be presented this plan: \textbf{Important}: in the following, a \argu{number} can be an integer written with numeric chars, a counter, or the result of an arithmetic operation made with the command \verbinline|\numexpr|.\smallskip -In the following, macros of \Xstring are displayed in {\makeatletter\color{@xs@keywordsxstring}red}. +All the macros of \Xstring are displayed in {\makeatletter\color{@xs@keywordsxstring}red}. \subsection{The tests} \subsubsection{\ttfamily\textbackslash IfSubStr} @@ -1148,7 +1150,7 @@ The command \verbinline|\fullexpandarg| is called by default, so all the argumen Of course, the expansion of argument can be canceled to find back the usual behaviour of \TeX{} with the comands \verbinline|\noexpandarg| or \verbinline|\normalexpandarg|.\medskip -Another expansion mode can be called with \verbinline|\expandarg|. In this case, the \textbf{first token} of each argument is expanded \emph{one time} while all other tokens are left unchanged (if you want the expansion of all tokens one time, you should call the macro \verbinline|\scancs*|, see page~\pageref{scancs}).\medskip +Another expansion mode can be called with \verbinline|\expandarg|. In this case, the \textbf{first token} of each argument is expanded \emph{one time} while all other tokens are left unchanged (if you want the expansion of all tokens one time, you should call the macro \verbinline|\StrExpand|, see page~\pageref{scancs}).\medskip The commands \verbinline|\fullexpandarg|, \verbinline|\noexpandarg|, \verbinline|\normalexpandarg| and \verbinline|\expandarg| can be called at any moment in the code; they behave as "switches" and they can be locally used in a group.\medskip @@ -1196,10 +1198,10 @@ In the following list, for every macro of the previous chapter, the arguments co \end{itemize} \parindent0pt -\subsubsection{Chars allowed in arguments} -First of all, whatever be the current expansion mode, \textbf{tokens with catcode 6 and 14 (usually {\ttfamily\#} and {\ttfamily\%}) are forbidden in all the arguments}\footnote{Maybe, the token {\ttfamily\#} will be allowed in a further version.}.\bigskip +\subsubsection{Chars and tokens allowed in arguments} +First of all, whatever be the current expansion mode, \textbf{tokens with catcode 6 and 14 (usually {\ttfamily\#} and {\ttfamily\%}) are forbidden in all the arguments}\footnote{Maybe, the token {\ttfamily\#} will be allowed in a future version.}.\bigskip -When full expansion mode is activated with \verbinline|\fullexpandarg|, arguments are expanded with an \verbinline|\edef| before they are read by the macro. Consequently, are allowed in arguments : +When full expansion mode is activated with \verbinline|\fullexpandarg|, arguments are expanded with an \verbinline|\edef| before they are read by the macro. Consequently, are allowed in arguments: \parindent3em \begin{itemize} \item letters (uppercase or lowercase, accented\footnote{For a reliable operation with accented letters, the \texttt{\string\fontenc} package with option \texttt{[T1]} and \texttt{\string\inputenc} with appropriated option must be loaded} or not), figures, spaces, and any other character with a catcode of 10, 11 ou 12 (punctuation signs, calculation signs, parenthesis, square bracket, etc).; @@ -1209,15 +1211,24 @@ When full expansion mode is activated with \verbinline|\fullexpandarg|, argument \end{itemize}\parindent0pt \smallskip -On the other hand, some chars\footnote{These chars are obtained with the keys \textsf{AtlGr}${}+{}$letter under GNU/Linux distributions.} like \officialeuro, \textcurrency, ¶, etc. will provoke errors.\medskip +When arguments are not expanded with the use of \verbinline|\noexpandarg|, other tokens can be put in a string whatever be the code they make: any control sequence, even undefined, any token catcode 13. Moreover, test tokens are allowed like \verbinline|\if| or \verbinline|\ifx|, even without their \verbinline|\fi|. On the same way, a \verbinline|\csname| without its \verbinline|\endcsname| is allowed. -When expansion is not full (\verbinline|\expandarg| or \verbinline|\noexpandarg| are active), allowed char in arguments are:\parindent3em -\begin{itemize} - \item those cited above; - \item any control sequence or token catocode 13, even undefined; - \item the special chars (\officialeuro, \textcurrency, ¶, etc.). -\end{itemize} -\parindent0pt +In this example, the argument contains a \verbinline|\ifx| \emph{without} the \verbinline|\fi|: the \verbinline|\StrBetween| command extracts and dislpays what is between \verbinline|\ifx| and \verbinline|\else|:\par\medskip\nobreak + +\begin{minipage}[c]{0.65\linewidth} +\begin{lstlisting} +\noexpandarg +\StrBetween{\ifx ab false \else true}{\ifx}{\else} +\end{lstlisting}% +\end{minipage}\hfill +\begin{minipage}[c]{0.35\linewidth} + \styleexercice + \noexpandarg + \StrBetween{\ifx ab false \else true}{\ifx}{\else} +\end{minipage} +\medskip + +When \verbinline|\expandarg| is used, the first token needs precaution since it is expanded one time: it must be defined. The other tokens are left unchanged like with \verbinline|\noexpandarg|. \subsection{Expansion of macros, optional argument} \label{argumentoptionnel} |