summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-29 22:08:38 +0000
committerKarl Berry <karl@freefriends.org>2017-11-29 22:08:38 +0000
commit7d16aaa59d05797f4d1053a1d2dbbe768df50e04 (patch)
tree7e838a5f8522cba5c754ef3e90fb674138938704 /Master/texmf-dist/source
parent41621b0b484649afdce10d4a48951b78320c6728 (diff)
witharrows (29nov17)
git-svn-id: svn://tug.org/texlive/trunk@45946 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/witharrows/witharrows.dtx949
1 files changed, 521 insertions, 428 deletions
diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
index d1806821106..5dd68ff86ab 100644
--- a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
+++ b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
@@ -15,14 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{1.1}
-\def\myfiledate{2017/11/06}
-%<package>\RequirePackage{l3keys2e}
-%<package>\ProvidesExplPackage
-%<package> {witharrows}
-%<package> {\myfiledate}
-%<package> {\myfileversion}
-%<package> {Draws arrows for explanations on the right}
+\def\myfileversion{1.2}
+\def\myfiledate{2017/11/29}
%
%
%<*batchfile>
@@ -58,12 +52,10 @@ version 2005/12/01 or later.
\usepackage{geometry}
\usepackage[dvipsnames]{xcolor} % color is already loaded with l3doc (?)
\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
-\usepackage{tikz}
-\usetikzlibrary{calc,arrows.meta,bending}
-\usepackage{footnote}
\usepackage{witharrows}
\usepackage{mathtools}
\usepackage{amsfonts}
+\usepackage{stmaryrd}
\NewDocumentEnvironment {scope} {} {} {}
\def\interitem{\vskip 7mm plus 2 mm minus 3mm}
\def\emphase#1{{\color{RoyalPurple}#1}}
@@ -92,12 +84,12 @@ version 2005/12/01 or later.
% This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by the classical workflow
% |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two compilations may be necessary. This package requires the
% packages \pkg{expl3}, \pkg{xparse}, \pkg{footnote}\footnote{The package footnote is used to extract the notes
-% from the environments \texttt{\{WithArrows\}}.} and \pkg{tikz}. The following Tikz libraries are also required :
+% from the environments \texttt{\{WithArrows\}}.} and \pkg{tikz}. The following Tikz libraries are also required:
% \pkg{calc}, \pkg{arrows.meta} and \pkg{bending}.
%
% \bigskip
% This package gives an environment |{WithArrows}| to construct alignments of equations with arrows for the
-% explanations on the right side :
+% explanations on the right side:
% %
% \begin{Verbatim}
% $\begin{WithArrows}
@@ -113,7 +105,7 @@ version 2005/12/01 or later.
%
%
% \medskip
-% The arrow has been drawn with the command |\Arrow| on the ligne from which it starts. The command |\Arrow| can be
+% The arrow has been drawn with the command |\Arrow| on the line from which it starts. The command |\Arrow| can be
% used anywhere on the line but the best way is to put it at the end.
%
%
@@ -122,10 +114,11 @@ version 2005/12/01 or later.
% The commande |\Arrow| has several options. These options can be put between square brackets, before, or after the
% mandatory argument.
%
-% The option |jump| gives the number of lines the arrow must jump (the default value is, of course,~$1$)
-% \footnote{It's not possible to give a non-positive value to \texttt{jump}. See below the way to draw an arrow
-% which goes backwards.}
-% %
+% The option |jump| gives the number\footnote{It's not possible to give a non-positive value to \texttt{jump}. See
+% below the way to draw an arrow which goes backwards.} of lines the arrow must jump (the default value is, of
+% course,~$1$).
+%
+%
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 \Arrow[~emphase#jump=2@]{we expand} \\
@@ -243,7 +236,7 @@ version 2005/12/01 or later.
% \end{WithArrows}$
%
% \interitem
-% One of the most useful options is ``|text width|'' to control the with of the text associated to the arrow.
+% One of the most useful options is ``|text width|'' to control the width of the text associated to the arrow.
% %
% \begin{Verbatim}
% $\begin{WithArrows}
@@ -282,7 +275,7 @@ version 2005/12/01 or later.
%
% \interitem
% If we put commands |\\| in the text to force newlines, a command of font placed in the beginning of the text will
-% have effect only until the first command |\\| (like in a environment |{tabular}|). That's why Tikz gives a option
+% have effect only until the first command |\\| (like in an environment |{tabular}|). That's why Tikz gives a option
% |font| to modify the font of the whole text. Nevertheless, if we use the option |tikz={font={\bfseries}}|, the
% default specification of |\small| and |\itshape| will be overwritten.
% %
@@ -305,7 +298,7 @@ version 2005/12/01 or later.
%
% \interitem
% Almost all the options can be given directly to the environment |{WithArrows}| (between square brackets). In this
-% case, they apply to all the arrows of the environment.\footnote{They applies also to the nested environments
+% case, they apply to all the arrows of the environment.\footnote{They also apply to the nested environments
% \texttt{\{WithArrows\}} with the notable exception of \texttt{interline}.}
% %
% \begin{Verbatim}
@@ -328,7 +321,7 @@ version 2005/12/01 or later.
% |\displaystyle| (like in an environment |{aligned}| of \pkg{amsmath}).
%
% \medskip
-% Without the option |displaystyle| :
+% Without the option |displaystyle|:
% %
% \begin{Verbatim}
% $\begin{WithArrows}
@@ -352,7 +345,7 @@ version 2005/12/01 or later.
%
%
% \medskip
-% The same example with the option |displaystyle| :\par\nobreak
+% The same example with the option |displaystyle|:\par\nobreak
%
% $\begin{WithArrows}[displaystyle]
% \int_0^1 (x+1)^2 dx
@@ -396,11 +389,11 @@ version 2005/12/01 or later.
%
% However, a previouly defined command |\Arrow| may still be useful in an environment |{WithArrows}|. If we want to
% use it in such an environment, it's possible to change the name of the command |\Arrow| of the package
-% \pkg{witharrows} : there is an option |CommandName| for this purpose. The new name of the command must be given to
+% \pkg{witharrows}: there is an option |CommandName| for this purpose. The new name of the command must be given to
% the option \emph{without} the leading backslash.
% %
% \begin{Verbatim}
-% \def\Arrow{\longmapsto}
+% \newcommand{\Arrow}{\longmapsto}
% $\begin{WithArrows}[~emphase#CommandName=Explanation@]
% f & = \bigl(x \Arrow (x+1)^2\bigr)
% ~emphase#\Explanation{we work directly on fonctions}@\\
@@ -409,7 +402,7 @@ version 2005/12/01 or later.
% \end{Verbatim}
% %
% \begin{scope}
-% \def\Arrow{\longmapsto}
+% \newcommand{\Arrow}{\longmapsto}
% $\begin{WithArrows}[CommandName=Explanation]
% f & = \bigl(x \Arrow (x+1)^2\bigr)
% \Explanation{we work directly on fonctions}\\
@@ -421,7 +414,7 @@ version 2005/12/01 or later.
% \interitem
% It's possible to use directly the nodes created by |{WithArrows}| with explicit Tikz instructions (in order, for
% example, to draw something that can't be drawn with the command |\Arrow|). That's why a style for the tips of the
-% arrows has be created : |TipsOfWithArrows|. By using this style, we will have homogeneous tips for the arrows of
+% arrows has be created: |TipsOfWithArrows|. By using this style, we will have homogeneous tips for the arrows of
% the document.
%
% Therefore, if we want to modify the tips of the arrows of |{WithArrows}|, we have to modify the style
@@ -458,11 +451,6 @@ version 2005/12/01 or later.
% nodes of the right side are aligned vertically on the right side of the array. These nodes will be called
% \emph{right nodes}.
%
-% % The names of the Tikz nodes created by \texttt{\{WithArrows\}} are \texttt{wa-}$n$\texttt{-l} and
-% % \texttt{wa-}$n$\texttt{-r} where $n$~is the number of the line. It's possible to refer to these Tikz nodes after
-% % the environment (one should use the options \texttt{remember picture} and \texttt{overlay} and also
-% % \texttt{TipsOfWithArrows} and \texttt{->} in order to have the same arrowheads).
-%
% 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 arrow is \emph{vertical} when its two ends have the same abscissa).
%
@@ -524,6 +512,7 @@ version 2005/12/01 or later.
% \end{WithArrows}$
% \end{Verbatim}
%
+%
% $\begin{WithArrows}[displaystyle,group]
% 2xy'-3y=\sqrt x
% & \Longleftrightarrow 2x(K'y_0+Ky_0')-3Ky_0 = \sqrt x \\
@@ -536,9 +525,29 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% If desired, the option |group| can be given to the command |\WithArrowsOptions| so that it will become the default
-% value.
+% The environment |{WithArrows}| gives also a |groups| option (with a \emph{s} in the name). With this option, the
+% arrows are divided into several ``groups''. Each group is a set of connected\footnote{More precisely : for each
+% arrow $a$, we note $i(a)$ the number of its initial line and $f(a)$ the number of its final line ; for two arrows
+% $a$ and $b$, we say that $a \sim b$ when
+% $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq \emptyset$ ; the groups are the
+% equivalence classes of the transitive closure of $\sim$.} arrows. All the arrows of a given group are grouped on
+% a same vertical line and at a leftmost position.
%
+% \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
+% If desired, the option |group| or the option |groups| can be given to the command |\WithArrowsOptions| so that it will become
+% the default value. In this case, it's still possible to come back to the default behaviour for a given
+% environment |{WithArrows}| with the option |rr|: |\begin{WithArrows}{rr}|
%
% \section{Comparison with the environment \{aligned\}}
%
@@ -546,7 +555,7 @@ version 2005/12/01 or later.
%
% |{WithArrows}| bears similarities with the environment |{aligned}| of the extension \pkg{amsmath}. These are only
% similarities because |{WithArrows}| has not been written upon the environment |{aligned}|.\footnote{In fact, it's
-% possible to use the package \pkg{witharrows} without the environment \pkg{amsmath}.}
+% possible to use the package \pkg{witharrows} without the package \pkg{amsmath}.}
%
% \interitem
% As in the environments of \pkg{amsmath}, it's possible to change the spacing between two given lines with the
@@ -590,7 +599,7 @@ version 2005/12/01 or later.
%
% \bigskip
% However, this new value of |\jot| will also be used in other alignments included in the
-% environment~|{WithArrows}| :
+% environment~|{WithArrows}|:
% %
% \begin{Verbatim}
% $\begin{WithArrows}[jot=2ex]
@@ -667,7 +676,7 @@ version 2005/12/01 or later.
% \end{WithArrows}$
%
% \bigskip
-% The value |c| may be useful, for example, if we want to add curly braces :
+% The value |c| may be useful, for example, if we want to add curly braces:
%
% \smallskip
% \begin{Verbatim}
@@ -693,13 +702,13 @@ version 2005/12/01 or later.
% \interitem
% Unlike |{aligned}|, the environment |{WithArrows}| uses |\textstyle| by default.
%
-% Once again, it's possible to change this behaviour with |\WithArrowsOptions| :
+% Once again, it's possible to change this behaviour with |\WithArrowsOptions|:
%
% \quad |\WithArrowsOptions{displaystyle}|.
%
%
% \smallskip
-% The following example is composed with |{aligned}| :\par\nobreak
+% The following example is composed with |{aligned}|:\par\nobreak
%
% \smallskip
% $\left\{
@@ -752,7 +761,7 @@ version 2005/12/01 or later.
%
% \subsection{MoveEqLeft}
%
-% It's possible to use |\MoveEqLeft| of \pkg{mathtools} (if we don't want ampersand on the firt line) :
+% It's possible to use |\MoveEqLeft| of \pkg{mathtools} (if we don't want ampersand on the firt line):
% %
% \begin{Verbatim}[formatcom=\small\color{gray}]
% $\begin{WithArrows}[jot=2mm]
@@ -861,7 +870,7 @@ version 2005/12/01 or later.
% fact, any TeX command.
%
% In the following example, the argument of |font| is the token list |\tiny\counter| where |\counter| is a command
-% which increment a counter previously defined and display its new value. Thus, the arrows are automatically
+% which increments a counter previously defined and displays its new value. Thus, the arrows are automatically
% numbered.
% %
% \begin{Verbatim}[formatcom=\small\color{gray}]
@@ -900,7 +909,7 @@ version 2005/12/01 or later.
% document.
%
% \smallskip
-% The Tikz name of a node created by \pkg{witharrows} is prefixed by |wa-|. Then, we have a list of numbers with
+% The Tikz name of a node created by \pkg{witharrows} is prefixed by |wa-|. Then, we have a list of numbers which
% give the position in the nesting tree and the number of the line in the environment. At the end, we have the
% suffixe |l| for a ``left node'' and |r| for a ``right node''.
%
@@ -953,36 +962,46 @@ version 2005/12/01 or later.
%
% \section{Implementation}
%
-% \subsection{Some extensions are loaded}
+% \subsection{Declaration of the package and extensions loaded}
%
-% This package is written in \pkg{expl3}.
+%
+% First, \pkg{tikz} and some Tikz libraries are loaded before the |\ProvidesExplPackage|.
+% They are loaded this way because |\usetikzlibrary| in |expl3| code fails.\footnote{cf.
+% |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|}
+%
% \begin{macrocode}
-\RequirePackage{expl3}
+\RequirePackage{tikz}
+\usetikzlibrary{calc,arrows.meta,bending}
% \end{macrocode}
%
% \bigskip
-% The package \pkg{xparse} will be used to define the environment |{WithArrows}| and the document-level commands
-% (|\Arrow|, |\WithArrowsOptions| ans |\WithArrowsLastEnv|).
+% Then, we can give the traditionnal declaration of a package written with |expl3|:
% \begin{macrocode}
-\RequirePackage{xparse}
+\RequirePackage{l3keys2e}
+\ProvidesExplPackage
+ {witharrows}
+ {\myfiledate}
+ {\myfileversion}
+ {Draws arrows for explanations on the right}
% \end{macrocode}
%
% \bigskip
-% The arrows are drawn with Tikz and that's why \pkg{tikz} is required with some libraries.
+% The package \pkg{xparse} will be used to define the environment |{WithArrows}| and the document-level commands
+% (|\Arrow|, |\WithArrowsOptions| ans |\WithArrowsLastEnv|).
% \begin{macrocode}
-\RequirePackage{tikz}
-\usetikzlibrary{calc,arrows.meta,bending}
+\RequirePackage{xparse}
% \end{macrocode}
%
% \bigskip
-% The package \pkg{footnote} will be used to extract footnotes.
+% The package \pkg{footnote} will be used to extract footnotes of the environments |{WithArrows}| via the pair
+% |\savenotes|-|\spewnotes|.
% \begin{macrocode}
\RequirePackage{footnote}
% \end{macrocode}
%
% \subsection{Some technical definitions}
%
-% We define a Tikz style |wa_node_style| for the nodes that will be created in the |\halign|.
+% We define a Tikz style |@@_node_style| for the nodes that will be created in the |\halign|.
% \begin{macrocode}
\tikzstyle{@@_node_style}=[rectangle,
inner~sep = 0 pt,
@@ -995,7 +1014,7 @@ version 2005/12/01 or later.
% (this option is useful for debugging).
%
% \bigskip
-% We also define a style for the tips of arrow. The final user of the extension \pkg{WithArrows} will use this
+% We also define a style for the tips of arrow. The final user of the extension \pkg{witharrows} will use this
% style if he wants to draw an arrow directly with a Tikz command in his document (probably using the Tikz nodes
% created by |{WithArrows}| in the |\halign|).
% \begin{macrocode}
@@ -1005,7 +1024,7 @@ version 2005/12/01 or later.
% \bigskip
% In order to increase the interline in the environments |{WithArrows}|, we will use the command |\spread@equation|
% of \pkg{amsmath}. When used, this command becomes no-op (in the current TeX group). Therefore, it will be
-% possible to use the environments of \pkg{amsmath} (\emph{e.g.} |{aligned}|) in an environment |{WithArrows}|.
+% possible to use the environments of \pkg{amsmath} (e.g. |{aligned}|) in an environment |{WithArrows}|.
%
% Nevertheless, we want the extension \pkg{witharrows} available without \pkg{amsmath}. That's why we give a
% definition of |\spread@equation| (this definition will be loaded only if \pkg{amsmath} --- or \pkg{mathtools} --- has
@@ -1020,7 +1039,7 @@ version 2005/12/01 or later.
% \subsection{Variables}
%
% \bigskip
-% The following sequence is the position of the last environment |{WithArrows}| in the tree of the imbricated
+% The following sequence is the position of the last environment |{WithArrows}| in the tree of the nested
% environments |{WithArrows}|.
% \begin{macrocode}
\seq_new:N \g_@@_position_in_the_tree_seq
@@ -1035,6 +1054,13 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% The following counter will be use to specify the level when we set keys: $0$~(global level as with
+% |\WithArrowsOptions|), $1$~(environment level with the |\begin{WithArrows}|) or $2$~(local level with the
+% |\Arrow| command).
+% \begin{macrocode}
+\int_new:N \l_@@_level_int
+% \end{macrocode}
+% \bigskip
% The following skip (=glue) is the vertical space inserted between two lines of the |\halign|.
% \begin{macrocode}
\skip_new:N \l_@@_interline_skip
@@ -1047,29 +1073,35 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The following integer indicates the position of the box that will be created : 0 (=|t|=|\vtop|), 1~(=|c|=|\vcenter|) or 2 (=|b|=|\vbox|).
+% The following integer indicates the position of the box that will be created: 0 (=|t|=|\vtop|), 1~(=|c|=|\vcenter|) or 2 (=|b|=|\vbox|).
% \begin{macrocode}
-\int_new:N \l_@@_pos_int
-% \end{macrocode}
-% \bigskip
-% The following flag indicates if the beginning of the arrow use a |r| option (if not, it's a |l| option).
-% \begin{macrocode}
-\bool_new:N \l_@@_initial_r_bool
-\bool_set_true:N \l_@@_initial_r_bool
+\int_new:N \l_@@_pos_env_int
% \end{macrocode}
%
% \bigskip
-% The following flag indicates if the end of the arrow use a |r| option (if not, it's a |l| option).
+% The integer |\l_@@_pos_arrows_int| indicates the position of the arrows with the following code:
+%
+% \begin{center}
+% \begin{tabular}{|l|c|c|c|c|c|c|c|}
+% \hline
+% option & |rr| & |ll| & |rl| & |lr| & |i| & |group| & |groups| \\
+% \hline
+% |\l_@@_pos_arrows_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
% \begin{macrocode}
-\bool_new:N \l_@@_final_r_bool
-\bool_set_true:N \l_@@_final_r_bool
+\int_new:N \l_@@_pos_arrows_int
% \end{macrocode}
%
-% \bigskip
-% The following flag indicates if the arrow use a |i| option (in this case, the options |l| and |r| for the
-% ends are meaningless).
+% \medskip
+% When we scan a list of options, we want to be able to raise an error if two options of position of the arrows
+% are present. That's why we keep the code of the first option of position in a variable called
+% |\l_@@_previous_pos_arrows_int|. This variable will be set to $-1$ each time we start the scanning of a list of options.
+%
% \begin{macrocode}
-\bool_new:N \l_@@_i_bool
+\int_new:N \l_@@_previous_pos_arrows_int
% \end{macrocode}
%
% \bigskip
@@ -1094,30 +1126,29 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% If the following flag is raised, the elements of the |\halign| will be composed with |\displaystyle| :
+% If the following flag is raised, the elements of the |\halign| will be composed with |\displaystyle|:
% \begin{macrocode}
\bool_new:N \l_@@_displaystyle_bool
% \end{macrocode}
%
% \bigskip
-% The following token list variable will contains the \pkg{Tikz} options used to draw the arrows.
+% The following token list variable will contains the Tikz options used to draw the arrows.
% \begin{macrocode}
\tl_clear_new:N \l_@@_options_tikz_tl
% \end{macrocode}
%
-% At each possible level for the options (\emph{global}, \emph{env} or \emph{local} : see below), the new values
-% will be appended on the right of this token list.
+% At each possible level for the options (\emph{global}, \emph{environment} or \emph{local}: see below), the new
+% values will be appended on the right of this token list.
%
% \bigskip
-% The following flag will be raised when a key controling position of the arrow has been set in the same list of
-% keys (this is useful in order to raise an error if two incompatibles keys are specified at the same level).
+% The dimension |\g_@@_x_dim| will be used to compute the $x$-value for some verticals arrows when one of the
+% options |i|, |group| and |groups| (values 4, 5 and 6 of |\l_@@_pos_arrows_int|) is used.
% \begin{macrocode}
-\bool_new:N \l_@@_position_key_already_set_bool
+\dim_new:N \g_@@_x_dim
% \end{macrocode}
-% This flag is set to |false| each time we have to process a list of options.
%
% \bigskip
-% In the |\halign| of an environment |{WithArrows}|, we will have to use three counters :
+% In the |\halign| of an environment |{WithArrows}|, we will have to use three counters:
% \begin{itemize}
% \item |\g_@@_arrow_int| to count the arrows created in the environment ;
% \item |\g_@@_line_int| to count the lines of the |\halign| ;
@@ -1131,61 +1162,39 @@ version 2005/12/01 or later.
% restore the previous value of these counters at the end of an environment |{WithArrows}| and we decide to manage
% a stack for each of these counters.
% \begin{macrocode}
-\seq_new:N \g_@@_stack_counter_arrows_seq
+\seq_new:N \g_@@_arrow_int_seq
\int_new:N \g_@@_arrow_int
-\seq_new:N \g_@@_stack_counter_lines_seq
+\seq_new:N \g_@@_line_int_seq
\int_new:N \g_@@_line_int
-\seq_new:N \g_@@_stack_counter_lines_bis_seq
+\seq_new:N \g_@@_line_bis_int_seq
\int_new:N \g_@@_line_bis_int
% \end{macrocode}
%
% \subsection{The definition of the options}
-% There are three levels where options can be set :
+% There are three levels where options can be set:
% \begin{itemize}
-% \item with |\WithArrowsOptions{...}| : this level will be called \emph{global} level;
-% \item with |\begin{WithArrows}[...]| : this level will be called \emph{env} level;
-% \item with |\Arrow[...]| : this level will be called \emph{local} level.
+% \item with |\WithArrowsOptions{...}|: this level will be called \emph{global} level (number~0);
+% \item with |\begin{WithArrows}[...]|: this level will be called \emph{environment} level (number~1);
+% \item with |\Arrow[...]|: this level will be called \emph{local} level (number~2).
% \end{itemize}
%
-% That's why there is three groups of keys named |global|, |env| and |local|.
-%
-% \bigskip
-% Before each |\keys_set_groups:nnn|, we execute a |\keys_set_filter:nnn| with group |secondary|. Thus, an
-% unknown key will raise an error. Furthermore, the \emph{primary} keys (those which are not in the group
-% |secondary|) will be set first : it's useful to raise an error if, for example, keys |i| and
-% |group| are set at the same level (which is incoherent).
+% The level is specified in the variable |\l_@@_level_int| and the code attached to the options can use this
+% information to alter their actions.
%
% \bigskip
-% \begin{macrocode}
-\keys_define:nn {WithArrows}
-% \end{macrocode}
+% We begin with a first submodule which will be loaded only at the global or the environment level.
%
% \medskip
-% The key |jump| indicates the number of lines jumped by the arrow (1 by default). This key will be extracted
-% when the command |\Arrow| will be executed. That's why this key is the only key of a dedicated group also named
-% |jump|.
-% \begin{macrocode}
- { jump .groups:n = {jump,secondary},
- jump .code:n = {\int_set:Nn \l_@@_jump_int {#1}
- \int_compare:nNnF \l_@@_jump_int > 0
- {\msg_error:nn {witharrows}
- {The~option~"jump"~must~be~non~negative}}},
- jump .value_required:n = true,
-% \end{macrocode}
-%
-% \bigskip
% The options |t|, |c| and |b| indicate if we will create a |\vtop|, a |\vcenter| of a |\vbox|. This information is
-% stored in the variable |\l_@@_pos_int|.
+% stored in the variable |\l_@@_pos_env_int|.
% \begin{macrocode}
- t .groups:n = {global,env,secondary},
- t .code:n = {\int_set:Nn \l_@@_pos_int 0},
+\keys_define:nn {WithArrows/GlobalOrEnv}
+ { t .code:n = {\int_set:Nn \l_@@_pos_env_int 0},
t .value_forbidden:n = true,
- c .groups:n = {global,env,secondary},
- c .code:n = {\int_set:Nn \l_@@_pos_int 1},
+ c .code:n = {\int_set:Nn \l_@@_pos_env_int 1},
c .value_forbidden:n = true,
- b .groups:n = {global,env,secondary},
- b .code:n = {\int_set:Nn \l_@@_pos_int 2},
+ b .code:n = {\int_set:Nn \l_@@_pos_env_int 2},
b .value_forbidden:n = true,
% \end{macrocode}
%
@@ -1193,186 +1202,175 @@ version 2005/12/01 or later.
% Usually, the number of columns in a |{WithArrows}| environment is limited to 2. Nevertheless, it's possible to
% have more columns with the option |MoreColumns|.
% \begin{macrocode}
- MoreColumns .groups:n = {global,env,secondary},
MoreColumns .bool_set:N = \l_@@_MoreColumns_bool,
- MoreColumns .default:n = true,
MoreColumns .value_forbidden:n = true,
% \end{macrocode}
%
% \bigskip
% If the user wants to give a new name to the |\Arrow| command (and the name |\Arrow| remains free).
% \begin{macrocode}
- CommandName .groups:n = {global,env,secondary},
CommandName .tl_set:N = \l_@@_CommandName_tl,
CommandName .initial:n = {Arrow},
CommandName .value_required:n = true,
% \end{macrocode}
%
% \bigskip
-% With the option |displaystyle|, all the elements of the environment will be composed in |\displaystyle|.
+% With the option |displaystyle|, the environments will be composed in |\displaystyle|.
% \begin{macrocode}
- displaystyle .groups:n = {global,env,secondary},
- displaystyle .bool_set:N = \l_@@_displaystyle_bool,
+ displaystyle .bool_set:N = \l_@@_displaystyle_bool,
% \end{macrocode}
- %
+%
% \bigskip
% With the option |shownodes|, the nodes will be drawn in red (useful only for debugging).
% \begin{macrocode}
- shownodes .groups:n = {global,env,secondary},
shownodes .bool_set:N = \l_@@_shownodes_bool,
- shownodes .default:n = true,
% \end{macrocode}
%
% \bigskip
% With the option |shownodenames|, the name of the ``right nodes'' will be written in the document (useful only
% for debugging).
% \begin{macrocode}
- shownodenames .groups:n = {global,env,secondary},
- shownodenames .bool_set:N = \l_@@_shownodenames_bool,
- shownodenames .default:n = true,
+ shownodenames .bool_set:N = \l_@@_shownodenames_bool,
% \end{macrocode}
%
% \bigskip
-% The option |jot| can be used to change the value of the LaTeX parameter |\jot|. If we put this option in the
-% |global| group, the use of this option in |\WithArrowsOptions| will change |\jot| for the whole document (at
-% least the current TeX group) and not only for the |{WithArrows}| environments. This is certainly not what the
-% user wants. That's why the option |jot| is not in the group |global|. It's interesting to note that |\jot| is a
-% dimension and not a skip (=glue).
-%
+% With the option |group|, \emph{all} the arrows of the environment are vertical with the same abscissa and at a
+% leftmost position.
% \begin{macrocode}
- jot .groups:n = {env,secondary},
- jot .dim_set:N = \jot,
- jot .value_required:n = true,
+ group .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1}
+ {\msg_error:nn {witharrows}
+ {Two~options~are~incompatible}}
+ \int_set:Nn \l_@@_previous_pos_arrows_int 5
+ \int_set:Nn \l_@@_pos_arrows_int 5},
+ group .value_forbidden:n = true,
% \end{macrocode}
%
% \bigskip
-% The option |interline| gives the vertical skip (=glue) inserted between two lines (independently of |\jot|). By
-% design, this option has a particular behaviour : it applies only to an environment and doesn't apply to the
-% nested environments.
+% With the option |groups| (with a \emph{s}), the arrows of the environment are divided in groups by an argument of
+% connexity, and, in each group, the arrows are vertical with the same abscissa and at a leftmost position. When
+% the option |group| or |groups| is used, it's not possible to an other option of position like |ll|, |lr|, etc.
+% for a individual key.
% \begin{macrocode}
- interline .groups:n = {env,secondary},
- interline .skip_set:N = \l_@@_interline_skip,
- interline .initial:n = \c_zero_skip,
- interline .value_required:n = true,
+ groups .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1}
+ {\msg_error:nn {witharrows}
+ {Two~options~are~incompatible}}
+ \int_set:Nn \l_@@_previous_pos_arrows_int 6
+ \int_set:Nn \l_@@_pos_arrows_int 6},
+ groups .value_forbidden:n = true}
% \end{macrocode}
%
-% \bigskip
-% The option |xoffset| change the $x$-offset of the arrows (towards the right). It's a dimension and not a skip.
-% \begin{macrocode}
- xoffset .groups:n = {global,env,local,secondary},
- xoffset .dim_set:N = \l_@@_xoffset_dim,
- xoffset .value_required:n = true,
-% \end{macrocode}
+%
%
% \bigskip
+% Then we define the main module called |WithArrows| which will be loaded at all the levels.
+%
+% \medskip
% The option |tikz| gives Tikz parameters that will be given to the arrow when it is drawn (more precisely, the
% parameters will be given to the command |\path| of Tikz).
% \begin{macrocode}
- tikz .groups:n = {global,env,local,secondary},
- tikz .code:n = {\tl_put_right:Nn \l_@@_options_tikz_tl {,#1}},
+\keys_define:nn {WithArrows}
+ {tikz .code:n = {\tl_put_right:Nn \l_@@_options_tikz_tl {,#1}},
tikz .value_required:n = true,
% \end{macrocode}
%
% \bigskip
-% The following options can be used to specify the position of the arrows. We control that a previous specification
-% of position has not been set at the same level of option. This is done with the help of the flag
-% |\l_@@_position_key_already_set_bool|.
+% The other options are for the position of the arrows. The treatment is the same for the options |ll|, |rr|, |lr|,
+% |lr| and |i| and that's why a dedicated fonction |\@@_analyze_option_position:n| has been written (see below).
% \begin{macrocode}
- ll .groups:n = {global,env,local,secondary},
- ll .value_forbidden:n = true,
- ll .default:n = true,
- ll .code:n = {\bool_if:NT \l_@@_position_key_already_set_bool
- {\msg_error:nn {witharrows}
- {Two~options~are~incompatible}}
- \bool_if:NT \l_@@_group_bool
- {\msg_error:nn {witharrows}
- {Option~incompatible~with~group}}
- \bool_set_true:N \l_@@_position_key_already_set_bool
- \bool_set_false:N \l_@@_initial_r_bool
- \bool_set_false:N \l_@@_final_r_bool
- \bool_set_false:N \l_@@_i_bool },
+ rr .value_forbidden:n = true,
+ rr .code:n = {\@@_analyze_option_position:n 0},
+ ll .value_forbidden:n = true,
+ ll .code:n = {\@@_analyze_option_position:n 1},
+ rl .value_forbidden:n = true,
+ rl .code:n = {\@@_analyze_option_position:n 2},
+ lr .value_forbidden:n = true,
+ lr .code:n = {\@@_analyze_option_position:n 3},
+ i .value_forbidden:n = true,
+ i .code:n = {\@@_analyze_option_position:n 4},
% \end{macrocode}
%
+% \bigskip
+% The option |xoffset| change the $x$-offset of the arrows (towards the right). It's a dimension and not a skip.
+% It's not possible to change the value of this parameter for a individual arrow if the option |group| or the
+% option |groups| is used.
% \begin{macrocode}
- lr .groups:n = {global,env,local,secondary},
- lr .value_forbidden:n = true,
- lr .default:n = true,
- lr .code:n = {\bool_if:NT \l_@@_position_key_already_set_bool
- {\msg_error:nn {witharrows}
- {Two~options~are~incompatible}}
- \bool_if:NT \l_@@_group_bool
- {\msg_error:nn {witharrows}
- {Option~incompatible~with~group}}
- \bool_set_true:N \l_@@_position_key_already_set_bool
- \bool_set_false:N \l_@@_initial_r_bool
- \bool_set_true:N \l_@@_final_r_bool
- \bool_set_false:N \l_@@_i_bool},
+ xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l_@@_level_int = 2 &&
+ \int_compare_p:nNn \l_@@_pos_arrows_int > 4}
+ {\msg_error:nn {witharrows}
+ {Option~incompatible~with~"group(s)"}}
+ {\dim_set:Nn \l_@@_xoffset_dim {#1}}},
+ xoffset .value_required:n = true,
% \end{macrocode}
%
+% \bigskip
+% The option |jot| exists for compatibility. It changes directly the value of the parameter |\jot|, which is a
+% LaTeX parameter and not a parameter specific to \pkg{witharrows}. It's allowed only at the level of the
+% environment (maybe we should suppress completely this option in the future).
% \begin{macrocode}
- rl .groups:n = {global,env,local,secondary},
- rl .value_forbidden:n = true,
- rl .default:n = true,
- rl .code:n = {\bool_if:NT \l_@@_position_key_already_set_bool
- {\msg_error:nn {witharrows}
- {Two~options~are~incompatible}}
- \bool_if:NT \l_@@_group_bool
- {\msg_error:nn {witharrows}
- {Option~incompatible~with~group}}
- \bool_set_true:N \l_@@_position_key_already_set_bool
- \bool_set_true:N \l_@@_initial_r_bool
- \bool_set_false:N \l_@@_final_r_bool
- \bool_set_false:N \l_@@_i_bool},
+ jot .code:n = {\int_compare:nNnTF \l_@@_level_int = 1
+ {\dim_set:Nn \jot {#1}}
+ {\msg_error:nn {witharrows} {Option~will~be~ignored} }},
+ jot .value_required:n = true,
% \end{macrocode}
%
+% \bigskip
+% The option |interline| gives the vertical skip (=glue) inserted between two lines (independently of |\jot|). It's
+% accepted only at the level of the environment (this last point is a kind of security). Futhermore, this option has a
+% particular behaviour: it applies only to the current environment and doesn't apply to the nested environments.
% \begin{macrocode}
- rr .groups:n = {global,env,local,secondary},
- rr .value_forbidden:n = true,
- rr .default:n = true,
- rr .code:n = {\bool_if:NT \l_@@_position_key_already_set_bool
- {\msg_error:nn {witharrows}
- {Two~options~are~incompatible}}
- \bool_if:NT \l_@@_group_bool
- {\msg_error:nn {witharrows}
- {Option~incompatible~with~group}}
- \bool_set_true:N \l_@@_position_key_already_set_bool
- \bool_set_true:N \l_@@_initial_r_bool
- \bool_set_true:N \l_@@_final_r_bool
- \bool_set_false:N \l_@@_i_bool},
-% \end{macrocode}
-%
-% \bigskip
-% With option |i| (for \emph{intermediate}), the arrow will be drawn on the leftmost position compatible with all
-% the lines between the starting line and the final line of the arrow.
-% \begin{macrocode}
- i .groups:n = {global,env,local,secondary},
- i .code:n = {\bool_if:NT \l_@@_position_key_already_set_bool
- {\msg_error:nn {witharrows}
- {Two~options~are~incompatible}}
- \bool_if:NT \l_@@_group_bool
- {\msg_error:nn {witharrows}
- {Option~incompatible~with~group}}
- \bool_set_true:N \l_@@_position_key_already_set_bool
- \bool_set_true:N \l_@@_i_bool},
- i .value_forbidden:n = true,
- i .default:n = true,
+ interline .code:n = {\int_compare:nNnTF \l_@@_level_int = 1
+ {\skip_set:Nn \l_@@_interline_skip {#1}}
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}},
+ interline .value_required:n = true,
% \end{macrocode}
%
-% \bigskip
-% With the option |group|, \emph{all} the arrows of the environment are grouped on a same vertical line and at a
-% leftmost position. Of course, this option is not available at the local level.
-%
-% This key is not in the |secondary| group. Thus, it will be set first during the |\keys_set_filter:nnn| and an
-% incompatibility like, for example, |[i,group]| will be detected (with a non fatal error).
+% \bigskip
+% Eventually, a key |jump| (see below) and a key for unknown keys.
% \begin{macrocode}
- group .groups:n = {global,env},
- group .bool_set:N = \l_@@_group_bool,
- group .value_forbidden:n = true
+ jump .code:n = {\msg_error:nn {witharrows} {Option~will~be~ignored}},
+ unknown .code:n = {\msg_error:nn {witharrows} {Option~unknown}}
}
% \end{macrocode}
%
% \bigskip
-% We process the options when the package is loaded (with |\usepackage|) but we recommend to use |\WithArrowOptions| instead.
+% The key |jump| indicates the number of lines jumped by the arrow (1 by default). This key will be extracted when
+% the command |\Arrow| will be executed. That's why there is a special module for this key. The key |jump| is
+% extracted in the command |\Arrow| because we want to compute right away the final line of the arrow (this will be
+% useful for the options |group| and |groups|).
+% \begin{macrocode}
+\keys_define:nn {WithArrows/jump}
+ {jump .code:n = {\int_set:Nn \l_@@_jump_int {#1}
+ \int_compare:nNnF \l_@@_jump_int > 0
+ {\msg_error:nn {witharrows}
+ {The~option~"jump"~must~be~non~negative}}},
+ jump .value_required:n = true}
+% \end{macrocode}
+%
+% \bigskip
+% The following command is for technical reasons. It's used for the following options of position: |ll|,
+% |lr|, |rl|, |rr| and |i|. The argument is the corresponding code for the position of the arrows.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_analyze_option_position:n
+ {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1}
+ {\msg_error:nn {witharrows}
+ {Two~options~are~incompatible}}
+ \int_set:Nn \l_@@_previous_pos_arrows_int {#1}
+% \end{macrocode}
+%
+% It's not possible to use one of the considered options at the level of an arrow (level~2) when the option |group|
+% or the option |groups| is used. However, if we are at the level of an environment, it's possible to override a
+% previous option |group| or |groups| (this previous option |group| or |groups| would necessarily have been set at
+% a global level by |\WithArrowsOptions|).
+% \begin{macrocode}
+ \bool_if:nTF { \int_compare_p:nNn \l_@@_level_int = 2 &&
+ \int_compare_p:nNn \l_@@_pos_arrows_int > 4}
+ {\msg_error:nn {witharrows}
+ {Option~incompatible~with~"group(s)"}}
+ {\int_set:Nn \l_@@_pos_arrows_int {#1}}}
+% \end{macrocode}
+%
+% \bigskip
+% We process the options when the package is loaded (with |\usepackage|) but we recommend to use |\WithArrowsOptions| instead.
% \begin{macrocode}
\ProcessKeysOptions {WithArrows}
% \end{macrocode}
@@ -1381,9 +1379,9 @@ version 2005/12/01 or later.
% |\WithArrowsOptions| is the command of the \pkg{witharrows} package to fix options at the document level.
% \begin{macrocode}
\NewDocumentCommand \WithArrowsOptions {m}
- {\bool_set_false:N \l_@@_position_key_already_set_bool
- \keys_set_filter:nnn {WithArrows} {secondary} {#1}
- \keys_set_groups:nnn {WithArrows} {global} {#1}}
+ {\int_set:Nn \l_@@_previous_pos_arrows_int {-1}
+ \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl
+ \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl}
% \end{macrocode}
%
%
@@ -1409,11 +1407,12 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% We decide to extract immediatly the key |jump| in order to compute the end line. That's the reason why there is a
-% group |jump| with only one key (the key |jump|).
+% module |WithArrows/jump| with this sole key. The remainded key-value pairs are stored in |\l_tmpa_tl| and will be
+% stored further in the properly list of the arrow.
% \begin{macrocode}
\int_zero_new:N \l_@@_jump_int
\int_set:Nn \l_@@_jump_int 1
- \keys_set_groups:nnn {WithArrows} {jump} {#1,#3}
+ \keys_set_known:nnN {WithArrows/jump} {#1,#3} \l_tmpa_tl
% \end{macrocode}
%
% \medskip
@@ -1422,23 +1421,23 @@ version 2005/12/01 or later.
%
% \smallskip
% \begin{enumerate}
-% \item First, the line from which the arrow starts :
+% \item First, the line from which the arrow starts:
% \begin{macrocode}
\prop_put:NnV \l_tmpa_prop {initial} \g_@@_line_int
% \end{macrocode}
%
-% \item The line where the arrow ends (that's why it was necessary to extract the key |jump|) :
+% \item The line where the arrow ends (that's why it was necessary to extract the key |jump|):
% \begin{macrocode}
\int_set:Nn \l_tmpa_int {\g_@@_line_int + \l_@@_jump_int}
\prop_put:NnV \l_tmpa_prop {final} \l_tmpa_int
% \end{macrocode}
%
-% \item All the options of the arrow (it's a token list) :
+% \item All the options of the arrow (it's a token list):
% \begin{macrocode}
- \prop_put:Nnn \l_tmpa_prop {options} {#1,#3}
+ \prop_put:NnV \l_tmpa_prop {options} \l_tmpa_tl
% \end{macrocode}
%
-% \item The label of the arrow (it's also a token list) :
+% \item The label of the arrow (it's also a token list):
% \begin{macrocode}
\prop_put:Nnn \l_tmpa_prop {label} {#2}
% \end{macrocode}
@@ -1465,11 +1464,11 @@ version 2005/12/01 or later.
% created for this end.
% \begin{macrocode}
\NewDocumentEnvironment {WithArrows} {O{}}
- { \seq_gput_right:NV \g_@@_stack_counter_arrows_seq \g_@@_arrow_int
+ { \seq_gput_right:NV \g_@@_arrow_int_seq \g_@@_arrow_int
\int_gzero:N \g_@@_arrow_int
- \seq_gput_right:NV \g_@@_stack_counter_lines_seq \g_@@_line_int
+ \seq_gput_right:NV \g_@@_line_int_seq \g_@@_line_int
\int_gzero:N \g_@@_line_int
- \seq_gput_right:NV \g_@@_stack_counter_lines_bis_seq \g_@@_line_bis_int
+ \seq_gput_right:NV \g_@@_line_bis_int_seq \g_@@_line_bis_int
\int_gzero:N \g_@@_line_bis_int
% \end{macrocode}
%
@@ -1517,7 +1516,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% These three counters will be used later as variables.
+% These counters will be used later as variables.
% \begin{macrocode}
\int_zero_new:N \l_@@_initial_int
\int_zero_new:N \l_@@_final_int
@@ -1525,14 +1524,6 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The flag |\l_@@_position_key_already_set_bool| is set to false before the treatment of the options of the
-% environment. It will be raised if a key indicating the position of the arrows is found. Thus, we can detect
-% incompatible keys.
-% \begin{macrocode}
- \bool_set_false:N \l_@@_position_key_already_set_bool
-% \end{macrocode}
-%
-% \bigskip
% The value corresponding to the key |interline| is put to zero before the treatment of the options of the
% environment.\footnote{It's recalled that, by design, the option \texttt{interline} of a environment doesn't apply
% in the nested environments.}
@@ -1541,32 +1532,29 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The following code in order to raise an error if a key is unknown.
+% We process the options given to the |{WithArrows}| environment. The level of options is set to 1.
% \begin{macrocode}
- \keys_set_filter:nnn {WithArrows} {secondary} {#1}
+ \int_set:Nn \l_@@_previous_pos_arrows_int {-1}
+ \int_set:Nn \l_@@_level_int 1
+ \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl
+ \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl
% \end{macrocode}
%
% \bigskip
-% We process the options given at the \emph{env} level, that is to say in the option of the |{WithArrows}| environment.
-% \begin{macrocode}
- \keys_set_groups:nnn {WithArrows} {env} {#1}
-% \end{macrocode}
-%
-% \bigskip
-% If the user has given a value for the option |CommandName| (at the global or at the \emph{env} level), a command
-% with this name is defined locally in the environment with meaning |\@@_Arrow|. The default value of the option
-% |CommandName| is ``|Arrow|'' and thus, by default, the name of the command will be |\Arrow|.
+% If the user has given a value for the option |CommandName| (at the global or at the \emph{environment} level), a
+% command with this name is defined locally in the environment with meaning |\@@_Arrow|. The default value of the
+% option |CommandName| is ``|Arrow|'' and thus, by default, the name of the command will be |\Arrow|.
% \begin{macrocode}
\cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow
% \end{macrocode}
%
% \bigskip
% The environment begins with a |\vtop|, a |\vcenter| or a |\vbox|\footnote{Notice that the use of
-% \texttt{\string\vtop} seems color-safe here...} depending of the value of |\l_@@_pos_int| (usually fixed by the
-% options |t|, |c| or |b|). The environment |{WithArrows}| must be used in math mode\footnote{An error is raised if
-% the environment is used outside math mode.} and therefore, we can use |\vcenter|.
+% \texttt{\string\vtop} seems color-safe here...} depending of the value of |\l_@@_pos_env_int| (fixed by the options
+% |t|, |c| or |b|). The environment |{WithArrows}| must be used in math mode\footnote{An error is raised if the
+% environment is used outside math mode.} and therefore, we can use |\vcenter|.
% \begin{macrocode}
- \int_case:nn \l_@@_pos_int
+ \int_case:nn \l_@@_pos_env_int
{0 {\vtop}
1 {\vcenter}
2 {\vbox}}
@@ -1609,7 +1597,7 @@ version 2005/12/01 or later.
%
% \bigskip
% We create the ``left node'' of the line (when using macros in Tikz node names, the macros have to be fully
-% expandable : here, |\tl_use:N| and |\int_use:N| are fully expandable).
+% expandable: here, |\tl_use:N| and |\int_use:N| are fully expandable).
% \begin{macrocode}
\tikz[remember~picture]
\node [@@_node_style]
@@ -1641,7 +1629,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% We begin the second part of the environment |{WithArrows}|. We have two |\egroup| : one for the |\halign| and
+% We begin the second part of the environment |{WithArrows}|. We have two |\egroup|: one for the |\halign| and
% one for the |\vtop| (or |\vcenter| or |\vbox|).
% \begin{macrocode}
{\crcr
@@ -1658,11 +1646,18 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% It there is really arrows in the environment, we draw the arrows with |\@@_draw_arrows:| (a special macro has
-% been written for lisibility of the code).
+% It there is really arrows in the environment, we draw the arrows:
+% \begin{itemize}
+% \item if neither option |group| or |groups| is used, we can draw directly ;
+% \item if option |group| or option |groups| is used (|\l_@@_pos_arrows_int| > 4), we have to draw the
+% arrows group by group ; the macro |\@@_draw_arrows:| does the work.
+% \end{itemize}
+%
% \begin{macrocode}
\int_compare:nNnT \g_@@_arrow_int > 0
- \@@_draw_arrows:
+ {\int_compare:nNnTF \l_@@_pos_arrows_int > 4
+ \@@_draw_arrows:
+ {\@@_draw_arrows:nn 1 \g_@@_arrow_int}}
% \end{macrocode}
%
% \bigskip
@@ -1681,7 +1676,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% We update the value of the counter |\g_@@_last_env_int|. This counter is used only by the fonction |\WithArrowsLastEnv|.
+% We update the value of the counter |\g_@@_last_env_int|. This counter is used only by the user function |\WithArrowsLastEnv|.
% \begin{macrocode}
\int_compare:nNnT {\seq_count:N \g_@@_position_in_the_tree_seq} = 1
{\int_gincr:N \g_@@_last_env_int}
@@ -1691,11 +1686,11 @@ version 2005/12/01 or later.
% Finally, we restore the previous values of the three counters |\g_@@_arrow_int|, |\g_@@_line_int| and
% |\g_@@_line_bis_int|. It is recalled that we manage three stacks in order to be able to do such a restoration.
% \begin{macrocode}
- \seq_gpop_right:NN \g_@@_stack_counter_arrows_seq {\l_tmpa_tl}
+ \seq_gpop_right:NN \g_@@_arrow_int_seq {\l_tmpa_tl}
\int_gset:Nn \g_@@_arrow_int {\l_tmpa_tl}
- \seq_gpop_right:NN \g_@@_stack_counter_lines_seq \l_tmpa_tl
+ \seq_gpop_right:NN \g_@@_line_int_seq \l_tmpa_tl
\int_gset:Nn \g_@@_line_int {\l_tmpa_tl}
- \seq_gpop_right:NN \g_@@_stack_counter_lines_bis_seq \l_tmpa_tl
+ \seq_gpop_right:NN \g_@@_line_bis_int_seq \l_tmpa_tl
\int_gset:Nn \g_@@_line_bis_int {\l_tmpa_tl}
}
% \end{macrocode}
@@ -1704,7 +1699,7 @@ version 2005/12/01 or later.
% \bigskip
% We give now the definition of |\@@_cr:| which is the definition of |\\| in an environment |{WithArrows}|. The two
% \pkg{expl3} commands |\group_align_safe_begin:| and |\group_align_safe_end:| are specifically designed for this
-% purpose : test the token that follows in a |\halign| structure.
+% purpose: test the token that follows in a |\halign| structure.
%
% First, we remove an eventual token |*| since the commands |\\| and |\\*| are equivalent in an environment
% |{WithArrows}| (an environment |{WithArrows}|, like an environment |{aligned}| of \pkg{amsmath} is always unbreakable).
@@ -1731,44 +1726,140 @@ version 2005/12/01 or later.
%
% \subsection{We draw the arrows}
%
-% The following code is necessary because we will have to expand an argument exactly 3 times.
+% \bigskip
+% |\@@_draw_arrows:| draws the arrows when the option |group| or the option |groups| is used. In both cases, we have
+% to compute the $x$-value of a group of arrows before actually drawing the arrows of that group. The arrows will
+% actually be drawn by the macro |\@@_draw_arrows:nn|.
+%
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_draw_arrows:
+ { \group_begin:
+% \end{macrocode}
+%
+% \bigskip
+% |\l_@@_first_arrow_of_group_int| will be the first arrow of the current group.
+%
+% |\l_@@_first_line_of_group_int| will be the first line involved in the group of arrows (equal to the initial line
+% of the first arrow of the group because the option |jump| is always positive).
+%
+% |\l_@@_last_line_of_group_int| will be the last line involved in the group (impossible to guess in advance).
% \begin{macrocode}
-\cs_generate_variant:Nn \keys_set_groups:nnn {nno}
-\cs_new_protected:Nn \keys_set_groups_WithArrows_local:
- {\keys_set_groups:nno {WithArrows} {local}}
+ \int_zero_new:N \l_@@_first_arrow_of_group_int
+ \int_zero_new:N \l_@@_first_line_of_group_int
+ \int_zero_new:N \l_@@_last_line_of_group_int
+ \bool_set_true:N \l_@@_new_group_bool
% \end{macrocode}
%
% \bigskip
+% We begin a loop over all the arrows of the environment. Inside this loop, if a group is finished, we will draw
+% the lines of that group.
+% \begin{macrocode}
+ \int_set:Nn \l_@@_arrow_int 1
+ \int_until_do:nNnn \l_@@_arrow_int > \g_@@_arrow_int
+ {
+% \end{macrocode}
+%
+% \bigskip
+% We extract from the property list of the current arrow the fields ``initial'' and ``final'' and we store these
+% values in |\l_@@_initial_int| and |\l_@@_final_int|. However, we have to do a conversion because the components
+% of a property list are token lists.
% \begin{macrocode}
-\cs_generate_variant:Nn \keys_set_filter:nnn {nno}
-\cs_new_protected:Nn \keys_set_filter_WithArrows_secondary:
- {\keys_set_filter:nno {WithArrows} {secondary}}
+ \prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _\int_use:N\l_@@_arrow_int _prop}
+ {initial} \l_tmpa_tl
+ \int_set:Nn \l_@@_initial_int {\l_tmpa_tl}
+ \prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _\int_use:N\l_@@_arrow_int _prop}
+ {final} \l_tmpa_tl
+ \int_set:Nn \l_@@_final_int {\l_tmpa_tl}
% \end{macrocode}
%
% \bigskip
+% 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 (with the $x$-value computed in |\g_@@_x_dim|).
% \begin{macrocode}
-\cs_new_protected:Nn \@@_draw_arrows:
- {
+ \bool_if:nT { \int_compare_p:nNn \l_@@_pos_arrows_int = 6
+ && \int_compare_p:nNn \l_@@_arrow_int > 1
+ && \int_compare_p:nNn \l_@@_initial_int > \l_@@_last_line_of_group_int}
+ {\@@_draw_arrows:nn \l_@@_first_arrow_of_group_int {\l_@@_arrow_int - 1}
+ \bool_set_true:N \l_@@_new_group_bool}
% \end{macrocode}
%
-% \medskip
-% If the option |group| is used (for the whole document --- with |\WithArrowsOptions| --- or for the current environment),
-% we have to compute the $x$-value common to all the arrows. This work is done by the command
-% |\@@_x_computation_for_option_group:| and the computed $x$-value is store in |\g_@@_x_dim| (we use a global
-% variable for technical reasons).
+% \bigskip
+% The flag |\l_@@_new_group_bool| indicates if we have to begin a new group of arrows. In fact, We have to begin a
+% new group in two circonstancies : if we are at the first arrow of the environment (that's why the flag is raised
+% before the beginning of the loop) an if we have just finished a group (that's why the flag is raised in the
+% previous conditionnal). At the beginning of a group, we have to initialize four variables:
+% |\l_@@_first_arrow_int|, |\l_@@_first_line_of_group_int|, |\l_@@_last_line_of_group| dans |\g_@@_x_dim| (global
+% for technical reasons). The last two will evolve during the construction of the group.
% \begin{macrocode}
- \bool_if:NT \l_@@_group_bool
- \@@_x_computation_for_option_group:
+ \bool_if:nTF \l_@@_new_group_bool
+ {\bool_set_false:N \l_@@_new_group_bool
+ \int_set:Nn \l_@@_first_arrow_of_group_int \l_@@_arrow_int
+ \int_set:Nn \l_@@_first_line_of_group_int \l_@@_initial_int
+ \int_set:Nn \l_@@_last_line_of_group_int \l_@@_final_int
+ \tikz[remember~picture]
+ \path let \p1 = (wa-\tl_use:N\l_@@_prefix_tl-\int_use:N\l_@@_initial_int-l)
+ in \pgfextra {\dim_gset:Nn \g_@@_x_dim {\x1}} ;
+ }
% \end{macrocode}
%
% \bigskip
+% If we are not at the beginning of a new group, we actualize |\l_@@_last_line_of_group_int|.
+% \begin{macrocode}
+ {\int_set:Nn \l_@@_last_line_of_group_int
+ {\int_max:nn \l_@@_last_line_of_group_int \l_@@_final_int}}
+% \end{macrocode}
+%
+% \bigskip
+% We actualise the current $x$-value (in |\g_@@_x_dim|) even if we are at the beginning of a group. Indeed, the
+% previous initialisation of |\g_@@_x_dim| only considers the initial line of the arrows and now we consider all
+% the lines between the initial and the final line. This is done with |\@@_actualise_x_value:nn|. We have written a
+% command for this because it is also used with the option |i| (|\l_@@_pos_arrows_int| = 4).
+% \begin{macrocode}
+ \@@_actualise_x_value:nn \l_@@_initial_int \l_@@_final_int
+% \end{macrocode}
+%
+% \bigskip
+% Incrementation of the index of the loop (and end of the loop).
+% \begin{macrocode}
+ \int_incr:N \l_@@_arrow_int
+ }
+% \end{macrocode}
+%
+% \bigskip
+% After the last arrow of the environment, you have to draw the last group of arrows.
+% \begin{macrocode}
+ \@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int
+ \group_end:
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The following code is necessary because we will have to expand an argument exactly 3 times.
+% \begin{macrocode}
+\cs_generate_variant:Nn \keys_set:nn {no}
+\cs_new_protected:Nn \keys_set_WithArrows: {\keys_set:no {WithArrows}}
+% \end{macrocode}
+%
+%
+% \bigskip
+% The macro |\@@_draw_arrows:nn| draws all the arrows whose numbers are between |#1| and |#2|. |#1| and |#2|
+% must be expressions that expands to an integer (they are expanded in the beginning of the macro).
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_draw_arrows:nn
+ {\group_begin:
+ \int_zero_new:N \l_@@_first_arrow_int
+ \int_set:Nn \l_@@_first_arrow_int {#1}
+ \int_zero_new:N \l_@@_last_arrow_int
+ \int_set:Nn \l_@@_last_arrow_int {#2}
+% \end{macrocode}
+%
+%
+% \bigskip
% We begin a loop over the arrows of the environment. The variable |\l_@@_arrow_int| (local in the environment
-% |{WithArrows}|) will be used as index for the loop. The number of arrows in the environment is |\g_@@_arrow_int|.
-% This variable was a counter incremented when an arrows is encountered during the construction of the |\halign|.
-% After the end of the |\halign|, |g_@@_arrow_int| is the number of arrows in the environment.
+% |{WithArrows}|) will be used as index for the loop.
% \begin{macrocode}
- \int_set:Nn \l_@@_arrow_int 1
- \int_until_do:nNnn \l_@@_arrow_int > \g_@@_arrow_int
+ \int_set:Nn \l_@@_arrow_int \l_@@_first_arrow_int
+ \int_until_do:nNnn \l_@@_arrow_int > \l_@@_last_arrow_int
{
% \end{macrocode}
%
@@ -1777,8 +1868,6 @@ version 2005/12/01 or later.
% values in |\l_@@_initial_int| and |\l_@@_final_int|. However, we have to do a conversion because the components
% of a property list are token lists.
%
-% \smallskip
-% If the arrow ends after the last line of the environment, we raise an error.
% \begin{macrocode}
\prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _\int_use:N\l_@@_arrow_int _prop}
{initial} \l_tmpa_tl
@@ -1786,37 +1875,72 @@ version 2005/12/01 or later.
\prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _\int_use:N\l_@@_arrow_int _prop}
{final} \l_tmpa_tl
\int_set:Nn \l_@@_final_int {\l_tmpa_tl}
+% \end{macrocode}
+%
+% \bigskip
+% If the arrow ends after the last line of the environment, we raise an error.
+% \begin{macrocode}
\int_compare:nNnT \l_@@_final_int > \g_@@_line_int
{\msg_error:nn {witharrows} {Too~few~lines~for~an~arrow}}
% \end{macrocode}
%
% \bigskip
-% We begin an TeX group which will contains the options local to the current arrow. We declare ``undefined'' the
-% key |group| because it's not possible to have a |group| key for an individual arrow.
+% We prepare the process of the options of the current arrow.
% \begin{macrocode}
\group_begin:
- \keys_define:nn {WithArrows} {group .undefine:}
- \bool_set_false:N \l_@@_position_key_already_set_bool
+ \int_set:Nn \l_@@_previous_pos_arrows_int {-1}
+ \int_set:Nn \l_@@_level_int 2
% \end{macrocode}
%
% \bigskip
-% We process the options of the current arrow. The third argument de |\keys_set_groups:nnn| must be expanded exactly
+% We process the options of the current arrow. The second argument of |\keys_set:nn| must be expanded exactly
% three times. An x-expansion is not possible because there can be tokens like |\bfseries| in the option |font| of
% the option |tikz|. This expansion is a bit tricky.
% \begin{macrocode}
\prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl
_\int_use:N\l_@@_arrow_int _prop} {options} \l_tmpa_tl
- \exp_args:NNo \exp_args:No \keys_set_filter_WithArrows_secondary: {\l_tmpa_tl}
- \exp_args:NNo \exp_args:No \keys_set_groups_WithArrows_local: {\l_tmpa_tl}
+ \exp_args:NNo \exp_args:No \keys_set_WithArrows: {\l_tmpa_tl}
+% \end{macrocode}
+%
+%
+% We create two booleans to indicate the position of the initial node and final node of the arrow in cases of
+% options |rr|, |rl|, |lr| or |ll|:
+% \begin{macrocode}
+\bool_set_false:N \l_@@_initial_r_bool
+\bool_set_false:N \l_@@_final_r_bool
+\int_case:nn \l_@@_pos_arrows_int
+ {0 {\bool_set_true:N \l_@@_initial_r_bool
+ \bool_set_true:N \l_@@_final_r_bool}
+ 2 {\bool_set_true:N \l_@@_initial_r_bool}
+ 3 {\bool_set_true:N \l_@@_final_r_bool}}
% \end{macrocode}
%
% \bigskip
-% In case of option |i|, we have to compute the $x$-value of the arrow (which is vertical). This work is done by
-% the command |\@@_x_computation_for_option_i:| and the computed $x$-value is stored in |g_@@_x_dim| (the same
-% variable used when the option |group| is used).
+% In case of option |i| (|\l_@@_pos_arrows_int| = 4), we have to compute the $x$-value of the arrow (which is
+% vertical). The computed $x$-value is stored in |\g_@@_x_dim| (the same variable used when the option |group| or
+% the option |groups| is used). This variable is global for technical reasons: we have to do assignments in a Tikz
+% node.
% \begin{macrocode}
- \bool_if:NT \l_@@_i_bool
- \@@_x_computation_for_option_i:
+ \int_compare:nNnT \l_@@_pos_arrows_int = 4
+ {
+% \end{macrocode}
+%
+% \medskip
+% First, we calculate the initial value for |\g_@@_x_dim|. We use a Tikz command, but, in fact, nothing is drawn.
+% We use this Tikz command only to read the abscissa of a Tikz node.
+% \begin{macrocode}
+ \tikz[remember~picture]
+ \path let \p1 = (wa-\tl_use:N\l_@@_prefix_tl-\int_use:N\l_@@_initial_int-l)
+ in \pgfextra {\dim_gset:Nn \g_@@_x_dim {\x1}} ;
+% \end{macrocode}
+% A global assignment is necessary because of Tikz.
+%
+% Then, we will loop to determine the maximal length of all the lines between the lines |\l_@@_initial_int| and
+% |\l_@@_final_int|... but we have written a command dedicated to this work because it will also be used in
+% |\@@_draw_arrows:|.
+% \begin{macrocode}
+ \@@_actualise_x_value:nn \l_@@_initial_int \l_@@_final_int
+ }
% \end{macrocode}
%
% \bigskip
@@ -1832,10 +1956,10 @@ version 2005/12/01 or later.
\bool_if:NTF\l_@@_final_r_bool rl . north}
% \end{macrocode}
% We use ``|. north|'' because we want a small gap between two consecutive arrows (and the Tikz nodes created have
-% the shape of small vertical segments : use option |shownodes| to visualize the nodes).
+% the shape of small vertical segments: use option |shownodes| to visualize the nodes).
%
% \bigskip
-% We can now draw the arrow in a |{tikzpicture}| :
+% We can now draw the arrow in a |{tikzpicture}|:
% \begin{macrocode}
\begin{tikzpicture}[remember~picture,
overlay,
@@ -1848,17 +1972,14 @@ version 2005/12/01 or later.
bend~left=45]
% \end{macrocode}
%
-% Of course, the arrow is drawn with the command |\draw| of Tikz. The syntax for this command is :
+% Of course, the arrow is drawn with the command |\draw| of Tikz. The syntax for this command is:
%
% \qquad |\draw| $(x_1,y_1)$ |to node| (\textsl{name}) |{|\textsl{contents}|}| $(x_2,y_2)$
%
% The surprising aspect of this syntax is the position of \textsl{contents} which is the label of the arrow.
%
-% We give a name to the node (\textsl{name} in the previous syntax) but, in fact, we don't use it in the extension
-% |witharrows|.
-%
% |\p1| and |\p2| are the two ends of the arrow (in fact, if the option |i| or the option |group| is used, it's not
-% exactly the two ends of the arrow because, in this case, this abscissa used is the value previously calculated in
+% exactly the two ends of the arrow because, in this case, the abscissa used is the value previously calculated in
% |g_@@_x_dim|).
%
% The ability to define |\p1| and |\p2| is given by the library |calc| of Tikz. When |\p1| and |\p2| are defined,
@@ -1870,19 +1991,19 @@ version 2005/12/01 or later.
\draw \exp_after:wN [\l_@@_options_tikz_tl]
let \p1 = (\tl_use:N \l_@@_initial_tl),
\p2 = (\tl_use:N \l_@@_final_tl) in
- (\bool_if:nTF {\l_@@_group_bool || \l_@@_i_bool}
+ (\int_compare:nNnTF \l_@@_pos_arrows_int > 3
{\dim_use:N \g_@@_x_dim + \dim_use:N \l_@@_xoffset_dim, \y1}
{\x1 + \dim_use:N \l_@@_xoffset_dim, \y1} )
% \end{macrocode}
-% There are two ways to give the content of the node : the classical way, with curly braces, and the option ``node
-% contents''. However, both are not strictly equivalent : when |\usetikzlibrary{babel}| is used, the tokens of the
+% There are two ways to give the content of the node: the classical way, with curly braces, and the option ``node
+% contents''. However, both are not strictly equivalent: when |\usetikzlibrary{babel}| is used, the tokens of the
% contents are rescanned in the first way but not in the second. We don't want the tokens to be rescanned (because
% this would lead to an error due of the characters |_| and |:| of the \pkg{expl3} syntax) and that's why we use
-% the second method. \footnote{cf. :
+% the second method. \footnote{cf.:
% |tex.stackexchange.com/questions/298177/how-to-get-around-a-problem-with-usetikzlibrarybabel|}
% \begin{macrocode}
to node [node~contents = {\tl_use:N \l_tmpa_tl}] {}
- (\bool_if:nTF {\l_@@_group_bool || \l_@@_i_bool}
+ (\int_compare:nNnTF \l_@@_pos_arrows_int > 3
{\dim_use:N \g_@@_x_dim + \dim_use:N \l_@@_xoffset_dim, \y2}
{\x2 + \dim_use:N \l_@@_xoffset_dim, \y2} ) ;
\end{tikzpicture}
@@ -1894,44 +2015,21 @@ version 2005/12/01 or later.
\group_end:
\int_incr:N \l_@@_arrow_int
}
+ \group_end:
}
% \end{macrocode}
%
% \bigskip
-% We want to compute the $x$-value for the current arrow which has option |i| (and therefore is vertical).
-% This value will be computed in |\g_@@_x_dim| (which is global for technical reasons : we have to do assignments in
-% a Tikz command).
+% The command |\@@_actualise_x_value:nn| will analyze the lines between |#1| and |#2| in order to modify
+% |\g_@@_x_dim| in consequence. More precisely, |\g_@@_x_dim| is increased if a line longer than the current value
+% of |\g_@@_x_dim| is found. |\@@_actualise_x_value:nn| is used in |\@@_draw_arrows:| (for options |group| and
+% |groups|) and in |\@@_draw_arrows:nn| (for option |i|).
% \begin{macrocode}
-\cs_new_protected:Nn \@@_x_computation_for_option_i:
- {\dim_gzero_new:N \g_@@_x_dim
-% \end{macrocode}
-%
-% \medskip
-% First, we calculate the initial value for |\g_@@_x_dim|. In this loop, we use a Tikz command, but, in fact,
-% nothing is drawn. We use this Tikz command only to read the abscissa of a Tikz node.
-% \begin{macrocode}
- \tikz[remember~picture]
- \path let \p1 = (wa-\tl_use:N\l_@@_prefix_tl-\int_use:N\l_@@_initial_int-l)
- in \pgfextra {\dim_gset:Nn \g_@@_x_dim {\x1}} ;
-% \end{macrocode}
-% A global assignment is necessary because of Tikz.
-%
-% Then, we will loop to determine the maximal length of all the lines between the lines |\l_@@_initial_int| and
-% |\l_@@_final_int|... but we have written a command dedicated to this work because it will also be used in
-% |\@@_x_computation_for_option_group:|
-% \begin{macrocode}
- \@@_x_computation_analyze_lines_between:
- }
-% \end{macrocode}
-%
-%
-% \bigskip
-% The command |\@@_x_computation_analyze_lines_between:| will analyse the lines between between |\l_@@_initial_int|
-% and |\l_@@_final_int| in order to modify |\g_@@_x_dim| in consequence. More precisely, we will increase
-% |\g_@@_x_dim| if we find a line longer than the current value of |\g_@@_x_dim|.
-% \begin{macrocode}
-\cs_new_protected:Nn \@@_x_computation_analyze_lines_between:
- {\int_compare:nNnT \l_@@_final_int > \g_@@_line_int
+\cs_new_protected:Nn \@@_actualise_x_value:nn
+ {\group_begin:
+ \int_set:Nn \l_@@_initial_int {#1}
+ \int_set:Nn \l_@@_final_int {#2}
+ \int_compare:nNnT \l_@@_final_int > \g_@@_line_int
{\msg_error:nn {witharrows} {Too~few~lines~for~an~arrow}}
% \end{macrocode}
%
@@ -1945,67 +2043,19 @@ version 2005/12/01 or later.
in \pgfextra {\dim_gset:Nn \g_@@_x_dim {\dim_max:nn \g_@@_x_dim {\x1}}} ;
\int_incr:N \l_tmpa_int
}
+ \group_end:
}
% \end{macrocode}
%
-%
-% \bigskip
-% We want to compute the $x$-value for the current environment which has option |group| (and therefore all arrows are
-% vertical at the same abscissa). Once again, the value will be computed in |\g_@@_x_dim|.
-%
% \begin{macrocode}
-\cs_new_protected:Nn \@@_x_computation_for_option_group:
- {\dim_gzero_new:N \g_@@_x_dim
-% \end{macrocode}
-%
-% \medskip
-% First, we calculate the initial value for |\g_@@_x_dim|. In this loop, we use a Tikz command, but, once again,
-% nothing is drawn. We use this Tikz command only to read the abscissa of a Tikz node.
-% \begin{macrocode}
- \prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _1_prop} {initial} \l_tmpa_tl
- \tikz[remember~picture]
- \path let \p1 = (wa-\tl_use:N\l_@@_prefix_tl-\tl_use:N\l_tmpa_tl-l)
- in \pgfextra {\dim_gset:Nn \g_@@_x_dim {\x1}} ;
-% \end{macrocode}
-% A global assignment is necessary because of Tikz.
-%
-% Then, we loop to determine the maximal length of all the lines concerned by the arrows of the environment.
-% \begin{macrocode}
- \int_set:Nn \l_@@_arrow_int 1
- \int_until_do:nNnn \l_@@_arrow_int > \g_@@_arrow_int
- {
-% \end{macrocode}
-% \smallskip
-% |\l_@@_initial_int| is the line number from which the arrow starts and |\l_@@_final_int| is the line number to which
-% the arrow ends.
-% \begin{macrocode}
- \prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _\int_use:N\l_@@_arrow_int _prop}
- {initial} \l_tmpa_tl
- \int_set:Nn \l_@@_initial_int {\l_tmpa_tl}
- \prop_get:cnN {g_@@_arrow_\l_@@_prefix_tl _\int_use:N\l_@@_arrow_int _prop}
- {final} \l_tmpa_tl
- \int_set:Nn \l_@@_final_int {\l_tmpa_tl}
-% \end{macrocode}
-%
-% \smallskip
-% |\@@_x_computation_analyze_lines_between:| will compute between lines |\l_@@_initial_int| and |\l_@@_final_int|.
-% \begin{macrocode}
- \@@_x_computation_analyze_lines_between:
- \int_incr:N \l_@@_arrow_int
- }
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_generate_variant:Nn \int_compare:nNnT {cNnT}
\cs_generate_variant:Nn \tl_if_eq:nnF {noF}
% \end{macrocode}
%
%
-\bigskip
+% \bigskip
% The command |\WithArrowsLastEnv| is not used by the package \pkg{witharrows}. It's only a facility given to the
-% final user. It gives the number of the last environment |{WithArrows}| at level~$0$. This macro is fully
-% expandable and, thus, can be used directly in the name of a Tikz node.
+% final user. It gives the number of the last environment |{WithArrows}| at level~$0$ (to the sens of the nested
+% environments). This macro is fully expandable and, thus, can be used directly in the name of a Tikz node.
% \begin{macrocode}
\NewDocumentCommand \WithArrowsLastEnv {}
{\int_use:N \g_@@_last_env_int}
@@ -2052,19 +2102,24 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\msg_new:nnn {witharrows}
- {Option~incompatible~with~group}
- {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~while~
- you~are~using~the~option~"group".~It's~incompatible.~You~can~go~on~ignoring~
- this~option~"\tl_use:N\l_keys_key_tl"~and~"group"~will~be~used.}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\msg_new:nnn {witharrows}
- {Two~options~are~incompatible}
- {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~
- this~option~is~incompatible~with~an~option~previously~set.~
- If~you~go~on,~I~will~overwrite~the~previous~option.}
+\msg_new:nnn {witharrows}
+ {Two~options~are~incompatible}
+ {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~
+ this~option~is~incompatible~or~redundant~with~the~option~"
+ \int_case:nn\l_@@_previous_pos_arrows_int
+ {0 {rr}
+ 1 {ll}
+ 2 {rl}
+ 3 {lr}
+ 4 {i}
+ 5 {group}
+ 6 {groups}}"~
+ previously~set~in~the~same~
+ \int_case:nn\l_@@_level_int
+ {0 {command~\string\WithArrowsOptions}
+ 1 {declaration~of~options~of~the~environment~\{WithArrows\}}
+ 2 {command~\string\Arrow}}.~
+ If~you~go~on,~I~will~overwrite~the~first~option.}
% \end{macrocode}
%
% \begin{macrocode}
@@ -2077,6 +2132,35 @@ version 2005/12/01 or later.
(e.g.~if~you~use~\string\MoveEqLeft\space~of~mathtools).}
% \end{macrocode}
%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
+ {Option~incompatible~with~"group(s)"}
+ {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~while~
+ you~are~using~the~option~"
+ \int_compare:nNnTF \l_@@_pos_arrows_int = 5
+ {group}
+ {groups}".~
+ It's~incompatible.~You~can~go~on~ignoring~this~option~
+ "\tl_use:N\l_keys_key_tl"~but~you~should~correct~your~code.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
+ {Option~will~be~ignored}
+ {The~option~"\tl_use:N\l_keys_key_tl"~can't~be~used~here.~
+ If~you~go~on,~it~will~be~ignored.}
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
+ {Option~unknown}
+ {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~meaningless~in~the~context.~
+ If~you~go~on,~it~will~be~ignored.}
+% \end{macrocode}
+%
+%
+%
%
% \section{History}
%
@@ -2091,6 +2175,15 @@ version 2005/12/01 or later.
% Better error messages
%
% Creation of a \textsc{dtx} file
+%
+% \subsection{Changes between versions 1.1 and 1.2}
+%
+% The package \pkg{witharrows} can now be loaded without having loaded previously \pkg{tikz} and the Tikz libraries |calc|,
+% |arrow.meta| and |bending|.
+%
+% New option |groups| (with a \emph{s})
+%
+% Better error messages
% \endinput
%
% Local Variables: