From 855d5215723f5bff8afadcf46452597e5873b8a8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 1 Jan 2023 20:32:12 +0000 Subject: witharrows (1jan23) git-svn-id: svn://tug.org/texlive/trunk@65425 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/generic/witharrows/witharrows-french.pdf | Bin 269827 -> 272837 bytes .../doc/generic/witharrows/witharrows-french.tex | 56 +- .../doc/generic/witharrows/witharrows.pdf | Bin 686365 -> 559421 bytes .../doc/generic/witharrows/witharrows.tex | 221 +++++-- .../source/generic/witharrows/witharrows.dtx | 702 ++++++++++++++------- .../source/generic/witharrows/witharrows.ins | 4 +- .../tex/generic/witharrows/witharrows.sty | 251 ++++++-- 7 files changed, 886 insertions(+), 348 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf index ebb65eab902..01445044345 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 fd610eef085..cf2c940912a 100644 --- a/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex +++ b/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex @@ -71,6 +71,7 @@ version~\myfileversion\space de \pkg{witharrows}, à la date du~\myfiledate.}} \maketitle + \begin{abstract} L'extension \pkg{witharrows} fournit des environments |{WithArrows}| et |{DispWithArrows}| similaires aux environnements |{aligned}| et |{align}| de @@ -93,7 +94,7 @@ l'extension LaTeX. \medskip 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}. L'utilisateur final n'a qu'à charger l'extension \pkg{nicematrix} avec +\pkg{xparse}, \pkg{tikz}, \pkg{varwidth} ainsi que les bibliothèques Tikz \pkg{arrows.meta} et \pkg{bending}. L'utilisateur final n'a qu'à charger l'extension \pkg{witharrows} avec l'instruction habituelle : |\usepackage{witharrows}|. \medskip @@ -481,7 +482,6 @@ option est similaire au préambule d'un environnement |{array}|: il s'agit d'une |l| mais aussi |R|, |C| et |L|. \smallskip -\colorbox{yellow!50}{\textbf{Nouveau 2.6}}\enskip Les lettres |R|, |C| et |L| placent des groupes vides |{}| qui permettent un espacement correct lorsque ces colonnes contiennent des symboles de type |\mathrel| (comme $=$, $\le$, etc.) ou |\mathbin| (comme $+$, $×$, etc.). Ce système est inspiré par l'environnement |{IEEEeqnarray}| de \pkg{IEEEtrantools}. @@ -1530,10 +1530,8 @@ A & = A_1 \Arrow{première étape} \\ \bigskip Avec l'option |fleqn|, l'environnement est composé calé à gauche (d'une manière similaire à l'option |fleqn| des classes standard de LaTeX). Dans ce cas, la marge gauche peut être réglée avec -l'option |mathindent| (qui a un nom inspiré du paramètre |\mathindent| de LaTeX\footnote{En LaTeX, |mathindent| est -une dimension (|dim|) mais devrait devenir un ressort (|skip|) dans une prochaine version de LaTeX. Pour le moment, le -paramètre |mathindent| de \pkg{witharrows} est une dimension.}). La valeur initiale -pour cette option est de 25~pt. +l'option |mathindent| (qui a un nom inspiré du paramètre |\mathindent| de LaTeX). La valeur initiale pour cette +option est de 25~pt. \begin{Verbatim} \begin{DispWithArrows}[~emphase#fleqn,mathindent = 1cm@] @@ -1805,7 +1803,7 @@ xyz = -15 \label{dernière-équation} Le système complet est l'équation \ref{système} (cette référence a été obtenue avec |\ref{système}|) et la dernière équation est l'équation \ref{dernière-équation} (référence obtenue avec |\ref{dernière-équation}|). Notons que |\ref*|, utilisé dans le code ci-dessus, est une variante de -|ref| proposée par \pkg{hyperref} pour composer une référence sans créer de lien. +|ref| qui compose une référence sans créer de lien hypertexte (même quand \pkg{hyperref} est chargé). \bigskip On peut souhaiter remplacer l'accolade gauche par un autre délimiteur extensible (gauche). On peut le faire avec @@ -1935,6 +1933,44 @@ environnement (via les arguments optionnels) ou bien encore dans une autre comma Pour un exemple d'utilisation, voir p.~\pageref{example-WithArrowsRightX}. +\bigskip +\subsection{La clé right-overlap} + +\colorbox{yellow!50}{\textbf{Nouveau 2.8}} + +La clé |right-overlap| est une clé booléenne dont la valeur initiale est |true|. Elle concerne uniquement les +environnements |{WithArrows}|. + +Quand la clé |right-overlap| est active, les flèches (et leurs étiquettes) sont tracées en débordement et n'entrent +donc pas dans le calcul de la boîte TeX contenant l'environnement |{WithArrows}|. + +Quand la clé |right-overlap| est mise à |false| (dans |\WithArrowsOptions| ou bien dans un environnement +|{WithArrows}| individuel) le débord vers la droite est pris en compte dans le calcul des dimensions de la boîte +englobante. + +\begin{Verbatim} +$\left\{\begin{WithArrows}[c,format = rCrCl,~emphase#right-overlap=false@] +2x & + & 3y & = & 5 \Arrow{on ajoute $L_1$ à $L_2$}\\ +-2x & - & 5y & = & 2 +\end{WithArrows}\right.$\quad +$\left\{\begin{WithArrows}[c,format = rCrCl] +2x & + & 3y & = & 5 \\ + & - & 2y & = & 7 +\end{WithArrows}\right.$ +\end{Verbatim} + +\medskip +$\left\{\begin{WithArrows}[c,format = rCrCl,right-overlap=false] +2x & + & 3y & = & 5 \Arrow{on ajoute $L_1$ à $L_2$}\\ +-2x & - & 5y & = & 2 +\end{WithArrows}\right.$\quad +$\left\{\begin{WithArrows}[c,format = rCrCl] +2x & + & 3y & = & 5 \\ + & - & 2y & = & 7 +\end{WithArrows}\right.$ + +\bigskip +Le réglage |right-overlap = false| peut aussi être utile en conjonction avec la classe |standalone|. \bigskip \subsection{Positionnement vertical des flèches} @@ -1961,8 +1997,8 @@ $\begin{WithArrows}[interline=1mm, adjust = 0pt] \end{WithArrows}$ \begin{tikzpicture}[remember picture,overlay,blue] -\draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ;; -\draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ;; +\draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ; +\draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ; \draw (B) -- (C) ; \draw[<-] (B) to ++(0,0.2) ; \draw[<-] (C) to ++(0,-0.2) ; @@ -1983,7 +2019,7 @@ est |end-adjust| sont égaux à $0.4$~ex. \bigskip Voici par exemple le comportement sans le mécanisme de |start-adjust| et -|end-adjust| (c'était le comportement par défaut dans les versions antérieures à la version 1.13). +|end-adjust| : \begin{Verbatim} $\begin{WithArrows}~emphase#[start-adjust=0pt, end-adjust=0pt]@ A & = (a+1)^2 \Arrow{on développe} \\ diff --git a/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf b/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf index a6570633eac..2cae02ea86a 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 d04cfea0628..09477d5d734 100644 --- a/Master/texmf-dist/doc/generic/witharrows/witharrows.tex +++ b/Master/texmf-dist/doc/generic/witharrows/witharrows.tex @@ -6,7 +6,7 @@ %% %% witharrows.dtx (with options: `plain-TeX') %% -%% Copyright (C) 2017-2022 by F. Pantigny +%% Copyright (C) 2017-2023 by F. Pantigny %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -18,15 +18,20 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{2.7} -\def\myfiledate{2022/04/20} +\def\myfileversion{2.8} +\def\myfiledate{2023/01/01} \input tikz.tex \input expl3-generic.tex \usetikzlibrary{arrows.meta,bending} \ExplSyntaxOn \catcode `\@ = 11 \cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } } -\cs_new_protected:Npn \__witharrows_msg_new:nnn { \msg_new:nnnn { witharrows } } +\cs_new_protected:Npn \__witharrows_msg_new:nnn #1 #2 #3 + { + \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool + { \msg_new:nnn { witharrows } { #1 } { #2 \\ #3 } } + { \msg_new:nnnn { witharrows } { #1 } { #2 } { #3 } } + } \cs_new_protected:Npn \__witharrows_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } \cs_new_protected:Npn \__witharrows_error:n { \msg_error:nn { witharrows } } @@ -34,6 +39,13 @@ \cs_new_protected:Npn \__witharrows_fatal:n { \msg_fatal:nn { witharrows } } \cs_new_protected:Npn \__witharrows_error:nn { \msg_error:nnn { witharrows } } \cs_generate_variant:Nn \__witharrows_error:nn { n x } +\cs_new_protected:Npn \__witharrows_error_or_warning:n + { \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool \__witharrows_warning:n \__witharrows_error:n } +\bool_set:Nn \c__witharrows_messages_for_Overleaf_bool + { + \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs + || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf + } \cs_generate_variant:Nn \seq_set_split:Nnn { N x x } \AtBeginDocument { @@ -172,6 +184,8 @@ \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 } +\bool_new:N \l__witharrows_right_overlap_bool +\bool_set_true:N \l__witharrows_right_overlap_bool \cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1 { \str_if_empty:NTF \l__witharrows_previous_key_str @@ -202,7 +216,7 @@ \str_set:Nx \l__witharrows_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__witharrows_tikz_code_tl, + tikz-code .tl_set:N = \l__witharrows_tikz_code_tl , tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , tikz-code .value_required:n = true , displaystyle .bool_set:N = \l__witharrows_displaystyle_bool , @@ -272,7 +286,9 @@ c .code:n = \int_set:Nn \l__witharrows_pos_env_int 1 , c .value_forbidden:n = true , b .code:n = \int_set:Nn \l__witharrows_pos_env_int 2 , - b .value_forbidden:n = true + b .value_forbidden:n = true , + right-overlap .bool_set:N = \l__witharrows_right_overlap_bool , + right-overlap .value_required:n = true } \clist_new:N \c__witharrows_extensible_delimiters_clist \clist_set:Nn \c__witharrows_extensible_delimiters_clist @@ -283,7 +299,7 @@ { fleqn .bool_set:N = \l__witharrows_fleqn_bool , fleqn .default:n = true , - mathindent .dim_set:N = \l__witharrows_mathindent_dim , + mathindent .skip_set:N = \l__witharrows_mathindent_skip , mathindent .initial:n = 25 pt , mathindent .value_required:n = true , wrap-lines .bool_set:N = \l__witharrows_wrap_lines_bool , @@ -352,7 +368,7 @@ \__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrows_seq { adjust, b, c, code-after, code-before, command-name, - displaystyle, end-adjust, + right-overlap, displaystyle, end-adjust, format, group, groups, i, interline, jot, ll, lr, max-length-of-arrow, more-columns, name, @@ -397,7 +413,8 @@ \seq_new:N \l__witharrows_options_WithArrowsOptions_seq \__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrowsOptions_seq { - allow-duplicate-names, b, c, command-name, more-columns, tikz-code, adjust, + allow-duplicate-names, b, c, command-name, right_overlap, + more-columns, tikz-code, adjust, 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, @@ -592,6 +609,14 @@ { \keys_set:nn { WithArrows / WithArrows } { #1 } } \bool_if:NT \l__witharrows_in_DispWithArrows_bool { \keys_set:nn { WithArrows / DispWithArrows } { #1 } } + \bool_if:NF \l__witharrows_right_overlap_bool + { + \bool_if:NT \l__witharrows_in_WithArrows_bool + { + \dim_gzero_new:N \g__witharrows_overlap_x_dim + \dim_zero_new:N \l__witharrows_delta_x_dim + } + } \cs_set_eq:cN \l__witharrows_command_name_str \__witharrows_Arrow_first_columns: \int_set:Nn \l__witharrows_nb_cols_int { \str_count:N \l__witharrows_format_str } \int_gset_eq:NN \g__witharrows_col_int \l__witharrows_nb_cols_int @@ -647,7 +672,7 @@ \halign to \l__witharrows_linewidth_dim \bgroup \bool_if:NT \l__witharrows_fleqn_bool - { \skip_horizontal:N \l__witharrows_mathindent_dim } + { \skip_horizontal:N \l__witharrows_mathindent_skip } } \int_gincr:N \g__witharrows_line_int \int_gzero:N \g__witharrows_col_int @@ -712,6 +737,9 @@ \if_mode_math: \else: \__witharrows_error:n { WithArrows~outside~math~mode } \fi: + \box_clear_new:N \l__witharrows_env_box + \hbox_set:Nw \l__witharrows_env_box + \int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token \int_case:nn \l__witharrows_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } \bgroup \spread@equation @@ -729,7 +757,15 @@ \\ \egroup \egroup + \int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token + \hbox_set_end: \__witharrows_post_halign: + \bool_if:NF \l__witharrows_right_overlap_bool + { + \box_set_wd:Nn \l__witharrows_env_box + { \g__witharrows_overlap_x_dim + \box_wd:N \l__witharrows_env_box } + } + \box_use_drop:N \l__witharrows_env_box \group_end: } \cs_new_protected:Npn \__witharrows_post_halign: @@ -901,7 +937,7 @@ \hbox_to_wd:nn \l__witharrows_linewidth_dim { \bool_if:NTF \l__witharrows_fleqn_bool - { \skip_horizontal:N \l__witharrows_mathindent_dim } + { \skip_horizontal:N \l__witharrows_mathindent_skip } \hfil \hbox_to_wd:nn \g__witharrows_alignment_dim { @@ -1217,6 +1253,25 @@ { \dim_use:N \g__witharrows_y_final_dim } } } + \bool_if:NF \l__witharrows_right_overlap_bool + { + \bool_if:NT \l__witharrows_in_WithArrows_bool + { + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfpointanchor { wa - \l__witharrows_prefix_str - 1 - r } { south } + \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 + { + \dim_set:Nn \l__witharrows_delta_x_dim + { + \pgf@x - + ( \dim_min:nn \g__witharrows_x_initial_dim \g__witharrows_x_final_dim ) + } + } + { \dim_set:Nn \l__witharrows_delta_x_dim { \pgf@x - \l__witharrows_x_dim } } + \endpgfpicture + } + } \__witharrows_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl \group_end: } @@ -1232,13 +1287,25 @@ \pgf@relevantforpicturesizetrue #1 \dim_compare:nNnTF \pgf@picminx = { 16000 pt } - { \dim_zero:NN \l_tmpa_dim } + { \dim_zero:N \l_tmpa_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 + \bool_if:NF \l__witharrows_right_overlap_bool + { + \bool_if:NT \l__witharrows_in_WithArrows_bool + { + \dim_gset:Nn \g__witharrows_overlap_x_dim + { + \dim_max:nn + \g__witharrows_overlap_x_dim + { \l_tmpa_dim - \l__witharrows_delta_x_dim } + } + } + } \pgfresetboundingbox \endtikzpicture } @@ -1519,7 +1586,6 @@ -- node (__witharrows_label) {} ([xshift = \l__witharrows_xoffset_dim+5mm]\l_tmpb_tl-r.south) -- ([xshift = \l__witharrows_xoffset_dim]\l_tmpb_tl-r.south) ; - \pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west } \dim_set:Nn \l_tmpa_dim { 20 cm } \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; @@ -1547,9 +1613,15 @@ { \draw [ <- ] ( [xshift = \l__witharrows_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; - } ; + } % ; \endtikzpicture } +\bool_if:NTF \c__witharrows_messages_for_Overleaf_bool + { \str_const:Nn \c__witharrows_available_keys_str { } } + { + \str_const:Nn \c__witharrows_available_keys_str + { For~a~list~of~the~available~keys,~type~H~. } + } \str_new:N \l_witharrows_body_str \cs_new:Npn \__witharrows_potential_body_i: { @@ -1558,7 +1630,7 @@ } \cs_new:Npn \__witharrows_potential_body_ii: { - \str_if_empty:NTF \l_nicematrix_body_str + \str_if_empty:NTF \l_witharrows_body_str { No~further~help~available } { The~body~of~your~environment~was:\\ @@ -1571,6 +1643,7 @@ { If~you~go~on,~this~command~will~be~ignored. } \__witharrows_msg_new:nn { Bad~value~for~replace~brace~by } { + Incorrect~value.\\ Bad~value~for~the~option~'\l_keys_key_str'.~The~value~must~begin~ with~an~extensible~left~delimiter.~The~possible~values~are:~., \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ @@ -1583,6 +1656,7 @@ } \__witharrows_msg_new:nn { option~of~cr~negative } { + Bad~value.\\ The~argument~of~the~command~\token_to_str:N\\~ should~be~positive~in~the~row~\int_use:N \g__witharrows_line_int\ of~your~environment~\{\l__witharrows_type_env_str\}.\\ @@ -1590,13 +1664,15 @@ } \__witharrows_msg_new:nn { omit~probably~used } { - There~is~a~problem.~Maybe~you~have~used~a~command~ + Strange~problem.\\ + Maybe~you~have~used~a~command~ \token_to_str:N\omit\ in~the~line~\int_use:N \g__witharrows_line_int\ (or~another~line)~of~your~environment~\{\l__witharrows_type_env_str\}.\\ You~can~go~on~but~you~may~have~others~errors. } \__witharrows_msg_new:nnn { Invalid~option~format } { + Invalide~value.\\ The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ must~not~be~empty.\\ \c__witharrows_option_ignored_str @@ -1605,6 +1681,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { invalid~key~o } { + Invalid~use~of~a~key.\\ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~ 'group'~or~in~mode~'groups'.\\ \c__witharrows_option_ignored_str @@ -1613,6 +1690,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Value~for~a~key } { + Misuse~of~a~key.\\ The~key~'\l_keys_key_str'~should~be~used~without~value. \\ However,~you~can~go~on~for~this~time. \__witharrows_potential_body_i: @@ -1620,12 +1698,13 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Unknown~option~in~Arrow } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~for~the~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~row~ \int_use:N \g__witharrows_line_int\ of~your~environment~ \{\l__witharrows_type_env_str\}. \l_tmpa_str \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1633,9 +1712,10 @@ } \__witharrows_msg_new:nnn { Unknown~option~WithArrows } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1643,9 +1723,10 @@ } \__witharrows_msg_new:nnn { Unknown~option~DispWithArrows } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1653,10 +1734,11 @@ } \__witharrows_msg_new:nnn { Unknown~option~WithArrowsOptions } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1664,10 +1746,11 @@ } \__witharrows_msg_new:nnn { Unknown~option~Arrow~in~code-after } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \Arrow\ in~code-after. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1675,6 +1758,7 @@ } \__witharrows_msg_new:nnn { Too~much~columns~in~WithArrows } { + Too~much~columns.\\ Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N \l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ @@ -1686,6 +1770,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Too~much~columns~in~DispWithArrows } { + Too~much~columns.\\ Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N \l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ @@ -1696,6 +1781,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { Negative~jump } { + Incorrect~value.\\ You~can't~use~a~negative~value~for~the~option~'jump'~of~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__witharrows_line_int\ @@ -1705,6 +1791,7 @@ } \__witharrows_msg_new:nn { new-group~without~groups } { + Misuse~of~a~key.\\ You~can't~use~the~option~'new-group'~for~the~command~ \l__witharrows_string_Arrow_for_msg_str\ because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~ @@ -1714,8 +1801,9 @@ \__witharrows_msg_new:nnn { Too~few~lines~for~an~arrow } { + Impossible~arrow.\\ Line~\l__witharrows_input_line_str\ - :~an~arrow~specifiead~in~the~row~\int_use:N \l__witharrows_initial_int\ + :~an~arrow~specified~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. @@ -1724,12 +1812,14 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { o~arrow~with~no~arrow~under } { + Problem~with~the~key~'o'.\\ 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:nnn { WithArrows~outside~math~mode } { + You~are~outside~math~mode.\\ The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~ like~the~environment~\{aligned\}~of~amsmath. \\ Nevertheless,~you~can~go~on. @@ -1738,6 +1828,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { DispWithArrows~in~math~mode } { + You~are~in~math~mode.\\ The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\ This~error~is~fatal. @@ -1746,14 +1837,17 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { Incompatible~options~in~Arrow } { + Incompatible~options.\\ You~try~to~use~the~option~'\l_keys_key_str'~but~ this~option~is~incompatible~or~redundant~with~the~option~ '\l__witharrows_previous_key_str'~set~in~the~same~command~ \l__witharrows_string_Arrow_for_msg_str. \\ \c__witharrows_option_ignored_str } -\__witharrows_msg_new:nn { Incompatible~options } - { You~try~to~use~the~option~'\l_keys_key_str'~but~ +\__witharrows_msg_new:nn { Incompatible~options a} + { + Incompatible~options. + You~try~to~use~the~option~'\l_keys_key_str'~but~ this~option~is~incompatible~or~redundant~with~the~option~ '\l__witharrows_previous_key_str'~set~in~the~same~command~ \bool_if:NT \l__witharrows_in_code_after_bool @@ -1765,8 +1859,10 @@ } \__witharrows_msg_new:nnn { Arrow~not~in~last~column } { + Bad~use~of~\l__witharrows_string_Arrow_for_msg_str. You~should~use~the~command~\l__witharrows_string_Arrow_for_msg_str\ only~in~the~last~column~(column~\int_use:N\l__witharrows_nb_cols_int)~ + in~the~row~\int_use:N \g__witharrows_line_int\ of~your~environment~\{\l__witharrows_type_env_str\}.\\ However~you~can~go~on~for~this~time. \__witharrows_potential_body_i: @@ -1774,6 +1870,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { Wrong~line~in~Arrow } { + Wrong~line.\\ The~specification~of~line~'#1'~you~use~in~the~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~'code-after'~of~\{\l__witharrows_type_env_str\}~doesn't~exist. \\ @@ -1781,23 +1878,27 @@ } \__witharrows_msg_new:nn { Both~lines~are~equal } { + Both~lines~are~equal.\\ In~the~'code-after'~of~\{\l__witharrows_type_env_str\}~you~try~to~ draw~an~arrow~going~to~itself~from~the~line~'#1'.~This~is~not~possible. \\ \c__witharrows_option_ignored_str } \__witharrows_msg_new:nn { Wrong~line~specification~in~MultiArrow } { + Wrong~line~specification.\\ The~specification~of~line~'#1'~doesn't~exist. \\ If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow. } \__witharrows_msg_new:nn { Too~small~specification~for~MultiArrow } { + Too~small~specification.\\ The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ is~too~small:~you~need~at~least~two~lines. \\ \c__witharrows_command_ignored_str } \__witharrows_msg_new:nn { Not~allowed~in~DispWithArrows } { + Forbidden~command.\\ The~command~\token_to_str:N #1 is~allowed~only~in~the~last~column~ (column~\int_use:N\l__witharrows_nb_cols_int)~of~\{\l__witharrows_type_env_str\}. \\ @@ -1805,13 +1906,15 @@ } \__witharrows_msg_new:nn { Not~allowed~in~WithArrows } { + Forbidden~command.\\ The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__witharrows_type_env_str\}~ (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\ \c__witharrows_option_ignored_str } \__witharrows_msg_new:nn { Inexistent~v-node } { - There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ + There~is~a~problem.\\ + Maybe~you~have~put~a~command~\token_to_str:N\cr\ instead~of~a~command~\token_to_str:N\\~at~the~end~of~ the~row~\l_tmpa_int\ of~your~environment~\{\l__witharrows_type_env_str\}. \\ @@ -1819,6 +1922,7 @@ } \__witharrows_msg_new:nn { Option~xoffset~forbidden } { + Incorrect~key.\\ You~can't~use~the~option~'xoffset'~in~the~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__witharrows_line_int\ of~your~environment~\{\l__witharrows_type_env_str\}~ @@ -1831,6 +1935,7 @@ } \__witharrows_msg_new:nnn { Duplicate~name } { + Duplicate~name.\\ The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ the~same~environment~name~twice.~You~can~go~on,~but,~ maybe,~you~will~have~incorrect~results. \\ @@ -1844,6 +1949,7 @@ } \__witharrows_msg_new:nn { Invalid~specification~for~MultiArrow } { + Invalid~specification.\\ The~specification~of~rows~for~\token_to_str:N\MultiArrow\ (i.e.~#1)~is~invalid. \\ \c__witharrows_command_ignored_str @@ -1853,29 +1959,58 @@ \keys_if_exist:nnTF { WithArrows / Global } { #1 } { \__witharrows_error:nn { Key~already~defined } { #1 } } { - \keys_define:nn { WithArrows / Global } + \seq_clear:N \l_tmpa_seq + \keyval_parse:NNn \__witharrows_valid_key:n \__witharrows_valid_key:nn { #2 } + \seq_if_empty:NTF \l_tmpa_seq { - #1 .code:n = - { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } } + \seq_put_right:Nx \l__witharrows_options_WithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l__witharrows_options_DispWithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l__witharrows_options_WithArrowsOptions_seq + { \tl_to_str:N { #1 } } + \cs_if_exist:NTF \keys_precompile:nnN + { + \keys_precompile:nnN + { WithArrows / WithArrowsOptions } + { #2 } + \l_tmpa_tl + \__witharrows_key_define:nV { #1 } \l_tmpa_tl + } + { + \keys_define:nn { WithArrows / Global } + { + #1 .code:n = + { \keys_set:nn { WithArrows / WithArrowsOptions } { #2 } } + } + } } - \seq_put_right:Nx \l__witharrows_options_WithArrows_seq { \tl_to_str:n { #1 } } - \seq_put_right:Nx \l__witharrows_options_DispWithArrows_seq - { \tl_to_str:n { #1 } } - \seq_put_right:Nx \l__witharrows_options_WithArrowsOptions_seq - { \tl_to_str:N { #1 } } - \group_begin: - \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } - { - The~key~'\l_keys_key_str'~can't~be~set~in~the~ - definition~of~a~style.~You~can~go~on~for~this~time~ - but~you~should~suppress~this~key. - } - \WithArrowsOptions { #2 } - \group_end: + { \__witharrows_error:nn { Impossible~style } { #1 } } } } +\__witharrows_msg_new:nn { Impossible~style } + { + Impossible~style.\\ + It's~impossible~to~define~the~style~'#1'~ + because~it~contains~unknown~keys:~' + \seq_use:Nnnn \l_tmpa_seq { '~and~' } { ',~'} { ',~and~}'. + } +\cs_new_protected:Npn \__witharrows_valid_key:n #1 + { + \keys_if_exist:nnF { WithArrows / Global } { #1 } + { \seq_put_right:Nn \l_tmpa_seq { #1 } } + } +\cs_new_protected:Npn \__witharrows_valid_key:nn #1 #2 + { + \keys_if_exist:nnF { WithArrows / Global } { #1 } + { \seq_put_right:Nn \l_tmpa_seq { #1 } } + } +\cs_new_protected:Npn \__witharrows_key_define:nn #1 #2 + { \keys_define:nn { WithArrows / Global } { #1 .code:n = #2 } } +\cs_generate_variant:Nn \__witharrows_key_define:nn { n V } \__witharrows_msg_new:nn { Key~already~defined } { + Key~already~define.\\ The~key~'#1'~is~already~defined. \\ If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored. @@ -1896,6 +2031,7 @@ } \__witharrows_msg_new:nn { Option~unknown~for~up-and-down } { + Unknown~option.\\ The~option~'\l_keys_key_str'~is~unknown.~\c__witharrows_option_ignored_str } \tl_const:Nn \c__witharrows_tikz_code_up_tl @@ -2012,6 +2148,7 @@ \seq_put_right:Nn \l__witharrows_options_Arrow_seq { up } \__witharrows_msg_new:nn { calc~not~loaded } { + calc~not~loaded.\\ You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~ Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'~ ~in~the~preamble~of~your~document. \\ diff --git a/Master/texmf-dist/source/generic/witharrows/witharrows.dtx b/Master/texmf-dist/source/generic/witharrows/witharrows.dtx index ca8955ce215..6c28c3c7569 100644 --- a/Master/texmf-dist/source/generic/witharrows/witharrows.dtx +++ b/Master/texmf-dist/source/generic/witharrows/witharrows.dtx @@ -1,6 +1,6 @@ %\iffalse meta-comment % -% Copyright (C) 2017-2022 by F. Pantigny +% Copyright (C) 2017-2023 by F. Pantigny % ----------------------------------- % % This file may be distributed and/or modified under the @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{2.7} -\def\myfiledate{2022/04/20} +\def\myfileversion{2.8} +\def\myfiledate{2023/01/01} % % %<*batchfile> @@ -26,7 +26,7 @@ \usedir{tex/latex/witharrows} \preamble -Copyright (C) 2017-2022 by F. Pantigny +Copyright (C) 2017-2023 by F. Pantigny ----------------------------------- This file may be distributed and/or modified under the @@ -523,7 +523,6 @@ version 2005/12/01 or later. % but also |R|, |C| and |L|. % % \smallskip -% \colorbox{yellow!50}{\textbf{New 2.6}}\enskip % The letters |R|, |C| and |L| add empty groups |{}| which provide correct % spaces when these columns contain symbols with the type |\mathrel| (such as % $=$, $\leq$, etc.) or |\mathbin| (such as $+$, $\times$, etc.). This system is @@ -1599,10 +1598,7 @@ version 2005/12/01 or later. % With the option |fleqn|, the environment is composed flush left (in a way % similar to the option |fleqn| of the standard classes of LaTeX). In this case, % the left margin can be controlled with the option |mathindent| (with a name -% inspired by the parameter |\mathindent| of standard LaTeX\footnote{In LaTeX, -% |mathindent| is a dimension (|dim|) and not a glue (|skip|) but should become -% a skip in a future version of LaTeX. As of now, the parameter |mathindent| of -% \pkg{witharrows} is a dimension.}). The initial value +% inspired by the parameter |\mathindent| of standard LaTeX. The initial value % of this parameter is 25~pt. % % \begin{Verbatim} @@ -1879,9 +1875,9 @@ version 2005/12/01 or later. % The whole system is the equation \ref{system} (this reference has been coded % by |\ref{system}|) whereas the last equation is the equation % \ref{last-equation} (this reference has been coded by -% |\ref{last-equation}|). The command |\ref*| used in the code above is -% provided by \pkg{hyperref}. It's a variant of |\ref| which doesn't create -% interactive link. +% |\ref{last-equation}|). The command |\ref*| used in the code above is a +% variant of the command |\ref| which does not create interactive link (even when +% \pkg{hyperref} is loaded). % % \bigskip % With the option |replace-left-brace-by|, it's possible to replace the @@ -2014,6 +2010,46 @@ version 2005/12/01 or later. % % For an example of use, see p.~\pageref{example-WithArrowsRightX}. % +% \subsection{The key right-overlap} +% +% \colorbox{yellow!50}{\textbf{New 2.8}} +% +% The key |right-overlap| is a boolean key whose initial value is |true|. It +% deals with the environments |{WithArrows}| only. +% +% When the key |right-overlap| is in force, the arrows (and their labels) are +% drawn in an overlapping position and are not relevant for the computation of +% the dimensions of the TeX box containing the environment |{WithArrows}|. +% +% When the key |right-overlap| is set to |false| (with |\WithArrowsOptions| or +% whithin an individual environment |{WithArrows}|), the overlapping on the +% right is taken into account in the dimensions of the encompassing box. +% +% +% \begin{Verbatim} +% $\left\{\begin{WithArrows}[c,format = rCrCl,~emphase#right-overlap=false@] +% 2x & + & 3y & = & 5 \Arrow{we add $L_1$ to $L_2$}\\ +% -2x & - & 5y & = & 2 +% \end{WithArrows}\right.$\quad +% $\left\{\begin{WithArrows}[c,format = rCrCl] +% 2x & + & 3y & = & 5 \\ +% & - & 2y & = & 7 +% \end{WithArrows}\right.$ +% \end{Verbatim} +% +% \medskip +% $\left\{\begin{WithArrows}[c,format = rCrCl,right-overlap=false] +% 2x & + & 3y & = & 5 \Arrow{we add $L_1$ to $L_2$}\\ +% -2x & - & 5y & = & 2 +% \end{WithArrows}\right.$\quad +% $\left\{\begin{WithArrows}[c,format = rCrCl] +% 2x & + & 3y & = & 5 \\ +% & - & 2y & = & 7 +% \end{WithArrows}\right.$ +% +% \bigskip +% The tuning |right-overlap = false| may also be useful in conjunction with the class |standalone|. +% % % \bigskip % \subsection{Vertical positioning of the arrows} @@ -2040,8 +2076,8 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \begin{tikzpicture}[remember picture,overlay,blue] -% \draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ;; -% \draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ;; +% \draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ; +% \draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ; % \draw (B) -- (C) ; % \draw[<-] (B) to ++(0,0.2) ; % \draw[<-] (C) to ++(0,-0.2) ; @@ -2062,7 +2098,7 @@ version 2005/12/01 or later. % % \bigskip % Here is for example the behaviour without the mechanism of |start-adjust| and -% |end-adjust| (this was the standard behaviour for versions prior to 1.13). +% |end-adjust|: % % \begin{Verbatim} % $\begin{WithArrows}~emphase#[start-adjust=0pt, end-adjust=0pt]@ % A & = (a+1)^2 \Arrow{we expand} \\ @@ -2569,8 +2605,8 @@ version 2005/12/01 or later. % Assume we want to draw a loop of numbered arrows. In this purpose, it's % possible to write a dedicated command |\NumberedLoop| which will do the job % when used in |code-after|. In the following example, we write this command with -% |\NewDocumentCommand| (of \pkg{xparse}) and |\foreach| of \pkg{pgffor} (both -% packages are loaded when \pkg{witharrows} is loaded). +% |\NewDocumentCommand| (of L3) and |\foreach| of \pkg{pgffor} (which +% is loaded when \pkg{witharrows} is loaded). % % \begin{Verbatim} % \NewDocumentCommand \NumberedLoop {} @@ -2680,22 +2716,8 @@ version 2005/12/01 or later. % \end{macrocode} % % -% \medskip -% \begin{macrocode} -\msg_new:nnn { witharrows } { expl3~too~old } - { - Your~version~of~LaTeX~(especially~expl3)~is~too~old.~ - You~can~go~on~but~you~will~probably~have~other~errors~ - if~you~use~the~functionalities~of~witharrows. - } -\cs_if_exist:NF \seq_set_map_x:NNn - { \msg_error:nn { witharrows } { expl3~too~old } } -% \end{macrocode} -% % \bigskip -% The package \pkg{xparse} is still loaded for use on Overleaf. % \begin{macrocode} -\RequirePackage { xparse } \RequirePackage { varwidth } % % \end{macrocode} @@ -2737,7 +2759,12 @@ version 2005/12/01 or later. % \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { witharrows } } -\cs_new_protected:Npn \@@_msg_new:nnn { \msg_new:nnnn { witharrows } } +\cs_new_protected:Npn \@@_msg_new:nnn #1 #2 #3 + { + \bool_if:NTF \c_@@_messages_for_Overleaf_bool + { \msg_new:nnn { witharrows } { #1 } { #2 \\ #3 } } + { \msg_new:nnnn { witharrows } { #1 } { #2 } { #3 } } + } \cs_new_protected:Npn \@@_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } \cs_new_protected:Npn \@@_error:n { \msg_error:nn { witharrows } } @@ -2747,6 +2774,25 @@ version 2005/12/01 or later. \cs_generate_variant:Nn \@@_error:nn { n x } % \end{macrocode} % +% \bigskip +% We also create a command which will genereate usually an error but only a +% warning on Overleaf. The argument is given by currification. +% \begin{macrocode} +\cs_new_protected:Npn \@@_error_or_warning:n + { \bool_if:NTF \c_@@_messages_for_Overleaf_bool \@@_warning:n \@@_error:n } +% \end{macrocode} +% +% We try to detect whether the compilation is done on Overleaf. We use +% |\c_sys_jobname_str| because, with Overleaf, the value of |\c_sys_jobname_str| +% is always ``|output|''. +% \begin{macrocode} +\bool_set:Nn \c_@@_messages_for_Overleaf_bool + { + \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs + || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf + } +% \end{macrocode} +% % \medskip % We define a set of keys |WithArrows/package| for these options. % \begin{macrocode} @@ -2780,6 +2826,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { footnote~with~footnotehyper~package } { + Footnote~forbidden.\\ You~can't~use~the~option~'footnote'~because~the~package~ footnotehyper~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ @@ -3108,7 +3155,7 @@ version 2005/12/01 or later. % \subsection{Variables} % % The boolean |\l_@@_in_WithArrows_bool| will be raised in an environment -% |{WithArrows}| and the boolean |\l_@@_in_dispwitharrows_bool| will be raised +% |{WithArrows}| and the boolean |\l_@@_in_DispWithArrows_bool| will be raised % in an environment |{DispWithArrows}| or |{DispWithArrows*}|. The boolean % |\l_@@_in_code_after_bool| will be raised during the execution of the % |code-after| (option |code-after|). @@ -3337,6 +3384,17 @@ version 2005/12/01 or later. \dim_new:N \l_@@_xoffset_for_o_arrows_dim \dim_set:Nn \l_@@_xoffset_for_o_arrows_dim { 2 mm } % \end{macrocode} +% +% +% \bigskip +% The following boolean corresponds to the key |right-overlap|. When that key is +% |false|, the overlap on the right of the arrows (and their labels) is computed +% and it is used to change the width of the environment |{WithArrows}| in order +% to include the arrows on the right (and, hence, there is no overlap). +% \begin{macrocode} +\bool_new:N \l_@@_right_overlap_bool +\bool_set_true:N \l_@@_right_overlap_bool +% \end{macrocode} % % \bigskip % \subsection{The definition of the options} @@ -3405,7 +3463,7 @@ version 2005/12/01 or later. \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 .tl_set:N = \l_@@_tikz_code_tl , tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , tikz-code .value_required:n = true , displaystyle .bool_set:N = \l_@@_displaystyle_bool , @@ -3490,7 +3548,9 @@ version 2005/12/01 or later. 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 , - b .value_forbidden:n = true + b .value_forbidden:n = true , + right-overlap .bool_set:N = \l_@@_right_overlap_bool , + right-overlap .value_required:n = true } % \end{macrocode} % @@ -3526,7 +3586,7 @@ 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 .skip_set:N = \l_@@_mathindent_skip , mathindent .initial:n = 25 pt , mathindent .value_required:n = true , %<*LaTeX> @@ -3670,7 +3730,7 @@ version 2005/12/01 or later. \@@_set_seq_of_str_from_clist:Nn \l_@@_options_WithArrows_seq { adjust, b, c, code-after, code-before, command-name, - displaystyle, end-adjust, + right-overlap, displaystyle, end-adjust, format, group, groups, i, interline, jot, ll, lr, max-length-of-arrow, more-columns, name, @@ -3743,7 +3803,8 @@ version 2005/12/01 or later. \seq_new:N \l_@@_options_WithArrowsOptions_seq \@@_set_seq_of_str_from_clist:Nn \l_@@_options_WithArrowsOptions_seq { - allow-duplicate-names, b, c, command-name, more-columns, tikz-code, adjust, + allow-duplicate-names, b, c, command-name, right_overlap, + more-columns, tikz-code, adjust, 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, @@ -4229,7 +4290,6 @@ version 2005/12/01 or later. % \end{macrocode} % % -% % \bigskip % In (the last column of) |{DispWithArrows}|, it's possible to put several % labels (for the same number of equation). That's why these labels will be @@ -4275,6 +4335,22 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip +% The dimension |\g_@@_overlap_x_dim| will be the maximal overlap on the right +% of the arrows (and their labels) drawn in the environment |{WithArrows}|. The +% dimension |\l_@@_delta_x_dim| will be the difference of abscissa between the +% right side of the alignment (|\halign|) and the left side of the arrow. +% \begin{macrocode} + \bool_if:NF \l_@@_right_overlap_bool + { + \bool_if:NT \l_@@_in_WithArrows_bool + { + \dim_gzero_new:N \g_@@_overlap_x_dim + \dim_zero_new:N \l_@@_delta_x_dim + } + } +% \end{macrocode} +% +% \medskip % Now we link the command |\Arrow| (or the corresponding command with a name % given by the user with the option |command-name|: that's why the following line % must be after the loading of the options) to the command @@ -4478,7 +4554,7 @@ version 2005/12/01 or later. \halign to \l_@@_linewidth_dim \bgroup \bool_if:NT \l_@@_fleqn_bool - { \skip_horizontal:N \l_@@_mathindent_dim } + { \skip_horizontal:N \l_@@_mathindent_skip } } \int_gincr:N \g_@@_line_int \int_gzero:N \g_@@_col_int @@ -4581,6 +4657,11 @@ version 2005/12/01 or later. \fi: % \end{macrocode} % +% \begin{macrocode} + \box_clear_new:N \l_@@_env_box + \hbox_set:Nw \l_@@_env_box +% \end{macrocode} +% % \bigskip % The environment begins with a |\vtop|, a |\vcenter| or a % |\vbox|\footnote{Notice that the use of |\vtop| seems color-safe here...} @@ -4589,6 +4670,7 @@ version 2005/12/01 or later. % error is raised if the environment is used outside math mode.} and therefore, % we can use |\vcenter|. % \begin{macrocode} + \int_compare:nNnT \l_@@_pos_env_int = 1 \c_math_toggle_token \int_case:nn \l_@@_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } \bgroup % \end{macrocode} @@ -4632,9 +4714,9 @@ version 2005/12/01 or later. % % % \bigskip -% We begin the second part of the environment |{WithArrows}|. We have two -% |\egroup|\,: one for the |\halign| and one for the |\vtop| (or |\vcenter| or -% |\vbox|). +% We begin the second part of the environment |{WithArrows}|. We have three +% |\egroup|\,: one for the |\halign|, one for the |\vtop| (or |\vcenter| or +% |\vbox|) and one for the |\hbox_set:Nn \l_@@_env_box|. % \begin{macrocode} %<*plain-TeX> \cs_new_protected:Npn \endWithArrows @@ -4643,8 +4725,20 @@ version 2005/12/01 or later. \\ \egroup \egroup + \int_compare:nNnT \l_@@_pos_env_int = 1 \c_math_toggle_token + \hbox_set_end: \@@_post_halign: % \end{macrocode} +% We want to add white space on the right side of the box in order to take into +% account the arrows and their labels. +% \begin{macrocode} + \bool_if:NF \l_@@_right_overlap_bool + { + \box_set_wd:Nn \l_@@_env_box + { \g_@@_overlap_x_dim + \box_wd:N \l_@@_env_box } + } + \box_use_drop:N \l_@@_env_box +% \end{macrocode} % % \bigskip % If the option |footnote| or the option |footnotehyper| is used, then we @@ -4772,10 +4866,9 @@ version 2005/12/01 or later. % \subsubsection{The command of end of row} % % We give now the definition of |\@@_cr:| which is the definition of |\\| in an -% environment |{WithArrows}|. The two \pkg{expl3} commands -% |\group_align_safe_begin:| and |\group_align_safe_end:| are specifically -% designed for this purpose: test the token that follows in an |\halign| -% structure. +% environment |{WithArrows}|. The two commands |\group_align_safe_begin:| and +% |\group_align_safe_end:| are specifically designed for this purpose: test the +% token that follows in an |\halign| structure. % % First, we remove an eventual token |*| (just after the |\\|: there should not % be space between the two) since the commands |\\| and |\\*| are equivalent in @@ -4814,16 +4907,19 @@ version 2005/12/01 or later. %<*LaTeX> \cs_new_protected:Npn \@@_cr_ii: [ #1 ] { - \peek_meaning_ignore_spaces:NTF \end - { - \@@_cr_iii:n { #1 } + \peek_remove_spaces:n + { + \peek_meaning:NTF \end + { + \@@_cr_iii:n { #1 } % \end{macrocode} % The analyse of the argument of the token |\end| must be after the % |\group_align_safe_end:| which is the beginning of |\@@_cr_iii:n|. % \begin{macrocode} - \@@_analyze_end:Nn + \@@_analyze_end:Nn + } + { \@@_cr_iii:n { #1 } } } - { \@@_cr_iii:n { #1 } } } % \end{macrocode} % @@ -4892,7 +4988,8 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NT \c_@@_hyperref_loaded_bool { - \str_set:Nn \This@name { equation } + % the following line is probably useless (2022/05/16) + % \str_set:Nn \This@name { equation } \hyper@refstepcounter { equation } } % \end{macrocode} @@ -5345,7 +5442,7 @@ version 2005/12/01 or later. \hbox_to_wd:nn \l_@@_linewidth_dim { \bool_if:NTF \l_@@_fleqn_bool - { \skip_horizontal:N \l_@@_mathindent_dim } + { \skip_horizontal:N \l_@@_mathindent_skip } \hfil \hbox_to_wd:nn \g_@@_alignment_dim { @@ -5677,9 +5774,9 @@ version 2005/12/01 or later. % of arrows (equal to the initial line of the first arrow of the group because % the option |jump| is always positive). % -% |\l_@@_first_arrows_seq| will be the list the arrows of the group starting at -% the first line of the group (we may have several arrows starting from the same -% line). We have to know all these arrows because of the adjustement by +% |\l_@@_first_arrows_seq| will be the list of the arrows of the group starting +% at the first line of the group (we may have several arrows starting from the +% same line). We have to know all these arrows because of the adjustement by % |\l_@@_start_adjust_dim|. % % |\l_@@_last_line_of_group_int| will be the last line involved in the group @@ -5696,7 +5793,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip -% The boolean |\l_@@_new_group_bool| is a switch that we will use the indicate +% The boolean |\l_@@_new_group_bool| is a switch that we will use to indicate % that a group is finished (and the lines of that group have to be drawn). This % boolean is not directly connected to the option |new-group| of an individual % arrow. @@ -6168,6 +6265,29 @@ version 2005/12/01 or later. } } % \end{macrocode} +% The dimension |\l_@@_delta_x_dim| is the difference of abscissa between the +% right side of the alignment (|\halign|) and the left side of the arrow. +% \begin{macrocode} + \bool_if:NF \l_@@_right_overlap_bool + { + \bool_if:NT \l_@@_in_WithArrows_bool + { + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfpointanchor { wa - \l_@@_prefix_str - 1 - r } { south } + \int_compare:nNnTF \l_@@_pos_arrow_int < 5 + { + \dim_set:Nn \l_@@_delta_x_dim + { + \pgf@x - + ( \dim_min:nn \g_@@_x_initial_dim \g_@@_x_final_dim ) + } + } + { \dim_set:Nn \l_@@_delta_x_dim { \pgf@x - \l_@@_x_dim } } + \endpgfpicture + } + } +% \end{macrocode} % % \bigskip % Eventually, we can draw the arrow with the code in |\l_@@_tikz_code_tl|. We @@ -6218,19 +6338,35 @@ version 2005/12/01 or later. 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|. +% You keep track of the bounding box because we want to compute the total width +% of the arrow (with the label) for the arrows of type |over| and also for the +% actualization of |\g_@@_overlap_x_dim|. % \begin{macrocode} \pgf@relevantforpicturesizetrue #1 \dim_compare:nNnTF \pgf@picminx = { 16000 pt } - { \dim_zero:NN \l_tmpa_dim } + { \dim_zero:N \l_tmpa_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 +% \end{macrocode} +% Now, the actualization of |\g_@@_overlap_x_dim|. +% \begin{macrocode} + \bool_if:NF \l_@@_right_overlap_bool + { + \bool_if:NT \l_@@_in_WithArrows_bool + { + \dim_gset:Nn \g_@@_overlap_x_dim + { + \dim_max:nn + \g_@@_overlap_x_dim + { \l_tmpa_dim - \l_@@_delta_x_dim } + } + } + } \pgfresetboundingbox %<*LaTeX> \end{tikzpicture} @@ -6242,6 +6378,7 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \medskip % When we draw the arrow (with |\@@_draw_arrow:nnn|), we first create the % function |\@@_tmpa:nnn| and, then, we use the function |\@@_tmpa:nnn| : @@ -6473,7 +6610,7 @@ version 2005/12/01 or later. % \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 +% |\g_tmpa_dim|. We need a global dimension because we will have to exit a % |\pgfpicture|. % \begin{macrocode} \dim_gzero:N \g_tmpa_dim @@ -6798,7 +6935,6 @@ version 2005/12/01 or later. -- node (@@_label) {} ([xshift = \l_@@_xoffset_dim+5mm]\l_tmpb_tl-r.south) -- ([xshift = \l_@@_xoffset_dim]\l_tmpb_tl-r.south) ; - \pgfpointanchor { wa - \l_@@_prefix_str - @@_label } { west } \dim_set:Nn \l_tmpa_dim { 20 cm } \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; @@ -6839,7 +6975,7 @@ version 2005/12/01 or later. { \draw [ <- ] ( [xshift = \l_@@_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; - } ; + } % ; %<*LaTeX> \end{tikzpicture} % @@ -6853,6 +6989,14 @@ version 2005/12/01 or later. % \bigskip % \subsection{The error messages of the package} % +% \begin{macrocode} +\bool_if:NTF \c_@@_messages_for_Overleaf_bool + { \str_const:Nn \c_@@_available_keys_str { } } + { + \str_const:Nn \c_@@_available_keys_str + { For~a~list~of~the~available~keys,~type~H~. } + } +% \end{macrocode} % % \begin{macrocode} \str_new:N \l_witharrows_body_str @@ -6871,7 +7015,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new:Npn \@@_potential_body_ii: { - \str_if_empty:NTF \l_nicematrix_body_str + \str_if_empty:NTF \l_witharrows_body_str { No~further~help~available } { The~body~of~your~environment~was:\\ @@ -6891,6 +7035,7 @@ version 2005/12/01 or later. %<*LaTeX> \@@_msg_new:nn { amsmath~not~loaded } { + amsmath~not~loaded.\\ You~can't~use~the~option~'\l_keys_key_str'~because~the~ package~'amsmath'~has~not~been~loaded.\\ If~you~go~on,~this~option~will~be~ignored~in~the~rest~ @@ -6902,6 +7047,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Bad~value~for~replace~brace~by } { + Incorrect~value.\\ Bad~value~for~the~option~'\l_keys_key_str'.~The~value~must~begin~ with~an~extensible~left~delimiter.~The~possible~values~are:~., \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ @@ -6917,6 +7063,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { option~of~cr~negative } { + Bad~value.\\ The~argument~of~the~command~\token_to_str:N\\~ should~be~positive~in~the~row~\int_use:N \g_@@_line_int\ of~your~environment~\{\l_@@_type_env_str\}.\\ @@ -6927,7 +7074,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { omit~probably~used } { - There~is~a~problem.~Maybe~you~have~used~a~command~ + Strange~problem.\\ + Maybe~you~have~used~a~command~ \token_to_str:N\omit\ in~the~line~\int_use:N \g_@@_line_int\ (or~another~line)~of~your~environment~\{\l_@@_type_env_str\}.\\ You~can~go~on~but~you~may~have~others~errors. @@ -6938,6 +7086,7 @@ version 2005/12/01 or later. %<*LaTeX> \@@_msg_new:nnn { newline~at~the~end~of~env } { + Incorrect~end.\\ The~environments~of~witharrows~(\{WithArrows\}~and~ \{DispWithArrows\})~should~not~end~by~\token_to_str:N \\.\\ However,~you~can~go~on~for~this~time.~No~similar~error~will~be~ @@ -6951,6 +7100,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Invalid~option~format } { + Invalide~value.\\ The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ must~not~be~empty.\\ \c_@@_option_ignored_str @@ -6962,6 +7112,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { invalid~key~o } { + Invalid~use~of~a~key.\\ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~ 'group'~or~in~mode~'groups'.\\ \c_@@_option_ignored_str @@ -6973,6 +7124,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Value~for~a~key } { + Misuse~of~a~key.\\ The~key~'\l_keys_key_str'~should~be~used~without~value. \\ However,~you~can~go~on~for~this~time. \@@_potential_body_i: @@ -6983,12 +7135,13 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~in~Arrow } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~for~the~command~ \l_@@_string_Arrow_for_msg_str\ in~the~row~ \int_use:N \g_@@_line_int\ of~your~environment~ \{\l_@@_type_env_str\}. \l_tmpa_str \\ \c_@@_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c_@@_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -7000,9 +7153,10 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~WithArrows } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c_@@_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -7012,9 +7166,10 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~DispWithArrows } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c_@@_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -7025,10 +7180,11 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~WithArrowsOptions } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ \c_@@_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c_@@_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -7039,10 +7195,11 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~Arrow~in~code-after } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \Arrow\ in~code-after. \\ \c_@@_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c_@@_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -7054,6 +7211,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Too~much~columns~in~WithArrows } { + Too~much~columns.\\ Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N \l_@@_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ @@ -7068,6 +7226,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Too~much~columns~in~DispWithArrows } { + Too~much~columns.\\ Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N \l_@@_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ @@ -7081,6 +7240,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Negative~jump } { + Incorrect~value.\\ You~can't~use~a~negative~value~for~the~option~'jump'~of~command~ \l_@@_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g_@@_line_int\ @@ -7093,6 +7253,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { new-group~without~groups } { + Misuse~of~a~key.\\ You~can't~use~the~option~'new-group'~for~the~command~ \l_@@_string_Arrow_for_msg_str\ because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~ @@ -7106,8 +7267,9 @@ version 2005/12/01 or later. \@@_msg_new:nnn { Too~few~lines~for~an~arrow } { + Impossible~arrow.\\ Line~\l_@@_input_line_str\ - :~an~arrow~specifiead~in~the~row~\int_use:N \l_@@_initial_int\ + :~an~arrow~specified~in~the~row~\int_use:N \l_@@_initial_int\ of~your~environment~\{\l_@@_type_env_str\}~can't~be~drawn~ because~it~arrives~after~the~last~row~of~the~environment. \\ If~you~go~on,~this~arrow~will~be~ignored. @@ -7119,6 +7281,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { o~arrow~with~no~arrow~under } { + Problem~with~the~key~'o'.\\ 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. @@ -7128,6 +7291,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { WithArrows~outside~math~mode } { + You~are~outside~math~mode.\\ The~environment~\{\l_@@_type_env_str\}~should~be~used~only~in~math~mode~ like~the~environment~\{aligned\}~of~amsmath. \\ Nevertheless,~you~can~go~on. @@ -7139,6 +7303,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { DispWithArrows~in~math~mode } { + You~are~in~math~mode.\\ The~environment~\{\l_@@_type_env_str\}~should~be~used~only~outside~math~ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\ This~error~is~fatal. @@ -7150,6 +7315,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Incompatible~options~in~Arrow } { + Incompatible~options.\\ You~try~to~use~the~option~'\l_keys_key_str'~but~ this~option~is~incompatible~or~redundant~with~the~option~ '\l_@@_previous_key_str'~set~in~the~same~command~ @@ -7160,8 +7326,10 @@ version 2005/12/01 or later. % % % \begin{macrocode} -\@@_msg_new:nn { Incompatible~options } - { You~try~to~use~the~option~'\l_keys_key_str'~but~ +\@@_msg_new:nn { Incompatible~options a} + { + Incompatible~options. + You~try~to~use~the~option~'\l_keys_key_str'~but~ this~option~is~incompatible~or~redundant~with~the~option~ '\l_@@_previous_key_str'~set~in~the~same~command~ \bool_if:NT \l_@@_in_code_after_bool @@ -7176,8 +7344,10 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Arrow~not~in~last~column } { + Bad~use~of~\l_@@_string_Arrow_for_msg_str. You~should~use~the~command~\l_@@_string_Arrow_for_msg_str\ only~in~the~last~column~(column~\int_use:N\l_@@_nb_cols_int)~ + in~the~row~\int_use:N \g_@@_line_int\ of~your~environment~\{\l_@@_type_env_str\}.\\ However~you~can~go~on~for~this~time. \@@_potential_body_i: @@ -7188,6 +7358,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Wrong~line~in~Arrow } { + Wrong~line.\\ The~specification~of~line~'#1'~you~use~in~the~command~ \l_@@_string_Arrow_for_msg_str\ in~the~'code-after'~of~\{\l_@@_type_env_str\}~doesn't~exist. \\ @@ -7198,6 +7369,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Both~lines~are~equal } { + Both~lines~are~equal.\\ In~the~'code-after'~of~\{\l_@@_type_env_str\}~you~try~to~ draw~an~arrow~going~to~itself~from~the~line~'#1'.~This~is~not~possible. \\ \c_@@_option_ignored_str @@ -7207,6 +7379,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Wrong~line~specification~in~MultiArrow } { + Wrong~line~specification.\\ The~specification~of~line~'#1'~doesn't~exist. \\ If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow. } @@ -7215,6 +7388,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Too~small~specification~for~MultiArrow } { + Too~small~specification.\\ The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ is~too~small:~you~need~at~least~two~lines. \\ \c_@@_command_ignored_str @@ -7225,6 +7399,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Not~allowed~in~DispWithArrows } { + Forbidden~command.\\ The~command~\token_to_str:N #1 is~allowed~only~in~the~last~column~ (column~\int_use:N\l_@@_nb_cols_int)~of~\{\l_@@_type_env_str\}. \\ @@ -7235,6 +7410,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Not~allowed~in~WithArrows } { + Forbidden~command.\\ The~command~\token_to_str:N #1 is~not~allowed~in~\{\l_@@_type_env_str\}~ (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\ \c_@@_option_ignored_str @@ -7245,6 +7421,7 @@ version 2005/12/01 or later. %<*LaTeX> \@@_msg_new:nn { tag*~without~amsmath } { + amsmath~not~loaded.\\ We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~ (or~mathtools). \\ If~you~go~on,~the~command~\token_to_str:N\tag\ @@ -7255,6 +7432,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Multiple~tags } { + Multiple~tags.\\ You~can't~use~twice~the~command~\token_to_str:N\tag\ in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\ If~you~go~on,~the~tag~'#1'~will~be~used. @@ -7265,6 +7443,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Multiple~labels } { + Multiple~labels.\\ Normally,~we~can't~use~the~command~\token_to_str:N\label\ twice~in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\ However,~you~can~go~on.~ @@ -7278,6 +7457,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Multiple~labels~with~cleveref } { + Multiple~labels.\\ Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ twice~in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\ If~you~go~on,~you~may~have~undefined~references. @@ -7289,7 +7469,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Inexistent~v-node } { - There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ + There~is~a~problem.\\ + Maybe~you~have~put~a~command~\token_to_str:N\cr\ instead~of~a~command~\token_to_str:N\\~at~the~end~of~ the~row~\l_tmpa_int\ of~your~environment~\{\l_@@_type_env_str\}. \\ @@ -7306,6 +7487,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Option~xoffset~forbidden } { + Incorrect~key.\\ You~can't~use~the~option~'xoffset'~in~the~command~ \l_@@_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g_@@_line_int\ of~your~environment~\{\l_@@_type_env_str\}~ @@ -7321,6 +7503,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Duplicate~name } { + Duplicate~name.\\ The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ the~same~environment~name~twice.~You~can~go~on,~but,~ maybe,~you~will~have~incorrect~results. \\ @@ -7338,6 +7521,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Invalid~specification~for~MultiArrow } { + Invalid~specification.\\ The~specification~of~rows~for~\token_to_str:N\MultiArrow\ (i.e.~#1)~is~invalid. \\ \c_@@_command_ignored_str @@ -7360,37 +7544,79 @@ version 2005/12/01 or later. \keys_if_exist:nnTF { WithArrows / Global } { #1 } { \@@_error:nn { Key~already~defined } { #1 } } { - \keys_define:nn { WithArrows / Global } - { - #1 .code:n = - { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } } - } - \seq_put_right:Nx \l_@@_options_WithArrows_seq { \tl_to_str:n { #1 } } - \seq_put_right:Nx \l_@@_options_DispWithArrows_seq - { \tl_to_str:n { #1 } } - \seq_put_right:Nx \l_@@_options_WithArrowsOptions_seq - { \tl_to_str:N { #1 } } % \end{macrocode} -% We now set the options in a TeX group in order to detect if some keys in |#2| -% are unknown. If a key is unknown, an error will be raised. However, the key -% will, even so, be stored in the definition of key~|#1|. +% First, we detect whether there is unknown keys in |#2| by storing in +% |\l_tmpa_seq| the list of the unknown keys. % \begin{macrocode} - \group_begin: - \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } - { - The~key~'\l_keys_key_str'~can't~be~set~in~the~ - definition~of~a~style.~You~can~go~on~for~this~time~ - but~you~should~suppress~this~key. - } - \WithArrowsOptions { #2 } - \group_end: + \seq_clear:N \l_tmpa_seq + \keyval_parse:NNn \@@_valid_key:n \@@_valid_key:nn { #2 } + \seq_if_empty:NTF \l_tmpa_seq + { + \seq_put_right:Nx \l_@@_options_WithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l_@@_options_DispWithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l_@@_options_WithArrowsOptions_seq + { \tl_to_str:N { #1 } } +% \end{macrocode} +% When we will consider that |\keys_precompile:nnN| (introduced in LaTeX on +% 2022-03-09) is widely available, we will delete that test and keep only the +% first version. +% \begin{macrocode} + \cs_if_exist:NTF \keys_precompile:nnN + { + \keys_precompile:nnN + { WithArrows / WithArrowsOptions } + { #2 } + \l_tmpa_tl + \@@_key_define:nV { #1 } \l_tmpa_tl + } + { + \keys_define:nn { WithArrows / Global } + { + #1 .code:n = + { \keys_set:nn { WithArrows / WithArrowsOptions } { #2 } } + } + } + } + { \@@_error:nn { Impossible~style } { #1 } } } } % \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { Impossible~style } + { + Impossible~style.\\ + It's~impossible~to~define~the~style~'#1'~ + because~it~contains~unknown~keys:~' + \seq_use:Nnnn \l_tmpa_seq { '~and~' } { ',~'} { ',~and~}'. + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_valid_key:n #1 + { + \keys_if_exist:nnF { WithArrows / Global } { #1 } + { \seq_put_right:Nn \l_tmpa_seq { #1 } } + } +\cs_new_protected:Npn \@@_valid_key:nn #1 #2 + { + \keys_if_exist:nnF { WithArrows / Global } { #1 } + { \seq_put_right:Nn \l_tmpa_seq { #1 } } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_key_define:nn #1 #2 + { \keys_define:nn { WithArrows / Global } { #1 .code:n = #2 } } +\cs_generate_variant:Nn \@@_key_define:nn { n V } +% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { Key~already~defined } { + Key~already~define.\\ The~key~'#1'~is~already~defined. \\ If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored. @@ -7442,6 +7668,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Option~unknown~for~up-and-down } { + Unknown~option.\\ The~option~'\l_keys_key_str'~is~unknown.~\c_@@_option_ignored_str } % \end{macrocode} @@ -7572,7 +7799,7 @@ version 2005/12/01 or later. % % % \bigskip -% The code for a arrow of type |down| is similar to the previous code (for an +% The code for an arrow of type |down| is similar to the previous code (for an % arrow of type |up|). % \begin{macrocode} %<*LaTeX> @@ -7686,7 +7913,7 @@ version 2005/12/01 or later. % % \bigskip % The options are scanned a second time when the arrow is actually drawn. That's -% the secon pass. +% the second pass. % \begin{macrocode} \keys_define:nn { WithArrows / Arrow / SecondPass } { @@ -7737,6 +7964,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { calc~not~loaded } { + calc~not~loaded.\\ You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~ Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'~ ~in~the~preamble~of~your~document. \\ @@ -7753,117 +7981,98 @@ version 2005/12/01 or later. % \end{macrocode} % % \section{History} -% -% \subsection*{Changes between versions 1.0 and 1.1} % -% Option for the command |\\| and option |interline| -% -% Compatibility with |\usetikzlibrary{babel}| +% \subsection*{Changes between 2.7 and 2.8} % -% Possibility of nested environments |{WithArrows}| -% +% New key |right-overlap| % -% \subsection*{Changes between versions 1.1 and 1.2} +% \subsection*{Changes between 2.6b and 2.7} % -% The package \pkg{witharrows} can now be loaded without having loaded -% previously \pkg{tikz} and the libraries |arrow.meta| and |bending| (this -% extension and these libraries are loaded silently by \pkg{witharrows}). +% Correction of a bug: when the key |wrap-lines| was in force, the content of +% the annotations was not ``flush left'' by default as it should be (but justified). % -% New option |groups| (with a \emph{s}) % -% -% \subsection*{Changes between versions 1.2 and 1.3} -% -% New options |ygap| and |ystart| for fine tuning. +% \subsection*{Changes between 2.6 and 2.6a (and 2.6b)} % -% \subsection*{Changes between versions 1.3 and 1.4} -% -% The package \pkg{footnote} is no longer loaded by default. Instead, two -% options |footnote| and |footnotehyper| have been added. In particular, -% \pkg{witharrows} becomes compatible with \cls{beamer}. -% -% \subsection*{Changes between versions 1.4 and 1.5} -% -% The Tikz code used to draw the arrows can be changed with the option -% |tikz-code|. +% Replacement of |\hbox_unpack_clear:N| by |\hbox_unpack_drop:N| since +% |\hbox_unpack_clear:N| is now deprecated in L3. % -% Two new options |code-before| and |code-after| have been added at the -% environment level. +% Version 2.6d: correction of a bug (cf. question 628461 on TeX StackExchange). % -% A special version of |\Arrow| is available in |code-after| in order to draw -% arrows in nested environments. -% -% A command |\MultiArrow| is available in |code-after| to draw arrows of other -% shapes. -% -% \subsection*{Changes between versions 1.5 and 1.6} +% \subsection*{Changes between 2.5 and 2.5.1} % -% The code has been improved to be faster and the Tikz library |calc| is no -% longer required. +% Correction of the erroneous programmation of the nodes aliases. % -% A new option |name| is available for the environments |{WithArrows}|. % -% \subsection*{Changes between 1.6 and 1.7} +% \subsection*{Changes between 2.4 and 2.5} % -% New environments |{DispWithArrows}| and |{DispWithArrows*}|. +% Arrows of type |o| which are \emph{over} other arrows. % -% \subsection*{Changes between 1.7 and 1.8} +% \pkg{witharrows} now requires and loads \pkg{varwidth} % -% The numbers and tags of the environment |{DispWithArrows}| are now compatible -% with all the major LaTeX packages concerning references (\pkg{autonum}, -% \pkg{cleveref}, \pkg{fancyref}, \pkg{hyperref}, \pkg{prettyref}, -% \pkg{refstyle}, \pkg{typedref} and \pkg{varioref}) and with the options -% |showonlyrefs| and |showmanualtags| of \pkg{mathtools}. +% \subsection*{Changes between 2.3 and 2.4} +% +% Correction of a bug with |{DispWithArrows}| : cf. question 535989 on |TeX StackExchange|. % -% \subsection*{Changes between 1.8 and 1.9} +% \subsection*{Changes between 2.2 and 2.3} % -% New option |wrap-lines| for the environments |{DispWithArrows}| and -% |{DispWithArrows*}|. +% Two options for the arrows of type |up| and |down|: |width| and |radius|. % -% \subsection*{Changes between 1.9 and 1.10} +% \subsection*{Changes between 2.1 and 2.2} % -% If the option |wrap-lines| is used, the option ``|text width|'' of Tikz is -% still active: if the value given to ``|text width|'' is lower than the width -% computed by |wrap-lines|, this value is used to wrap the lines. +% Addition of |\normalbaselines| at the beginning of |\@@_post_halign:|. % -% The option |wrap-lines| is now fully compatible with the class option |leqno|. +% The warning for an environment ending by |\\| has been transformed in |error|. % -% Correction of a bug: |\nointerlineskip| and |\makebox[.6\linewidth]{}| should -% be inserted in |{DispWithArrows}| only in vertical mode. +% \subsection*{Changes between 2.0 and 2.1} +% +% Option |max-length-of-arrow|. +% +% Validation with regular expression for the first argument of |\MultiArrow|. % -% \subsection*{Changes between 1.10 and 1.11} +% \subsection*{Changes between 1.18 and 2.0} +% +% A version of \pkg{witharrows} is available for plain-TeX. +% +% \subsection*{Changes between 1.17 and 1.18} % -% New commands |\WithArrowsNewStyle| and |\WithArrowsRightX|. +% New option |<...>| for |{DispWithArrows}|. % -% \subsection*{Changes between 1.11 and 1.12} +% Option |subequations|. % -% New command |\tagnextline|. +% Warning when |{WithArrows}| or |{DispWithArrows}| ends by "\\". +% +% No space before an environment |{DispWithArrows}| if we are at the beginning +% of a |{minipage}|. % -% New option |tagged-lines|. +% \subsection*{Changes between 1.16 and 1.17} +% +% Option |format|. % -% An option of position (|ll|, |lr|, |rl|, |rr| or |i|) is now allowed at the -% local level even if the option |group| or the option |groups| is used at the -% global or environment level. +% \subsection*{Changes between 1.15 and 1.16} % -% Compatibility of |{DispWithArrows}| with |\qedhere| of \pkg{amsthm}. +% Option |no-arrows| % -% Compatibility with the packages \pkg{refcheck}, \pkg{showlabels} and -% \pkg{listlbls}. +% The behaviour of |{DispWithArrows}| after an |\item| of a LaTeX list has been +% changed : no vertical is added. The previous behaviour can be restored with +% the option |standard-behaviour-with-items|. +% +% A given name can no longer be used for two distinct environments. However, +% it's possible to deactivate this control with the option +% |allow-duplicate-names|. +% % -% The option |\AllowLineWithoutAmpersand| is deprecated because lines without -% ampersands are now always allowed. +% \subsection*{Changes between 1.14 and 1.15} % -% \subsection*{Changes between 1.12 and 1.13} +% Option |new-group| to start a new group of arrows (only available when the +% environment is composed with the option |groups|). +% +% Tikz externalization is now deactivated in the environments of the +% extension \pkg{witharrows}.\footnote{Before this version, there was an error +% when using \pkg{witharrows} with Tikz externalization. In any case, it's not +% possible to externalize the Tikz elements constructed by \pkg{witharrows} +% because they use the options |overlay| and |remember picture|.} % -% Options |start-adjust|, |end-adjust| and |adjust|. -% -% This version is not stricty compatible with previous ones. To restore the -% behaviour of the previous versions, one has to use the option |adjust| with -% the value $0$~pt: -% -% \begin{Verbatim} -% \WithArrowsOptions{adjust = 0pt} -% \end{Verbatim} % % \subsection*{Changes between 1.13 and 1.14} % @@ -7885,99 +8094,116 @@ version 2005/12/01 or later. % The error |Option incompatible with 'group(s)'| was suppressed in the version % 1.12 but this was a mistake since this error is used with the option |xoffset| % at the local level. The error is put back. +% +% \subsection*{Changes between 1.12 and 1.13} +% +% Options |start-adjust|, |end-adjust| and |adjust|. % -% \subsection*{Changes between 1.14 and 1.15} +% This version is not stricty compatible with previous ones. To restore the +% behaviour of the previous versions, one has to use the option |adjust| with +% the value $0$~pt: +% +% \begin{Verbatim} +% \WithArrowsOptions{adjust = 0pt} +% \end{Verbatim} % -% Option |new-group| to start a new group of arrows (only available when the -% environment is composed with the option |groups|). +% \subsection*{Changes between 1.11 and 1.12} % -% Tikz externalization is now deactivated in the environments of the -% extension \pkg{witharrows}.\footnote{Before this version, there was an error -% when using \pkg{witharrows} with Tikz externalization. In any case, it's not -% possible to externalize the Tikz elements constructed by \pkg{witharrows} -% because they use the options |overlay| and |remember picture|.} +% New command |\tagnextline|. % -% \subsection*{Changes between 1.15 and 1.16} +% New option |tagged-lines|. % -% Option |no-arrows| +% An option of position (|ll|, |lr|, |rl|, |rr| or |i|) is now allowed at the +% local level even if the option |group| or the option |groups| is used at the +% global or environment level. % -% The behaviour of |{DispWithArrows}| after an |\item| of a LaTeX list has been -% changed : no vertical is added. The previous behaviour can be restored with -% the option |standard-behaviour-with-items|. -% -% A given name can no longer be used for two distinct environments. However, -% it's possible to deactivate this control with the option -% |allow-duplicate-names|. -% +% Compatibility of |{DispWithArrows}| with |\qedhere| of \pkg{amsthm}. % -% \subsection*{Changes between 1.16 and 1.17} -% -% Option |format|. +% Compatibility with the packages \pkg{refcheck}, \pkg{showlabels} and +% \pkg{listlbls}. % -% \subsection*{Changes between 1.17 and 1.18} +% The option |\AllowLineWithoutAmpersand| is deprecated because lines without +% ampersands are now always allowed. % -% New option |<...>| for |{DispWithArrows}|. +% \subsection*{Changes between 1.10 and 1.11} % -% Option |subequations|. +% New commands |\WithArrowsNewStyle| and |\WithArrowsRightX|. % -% Warning when |{WithArrows}| or |{DispWithArrows}| ends by "\\". -% -% No space before an environment |{DispWithArrows}| if we are at the beginning -% of a |{minipage}|. +% \subsection*{Changes between 1.9 and 1.10} % -% \subsection*{Changes between 1.18 and 2.0} -% -% A version of \pkg{witharrows} is available for plain-TeX. -% +% If the option |wrap-lines| is used, the option ``|text width|'' of Tikz is +% still active: if the value given to ``|text width|'' is lower than the width +% computed by |wrap-lines|, this value is used to wrap the lines. % -% \subsection*{Changes between 2.0 and 2.1} -% -% Option |max-length-of-arrow|. +% The option |wrap-lines| is now fully compatible with the class option |leqno|. +% +% Correction of a bug: |\nointerlineskip| and |\makebox[.6\linewidth]{}| should +% be inserted in |{DispWithArrows}| only in vertical mode. +% +% \subsection*{Changes between 1.8 and 1.9} % -% Validation with regular expression for the first argument of |\MultiArrow|. +% New option |wrap-lines| for the environments |{DispWithArrows}| and +% |{DispWithArrows*}|. % -% \subsection*{Changes between 2.1 and 2.2} +% \subsection*{Changes between 1.7 and 1.8} % -% Addition of |\normalbaselines| at the beginning of |\@@_post_halign:|. +% The numbers and tags of the environment |{DispWithArrows}| are now compatible +% with all the major LaTeX packages concerning references (\pkg{autonum}, +% \pkg{cleveref}, \pkg{fancyref}, \pkg{hyperref}, \pkg{prettyref}, +% \pkg{refstyle}, \pkg{typedref} and \pkg{varioref}) and with the options +% |showonlyrefs| and |showmanualtags| of \pkg{mathtools}. % -% The warning for an environment ending by |\\| has been transformed in |error|. +% \subsection*{Changes between 1.6 and 1.7} % -% \subsection*{Changes between 2.2 and 2.3} -% -% Two options for the arrows of type |up| and |down|: |width| and |radius|. +% New environments |{DispWithArrows}| and |{DispWithArrows*}|. % -% \subsection*{Changes between 2.3 and 2.4} +% \subsection*{Changes between versions 1.5 and 1.6} % -% Correction of a bug with |{DispWithArrows}| : cf. question 535989 on |TeX StackExchange|. +% The code has been improved to be faster and the Tikz library |calc| is no +% longer required. % -% \subsection*{Changes between 2.4 and 2.5} +% A new option |name| is available for the environments |{WithArrows}|. % -% Arrows of type |o| which are \emph{over} other arrows. +% \subsection*{Changes between versions 1.4 and 1.5} +% +% The Tikz code used to draw the arrows can be changed with the option +% |tikz-code|. % -% \pkg{witharrows} now requires and loads \pkg{varwidth} +% Two new options |code-before| and |code-after| have been added at the +% environment level. % -% \subsection*{Changes between 2.5 and 2.5.1} +% A special version of |\Arrow| is available in |code-after| in order to draw +% arrows in nested environments. % -% Correction of the erroneous programmation of the nodes aliases. -% -% \subsection*{Changes between 2.5.1 and 2.6} +% A command |\MultiArrow| is available in |code-after| to draw arrows of other +% shapes. % -% The key |format| now supports the letters |R|, |C| and |L|. +% \subsection*{Changes between versions 1.3 and 1.4} % +% The package \pkg{footnote} is no longer loaded by default. Instead, two +% options |footnote| and |footnotehyper| have been added. In particular, +% \pkg{witharrows} becomes compatible with \cls{beamer}. % -% \subsection*{Changes between 2.6 and 2.6a (and 2.6b)} +% \subsection*{Changes between versions 1.2 and 1.3} +% +% New options |ygap| and |ystart| for fine tuning. % -% Replacement of |\hbox_unpack_clear:N| by |\hbox_unpack_drop:N| since -% |\hbox_unpack_clear:N| is now deprecated in \pkg{expl3}. +% \subsection*{Changes between versions 1.1 and 1.2} % -% Version 2.6d: correction of a bug (cf. question 628461 on TeX StackExchange). +% The package \pkg{witharrows} can now be loaded without having loaded +% previously \pkg{tikz} and the libraries |arrow.meta| and |bending| (this +% extension and these libraries are loaded silently by \pkg{witharrows}). % -% \subsection*{Changes between 2.6b and 2.7} +% New option |groups| (with a \emph{s}) % -% Correction of a bug: when the key |wrap-lines| was in force, the content of -% the annotations was not ``flush left'' by default as it should be (but justified). +% \subsection*{Changes between versions 1.0 and 1.1} +% +% Option for the command |\\| and option |interline| +% +% Compatibility with |\usetikzlibrary{babel}| % -% \PrintIndex +% Possibility of nested environments |{WithArrows}| +% % % \tableofcontents % diff --git a/Master/texmf-dist/source/generic/witharrows/witharrows.ins b/Master/texmf-dist/source/generic/witharrows/witharrows.ins index d101deff19c..5a65f4914c8 100644 --- a/Master/texmf-dist/source/generic/witharrows/witharrows.ins +++ b/Master/texmf-dist/source/generic/witharrows/witharrows.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2017-2022 by F. Pantigny +%% Copyright (C) 2017-2023 by F. Pantigny %% %% %% This file may be distributed and/or modified under the @@ -17,7 +17,7 @@ \usedir{tex/latex/witharrows} \preamble -Copyright (C) 2017-2022 by F. Pantigny +Copyright (C) 2017-2023 by F. Pantigny This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either diff --git a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty index 54a29d97d40..f4a208a7f1c 100644 --- a/Master/texmf-dist/tex/generic/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/generic/witharrows/witharrows.sty @@ -6,7 +6,7 @@ %% %% witharrows.dtx (with options: `LaTeX') %% -%% Copyright (C) 2017-2022 by F. Pantigny +%% Copyright (C) 2017-2023 by F. Pantigny %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -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.7} -\def\myfiledate{2022/04/20} +\def\myfileversion{2.8} +\def\myfiledate{2023/01/01} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} \RequirePackage{l3keys2e} @@ -28,20 +28,16 @@ {\myfiledate} {\myfileversion} {Draws arrows for explanations on the right} -\msg_new:nnn { witharrows } { expl3~too~old } - { - Your~version~of~LaTeX~(especially~expl3)~is~too~old.~ - You~can~go~on~but~you~will~probably~have~other~errors~ - if~you~use~the~functionalities~of~witharrows. - } -\cs_if_exist:NF \seq_set_map_x:NNn - { \msg_error:nn { witharrows } { expl3~too~old } } -\RequirePackage { xparse } \RequirePackage { varwidth } \bool_new:N \c__witharrows_footnotehyper_bool \bool_new:N \c__witharrows_footnote_bool \cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } } -\cs_new_protected:Npn \__witharrows_msg_new:nnn { \msg_new:nnnn { witharrows } } +\cs_new_protected:Npn \__witharrows_msg_new:nnn #1 #2 #3 + { + \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool + { \msg_new:nnn { witharrows } { #1 } { #2 \\ #3 } } + { \msg_new:nnnn { witharrows } { #1 } { #2 } { #3 } } + } \cs_new_protected:Npn \__witharrows_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } \cs_new_protected:Npn \__witharrows_error:n { \msg_error:nn { witharrows } } @@ -49,6 +45,13 @@ \cs_new_protected:Npn \__witharrows_fatal:n { \msg_fatal:nn { witharrows } } \cs_new_protected:Npn \__witharrows_error:nn { \msg_error:nnn { witharrows } } \cs_generate_variant:Nn \__witharrows_error:nn { n x } +\cs_new_protected:Npn \__witharrows_error_or_warning:n + { \bool_if:NTF \c__witharrows_messages_for_Overleaf_bool \__witharrows_warning:n \__witharrows_error:n } +\bool_set:Nn \c__witharrows_messages_for_Overleaf_bool + { + \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs + || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf + } \keys_define:nn { WithArrows / package } { footnote .bool_set:N = \c__witharrows_footnote_bool , @@ -65,6 +68,7 @@ \ProcessKeysOptions { WithArrows / package } \__witharrows_msg_new:nn { footnote~with~footnotehyper~package } { + Footnote~forbidden.\\ You~can't~use~the~option~'footnote'~because~the~package~ footnotehyper~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ @@ -269,6 +273,8 @@ \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 } +\bool_new:N \l__witharrows_right_overlap_bool +\bool_set_true:N \l__witharrows_right_overlap_bool \cs_new_protected:Npn \__witharrows_eval_if_allowed:n #1 { \str_if_empty:NTF \l__witharrows_previous_key_str @@ -299,7 +305,7 @@ \str_set:Nx \l__witharrows_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__witharrows_tikz_code_tl, + tikz-code .tl_set:N = \l__witharrows_tikz_code_tl , tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , tikz-code .value_required:n = true , displaystyle .bool_set:N = \l__witharrows_displaystyle_bool , @@ -369,7 +375,9 @@ c .code:n = \int_set:Nn \l__witharrows_pos_env_int 1 , c .value_forbidden:n = true , b .code:n = \int_set:Nn \l__witharrows_pos_env_int 2 , - b .value_forbidden:n = true + b .value_forbidden:n = true , + right-overlap .bool_set:N = \l__witharrows_right_overlap_bool , + right-overlap .value_required:n = true } \clist_new:N \c__witharrows_extensible_delimiters_clist \clist_set:Nn \c__witharrows_extensible_delimiters_clist @@ -389,7 +397,7 @@ { fleqn .bool_set:N = \l__witharrows_fleqn_bool , fleqn .default:n = true , - mathindent .dim_set:N = \l__witharrows_mathindent_dim , + mathindent .skip_set:N = \l__witharrows_mathindent_skip , mathindent .initial:n = 25 pt , mathindent .value_required:n = true , notag .code:n = @@ -489,7 +497,7 @@ \__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrows_seq { adjust, b, c, code-after, code-before, command-name, - displaystyle, end-adjust, + right-overlap, displaystyle, end-adjust, format, group, groups, i, interline, jot, ll, lr, max-length-of-arrow, more-columns, name, @@ -535,7 +543,8 @@ \seq_new:N \l__witharrows_options_WithArrowsOptions_seq \__witharrows_set_seq_of_str_from_clist:Nn \l__witharrows_options_WithArrowsOptions_seq { - allow-duplicate-names, b, c, command-name, more-columns, tikz-code, adjust, + allow-duplicate-names, b, c, command-name, right_overlap, + more-columns, tikz-code, adjust, 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, @@ -724,6 +733,14 @@ { \keys_set:nn { WithArrows / WithArrows } { #1 } } \bool_if:NT \l__witharrows_in_DispWithArrows_bool { \keys_set:nn { WithArrows / DispWithArrows } { #1 } } + \bool_if:NF \l__witharrows_right_overlap_bool + { + \bool_if:NT \l__witharrows_in_WithArrows_bool + { + \dim_gzero_new:N \g__witharrows_overlap_x_dim + \dim_zero_new:N \l__witharrows_delta_x_dim + } + } \cs_set_eq:cN \l__witharrows_command_name_str \__witharrows_Arrow_first_columns: \int_set:Nn \l__witharrows_nb_cols_int { \str_count:N \l__witharrows_format_str } \int_gset_eq:NN \g__witharrows_col_int \l__witharrows_nb_cols_int @@ -791,7 +808,7 @@ \halign to \l__witharrows_linewidth_dim \bgroup \bool_if:NT \l__witharrows_fleqn_bool - { \skip_horizontal:N \l__witharrows_mathindent_dim } + { \skip_horizontal:N \l__witharrows_mathindent_skip } } \int_gincr:N \g__witharrows_line_int \int_gzero:N \g__witharrows_col_int @@ -847,6 +864,9 @@ \if_mode_math: \else: \__witharrows_error:n { WithArrows~outside~math~mode } \fi: + \box_clear_new:N \l__witharrows_env_box + \hbox_set:Nw \l__witharrows_env_box + \int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token \int_case:nn \l__witharrows_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox } \bgroup \spread@equation @@ -863,7 +883,15 @@ \\ \egroup \egroup + \int_compare:nNnT \l__witharrows_pos_env_int = 1 \c_math_toggle_token + \hbox_set_end: \__witharrows_post_halign: + \bool_if:NF \l__witharrows_right_overlap_bool + { + \box_set_wd:Nn \l__witharrows_env_box + { \g__witharrows_overlap_x_dim + \box_wd:N \l__witharrows_env_box } + } + \box_use_drop:N \l__witharrows_env_box \bool_if:NT \c__witharrows_footnote_bool { \end { savenotes } } } \cs_new_protected:Npn \__witharrows_post_halign: @@ -915,12 +943,15 @@ { \peek_meaning:NTF [ \__witharrows_cr_ii: { \__witharrows_cr_ii: [ \c_zero_dim ] } } \cs_new_protected:Npn \__witharrows_cr_ii: [ #1 ] { - \peek_meaning_ignore_spaces:NTF \end + \peek_remove_spaces:n { - \__witharrows_cr_iii:n { #1 } - \__witharrows_analyze_end:Nn + \peek_meaning:NTF \end + { + \__witharrows_cr_iii:n { #1 } + \__witharrows_analyze_end:Nn + } + { \__witharrows_cr_iii:n { #1 } } } - { \__witharrows_cr_iii:n { #1 } } } \cs_new_protected:Npn \__witharrows_cr_iii:n #1 { @@ -937,7 +968,8 @@ \cs_set:Npx \@currentlabel { \p@equation \g_tmpa_tl } \bool_if:NT \c__witharrows_hyperref_loaded_bool { - \str_set:Nn \This@name { equation } + % the following line is probably useless (2022/05/16) + % \str_set:Nn \This@name { equation } \hyper@refstepcounter { equation } } \bool_if:NT \c__witharrows_cleveref_loaded_bool @@ -1146,7 +1178,7 @@ \hbox_to_wd:nn \l__witharrows_linewidth_dim { \bool_if:NTF \l__witharrows_fleqn_bool - { \skip_horizontal:N \l__witharrows_mathindent_dim } + { \skip_horizontal:N \l__witharrows_mathindent_skip } \hfil \hbox_to_wd:nn \g__witharrows_alignment_dim { @@ -1545,6 +1577,25 @@ { \dim_use:N \g__witharrows_y_final_dim } } } + \bool_if:NF \l__witharrows_right_overlap_bool + { + \bool_if:NT \l__witharrows_in_WithArrows_bool + { + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfpointanchor { wa - \l__witharrows_prefix_str - 1 - r } { south } + \int_compare:nNnTF \l__witharrows_pos_arrow_int < 5 + { + \dim_set:Nn \l__witharrows_delta_x_dim + { + \pgf@x - + ( \dim_min:nn \g__witharrows_x_initial_dim \g__witharrows_x_final_dim ) + } + } + { \dim_set:Nn \l__witharrows_delta_x_dim { \pgf@x - \l__witharrows_x_dim } } + \endpgfpicture + } + } \__witharrows_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl \group_end: } @@ -1560,13 +1611,25 @@ \pgf@relevantforpicturesizetrue #1 \dim_compare:nNnTF \pgf@picminx = { 16000 pt } - { \dim_zero:NN \l_tmpa_dim } + { \dim_zero:N \l_tmpa_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 + \bool_if:NF \l__witharrows_right_overlap_bool + { + \bool_if:NT \l__witharrows_in_WithArrows_bool + { + \dim_gset:Nn \g__witharrows_overlap_x_dim + { + \dim_max:nn + \g__witharrows_overlap_x_dim + { \l_tmpa_dim - \l__witharrows_delta_x_dim } + } + } + } \pgfresetboundingbox \end{tikzpicture} } @@ -1852,7 +1915,6 @@ -- node (__witharrows_label) {} ([xshift = \l__witharrows_xoffset_dim+5mm]\l_tmpb_tl-r.south) -- ([xshift = \l__witharrows_xoffset_dim]\l_tmpb_tl-r.south) ; - \pgfpointanchor { wa - \l__witharrows_prefix_str - __witharrows_label } { west } \dim_set:Nn \l_tmpa_dim { 20 cm } \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ; @@ -1880,9 +1942,15 @@ { \draw [ <- ] ( [xshift = \l__witharrows_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; - } ; + } % ; \end{tikzpicture} } +\bool_if:NTF \c__witharrows_messages_for_Overleaf_bool + { \str_const:Nn \c__witharrows_available_keys_str { } } + { + \str_const:Nn \c__witharrows_available_keys_str + { For~a~list~of~the~available~keys,~type~H~. } + } \str_new:N \l_witharrows_body_str \cs_new:Npn \__witharrows_potential_body_i: { @@ -1891,7 +1959,7 @@ } \cs_new:Npn \__witharrows_potential_body_ii: { - \str_if_empty:NTF \l_nicematrix_body_str + \str_if_empty:NTF \l_witharrows_body_str { No~further~help~available } { The~body~of~your~environment~was:\\ @@ -1904,6 +1972,7 @@ { If~you~go~on,~this~command~will~be~ignored. } \__witharrows_msg_new:nn { amsmath~not~loaded } { + amsmath~not~loaded.\\ You~can't~use~the~option~'\l_keys_key_str'~because~the~ package~'amsmath'~has~not~been~loaded.\\ If~you~go~on,~this~option~will~be~ignored~in~the~rest~ @@ -1911,6 +1980,7 @@ } \__witharrows_msg_new:nn { Bad~value~for~replace~brace~by } { + Incorrect~value.\\ Bad~value~for~the~option~'\l_keys_key_str'.~The~value~must~begin~ with~an~extensible~left~delimiter.~The~possible~values~are:~., \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ @@ -1923,6 +1993,7 @@ } \__witharrows_msg_new:nn { option~of~cr~negative } { + Bad~value.\\ The~argument~of~the~command~\token_to_str:N\\~ should~be~positive~in~the~row~\int_use:N \g__witharrows_line_int\ of~your~environment~\{\l__witharrows_type_env_str\}.\\ @@ -1930,13 +2001,15 @@ } \__witharrows_msg_new:nn { omit~probably~used } { - There~is~a~problem.~Maybe~you~have~used~a~command~ + Strange~problem.\\ + Maybe~you~have~used~a~command~ \token_to_str:N\omit\ in~the~line~\int_use:N \g__witharrows_line_int\ (or~another~line)~of~your~environment~\{\l__witharrows_type_env_str\}.\\ You~can~go~on~but~you~may~have~others~errors. } \__witharrows_msg_new:nnn { newline~at~the~end~of~env } { + Incorrect~end.\\ The~environments~of~witharrows~(\{WithArrows\}~and~ \{DispWithArrows\})~should~not~end~by~\token_to_str:N \\.\\ However,~you~can~go~on~for~this~time.~No~similar~error~will~be~ @@ -1946,6 +2019,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Invalid~option~format } { + Invalide~value.\\ The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ must~not~be~empty.\\ \c__witharrows_option_ignored_str @@ -1954,6 +2028,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { invalid~key~o } { + Invalid~use~of~a~key.\\ The~key~'o'~for~individual~arrows~can~be~used~only~in~mode~ 'group'~or~in~mode~'groups'.\\ \c__witharrows_option_ignored_str @@ -1962,6 +2037,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Value~for~a~key } { + Misuse~of~a~key.\\ The~key~'\l_keys_key_str'~should~be~used~without~value. \\ However,~you~can~go~on~for~this~time. \__witharrows_potential_body_i: @@ -1969,12 +2045,13 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Unknown~option~in~Arrow } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~for~the~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~row~ \int_use:N \g__witharrows_line_int\ of~your~environment~ \{\l__witharrows_type_env_str\}. \l_tmpa_str \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1982,9 +2059,10 @@ } \__witharrows_msg_new:nnn { Unknown~option~WithArrows } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -1992,9 +2070,10 @@ } \__witharrows_msg_new:nnn { Unknown~option~DispWithArrows } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~\{\l__witharrows_type_env_str\}. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -2002,10 +2081,11 @@ } \__witharrows_msg_new:nnn { Unknown~option~WithArrowsOptions } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -2013,10 +2093,11 @@ } \__witharrows_msg_new:nnn { Unknown~option~Arrow~in~code-after } { + Unknown~option.\\ The~key~'\l_keys_key_str'~is~unknown~in~ \token_to_str:N \Arrow\ in~code-after. \\ \c__witharrows_option_ignored_str \\ - For~a~list~of~the~available~keys,~type~H~. + \c__witharrows_available_keys_str } { The~available~keys~are~(in~alphabetic~order):~ @@ -2024,6 +2105,7 @@ } \__witharrows_msg_new:nnn { Too~much~columns~in~WithArrows } { + Too~much~columns.\\ Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N \l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ @@ -2035,6 +2117,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { Too~much~columns~in~DispWithArrows } { + Too~much~columns.\\ Your~environment~\{\l__witharrows_type_env_str\}~has~\int_use:N \l__witharrows_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ @@ -2045,6 +2128,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { Negative~jump } { + Incorrect~value.\\ You~can't~use~a~negative~value~for~the~option~'jump'~of~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__witharrows_line_int\ @@ -2054,6 +2138,7 @@ } \__witharrows_msg_new:nn { new-group~without~groups } { + Misuse~of~a~key.\\ You~can't~use~the~option~'new-group'~for~the~command~ \l__witharrows_string_Arrow_for_msg_str\ because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~ @@ -2063,8 +2148,9 @@ \__witharrows_msg_new:nnn { Too~few~lines~for~an~arrow } { + Impossible~arrow.\\ Line~\l__witharrows_input_line_str\ - :~an~arrow~specifiead~in~the~row~\int_use:N \l__witharrows_initial_int\ + :~an~arrow~specified~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. @@ -2073,12 +2159,14 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { o~arrow~with~no~arrow~under } { + Problem~with~the~key~'o'.\\ 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:nnn { WithArrows~outside~math~mode } { + You~are~outside~math~mode.\\ The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~in~math~mode~ like~the~environment~\{aligned\}~of~amsmath. \\ Nevertheless,~you~can~go~on. @@ -2087,6 +2175,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nnn { DispWithArrows~in~math~mode } { + You~are~in~math~mode.\\ The~environment~\{\l__witharrows_type_env_str\}~should~be~used~only~outside~math~ mode~like~the~environments~\{align\}~and~\{align*\}~of~amsmath. \\ This~error~is~fatal. @@ -2095,14 +2184,17 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { Incompatible~options~in~Arrow } { + Incompatible~options.\\ You~try~to~use~the~option~'\l_keys_key_str'~but~ this~option~is~incompatible~or~redundant~with~the~option~ '\l__witharrows_previous_key_str'~set~in~the~same~command~ \l__witharrows_string_Arrow_for_msg_str. \\ \c__witharrows_option_ignored_str } -\__witharrows_msg_new:nn { Incompatible~options } - { You~try~to~use~the~option~'\l_keys_key_str'~but~ +\__witharrows_msg_new:nn { Incompatible~options a} + { + Incompatible~options. + You~try~to~use~the~option~'\l_keys_key_str'~but~ this~option~is~incompatible~or~redundant~with~the~option~ '\l__witharrows_previous_key_str'~set~in~the~same~command~ \bool_if:NT \l__witharrows_in_code_after_bool @@ -2114,8 +2206,10 @@ } \__witharrows_msg_new:nnn { Arrow~not~in~last~column } { + Bad~use~of~\l__witharrows_string_Arrow_for_msg_str. You~should~use~the~command~\l__witharrows_string_Arrow_for_msg_str\ only~in~the~last~column~(column~\int_use:N\l__witharrows_nb_cols_int)~ + in~the~row~\int_use:N \g__witharrows_line_int\ of~your~environment~\{\l__witharrows_type_env_str\}.\\ However~you~can~go~on~for~this~time. \__witharrows_potential_body_i: @@ -2123,6 +2217,7 @@ { \__witharrows_potential_body_ii: } \__witharrows_msg_new:nn { Wrong~line~in~Arrow } { + Wrong~line.\\ The~specification~of~line~'#1'~you~use~in~the~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~'code-after'~of~\{\l__witharrows_type_env_str\}~doesn't~exist. \\ @@ -2130,23 +2225,27 @@ } \__witharrows_msg_new:nn { Both~lines~are~equal } { + Both~lines~are~equal.\\ In~the~'code-after'~of~\{\l__witharrows_type_env_str\}~you~try~to~ draw~an~arrow~going~to~itself~from~the~line~'#1'.~This~is~not~possible. \\ \c__witharrows_option_ignored_str } \__witharrows_msg_new:nn { Wrong~line~specification~in~MultiArrow } { + Wrong~line~specification.\\ The~specification~of~line~'#1'~doesn't~exist. \\ If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow. } \__witharrows_msg_new:nn { Too~small~specification~for~MultiArrow } { + Too~small~specification.\\ The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ is~too~small:~you~need~at~least~two~lines. \\ \c__witharrows_command_ignored_str } \__witharrows_msg_new:nn { Not~allowed~in~DispWithArrows } { + Forbidden~command.\\ The~command~\token_to_str:N #1 is~allowed~only~in~the~last~column~ (column~\int_use:N\l__witharrows_nb_cols_int)~of~\{\l__witharrows_type_env_str\}. \\ @@ -2154,12 +2253,14 @@ } \__witharrows_msg_new:nn { Not~allowed~in~WithArrows } { + Forbidden~command.\\ The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__witharrows_type_env_str\}~ (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\ \c__witharrows_option_ignored_str } \__witharrows_msg_new:nn { tag*~without~amsmath } { + amsmath~not~loaded.\\ We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~ (or~mathtools). \\ If~you~go~on,~the~command~\token_to_str:N\tag\ @@ -2167,12 +2268,14 @@ } \__witharrows_msg_new:nn { Multiple~tags } { + Multiple~tags.\\ You~can't~use~twice~the~command~\token_to_str:N\tag\ in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ If~you~go~on,~the~tag~'#1'~will~be~used. } \__witharrows_msg_new:nn { Multiple~labels } { + Multiple~labels.\\ Normally,~we~can't~use~the~command~\token_to_str:N\label\ twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ However,~you~can~go~on.~ @@ -2183,13 +2286,15 @@ } \__witharrows_msg_new:nn { Multiple~labels~with~cleveref } { + Multiple~labels.\\ Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\ If~you~go~on,~you~may~have~undefined~references. } \__witharrows_msg_new:nn { Inexistent~v-node } { - There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ + There~is~a~problem.\\ + Maybe~you~have~put~a~command~\token_to_str:N\cr\ instead~of~a~command~\token_to_str:N\\~at~the~end~of~ the~row~\l_tmpa_int\ of~your~environment~\{\l__witharrows_type_env_str\}. \\ @@ -2197,6 +2302,7 @@ } \__witharrows_msg_new:nn { Option~xoffset~forbidden } { + Incorrect~key.\\ You~can't~use~the~option~'xoffset'~in~the~command~ \l__witharrows_string_Arrow_for_msg_str\ in~the~row~\int_use:N \g__witharrows_line_int\ of~your~environment~\{\l__witharrows_type_env_str\}~ @@ -2209,6 +2315,7 @@ } \__witharrows_msg_new:nnn { Duplicate~name } { + Duplicate~name.\\ The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~ the~same~environment~name~twice.~You~can~go~on,~but,~ maybe,~you~will~have~incorrect~results. \\ @@ -2222,6 +2329,7 @@ } \__witharrows_msg_new:nn { Invalid~specification~for~MultiArrow } { + Invalid~specification.\\ The~specification~of~rows~for~\token_to_str:N\MultiArrow\ (i.e.~#1)~is~invalid. \\ \c__witharrows_command_ignored_str @@ -2231,29 +2339,58 @@ \keys_if_exist:nnTF { WithArrows / Global } { #1 } { \__witharrows_error:nn { Key~already~defined } { #1 } } { - \keys_define:nn { WithArrows / Global } + \seq_clear:N \l_tmpa_seq + \keyval_parse:NNn \__witharrows_valid_key:n \__witharrows_valid_key:nn { #2 } + \seq_if_empty:NTF \l_tmpa_seq { - #1 .code:n = - { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } } + \seq_put_right:Nx \l__witharrows_options_WithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l__witharrows_options_DispWithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l__witharrows_options_WithArrowsOptions_seq + { \tl_to_str:N { #1 } } + \cs_if_exist:NTF \keys_precompile:nnN + { + \keys_precompile:nnN + { WithArrows / WithArrowsOptions } + { #2 } + \l_tmpa_tl + \__witharrows_key_define:nV { #1 } \l_tmpa_tl + } + { + \keys_define:nn { WithArrows / Global } + { + #1 .code:n = + { \keys_set:nn { WithArrows / WithArrowsOptions } { #2 } } + } + } } - \seq_put_right:Nx \l__witharrows_options_WithArrows_seq { \tl_to_str:n { #1 } } - \seq_put_right:Nx \l__witharrows_options_DispWithArrows_seq - { \tl_to_str:n { #1 } } - \seq_put_right:Nx \l__witharrows_options_WithArrowsOptions_seq - { \tl_to_str:N { #1 } } - \group_begin: - \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } - { - The~key~'\l_keys_key_str'~can't~be~set~in~the~ - definition~of~a~style.~You~can~go~on~for~this~time~ - but~you~should~suppress~this~key. - } - \WithArrowsOptions { #2 } - \group_end: + { \__witharrows_error:nn { Impossible~style } { #1 } } } } +\__witharrows_msg_new:nn { Impossible~style } + { + Impossible~style.\\ + It's~impossible~to~define~the~style~'#1'~ + because~it~contains~unknown~keys:~' + \seq_use:Nnnn \l_tmpa_seq { '~and~' } { ',~'} { ',~and~}'. + } +\cs_new_protected:Npn \__witharrows_valid_key:n #1 + { + \keys_if_exist:nnF { WithArrows / Global } { #1 } + { \seq_put_right:Nn \l_tmpa_seq { #1 } } + } +\cs_new_protected:Npn \__witharrows_valid_key:nn #1 #2 + { + \keys_if_exist:nnF { WithArrows / Global } { #1 } + { \seq_put_right:Nn \l_tmpa_seq { #1 } } + } +\cs_new_protected:Npn \__witharrows_key_define:nn #1 #2 + { \keys_define:nn { WithArrows / Global } { #1 .code:n = #2 } } +\cs_generate_variant:Nn \__witharrows_key_define:nn { n V } \__witharrows_msg_new:nn { Key~already~defined } { + Key~already~define.\\ The~key~'#1'~is~already~defined. \\ If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored. @@ -2274,6 +2411,7 @@ } \__witharrows_msg_new:nn { Option~unknown~for~up-and-down } { + Unknown~option.\\ The~option~'\l_keys_key_str'~is~unknown.~\c__witharrows_option_ignored_str } \tl_const:Nn \c__witharrows_tikz_code_up_tl @@ -2410,6 +2548,7 @@ \seq_put_right:Nn \l__witharrows_options_Arrow_seq { up } \__witharrows_msg_new:nn { calc~not~loaded } { + calc~not~loaded.\\ You~can't~use~the~option~'\l_keys_key_str'~because~you~don't~have~loaded~the~ Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'~ ~in~the~preamble~of~your~document. \\ -- cgit v1.2.3