diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/witharrows-french.pdf | bin | 0 -> 251565 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/witharrows-french.tex | 2244 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/witharrows.pdf | bin | 389748 -> 553254 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/witharrows/witharrows.dtx | 982 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 1814 |
5 files changed, 3984 insertions, 1056 deletions
diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows-french.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows-french.pdf Binary files differnew file mode 100644 index 00000000000..642c9f86139 --- /dev/null +++ b/Master/texmf-dist/doc/latex/witharrows/witharrows-french.pdf diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows-french.tex b/Master/texmf-dist/doc/latex/witharrows/witharrows-french.tex new file mode 100644 index 00000000000..65f0355dfb7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/witharrows/witharrows-french.tex @@ -0,0 +1,2244 @@ +% -*- coding: utf-8 ; -*- +\documentclass[dvipsnames]{article}% dvipsnames est pour xcolor (chargé par Tikz) +\usepackage{xltxtra} +\usepackage[french]{babel} + +\usepackage[xetex]{geometry} +\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} + +\usepackage{amsmath} +\usepackage{color} +\usepackage{verbatim} +\usepackage{mathtools} +\usepackage[footnotehyper]{witharrows} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{varwidth} +\usetikzlibrary{calc} +\usepackage[only,llbracket,rrbracket]{stmaryrd} + +\usepackage{fancyvrb} +\fvset{commandchars=\~\#\@,formatcom={\color{gray}}} + +\usepackage{titlesec} +\titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex} +\titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex} + + +\def\interitem{\vskip 7mm plus 2 mm minus 3mm} +\def\emphase{\bgroup\color{RoyalPurple}\let\next=} + +\skip \footins = 2 \bigskipamount + +\usepackage[hyperfootnotes = false]{hyperref} + +\hypersetup{ + pdfinfo = { + Title = { L’extension witharrows }, + Subject = { Une extension LaTeX } , + Author = { F. Pantigny } + } +} + +\NewDocumentEnvironment {scope} {} {} {} + +\NewDocumentCommand {\pkg} {m} {\textsf{#1}} +\NewDocumentCommand {\cls} {m} {\textsf{#1}} + +\setlength{\parindent}{0pt} + + +\begin{document} + +\VerbatimFootnotes + +\title{L'extension \pkg{witharrows}\thanks{Ce document correspond à la +version~\myfileversion\space de \pkg{witharrows}, à la date du~\myfiledate.}} \author{F. Pantigny \\ +\texttt{fpantigny@wanadoo.fr}} + +\maketitle + +\begin{abstract} +L'extension LaTeX \pkg{witharrows} fournit des environments \verb|{WithArrows}| et +\verb|{DispWithArrows}| similaires aux environnements \verb|{aligned}| et \verb|{align}| de +l'\pkg{amsmath} mais avec la possibilité de dessiner des flèches sur le côté droit. +Ces flèches sont habituellement utilisées pour donner des explications concernant +le calcul mathématique présenté. +\end{abstract} + + +\vspace{1cm} +Cette extension peut être utilisée avec \verb|xelatex|, \verb|lualatex|, \verb|pdflatex| +mais aussi avec le cheminement classique \verb|latex|-\verb|dvips|-\verb|ps2pdf| (ou Adobe +Distiller). Plusieurs compilations peuvent être nécessaires. Cette extension nécessite les +extensions \pkg{expl3}, \pkg{xparse} et \pkg{tikz}. Les extensions Tikz +\pkg{arrows.meta} et \pkg{bending} sont également requises. Toutes sont chargées par \pkg{witharrows}. + +\bigskip +Cette extension fournit un environnement \verb|{WithArrows}| pour construire des alignements d'équations +avec des flèches pour les explications sur le côté droit. + +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 ~emphase#\Arrow{on développe}@ \\ + & = a^2 + 2a + 1 % ne pas mettre de \\ ici +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + + + +\medskip +La flèche a été tracée avec la commande \verb|\Arrow| dans la rangée dont la flèche part. La commande \verb|\Arrow| +doit être utilisée dans la seconde colonne (le mieux est de la mettre à la fin de la ligne comme dans l'exemple +précédent). + + +\medskip +Comme on le voit, l'environnement \verb|{WithArrows}| est proche de l'environnement +\verb|{aligned}| de l'\pkg{amsmath}. L'extension \pkg{witharrows} +propose aussi un environnement \verb|{DispWithArrows}| qui est similaire à l'environnement \verb|{align}| de +l'\pkg{amsmath}: cf. p. \pageref{DispWithArrows}. + + +\section{Options pour la forme des flèches} + +La commande \verb|\Arrow| a plusieurs options. Ces options peuvent être placées entre crochets, avant, ou après, +l'argument obligatoire. + +L'option \verb|jump| indique le nombre\footnote{Il n'est pas possible de donner une valeur négative à \verb|jump|. +Voir plus loin (p.~\pageref{Backwards}) la manière de tracer une flèche qui remonte.} de rangées que la flèche doit sauter (la valeur par défaut est, bien +entendu,~$1$). + + +\begin{Verbatim} +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 \Arrow[~emphase#jump=2@]{on développe} \\ + & = (a+b)^2 + 2(a+b) +1 \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 \Arrow[jump=1+1]{on développe} \\ + & = (a+b)^2 + 2(a+b) +1 \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ + +\interitem +Il est possible de faire partir plusieurs flèches d'une même rangée. +\begin{Verbatim} +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 ~emphase#\Arrow{}\Arrow{}[jump=2]@ \\ + & = (a+b)^2 + 2(a+b) +1 \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 \Arrow{}\Arrow{}[jump=2] \\ + & = (a+b)^2 + 2(a+b) +1 \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ + +\interitem +L'option \verb|xoffset| décale la flèche vers la droite (habituellement, on ne souhaite pas que les flèches soient +collées au texte). La valeur par défaut de \verb|xoffset| est de $3$~mm. +\begin{Verbatim} +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 +\Arrow[~emphase#xoffset=1cm@]{avec \texttt{xoffset=1cm}} \\ + & = (a+b)^2 + 2(a+b) +1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 +\Arrow[xoffset=1cm]{avec \texttt{xoffset=1cm}} \\ + & = (a+b)^2 + 2(a+b) +1 +\end{WithArrows}$ + + +\interitem +Les flèches sont tracées avec Tikz. C'est pourquoi la commande \verb|\Arrow| a une option +\verb|tikz| qui peut être utilisée pour donner à la flèche (en fait, à la commande \verb|\path| de +Tikz) les options proposées par Tikz pour une telle flèche. L'exemple suivant fournit une flèche en trait épais. +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[~emphase#tikz=thick@]{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[tikz=thick]{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\interitem +Il est également possible de changer les pointes de flèche. Par exemple, nous pouvons tracer une flèche +qui remonte vers le haut avec l'option Tikz~\verb|<-|.\label{Backwards} + +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow~emphase#[tikz=<-]@{on factorise} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[tikz=<-]{on factorise} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\interitem +Il est aussi possible de supprimer les deux pointes de flèche avec l'option Tikz «\verb|-|». +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[~emphase#tikz=-@]{très classique} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[tikz=-]{très classique} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\interitem +Pour avoir des flèches droites et non incurvées, il convient d'utiliser l'option Tikz +«\verb|bend left = 0|». +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow~emphase#[tikz={bend left=0}]@{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[tikz={bend left=0}]{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\smallskip +En fait, il est possible de modifier de manière plus drastique la forme des flèches avec l'option +\verb|tikz-code| (présentée p.~\pageref{tikz-code}). + +\interitem +Il est possible d'utiliser l'option «\verb|text width|» pour contrôler la largeur du texte associé à la +flèche.\footnote{Il est possible d'éviter les coupures de mots dans ces étiquettes +avec l'option «\verb|align = flush left|» de Tikz.} +% +\begin{Verbatim} +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 +\Arrow[jump=2,~emphase#tikz={text width=5.3cm}@]{Nous avons développé...} \\ + & = (a+b)^2 + 2(a+b) +1 \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = \bigl((a+b)+1\bigr)^2 +\Arrow[jump=2,tikz={text width=5.3cm}]{Nous avons développé en deux étapes mais il aurait été plus habile + d'utiliser la formule du multinôme.} \\ +& = (a+b)^2 + 2(a+b) +1 \\ +& = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ + + +\bigskip +Dans les environnements \verb|{DispWithArrows}| et \verb|{DispWithArrows*}|, il y a une +option \verb|wrap-lines|. Lorsque cette option est utilisée, les lignes des étiquettes sont +automatiquement coupées sur la marge droite : voir p.~\pageref{wrap-lines}. + +\interitem +Si on veut changer la fonte du texte associé à une flèche, on peut, bien entendu, placer une commande comme +\verb|\bfseries|, \verb|\large| ou \verb|\sffamily| au début du texte. +Mais, par défaut, les étiquettes sont composées avec une combinaison +de \verb|\small| et \verb|\itshape|. En ajoutant \verb|\bfseries| au début du texte, on ne va pas supprimer le +\verb|\small| et le \verb|\itshape| et, par conséquent, on aura un texte en gras, italique et petite taille. +% +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{~emphase#\bfseries@ on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{\bfseries on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\interitem +Il est possible de placer des commandes \verb|\\| dans le texte pour forcer des retours à la ligne\footnote{Par +défaut, ce n'est pas possible dans un nœud Tikz. Néanmoins, dans \pkg{witharrows}, +les nœuds sont construits avec l'option \verb|align=left|, et, ainsi, cela devient possible.}. Néanmoins, si on utilise des commandes \verb|\\|, une instruction de fonte placée au début +du texte aura un effet seulement jusqu'à la première occurrence de~\verb|\\| (comme +dans un environnement \verb|{tabular}|). C'est pourquoi Tikz fournit une option +\verb|font| pour modifier la fonte de tout le texte de l'étiquette. Cette fois-ci, si on utilise une option +\verb|tikz={font={\bfseries}}|, la spécification par défaut constituée par \verb|\small| et \verb|\itshape| va être +écrasée. +% +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[~emphase#tikz={font={\bfseries}}@]{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow[tikz={font={\bfseries}}]{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\medskip +Si on veut exactement le même résultat que précédemment, on doit donner à l'option \verb|font| la valeur +\verb|\itshape\small\bfseries|. + + +\interitem +Presque toutes les options peuvent être données entre crochets à l'environnement \verb|{WithArrows}|. Il ne doit +pas y avoir d'espace entre le \verb|\begin{WithArrows}| et le crochet ouvrant (\verb|[|) des options de +l'environnement. Ces options s'appliquent à toutes les flèches de l'environnement.\footnote{Elles s'appliquent + aussi aux environnements imbriqués dans un environnement \verb|{WithArrows}| donné (avec des exceptions attendues + pour les options \verb|interline|, \verb|code-before| et \verb|code-after|).} +% +\begin{Verbatim} +$\begin{WithArrows}[~emphase#tikz=blue@] +A & = \bigl((a+b)+1\bigr)^2 \Arrow{premier développement} \\ + & = (a+b)^2 + 2(a+b) +1 \Arrow{second développement} \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows}[tikz=blue] +A & = \bigl((a+b)+1\bigr)^2 \Arrow{premier développement} \\ + & = (a+b)^2 + 2(a+b) +1 \Arrow{second développement} \\ + & = a^2 + 2ab + b^2 + 2a + 2b +1 +\end{WithArrows}$ + + +\interitem +L'environnement \verb|{WithArrows}| a une option \verb|displaystyle|. Avec cette option, +tous les éléments sont composés en \verb|\displaystyle| (comme dans un environnement +\verb|{aligned}| de l'\pkg{amsmath}). + +\medskip +Sans l'option \verb|displaystyle|: +% +\begin{Verbatim} +$\begin{WithArrows} +\int_0^1 (x+1)^2 dx +& = \int_0^1 (x^2+2x+1) dx +\Arrow{linéarité de l'intégration} \\ +& = \int_0^1 x^2 dx + 2 \int_0^1 x dx + \int_0^1 dx \\ +& = \frac13 + 2\frac12 + 1 \\ +& = \frac73 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +\int_0^1 (x+1)^2 dx +& = \int_0^1 (x^2+2x+1) dx +\Arrow{linéarité de l'intégration} \\ +& = \int_0^1 x^2 dx + 2 \int_0^1 x dx + \int_0^1 dx \\ +& = \frac13 + 2\frac12 + 1 \\ +& = \frac73 +\end{WithArrows}$ + + +\medskip +Le même exemple avec l'option \verb|displaystyle|:\par\nobreak + +$\begin{WithArrows}[displaystyle] +\int_0^1 (x+1)^2 dx +& = \int_0^1 (x^2+2x+1) dx +\Arrow{linéarité de l'intégration} \\ +& = \int_0^1 x^2 dx + 2 \int_0^1 x dx + \int_0^1 dx \\ +& = \frac13 + 2\frac12 + 1 \\ +& = \frac73 +\end{WithArrows}$ + + + +\interitem +Presque toutes les options peuvent aussi être fixées au niveau du document avec la commande +\verb|\WithArrowsOptions|. Dans ce cas, la portée des déclarations est le groupe TeX courant (de telles +déclarations sont parfois qualifiées de «semi-globales»). Par exemple, si nous voulons que tous les environnements +\verb|{WithArrows}| soient composés en \verb|\displaystyle| avec des flèches bleues, nous pouvons écrire +\verb|\WithArrowsOptions{displaystyle,tikz=blue}|.\footnote{Il est aussi possible de configurer \pkg{witharrows} en + modifiant le style Tikz \verb|WithArrows/arrow| qui est le style utilisé par \pkg{witharrows} lors du tracé d'une + flèche. Par exemple, pour avoir les étiquettes en bleu et en caractères droits, on peut utiliser l'instruction + suivante : \verb|\tikzset{WithArrows/arrow/.append style = {blue,font = {}}}|.} + +\begin{Verbatim} +~emphase#\WithArrowsOptions{displaystyle,tikz=blue}@ +$\begin{WithArrows} +\sum_{i=1}^n (x_i+1)^2 +& = \sum_{i=1}^n (x_i^2+2x_i+1) \Arrow{par linéarité}\\ +& = \sum_{i=1}^n x_i^2 + 2\sum_{i=1}^nx_i+ n +\end{WithArrows}$ +\end{Verbatim} + +\begin{scope} +\WithArrowsOptions{displaystyle,tikz=blue} +$\begin{WithArrows} +\sum_{i=1}^n (x_i+1)^2 +& = \sum_{i=1}^n (x_i^2+2x_i+1) \Arrow{par linéarité}\\ +& = \sum_{i=1}^n x_i^2 + 2\sum_{i=1}^nx_i+ n +\end{WithArrows}$ +\end{scope} + + +\interitem +La commande \verb|\Arrow| est reconnue seulement dans les environnements \verb|{WithArrows}|. Si on +dispose d'une commande \verb|\Arrow| précédemment définie, il est possible de continuer à l'utiliser à +l'extérieur des environnements \verb|{WithArrows}|. + +Néanmoins, une commande \verb|\Arrow| définie précédemment pourrait encore être utile dans un environnement \verb|{WithArrows}|. +Si vous voulez l'utiliser dans un tel environnement, il est possible de changer le nom de la commande \verb|\Arrow| de +l'extension \pkg{witharrows} grâce à une option \verb|command-name|\footnote{Pour des raisons historiques, il y a + un alias pour cette option : \verb|CommandeName|.} dédiée. Le nouveau nom de la commande doit être fourni à +l'option \emph{sans} la contre-oblique. +% +\begin{Verbatim} +\NewDocumentCommand {\Arrow} {} {\longmapsto} +$\begin{WithArrows}[~emphase#command-name=Explication@] +f & = \bigl(x \Arrow (x+1)^2\bigr) +~emphase#\Explication{on travaille directement sur les fonctions}@\\ +& = \bigl(x \Arrow x^2+2x+1\bigr) +\end{WithArrows}$ +\end{Verbatim} +% +\begin{scope} +\NewDocumentCommand {\Arrow} {} {\longmapsto} +$\begin{WithArrows}[command-name=Explication] +f & = \bigl(x \Arrow (x+1)^2\bigr) +\Explication{on travaille directement sur les fonctions}\\ +& = \bigl(x \Arrow x^2+2x+1\bigr) +\end{WithArrows}$ +\end{scope} + + +\interitem +L'environnement \verb|{WithArrows}| fournit aussi deux options \verb|code-before| et +\verb|code-after|\footnote{Pour des raisons historiques, il y a aussi des alias pour ces options : + \verb|CodeBefore| et \verb|CodeAfter|.} pour du code LaTeX qui sera exécuté au début et à la fin de +l'environnement. Ces options ne sont pas conçues pour être utilisées comme des \emph{hooks} (elles sont disponibles +uniquement au niveau de l'environnement et ne s'appliquent pas aux environnements imbriqués). +% +\begin{Verbatim} +$\begin{WithArrows}[~emphase#code-before = \color{blue}@] +A & = (a+b)^2 \Arrow{on développe} \\ + & = a^2 + 2ab + b^2 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows}[code-before = \color{blue}] +A & = (a+b)^2 \Arrow{on développe} \\ + & = a^2 + 2ab + b^2 +\end{WithArrows}$ + +\medskip +Des commandes spéciales sont disponibles dans le \verb|code-after| : une commande \verb|\WithArrowsNbLines| qui +indique le nombre de lignes (=rangées) de l'environnement courant (pour TeX, il s'agit d'une commande et non d'un +compteur), une forme spéciale de la commande \verb|\Arrow| et la commande \verb|\MultiArrow| : ces commandes sont +décrites à partir de la page~\pageref{NestedEnv}. + +\section{Nombre et formats des colonnes} + +Jusqu'à présent, nous n'avons utilisé l'environnement \verb|{WithArrows}| qu'avec deux colonnes. Néanmoins, il est +possible de l'utiliser avec un nombre arbitraire de colonnes grâce à l'option \verb|format|. La valeur +donnée à cette option est similaire au préambule d'un environnement \verb|{array}|: il s'agit d'une séquence de +lettres \verb|r|, \verb|c| et \verb|l|. La valeur par défaut de cette option \verb|format| est, en fait, \verb|rl|. + + +\bigskip +Par exemple, si on veut seulement une colonne alignée à gauche, on peut utiliser l'option \verb|format=l|. +\begin{Verbatim} +$\begin{WithArrows}[~emphase#format = l@] +f(x) \ge g(x) \Arrow{on élève les deux membres au carré} \\ +f(x)^2 \ge g(x)^2 \Arrow{on fait tout passer à gauche} \\ +f(x)^2 - g(x)^2 \ge 0 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows}[format = l] +f(x) \ge g(x) \Arrow{on élève les deux membres au carré} \\ +f(x)^2 \ge g(x)^2 \Arrow{on fait tout passer à gauche} \\ +f(x)^2 - g(x)^2 \ge 0 +\end{WithArrows}$ + +\interitem +Dans l'exemple suivant, on utilise cinq colonnes toutes centrées (l'environnement +\verb|{DispWithArrows*}| utilisé est présenté p.~\pageref{DispWithArrows}). + +\begin{Verbatim} +\begin{DispWithArrows*}[~emphase#format = ccccc@, + wrap-lines, + tikz = {align = flush left}, + interline=1mm] +k & \;\le\; & t & \;\le\; & k+1 \\ +\frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} +\Arrow{nous pouvons intégrer les inégalités puisque $k \leq k+1$ } \\ +\int\limits_k^{k+1} \frac{dt}{k+1} +& \le & \int\limits_k^{k+1} \frac{dt}{t} +& \le & \int\limits_k^{k+1} \frac{dt}{k} \\ +\frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} +\end{DispWithArrows*} +\end{Verbatim} +\begin{DispWithArrows*}[format = ccccc, + wrap-lines, + tikz = {align = flush left}, + interline=1mm] +k & \;\le\; & t & \;\le\; & k+1 \\ +\frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} +\Arrow{nous pouvons intégrer les inégalités puisque $k \leq k+1$} \\ +\int\limits_k^{k+1} \frac{dt}{k+1} +& \le & \int\limits_k^{k+1} \frac{dt}{t} +& \le & \int\limits_k^{k+1} \frac{dt}{k} \\ +\frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} +\end{DispWithArrows*} + + +\section{Positionnement précis des flèches} + +L'environnement \verb|{WithArrows}| construit, lors de la composition du tableau, +deux séries de nœuds représentés en rouge dans l'exemple suivant.\footnote{L'option +\verb|show-nodes| peut être utilisée pour visualiser ces nœuds. Les nœuds sont en fait des nœuds Tikz de forme +rectangulaire et de largeur nulle. Une flèche entre deux nœuds part de l'ancre sud (\emph{south + anchor}) du premier nœud et arrive à l'ancre nord (\emph{north anchor}) du deuxième nœud.} + + +\smallskip +$\begin{WithArrows}[displaystyle,show-nodes] +I +& = \int_{\frac{\pi}4}^0 \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)(-d u) \\ +& = \int_0^{\frac{\pi}4} \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)d u \\ +& = \int_0^{\frac{\pi}4}\ln\left(1+\frac{1-\tan u}{1+\tan u}\right)\, d u \\ +& =\int_0^{\frac{\pi}4}\ln\left(\frac{1+\tan u+1-\tan u}{1+\tan u}\right) d u \\ +& =\int_0^{\frac{\pi}4} \ln\left(\frac2{1+\tan u}\right)\, d u\\ +& =\int_0^{\frac{\pi}4}\bigl(\ln2-\ln(1+\tan u)\bigr)\, d u \\ +& =\frac{\pi}4\ln2-\int_0^{\frac{\pi}4}\ln(1+\tan u)\, d u \\ +& =\frac{\pi}4\ln2-I +\end{WithArrows}$ + +\bigskip +Les nœuds sur la gauche sont à la fin de chaque ligne de texte. Ces nœuds seront appelés \emph{nœuds de gauche}. Les +nœuds du côté droit sont alignés verticalement sur le bord droit de l'alignement d'équations. Ces nœuds seront +appelés \emph{nœuds de droite}. + + +Par défaut, les flèches utilisent les nœuds de droite. Nous dirons que ces flèches sont dans le mode \verb|rr| (\emph{r} +for \emph{right} en anglais). Ces flèches sont verticales (nous dirons qu'une flèche est \emph{verticale} lorsque +ses deux extrémités sont à la même abscisse). + + + +\smallskip +Néanmoins, il est possible d'utiliser les nœuds de gauche, ou une combinaison de nœuds de gauche et de droite avec +l'une des options \verb|lr|, \verb|rl| et \verb|ll| (\emph{l} for \emph{left} en anglais). Ces flèches sont, la +plupart du temps, non verticales. + + +Therefore +$\begin{WithArrows}[displaystyle] +I +& = \int_{\frac{\pi}4}^0 \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)(-d u) +\Arrow[lr]{Cette flèche utilise une option \texttt{lr}.}\\ +& = \int_0^{\frac{\pi}4} \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)d u \\ +& = \int_0^{\frac{\pi}4}\ln\left(1+\frac{1-\tan u}{1+\tan u}\right)\, d u \\ +& =\int_0^{\frac{\pi}4}\ln\left(\frac{1+\tan u+1-\tan u}{1+\tan u}\right) d u +\Arrow[ll,jump=2,tikz={text width = 5cm}]{Cette flèche utilise une option \texttt{ll} +et une option \texttt{jump} fixée à $2$}\\ +& =\int_0^{\frac{\pi}4} \ln\left(\frac2{1+\tan u}\right)\, d u\\ +& =\int_0^{\frac{\pi}4}\bigl(\ln2-\ln(1+\tan u)\bigr)\, d u \\ +& =\frac{\pi}4\ln2-\int_0^{\frac{\pi}4}\ln(1+\tan u)\, d u \\ +& =\frac{\pi}4\ln2-I +\end{WithArrows}$ + + +\interitem +Il y a aussi une option nommée \verb|i| (\emph{i} pour \emph{intermédiaire}). Avec cette option, la flèche est +verticale et calée à gauche. + +\begin{Verbatim} +$\begin{WithArrows} +(a+b)(a+ib)(a-b)(a-ib) +& = (a+b)(a-b)\cdot(a+ib)(a-ib) \\ +& = (a^2-b^2)(a^2+b^2) \Arrow~emphase#[i]@{parce que $(x-y)(x+y)=x^2-y^2$}\\ +& = a^4-b^4 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +(a+b)(a+ib)(a-b)(a-ib) +& = (a+b)(a-b)\cdot(a+ib)(a-ib) \\ +& = (a^2-b^2)(a^2+b^2) \Arrow[i]{parce que $(x-y)(x+y)=x^2-y^2$}\\ +& = a^4-b^4 +\end{WithArrows}$ + + +\interitem +L'environnement \verb|{WithArrows}| propose aussi une option \verb|group|. Avec cette option, +\emph{toutes} les flèches de l'environnement sont regroupées sur une même verticale calée à gauche. +% +\begin{Verbatim}[formatcom=\small\color{gray}] +$\begin{WithArrows}[~emphase#displaystyle,group@] +2xy'-3y=\sqrt x +& \Longleftrightarrow 2x(K'y_0+Ky_0')-3Ky_0 = \sqrt x \\ +& \Longleftrightarrow 2xK'y_0 + K(2xy_0'-3y_0) = \sqrt x \\ +& \Longleftrightarrow 2x K'y_0 = \sqrt x \Arrow{...}\\ +... +\end{WithArrows}$ +\end{Verbatim} + + +$\begin{WithArrows}[displaystyle,group] +2xy'-3y=\sqrt x +& \Longleftrightarrow 2x(K'y_0+Ky_0')-3Ky_0 = \sqrt x \\ +& \Longleftrightarrow 2xK'y_0 + K(2xy_0'-3y_0) = \sqrt x \\ +& \Longleftrightarrow 2x K'y_0 = \sqrt x \Arrow{on remplace $y_0$ par sa valeur}\\ +& \Longleftrightarrow 2xK'x^{\frac32} = x^{\frac12} \Arrow{simplification par $x$}\\ +& \Longleftrightarrow K' = \tfrac1{2x^2} \Arrow{on primitive}\\ +& \Longleftrightarrow K = -\tfrac1{2x} +\end{WithArrows}$ + + +\bigskip +L'environnement \verb|{WithArrows}| fournit encore une autre option, nommée \verb|groups| (avec un \emph{s} dans le +nom). Avec cette option, les flèches sont divisées en plusieurs «groupes». Chaque groupe est un ensemble de flèches +connectées entre elles\footnote{Plus précisément : pour chaque flèche $a$, notons $i(a)$ le numéro de sa rangée de + départ et + $f(a)$ le numéro de sa rangée d'arrivée ; pour deux flèches $a$ et $b$, nous noterons $a \sim b$ lorsque + $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq \varnothing$ ; les groupes sont les + classes d'équivalence de la clôture transitive de la relation $\sim$.}. Toutes les flèches d'un même groupe sont placées sur +une même verticale qui est calée à gauche. + + +\bigskip +$\begin{WithArrows}[groups] +A & = B \Arrow{one} \\ + & = C+D \Arrow{two} \\ + & = D' \\ + & = E+F+G+H+I \\ + & = K + L + M \Arrow{three}\\ + & = N \Arrow{four}\\ + & = O +\end{WithArrows}$ + +\bigskip +Dans un environnement qui utilise l'option \verb|group| ou l'option \verb|groups|, il est encore possible de donner +une option de position (\verb|ll|, \verb|lr|, \verb|rl|, \verb|rr| ou \verb|i|) à une flèche individuelle. Une +telle flèche sera tracée indépendamment des groupes. Il est aussi possible de commencer un nouveau groupe avec +l'option \verb|new-group| pour une certaine flèche. + + +\bigskip +Si on le souhaite, on peut passer l'option \verb|group| ou \verb|groups| à la commande \verb|WithArrowsOptions| de +telle sorte qu'elle deviendra la valeur par défaut (jusqu'à la fin du groupe TeX). Dans ce cas, il est encore +possible de revenir au comportement par défaut pour un environnement \verb|{WithArrows}| donné avec l'option +\verb|rr|: \verb|\begin{WithArrows}[rr]|. + + +\vspace{1cm} +Dans l'exemple suivant, nous avons utilisé l'option \verb|group| pour l'environnement +et l'option \verb|rr| pour la dernière flèche (c'est pourquoi cette dernière flèche n'est pas alignée avec les +premières). + +$\begin{WithArrows}[interline=1mm,group] +\sum\limits_{k=0}^n\frac{\cos kx}{\cos^k x} +& = \sum\limits_{k=0}^n \frac{\Re (e^{ikx})}{(\cos x)^k} +\Arrow{$(\cos x)^k$ est réel} \\ +& = \sum\limits_{k=0}^n \Re\left(\frac{e^{ikx}}{(\cos x)^k}\right) +\Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\ +& = \Re \left(\sum\limits_{k=0}^n \left(\frac{e^{ix}}{\cos x}\right)^k\right) +\Arrow{somme de termes d'une suite géométrique} \\ +& = \Re \left(\frac{1-\left(\frac{e^{ix}}{\cos x}\right)^{n+1}}{1-\frac{e^{ix}}{\cos x}} \right) +\Arrow{calcul algébrique} \\ +& = \Re \left(\frac{1-\frac{e^{i(n+1)x}}{\cos^{n+1}x}}{1-\frac{e^{ix}}{\cos x}}\right) +\Arrow{réduction au même dénominateur} \\ +& = \Re \left(\frac{\frac{\cos^{n+1}x-e^{i(n+1)x}}{\cos^{n+1}x}}{\frac{\cos x-e^{ix}}{\cos x}}\right) +\Arrow{$\Re(kz) = k\cdot\Re(z)$ lorsque $k$ est réel} \\ +& = \frac1{\cos^n x}\Re \left(\frac{\cos^{n+1}x-e^{i(n+1)x}}{\cos x-e^{ix}}\right) +\Arrow[rr]{forme algébrique des nombres complexes} \\ +& =\frac1{\cos^n x}\Re\left(\frac{\cos^{n+1}x-(\cos(n+1)x+i\sin(n+1)x)}{\cos x-(\cos x+i\sin x)}\right) \\ +& =\frac1{\cos^n x}\Re\left(\frac{(\cos^{n+1}x-\cos(n+1)x)-i\sin(n+1)x}{-i\sin x}\right) \\ +& = \frac1{\cos^nx}\cdot\frac{\sin(n+1)x}{\sin x} +\end{WithArrows}$ + +\interitem + +\section{Les options «up» et «down» pour des flèches individuelles} + +\label{up-and-down} +Au niveau local, il y a deux options pour les flèches individuelles, nommée «\verb|up|» et «\verb|down|». L'exemple +suivant illustre ces types de flèches: + + +\begin{Verbatim} +\(\begin{WithArrows} +A & = B +\Arrow~emphase#[up]@{une flèche de type \texttt{up}} \\ + & = C + C + C + C + C + C + C + C \\ + & = C + C + C + C + C + C + C + C +\Arrow~emphase#[down]@{une flèche de type \texttt{down}} \\ + & = E + E +\end{WithArrows}\) +\end{Verbatim} + +\vspace{1cm} +\(\begin{WithArrows} +A & = B +\Arrow[up]{une flèche de type \texttt{up}} \\ + & = C + C + C + C + C + C + C + C \\ + & = C + C + C + C + C + C + C + C +\Arrow[down]{une flèche de type \texttt{down}} \\ + & = E + E +\end{WithArrows}\) + + +\vspace{1cm} +Les options \verb|up| et \verb|down| nécessitent l'extension \pkg{varwidth} et l'extension Tikz +\pkg{calc}. Si elles ne sont pas chargées, une erreur sera levée. + + +\interitem + +\section{Comparaison avec l'environnement \{aligned\}} + +L'environnement \verb|{WithArrows}| présente des similitudes avec l'environnement \verb|{aligned}| de l'extension +\pkg{amsmath}. Ce sont seulement des similitudes car \verb|{WithArrows}| n'a pas été écrit en s'appuyant sur +\verb|{aligned}|.\footnote{En fait, il est +possible d'utiliser l'extension \pkg{witharrows} sans l'extension \pkg{amsmath}.} + +\interitem +Comme dans les environnements de l'\pkg{amsmath}, il est possible de changer l'espacement entre deux rangées avec +l'option de la commande \verb|\\| de fin de ligne (il est aussi possible d'utiliser \verb|\\*| mais cela a +exactement le même effet que \verb|\\| puisqu'un environnement \verb|{WithArrows}| est toujours insécable). Cette +option est conçu pour être utilisée avec des valeurs positives uniquement. +% +\begin{Verbatim} +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{on développe} ~emphase#\\[2ex]@ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{on développe} \\*[2ex] +\noalign{\vspace{3mm}} + & = a^2 + 2a + 1 +\end{WithArrows}$ + + +\interitem +Dans les environnements de l'\pkg{amsmath} (ou de \pkg{mathtools}), l'espace entre deux rangées +est fixé par un paramètre appelé \verb|\jot| (il s'agit d'une dimension et non d'un ressort). C'est aussi le cas +pour l'environnement \verb|{WithArrows}|. Une option \verb|jot| a été ajoutée à l'environnement \verb|{WithArrows}| +dans le but de changer ce paramètre \verb|\jot| pour un environnement donné.\footnote{Il est aussi possible de +changer \verb|\jot| avec l'environnement \verb|{spreadlines}| de \pkg{mathtools}.} +% +\begin{Verbatim} +$\begin{WithArrows}[displaystyle,~emphase#jot=2ex@] +F & = \frac12G \Arrow{on développe}\\ + & = H + \frac12K \Arrow{on continue}\\ + & = K +\end{WithArrows}$ +\end{Verbatim} + + +$\begin{WithArrows}[displaystyle,jot=2ex] +F & = \frac12G \Arrow{on développe}\\ + & = H + \frac12K \Arrow{on continue}\\ + & = K +\end{WithArrows}$ + + +\bigskip +Néanmoins, cette nouvelle valeur de \verb|\jot| sera aussi utilisée dans les nouveaux alignements +inclus dans l'environnement~\verb|{WithArrows}|: +% +\begin{Verbatim} +$\begin{WithArrows}[jot=2ex] +\varphi(x,y) = 0 & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 +\Arrow{$x$ et $y$ sont réels}\\ +& \Leftrightarrow \left\{ +\begin{aligned} +x+y & = 0 \\ +x+2y & = 0 +\end{aligned} +\right. +\end{WithArrows}$ +\end{Verbatim} + + +$\begin{WithArrows}[jot=2ex] +\varphi(x,y) = 0 & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 +\Arrow{$x$ et $y$ sont réels}\\ +& \Leftrightarrow \left\{ +\begin{aligned} +x+y & = 0 \\ +x+2y & = 0 +\end{aligned} +\right. +\end{WithArrows}$ + +\bigskip +Peut-être que cela ne correspond pas au résultat souhaité. C'est pourquoi une option +\verb|interline| est fournie. Il est possible d'utiliser un ressort (\emph{skip}) pour cette option. +% +\begin{Verbatim} +$\begin{WithArrows}[~emphase#interline=2ex@] +\varphi(x,y) = 0 & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 +\Arrow{$x$ et $y$ sont réels}\\ +& \Leftrightarrow \left\{ +\begin{aligned} +x+y & = 0 \\ +x+2y & = 0 \\ +\end{aligned} +\right. +\end{WithArrows}$ +\end{Verbatim} + + +$\begin{WithArrows}[interline=2ex] +\varphi(x,y) = 0 & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 +\Arrow{$x$ et $y$ sont réels}\\ +& \Leftrightarrow \left\{ +\begin{aligned} +x+y & = 0 \\ +x+2y & = 0 \\ +\end{aligned} +\right. +\end{WithArrows}$ + + +\interitem +De même que l'environnement \verb|{aligned}|, \verb|{WithArrows}| a une option de placement qui peut prendre les valeurs +\verb|t|, \verb|c| ou \verb|b|. Néanmoins, la valeur par défaut n'est pas \verb|c| mais \verb|t|. +Si on le souhaite, il est possible d'avoir la valeur \verb|c| comme valeur par défaut +en utilisant l'instruction \verb|\WithArrowsOptions{c}| au début du document. +% +\begin{Verbatim} +Ainsi\enskip +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +Ainsi\enskip +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + +\bigskip +La valeur \verb|c| peut être utile, par exemple, si on souhaite mettre une accolade : + +\smallskip +\begin{Verbatim} +On pose\enskip $~emphase#\left\{@ +\begin{WithArrows}[~emphase#c@] +f(x) & = 3x^3+2x^2-x+4 +\Arrow[tikz=-]{les deux sont des polynômes}\\ +g(x) & = 5x^2-5x+6 +\end{WithArrows} +~emphase#\right.@$ +\end{Verbatim} + + +On pose\enskip $\left\{ +\begin{WithArrows}[c] +f(x) & = 3x^3+2x^2-x+4 +\Arrow[tikz=-]{les deux sont des polynômes}\\ +g(x) & = 5x^2-5x+6 +\end{WithArrows} +\right.$ + + +\interitem +Contrairement à \verb|{aligned}|, l'environnement \verb|{WithArrows}| utilise \verb|\textstyle| par +défaut. + +Là aussi, il est possible de changer ce comportement avec \verb|\WithArrowsOptions|: + +\quad \verb|\WithArrowsOptions{displaystyle}|. + + +\smallskip +L'exemple suivant est composé avec \verb|{aligned}|:\par\nobreak + +\smallskip +$\left\{ +\begin{aligned} +\sum_{i=1}^n (x_i+1)^2 +& = \sum_{i=1}^n (x_i^2 + 2x_i+1) \\ +& = \sum_{i=1}^n x_i^2 + 2 \sum_{i=1}^nx_i + n +\end{aligned} +\right.$ + + +\medskip +L'exemple suivant est composé avec \verb|{WithArrows}[c,displaystyle]|. Les résultats +sont parfaitement identiques.\footnote{Dans les versions de l'\pkg{amsmath} antérieures au +5~novembre~2016, un espace fin était ajouté sur la gauche de l'environnement \verb|{aligned}|. +Les versions plus récentes n'ajoutent pas d'espace et \verb|{WithArrows}| non plus.}\par\nobreak + +\smallskip +$\left\{ +\begin{WithArrows}[c,displaystyle] +\sum_{i=1}^n (x_i+1)^2 +& = \sum_{i=1}^n (x_i^2 + 2x_i+1) \\ +& = \sum_{i=1}^n x_i^2 + 2 \sum_{i=1}^nx_i + n +\end{WithArrows} +\right.$ + + +\section{Les flèches dans les environnements imbriqués} + +\label{NestedEnv} + +Les environnements \verb|{WithArrows}| peuvent être imbriqués. Dans ce cas, les options fournies +à l'environnement englobant s'appliquent aussi aux environnements imbriqués (avec des +exceptions tout à fait attendues pour \verb|interline|, \verb|code-before| et \verb|code-after|). La commande +\verb|Arrow| peut être utilisée dans chaque environnement \verb|{WithArrows}|. + +\begin{Verbatim}[formatcom=\small\color{gray}] +$~emphase#\begin{WithArrows}@ +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \Arrow{les nombres sont réels}\\ + & \Leftrightarrow + \left\{~emphase#\begin{WithArrows}@[c] + x+2y & = 0 \\ + 2x+4y & = 0 + ~emphase#\end{WithArrows}@\right. \\ + & \Leftrightarrow + \left\{~emphase#\begin{WithArrows}@[c] + x+2y & = 0 \Arrow[tikz=-]{la même équation}\\ + x+2y & = 0 + ~emphase#\end{WithArrows}@\right. \\ + & \Leftrightarrow x+2y=0 +~emphase#\end{WithArrows}@$ +\end{Verbatim} + +$\begin{WithArrows} +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \Arrow{les nombres sont réels}\\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + 2x+4y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \Arrow[tikz=-]{la même équation}\\ + x+2y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow x+2y=0 +\end{WithArrows}$ + +\bigskip +Néanmoins, on peut souhaiter tracer une flèche entre des rangées qui ne sont pas dans le même +environnement. Par exemple, on pourrait souhaiter tracer la flèche suivante : + +\bigskip +$\begin{WithArrows}[code-after = \Arrow[v]{1-2}{2-2}{division par $2$} ] +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + 2x+4y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + x+2y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow x+2y=0 +\end{WithArrows}$ + + +\bigskip +Une telle construction est possible en utilisant \verb|\Arrow| dans le \verb|code-after| : +dans le \verb|code-after|, une version spéciale de la commande \verb|\Arrow| est disponible +(nous l'appellerons «\verb|\Arrow| dans le \verb|code-after|»). + +\smallskip +Une commande \verb|\Arrow| dans le \verb|code-after| prend trois arguments : +\begin{itemize} +\item une spécification pour la rangée de départ de la flèche ; +\item une spécification pour la rangée d'arrivée ; +\item une étiquette pour la flèche. +\end{itemize} +Comme d'habitude, il est possible de donner des options entre crochets avant ou après les trois arguments +obligatoires. Néanmoins, ces options sont limitées (voir plus bas). + +\interitem +La spécification de rangée est construite avec la position de l'environnement conidéré dans l'arbre des +imbrications, suivie, après un trait d'union, par le numéro de la rangée. + +\bigskip +Dans l'exemple précédent, il y a deux environnements \verb|{WithArrows}| imbriqués dans l'environnement +\verb|{WithArrows}| principal. + +\medskip +$\begin{WithArrows}[tikz-code = {\path (#1) to node {#3} (#2) ; }] +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\ + & \Leftrightarrow \color{blue} + \left\{\begin{WithArrows}[c] + x+2y & = 0 \Arrow{environnement \no 1}\\ + 2x+4y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow \color{red} + \left\{\begin{WithArrows}[c] + x+2y & = 0 \Arrow{environnement \no 2}\\ + x+2y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow x+2y=0 +\end{WithArrows}$ + +\bigskip +La flèche que nous voulons tracer part de la rangée~$2$ du sous-environnement +\no $1$ (et, par conséquent, la spécification est \verb|1-2|) et arrive à la rangée~$2$ +du sous-environnement \no $2$ (et, par conséquent, la spécification est \verb|2-2|). +Nous pouvons tracer la flèche avec une commande \verb|\Arrow| dans le \verb|code-after| de la manière suivante : +\begin{Verbatim} +$\begin{WithArrows}[~emphase#code-after = \Arrow{1-2}{2-2}{division par $2$}@ ] +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\ +......... +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows}[code-after = \Arrow{1-2}{2-2}{division par $2$} ] +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + 2x+4y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + x+2y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow x+2y=0 +\end{WithArrows}$ + +\bigskip +Les options autorisées pour une commande \verb|\Arrow| dans le \verb|code-after| sont : \verb|ll|, \verb|lr|, +\verb|rl|, \verb|rr|, \verb|v|, \verb|xoffset|, \verb|tikz| et \verb|tikz-code|. Exceptée \verb|v|, qui est +spécifique à \verb|\Arrow| dans le \verb|code-after|, toutes ces options ont leur signification habituelle. + + +Avec l'option \verb|v|, la flèche tracée est verticale à une abscisse calculée avec +la rangée de départ et la rangée d'arrivée uniquement : les lignes intermédiaires ne sont pas prises en compte +contrairement à ce qui se passe avec l'option \verb|i|. Pour le moment, l'option \verb|i| n'est pas disponible +pour la commande~\verb|\Arrow| dans le \verb|code-after|. Néanmoins, il est toujours possible +de déplacer une flèche avec \verb|xoffset| (ou \verb|xshift| de Tikz). +\begin{Verbatim} +$\begin{WithArrows}[code-after=\Arrow~emphase#[v]@{1-2}{2-2}{division by $2$}] +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\ +......... +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows}[code-after = \Arrow[v]{1-2}{2-2}{division par $2$} ] +\varphi(x,y)=0 + & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + 2x+4y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow + \left\{\begin{WithArrows}[c] + x+2y & = 0 \\ + x+2y & = 0 + \end{WithArrows}\right. \\ + & \Leftrightarrow x+2y=0 +\end{WithArrows}$ + + +\interitem +L'extension \pkg{witharrows} fournit une autre commande disponible dans le \verb|code-after| : la commande +\verb|\MultiArrow|. Cette commande dessine un «rateau». La liste des rangées concernées par ce rateau +est donnée dans le premier argument de la commande \verb|\MultiArrow|. La syntaxe utilisée pour décrire cette liste +est celle de la commande \verb|\foreach| de \pkg{pgffor}. + +\begin{Verbatim} +$\begin{WithArrows}[tikz = rounded corners, + code-after = {~emphase#\MultiArrow{1,...,4}{text}@} ] +A & = B \\ + & = C \\ + & = D \\ + & = E \\ + & = F +\end{WithArrows}$ +\end{Verbatim} + + +$\begin{WithArrows}[tikz = rounded corners, + code-after = {\MultiArrow{1,...,4}{text}}] +A & = B \\ + & = C \\ + & = D \\ + & = E \\ + & = F +\end{WithArrows}$ + +\medskip +Pour le moment, aucune option n'est disponible pour cette commande \verb|\MultiArrow|. + + +\medskip +\section{Dessiner des flèches depuis l'extérieur des environnements \{WithArrows\}} + +Si on désire dessiner des flèches depuis l'extérieur des environnements \verb|{WithArrows}|, il est possible de le +faire en utilisant les nœuds Tikz créés par ces environnements. + +Le nom d'un nœud Tikz crée par \pkg{witharrows} est préfixé par \verb|wa-|. Ensuite, on trouve une liste de nombres +qui indique quelle est la position de l'environnement dans l'arbre d'imbrication des environnements. À la fin, on a +le suffixe \verb|l| pour un nœud de gauche et le suffixe \verb|r| pour un nœud de droite. + +\smallskip +À titre d'illustration, nous donnons un exemple d'environnements \verb|{WithArrows}| imbriqués et, pour chaque nœud +de droite, le nom de ce nœud.\footnote{Il existe une option \verb|show-node-names| pour faire afficher les noms de + ces nœuds.} + + +\medskip +\[\begin{WithArrows}[show-nodes,show-node-names] +A & \vartriangleleft B+B+B+B+B+B+B+B+B+B+B+B+B \\ +& \vartriangleleft \left\{ +\begin{WithArrows}[c] +C & \vartriangleleft D \\ +E & \vartriangleleft F +\end{WithArrows} +\right. \\ + & \vartriangleleft +\left\{ +\begin{WithArrows}[c] +G & \vartriangleleft H+H+H+H+H+H+H \\ +I & \vartriangleleft +\left\{ +\begin{WithArrows} +J &\vartriangleleft K \\ +L &\vartriangleleft M +\end{WithArrows} +\right. +\end{WithArrows} +\right. \\ + & \vartriangleleft +\left\{ +\begin{WithArrows}[c] +N & \vartriangleleft O \\ +P & \vartriangleleft Q +\end{WithArrows} +\right. +\end{WithArrows}\] + +\medskip +The package \pkg{witharrows} fournit quelques outils pour faciliter l'utilisation de ces nœuds : +\begin{itemize} +\item la commande \verb|\WithArrowsLastEnv| donne le numéro du dernier environnement de niveau~$0$ (c'est-à-dire +non imbriqué dans un autre environnement de \pkg{witharrows}) ; + +\item un nom peut être donné à un environnement avec l'option \verb|name| et, dans ce cas, les nœuds créés dans +l'environnement auront des alias construits en utilisant ce nom ; + +\item le style Tikz \verb|WithArrows/arrow| est le style utilisé par \pkg{witharrows} pour dessiner une +flèche\footnote{Plus précisément, ce style est passé à Tikz via l'option «\verb|every path|» avant le dessin de la + flèche (qui se fait avec l'instruction Tikz stockée dans \verb|tikz-code|). Ce style est modifié par l'option + \verb|tikz| de \pkg{witharrows} (avec une portée correspondant au groupe TeX courant).} ; + +\item le style Tikz \verb|WithArrows/arrow/tips| est le style utilisé pour la pointe de flèche (ce style est +lui-même chargé par le style \verb|WithArrows/arrow|). +\end{itemize} + +Par exemple, nous pouvons tracer une flèche allant de \texttt{wa-\WithArrowsLastEnv-2-1-2-r.south} +à \texttt{wa-\WithArrowsLastEnv-3-2-r.north} avec l'instruction Tikz suivante : + +\begin{Verbatim} +\begin{tikzpicture}[remember picture,overlay] +\draw [WithArrows/arrow] + ([xshift=3mm]wa-\WithArrowsLastEnv-2-1-2-r.south) + to ([xshift=3mm]wa-\WithArrowsLastEnv-3-2-r.north) ; +\end{tikzpicture} +\end{Verbatim} + +\[\begin{WithArrows} +A & \vartriangleleft B+B+B+B+B+B+B+B+B+B+B+B+B \\ +& \vartriangleleft \left\{ +\begin{WithArrows}[c] +C & \vartriangleleft D \\ +E & \vartriangleleft F +\end{WithArrows} +\right. \\ + & \vartriangleleft +\left\{ +\begin{WithArrows}[c] +G & \vartriangleleft H+H+H+H+H+H+H \\ +I & \vartriangleleft +\left\{ +\begin{WithArrows} +J &\vartriangleleft K \\ +L &\vartriangleleft M +\end{WithArrows} +\right. +\end{WithArrows} +\right. \\ + & \vartriangleleft +\left\{ +\begin{WithArrows}[c] +N & \vartriangleleft O \\ +P & \vartriangleleft Q +\end{WithArrows} +\right. +\end{WithArrows}\] + +\begin{tikzpicture}[remember picture,overlay] +\draw [WithArrows/arrow] + ([xshift=3mm]wa-\WithArrowsLastEnv-2-1-2-r.south) + to ([xshift=3mm]wa-\WithArrowsLastEnv-3-2-r.north) ; +\end{tikzpicture} + +\medskip +Dans le cas présent, il aurait été plus facile d'utiliser une commande \verb|\Arrow| dans le \verb|code-after| mais +c'était seulement un exemple pour expliquer comment les nœuds Tikz créés par \pkg{witharrows} peuvent être utilisés. + +\bigskip +Dans l'exemple suivant, on crée deux environnements \verb|{WithArrows}| nommés +«\verb|premier|» et «\verb|second|» et on dessine une flèche entre un nœud du premier et un nœud du second. + +\begin{Verbatim} +$\begin{WithArrows}[~emphase#name=premier@] +A & = B \\ + & = C +\end{WithArrows}$ + +\bigskip +$\begin{WithArrows}[~emphase#name=second@] +A' & = B' \\ + & = C' +\end{WithArrows}$ + +\begin{tikzpicture}[remember picture,overlay] +\draw [WithArrows/arrow] + ([xshift=3mm]~emphase#premier@-1-r.south) + to ([xshift=3mm]~emphase#second@-1-r.north) ; +\end{tikzpicture} +\end{Verbatim} + + +\begin{center} +$\begin{WithArrows}[name=premier] +A & = B \\ + & = C +\end{WithArrows}$ + +\bigskip +$\begin{WithArrows}[name=second] +A' & = B' \\ + & = C' +\end{WithArrows}$ +\end{center} + +\begin{tikzpicture}[remember picture,overlay] +\draw [WithArrows/arrow] + ([xshift=3mm]premier-1-r.south) + to ([xshift=3mm]second-1-r.north) ; +\end{tikzpicture} + +\section{L'environnement \{DispWithArrows\}} +\label{DispWithArrows} + +Comme dit précédemment, l'environnement \verb|{WithArrows}| présente des similitudes avec l'environnement +\verb|{aligned}| de l'\pkg{amsmath} (et de \verb|mathtools|). L'extension \pkg{witharrows} +fournit aussi un environnement \verb|{DispWithArrows}| qui est similaire aux +environnements \verb|{align}| et \verb|{flalign}| de l'\pkg{amsmath}. + +\medskip +L'environnement \verb|{DispWithArrows}| doit être utilisé \emph{hors} du mode mathématique. Comme +\verb|{align}|, il doit être utilisé en mode horizontal. +\begin{Verbatim} +\begin{~emphase#DispWithArrows@} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{~emphase#DispWithArrows@} +\end{Verbatim} +\begin{DispWithArrows} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{DispWithArrows} + +\medskip +Il est possible d'utiliser la commande \verb|\notag| (ou \verb|\nonumber|) pour supprimer un numéro d'équation. + +Il est possible d'utiliser la commande \verb|\tag| pour placer une étiquette spéciale (par ex. $\star$). + +Il est aussi possible de placer un label pour une ligne de l'environnement avec la commande +\verb|\label|. + +Ces commandes doivent être utilisées dans la dernière colonne de l'environnement. +\begin{Verbatim} +\begin{DispWithArrows} +A & = (a+1)^2 \Arrow{on développe} ~emphase#\notag@ \\ + & = a^2 + 2a + 1 ~emphase#\tag{$\star$} \label{mon-équation}@ +\end{DispWithArrows} +\end{Verbatim} +\begin{DispWithArrows} +A & = (a+1)^2 \Arrow{on développe} \notag \\ + & = a^2 + 2a + 1 \tag{$\star$} \label{mon-équation} +\end{DispWithArrows} +Un lien vers l'équation \eqref{mon-équation}. On a obtenu ce lien avec la commande +\verb|\eqref{mon-équation}| (la commande \verb|\eqref| est une commande de l'extension \pkg{amsmath}). + +\medskip +Si \pkg{amsmath} (ou \pkg{mathtools}) est chargée, il est toujours possible d'utiliser +\verb|\tag*| qui, comme dans l'extension\pkg{amsmath}, compose le label sans les parenthèses. +Par exemple, il est possible de l'utiliser pour mettre le symbole \verb|\square| de +\pkg{amssymb}. Ce symbole est souvent utilisé pour marquer la fin d'une démonstration.\footnote{Signalons que l'environnement \verb|{DispWithArrows}| est compatible +avec la commande \verb|\qedhere| de \pkg{amsthm}.} +\begin{Verbatim} +\begin{DispWithArrows} +A & = (a+1)^2 \Arrow{on développe} \notag \\ + & = a^2 + 2a + 1 ~emphase#\tag*{$\square$}@ +\end{DispWithArrows} +\end{Verbatim} +\begin{DispWithArrows} +A & = (a+1)^2 \Arrow{on développe} \notag \\ + & = a^2 + 2a + 1 \tag*{$\square$} +\end{DispWithArrows} + +\medskip +Il est également possible de supprimer tous les numéros d'équations avec l'option booléenne \verb|notag| (ou +\verb|nonumber|), au niveau global ou bien au niveau d'un environnement. + +Enfin, il existe aussi +un environnement \verb|{DispWithArrows*}| qui supprime tous les numéros.\footnote{Même dans ce cas, il est possible +de mettre une étiquette manuellement avec la commande \verb|\tag|.} +\begin{Verbatim} +\begin{~emphase#DispWithArrows*@} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{~emphase#DispWithArrows*@} +\end{Verbatim} +\begin{DispWithArrows*} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{DispWithArrows*} + +\medskip +En fait, il y a une autre option, nommée \verb|tagged-lines|, qui peut être utilisée pour contrôler quelles lignes +seront numérotées. La valeur de cette option est la liste des numéros de lignes (dans l'environnement) qui seront +numérotées (par le système de numérotage des équations). Par exemple, avec l'option +\verb|tagged-lines = {first,3,last}|, seulement la première, la troisième et la dernière lignes seront numérotées. +Il y a aussi une valeur spéciale \verb|all| qui signifie que toutes les lignes doivent être numérotées. +\begin{Verbatim} +\begin{DispWithArrows}[~emphase#tagged-lines = last@] +A & = A_1 \Arrow{première étape} \\ + & = A_2 \Arrow{deuxième étape} \\ + & = A_3 +\end{DispWithArrows} +\end{Verbatim} +\begin{DispWithArrows}[tagged-lines = last] +A & = A_1 \Arrow{première étape} \\ + & = A_2 \Arrow{deuxième étape} \\ + & = A_3 +\end{DispWithArrows} + +\bigskip +Avec l'option \verb|fleqn|, l'environnement est composé calé à gauche (d'une manière similaire +à l'option \verb|fleqn| des classes standard de LaTeX). Dans ce cas, la marge gauche peut être réglée avec +l'option \verb|mathindent| (qui a un nom inspiré du paramètre \verb|\mathindent| de LaTeX). La valeur par défaut +pour cette option est de 25~pt. + +\begin{Verbatim} +\begin{DispWithArrows}[~emphase#fleqn,mathindent = 1cm@] +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{DispWithArrows} +\end{Verbatim} +\begin{DispWithArrows}[fleqn,mathindent = 1cm] +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{DispWithArrows} + +\medskip +\emph{Remarque} : Par conception, l'option \verb|fleqn| de \pkg{witharrows} est +indépendante de l'option de classe \verb|fleqn| de LaTeX. En effet, puisque les environnement de +\pkg{witharrows} sont conçus pour être utilisés avec des flèches sur le côté droit, l'utilisateur +peut souhaiter utiliser \pkg{witharrows} avec l'option \verb|fleqn| (de manière à avoir plus de place sur la droite +des équations pour les flèches) tout en continuant à centrer les équations classiques. + +\medskip +Si l'option \verb|leqno| est utilisée comme option de classe, les labels seront composés +à gauche également pour les environnements \verb|{DispWithArrows}|.\footnote{L'extension \pkg{amsmath} a une option \verb|leqno| +mais \pkg{witharrows}, bien entendu, ne tient pas compte de cette option : \pkg{witharrows} +vérifie seulement l'option \verb|leqno| de la classe du document.} + + +\medskip +Si l'extension \pkg{amsmath} est chargée, il est possible d'utiliser la commande \verb|\intertext| dans les +environnements \verb|{DispWithArrows}|. Il est également possible d'utiliser l'environnement \verb|{subequations}|. +Néanmoins, il existe pour les environnements \verb|{DispWithArrows}| une option \verb|subequations| qui demande +d'encapsuler l'environnement dans un environnement \verb|{subequations}|. + + +\medskip +Dans l'exemple suivant, l'option \verb|subequations| est fixée via la commande \verb|\WithArrowsOptions|. Chacun +des environnements suivants sera alors sous-numéroté (dans la portée de la commande \verb|WithArrowsOptions|). + +\begin{Verbatim} +~emphase#\WithArrowsOptions{subequations}@ +Premier environnement. +\begin{DispWithArrows} +A & = B \\ + & = C +\end{DispWithArrows} +Deuxième environnement. +\begin{DispWithArrows} +D & = E \\ + & = F +\end{DispWithArrows} +\end{Verbatim} +% +\begin{scope} +\WithArrowsOptions{subequations} +Premier environnement. +\begin{DispWithArrows} +A & = B \\ + & = C +\end{DispWithArrows} +Deuxième environnement. +\begin{DispWithArrows} +D & = E \\ + & = F +\end{DispWithArrows} +\end{scope} + +\bigskip +S'il n'y a pas suffisamment de place pour faire appraraître le numéro d'équation à la fin de la ligne, il n'y a pas +de positionnement automatique de ce numéro sur la ligne suivante (comme dans les environnements de +l'\pkg{amsmath}) : il y aura surimpression de texte. Néanmoins, dans \verb|{DispWithArrows}|, l'utilisateur peut +utiliser la commande \verb|\tagnextline| pour demander manuellement la composition du numéro sur la ligne suivante. +\begin{Verbatim} +\begin{DispWithArrows}[displaystyle] +S_{2(p+1)} +& =\sum_{k=1}^{2(p+1)} (-1)^k k^2 \\ +& \smash[b]{=\sum_{k=1}^{2p}(-1)^kk² + +(-1)^{2p+1}(2p+1)^2+(-1)^{2p+2}(2p+2)^2} ~emphase#\tagnextline@ \\ +&= S_{2p}-(2p+1)^2+(2p+2)^2\\ +&=p(2p+1)-(2p+1)^2+(2p+2)^2\\ +&= 2p^2+5p+3 +\end{DispWithArrows} +\end{Verbatim} +\begin{center} +\color{gray}\vrule% +\begin{minipage}{275pt}\color{black} +\begin{DispWithArrows}[displaystyle] +S_{2(p+1)} +& =\sum_{k=1}^{2(p+1)} (-1)^k k^2 \\ +& \smash[b]{=\sum_{k=1}^{2p}(-1)^kk^2+(-1)^{2p+1}(2p+1)^2+(-1)^{2p+2}(2p+2)^2} +\tagnextline \\ +&= S_{2p}-(2p+1)^2+(2p+2)^2\\ +&= 2p^2+p-4p^2-4p-1+4p^2+8p+4\\ +&= 2p^2+5p+3 +\end{DispWithArrows} +\end{minipage}% +\color{gray}\vrule +\end{center} + + + +\bigskip +Les environnements \verb|{DispWithArrows}| et \verb|{DispWithArrows*}| fournissent également une option +\verb|wrap-lines|. Avec cette option, les lignes de l'étiquette sont automatiquement coupées à droite.\footnote{Il + est possible d'éviter la coupure des mots avec l'option «\verb|align = flush left|» de Tikz.}\label{wrap-lines} + +\begin{Verbatim} +\begin{DispWithArrows*}[displaystyle,~emphase#wrap-lines@] +S_n +& = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +\Arrow{somme des termes d'une suite géométrique de raison $e^{i\frac{2\pi}n}$}\\ +& = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n} + {1-e^{i\frac{\pi}{2n}}}\right) +\Arrow{cette ligne de texte a été coupée automatiquement} \\ +& = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +\end{DispWithArrows*} +\end{Verbatim} +\begin{DispWithArrows*}[displaystyle,wrap-lines] +S_n +& = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +\Arrow{somme des termes d'une suite géométrique de raison $e^{i\frac{2\pi}n}$}\\ +& = \frac1n \Re \left( +\frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}} \right) +\Arrow{cette ligne de texte a été coupée automatiquement} \\ +& = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +\end{DispWithArrows*} + +\bigskip +L'option \verb|wrap-lines| ne s'applique pas aux environnements \verb|{WithArrows}| +imbriqués dans un environnement \verb|{DispWithArrows}| ou \verb|{DispWithArrows*}|. Néanmoins, +elle s'applique aux instructions \verb|\Arrow| et \verb|\MultiArrow| du \verb|code-after| +de l'environnement englobant. + +\vspace{1cm} +Nous avons dit que les environnements \verb|{DispWithArrows}| et \verb|{DispWithArrows*}| +devaient être utilisés en mode horizontal et non en mode vertical. Il y a néanmoins +une exception. Ces environnements peuvent être utilisés directement après un \verb|\item| d'une liste +LaTeX. Dans ce cas, aucun espace vertical n'est ajouté avant l'environnement.\footnote{Il est possible de désactiver + cette fonctionnalité avec l'option \verb|standard-behaviour-with-items|.} + +\medskip +Voici un exemple où, avec \verb|{DispWithArrows}|, on peut insérer l'équation dans un environnement +\verb|{enumerate}| tout en utilisant l'option \verb|wrap-lines|. + +\begin{Verbatim} +~emphase#\begin{enumerate}@ +~emphase#\item @ +\begin{DispWithArrows}% + [displaystyle, wrap-lines, tagged-lines = last, fleqn, mathindent = 0 pt] +S_n +& = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +\Arrow{on utilise la formule pour la somme de termes d'une suite géométrique de raison +$e^{i\frac{2\pi}n}$} \\ +& = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n} + {1-e^{i\frac{\pi}{2n}}}\right) +\Arrow{$\bigl(e^{i\frac{\pi}{2n}}\bigr)^n = e^{i\frac{\pi}2}=i$} \\ +& = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +\end{DispWithArrows} +~emphase#\end{enumerate}@ +\end{Verbatim} +\begin{enumerate} +\item +\begin{DispWithArrows}[displaystyle, wrap-lines, tagged-lines = last, fleqn, mathindent = 0 pt] +S_n +& = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +\Arrow{on utilise la formule pour la somme de termes d'une suite géométrique de raison +$e^{i\frac{2\pi}n}$}\\ +& = \frac1n \Re \left( +\frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}} \right) +\Arrow{$\bigl(e^{i\frac{\pi}{2n}}\bigr)^n = e^{i\frac{\pi}2}=i$} \\ +& = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +\end{DispWithArrows} +\end{enumerate} + +\vspace{1cm} +L'environnement \verb|{DispWithArrows}| est similaire à l'environnement \verb|{align}| de +l'\pkg{amsmath}. Néanmoins, \verb|{DispWithArrows}| n'est pas construit en utilisant \verb|{align}| +(en fait, il est possible d'utiliser \pkg{witharrows} sans \pkg{amsmath}). + +Il y a quelques différences entre \verb|{DispWithArrows}| et \verb|{align}|. +\begin{itemize} +\item L'environnement \verb|{DispWithArrows}| ne peut pas être inséré dans un environment +\verb|{gather}| de l'\pkg{amsmath}. +\item Un environment \verb|{DispWithArrows}| est toujours insécable (même avec +\verb|\allowdisplaybreaks| de l'\pkg{amsmath}). +\item Les commandes \verb|\label|, \verb|\tag|, \verb|\notag| et \verb|\nonumber| ne sont autorisées +que dans la dernière colonne. +\item Après un \verb|\item| d'une liste LaTeX, aucun espace vertical n'est ajouté (cela peut être +modifié avec l'option \verb|standard-behaviour-with-items|). +\item +\begin{bfseries} +Enfin, par défaut, les éléments d'un environnement \verb|\{DispWithArrows\}| +sont composés en \verb|textstyle| et non en \verb|displaystyle| (il est possible de modifier +ce point avec l'option \verb|displaystyle|). +\end{bfseries} +\end{itemize} + +\bigskip +En ce qui concerne les références, l'extension \pkg{witharrows} est compatible avec les +extensions \pkg{autonum}, \pkg{cleveref}, \pkg{fancyref}, \pkg{fncylab}, +\pkg{hyperref}, \pkg{listlbls}, \pkg{prettyref}, \pkg{refcheck}, +\pkg{refstyle}, \pkg{showlabels}, \pkg{smartref}, \pkg{typedref} et +\pkg{varioref} et avec les options \verb|showonlyrefs| et \verb|showmanualtags| de +\pkg{mathtools}.\footnote{Rappelons que \pkg{varioref}, \pkg{hyperref}, +\pkg{cleveref} et \pkg{autonum} doivent être chargés dans cet ordre. L'extension +\pkg{witharrows} peut être chargée n'importe où.} + +Elle n'est pas compatible avec \pkg{showkeys} (certains labels ne sont pas affichés). + + + + +\subsection*{L'option <...> de DispWithArrows} + +L'environnement \verb|{DispWithArrows}| propose une option \verb|left-brace|. Si cette option est présente, son +contenu est composé à gauche, suivi d'une accolade (d'où le nom) puis du corps de +l'environnement.\footnote{L'option \verb|left-brace| peut aussi être utilisée sans valeur: dans ce cas, seule + l'accolade est tracée.} + +Pour la lisibilité, cette option \verb|left-brace| est aussi disponible avec une syntaxe spéciale : on peut la +rentrer en la mettant entre chevrons (\verb|<| et \verb|>|) juste après le \verb|{DispWithArrows}| (et donc avant +les éventuels arguments optionnels entre crochets). + +\bigskip +On peut alors faire des constructions avec distinctions de cas, comme dans l'exemple +suivant.\footnote{L'environnement \verb|{cases}| de l'\pkg{amsmath} permet de réaliser de telles distinctions de + cas mais on ne peut pas utiliser la numérotation automatique des équations. L'environnement \verb|{numcases}| de + l'extension \pkg{cases} (de Donald Arseneau) permet d'utiliser ces numéros d'équations, mais, bien entendu, il + n'y a pas de composition de flèches.} + + + +\medskip + +\begin{BVerbatim} +\begin{DispWithArrows}~emphase#< \binom{n}{p} = >@[format = ll,fleqn,displaystyle] +0 & \quad \text{si } p > n +\Arrow{ce cas peut en fait rentrer\\ dans le suivant} \\ +\frac{n(n-1)\cdots(n-p+1)}{p!} & \quad \text{si } 0 \leq p \leq n \\ +0 & \quad \text{si } p < 0 +\end{DispWithArrows} +\end{BVerbatim} +% +\begin{DispWithArrows}< \binom{n}{p} = >[format = ll,fleqn,displaystyle] +0 & \quad \text{si } p > n +\Arrow{ce cas peut en fait rentrer\\ dans le suivant} \\ +\frac{n(n-1)\cdots(n-p+1)}{p!} & \quad \text{si } 0 \leq p \leq n \\ +0 & \quad \text{si } p < 0 +\end{DispWithArrows} + +\interitem +Dans l'exemple suivant, on sous-numérote les équations d'un système avec l'option \verb|subnumerate| (disponible +quand l'\verb|amsmath| est chargé). + +\begin{Verbatim} +\begin{DispWithArrows}~emphase#< \label{système} (\ref*{système}) \Leftrightarrow >@% + [format = l, subequations] +x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ +xy+xz+yz=-2 \\ +xyz = -15 \label{dernière-équation} +\end{DispWithArrows} +\end{Verbatim} +% +\begin{DispWithArrows}< \label{système} (\ref*{système}) \Leftrightarrow >% + [format = l, subequations] +x+y+z = -3 \Arrow[tikz=-,jump=2]{3 équations} \\ +xy+xz+yz=-2 \\ +xyz = -15 \label{dernière-équation} +\end{DispWithArrows} + +\bigskip +Le système complet est l'équation \eqref{système} (cette référence a été obtenue avec +\verb|\eqref{système}|) et la dernière équation est l'équation \eqref{dernière-équation} (référence obtenue +avec \verb|\eqref{dernière-équation}|). Notons que \verb|\ref*|, utilisé dans le code ci-dessus, est une variante +de \verb|ref| proposée par \pkg{hyperref} pour composer une référence sans créer de lien. + +\bigskip +On peut souhaiter remplacer l'accolade gauche par un autre délimiteur extensible (gauche). On peut le faire +avec l'option \verb|replace-curly-brace-by|. + +\bigskip +\section{Fonctionnalités avancées} + +\subsection{L'option tikz-code : comment changer la forme des flèches} + +\label{tikz-code} + +L'option \verb|tikz-code|\footnote{Pour des raisons historiques, l'option \verb|tikz-code| a un alias : + \verb|TikzCode|.} permet à l'utilisateur de changer la forme des flèches.\footnote{Si l'option \verb|wrap-lines| + est utilisée dans un environnement \verb|{DispWithArrows}| ou \verb|{DispWithArrows*}|, l'option \verb|tikz-code| + n'aura pas d'effet sur les flèches de cet environnement mais uniquement sur les flèches des environnements + \verb|{WithArrows}| imbriqués.} + +\smallskip +Par exemple, les options «\verb|up|» et «\verb|down|» décrites précédemment (cf. +p.~\pageref{up-and-down}) sont programmées en interne avec \verb|tikz-code|. + +\smallskip +La valeur de cette option doit être une instruction de tracé Tikz valide (avec le point-virgule final) où les trois +marqueurs \verb|#1|, \verb|#2| et \verb|#3| représentent le point de départ, le point d'arrivée et l'étiquette de +la flèche. + + +\bigskip +Par défaut, la valeur de \verb|tikz-code| est la suivante : + +\smallskip +\qquad \verb|\draw (#1) to node {#3} (#2) ;| + + +\bigskip +Dans l'exemple suivant, nous remplaçons le chemin par défaut par un chemin avec trois segments (et un +nœud recouvrant le deuxième segment). +\begin{Verbatim} +\begin{WithArrows}[format=c,ygap=5pt,interline=4mm, + ~emphase#tikz-code = {\draw[rounded corners]@ + ~emphase# (~#1) -- ([xshift=5mm]~#1)@ + ~emphase# -- node[circle,@ + ~emphase# draw,@ + ~emphase# auto = false,@ + ~emphase# fill = gray!50,@ + ~emphase# inner sep = 1pt] {\tiny ~#3}@ + ~emphase# ([xshift=5mm]~#2)@ + ~emphase# -- (~#2) ; }@] +3 (2x+4) = 6 \Arrow{$\div 3$} \\ +2x+4 = 2 \Arrow{$-4$} \\ +2x = -2 \Arrow{$\div 2$} \\ + x = -1 +\end{WithArrows} +\end{Verbatim} + + +\[\begin{WithArrows}[format=c, + ygap=5pt, + interline=4mm, + tikz-code = {\draw[rounded corners] + (#1) + -- + ([xshift=5mm]#1) + -- node[circle, + draw, + auto=false, + fill=gray!50, + inner sep = 1pt] {\tiny #3} + ([xshift=5mm]#2) + -- + (#2) ; }] +3 (2x+4) = 6 \Arrow{$\div 3$} \\ +2x+4 = 2 \Arrow{$-4$} \\ +2x = -2 \Arrow{$\div 2$} \\ + x = -1 +\end{WithArrows}\] + +\bigskip +L'environnement \verb|{DispWithArrows}| et sa version étoilée \verb|{DispWithArrows*}| fournissent une commande +\verb|\WithArrowsRightX| qui peut être utilisée dans l'option \verb|tikz-code|. Cette commande fournit +l'abscisse de la marge droite de la boîte de composition courante (en prenant en compte les éventuels numéros des +équations). Pour un exemple d'utilisation, voir p.~\pageref{example-WithArrowsRightX}. + + +\bigskip +\subsection{La commande \textbackslash WithArrowsNewStyle} + +L'extension \pkg{witharrows} fournit une commande \verb|\WithArrowsNewStyle| pour définir +des styles d'une manière similaire aux «styles» de Tikz. + +La commande \verb|\WithArrowsNewStyle| prend deux arguments obligatoires. Le premier est +le nom du style et le second est une liste de couples clé-valeur. La portée +de la definition ainsi faite par \verb|\WithArrowsNewStyle| est le groupe TeX courant. + +Le style peut être utilisé comme une clé au niveau du document (avec \verb|\WithArrowsOptions|), au niveau d'un +environnement (via les arguments optionnels) ou bien encore dans une autre commande \verb|\WithArrowsNewStyle|. + +Pour un exemple d'utilisation, voir p.~\pageref{example-WithArrowsRightX}. + + +\bigskip +\subsection{Postionnement vertical des flèches} + +Il y a quatre paramètres pour ajuster finement la position verticale des flèches : +\verb|ygap|, \verb|ystart|, \verb|start-adjust| et \verb|end-adjust|. + +\medskip +Nous expliquons d'abord le comportement quand les paramètres \verb|start-adjust| et \verb|end-adjust| sont égaux à +zéro: +\begin{itemize} +\item l'option \verb|ystart| représente la distance verticale entre la ligne de base du +texte et le début de la flèche (valeur par défaut : $0.4$~ex); +\item l'option \verb|ygap| représente la distance verticale entre deux flèches consécutives +(valeur par défaut : $0.4$~ex). +\end{itemize} + + +\bigskip +$\begin{WithArrows}[interline=1mm, adjust = 0pt] + (\cos x + \sin x)^2 & = \cos^2 x +2 \cos x \sin x + \sin^2 x\Arrow{}\tikz[remember picture] \coordinate (A) ; \\ + & = \cos^2x + \sin^2x + 2\sin x\cos x \Arrow{} \\ + & = 1 + \sin(2x) +\end{WithArrows}$ + +\begin{tikzpicture}[remember picture,overlay,blue] +\draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ;; +\draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ;; +\draw (B) -- (C) ; +\draw[<-] (B) to ++(0,0.2) ; +\draw[<-] (C) to ++(0,-0.2) ; +\path (C) node[right=1mm] {\texttt{ystart}} ; +\draw (wa-\WithArrowsLastEnv-2-r.north) to ++(3,0) coordinate (E) to ++(0.1,0); +\draw (wa-\WithArrowsLastEnv-2-r.south) to ++(3,0) coordinate (F) to ++(0.1,0); +\draw (E) -- (F) ; +\draw[<-] (E) to ++(0,0.2) ; +\draw[<-] (F) to ++(0,-0.2) ; +\path (F) node[right=1mm] {\texttt{ygap}} ; +\end{tikzpicture} + +\interitem +Néanmoins, pour des raisons esthétiques, quand il est possible, \pkg{witharrows} commence +la flèche un peu plus haut (d'une quantité \verb|start-adjust|) et termine la flèche un peu plus +bas (par une quantité \verb|end-adjust|). Par défaut, ces deux paramètres \verb|start-adjust| +est \verb|end-adjust| sont égaux à $0.4$~ex. + +\bigskip +Voici par exemple le comportement sans le mécanisme de \verb|start-adjust| et +\verb|end-adjust| (c'était le comportement par défaut dans les version antérieures à la version 1.13). +\begin{Verbatim} +$\begin{WithArrows}~emphase#[start-adjust=0pt, end-adjust=0pt]@ +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ +\end{Verbatim} + +$\begin{WithArrows}[start-adjust=0pt, end-adjust=0pt] +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + + +\bigskip +Voici le comportement par défaut depuis la version 1.13 (les paramètres +\verb|start-adjust| et \verb|end-ajust| sont utilisés avec la valeur par défaut $0.4$~ex). La flèche +est plus longue et le résultat est plus esthétique. + +\medskip +$\begin{WithArrows} +A & = (a+1)^2 \Arrow{on développe} \\ + & = a^2 + 2a + 1 +\end{WithArrows}$ + + +\bigskip +Il est possible d'utiliser l'option \verb|adjust| qui fixe à la fois \verb|start-adjust| et \verb|end-ajust|. + +\bigskip +Puisque le mécanisme de \verb|start-adjust| et \verb|end-ajust| a été ajouté dans la +version 1.13 of \pkg{witharrows}, cette version n'est pas strictement compatible avec +les versions précédentes. Néanmoins, il est possible de retrouver le comportement précédent +en fixant simplement \verb|start-adjust| et \verb|end-adjust| à $0$~pt: +\begin{Verbatim} +\WithArrowsOptions{adjust = 0pt} +\end{Verbatim} + +\bigskip +\subsection{Notes de pied de page dans les environnements de witharrows} + +Si vous voulez mettre des notes de pied de page dans un environnement de \pkg{witharrows}, +vous pouvez utiliser une paire \verb|\footnotemark|--\verb|\footnotetext|. + +\smallskip +Il est aussi possible d'extraire les notes de pieds de page avec l'extension \pkg{footnote} ou bien l'extension +\pkg{footnotehyper}. + +\smallskip +Si \pkg{witharrows} est chargée avec l'option \verb|footnote| (avec \verb|\usepackage[footnote]{witharrows}| ou +avec \verb|\PassOptionsToPackage|), l'extension \pkg{footnote} est chargée (si elle ne l'est pas déjà) et elle est +utilisée pour extraire les notes de pied de page. + +\smallskip +Si \pkg{witharrows} est chargée avec l'option \verb|footnotehyper|, l'extension \pkg{footnotehyper} est chargée (si +elle ne l'est pas déjà) et elle est utilisée pour extraire les notes de pied de page. + +\smallskip +Attention : Les extensions \pkg{footnote} et \pkg{footnotehyper} sont incompatibles. +L'extension \pkg{footnotehyper} est le successeur de l'extension \pkg{footnote} +et devrait être utilisée préférentiellement. L'extension \pkg{footnote} a quelques défauts ; +en particulier, elle doit être chargée après l'extension \pkg{xcolor} et elle n'est pas parfaitement +compatible avec \pkg{hyperref}. + +\medskip +Dans ce document, l'extension \pkg{witharrows} a été chargée avec l'option \verb|footnotehyper| et nous donnons un +exemple avec une note de pied de page dans l'étiquette d'une flèche : + + +\smallskip +$\begin{WithArrows} +A & = (a+b)^2 +\Arrow{on développe\,\footnote{Une note de pied de page.}} \\ + & = a^2+b^2+2ab +\end{WithArrows}$ + +\bigskip +\subsection{L'option no-arrows} + +L'option \verb|no-arrows| est une facilité donnée à l'utilisateur. Avec cette option, +les flèches ne sont pas tracées. Néanmoins, une analyse des flèches est effectuée et certains erreurs sont +détectées (par exemple, si une flèche arrive après la dernière ligne de l'environnement). + + +\bigskip +\subsection{Note pour les développeurs} + +Si vous définissez un environnement s'appuyant sur un environnement de +\pkg{witharrows}, nous recommandons de faire appel à l'environnement de \pkg{witharrows} avec +\verb|\WithArrows|--\verb|\endWithArrows| ou \verb|\DispWithArrows|--\verb|\endDispWithArrows| (et +non \verb|\begin{WithArrows}|--\verb|\end{WithArrows}|, etc.). + +\smallskip +En faisant ainsi, les messages d'erreur affichés par \pkg{witharrows} mentionneront (le cas échéant) le nom de +votre environnement et seront plus faciles à comprendre pour l'utilisateur final. + +\smallskip +Par exemple, vous pouvez définir un environnement \verb|{DWA}| qui va être un alias de \verb|{DispWithArrows}|: +\begin{BVerbatim} +\NewDocumentEnvironment {DWA} {} {\DispWithArrows}{\endDispWithArrows} +\end{BVerbatim} + +\smallskip +Si vous utilisez cet environnement \verb|{DWA}| en mode mathématique, vous aurez le message d'erreur suivant : + +\begin{BVerbatim} +L'environnement {DWA} should be used only outside math mode. +\end{BVerbatim} + +\interitem +Une autre exemple est donné en interne par la définition de l'environnement \verb|{DispWithArrows*}| +dans l'extension \pkg{witharrows} avec le code suivant: +\begin{Verbatim} +\NewDocumentEnvironment {DispWithArrows*} {} + {\WithArrowsOptions{notag}% + \DispWithArrows} + {\endDispWithArrows} +\end{Verbatim} + + + +\section{Examples} + +\subsection{\textbackslash MoveEqLeft} + +Il est possible d'utiliser \verb|\MoveEqLeft| de \pkg{mathtools}. Dans ce cas, on doit se souvenir que la commande +\verb|\MoveEqLeft| a aussi la valeur d'une esperluette (\verb|&|). Il faut en tenir compte pour le positionnement +d'une éventuelle commande \verb|\Arrow|. + + +% +\begin{Verbatim}[formatcom=\small\color{gray}] +$\begin{WithArrows}[interline=0.5ex] +~emphase#\MoveEqLeft@ \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} +\Arrow{parce que les deux sont dans $[-\frac{\pi}2,\frac{\pi}2]$} \\ +& \Leftrightarrow x = \sin\left(\arcsin\frac45 + \arcsin\frac5{13}\right) \\ +& \Leftrightarrow x = \frac45\cos\arcsin\frac5{13} + \frac5{13} \cos\arcsin\frac45 +\Arrow{$\forall x \in [-1,1], \cos(\arcsin x) = \sqrt{1-x^2}$} \\ +& \Leftrightarrow x = \frac45\sqrt{1-\bigl(\frac5{13}\bigr)^2} ++ \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2} +\end{WithArrows}$ +\end{Verbatim} + + +\medskip +$\begin{WithArrows}[interline=0.5ex] +\MoveEqLeft \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} +\Arrow{parce que les deux sont dans $[-\frac{\pi}2,\frac{\pi}2]$} \\ +& \Leftrightarrow x = \sin\left(\arcsin\frac45 + \arcsin\frac5{13}\right) \\ +& \Leftrightarrow x = \frac45\cos\arcsin\frac5{13} + \frac5{13} \cos\arcsin\frac45 +\Arrow{$\forall x \in [-1,1], \cos(\arcsin x) = \sqrt{1-x^2}$} \\ +& \Leftrightarrow x = \frac45\sqrt{1-\bigl(\frac5{13}\bigr)^2} ++ \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2} +\end{WithArrows}$ + + +\bigskip +\subsection{Modifier la forme des nœuds} + +Il est possible de changer la forme des étiquettes, qui sont des nœuds Tikz, en +modifiant la clé «\verb|every node|» de Tikz. + +\begin{Verbatim} +\begin{WithArrows}% + [format = c, + interline = 4mm, + tikz = {~emphase#every node/.style = {circle,@ + ~emphase# draw,@ + ~emphase# auto = false,@ + ~emphase# fill = gray!50,@ + ~emphase# inner sep = 1pt,@ + ~emphase# font = \tiny}@}] + 3 (2x+4) = 6 \Arrow{$\div 3$} \\ + 2x+4 = 2 \Arrow{$-4$} \\ + 2x = -2 \Arrow{$\div 2$} \\ + 2x = -1 +\end{WithArrows} +\end{Verbatim} + +\[\begin{WithArrows}[% + format = c, + interline = 4mm, + tikz = {every node/.style = {circle, + draw, + auto = false, + fill = gray!50, + inner sep = 1pt, + font = \tiny}}] + 3 (2x+4) = 6 \Arrow{$\div 3$} \\ + 2x+4 = 2 \Arrow{$-4$} \\ + 2x = -2 \Arrow{$\div 2$} \\ + 2x = -1 +\end{WithArrows}\] + + +\bigskip +\subsection{Exemples avec l'option tikz-code} + +Rappelons que l'option \verb|tikz-code| est le code Tikz utilisé par \pkg{witharrows} +pour tracer les flèches.\footnote{Si un environnement \verb|{DispWithArrows}| ou +\verb|{DispWithArrows*}| est utilisé avec l'option \verb|wrap-lines|, la valeur de l'option +\verb|tikz-code| n'est pas utilisée pour cet environnement (mais est utilisée pour les +environnements imbriqués à l'intérieur).} + +\smallskip +La valeur par défaut de \verb|tikz-code| est \verb|\draw (#1) to node {#3} (#2) ;| +où les trois marqueurs \verb|#1|, \verb|#2| et \verb|#3| représentent le point de départ, le point d'arrivée +et l'étiquette de la flèche. + + +\bigskip +\subsubsection{Exemple 1} +Dans l'exemple suivant, nous définissons la valeur de \verb|tikz-code| avec deux +instructions \verb|\path| : la première instruction trace la flèche elle-même et la seconde +place l'étiquette dans un nœud Tikz dans le rectangle délimité par la flèche. + +\begin{Verbatim} +\begin{DispWithArrows*}% + [displaystyle, + ygap = 2mm, + ystart = 0mm, + ~emphase#tikz-code = {\draw (~#1) -- ++(4.5cm,0) \verb|- (~#2) ;@ + ~emphase# \path (~#1) -- (~#2) @ + ~emphase# node[text width = 4.2cm, right, midway] {~#3} ;}@] +S_n +& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr) +........... +\end{Verbatim} + + +\bigskip +\begin{DispWithArrows*}[ + displaystyle, + ygap = 2mm, + ystart = 0mm, + tikz-code = {\draw (#1) -- ++(4.5cm,0) |- (#2) ; + \path (#1) -- (#2) + node[text width = 4.2cm, right, midway] {#3} ;}] +S_n +& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr) +\Arrow{$\cos x = \Re(e^{ix})$}\\ +& = \frac1n\sum_{k=0}^{n-1} \Re\left(e^{i\frac{k\pi}{2n}}\right) +\Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\ +& = \frac1n \Re\left(\sum_{k=0}^{n-1} e^{i\frac{k\pi}{2n}}\right) +\Arrow{$\exp$ est un morphisme pour $\times$ et $+$} \\ +& = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +\Arrow{somme de termes d'une suite géométrique de raison $e^{i\frac{2\pi}n}$}\\ +& = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)\\ +& = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +\end{DispWithArrows*} + +\bigskip +\subsubsection{Exemple 2} + +\label{example-WithArrowsRightX} +Il est possible de modifier l'exemple précédent pour avoir «\verb|text width|» calculé automatiquement en fonction +de la marge droite (d'une manière similaire à l'option \verb|wrap-lines|) dans les environnements +\verb|{DispWithArrows}| et \verb|{DispWithArrows*}|. Dans la définition de \verb|tikz-code|, nous utilisons la commande +\verb|\WithArrowsRightX| qui donne l'abscisse de la marge droite de la boîte de composition (pour TeX, il s'agit d'une commande +et non d'une dimension). Pour la lisibilité, nous avons utilisé un style de \pkg{witharrows}. Cet exemple nécessite +l'extension Tikz \pkg{calc}. + +\begin{Verbatim} +\WithArrowsNewStyle{MonStyle} + {displaystyle, + ygap = 2mm, + xoffset = 0pt, + ystart = 0mm, + tikz-code = {\path let \p1 = (~#~#1) + in (~#~#1) + -- node [anchor = west, + text width = {~emphase#\WithArrowsRightX@ - \x1 - 0.5 em}] + {~#~#3} + (~#~#2) ; + \draw let \p1 = (~#~#1) + in (~#~#1) -- ++(~emphase#\WithArrowsRightX@ - \x1,0) |- (~#~#2) ; }} +\end{Verbatim} + +\begin{Verbatim} +\begin{DispWithArrows}[MonStyle] + S_n + & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr) + \Arrow{$\cos x = \Re(e^{ix})$}\\ +........... +\end{Verbatim} + +\WithArrowsNewStyle{MonStyle} +{displaystyle, + ygap = 2mm, + xoffset = 0pt, + ystart = 0mm, + tikz-code = {\path let \p1 = (##1) + in (##1) + -- node [anchor = west, + text width = {\WithArrowsRightX - \x1 - 0.5 em}] {##3} + (##2) ; + \draw let \p1 = (##1) + in (##1) -- ++(\WithArrowsRightX - \x1,0) |- (##2) ; }} + +\begin{DispWithArrows}[MonStyle] +S_n +& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr) +\Arrow{$\cos x = \Re(e^{ix})$}\\ +& = \frac1n\sum_{k=0}^{n-1} \Re\left(e^{i\frac{k\pi}{2n}}\right) +\Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\ +& = \frac1n \Re\left(\sum_{k=0}^{n-1} e^{i\frac{k\pi}{2n}}\right) +\Arrow{$\exp$ est un morphisme pour $\times$ et $+$} \\ +& = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +\Arrow{somme de termes d'une suite géométrique $e^{i\frac{2\pi}n}$}\\ +& = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)\\ +& = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +\end{DispWithArrows} + + + +\bigskip +\subsubsection{Exemple 3} + +Dans l'exemple suivant, nous changeons la forme de la flèche selon que la rangée de départ est plus longue ou +plus courte que la rangée d'arrivée. Cet exemple nécessite l'extension \pkg{calc} de Tikz. + + +\begin{Verbatim} +\begin{WithArrows}[ll,interline=5mm,xoffset=5mm, + ~emphase#tikz-code = {\draw[rounded corners,@ + ~emphase# every node/.style = {circle,@ + ~emphase# draw,@ + ~emphase# auto = false,@ + ~emphase# inner sep = 1pt,@ + ~emphase# fill = gray!50,@ + ~emphase# font = \tiny }]@ + ~emphase# let \p1 = (~#1),@ + ~emphase# \p2 = (~#2)@ + ~emphase# dans \ifdim \x1 > \x2@ + ~emphase# (\p1) -- node {~#3} (\x1,\y2) -- (\p2)@ + ~emphase# \else@ + ~emphase# (\p1) -- (\x2,\y1) -- node {~#3} (\p2)@ + ~emphase# \fi ;}@] +E & \Longleftrightarrow \frac{(x+4)}3 + \frac{5x+3}5 = 7 +\Arrow{$\times 15$}\\ + & \Longleftrightarrow 5(x+4) + 3(5x+3) = 105 \\ + & \Longleftrightarrow 5x+20 + 15x+9 = 105 \\ + & \Longleftrightarrow 20x+29 = 105 +\Arrow{$-29$}\\ + & \Longleftrightarrow 20x = 76 +\Arrow{$\div 20$}\\ + & \Longleftrightarrow x = \frac{38}{10} +\end{WithArrows} +\end{Verbatim} + + +\[\begin{WithArrows}[ll,interline=5mm,xoffset=5mm, + tikz-code = {\draw[rounded corners, + every node/.style = {circle, + draw, + auto = false, + inner sep = 1pt, + fill = gray!50, + font = \tiny}] + let \p1 = (#1), + \p2 = (#2) + in \ifdim \x1 > \x2 + (\p1) -- node {#3} (\x1,\y2) -- (\p2) + \else + (\p1) -- (\x2,\y1) -- node {#3} (\p2) + \fi ;}] +E & \Longleftrightarrow \frac{(x+4)}3 + \frac{5x+3}5 = 7 +\Arrow{$\times 15$}\\ + & \Longleftrightarrow 5(x+4) + 3(5x+3) = 105 \\ + & \Longleftrightarrow 5x+20 + 15x+9 = 105 \\ + & \Longleftrightarrow 20x+29 = 105 +\Arrow{$-29$}\\ + & \Longleftrightarrow 20x = 76 +\Arrow{$\div 20$}\\ + & \Longleftrightarrow x = \frac{38}{10} +\end{WithArrows}\] + + + +\subsection{Boucle numérotée automatique} + +Supposons que nous voulions tracer une boucle avec des flèches numérotées. Dans ce but, il est +possible d'écrire une commande dédiée \verb|\BoucleNumérotée| qui fera le travail quand elle +sera utilisée dans le \verb|code-after|. Dans l'exemple suivant, nous avons écrit cette commande avec +\verb|\NewDocumentCommand| de \pkg{xparse} et \verb|\foreach| de \pkg{pgffor} (ces deux +extensions sont chargées quand \pkg{witharrows} est chargé.). + +\begin{Verbatim} +\NewDocumentCommande \NombreedLoop {} + {\foreach \j dans {2,...,\WithArrowsNbLines} + { \pgfmathtruncatemacro{\i}{\j-1} + \Arrow[rr]{\i}{\j}{\i} } + \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\WithArrowsNbLines}{\WithArrowsNbLines}} +\end{Verbatim} + +La commande \verb|\WithArrowsNbLines| est une commande disponible dans le \verb|code-after| qui donne +le nombre total de lignes (=rangées) dans l'environnement courant (pour TeX, il s'agit d'une commande et non d'un +compteur). + + +\bigskip +\begin{Verbatim} +$\begin{WithArrows}[~emphase#code-after = \BoucleNumérotée@] +a.\;& f \text{ est continue sur } E \\ +b.\;& f \text{ est continue en } 0 \\ +c.\;& f \text{ est bornée sur la sphère unité} \\ +d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\ +e.\;& f \text{ est lipschitzienne} +\end{WithArrows}$ +\end{Verbatim} + +\bigskip +\begin{scope} +\NewDocumentCommand \BoucleNumérotée {} + {\foreach \j in {2,...,\WithArrowsNbLines} + { \pgfmathtruncatemacro{\i}{\j-1} + \Arrow[rr]{\i}{\j}{\i} } + \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\WithArrowsNbLines}{\WithArrowsNbLines}} + + +$\begin{WithArrows}[code-after = \BoucleNumérotée] +a.\;& f \text{ est continue sur } E \\ +b.\;& f \text{ est continue en } 0 \\ +c.\;& f \text{ est bornée sur la sphère unité} \\ +d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\ +e.\;& f \text{ est lipschitzienne} +\end{WithArrows}$ + + +\bigskip +Comme d'habitude, il est possible changer les caractéristiques des flèches et des nœuds +avec l'option \verb|tikz|. Néanmoins, si nous voulons changer le style pour avoir, par +exemple, les numéros entre parenthèses, le moyen le plus rapide est de changer la valeur de +\verb|tikz-code|: + +\begin{Verbatim} +tikz-code = {\draw (~#1) to node {\footnotesize (~#3)} (~#2) ;} +\end{Verbatim} + +\WithArrowsOptions{tikz-code = {\draw (#1) to node {\footnotesize (#3)} (#2) ;}} + +$\begin{WithArrows}[code-after = \BoucleNumérotée] +a.\;& f \text{ est continue on } E \\ +b.\;& f \text{ est continue dans } 0 \\ +c.\;& f \text{ est bornée sur la sphère unité} \\ +d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\ +e.\;& f \text{ est lipschitzienne} +\end{WithArrows}$ + +\end{scope} + + + + + +\end{document} diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf Binary files differindex cdd7c11f9e0..a93bca1ae42 100644 --- a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf +++ b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx index c9b463ca716..f814d93b32b 100644 --- a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx +++ b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{1.17} -\def\myfiledate{2019/07/09} +\def\myfileversion{1.18} +\def\myfiledate{2019/07/24} % % %<*batchfile> @@ -44,11 +44,11 @@ version 2005/12/01 or later. \endgroup %</batchfile> % -%<@@=wa> +%<@@=wi> %<*driver> \documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by witharrows) \usepackage{xltxtra} -\usepackage{geometry} +\usepackage[xetex]{geometry} \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} \usepackage[footnotehyper]{witharrows} \usetikzlibrary{calc} @@ -61,6 +61,7 @@ version 2005/12/01 or later. \def\emphase{\bgroup\color{RoyalPurple}\let\next=} \fvset{commandchars=\~\#\@,formatcom={\color{gray}}} \DeclareMathOperator{\re}{Re} +\skip \footins = 2 \bigskipamount \parindent 0pt \DisableCrossrefs \begin{document} @@ -75,6 +76,15 @@ version 2005/12/01 or later. % % \maketitle % +% \hypersetup{ +% pdfinfo = { +% Title = { The extension 'witharrows' }, +% Subject = { A LaTeX extension } , +% Author = { F. Pantigny } +% } +% } +% +% % \begin{abstract} % The LaTeX package \pkg{witharrows} provides environments |{WithArrows}| and % |{DispWithArrows}| similar to the environments |{aligned}| and |{align}| of @@ -98,7 +108,7 @@ version 2005/12/01 or later. % \begin{Verbatim} % $\begin{WithArrows} % A & = (a+1)^2 ~emphase#\Arrow{we expand}@ \\ -% & = a^2 + 2a + 1 +% & = a^2 + 2a + 1 % don't put \\ here % \end{WithArrows}$ % \end{Verbatim} % @@ -117,9 +127,9 @@ version 2005/12/01 or later. % % \medskip % The environment |{WithArrows}| bears similarities with the environment -% |{aligned}| of |amsmath| (and |mathtools|). The extension \pkg{witharrows} +% |{aligned}| of \pkg{amsmath} (and |mathtools|). The extension \pkg{witharrows} % also provides an environment |{DispWithArrows}| which is similar to the -% environment |{align}| of |amsmath|: cf. p. \pageref{DispWithArrows}. +% environment |{align}| of \pkg{amsmath}: cf. p. \pageref{DispWithArrows}. % % % \section{Options for the shape of the arrows} @@ -164,7 +174,7 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \interitem -% The option |xoffset| shifts the arrows to the right (we usually don't want the +% The option |xoffset| shifts the arrow to the right (we usually don't want the % arrows to be stucked on the text). The default value of |xoffset| is $3$~mm. % \begin{Verbatim} % $\begin{WithArrows} @@ -217,7 +227,7 @@ version 2005/12/01 or later. % % \interitem % It's also possible to suppress both tips of the arrow with the Tikz option -% |-|. +% ``|-|''. % \begin{Verbatim} % $\begin{WithArrows} % A & = (a+1)^2 \Arrow[~emphase#tikz=-@]{very classical} \\ @@ -247,7 +257,7 @@ version 2005/12/01 or later. % % \smallskip % In fact, it's possible to change more drastically the shape or the arrows with -% the option |tikz-code| (presented p.~\pageref{tikz-code}. +% the option |tikz-code| (presented p.~\pageref{tikz-code}). % % \interitem % It's possible to use the Tikz option ``|text width|'' to control the width of @@ -323,16 +333,16 @@ version 2005/12/01 or later. % % \medskip % If we want exactly the same result as previously, we have to give to the -% option |font| the value |{\itshape\small\bfseries}|. +% option |font| the value |\itshape\small\bfseries|. % % % \interitem -% Almost all the options can be given directly between square brackets to the -% environment |{WithArrows}|. \textbf{There must be no space before the opening -% bracket (|[|) of the options of the environment.} The options apply to all the -% arrows of the environment.\footnote{They also apply to the nested environments -% |{WithArrows}| (with the logical exceptions of |interline|, |code-before| and -% |code-after|).} +% The options can be given directly between square brackets to the environment +% |{WithArrows}|. There must be no space between the |\begin{WithArrows}| and +% the opening bracket (|[|) of the options of the environment. Such options +% apply to all the arrows of the environment.\footnote{They also apply to the +% nested environments |{WithArrows}| (with the logical exceptions of +% |interline|, |code-before| and |code-after|).} % % % \begin{Verbatim} % $\begin{WithArrows}[~emphase#tikz=blue@] @@ -457,7 +467,7 @@ version 2005/12/01 or later. % % % \interitem -% The environment |{WithArrows}| gives also two options |code-before| and +% The environment |{WithArrows}| provides also two options |code-before| and % |code-after|\footnote{For historical reasons, there are aliases for these % options: |CodeBefore| and |CodeAfter|.} for LaTeX code that will be executed % at the beginning and at the end of the environment. These options are not @@ -519,9 +529,9 @@ version 2005/12/01 or later. % k & \;\le\; & t & \;\le\; & k+1 \\ % \frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} % \Arrow{we can integrate the inequalities since $k \leq k+1$ } \\ -% \int\limits_k^{k+1} \frac{\text{d} t}{k+1} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{t} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{k} \\ +% \int\limits_k^{k+1} \frac{d t}{k+1} +% & \le & \int\limits_k^{k+1} \frac{dt}{t} +% & \le & \int\limits_k^{k+1} \frac{dt}{k} \\ % \frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} % \end{DispWithArrows*} % \end{Verbatim} @@ -532,9 +542,9 @@ version 2005/12/01 or later. % k & \;\le\; & t & \;\le\; & k+1 \\ % \frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} % \Arrow{we can integrate the inequalities since $k \leq k+1$ } \\ -% \int\limits_k^{k+1} \frac{\text{d} t}{k+1} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{t} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{k} \\ +% \int\limits_k^{k+1} \frac{d t}{k+1} +% & \le & \int\limits_k^{k+1} \frac{dt}{t} +% & \le & \int\limits_k^{k+1} \frac{dt}{k} \\ % \frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} % \end{DispWithArrows*} % @@ -568,7 +578,7 @@ version 2005/12/01 or later. % on the right side of the array. These nodes will be called \emph{right nodes}. % % By default, the arrows use the right nodes. We will say that they are in |rr| -% mode ($r$ for \emph{right}). These arrows are |vertical| (we will say that an +% mode ($r$ for \emph{right}). These arrows are vertical (we will say that an % arrow is \emph{vertical} when its two ends have the same abscissa). % % @@ -882,7 +892,7 @@ version 2005/12/01 or later. % % \smallskip % \begin{Verbatim} -% On pose\enskip $~emphase#\left\{@ +% Let's set\enskip $~emphase#\left\{@ % \begin{WithArrows}[~emphase#c@] % f(x) & = 3x^3+2x^2-x+4 % \Arrow[tikz=-]{both are polynoms}\\ @@ -892,7 +902,7 @@ version 2005/12/01 or later. % \end{Verbatim} % % -% On pose\enskip $\left\{ +% Let's set\enskip $\left\{ % \begin{WithArrows}[c] % f(x) & = 3x^3+2x^2-x+4 % \Arrow[tikz=-]{both are polynoms}\\ @@ -1197,7 +1207,8 @@ version 2005/12/01 or later. % nodes: % \begin{itemize} % \item the command |\WithArrowsLastEnv| gives the number of the last -% environment of level~$0$; +% environment of level~$0$ (\emph{i.e.} which is not included in another +% environnment of the package \pkg{witharrows}); % % \item a name can be given to a given environment with the option |name| and, % in this case, the nodes created in the environment will have aliases @@ -1313,9 +1324,9 @@ version 2005/12/01 or later. % \label{DispWithArrows} % % As previously said, the environment |{WithArrows}| bears similarities with the -% environment |{aligned}| of |amsmath| (and |mathtools|). This extension also +% environment |{aligned}| of \pkg{amsmath} (and |mathtools|). This extension also % provides an environment |{DispWithArrows}| which is similar to the -% environments |{align}| and |{flalign}| of |amsmath|. +% environments |{align}| and |{flalign}| of \pkg{amsmath}. % % \medskip % The environment |{DispWithArrows}| must be used \emph{outside} math mode. Like @@ -1434,18 +1445,52 @@ version 2005/12/01 or later. % more space on the right of the equations for the arrows) while still centering % the classical equations. % -% \bigskip -% If the package \pkg{amsmath} is loaded, it's possible to use the environment -% |{subequations}| and the command |\intertext| in the environments -% |{DispWithArrows}| and |{DispWithArrows*}| (and even the |\intertext| of -% \pkg{nccmath} if this package is loaded). -% +% \medskip % If the option |leqno| is used as a class option, the labels will be composed % on the left also for the environments |{DispWithArrows}| and % |{DispWithArrows*}|.\footnote{The package \pkg{amsmath} has an option |leqno| % but \pkg{witharrows}, of course, is not aware of that option: \pkg{witharrows} % only checks the option |leqno| of the document class.} % +% \medskip +% If the package \pkg{amsmath} is loaded, it's possible to use the command +% |\intertext| in the environments |{DispWithArrows}|. It's also possible to use +% the environment |{subequations}|. However, there is, for the environments +% |{DispWithArrows}| an option |subequations| to encapsulate the environment in +% an environment |{subequations}|. +% +% \medskip +% In the following example, the key |{subequations}| is fixed by the command +% |\WithArrowsOptions|. Each environment |{DispWithArrows}| will subnumerated +% (in the scope of the |\WithArrowsOptions|) +% \begin{Verbatim} +% ~emphase#\WithArrowsOptions{subequations}@ +% First environment. +% \begin{DispWithArrows} +% A & = B \\ +% & = C +% \end{DispWithArrows} +% Second environment. +% \begin{DispWithArrows} +% D & = E \\ +% & = F +% \end{DispWithArrows} +% \end{Verbatim} +% % +% \begin{scope} +% \WithArrowsOptions{subequations} +% First environment. +% \begin{DispWithArrows} +% A & = B \\ +% & = C +% \end{DispWithArrows} +% Second environment. +% \begin{DispWithArrows} +% D & = E \\ +% & = F +% \end{DispWithArrows} +% \end{scope} +% % \bigskip % If there is not enough space to put the tag at the end of a line, there is no % automatic positioning of the label on the next line (as in the environments of @@ -1591,9 +1636,84 @@ version 2005/12/01 or later. % It is not compatible with \pkg{showkeys} (not all the labels are shown). % % -% \section{Advanced features} % % +% \subsection{The option <...> of DispWithArrows} +% +% The environment |{DispWithArrows}| provides an option |left-brace|. When present, +% the value of this option is composed on the left, followed by a curly brace +% (hence the name) and the body of the environment.\footnote{The option +% |left-brace| can also be used without value: in this case, only the brace is drawn...} +% +% For lisibility, this option |left-brace| is also available with a special +% syntax: it's possible to give this option between angle brackets +% (\verb|<| and \verb|>|) just after \verb|{DispWithArrows}| (before the optional +% arguments between square brackets). +% +% \bigskip +% The following code is an example of multi-case equations.\footnote{The +% environment |{cases}| of \pkg{amsmath} is a way to compose such multi-cases +% equations. However, it's not possible to use the automatic numbering of +% equations with this environment. The environment |{numcases}| of the extension +% \pkg{cases} (written by Donald Arseneau) provides this possibility but, of +% course, it's not possible to draw arrows with this extension.} +% +% \medskip +% +% \begin{BVerbatim} +% \begin{DispWithArrows}~emphase#< \binom{n}{p} = >@[format = ll,fleqn,displaystyle] +% 0 & \quad \text{if } p > n +% \Arrow{if fact, it's a special case\\ of the following one} \\ +% \frac{n(n-1)\cdots(n-p+1)}{p!} & \quad \text{if } 0 \leq p \leq n \\ +% 0 & \quad \text{if } p < 0 +% \end{DispWithArrows} +% \end{BVerbatim} +% % +% \begin{DispWithArrows}< \binom{n}{p} = >[format = ll,fleqn,displaystyle] +% 0 & \quad \text{if } p > n +% \Arrow{if fact, it's a special case\\ of the following one} \\ +% \frac{n(n-1)\cdots(n-p+1)}{p!} & \quad \text{if } 0 \leq p \leq n \\ +% 0 & \quad \text{if } p < 0 +% \end{DispWithArrows} +% +% \interitem +% It's possible to use the environment |{subequations}| of \pkg{amsmath}. +% +% \begin{Verbatim} +% \begin{subequations} +% \label{system} +% \begin{DispWithArrows}< (\ref*{system}) \Leftrightarrow >[format = l] +% x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ +% xy+xz+yz=-2 \\ +% xyz = -15 \label{last-equation} +% \end{DispWithArrows} +% \end{subequations} +% \end{Verbatim} +% % +% \begin{subequations} +% \label{system} +% \begin{DispWithArrows}< (\ref*{system}) \Leftrightarrow >[format = l] +% x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ +% xy+xz+yz=-2 \\ +% xyz = -15 \label{last-equation} +% \end{DispWithArrows} +% \end{subequations} +% +% \bigskip +% The whole system is the equation \eqref{system} (this reference has been coded +% by |\eqref{system}|) whereas the last equation is the equation +% \eqref{last-equation} (this reference has been coded by +% |\eqref{last-equation}|). The command |\ref*| used in the code above is +% provided by \pkg{hyperref}. It's a variant of |\ref| which doesn't create +% interactive link. +% +% \bigskip +% With the option \verb|replace-curly-brace-by|, it's possible to replace the +% left curly brace can be replaced by another extensible delimiter. +% +% \bigskip +% \section{Advanced features} +% % \subsection{The option tikz-code : how to change the shape of the arrows} % % \label{tikz-code} @@ -1869,9 +1989,12 @@ version 2005/12/01 or later. % % \subsection{\textbackslash MoveEqLeft} % -% It's possible to use |\MoveEqLeft| of \pkg{mathtools} (if we don't want -% ampersand on the first line): -% % +% It's possible to use |\MoveEqLeft| of \pkg{mathtools}. Don't forget that +% |\MoveEqLeft| has also the value of an ampersand (|&|). That's important for the +% placement of an eventual command |\Arrow|. +% +% +% % \begin{Verbatim}[formatcom=\small\color{gray}] % $\begin{WithArrows}[interline=0.5ex] % ~emphase#\MoveEqLeft@ \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} @@ -2262,6 +2385,11 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_msg_new:nnn { \msg_new:nnnn { witharrows } } \cs_new_protected:Npn \@@_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } +\cs_new_protected:Npn \@@_error:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \@@_warning:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \@@_fatal:n { \msg_fatal:nn { witharrows } } +\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { witharrows } } +\cs_generate_variant:Nn \@@_error:nn { n x } % \end{macrocode} % % \medskip @@ -2272,7 +2400,7 @@ version 2005/12/01 or later. footnote .bool_gset:N = \g_@@_footnote_bool , footnotehyper .bool_gset:N = \g_@@_footnotehyper_bool , unknown .code:n = - \msg_fatal:nn { witharrows } { Option~unknown~for~package } + \@@_fatal:n { Option~unknown~for~package } } % \end{macrocode} % @@ -2298,7 +2426,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { Option~incompatible~with~Beamer } { The~option~'\l_keys_key_tl'\ is~incompatible~ - with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. + with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. } % \end{macrocode} % @@ -2309,7 +2437,8 @@ version 2005/12/01 or later. footnotehyper~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnotehyper. + of~the~package~footnotehyper.\\ + If~you~go~on,~the~package~footnote~won't~be~loaded. } % \end{macrocode} % @@ -2320,7 +2449,8 @@ version 2005/12/01 or later. footnote~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~ within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnote. + of~the~package~footnote.\\ + If~you~go~on,~the~package~footnotehyper~won't~be~loaded. } % \end{macrocode} % @@ -2329,12 +2459,12 @@ version 2005/12/01 or later. \bool_if:NT \g_@@_footnote_bool { \@ifclassloaded { beamer } - { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } - { } - \@ifpackageloaded { footnotehyper } - { \msg_fatal:nn { witharrows } { footnote~with~footnotehyper~package } } - { } - \usepackage { footnote } + { \msg_info:nn { witharrows } { Option~incompatible~with~Beamer } } + { + \@ifpackageloaded { footnotehyper } + { \@@_error:n { footnote~with~footnotehyper~package } } + { \usepackage { footnote } } + } } % \end{macrocode} % @@ -2342,12 +2472,12 @@ version 2005/12/01 or later. \bool_if:NT \g_@@_footnotehyper_bool { \@ifclassloaded { beamer } - { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } - { } - \@ifpackageloaded { footnote } - { \msg_fatal:nn { witharrows } { footnotehyper~with~footnote~package } } - { } - \usepackage { footnotehyper } + { \@@_info:n { Option~incompatible~with~Beamer } } + { + \@ifpackageloaded { footnote } + { \@@_error:n { footnotehyper~with~footnote~package } } + { \usepackage { footnotehyper } } + } \bool_gset_true:N \g_@@_footnote_bool } % \end{macrocode} @@ -2380,11 +2510,6 @@ version 2005/12/01 or later. % \bigskip % \subsection{Some technical definitions} % -% \begin{macrocode} -\cs_new_protected:Npn \@@_error:n { \msg_error:nn { witharrows } } -\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { witharrows } } -\cs_generate_variant:Nn \@@_error:nn { n x } -% \end{macrocode} % % \begin{macrocode} \cs_generate_variant:Nn \tl_put_right:Nn { N v } @@ -2403,7 +2528,7 @@ version 2005/12/01 or later. \clist_map_inline:nn { amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels, - typedref, varwidth + typedref, unicode-math, varwidth } { \bool_new:c { c_@@_#1_loaded_bool } @@ -2449,6 +2574,25 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% The following command converts each item of a sequence from |tl| to |str|. It +% will be used when creating list of keys (a key name is always a |str|). +% \begin{macrocode} +\cs_new_protected:Npn \@@_convert_to_str_seq:N #1 + { + \seq_clear:N \l_tmpa_seq + \seq_map_inline:Nn #1 + { + \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } } + } + \seq_set_eq:NN #1 \l_tmpa_seq + } +\cs_new_protected:Npn \@@_set_seq_of_str_from_clist:Nn #1 #2 + { + \seq_set_from_clist:Nn #1 { #2 } + \@@_convert_to_str_seq:N #1 + } +% \end{macrocode} % % \bigskip % The command |\@@_save:N| saves a \pkg{expl3} variable by creating a global @@ -2574,6 +2718,21 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The option |subequations| is an option which uses the environment +% |{subequations}| of \pkg{amsmath}. That's why, if \pkg{amsmath} is loaded, we +% add the key |subequations| to the list of the keys available in +% |\WithArrowsOptions| and |{DispWithArrows}|. +% \begin{macrocode} +\AtBeginDocument + { + \bool_if:NTF \c_@@_amsmath_loaded_bool + { + \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { subequations } + \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { subequations } + } +% \end{macrocode} +% +% \bigskip % In order to increase the interline in the environments |{WithArrows}|, % |{DispWithArrows}|, etc., we will use the command |\spread@equation| of % \pkg{amsmath}. When used, this command becomes no-op (in the current TeX @@ -2585,11 +2744,8 @@ version 2005/12/01 or later. % \pkg{amsmath} is not loaded (we put the code in a |\AtBeginDocument| because % the flag |\c_@@_amsmath_loaded_bool| is itself set in a |\AtBeginDocument|). % \begin{macrocode} -\AtBeginDocument - { - \bool_if:NF \c_@@_amsmath_loaded_bool { - \cs_set_protected:Npn \spread@equation + \cs_new_protected:Npn \spread@equation { \openup \jot \cs_set_eq:NN \spread@equation \prg_do_nothing: @@ -2599,12 +2755,9 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% For the construction of the preambles of the environments |{WithArrows}| and -% |{DispWithArrows}|, we will have to insert the token |#| (catcode 6). We put it -% in a \emph{toks register} of TeX (with no equivalent in \pkg{expl3}). % \begin{macrocode} -\newtoks \@@_parameter_token -\@@_parameter_token = { # } +\tl_new:N \l_@@_left_brace_tl +\tl_set_eq:NN \l_@@_left_brace_tl \c_novalue_tl % \end{macrocode} % % \bigskip @@ -2679,6 +2832,7 @@ version 2005/12/01 or later. % \item |\g_@@_col_int| to count the column of the |\halign|. % \end{itemize} % +% % These counters will be incremented in a cell of the |\halign| and, therefore, % the incrementation must be global. However, we want to be able to include a % |{WithArrows}| in another |{WithArrows}|. To do so, we must restore the @@ -2769,8 +2923,7 @@ version 2005/12/01 or later. \bool_new:N \l_@@_final_r_bool \tl_new:N \l_@@_initial_tl \tl_new:N \l_@@_final_tl -\int_new:N \l_@@_nb_of_columns_int -\bool_new:N \l_@@_last_col_bool +\int_new:N \l_@@_nb_cols_int % \end{macrocode} % % \bigskip @@ -2782,7 +2935,12 @@ version 2005/12/01 or later. \str_new:N \l_@@_format_str % \end{macrocode} % -% +% \bigskip +% The option boolean corresponds to the option |subequations|. +% \begin{macrocode} +\bool_new:N \l_@@_subequations_bool +% \end{macrocode} +% % \bigskip % \subsection{The definition of the options} % @@ -2904,11 +3062,7 @@ version 2005/12/01 or later. end-adjust .dim_set:N = \l_@@_end_adjust_dim , end-adjust .value_required:n = true , end-adjust .initial:n = 0.4 ex , - adjust .code:n = - \dim_zero_new:N \l_@@_start_adjust_dim - \dim_set:Nn \l_@@_start_adjust_dim { #1 } - \dim_zero_new:N \l_@@_end_adjust_dim - \dim_set:Nn \l_@@_end_adjust_dim { #1 } , + adjust .meta:n = { start-adjust = #1 , end-adjust = #1 } , adjust .value_required:n = true , % \end{macrocode} % @@ -2916,7 +3070,7 @@ version 2005/12/01 or later. % With the option |no-arrows|, the arrows won't be drawn. However, the ``first % pass'' of the arrows is done and some errors may be detected. The % nullification of |\@@_draw_arrows:nn| is for the standard arrows and the -% nullification of |\@@_draw_arrow:nnn| is for ``Arrow in code-after''. +% nullification of |\@@_draw_arrow:nnn| is for ``Arrow in |code-after|''. % \begin{macrocode} no-arrows .code:n = \cs_set_eq:NN \@@_draw_arrows:nn \use_none:nn @@ -2942,6 +3096,26 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The following list of the (left) extensible delimiters of LaTeX is only for +% the validation of the key |replace-left-brace-by|. +% \begin{macrocode} +\clist_new:N \c_@@_extensible_delimiters_clist +\clist_set:Nn \c_@@_extensible_delimiters_clist + { + \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor + } +\AtBeginDocument + { + \bool_if:nT + { \c_@@_amsmath_loaded_bool || \use:c { c_@@_unicode-math_loaded_bool } } + { + \clist_put_right:Nn \c_@@_extensible_delimiters_clist { \lvert, \lVert } + } + } +% \end{macrocode} +% +% +% \bigskip % Now a set of keys specific to the environments |{DispWithArrows}| and % |{DispWithArrows*}| (and not |{WithArrows}|). Despite its name, this set of % keys will also be used in |\WithArrowsOptions|. @@ -2958,6 +3132,23 @@ version 2005/12/01 or later. { \clist_clear:N \l_@@_tags_clist } { \clist_set:Nn \l_@@_tags_clist { all } } , notag .default:n = true , +% \end{macrocode} +% Since the option |subequations| is an option which insert the environment +% |{DispWithArrows}| in an environment |{subequations}| of \pkg{amsmath}, we +% must test whether the package \pkg{amsmath} is loaded. +% \begin{macrocode} + subequations .code:n = + \bool_if:NTF \c_@@_amsmath_loaded_bool + { \bool_set_true:N \l_@@_subequations_bool } + { + \@@_error:n { amsmath~not~loaded } + \group_begin: + \globaldefs = 1 + \@@_msg_redirect_name:nn { amsmath~not~loaded } { info } + \group_end: + } , + subequations .default:n = true , + subequations .value_forbidden:n = true , nonumber .meta:n = notag , allow-multiple-labels .code:n = \@@_msg_redirect_name:nn { Multiple~labels } { none } , @@ -2972,6 +3163,15 @@ version 2005/12/01 or later. \clist_put_left:Nn \l_@@_tags_clist \c_one_int } , tagged-lines .value_required:n = true , + replace-left-brace-by .code:n = + { + \clist_if_in:NnTF + \c_@@_extensible_delimiters_clist + { #1 } + { \tl_set:Nn \l_@@_replace_left_brace_by_tl { #1 } } + { \@@_error:n { Bad~value~for~replace~brace~by } } + } , + replace-left-brace-by .initial:n = \lbrace , % \end{macrocode} % % Since the version 1.16 of \pkg{witharrows}, no vertical space is added between @@ -2985,6 +3185,7 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \bigskip % Now a set of keys which will be used in all the environments (but not in % |\WithArrowsOptions}|). @@ -2993,10 +3194,15 @@ version 2005/12/01 or later. \keys_define:nn { WithArrows / Env } { name .code:n = - \seq_if_in:NnTF \g_@@_names_seq { #1 } +% \end{macrocode} +% First, we convert the value in a |str| because the list of the names will be a +% list of |str|. +% \begin{macrocode} + \str_set:Nn \l_tmpa_str { #1 } + \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str { \@@_error:n { Duplicate~name } } - { \seq_gput_left:Nn \g_@@_names_seq { #1 } } - \str_set:Nn \l_@@_name_str { #1 } , + { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str } + \str_set_eq:NN \l_@@_name_str \l_tmpa_str , name .value_required:n = true , code-before .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } , code-before .value_required:n = true, @@ -3004,34 +3210,21 @@ version 2005/12/01 or later. code-after .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } , code-after .value_required:n = true , CodeAfter .meta:n = { code-after = #1 } , - format .code:n = \@@_set_option_format:n { #1 }, + format .code:n = + \tl_if_empty:nTF { #1 } + { \@@_error:n { Invalid~option~format } } + { + \regex_match:nnTF { \A[rcl]*\Z } { #1 } + { \tl_set:Nn \l_@@_format_str { #1 } } + { \@@_error:n { Invalid~option~format } } + } , format .value_required:n = true , } % \end{macrocode} % -% \medskip -% An option |format| should contain only the letters |r|, |c| and |l|. That's -% why we write a function to validate and set the value given to |format|. -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_option_format:n #1 - { - \bool_set_true:N \l_tmpa_bool - \str_map_inline:nn { #1 } - { - \str_if_in:nnF {rcl} { ##1 } - { - \bool_set_false:N \l_tmpa_bool - \@@_error:n { Invalid~option~format } - \str_map_break: - } - } - \bool_if:NT \l_tmpa_bool { \tl_set:Nn \l_@@_format_str { #1 } } - } -% \end{macrocode} -% % % \bigskip -% Now, we begin the construction of the major sets of keys which are named +% Now, we begin the construction of the major sets of keys, named % ``|WithArrows / WithArrows|'', ``|WithArrows / DispWithArrows|'' and % ``|WithArrows / WithArrowsOptions|''. Each of these sets of keys will be % completed after. @@ -3061,17 +3254,23 @@ version 2005/12/01 or later. % % % \bigskip -% A sequence of the options available in |{WithArrows}|. This sequence will be -% used in the error messages and can be modified dynamically. +% A sequence of |str| for the options available in |{WithArrows}|. This sequence +% will be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_WithArrows_seq -\seq_set_from_clist:Nn \l_@@_options_WithArrows_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_WithArrows_seq { - adjust, b, c, code-after, code-before, command-name, displaystyle, end-adjust, - format, group, groups, i, interline, jot, ll, lr, more-columns, name, - no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz, - tikz-code, xoffset, ygap, ystart + adjust, b, c, code-after, code-before, command-name, + displaystyle, end-adjust, + format, group, groups, i, + interline, jot, ll, + lr, more-columns, name, + no-arrows, rl, rr, + show-node-names, show-nodes, start-adjust, + t, tikz, tikz-code, + xoffset, ygap, ystart } +\@@_convert_to_str_seq:N \l_@@_options_WithArrows_seq % \end{macrocode} % % \medskip @@ -3088,6 +3287,7 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { WithArrows / DispWithArrows } { + left-brace .tl_set:N = \l_@@_left_brace_tl , unknown .code:n = \@@_sort_seq:N \l_@@_options_DispWithArrows_seq \@@_error:n { Unknown~option~DispWithArrows } @@ -3099,13 +3299,13 @@ version 2005/12/01 or later. % be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_DispWithArrows_seq -\seq_set_from_clist:Nn \l_@@_options_DispWithArrows_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_DispWithArrows_seq { allow-multiple-labels, code-after, code-before, command-name, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot, - ll, lr, mathindent, name, no-arrows, nonumber, notag, rl, rr, - show-node-names, show-nodes, start-adjust, tagged-lines, tikz, wrap-lines, - xoffset, ygap, ystart + left-brace, ll, lr, mathindent, name, no-arrows, nonumber, notag, + replace-left-brace-by, rl, rr, show-node-names, show-nodes, start-adjust, + tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart } % \end{macrocode} % @@ -3128,7 +3328,7 @@ version 2005/12/01 or later. % will be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_WithArrowsOptions_seq -\seq_set_from_clist:Nn \l_@@_options_WithArrowsOptions_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_WithArrowsOptions_seq { allow-duplicate-names, allow-multiple-labels, b, c, command-name, more-columns, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, @@ -3151,7 +3351,7 @@ version 2005/12/01 or later. { \str_set_eq:NN \l_@@_previous_key_str \l_keys_key_tl \str_set:Nn \l_@@_status_arrow_str { independent } - \str_if_eq:VnF \l_keys_value_tl { NoValue } + \str_if_eq:VnF \l_keys_value_tl { NoValue } { \@@_error:n { Value~for~a~key } } } { \@@_error:n { Incompatible~options~in~Arrow } } @@ -3219,6 +3419,12 @@ version 2005/12/01 or later. adjust .value_required:n = true , unknown .code:n = \@@_sort_seq:N \l_@@_options_Arrow_seq + \seq_if_in:NVTF \l_@@_options_WithArrows_seq \l_keys_key_tl + { + \str_set:Nn \l_tmpa_str + { ~However,~this~key~can~be~used~in~the~options~of~\{WithArrows\}. } + } + { \str_clear:N \l_tmpa_str } \@@_error:n { Unknown~option~in~Arrow } } % \end{macrocode} @@ -3229,7 +3435,7 @@ version 2005/12/01 or later. % the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_Arrow_seq -\seq_set_from_clist:Nn \l_@@_options_Arrow_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_Arrow_seq { adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code, xoffset @@ -3485,6 +3691,23 @@ version 2005/12/01 or later. \seq_gput_right:NV \g_@@_col_int_seq \g_@@_col_int \int_gzero:N \g_@@_col_int % \end{macrocode} +% +% In the preamble of the |\halign|, there will be \emph{two} counters of the +% columns. The aim of this programmation is to detect the utilisation of a +% command |\omit| in a cell of the |\halign| (it should be forbidden). +% For example, in the part of the preamble concerning the third column (if there +% is a third column in the environment), we will have the following instructions : +% \begin{Verbatim} +% \int_gincr:N \g_~@~@_col_int +% \int_gset:Nn \g_~@~@_static_col_int 3 +% \end{Verbatim} +% The counter |\g_@@_col_int| is incremented dynamically and the second is +% static. If the user has used a command |\omit|, the dynamic incrementation is +% not done in the cell and, at this end of the row, the difference between the +% counters may infer the presence of |\omit| at least once. +% \begin{macrocode} + \int_gzero_new:N \g_@@_static_col_int +% \end{macrocode} % % \bigskip % We also have to update the position on the nesting tree. @@ -3537,12 +3760,6 @@ version 2005/12/01 or later. \str_set:Nn \l_@@_format_str { rl } % \end{macrocode} % -% \bigskip -% The boolean |\l_@@_last_col_bool| will be used only during the construction of -% the preamble (in |\@@_construct_halign:|). -% \begin{macrocode} - \bool_set_true:N \l_@@_last_col_bool -% \end{macrocode} % % % \bigskip @@ -3599,17 +3816,33 @@ version 2005/12/01 or later. % command |\@@_Arrow:|. % % \medskip -% The counter |\l_@@_nb_of_columns_int| is the number of columns in the +% The counter |\l_@@_nb_cols_int| is the number of columns in the % |\halign| (excepted the column for the labels of equations in -% |{DispWithArrows}| and excepted evenutals other columns in |{WithArrows}| if -% the user uses the option |more-columns|). +% |{DispWithArrows}| and excepted eventuals other columns in |{WithArrows}| allowed +% by the option |more-columns|). % \begin{macrocode} - \int_set:Nn \l_@@_nb_of_columns_int { \str_count:N \l_@@_format_str } + \int_set:Nn \l_@@_nb_cols_int { \str_count:N \l_@@_format_str } % \end{macrocode} +% +% \medskip +% Be careful! The following counter |\g_@@_col_int| will be used for two usages: +% \begin{itemize} +% \item during, the construction of the preamble of the |\halign|, it will be +% used as counter for the number of the column under construction in the +% preamble (since the preamble is constructed backwards, |\g_@@_col_int| will go +% decreasing from |\l_@@_nb_cols_int| to $1$) ; +% \item once the preamble constructed, the primitive |\halign| is executed, and, +% in each row of the |\halign|, the counter |\g_@@_col_int| will be increased +% from column to column. +% \end{itemize} % +% \begin{macrocode} + \int_gset_eq:NN \g_@@_col_int \l_@@_nb_cols_int +% \end{macrocode} +% % \medskip -% We convert the format in a sequence because we use it as a stack in the -% construction of the preamble. +% We convert the format in a sequence because we use it as a stack (with the top +% of the stack at the end of the sequence) in the construction of the preamble. % \begin{macrocode} \seq_clear_new:N \l_@@_format_seq \seq_set_split:NnV \l_@@_format_seq { } \l_@@_format_str @@ -3645,7 +3878,7 @@ version 2005/12/01 or later. % % \begin{macrocode} \cs_set_eq:NN \notag \@@_notag: - \cs_set_eq:NN \nonumber \@@_notag: + \cs_set_eq:NN \nonumber \@@_nonumber: \cs_set_eq:NN \tag \@@_tag \cs_set_eq:NN \@@_old_label \label \cs_set_eq:NN \label \@@_label:n @@ -3662,8 +3895,8 @@ version 2005/12/01 or later. % the last column (more precisely: except the part concerning the construction % of the left node and the right node). % -% The same function |\@@_construct_halign:| will be used both for |{WithArrows}| -% and |{DispWithArrows}|. +% The same function |\@@_construct_halign:| will be used both for the +% environment |{WithArrows}| and the environment |{DispWithArrows}|. % % Several important points must be noted concerning that construction of the % preamble. @@ -3678,6 +3911,9 @@ version 2005/12/01 or later. % expansion of the preamble gives the ability of controlling which parts of the % code will be expanded during the construction of the preamble (other parts % will be expanded and executed only during the execution of the |\halign|). +% \item The counter |\g_@@_col_int| is used during the loop of the construction +% of the preamble but, it will also appears in the preamble (we could have +% chosen two differents counters but this way saves a counter). % \end{itemize} % % \begin{macrocode} @@ -3693,17 +3929,17 @@ version 2005/12/01 or later. \use:x { % \end{macrocode} -% Before the recursive call of |\@@_construct_halign:|, -% we lower the flag |\l_@@_last_col_bool| in order that all the recursive calls -% will know that they are not in the last column. But, during the construction -% of the first column, it is \emph{not} lowered because |\bool_set_false:N|, -% which is protected, won't be expanded by the |\use:x|. +% Before the recursive call of |\@@_construct_halign:|, we decrease the integer +% |\g_@@_col_bool|. But, during the construction of the column which is +% constructed first (that is to say which is the last column of the |\halign|), +% it is \emph{not} lowered because |\int_decr:N|, which is protected, won't be +% expanded by the |\use:x|. % % We begin the construction of a generic column. % \begin{macrocode} - \bool_set_false:N \l_@@_last_col_bool + \int_gdecr:N \g_@@_col_int \@@_construct_halign: - \bool_if:NT \l_@@_last_col_bool + \int_compare:nNnT \g_@@_col_int = \l_@@_nb_cols_int { % \end{macrocode} % We redefine the command |\Arrow| (or the name given to the corresponding @@ -3732,19 +3968,20 @@ version 2005/12/01 or later. \str_if_eq:VnT \l_@@_type_col_str { c } \hfil \str_if_eq:VnT \l_@@_type_col_str { r } \hfill \int_gincr:N \g_@@_col_int - $ % $ + \int_gset:Nn \g_@@_static_col_int { \int_use:N \g_@@_col_int } + \c_math_toggle_token { { } \bool_if:NT \l_@@_displaystyle_bool \displaystyle #### } - $ % $ - \bool_if:NTF \l_@@_last_col_bool + \c_math_toggle_token + \int_compare:nNnTF \g_@@_col_int = \l_@@_nb_cols_int { \@@_construct_nodes: } { % \end{macrocode} % The following glue (|\hfil|) will be added only if we are not in the last cell -% because, in the last cell, a glue is added beetween the nodes (in +% because, in the last cell, a glue (=skip) is added between the nodes (in % |\@@_construct_nodes:|). % \begin{macrocode} \str_if_eq:VnT \l_@@_type_col_str { l } \hfil @@ -3765,14 +4002,18 @@ version 2005/12/01 or later. \bgroup } { - \halign to - \bool_if:NTF \l_@@_inlabel_bool \linewidth \displaywidth + \halign to \l_@@_linewidth_dim \bgroup \bool_if:NT \l_@@_fleqn_bool { \skip_horizontal:N \l_@@_mathindent_dim } } \int_gincr:N \g_@@_line_int \int_gzero:N \g_@@_col_int + \tl_if_eq:NNF \l_@@_left_brace_tl \c_novalue_tl + { + \skip_horizontal:n + { \box_wd:N \l_@@_left_brace_box + \l_@@_delim_wd_dim } + } \strut } } @@ -3781,8 +4022,8 @@ version 2005/12/01 or later. % % \bigskip % The command |\@@_construct_nodes:| is only for the lisibility of the code -% because, in fact, it is used only once. It construct the ``left node'' and the -% ``right node'' at the end of each row of the arrow. +% because, in fact, it is used only once. It constructs the ``left node'' and +% the ``right node'' at the end of each row of the arrow. % \begin{macrocode} \cs_new_protected:Npn \@@_construct_nodes: { @@ -3838,7 +4079,6 @@ version 2005/12/01 or later. % \bigskip % \subsubsection{The environment \{WithArrows\}} % -% % % \begin{macrocode} \NewDocumentEnvironment { WithArrows } { ! O { } } @@ -3864,7 +4104,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% We begin the |\halign| and the preamble. +% We begin the |\halign| and the preamble. During the construction of the +% preamble, |\l_tmpa_int| will be incremented during each column constructed. % \begin{macrocode} \@@_construct_halign: % \end{macrocode} @@ -3881,10 +4122,10 @@ version 2005/12/01 or later. % \begin{macrocode} && \@@_error:n { Too~much~columns~in~WithArrows } - $ + \c_math_toggle_token \bool_if:NT \l_@@_displaystyle_bool \displaystyle { ## } - $ + \c_math_toggle_token \cr } % \end{macrocode} @@ -4012,7 +4253,13 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_cr: { \scan_stop: - \prg_replicate:nn { \l_@@_nb_of_columns_int - \g_@@_col_int } { & { } } +% \end{macrocode} +% We try to detect some |\omit| (as of now, an |\omit| in the last column is +% not detected). +% \begin{macrocode} + \int_compare:nNnF \g_@@_col_int = \g_@@_static_col_int + { \@@_error:n { omit~probably~used } } + \prg_replicate:nn { \l_@@_nb_cols_int - \g_@@_static_col_int } { & { } } \group_align_safe_begin: \peek_meaning_remove:NTF * \@@_cr_i: \@@_cr_i: } @@ -4027,15 +4274,36 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% Now, we test if the next token is the token |\end|. Indeed, we want to test if +% the following tokens are |\end{WithArrows}| (or |\end{DispWithArrows}|, etc). +% In this case, we raise an error because the user must not put "\\" at the end +% of its alignment. % \begin{macrocode} \cs_new_protected:Npn \@@_cr_ii: [ #1 ] { + \peek_meaning_ignore_spaces:NTF \end + { + \@@_cr_iii:n { #1 } +% \end{macrocode} +% The analyse of the argument of the token |\end| must be after the +% |\group_align_safe_end:| which is the beginning of |\@@_cr_iii:n|. +% \begin{macrocode} + \@@_analyze_end:Nn + } + { \@@_cr_iii:n { #1 } } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_cr_iii:n #1 + { \group_align_safe_end: % \end{macrocode} % For the environment |{DispWithArrows}|, the behaviour of |\\| is different -% because we add the third column which is the column for the tag (number of the -% equation). Even if there is no tag, the third column is used for the -% |v|-nodes. +% because we add the last column which is the column for the tag (number of the +% equation). Even if there is no tag, this column is used for the +% |v|-nodes.\footnote{The |v|-nodes are used to compute the abscissa of the +% right margin, used by the option |wrap-lines|.} % \begin{macrocode} \bool_if:NT \l_@@_in_DispWithArrows_bool % \end{macrocode} @@ -4172,12 +4440,39 @@ version 2005/12/01 or later. \coordinate ( \int_use:N \g_@@_line_int - v ) ; } } - \cr \noalign { \skip_vertical:n { #1 + \l_@@_interline_skip } \scan_stop: } + \dim_compare:nNnT { #1 } < \c_zero_dim + { \@@_error:n { option~of~cr~negative } } + \dim_set:Nn \l_tmpa_dim { \dim_max:nn { #1 } \c_zero_dim } + \cr + \noalign + { + \skip_vertical:n { \l_tmpa_dim + \l_@@_interline_skip } + \scan_stop: + } } % \end{macrocode} % According to the documentation of \pkg{expl3}, the previous addition in % ``|#1 + \l_@@_interline_skip|'' is really an addition of skips (=glues). % +% +% The following command will be used when, after a |\\| (and its optional +% arguments) there is a |\end|. You want to known if this is the end of the +% environment |{WithArrows}| (or |{DispWithArrows}|, etc.) because, in this +% case, we will explain that the environment must not be ended by |\\|. If it is +% not the case, that means it's a classical situation of LaTeX environments not +% correctly imbricated and there will be a LaTeX error. +% \begin{macrocode} +\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2 + { + \exp_args:NV \str_if_eq:nnT \l_@@_type_env_str { #2 } + { \@@_warning:n { newline~at~the~end~of~env } } +% \end{macrocode} +% We reput in the stream the |\end{...}| we have extracted. +% \begin{macrocode} + \end { #2 } + } +% \end{macrocode} +% % \bigskip % \subsubsection{The environment \{DispWithArrows\}} % @@ -4188,23 +4483,24 @@ version 2005/12/01 or later. % % The purpose of the |\vtop| is to have an environment unbreakable. % -% However, if we are juste after an item of a LaTeX list, the construction is -% slightly different: +% However, if we are juste after an item of a LaTeX list or at the beginning of +% a |{minipage}|, the construction is slightly different: % % |\[\vtop{\halign to \linewidth {...}}\]| % % % \bigskip -% The boolean |\l_@@_inlabel_bool| will be raised if we are just after a |\item| -% of a list of LaTeX. +% The boolean |\l_@@_in_label_or_minipage_bool| will be raised if we are just after a |\item| +% of a list of LaTeX or at the beginning of a |{minipage}|. % \begin{macrocode} -\bool_new:N \l_@@_inlabel_bool +\bool_new:N \l_@@_in_label_or_minipage_bool % \end{macrocode} % % % \begin{macrocode} -\NewDocumentEnvironment { DispWithArrows } { ! O { } } +\NewDocumentEnvironment { DispWithArrows } { ! d < > ! O { } } { + \bool_set_true:N \l_@@_in_DispWithArrows_bool % \end{macrocode} % If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we disable % the code of \pkg{mathtools} for the option |showonlyrefs| with the command @@ -4237,23 +4533,58 @@ version 2005/12/01 or later. % definition of |\intertext|. % \begin{macrocode} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ - \bool_set_true:N \l_@@_in_DispWithArrows_bool - \@@_pre_halign:n { #1 } + \IfValueT { #1 } { \tl_set:Nn \l_@@_left_brace_tl { #1 } } + \@@_pre_halign:n { #2 } % \end{macrocode} % +% If |subequations| is used, we encapsulate the environment in an +% environment |{subequations}| of \pkg{amsmath}. +% \begin{macrocode} + \bool_if:NT \l_@@_subequations_bool { \begin { subequations } } +% \end{macrocode} % Since the version 1.16 of \pkg{witharrows}, no space is added between an % |\item| of a LaTeX list and an environment |{DispWithArrows}| except with the % option |standard-behaviour-with-items| stored in the boolean % |\l_@@_sbwi_bool|. We have to know if we are just after an |\item| and this -% information will be stored in |\l_@@_inlabel_bool|. +% information will be stored in |\l_@@_in_label_or_minipage_bool|. % \begin{macrocode} \bool_if:NF \l_@@_sbwi_bool { \if@inlabel - \bool_set_true:N \l_@@_inlabel_bool + \bool_set_true:N \l_@@_in_label_or_minipage_bool + \fi + \if@minipage + \bool_set_true:N \l_@@_in_label_or_minipage_bool \fi } % \end{macrocode} +% +% +% \begin{macrocode} + \tl_if_eq:NNF \l_@@_left_brace_tl \c_novalue_tl + { + \hbox_set:Nn \l_tmpa_box + { + \c_math_toggle_token + \left \l_@@_replace_left_brace_by_tl \vcenter to 1 cm { } \right. + \c_math_toggle_token + } + \dim_zero_new:N \l_@@_delim_wd_dim + \dim_set:Nn \l_@@_delim_wd_dim { \box_wd:N \l_tmpa_box } + \box_clear_new:N \l_@@_left_brace_box + \hbox_set:Nn \l_@@_left_brace_box + { + \group_begin: + \cs_set_eq:NN \label \@@_old_label + \c_math_toggle_token + \bool_if:NT \l_@@_displaystyle_bool \displaystyle + \l_@@_left_brace_tl + { } + \c_math_toggle_token + \group_end: + } + } +% \end{macrocode} % % \bigskip % The token list |\l_@@_tag_tl| will contain the argument of the command |\tag|. @@ -4275,17 +4606,17 @@ version 2005/12/01 or later. % % \begin{macrocode} \if_mode_math: - \@@_error:n { DispWithArrows~in~math~mode } + \@@_fatal:n { DispWithArrows~in~math~mode } \fi: % \end{macrocode} % % \bigskip % The construction is not exactly the same whether we are just after an |\item| % of a LaTeX list or not. We know if we are after an |\item| thanks to the -% boolean |\l_@@_inlabel_bool|. +% boolean |\l_@@_in_label_or_minipage_bool|. % \begin{macrocode} - \bool_if:NTF \l_@@_inlabel_bool - { $ } % $ + \bool_if:NTF \l_@@_in_label_or_minipage_bool + { \c_math_toggle_token } { % \end{macrocode} % We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a @@ -4296,15 +4627,25 @@ version 2005/12/01 or later. \nointerlineskip \hbox_to_wd:nn { .6 \linewidth } { } \fi: - $$ + \c_math_toggle_token \c_math_toggle_token } % \end{macrocode} -% We use a |\vtop| in order to prevent page breaks in the environment. +% +% \begin{macrocode} + \dim_zero_new:N \l_@@_linewidth_dim + \bool_if:NTF \l_@@_in_label_or_minipage_bool + { \dim_set_eq:NN \l_@@_linewidth_dim \linewidth } + { \dim_set_eq:NN \l_@@_linewidth_dim \displaywidth } +% \end{macrocode} +% +% % \begin{macrocode} - \vtop \bgroup - \bool_if:NTF \l_@@_fleqn_bool - { \tabskip = \c_zero_skip } - { \tabskip = 0 pt plus 1000 pt minus 1000 pt } + \box_clear_new:N \l_@@_halign_box + \setbox \l_@@_halign_box \vtop \bgroup + \tabskip = + \bool_if:NTF \l_@@_fleqn_bool + \c_zero_skip + { 0 pt plus 1000 pt minus 1000 pt } % \end{macrocode} % % @@ -4314,7 +4655,7 @@ version 2005/12/01 or later. & % \end{macrocode} % -% If the user try to use more columns than the lenght of the format, we have to +% If the user tries to use more columns than the length of the format, we have to % raise an error. However, the error won't be in the next column which is the % columns for the labels of the equations. The error will be after... and it % must be after. That means that we must not have an error in the next column @@ -4324,7 +4665,7 @@ version 2005/12/01 or later. $ ## $ \tabskip = \c_zero_skip && - \@@_error:n { Too~much~columns~in~DispWithArrows } + \@@_fatal:n { Too~much~columns~in~DispWithArrows } \bool_if:nT \c_false_bool { ## } \cr } @@ -4341,13 +4682,54 @@ version 2005/12/01 or later. % The following |\egroup| is for the |\halign|. % \begin{macrocode} \egroup -% \end{macrocode} -% The following |\egroup| is for the |\vtop|. + \unskip \unpenalty \unskip \unpenalty + \box_set_to_last:N \l_tmpa_box + \nointerlineskip + \box_use:N \l_tmpa_box + \dim_gzero_new:N \g_@@_alignment_dim + \dim_gset:Nn \g_@@_alignment_dim { \box_wd:N \l_tmpa_box } + \box_clear_new:N \l_@@_new_box + \hbox_set:Nn \l_@@_new_box { \hbox_unpack_clear:N \l_tmpa_box } + \dim_compare:nNnT + { \box_wd:N \l_@@_new_box } < \g_@@_alignment_dim + { \dim_gset:Nn \g_@@_alignment_dim { \box_wd:N \l_@@_new_box } } +% \end{macrocode} +% The |\egroup| is for the box |\l_@@_halign_box|. % \begin{macrocode} - \egroup + \egroup % \end{macrocode} % -% +% \begin{macrocode} + \tl_if_eq:NNTF \l_@@_left_brace_tl \c_novalue_tl + { \box_use_drop:N \l_@@_halign_box } + { + \hbox_to_wd:nn \l_@@_linewidth_dim + { + \bool_if:NTF \l_@@_fleqn_bool + { \skip_horizontal:n \l_@@_mathindent_dim } + \hfil + \hbox_to_wd:nn \g_@@_alignment_dim + { + \box_use_drop:N \l_@@_left_brace_box + \dim_set:Nn \l_tmpa_dim + { + \box_ht:N \l_@@_halign_box + + \box_dp:N \l_@@_halign_box + } + \c_math_toggle_token + \left \l_@@_replace_left_brace_by_tl + \vcenter to \l_tmpa_dim { \vfil } + \right. + \c_math_toggle_token + \hfil + } + \hfil + } + \skip_horizontal:n { - \l_@@_linewidth_dim } + \vcenter { \box_use_drop:N \l_@@_halign_box } + } +% \end{macrocode} +% % We compute the dimension |\g_@@_right_x_dim|. As a first approximation, % |\g_@@_right_x_dim| is the $x$-value of the right side of the current % composition box. In fact, we must take into account the potential labels of @@ -4362,7 +4744,7 @@ version 2005/12/01 or later. { \cs_if_free:cTF { pgf@sh@ns@wa - \l_@@_prefix_str - \l_tmpa_int - v } - { \@@_error:n { Inexistent~v-node } } + { \@@_fatal:n { Inexistent~v-node } } { \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v ) \dim_set:Nn \l_tmpa_dim \pgf@x @@ -4373,6 +4755,7 @@ version 2005/12/01 or later. \end { tikzpicture } % \end{macrocode} % +% % \bigskip % The code in |\@@_post_halign:| is common to |{WithArrows}| and % |{DispWithArrows}|. @@ -4386,12 +4769,16 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:nT \c_@@_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: } - \bool_if:NTF \l_@@_inlabel_bool + \bool_if:NTF \l_@@_in_label_or_minipage_bool { - $ % $ + \c_math_toggle_token \skip_vertical:N \belowdisplayskip } - { $$ } + { \c_math_toggle_token \c_math_toggle_token } +% \end{macrocode} +% +% \begin{macrocode} + \bool_if:NT \l_@@_subequations_bool { \end { subequations } } % \end{macrocode} % % \bigskip @@ -4399,7 +4786,7 @@ version 2005/12/01 or later. % extract the footnotes with an environment |{savenotes}| (of the package % \pkg{footnote} or the package \pkg{footnotehyper}). % \begin{macrocode} - \bool_if:NT \g_@@_footnote_bool { \end {savenotes } } + \bool_if:NT \g_@@_footnote_bool { \end { savenotes } } \ignorespacesafterend } % \end{macrocode} @@ -4435,7 +4822,7 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_in_WithArrows_bool { \@@_error:nn { Not~allowed~in~WithArrows } { #1 } } { - \int_compare:nNnTF \g_@@_col_int < \l_@@_nb_of_columns_int + \int_compare:nNnTF \g_@@_col_int < \l_@@_nb_cols_int { \@@_error:nn { Not~allowed~in~DispWithArrows } { #1 } } { #2 } } @@ -4443,18 +4830,25 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The command |\@@_notag:| will be linked to |\notag| and |\nonumber| in the -% environments |{WithArrows}| and |{DispWithArrows}|. +% The command |\@@_notag:| will be linked to the command |\notag| and also to +% in the environments |{WithArrows}| and |{DispWithArrows}|. % \begin{macrocode} \cs_new_protected:Npn \@@_notag: { \@@_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l_@@_tags_clist } } % \end{macrocode} % -% % \bigskip -% The command |\@@_tag| will be linked to |\tag| in the environments -% |{WithArrows}| and |{DispWithArrows}|. We use |\NewDocumentCommand| because -% this command has a starred version. +% The command |\@@_nonumber:| will be linked to the command |\nonumber| and also to +% in the environments |{WithArrows}| and |{DispWithArrows}|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_nonumber: + { \@@_if_in_last_col_of_disp:Nn \nonumber { \clist_clear:N \l_@@_tags_clist } } +% \end{macrocode} +% +% \bigskip +% The command |\@@_tag| will be linked to |\tag| in |{WithArrows}| and +% |{DispWithArrows}|. We do the definition with |\NewDocumentCommand| because this +% command has a starred version. % \begin{macrocode} \NewDocumentCommand \@@_tag { s m } { @@ -4524,8 +4918,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The command |\@@_tagnextline:| will be linked to |\tagnextline| in the -% environments |{DispWithArrows}|. +% The command |\@@_tagnextline:| will be linked to |\tagnextline| in +% |{DispWithArrows}|. % \begin{macrocode} \cs_new_protected:Npn \@@_tagnextline: { @@ -4549,7 +4943,8 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_set_qedhere: { \cs_set_eq:NN \qedhere \@@_qedhere: } % \end{macrocode} % -% In the third column of the |\halign| of |{DispWithArrows}|, a command +% In the last column of the |\halign| of |{DispWithArrows}| (column of the +% labels, that is to say the numbers of the equations), a command % |\@@_qedhere_i:| will be issued if the flag |\l_@@_qedhere_bool| has been % raised. The code of this command is an adaptation of the code of |\qedhere| in % \pkg{amsthm}. @@ -4686,7 +5081,7 @@ version 2005/12/01 or later. \int_compare:nNnTF \l_@@_final_int > \g_@@_line_int { \int_compare:nNnF \l_@@_pos_arrow_int = 8 - { \_@@_error:n { Too~few~lines~for~an~arrow } } + { \@@_error:n { Too~few~lines~for~an~arrow } } } \@@_code_for_possible_arrow: % \end{macrocode} @@ -4703,7 +5098,7 @@ version 2005/12/01 or later. % arrows. If we are in option |group| and in the first step of treatment % (|\l_@@_pos_arrow_int| = 7), we don't draw because, in the first step, we % don't draw anything. If there is no arrow in the group, we don't draw (this -% situation occurs when all the arrows of the potential group arrives after the +% situation occurs when all the arrows of the potential group arrive after the % last line of the environment). % \begin{macrocode} \bool_if:nT @@ -4721,9 +5116,10 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_code_for_possible_arrow: { % \end{macrocode} -% We test if the previous arrow was in fact the last arrow of a group. In this -% case, we have to draw all the arrows of that group, except if we are with the -% option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = 7). +% We test whether the previous arrow was in fact the last arrow of a group. In +% this case, we have to draw all the arrows of that group, except if we are with +% the option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = +% 7). % \begin{macrocode} \bool_if:nT { @@ -4997,7 +5393,7 @@ version 2005/12/01 or later. % first line of the group and in |\l_@@_last_arrows_seq| the list of % all the arrows ending at the last line of the group. We compute these values % in the booleans |\l_tmpa_bool| and |\l_tmpb_bool|. These computations can't be -% done in the following |{tikzpicture}| because the command |\seq_if_in:NTF| +% done in the following |{tikzpicture}| because the command |\seq_if_in:NnTF| % which is \emph{not} expandable. % \begin{macrocode} \seq_if_in:NxTF \l_@@_first_arrows_seq @@ -5144,11 +5540,11 @@ version 2005/12/01 or later. \tikz@parse@node \pgfutil@firstofone ( @@_label.west ) % \end{macrocode} % We compute in |\l_tmpa_dim| the maximal width possible for the label. -% |0.3333 em| is the default value of |inner sep| in the nodes of Tikz. Maybe we -% should put the exact Tikz parameter. Here is the use of |\g_@@_right_x_dim| -% which has been computed previously with the |v|-nodes. +% Here is the use of |\g_@@_right_x_dim| which has been computed previously with +% the |v|-nodes. % \begin{macrocode} - \dim_set:Nn \l_tmpa_dim { \g_@@_right_x_dim - \pgf@x - 0.3333 em } + \dim_set:Nn \l_tmpa_dim + { \g_@@_right_x_dim - \pgf@x - \pgfkeysvalueof { / pgf / inner~xsep } } % \end{macrocode} % We retrieve in |\g_tmpa_tl| the current value of the Tikz parameter % ``|text width|''.\footnote{In fact, it's not the current value of @@ -5248,11 +5644,11 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% A sequence of the options available in |\Arrow| in |\code-after|. This sequence +% A sequence of the options available in |\Arrow| in |code-after|. This sequence % will be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_Arrow_code_after_seq -\seq_set_from_clist:Nn \l_@@_options_Arrow_code_after_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_Arrow_code_after_seq { ll, lr, rl, rr, tikz, tikz-code, v, x, offset } % \end{macrocode} % @@ -5268,7 +5664,8 @@ version 2005/12/01 or later. \bool_set_false:N \l_@@_initial_r_bool \bool_set_false:N \l_@@_final_r_bool \int_case:nn \l_@@_pos_arrow_int - { 0 + { + 0 { \bool_set_true:N \l_@@_initial_r_bool \bool_set_true:N \l_@@_final_r_bool @@ -5445,9 +5842,64 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { amsmath~not~loaded } + { + You~can't~use~the~option~'\l_keys_key_tl'~because~the~ + package~'amsmath'~has~not~been~loaded.\\ + If~you~go~on,~this~option~will~be~ignored~in~the~rest~ + of~the~document. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { Bad~value~for~replace~brace~by } + { + Bad~value~for~the~option~'\l_keys_key_tl'.~The~value~must~be~ + an~extensible~left~delimiter.~The~possible~values~are:~ + \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ + \token_to_str:N \lbrack,~\token_to_str:N \lgroup,~ + \token_to_str:N \langle,~\token_to_str:N \lmoustache,~ + \token_to_str:N \lfloor\ and~\token_to_str:N \lceil\ + (and~\token_to_str:N \lvert\ and~\token_to_str:N \lVert\ + if~amsmath~or~unicode-math~is~loaded).\\ + \c_@@_option_ignored_str + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { option~of~cr~negative } + { + The~argument~of~the~command~\token_to_str:N\\~ + should~be~positive~in~the~row~\int_use:N \g_@@_line_int\ + of~your~environment~\{\l_@@_type_env_str\}.\\ + \c_@@_option_ignored_str + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { omit~probably~used } + { + There~is~a~problem.~Maybe~you~have~used~a~command~ + \token_to_str:N\omit\ in~the~line~\int_use:N \g_@@_line_int\ + (or~another~line)~of~your~environment~\{\l_@@_type_env_str\}.\\ + You~can~go~on~but~you~may~have~others~errors. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { newline~at~the~end~of~env } + { + Your~environment~\{\l_@@_type_env_str\}~should~not~end~with~ + a~\token_to_str:N \\.\\ + This~warning~might~become~an~error~in~a~future~version. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Invalid~option~format } { - The~option~'format'~should~contain~only~letters~r,~c~and~l.\\ + The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ + must~not~be~empty.\\ \c_@@_option_ignored_str } % \end{macrocode} @@ -5463,10 +5915,10 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~in~Arrow } { - The~option~'\l_keys_key_tl'~ - is~unknown~for~the~command~\l_@@_string_Arrow_for_msg_str\ - in~the~row~\int_use:N \g_@@_line_int\ - of~your~environment~\{\l_@@_type_env_str\}. \\ + The~key~'\l_keys_key_tl'~is~unknown~for~the~command~ + \l_@@_string_Arrow_for_msg_str\ in~the~row~ + \int_use:N \g_@@_line_int\ of~your~environment~ + \{\l_@@_type_env_str\}. \l_tmpa_str \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5480,7 +5932,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~WithArrows } { - The~option~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ + The~key~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5493,7 +5945,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~DispWithArrows } { - The~option~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ + The~key~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5506,7 +5958,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~WithArrowsOptions } { - The~option~'\l_keys_key_tl'~is~unknown~in~ + The~key~'\l_keys_key_tl'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. @@ -5520,9 +5972,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~Arrow~in~code-after } { - The~option~'\l_keys_key_tl'~is~unknown~in~ - \token_to_str:N \Arrow\ - in~\token_to_str:N \code-after. \\ + The~key~'\l_keys_key_tl'~is~unknown~in~ + \token_to_str:N \Arrow\ in~code-after. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5537,7 +5988,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { Too~much~columns~in~WithArrows } { Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N - \l_@@_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~ + \l_@@_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ If~you~really~want~to~use~more~columns~(after~the~arrows)~you~should~use~ the~option~'more-columns'~at~a~global~level~or~for~an~environment. \\ @@ -5549,10 +6000,10 @@ version 2005/12/01 or later. \@@_msg_new:nn { Too~much~columns~in~DispWithArrows } { Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N - \l_@@_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~ + \l_@@_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ at~the~end~of~row~\int_use:N \g_@@_line_int. \\ - If~you~go~on,~you~may~have~other~errors. + This~error~is~fatal. } % \end{macrocode} % @@ -5583,7 +6034,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Too~few~lines~for~an~arrow } - { Line~\l_@@_input_line_str\ + { + Line~\l_@@_input_line_str\ :~an~arrow~specified~in~the~row~\int_use:N \l_@@_initial_int\ of~your~environment~\{\l_@@_type_env_str\}~can't~be~drawn~ because~it~arrives~after~the~last~row~of~the~environment. \\ @@ -5605,7 +6057,7 @@ version 2005/12/01 or later. { The~environment~\{\l_@@_type_env_str\}~should~be~used~only~outside~math~ mode~like~the~environment~\{align\}~of~amsmath. \\ - If~you~go~on,~you~will~have~other~errors. + This~error~is~fatal. } % \end{macrocode} % @@ -5639,7 +6091,8 @@ version 2005/12/01 or later. \@@_msg_new:nn { Arrow~not~in~last~column } { You~should~use~the~command~\l_@@_string_Arrow_for_msg_str\ - only~in~the~last~column~of~your~environment~\{\l_@@_type_env_str\}.\\ + only~in~the~last~column~(column~\int_use:N\l_@@_nb_cols_int)~ + of~your~environment~\{\l_@@_type_env_str\}.\\ However~you~can~go~on~for~this~time. } % \end{macrocode} @@ -5694,7 +6147,8 @@ version 2005/12/01 or later. \@@_msg_new:nn { Not~allowed~in~DispWithArrows } { The~command~\token_to_str:N #1 - is~allowed~only~in~the~last~columnm~of~\{\l_@@_type_env_str\}. \\ + is~allowed~only~in~the~last~column~ + (column~\int_use:N\l_@@_nb_cols_int)~of~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str } % \end{macrocode} @@ -5746,9 +6200,9 @@ version 2005/12/01 or later. { There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ instead~of~a~command~\token_to_str:N\\~at~the~end~of~ - the~row~\int_use:N \l_tmpa_int\ + the~row~\l_tmpa_int\ of~your~environment~\{\l_@@_type_env_str\}. \\ - If~you~go~on,~you~may~have~an~incorrect~output. + This~error~is~fatal. } % \end{macrocode} % @@ -5765,6 +6219,22 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \begin{macrocode} +\@@_msg_new:nnn { Duplicate~name } + { + The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ + the~same~environment~name~twice.~You~can~go~on,~but,~ + maybe,~you~will~have~incorrect~results. \\ + For~a~list~of~the~names~already~used,~type~H~<return>. \\ + If~you~don't~want~to~see~this~message~again,~use~the~option~ + 'allow-duplicate-names'. + } + { + The~names~already~defined~in~this~document~are:~ + \seq_use:Nnnn \g_@@_names_seq { ,~ } { ,~ } { ~and~ }. + } +% \end{macrocode} +% % % % \subsection{The command \textbackslash WithArrowsNewStyle} @@ -5782,9 +6252,11 @@ version 2005/12/01 or later. #1 .code:n = { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } } } - \seq_put_right:Nn \l_@@_options_WithArrows_seq {#1} - \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { #1 } - \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { #1 } + \seq_put_right:Nx \l_@@_options_WithArrows_seq { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l_@@_options_DispWithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l_@@_options_WithArrowsOptions_seq + { \tl_to_str:N { #1 } } % \end{macrocode} % We now set the options in a TeX group in order to detect if some keys in |#2| % are unknown. If a key is unknown, an error will be raised. However, the key @@ -5793,7 +6265,7 @@ version 2005/12/01 or later. \group_begin: \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } { - The~option~'\l_keys_key_tl'~can't~be~set~in~the~ + The~key~'\l_keys_key_tl'~can't~be~set~in~the~ definition~of~a~style.~You~can~go~on~for~this~time~ but~you~should~suppress~this~key. } @@ -5822,7 +6294,7 @@ version 2005/12/01 or later. % This code is the only part of the code of \pkg{witharrows} which uses the % package \pkg{varwidth} and also the Tikz library |calc|. That's why we have % decided not to load this package and this library. If they are not loaded, the -% user will have an error only if he uses the option |up| or the option |down|. +% user will have an error only when using the option |up| or the option |down|. % % \medskip % The token list |\c_@@_tikz_code_up_tl| is the value of |tikz-code| which will @@ -5919,6 +6391,8 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% % % \begin{macrocode} \seq_put_right:Nn \l_@@_options_Arrow_seq { down } @@ -5944,24 +6418,8 @@ version 2005/12/01 or later. \c_@@_option_ignored_str } % \end{macrocode} -% -% \begin{macrocode} -\@@_msg_new:nnn { Duplicate~name } - { - The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ - the~same~environment~name~twice.~You~can~go~on,~but,~ - maybe,~you~will~have~incorrect~results. \\ - For~a~list~of~the~names~already~used,~type~H~<return>. \\ - If~you~don't~want~to~see~this~message~again,~use~the~option~ - 'allow-duplicate-names'. - } - { - The~names~already~defined~in~this~document~are:~ - \seq_use:Nnnn \g_@@_names_seq { ,~ } { ,~ } { ~and~ }. - } -% \end{macrocode} -% % +% % \section{History} % % \subsection*{Changes between versions 1.0 and 1.1} @@ -6081,7 +6539,7 @@ version 2005/12/01 or later. % % \smallskip % Replacement of some options |O { }| in commands and environments defined with -% \pkg{xparse} by |! O { }| (because a recent version of \pkg{xparse} introduced +% \pkg{xparse} by |! O { }| (a recent version of \pkg{xparse} introduced % the specifier |!| and modified the default behaviour of the last optional % arguments: % |//www.texdev.net/2018/04/21/xparse-optional-arguments-at-the-end|). @@ -6123,7 +6581,21 @@ version 2005/12/01 or later. % \subsection*{Changes between 1.16 and 1.17} % % Option |format| +% +% \subsection*{Changes between 1.17 and 1.18} +% +% New option |<...>| for |{DispWithArrows}|. +% +% Option |subequations|. +% +% Warning when |{WithArrows}| or |{DispWithArrows}| ends by "\\". % +% No space before an environnement |{DispWithArrows}| if we are at the beginning +% of a |{minipage}|. +% \PrintIndex +% +% \tableofcontents +% % \endinput % Local Variables: % TeX-fold-mode: nil diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index 795d67b973b..563c6e8b260 100644 --- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.17} -\def\myfiledate{2019/07/09} +\def\myfileversion{1.18} +\def\myfiledate{2019/07/24} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} \RequirePackage{expl3}[2019/02/15] @@ -30,75 +30,79 @@ {\myfileversion} {Draws arrows for explanations on the right} \RequirePackage { xparse } [ 2018-10-17 ] -\bool_new:N \g__wa_footnotehyper_bool -\bool_new:N \g__wa_footnote_bool -\cs_new_protected:Npn \__wa_msg_new:nn { \msg_new:nnn { witharrows } } -\cs_new_protected:Npn \__wa_msg_new:nnn { \msg_new:nnnn { witharrows } } -\cs_new_protected:Npn \__wa_msg_redirect_name:nn +\bool_new:N \g__wi_footnotehyper_bool +\bool_new:N \g__wi_footnote_bool +\cs_new_protected:Npn \__wi_msg_new:nn { \msg_new:nnn { witharrows } } +\cs_new_protected:Npn \__wi_msg_new:nnn { \msg_new:nnnn { witharrows } } +\cs_new_protected:Npn \__wi_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } +\cs_new_protected:Npn \__wi_error:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \__wi_warning:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \__wi_fatal:n { \msg_fatal:nn { witharrows } } +\cs_new_protected:Npn \__wi_error:nn { \msg_error:nnn { witharrows } } +\cs_generate_variant:Nn \__wi_error:nn { n x } \keys_define:nn { WithArrows / package } { - footnote .bool_gset:N = \g__wa_footnote_bool , - footnotehyper .bool_gset:N = \g__wa_footnotehyper_bool , + footnote .bool_gset:N = \g__wi_footnote_bool , + footnotehyper .bool_gset:N = \g__wi_footnotehyper_bool , unknown .code:n = - \msg_fatal:nn { witharrows } { Option~unknown~for~package } + \__wi_fatal:n { Option~unknown~for~package } } -\__wa_msg_new:nn { Option~unknown~for~package } +\__wi_msg_new:nn { Option~unknown~for~package } { You~can't~use~the~option~'\l_keys_key_tl'~when~loading~the~ package~witharrows.~Try~to~use~the~command~ \token_to_str:N\WithArrowsOptions. } \ProcessKeysOptions { WithArrows / package } -\__wa_msg_new:nn { Option~incompatible~with~Beamer } +\__wi_msg_new:nn { Option~incompatible~with~Beamer } { The~option~'\l_keys_key_tl'\ is~incompatible~ with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. } -\__wa_msg_new:nn { footnote~with~footnotehyper~package } +\__wi_msg_new:nn { footnote~with~footnotehyper~package } { You~can't~use~the~option~'footnote'~because~the~package~ footnotehyper~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnotehyper. + of~the~package~footnotehyper.\\ + If~you~go~on,~the~package~footnote~won't~be~loaded. } -\__wa_msg_new:nn { footnotehyper~with~footnote~package } +\__wi_msg_new:nn { footnotehyper~with~footnote~package } { You~can't~use~the~option~'footnotehyper'~because~the~package~ footnote~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~ within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnote. + of~the~package~footnote.\\ + If~you~go~on,~the~package~footnotehyper~won't~be~loaded. } -\bool_if:NT \g__wa_footnote_bool +\bool_if:NT \g__wi_footnote_bool { \@ifclassloaded { beamer } - { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } - { } - \@ifpackageloaded { footnotehyper } - { \msg_fatal:nn { witharrows } { footnote~with~footnotehyper~package } } - { } - \usepackage { footnote } + { \msg_info:nn { witharrows } { Option~incompatible~with~Beamer } } + { + \@ifpackageloaded { footnotehyper } + { \__wi_error:n { footnote~with~footnotehyper~package } } + { \usepackage { footnote } } + } } -\bool_if:NT \g__wa_footnotehyper_bool +\bool_if:NT \g__wi_footnotehyper_bool { \@ifclassloaded { beamer } - { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } - { } - \@ifpackageloaded { footnote } - { \msg_fatal:nn { witharrows } { footnotehyper~with~footnote~package } } - { } - \usepackage { footnotehyper } - \bool_gset_true:N \g__wa_footnote_bool - } -\bool_new:N \c__wa_leqno_bool -\DeclareOption { leqno } { \bool_set_true:N \c__wa_leqno_bool } + { \__wi_info:n { Option~incompatible~with~Beamer } } + { + \@ifpackageloaded { footnote } + { \__wi_error:n { footnotehyper~with~footnote~package } } + { \usepackage { footnotehyper } } + } + \bool_gset_true:N \g__wi_footnote_bool + } +\bool_new:N \c__wi_leqno_bool +\DeclareOption { leqno } { \bool_set_true:N \c__wi_leqno_bool } \DeclareOption* { } \ProcessOptions* -\cs_new_protected:Npn \__wa_error:n { \msg_error:nn { witharrows } } -\cs_new_protected:Npn \__wa_error:nn { \msg_error:nnn { witharrows } } -\cs_generate_variant:Nn \__wa_error:nn { n x } \cs_generate_variant:Nn \tl_put_right:Nn { N v } \cs_generate_variant:Nn \seq_set_split:Nnn { N x x } \AtBeginDocument @@ -106,31 +110,31 @@ \clist_map_inline:nn { amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels, - typedref, varwidth + typedref, unicode-math, varwidth } { - \bool_new:c { c__wa_#1_loaded_bool } + \bool_new:c { c__wi_#1_loaded_bool } \@ifpackageloaded { #1 } - { \bool_set_true:c { c__wa_#1_loaded_bool } } + { \bool_set_true:c { c__wi_#1_loaded_bool } } { } } } \sys_if_engine_luatex:TF { - \cs_new_protected:Npn \__wa_strcmp:nn #1 #2 + \cs_new_protected:Npn \__wi_strcmp:nn #1 #2 { \lua_now:e { l3kernel.strcmp('#1','#2') } } } { - \cs_new_protected:Npn \__wa_strcmp:nn #1 #2 + \cs_new_protected:Npn \__wi_strcmp:nn #1 #2 { \pdftex_strcmp:D { #1 } { #2 } } } -\cs_new_protected:Npn \__wa_sort_seq:N #1 +\cs_new_protected:Npn \__wi_sort_seq:N #1 { \seq_sort:Nn #1 { \int_compare:nNnTF { - \__wa_strcmp:nn + \__wi_strcmp:nn { \str_lower_case:n { ##1 } } { \str_lower_case:n { ##2 } } } @@ -139,7 +143,21 @@ \sort_return_same: } } -\cs_new_protected:Npn \__wa_save:N #1 +\cs_new_protected:Npn \__wi_convert_to_str_seq:N #1 + { + \seq_clear:N \l_tmpa_seq + \seq_map_inline:Nn #1 + { + \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } } + } + \seq_set_eq:NN #1 \l_tmpa_seq + } +\cs_new_protected:Npn \__wi_set_seq_of_str_from_clist:Nn #1 #2 + { + \seq_set_from_clist:Nn #1 { #2 } + \__wi_convert_to_str_seq:N #1 + } +\cs_new_protected:Npn \__wi_save:N #1 { \seq_set_split:Nxx \l_tmpa_seq { \char_generate:nn { `_ } { 12 } } @@ -155,7 +173,7 @@ \use:c { \l_tmpa_str _gset_eq:cN } { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1 } -\cs_new_protected:Npn \__wa_restore:N #1 +\cs_new_protected:Npn \__wi_restore:N #1 { \seq_set_split:Nxx \l_tmpa_seq { \char_generate:nn { `_ } { 12 } } @@ -167,21 +185,21 @@ } \tikzset { - __wa_node_style / .style = + __wi_node_style / .style = { - above = \l__wa_ystart_dim , + above = \l__wi_ystart_dim , inner~sep = \c_zero_dim , minimum~width = \c_zero_dim , - minimum~height = \l__wa_ygap_dim + minimum~height = \l__wi_ygap_dim } } \tikzset { - __wa_standard / .style = + __wi_standard / .style = { remember~picture , overlay , - name~prefix = wa - \l__wa_prefix_str - + name~prefix = wa - \l__wi_prefix_str - } } \tikzset @@ -203,221 +221,249 @@ } \AtBeginDocument { - \bool_if:NF \c__wa_amsmath_loaded_bool + \bool_if:NTF \c__wi_amsmath_loaded_bool + { + \seq_put_right:Nn \l__wi_options_WithArrowsOptions_seq { subequations } + \seq_put_right:Nn \l__wi_options_DispWithArrows_seq { subequations } + } { - \cs_set_protected:Npn \spread@equation + \cs_new_protected:Npn \spread@equation { \openup \jot \cs_set_eq:NN \spread@equation \prg_do_nothing: } } } -\newtoks \__wa_parameter_token -\__wa_parameter_token = { # } -\bool_new:N \l__wa_in_WithArrows_bool -\bool_new:N \l__wa_in_DispWithArrows_bool -\bool_new:N \l__wa_in_code_after_bool -\seq_new:N \g__wa_position_in_the_tree_seq -\seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1 -\int_new:N \g__wa_last_env_int -\int_new:N \l__wa_pos_env_int -\int_new:N \l__wa_pos_arrow_int -\int_set:Nn \l__wa_pos_arrow_int 3 -\seq_new:N \g__wa_arrow_int_seq -\int_new:N \g__wa_arrow_int -\seq_new:N \g__wa_line_int_seq -\int_new:N \g__wa_line_int -\seq_new:N \g__wa_col_int_seq -\int_new:N \g__wa_col_int -\clist_new:N \l__wa_tags_clist -\clist_set:Nn \l__wa_tags_clist { all } -\cs_new_protected:Npn \__wa_test_if_to_tag: - { - \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int - { \clist_set:Nn \l__wa_tags_clist { all } } - } -\str_new:N \l__wa_command_name_str -\str_set:Nn \l__wa_command_name_str { Arrow } -\str_new:N \l__wa_string_Arrow_for_msg_str -\str_set:Nx \l__wa_string_Arrow_for_msg_str { \token_to_str:N \Arrow } -\seq_new:N \g__wa_names_seq -\bool_new:N \l__wa_sbwi_bool -\bool_new:N \l__wa_in_first_columns_bool -\bool_new:N \l__wa_tag_star_bool -\bool_new:N \l__wa_tag_next_line_bool -\bool_new:N \l__wa_qedhere_bool -\bool_new:N \l__wa_new_group_bool -\bool_new:N \l__wa_initial_r_bool -\bool_new:N \l__wa_final_r_bool -\tl_new:N \l__wa_initial_tl -\tl_new:N \l__wa_final_tl -\int_new:N \l__wa_nb_of_columns_int -\bool_new:N \l__wa_last_col_bool -\str_new:N \l__wa_format_str -\cs_new_protected:Npn \__wa_eval_if_allowed:n #1 - { - \str_if_empty:NTF \l__wa_previous_key_str +\tl_new:N \l__wi_left_brace_tl +\tl_set_eq:NN \l__wi_left_brace_tl \c_novalue_tl +\bool_new:N \l__wi_in_WithArrows_bool +\bool_new:N \l__wi_in_DispWithArrows_bool +\bool_new:N \l__wi_in_code_after_bool +\seq_new:N \g__wi_position_in_the_tree_seq +\seq_gput_right:Nn \g__wi_position_in_the_tree_seq 1 +\int_new:N \g__wi_last_env_int +\int_new:N \l__wi_pos_env_int +\int_new:N \l__wi_pos_arrow_int +\int_set:Nn \l__wi_pos_arrow_int 3 +\seq_new:N \g__wi_arrow_int_seq +\int_new:N \g__wi_arrow_int +\seq_new:N \g__wi_line_int_seq +\int_new:N \g__wi_line_int +\seq_new:N \g__wi_col_int_seq +\int_new:N \g__wi_col_int +\clist_new:N \l__wi_tags_clist +\clist_set:Nn \l__wi_tags_clist { all } +\cs_new_protected:Npn \__wi_test_if_to_tag: + { + \clist_if_in:NVT \l__wi_tags_clist \g__wi_line_int + { \clist_set:Nn \l__wi_tags_clist { all } } + } +\str_new:N \l__wi_command_name_str +\str_set:Nn \l__wi_command_name_str { Arrow } +\str_new:N \l__wi_string_Arrow_for_msg_str +\str_set:Nx \l__wi_string_Arrow_for_msg_str { \token_to_str:N \Arrow } +\seq_new:N \g__wi_names_seq +\bool_new:N \l__wi_sbwi_bool +\bool_new:N \l__wi_in_first_columns_bool +\bool_new:N \l__wi_tag_star_bool +\bool_new:N \l__wi_tag_next_line_bool +\bool_new:N \l__wi_qedhere_bool +\bool_new:N \l__wi_new_group_bool +\bool_new:N \l__wi_initial_r_bool +\bool_new:N \l__wi_final_r_bool +\tl_new:N \l__wi_initial_tl +\tl_new:N \l__wi_final_tl +\int_new:N \l__wi_nb_cols_int +\str_new:N \l__wi_format_str +\bool_new:N \l__wi_subequations_bool +\cs_new_protected:Npn \__wi_eval_if_allowed:n #1 + { + \str_if_empty:NTF \l__wi_previous_key_str { - \str_set_eq:NN \l__wa_previous_key_str \l_keys_key_tl + \str_set_eq:NN \l__wi_previous_key_str \l_keys_key_tl #1 } - { \__wa_error:n { Incompatible~options } } + { \__wi_error:n { Incompatible~options } } } -\cs_new_protected:Npn \__wa_fix_pos_option:n #1 - { \__wa_eval_if_allowed:n { \int_set:Nn \l__wa_pos_arrow_int { #1 } } } +\cs_new_protected:Npn \__wi_fix_pos_option:n #1 + { \__wi_eval_if_allowed:n { \int_set:Nn \l__wi_pos_arrow_int { #1 } } } \keys_define:nn { WithArrows / Global } { - ygap .dim_set:N = \l__wa_ygap_dim , + ygap .dim_set:N = \l__wi_ygap_dim , ygap .value_required:n = true , ygap .initial:n = 0.4 ex , - ystart .dim_set:N = \l__wa_ystart_dim , + ystart .dim_set:N = \l__wi_ystart_dim , ystart .value_required:n = true , ystart .initial:n = 0.4 ex , more-columns .code:n = - \__wa_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } , + \__wi_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } , more-columns .value_forbidden:n = true, command-name .code:n = - \str_set:Nn \l__wa_command_name_str { #1 } - \str_set:Nx \l__wa_string_Arrow_for_msg_str + \str_set:Nn \l__wi_command_name_str { #1 } + \str_set:Nx \l__wi_string_Arrow_for_msg_str { \c_backslash_str Arrow~alias~\c_backslash_str #1 } , command-name .value_required:n = true , - tikz-code .tl_set:N = \l__wa_tikz_code_tl, + tikz-code .tl_set:N = \l__wi_tikz_code_tl, tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , tikz-code .value_required:n = true , TikzCode .meta:n = { tikz-code = #1 } , - displaystyle .bool_set:N = \l__wa_displaystyle_bool , + displaystyle .bool_set:N = \l__wi_displaystyle_bool , displaystyle .default:n = true , show-nodes .code:n = - \tikzset { __wa_node_style / .append~style = { draw , red } } , + \tikzset { __wi_node_style / .append~style = { draw , red } } , show-nodes .value_forbidden:n = true, - show-node-names .bool_set:N = \l__wa_show_node_names_bool , + show-node-names .bool_set:N = \l__wi_show_node_names_bool , show-node-names .default:n = true , group .code:n = - \str_if_empty:NTF \l__wa_previous_key_str + \str_if_empty:NTF \l__wi_previous_key_str { - \str_set:Nn \l__wa_previous_key_str { group } - \seq_remove_all:Nn \l__wa_options_Arrow_seq { xoffset } - \int_set:Nn \l__wa_pos_arrow_int 7 + \str_set:Nn \l__wi_previous_key_str { group } + \seq_remove_all:Nn \l__wi_options_Arrow_seq { xoffset } + \int_set:Nn \l__wi_pos_arrow_int 7 } - { \__wa_error:n { Incompatible~options } } , + { \__wi_error:n { Incompatible~options } } , group .value_forbidden:n = true , groups .code:n = - \str_if_empty:NTF \l__wa_previous_key_str + \str_if_empty:NTF \l__wi_previous_key_str { - \str_set:Nn \l__wa_previous_key_str { groups } - \seq_if_in:NnF \l__wa_options_Arrow_seq { new-group } - { \seq_put_right:Nn \l__wa_options_Arrow_seq { new-group } } - \seq_remove_all:Nn \l__wa_options_Arrow_seq { xoffset } - \int_set:Nn \l__wa_pos_arrow_int 6 + \str_set:Nn \l__wi_previous_key_str { groups } + \seq_if_in:NnF \l__wi_options_Arrow_seq { new-group } + { \seq_put_right:Nn \l__wi_options_Arrow_seq { new-group } } + \seq_remove_all:Nn \l__wi_options_Arrow_seq { xoffset } + \int_set:Nn \l__wi_pos_arrow_int 6 } - { \__wa_error:n { Incompatible~options } } , + { \__wi_error:n { Incompatible~options } } , groups .value_forbidden:n = true , tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , tikz .initial:n = \c_empty_tl , tikz .value_required:n = true , rr .value_forbidden:n = true , - rr .code:n = \__wa_fix_pos_option:n 3 , + rr .code:n = \__wi_fix_pos_option:n 3 , ll .value_forbidden:n = true , - ll .code:n = \__wa_fix_pos_option:n 1 , + ll .code:n = \__wi_fix_pos_option:n 1 , rl .value_forbidden:n = true , - rl .code:n = \__wa_fix_pos_option:n 2 , + rl .code:n = \__wi_fix_pos_option:n 2 , lr .value_forbidden:n = true , - lr .code:n = \__wa_fix_pos_option:n 0 , + lr .code:n = \__wi_fix_pos_option:n 0 , i .value_forbidden:n = true , - i .code:n = \__wa_fix_pos_option:n 5 , - xoffset .dim_set:N = \l__wa_xoffset_dim , + i .code:n = \__wi_fix_pos_option:n 5 , + xoffset .dim_set:N = \l__wi_xoffset_dim , xoffset .value_required:n = true , xoffset .initial:n = 3 mm , jot .dim_set:N = \jot , jot .value_required:n = true , - interline .skip_set:N = \l__wa_interline_skip , + interline .skip_set:N = \l__wi_interline_skip , interline .value_required:n = true , - start-adjust .dim_set:N = \l__wa_start_adjust_dim , + start-adjust .dim_set:N = \l__wi_start_adjust_dim , start-adjust .value_required:n = true , start-adjust .initial:n = 0.4 ex , - end-adjust .dim_set:N = \l__wa_end_adjust_dim , + end-adjust .dim_set:N = \l__wi_end_adjust_dim , end-adjust .value_required:n = true , end-adjust .initial:n = 0.4 ex , - adjust .code:n = - \dim_zero_new:N \l__wa_start_adjust_dim - \dim_set:Nn \l__wa_start_adjust_dim { #1 } - \dim_zero_new:N \l__wa_end_adjust_dim - \dim_set:Nn \l__wa_end_adjust_dim { #1 } , + adjust .meta:n = { start-adjust = #1 , end-adjust = #1 } , adjust .value_required:n = true , no-arrows .code:n = - \cs_set_eq:NN \__wa_draw_arrows:nn \use_none:nn - \cs_set_eq:NN \__wa_draw_arrow:nnn \use_none:nnn , + \cs_set_eq:NN \__wi_draw_arrows:nn \use_none:nn + \cs_set_eq:NN \__wi_draw_arrow:nnn \use_none:nnn , no-arrows .value_forbidden:n = true , } \keys_define:nn { WithArrows / WithArrowsSpecific } { - t .code:n = \int_set:Nn \l__wa_pos_env_int O , + t .code:n = \int_set:Nn \l__wi_pos_env_int O , t .value_forbidden:n = true , - c .code:n = \int_set:Nn \l__wa_pos_env_int 1 , + c .code:n = \int_set:Nn \l__wi_pos_env_int 1 , c .value_forbidden:n = true , - b .code:n = \int_set:Nn \l__wa_pos_env_int 2 , + b .code:n = \int_set:Nn \l__wi_pos_env_int 2 , b .value_forbidden:n = true } +\clist_new:N \c__wi_extensible_delimiters_clist +\clist_set:Nn \c__wi_extensible_delimiters_clist + { + \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor + } +\AtBeginDocument + { + \bool_if:nT + { \c__wi_amsmath_loaded_bool || \use:c { c__wi_unicode-math_loaded_bool } } + { + \clist_put_right:Nn \c__wi_extensible_delimiters_clist { \lvert, \lVert } + } + } \keys_define:nn { WithArrows / DispWithArrowsSpecific } { - fleqn .bool_set:N = \l__wa_fleqn_bool , + fleqn .bool_set:N = \l__wi_fleqn_bool , fleqn .default:n = true , - mathindent .dim_set:N = \l__wa_mathindent_dim , + mathindent .dim_set:N = \l__wi_mathindent_dim , mathindent .value_required:n = true , mathindent .initial:n = 25 pt , notag .code:n = \str_if_eq:nnTF { #1 } { true } - { \clist_clear:N \l__wa_tags_clist } - { \clist_set:Nn \l__wa_tags_clist { all } } , + { \clist_clear:N \l__wi_tags_clist } + { \clist_set:Nn \l__wi_tags_clist { all } } , notag .default:n = true , + subequations .code:n = + \bool_if:NTF \c__wi_amsmath_loaded_bool + { \bool_set_true:N \l__wi_subequations_bool } + { + \__wi_error:n { amsmath~not~loaded } + \group_begin: + \globaldefs = 1 + \__wi_msg_redirect_name:nn { amsmath~not~loaded } { info } + \group_end: + } , + subequations .default:n = true , + subequations .value_forbidden:n = true , nonumber .meta:n = notag , allow-multiple-labels .code:n = - \__wa_msg_redirect_name:nn { Multiple~labels } { none } , + \__wi_msg_redirect_name:nn { Multiple~labels } { none } , allow-multiple-labels .value_forbidden:n = true , - wrap-lines .bool_set:N = \l__wa_wrap_lines_bool , + wrap-lines .bool_set:N = \l__wi_wrap_lines_bool , wrap-lines .default:n = true , tagged-lines .code:n = - \clist_set:Nn \l__wa_tags_clist { #1 } - \clist_if_in:NnT \l__wa_tags_clist { first } + \clist_set:Nn \l__wi_tags_clist { #1 } + \clist_if_in:NnT \l__wi_tags_clist { first } { - \clist_remove_all:Nn \l__wa_tags_clist { first } - \clist_put_left:Nn \l__wa_tags_clist \c_one_int + \clist_remove_all:Nn \l__wi_tags_clist { first } + \clist_put_left:Nn \l__wi_tags_clist \c_one_int } , tagged-lines .value_required:n = true , - standard-behaviour-with-items .bool_set:N = \l__wa_sbwi_bool , + replace-left-brace-by .code:n = + { + \clist_if_in:NnTF + \c__wi_extensible_delimiters_clist + { #1 } + { \tl_set:Nn \l__wi_replace_left_brace_by_tl { #1 } } + { \__wi_error:n { Bad~value~for~replace~brace~by } } + } , + replace-left-brace-by .initial:n = \lbrace , + standard-behaviour-with-items .bool_set:N = \l__wi_sbwi_bool , standard-behaviour-with-items .default:n = true } \keys_define:nn { WithArrows / Env } { name .code:n = - \seq_if_in:NnTF \g__wa_names_seq { #1 } - { \__wa_error:n { Duplicate~name } } - { \seq_gput_left:Nn \g__wa_names_seq { #1 } } - \str_set:Nn \l__wa_name_str { #1 } , + \str_set:Nn \l_tmpa_str { #1 } + \seq_if_in:NVTF \g__wi_names_seq \l_tmpa_str + { \__wi_error:n { Duplicate~name } } + { \seq_gput_left:NV \g__wi_names_seq \l_tmpa_str } + \str_set_eq:NN \l__wi_name_str \l_tmpa_str , name .value_required:n = true , - code-before .code:n = \tl_put_right:Nn \l__wa_code_before_tl { #1 } , + code-before .code:n = \tl_put_right:Nn \l__wi_code_before_tl { #1 } , code-before .value_required:n = true, CodeBefore .meta:n = { code-before = #1 } , - code-after .code:n = \tl_put_right:Nn \l__wa_code_after_tl { #1 } , + code-after .code:n = \tl_put_right:Nn \l__wi_code_after_tl { #1 } , code-after .value_required:n = true , CodeAfter .meta:n = { code-after = #1 } , - format .code:n = \__wa_set_option_format:n { #1 }, + format .code:n = + \tl_if_empty:nTF { #1 } + { \__wi_error:n { Invalid~option~format } } + { + \regex_match:nnTF { \A[rcl]*\Z } { #1 } + { \tl_set:Nn \l__wi_format_str { #1 } } + { \__wi_error:n { Invalid~option~format } } + } , format .value_required:n = true , } -\cs_new_protected:Npn \__wa_set_option_format:n #1 - { - \bool_set_true:N \l_tmpa_bool - \str_map_inline:nn { #1 } - { - \str_if_in:nnF {rcl} { ##1 } - { - \bool_set_false:N \l_tmpa_bool - \__wa_error:n { Invalid~option~format } - \str_map_break: - } - } - \bool_if:NT \l_tmpa_bool { \tl_set:Nn \l__wa_format_str { #1 } } - } \keys_define:nn { WithArrows } { WithArrows .inherit:n = @@ -439,46 +485,53 @@ WithArrows / DispWithArrowsSpecific } } -\seq_new:N \l__wa_options_WithArrows_seq -\seq_set_from_clist:Nn \l__wa_options_WithArrows_seq - { - adjust, b, c, code-after, code-before, command-name, displaystyle, end-adjust, - format, group, groups, i, interline, jot, ll, lr, more-columns, name, - no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz, - tikz-code, xoffset, ygap, ystart +\seq_new:N \l__wi_options_WithArrows_seq +\__wi_set_seq_of_str_from_clist:Nn \l__wi_options_WithArrows_seq + { + adjust, b, c, code-after, code-before, command-name, + displaystyle, end-adjust, + format, group, groups, i, + interline, jot, ll, + lr, more-columns, name, + no-arrows, rl, rr, + show-node-names, show-nodes, start-adjust, + t, tikz, tikz-code, + xoffset, ygap, ystart } +\__wi_convert_to_str_seq:N \l__wi_options_WithArrows_seq \keys_define:nn { WithArrows / WithArrows } { unknown .code:n = - \__wa_sort_seq:N \l__wa_options_WithArrows_seq - \__wa_error:n { Unknown~option~WithArrows } + \__wi_sort_seq:N \l__wi_options_WithArrows_seq + \__wi_error:n { Unknown~option~WithArrows } } \keys_define:nn { WithArrows / DispWithArrows } { + left-brace .tl_set:N = \l__wi_left_brace_tl , unknown .code:n = - \__wa_sort_seq:N \l__wa_options_DispWithArrows_seq - \__wa_error:n { Unknown~option~DispWithArrows } + \__wi_sort_seq:N \l__wi_options_DispWithArrows_seq + \__wi_error:n { Unknown~option~DispWithArrows } } -\seq_new:N \l__wa_options_DispWithArrows_seq -\seq_set_from_clist:Nn \l__wa_options_DispWithArrows_seq +\seq_new:N \l__wi_options_DispWithArrows_seq +\__wi_set_seq_of_str_from_clist:Nn \l__wi_options_DispWithArrows_seq { allow-multiple-labels, code-after, code-before, command-name, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot, - ll, lr, mathindent, name, no-arrows, nonumber, notag, rl, rr, - show-node-names, show-nodes, start-adjust, tagged-lines, tikz, wrap-lines, - xoffset, ygap, ystart + left-brace, ll, lr, mathindent, name, no-arrows, nonumber, notag, + replace-left-brace-by, rl, rr, show-node-names, show-nodes, start-adjust, + tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart } \keys_define:nn { WithArrows / WithArrowsOptions } { allow-duplicate-names .code:n = - \__wa_msg_redirect_name:nn { Duplicate~name } { none } , + \__wi_msg_redirect_name:nn { Duplicate~name } { none } , allow-duplicate-names .value_forbidden:n = true , unknown .code:n = - \__wa_sort_seq:N \l__wa_options_WithArrowsOptions_seq - \__wa_error:n { Unknown~option~WithArrowsOptions } + \__wi_sort_seq:N \l__wi_options_WithArrowsOptions_seq + \__wi_error:n { Unknown~option~WithArrowsOptions } } -\seq_new:N \l__wa_options_WithArrowsOptions_seq -\seq_set_from_clist:Nn \l__wa_options_WithArrowsOptions_seq +\seq_new:N \l__wi_options_WithArrowsOptions_seq +\__wi_set_seq_of_str_from_clist:Nn \l__wi_options_WithArrowsOptions_seq { allow-duplicate-names, allow-multiple-labels, b, c, command-name, more-columns, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, @@ -486,29 +539,29 @@ rl, rr, show-node-names, show-nodes, standard-behaviour-with-items, start-adjust, t, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart } -\cs_new_protected:Npn \__wa_set_independent: +\cs_new_protected:Npn \__wi_set_independent: { - \str_if_empty:NTF \l__wa_previous_key_str + \str_if_empty:NTF \l__wi_previous_key_str { - \str_set_eq:NN \l__wa_previous_key_str \l_keys_key_tl - \str_set:Nn \l__wa_status_arrow_str { independent } + \str_set_eq:NN \l__wi_previous_key_str \l_keys_key_tl + \str_set:Nn \l__wi_status_arrow_str { independent } \str_if_eq:VnF \l_keys_value_tl { NoValue } - { \__wa_error:n { Value~for~a~key } } + { \__wi_error:n { Value~for~a~key } } } - { \__wa_error:n { Incompatible~options~in~Arrow } } + { \__wi_error:n { Incompatible~options~in~Arrow } } } \keys_define:nn { WithArrows / Arrow / FirstPass } { jump .code:n = \int_compare:nTF { #1 > 0 } - { \int_set:Nn \l__wa_jump_int { #1 } } - { \__wa_error:n { Negative~jump } } , + { \int_set:Nn \l__wi_jump_int { #1 } } + { \__wi_error:n { Negative~jump } } , jump .value_required:n = true, - rr .code:n = \__wa_set_independent: , - ll .code:n = \__wa_set_independent: , - rl .code:n = \__wa_set_independent: , - lr .code:n = \__wa_set_independent: , - i .code:n = \__wa_set_independent: , + rr .code:n = \__wi_set_independent: , + ll .code:n = \__wi_set_independent: , + rl .code:n = \__wi_set_independent: , + lr .code:n = \__wi_set_independent: , + i .code:n = \__wi_set_independent: , rr .default:n = NoValue , ll .default:n = NoValue , rl .default:n = NoValue , @@ -516,16 +569,16 @@ i .default:n = NoValue , new-group .value_forbidden:n = true, new-group .code:n = - \int_compare:nTF { \l__wa_pos_arrow_int = 6 } - { \str_set:Nn \l__wa_status_arrow_str { new-group } } - { \__wa_error:n { new-group~without~groups } } , + \int_compare:nTF { \l__wi_pos_arrow_int = 6 } + { \str_set:Nn \l__wi_status_arrow_str { new-group } } + { \__wi_error:n { new-group~without~groups } } , tikz-code .code:n = \prg_do_nothing: , tikz-code .value_required:n = true , tikz .code:n = \prg_do_nothing: , tikz .value_required:n = true , xoffset .code:n = - \int_compare:nNnT \l__wa_pos_arrow_int > 5 - { \__wa_error:n { Option~xoffset~forbidden } } , + \int_compare:nNnT \l__wi_pos_arrow_int > 5 + { \__wi_error:n { Option~xoffset~forbidden } } , xoffset .value_required:n = true , start-adjust .code:n = \prg_do_nothing: , start-adjust .value_required:n = true , @@ -534,190 +587,202 @@ adjust .code:n = \prg_do_nothing: , adjust .value_required:n = true , unknown .code:n = - \__wa_sort_seq:N \l__wa_options_Arrow_seq - \__wa_error:n { Unknown~option~in~Arrow } + \__wi_sort_seq:N \l__wi_options_Arrow_seq + \seq_if_in:NVTF \l__wi_options_WithArrows_seq \l_keys_key_tl + { + \str_set:Nn \l_tmpa_str + { ~However,~this~key~can~be~used~in~the~options~of~\{WithArrows\}. } + } + { \str_clear:N \l_tmpa_str } + \__wi_error:n { Unknown~option~in~Arrow } } -\seq_new:N \l__wa_options_Arrow_seq -\seq_set_from_clist:Nn \l__wa_options_Arrow_seq +\seq_new:N \l__wi_options_Arrow_seq +\__wi_set_seq_of_str_from_clist:Nn \l__wi_options_Arrow_seq { adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code, xoffset } -\cs_new_protected:Npn \__wa_fix_pos_arrow:n #1 +\cs_new_protected:Npn \__wi_fix_pos_arrow:n #1 { - \str_if_empty:NT \l__wa_previous_key_str + \str_if_empty:NT \l__wi_previous_key_str { - \str_set_eq:NN \l__wa_previous_key_str \l_keys_key_tl - \int_set:Nn \l__wa_pos_arrow_int { #1 } + \str_set_eq:NN \l__wi_previous_key_str \l_keys_key_tl + \int_set:Nn \l__wi_pos_arrow_int { #1 } } } \keys_define:nn {WithArrows / Arrow / SecondPass } { - tikz-code .tl_set:N = \l__wa_tikz_code_tl , + tikz-code .tl_set:N = \l__wi_tikz_code_tl , tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , tikz .initial:n = \c_empty_tl , - rr .code:n = \__wa_fix_pos_arrow:n 3 , - ll .code:n = \__wa_fix_pos_arrow:n 1 , - rl .code:n = \__wa_fix_pos_arrow:n 2 , - lr .code:n = \__wa_fix_pos_arrow:n 0 , - i .code:n = \__wa_fix_pos_arrow:n 5 , + rr .code:n = \__wi_fix_pos_arrow:n 3 , + ll .code:n = \__wi_fix_pos_arrow:n 1 , + rl .code:n = \__wi_fix_pos_arrow:n 2 , + lr .code:n = \__wi_fix_pos_arrow:n 0 , + i .code:n = \__wi_fix_pos_arrow:n 5 , xoffset .code:n = - \int_compare:nNnF \l__wa_pos_arrow_int > 5 - { \dim_set:Nn \l__wa_xoffset_dim { #1 } } , - start-adjust .dim_set:N = \l__wa_start_adjust_dim, - end-adjust .dim_set:N = \l__wa_end_adjust_dim, + \int_compare:nNnF \l__wi_pos_arrow_int > 5 + { \dim_set:Nn \l__wi_xoffset_dim { #1 } } , + start-adjust .dim_set:N = \l__wi_start_adjust_dim, + end-adjust .dim_set:N = \l__wi_end_adjust_dim, adjust .code:n = - \dim_set:Nn \l__wa_start_adjust_dim { #1 } - \dim_set:Nn \l__wa_end_adjust_dim { #1 } , + \dim_set:Nn \l__wi_start_adjust_dim { #1 } + \dim_set:Nn \l__wi_end_adjust_dim { #1 } , } \NewDocumentCommand \WithArrowsOptions { m } { - \str_clear_new:N \l__wa_previous_key_str + \str_clear_new:N \l__wi_previous_key_str \keys_set:nn { WithArrows / WithArrowsOptions } { #1 } } -\NewDocumentCommand \__wa_Arrow { O { } m ! O { } } +\NewDocumentCommand \__wi_Arrow { O { } m ! O { } } { - \int_gincr:N \g__wa_arrow_int - \str_clear_new:N \l__wa_previous_key_str + \int_gincr:N \g__wi_arrow_int + \str_clear_new:N \l__wi_previous_key_str \keys_set:nn { WithArrows / Arrow / FirstPass } { #1 , #3 } - \prop_put:NnV \l_tmpa_prop { initial } \g__wa_line_int - \int_set:Nn \l_tmpa_int { \g__wa_line_int + \l__wa_jump_int } + \prop_put:NnV \l_tmpa_prop { initial } \g__wi_line_int + \int_set:Nn \l_tmpa_int { \g__wi_line_int + \l__wi_jump_int } \prop_put:NnV \l_tmpa_prop { final } \l_tmpa_int - \prop_put:NnV \l_tmpa_prop { status } \l__wa_status_arrow_str + \prop_put:NnV \l_tmpa_prop { status } \l__wi_status_arrow_str \prop_put:Nnn \l_tmpa_prop { options } { #1 , #3 } \prop_put:Nnn \l_tmpa_prop { label } { #2 } \prop_put:Nnx \l_tmpa_prop { input-line } \msg_line_number: \prop_gclear_new:c - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \g__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \g__wi_arrow_int _ prop } \prop_gset_eq:cN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \g__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \g__wi_arrow_int _ prop } \l_tmpa_prop } -\cs_new_protected:Npn \__wa_Arrow_first_columns: - { \__wa_error:n { Arrow~not~in~last~column } \__wa_Arrow } -\cs_new_protected:Npn \__wa_pre_halign:n #1 +\cs_new_protected:Npn \__wi_Arrow_first_columns: + { \__wi_error:n { Arrow~not~in~last~column } \__wi_Arrow } +\cs_new_protected:Npn \__wi_pre_halign:n #1 { - \str_clear_new:N \l__wa_type_env_str - \str_set:NV \l__wa_type_env_str \@currenvir + \str_clear_new:N \l__wi_type_env_str + \str_set:NV \l__wi_type_env_str \@currenvir \cs_if_exist:NT \tikz@library@external@loaded { \tikzset { external / export = false } } - \str_clear_new:N \l__wa_name_str - \str_clear_new:N \l__wa_status_arrow_str - \dim_zero_new:N \l__wa_x_dim - \str_clear_new:N \l__wa_input_line_str - \seq_gput_right:NV \g__wa_arrow_int_seq \g__wa_arrow_int - \int_gzero:N \g__wa_arrow_int - \seq_gput_right:NV \g__wa_line_int_seq \g__wa_line_int - \int_gzero:N \g__wa_line_int - \seq_gput_right:NV \g__wa_col_int_seq \g__wa_col_int - \int_gzero:N \g__wa_col_int - \seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1 - \seq_set_eq:NN \l_tmpa_seq \g__wa_position_in_the_tree_seq + \str_clear_new:N \l__wi_name_str + \str_clear_new:N \l__wi_status_arrow_str + \dim_zero_new:N \l__wi_x_dim + \str_clear_new:N \l__wi_input_line_str + \seq_gput_right:NV \g__wi_arrow_int_seq \g__wi_arrow_int + \int_gzero:N \g__wi_arrow_int + \seq_gput_right:NV \g__wi_line_int_seq \g__wi_line_int + \int_gzero:N \g__wi_line_int + \seq_gput_right:NV \g__wi_col_int_seq \g__wi_col_int + \int_gzero:N \g__wi_col_int + \int_gzero_new:N \g__wi_static_col_int + \seq_gput_right:Nn \g__wi_position_in_the_tree_seq 1 + \seq_set_eq:NN \l_tmpa_seq \g__wi_position_in_the_tree_seq \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl - \str_clear_new:N \l__wa_prefix_str - \str_set:Nx \l__wa_prefix_str { \seq_use:Nnnn \l_tmpa_seq - - - } - \cs_set_eq:NN \\ \__wa_cr: + \str_clear_new:N \l__wi_prefix_str + \str_set:Nx \l__wi_prefix_str { \seq_use:Nnnn \l_tmpa_seq - - - } + \cs_set_eq:NN \\ \__wi_cr: \dim_zero:N \mathsurround - \int_zero_new:N \l__wa_initial_int - \int_zero_new:N \l__wa_final_int - \int_zero_new:N \l__wa_arrow_int - \int_zero_new:N \l__wa_pos_of_arrow_int - \int_zero_new:N \l__wa_jump_int - \int_set:Nn \l__wa_jump_int \c_one_int - \str_set:Nn \l__wa_format_str { rl } - \bool_set_true:N \l__wa_last_col_bool - \seq_clear_new:N \l__wa_labels_seq - \bool_set_false:N \l__wa_tag_next_line_bool - \skip_zero:N \l__wa_interline_skip - \tl_clear_new:N \l__wa_code_before_tl - \tl_clear_new:N \l__wa_code_after_tl - \str_clear_new:N \l__wa_previous_key_str - \bool_if:NT \l__wa_in_WithArrows_bool + \int_zero_new:N \l__wi_initial_int + \int_zero_new:N \l__wi_final_int + \int_zero_new:N \l__wi_arrow_int + \int_zero_new:N \l__wi_pos_of_arrow_int + \int_zero_new:N \l__wi_jump_int + \int_set:Nn \l__wi_jump_int \c_one_int + \str_set:Nn \l__wi_format_str { rl } + \seq_clear_new:N \l__wi_labels_seq + \bool_set_false:N \l__wi_tag_next_line_bool + \skip_zero:N \l__wi_interline_skip + \tl_clear_new:N \l__wi_code_before_tl + \tl_clear_new:N \l__wi_code_after_tl + \str_clear_new:N \l__wi_previous_key_str + \bool_if:NT \l__wi_in_WithArrows_bool { \keys_set:nn { WithArrows / WithArrows } { #1 } } - \bool_if:NT \l__wa_in_DispWithArrows_bool + \bool_if:NT \l__wi_in_DispWithArrows_bool { \keys_set:nn { WithArrows / DispWithArrows } { #1 } } - \cs_set_eq:cN \l__wa_command_name_str \__wa_Arrow_first_columns: - \int_set:Nn \l__wa_nb_of_columns_int { \str_count:N \l__wa_format_str } - \seq_clear_new:N \l__wa_format_seq - \seq_set_split:NnV \l__wa_format_seq { } \l__wa_format_str - \bool_if:NT \g__wa_footnote_bool { \begin { savenotes } } - \l__wa_code_before_tl + \cs_set_eq:cN \l__wi_command_name_str \__wi_Arrow_first_columns: + \int_set:Nn \l__wi_nb_cols_int { \str_count:N \l__wi_format_str } + \int_gset_eq:NN \g__wi_col_int \l__wi_nb_cols_int + \seq_clear_new:N \l__wi_format_seq + \seq_set_split:NnV \l__wi_format_seq { } \l__wi_format_str + \bool_if:NT \g__wi_footnote_bool { \begin { savenotes } } + \l__wi_code_before_tl \spread@equation - \cs_set_eq:NN \notag \__wa_notag: - \cs_set_eq:NN \nonumber \__wa_notag: - \cs_set_eq:NN \tag \__wa_tag - \cs_set_eq:NN \__wa_old_label \label - \cs_set_eq:NN \label \__wa_label:n - \cs_set_eq:NN \tagnextline \__wa_tagnextline: + \cs_set_eq:NN \notag \__wi_notag: + \cs_set_eq:NN \nonumber \__wi_nonumber: + \cs_set_eq:NN \tag \__wi_tag + \cs_set_eq:NN \__wi_old_label \label + \cs_set_eq:NN \label \__wi_label:n + \cs_set_eq:NN \tagnextline \__wi_tagnextline: } -\cs_new_protected:Npn \__wa_construct_halign: +\cs_new_protected:Npn \__wi_construct_halign: { - \seq_pop_right:NNTF \l__wa_format_seq \l__wa_type_col_str + \seq_pop_right:NNTF \l__wi_format_seq \l__wi_type_col_str { \use:x { - \bool_set_false:N \l__wa_last_col_bool - \__wa_construct_halign: - \bool_if:NT \l__wa_last_col_bool + \int_gdecr:N \g__wi_col_int + \__wi_construct_halign: + \int_compare:nNnT \g__wi_col_int = \l__wi_nb_cols_int { - \cs_set_eq:cN { \l__wa_command_name_str } \__wa_Arrow - \bool_if:NT \l__wa_in_DispWithArrows_bool + \cs_set_eq:cN { \l__wi_command_name_str } \__wi_Arrow + \bool_if:NT \l__wi_in_DispWithArrows_bool { - \__wa_test_if_to_tag: - \bool_if:NT \c__wa_amsthm_loaded_bool \__wa_set_qedhere: + \__wi_test_if_to_tag: + \bool_if:NT \c__wi_amsthm_loaded_bool \__wi_set_qedhere: } } - \str_if_eq:VnT \l__wa_type_col_str { c } \hfil - \str_if_eq:VnT \l__wa_type_col_str { r } \hfill - \int_gincr:N \g__wa_col_int - $ % $ + \str_if_eq:VnT \l__wi_type_col_str { c } \hfil + \str_if_eq:VnT \l__wi_type_col_str { r } \hfill + \int_gincr:N \g__wi_col_int + \int_gset:Nn \g__wi_static_col_int { \int_use:N \g__wi_col_int } + \c_math_toggle_token { { } - \bool_if:NT \l__wa_displaystyle_bool \displaystyle + \bool_if:NT \l__wi_displaystyle_bool \displaystyle #### } - $ % $ - \bool_if:NTF \l__wa_last_col_bool - { \__wa_construct_nodes: } + \c_math_toggle_token + \int_compare:nNnTF \g__wi_col_int = \l__wi_nb_cols_int + { \__wi_construct_nodes: } { - \str_if_eq:VnT \l__wa_type_col_str { l } \hfil - \str_if_eq:VnT \l__wa_type_col_str { c } \hfil - \bool_if:NT \l__wa_in_DispWithArrows_bool { \tabskip = \c_zero_skip } + \str_if_eq:VnT \l__wi_type_col_str { l } \hfil + \str_if_eq:VnT \l__wi_type_col_str { c } \hfil + \bool_if:NT \l__wi_in_DispWithArrows_bool { \tabskip = \c_zero_skip } & } } } { - \bool_if:NTF \l__wa_in_WithArrows_bool + \bool_if:NTF \l__wi_in_WithArrows_bool { \ialign \bgroup } { - \halign to - \bool_if:NTF \l__wa_inlabel_bool \linewidth \displaywidth + \halign to \l__wi_linewidth_dim \bgroup - \bool_if:NT \l__wa_fleqn_bool - { \skip_horizontal:N \l__wa_mathindent_dim } + \bool_if:NT \l__wi_fleqn_bool + { \skip_horizontal:N \l__wi_mathindent_dim } + } + \int_gincr:N \g__wi_line_int + \int_gzero:N \g__wi_col_int + \tl_if_eq:NNF \l__wi_left_brace_tl \c_novalue_tl + { + \skip_horizontal:n + { \box_wd:N \l__wi_left_brace_box + \l__wi_delim_wd_dim } } - \int_gincr:N \g__wa_line_int - \int_gzero:N \g__wa_col_int \strut } } -\cs_new_protected:Npn \__wa_construct_nodes: +\cs_new_protected:Npn \__wi_construct_nodes: { \tikz [ remember~picture , overlay ] \node [ node~contents = { } , - __wa_node_style , - name = wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int - l , + __wi_node_style , + name = wa - \l__wi_prefix_str - \int_use:N \g__wi_line_int - l , alias = { - \str_if_empty:NF \l__wa_name_str - { \l__wa_name_str - \int_use:N \g__wa_line_int - l } + \str_if_empty:NF \l__wi_name_str + { \l__wi_name_str - \int_use:N \g__wi_line_int - l } } ] ; @@ -726,100 +791,111 @@ \node [ node~contents = { } , - __wa_node_style , - name = wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int - r , + __wi_node_style , + name = wa - \l__wi_prefix_str - \int_use:N \g__wi_line_int - r , alias = { - \str_if_empty:NF \l__wa_name_str - { \l__wa_name_str - \int_use:N \g__wa_line_int - r } + \str_if_empty:NF \l__wi_name_str + { \l__wi_name_str - \int_use:N \g__wi_line_int - r } } ] ; - \bool_if:NT \l__wa_show_node_names_bool + \bool_if:NT \l__wi_show_node_names_bool { \hbox_overlap_right:n - { \small wa - \l__wa_prefix_str - \int_use:N \g__wa_line_int - r } + { \small wa - \l__wi_prefix_str - \int_use:N \g__wi_line_int - r } } } \NewDocumentEnvironment { WithArrows } { ! O { } } { - \bool_set_true:N \l__wa_in_WithArrows_bool - \bool_set_false:N \l__wa_in_DispWithArrows_bool - \__wa_pre_halign:n { #1 } + \bool_set_true:N \l__wi_in_WithArrows_bool + \bool_set_false:N \l__wi_in_DispWithArrows_bool + \__wi_pre_halign:n { #1 } \if_mode_math: \else: - \__wa_error:n { WithArrows~outside~math~mode } + \__wi_error:n { WithArrows~outside~math~mode } \fi: - \int_case:nn \l__wa_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } + \int_case:nn \l__wi_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } \bgroup - \__wa_construct_halign: + \__wi_construct_halign: && - \__wa_error:n { Too~much~columns~in~WithArrows } - $ - \bool_if:NT \l__wa_displaystyle_bool \displaystyle + \__wi_error:n { Too~much~columns~in~WithArrows } + \c_math_toggle_token + \bool_if:NT \l__wi_displaystyle_bool \displaystyle { ## } - $ + \c_math_toggle_token \cr } { \\ \egroup \egroup - \__wa_post_halign: - \bool_if:NT \g__wa_footnote_bool { \end { savenotes } } + \__wi_post_halign: + \bool_if:NT \g__wi_footnote_bool { \end { savenotes } } } -\cs_new_protected:Npn \__wa_post_halign: +\cs_new_protected:Npn \__wi_post_halign: { - \cs_set:Npn \WithArrowsRightX { \g__wa_right_x_dim } - \int_compare:nNnT \g__wa_arrow_int > 0 \__wa_scan_arrows: + \cs_set:Npn \WithArrowsRightX { \g__wi_right_x_dim } + \int_compare:nNnT \g__wi_arrow_int > 0 \__wi_scan_arrows: \group_begin: - \tikzset { every~picture / .style = __wa_standard } - \cs_set:Npn \WithArrowsNbLines { \int_use:N \g__wa_line_int } - \cs_set_eq:NN \MultiArrow \__wa_MultiArrow:nn - \cs_set_eq:cN \l__wa_command_name_str \__wa_Arrow_code_after - \bool_set_true:N \l__wa_in_code_after_bool - \l__wa_code_after_tl + \tikzset { every~picture / .style = __wi_standard } + \cs_set:Npn \WithArrowsNbLines { \int_use:N \g__wi_line_int } + \cs_set_eq:NN \MultiArrow \__wi_MultiArrow:nn + \cs_set_eq:cN \l__wi_command_name_str \__wi_Arrow_code_after + \bool_set_true:N \l__wi_in_code_after_bool + \l__wi_code_after_tl \group_end: - \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl - \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl - \seq_gput_right:Nx \g__wa_position_in_the_tree_seq + \seq_gpop_right:NN \g__wi_position_in_the_tree_seq \l_tmpa_tl + \seq_gpop_right:NN \g__wi_position_in_the_tree_seq \l_tmpa_tl + \seq_gput_right:Nx \g__wi_position_in_the_tree_seq { \int_eval:n { \l_tmpa_tl + 1 } } - \int_compare:nNnT { \seq_count:N \g__wa_position_in_the_tree_seq } = 1 - { \int_gincr:N \g__wa_last_env_int } - \seq_gpop_right:NN \g__wa_arrow_int_seq \l_tmpa_tl - \int_gset:Nn \g__wa_arrow_int \l_tmpa_tl - \seq_gpop_right:NN \g__wa_line_int_seq \l_tmpa_tl - \int_gset:Nn \g__wa_line_int \l_tmpa_tl - \seq_gpop_right:NN \g__wa_col_int_seq \l_tmpa_tl - \int_gset:Nn \g__wa_col_int \l_tmpa_tl + \int_compare:nNnT { \seq_count:N \g__wi_position_in_the_tree_seq } = 1 + { \int_gincr:N \g__wi_last_env_int } + \seq_gpop_right:NN \g__wi_arrow_int_seq \l_tmpa_tl + \int_gset:Nn \g__wi_arrow_int \l_tmpa_tl + \seq_gpop_right:NN \g__wi_line_int_seq \l_tmpa_tl + \int_gset:Nn \g__wi_line_int \l_tmpa_tl + \seq_gpop_right:NN \g__wi_col_int_seq \l_tmpa_tl + \int_gset:Nn \g__wi_col_int \l_tmpa_tl } -\cs_new_protected:Npn \__wa_cr: +\cs_new_protected:Npn \__wi_cr: { \scan_stop: - \prg_replicate:nn { \l__wa_nb_of_columns_int - \g__wa_col_int } { & { } } + \int_compare:nNnF \g__wi_col_int = \g__wi_static_col_int + { \__wi_error:n { omit~probably~used } } + \prg_replicate:nn { \l__wi_nb_cols_int - \g__wi_static_col_int } { & { } } \group_align_safe_begin: - \peek_meaning_remove:NTF * \__wa_cr_i: \__wa_cr_i: + \peek_meaning_remove:NTF * \__wi_cr_i: \__wi_cr_i: + } +\cs_new_protected:Npn \__wi_cr_i: + { \peek_meaning:NTF [ \__wi_cr_ii: { \__wi_cr_ii: [ \c_zero_dim ] } } +\cs_new_protected:Npn \__wi_cr_ii: [ #1 ] + { + \peek_meaning_ignore_spaces:NTF \end + { + \__wi_cr_iii:n { #1 } + \__wi_analyze_end:Nn + } + { \__wi_cr_iii:n { #1 } } } -\cs_new_protected:Npn \__wa_cr_i: - { \peek_meaning:NTF [ \__wa_cr_ii: { \__wa_cr_ii: [ \c_zero_dim ] } } -\cs_new_protected:Npn \__wa_cr_ii: [ #1 ] +\cs_new_protected:Npn \__wi_cr_iii:n #1 { \group_align_safe_end: - \bool_if:NT \l__wa_in_DispWithArrows_bool + \bool_if:NT \l__wi_in_DispWithArrows_bool { - \clist_if_in:NnTF \l__wa_tags_clist { all } + \clist_if_in:NnTF \l__wi_tags_clist { all } { - \tl_if_empty:NT \l__wa_tag_tl { \int_gincr:N \c@equation } + \tl_if_empty:NT \l__wi_tag_tl { \int_gincr:N \c@equation } \cs_gset:Npx \g_tmpa_tl - { \tl_if_empty:NTF \l__wa_tag_tl \theequation \l__wa_tag_tl } - \seq_if_empty:NF \l__wa_labels_seq + { \tl_if_empty:NTF \l__wi_tag_tl \theequation \l__wi_tag_tl } + \seq_if_empty:NF \l__wi_labels_seq { \cs_set:Npx \@currentlabel { \p@equation \g_tmpa_tl } - \bool_if:NT \c__wa_hyperref_loaded_bool + \bool_if:NT \c__wi_hyperref_loaded_bool { \str_set:Nn \This@name { equation } \hyper@refstepcounter { equation } } - \bool_if:NT \c__wa_cleveref_loaded_bool + \bool_if:NT \c__wi_cleveref_loaded_bool { \cref@constructprefix { equation } \cref@result \protected@edef \cref@currentlabel @@ -833,56 +909,71 @@ \p@equation \g_tmpa_tl } } - \seq_map_function:NN \l__wa_labels_seq \__wa_old_label + \seq_map_function:NN \l__wi_labels_seq \__wi_old_label } - \__wa_save:N \l__wa_tag_star_bool - \__wa_save:N \l__wa_qedhere_bool - \bool_if:NT \l__wa_tag_next_line_bool + \__wi_save:N \l__wi_tag_star_bool + \__wi_save:N \l__wi_qedhere_bool + \bool_if:NT \l__wi_tag_next_line_bool { \openup -\jot - \bool_set_false:N \l__wa_tag_next_line_bool + \bool_set_false:N \l__wi_tag_next_line_bool \notag \\ & } & - \__wa_restore:N \l__wa_tag_star_bool - \__wa_restore:N \l__wa_qedhere_bool - \bool_if:NT \l__wa_qedhere_bool - { \hbox_overlap_left:n \__wa_qedhere_i: } + \__wi_restore:N \l__wi_tag_star_bool + \__wi_restore:N \l__wi_qedhere_bool + \bool_if:NT \l__wi_qedhere_bool + { \hbox_overlap_left:n \__wi_qedhere_i: } \cs_set_eq:NN \theequation \g_tmpa_tl - \bool_if:NT \l__wa_tag_star_bool + \bool_if:NT \l__wi_tag_star_bool { \cs_set_eq:NN \tagform@ \prg_do_nothing: } \hbox_overlap_left:n { - \bool_if:NF \c__wa_leqno_bool + \bool_if:NF \c__wi_leqno_bool { - \tikz [ __wa_standard ] - \coordinate ( \int_use:N \g__wa_line_int - v ) ; + \tikz [ __wi_standard ] + \coordinate ( \int_use:N \g__wi_line_int - v ) ; } \quad \@eqnnum } - \bool_if:NT \c__wa_leqno_bool + \bool_if:NT \c__wi_leqno_bool { - \tikz [ __wa_standard ] - \coordinate ( \int_use:N \g__wa_line_int - v ) ; + \tikz [ __wi_standard ] + \coordinate ( \int_use:N \g__wi_line_int - v ) ; } } { - \__wa_save:N \l__wa_qedhere_bool + \__wi_save:N \l__wi_qedhere_bool & - \__wa_restore:N \l__wa_qedhere_bool - \bool_if:NT \l__wa_qedhere_bool - { \hbox_overlap_left:n \__wa_qedhere_i: } - \tikz [ __wa_standard ] - \coordinate ( \int_use:N \g__wa_line_int - v ) ; + \__wi_restore:N \l__wi_qedhere_bool + \bool_if:NT \l__wi_qedhere_bool + { \hbox_overlap_left:n \__wi_qedhere_i: } + \tikz [ __wi_standard ] + \coordinate ( \int_use:N \g__wi_line_int - v ) ; } } - \cr \noalign { \skip_vertical:n { #1 + \l__wa_interline_skip } \scan_stop: } + \dim_compare:nNnT { #1 } < \c_zero_dim + { \__wi_error:n { option~of~cr~negative } } + \dim_set:Nn \l_tmpa_dim { \dim_max:nn { #1 } \c_zero_dim } + \cr + \noalign + { + \skip_vertical:n { \l_tmpa_dim + \l__wi_interline_skip } + \scan_stop: + } } -\bool_new:N \l__wa_inlabel_bool -\NewDocumentEnvironment { DispWithArrows } { ! O { } } +\cs_new_protected:Npn \__wi_analyze_end:Nn #1 #2 { - \bool_if:nT \c__wa_mathtools_loaded_bool + \exp_args:NV \str_if_eq:nnT \l__wi_type_env_str { #2 } + { \__wi_warning:n { newline~at~the~end~of~env } } + \end { #2 } + } +\bool_new:N \l__wi_in_label_or_minipage_bool +\NewDocumentEnvironment { DispWithArrows } { ! d < > ! O { } } + { + \bool_set_true:N \l__wi_in_DispWithArrows_bool + \bool_if:nT \c__wi_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } { @@ -890,77 +981,150 @@ \MH_set_boolean_T:n { show_only_refs } } } - \bool_if:NT \c__wa_typedref_loaded_bool { \str_set:Nn \sr@name { equation } } - \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ - \bool_set_true:N \l__wa_in_DispWithArrows_bool - \__wa_pre_halign:n { #1 } - \bool_if:NF \l__wa_sbwi_bool + \bool_if:NT \c__wi_typedref_loaded_bool { \str_set:Nn \sr@name { equation } } + \bool_if:NT \c__wi_amsmath_loaded_bool \intertext@ + \IfValueT { #1 } { \tl_set:Nn \l__wi_left_brace_tl { #1 } } + \__wi_pre_halign:n { #2 } + \bool_if:NT \l__wi_subequations_bool { \begin { subequations } } + \bool_if:NF \l__wi_sbwi_bool { \if@inlabel - \bool_set_true:N \l__wa_inlabel_bool + \bool_set_true:N \l__wi_in_label_or_minipage_bool + \fi + \if@minipage + \bool_set_true:N \l__wi_in_label_or_minipage_bool \fi } - \tl_clear_new:N \l__wa_tag_tl - \bool_set_false:N \l__wa_qedhere_bool - \bool_set_false:N \l__wa_tag_star_bool + \tl_if_eq:NNF \l__wi_left_brace_tl \c_novalue_tl + { + \hbox_set:Nn \l_tmpa_box + { + \c_math_toggle_token + \left \l__wi_replace_left_brace_by_tl \vcenter to 1 cm { } \right. + \c_math_toggle_token + } + \dim_zero_new:N \l__wi_delim_wd_dim + \dim_set:Nn \l__wi_delim_wd_dim { \box_wd:N \l_tmpa_box } + \box_clear_new:N \l__wi_left_brace_box + \hbox_set:Nn \l__wi_left_brace_box + { + \group_begin: + \cs_set_eq:NN \label \__wi_old_label + \c_math_toggle_token + \bool_if:NT \l__wi_displaystyle_bool \displaystyle + \l__wi_left_brace_tl + { } + \c_math_toggle_token + \group_end: + } + } + \tl_clear_new:N \l__wi_tag_tl + \bool_set_false:N \l__wi_qedhere_bool + \bool_set_false:N \l__wi_tag_star_bool \if_mode_math: - \__wa_error:n { DispWithArrows~in~math~mode } + \__wi_fatal:n { DispWithArrows~in~math~mode } \fi: - \bool_if:NTF \l__wa_inlabel_bool - { $ } % $ + \bool_if:NTF \l__wi_in_label_or_minipage_bool + { \c_math_toggle_token } { \if_mode_vertical: \nointerlineskip \hbox_to_wd:nn { .6 \linewidth } { } \fi: - $$ + \c_math_toggle_token \c_math_toggle_token } - \vtop \bgroup - \bool_if:NTF \l__wa_fleqn_bool - { \tabskip = \c_zero_skip } - { \tabskip = 0 pt plus 1000 pt minus 1000 pt } - \__wa_construct_halign: + \dim_zero_new:N \l__wi_linewidth_dim + \bool_if:NTF \l__wi_in_label_or_minipage_bool + { \dim_set_eq:NN \l__wi_linewidth_dim \linewidth } + { \dim_set_eq:NN \l__wi_linewidth_dim \displaywidth } + \box_clear_new:N \l__wi_halign_box + \setbox \l__wi_halign_box \vtop \bgroup + \tabskip = + \bool_if:NTF \l__wi_fleqn_bool + \c_zero_skip + { 0 pt plus 1000 pt minus 1000 pt } + \__wi_construct_halign: \tabskip = 0 pt plus 1000 pt minus 1000 pt & $ ## $ \tabskip = \c_zero_skip && - \__wa_error:n { Too~much~columns~in~DispWithArrows } + \__wi_fatal:n { Too~much~columns~in~DispWithArrows } \bool_if:nT \c_false_bool { ## } \cr } { - \clist_if_in:NnT \l__wa_tags_clist { last } - { \clist_set:Nn \l__wa_tags_clist { all } } + \clist_if_in:NnT \l__wi_tags_clist { last } + { \clist_set:Nn \l__wi_tags_clist { all } } \\ \egroup + \unskip \unpenalty \unskip \unpenalty + \box_set_to_last:N \l_tmpa_box + \nointerlineskip + \box_use:N \l_tmpa_box + \dim_gzero_new:N \g__wi_alignment_dim + \dim_gset:Nn \g__wi_alignment_dim { \box_wd:N \l_tmpa_box } + \box_clear_new:N \l__wi_new_box + \hbox_set:Nn \l__wi_new_box { \hbox_unpack_clear:N \l_tmpa_box } + \dim_compare:nNnT + { \box_wd:N \l__wi_new_box } < \g__wi_alignment_dim + { \dim_gset:Nn \g__wi_alignment_dim { \box_wd:N \l__wi_new_box } } \egroup - \dim_gzero_new:N \g__wa_right_x_dim - \dim_gset_eq:NN \g__wa_right_x_dim \c_max_dim - \begin { tikzpicture } [ __wa_standard ] - \int_step_variable:nNn \g__wa_line_int \l_tmpa_int + \tl_if_eq:NNTF \l__wi_left_brace_tl \c_novalue_tl + { \box_use_drop:N \l__wi_halign_box } + { + \hbox_to_wd:nn \l__wi_linewidth_dim + { + \bool_if:NTF \l__wi_fleqn_bool + { \skip_horizontal:n \l__wi_mathindent_dim } + \hfil + \hbox_to_wd:nn \g__wi_alignment_dim + { + \box_use_drop:N \l__wi_left_brace_box + \dim_set:Nn \l_tmpa_dim + { + \box_ht:N \l__wi_halign_box + + \box_dp:N \l__wi_halign_box + } + \c_math_toggle_token + \left \l__wi_replace_left_brace_by_tl + \vcenter to \l_tmpa_dim { \vfil } + \right. + \c_math_toggle_token + \hfil + } + \hfil + } + \skip_horizontal:n { - \l__wi_linewidth_dim } + \vcenter { \box_use_drop:N \l__wi_halign_box } + } + \dim_gzero_new:N \g__wi_right_x_dim + \dim_gset_eq:NN \g__wi_right_x_dim \c_max_dim + \begin { tikzpicture } [ __wi_standard ] + \int_step_variable:nNn \g__wi_line_int \l_tmpa_int { \cs_if_free:cTF - { pgf@sh@ns@wa - \l__wa_prefix_str - \l_tmpa_int - v } - { \__wa_error:n { Inexistent~v-node } } + { pgf@sh@ns@wa - \l__wi_prefix_str - \l_tmpa_int - v } + { \__wi_fatal:n { Inexistent~v-node } } { \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v ) \dim_set:Nn \l_tmpa_dim \pgf@x - \dim_compare:nNnT \l_tmpa_dim < \g__wa_right_x_dim - { \dim_gset:Nn \g__wa_right_x_dim \l_tmpa_dim } + \dim_compare:nNnT \l_tmpa_dim < \g__wi_right_x_dim + { \dim_gset:Nn \g__wi_right_x_dim \l_tmpa_dim } } } \end { tikzpicture } - \__wa_post_halign: - \bool_if:nT \c__wa_mathtools_loaded_bool + \__wi_post_halign: + \bool_if:nT \c__wi_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: } - \bool_if:NTF \l__wa_inlabel_bool + \bool_if:NTF \l__wi_in_label_or_minipage_bool { - $ % $ + \c_math_toggle_token \skip_vertical:N \belowdisplayskip } - { $$ } - \bool_if:NT \g__wa_footnote_bool { \end {savenotes } } + { \c_math_toggle_token \c_math_toggle_token } + \bool_if:NT \l__wi_subequations_bool { \end { subequations } } + \bool_if:NT \g__wi_footnote_bool { \end { savenotes } } \ignorespacesafterend } \NewDocumentEnvironment { DispWithArrows* } { } @@ -969,75 +1133,77 @@ \DispWithArrows } \endDispWithArrows -\cs_new_protected:Npn \__wa_if_in_last_col_of_disp:Nn #1 #2 +\cs_new_protected:Npn \__wi_if_in_last_col_of_disp:Nn #1 #2 { - \bool_if:NTF \l__wa_in_WithArrows_bool - { \__wa_error:nn { Not~allowed~in~WithArrows } { #1 } } + \bool_if:NTF \l__wi_in_WithArrows_bool + { \__wi_error:nn { Not~allowed~in~WithArrows } { #1 } } { - \int_compare:nNnTF \g__wa_col_int < \l__wa_nb_of_columns_int - { \__wa_error:nn { Not~allowed~in~DispWithArrows } { #1 } } + \int_compare:nNnTF \g__wi_col_int < \l__wi_nb_cols_int + { \__wi_error:nn { Not~allowed~in~DispWithArrows } { #1 } } { #2 } } } -\cs_new_protected:Npn \__wa_notag: - { \__wa_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l__wa_tags_clist } } -\NewDocumentCommand \__wa_tag { s m } +\cs_new_protected:Npn \__wi_notag: + { \__wi_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l__wi_tags_clist } } +\cs_new_protected:Npn \__wi_nonumber: + { \__wi_if_in_last_col_of_disp:Nn \nonumber { \clist_clear:N \l__wi_tags_clist } } +\NewDocumentCommand \__wi_tag { s m } { - \__wa_if_in_last_col_of_disp:Nn \tag + \__wi_if_in_last_col_of_disp:Nn \tag { - \tl_if_empty:NF \l__wa_tag_tl - { \__wa_error:nn { Multiple~tags } { #2 } } - \clist_set:Nn \l__wa_tags_clist { all } - \bool_if:nT \c__wa_mathtools_loaded_bool + \tl_if_empty:NF \l__wi_tag_tl + { \__wi_error:nn { Multiple~tags } { #2 } } + \clist_set:Nn \l__wi_tags_clist { all } + \bool_if:nT \c__wi_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } { \MH_if_boolean:nF { show_manual_tags } - { \clist_clear:N \l__wa_tags_clist } + { \clist_clear:N \l__wi_tags_clist } } } - \tl_set:Nn \l__wa_tag_tl { #2 } - \bool_set:Nn \l__wa_tag_star_bool { #1 } - \bool_if:nT { #1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool } - { \__wa_error:n { tag*~without~amsmath } } + \tl_set:Nn \l__wi_tag_tl { #2 } + \bool_set:Nn \l__wi_tag_star_bool { #1 } + \bool_if:nT { #1 && ! \bool_if_p:N \c__wi_amsmath_loaded_bool } + { \__wi_error:n { tag*~without~amsmath } } } } -\cs_new_protected:Npn \__wa_label:n #1 +\cs_new_protected:Npn \__wi_label:n #1 { - \__wa_if_in_last_col_of_disp:Nn \label + \__wi_if_in_last_col_of_disp:Nn \label { - \seq_if_empty:NF \l__wa_labels_seq + \seq_if_empty:NF \l__wi_labels_seq { - \bool_if:NTF \c__wa_cleveref_loaded_bool - { \__wa_error:n { Multiple~labels~with~cleveref } } - { \__wa_error:n { Multiple~labels } } + \bool_if:NTF \c__wi_cleveref_loaded_bool + { \__wi_error:n { Multiple~labels~with~cleveref } } + { \__wi_error:n { Multiple~labels } } } - \seq_put_right:Nn \l__wa_labels_seq { #1 } - \bool_if:nT \c__wa_mathtools_loaded_bool + \seq_put_right:Nn \l__wi_labels_seq { #1 } + \bool_if:nT \c__wi_mathtools_loaded_bool { \MH_if_boolean:nT { show_only_refs } { \cs_if_exist:cTF { MT_r_#1 } - { \clist_set:Nn \l__wa_tags_clist { all } } - { \clist_clear:N \l__wa_tags_clist } + { \clist_set:Nn \l__wi_tags_clist { all } } + { \clist_clear:N \l__wi_tags_clist } } } - \bool_if:nT \c__wa_autonum_loaded_bool + \bool_if:nT \c__wi_autonum_loaded_bool { \cs_if_exist:cTF { autonum@#1Referenced } - { \clist_set:Nn \l__wa_tags_clist { all } } - { \clist_clear:N \l__wa_tags_clist } + { \clist_set:Nn \l__wi_tags_clist { all } } + { \clist_clear:N \l__wi_tags_clist } } } } -\cs_new_protected:Npn \__wa_tagnextline: +\cs_new_protected:Npn \__wi_tagnextline: { - \__wa_if_in_last_col_of_disp:Nn \tagnextline - { \bool_set_true:N \l__wa_tag_next_line_bool } + \__wi_if_in_last_col_of_disp:Nn \tagnextline + { \bool_set_true:N \l__wi_tag_next_line_bool } } -\cs_new_protected:Npn \__wa_qedhere: { \bool_set_true:N \l__wa_qedhere_bool } -\cs_new_protected:Npn \__wa_set_qedhere: { \cs_set_eq:NN \qedhere \__wa_qedhere: } -\cs_new_protected:Npn \__wa_qedhere_i: +\cs_new_protected:Npn \__wi_qedhere: { \bool_set_true:N \l__wi_qedhere_bool } +\cs_new_protected:Npn \__wi_set_qedhere: { \cs_set_eq:NN \qedhere \__wi_qedhere: } +\cs_new_protected:Npn \__wi_qedhere_i: { \group_begin: \cs_set_eq:NN \qed \qedsymbol @@ -1045,245 +1211,246 @@ \QED@stack \relax \relax \group_end: } -\cs_new_protected:Npn \__wa_scan_arrows: +\cs_new_protected:Npn \__wi_scan_arrows: { \group_begin: - \int_compare:nNnT \l__wa_pos_arrow_int = 7 + \int_compare:nNnT \l__wi_pos_arrow_int = 7 { - \__wa_scan_arrows_i: - \int_set:Nn \l__wa_pos_arrow_int 8 + \__wi_scan_arrows_i: + \int_set:Nn \l__wi_pos_arrow_int 8 } - \__wa_scan_arrows_i: + \__wi_scan_arrows_i: \group_end: } -\cs_new_protected:Npn \__wa_scan_arrows_i: +\cs_new_protected:Npn \__wi_scan_arrows_i: { - \int_zero_new:N \l__wa_first_arrow_of_group_int - \int_zero_new:N \l__wa_first_line_of_group_int - \int_zero_new:N \l__wa_last_line_of_group_int - \seq_clear_new:N \l__wa_first_arrows_seq - \seq_clear_new:N \l__wa_last_arrows_seq - \bool_set_true:N \l__wa_new_group_bool - \int_set:Nn \l__wa_arrow_int \c_one_int - \int_until_do:nNnn \l__wa_arrow_int > \g__wa_arrow_int + \int_zero_new:N \l__wi_first_arrow_of_group_int + \int_zero_new:N \l__wi_first_line_of_group_int + \int_zero_new:N \l__wi_last_line_of_group_int + \seq_clear_new:N \l__wi_first_arrows_seq + \seq_clear_new:N \l__wi_last_arrows_seq + \bool_set_true:N \l__wi_new_group_bool + \int_set:Nn \l__wi_arrow_int \c_one_int + \int_until_do:nNnn \l__wi_arrow_int > \g__wi_arrow_int { \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } { initial } \l_tmpa_tl - \int_set:Nn \l__wa_initial_int \l_tmpa_tl + \int_set:Nn \l__wi_initial_int \l_tmpa_tl \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } { final } \l_tmpa_tl - \int_set:Nn \l__wa_final_int \l_tmpa_tl + \int_set:Nn \l__wi_final_int \l_tmpa_tl \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } - { status } \l__wa_status_arrow_str + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } + { status } \l__wi_status_arrow_str \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } - { input-line } \l__wa_input_line_str - \int_compare:nNnTF \l__wa_final_int > \g__wa_line_int + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } + { input-line } \l__wi_input_line_str + \int_compare:nNnTF \l__wi_final_int > \g__wi_line_int { - \int_compare:nNnF \l__wa_pos_arrow_int = 8 - { \__wa_error:n { Too~few~lines~for~an~arrow } } + \int_compare:nNnF \l__wi_pos_arrow_int = 8 + { \__wi_error:n { Too~few~lines~for~an~arrow } } } - \__wa_code_for_possible_arrow: - \int_incr:N \l__wa_arrow_int + \__wi_code_for_possible_arrow: + \int_incr:N \l__wi_arrow_int } \bool_if:nT { - \int_compare_p:n { \l__wa_pos_arrow_int != 7 } + \int_compare_p:n { \l__wi_pos_arrow_int != 7 } && - \int_compare_p:nNn \l__wa_first_arrow_of_group_int > 0 + \int_compare_p:nNn \l__wi_first_arrow_of_group_int > 0 } - { \__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int \g__wa_arrow_int } + { \__wi_draw_arrows:nn \l__wi_first_arrow_of_group_int \g__wi_arrow_int } } -\cs_new_protected:Npn \__wa_code_for_possible_arrow: +\cs_new_protected:Npn \__wi_code_for_possible_arrow: { \bool_if:nT { - \int_compare_p:nNn \l__wa_arrow_int > \c_one_int + \int_compare_p:nNn \l__wi_arrow_int > \c_one_int && - ( \int_compare_p:n { \l__wa_initial_int > \l__wa_last_line_of_group_int } + ( \int_compare_p:n { \l__wi_initial_int > \l__wi_last_line_of_group_int } && - \int_compare_p:n { \l__wa_pos_arrow_int != 7 } + \int_compare_p:n { \l__wi_pos_arrow_int != 7 } || - \str_if_eq_p:Vn \l__wa_status_arrow_str { new-group } + \str_if_eq_p:Vn \l__wi_status_arrow_str { new-group } ) } { - \int_compare:nNnF \l__wa_first_arrow_of_group_int = \c_zero_int + \int_compare:nNnF \l__wi_first_arrow_of_group_int = \c_zero_int { - \__wa_draw_arrows:nn - \l__wa_first_arrow_of_group_int - { \l__wa_arrow_int - 1 } + \__wi_draw_arrows:nn + \l__wi_first_arrow_of_group_int + { \l__wi_arrow_int - 1 } } - \bool_set_true:N \l__wa_new_group_bool + \bool_set_true:N \l__wi_new_group_bool } - \bool_if:nTF \l__wa_new_group_bool + \bool_if:nTF \l__wi_new_group_bool { - \bool_set_false:N \l__wa_new_group_bool - \int_set_eq:NN \l__wa_first_arrow_of_group_int \l__wa_arrow_int - \int_set_eq:NN \l__wa_first_line_of_group_int \l__wa_initial_int - \int_set_eq:NN \l__wa_last_line_of_group_int \l__wa_final_int - \seq_clear:N \l__wa_first_arrows_seq - \seq_put_left:NV \l__wa_first_arrows_seq \l__wa_arrow_int - \seq_clear:N \l__wa_last_arrows_seq - \seq_put_left:NV \l__wa_last_arrows_seq \l__wa_arrow_int - \int_compare:nT { \l__wa_pos_arrow_int != 8 } - { \dim_set:Nn \l__wa_x_dim { - \c_max_dim } } + \bool_set_false:N \l__wi_new_group_bool + \int_set_eq:NN \l__wi_first_arrow_of_group_int \l__wi_arrow_int + \int_set_eq:NN \l__wi_first_line_of_group_int \l__wi_initial_int + \int_set_eq:NN \l__wi_last_line_of_group_int \l__wi_final_int + \seq_clear:N \l__wi_first_arrows_seq + \seq_put_left:NV \l__wi_first_arrows_seq \l__wi_arrow_int + \seq_clear:N \l__wi_last_arrows_seq + \seq_put_left:NV \l__wi_last_arrows_seq \l__wi_arrow_int + \int_compare:nT { \l__wi_pos_arrow_int != 8 } + { \dim_set:Nn \l__wi_x_dim { - \c_max_dim } } } { \bool_if:nF - { \str_if_eq_p:Vn \l__wa_status_arrow_str { independent } } + { \str_if_eq_p:Vn \l__wi_status_arrow_str { independent } } { \int_compare:nT - { \l__wa_initial_int = \l__wa_first_line_of_group_int } - { \seq_put_left:NV \l__wa_first_arrows_seq \l__wa_arrow_int } - \int_compare:nNnTF \l__wa_final_int > \l__wa_last_line_of_group_int + { \l__wi_initial_int = \l__wi_first_line_of_group_int } + { \seq_put_left:NV \l__wi_first_arrows_seq \l__wi_arrow_int } + \int_compare:nNnTF \l__wi_final_int > \l__wi_last_line_of_group_int { - \int_set_eq:NN \l__wa_last_line_of_group_int \l__wa_final_int - \seq_clear:N \l__wa_last_arrows_seq - \seq_put_left:NV \l__wa_last_arrows_seq \l__wa_arrow_int + \int_set_eq:NN \l__wi_last_line_of_group_int \l__wi_final_int + \seq_clear:N \l__wi_last_arrows_seq + \seq_put_left:NV \l__wi_last_arrows_seq \l__wi_arrow_int } { - \int_compare:nNnT \l__wa_final_int = \l__wa_last_line_of_group_int - { \seq_put_left:NV \l__wa_last_arrows_seq \l__wa_arrow_int } + \int_compare:nNnT \l__wi_final_int = \l__wi_last_line_of_group_int + { \seq_put_left:NV \l__wi_last_arrows_seq \l__wi_arrow_int } } } } - \bool_if:nF { \str_if_eq_p:Vn \l__wa_status_arrow_str { independent } } + \bool_if:nF { \str_if_eq_p:Vn \l__wi_status_arrow_str { independent } } { - \int_compare:nT { \l__wa_pos_arrow_int != 8 } - { \__wa_update_x:nn \l__wa_initial_int \l__wa_final_int } + \int_compare:nT { \l__wi_pos_arrow_int != 8 } + { \__wi_update_x:nn \l__wi_initial_int \l__wi_final_int } } } \cs_generate_variant:Nn \keys_set:nn { n o } -\cs_new_protected:Npn \__wa_keys_set: +\cs_new_protected:Npn \__wi_keys_set: { \keys_set_known:no { WithArrows / Arrow / SecondPass } } -\cs_new_protected:Npn \__wa_draw_arrows:nn #1 #2 +\cs_new_protected:Npn \__wi_draw_arrows:nn #1 #2 { \group_begin: - \int_zero_new:N \l__wa_first_arrow_int - \int_set:Nn \l__wa_first_arrow_int { #1 } - \int_zero_new:N \l__wa_last_arrow_int - \int_set:Nn \l__wa_last_arrow_int { #2 } - \int_set:Nn \l__wa_arrow_int \l__wa_first_arrow_int - \int_until_do:nNnn \l__wa_arrow_int > \l__wa_last_arrow_int + \int_zero_new:N \l__wi_first_arrow_int + \int_set:Nn \l__wi_first_arrow_int { #1 } + \int_zero_new:N \l__wi_last_arrow_int + \int_set:Nn \l__wi_last_arrow_int { #2 } + \int_set:Nn \l__wi_arrow_int \l__wi_first_arrow_int + \int_until_do:nNnn \l__wi_arrow_int > \l__wi_last_arrow_int { \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } { initial } \l_tmpa_tl - \int_set:Nn \l__wa_initial_int \l_tmpa_tl + \int_set:Nn \l__wi_initial_int \l_tmpa_tl \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } { final } \l_tmpa_tl - \int_set:Nn \l__wa_final_int \l_tmpa_tl - \int_compare:nT { \l__wa_final_int <= \g__wa_line_int } \__wa_draw_arrows_i: - \int_incr:N \l__wa_arrow_int + \int_set:Nn \l__wi_final_int \l_tmpa_tl + \int_compare:nT { \l__wi_final_int <= \g__wi_line_int } \__wi_draw_arrows_i: + \int_incr:N \l__wi_arrow_int } \group_end: } -\cs_new_protected:Npn \__wa_draw_arrows_i: +\cs_new_protected:Npn \__wi_draw_arrows_i: { \group_begin: \prop_get:cnN - { g__wa_arrow _\l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } + { g__wi_arrow _\l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } { options } \l_tmpa_tl - \str_clear_new:N \l__wa_previous_key_str + \str_clear_new:N \l__wi_previous_key_str \exp_args:NNo \exp_args:No - \__wa_keys_set: { \l_tmpa_tl , tikz = { xshift = \l__wa_xoffset_dim } } - \bool_set_false:N \l__wa_initial_r_bool - \bool_set_false:N \l__wa_final_r_bool - \int_case:nn \l__wa_pos_arrow_int + \__wi_keys_set: { \l_tmpa_tl , tikz = { xshift = \l__wi_xoffset_dim } } + \bool_set_false:N \l__wi_initial_r_bool + \bool_set_false:N \l__wi_final_r_bool + \int_case:nn \l__wi_pos_arrow_int { - 0 { \bool_set_true:N \l__wa_final_r_bool } - 2 { \bool_set_true:N \l__wa_initial_r_bool } + 0 { \bool_set_true:N \l__wi_final_r_bool } + 2 { \bool_set_true:N \l__wi_initial_r_bool } 3 { - \bool_set_true:N \l__wa_initial_r_bool - \bool_set_true:N \l__wa_final_r_bool + \bool_set_true:N \l__wi_initial_r_bool + \bool_set_true:N \l__wi_final_r_bool } } - \int_compare:nNnT \l__wa_pos_arrow_int = 5 + \int_compare:nNnT \l__wi_pos_arrow_int = 5 { - \dim_set:Nn \l__wa_x_dim { - \c_max_dim } - \__wa_update_x:nn \l__wa_initial_int \l__wa_final_int + \dim_set:Nn \l__wi_x_dim { - \c_max_dim } + \__wi_update_x:nn \l__wi_initial_int \l__wi_final_int } - \tl_set:Nx \l__wa_initial_tl + \tl_set:Nx \l__wi_initial_tl { - \int_use:N \l__wa_initial_int - \bool_if:NTF \l__wa_initial_r_bool rl + \int_use:N \l__wi_initial_int - \bool_if:NTF \l__wi_initial_r_bool rl .south } - \tl_set:Nx \l__wa_final_tl - { \int_use:N \l__wa_final_int - \bool_if:NTF \l__wa_final_r_bool rl .north } + \tl_set:Nx \l__wi_final_tl + { \int_use:N \l__wi_final_int - \bool_if:NTF \l__wi_final_r_bool rl .north } \prop_get:cnN - { g__wa_arrow _ \l__wa_prefix_str _ \int_use:N \l__wa_arrow_int _ prop } + { g__wi_arrow _ \l__wi_prefix_str _ \int_use:N \l__wi_arrow_int _ prop } { label } \l_tmpa_tl - \seq_if_in:NxTF \l__wa_first_arrows_seq - { \int_use:N \l__wa_arrow_int } + \seq_if_in:NxTF \l__wi_first_arrows_seq + { \int_use:N \l__wi_arrow_int } { \bool_set_true:N \l_tmpa_bool } { \bool_set_false:N \l_tmpa_bool } - \seq_if_in:NxTF \l__wa_last_arrows_seq - { \int_use:N \l__wa_arrow_int } + \seq_if_in:NxTF \l__wi_last_arrows_seq + { \int_use:N \l__wi_arrow_int } { \bool_set_true:N \l_tmpb_bool } { \bool_set_false:N \l_tmpb_bool } - \int_compare:nNnT \l__wa_pos_arrow_int = 5 + \int_compare:nNnT \l__wi_pos_arrow_int = 5 { \bool_set_true:N \l_tmpa_bool \bool_set_true:N \l_tmpb_bool } - \begin { tikzpicture } [ __wa_standard ] - \tikz@scan@one@point \pgfutil@firstofone ( \l__wa_initial_tl ) + \begin { tikzpicture } [ __wi_standard ] + \tikz@scan@one@point \pgfutil@firstofone ( \l__wi_initial_tl ) \tl_gset:Nx \g_tmpa_tl { - \int_compare:nNnTF \l__wa_pos_arrow_int < 5 + \int_compare:nNnTF \l__wi_pos_arrow_int < 5 { \dim_use:N \pgf@x } - { \dim_use:N \l__wa_x_dim } , + { \dim_use:N \l__wi_x_dim } , \bool_if:NTF \l_tmpa_bool - { \dim_eval:n { \pgf@y + \l__wa_start_adjust_dim } } + { \dim_eval:n { \pgf@y + \l__wi_start_adjust_dim } } { \dim_use:N \pgf@y } } - \tikz@scan@one@point \pgfutil@firstofone ( \l__wa_final_tl ) + \tikz@scan@one@point \pgfutil@firstofone ( \l__wi_final_tl ) \tl_gset:Nx \g_tmpb_tl { - \int_compare:nNnTF \l__wa_pos_arrow_int < 5 + \int_compare:nNnTF \l__wi_pos_arrow_int < 5 { \dim_use:N \pgf@x } - { \dim_use:N \l__wa_x_dim } , + { \dim_use:N \l__wi_x_dim } , \bool_if:NTF \l_tmpb_bool - { \dim_eval:n { \pgf@y - \l__wa_end_adjust_dim } } + { \dim_eval:n { \pgf@y - \l__wi_end_adjust_dim } } { \dim_use:N \pgf@y } } \end { tikzpicture } - \__wa_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl + \__wi_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl \group_end: } -\cs_new_protected:Npn \__wa_def_function_tmpa:n #1 +\cs_new_protected:Npn \__wi_def_function_tmpa:n #1 { - \cs_set:Npn \__wa_tmpa:nnn ##1 ##2 ##3 + \cs_set:Npn \__wi_tmpa:nnn ##1 ##2 ##3 { \begin{tikzpicture} [ - __wa_standard , + __wi_standard , every~path / .style = WithArrows / arrow ] #1 \end{tikzpicture} } } -\cs_new_protected:Npn \__wa_draw_arrow:nnn #1 #2 #3 +\cs_new_protected:Npn \__wi_draw_arrow:nnn #1 #2 #3 { - \bool_if:nT { \l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool } - { \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_wrap_lines_tl } - \exp_args:NV \__wa_def_function_tmpa:n \l__wa_tikz_code_tl - \__wa_tmpa:nnn { #1 } { #2 } { #3 } + \bool_if:nT { \l__wi_wrap_lines_bool && \l__wi_in_DispWithArrows_bool } + { \tl_set_eq:NN \l__wi_tikz_code_tl \c__wi_tikz_code_wrap_lines_tl } + \exp_args:NV \__wi_def_function_tmpa:n \l__wi_tikz_code_tl + \__wi_tmpa:nnn { #1 } { #2 } { #3 } } -\cs_generate_variant:Nn \__wa_draw_arrow:nnn { n n o } -\tl_const:Nn \c__wa_tikz_code_wrap_lines_tl +\cs_generate_variant:Nn \__wi_draw_arrow:nnn { n n o } +\tl_const:Nn \c__wi_tikz_code_wrap_lines_tl { - \draw ( #1 ) to node ( __wa_label ) { } ( #2 ) ; - \tikz@parse@node \pgfutil@firstofone ( __wa_label.west ) - \dim_set:Nn \l_tmpa_dim { \g__wa_right_x_dim - \pgf@x - 0.3333 em } + \draw ( #1 ) to node ( __wi_label ) { } ( #2 ) ; + \tikz@parse@node \pgfutil@firstofone ( __wi_label.west ) + \dim_set:Nn \l_tmpa_dim + { \g__wi_right_x_dim - \pgf@x - \pgfkeysvalueof { / pgf / inner~xsep } } \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; \tl_if_empty:NF \g_tmpa_tl { @@ -1293,79 +1460,80 @@ } \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim { - \path ( __wa_label.west ) + \path ( __wi_label.west ) node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ] { #3 } ; } } -\cs_new_protected:Npn \__wa_update_x:nn #1 #2 +\cs_new_protected:Npn \__wi_update_x:nn #1 #2 { \int_step_inline:nnn { #1 } { #2 } { - \begin { tikzpicture } [ __wa_standard ] + \begin { tikzpicture } [ __wi_standard ] \tikz@scan@one@point \pgfutil@firstofone ( ##1 - l ) - \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \l__wa_x_dim \pgf@x } + \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \l__wi_x_dim \pgf@x } \end { tikzpicture } - \dim_set_eq:NN \l__wa_x_dim \g_tmpa_dim + \dim_set_eq:NN \l__wi_x_dim \g_tmpa_dim } } -\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__wa_last_env_int } +\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__wi_last_env_int } \keys_define:nn { WithArrows / Arrow / code-after } { tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , tikz .value_required:n = true , rr .value_forbidden:n = true , - rr .code:n = \__wa_fix_pos_option:n 0 , + rr .code:n = \__wi_fix_pos_option:n 0 , ll .value_forbidden:n = true, - ll .code:n = \__wa_fix_pos_option:n 1 , + ll .code:n = \__wi_fix_pos_option:n 1 , rl .value_forbidden:n = true , - rl .code:n = \__wa_fix_pos_option:n 2 , + rl .code:n = \__wi_fix_pos_option:n 2 , lr .value_forbidden:n = true , - lr .code:n = \__wa_fix_pos_option:n 3 , + lr .code:n = \__wi_fix_pos_option:n 3 , v .value_forbidden:n = true , - v .code:n = \__wa_fix_pos_option:n 4 , - tikz-code .tl_set:N = \l__wa_tikz_code_tl , + v .code:n = \__wi_fix_pos_option:n 4 , + tikz-code .tl_set:N = \l__wi_tikz_code_tl , tikz-code .value_required:n = true , - xoffset .dim_set:N = \l__wa_xoffset_dim , + xoffset .dim_set:N = \l__wi_xoffset_dim , xoffset .value_required:n = true , unknown .code:n = - \__wa_sort_seq:N \l__wa_options_Arrow_code_after_seq - \__wa_error:n { Unknown~option~Arrow~in~code-after } + \__wi_sort_seq:N \l__wi_options_Arrow_code_after_seq + \__wi_error:n { Unknown~option~Arrow~in~code-after } } -\seq_new:N \l__wa_options_Arrow_code_after_seq -\seq_set_from_clist:Nn \l__wa_options_Arrow_code_after_seq +\seq_new:N \l__wi_options_Arrow_code_after_seq +\__wi_set_seq_of_str_from_clist:Nn \l__wi_options_Arrow_code_after_seq { ll, lr, rl, rr, tikz, tikz-code, v, x, offset } -\NewDocumentCommand \__wa_Arrow_code_after { O { } m m m ! O { } } +\NewDocumentCommand \__wi_Arrow_code_after { O { } m m m ! O { } } { - \int_set:Nn \l__wa_pos_arrow_int 1 - \str_clear_new:N \l__wa_previous_key_str + \int_set:Nn \l__wi_pos_arrow_int 1 + \str_clear_new:N \l__wi_previous_key_str \group_begin: \keys_set:nn { WithArrows / Arrow / code-after } - { #1, #5, tikz = { xshift = \l__wa_xoffset_dim } } - \bool_set_false:N \l__wa_initial_r_bool - \bool_set_false:N \l__wa_final_r_bool - \int_case:nn \l__wa_pos_arrow_int - { 0 + { #1, #5, tikz = { xshift = \l__wi_xoffset_dim } } + \bool_set_false:N \l__wi_initial_r_bool + \bool_set_false:N \l__wi_final_r_bool + \int_case:nn \l__wi_pos_arrow_int + { + 0 { - \bool_set_true:N \l__wa_initial_r_bool - \bool_set_true:N \l__wa_final_r_bool + \bool_set_true:N \l__wi_initial_r_bool + \bool_set_true:N \l__wi_final_r_bool } - 2 { \bool_set_true:N \l__wa_initial_r_bool } - 3 { \bool_set_true:N \l__wa_final_r_bool } + 2 { \bool_set_true:N \l__wi_initial_r_bool } + 3 { \bool_set_true:N \l__wi_final_r_bool } } \tl_if_eq:nnTF { #2 } { #3 } - { \__wa_error:nn { Both~lines~are~equal } { #2 } } + { \__wi_error:nn { Both~lines~are~equal } { #2 } } { - \cs_if_free:cTF { pgf@sh@ns@wa - \l__wa_prefix_str - #2 - l } - { \__wa_error:nx { Wrong~line~in~Arrow } { #2 } } + \cs_if_free:cTF { pgf@sh@ns@wa - \l__wi_prefix_str - #2 - l } + { \__wi_error:nx { Wrong~line~in~Arrow } { #2 } } { - \cs_if_free:cTF { pgf@sh@ns@wa - \l__wa_prefix_str - #3 - l } - { \__wa_error:nx { Wrong~line~in~Arrow } { #3 } } + \cs_if_free:cTF { pgf@sh@ns@wa - \l__wi_prefix_str - #3 - l } + { \__wi_error:nx { Wrong~line~in~Arrow } { #3 } } { - \int_compare:nNnTF \l__wa_pos_arrow_int = 4 + \int_compare:nNnTF \l__wi_pos_arrow_int = 4 { - \begin { tikzpicture } [ __wa_standard ] + \begin { tikzpicture } [ __wi_standard ] \tikz@scan@one@point \pgfutil@firstofone (#2-l.south) \dim_set_eq:NN \l_tmpa_dim \pgf@x \dim_set_eq:NN \l_tmpb_dim \pgf@y @@ -1379,33 +1547,33 @@ \end { tikzpicture } } { - \begin { tikzpicture } [ __wa_standard ] + \begin { tikzpicture } [ __wi_standard ] \tikz@scan@one@point \pgfutil@firstofone - ( #2-\bool_if:NTF\l__wa_initial_r_bool rl .south ) + ( #2-\bool_if:NTF\l__wi_initial_r_bool rl .south ) \tl_gset:Nx \g_tmpa_tl { \dim_use:N \pgf@x , \dim_use:N \pgf@y } \tikz@scan@one@point \pgfutil@firstofone - ( #3-\bool_if:NTF\l__wa_final_r_bool rl .north ) + ( #3-\bool_if:NTF\l__wi_final_r_bool rl .north ) \tl_gset:Nx \g_tmpb_tl { \dim_use:N \pgf@x , \dim_use:N \pgf@y } \end { tikzpicture } } - \__wa_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 } + \__wi_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 } } } } \group_end: } -\cs_new_protected:Npn \__wa_MultiArrow:nn #1 #2 +\cs_new_protected:Npn \__wi_MultiArrow:nn #1 #2 { \foreach \x in { #1 } { - \cs_if_free:cTF { pgf@sh@ns@wa - \l__wa_prefix_str - \x - l } - { \__wa_error:nx { Wrong~line~specification~in~MultiArrow } \x } + \cs_if_free:cTF { pgf@sh@ns@wa - \l__wi_prefix_str - \x - l } + { \__wi_error:nx { Wrong~line~specification~in~MultiArrow } \x } { \clist_gput_right:Nx \g_tmpa_clist \x } } \int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 } - { \__wa_error:n { Too~small~specification~for~MultiArrow } } + { \__wi_error:n { Too~small~specification~for~MultiArrow } } { \clist_sort:Nn \g_tmpa_clist { @@ -1416,296 +1584,353 @@ \clist_pop:NN \g_tmpa_clist \l_tmpa_tl \clist_reverse:N \g_tmpa_clist \clist_pop:NN \g_tmpa_clist \l_tmpb_tl - \exp_args:NV \__wa_MultiArrow_i:n \g_tmpa_clist + \exp_args:NV \__wi_MultiArrow_i:n \g_tmpa_clist \begin { tikzpicture } [ - __wa_standard , + __wi_standard , every~path / .style = { WithArrows / arrow } ] - \draw [<->] ([xshift = \l__wa_xoffset_dim]\l_tmpa_tl-r.south) + \draw [<->] ([xshift = \l__wi_xoffset_dim]\l_tmpa_tl-r.south) -- ++(5mm,0) - -- node (__wa_label) {} - ([xshift = \l__wa_xoffset_dim+5mm]\l_tmpb_tl-r.south) - -- ([xshift = \l__wa_xoffset_dim]\l_tmpb_tl-r.south) ; - \tikz@parse@node \pgfutil@firstofone (__wa_label.west) + -- node (__wi_label) {} + ([xshift = \l__wi_xoffset_dim+5mm]\l_tmpb_tl-r.south) + -- ([xshift = \l__wi_xoffset_dim]\l_tmpb_tl-r.south) ; + \tikz@parse@node \pgfutil@firstofone (__wi_label.west) \dim_set:Nn \l_tmpa_dim { 20 cm } \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; \tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl } - \bool_if:nT { \l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool } + \bool_if:nT { \l__wi_wrap_lines_bool && \l__wi_in_DispWithArrows_bool } { \dim_set:Nn \l_tmpb_dim - { \g__wa_right_x_dim - \pgf@x - 0.3333 em } + { \g__wi_right_x_dim - \pgf@x - 0.3333 em } \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim } } - \path (__wa_label.west) + \path (__wi_label.west) node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ; \end{tikzpicture} } } -\cs_new_protected:Npn \__wa_MultiArrow_i:n #1 +\cs_new_protected:Npn \__wi_MultiArrow_i:n #1 { \begin {tikzpicture } [ - __wa_standard , + __wi_standard , every~path / .style = { WithArrows / arrow } ] \foreach \k in { #1 } { \draw [ <- ] - ( [xshift = \l__wa_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; + ( [xshift = \l__wi_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; } ; \end { tikzpicture } } -\str_const:Nn \c__wa_option_ignored_str +\str_const:Nn \c__wi_option_ignored_str { If~you~go~on,~this~option~will~be~ignored. } -\str_const:Nn \c__wa_command_ignored_str +\str_const:Nn \c__wi_command_ignored_str { If~you~go~on,~this~command~will~be~ignored. } -\__wa_msg_new:nn { Invalid~option~format } +\__wi_msg_new:nn { amsmath~not~loaded } + { + You~can't~use~the~option~'\l_keys_key_tl'~because~the~ + package~'amsmath'~has~not~been~loaded.\\ + If~you~go~on,~this~option~will~be~ignored~in~the~rest~ + of~the~document. + } +\__wi_msg_new:nn { Bad~value~for~replace~brace~by } + { + Bad~value~for~the~option~'\l_keys_key_tl'.~The~value~must~be~ + an~extensible~left~delimiter.~The~possible~values~are:~ + \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ + \token_to_str:N \lbrack,~\token_to_str:N \lgroup,~ + \token_to_str:N \langle,~\token_to_str:N \lmoustache,~ + \token_to_str:N \lfloor\ and~\token_to_str:N \lceil\ + (and~\token_to_str:N \lvert\ and~\token_to_str:N \lVert\ + if~amsmath~or~unicode-math~is~loaded).\\ + \c__wi_option_ignored_str + } +\__wi_msg_new:nn { option~of~cr~negative } + { + The~argument~of~the~command~\token_to_str:N\\~ + should~be~positive~in~the~row~\int_use:N \g__wi_line_int\ + of~your~environment~\{\l__wi_type_env_str\}.\\ + \c__wi_option_ignored_str + } +\__wi_msg_new:nn { omit~probably~used } + { + There~is~a~problem.~Maybe~you~have~used~a~command~ + \token_to_str:N\omit\ in~the~line~\int_use:N \g__wi_line_int\ + (or~another~line)~of~your~environment~\{\l__wi_type_env_str\}.\\ + You~can~go~on~but~you~may~have~others~errors. + } +\__wi_msg_new:nn { newline~at~the~end~of~env } + { + Your~environment~\{\l__wi_type_env_str\}~should~not~end~with~ + a~\token_to_str:N \\.\\ + This~warning~might~become~an~error~in~a~future~version. + } +\__wi_msg_new:nn { Invalid~option~format } { - The~option~'format'~should~contain~only~letters~r,~c~and~l.\\ - \c__wa_option_ignored_str + The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ + must~not~be~empty.\\ + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Value~for~a~key } +\__wi_msg_new:nn { Value~for~a~key } { The~key~'\l_keys_key_tl'~should~be~used~without~value. \\ However,~you~can~go~on~for~this~time. } -\__wa_msg_new:nnn { Unknown~option~in~Arrow } +\__wi_msg_new:nnn { Unknown~option~in~Arrow } { - The~option~'\l_keys_key_tl'~ - is~unknown~for~the~command~\l__wa_string_Arrow_for_msg_str\ - in~the~row~\int_use:N \g__wa_line_int\ - of~your~environment~\{\l__wa_type_env_str\}. \\ - \c__wa_option_ignored_str \\ + The~key~'\l_keys_key_tl'~is~unknown~for~the~command~ + \l__wi_string_Arrow_for_msg_str\ in~the~row~ + \int_use:N \g__wi_line_int\ of~your~environment~ + \{\l__wi_type_env_str\}. \l_tmpa_str \\ + \c__wi_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } { The~available~keys~are~(in~alphabetic~order):~ - \seq_use:Nnnn \l__wa_options_Arrow_seq {~and~} {,~} {~and~}. + \seq_use:Nnnn \l__wi_options_Arrow_seq {~and~} {,~} {~and~}. } -\__wa_msg_new:nnn { Unknown~option~WithArrows } +\__wi_msg_new:nnn { Unknown~option~WithArrows } { - The~option~'\l_keys_key_tl'~is~unknown~in~\{\l__wa_type_env_str\}. \\ - \c__wa_option_ignored_str \\ + The~key~'\l_keys_key_tl'~is~unknown~in~\{\l__wi_type_env_str\}. \\ + \c__wi_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } { The~available~keys~are~(in~alphabetic~order):~ - \seq_use:Nnnn \l__wa_options_WithArrows_seq {~and~} {,~} {~and~}. + \seq_use:Nnnn \l__wi_options_WithArrows_seq {~and~} {,~} {~and~}. } -\__wa_msg_new:nnn { Unknown~option~DispWithArrows } +\__wi_msg_new:nnn { Unknown~option~DispWithArrows } { - The~option~'\l_keys_key_tl'~is~unknown~in~\{\l__wa_type_env_str\}. \\ - \c__wa_option_ignored_str \\ + The~key~'\l_keys_key_tl'~is~unknown~in~\{\l__wi_type_env_str\}. \\ + \c__wi_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } { The~available~keys~are~(in~alphabetic~order):~ - \seq_use:Nnnn \l__wa_options_DispWithArrows_seq {~and~} {,~} {~and~}. + \seq_use:Nnnn \l__wi_options_DispWithArrows_seq {~and~} {,~} {~and~}. } -\__wa_msg_new:nnn { Unknown~option~WithArrowsOptions } +\__wi_msg_new:nnn { Unknown~option~WithArrowsOptions } { - The~option~'\l_keys_key_tl'~is~unknown~in~ + The~key~'\l_keys_key_tl'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ - \c__wa_option_ignored_str \\ + \c__wi_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } { The~available~keys~are~(in~alphabetic~order):~ - \seq_use:Nnnn \l__wa_options_WithArrowsOptions_seq {~and~} {,~} {~and~}. + \seq_use:Nnnn \l__wi_options_WithArrowsOptions_seq {~and~} {,~} {~and~}. } -\__wa_msg_new:nnn { Unknown~option~Arrow~in~code-after } +\__wi_msg_new:nnn { Unknown~option~Arrow~in~code-after } { - The~option~'\l_keys_key_tl'~is~unknown~in~ - \token_to_str:N \Arrow\ - in~\token_to_str:N \code-after. \\ - \c__wa_option_ignored_str \\ + The~key~'\l_keys_key_tl'~is~unknown~in~ + \token_to_str:N \Arrow\ in~code-after. \\ + \c__wi_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } { The~available~keys~are~(in~alphabetic~order):~ - \seq_use:Nnnn \l__wa_options_Arrow_code_after_seq {~and~} {,~} {~and~}. + \seq_use:Nnnn \l__wi_options_Arrow_code_after_seq {~and~} {,~} {~and~}. } -\__wa_msg_new:nn { Too~much~columns~in~WithArrows } +\__wi_msg_new:nn { Too~much~columns~in~WithArrows } { - Your~environment~\{\l__wa_type_env_str\}~has~\int_use:N - \l__wa_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~ + Your~environment~\{\l__wi_type_env_str\}~has~\int_use:N + \l__wi_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ If~you~really~want~to~use~more~columns~(after~the~arrows)~you~should~use~ the~option~'more-columns'~at~a~global~level~or~for~an~environment. \\ However,~you~can~go~one~for~this~time. } -\__wa_msg_new:nn { Too~much~columns~in~DispWithArrows } +\__wi_msg_new:nn { Too~much~columns~in~DispWithArrows } { - Your~environment~\{\l__wa_type_env_str\}~has~\int_use:N - \l__wa_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~ + Your~environment~\{\l__wi_type_env_str\}~has~\int_use:N + \l__wi_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ - at~the~end~of~row~\int_use:N \g__wa_line_int. \\ - If~you~go~on,~you~may~have~other~errors. + at~the~end~of~row~\int_use:N \g__wi_line_int. \\ + This~error~is~fatal. } -\__wa_msg_new:nn { Negative~jump } +\__wi_msg_new:nn { Negative~jump } { You~can't~use~a~negative~value~for~the~option~'jump'~of~command~ - \l__wa_string_Arrow_for_msg_str\ - in~the~row~\int_use:N \g__wa_line_int\ - of~your~environment~\{\l__wa_type_env_str\}.~ + \l__wi_string_Arrow_for_msg_str\ + in~the~row~\int_use:N \g__wi_line_int\ + of~your~environment~\{\l__wi_type_env_str\}.~ You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str } -\__wa_msg_new:nn { new-group~without~groups } +\__wi_msg_new:nn { new-group~without~groups } { You~can't~use~the~option~'new-group'~for~the~command~ - \l__wa_string_Arrow_for_msg_str\ + \l__wi_string_Arrow_for_msg_str\ because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~ - 'groups'~in~your~environment~\{\l__wa_type_env_str\}. \\ - \c__wa_option_ignored_str + 'groups'~in~your~environment~\{\l__wi_type_env_str\}. \\ + \c__wi_option_ignored_str } -\__wa_msg_new:nn +\__wi_msg_new:nn { Too~few~lines~for~an~arrow } - { Line~\l__wa_input_line_str\ - :~an~arrow~specified~in~the~row~\int_use:N \l__wa_initial_int\ - of~your~environment~\{\l__wa_type_env_str\}~can't~be~drawn~ + { + Line~\l__wi_input_line_str\ + :~an~arrow~specified~in~the~row~\int_use:N \l__wi_initial_int\ + of~your~environment~\{\l__wi_type_env_str\}~can't~be~drawn~ because~it~arrives~after~the~last~row~of~the~environment. \\ If~you~go~on,~this~arrow~will~be~ignored. } -\__wa_msg_new:nn { WithArrows~outside~math~mode } +\__wi_msg_new:nn { WithArrows~outside~math~mode } { - The~environment~\{\l__wa_type_env_str\}~should~be~used~only~in~math~mode~ + The~environment~\{\l__wi_type_env_str\}~should~be~used~only~in~math~mode~ like~the~environment~\{aligned\}~of~amsmath. \\ Nevertheless,~you~can~go~on. } -\__wa_msg_new:nn { DispWithArrows~in~math~mode } +\__wi_msg_new:nn { DispWithArrows~in~math~mode } { - The~environment~\{\l__wa_type_env_str\}~should~be~used~only~outside~math~ + The~environment~\{\l__wi_type_env_str\}~should~be~used~only~outside~math~ mode~like~the~environment~\{align\}~of~amsmath. \\ - If~you~go~on,~you~will~have~other~errors. + This~error~is~fatal. } -\__wa_msg_new:nn { Incompatible~options~in~Arrow } +\__wi_msg_new:nn { Incompatible~options~in~Arrow } { You~try~to~use~the~option~'\l_keys_key_tl'~but~ this~option~is~incompatible~or~redundant~with~the~option~ - '\l__wa_previous_key_str'~set~in~the~same~command~ - \l__wa_string_Arrow_for_msg_str. \\ - \c__wa_option_ignored_str + '\l__wi_previous_key_str'~set~in~the~same~command~ + \l__wi_string_Arrow_for_msg_str. \\ + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Incompatible~options } +\__wi_msg_new:nn { Incompatible~options } { You~try~to~use~the~option~'\l_keys_key_tl'~but~ this~option~is~incompatible~or~redundant~with~the~option~ - '\l__wa_previous_key_str'~set~in~the~same~command~ - \bool_if:NT \l__wa_in_code_after_bool + '\l__wi_previous_key_str'~set~in~the~same~command~ + \bool_if:NT \l__wi_in_code_after_bool { - \l__wa_string_Arrow_for_msg_str\ - in~the~code-after~of~your~environment~\{\l__wa_type_env_str\} + \l__wi_string_Arrow_for_msg_str\ + in~the~code-after~of~your~environment~\{\l__wi_type_env_str\} }. \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Arrow~not~in~last~column } +\__wi_msg_new:nn { Arrow~not~in~last~column } { - You~should~use~the~command~\l__wa_string_Arrow_for_msg_str\ - only~in~the~last~column~of~your~environment~\{\l__wa_type_env_str\}.\\ + You~should~use~the~command~\l__wi_string_Arrow_for_msg_str\ + only~in~the~last~column~(column~\int_use:N\l__wi_nb_cols_int)~ + of~your~environment~\{\l__wi_type_env_str\}.\\ However~you~can~go~on~for~this~time. } -\__wa_msg_new:nn { Wrong~line~in~Arrow } +\__wi_msg_new:nn { Wrong~line~in~Arrow } { The~specification~of~line~'#1'~you~use~in~the~command~ - \l__wa_string_Arrow_for_msg_str\ - in~the~'code-after'~of~\{\l__wa_type_env_str\}~doesn't~exist. \\ - \c__wa_option_ignored_str + \l__wi_string_Arrow_for_msg_str\ + in~the~'code-after'~of~\{\l__wi_type_env_str\}~doesn't~exist. \\ + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Both~lines~are~equal } +\__wi_msg_new:nn { Both~lines~are~equal } { - In~the~'code-after'~of~\{\l__wa_type_env_str\}~you~try~to~ + In~the~'code-after'~of~\{\l__wi_type_env_str\}~you~try~to~ draw~an~arrow~going~to~it~self~from~the~line~'#1'.~This~is~not~possible. \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Wrong~line~specification~in~MultiArrow } +\__wi_msg_new:nn { Wrong~line~specification~in~MultiArrow } { The~specification~of~line~'#1'~doesn't~exist. \\ If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow. } -\__wa_msg_new:nn { Too~small~specification~for~MultiArrow } +\__wi_msg_new:nn { Too~small~specification~for~MultiArrow } { The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ is~too~small:~you~need~at~least~two~lines. \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str } -\__wa_msg_new:nn { tag*~without~amsmath } +\__wi_msg_new:nn { tag*~without~amsmath } { We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~ (or~mathtools). \\ If~you~go~on,~the~command~\token_to_str:N\tag\ will~be~used~instead. } -\__wa_msg_new:nn { Not~allowed~in~DispWithArrows } +\__wi_msg_new:nn { Not~allowed~in~DispWithArrows } { The~command~\token_to_str:N #1 - is~allowed~only~in~the~last~columnm~of~\{\l__wa_type_env_str\}. \\ - \c__wa_option_ignored_str + is~allowed~only~in~the~last~column~ + (column~\int_use:N\l__wi_nb_cols_int)~of~\{\l__wi_type_env_str\}. \\ + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Not~allowed~in~WithArrows } +\__wi_msg_new:nn { Not~allowed~in~WithArrows } { - The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__wa_type_env_str\}~ + The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__wi_type_env_str\}~ (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str } -\__wa_msg_new:nn { Multiple~tags } +\__wi_msg_new:nn { Multiple~tags } { You~can't~use~twice~the~command~\token_to_str:N\tag\ - in~a~line~of~the~environment~\{\l__wa_type_env_str\}. \\ + in~a~line~of~the~environment~\{\l__wi_type_env_str\}. \\ If~you~go~on,~the~tag~'#1'~will~be~used. } -\__wa_msg_new:nn { Multiple~labels } +\__wi_msg_new:nn { Multiple~labels } { Normally,~we~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\l__wa_type_env_str\}. \\ + twice~in~a~line~of~the~environment~\{\l__wi_type_env_str\}. \\ However,~you~can~go~on.~ - \bool_if:NT \c__wa_showlabels_loaded_bool + \bool_if:NT \c__wi_showlabels_loaded_bool { However,~only~the~last~label~will~be~shown~by~showlabels.~ } If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~ 'allow-multiple-labels'~at~the~global~or~environment~level. } -\__wa_msg_new:nn { Multiple~labels~with~cleveref } +\__wi_msg_new:nn { Multiple~labels~with~cleveref } { Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\l__wa_type_env_str\}. \\ + twice~in~a~line~of~the~environment~\{\l__wi_type_env_str\}. \\ If~you~go~on,~you~may~have~undefined~references. } -\__wa_msg_new:nn { Inexistent~v-node } +\__wi_msg_new:nn { Inexistent~v-node } { There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ instead~of~a~command~\token_to_str:N\\~at~the~end~of~ - the~row~\int_use:N \l_tmpa_int\ - of~your~environment~\{\l__wa_type_env_str\}. \\ - If~you~go~on,~you~may~have~an~incorrect~output. + the~row~\l_tmpa_int\ + of~your~environment~\{\l__wi_type_env_str\}. \\ + This~error~is~fatal. } -\__wa_msg_new:nn { Option~xoffset~forbidden } +\__wi_msg_new:nn { Option~xoffset~forbidden } { You~can't~use~the~option~'xoffset'~in~the~command~ - \l__wa_string_Arrow_for_msg_str\ + \l__wi_string_Arrow_for_msg_str\ while~you~are~using~the~option~ - ' \int_compare:nNnTF \l__wa_pos_arrow_int = 7 + ' \int_compare:nNnTF \l__wi_pos_arrow_int = 7 { group } { groups } '. \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str + } +\__wi_msg_new:nnn { Duplicate~name } + { + The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ + the~same~environment~name~twice.~You~can~go~on,~but,~ + maybe,~you~will~have~incorrect~results. \\ + For~a~list~of~the~names~already~used,~type~H~<return>. \\ + If~you~don't~want~to~see~this~message~again,~use~the~option~ + 'allow-duplicate-names'. + } + { + The~names~already~defined~in~this~document~are:~ + \seq_use:Nnnn \g__wi_names_seq { ,~ } { ,~ } { ~and~ }. } \NewDocumentCommand \WithArrowsNewStyle { m m } { \keys_if_exist:nnTF { WithArrows / Global } { #1 } - { \__wa_error:nn { Key~already~defined } { #1 } } + { \__wi_error:nn { Key~already~defined } { #1 } } { \keys_define:nn { WithArrows / Global } { #1 .code:n = { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } } } - \seq_put_right:Nn \l__wa_options_WithArrows_seq {#1} - \seq_put_right:Nn \l__wa_options_DispWithArrows_seq { #1 } - \seq_put_right:Nn \l__wa_options_WithArrowsOptions_seq { #1 } + \seq_put_right:Nx \l__wi_options_WithArrows_seq { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l__wi_options_DispWithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l__wi_options_WithArrowsOptions_seq + { \tl_to_str:N { #1 } } \group_begin: \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } { - The~option~'\l_keys_key_tl'~can't~be~set~in~the~ + The~key~'\l_keys_key_tl'~can't~be~set~in~the~ definition~of~a~style.~You~can~go~on~for~this~time~ but~you~should~suppress~this~key. } @@ -1713,13 +1938,13 @@ \group_end: } } -\__wa_msg_new:nn { Key~already~defined } +\__wi_msg_new:nn { Key~already~defined } { The~key~'#1'~is~already~defined. \\ If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored. } -\tl_const:Nn \c__wa_tikz_code_up_tl +\tl_const:Nn \c__wi_tikz_code_up_tl { \draw [ rounded~corners ] let \p1 = (#1) , @@ -1733,7 +1958,7 @@ } (\x2,\y1) -- (\p2) ; } -\tl_const:Nn \c__wa_tikz_code_down_tl +\tl_const:Nn \c__wi_tikz_code_down_tl { \draw [ rounded~corners ] let \p1 = (#1) , @@ -1750,75 +1975,62 @@ } \keys_define:nn { WithArrows / Arrow / FirstPass } { - up .code:n = \__wa_set_independent: , - down .code:n = \__wa_set_independent: , + up .code:n = \__wi_set_independent: , + down .code:n = \__wi_set_independent: , up .default:n = NoValue , down .default:n = NoValue } \keys_define:nn { WithArrows / Arrow / SecondPass } { up .code:n = - \str_if_empty:NT \l__wa_previous_key_str + \str_if_empty:NT \l__wi_previous_key_str { - \str_set:Nn \l__wa_previous_key_str { up } - \bool_if:NTF \c__wa_varwidth_loaded_bool + \str_set:Nn \l__wi_previous_key_str { up } + \bool_if:NTF \c__wi_varwidth_loaded_bool { \cs_if_exist:cTF { tikz@library@calc@loaded } { - \int_set:Nn \l__wa_pos_arrow_int \c_one_int - \bool_set_false:N \l__wa_wrap_lines_bool - \tl_set_eq:NN \l__wa_tikz_code_tl - \c__wa_tikz_code_up_tl + \int_set:Nn \l__wi_pos_arrow_int \c_one_int + \bool_set_false:N \l__wi_wrap_lines_bool + \tl_set_eq:NN \l__wi_tikz_code_tl + \c__wi_tikz_code_up_tl } - { \__wa_error:n { calc~not~loaded } } + { \__wi_error:n { calc~not~loaded } } } - { \__wa_error:n { varwidth~not~loaded } } + { \__wi_error:n { varwidth~not~loaded } } } , down .code:n = - \str_if_empty:NT \l__wa_previous_key_str + \str_if_empty:NT \l__wi_previous_key_str { - \str_set:Nn \l__wa_previous_key_str { down } - \bool_if:NTF \c__wa_varwidth_loaded_bool + \str_set:Nn \l__wi_previous_key_str { down } + \bool_if:NTF \c__wi_varwidth_loaded_bool { \cs_if_exist:cTF { tikz@library@calc@loaded } { - \int_set:Nn \l__wa_pos_arrow_int \c_one_int - \bool_set_false:N \l__wa_wrap_lines_bool - \tl_set_eq:NN \l__wa_tikz_code_tl - \c__wa_tikz_code_down_tl + \int_set:Nn \l__wi_pos_arrow_int \c_one_int + \bool_set_false:N \l__wi_wrap_lines_bool + \tl_set_eq:NN \l__wi_tikz_code_tl + \c__wi_tikz_code_down_tl } - { \__wa_error:n { calc~not~loaded } } + { \__wi_error:n { calc~not~loaded } } } - { \__wa_error:n { varwidth~not~loaded } } + { \__wi_error:n { varwidth~not~loaded } } } } -\seq_put_right:Nn \l__wa_options_Arrow_seq { down } -\seq_put_right:Nn \l__wa_options_Arrow_seq { up } -\__wa_msg_new:nn { varwidth~not~loaded } +\seq_put_right:Nn \l__wi_options_Arrow_seq { down } +\seq_put_right:Nn \l__wi_options_Arrow_seq { up } +\__wi_msg_new:nn { varwidth~not~loaded } { You~can't~use~the~option~'\l_keys_key_tl'~because~ you~don't~have~loaded~the~package~'varwidth'. \\ - \c__wa_option_ignored_str + \c__wi_option_ignored_str } -\__wa_msg_new:nn { calc~not~loaded } +\__wi_msg_new:nn { calc~not~loaded } { You~can't~use~the~option~'\l_keys_key_tl'~because~you~don't~have~loaded~the~ Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}' ~in~the~preamble~of~your~document. \\ - \c__wa_option_ignored_str - } -\__wa_msg_new:nnn { Duplicate~name } - { - The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ - the~same~environment~name~twice.~You~can~go~on,~but,~ - maybe,~you~will~have~incorrect~results. \\ - For~a~list~of~the~names~already~used,~type~H~<return>. \\ - If~you~don't~want~to~see~this~message~again,~use~the~option~ - 'allow-duplicate-names'. - } - { - The~names~already~defined~in~this~document~are:~ - \seq_use:Nnnn \g__wa_names_seq { ,~ } { ,~ } { ~and~ }. + \c__wi_option_ignored_str } \endinput %% |