From 17704765562fe7fb37c673221b8798a23fce1e30 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Jun 2020 20:51:58 +0000 Subject: witharrows (22jun20) git-svn-id: svn://tug.org/texlive/trunk@55625 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/witharrows/README.md | 7 +- .../doc/generic/witharrows/witharrows-french.pdf | Bin 260589 -> 266363 bytes .../doc/generic/witharrows/witharrows-french.tex | 160 ++++++++++++-- .../doc/generic/witharrows/witharrows.pdf | Bin 616385 -> 639742 bytes .../doc/generic/witharrows/witharrows.tex | 240 ++++++++++++++++----- 5 files changed, 332 insertions(+), 75 deletions(-) (limited to 'Master/texmf-dist/doc') 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 Binary files a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf and b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf 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 @@ -2112,6 +2196,48 @@ $\begin{WithArrows}[interline=0.5ex] \end{WithArrows}$ +\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} diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf b/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf index 31c50353bfc..64cd930e620 100644 Binary files a/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf and b/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf 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~ -- cgit v1.2.3