summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-22 20:51:58 +0000
committerKarl Berry <karl@freefriends.org>2020-06-22 20:51:58 +0000
commit17704765562fe7fb37c673221b8798a23fce1e30 (patch)
tree13e76558d43be395341c18d35670ea446ea3c31f /Master/texmf-dist
parent72f942a238cb172eea71c1d955e21fac7fd8575d (diff)
witharrows (22jun20)
git-svn-id: svn://tug.org/texlive/trunk@55625 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/generic/witharrows/README.md7
-rw-r--r--Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdfbin260589 -> 266363 bytes
-rw-r--r--Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex160
-rw-r--r--Master/texmf-dist/doc/generic/witharrows/witharrows.pdfbin616385 -> 639742 bytes
-rw-r--r--Master/texmf-dist/doc/generic/witharrows/witharrows.tex240
-rw-r--r--Master/texmf-dist/source/generic/witharrows/witharrows.dtx609
-rw-r--r--Master/texmf-dist/tex/generic/witharrows/witharrows.sty248
7 files changed, 1015 insertions, 249 deletions
diff --git a/Master/texmf-dist/doc/generic/witharrows/README.md b/Master/texmf-dist/doc/generic/witharrows/README.md
index a8453ea275f..3ca957c2a0b 100644
--- a/Master/texmf-dist/doc/generic/witharrows/README.md
+++ b/Master/texmf-dist/doc/generic/witharrows/README.md
@@ -22,11 +22,12 @@ The package `witharrows` is present in the distributions MiKTeX, TeXLive and Mac
For a manual installation:
-* put the files `witharrows.ins` dans `witharrows.dtx` in the same directory;
+* put the files `witharrows.ins` and `witharrows.dtx` in the same directory;
* run `latex witharrows.ins`.
The files `witharrows.sty` and `witharrows.tex` will be generated.
-The file `witharrows.sty` is the only file necessary to use the extension `witharrows` with LaTeX (with `\usepackage{witharrows}`).
+The file `witharrows.sty` is the only file necessary to use the extension `witharrows` with LaTeX (with `\usepackage{witharrows}`). You have to put it in the same directory as your document or (best) in a `texmf` tree.
-The file `witharrows.tex` is the only file necessary to use the extension `witharrows` with plain-TeX (with `\input{witharrows}`).
+
+The file `witharrows.tex` is the only file necessary to use the extension `witharrows` with plain-TeX (with `\input{witharrows}`). You have to put it in the same directory as your document or (best) in a `texmf` tree.
diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf
index ffb9a424e29..9a9a5e39182 100644
--- a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf
+++ b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex
index 1d3605543ae..95b3e772566 100644
--- a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex
+++ b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex
@@ -82,11 +82,11 @@ le calcul mathématique présenté.
\vspace{1cm}
Dans la suite, on décrira l'extension LaTeX \pkg{witharrows} (néanmoins \pkg{witharrows} peut aussi être utilisé en
-plain-TeX : voir à ce sujet p.~\pageref{plain-TeX}). Cette extension peut être utilisée avec |xelatex|,
-|lualatex|, |pdflatex| mais aussi avec le cheminement classique |latex|-|dvips|-|ps2pdf|
-(ou Adobe Distiller). L'extension \pkg{witharrows} charge les extensions \pkg{expl3}, \pkg{xparse}, \pkg{tikz}
-ainsi que les extensions Tikz \pkg{arrows.meta} et \pkg{bending}. Les flèches sont tracées avec Tikz et donc
-plusieurs compilations peuvent être nécessaires.
+plain-TeX : voir à ce sujet p.~\pageref{plain-TeX}). Cette extension peut être utilisée avec |xelatex|, |lualatex|,
+|pdflatex| mais aussi avec le cheminement classique |latex|-|dvips|-|ps2pdf| (ou Adobe Distiller). L'extension
+\pkg{witharrows} charge les extensions \pkg{l3keys2e}, \pkg{xparse}, \pkg{tikz}, \pkg{varwidth} ainsi que les
+bibliothèques Tikz \pkg{arrows.meta} et \pkg{bending}. Les flèches sont tracées avec Tikz et donc plusieurs
+compilations peuvent être nécessaires.
\bigskip
Cette extension fournit un environnement |{WithArrows}| pour construire des alignements d'équations
@@ -95,7 +95,7 @@ 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
+ & = a^2 + 2a + 1 % <------ ne pas mettre de \\ ici
\end{WithArrows}$
\end{Verbatim}
@@ -209,7 +209,7 @@ A & = (a+1)^2 \Arrow[tikz=<-]{on factorise} \\
\end{WithArrows}$
\interitem
-Il est aussi possible de supprimer les deux pointes de flèche avec l'option Tikz «|-|».
+Il est aussi possible de supprimer les deux pointes de flèche avec l'option Tikz «|-|».\par\nobreak
\begin{Verbatim}
$\begin{WithArrows}
A & = (a+1)^2 \Arrow[~emphase#tikz=-@]{très classique} \\
@@ -494,7 +494,6 @@ 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}
@@ -507,7 +506,6 @@ k & \;\le\; & t & \;\le\; & k+1 \\
\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}
@@ -559,7 +557,7 @@ l'une des options |lr|, |rl| et |ll| (\emph{l} for \emph{left} en anglais). Ces
non verticales.
-Therefore
+Ainsi\enskip
$\begin{WithArrows}[displaystyle]
I
& = \int_{\frac{\pi}4}^0 \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)(-d u)
@@ -600,6 +598,7 @@ $\begin{WithArrows}
\interitem
L'environnement |{WithArrows}| propose aussi une option |group|. Avec cette option,
\emph{toutes} les flèches de l'environnement sont regroupées sur une même verticale calée à gauche.
+\label{group}
%
\begin{Verbatim}[formatcom=\small\color{gray}]
$\begin{WithArrows}[~emphase#displaystyle,group@]
@@ -636,12 +635,12 @@ une même verticale qui est calée à gauche.
\bigskip
$\begin{WithArrows}[groups]
-A & = B \Arrow{one} \\
- & = C+D \Arrow{two} \\
+A & = B \Arrow{un} \\
+ & = C+D \Arrow{deux} \\
& = D' \\
& = E+F+G+H+I \\
- & = K + L + M \Arrow{three}\\
- & = N \Arrow{four}\\
+ & = K + L + M \Arrow{trois}\\
+ & = N \Arrow{quatre}\\
& = O
\end{WithArrows}$
@@ -685,6 +684,90 @@ $\begin{WithArrows}[interline=1mm,groups]
& = \frac1{\cos^nx}\cdot\frac{\sin(n+1)x}{\sin x}
\end{WithArrows}$
+
+\interitem
+\section{L'option « o » pour des flèches individuelles}
+
+\label{option-o}
+
+Considérons, dans un environnement donné, deux flèches notées formellement $a$ et $b$.
+
+On notera $i_a$ et $i_b$ les numéros des lignes de départ de $a$ et $b$ et $f_a$ et $f_b$ les numéros de leurs
+lignes d'arrivée. On a bien entendu $i_a \le f_a$ et $i_b \le f_b$
+
+\smallskip
+On dira que la flèche~$a$ \emph{recouvre} la flèche~$b$ lorsque $i_a \le i_b \le f_b \le f_a$
+
+
+\medskip
+\parbox{8cm}{Dans l'exemple ci-contre, la flèche rouge recouvre la flèche bleue.}\hspace{3cm}
+$\begin{WithArrows}[c]
+A & = B \Arrow[tikz=red,jump=3]{}\\
+ & = C \Arrow[tikz=blue]{}\\
+ & = D \\
+ & = E
+\end{WithArrows}$
+
+\bigskip
+Au niveau local, il existe une option |o|. Cette option n'est disponible que lorsque l'on est en mode |group| ou bien
+en mode |groups| (cf. p.~\pageref{group}).
+
+Une flèche de type |o| est tracée avec un décalage horizontal (comme celui fixé par |xoffset|) calculé
+automatiquement en fonction des flèches qu'elle recrouvre.\footnote{Parmi les flèches recouvertes, les flèches
+ indépendantes (c'est-à-dire celles qui ont une option explicite |rr|, |ll|, |rl|, |lr|, |i|, |up| ou |down|) ne
+ sont pas prises en compte pour le calcul du |xoffset|.}
+
+
+\bigskip
+\begin{BVerbatim}[boxwidth=10cm,baseline=c]
+$\begin{WithArrows}[groups]
+A & = B \Arrow{un}\Arrow[~emphase#o@,jump=3]{direct} \\
+ & = C + C \Arrow{deux} \\
+ & = D + D + D \Arrow{trois} \\
+ & = E + E \\
+ & = F + F
+\end{WithArrows}$
+\end{BVerbatim}
+$\begin{WithArrows}[c,groups]
+A & = B \Arrow{un}\Arrow[o,jump=3]{direct} \\
+ & = C + C \Arrow{deux} \\
+ & = D + D + D \Arrow{trois} \\
+ & = E + E \\
+ & = F + F
+\end{WithArrows}$
+
+
+
+\interitem
+Les flèches de type |o| peuvent elles-mêmes être recouvertes par d'autres flèches de type~|o|:\par\nobreak
+
+\bigskip
+\begin{BVerbatim}
+$\begin{WithArrows}[groups]
+A & = B \Arrow{un}\Arrow[~emphase#o@,jump=2]{deux}\Arrow[~emphase#o@,jump=3]{trois}\\
+ & = C \\
+ & = D \\
+ & = E + E + E + E + E + E + E
+\end{WithArrows}$
+\end{BVerbatim}
+
+
+\bigskip
+$\begin{WithArrows}[c,groups]
+A & = B \Arrow{un}\Arrow[o,jump=2]{deux}\Arrow[o,jump=3]{trois}\\
+ & = C \\
+ & = D \\
+ & = E + E + E + E + E + E + E
+\end{WithArrows}$
+
+\bigskip
+L'espace (horizontal) entre une flèche de type \verb|o| et les flèches immédiatement recouvertes est fixé par le
+paramètre \verb|xoffset-for-o-arrows| que l'on peut régler avec \verb|\WithArrowsOptions| (valeur initiale : 2~mm).
+
+\bigskip
+\emph{Remarque} : La lettre |o| a été choisie car c'est la première lettre du mot anglais \emph{over}. Une flèche
+de type~|o| est \emph{au-dessus} des flèches qu'elle recouvre.
+
\interitem
\section{Les options « up » et « down » pour des flèches individuelles}
@@ -717,8 +800,8 @@ A & = B
\vspace{1cm}
-Les options |up| et |down| nécessitent l'extension \pkg{varwidth} et l'extension Tikz \pkg{calc}. Si elles n'ont
-pas été chargées au préalable par l'utilisateur, une erreur sera levée.
+Les options |up| et |down| nécessitent la bibliothèque Tikz \pkg{calc}. Si elle n'a pas été chargée au préalable par
+l'utilisateur, une erreur sera levée.
\vspace{1cm}
Les options |up| et |down| peuvent en fait prendre comme valeur une liste de couples clé-valeur.
@@ -1283,7 +1366,8 @@ P & \vartriangleleft Q
\medskip
Dans le cas présent, il aurait été plus facile d'utiliser une commande |\Arrow| dans le |code-after| mais
-c'était seulement un exemple pour expliquer comment les nœuds Tikz créés par \pkg{witharrows} peuvent être utilisés.
+c'était seulement un exemple pour illustrer comment les nœuds Tikz créés par \pkg{witharrows} peuvent être
+utilisés.
\bigskip
Dans l'exemple suivant, on crée des environnements |{WithArrows}| nommés «|premier|» et «|second|» et on dessine
@@ -2113,6 +2197,48 @@ $\begin{WithArrows}[interline=0.5ex]
\bigskip
+\subsection{Une commande \textbackslash DoubleArrow}
+
+En utilisant l'option |o| (cf. p. \pageref{option-o}) disponible au niveau local, on peut facilement écrire une
+commande |\DoubleArrow| pour deux flèches allant en sens inverse l'une de l'autre.
+
+\bigskip
+\begin{Verbatim}
+\NewDocumentCommand \DoubleArrow { O {} m m }
+ {
+ \Arrow[tikz=->,~#1]{~#2}%
+ \Arrow[o,tikz=<-,~#1]{~#3}
+ }
+\end{Verbatim}
+
+
+\NewDocumentCommand \DoubleArrow { O {} m m }
+ {
+ \Arrow[tikz=->,#1]{#2}%
+ \Arrow[o,tikz=<-,#1]{#3}
+ }
+
+
+\bigskip
+Exemple d'utilisation :
+
+\begin{Verbatim}
+$\begin{WithArrows}[groups]
+A & = (a+b)^2 \DoubleArrow[tikz={font=\bfseries}]{développement}{factorisation} \\
+ & = a^2 + 2ab+b^2
+\end{WithArrows}$
+\end{Verbatim}
+
+\bigskip
+$\begin{WithArrows}[groups]
+A & = (a+b)^2 \DoubleArrow[tikz={font=\bfseries}]{développement}{factorisation} \\
+ & = a^2 + 2ab+b^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
diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf b/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf
index 31c50353bfc..64cd930e620 100644
--- a/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf
+++ b/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows.tex b/Master/texmf-dist/doc/generic/witharrows/witharrows.tex
index 3655e422ca1..b1c30db494b 100644
--- a/Master/texmf-dist/doc/generic/witharrows/witharrows.tex
+++ b/Master/texmf-dist/doc/generic/witharrows/witharrows.tex
@@ -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{2.4}
-\def\myfiledate{2020/03/31}
+\def\myfileversion{2.5}
+\def\myfiledate{2020/06/22}
\input tikz.tex
\input expl3-generic.tex
\usetikzlibrary{arrows.meta,bending}
@@ -41,7 +41,7 @@
\clist_map_inline:nn
{
amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
- typedref, unicode-math, varwidth
+ typedref, unicode-math
}
{
\bool_new:c { c__witharrows_#1_loaded_bool }
@@ -188,6 +188,9 @@
\dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim
\dim_new:N \l__witharrows_up_and_down_radius_dim
\dim_set:Nn \l__witharrows_up_and_down_radius_dim { 4 pt }
+\seq_new:N \l__witharrows_o_arrows_seq
+\dim_new:N \l__witharrows_xoffset_for_o_arrows_dim
+\dim_set:Nn \l__witharrows_xoffset_for_o_arrows_dim { 2 mm }
\cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1
{
\str_if_empty:NTF \l__witharrows_previous_key_str
@@ -405,6 +408,8 @@
allow-duplicate-names .code:n =
\__witharrows_msg_redirect_name:nn { Duplicate~name } { none } ,
allow-duplicate-names .value_forbidden:n = true ,
+ xoffset-for-o-arrows .dim_set:N = \l__witharrows_xoffset_for_o_arrows_dim ,
+ xoffset-for-o-arrows .value_required:n = true ,
unknown .code:n =
\__witharrows_sort_seq:N \l__witharrows_options_WithArrowsOptions_seq
\__witharrows_error:n { Unknown~option~WithArrowsOptions }
@@ -416,7 +421,7 @@
displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
mathindent, max-length-of-arrow, no-arrows, up-and-down, rl, rr,
show-node-names, show-nodes, start-adjust, t, tikz, wrap-lines, xoffset,
- ygap, ystart,
+ xoffset-for-o-arrows, ygap, ystart,
}
\cs_new_protected:Npn \__witharrows_set_independent:
{
@@ -450,11 +455,22 @@
rl .default:n = NoValue ,
lr .default:n = NoValue ,
i .default:n = NoValue ,
- new-group .value_forbidden:n = true,
+ new-group .value_forbidden:n = true ,
new-group .code:n =
\int_compare:nTF { \l__witharrows_pos_arrow_int = 6 }
{ \str_set:Nn \l__witharrows_status_arrow_str { new-group } }
{ \__witharrows_error:n { new-group~without~groups } } ,
+ o .code:n =
+ \str_if_empty:NTF \l__witharrows_previous_key_str
+ {
+ \int_compare:nNnTF \l__witharrows_pos_arrow_int < 6
+ { \__witharrows_error:n { invalid~key~o } }
+ {
+ \str_set:Nn \l__witharrows_status_arrow_str { over }
+ \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str
+ }
+ }
+ { \__witharrows_error:n { Incompatible~options~in~Arrow } } ,
tikz-code .code:n = \prg_do_nothing: ,
tikz-code .value_required:n = true ,
tikz .code:n = \prg_do_nothing: ,
@@ -479,8 +495,8 @@
\seq_new:N \l__witharrows_options_Arrow_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_seq
{
- adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code,
- xoffset
+ adjust, end-adjust, i, jump, ll, lr, o , rl, rr, start-adjust, tikz,
+ tikz-code, xoffset
}
\cs_new_protected:Npn \__witharrows_fix_pos_arrow:n #1
{
@@ -501,6 +517,7 @@
rl .code:n = \__witharrows_fix_pos_arrow:n 2 ,
lr .code:n = \__witharrows_fix_pos_arrow:n 0 ,
i .code:n = \__witharrows_fix_pos_arrow:n 5 ,
+ o .code:n = \str_set:Nn \l__witharrows_previous_key_str { o } ,
xoffset .code:n =
\bool_if:nTF
{
@@ -548,6 +565,7 @@
\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_put:Nnn \l_tmpa_prop { width } { 0 pt }
\prop_gclear_new:c
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop }
\prop_gset_eq:cN
@@ -781,12 +799,12 @@
\bool_if:NT \l__witharrows_in_DispWithArrows_bool
{
&
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgfcoordinate
- { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v }
- \pgfpointorigin
- \endpgfpicture
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgfcoordinate
+ { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v }
+ \pgfpointorigin
+ \endpgfpicture
}
\dim_compare:nNnT { #1 } < \c_zero_dim
{ \__witharrows_error:n { option~of~cr~negative } }
@@ -932,7 +950,9 @@
{ pgf @ sh @ ns @ wa - \l__witharrows_prefix_str - \l_tmpa_int - v }
{ \__witharrows_fatal:n { Inexistent~v-node } }
{
- \pgfpointanchor { wa - \l__witharrows_prefix_str - \l_tmpa_int - v } { center }
+ \pgfpointanchor
+ { wa - \l__witharrows_prefix_str - \l_tmpa_int - v }
+ { center }
\dim_compare:nNnT \pgf@x < \g__witharrows_right_x_dim
{ \dim_gset_eq:NN \g__witharrows_right_x_dim \pgf@x }
}
@@ -993,15 +1013,18 @@
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8
{ \__witharrows_error:n { Too~few~lines~for~an~arrow } }
}
- \__witharrows_code_for_possible_arrow:
+ \__witharrows_treat_an_arrow_in_scan:
\int_incr:N \l__witharrows_arrow_int
}
- \bool_lazy_and:nnT
- { \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } }
- { \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 }
+ \bool_if:nT
+ {
+ ! \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7
+ &&
+ \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0
+ }
{ \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int }
}
-\cs_new_protected:Npn \__witharrows_code_for_possible_arrow:
+\cs_new_protected:Npn \__witharrows_treat_an_arrow_in_scan:
{
\bool_lazy_and:nnT
{ \int_compare_p:nNn \l__witharrows_arrow_int > 1 }
@@ -1040,8 +1063,7 @@
{ \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } }
}
{
- \bool_if:nF
- { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } }
+ \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
{
\int_compare:nT
{ \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int }
@@ -1058,7 +1080,7 @@
}
}
}
- \bool_if:nF { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } }
+ \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
{
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8
{ \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int }
@@ -1085,12 +1107,21 @@
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
{ final } \l_tmpa_tl
\int_set:Nn \l__witharrows_final_int \l_tmpa_tl
- \int_compare:nT { \l__witharrows_final_int <= \g__witharrows_line_int } \__witharrows_draw_arrows_i:
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
+ { status } \l__witharrows_status_arrow_str
+ \int_compare:nNnF \l__witharrows_final_int > \g__witharrows_line_int
+ {
+ \str_if_eq:VnTF \l__witharrows_status_arrow_str { over }
+ { \seq_put_right:NV \l__witharrows_o_arrows_seq \l__witharrows_arrow_int }
+ \__witharrows_draw_arrow:
+ }
\int_incr:N \l__witharrows_arrow_int
}
+ \__witharrows_draw_o_arrows_of_the_group:
\group_end:
}
-\cs_new_protected:Npn \__witharrows_draw_arrows_i:
+\cs_new_protected:Npn \__witharrows_draw_arrow:
{
\group_begin:
\prop_get:cnN
@@ -1208,18 +1239,28 @@
\cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3
{
\tikzpicture
- [
- __witharrows_standard ,
- every~path / .style = WithArrows / arrow
- ]
+ [
+ __witharrows_standard ,
+ every~path / .style = WithArrows / arrow
+ ]
+ \pgf@relevantforpicturesizetrue
#1
+ \dim_compare:nNnTF \pgf@picminx = { 16000 pt }
+ { \dim_set_eq:NN \l_tmpa_dim \c_zero_dim }
+ { \dim_set:Nn \l_tmpa_dim { \pgf@picmaxx - \pgf@picminx } }
+ \dim_add:Nn \l_tmpa_dim \l__witharrows_xoffset_dim
+ \prop_gput:cnV
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
+ { width }
+ \l_tmpa_dim
+ \pgfresetboundingbox
\endtikzpicture
}
}
\cs_new_protected:Npn \__witharrows_draw_arrow:nnn #1 #2 #3
{
\bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool
- { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl }
+ { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl }
\exp_args:NV \__witharrows_def_function_tmpa:n \l__witharrows_tikz_code_tl
\__witharrows_tmpa:nnn { #1 } { #2 } { #3 }
}
@@ -1241,7 +1282,7 @@
{
\path ( __witharrows_label.west )
node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ]
- { #3 } ;
+ { #3 } ;
}
}
\cs_new_protected:Npn \__witharrows_update_x:nn #1 #2
@@ -1257,7 +1298,90 @@
\endpgfpicture
\dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim
}
-\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int }
+\cs_new_protected:Npn \__witharrows_draw_o_arrows_of_the_group:
+ {
+ \seq_sort:Nn \l__witharrows_o_arrows_seq
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { final } \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop }
+ { final } \l_tmpb_tl
+ \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
+ \sort_return_same:
+ {
+ \int_compare:nNnTF \l_tmpa_tl > \l_tmpb_tl
+ \sort_return_swapped:
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { initial } \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop }
+ { initial } \l_tmpb_tl
+ \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
+ \sort_return_swapped:
+ \sort_return_same:
+ }
+ }
+ }
+ \seq_map_inline:Nn \l__witharrows_o_arrows_seq
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { initial } \l_tmpa_tl
+ \int_set:Nn \l__witharrows_initial_int \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { final } \l_tmpa_tl
+ \int_set:Nn \l__witharrows_final_int \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { input-line } \l__witharrows_input_line_str
+ \dim_gzero:N \g_tmpa_dim
+ \bool_set_false:N \g_tmpa_bool
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \int_step_inline:nnn \l__witharrows_first_arrow_int \l__witharrows_last_arrow_int
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { initial } \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { final } \l_tmpb_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { status } \l__witharrows_status_arrow_str
+ \bool_if:nT
+ {
+ ! \int_compare_p:n { ##1 = ####1 }
+ && \int_compare_p:n { \l__witharrows_initial_int <= \l_tmpa_tl }
+ && \int_compare_p:n { \l_tmpb_tl <= \l__witharrows_final_int }
+ && ! \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent }
+ }
+ {
+ \bool_gset_true:N \g_tmpa_bool
+ \prop_get:cnN
+ { g__witharrows _ arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { width }
+ \l_tmpa_tl
+ \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \l_tmpa_tl }
+ }
+ }
+ \endpgfpicture
+ \bool_if:NTF \g_tmpa_bool
+ {
+ \int_set:Nn \l__witharrows_arrow_int { ##1 }
+ \dim_set_eq:NN \l__witharrows_xoffset_dim \g_tmpa_dim
+ \dim_add:Nn \l__witharrows_xoffset_dim \l__witharrows_xoffset_for_o_arrows_dim
+ \__witharrows_draw_arrow:
+ }
+ { \__witharrows_error:n { o~arrow~with~no~arrow~under } }
+ }
+ }
+\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g__witharrows_last_env_int }
\keys_define:nn { WithArrows / Arrow / code-after }
{
tikz .code:n =
@@ -1476,6 +1600,12 @@
must~not~be~empty.\\
\c__witharrows_option_ignored_str
}
+\__witharrows_msg_new:nn { invalid~key~o }
+ {
+ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~
+ 'group'~or~in~mode~'groups'.\\
+ \c__witharrows_option_ignored_str
+ }
\__witharrows_msg_new:nn { Value~for~a~key }
{
The~key~'\l_keys_key_str'~should~be~used~without~value. \\
@@ -1574,11 +1704,17 @@
{ Too~few~lines~for~an~arrow }
{
Line~\l__witharrows_input_line_str\
- :~an~arrow~specified~in~the~row~\int_use:N \l__witharrows_initial_int\
+ :~an~arrow~specifiead~in~the~row~\int_use:N \l__witharrows_initial_int\
of~your~environment~\{\l__witharrows_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.
}
+\__witharrows_msg_new:nn { o~arrow~with~no~arrow~under }
+ {
+ Line~\l__witharrows_input_line_str\
+ :~there~is~no~arrow~'under'~your~arrow~of~type~'o'.\\
+ If~you~go~on,~this~arrow~won't~be~drawn.
+ }
\__witharrows_msg_new:nn { WithArrows~outside~math~mode }
{
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~
@@ -1588,7 +1724,7 @@
\__witharrows_msg_new:nn { DispWithArrows~in~math~mode }
{
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~
- mode~like~the~environment~\{align\}~of~amsmath. \\
+ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\
This~error~is~fatal.
}
\__witharrows_msg_new:nn { Incompatible~options~in~Arrow }
@@ -1830,37 +1966,31 @@
\str_if_empty:NT \l__witharrows_previous_key_str
{
\str_set:Nn \l__witharrows_previous_key_str { up }
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
- \int_set:Nn \l__witharrows_pos_arrow_int 1
- \bool_set_false:N \l__witharrows_wrap_lines_bool
- \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl
- }
- { \__witharrows_error:n { calc~not~loaded } }
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
+ {
+ \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
+ \int_set:Nn \l__witharrows_pos_arrow_int 1
+ \bool_set_false:N \l__witharrows_wrap_lines_bool
+ \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl
+ }
+ { \__witharrows_error:n { calc~not~loaded } }
} ,
down .code:n =
\str_if_empty:NT \l__witharrows_previous_key_str
{
\str_set:Nn \l__witharrows_previous_key_str { down }
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
- \int_set:Nn \l__witharrows_pos_arrow_int 1
- \bool_set_false:N \l__witharrows_wrap_lines_bool
- \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl
- }
- { \__witharrows_error:n { calc~not~loaded } }
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
+ {
+ \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
+ \int_set:Nn \l__witharrows_pos_arrow_int 1
+ \bool_set_false:N \l__witharrows_wrap_lines_bool
+ \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl
+ }
+ { \__witharrows_error:n { calc~not~loaded } }
}
}
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { down }
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { up }
-\__witharrows_msg_new:nn { varwidth~not~loaded }
- {
- You~can't~use~the~option~'\l_keys_key_str'~because~
- you~don't~have~loaded~the~package~'varwidth'. \\
- \c__witharrows_option_ignored_str
- }
\__witharrows_msg_new:nn { calc~not~loaded }
{
You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~
diff --git a/Master/texmf-dist/source/generic/witharrows/witharrows.dtx b/Master/texmf-dist/source/generic/witharrows/witharrows.dtx
index fc8cd3ae2a6..9a4b5067ef3 100644
--- a/Master/texmf-dist/source/generic/witharrows/witharrows.dtx
+++ b/Master/texmf-dist/source/generic/witharrows/witharrows.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{2.4}
-\def\myfiledate{2020/03/31}
+\def\myfileversion{2.5}
+\def\myfiledate{2020/06/22}
%
%
%<*batchfile>
@@ -96,13 +96,12 @@ version 2005/12/01 or later.
% \end{abstract}
%
%
-% \vspace{1cm}
-% In this document, we describe the LaTeX extension
+% \vspace{1cm} In this document, we describe the LaTeX extension
% \pkg{witharrows} (however, \pkg{witharrows} can also be used with plain-TeX:
% see p.~\pageref{plain-TeX}). This package can be used with |xelatex|,
% |lualatex|, |pdflatex| but also by the classical workflow
% |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). This package loads the packages
-% \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse}, \pkg{tikz} and the Tikz libraries
+% \pkg{l3keys2e}, \pkg{xparse}, \pkg{varwidth}, \pkg{tikz} and the Tikz libraries
% \pkg{arrows.meta} and \pkg{bending}. The arrows are drawn with Tikz and that's
% why several compilations may be necessary.
%
@@ -113,7 +112,7 @@ version 2005/12/01 or later.
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 ~emphase#\Arrow{we expand}@ \\
-% & = a^2 + 2a + 1 % don't put \\ here
+% & = a^2 + 2a + 1 % <------- don't put \\ here
% \end{WithArrows}$
% \end{Verbatim}
%
@@ -500,6 +499,7 @@ version 2005/12/01 or later.
% command |\MultiArrow|: these commands are described in the section concerning
% the nested environments, p.~\pageref{NestedEnv}.
%
+% \interitem
% \section{Numbers of columns}
%
% So far, we have used the environment |{WithArrows}| with two columns. However,
@@ -556,6 +556,7 @@ version 2005/12/01 or later.
% \end{DispWithArrows*}
%
%
+% \interitem
% \section{Precise positioning of the arrows}
%
%
@@ -638,6 +639,7 @@ version 2005/12/01 or later.
% The environment |{WithArrows}| gives also a |group| option. With this option,
% \emph{all} the arrows of the environment are grouped on a same vertical line
% and at a leftmost position.
+% \label{group}
% %
% \begin{Verbatim}[formatcom=\small\color{gray}]
% $\begin{WithArrows}[~emphase#displaystyle,group@]
@@ -724,6 +726,88 @@ version 2005/12/01 or later.
% & = \frac1{\cos^nx}\cdot\frac{\sin(n+1)x}{\sin x}
% \end{WithArrows}$
%
+%
+% \interitem
+% \section[The option 'o' for individual arrows]%
+% {The option ``o'' for individual arrows}
+%
+% \label{option-o}
+%
+% Let's consider, in a given environment, two arrows called $a$ and $b$.
+% We will note $i_a$ and $i_b$ the numbers of the initial lines of $a$ et $b$
+% dans $f_a$ and $f_b$ the numbers of the final lines. Of course, we have $i_a
+% \le f_a$ and $i_b \le f_b$
+%
+% \smallskip
+% We will say that the arrow~$a$ \emph{covers} the arrow~$b$ when $i_a \le i_b
+% \le f_b \le f_a$. We will also say that the arrow $a$ is \emph{over} the arrow~$b$.
+%
+% \bigskip
+% \parbox{8cm}{In the exemple on the right, the red arrow covers the blue one.}\hspace{3cm}
+% $\begin{WithArrows}[c]
+% A & = B \Arrow[tikz=red,jump=3]{}\\
+% & = C \Arrow[tikz=blue]{}\\
+% & = D \\
+% & = E
+% \end{WithArrows}$
+%
+% \medskip
+% On the local level, there exists a key |o|. This key is available only when
+% the option |group| or the option |groups| is in force (cf.~p.~\pageref{group}).
+%
+% An arrow of type |o| is drawn with an horizontal shift (such as those set by
+% |xoffset|) automatically computed by taking into account the arrows covered by
+% our arrow.\footnote{Among the covered arrows, the independent ones (that is to
+% say with an explicit key |rr|, |ll|, |lr|, |rl|, |i|, |up| or |down|) are not
+% taken into account in the computation of the value of |xoffset|.}
+%
+% \bigskip
+% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
+% $\begin{WithArrows}[groups]
+% A & = B \Arrow{one}\Arrow[~emphase#o@,jump=3]{direct} \\
+% & = C + C \Arrow{two} \\
+% & = D + D + D \Arrow{three} \\
+% & = E + E \\
+% & = F + F
+% \end{WithArrows}$
+% \end{BVerbatim}
+% $\begin{WithArrows}[c,groups]
+% A & = B \Arrow{one}\Arrow[o,jump=3]{direct} \\
+% & = C + C \Arrow{two} \\
+% & = D + D + D \Arrow{three} \\
+% & = E + E \\
+% & = F + F
+% \end{WithArrows}$
+%
+%
+% \interitem
+% Arrows of type |o| may themselves be covered by other arrows of type~|o|.\par\nobreak
+%
+% \bigskip
+% \begin{BVerbatim}
+% $\begin{WithArrows}[groups]
+% A & = B \Arrow{one}\Arrow[~emphase#o@,jump=2]{two}\Arrow[~emphase#o@,jump=3]{three}\\
+% & = C \\
+% & = D \\
+% & = E + E + E + E + E + E + E
+% \end{WithArrows}$
+% \end{BVerbatim}
+%
+%
+% \bigskip
+% $\begin{WithArrows}[c,groups]
+% A & = B \Arrow{one}\Arrow[o,jump=2]{two}\Arrow[o,jump=3]{three}\\
+% & = C \\
+% & = D \\
+% & = E + E + E + E + E + E + E
+% \end{WithArrows}$
+%
+% \bigskip
+% The horizontal space between an arrow of type |o| and the arrows immediately
+% covered is fixed by the dimension \verb|xoffset-for-o-arrows| which can be set
+% which the command |\WithArrowsOptions| (initial value: 2~mm).
+%
+%
% \interitem
%
% \section[The options 'up' and 'down' for individual arrows]%
@@ -757,9 +841,8 @@ version 2005/12/01 or later.
%
%
% \vspace{1cm}
-% The options |up| and |down| require the package \pkg{varwidth} and the Tikz
-% library \pkg{calc}. It they are not previously loaded by the user, an error
-% will be raised.
+% The options |up| and |down| require the Tikz library \pkg{calc}. It it has not
+% been previously loaded by the user, an error will be raised.
%
% \vspace{1cm}
% In fact, the options |up| and |down| may be used with a value which is a list
@@ -1019,6 +1102,7 @@ version 2005/12/01 or later.
% \right.$
%
%
+% \interitem
% \section{Arrows in nested environments}
%
% \label{NestedEnv}
@@ -1102,7 +1186,7 @@ version 2005/12/01 or later.
% \bigskip
% The specification of the row is constructed with the position of the concerned
% environment in the nesting tree, followed (after an hyphen) by the number of
-% the row.
+% that row.
%
% \bigskip
% In the previous example, there are two environments |{WithArrows}| nested in
@@ -1223,7 +1307,7 @@ version 2005/12/01 or later.
% in a future release).
%
%
-% \bigskip
+% \interitem
% \section{Arrows from outside environments \{WithArrows\}}
%
% If someone wants to draw arrows from outside the environments |{WithArrows}|,
@@ -1388,6 +1472,7 @@ version 2005/12/01 or later.
% to ([xshift=3mm]second-1-r.north) ;
% \end{tikzpicture}
%
+% \interitem
% \section{The environment \{DispWithArrows\}}
% \label{DispWithArrows}
%
@@ -1534,7 +1619,7 @@ version 2005/12/01 or later.
% \medskip
% In the following example, the key |{subequations}| is fixed by the command
% |\WithArrowsOptions|. Each environment |{DispWithArrows}| will be subnumerated
-% (in the scope of the |\WithArrowsOptions|)
+% (in the scope of |\WithArrowsOptions|)
% \begin{Verbatim}
% ~emphase#\WithArrowsOptions{subequations}@
% First environment.
@@ -1782,7 +1867,7 @@ version 2005/12/01 or later.
% ``|replace-left-brace-by = [\enskip|'' will compose with a bracket and add also a
% |\enskip| after this bracket.
%
-% \bigskip
+% \interitem
% \section{Advanced features}
%
% \subsection{Utilisation with plain-TeX}
@@ -1813,6 +1898,7 @@ version 2005/12/01 or later.
% deal with the number of the equations are not available (since they rely upon
% the system of tags of LaTeX).
%
+% \bigskip
% \subsection{The option tikz-code : how to change the shape of the arrows}
%
% \label{tikz-code}
@@ -2153,6 +2239,7 @@ version 2005/12/01 or later.
%
%
%
+% \interitem
% \section{Examples}
%
% \subsection{\textbackslash MoveEqLeft}
@@ -2189,6 +2276,49 @@ version 2005/12/01 or later.
%
%
% \bigskip
+% \subsection{A command \textbackslash DoubleArrow}
+%
+% By using the key |o| (cf. p. \pageref{option-o}) available at the local level,
+% it's easy to write a command |\DoubleArrow| for two arrows going in opposite
+% directions.
+%
+% \bigskip
+% \begin{Verbatim}
+% \NewDocumentCommand \DoubleArrow { O {} m m }
+% {
+% \Arrow[tikz=->,~#1]{~#2}%
+% \Arrow[o,tikz=<-,~#1]{~#3}
+% }
+% \end{Verbatim}
+%
+%
+% \NewDocumentCommand \DoubleArrow { O {} m m }
+% {
+% \Arrow[tikz=->,#1]{#2}%
+% \Arrow[o,tikz=<-,#1]{#3}
+% }
+%
+%
+% \bigskip
+% Example of utilisation:
+%
+% \begin{Verbatim}
+% $\begin{WithArrows}[groups]
+% A & = (a+b)^2 \DoubleArrow[tikz={font=\bfseries}]{expansion}{factorization} \\
+% & = a^2 + 2ab+b^2
+% \end{WithArrows}$
+% \end{Verbatim}
+%
+% \bigskip
+% $\begin{WithArrows}[groups]
+% A & = (a+b)^2 \DoubleArrow[tikz={font=\bfseries}]{expansion}{factorization} \\
+% & = a^2 + 2ab+b^2
+% \end{WithArrows}$
+%
+%
+%
+%
+% \bigskip
% \subsection{Modifying the shape of the nodes}
%
% It's possible to change the shape of the labels, which are Tikz nodes, by
@@ -2506,7 +2636,6 @@ version 2005/12/01 or later.
% \begin{macrocode}
%<*LaTeX>
\RequirePackage{tikz}
-\RequirePackage{expl3}[2020/02/08]
%</LaTeX>
%<*plain-TeX>
\input tikz.tex
@@ -2546,11 +2675,9 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The package \pkg{xparse} will be used to define the environments
-% |{WithArrows}|, |{DispWithArrows}|, |{DispWithArrows*}| and the commands
-% |\Arrow|, |\WithArrowsOptions| and |\WithArrowsNewStyle|.
% \begin{macrocode}
\RequirePackage { xparse } [ 2019-01-01 ]
+\RequirePackage { varwidth }
%</LaTeX>
% \end{macrocode}
%
@@ -2739,7 +2866,7 @@ version 2005/12/01 or later.
\clist_map_inline:nn
{
amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
- typedref, unicode-math, varwidth
+ typedref, unicode-math
}
{
\bool_new:c { c_@@_#1_loaded_bool }
@@ -3194,7 +3321,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The parameter |\l_@@_up_and_down_radius_dim| corresponds to the option
+% The parameter |\l_@@_up_and_down_radius_dim| corresponds to option
% |radius_for_up_and_down|.
% \begin{macrocode}
\dim_new:N \l_@@_up_and_down_radius_dim
@@ -3202,6 +3329,23 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% The sequence |\l_@@_o_arrows_seq| will be used to store the numbers of the
+% arrows which are of type |o| (for \emph{over}) (they are drawn \emph{after}
+% the other arrows).
+% \begin{macrocode}
+\seq_new:N \l_@@_o_arrows_seq
+% \end{macrocode}
+%
+% \bigskip
+% The dimension |\l_@@_xoffset_for_o_arrows_dim| is the xoffset added when
+% drawing an arrow of type |o| (for \emph{over}).
+%
+% \begin{macrocode}
+\dim_new:N \l_@@_xoffset_for_o_arrows_dim
+\dim_set:Nn \l_@@_xoffset_for_o_arrows_dim { 2 mm }
+% \end{macrocode}
+%
+% \bigskip
% \subsection{The definition of the options}
%
% There are four levels where options can be set:
@@ -3591,6 +3735,8 @@ version 2005/12/01 or later.
allow-duplicate-names .code:n =
\@@_msg_redirect_name:nn { Duplicate~name } { none } ,
allow-duplicate-names .value_forbidden:n = true ,
+ xoffset-for-o-arrows .dim_set:N = \l_@@_xoffset_for_o_arrows_dim ,
+ xoffset-for-o-arrows .value_required:n = true ,
unknown .code:n =
\@@_sort_seq:N \l_@@_options_WithArrowsOptions_seq
\@@_error:n { Unknown~option~WithArrowsOptions }
@@ -3609,7 +3755,7 @@ version 2005/12/01 or later.
displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
mathindent, max-length-of-arrow, no-arrows, up-and-down, rl, rr,
show-node-names, show-nodes, start-adjust, t, tikz, wrap-lines, xoffset,
- ygap, ystart,
+ xoffset-for-o-arrows, ygap, ystart,
%<*LaTeX>
allow-multiple-labels, nonumber, notag, standard-behaviour-with-items,
tagged-lines
@@ -3652,7 +3798,7 @@ version 2005/12/01 or later.
% The options of an individual arrow are parsed twice. The first pass is when
% the command |\Arrow| is read. The second pass is when the arrows are drawn
% (after the end of the environment |{WithArrows}| or |{DispWithArrows}|). Now,
-% we present the keys set for the first pass. The main goal is to extract
+% we present the set of keys for the first pass. The main goal is to extract
% informations which will be necessary during the scan of the arrows. For
% instance, we have to know if some arrows are ``independent'' or use the
% option ``new-group''.
@@ -3674,11 +3820,22 @@ version 2005/12/01 or later.
rl .default:n = NoValue ,
lr .default:n = NoValue ,
i .default:n = NoValue ,
- new-group .value_forbidden:n = true,
+ new-group .value_forbidden:n = true ,
new-group .code:n =
\int_compare:nTF { \l_@@_pos_arrow_int = 6 }
{ \str_set:Nn \l_@@_status_arrow_str { new-group } }
{ \@@_error:n { new-group~without~groups } } ,
+ o .code:n =
+ \str_if_empty:NTF \l_@@_previous_key_str
+ {
+ \int_compare:nNnTF \l_@@_pos_arrow_int < 6
+ { \@@_error:n { invalid~key~o } }
+ {
+ \str_set:Nn \l_@@_status_arrow_str { over }
+ \str_set_eq:NN \l_@@_previous_key_str \l_keys_key_str
+ }
+ }
+ { \@@_error:n { Incompatible~options~in~Arrow } } ,
% \end{macrocode}
%
% \medskip
@@ -3718,8 +3875,8 @@ version 2005/12/01 or later.
\seq_new:N \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
+ adjust, end-adjust, i, jump, ll, lr, o , rl, rr, start-adjust, tikz,
+ tikz-code, xoffset
}
% \end{macrocode}
%
@@ -3753,6 +3910,7 @@ version 2005/12/01 or later.
rl .code:n = \@@_fix_pos_arrow:n 2 ,
lr .code:n = \@@_fix_pos_arrow:n 0 ,
i .code:n = \@@_fix_pos_arrow:n 5 ,
+ o .code:n = \str_set:Nn \l_@@_previous_key_str { o } ,
% \end{macrocode}
%
% \medskip
@@ -3848,7 +4006,7 @@ version 2005/12/01 or later.
% ``final'', ``status'', ``options'', ``label'' and ``input-line''. In order to
% compute the value of ``final'' (the destination row of the arrow), we have to
% take into account a potential option |jump|. In order to compute the value of
-% the field ``status'', we have to take into account options as |ll|, |rl|,
+% the field ``status'', we have to take into account options |ll|, |rl|,
% |rr|, |lr|, etc. or |new-group|.
%
% We will do that job with a first analyze of the options of the command
@@ -3878,8 +4036,8 @@ version 2005/12/01 or later.
\prop_put:NnV \l_tmpa_prop { final } \l_tmpa_int
% \end{macrocode}
%
-% \item The ``status'' of the arrow, with 3 possible values: empty,
-% |independent|, or |new-group|.
+% \item The ``status'' of the arrow, with 4 possible values: empty,
+% |independent|, |new-group| or |over|.
% \begin{macrocode}
\prop_put:NnV \l_tmpa_prop { status } \l_@@_status_arrow_str
% \end{macrocode}
@@ -3895,10 +4053,17 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \item The number of the line where the command |\Arrow| is issued in the TeX
-% source (as of now, this is only useful for an error message).
+% source (as of now, this is only useful for some error messages).
% \begin{macrocode}
\prop_put:Nnx \l_tmpa_prop { input-line } \msg_line_number:
% \end{macrocode}
+%
+% \item The total width of the arrow (with the label)... but we don't know it
+% now and that's why we put |0 pt|. There are used for the arrows of type~|o|.
+% \begin{macrocode}
+ \prop_put:Nnn \l_tmpa_prop { width } { 0 pt }
+% \end{macrocode}
+%
% \end{enumerate}
%
% The property list has been created in a local variable for convenience. Now,
@@ -3986,14 +4151,13 @@ version 2005/12/01 or later.
% The variable |\l_@@_input_line_str| will be used only to store, for each
% command |\Arrow| the line (in the TeX file) where the command is issued. This
% information will be stored in the field ``input-line'' of the arrow. As of
-% now, this information is used only in the error message of an arrow impossible
-% to draw (because it arrives after the last row of the environment).
+% now, this information is used only in some error messages.
% \begin{macrocode}
\str_clear_new:N \l_@@_input_line_str
% \end{macrocode}
%
%
-% The initialization of the counters |\g_@@_arrow_int|, |\g_@@_line_int|,
+% Initialization of |\g_@@_arrow_int|, |\g_@@_line_int|,
% |\g_@@_col_int| and |\g_@@_static_col_int|. However, we have to save their
% previous values with the stacks created for this end.
% \begin{macrocode}
@@ -4822,12 +4986,12 @@ version 2005/12/01 or later.
\bool_if:NT \l_@@_qedhere_bool
{ \hbox_overlap_left:n \@@_qedhere_i: }
%</LaTeX>
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgfcoordinate
- { wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int - v }
- \pgfpointorigin
- \endpgfpicture
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgfcoordinate
+ { wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int - v }
+ \pgfpointorigin
+ \endpgfpicture
%<*LaTeX>
}
%</LaTeX>
@@ -4859,7 +5023,7 @@ version 2005/12/01 or later.
%<*LaTeX>
\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2
{
- \exp_args:NV \str_if_eq:nnT \l_@@_type_env_str { #2 }
+ \str_if_eq:VnT \l_@@_type_env_str { #2 }
{
\@@_error:n { newline~at~the~end~of~env }
\group_begin:
@@ -5224,7 +5388,9 @@ version 2005/12/01 or later.
{ pgf @ sh @ ns @ wa - \l_@@_prefix_str - \l_tmpa_int - v }
{ \@@_fatal:n { Inexistent~v-node } }
{
- \pgfpointanchor { wa - \l_@@_prefix_str - \l_tmpa_int - v } { center }
+ \pgfpointanchor
+ { wa - \l_@@_prefix_str - \l_tmpa_int - v }
+ { center }
\dim_compare:nNnT \pgf@x < \g_@@_right_x_dim
{ \dim_gset_eq:NN \g_@@_right_x_dim \pgf@x }
}
@@ -5562,7 +5728,8 @@ version 2005/12/01 or later.
{ g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
{ input-line } \l_@@_input_line_str
% \end{macrocode}
-%
+%
+%
% \bigskip
% We recall that, after the construction of the |\halign|, |\g_@@_line_int| is
% the total number of lines of the environment. Therefore, the conditionnal
@@ -5576,7 +5743,7 @@ version 2005/12/01 or later.
\int_compare:nNnF \l_@@_pos_arrow_int = 8
{ \@@_error:n { Too~few~lines~for~an~arrow } }
}
- \@@_code_for_possible_arrow:
+ \@@_treat_an_arrow_in_scan:
% \end{macrocode}
%
% \bigskip
@@ -5594,16 +5761,23 @@ version 2005/12/01 or later.
% situation occurs when all the arrows of the potential group arrive after the
% last line of the environment).
% \begin{macrocode}
- \bool_lazy_and:nnT
- { \bool_not_p:n { \int_compare_p:nNn \l_@@_pos_arrow_int = 7 } }
- { \int_compare_p:nNn \l_@@_first_arrow_of_group_int > 0 }
+ \bool_if:nT
+ {
+ ! \int_compare_p:nNn \l_@@_pos_arrow_int = 7
+ &&
+ \int_compare_p:nNn \l_@@_first_arrow_of_group_int > 0
+ }
{ \@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int }
}
% \end{macrocode}
%
% \bigskip
+% The following command is only for the lisibility of the code. It's used only
+% once. Its name may be misleading. Indeed, it treats an arrow in the scan but
+% it \emph{may} trigger the construction of all arrows of a group if it detects
+% that a group has just been completed (with |\@@_draw_arrows:nn|)
% \begin{macrocode}
-\cs_new_protected:Npn \@@_code_for_possible_arrow:
+\cs_new_protected:Npn \@@_treat_an_arrow_in_scan:
{
% \end{macrocode}
% We test whether the previous arrow was in fact the last arrow of a group. In
@@ -5676,11 +5850,10 @@ version 2005/12/01 or later.
{
% \end{macrocode}
%
-% If the arrow is independent, we don't take into account this arrow for the
+% If the arrow is independent, we don't take into account that arrow for the
% detection of the end of the group.
% \begin{macrocode}
- \bool_if:nF
- { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
+ \str_if_eq:VnF \l_@@_status_arrow_str { independent }
{
% \end{macrocode}
% If the arrow is not independent, the arrow belongs to the current group and we
@@ -5710,7 +5883,7 @@ version 2005/12/01 or later.
% 8), we don't initialize |\l_@@_x_dim| because we want to use the same value of
% |\l_@@_x_dim| (computed during the first step) for all the groups.
% \begin{macrocode}
- \bool_if:nF { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
+ \str_if_eq:VnF \l_@@_status_arrow_str { independent }
{
\int_compare:nNnF \l_@@_pos_arrow_int = 8
{ \@@_update_x:nn \l_@@_initial_int \l_@@_final_int }
@@ -5767,6 +5940,9 @@ version 2005/12/01 or later.
{ g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
{ final } \l_tmpa_tl
\int_set:Nn \l_@@_final_int \l_tmpa_tl
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
+ { status } \l_@@_status_arrow_str
% \end{macrocode}
%
% \bigskip
@@ -5775,20 +5951,31 @@ version 2005/12/01 or later.
% that, after the construction of the |\halign|, |\g_@@_line_int| is the total
% number of lines of the environment).
% \begin{macrocode}
- \int_compare:nT { \l_@@_final_int <= \g_@@_line_int } \@@_draw_arrows_i:
+ \int_compare:nNnF \l_@@_final_int > \g_@@_line_int
+% \end{macrocode}
+%
+% \bigskip
+% If the arrow is of type |over| (key |o|), we don't draw that arrow now (those
+% arrows will be drawn after all the other arrows).
+% \begin{macrocode}
+ {
+ \str_if_eq:VnTF \l_@@_status_arrow_str { over }
+ { \seq_put_right:NV \l_@@_o_arrows_seq \l_@@_arrow_int }
+ \@@_draw_arrow:
+ }
\int_incr:N \l_@@_arrow_int
}
+ \@@_draw_o_arrows_of_the_group:
\group_end:
}
% \end{macrocode}
%
% \bigskip
-% The macro |\@@_draw_arrows_i:| is only for the lisibility of the code. The
-% first |\group_begin:| is for the options of the arrows (but we remind that the
-% options |ll|, |rr|, |rl|, |lr|, |i| and |jump| have already been extracted and
-% are not present in the field |options| of the property list of the arrow).
+% The first |\group_begin:| is for the options of the arrows (but we remind that
+% the options |ll|, |rr|, |rl|, |lr|, |i| and |jump| have already been extracted
+% and are not present in the field |options| of the property list of the arrow).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_draw_arrows_i:
+\cs_new_protected:Npn \@@_draw_arrow:
{
\group_begin:
% \end{macrocode}
@@ -5863,9 +6050,6 @@ version 2005/12/01 or later.
\tl_set:Nx \l_@@_final_tl
{ \int_use:N \l_@@_final_int - \bool_if:NTF \l_@@_final_r_bool rl }
% \end{macrocode}
-% We use ``|.south|'' and ``|.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 |show-nodes| to visualize the nodes).
%
% \bigskip
% The label of the arrow will be stored in |\l_tmpa_tl|.
@@ -6024,11 +6208,25 @@ version 2005/12/01 or later.
%<*plain-TeX>
\tikzpicture
%</plain-TeX>
- [
- @@_standard ,
- every~path / .style = WithArrows / arrow
- ]
+ [
+ @@_standard ,
+ every~path / .style = WithArrows / arrow
+ ]
+% \end{macrocode}
+% You keep track of the bouding box because we want to compute the total width
+% of the arrow (with the label) for the arrows of type |over|.
+% \begin{macrocode}
+ \pgf@relevantforpicturesizetrue
#1
+ \dim_compare:nNnTF \pgf@picminx = { 16000 pt }
+ { \dim_set_eq:NN \l_tmpa_dim \c_zero_dim }
+ { \dim_set:Nn \l_tmpa_dim { \pgf@picmaxx - \pgf@picminx } }
+ \dim_add:Nn \l_tmpa_dim \l_@@_xoffset_dim
+ \prop_gput:cnV
+ { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
+ { width }
+ \l_tmpa_dim
+ \pgfresetboundingbox
%<*LaTeX>
\end{tikzpicture}
%</LaTeX>
@@ -6052,7 +6250,7 @@ version 2005/12/01 or later.
% |\l_@@_tikz_code_tl| (which corresponds to the option |tikz-code|).
% \begin{macrocode}
\bool_lazy_and:nnT \l_@@_wrap_lines_bool \l_@@_in_DispWithArrows_bool
- { \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_wrap_lines_tl }
+ { \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_wrap_lines_tl }
% \end{macrocode}
%
% \medskip
@@ -6110,14 +6308,26 @@ version 2005/12/01 or later.
% \begin{macrocode}
\dim_compare:nNnT \l_tmpa_dim > \c_zero_dim
{
- \path ( @@_label.west )
+ \path ( @@_label.west )
+%<*LaTeX>
+ node [ anchor = west ]
+ {
+ \begin { varwidth } { \l_tmpa_dim }
+ #3
+ \end { varwidth }
+ } ;
+%</LaTeX>
+%<*plain-TeX>
node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ]
- { #3 } ;
+ { #3 } ;
+%</plain-TeX>
}
}
% \end{macrocode}
%
% \bigskip
+% \subsubsection{The command update_x}
+%
% The command |\@@_update_x:nn| will analyze the lines between |#1| and
% |#2| in order to modify |\l_@@_x_dim| in consequence. More precisely,
% |\l_@@_x_dim| is increased if a line longer than the current value of
@@ -6140,8 +6350,185 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \bigskip
+% \subsubsection{We draw the arrows of type o}
+%
+% We recall that the arrows of type~|o| will be drawn \emph{over} (hence the
+% letter |o|) the other arrows. The arrows of type~|o| are available only when
+% the option |group| or the option |groups| is in force. The arrows of type~|o|
+% will be drawn group by group. The command |\@@_draw_o_arrows_of_the_group:| is
+% called after the construction of the (other) arrows of the group.
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_draw_o_arrows_of_the_group:
+ {
+% \end{macrocode}
+%
+% The numbers of the arrows of type |o| we have to draw are in the sequence
+% |\l_@@_o_arrows_seq|. We have to sort that sequence because the order in which
+% these arrows will be drawn matters.
+%
+% \begin{itemize}
+% \item The arrows which arrive first must be drawn first.
+% \item For arrows with the same final line, the arrows with lower initial line
+% must be drawn after (because they encompass the previous ones).
+% \end{itemize}
+%
+%
+% The second point ensures the expected output in situations such as in the
+% following example :
%
% \bigskip
+% \begin{BVerbatim}[boxwidth=6cm,baseline=c]
+% $\begin{WithArrows}[groups]
+% A & = B \Arrow[o,jump=3]{one}\\
+% & = C \Arrow[o,jump=2]{two}\\
+% & = D \Arrow{three} \\
+% & = E + E
+% \end{WithArrows}$
+% \end{BVerbatim}
+% \hspace{2cm}
+% $\begin{WithArrows}[groups,c]
+% A & = B \Arrow[o,jump=3]{one}\\
+% & = C \Arrow[o,jump=2]{two}\\
+% & = D \Arrow{three} \\
+% & = E + E
+% \end{WithArrows}$
+%
+% \bigskip
+% \begin{macrocode}
+ \seq_sort:Nn \l_@@_o_arrows_seq
+ {
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##1 _ prop }
+ { final } \l_tmpa_tl
+% \end{macrocode}
+% We recall that |\prop_get:cnN| retrieves token lists (here |\l_tmpa_tl| and
+% |\l_tmpb_tl|). We don't need to do an explicit conversion in \pkg{expl3}
+% integers because such token lists can be used directly in |\int_compare:nNnTF|.
+% \begin{macrocode}
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##2 _ prop }
+ { final } \l_tmpb_tl
+ \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
+ \sort_return_same:
+ {
+ \int_compare:nNnTF \l_tmpa_tl > \l_tmpb_tl
+ \sort_return_swapped:
+ {
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##1 _ prop }
+ { initial } \l_tmpa_tl
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##2 _ prop }
+ { initial } \l_tmpb_tl
+ \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
+ \sort_return_swapped:
+ \sort_return_same:
+ }
+ }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% Now, we can draw the arrows of type~|o| of the group in the order of the
+% sequence.
+% \begin{macrocode}
+ \seq_map_inline:Nn \l_@@_o_arrows_seq
+ {
+% \end{macrocode}
+% We retrieve the initial row and the final row of the arrow.
+% \begin{macrocode}
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##1 _ prop }
+ { initial } \l_tmpa_tl
+ \int_set:Nn \l_@@_initial_int \l_tmpa_tl
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##1 _ prop }
+ { final } \l_tmpa_tl
+ \int_set:Nn \l_@@_final_int \l_tmpa_tl
+% \end{macrocode}
+% The string |\l_@@_input_line_str| will be used only in some error messages.
+% \begin{macrocode}
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ##1 _ prop }
+ { input-line } \l_@@_input_line_str
+% \end{macrocode}
+% We have to compute the maximal width of all the arrows (with their labels)
+% which are covered by our arrow. We will compute that dimension in
+% |\g_tmpa_dim|. We need global dimension because we will have to exit a
+% |\pgfpicture|.
+% \begin{macrocode}
+ \dim_gzero:N \g_tmpa_dim
+% \end{macrocode}
+% We will raise the boolean |\g_tmpa_bool| if we find an arrow ``under'' our
+% arrow (we should find at least once since you are drawing an arrow of
+% type~|o|: if not, we will raise an error\footnote{Maybe we will change that in
+% future versions.}).
+% \begin{macrocode}
+ \bool_set_false:N \g_tmpa_bool
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \int_step_inline:nnn \l_@@_first_arrow_int \l_@@_last_arrow_int
+ {
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ####1 _ prop }
+ { initial } \l_tmpa_tl
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ####1 _ prop }
+ { final } \l_tmpb_tl
+ \prop_get:cnN
+ { g_@@_arrow _ \l_@@_prefix_str _ ####1 _ prop }
+ { status } \l_@@_status_arrow_str
+ \bool_if:nT
+ {
+ ! \int_compare_p:n { ##1 = ####1 }
+ && \int_compare_p:n { \l_@@_initial_int <= \l_tmpa_tl }
+ && \int_compare_p:n { \l_tmpb_tl <= \l_@@_final_int }
+% \end{macrocode}
+% We don't take into account the independent arrows because we have only
+% computed the \emph{width} of the arrows and that's why our arrow of type~|o|
+% will be positionned only relatively to the current group.
+% \begin{macrocode}
+ && ! \str_if_eq_p:Vn \l_@@_status_arrow_str { independent }
+ }
+ {
+% \end{macrocode}
+% The total width of the arrow (with its label) has been stored in a ``field''
+% of the arrow.
+% \begin{macrocode}
+ \bool_gset_true:N \g_tmpa_bool
+ \prop_get:cnN
+ { g_@@ _ arrow _ \l_@@_prefix_str _ ####1 _ prop }
+ { width }
+ \l_tmpa_tl
+% \end{macrocode}
+% We have to do a global affectation in order to exit the |pgfpicture|.
+% \begin{macrocode}
+ \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \l_tmpa_tl }
+ }
+ }
+ \endpgfpicture
+% \end{macrocode}
+% The boolean |\g_tmpa_bool| is raised if at least one arrow has been found
+% ``under'' our arrow (it should be the case since we are drawing an arrow of
+% type~|o|).
+% \begin{macrocode}
+ \bool_if:NTF \g_tmpa_bool
+ {
+ \int_set:Nn \l_@@_arrow_int { ##1 }
+ \dim_set_eq:NN \l_@@_xoffset_dim \g_tmpa_dim
+ \dim_add:Nn \l_@@_xoffset_dim \l_@@_xoffset_for_o_arrows_dim
+% \end{macrocode}
+% \begin{macrocode}
+ \@@_draw_arrow:
+ }
+ { \@@_error:n { o~arrow~with~no~arrow~under } }
+ }
+ }
+% \end{macrocode}
+%
+% \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
@@ -6153,7 +6540,7 @@ version 2005/12/01 or later.
{ \int_use:N \g_@@_last_env_int }
%</LaTeX>
%<*plain-TeX>
-\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g_@@_last_env_int }
+\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g_@@_last_env_int }
%</plain-TeX>
% \end{macrocode}
%
@@ -6525,6 +6912,15 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { invalid~key~o }
+ {
+ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~
+ 'group'~or~in~mode~'groups'.\\
+ \c_@@_option_ignored_str
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { Value~for~a~key }
{
The~key~'\l_keys_key_str'~should~be~used~without~value. \\
@@ -6561,7 +6957,6 @@ version 2005/12/01 or later.
\seq_use:Nnnn \l_@@_options_WithArrows_seq {~and~} {,~} {~and~}.
}
% \end{macrocode}
-%
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~DispWithArrows }
{
@@ -6626,7 +7021,7 @@ version 2005/12/01 or later.
This~error~is~fatal.
}
% \end{macrocode}
-%
+%
% \begin{macrocode}
\@@_msg_new:nn { Negative~jump }
{
@@ -6656,13 +7051,22 @@ version 2005/12/01 or later.
{ Too~few~lines~for~an~arrow }
{
Line~\l_@@_input_line_str\
- :~an~arrow~specified~in~the~row~\int_use:N \l_@@_initial_int\
+ :~an~arrow~specifiead~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. \\
If~you~go~on,~this~arrow~will~be~ignored.
}
% \end{macrocode}
%
+% \begin{macrocode}
+\@@_msg_new:nn { o~arrow~with~no~arrow~under }
+ {
+ Line~\l_@@_input_line_str\
+ :~there~is~no~arrow~'under'~your~arrow~of~type~'o'.\\
+ If~you~go~on,~this~arrow~won't~be~drawn.
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\@@_msg_new:nn { WithArrows~outside~math~mode }
{
@@ -6676,7 +7080,7 @@ version 2005/12/01 or later.
\@@_msg_new:nn { DispWithArrows~in~math~mode }
{
The~environment~\{\l_@@_type_env_str\}~should~be~used~only~outside~math~
- mode~like~the~environment~\{align\}~of~amsmath. \\
+ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\
This~error~is~fatal.
}
% \end{macrocode}
@@ -6936,11 +7340,10 @@ version 2005/12/01 or later.
% corresponding code is given here. It is independent of the main code of the
% extension \pkg{witharrows}.
%
-% 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 by default this package and this library. If they are not
-% loaded, the user will have an error only when using the option |up| or the
-% option |down|.
+% This code is the only part of the code of \pkg{witharrows} which uses the the
+% Tikz library |calc|. That's why we have decided not to load by default this
+% library. If it is not loaded, the user will have an error only when using the
+% option |up| or the option |down|.
%
% \bigskip
% The keys |up| and |down| can be used with a value. This value is a list of
@@ -7002,7 +7405,7 @@ version 2005/12/01 or later.
{
\dim_set:Nn \l_tmpa_dim { \x2 - \x1 }
\begin { varwidth } \l_tmpa_dim
-% \end{macrocode}
+% \end{macrocode}a
% |\narrowragged| is a command of the package \pkg{varwidth}.
% \begin{macrocode}
\narrowragged
@@ -7227,51 +7630,35 @@ version 2005/12/01 or later.
\str_if_empty:NT \l_@@_previous_key_str
{
\str_set:Nn \l_@@_previous_key_str { up }
-%<*LaTeX>
- \bool_if:NTF \c_@@_varwidth_loaded_bool
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
{
-%</LaTeX>
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
- \int_set:Nn \l_@@_pos_arrow_int 1
+ \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
+ \int_set:Nn \l_@@_pos_arrow_int 1
% \end{macrocode}
% We have to set |\l_@@_wrap_lines_bool| to |false| because, otherwise, if the
% option |wrap_lines| is used at a higher level (global or environment), we will
% have a special affectation to |tikz-code| that will overwrite our affectation.
% \begin{macrocode}
- \bool_set_false:N \l_@@_wrap_lines_bool
+ \bool_set_false:N \l_@@_wrap_lines_bool
% \end{macrocode}
% The main action occurs now. We change the value of the |tikz-code|.
% \begin{macrocode}
- \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_up_tl
- }
- { \@@_error:n { calc~not~loaded } }
-%<*LaTeX>
+ \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_up_tl
}
- { \@@_error:n { varwidth~not~loaded } }
-%</LaTeX>
+ { \@@_error:n { calc~not~loaded } }
} ,
down .code:n =
\str_if_empty:NT \l_@@_previous_key_str
{
\str_set:Nn \l_@@_previous_key_str { down }
-%<*LaTeX>
- \bool_if:NTF \c_@@_varwidth_loaded_bool
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
{
-%</LaTeX>
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
- \int_set:Nn \l_@@_pos_arrow_int 1
- \bool_set_false:N \l_@@_wrap_lines_bool
- \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_down_tl
- }
- { \@@_error:n { calc~not~loaded } }
-%<*LaTeX>
+ \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
+ \int_set:Nn \l_@@_pos_arrow_int 1
+ \bool_set_false:N \l_@@_wrap_lines_bool
+ \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_down_tl
}
- { \@@_error:n { varwidth~not~loaded } }
-%</LaTeX>
+ { \@@_error:n { calc~not~loaded } }
}
}
% \end{macrocode}
@@ -7282,15 +7669,6 @@ version 2005/12/01 or later.
\seq_put_right:Nn \l_@@_options_Arrow_seq { up }
% \end{macrocode}
%
-%
-% \begin{macrocode}
-\@@_msg_new:nn { varwidth~not~loaded }
- {
- You~can't~use~the~option~'\l_keys_key_str'~because~
- you~don't~have~loaded~the~package~'varwidth'. \\
- \c_@@_option_ignored_str
- }
-% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { calc~not~loaded }
@@ -7508,6 +7886,11 @@ version 2005/12/01 or later.
%
% Correction of a bug with |{DispWithArrows}| : cf. question 535989 on |TeX StackExchange|.
%
+% \subsection*{Changes between 2.4 and 2.5}
+%
+% Arrows of type |o| which are \emph{over} other arrows.
+%
+% \pkg{witharrows} now requires and loads \pkg{varwidth}
%
%
% \PrintIndex
diff --git a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
index 2798b9ff33f..1a7286bca41 100644
--- a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
+++ b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
@@ -18,10 +18,9 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{2.4}
-\def\myfiledate{2020/03/31}
+\def\myfileversion{2.5}
+\def\myfiledate{2020/06/22}
\RequirePackage{tikz}
-\RequirePackage{expl3}[2020/02/08]
\usetikzlibrary{arrows.meta,bending}
\RequirePackage{l3keys2e}
\ProvidesExplPackage
@@ -38,6 +37,7 @@
\cs_if_exist:NF \l_keys_key_str
{ \msg_error:nn { witharrows } { expl3~too~old } }
\RequirePackage { xparse } [ 2019-01-01 ]
+\RequirePackage { varwidth }
\bool_new:N \g__witharrows_footnotehyper_bool
\bool_new:N \g__witharrows_footnote_bool
\cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } }
@@ -118,7 +118,7 @@
\clist_map_inline:nn
{
amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
- typedref, unicode-math, varwidth
+ typedref, unicode-math
}
{
\bool_new:c { c__witharrows_#1_loaded_bool }
@@ -290,6 +290,9 @@
\dim_set_eq:NN \l__witharrows_arrow_width_dim \c_max_dim
\dim_new:N \l__witharrows_up_and_down_radius_dim
\dim_set:Nn \l__witharrows_up_and_down_radius_dim { 4 pt }
+\seq_new:N \l__witharrows_o_arrows_seq
+\dim_new:N \l__witharrows_xoffset_for_o_arrows_dim
+\dim_set:Nn \l__witharrows_xoffset_for_o_arrows_dim { 2 mm }
\cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1
{
\str_if_empty:NTF \l__witharrows_previous_key_str
@@ -548,6 +551,8 @@
allow-duplicate-names .code:n =
\__witharrows_msg_redirect_name:nn { Duplicate~name } { none } ,
allow-duplicate-names .value_forbidden:n = true ,
+ xoffset-for-o-arrows .dim_set:N = \l__witharrows_xoffset_for_o_arrows_dim ,
+ xoffset-for-o-arrows .value_required:n = true ,
unknown .code:n =
\__witharrows_sort_seq:N \l__witharrows_options_WithArrowsOptions_seq
\__witharrows_error:n { Unknown~option~WithArrowsOptions }
@@ -559,7 +564,7 @@
displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
mathindent, max-length-of-arrow, no-arrows, up-and-down, rl, rr,
show-node-names, show-nodes, start-adjust, t, tikz, wrap-lines, xoffset,
- ygap, ystart,
+ xoffset-for-o-arrows, ygap, ystart,
allow-multiple-labels, nonumber, notag, standard-behaviour-with-items,
tagged-lines
}
@@ -595,11 +600,22 @@
rl .default:n = NoValue ,
lr .default:n = NoValue ,
i .default:n = NoValue ,
- new-group .value_forbidden:n = true,
+ new-group .value_forbidden:n = true ,
new-group .code:n =
\int_compare:nTF { \l__witharrows_pos_arrow_int = 6 }
{ \str_set:Nn \l__witharrows_status_arrow_str { new-group } }
{ \__witharrows_error:n { new-group~without~groups } } ,
+ o .code:n =
+ \str_if_empty:NTF \l__witharrows_previous_key_str
+ {
+ \int_compare:nNnTF \l__witharrows_pos_arrow_int < 6
+ { \__witharrows_error:n { invalid~key~o } }
+ {
+ \str_set:Nn \l__witharrows_status_arrow_str { over }
+ \str_set_eq:NN \l__witharrows_previous_key_str \l_keys_key_str
+ }
+ }
+ { \__witharrows_error:n { Incompatible~options~in~Arrow } } ,
tikz-code .code:n = \prg_do_nothing: ,
tikz-code .value_required:n = true ,
tikz .code:n = \prg_do_nothing: ,
@@ -624,8 +640,8 @@
\seq_new:N \l__witharrows_options_Arrow_seq
\__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_Arrow_seq
{
- adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code,
- xoffset
+ adjust, end-adjust, i, jump, ll, lr, o , rl, rr, start-adjust, tikz,
+ tikz-code, xoffset
}
\cs_new_protected:Npn \__witharrows_fix_pos_arrow:n #1
{
@@ -646,6 +662,7 @@
rl .code:n = \__witharrows_fix_pos_arrow:n 2 ,
lr .code:n = \__witharrows_fix_pos_arrow:n 0 ,
i .code:n = \__witharrows_fix_pos_arrow:n 5 ,
+ o .code:n = \str_set:Nn \l__witharrows_previous_key_str { o } ,
xoffset .code:n =
\bool_if:nTF
{
@@ -681,6 +698,7 @@
\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_put:Nnn \l_tmpa_prop { width } { 0 pt }
\prop_gclear_new:c
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \g__witharrows_arrow_int _ prop }
\prop_gset_eq:cN
@@ -1003,12 +1021,12 @@
\__witharrows_restore:N \l__witharrows_qedhere_bool
\bool_if:NT \l__witharrows_qedhere_bool
{ \hbox_overlap_left:n \__witharrows_qedhere_i: }
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgfcoordinate
- { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v }
- \pgfpointorigin
- \endpgfpicture
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgfcoordinate
+ { wa - \l__witharrows_prefix_str - \int_use:N \g__witharrows_line_int - v }
+ \pgfpointorigin
+ \endpgfpicture
}
}
\dim_compare:nNnT { #1 } < \c_zero_dim
@@ -1025,7 +1043,7 @@
}
\cs_new_protected:Npn \__witharrows_analyze_end:Nn #1 #2
{
- \exp_args:NV \str_if_eq:nnT \l__witharrows_type_env_str { #2 }
+ \str_if_eq:VnT \l__witharrows_type_env_str { #2 }
{
\__witharrows_error:n { newline~at~the~end~of~env }
\group_begin:
@@ -1179,7 +1197,9 @@
{ pgf @ sh @ ns @ wa - \l__witharrows_prefix_str - \l_tmpa_int - v }
{ \__witharrows_fatal:n { Inexistent~v-node } }
{
- \pgfpointanchor { wa - \l__witharrows_prefix_str - \l_tmpa_int - v } { center }
+ \pgfpointanchor
+ { wa - \l__witharrows_prefix_str - \l_tmpa_int - v }
+ { center }
\dim_compare:nNnT \pgf@x < \g__witharrows_right_x_dim
{ \dim_gset_eq:NN \g__witharrows_right_x_dim \pgf@x }
}
@@ -1323,15 +1343,18 @@
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8
{ \__witharrows_error:n { Too~few~lines~for~an~arrow } }
}
- \__witharrows_code_for_possible_arrow:
+ \__witharrows_treat_an_arrow_in_scan:
\int_incr:N \l__witharrows_arrow_int
}
- \bool_lazy_and:nnT
- { \bool_not_p:n { \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7 } }
- { \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0 }
+ \bool_if:nT
+ {
+ ! \int_compare_p:nNn \l__witharrows_pos_arrow_int = 7
+ &&
+ \int_compare_p:nNn \l__witharrows_first_arrow_of_group_int > 0
+ }
{ \__witharrows_draw_arrows:nn \l__witharrows_first_arrow_of_group_int \g__witharrows_arrow_int }
}
-\cs_new_protected:Npn \__witharrows_code_for_possible_arrow:
+\cs_new_protected:Npn \__witharrows_treat_an_arrow_in_scan:
{
\bool_lazy_and:nnT
{ \int_compare_p:nNn \l__witharrows_arrow_int > 1 }
@@ -1370,8 +1393,7 @@
{ \dim_set:Nn \l__witharrows_x_dim { - \c_max_dim } }
}
{
- \bool_if:nF
- { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } }
+ \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
{
\int_compare:nT
{ \l__witharrows_initial_int = \l__witharrows_first_line_of_group_int }
@@ -1388,7 +1410,7 @@
}
}
}
- \bool_if:nF { \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent } }
+ \str_if_eq:VnF \l__witharrows_status_arrow_str { independent }
{
\int_compare:nNnF \l__witharrows_pos_arrow_int = 8
{ \__witharrows_update_x:nn \l__witharrows_initial_int \l__witharrows_final_int }
@@ -1415,12 +1437,21 @@
{ g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
{ final } \l_tmpa_tl
\int_set:Nn \l__witharrows_final_int \l_tmpa_tl
- \int_compare:nT { \l__witharrows_final_int <= \g__witharrows_line_int } \__witharrows_draw_arrows_i:
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
+ { status } \l__witharrows_status_arrow_str
+ \int_compare:nNnF \l__witharrows_final_int > \g__witharrows_line_int
+ {
+ \str_if_eq:VnTF \l__witharrows_status_arrow_str { over }
+ { \seq_put_right:NV \l__witharrows_o_arrows_seq \l__witharrows_arrow_int }
+ \__witharrows_draw_arrow:
+ }
\int_incr:N \l__witharrows_arrow_int
}
+ \__witharrows_draw_o_arrows_of_the_group:
\group_end:
}
-\cs_new_protected:Npn \__witharrows_draw_arrows_i:
+\cs_new_protected:Npn \__witharrows_draw_arrow:
{
\group_begin:
\prop_get:cnN
@@ -1538,18 +1569,28 @@
\cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3
{
\begin{tikzpicture}
- [
- __witharrows_standard ,
- every~path / .style = WithArrows / arrow
- ]
+ [
+ __witharrows_standard ,
+ every~path / .style = WithArrows / arrow
+ ]
+ \pgf@relevantforpicturesizetrue
#1
+ \dim_compare:nNnTF \pgf@picminx = { 16000 pt }
+ { \dim_set_eq:NN \l_tmpa_dim \c_zero_dim }
+ { \dim_set:Nn \l_tmpa_dim { \pgf@picmaxx - \pgf@picminx } }
+ \dim_add:Nn \l_tmpa_dim \l__witharrows_xoffset_dim
+ \prop_gput:cnV
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ \int_use:N \l__witharrows_arrow_int _ prop }
+ { width }
+ \l_tmpa_dim
+ \pgfresetboundingbox
\end{tikzpicture}
}
}
\cs_new_protected:Npn \__witharrows_draw_arrow:nnn #1 #2 #3
{
\bool_lazy_and:nnT \l__witharrows_wrap_lines_bool \l__witharrows_in_DispWithArrows_bool
- { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl }
+ { \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_wrap_lines_tl }
\exp_args:NV \__witharrows_def_function_tmpa:n \l__witharrows_tikz_code_tl
\__witharrows_tmpa:nnn { #1 } { #2 } { #3 }
}
@@ -1570,8 +1611,12 @@
\dim_compare:nNnT \l_tmpa_dim > \c_zero_dim
{
\path ( __witharrows_label.west )
- node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ]
- { #3 } ;
+ node [ anchor = west ]
+ {
+ \begin { varwidth } { \l_tmpa_dim }
+ #3
+ \end { varwidth }
+ } ;
}
}
\cs_new_protected:Npn \__witharrows_update_x:nn #1 #2
@@ -1587,6 +1632,89 @@
\endpgfpicture
\dim_set_eq:NN \l__witharrows_x_dim \g_tmpa_dim
}
+\cs_new_protected:Npn \__witharrows_draw_o_arrows_of_the_group:
+ {
+ \seq_sort:Nn \l__witharrows_o_arrows_seq
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { final } \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop }
+ { final } \l_tmpb_tl
+ \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
+ \sort_return_same:
+ {
+ \int_compare:nNnTF \l_tmpa_tl > \l_tmpb_tl
+ \sort_return_swapped:
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { initial } \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##2 _ prop }
+ { initial } \l_tmpb_tl
+ \int_compare:nNnTF \l_tmpa_tl < \l_tmpb_tl
+ \sort_return_swapped:
+ \sort_return_same:
+ }
+ }
+ }
+ \seq_map_inline:Nn \l__witharrows_o_arrows_seq
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { initial } \l_tmpa_tl
+ \int_set:Nn \l__witharrows_initial_int \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { final } \l_tmpa_tl
+ \int_set:Nn \l__witharrows_final_int \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ##1 _ prop }
+ { input-line } \l__witharrows_input_line_str
+ \dim_gzero:N \g_tmpa_dim
+ \bool_set_false:N \g_tmpa_bool
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \int_step_inline:nnn \l__witharrows_first_arrow_int \l__witharrows_last_arrow_int
+ {
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { initial } \l_tmpa_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { final } \l_tmpb_tl
+ \prop_get:cnN
+ { g__witharrows_arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { status } \l__witharrows_status_arrow_str
+ \bool_if:nT
+ {
+ ! \int_compare_p:n { ##1 = ####1 }
+ && \int_compare_p:n { \l__witharrows_initial_int <= \l_tmpa_tl }
+ && \int_compare_p:n { \l_tmpb_tl <= \l__witharrows_final_int }
+ && ! \str_if_eq_p:Vn \l__witharrows_status_arrow_str { independent }
+ }
+ {
+ \bool_gset_true:N \g_tmpa_bool
+ \prop_get:cnN
+ { g__witharrows _ arrow _ \l__witharrows_prefix_str _ ####1 _ prop }
+ { width }
+ \l_tmpa_tl
+ \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \g_tmpa_dim \l_tmpa_tl }
+ }
+ }
+ \endpgfpicture
+ \bool_if:NTF \g_tmpa_bool
+ {
+ \int_set:Nn \l__witharrows_arrow_int { ##1 }
+ \dim_set_eq:NN \l__witharrows_xoffset_dim \g_tmpa_dim
+ \dim_add:Nn \l__witharrows_xoffset_dim \l__witharrows_xoffset_for_o_arrows_dim
+ \__witharrows_draw_arrow:
+ }
+ { \__witharrows_error:n { o~arrow~with~no~arrow~under } }
+ }
+ }
\NewExpandableDocumentCommand \WithArrowsLastEnv { }
{ \int_use:N \g__witharrows_last_env_int }
\keys_define:nn { WithArrows / Arrow / code-after }
@@ -1809,6 +1937,12 @@
must~not~be~empty.\\
\c__witharrows_option_ignored_str
}
+\__witharrows_msg_new:nn { invalid~key~o }
+ {
+ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~
+ 'group'~or~in~mode~'groups'.\\
+ \c__witharrows_option_ignored_str
+ }
\__witharrows_msg_new:nn { Value~for~a~key }
{
The~key~'\l_keys_key_str'~should~be~used~without~value. \\
@@ -1907,11 +2041,17 @@
{ Too~few~lines~for~an~arrow }
{
Line~\l__witharrows_input_line_str\
- :~an~arrow~specified~in~the~row~\int_use:N \l__witharrows_initial_int\
+ :~an~arrow~specifiead~in~the~row~\int_use:N \l__witharrows_initial_int\
of~your~environment~\{\l__witharrows_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.
}
+\__witharrows_msg_new:nn { o~arrow~with~no~arrow~under }
+ {
+ Line~\l__witharrows_input_line_str\
+ :~there~is~no~arrow~'under'~your~arrow~of~type~'o'.\\
+ If~you~go~on,~this~arrow~won't~be~drawn.
+ }
\__witharrows_msg_new:nn { WithArrows~outside~math~mode }
{
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~
@@ -1921,7 +2061,7 @@
\__witharrows_msg_new:nn { DispWithArrows~in~math~mode }
{
The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~
- mode~like~the~environment~\{align\}~of~amsmath. \\
+ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\
This~error~is~fatal.
}
\__witharrows_msg_new:nn { Incompatible~options~in~Arrow }
@@ -2212,45 +2352,31 @@
\str_if_empty:NT \l__witharrows_previous_key_str
{
\str_set:Nn \l__witharrows_previous_key_str { up }
- \bool_if:NTF \c__witharrows_varwidth_loaded_bool
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
{
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
- \int_set:Nn \l__witharrows_pos_arrow_int 1
- \bool_set_false:N \l__witharrows_wrap_lines_bool
- \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl
- }
- { \__witharrows_error:n { calc~not~loaded } }
+ \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
+ \int_set:Nn \l__witharrows_pos_arrow_int 1
+ \bool_set_false:N \l__witharrows_wrap_lines_bool
+ \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_up_tl
}
- { \__witharrows_error:n { varwidth~not~loaded } }
+ { \__witharrows_error:n { calc~not~loaded } }
} ,
down .code:n =
\str_if_empty:NT \l__witharrows_previous_key_str
{
\str_set:Nn \l__witharrows_previous_key_str { down }
- \bool_if:NTF \c__witharrows_varwidth_loaded_bool
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
{
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
- \int_set:Nn \l__witharrows_pos_arrow_int 1
- \bool_set_false:N \l__witharrows_wrap_lines_bool
- \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl
- }
- { \__witharrows_error:n { calc~not~loaded } }
+ \keys_set:nV { WithArrows / up-and-down } \l_keys_value_tl
+ \int_set:Nn \l__witharrows_pos_arrow_int 1
+ \bool_set_false:N \l__witharrows_wrap_lines_bool
+ \tl_set_eq:NN \l__witharrows_tikz_code_tl \c__witharrows_tikz_code_down_tl
}
- { \__witharrows_error:n { varwidth~not~loaded } }
+ { \__witharrows_error:n { calc~not~loaded } }
}
}
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { down }
\seq_put_right:Nn \l__witharrows_options_Arrow_seq { up }
-\__witharrows_msg_new:nn { varwidth~not~loaded }
- {
- You~can't~use~the~option~'\l_keys_key_str'~because~
- you~don't~have~loaded~the~package~'varwidth'. \\
- \c__witharrows_option_ignored_str
- }
\__witharrows_msg_new:nn { calc~not~loaded }
{
You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~