summaryrefslogtreecommitdiff
path: root/macros/generic/witharrows
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/witharrows')
-rw-r--r--macros/generic/witharrows/witharrows-french.pdfbin257996 -> 259546 bytes
-rw-r--r--macros/generic/witharrows/witharrows-french.tex80
-rw-r--r--macros/generic/witharrows/witharrows.dtx592
-rw-r--r--macros/generic/witharrows/witharrows.pdfbin589390 -> 615389 bytes
4 files changed, 535 insertions, 137 deletions
diff --git a/macros/generic/witharrows/witharrows-french.pdf b/macros/generic/witharrows/witharrows-french.pdf
index 0a045846a7..9711cf5756 100644
--- a/macros/generic/witharrows/witharrows-french.pdf
+++ b/macros/generic/witharrows/witharrows-french.pdf
Binary files differ
diff --git a/macros/generic/witharrows/witharrows-french.tex b/macros/generic/witharrows/witharrows-french.tex
index f57d0a28d2..9eac72c3c7 100644
--- a/macros/generic/witharrows/witharrows-french.tex
+++ b/macros/generic/witharrows/witharrows-french.tex
@@ -417,9 +417,8 @@ de \pkg{witharrows}.
Néanmoins, une commande |\Arrow| définie précédemment pourrait encore être utile dans un environnement
|{WithArrows}|. Si vous voulez l'utiliser dans un tel environnement, il est possible de changer le nom de la
-commande |\Arrow| de l'extension \pkg{witharrows} grâce à une option |command-name|\footnote{Pour des raisons
- historiques, il y a un alias pour cette option : |CommandeName|.} dédiée. Le nouveau nom de la commande doit être
-fourni à l'option \emph{sans} la contre-oblique.
+commande |\Arrow| de l'extension \pkg{witharrows} grâce à une option |command-name| dédiée. Le nouveau nom de la
+commande doit être fourni à l'option \emph{sans} la contre-oblique.
%
\begin{Verbatim}
\NewDocumentCommand {\Arrow} {} {\longmapsto}
@@ -441,8 +440,7 @@ f & = \bigl(x \Arrow (x+1)^2\bigr)
\interitem
-L'environnement |{WithArrows}| fournit aussi deux options |code-before| et |code-after|\footnote{Pour des raisons
- historiques, il y a aussi des alias pour ces options : |CodeBefore| et |CodeAfter|.} pour du code LaTeX qui sera
+L'environnement |{WithArrows}| fournit aussi deux options |code-before| et |code-after| pour du code LaTeX qui sera
exécuté au début et à la fin de l'environnement. Ces options ne sont pas conçues pour être utilisées comme des
\emph{hooks} (elles sont disponibles uniquement au niveau de l'environnement et ne s'appliquent pas aux
environnements imbriqués).
@@ -689,10 +687,10 @@ $\begin{WithArrows}[interline=1mm,groups]
\interitem
-\section{Les options «up» et «down» pour des flèches individuelles}
+\section{Les options « up » et « down » pour des flèches individuelles}
\label{up-and-down}
-Au niveau local, il y a deux options pour les flèches individuelles, nommée «|up|» et «|down|». L'exemple
+Au niveau local, il y a deux options pour les flèches individuelles, nommées «|up|» et «|down|». L'exemple
suivant illustre ces types de flèches:
@@ -707,7 +705,7 @@ A & = B
\end{WithArrows}\)
\end{Verbatim}
-\vspace{1cm}
+\bigskip
$\begin{WithArrows}
A & = B
\Arrow[up]{une flèche de type \texttt{up}} \\
@@ -719,9 +717,63 @@ A & = B
\vspace{1cm}
-Les options |up| et |down| nécessitent l'extension \pkg{varwidth} et l'extension Tikz \pkg{calc}. Si elles ne sont
-pas chargées, une erreur sera levée.
+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.
+\vspace{1cm}
+Les options |up| et |down| peuvent en fait prendre comme valeur une liste de couples clé-valeur.
+\begin{itemize}
+\item La clé |radius| est le rayon de l'angle arrondi de la flèche\footnote{La valeur initiale de ce paramètre est égale à
+$4$~pt, qui est la valeur par défaut du ``|rounded corners|'' de Tikz.}.
+\item La clé |width| contrôle la largeur (de la partie horizontale) de la flèche :
+\begin{itemize}
+\item avec la valeur |max|, la largeur de la flèche est ajustée par rapport à la position des nœuds (c'est le
+comportement par défaut des flèches |up| et |down| comme illustré dans l'exemple précédent) ;
+\item avec une valeur numérique, la largeur de la flèche est directement fixée par cette valeur numérique ;
+\item avec la valeur |min|, la largeur de la flèche est ajustée au contenu de son étiquette.
+\end{itemize}
+\end{itemize}
+
+\vspace{1cm}
+\begin{Verbatim}
+$\begin{WithArrows}
+A & = B
+\Arrow[~emphase#up={width=2cm,radius=0pt}@]{essai} \\
+ & = C + C + C + C + C + C + C + C
+\end{WithArrows}$
+\end{Verbatim}
+
+\medskip
+$\begin{WithArrows}
+A & = B
+\Arrow[up={width=2cm,radius=0pt}]{essai} \\
+ & = C + C + C + C + C + C + C + C
+\end{WithArrows}$
+
+
+\vspace{1cm}
+\begin{Verbatim}
+$\begin{WithArrows}
+A & = B
+\Arrow[~emphase#up={width=min}@]{essai} \\
+ & = C + C + C + C + C + C + C + C
+\end{WithArrows}$
+\end{Verbatim}
+
+\medskip
+$\begin{WithArrows}
+A & = B
+\Arrow[up={width=min}]{essai} \\
+ & = C + C + C + C + C + C + C + C
+\end{WithArrows}$
+
+\vspace{1cm}
+Les options relatives aux flèches |up| and |down| peuvent être fixées au niveau global ou environnemental avec la
+clé |up-and-down|. Cette clé peut aussi être utilisée comme préfixe comme illustré maintenant.
+%
+\begin{Verbatim}
+\WithArrowsOptions{up-and-down/width=min}
+\end{Verbatim}
\interitem
@@ -1220,13 +1272,14 @@ N & \vartriangleleft O \\
P & \vartriangleleft Q
\end{WithArrows}
\right.
-\end{WithArrows}\]
-
+\end{WithArrows}
+%
\begin{tikzpicture}[remember picture,overlay]
\draw [WithArrows/arrow]
([xshift=3mm]wa-\WithArrowsLastEnv-2-1-2-r.south)
to ([xshift=3mm]wa-\WithArrowsLastEnv-3-2-r.north) ;
\end{tikzpicture}
+\]
\medskip
Dans le cas présent, il aurait été plus facile d'utiliser une commande |\Arrow| dans le |code-after| mais
@@ -1691,8 +1744,7 @@ reposent sur le système de numérotation de LaTeX).
\label{tikz-code}
-L'option |tikz-code|\footnote{Pour des raisons historiques, l'option |tikz-code| a un alias :
- |TikzCode|.} permet à l'utilisateur de changer la forme des flèches.\footnote{Si l'option |wrap-lines|
+L'option |tikz-code| permet à l'utilisateur de changer la forme des flèches.\footnote{Si l'option |wrap-lines|
est utilisée dans un environnement |{DispWithArrows}| ou |{DispWithArrows*}|, l'option |tikz-code|
n'aura pas d'effet sur les flèches de cet environnement mais uniquement sur les flèches des environnements
|{WithArrows}| imbriqués.}
diff --git a/macros/generic/witharrows/witharrows.dtx b/macros/generic/witharrows/witharrows.dtx
index 8aef1584bb..9b3e9c5869 100644
--- a/macros/generic/witharrows/witharrows.dtx
+++ b/macros/generic/witharrows/witharrows.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{2.2}
-\def\myfiledate{2019/12/10}
+\def\myfileversion{2.3}
+\def\myfiledate{2019/12/27}
%
%
%<*batchfile>
@@ -451,8 +451,7 @@ 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 |command-name|\footnote{For historical
-% reasons, there is an alias for this option: |CommandName|.} for this purpose.
+% \pkg{witharrows}: there is an option |command-name| for this purpose.
% The new name of the command must be given to the option \emph{without} the
% leading backslash.
% %
@@ -477,11 +476,10 @@ version 2005/12/01 or later.
%
% \interitem
% The environment |{WithArrows}| provides also two options |code-before| and
-% |code-after|\footnote{For historical reasons, there are aliases for these
-% options: |CodeBefore| and |CodeAfter|.} for LaTeX code that will be executed
-% at the beginning and at the end of the environment. These options are not
-% designed to be hooks (they are available only at the environment level and
-% they do not apply to the nested environments).
+% |code-after| for LaTeX code that will be executed at the beginning and at the
+% end of the environment. These options are not designed to be hooks (they are
+% available only at the environment level and they do not apply to the nested
+% environments).
% %
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#code-before = \color{blue}@]
@@ -732,7 +730,7 @@ version 2005/12/01 or later.
% {The options ``up'' and ``down'' for individual arrows}
%
% \label{up-and-down}
-% At the local level, there are also two options for individuals arrows, called
+% At the local level, there are also two options for individual arrows, called
% ``|up|'' and ``|down|''. The following example illustrates these types of
% arrows:
%
@@ -760,9 +758,70 @@ 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 loaded, an error will be raised.
+% library \pkg{calc}. It they are not 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
+% of couples key-value.
+% \begin{itemize}
+% \item The key |radius| is the radius of the rounded corner of the
+% arrow.\footnote{The initial value of this parameter is $4$~pt, which is the
+% default value of the ``|rounded corners|'' of Tikz.}
+% \item The key |width| is the width of the (horizontal part of) the arrow:
+% \begin{itemize}
+% \item with the value |max|, the width of the arrow is ajusted with respect of
+% the position of the nodes (that's the behaviour by default of the arrows |up|
+% and |down| as shown in the previous example);
+% \item with a numerical value, the width of the arrow is directly fixed to that
+% numerical value;
+% \item with the value |min|, the width of the arrow is adjusted with respect to
+% the contents of the label of the arrow.
+% \end{itemize}
+% \end{itemize}
+%
+% \vspace{1cm}
+% \begin{Verbatim}
+% $\begin{WithArrows}
+% A & = B
+% \Arrow[~emphase#up={radius=0pt,width=2cm}@]{we try} \\
+% & = C + C + C + C + C + C + C + C
+% \end{WithArrows}$
+% \end{Verbatim}
+%
+% \medskip
+% $\begin{WithArrows}
+% A & = B
+% \Arrow[up={radius=0pt,width=2cm}]{we try} \\
+% & = C + C + C + C + C + C + C + C
+% \end{WithArrows}$
%
+%
+% \vspace{1cm}
+% \begin{Verbatim}
+% $\begin{WithArrows}
+% A & = B
+% \Arrow[~emphase#up={width=min}@]{we try} \\
+% & = C + C + C + C + C + C + C + C
+% \end{WithArrows}$
+% \end{Verbatim}
+%
+% \medskip
+% $\begin{WithArrows}
+% A & = B
+% \Arrow[up={width=min}]{we try} \\
+% & = C + C + C + C + C + C + C + C
+% \end{WithArrows}$
+%
+% \vspace{1cm}
+% The options relative to the arrows |up| and |down| can be fixed at the global
+% or environment level with the key |up-and-down|. This key may also be used as
+% prefix as illustrated now.
+% %
+% \begin{Verbatim}
+% \WithArrowsOptions{up-and-down/width=min}
+% \end{Verbatim}
+%
% \interitem
%
% \section{Comparison with the environment \{aligned\}}
@@ -1273,13 +1332,12 @@ version 2005/12/01 or later.
% P & \vartriangleleft Q
% \end{WithArrows}
% \right.
-% \end{WithArrows}\]
-%
+% \end{WithArrows}
% \begin{tikzpicture}[remember picture,overlay]
% \draw [WithArrows/arrow]
% ([xshift=3mm]wa-\WithArrowsLastEnv-2-1-2-r.south)
% to ([xshift=3mm]wa-\WithArrowsLastEnv-3-2-r.north) ;
-% \end{tikzpicture}
+% \end{tikzpicture}\]
%
% \medskip
% In this case, it would be easier to use a command |\Arrow| in |code-after| but
@@ -1756,9 +1814,7 @@ version 2005/12/01 or later.
%
% \label{tikz-code}
%
-% The option |tikz-code|\footnote{For historical reasons, the option |tikz-code|
-% has an alias: |TikzCode|.} allows the user to change the shape of the
-% arrows.\footnote{If the option |wrap-lines| is used in an environment
+% The option |tikz-code| allows the user to change the shape of the arrows.\footnote{If the option |wrap-lines| is used in an environment
% |{DispWithArrows}| or |{DispWithArrows*}|, the option |tikz-code| will have no
% effect for the arrows of this environment but only for the arrows in the
% nested environments |{WithArrows}|.}
@@ -2423,7 +2479,7 @@ version 2005/12/01 or later.
% |expl3| code fails.\footnote{cf.
% |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|}
%
-% <@@=witharrows>
+%<@@=witharrows>
%
% \begin{macrocode}
%<*LaTeX>
@@ -2806,7 +2862,8 @@ version 2005/12/01 or later.
% 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|).
+% |{WithArrows}| in the |\halign|). This style is documented in the
+% documentation of \pkg{witharrows}.
% \begin{macrocode}
\tikzset
{
@@ -2817,7 +2874,8 @@ version 2005/12/01 or later.
%
% \bigskip
% The style |WithArrows/arrow| will be used to draw the arrows (more precisely,
-% it will be passed to |every~path|).
+% it will be passed to |every~path|). This style is documented in the
+% documentation of \pkg{witharrows}.
% \begin{macrocode}
\tikzset
{
@@ -3085,7 +3143,25 @@ version 2005/12/01 or later.
\bool_new:N \l_@@_subequations_bool
%</LaTeX>
% \end{macrocode}
-%
+%
+% \bigskip
+% The dimension |\l_@@_arrow_width_dim| is only for the arrows of type |up| and
+% |down|. A value of |\c_max_dim| means that the arrow has the maximal possible
+% width. A value of $0$~pt means that the the arrow has a width ajusted to the
+% content of the node.
+% \begin{macrocode}
+\dim_new:N \l_@@_arrow_width_dim
+\dim_set_eq:NN \l_@@_arrow_width_dim \c_max_dim
+% \end{macrocode}
+%
+% \bigskip
+% The parameter |\l_@@_up_and_down_radius_dim| corresponds to the option
+% |radius_for_up_and_down|.
+% \begin{macrocode}
+\dim_new:N \l_@@_up_and_down_radius_dim
+\dim_set:Nn \l_@@_up_and_down_radius_dim { 4 pt }
+% \end{macrocode}
+%
% \bigskip
% \subsection{The definition of the options}
%
@@ -3140,28 +3216,23 @@ version 2005/12/01 or later.
max-length-of-arrow .value_required:n = true ,
max-length-of-arrow .initial:n = 2 cm ,
ygap .dim_set:N = \l_@@_ygap_dim ,
- ygap .value_required:n = true ,
ygap .initial:n = 0.4 ex ,
ystart .dim_set:N = \l_@@_ystart_dim ,
- ystart .value_required:n = true ,
+
ystart .initial:n = 0.4 ex ,
more-columns .code:n =
\@@_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } ,
- more-columns .value_forbidden:n = true,
command-name .code:n =
\str_set:Nn \l_@@_command_name_str { #1 }
\str_set:Nx \l_@@_string_Arrow_for_msg_str
{ \c_backslash_str Arrow~alias~\c_backslash_str #1 } ,
- command-name .value_required:n = true ,
tikz-code .tl_set:N = \l_@@_tikz_code_tl,
tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
- tikz-code .value_required:n = true ,
TikzCode .meta:n = { tikz-code = #1 } ,
displaystyle .bool_set:N = \l_@@_displaystyle_bool ,
displaystyle .default:n = true ,
show-nodes .code:n =
\tikzset { @@_node_style / .append~style = { draw , red } } ,
- show-nodes .value_forbidden:n = true,
show-node-names .bool_set:N = \l_@@_show_node_names_bool ,
show-node-names .default:n = true ,
group .code:n =
@@ -3172,7 +3243,6 @@ version 2005/12/01 or later.
\int_set:Nn \l_@@_pos_arrow_int 7
}
{ \@@_error:n { Incompatible~options } } ,
- group .value_forbidden:n = true ,
groups .code:n =
\str_if_empty:NTF \l_@@_previous_key_str
{
@@ -3183,35 +3253,23 @@ version 2005/12/01 or later.
\int_set:Nn \l_@@_pos_arrow_int 6
}
{ \@@_error:n { Incompatible~options } } ,
- groups .value_forbidden:n = true ,
tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } ,
tikz .initial:n = \c_empty_tl ,
- tikz .value_required:n = true ,
- rr .value_forbidden:n = true ,
rr .code:n = \@@_fix_pos_option:n 3 ,
- ll .value_forbidden:n = true ,
ll .code:n = \@@_fix_pos_option:n 1 ,
- rl .value_forbidden:n = true ,
rl .code:n = \@@_fix_pos_option:n 2 ,
- lr .value_forbidden:n = true ,
lr .code:n = \@@_fix_pos_option:n 0 ,
- i .value_forbidden:n = true ,
i .code:n = \@@_fix_pos_option:n 5 ,
xoffset .dim_set:N = \l_@@_xoffset_dim ,
- xoffset .value_required:n = true ,
xoffset .initial:n = 3 mm ,
jot .dim_set:N = \jot ,
- jot .value_required:n = true ,
interline .skip_set:N = \l_@@_interline_skip ,
- interline .value_required:n = true ,
start-adjust .dim_set:N = \l_@@_start_adjust_dim ,
- start-adjust .value_required:n = true ,
start-adjust .initial:n = 0.4 ex ,
end-adjust .dim_set:N = \l_@@_end_adjust_dim ,
- end-adjust .value_required:n = true ,
end-adjust .initial:n = 0.4 ex ,
adjust .meta:n = { start-adjust = #1 , end-adjust = #1 } ,
- adjust .value_required:n = true ,
+ up-and-down .code:n = \keys_set:nn { WithArrows / up-and-down } { #1 } ,
% \end{macrocode}
%
% \medskip
@@ -3223,7 +3281,37 @@ version 2005/12/01 or later.
no-arrows .code:n =
\cs_set_eq:NN \@@_draw_arrows:nn \use_none:nn
\cs_set_eq:NN \@@_draw_arrow:nnn \use_none:nnn ,
- no-arrows .value_forbidden:n = true ,
+% \end{macrocode}
+% The following lines are the properties |.value_required:n| and
+% |.value_forbidden:n| or the keys. These properties have no effect because they
+% are not transmitted by inheritance (unfortunately). We maintain these lines in
+% the \textsc{dtx} only for the case of a modification of |l3keys|.
+%
+% \begin{macrocode}
+%<*comment>
+ ygap .value_required:n = true ,
+ ystart .value_required:n = true ,
+ more-columns .value_forbidden:n = true,
+ command-name .value_required:n = true ,
+ tikz-code .value_required:n = true ,
+ group .value_forbidden:n = true ,
+ groups .value_forbidden:n = true ,
+ tikz .value_required:n = true ,
+ show-nodes .value_forbidden:n = true,
+ ll .value_forbidden:n = true ,
+ rr .value_forbidden:n = true ,
+ rl .value_forbidden:n = true ,
+ lr .value_forbidden:n = true ,
+ i .value_forbidden:n = true ,
+ xoffset .value_required:n = true ,
+ jot .value_required:n = true ,
+ interline .value_required:n = true ,
+ start-adjust .value_required:n = true ,
+ end-adjust .value_required:n = true ,
+ adjust .value_required:n = true ,
+ up-and-down .value_required:n = true ,
+ no-arrows .value_forbidden:n = true
+%</comment>
}
% \end{macrocode}
%
@@ -3235,11 +3323,19 @@ version 2005/12/01 or later.
\keys_define:nn { WithArrows / WithArrowsSpecific }
{
t .code:n = \int_set:Nn \l_@@_pos_env_int O ,
- t .value_forbidden:n = true ,
c .code:n = \int_set:Nn \l_@@_pos_env_int 1 ,
- c .value_forbidden:n = true ,
b .code:n = \int_set:Nn \l_@@_pos_env_int 2 ,
+% \end{macrocode}
+% The following lines are the properties |.value_required:n| and
+% |.value_forbidden:n| or the keys. These properties have no effect because they
+% are not transmitted by inheritance (unfortunately). We maintain these lines in
+% the \textsc{dtx} only for the case of a modification of |l3keys|.
+% \begin{macrocode}
+%<*comment>
+ t .value_forbidden:n = true ,
+ c .value_forbidden:n = true ,
b .value_forbidden:n = true
+%</comment>
}
% \end{macrocode}
%
@@ -3275,7 +3371,6 @@ version 2005/12/01 or later.
fleqn .bool_set:N = \l_@@_fleqn_bool ,
fleqn .default:n = true ,
mathindent .dim_set:N = \l_@@_mathindent_dim ,
- mathindent .value_required:n = true ,
mathindent .initial:n = 25 pt ,
%<*LaTeX>
notag .code:n =
@@ -3299,11 +3394,9 @@ version 2005/12/01 or later.
\group_end:
} ,
subequations .default:n = true ,
- subequations .value_forbidden:n = true ,
nonumber .meta:n = notag ,
allow-multiple-labels .code:n =
\@@_msg_redirect_name:nn { Multiple~labels } { none } ,
- allow-multiple-labels .value_forbidden:n = true ,
tagged-lines .code:n =
\clist_set:Nn \l_@@_tags_clist { #1 }
\clist_if_in:NnT \l_@@_tags_clist { first }
@@ -3311,7 +3404,6 @@ version 2005/12/01 or later.
\clist_remove_all:Nn \l_@@_tags_clist { first }
\clist_put_left:Nn \l_@@_tags_clist \c_one_int
} ,
- tagged-lines .value_required:n = true ,
%</LaTeX>
wrap-lines .bool_set:N = \l_@@_wrap_lines_bool ,
wrap-lines .default:n = true ,
@@ -3333,10 +3425,22 @@ version 2005/12/01 or later.
% behaviour (which corresponds to the standard behaviour of |{align}| of
% \pkg{amsmath}).
% \begin{macrocode}
-%<*LaTeX>>
+%<*LaTeX>
standard-behaviour-with-items .bool_set:N = \l_@@_sbwi_bool ,
- standard-behaviour-with-items .default:n = true
+ standard-behaviour-with-items .default:n = true ,
%</LaTeX>
+% \end{macrocode}
+% The following lines are the properties |.value_required:n| and
+% |.value_forbidden:n| or the keys. These properties have no effect because they
+% are not transmitted by inheritance (unfortunately). We maintain these lines in
+% the \textsc{dtx} only for the case of a modification of |l3keys|.
+% \begin{macrocode}
+%<*comment>
+ mathindent .value_required:n = true ,
+ subequations .value_forbidden:n = true ,
+ allow-multiple-labels .value_forbidden:n = true ,
+ tagged-lines .value_required:n = true
+%</comment>
}
% \end{macrocode}
%
@@ -3358,13 +3462,10 @@ version 2005/12/01 or later.
{ \@@_error:n { Duplicate~name } }
{ \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str }
\str_set_eq:NN \l_@@_name_str \l_tmpa_str ,
- name .value_required:n = true ,
code-before .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } ,
- code-before .value_required:n = true,
CodeBefore .meta:n = { code-before = #1 } ,
code-after .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } ,
- code-after .value_required:n = true ,
- CodeAfter .meta:n = { code-after = #1 } ,
+ CodeAfter .meta:n = { code-after = #1 } ,
format .code:n =
\tl_if_empty:nTF { #1 }
{ \@@_error:n { Invalid~option~format } }
@@ -3373,6 +3474,15 @@ version 2005/12/01 or later.
{ \tl_set:Nn \l_@@_format_str { #1 } }
{ \@@_error:n { Invalid~option~format } }
} ,
+% \end{macrocode}
+% The following lines are the properties |.value_required:n| and
+% |.value_forbidden:n| or the keys. These properties have no effect because they
+% are not transmitted by inheritance (unfortunately). Maybe we should delete
+% these lines.
+% \begin{macrocode}
+ code-before .value_required:n = true,
+ code-after .value_required:n = true ,
+ name .value_required:n = true ,
format .value_required:n = true ,
}
% \end{macrocode}
@@ -3392,18 +3502,21 @@ version 2005/12/01 or later.
WithArrows / WithArrowsSpecific ,
WithArrows / Env
} ,
+ WithArrows / up-and-down .inherit:n = WithArrows / up-and-down ,
DispWithArrows .inherit:n =
{
WithArrows / DispWithArrowsSpecific ,
WithArrows / Global ,
WithArrows / Env ,
} ,
+ DispWithArrows / up-and-down .inherit:n = WithArrows / up-and-down ,
WithArrowsOptions .inherit:n =
{
WithArrows / Global ,
WithArrows / WithArrowsSpecific ,
- WithArrows / DispWithArrowsSpecific
- }
+ WithArrows / DispWithArrowsSpecific ,
+ } ,
+ WithArrowsOptions / up-and-down .inherit:n = WithArrows / up-and-down
}
% \end{macrocode}
%
@@ -3420,7 +3533,7 @@ version 2005/12/01 or later.
format, group, groups, i,
interline, jot, ll,
lr, max-length-of-arrow, more-columns, name,
- no-arrows, rl, rr,
+ no-arrows, rl, rr, up-and-down,
show-node-names, show-nodes, start-adjust,
t, tikz, tikz-code,
xoffset, ygap, ystart
@@ -3434,7 +3547,7 @@ version 2005/12/01 or later.
{
unknown .code:n =
\@@_sort_seq:N \l_@@_options_WithArrows_seq
- \@@_error:n { Unknown~option~WithArrows }
+ \@@_error:n { Unknown~option~WithArrows }
}
% \end{macrocode}
%
@@ -3445,7 +3558,7 @@ version 2005/12/01 or later.
left-brace .tl_set:N = \l_@@_left_brace_tl ,
unknown .code:n =
\@@_sort_seq:N \l_@@_options_DispWithArrows_seq
- \@@_error:n { Unknown~option~DispWithArrows }
+ \@@_error:n { Unknown~option~DispWithArrows } ,
}
% \end{macrocode}
%
@@ -3459,9 +3572,9 @@ version 2005/12/01 or later.
code-after, code-before, command-name, tikz-code, adjust,
displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot,
left-brace, ll, lr, max-length-of-arrow, mathindent, name, no-arrows,
- replace-left-brace-by, rl, rr, show-node-names, show-nodes, start-adjust,
- tikz, wrap-lines, xoffset, ygap, ystart,
-%<*LaTeX>>
+ up-and-down, replace-left-brace-by, rl, rr, show-node-names,
+ show-nodes, start-adjust, tikz, wrap-lines, xoffset, ygap, ystart,
+%<*LaTeX>
allow-multiple-labels, tagged-lines, nonumber, notag
%</LaTeX>
}
@@ -3490,9 +3603,10 @@ version 2005/12/01 or later.
{
allow-duplicate-names, b, c, command-name, more-columns, tikz-code, adjust,
displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
- mathindent, max-length-of-arrow, no-arrows, rl, rr, show-node-names,
- show-nodes, start-adjust, t, tikz, wrap-lines, xoffset, ygap, ystart,
-%<*LaTeX>>
+ 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,
+%<*LaTeX>
allow-multiple-labels, nonumber, notag, standard-behaviour-with-items,
tagged-lines
%</LaTeX>
@@ -3503,22 +3617,33 @@ version 2005/12/01 or later.
% The command |\@@_set_independent:| is a command without argument that will be
% used to specify that the arrow will be ``independent'' (of the potential
% groups of the option |group| or |groups|). This information will be stored in
-% the field ``status'' of the arrow. Another value of the field ``status'' is
-% ``new-group''.
+% the field ``status'' of the arrow. Another possible value of the field
+% ``status'' is ``new-group''.
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_independent:
{
+ \str_if_eq:VnF \l_keys_value_tl { NoValue }
+ { \@@_error:n { Value~for~a~key } }
+ \@@_set_independent_bis:
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The command |\@@_set_independent_bis:| is the same as |\@@_set_independant:|
+% except that the key may be used with a value.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_independent_bis:
+ {
\str_if_empty:NTF \l_@@_previous_key_str
{
\str_set_eq:NN \l_@@_previous_key_str \l_keys_key_tl
\str_set:Nn \l_@@_status_arrow_str { independent }
- \str_if_eq:VnF \l_keys_value_tl { NoValue }
- { \@@_error:n { Value~for~a~key } }
}
{ \@@_error:n { Incompatible~options~in~Arrow } }
}
% \end{macrocode}
%
+%
% \bigskip
% 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
@@ -6741,6 +6866,15 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
+% \begin{macrocode}
+\@@_msg_new:nn { Invalid~specification~for~MultiArrow }
+ {
+ The~specification~of~rows~for~\token_to_str:N\MultiArrow\
+ (i.e.~#1)~is~invalid. \\
+ \c_@@_command_ignored_str
+ }
+% \end{macrocode}
+%
%
% \subsection{The command \textbackslash WithArrowsNewStyle}
%
@@ -6803,74 +6937,288 @@ version 2005/12/01 or later.
%
% This code is the only part of the code of \pkg{witharrows} which uses the
% package \pkg{varwidth} and also the Tikz library |calc|. That's why we have
-% decided not to load this package and this library. If they are not loaded, the
-% user will have an error only when using the option |up| or the option |down|.
+% 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|.
+%
+% \bigskip
+% The keys |up| and |down| can be used with a value. This value is a list of
+% pairs key-value specific to the options |up| and |down|.
+% \begin{itemize}
+% \item The key |radius| is the radius of the rounded corner of the arrow.
+% \item The key |width| is the width of the horizontal part of the arrow. The
+% corresponding dimension is |\l_@@_arrow_width_dim|. By convention, a value of
+% $0$~pt for |\l_@@_arrow_width_dim| means that the option |width| has been used
+% with the special value |min| and a value of |\c_max_dim| means that it has
+% been used with the value |max|.
+% \end{itemize}
%
-% \medskip
+% \begin{macrocode}
+\keys_define:nn { WithArrows / up-and-down }
+ {
+ radius .dim_set:N = \l_@@_up_and_down_radius_dim ,
+ radius .value_required:n = true ,
+ width .code:n =
+ \str_case:nnF { #1 }
+ {
+ { min } { \dim_zero:N \l_@@_arrow_width_dim }
+ { max } { \dim_set_eq:NN \l_@@_arrow_width_dim \c_max_dim }
+ }
+ { \dim_set:Nn \l_@@_arrow_width_dim { #1 } } ,
+ width .value_required:n = true ,
+ unknown .code:n = \@@_error:n { Option~unknown~for~up-and-down }
+ }
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\@@_msg_new:nn { Option~unknown~for~up-and-down }
+ {
+ The~option~'\l_keys_key_tl'~is~unknown.~\c_@@_option_ignored_str
+ }
+% \end{macrocode}
+%
+%
+%
+% \bigskip
% The token list |\c_@@_tikz_code_up_tl| is the value of |tikz-code| which will
% be used for an option |up|.
+%
+% \bigskip
% \begin{macrocode}
-\tl_const:Nn \c_@@_tikz_code_up_tl
- {
- \draw [ rounded~corners ]
- let \p1 = (#1) ,
- \p2 = (#2)
- in (\p1) -- node {
%<*LaTeX>
- \dim_set:Nn \l_tmpa_dim { \x2 - \x1 }
- \begin { varwidth } \l_tmpa_dim
+\tl_const:Nn \c_@@_tikz_code_up_tl
+ {
+% \end{macrocode}
+% First the case when the key |up| is used with |width=max| (that's the default
+% behaviour).
+% \begin{macrocode}
+ \dim_compare:nNnTF \l_@@_arrow_width_dim = \c_max_dim
+ {
+ \draw [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1) -- node
+ {
+ \dim_set:Nn \l_tmpa_dim { \x2 - \x1 }
+ \begin { varwidth } \l_tmpa_dim
% \end{macrocode}
% |\narrowragged| is a command of the package \pkg{varwidth}.
% \begin{macrocode}
- \narrowragged
- #3
- \end { varwidth }
+ \narrowragged
+ #3
+ \end { varwidth }
+ }
+ (\x2,\y1) -- (\p2) ;
+ }
+% \end{macrocode}
+% Now the case where the key |up| is used with |width=|\textsl{value} with
+% \textsl{value} equal to |min| or a numeric value. The instruction |\path|
+% doesn't draw anything: its aim is to compute the natural width of the label of
+% the arrow. We can't use |\pgfextra| here because of the |\hbox_gset:Nn|.
+% \begin{macrocode}
+ {
+ \path
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in node
+ {
+% \end{macrocode}
+% The length |\l_tmpa_dim| will be the maximal width of the box composed by the
+% environment |{varwidth}|.
+% \begin{macrocode}
+ \dim_set:Nn \l_tmpa_dim
+ { \x2 - \x1 - \l_@@_up_and_down_radius_dim }
+ \dim_compare:nNnF \l_@@_arrow_width_dim = \c_zero_dim
+ {
+ \dim_set:Nn \l_tmpa_dim
+ { \dim_min:nn \l_tmpa_dim \l_@@_arrow_width_dim }
+ }
+% \end{macrocode}
+% Now, the length |\l_tmpa_dim| is computed. We can compose the label in the box
+% |\g_tmpa_box|. We have to do a global affectation to be able to exit the node.
+% \begin{macrocode}
+ \hbox_gset:Nn \g_tmpa_box
+ {
+ \begin { varwidth } \l_tmpa_dim
+ \narrowragged
+ #3
+ \end { varwidth }
+ }
+% \end{macrocode}
+% The length |\g_tmpa_dim| will be the width of the arrow (+ the radius of the
+% corner).
+% \begin{macrocode}
+ \dim_compare:nNnTF \l_@@_arrow_width_dim > \c_zero_dim
+ { \dim_gset_eq:NN \g_tmpa_dim \l_@@_arrow_width_dim }
+ { \dim_gset:Nn \g_tmpa_dim { \box_wd:N \g_tmpa_box } }
+ \dim_gadd:Nn \g_tmpa_dim \l_@@_up_and_down_radius_dim
+ } ;
+ \draw
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\x2-\g_tmpa_dim,\y1)
+ -- node { \box_use:N \g_tmpa_box }
+ (\x2-\l_@@_up_and_down_radius_dim,\y1)
+ [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ -| (\p2) ;
+ }
+ }
%</LaTeX>
%<*plain-TeX>
- #3
-%</plain-TeX>
- }
- (\x2,\y1) -- (\p2) ;
+\tl_const:Nn \c_@@_tikz_code_up_tl
+ {
+ \dim_case:nnF \l_@@_arrow_width_dim
+ {
+ \c_max_dim
+ {
+ \draw [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1) -- node { #3 } (\x2,\y1) -- (\p2) ;
+ }
+ \c_zero_dim
+ {
+ \path node
+ {
+ \hbox_gset:Nn \g_tmpa_box { #3 }
+ \dim_gset:Nn \g_tmpa_dim
+ { \box_wd:N \g_tmpa_box + \l_@@_up_and_down_radius_dim }
+ } ;
+ \draw
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\x2-\g_tmpa_dim,\y1)
+ -- node { \box_use:N \g_tmpa_box }
+ (\x2-\l_@@_up_and_down_radius_dim,\y1)
+ [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ -| (\p2) ;
+ }
+ }
+ {
+ \draw
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\x2 - \l_@@_arrow_width_dim - \l_@@_up_and_down_radius_dim,\y1)
+ -- node { #3 } (\x2-\l_@@_up_and_down_radius_dim,\y1)
+ [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ -| (\p2) ;
+ }
}
+%</plain-TeX>
% \end{macrocode}
-%
%
-% \medskip
-% Idem for the option |down|.
+%
+% \bigskip
+% The code for a arrow of type |down| is similar to the previous code (for an
+% arrow of type |up|).
% \begin{macrocode}
+%<*LaTeX>
\tl_const:Nn \c_@@_tikz_code_down_tl
{
- \draw [ rounded~corners ]
- let \p1 = (#1) ,
- \p2 = (#2)
- in (\p1) -- (\x1,\y2) --
- node {
-%<*LaTeX>
- \dim_set:Nn \l_tmpa_dim { \x1 - \x2 }
- \begin { varwidth } \l_tmpa_dim
- \narrowragged
- #3
- \end { varwidth }
+ \dim_compare:nNnTF \l_@@_arrow_width_dim = \c_max_dim
+ {
+ \draw [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1) -- (\x1,\y2) -- node
+ {
+ \dim_set:Nn \l_tmpa_dim { \x1 - \x2 }
+ \begin { varwidth } \l_tmpa_dim
+ \narrowragged
+ #3
+ \end { varwidth }
+ }
+ (\p2) ;
+ }
+ {
+ \path
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in node
+ {
+ \hbox_gset:Nn \g_tmpa_box
+ {
+ \dim_set:Nn \l_tmpa_dim
+% \end{macrocode}
+% The $2$~mm are for the tip of the arrow. We don't want the label of the arrow
+% too close to the tip of arrow (we assume that to the tip of the arrow has its
+% standard position, that is at the end of the arrow.).
+% \begin{macrocode}
+ { \x1 - \x2 - \l_@@_up_and_down_radius_dim - 2 mm }
+ \begin { varwidth } \l_tmpa_dim
+ \narrowragged
+ #3
+ \end { varwidth }
+ }
+ \dim_compare:nNnTF \l_@@_arrow_width_dim > \c_zero_dim
+ { \dim_gset_eq:NN \g_tmpa_dim \l_@@_arrow_width_dim }
+ { \dim_gset:Nn \g_tmpa_dim { \box_wd:N \g_tmpa_box } }
+ \dim_gadd:Nn \g_tmpa_dim \l_@@_up_and_down_radius_dim
+ } ;
+
+ \draw
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1)
+ { [ rounded~corners = \l_@@_up_and_down_radius_dim ] -- (\x1,\y2) }
+ -- (\x1-\l_@@_up_and_down_radius_dim,\y2)
+ -- node { \box_use:N \g_tmpa_box } (\x1-\g_tmpa_dim,\y2)
+ -- ++ (-2mm,0) ;
+ }
+ }
%</LaTeX>
-%<*plain-TeX>
- #3
-%</plain-TeX>
- }
- (\p2) ;
+%
+%<*plain-TeX>
+\tl_const:Nn \c_@@_tikz_code_down_tl
+ {
+ \dim_case:nnF \l_@@_arrow_width_dim
+ {
+ \c_max_dim
+ {
+ \draw [ rounded~corners = \l_@@_up_and_down_radius_dim ]
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1) -- (\x1,\y2) -- node { #3 } (\p2) ;
+ }
+ \c_zero_dim
+ {
+ \path node
+ {
+ \hbox_gset:Nn \g_tmpa_box { #3 }
+ \dim_gset:Nn \g_tmpa_dim
+ { \box_wd:N \g_tmpa_box + \l_@@_up_and_down_radius_dim }
+ } ;
+ \draw
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1)
+ { [ rounded~corners = \l_@@_up_and_down_radius_dim ] -- (\x1,\y2) }
+ -- (\x1-\l_@@_up_and_down_radius_dim,\y2)
+ -- node { \box_use:N \g_tmpa_box } (\x1-\g_tmpa_dim,\y2)
+ -- ++ (-2mm,0) ;
+ }
+ }
+ {
+ \draw
+ let \p1 = ( #1 ) , \p2 = ( #2 )
+ in (\p1)
+ { [ rounded~corners = \l_@@_up_and_down_radius_dim ] -- (\x1,\y2) }
+ -- (\x1-\l_@@_up_and_down_radius_dim,\y2)
+ -- node { #3 }
+ (\x1 - \l_@@_arrow_width_dim - \l_@@_up_and_down_radius_dim,\y2)
+ -- ++ (-2mm,0) ;
+ }
}
+%</plain-TeX>
% \end{macrocode}
-%
+%
+% \bigskip
+% We recall that the options of the individual arrows are scanned twice. First,
+% when are scanned when the command |\Arrow| occurs (we try to know whether the
+% arrow is ``individual'', etc.). That's the first pass.
% \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / FirstPass }
{
- up .code:n = \@@_set_independent: ,
- down .code:n = \@@_set_independent: ,
+ up .code:n = \@@_set_independent_bis: ,
+ down .code:n = \@@_set_independent_bis: ,
up .default:n = NoValue ,
down .default:n = NoValue
}
% \end{macrocode}
%
% \bigskip
+% The options are scanned a second time when the arrow is actually drawn. That's
+% the secon pass.
% \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / SecondPass }
{
@@ -6884,6 +7232,7 @@ version 2005/12/01 or later.
%</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 \c_one_int
% \end{macrocode}
% We have to set |\l_@@_wrap_lines_bool| to |false| because, otherwise, if the
@@ -6891,8 +7240,10 @@ version 2005/12/01 or later.
% have a special affectation to |tikz-code| that will overwrite our affectation.
% \begin{macrocode}
\bool_set_false:N \l_@@_wrap_lines_bool
- \tl_set_eq:NN \l_@@_tikz_code_tl
- \c_@@_tikz_code_up_tl
+% \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>
@@ -6910,10 +7261,10 @@ version 2005/12/01 or later.
%</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 \c_one_int
\bool_set_false:N \l_@@_wrap_lines_bool
- \tl_set_eq:NN \l_@@_tikz_code_tl
- \c_@@_tikz_code_down_tl
+ \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_down_tl
}
{ \@@_error:n { calc~not~loaded } }
%<*LaTeX>
@@ -6924,7 +7275,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
%
% \begin{macrocode}
\seq_put_right:Nn \l_@@_options_Arrow_seq { down }
@@ -6951,15 +7301,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \begin{macrocode}
-\@@_msg_new:nn { Invalid~specification~for~MultiArrow }
- {
- The~specification~of~rows~for~\token_to_str:N\MultiArrow\
- (i.e.~#1)~is~invalid. \\
- \c_@@_command_ignored_str
- }
-% \end{macrocode}
-%
%
% \begin{macrocode}
%<*plain-TeX>
@@ -7158,6 +7499,11 @@ version 2005/12/01 or later.
%
% The warning for an environment ending by |\\| has been transformed in |error|.
%
+% \subsection*{Changes between 2.2 and 2.3}
+%
+% Two options for the arrows of type |up| and |down|: |width| and |radius|.
+%
+%
% \PrintIndex
%
% \tableofcontents
diff --git a/macros/generic/witharrows/witharrows.pdf b/macros/generic/witharrows/witharrows.pdf
index eb25c91d02..b64ebed03c 100644
--- a/macros/generic/witharrows/witharrows.pdf
+++ b/macros/generic/witharrows/witharrows.pdf
Binary files differ