summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-17 01:39:17 +0000
committerKarl Berry <karl@freefriends.org>2008-11-17 01:39:17 +0000
commita2b37753f4b3df3c66f5e8e1644f4a9646c9aabb (patch)
tree0276fd468cf82730031fe18a29505e84fc894365 /Master/texmf-dist/doc/generic
parentff8d5e7c0f057c2c1a7abafc338b6f0b84020855 (diff)
xstring update (16nov08)
git-svn-id: svn://tug.org/texlive/trunk@11321 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic')
-rw-r--r--Master/texmf-dist/doc/generic/xstring/README4
-rw-r--r--Master/texmf-dist/doc/generic/xstring/test_etex.pdfbin56903 -> 56872 bytes
-rw-r--r--Master/texmf-dist/doc/generic/xstring/test_etex.tex30
-rw-r--r--Master/texmf-dist/doc/generic/xstring/test_latex.pdfbin66303 -> 66661 bytes
-rw-r--r--Master/texmf-dist/doc/generic/xstring/test_latex.tex25
-rw-r--r--Master/texmf-dist/doc/generic/xstring/xstring_doc_en.pdfbin208615 -> 210307 bytes
-rw-r--r--Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex92
-rw-r--r--Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.pdfbin226141 -> 228721 bytes
-rw-r--r--Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.tex16
9 files changed, 114 insertions, 53 deletions
diff --git a/Master/texmf-dist/doc/generic/xstring/README b/Master/texmf-dist/doc/generic/xstring/README
index 16b5f4bcfe5..0fc7ebf61d5 100644
--- a/Master/texmf-dist/doc/generic/xstring/README
+++ b/Master/texmf-dist/doc/generic/xstring/README
@@ -1,8 +1,8 @@
_________________
xstring package
- v1.4
- 2008/11/04
+ v1.4b
+ 2008/11/16
_________________
------------------------------------------------------------------------------
diff --git a/Master/texmf-dist/doc/generic/xstring/test_etex.pdf b/Master/texmf-dist/doc/generic/xstring/test_etex.pdf
index 13caea90c2f..69fdb0fe788 100644
--- a/Master/texmf-dist/doc/generic/xstring/test_etex.pdf
+++ b/Master/texmf-dist/doc/generic/xstring/test_etex.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/xstring/test_etex.tex b/Master/texmf-dist/doc/generic/xstring/test_etex.tex
index 8268b043e56..74e389db727 100644
--- a/Master/texmf-dist/doc/generic/xstring/test_etex.tex
+++ b/Master/texmf-dist/doc/generic/xstring/test_etex.tex
@@ -1,9 +1,27 @@
-%%%%%%%% WARNING %%%%%%%%
-% This is not a LaTeX file, it is a TeX file.
+%##################### WARNING #####################
+% This is NOT a LaTeX file, it is a TeX file.
% It must be compiled with eTeX typing <etex test_etex>
-%%%%%%%% ATTENTION %%%%%%%%
-% Ceci n'est pas un fichier LaTeX, c'est un fichier TeX.
+%#################### ATTENTION ####################
+% Ceci n'est PAS un fichier LaTeX, c'est un fichier TeX.
% Il doit être compil\'e avec eteX en tapant <etex test_etex>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Ceci est test_latex.tex, le fichier de test de xstring à compiler avec LaTeX
+% This is test_latex.tex, the test file of xstring to compile with LaTeX
+%
+% Christian Tellechea 2008
+%
+% email : unbonpetit@gmail.com
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 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
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input xstring
\def\delimiteur{-{}}
\font\hugerm=cmr10 scaled 1750
@@ -826,6 +844,8 @@ La commande {\tt\string\StrBetween} op\`ere en mode {\tt\string\noexploregroups}
\exemple|\detokenize\expandafter{\cmd}|\vskip0.7ex
\exemple|\StrSubstitute{\a1{2\a{3\a}4\a}\a5\a}{3\a}{XXX}[\cmd]|
\exemple|\detokenize\expandafter{\cmd}|\vskip0.7ex
+\exemple|\StrSubstitute{a1{b1\bgroup c1}\egroup d1}{1}{X}[\cmd]|
+\exemple|\detokenize\expandafter{\cmd}|\smallskip
\exemple|\exploregroups|
\exemple|\StrSubstitute{\a1{2\a{3\a}4\a}\a5\a}{\a}{\X}[\cmd]|
\exemple|\detokenize\expandafter{\cmd}|\vskip0.7ex
@@ -837,6 +857,8 @@ La commande {\tt\string\StrBetween} op\`ere en mode {\tt\string\noexploregroups}
\exemple|\detokenize\expandafter{\cmd}|\vskip0.7ex
\exemple|\StrSubstitute{\a1{2\a{3\a}4\a}\a5\a}{3\a}{XXX}[\cmd]|
\exemple|\detokenize\expandafter{\cmd}|
+\exemple|\StrSubstitute{a1{b1\bgroup c1}\egroup d1}{1}{X}[\cmd]|
+\exemple|\detokenize\expandafter{\cmd}|\smallskip
\chapitre{La macro}{StrDel}
diff --git a/Master/texmf-dist/doc/generic/xstring/test_latex.pdf b/Master/texmf-dist/doc/generic/xstring/test_latex.pdf
index 6d2e5a33cf0..ca71e773cbb 100644
--- a/Master/texmf-dist/doc/generic/xstring/test_latex.pdf
+++ b/Master/texmf-dist/doc/generic/xstring/test_latex.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/xstring/test_latex.tex b/Master/texmf-dist/doc/generic/xstring/test_latex.tex
index cccddd2cb24..e7f698e99ce 100644
--- a/Master/texmf-dist/doc/generic/xstring/test_latex.tex
+++ b/Master/texmf-dist/doc/generic/xstring/test_latex.tex
@@ -1,3 +1,20 @@
+% Ceci est test_latex.tex, le fichier de test de xstring à compiler avec LaTeX
+% This is test_latex.tex, the test file of xstring to compile with LaTeX
+%
+% Christian Tellechea 2008
+%
+% email : unbonpetit@gmail.com
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 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
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
@@ -10,7 +27,7 @@
\newcommand*\exemple{\@ifstar{\def\frontiere{|}\@xs@MakeVerb}{\def\frontiere{}\@xs@MakeVerb}}
\def\@xs@afterreadverb#1{%
- \normalexpandarg
+ \noexpandarg
\tokenize\cs@resultat{#1}%
\fullexpandarg
\leavevmode\hbox to0.7\linewidth{\hfil\tt#1}\quad\frontiere\cs@resultat\frontiere\hfil\par}%
@@ -20,7 +37,7 @@
\def\delimiteur{|}
\begin{document}
-\setlength{\parindent}{0pt}
+\parindent0pt
\begin{center}\Large{Ceci est le fichier de test de xstring}.\end{center}
\vspace{-1.8ex}\hrule\smallskip
@@ -914,6 +931,8 @@ La commande \verb|\StrBetween| opère en mode \verb|\noexploregroups|, quelque s
\exemple|\detokenize\expandafter{\cmd}|\smallskip
\exemple|\StrSubstitute{\a1{2\a{3\a}4\a}\a5\a}{3\a}{XXX}[\cmd]|
\exemple|\detokenize\expandafter{\cmd}|\smallskip
+\exemple|\StrSubstitute{a1{b1\bgroup c1}\egroup d1}{1}{X}[\cmd]|
+\exemple|\detokenize\expandafter{\cmd}|\smallskip
\exemple|\exploregroups|
\exemple|\StrSubstitute{\a1{2\a{3\a}4\a}\a5\a}{\a}{\X}[\cmd]|
\exemple|\detokenize\expandafter{\cmd}|\smallskip
@@ -925,6 +944,8 @@ La commande \verb|\StrBetween| opère en mode \verb|\noexploregroups|, quelque s
\exemple|\detokenize\expandafter{\cmd}|\smallskip
\exemple|\StrSubstitute{\a1{2\a{3\a}4\a}\a5\a}{3\a}{XXX}[\cmd]|
\exemple|\detokenize\expandafter{\cmd}|
+\exemple|\StrSubstitute{a1{b1\bgroup c1}\egroup d1}{1}{X}[\cmd]|
+\exemple|\detokenize\expandafter{\cmd}|
\chapitre{La macro}{StrDel}
diff --git a/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.pdf b/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.pdf
index 10910617ba6..d8d6ddc6057 100644
--- a/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.pdf
+++ b/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.pdf
Binary files differ
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 aa1dae5525c..0dd3ecaa4ec 100644
--- a/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex
+++ b/Master/texmf-dist/doc/generic/xstring/xstring_doc_en.tex
@@ -1,8 +1,9 @@
-% This is xtring_doc_en.tex, the manual of xstring
+% This is xtring_doc_en.tex, the english manual of xstring
+%
% Christian Tellechea 2008
%
% email : unbonpetit@gmail.com
-%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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.
@@ -12,12 +13,12 @@
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
-%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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},pdfkeywords={xstring,latex,string},pdfcreator={LaTeX}]{hyperref}
-\usepackage[a4paper,dvips,margin=1.9cm]{geometry}
+\usepackage[a4paper,dvips,margin=2cm]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{textcomp}
\usepackage{moreverb}
@@ -25,7 +26,6 @@
\usepackage{eurosym}
\usepackage{xspace}
\usepackage{xstring}
-\usepackage{xstring}
\usepackage[french,english]{babel}
\makeatletter
\newcommand*\exemple{\@ifstar{\def\frontiere{|}\@xs@MakeVerb}{\def\frontiere{}\@xs@MakeVerb}}
@@ -778,7 +778,7 @@ And this not allowed nested structure, supposed to remove the first and last cha
\hspace{0.2\linewidth}\verb|\StrGobbleRight{xstring}{1}[\mystring]|\par
\hspace{0.2\linewidth}\verb|\StrGobbleleft{\mystring}{1}|\par
-\subsection{How \Xstring reads the arguments?}
+\subsection{How does \Xstring read the arguments?}
\label{developpementarguments}
\subsubsection{Syntax unit by \US}
The macros of \Xstring read their arguments \US par \US. In the \TeX{} code, a \US is either:\parindent3em
@@ -1141,6 +1141,14 @@ We expect: \textbf{A}\textbf{B}\textit{C}\medskip
\def\replace{\textbf}
\StrSubstitute[2]{\myCS}{\pattern}{\replace}
\end{minipage}\fullexpandarg
+\medskip
+
+It is possible to avoid to define \verb|\pattern| and \verb|\replace|: a "snare" can be used. It can be a control sequence which expansion is empty, like the famous \verb|\empty|. The code would have been:\par\smallskip
+\hfil\verb|\StrSubstitute[2]{\myCS}{\empty\textit}{\empty\textbf}|\hfil{}\medskip
+
+With this code, in both arguments, the first token \verb|\empty| is expanded to "nothing" and the following significant tokens \verb|\textit| and \verb|textbf| are left unchanged.\smallskip
+
+By this way, \verb|\empty| is a way to "hack" \verb|\expandarg|: it allows to avoid the expansion of all the other tokens. The control sequence \verb|\noexpand| can be used instead of \verb|\empty| for the same result.
\subsubsection{Example 2}
Let's try to write a macro \verb|\tofrac| that transforms an argument of this type \guill{a/b} into \guill{$\frac{a}{b}$}:\par\medskip
@@ -1260,6 +1268,7 @@ A control sequence \verb|\myCS| defined with an \verb|\edef| contains control se
\begin{minipage}[r]{0.6\linewidth}
\hfill
\begin{boxedverbatim}
+ \fullexpandarg
\newcount\occurr
\newcount\nbgroup
\newcommand\findgroup[2]{%
@@ -1277,10 +1286,12 @@ A control sequence \verb|\myCS| defined with an \verb|\edef| contains control se
\ifnum\nbgroup<#1% not the good group ?
\StrBehind{\text}{\group}[\text]%
\occurr=0% initialise \text & \occur
+ \expandafter\expandafter\expandafter
\findthegroup% do it again
\fi
\else% unbalanced braces ?
% look for next "}"
+ \expandafter
\findthegroup
\fi}
\findthegroup
@@ -1297,39 +1308,42 @@ A control sequence \verb|\myCS| defined with an \verb|\edef| contains control se
\hspace*{0.3cm}
\end{minipage}%
\begin{minipage}[r]{0.3\linewidth}
- \newcount\occurr
- \newcount\nbgroup
- \newcommand\findgroup[2]{%
- \scancs[1]{\text}{#2}%
- \occurr=0
- \nbgroup=0
- \def\findthegroup{%
- \StrBehind{\text}{\Obr}[\remain]%
- \advance\occurr by 1% next "{"
- \StrBefore[\the\occurr]{\remain}{\Cbr}[\group]%
- \StrCount{\group}{\Obr}[\nbA]%
- \StrCount{\group}{\Cbr}[\nbB]%
- \ifnum\nbA=\nbB% balanced braces ?
- \advance\nbgroup by 1
- \ifnum\nbgroup<#1% if it's not the sought group
- \StrBehind{\text}{\group}[\text]%
- \occurr=0% initialization of \text & \occur
- \findthegroup% do it again
- \fi
- \else% unbalanced braces ?
- % look for next "}"
- \findthegroup
- \fi}
- \findthegroup
- \group}
-
- \verbtocs{\Obr}|{|
- \verbtocs{\Cbr}|}|
- \def\myCS{\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}}
-
- groupe 1: \findgroup{1}{\myCS}\par
- groupe 2: \findgroup{2}{\myCS}\par
- groupe 3: \findgroup{3}{\myCS}
+ \fullexpandarg
+ \newcount\occurr
+ \newcount\nbgroup
+ \newcommand\findgroup[2]{%
+ \scancs[1]{\text}{#2}%
+ \occurr=0
+ \nbgroup=0
+ \def\findthegroup{%
+ \StrBehind{\text}{\Obr}[\remain]%
+ \advance\occurr by 1% next "{"
+ \StrBefore[\the\occurr]{\remain}{\Cbr}[\group]%
+ \StrCount{\group}{\Obr}[\nbA]%
+ \StrCount{\group}{\Cbr}[\nbB]%
+ \ifnum\nbA=\nbB% balanced braces ?
+ \advance\nbgroup by 1
+ \ifnum\nbgroup<#1% not the good group ?
+ \StrBehind{\text}{\group}[\text]%
+ \occurr=0% initialise \text & \occur
+ \expandafter\expandafter\expandafter
+ \findthegroup\expandafter% do it again
+ \fi
+ \else% unbalanced braces ?
+ % look for next "}"
+ \expandafter
+ \findthegroup
+ \fi}
+ \findthegroup
+ \group}
+
+ \verbtocs{\Obr}|{|
+ \verbtocs{\Cbr}|}|
+ \def\myCS{\a{1\b{2}}\c{3}\d{4\e{5}\f{6{7}}}}
+
+ group 1: \findgroup{1}{\myCS}\par
+ group 2: \findgroup{2}{\myCS}\par
+ group 3: \findgroup{3}{\myCS}
\end{minipage}
\medskip
diff --git a/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.pdf b/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.pdf
index fd5faae76ac..f8cd7c7c233 100644
--- a/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.pdf
+++ b/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.tex b/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.tex
index 295c34bc879..0cbf4bd637d 100644
--- a/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.tex
+++ b/Master/texmf-dist/doc/generic/xstring/xstring_doc_fr.tex
@@ -1,8 +1,10 @@
+% Ceci est xtring_doc_fr.tex, le manuel en français de xstring
% This is xtring_doc_fr.tex, the french manual of xstring
+%
% Christian Tellechea 2008
%
% email : unbonpetit@gmail.com
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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.
@@ -12,12 +14,12 @@
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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 pour la manipulation de chaines de caractères},pdfkeywords={xstring,latex,string,chaine de caractères},pdfcreator={LaTeX}]{hyperref}
-\usepackage[a4paper,dvips,margin=1.9cm]{geometry}
+\usepackage[a4paper,dvips,margin=2cm]{geometry}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{moreverb}
@@ -1145,12 +1147,12 @@ Ensuite, on définit \verb|\pattern| qui est le motif à remplacer, et \verb|\re
\end{minipage}\fullexpandarg
\medskip
-Pour éviter de définir les séquences de contrôle \verb|\pattern| et \verb|\replace|, on aurait pu utiliser un leurre comme par exemple une séquence de contrôle \guill{vide} comme \verb|\empty|, et coder de cette façon :\par\smallskip
+Pour éviter de définir les séquences de contrôle \verb|\pattern| et \verb|\replace|, on aurait pu utiliser un leurre comme par exemple une séquence de contrôle qui se développe en \guill{rien} comme \verb|\empty|, et coder de cette façon :\par\smallskip
\hfil\verb|\StrSubstitute[2]{\myCS}{\empty\textit}{\empty\textbf}|\hfil{}\medskip
Ainsi, \verb|\empty| est développée en \guill{rien} et il reste dans les 2 derniers arguments les séquences de contrôles significatives \verb|\textit| et \verb|textbf|.\smallskip
-La séquence de contrôle \verb|\empty| est donc un \guill{hack} pour \verb|\expandarg| : elle permet de bloquer le développement de certains arguments ! On aurait d'ailleurs pu utiliser \verb|\noexpand| au lieu de \verb|\empty| pour obtenir le même résultat.
+La séquence de contrôle \verb|\empty| est donc un \guill{hack} pour \verb|\expandarg| : elle permet de bloquer le développement du 1\ier{} lexème ! On aurait d'ailleurs pu utiliser \verb|\noexpand| au lieu de \verb|\empty| pour obtenir le même résultat.
\subsubsection{Exemple 2}
Cherchons à écrire une macro \verb|\tofrac| qui transforme une écriture du type \guill{a/b} par \guill{$\frac{a}{b}$}.\medskip
@@ -1274,6 +1276,7 @@ Soit une séquence de contrôle \verb|\myCS| définie par un \verb|\def| contena
\begin{minipage}[r]{0.6\linewidth}
\hfill
\begin{boxedverbatim}
+ \fullexpandarg
\newcount\occurr \newcount\nbgroup
\newcommand\findgroup[2]{%
\scancs[1]{\chaine}{#2}%
@@ -1291,7 +1294,7 @@ Soit une séquence de contrôle \verb|\myCS| définie par un \verb|\def| contena
\StrBehind{\chaine}{\group}[\chaine]%
\occurr=0% on initialise \chaine et \occur
\expandafter\expandafter\expandafter
- \findthegroup\expandafter% et on recommence
+ \findthegroup\expandafter% et on recommence
\fi
\else% accolades non équilibrées ?
% cherche accolade fermante suivante
@@ -1310,6 +1313,7 @@ Soit une séquence de contrôle \verb|\myCS| définie par un \verb|\def| contena
\hspace*{0.3cm}
\end{minipage}%
\begin{minipage}[r]{0.3\linewidth}
+ \fullexpandarg
\newcount\occurr \newcount\nbgroup
\newcommand\findgroup[2]{%
\scancs[1]{\chaine}{#2}%