diff options
author | Karl Berry <karl@freefriends.org> | 2019-02-02 22:40:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-02-02 22:40:05 +0000 |
commit | b75126fec00fa8fd38a87a1c3e4852ac858f7465 (patch) | |
tree | 92be8229b65e29c56b046158241dc07875b4ce0b /Master/texmf-dist | |
parent | e4085f904b974b17f7b25d2f9aa18bc94a32c134 (diff) |
witharrows (2feb19)
git-svn-id: svn://tug.org/texlive/trunk@49912 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/witharrows.pdf | bin | 353107 -> 360337 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/witharrows/witharrows.dtx | 676 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/witharrows/witharrows.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 1404 |
4 files changed, 1195 insertions, 889 deletions
diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf Binary files differindex d4892e3ee01..e1cf1e10ad6 100644 --- a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf +++ b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx index 0dace1ef4da..87c7caecfef 100644 --- a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx +++ b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2017-2018 by F. Pantigny +% Copyright (C) 2017-2019 by F. Pantigny % ----------------------------------- % % This file may be distributed and/or modified under the @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{1.13} -\def\myfiledate{2018/12/31} +\def\myfileversion{1.14} +\def\myfiledate{2019/02/01} % % %<*batchfile> @@ -26,7 +26,7 @@ \usedir{tex/latex/witharrows} \preamble -Copyright (C) 2017-2018 by F. Pantigny +Copyright (C) 2017-2019 by F. Pantigny ----------------------------------- This file may be distributed and/or modified under the @@ -44,7 +44,7 @@ version 2005/12/01 or later. \endgroup %</batchfile> % -%<@@=wi> +%<@@=wa> %<*driver> \documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by witharrows) \usepackage{xltxtra} @@ -55,6 +55,7 @@ version 2005/12/01 or later. \usepackage{mathtools} \usepackage{amssymb} \usepackage[only,llbracket,rrbracket]{stmaryrd} +\usepackage{varwidth} \NewDocumentEnvironment {scope} {} {} {} \def\interitem{\vskip 7mm plus 2 mm minus 3mm} \def\emphase{\bgroup\color{RoyalPurple}\let\next=} @@ -315,8 +316,9 @@ version 2005/12/01 or later. % % % \interitem -% Almost all the options can be given directly to the environment |{WithArrows}| (between square brackets). In this -% case, they apply to all the arrows of the environment.\footnote{They also apply to the nested environments +% Almost all the options can be given directly between square brackets to the environment |{WithArrows}|. +% \textbf{There must be no space before the opening bracket (|[|) of the options of the environment.} +% The options apply to all the arrows of the environment.\footnote{They also apply to the nested environments % |{WithArrows}| (with the logical exceptions of |interline|, |CodeBefore| and |CodeAfter|).} % % % \begin{Verbatim} @@ -612,6 +614,39 @@ version 2005/12/01 or later. % % \interitem % +% \section{The options ``up'' and ``down'' for individual arrows} +% +% \label{up-and-down} +% At the local, level, there is also two options for individuals arrows, called ``|up|'' and ``|down|''. The +% following example illustrates these types of arrows: +% +% \begin{Verbatim} +% \(\begin{WithArrows} +% A & = B +% \Arrow~emphase#[up]@{an arrow of type "up"} \\ +% & = C + C + C + C + C + C + C + C \\ +% & = C + C + C + C + C + C + C + C +% \Arrow~emphase#[down]@{an arrow of type "down"} \\ +% & = E + E +% \end{WithArrows}\) +% \end{Verbatim} +% +% \vspace{1cm} +% \(\begin{WithArrows} +% A & = B +% \Arrow[up]{an arrow of type "up"} \\ +% & = C + C + C + C + C + C + C + C \\ +% & = C + C + C + C + C + C + C + C +% \Arrow[down]{an arrow of type "down"} \\ +% & = E + E +% \end{WithArrows}\) +% +% +% \vspace{1cm} +% The options |up| and |down| require the package \pkg{varwidth} and the Tikz library \pkg{calc}. It they are not +% loaded, an error will be raised. +% +% \interitem % % \section{Comparison with the environment \{aligned\}} % @@ -1363,7 +1398,7 @@ version 2005/12/01 or later. % % \section{Advanced features} % -% +% % \subsection{The option TikzCode : how to change the shape of the arrows} % % \label{TikzCode} @@ -1373,6 +1408,10 @@ version 2005/12/01 or later. % the arrows of this environment but only for the arrows in the nested environments |{WithArrows}|.} % % \smallskip +% For example, the options ``|up|'' and ``|down|'' described previously (cf. p.~\pageref{up-and-down}) are +% programmed internally with |TikzCode|. +% +% \smallskip % The value of this option must be a valid Tikz drawing instruction (with the final semicolon) with three markers % |#1|, |#2| and |#3| for the start point, the end point and the label of the arrow. % @@ -1446,7 +1485,8 @@ version 2005/12/01 or later. % scope. % % The style can be used as a key at the document level (with |\WithArrowsOptions|) or at the environment level (in -% the optional arguments of |{WithArrows}| and |{DispWithArrows}|). +% the optional arguments of |{WithArrows}| and |{DispWithArrows}|). The style can also be used in another command +% |\WithArrowsNewStyle|. % % For an example of use, see p.~\pageref{example-WithArrowsRightX}. % @@ -1566,7 +1606,40 @@ version 2005/12/01 or later. % & = a^2+b^2+2ab % \end{WithArrows}$ % +% \bigskip +% \subsection{Note for developpers} +% +% If you want to construct an environment upon an environment of \pkg{witharrows}, it's recommand to call the +% environment with the construction |\WithArrows|-|\endWithArrows| or |\DispWithArrows|-|\endDispWithArrows| (and +% not |\begin{WithArrows}|-|\end{WithArrows}|, etc.). +% +% \smallskip +% By doing so, the error messages generated by \pkg{witharrows} will (usually) mention the name of your +% environment and they will be easier to understand by the final user. % +% \smallskip +% By example, you can define an environment |{DWA}| which is an alias of |{DispWithArrows}|: +% \begin{BVerbatim} +% \NewDocumentEnvironment {DWA} {} {\DispWithArrows}{\endDispWithArrows} +% \end{BVerbatim} +% +% \smallskip +% If you use this environment |{DWA}| in math mode, you will have the following error message: +% +% \begin{BVerbatim} +% The environment {DWA} should be used only outside math mode. +% \end{BVerbatim} +% +% \interitem +% Another example is the definition of the environment |{DispWithArrows*}| internally in the package +% \pkg{witharrows} by the following code: +% \begin{Verbatim} +% \NewDocumentEnvironment {DispWithArrows*} {} +% {\WithArrowsOptions{notag} +% \DispWithArrows} +% {\endDispWithArrows} +% \end{Verbatim} +% % \section{Examples} % % \subsection{With only one column} @@ -1625,8 +1698,8 @@ version 2005/12/01 or later. % Tikz. % % \begin{Verbatim} -% \begin{WithArrows}[% -% interline = 4mm, +% \begin{WithArrows}% +% [interline = 4mm, % tikz = {~emphase#every node/.style = {circle,@ % ~emphase# draw,@ % ~emphase# auto = false,@ @@ -1679,8 +1752,8 @@ version 2005/12/01 or later. % draws the arrow itself and the second puts the label in a Tikz node in the rectangle delimited by the arrow. % % \begin{Verbatim} -% \begin{DispWithArrows*}[ -% displaystyle, +% \begin{DispWithArrows*}% +% [displaystyle, % ygap = 2mm, % ystart = 0mm, % ~emphase#TikzCode = {\draw (~#1) -- ++(4.5cm,0) |- (~#2) ;@ @@ -1724,7 +1797,7 @@ version 2005/12/01 or later. % For lisibility, we use a style. This example requires the Tikz library \pkg{calc}. % % \begin{Verbatim} -% \WithArrowsNewStyle{MyStyle}% +% \WithArrowsNewStyle{MyStyle} % {displaystyle, % ygap = 2mm, % xoffset = 0pt, @@ -1747,7 +1820,7 @@ version 2005/12/01 or later. % ........... % \end{Verbatim} % -% \WithArrowsNewStyle{MyStyle}% +% \WithArrowsNewStyle{MyStyle} % {displaystyle, % ygap = 2mm, % xoffset = 0pt, @@ -1921,7 +1994,7 @@ version 2005/12/01 or later. % \begin{macrocode} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} -\RequirePackage{expl3}[2018-01-01] +\RequirePackage{expl3}[2019/01/28] % \end{macrocode} % % \bigskip @@ -1939,7 +2012,7 @@ version 2005/12/01 or later. % The package \pkg{xparse} will be used to define the environments |{WithArrows}|, |{DispWithArrows}|, % |{DispWithArrows*}| and the commands |\Arrow|, |\WithArrowsOptions| and |\WithArrowsNewStyle|. % \begin{macrocode} -\RequirePackage{xparse} +\RequirePackage{xparse}[2018-10-17] % \end{macrocode} % % \bigskip @@ -2010,7 +2083,7 @@ version 2005/12/01 or later. {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~ - within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~ + within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ of~the~package~footnotehyper.} % \end{macrocode} % @@ -2020,7 +2093,7 @@ version 2005/12/01 or later. {You~can't~use~the~option~"footnotehyper"~because~the~package~ footnote~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~"footnote"~and~the~footnotes~ - within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~ + within~the~environments~of~withArrows~will~be~extracted~with~the~tools~ of~the~package~footnote.} % \end{macrocode} % @@ -2097,7 +2170,8 @@ version 2005/12/01 or later. % \begin{macrocode} \AtBeginDocument {\clist_map_inline:nn - {amsmath,mathtools,autonum,cleveref,hyperref,typedref,showlabels,amsthm} + {amsmath,mathtools,autonum,cleveref,hyperref,typedref,showlabels, + amsthm,varwidth} {\bool_new:c {c_@@_#1_loaded_bool} \@ifpackageloaded {#1} {\bool_set_true:c {c_@@_#1_loaded_bool}} @@ -2154,22 +2228,20 @@ version 2005/12/01 or later. above = \l_@@_ystart_dim, inner~sep = 0 pt, minimum~width = 0pt, - minimum~height = \l_@@_ygap_dim, - red, - \bool_if:NT \l_@@_shownodes_bool {draw} }} + minimum~height = \l_@@_ygap_dim}} % \end{macrocode} -% The color of the nodes is red, but in fact, the nodes will be drawn only when the option |shownodes| is used -% (this option is useful for debugging).\footnote{The |v|-nodes, created near the end of line in |{DispWithArrows}| -% are not shown with this option.} +% If the user uses the option |shownodes| (it's a \pkg{l3keys} option), the Tikz options |draw| and |red| will be +% appended to this style. This feature may be useful for debugging.\footnote{The |v|-nodes, created near the end of +% line in |{DispWithArrows}| and |{DispWithArrows*}| are not shown with the option |shownodes|.} % % % \bigskip -% The style |@@_standard| is load in standard in the |{tikzpicture}| we need. The names of the nodes are prefixed by -% |wa| (by security) but also by a prefix which is the position-in-the-tree of the nested environments. +% The style |@@_standard| is loaded in standard in the |{tikzpicture}| we need. The names of the nodes are prefixed +% by |wa| (by security) but also by a prefix which is the position-in-the-tree of the nested environments. % \begin{macrocode} \tikzset{@@_standard/.style= { remember~picture, overlay, - name~prefix = wa-\l_@@_prefix_str- }} + name~prefix = wa-\l_@@_prefix_str-}} % \end{macrocode} % % \bigskip @@ -2181,7 +2253,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The style |WithArrows/arrow| will be used to draw the arrow (more precisely, it will be pass to |every~path|). +% The style |WithArrows/arrow| will be used to draw the arrow (more precisely, it will be passed to |every~path|). % \begin{macrocode} \tikzset{WithArrows/arrow/.style = { align = left, % \end{macrocode} @@ -2201,7 +2273,7 @@ version 2005/12/01 or later. % |{WithArrows}|. % % Nevertheless, we want the extension \pkg{witharrows} available without \pkg{amsmath}. That's why we give a -% definition of |\spread@equation| if \pkg{amsmath} is not loaded (you put the code in a |\AtBeginDocument| because +% definition of |\spread@equation| if \pkg{amsmath} is not loaded (we put the code in a |\AtBeginDocument| because % the flag |\c_@@_amsmath_loaded_bool| is itself set in a |\AtBeginDocument|). % \begin{macrocode} \AtBeginDocument @@ -2211,13 +2283,12 @@ version 2005/12/01 or later. \cs_set_eq:NN \spread@equation \prg_do_nothing:}}} % \end{macrocode} % Don't put |\cs_set_eq:NN \spread@equation \prog_do_nothing:| in the last line because this would raise errors -% with nested environments. |\cs_set_protected:Npn \spread@equation {}| +% with nested environments. % % % \bigskip % \subsection{Variables} % -% % The boolean |\l_@@_in_WithArrows_bool| will be raised in an environment |{WithArrows}| and the % boolean |\l_@@_in_dispwitharrows_bool| in an environment |{DispWithArrows}| or |{DispWithArrows*}|. % \begin{macrocode} @@ -2246,7 +2317,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The following integer indicates the position of the box that will be created: 0 (=|t|=|\vtop|), 1~(=|c|=|\vcenter|) or 2 (=|b|=|\vbox|). +% The following integer indicates the position of the box that will be created: 0 (=|t|=|\vtop|), +% 1~(=|c|=|\vcenter|) or 2 (=|b|=|\vbox|). % \begin{macrocode} \int_new:N \l_@@_pos_env_int % \end{macrocode} @@ -2259,7 +2331,7 @@ version 2005/12/01 or later. % % % \bigskip -% The integer |\l_@@_pos_arrows_int| indicates the position of the arrows with the following code (the option |v| +% The integer |\l_@@_pos_arrow_int| indicates the position of the arrow with the following code (the option |v| % is accessible only for the arrows in |CodeAfter| where the options |i|, |group| et |groups| are not available). % % \begin{center} @@ -2268,7 +2340,7 @@ version 2005/12/01 or later. % \toprule % option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\ % \midrule -% |\l_@@_pos_arrows_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\ +% |\l_@@_pos_arrow_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\ % \bottomrule % \end{tabular} \\ % \footnotesize The option |v| can be used only in |\Arrow| in |CodeAfter| (see below). @@ -2277,17 +2349,17 @@ version 2005/12/01 or later. % % % \begin{macrocode} -\int_new:N \l_@@_pos_arrows_int -\int_set:Nn \l_@@_pos_arrows_int 3 +\int_new:N \l_@@_pos_arrow_int +\int_set:Nn \l_@@_pos_arrow_int 3 % \end{macrocode} % % \medskip % When we scan a list of options, we want to be able to raise an error if two options of position of the arrows % are present. That's why we keep the code of the first option of position in a variable called -% |\l_@@_previous_pos_arrows_int|. This variable will be set to $-1$ each time we start the scanning of a list of options. +% |\l_@@_previous_pos_arrow_int|. This variable will be set to $-1$ each time we start the scanning of a list of options. % % \begin{macrocode} -\int_new:N \l_@@_previous_pos_arrows_int +\int_new:N \l_@@_previous_pos_arrow_int % \end{macrocode} % % \bigskip @@ -2297,7 +2369,7 @@ version 2005/12/01 or later. % % \bigskip % The dimension |\l_@@_x_dim| will be used to compute the $x$-value for some vertical arrows when one of the -% options |i|, |group| and |groups| (values 5, 6 and 7 of |\l_@@_pos_arrows_int|) is used. +% options |i|, |group| and |groups| (values 5, 6 and 7 of |\l_@@_pos_arrow_int|) is used. % \begin{macrocode} \dim_new:N \l_@@_x_dim % \end{macrocode} @@ -2394,6 +2466,21 @@ version 2005/12/01 or later. \dim_set:Nn \l_@@_end_adjust_dim {0.4ex} % \end{macrocode} % +% \bigskip +% \begin{macrocode} +\str_new:N \l_@@_CommandName_str +\str_set:Nn \l_@@_CommandName_str {Arrow} +% \end{macrocode} +% +% \bigskip +% The string |\l_@@_string_Arrow_for_messages_str| is only a string that will be displayed in some error messages. +% For example, if |CommandName| is defined to be |Explanation|, the string |\l_@@_string_Arrow_for_messages_str| +% will contain "|\Arrow (renamed here in \Explanation)|". +% \begin{macrocode} +\str_new:N \l_@@_string_Arrow_for_messages_str +\str_set:Nx \l_@@_string_Arrow_for_messages_str {\token_to_str:N \Arrow} +% \end{macrocode} +% % % \bigskip % \subsection{The definition of the options} @@ -2461,10 +2548,12 @@ version 2005/12/01 or later. % Usually, the number of columns in a |{WithArrows}| environment is limited to 2. Nevertheless, it's possible to % have more columns with the option |MoreColumns|. % \begin{macrocode} - MoreColumns .code:n = { \msg_redirect_name:nnn - {witharrows} - {Third~column~in~an~environment~{WithArrows}} - {none} }, + MoreColumns .code:n = { \bool_if:NTF \l_@@_in_DispWithArrows_bool + {\@@_error:n {Option~will~be~ignored}} + { \msg_redirect_name:nnn + {witharrows} + {Third~column~in~WithArrows} + {none} }}, MoreColumns .value_forbidden:n = true, % \end{macrocode} % @@ -2480,8 +2569,14 @@ version 2005/12/01 or later. % \bigskip % If the user wants to give a new name to the |\Arrow| command (and the name |\Arrow| remains free). % \begin{macrocode} - CommandName .tl_set:N = \l_@@_CommandName_tl, - CommandName .initial:n = Arrow , + CommandName .code:n = + {\str_set:Nn \l_@@_CommandName_str {#1} +% \end{macrocode} +% +% The string |\l_@@_string_Arrow_for_messages_str| will be used only in some error messages. +% \begin{macrocode} + \str_set:Nx \l_@@_string_Arrow_for_messages_str + {\c_backslash_str Arrow~(renamed~here~in~\c_backslash_str #1)}}, CommandName .value_required:n = true, % \end{macrocode} % @@ -2502,8 +2597,8 @@ version 2005/12/01 or later. % \bigskip % With the option |shownodes|, the nodes will be drawn in red (useful only for debugging). % \begin{macrocode} - shownodes .bool_set:N = \l_@@_shownodes_bool, - shownodes .initial:n = false, + shownodes .code:n = {\tikzset{@@_node_style/.append~style = {draw,red}}}, + shownodes .value_forbidden:n = true, % \end{macrocode} % % \bigskip @@ -2518,10 +2613,10 @@ version 2005/12/01 or later. % With the option |group|, \emph{all} the arrows of the environment are vertical with the same abscissa and at a % leftmost position. % \begin{macrocode} - group .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\@@_error:n {Two~options~are~incompatible}} - \int_set:Nn \l_@@_previous_pos_arrows_int 7 - \int_set:Nn \l_@@_pos_arrows_int 7} , + group .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrow_int > {-1} + {\@@_error:n {Incompatible~options}} + \int_set:Nn \l_@@_previous_pos_arrow_int 7 + \int_set:Nn \l_@@_pos_arrow_int 7} , group .value_forbidden:n = true, % \end{macrocode} % @@ -2529,10 +2624,10 @@ version 2005/12/01 or later. % With the option |groups| (with a \emph{s}), the arrows of the environment are divided in groups by an argument of % connexity, and, in each group, the arrows are vertical with the same abscissa and at a leftmost position. % \begin{macrocode} - groups .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\@@_error:n {Two~options~are~incompatible}} - \int_set:Nn \l_@@_previous_pos_arrows_int 6 - \int_set:Nn \l_@@_pos_arrows_int 6} , + groups .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrow_int > {-1} + {\@@_error:n {Incompatible~options}} + \int_set:Nn \l_@@_previous_pos_arrow_int 6 + \int_set:Nn \l_@@_pos_arrow_int 6} , groups .value_forbidden:n = true, % \end{macrocode} % @@ -2638,11 +2733,10 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} - unknown .code:n = \@@_error:n {Option~unknown} + unknown .code:n = \@@_error:n {Unknown~option} } % \end{macrocode} -% -% +% % \bigskip % Then we define the main module called |WithArrows/General| which will be loaded at all the levels. % @@ -2681,8 +2775,8 @@ version 2005/12/01 or later. % % \begin{macrocode} xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l_@@_level_int = 3 && - \int_compare_p:nNn \l_@@_pos_arrows_int > 5} - {\@@_error:n {Option~incompatible~with~"group(s)"}} + \int_compare_p:nNn \l_@@_pos_arrow_int > 5} + {\@@_error:n {Option~incompatible~with~group}} {\dim_set:Nn \l_@@_xoffset_dim {#1}}} , xoffset .value_required:n = true, % \end{macrocode} @@ -2718,15 +2812,7 @@ version 2005/12/01 or later. adjust .code:n = {\dim_set:Nn \l_@@_start_adjust_dim {#1} \dim_set:Nn \l_@@_end_adjust_dim {#1} }, adjust .value_required:n = true, -% \end{macrocode} -% -% -% \bigskip -% Eventually, a key |jump| (see below) and a key for unknown keys. -% \begin{macrocode} - jump .code:n = {\int_compare:nNnF \l_@@_level_int = 3 - {\@@_error:n {Option~will~be~ignored}}} , - unknown .code:n = \@@_error:n {Option~unknown} + unknown .code:n = \@@_error:n {Unknown~option} } % \end{macrocode} % @@ -2738,7 +2824,7 @@ version 2005/12/01 or later. \keys_define:nn {WithArrows/Arrow} {jump .code:n = {\int_set:Nn \l_@@_jump_int {#1} \int_compare:nNnF \l_@@_jump_int > 0 - {\@@_error:n {The~option~"jump"~must~be~non~negative}}} , + {\@@_error:n {Negative~value~for~jump}}} , jump .value_required:n = true, rr .value_forbidden:n = true, rr .code:n = \@@_analyze_option_position:n 3 , @@ -2757,10 +2843,10 @@ version 2005/12/01 or later. % |lr|, |rl|, |rr| and |i|. The argument is the corresponding code for the position of the arrows. % \begin{macrocode} \cs_new_protected:Nn \@@_analyze_option_position:n - {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\@@_error:n {Two~options~are~incompatible}} - \int_set:Nn \l_@@_previous_pos_arrows_int {#1} - \int_set:Nn \l_@@_pos_arrows_int {#1}} + {\int_compare:nNnT \l_@@_previous_pos_arrow_int > {-1} + {\@@_error:n {Incompatible~options}} + \int_set:Nn \l_@@_previous_pos_arrow_int {#1} + \int_set:Nn \l_@@_pos_arrow_int {#1}} % \end{macrocode} % % @@ -2768,7 +2854,7 @@ version 2005/12/01 or later. % |\WithArrowsOptions| is the command of the \pkg{witharrows} package to fix options at the document level. % \begin{macrocode} \NewDocumentCommand \WithArrowsOptions {m} - {\int_set:Nn \l_@@_previous_pos_arrows_int {-1} + {\int_set:Nn \l_@@_previous_pos_arrow_int {-1} \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl} % \end{macrocode} @@ -2784,7 +2870,7 @@ version 2005/12/01 or later. % % \medskip % \begin{macrocode} -\NewDocumentCommand \@@_Arrow {O{} m O{}} +\NewDocumentCommand \@@_Arrow {O{} m !O{}} { % \end{macrocode} % @@ -2796,12 +2882,12 @@ version 2005/12/01 or later. % \end{macrocode} % % We will extract immediately the options |ll|, |rr|, |lr|, |rl|, |i| and |jump|. For the position, we use the -% integer |\l_@@_pos_arrows_int| locally in the cell of the |\halign|: we won't change the exterior evalue of -% |\l_@@_pos_arrows_int| set by the environment |{WithArrows}| of by the command |\WithArrowsOptions|. The default -% value of |\l_@@_pos_arrows_int| will be $-1$ for an arrow without option of position. +% integer |\l_@@_pos_arrow_int| locally in the cell of the |\halign|: we won't change the exterior evalue of +% |\l_@@_pos_arrow_int| set by the environment |{WithArrows}| of by the command |\WithArrowsOptions|. The default +% value of |\l_@@_pos_arrow_int| will be $-1$ for an arrow without option of position. % \begin{macrocode} - \int_set:Nn \l_@@_previous_pos_arrows_int {-1} - \int_set:Nn \l_@@_pos_arrows_int {-1} + \int_set:Nn \l_@@_previous_pos_arrow_int {-1} + \int_set:Nn \l_@@_pos_arrow_int {-1} % \end{macrocode} % The level of options is set to 3 which is the level for the options in a command |\Arrow|. % \begin{macrocode} @@ -2833,7 +2919,7 @@ version 2005/12/01 or later. % \item The ``position'' of the arrow. If the arrow has no option of position, the default value $-1$ is stored in % that field. % \begin{macrocode} - \prop_put:NnV \l_tmpa_prop {position} \l_@@_pos_arrows_int + \prop_put:NnV \l_tmpa_prop {position} \l_@@_pos_arrow_int % \end{macrocode} % % \item The other options of the arrow (it's a token list): @@ -2862,12 +2948,7 @@ version 2005/12/01 or later. % \medskip % \begin{macrocode} \cs_new_protected:Nn \@@_Arrow_first_column: -% \end{macrocode} -% All messages of LaTeX3 must be \emph{fully expandable} and that's why we do the affectation (necessary for a -% comparison) before the |\@@_error:n|. -% \begin{macrocode} - {\tl_set:Nn \l_tmpa_tl {Arrow} - \@@_error:n {Arrow~in~first~column} + {\@@_error:n {Arrow~in~first~column} \@@_Arrow} % \end{macrocode} % @@ -2880,11 +2961,18 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Nn \@@_pre_environment:n % \end{macrocode} +% +% First the initialisation of |\l_@@_type_env_tl| which is the name of the encompassing environment. In fact, this +% token list is used only in the error messages. +% \begin{macrocode} + { \tl_clear_new:N \l_@@_type_env_tl + \tl_set:NV \l_@@_type_env_tl \@currenvir +% \end{macrocode} % -% First the initialisation of the counters |\g_@@_arrow_int| and |\g_@@_line_int|. However, we have to save their +% The initialisation of the counters |\g_@@_arrow_int| and |\g_@@_line_int|. However, we have to save their % previous values with the two stacks created for this end. % \begin{macrocode} - { \seq_gput_right:NV \g_@@_arrow_int_seq \g_@@_arrow_int + \seq_gput_right:NV \g_@@_arrow_int_seq \g_@@_arrow_int \int_gzero:N \g_@@_arrow_int \seq_gput_right:NV \g_@@_line_int_seq \g_@@_line_int \int_gzero:N \g_@@_line_int @@ -2953,10 +3041,11 @@ version 2005/12/01 or later. \tl_clear_new:N \l_@@_code_before_tl \tl_clear_new:N \l_@@_code_after_tl % \end{macrocode} +% % \bigskip -% We process the options given to the |{WithArrows}| environment. The level of options is set to 1. +% We process the options given to the |{WithArrows}| environment. The level of options is set to 2. % \begin{macrocode} - \int_set:Nn \l_@@_previous_pos_arrows_int {-1} + \int_set:Nn \l_@@_previous_pos_arrow_int {-1} \int_set:Nn \l_@@_level_int 2 \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl @@ -2984,7 +3073,7 @@ version 2005/12/01 or later. % command with this name is defined locally in the environment with meaning |\@@_Arrow|. The default value of the % option |CommandName| is ``|Arrow|'' and thus, by default, the name of the command will be |\Arrow|. % \begin{macrocode} - \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow} + \cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow} % \end{macrocode} % This is the end of |\@@_pre_environment:n|. % @@ -2992,13 +3081,13 @@ version 2005/12/01 or later. % \bigskip % Now, we begin the environment |{WithArrows}|. % \begin{macrocode} -\NewDocumentEnvironment {WithArrows} {O{}} +\NewDocumentEnvironment {WithArrows} {!O{}} { \bool_set_true:N \l_@@_in_WithArrows_bool \bool_set_false:N \l_@@_in_DispWithArrows_bool + \@@_pre_environment:n {#1} \reverse_if:N \if_mode_math: - \@@_error:n {{WithArrows}~used~outside~math~mode} + \@@_error:n {WithArrows~outside~math~mode} \fi: - \@@_pre_environment:n {#1} \cs_set_eq:NN \notag \@@_notag: \cs_set_eq:NN \nonumber \@@_notag: \cs_set_eq:NN \tag \@@_tag @@ -3038,7 +3127,7 @@ version 2005/12/01 or later. % manage a stack for this counter. % \begin{macrocode} \int_gincr:N \g_@@_line_int - \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_first_column: + \cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow_first_column: \bool_set_true:N \l_@@_in_first_column_bool \strut\hfil $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$ @@ -3080,7 +3169,7 @@ version 2005/12/01 or later. % Usually, the |\halign| of an environment |{WithArrows}| will have exactly two columns. Nevertheless, if the user % wants to use more columns (without arrows) it's possible with the option |MoreColumns|. % \begin{macrocode} - && \@@_error:n {Third~column~in~an~environment~{WithArrows}} + && \@@_error:n {Third~column~in~WithArrows} $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$ \cr } @@ -3142,7 +3231,7 @@ version 2005/12/01 or later. % options and has the name of a function defined with |\NewDocumentCommand|.} % \begin{macrocode} \cs_set_eq:NN \MultiArrow \@@_MultiArrow:nn - \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_code_after + \cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow_code_after \l_@@_code_after_tl \group_end: % \end{macrocode} @@ -3326,10 +3415,10 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Nn \@@_if_in_second_col_of_disp:nn {\bool_if:NTF \l_@@_in_WithArrows_bool - {\@@_error:nn {Command~not~allowed~in~{WithArrows}} + {\@@_error:nn {Command~not~allowed~in~WithArrows} {#1}} {\bool_if:NTF \l_@@_in_first_column_bool - {\@@_error:nn {Command~not~allowed~in~{DispWithArrows}} + {\@@_error:nn {Command~not~allowed~in~DispWithArrows} {#1}} {#2}}} % \end{macrocode} @@ -3359,7 +3448,7 @@ version 2005/12/01 or later. \bool_set:Nn \l_@@_tag_star_bool {#1} % \end{macrocode} % The starred version |\tag*| can't be used if \pkg{amsmath} has not been loaded because this version does the job -% by desactivating the command |\tagform@| inserted by \pkg{amsmath} in the (two versions of the) command +% by deactivating the command |\tagform@| inserted by \pkg{amsmath} in the (two versions of the) command % |\@eqnnum|.\footnote{There are two versions of |@eqnnum|, a standard version and a version for the option |leqno|.} % \begin{macrocode} \bool_if:nT {#1 && ! \bool_if_p:N \c_@@_amsmath_loaded_bool} @@ -3441,7 +3530,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} -\NewDocumentEnvironment {DispWithArrows} {O{}} +\NewDocumentEnvironment {DispWithArrows} {!O{}} { % \end{macrocode} % If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we disable the code of \pkg{mathtools} for @@ -3460,11 +3549,11 @@ version 2005/12/01 or later. % The command |\intertext@| is a command of \pkg{amsmath} which loads the definition of |\intertext|. % \begin{macrocode} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ - \if_mode_math: - \@@_error:n {{DispWithArrows}~used~in~math~mode} - \fi: \bool_set_true:N \l_@@_in_DispWithArrows_bool \@@_pre_environment:n {#1} + \if_mode_math: + \@@_error:n {DispWithArrows~in~math~mode} + \fi: % \end{macrocode} % We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a redefinition of |\[|. However, we % put the following lines which are in the definition of |\[| even though they are in case of misuse. @@ -3490,7 +3579,7 @@ version 2005/12/01 or later. \cs_set_eq:NN \tagnextline \@@_tagnextline: \halign to \displaywidth \bgroup \int_gincr:N \g_@@_line_int - \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_first_column: + \cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow_first_column: \bool_set_true:N \l_@@_in_first_column_bool \strut \bool_if:NT \l_@@_fleqn_bool @@ -3523,7 +3612,7 @@ version 2005/12/01 or later. -\int_use:N\g_@@_line_int}} & ## \tabskip = \c_zero_skip - && \@@_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \@@_error:n {Third~column~in~DispWithArrows} \iffalse ## \fi \cr} % \end{macrocode} @@ -3552,11 +3641,13 @@ version 2005/12/01 or later. {\dim_gzero_new:N \g_@@_right_x_dim \dim_gset_eq:NN \g_@@_right_x_dim \c_max_dim \begin{tikzpicture} [@@_standard] - \int_step_variable:nnnNn 1 1 \g_@@_line_int \l_tmpa_int - {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) - \dim_set:Nn \l_tmpa_dim \pgf@x - \dim_compare:nNnT \l_tmpa_dim < \g_@@_right_x_dim - {\dim_gset:Nn \g_@@_right_x_dim \l_tmpa_dim} } + \int_step_variable:nNn \g_@@_line_int \l_tmpa_int + {\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-\l_tmpa_int-v} + {\@@_error:n {Inexistent~v-node}} + {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) + \dim_set:Nn \l_tmpa_dim \pgf@x + \dim_compare:nNnT \l_tmpa_dim < \g_@@_right_x_dim + {\dim_gset:Nn \g_@@_right_x_dim \l_tmpa_dim}} } \end{tikzpicture}} % \end{macrocode} % @@ -3566,7 +3657,7 @@ version 2005/12/01 or later. \@@_post_environment: % \end{macrocode} % If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we reactivate the code of \pkg{mathtools} for -% the option |showonlyrefs| with the command |\MT_showonlyrefs_true:| (it has been desactivated in the beginning of +% the option |showonlyrefs| with the command |\MT_showonlyrefs_true:| (it has been deactivated in the beginning of % the environment). % \begin{macrocode} \bool_if:nT \c_@@_mathtools_loaded_bool @@ -3606,15 +3697,15 @@ version 2005/12/01 or later. % \end{itemize} % % \medskip -% If the option |group| is used (|\l_@@_pos_arrows_int| = 7), we scan the arrows twice: in the first step we only -% compute the value of |\l_@@_x_dim| for the whole group, and, in the second step (|\l_@@_pos_arrows_int| is set to +% If the option |group| is used (|\l_@@_pos_arrow_int| = 7), we scan the arrows twice: in the first step we only +% compute the value of |\l_@@_x_dim| for the whole group, and, in the second step (|\l_@@_pos_arrow_int| is set to % 8), we divide the arrows in groups (for the vertical adjustement) and we actually draw the arrows. % \begin{macrocode} \cs_new_protected:Nn \@@_scan_arrows: { \group_begin: - \int_compare:nNnT \l_@@_pos_arrows_int = 7 + \int_compare:nNnT \l_@@_pos_arrow_int = 7 { \@@_scan_arrows_i: - \int_set:Nn \l_@@_pos_arrows_int 8 } + \int_set:Nn \l_@@_pos_arrow_int 8 } \@@_scan_arrows_i: \group_end:} % \end{macrocode} @@ -3667,10 +3758,10 @@ version 2005/12/01 or later. % \begin{macrocode} \prop_get:cnN {g_@@_arrow_\l_@@_prefix_str _\int_use:N\l_@@_arrow_int _prop} {initial} \l_tmpa_tl - \int_set:Nn \l_@@_initial_int {\l_tmpa_tl} + \int_set:Nn \l_@@_initial_int \l_tmpa_tl \prop_get:cnN {g_@@_arrow_\l_@@_prefix_str _\int_use:N\l_@@_arrow_int _prop} {final} \l_tmpa_tl - \int_set:Nn \l_@@_final_int {\l_tmpa_tl} + \int_set:Nn \l_@@_final_int \l_tmpa_tl \prop_get:cnN {g_@@_arrow_\l_@@_prefix_str _\int_use:N\l_@@_arrow_int _prop} {position} \l_tmpa_tl \int_set:Nn \l_@@_pos_of_arrow_int \l_tmpa_tl @@ -3687,14 +3778,14 @@ version 2005/12/01 or later. % % \bigskip % We test if the previous arrow was in fact the last arrow of a group. In this case, we have to draw all the arrows -% of that group, except if you are with the option |group| and in the first step of treatment (|\l_@@_pos_arrows_int| = 7). +% of that group, except if you are with the option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = 7). % \begin{macrocode} {\bool_if:nT {\int_compare_p:nNn \l_@@_arrow_int > 1 && \int_compare_p:nNn \l_@@_initial_int > \l_@@_last_line_of_group_int && - \int_compare_p:n {\l_@@_pos_arrows_int != 7}} + \int_compare_p:n {\l_@@_pos_arrow_int != 7}} {\@@_draw_arrows:nn \l_@@_first_arrow_of_group_int {\l_@@_arrow_int - 1} \bool_set_true:N \l_@@_new_group_bool} % \end{macrocode} @@ -3710,22 +3801,20 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:nTF \l_@@_new_group_bool {\bool_set_false:N \l_@@_new_group_bool - \int_set:Nn \l_@@_first_arrow_of_group_int \l_@@_arrow_int - \int_set:Nn \l_@@_first_line_of_group_int \l_@@_initial_int - \int_set:Nn \l_@@_last_line_of_group_int \l_@@_final_int + \int_set_eq:NN \l_@@_first_arrow_of_group_int \l_@@_arrow_int + \int_set_eq:NN \l_@@_first_line_of_group_int \l_@@_initial_int + \int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int \seq_clear:N \l_@@_first_arrows_of_group_seq - \seq_put_left:Nx \l_@@_first_arrows_of_group_seq - {\int_use:N \l_@@_arrow_int} + \seq_put_left:NV \l_@@_first_arrows_of_group_seq \l_@@_arrow_int \seq_clear:N \l_@@_last_arrows_of_group_seq - \seq_put_left:Nx \l_@@_last_arrows_of_group_seq - {\int_use:N \l_@@_arrow_int} + \seq_put_left:NV \l_@@_last_arrows_of_group_seq \l_@@_arrow_int % \end{macrocode} % -% If we are in option |group| and in the second step of treatment (|\l_@@_pos_arrows_int| = 8), we don't initialize +% If we are in option |group| and in the second step of treatment (|\l_@@_pos_arrow_int| = 8), we don't initialize % |\l_@@_x_dim| because we want to use the same value of |\l_@@_x_dim| (computed during the first step) for all the % groups. % \begin{macrocode} - \int_compare:nT {\l_@@_pos_arrows_int != 8} + \int_compare:nT {\l_@@_pos_arrow_int != 8} {\dim_set:Nn \l_@@_x_dim {-\c_max_dim}} } % \end{macrocode} @@ -3737,26 +3826,23 @@ version 2005/12/01 or later. % \begin{macrocode} {\int_compare:nNnT \l_@@_pos_of_arrow_int = {-1} {\int_compare:nNnT \l_@@_initial_int = \l_@@_first_line_of_group_int - {\seq_put_left:Nx \l_@@_first_arrows_of_group_seq - {\int_use:N \l_@@_arrow_int}} + {\seq_put_left:NV \l_@@_first_arrows_of_group_seq \l_@@_arrow_int} \int_compare:nNnTF \l_@@_final_int > \l_@@_last_line_of_group_int {\int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int \seq_clear:N \l_@@_last_arrows_of_group_seq - \seq_put_left:Nx \l_@@_last_arrows_of_group_seq - {\int_use:N \l_@@_arrow_int}} + \seq_put_left:NV \l_@@_last_arrows_of_group_seq \l_@@_arrow_int} {\int_compare:nNnT \l_@@_final_int = \l_@@_last_line_of_group_int - {\seq_put_left:Nx \l_@@_last_arrows_of_group_seq - {\int_use:N \l_@@_arrow_int}}}}} + {\seq_put_left:NV \l_@@_last_arrows_of_group_seq \l_@@_arrow_int}}}} % \end{macrocode} % % \bigskip % If the arrow is not independant, we update the current $x$-value (in |\l_@@_x_dim|) with the dedicated command -% |\@@_update_x_value:nn|. If we are in option |group| and in the second step of treatment (|\l_@@_pos_arrows_int| +% |\@@_update_x_value:nn|. If we are in option |group| and in the second step of treatment (|\l_@@_pos_arrow_int| % = 8), we don't initialize |\l_@@_x_dim| because we want to use the same value of |\l_@@_x_dim| (computed during % the first step) for all the groups. % \begin{macrocode} \int_compare:nNnT \l_@@_pos_of_arrow_int = {-1} - { \int_compare:nT {\l_@@_pos_arrows_int != 8} + { \int_compare:nT {\l_@@_pos_arrow_int != 8} {\@@_update_x_value:nn \l_@@_initial_int \l_@@_final_int}} } % \end{macrocode} % @@ -3769,10 +3855,10 @@ version 2005/12/01 or later. % % \bigskip % After the last arrow of the environment, we have to draw the last group of arrows. If we are in option |group| -% and in the first step of treatment (|\l_@@_pos_arrows_int| = 7), we don't draw because, in the first step, we don't +% and in the first step of treatment (|\l_@@_pos_arrow_int| = 7), we don't draw because, in the first step, we don't % draw anything. % \begin{macrocode} - \int_compare:nT {\l_@@_pos_arrows_int != 7} + \int_compare:nT {\l_@@_pos_arrow_int != 7} {\@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int} } % \end{macrocode} @@ -3857,13 +3943,13 @@ version 2005/12/01 or later. % % We retrieve the value of the field |position| of the current arrow. If the arrow has no option of position, the % value of this field is $-1$. If the arrow has a option of position, you modify the current value of -% |\l_@@_pos_arrows_int| to reflect this value. +% |\l_@@_pos_arrow_int| to reflect this value. % \begin{macrocode} \prop_get:cnN {g_@@_arrow_\l_@@_prefix_str _\int_use:N\l_@@_arrow_int _prop} {position} \l_tmpa_tl \int_set:Nn \l_tmpa_int \l_tmpa_tl \int_compare:nNnF \l_tmpa_int = {-1} - {\int_set_eq:NN \l_@@_pos_arrows_int \l_tmpa_int} + {\int_set_eq:NN \l_@@_pos_arrow_int \l_tmpa_int} % \end{macrocode} % % We create two booleans to indicate the position of the initial node and final node of the arrow in cases of @@ -3871,7 +3957,7 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_set_false:N \l_@@_initial_r_bool \bool_set_false:N \l_@@_final_r_bool - \int_case:nn \l_@@_pos_arrows_int + \int_case:nn \l_@@_pos_arrow_int {0 {\bool_set_true:N \l_@@_final_r_bool} 2 {\bool_set_true:N \l_@@_initial_r_bool} 3 {\bool_set_true:N \l_@@_initial_r_bool @@ -3885,7 +3971,7 @@ version 2005/12/01 or later. % \toprule % option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\ % \midrule -% |\l_@@_pos_arrows_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\ +% |\l_@@_pos_arrow_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\ % \bottomrule % \end{tabular} \\ % \footnotesize The option |v| can be used only in |\Arrow| in |CodeAfter| (see below). @@ -3893,11 +3979,11 @@ version 2005/12/01 or later. % \end{center} % % \bigskip -% In case of option |i| at a local or global level (|\l_@@_pos_arrows_int| = 5), we have to compute the +% In case of option |i| at a local or global level (|\l_@@_pos_arrow_int| = 5), we have to compute the % $x$-value of the arrow (which is vertical). The computed $x$-value is stored in |\l_@@_x_dim| (the same variable % used when the option |group| or the option |groups| is used). % \begin{macrocode} - \int_compare:nNnT \l_@@_pos_arrows_int = 5 + \int_compare:nNnT \l_@@_pos_arrow_int = 5 { \dim_set:Nn \l_@@_x_dim {-\c_max_dim} \@@_update_x_value:nn \l_@@_initial_int \l_@@_final_int } % \end{macrocode} @@ -3937,7 +4023,7 @@ version 2005/12/01 or later. \seq_if_in:NxTF \l_@@_last_arrows_of_group_seq {\int_use:N \l_@@_arrow_int} {\bool_set_true:N \l_tmpb_bool} {\bool_set_false:N \l_tmpb_bool} - \int_compare:nNnT \l_@@_pos_arrows_int = 5 + \int_compare:nNnT \l_@@_pos_arrow_int = 5 {\bool_set_true:N \l_tmpa_bool \bool_set_true:N \l_tmpb_bool} % \end{macrocode} @@ -3956,7 +4042,7 @@ version 2005/12/01 or later. \begin{tikzpicture} [@@_standard] \tikz@scan@one@point\pgfutil@firstofone (\l_@@_initial_tl) \tl_gset:Nx \g_tmpa_tl - {\int_compare:nNnTF \l_@@_pos_arrows_int < 5 + {\int_compare:nNnTF \l_@@_pos_arrow_int < 5 { \dim_use:N \pgf@x } { \dim_use:N \l_@@_x_dim } , \bool_if:NTF \l_tmpa_bool @@ -3964,7 +4050,7 @@ version 2005/12/01 or later. { \dim_use:N \pgf@y } } \tikz@scan@one@point\pgfutil@firstofone (\l_@@_final_tl) \tl_gset:Nx \g_tmpb_tl - {\int_compare:nNnTF \l_@@_pos_arrows_int < 5 + {\int_compare:nNnTF \l_@@_pos_arrow_int < 5 { \dim_use:N \pgf@x } { \dim_use:N \l_@@_x_dim } , \bool_if:NTF \l_tmpb_bool @@ -3977,7 +4063,7 @@ version 2005/12/01 or later. % Eventually, we can draw the arrow with the code in |\l_@@_tikz_code_tl|. We recall that the value by default for % this token list is :\enskip ``\verb|\draw (#1) to node {#3} (#2) ;|''. This value can be modified % with the option |TikzCode|. We use the variant |\@@_draw_arrow:nno| of the macro |\@@_draw_arrow:nnn| because of -% the characters \emph{underscore} in the name |\l_tmpa_tl| : if the user uses the Tikz library |babel|, the third +% the characters \emph{underscore} in the name |\l_tmpa_tl|: if the user uses the Tikz library |babel|, the third % argument of the command |\@@_draw_arrow:nno| will be rescanned because this third argument will be in the % argument of a command |node| of an instruction |\draw| of Tikz... and we will have an error because of the % characters \emph{underscore}.\footnote{There were other solutions: use another name without \emph{underscore} @@ -4029,7 +4115,7 @@ version 2005/12/01 or later. \@@_tmpa:nnn {#1} {#2} {#3} } \cs_generate_variant:Nn \@@_draw_arrow:nnn {nno} % \end{macrocode} -% +% % \bigskip % If the option |wrap-lines| is used, we have to use a special version of |\l_@@_tikz_code_tl| (which corresponds % to the option |TikzCode|). @@ -4080,7 +4166,7 @@ version 2005/12/01 or later. % |groups|) and in |\@@_draw_arrows:nn| (for option |i|). % \begin{macrocode} \cs_new_protected:Nn \@@_update_x_value:nn - {\int_step_inline:nnnn {#1} 1 {#2} + {\int_step_inline:nnn {#1} {#2} {\begin{tikzpicture} [@@_standard] \tikz@scan@one@point\pgfutil@firstofone (##1-l) \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l_@@_x_dim \pgf@x } @@ -4091,7 +4177,7 @@ version 2005/12/01 or later. % % \bigskip % The command |\WithArrowsLastEnv| is not used by the package \pkg{witharrows}. It's only a facility given to the -% final user. It gives the number of the last environment |{WithArrows}| at level~$0$ (to the sens of the nested +% final user. It gives the number of the last environment |{WithArrows}| at level~$0$ (to the sense of the nested % environments). This macro is fully expandable and, thus, can be used directly in the name of a Tikz node. % \begin{macrocode} \cs_new:Npn \WithArrowsLastEnv {\int_use:N \g_@@_last_env_int} @@ -4128,9 +4214,9 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} -\NewDocumentCommand \@@_Arrow_code_after {O{} mmm O{}} - {\int_set:Nn \l_@@_pos_arrows_int 1 - \int_set:Nn \l_@@_previous_pos_arrows_int {-1} +\NewDocumentCommand \@@_Arrow_code_after {O{} mmm !O{}} + {\int_set:Nn \l_@@_pos_arrow_int 1 + \int_set:Nn \l_@@_previous_pos_arrow_int {-1} \group_begin: % \end{macrocode} % Even if |\Arrow| in |CodeAfter| has its own set of options (|WithArrows/CodeAfter|), we set the level of the @@ -4141,7 +4227,7 @@ version 2005/12/01 or later. {#1,#5,tikz={xshift = \l_@@_xoffset_dim}} \bool_set_false:N \l_@@_initial_r_bool \bool_set_false:N \l_@@_final_r_bool - \int_case:nn \l_@@_pos_arrows_int + \int_case:nn \l_@@_pos_arrow_int {0 {\bool_set_true:N \l_@@_initial_r_bool \bool_set_true:N \l_@@_final_r_bool} 2 {\bool_set_true:N \l_@@_initial_r_bool} @@ -4150,10 +4236,10 @@ version 2005/12/01 or later. % We test wether the two Tikz nodes |(#2-l)| and |(#3-l)| really exist. If not, the arrow won't be drawn. % \begin{macrocode} \cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-#2-l} - {\@@_error:nx {Wrong~line~specification~in~Arrow} {#2}} + {\@@_error:nx {Wrong~line~in~Arrow} {#2}} {\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-#3-l} - {\@@_error:nx {Wrong~line~specification~in~Arrow} {#3}} - {\int_compare:nNnTF \l_@@_pos_arrows_int = 4 + {\@@_error:nx {Wrong~line~in~Arrow} {#3}} + {\int_compare:nNnTF \l_@@_pos_arrow_int = 4 {\begin{tikzpicture} [@@_standard] \tikz@scan@one@point\pgfutil@firstofone(#2-l.south) \dim_set_eq:NN \l_tmpa_dim \pgf@x @@ -4173,7 +4259,7 @@ version 2005/12/01 or later. (#3-\bool_if:NTF\l_@@_final_r_bool rl .north) \tl_gset:Nx \g_tmpb_tl {\dim_use:N \pgf@x , \dim_use:N \pgf@y} \end{tikzpicture}} - \@@_draw_arrow:nnn {\g_tmpa_tl} {\g_tmpb_tl} {#4} }} + \@@_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl {#4} }} \group_end: } % \end{macrocode} @@ -4268,34 +4354,36 @@ version 2005/12/01 or later. % % \begin{macrocode} \msg_new:nnn {witharrows} - {Option~unknown} + {Unknown~option} {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~ meaningless~in~the~context.~If~you~go~on,~it~will~be~ignored.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {Third~column~in~an~environment~{WithArrows}} - {By~default,~an~environment~\{WithArrows\}~can~only~have~two~columns.~ - Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str - \str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~ - you~should~use~the~option~"MoreColumns"~at~a~global~level~or~for~ - an~environment.~However,~you~can~go~one~for~this~time.} + {Third~column~in~WithArrows} + {By~default,~an~environment~\{\l_@@_type_env_tl\}~can~only~have~ + two~columns.~Maybe~you~have~forgotten~a~ + \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~ + two~columns,~you~should~use~the~option~"MoreColumns"~at~a~global~ + level~or~for~ an~environment.~However,~you~can~go~one~for~ + this~time.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {Third~column~in~an~environment~{DispWithArrows}} - {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~ - have~two~columns.~If~you~go~on,~you~may~have~an~incorrect~output.} + {Third~column~in~DispWithArrows} + {An~environment~\{\l_@@_type_env_tl\}~can~only~have~two~columns.~ + Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ at~the~end~ + of~row~\int_use:N\g_@@_line_int.~If~you~go~on,~you~may~have~other~errors.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {The~option~"jump"~must~be~non~negative} + {Negative~value~for~jump} {You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~ - \token_to_str:N\Arrow.~ You~can~create~an~arrow~going~backwards~with~ - the~option~"<-"~of~Tikz.} + \l_@@_string_Arrow_for_messages_str.~ + You~can~create~an~arrow~going~backwards~with~ the~option~"<-"~of~Tikz.} % \end{macrocode} % % \begin{macrocode} @@ -4303,34 +4391,35 @@ version 2005/12/01 or later. {Too~few~lines~for~an~arrow} {An~arrow~specified~in~line~\int_use:N \l_@@_initial_int\ can't~be~drawn~ because~it~arrives~after~the~last~line~of~the~environment~(remind~that~ - the~command~\token_to_str:N\Arrow\ must~be~in~the~*start*~line~ - of~the~arrow).~If~you~go~on,~this~arrow~will~be~ignored.} + the~command~\l_@@_string_Arrow_for_messages_str.~ + must~be~in~the~*start*~line~of~the~arrow).~ + If~you~go~on,~this~arrow~will~be~ignored.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {{WithArrows}~used~outside~math~mode} - {The~environment~\{WithArrows\}~should~be~used~only~in~math~mode.~ + {WithArrows~outside~math~mode} + {The~environment~\{\l_@@_type_env_tl\}~should~be~used~only~in~math~mode.~ Nevertheless,~you~can~go~on.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {{DispWithArrows}~used~in~math~mode} - {The~environment~\{DispWithArrows\}~should~be~used~only~outside~math~mode.~ - If~you~go~on,~you~will~have~other~errors.} + {DispWithArrows~in~math~mode} + {The~environment~\{\l_@@_type_env_tl\}~should~be~used~only~ + outside~math~mode.~If~you~go~on,~you~will~have~other~errors.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {Two~options~are~incompatible} + {Incompatible~options} {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~ this~option~is~incompatible~or~redundant~with~the~option~" - \int_case:nn\l_@@_previous_pos_arrows_int - {0 {rr} + \int_case:nn\l_@@_previous_pos_arrow_int + {0 {lr} 1 {ll} 2 {rl} - 3 {lr} + 3 {rr} 4 {v} 5 {i} 6 {groups} @@ -4339,8 +4428,8 @@ version 2005/12/01 or later. \int_case:nn\l_@@_level_int {1 {command~\token_to_str:N\WithArrowsOptions} 2 {declaration~of~options~of~the~environment~ - \{\@currenvir\}} - 3 {command~\token_to_str:N\Arrow}}.~ + \{\l_@@_type_env_tl\}} + 3 {command~\l_@@_string_Arrow_for_messages_str}}.~ If~you~go~on,~I~will~use~the~option~"\tl_use:N\l_keys_key_tl".} % \end{macrocode} % @@ -4351,23 +4440,18 @@ version 2005/12/01 or later. {The~option~"\tl_use:N\l_keys_key_tl"~can't~be~used~here.~ If~you~go~on,~it~will~be~ignored.} % \end{macrocode} -% -% % % \begin{macrocode} \msg_new:nnn {witharrows} {Arrow~in~first~column} - {You~should~not~use~the~command~\token_to_str:N\Arrow\ - \str_if_eq:NNF \l_@@_CommandName_tl \l_tmpa_tl - {(renamed~in~\str_use:N \c_backslash_str - \tl_use:N \l_@@_CommandName_tl)~} - ~in~the~first~column~but~only~in~the~second~column.\\ + {You~should~not~use~the~command~\l_@@_string_Arrow_for_messages_str\ + in~the~first~column~but~only~in~the~second~column.\\ However~you~can~go~on~for~this~time.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {Wrong~line~specification~in~Arrow} + {Wrong~line~in~Arrow} {The~specification~of~line~"#1"~you~use~in~\token_to_str:N\Arrow\ ~doesn't~exist.\\ If~you~go~on,~the~arrow~will~be~ignored.} @@ -4380,7 +4464,6 @@ version 2005/12/01 or later. If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow.} % \end{macrocode} % -% % \begin{macrocode} \msg_new:nnn {witharrows} {Too~small~specification~for~MultiArrow} @@ -4397,28 +4480,27 @@ version 2005/12/01 or later. will~be~used~instead.} % \end{macrocode} % -% % \begin{macrocode} \msg_new:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} + {Command~not~allowed~in~DispWithArrows} {The~command~\token_to_str:N #1 - is~not~allowed~in~the~first~column~of~\{DispWithArrows\}~but~ + is~not~allowed~in~the~first~column~of~\{\l_@@_type_env_tl\}~but~ only~in~the~second~column.~If~you~go~on,~this~command~will~be~ignored.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} - {Command~not~allowed~in~{WithArrows}} - {The~command~\token_to_str:N #1 - is~not~allowed~in~\{WithArrows\}~but~is~allowed~in~the~second~ - column~of~\{DispWithArrows\}~If~you~go~on,~this~command~will~be~ignored.} + {Command~not~allowed~in~WithArrows} + {The~command~\token_to_str:N #1 is~not~allowed~in~\{\l_@@_type_env_tl\}~ + (it's~allowed~in~the~second~column~of~\{DispWithArrows\}).~If~you~go~on, + ~this~command~will~be~ignored.} % \end{macrocode} % % \begin{macrocode} \msg_new:nnn {witharrows} {Multiple~tags} {You~can't~use~twice~the~command~\token_to_str:N\tag\ - in~a~line~of~the~environment~\{\@currenvir\}.~If~you~go~on,~the~tag~ + in~a~line~of~the~environment~\{\l_@@_type_env_tl\}.~If~you~go~on,~the~tag~ '#1'~will~be~used.} % \end{macrocode} % @@ -4427,7 +4509,7 @@ version 2005/12/01 or later. \msg_new:nnn {witharrows} {Multiple~labels} {Normally,~we~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\@currenvir\}.~ + twice~in~a~line~of~the~environment~\{\l_@@_type_env_tl\}.~ However,~you~can~go~on.~ \bool_if:NT \c_@@_showlabels_loaded_bool {However,~only~the~last~label~will~be~shown~by~showlabels.~} @@ -4439,15 +4521,37 @@ version 2005/12/01 or later. \msg_new:nnn {witharrows} {Multiple~labels~with~cleveref} {Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\@currenvir\}.~ + twice~in~a~line~of~the~environment~\{\l_@@_type_env_tl\}.~ If~you~go~on,~you~may~have~undefined~references.} % \end{macrocode} +% +% +% \begin{macrocode} +\msg_new:nnn {witharrows} + {Inexistent~v-node} + {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.~If~you~go~on,~you~may~have~an~incorrect~output.} +% \end{macrocode} +% +% \begin{macrocode} +\msg_new:nnn {witharrows} + {Option~incompatible~with~group} + {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~while~ + you~are~using~the~option~" + \int_compare:nNnTF \l_@@_pos_arrow_int = 5 + {group} + {groups}".~ + It's~incompatible.~You~can~go~on~ignoring~this~option~ + "\tl_use:N\l_keys_key_tl"~but~you~should~correct~your~code.} +% \end{macrocode} +% % % \subsection{Environment \{CasesWithArrows\}} % % \begin{macrocode} \coffin_new:N \l_@@_halign_coffin -\NewDocumentEnvironment {CasesWithArrows} {m O{}} +\NewDocumentEnvironment {CasesWithArrows} {m !O{}} {\hbox_set:Nn \l_tmpa_box {$\left\{\vcenter to 1cm {} \right.$} \dim_zero_new:N \l_@@_delim_wd_dim \dim_set:Nn \l_@@_delim_wd_dim {\box_wd:N \l_tmpa_box} @@ -4461,7 +4565,7 @@ version 2005/12/01 or later. \clist_set:Nn \l_@@_tags_clist {all}}} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ \if_mode_math: - \@@_error:n {{DispWithArrows}~used~in~math~mode} + \@@_error:n {DispWithArrows~in~math~mode} \fi: \bool_set_true:N \l_@@_in_DispWithArrows_bool % @@ -4479,9 +4583,8 @@ version 2005/12/01 or later. {\cs_set_eq:NN \@@_old_label \label} \halign to \displaywidth \bgroup \int_gincr:N \g_@@_line_int - \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_first_column: + \cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow_first_column: \bool_set_true:N \l_@@_in_first_column_bool - \strut \bool_if:NT \l_@@_fleqn_bool {\skip_horizontal:n \l_@@_mathindent_dim} \hfil @@ -4510,10 +4613,10 @@ version 2005/12/01 or later. -\int_use:N\g_@@_line_int}} & ## \tabskip = \c_zero_skip - && \@@_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \@@_error:n {Third~column~in~DispWithArrows} \if_false: ## \fi: \cr} - {\clist_if_in:NnT {last} \l_@@_tags_clist + {\clist_if_in:NnT \l_@@_tags_clist {last} {\clist_set:Nn \l_@@_tags_clist {all}} \\ \egroup @@ -4560,14 +4663,31 @@ version 2005/12/01 or later. {\@@_error:nn {Key~already~defined} {#1}} {\keys_define:nn {WithArrows/General} {#1 .code:n = {\int_compare:nNnTF \l_@@_level_int < 3 - {\keys_set:nn {WithArrows/General} {#2}} - {\@@_error:n {Option~unknown}}}} -% \end{macrocode} -% We 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|. When the key |#1| + {\bool_set_eq:NN \l_tmpa_bool \l_@@_in_WithArrows_bool + \bool_set_eq:NN \l_tmpb_bool \l_@@_in_DispWithArrows_bool + \bool_set_false:N \l_@@_in_WithArrows_bool + \bool_set_false:N \l_@@_in_DispWithArrows_bool + \keys_set_known:nnN {WithArrows/General} {#2} \l_tmpa_tl + \keys_set_known:nVN {WithArrows/GlobalOrEnv} + \l_tmpa_tl \l_tmpb_tl + \bool_set_eq:NN \l_@@_in_WithArrows_bool \l_tmpa_bool + \bool_set_eq:NN \l_@@_in_DispWithArrows_bool \l_tmpb_bool} + {\@@_error:n {Unknown~option}}}} +% \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|. When the key~|#1| % will be used, the error will be raised again. % \begin{macrocode} \group_begin: + \msg_set:nnn {witharrows} + {Option~will~be~ignored} + {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~can't~be~ + used~in~\token_to_str:N\WithArrowsNewStyle.~If~you~go~on,~ + this~option~will~be~ignored~in~the~definition~of~style~'#1'.} + \msg_set:nnn {witharrows} + {Unknown~option} + {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown.~If~you~go~on,~ + this~option~will~be~ignored~in~the~definition~of~style~'#1'.} \WithArrowsOptions{#2} \group_end:} } % \end{macrocode} @@ -4579,7 +4699,93 @@ version 2005/12/01 or later. your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored.} % \end{macrocode} % +% +% \subsection{The options up and down} +% +% The options |up| and |down| are available for individual arrows. The corresponding code is given here. +% It is independant of the main code of the extension \pkg{witharrows}. +% +% This code is the only part of the code of \pkg{witharrows} which uses the package \pkg{varwidth} and also the +% Tikz library |calc|. That's why we have decided not to load this package and this library. If they are not +% loaded, the user will have an error only if he uses the option |up| or the option |down|. +% +% \medskip +% The token list |\c_@@_tikz_code_up_tl| is the value of |TikzCode| which will be used for an option |up|. +% \begin{macrocode} +\tl_set:Nn \c_@@_tikz_code_up_tl + {\draw[rounded~corners] + let \p1 = (#1), + \p2 = (#2) + in (\p1) -- node {\dim_set:Nn \l_tmpa_dim {\x2-\x1} + \begin{varwidth}\l_tmpa_dim + \raggedright + #3 + \end{varwidth}} + (\x2,\y1) -- (\p2) ;} +% \end{macrocode} +% +% \medskip +% Idem for the option |down|. +% \begin{macrocode} +\tl_set:Nn \c_@@_tikz_code_down_tl + {\draw[rounded~corners] + let \p1 = (#1), + \p2 = (#2) + in (\p1) -- (\x1,\y2) -- + node {\dim_set:Nn \l_tmpa_dim {\x1-\x2} + \begin{varwidth}\l_tmpa_dim + \raggedright + #3 + \end{varwidth}} + (\p2) ;} +% \end{macrocode} +% +% +% \bigskip +% \begin{macrocode} +\keys_define:nn {WithArrows/General} + {up .value_forbidden:n = true, + up .code:n = {\int_compare:nNnTF \l_@@_level_int = 3 + {\bool_if:NTF \c_@@_varwidth_loaded_bool + {\cs_if_exist:cTF {tikz@library@calc@loaded} + {\int_set:Nn \l_@@_pos_arrow_int 1 +% \end{macrocode} +% We have to set |\l_@@_wrap_lines_bool| to |false| because, otherwise, if the option |wrap_lines| is used at a +% higher level (global or environment), we will have a special affectation to TikzCode that will overwrite our affectation. +% \begin{macrocode} + \bool_set_false:N \l_@@_wrap_lines_bool + \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_up_tl} + {\@@_error:n {calc~not~loaded}}} + {\@@_error:n {varwidth~not~loaded}}} + {\@@_error:n {Unknown~option}}}, + down .value_forbidden:n = true, + down .code:n = {\int_compare:nNnTF \l_@@_level_int = 3 + {\bool_if:NTF \c_@@_varwidth_loaded_bool + {\cs_if_exist:cTF {tikz@library@calc@loaded} + {\int_set:Nn \l_@@_pos_arrow_int 1 + \bool_set_false:N \l_@@_wrap_lines_bool + \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_down_tl} + {\@@_error:n {calc~not~loaded}}} + {\@@_error:n {varwidth~not~loaded}}} + {\@@_error:n {Unknown~option}}}} +% \end{macrocode} % +% \begin{macrocode} +\msg_new:nnn {witharrows} + {varwidth~not~loaded} + {You~can't~use~the~option~"\l_keys_key_tl"~because~ + you~don't~have~loaded~the~package~ + varwidth.~If~you~go~on,~this~option~will~be~forgotten.} +% \end{macrocode} +% +% \begin{macrocode} +\msg_new:nnn {witharrows} + {calc~not~loaded} + {You~can't~use~the~option~"\l_keys_key_tl"~because~you~don't~have~loaded~the~ + Tikz~library~calc.You~should~add~"\token_to_str:N\usetikzlibrary{calc}" + ~in~your~preamble.~ + ~If~you~go~on,~this~option~will~be~forgotten.} +% \end{macrocode} % % \section{History} % @@ -4591,9 +4797,6 @@ version 2005/12/01 or later. % % Possibility of nested environments |{WithArrows}| % -% Better error messages -% -% Creation of a \textsc{dtx} file % % \subsection*{Changes between versions 1.1 and 1.2} % @@ -4608,8 +4811,6 @@ version 2005/12/01 or later. % % New options |ygap| and |ystart| for fine tuning. % -% Minor bugs. -% % \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 @@ -4682,14 +4883,33 @@ version 2005/12/01 or later. % 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 : +% has to use the option |adjust| with the value $0$~pt: % % \begin{Verbatim} % \WithArrowsOptions{adjust = 0pt} % \end{Verbatim} +% +% \subsection*{Changes between 1.13 et 1.14} +% +% New options |up| and |down| for the arrows. +% +% \smallskip +% Replacement of some options |O{}| in commands and environments defined with \pkg{xparse} by |!O{}| (because a +% recent version of \pkg{xparse} introduced the specifier |!| and modified the default behaviour of the last +% optional arguments: |//www.texdev.net/2018/04/21/xparse-optional-arguments-at-the-end|). +% +% \smallskip +% Modification of the code of |\WithArrowsNewStyle| following a correction of a bug in \pkg{l3keys} in the +% version of \pkg{l3kernel} of 2019/01/28. % -% \endinput +% New error message |Inexistent~v-node| to avoid a \pkg{pgf} error. % +% 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. +% +% +% +% \endinput % Local Variables: % TeX-fold-mode: nil -% End +% End: diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.ins b/Master/texmf-dist/source/latex/witharrows/witharrows.ins index 36e3de8aa20..6aad8b87f3e 100644 --- a/Master/texmf-dist/source/latex/witharrows/witharrows.ins +++ b/Master/texmf-dist/source/latex/witharrows/witharrows.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2017-2018 by F. Pantigny +%% Copyright (C) 2017-2019 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-2018 by F. Pantigny +Copyright (C) 2017-2019 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/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index e7809aa70b2..98375f94bd6 100644 --- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty @@ -6,7 +6,7 @@ %% %% witharrows.dtx (with options: `package') %% -%% Copyright (C) 2017-2018 by F. Pantigny +%% Copyright (C) 2017-2019 by F. Pantigny %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -18,24 +18,24 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.13} -\def\myfiledate{2018/12/31} +\def\myfileversion{1.14} +\def\myfiledate{2019/02/01} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} -\RequirePackage{expl3}[2018-01-01] +\RequirePackage{expl3}[2019/01/28] \RequirePackage{l3keys2e} \ProvidesExplPackage {witharrows} {\myfiledate} {\myfileversion} {Draws arrows for explanations on the right} -\RequirePackage{xparse} -\bool_new:N \g__wi_footnotehyper_bool -\bool_new:N \g__wi_footnote_bool -\int_new:N \l__wi_level_int +\RequirePackage{xparse}[2018-10-17] +\bool_new:N \g__wa_footnotehyper_bool +\bool_new:N \g__wa_footnote_bool +\int_new:N \l__wa_level_int \keys_define:nn {WithArrows/package} - {footnote .bool_gset:N = \g__wi_footnote_bool, - footnotehyper .bool_gset:N = \g__wi_footnotehyper_bool, + {footnote .bool_gset:N = \g__wa_footnote_bool, + footnotehyper .bool_gset:N = \g__wa_footnotehyper_bool, unknown .code:n = \msg_fatal:nn {witharrows} {Option~unknown~for~package}} \msg_new:nnn {witharrows} @@ -52,16 +52,16 @@ {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~ - within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~ + within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ of~the~package~footnotehyper.} \msg_new:nnn {witharrows} {footnotehyper~with~footnote~package} {You~can't~use~the~option~"footnotehyper"~because~the~package~ footnote~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~"footnote"~and~the~footnotes~ - within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~ + within~the~environments~of~withArrows~will~be~extracted~with~the~tools~ of~the~package~footnote.} -\bool_if:NT \g__wi_footnote_bool +\bool_if:NT \g__wa_footnote_bool {\@ifclassloaded {beamer} {\msg_fatal:nn {witharrows} {Option~incompatible~with~Beamer}} @@ -71,7 +71,7 @@ {footnote~with~footnotehyper~package}} {} \usepackage{footnote}} -\bool_if:NT \g__wi_footnotehyper_bool +\bool_if:NT \g__wa_footnotehyper_bool {\@ifclassloaded {beamer} {\msg_fatal:nn {witharrows} {Option~incompatible~with~Beamer}} @@ -81,29 +81,30 @@ {footnotehyper~with~footnote~package}} {} \usepackage{footnotehyper} - \bool_gset_true:N \g__wi_footnote_bool} -\bool_new:N \c__wi_leqno_bool -\DeclareOption {leqno} {\bool_set_true:N \c__wi_leqno_bool} + \bool_gset_true:N \g__wa_footnote_bool} +\bool_new:N \c__wa_leqno_bool +\DeclareOption {leqno} {\bool_set_true:N \c__wa_leqno_bool} \DeclareOption* {} \ProcessOptions* -\cs_new_protected:Nn \__wi_error:n +\cs_new_protected:Nn \__wa_error:n {\msg_error:nn {witharrows} {#1}} -\cs_new_protected:Nn \__wi_error:nn +\cs_new_protected:Nn \__wa_error:nn {\msg_error:nnn {witharrows} {#1} {#2}} -\cs_generate_variant:Nn \__wi_error:nn {nx} -\cs_new_protected:Nn \__wi_bool_new:N +\cs_generate_variant:Nn \__wa_error:nn {nx} +\cs_new_protected:Nn \__wa_bool_new:N {\bool_if_exist:NTF #1 {\bool_set_false:N #1} {\bool_new:N #1}} \AtBeginDocument {\clist_map_inline:nn - {amsmath,mathtools,autonum,cleveref,hyperref,typedref,showlabels,amsthm} - {\bool_new:c {c__wi_#1_loaded_bool} + {amsmath,mathtools,autonum,cleveref,hyperref,typedref,showlabels, + amsthm,varwidth} + {\bool_new:c {c__wa_#1_loaded_bool} \@ifpackageloaded {#1} - {\bool_set_true:c {c__wi_#1_loaded_bool}} + {\bool_set_true:c {c__wa_#1_loaded_bool}} {}}} \cs_generate_variant:Nn \seq_set_split:Nnn {Nxx} -\cs_new_protected:Nn \__wi_save:N +\cs_new_protected:Nn \__wa_save:N {\seq_set_split:Nxx \l_tmpa_seq {\char_generate:nn {`_} {12}} {\cs_to_str:N #1} \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl \str_set:Nx \l_tmpa_str {\seq_item:Nn \l_tmpa_seq {-1}} @@ -113,22 +114,20 @@ {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } } \use:c {\l_tmpa_str _gset_eq:cN} {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1 } -\cs_new_protected:Nn \__wi_restore:N +\cs_new_protected:Nn \__wa_restore:N {\seq_set_split:Nxx \l_tmpa_seq {\char_generate:nn {`_} {12}} {\cs_to_str:N #1} \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl \str_set:Nx \l_tmpa_str {\seq_item:Nn \l_tmpa_seq {-1}} \use:c {\l_tmpa_str _set_eq:Nc} #1 {g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } } -\tikzset{__wi_node_style/.style= { - above = \l__wi_ystart_dim, +\tikzset{__wa_node_style/.style= { + above = \l__wa_ystart_dim, inner~sep = 0 pt, minimum~width = 0pt, - minimum~height = \l__wi_ygap_dim, - red, - \bool_if:NT \l__wi_shownodes_bool {draw} }} -\tikzset{__wi_standard/.style= { remember~picture, + minimum~height = \l__wa_ygap_dim}} +\tikzset{__wa_standard/.style= { remember~picture, overlay, - name~prefix = wa-\l__wi_prefix_str- }} + name~prefix = wa-\l__wa_prefix_str-}} \tikzset{WithArrows/arrow/tips/.style = { > = {Straight~Barb[scale=1.2,bend]} }} \tikzset{WithArrows/arrow/.style = { align = left, auto = left, @@ -137,354 +136,361 @@ bend~left = 45, -> }} \AtBeginDocument - {\bool_if:NF \c__wi_amsmath_loaded_bool + {\bool_if:NF \c__wa_amsmath_loaded_bool {\cs_set_protected:Npn \spread@equation {\openup\jot \cs_set_eq:NN \spread@equation \prg_do_nothing:}}} -\bool_new:N \l__wi_in_WithArrows_bool -\bool_new:N \l__wi_in_DispWithArrows_bool -\seq_new:N \g__wi_position_in_the_tree_seq -\seq_gput_right:Nn \g__wi_position_in_the_tree_seq 1 -\int_new:N \g__wi_last_env_int -\skip_new:N \l__wi_interline_skip -\int_new:N \l__wi_pos_env_int -\dim_new:N \l__wi_xoffset_dim -\dim_set:Nn \l__wi_xoffset_dim {3mm} -\int_new:N \l__wi_pos_arrows_int -\int_set:Nn \l__wi_pos_arrows_int 3 -\int_new:N \l__wi_previous_pos_arrows_int -\dim_new:N \l__wi_x_dim -\seq_new:N \g__wi_arrow_int_seq -\int_new:N \g__wi_arrow_int -\seq_new:N \g__wi_line_int_seq -\int_new:N \g__wi_line_int -\tl_new:N \l__wi_name_tl -\bool_new:N \l__wi_fleqn_bool -\dim_new:N \l__wi_mathindent_dim -\dim_set:Nn \l__wi_mathindent_dim {25pt} -\bool_new:N \l__wi_wrap_lines_bool -\clist_new:N \l__wi_tags_clist -\clist_set:Nn \l__wi_tags_clist {all} -\tl_new:N \l__wi_tag_tl -\bool_new:N \l__wi_tag_star_bool -\bool_new:N \l__wi_in_first_column_bool -\bool_new:N \l__wi_initial_r_bool -\bool_new:N \l__wi_initial_l_bool -\dim_new:N \l__wi_start_adjust_dim -\dim_set:Nn \l__wi_start_adjust_dim {0.4ex} -\dim_new:N \l__wi_end_adjust_dim -\dim_set:Nn \l__wi_end_adjust_dim {0.4ex} -\int_set:Nn \l__wi_level_int 1 +\bool_new:N \l__wa_in_WithArrows_bool +\bool_new:N \l__wa_in_DispWithArrows_bool +\seq_new:N \g__wa_position_in_the_tree_seq +\seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1 +\int_new:N \g__wa_last_env_int +\skip_new:N \l__wa_interline_skip +\int_new:N \l__wa_pos_env_int +\dim_new:N \l__wa_xoffset_dim +\dim_set:Nn \l__wa_xoffset_dim {3mm} +\int_new:N \l__wa_pos_arrow_int +\int_set:Nn \l__wa_pos_arrow_int 3 +\int_new:N \l__wa_previous_pos_arrow_int +\dim_new:N \l__wa_x_dim +\seq_new:N \g__wa_arrow_int_seq +\int_new:N \g__wa_arrow_int +\seq_new:N \g__wa_line_int_seq +\int_new:N \g__wa_line_int +\tl_new:N \l__wa_name_tl +\bool_new:N \l__wa_fleqn_bool +\dim_new:N \l__wa_mathindent_dim +\dim_set:Nn \l__wa_mathindent_dim {25pt} +\bool_new:N \l__wa_wrap_lines_bool +\clist_new:N \l__wa_tags_clist +\clist_set:Nn \l__wa_tags_clist {all} +\tl_new:N \l__wa_tag_tl +\bool_new:N \l__wa_tag_star_bool +\bool_new:N \l__wa_in_first_column_bool +\bool_new:N \l__wa_initial_r_bool +\bool_new:N \l__wa_initial_l_bool +\dim_new:N \l__wa_start_adjust_dim +\dim_set:Nn \l__wa_start_adjust_dim {0.4ex} +\dim_new:N \l__wa_end_adjust_dim +\dim_set:Nn \l__wa_end_adjust_dim {0.4ex} +\str_new:N \l__wa_CommandName_str +\str_set:Nn \l__wa_CommandName_str {Arrow} +\str_new:N \l__wa_string_Arrow_for_messages_str +\str_set:Nx \l__wa_string_Arrow_for_messages_str {\token_to_str:N \Arrow} +\int_set:Nn \l__wa_level_int 1 \keys_define:nn {WithArrows/GlobalOrEnv} - { t .code:n = {\bool_if:NTF \l__wi_in_DispWithArrows_bool - {\__wi_error:n {Option~will~be~ignored} - {\int_set:Nn \l__wi_pos_env_int 0}}}, + { t .code:n = {\bool_if:NTF \l__wa_in_DispWithArrows_bool + {\__wa_error:n {Option~will~be~ignored} + {\int_set:Nn \l__wa_pos_env_int 0}}}, t .value_forbidden:n = true, - c .code:n = {\bool_if:NTF \l__wi_in_DispWithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} - {\int_set:Nn \l__wi_pos_env_int 1}}, + c .code:n = {\bool_if:NTF \l__wa_in_DispWithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} + {\int_set:Nn \l__wa_pos_env_int 1}}, c .value_forbidden:n = true, - b .code:n = {\bool_if:NTF \l__wi_in_DispWithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} - {\int_set:Nn \l__wi_pos_env_int 2}}, + b .code:n = {\bool_if:NTF \l__wa_in_DispWithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} + {\int_set:Nn \l__wa_pos_env_int 2}}, b .value_forbidden:n = true, - ygap .dim_set:N = \l__wi_ygap_dim, + ygap .dim_set:N = \l__wa_ygap_dim, ygap .value_required:n = true, ygap .initial:n = 0.4 ex, - ystart .dim_set:N = \l__wi_ystart_dim, + ystart .dim_set:N = \l__wa_ystart_dim, ystart .value_required:n = true, ystart .initial:n = 0.4 ex, - MoreColumns .code:n = { \msg_redirect_name:nnn - {witharrows} - {Third~column~in~an~environment~{WithArrows}} - {none} }, + MoreColumns .code:n = { \bool_if:NTF \l__wa_in_DispWithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} + { \msg_redirect_name:nnn + {witharrows} + {Third~column~in~WithArrows} + {none} }}, MoreColumns .value_forbidden:n = true, - AllowLineWithoutAmpersand .code:n = { \__wi_error:n + AllowLineWithoutAmpersand .code:n = { \__wa_error:n {AllowLineWithoutAmpersand}}, AllowLineWithoutAmpersand .value_forbidden:n = true, - CommandName .tl_set:N = \l__wi_CommandName_tl, - CommandName .initial:n = Arrow , + CommandName .code:n = + {\str_set:Nn \l__wa_CommandName_str {#1} + \str_set:Nx \l__wa_string_Arrow_for_messages_str + {\c_backslash_str Arrow~(renamed~here~in~\c_backslash_str #1)}}, CommandName .value_required:n = true, - TikzCode .tl_set:N = \l__wi_tikz_code_tl, + TikzCode .tl_set:N = \l__wa_tikz_code_tl, TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , TikzCode .value_required:n = true, - displaystyle .bool_set:N = \l__wi_displaystyle_bool, + displaystyle .bool_set:N = \l__wa_displaystyle_bool, displaystyle .initial:n = false, - shownodes .bool_set:N = \l__wi_shownodes_bool, - shownodes .initial:n = false, - shownodenames .bool_set:N = \l__wi_shownodenames_bool, + shownodes .code:n = {\tikzset{__wa_node_style/.append~style = {draw,red}}}, + shownodes .value_forbidden:n = true, + shownodenames .bool_set:N = \l__wa_shownodenames_bool, shownodenames .initial:n = false, - group .code:n = {\int_compare:nNnT \l__wi_previous_pos_arrows_int > {-1} - {\__wi_error:n {Two~options~are~incompatible}} - \int_set:Nn \l__wi_previous_pos_arrows_int 7 - \int_set:Nn \l__wi_pos_arrows_int 7} , + group .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrow_int > {-1} + {\__wa_error:n {Incompatible~options}} + \int_set:Nn \l__wa_previous_pos_arrow_int 7 + \int_set:Nn \l__wa_pos_arrow_int 7} , group .value_forbidden:n = true, - groups .code:n = {\int_compare:nNnT \l__wi_previous_pos_arrows_int > {-1} - {\__wi_error:n {Two~options~are~incompatible}} - \int_set:Nn \l__wi_previous_pos_arrows_int 6 - \int_set:Nn \l__wi_pos_arrows_int 6} , + groups .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrow_int > {-1} + {\__wa_error:n {Incompatible~options}} + \int_set:Nn \l__wa_previous_pos_arrow_int 6 + \int_set:Nn \l__wa_pos_arrow_int 6} , groups .value_forbidden:n = true, - CodeBefore .code:n = {\int_compare:nNnTF \l__wi_level_int = 1 - {\__wi_error:n {Option~will~be~ignored}} - {\tl_put_right:Nn \l__wi_code_before_tl {#1}}} , + CodeBefore .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 + {\__wa_error:n {Option~will~be~ignored}} + {\tl_put_right:Nn \l__wa_code_before_tl {#1}}} , CodeBefore .value_required:n = true, - CodeAfter .code:n = {\int_compare:nNnTF \l__wi_level_int = 1 - {\__wi_error:n {Option~will~be~ignored}} - {\tl_put_right:Nn \l__wi_code_after_tl {#1}}} , + CodeAfter .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 + {\__wa_error:n {Option~will~be~ignored}} + {\tl_put_right:Nn \l__wa_code_after_tl {#1}}} , CodeAfter .value_required:n = true, - name .code:n = {\int_compare:nNnTF \l__wi_level_int = 1 - {\__wi_error:n {Option~will~be~ignored}} - {\tl_set:Nn \l__wi_name_tl {#1}}} , + name .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 + {\__wa_error:n {Option~will~be~ignored}} + {\tl_set:Nn \l__wa_name_tl {#1}}} , name .value_required:n = true, - fleqn .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} + fleqn .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} {\str_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wi_fleqn_bool} - {\bool_set_false:N \l__wi_fleqn_bool}}}, + {\bool_set_true:N \l__wa_fleqn_bool} + {\bool_set_false:N \l__wa_fleqn_bool}}}, fleqn .default:n = true, - mathindent .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} - {\dim_set:Nn \l__wi_mathindent_dim {#1}}}, + mathindent .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} + {\dim_set:Nn \l__wa_mathindent_dim {#1}}}, mathindent .value_required:n = true, - notag .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} + notag .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} {\str_if_eq:nnTF {#1} {true} - {\clist_clear:N \l__wi_tags_clist} - {\clist_set:Nn \l__wi_tags_clist {all}}}}, + {\clist_clear:N \l__wa_tags_clist} + {\clist_set:Nn \l__wa_tags_clist {all}}}}, notag .default:n = true, nonumber .meta:n = notag, - AllowMultipleLabels .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} + AllowMultipleLabels .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} {\msg_redirect_name:nnn {witharrows} {Multiple~labels} {none}}}, AllowMultipleLabels .value_forbidden:n = true, - wrap-lines .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} + wrap-lines .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} {\str_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wi_wrap_lines_bool} - {\bool_set_false:N \l__wi_wrap_lines_bool}}}, + {\bool_set_true:N \l__wa_wrap_lines_bool} + {\bool_set_false:N \l__wa_wrap_lines_bool}}}, wrap-lines .default:n = true, - tagged-lines .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:n {Option~will~be~ignored}} - {\clist_set:Nn \l__wi_tags_clist {#1} - \clist_if_in:NnT \l__wi_tags_clist {first} - {\clist_remove_all:Nn \l__wi_tags_clist {first} - \clist_put_left:Nn \l__wi_tags_clist 1 }}}, + tagged-lines .code:n = {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:n {Option~will~be~ignored}} + {\clist_set:Nn \l__wa_tags_clist {#1} + \clist_if_in:NnT \l__wa_tags_clist {first} + {\clist_remove_all:Nn \l__wa_tags_clist {first} + \clist_put_left:Nn \l__wa_tags_clist 1 }}}, tagged-lines .value_required:n = true, - unknown .code:n = \__wi_error:n {Option~unknown} + unknown .code:n = \__wa_error:n {Unknown~option} } \keys_define:nn {WithArrows/General} {tikz .code:n = \tikzset {WithArrows/arrow/.append~style = {#1}}, tikz .initial:n = {}, tikz .value_required:n = true, rr .value_forbidden:n = true, - rr .code:n = \__wi_analyze_option_position:n 3 , + rr .code:n = \__wa_analyze_option_position:n 3 , ll .value_forbidden:n = true, - ll .code:n = \__wi_analyze_option_position:n 1 , + ll .code:n = \__wa_analyze_option_position:n 1 , rl .value_forbidden:n = true, - rl .code:n = \__wi_analyze_option_position:n 2 , + rl .code:n = \__wa_analyze_option_position:n 2 , lr .value_forbidden:n = true, - lr .code:n = \__wi_analyze_option_position:n 0 , + lr .code:n = \__wa_analyze_option_position:n 0 , i .value_forbidden:n = true, - i .code:n = \__wi_analyze_option_position:n 5 , - xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__wi_level_int = 3 && - \int_compare_p:nNn \l__wi_pos_arrows_int > 5} - {\__wi_error:n {Option~incompatible~with~"group(s)"}} - {\dim_set:Nn \l__wi_xoffset_dim {#1}}} , + i .code:n = \__wa_analyze_option_position:n 5 , + xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__wa_level_int = 3 && + \int_compare_p:nNn \l__wa_pos_arrow_int > 5} + {\__wa_error:n {Option~incompatible~with~group}} + {\dim_set:Nn \l__wa_xoffset_dim {#1}}} , xoffset .value_required:n = true, - jot .code:n = {\int_compare:nNnTF \l__wi_level_int = 2 + jot .code:n = {\int_compare:nNnTF \l__wa_level_int = 2 {\dim_set:Nn \jot {#1}} - {\__wi_error:n {Option~will~be~ignored}}} , + {\__wa_error:n {Option~will~be~ignored}}} , jot .value_required:n = true, - interline .code:n = {\int_compare:nNnTF \l__wi_level_int = 2 - {\skip_set:Nn \l__wi_interline_skip {#1}} - {\__wi_error:n {Option~will~be~ignored}}} , + interline .code:n = {\int_compare:nNnTF \l__wa_level_int = 2 + {\skip_set:Nn \l__wa_interline_skip {#1}} + {\__wa_error:n {Option~will~be~ignored}}} , interline .value_required:n = true, - start-adjust .dim_set:N = \l__wi_start_adjust_dim, + start-adjust .dim_set:N = \l__wa_start_adjust_dim, start-adjust .value_required:n = true, - end-adjust .dim_set:N = \l__wi_end_adjust_dim, + end-adjust .dim_set:N = \l__wa_end_adjust_dim, end-adjust .value_required:n = true, - adjust .code:n = {\dim_set:Nn \l__wi_start_adjust_dim {#1} - \dim_set:Nn \l__wi_end_adjust_dim {#1} }, + adjust .code:n = {\dim_set:Nn \l__wa_start_adjust_dim {#1} + \dim_set:Nn \l__wa_end_adjust_dim {#1} }, adjust .value_required:n = true, - jump .code:n = {\int_compare:nNnF \l__wi_level_int = 3 - {\__wi_error:n {Option~will~be~ignored}}} , - unknown .code:n = \__wi_error:n {Option~unknown} + unknown .code:n = \__wa_error:n {Unknown~option} } \keys_define:nn {WithArrows/Arrow} - {jump .code:n = {\int_set:Nn \l__wi_jump_int {#1} - \int_compare:nNnF \l__wi_jump_int > 0 - {\__wi_error:n {The~option~"jump"~must~be~non~negative}}} , + {jump .code:n = {\int_set:Nn \l__wa_jump_int {#1} + \int_compare:nNnF \l__wa_jump_int > 0 + {\__wa_error:n {Negative~value~for~jump}}} , jump .value_required:n = true, rr .value_forbidden:n = true, - rr .code:n = \__wi_analyze_option_position:n 3 , + rr .code:n = \__wa_analyze_option_position:n 3 , ll .value_forbidden:n = true, - ll .code:n = \__wi_analyze_option_position:n 1 , + ll .code:n = \__wa_analyze_option_position:n 1 , rl .value_forbidden:n = true, - rl .code:n = \__wi_analyze_option_position:n 2 , + rl .code:n = \__wa_analyze_option_position:n 2 , lr .value_forbidden:n = true, - lr .code:n = \__wi_analyze_option_position:n 0 , + lr .code:n = \__wa_analyze_option_position:n 0 , i .value_forbidden:n = true, - i .code:n = \__wi_analyze_option_position:n 5 } -\cs_new_protected:Nn \__wi_analyze_option_position:n - {\int_compare:nNnT \l__wi_previous_pos_arrows_int > {-1} - {\__wi_error:n {Two~options~are~incompatible}} - \int_set:Nn \l__wi_previous_pos_arrows_int {#1} - \int_set:Nn \l__wi_pos_arrows_int {#1}} + i .code:n = \__wa_analyze_option_position:n 5 } +\cs_new_protected:Nn \__wa_analyze_option_position:n + {\int_compare:nNnT \l__wa_previous_pos_arrow_int > {-1} + {\__wa_error:n {Incompatible~options}} + \int_set:Nn \l__wa_previous_pos_arrow_int {#1} + \int_set:Nn \l__wa_pos_arrow_int {#1}} \NewDocumentCommand \WithArrowsOptions {m} - {\int_set:Nn \l__wi_previous_pos_arrows_int {-1} + {\int_set:Nn \l__wa_previous_pos_arrow_int {-1} \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl} -\NewDocumentCommand \__wi_Arrow {O{} m O{}} +\NewDocumentCommand \__wa_Arrow {O{} m !O{}} { - \int_gincr:N \g__wi_arrow_int - \int_set:Nn \l__wi_previous_pos_arrows_int {-1} - \int_set:Nn \l__wi_pos_arrows_int {-1} - \int_set:Nn \l__wi_level_int 3 + \int_gincr:N \g__wa_arrow_int + \int_set:Nn \l__wa_previous_pos_arrow_int {-1} + \int_set:Nn \l__wa_pos_arrow_int {-1} + \int_set:Nn \l__wa_level_int 3 \keys_set_known:nnN {WithArrows/Arrow} {#1,#3} \l_tmpa_tl - \prop_put:NnV \l_tmpa_prop {initial} \g__wi_line_int - \int_set:Nn \l_tmpa_int {\g__wi_line_int + \l__wi_jump_int} + \prop_put:NnV \l_tmpa_prop {initial} \g__wa_line_int + \int_set:Nn \l_tmpa_int {\g__wa_line_int + \l__wa_jump_int} \prop_put:NnV \l_tmpa_prop {final} \l_tmpa_int - \prop_put:NnV \l_tmpa_prop {position} \l__wi_pos_arrows_int + \prop_put:NnV \l_tmpa_prop {position} \l__wa_pos_arrow_int \prop_put:NnV \l_tmpa_prop {options} \l_tmpa_tl \prop_put:Nnn \l_tmpa_prop {label} {#2} \prop_gclear_new:c - {g__wi_arrow_\l__wi_prefix_str _\int_use:N\g__wi_arrow_int _prop} + {g__wa_arrow_\l__wa_prefix_str _\int_use:N\g__wa_arrow_int _prop} \prop_gset_eq:cN - {g__wi_arrow_\l__wi_prefix_str _\int_use:N\g__wi_arrow_int _prop} + {g__wa_arrow_\l__wa_prefix_str _\int_use:N\g__wa_arrow_int _prop} \l_tmpa_prop } -\cs_new_protected:Nn \__wi_Arrow_first_column: - {\tl_set:Nn \l_tmpa_tl {Arrow} - \__wi_error:n {Arrow~in~first~column} - \__wi_Arrow} -\cs_new_protected:Nn \__wi_pre_environment:n - { \seq_gput_right:NV \g__wi_arrow_int_seq \g__wi_arrow_int - \int_gzero:N \g__wi_arrow_int - \seq_gput_right:NV \g__wi_line_int_seq \g__wi_line_int - \int_gzero:N \g__wi_line_int - \seq_gput_right:Nn \g__wi_position_in_the_tree_seq 1 - \seq_set_eq:NN \l_tmpa_seq \g__wi_position_in_the_tree_seq +\cs_new_protected:Nn \__wa_Arrow_first_column: + {\__wa_error:n {Arrow~in~first~column} + \__wa_Arrow} +\cs_new_protected:Nn \__wa_pre_environment:n + { \tl_clear_new:N \l__wa_type_env_tl + \tl_set:NV \l__wa_type_env_tl \@currenvir + \seq_gput_right:NV \g__wa_arrow_int_seq \g__wa_arrow_int + \int_gzero:N \g__wa_arrow_int + \seq_gput_right:NV \g__wa_line_int_seq \g__wa_line_int + \int_gzero:N \g__wa_line_int + \seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1 + \seq_set_eq:NN \l_tmpa_seq \g__wa_position_in_the_tree_seq \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl - \str_clear_new:N \l__wi_prefix_str - \str_set:Nx \l__wi_prefix_str {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}} - \cs_set_eq:NN \\ \__wi_cr: + \str_clear_new:N \l__wa_prefix_str + \str_set:Nx \l__wa_prefix_str {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}} + \cs_set_eq:NN \\ \__wa_cr: \dim_zero:N \mathsurround - \int_zero_new:N \l__wi_initial_int - \int_zero_new:N \l__wi_final_int - \int_zero_new:N \l__wi_arrow_int - \int_zero_new:N \l__wi_pos_of_arrow_int - \int_zero_new:N \l__wi_jump_int - \int_set:Nn \l__wi_jump_int 1 - \seq_clear_new:N \l__wi_labels_seq - \__wi_bool_new:N \l__wi_tag_next_line_bool - \skip_zero:N \l__wi_interline_skip - \tl_clear_new:N \l__wi_code_before_tl - \tl_clear_new:N \l__wi_code_after_tl - \int_set:Nn \l__wi_previous_pos_arrows_int {-1} - \int_set:Nn \l__wi_level_int 2 + \int_zero_new:N \l__wa_initial_int + \int_zero_new:N \l__wa_final_int + \int_zero_new:N \l__wa_arrow_int + \int_zero_new:N \l__wa_pos_of_arrow_int + \int_zero_new:N \l__wa_jump_int + \int_set:Nn \l__wa_jump_int 1 + \seq_clear_new:N \l__wa_labels_seq + \__wa_bool_new:N \l__wa_tag_next_line_bool + \skip_zero:N \l__wa_interline_skip + \tl_clear_new:N \l__wa_code_before_tl + \tl_clear_new:N \l__wa_code_after_tl + \int_set:Nn \l__wa_previous_pos_arrow_int {-1} + \int_set:Nn \l__wa_level_int 2 \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl - \bool_if:NT \g__wi_footnote_bool \savenotes - \l__wi_code_before_tl - \cs_set_eq:cN \l__wi_CommandName_tl \__wi_Arrow} -\NewDocumentEnvironment {WithArrows} {O{}} - { \bool_set_true:N \l__wi_in_WithArrows_bool - \bool_set_false:N \l__wi_in_DispWithArrows_bool + \bool_if:NT \g__wa_footnote_bool \savenotes + \l__wa_code_before_tl + \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow} +\NewDocumentEnvironment {WithArrows} {!O{}} + { \bool_set_true:N \l__wa_in_WithArrows_bool + \bool_set_false:N \l__wa_in_DispWithArrows_bool + \__wa_pre_environment:n {#1} \reverse_if:N \if_mode_math: - \__wi_error:n {{WithArrows}~used~outside~math~mode} + \__wa_error:n {WithArrows~outside~math~mode} \fi: - \__wi_pre_environment:n {#1} - \cs_set_eq:NN \notag \__wi_notag: - \cs_set_eq:NN \nonumber \__wi_notag: - \cs_set_eq:NN \tag \__wi_tag - \cs_set_eq:NN \label \__wi_label:n - \cs_set_eq:NN \tagnextline \__wi_tagnextline: - \int_case:nn \l__wi_pos_env_int + \cs_set_eq:NN \notag \__wa_notag: + \cs_set_eq:NN \nonumber \__wa_notag: + \cs_set_eq:NN \tag \__wa_tag + \cs_set_eq:NN \label \__wa_label:n + \cs_set_eq:NN \tagnextline \__wa_tagnextline: + \int_case:nn \l__wa_pos_env_int {0 \vtop 1 \vcenter 2 \vbox} \bgroup \spread@equation \ialign\bgroup - \int_gincr:N \g__wi_line_int - \cs_set_eq:cN \l__wi_CommandName_tl \__wi_Arrow_first_column: - \bool_set_true:N \l__wi_in_first_column_bool + \int_gincr:N \g__wa_line_int + \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column: + \bool_set_true:N \l__wa_in_first_column_bool \strut\hfil - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {##}$ + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ & - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {{}##}$ + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ \tikz [remember~picture,overlay] - \node [__wi_node_style, - name = wa-\l__wi_prefix_str-\int_use:N\g__wi_line_int-l, - alias = {\tl_if_empty:NF \l__wi_name_tl - {\l__wi_name_tl-\int_use:N\g__wi_line_int-l}} ] {} ; + \node [__wa_node_style, + name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l, + alias = {\tl_if_empty:NF \l__wa_name_tl + {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \node [__wi_node_style, - name = wa-\l__wi_prefix_str-\int_use:N\g__wi_line_int-r, - alias = {\tl_if_empty:NF \l__wi_name_tl - {\l__wi_name_tl-\int_use:N\g__wi_line_int-r}} ] {} ; - \bool_if:NT \l__wi_shownodenames_bool - {\hbox_overlap_right:n {\small wa-\l__wi_prefix_str - -\int_use:N\g__wi_line_int}} - && \__wi_error:n {Third~column~in~an~environment~{WithArrows}} - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {##}$ + \node [__wa_node_style, + name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r, + alias = {\tl_if_empty:NF \l__wa_name_tl + {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ; + \bool_if:NT \l__wa_shownodenames_bool + {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str + -\int_use:N\g__wa_line_int}} + && \__wa_error:n {Third~column~in~WithArrows} + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ \cr } {\\ \egroup \egroup - \__wi_post_environment: - \bool_if:NT \g__wi_footnote_bool \endsavenotes + \__wa_post_environment: + \bool_if:NT \g__wa_footnote_bool \endsavenotes } -\cs_new_protected:Nn \__wi_post_environment: - {\cs_set:Npn \WithArrowsRightX {\g__wi_right_x_dim} - \int_compare:nNnT \g__wi_arrow_int > 0 \__wi_scan_arrows: +\cs_new_protected:Nn \__wa_post_environment: + {\cs_set:Npn \WithArrowsRightX {\g__wa_right_x_dim} + \int_compare:nNnT \g__wa_arrow_int > 0 \__wa_scan_arrows: \group_begin: - \tikzset{every~picture/.style = __wi_standard} - \cs_set:Npn \WithArrowsNbLines {\int_use:N \g__wi_line_int} - \cs_set_eq:NN \MultiArrow \__wi_MultiArrow:nn - \cs_set_eq:cN \l__wi_CommandName_tl \__wi_Arrow_code_after - \l__wi_code_after_tl + \tikzset{every~picture/.style = __wa_standard} + \cs_set:Npn \WithArrowsNbLines {\int_use:N \g__wa_line_int} + \cs_set_eq:NN \MultiArrow \__wa_MultiArrow:nn + \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_code_after + \l__wa_code_after_tl \group_end: - \seq_gpop_right:NN \g__wi_position_in_the_tree_seq \l_tmpa_tl - \seq_gpop_right:NN \g__wi_position_in_the_tree_seq \l_tmpa_tl - \seq_gput_right:Nx \g__wi_position_in_the_tree_seq + \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl + \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl + \seq_gput_right:Nx \g__wa_position_in_the_tree_seq {\int_eval:n {\l_tmpa_tl+1}} - \int_compare:nNnT {\seq_count:N \g__wi_position_in_the_tree_seq} = 1 - {\int_gincr:N \g__wi_last_env_int} - \seq_gpop_right:NN \g__wi_arrow_int_seq {\l_tmpa_tl} - \int_gset:Nn \g__wi_arrow_int {\l_tmpa_tl} - \seq_gpop_right:NN \g__wi_line_int_seq \l_tmpa_tl - \int_gset:Nn \g__wi_line_int {\l_tmpa_tl} + \int_compare:nNnT {\seq_count:N \g__wa_position_in_the_tree_seq} = 1 + {\int_gincr:N \g__wa_last_env_int} + \seq_gpop_right:NN \g__wa_arrow_int_seq {\l_tmpa_tl} + \int_gset:Nn \g__wa_arrow_int {\l_tmpa_tl} + \seq_gpop_right:NN \g__wa_line_int_seq \l_tmpa_tl + \int_gset:Nn \g__wa_line_int {\l_tmpa_tl} } -\cs_new_protected:Nn \__wi_cr: +\cs_new_protected:Nn \__wa_cr: {\scan_stop: - \bool_if:NT \l__wi_in_first_column_bool { & {} } + \bool_if:NT \l__wa_in_first_column_bool { & {} } \group_align_safe_begin: - \peek_meaning_remove:NTF * \__wi_cr_i: \__wi_cr_i:} -\cs_new_protected:Nn \__wi_cr_i: - {\peek_meaning:NTF [ {\__wi_cr_ii:} {\__wi_cr_ii:[\c_zero_dim]} } -\cs_new_protected:Npn \__wi_cr_ii:[#1] + \peek_meaning_remove:NTF * \__wa_cr_i: \__wa_cr_i:} +\cs_new_protected:Nn \__wa_cr_i: + {\peek_meaning:NTF [ {\__wa_cr_ii:} {\__wa_cr_ii:[\c_zero_dim]} } +\cs_new_protected:Npn \__wa_cr_ii:[#1] {\group_align_safe_end: - \bool_if:NT \l__wi_in_DispWithArrows_bool - {\clist_if_in:NnTF \l__wi_tags_clist {all} + \bool_if:NT \l__wa_in_DispWithArrows_bool + {\clist_if_in:NnTF \l__wa_tags_clist {all} { - \tl_if_empty:NT \l__wi_tag_tl + \tl_if_empty:NT \l__wa_tag_tl {\int_gincr:N \c@equation} \cs_gset:Npx \g_tmpa_tl - {\tl_if_empty:NTF \l__wi_tag_tl + {\tl_if_empty:NTF \l__wa_tag_tl \theequation - \l__wi_tag_tl} - \seq_if_empty:NF \l__wi_labels_seq + \l__wa_tag_tl} + \seq_if_empty:NF \l__wa_labels_seq { \cs_set:Npx \@currentlabel {\p@equation \g_tmpa_tl} - \bool_if:NT \c__wi_hyperref_loaded_bool + \bool_if:NT \c__wa_hyperref_loaded_bool {\cs_set:Npn \This@name {equation} \hyper@refstepcounter{equation}} - \bool_if:NT \c__wi_cleveref_loaded_bool + \bool_if:NT \c__wa_cleveref_loaded_bool {\cref@constructprefix{equation}{\cref@result} \@ifundefined{cref@equation@alias} {\def\@tempa{equation}} @@ -492,99 +498,99 @@ \protected@edef\cref@currentlabel {[\@tempa][\arabic{equation}][\cref@result] \p@equation \g_tmpa_tl}} - \bool_if:NT \c__wi_typedref_loaded_bool + \bool_if:NT \c__wa_typedref_loaded_bool {\cs_set:Npn \sr@name {equation}} - \seq_map_function:NN \l__wi_labels_seq \__wi_old_label} - \__wi_save:N \l__wi_tag_star_bool - \__wi_save:N \l__wi_qedhere_bool - \bool_if:NT \l__wi_tag_next_line_bool + \seq_map_function:NN \l__wa_labels_seq \__wa_old_label} + \__wa_save:N \l__wa_tag_star_bool + \__wa_save:N \l__wa_qedhere_bool + \bool_if:NT \l__wa_tag_next_line_bool { \openup -\jot - \bool_set_false:N \l__wi_tag_next_line_bool + \bool_set_false:N \l__wa_tag_next_line_bool \notag \\ & } - & \__wi_restore:N \l__wi_tag_star_bool - \__wi_restore:N \l__wi_qedhere_bool - \bool_if:NT \l__wi_qedhere_bool - {\hbox_overlap_left:n \__wi_qedhere_i:} + & \__wa_restore:N \l__wa_tag_star_bool + \__wa_restore:N \l__wa_qedhere_bool + \bool_if:NT \l__wa_qedhere_bool + {\hbox_overlap_left:n \__wa_qedhere_i:} \cs_set_eq:NN \theequation \g_tmpa_tl - \bool_if:NT \l__wi_tag_star_bool {\cs_set:Npn \tagform@ {}} + \bool_if:NT \l__wa_tag_star_bool {\cs_set:Npn \tagform@ {}} \hbox_overlap_left:n - {\bool_if:NF \c__wi_leqno_bool - {\tikz [__wi_standard] \coordinate (\int_use:N\g__wi_line_int-v) ;} + {\bool_if:NF \c__wa_leqno_bool + {\tikz [__wa_standard] \coordinate (\int_use:N\g__wa_line_int-v) ;} \quad \@eqnnum } - \bool_if:NT \c__wi_leqno_bool - {\tikz [__wi_standard] \coordinate (\int_use:N \g__wi_line_int-v) ;}} - {\__wi_save:N \l__wi_qedhere_bool - & \__wi_restore:N \l__wi_qedhere_bool - \bool_if:NT \l__wi_qedhere_bool - {\hbox_overlap_left:n \__wi_qedhere_i:} - \tikz [__wi_standard] \coordinate (\int_use:N\g__wi_line_int-v) ; } + \bool_if:NT \c__wa_leqno_bool + {\tikz [__wa_standard] \coordinate (\int_use:N \g__wa_line_int-v) ;}} + {\__wa_save:N \l__wa_qedhere_bool + & \__wa_restore:N \l__wa_qedhere_bool + \bool_if:NT \l__wa_qedhere_bool + {\hbox_overlap_left:n \__wa_qedhere_i:} + \tikz [__wa_standard] \coordinate (\int_use:N\g__wa_line_int-v) ; } } - \cr\noalign{\skip_vertical:n {#1 + \l__wi_interline_skip} + \cr\noalign{\skip_vertical:n {#1 + \l__wa_interline_skip} \scan_stop:}} -\cs_new_protected:Nn \__wi_if_in_second_col_of_disp:nn - {\bool_if:NTF \l__wi_in_WithArrows_bool - {\__wi_error:nn {Command~not~allowed~in~{WithArrows}} +\cs_new_protected:Nn \__wa_if_in_second_col_of_disp:nn + {\bool_if:NTF \l__wa_in_WithArrows_bool + {\__wa_error:nn {Command~not~allowed~in~WithArrows} {#1}} - {\bool_if:NTF \l__wi_in_first_column_bool - {\__wi_error:nn {Command~not~allowed~in~{DispWithArrows}} + {\bool_if:NTF \l__wa_in_first_column_bool + {\__wa_error:nn {Command~not~allowed~in~DispWithArrows} {#1}} {#2}}} -\cs_new_protected:Nn \__wi_notag: - {\__wi_if_in_second_col_of_disp:nn {\notag} - {\clist_clear:N \l__wi_tags_clist}} -\NewDocumentCommand \__wi_tag {sm} - {\__wi_if_in_second_col_of_disp:nn {\tag} - {\tl_if_empty:NF \l__wi_tag_tl - {\__wi_error:nn {Multiple~tags} {#2}} - \clist_set:Nn \l__wi_tags_clist {all} - \bool_if:nT \c__wi_mathtools_loaded_bool +\cs_new_protected:Nn \__wa_notag: + {\__wa_if_in_second_col_of_disp:nn {\notag} + {\clist_clear:N \l__wa_tags_clist}} +\NewDocumentCommand \__wa_tag {sm} + {\__wa_if_in_second_col_of_disp:nn {\tag} + {\tl_if_empty:NF \l__wa_tag_tl + {\__wa_error:nn {Multiple~tags} {#2}} + \clist_set:Nn \l__wa_tags_clist {all} + \bool_if:nT \c__wa_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\MH_if_boolean:nF {show_manual_tags} - {\clist_clear:N \l__wi_tags_clist}}} - \tl_set:Nn \l__wi_tag_tl {#2} - \bool_set:Nn \l__wi_tag_star_bool {#1} - \bool_if:nT {#1 && ! \bool_if_p:N \c__wi_amsmath_loaded_bool} - { \__wi_error:n {tag*~without~amsmath} }} + {\clist_clear:N \l__wa_tags_clist}}} + \tl_set:Nn \l__wa_tag_tl {#2} + \bool_set:Nn \l__wa_tag_star_bool {#1} + \bool_if:nT {#1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool} + { \__wa_error:n {tag*~without~amsmath} }} } -\cs_new_protected:Nn \__wi_label:n - {\__wi_if_in_second_col_of_disp:nn {\label} - {\seq_if_empty:NF \l__wi_labels_seq - {\bool_if:NTF \c__wi_cleveref_loaded_bool - {\__wi_error:n {Multiple~labels~with~cleveref}} - {\__wi_error:n {Multiple~labels}}} - \seq_put_right:Nn \l__wi_labels_seq {#1} - \bool_if:nT \c__wi_mathtools_loaded_bool +\cs_new_protected:Nn \__wa_label:n + {\__wa_if_in_second_col_of_disp:nn {\label} + {\seq_if_empty:NF \l__wa_labels_seq + {\bool_if:NTF \c__wa_cleveref_loaded_bool + {\__wa_error:n {Multiple~labels~with~cleveref}} + {\__wa_error:n {Multiple~labels}}} + \seq_put_right:Nn \l__wa_labels_seq {#1} + \bool_if:nT \c__wa_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\cs_if_exist:cTF {MT_r_#1} - {\clist_set:Nn \l__wi_tags_clist {all}} - {\clist_clear:N \l__wi_tags_clist}}} - \bool_if:nT \c__wi_autonum_loaded_bool + {\clist_set:Nn \l__wa_tags_clist {all}} + {\clist_clear:N \l__wa_tags_clist}}} + \bool_if:nT \c__wa_autonum_loaded_bool {\cs_if_exist:cTF {autonum@#1Referenced} - {\clist_set:Nn \l__wi_tags_clist {all}} - {\clist_clear:N \l__wi_tags_clist}}}} -\cs_new_protected:Nn \__wi_tagnextline: - {\__wi_if_in_second_col_of_disp:nn {\tagnextline} - {\bool_set_true:N \l__wi_tag_next_line_bool}} -\bool_new:N \l__wi_qedhere_bool -\cs_new_protected:Nn \__wi_qedhere: {\bool_set_true:N \l__wi_qedhere_bool} -\cs_new_protected:Nn \__wi_qedhere_i: {\group_begin: + {\clist_set:Nn \l__wa_tags_clist {all}} + {\clist_clear:N \l__wa_tags_clist}}}} +\cs_new_protected:Nn \__wa_tagnextline: + {\__wa_if_in_second_col_of_disp:nn {\tagnextline} + {\bool_set_true:N \l__wa_tag_next_line_bool}} +\bool_new:N \l__wa_qedhere_bool +\cs_new_protected:Nn \__wa_qedhere: {\bool_set_true:N \l__wa_qedhere_bool} +\cs_new_protected:Nn \__wa_qedhere_i: {\group_begin: \cs_set_eq:NN \qed \qedsymbol \cs_set_eq:NN \qed@elt \setQED@elt \QED@stack\relax\relax \group_end: } -\NewDocumentEnvironment {DispWithArrows} {O{}} +\NewDocumentEnvironment {DispWithArrows} {!O{}} { - \bool_if:nT \c__wi_mathtools_loaded_bool + \bool_if:nT \c__wa_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\MT_showonlyrefs_false: \MH_set_boolean_T:n {show_only_refs}}} - \bool_if:NT \c__wi_amsmath_loaded_bool \intertext@ + \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ + \bool_set_true:N \l__wa_in_DispWithArrows_bool + \__wa_pre_environment:n {#1} \if_mode_math: - \__wi_error:n {{DispWithArrows}~used~in~math~mode} + \__wa_error:n {DispWithArrows~in~math~mode} \fi: - \bool_set_true:N \l__wi_in_DispWithArrows_bool - \__wi_pre_environment:n {#1} \if_mode_vertical: \nointerlineskip \makebox[.6\linewidth]{} @@ -592,300 +598,297 @@ $$ \vcenter \bgroup \spread@equation - \bool_if:NTF \l__wi_fleqn_bool + \bool_if:NTF \l__wa_fleqn_bool {\tabskip = \c_zero_skip} {\tabskip = 0 pt plus 1000 pt minus 1000 pt} - \cs_set_eq:NN \__wi_old_label \label - \cs_set_eq:NN \notag \__wi_notag: - \cs_set_eq:NN \nonumber \__wi_notag: - \cs_set_eq:NN \tag \__wi_tag - \cs_set_eq:NN \label \__wi_label:n - \cs_set_eq:NN \tagnextline \__wi_tagnextline: + \cs_set_eq:NN \__wa_old_label \label + \cs_set_eq:NN \notag \__wa_notag: + \cs_set_eq:NN \nonumber \__wa_notag: + \cs_set_eq:NN \tag \__wa_tag + \cs_set_eq:NN \label \__wa_label:n + \cs_set_eq:NN \tagnextline \__wa_tagnextline: \halign to \displaywidth \bgroup - \int_gincr:N \g__wi_line_int - \cs_set_eq:cN \l__wi_CommandName_tl \__wi_Arrow_first_column: - \bool_set_true:N \l__wi_in_first_column_bool + \int_gincr:N \g__wa_line_int + \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column: + \bool_set_true:N \l__wa_in_first_column_bool \strut - \bool_if:NT \l__wi_fleqn_bool - {\skip_horizontal:n \l__wi_mathindent_dim} + \bool_if:NT \l__wa_fleqn_bool + {\skip_horizontal:n \l__wa_mathindent_dim} \hfil - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {##}$ + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ \tabskip = \c_zero_skip & - \clist_if_in:NVT \l__wi_tags_clist \g__wi_line_int - {\clist_set:Nn \l__wi_tags_clist {all}} - \bool_if:NT \c__wi_amsthm_loaded_bool {\cs_set_eq:NN \qedhere \__wi_qedhere:} - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {{}##}$ + \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int + {\clist_set:Nn \l__wa_tags_clist {all}} + \bool_if:NT \c__wa_amsthm_loaded_bool {\cs_set_eq:NN \qedhere \__wa_qedhere:} + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ \tabskip = 0 pt plus 1000 pt minus 1000 pt \tikz [remember~picture,overlay] - \node [__wi_node_style, - name = wa-\l__wi_prefix_str-\int_use:N\g__wi_line_int-l, - alias = {\tl_if_empty:NF \l__wi_name_tl - {\l__wi_name_tl-\int_use:N\g__wi_line_int-l}} ] {} ; + \node [__wa_node_style, + name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l, + alias = {\tl_if_empty:NF \l__wa_name_tl + {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \node [__wi_node_style, - name = wa-\l__wi_prefix_str-\int_use:N\g__wi_line_int-r, - alias = {\tl_if_empty:NF \l__wi_name_tl - {\l__wi_name_tl-\int_use:N\g__wi_line_int-r}} ] {} ; - \bool_if:NT \l__wi_shownodenames_bool - {\hbox_overlap_right:n {\small wa-\l__wi_prefix_str - -\int_use:N\g__wi_line_int}} + \node [__wa_node_style, + name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r, + alias = {\tl_if_empty:NF \l__wa_name_tl + {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ; + \bool_if:NT \l__wa_shownodenames_bool + {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str + -\int_use:N\g__wa_line_int}} & ## \tabskip = \c_zero_skip - && \__wi_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \__wa_error:n {Third~column~in~DispWithArrows} \iffalse ## \fi \cr} - {\clist_if_in:NnT \l__wi_tags_clist {last} - {\clist_set:Nn \l__wi_tags_clist {all}} + {\clist_if_in:NnT \l__wa_tags_clist {last} + {\clist_set:Nn \l__wa_tags_clist {all}} \\ \egroup \egroup - \bool_if:NT \l__wi_in_DispWithArrows_bool - {\dim_gzero_new:N \g__wi_right_x_dim - \dim_gset_eq:NN \g__wi_right_x_dim \c_max_dim - \begin{tikzpicture} [__wi_standard] - \int_step_variable:nnnNn 1 1 \g__wi_line_int \l_tmpa_int - {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) - \dim_set:Nn \l_tmpa_dim \pgf@x - \dim_compare:nNnT \l_tmpa_dim < \g__wi_right_x_dim - {\dim_gset:Nn \g__wi_right_x_dim \l_tmpa_dim} } + \bool_if:NT \l__wa_in_DispWithArrows_bool + {\dim_gzero_new:N \g__wa_right_x_dim + \dim_gset_eq:NN \g__wa_right_x_dim \c_max_dim + \begin{tikzpicture} [__wa_standard] + \int_step_variable:nNn \g__wa_line_int \l_tmpa_int + {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\l_tmpa_int-v} + {\__wa_error:n {Inexistent~v-node}} + {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) + \dim_set:Nn \l_tmpa_dim \pgf@x + \dim_compare:nNnT \l_tmpa_dim < \g__wa_right_x_dim + {\dim_gset:Nn \g__wa_right_x_dim \l_tmpa_dim}} } \end{tikzpicture}} - \__wi_post_environment: - \bool_if:nT \c__wi_mathtools_loaded_bool + \__wa_post_environment: + \bool_if:nT \c__wa_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} \MT_showonlyrefs_true:} $$ - \bool_if:NT \g__wi_footnote_bool \endsavenotes + \bool_if:NT \g__wa_footnote_bool \endsavenotes \ignorespacesafterend } \NewDocumentEnvironment {DispWithArrows*} {} {\WithArrowsOptions{notag} \DispWithArrows} {\endDispWithArrows} -\cs_new_protected:Nn \__wi_scan_arrows: +\cs_new_protected:Nn \__wa_scan_arrows: { \group_begin: - \int_compare:nNnT \l__wi_pos_arrows_int = 7 - { \__wi_scan_arrows_i: - \int_set:Nn \l__wi_pos_arrows_int 8 } - \__wi_scan_arrows_i: + \int_compare:nNnT \l__wa_pos_arrow_int = 7 + { \__wa_scan_arrows_i: + \int_set:Nn \l__wa_pos_arrow_int 8 } + \__wa_scan_arrows_i: \group_end:} -\cs_new_protected:Nn \__wi_scan_arrows_i: +\cs_new_protected:Nn \__wa_scan_arrows_i: { - \int_zero_new:N \l__wi_first_arrow_of_group_int - \int_zero_new:N \l__wi_first_line_of_group_int - \int_zero_new:N \l__wi_last_line_of_group_int - \seq_clear_new:N \l__wi_first_arrows_of_group_seq - \seq_clear_new:N \l__wi_last_arrows_of_group_seq - \bool_set_true:N \l__wi_new_group_bool - \int_set:Nn \l__wi_arrow_int 1 - \int_until_do:nNnn \l__wi_arrow_int > \g__wi_arrow_int + \int_zero_new:N \l__wa_first_arrow_of_group_int + \int_zero_new:N \l__wa_first_line_of_group_int + \int_zero_new:N \l__wa_last_line_of_group_int + \seq_clear_new:N \l__wa_first_arrows_of_group_seq + \seq_clear_new:N \l__wa_last_arrows_of_group_seq + \bool_set_true:N \l__wa_new_group_bool + \int_set:Nn \l__wa_arrow_int 1 + \int_until_do:nNnn \l__wa_arrow_int > \g__wa_arrow_int { - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {initial} \l_tmpa_tl - \int_set:Nn \l__wi_initial_int {\l_tmpa_tl} - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + \int_set:Nn \l__wa_initial_int \l_tmpa_tl + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {final} \l_tmpa_tl - \int_set:Nn \l__wi_final_int {\l_tmpa_tl} - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + \int_set:Nn \l__wa_final_int \l_tmpa_tl + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {position} \l_tmpa_tl - \int_set:Nn \l__wi_pos_of_arrow_int \l_tmpa_tl - \int_compare:nNnTF \l__wi_final_int > \g__wi_line_int - {\__wi_error:n {Too~few~lines~for~an~arrow}} - {\bool_if:nT {\int_compare_p:nNn \l__wi_arrow_int > 1 + \int_set:Nn \l__wa_pos_of_arrow_int \l_tmpa_tl + \int_compare:nNnTF \l__wa_final_int > \g__wa_line_int + {\__wa_error:n {Too~few~lines~for~an~arrow}} + {\bool_if:nT {\int_compare_p:nNn \l__wa_arrow_int > 1 && \int_compare_p:nNn - \l__wi_initial_int > \l__wi_last_line_of_group_int + \l__wa_initial_int > \l__wa_last_line_of_group_int && - \int_compare_p:n {\l__wi_pos_arrows_int != 7}} - {\__wi_draw_arrows:nn \l__wi_first_arrow_of_group_int {\l__wi_arrow_int - 1} - \bool_set_true:N \l__wi_new_group_bool} - \bool_if:nTF \l__wi_new_group_bool - {\bool_set_false:N \l__wi_new_group_bool - \int_set:Nn \l__wi_first_arrow_of_group_int \l__wi_arrow_int - \int_set:Nn \l__wi_first_line_of_group_int \l__wi_initial_int - \int_set:Nn \l__wi_last_line_of_group_int \l__wi_final_int - \seq_clear:N \l__wi_first_arrows_of_group_seq - \seq_put_left:Nx \l__wi_first_arrows_of_group_seq - {\int_use:N \l__wi_arrow_int} - \seq_clear:N \l__wi_last_arrows_of_group_seq - \seq_put_left:Nx \l__wi_last_arrows_of_group_seq - {\int_use:N \l__wi_arrow_int} - \int_compare:nT {\l__wi_pos_arrows_int != 8} - {\dim_set:Nn \l__wi_x_dim {-\c_max_dim}} + \int_compare_p:n {\l__wa_pos_arrow_int != 7}} + {\__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int {\l__wa_arrow_int - 1} + \bool_set_true:N \l__wa_new_group_bool} + \bool_if:nTF \l__wa_new_group_bool + {\bool_set_false:N \l__wa_new_group_bool + \int_set_eq:NN \l__wa_first_arrow_of_group_int \l__wa_arrow_int + \int_set_eq:NN \l__wa_first_line_of_group_int \l__wa_initial_int + \int_set_eq:NN \l__wa_last_line_of_group_int \l__wa_final_int + \seq_clear:N \l__wa_first_arrows_of_group_seq + \seq_put_left:NV \l__wa_first_arrows_of_group_seq \l__wa_arrow_int + \seq_clear:N \l__wa_last_arrows_of_group_seq + \seq_put_left:NV \l__wa_last_arrows_of_group_seq \l__wa_arrow_int + \int_compare:nT {\l__wa_pos_arrow_int != 8} + {\dim_set:Nn \l__wa_x_dim {-\c_max_dim}} } - {\int_compare:nNnT \l__wi_pos_of_arrow_int = {-1} - {\int_compare:nNnT \l__wi_initial_int = \l__wi_first_line_of_group_int - {\seq_put_left:Nx \l__wi_first_arrows_of_group_seq - {\int_use:N \l__wi_arrow_int}} - \int_compare:nNnTF \l__wi_final_int > \l__wi_last_line_of_group_int - {\int_set_eq:NN \l__wi_last_line_of_group_int \l__wi_final_int - \seq_clear:N \l__wi_last_arrows_of_group_seq - \seq_put_left:Nx \l__wi_last_arrows_of_group_seq - {\int_use:N \l__wi_arrow_int}} - {\int_compare:nNnT \l__wi_final_int = \l__wi_last_line_of_group_int - {\seq_put_left:Nx \l__wi_last_arrows_of_group_seq - {\int_use:N \l__wi_arrow_int}}}}} - \int_compare:nNnT \l__wi_pos_of_arrow_int = {-1} - { \int_compare:nT {\l__wi_pos_arrows_int != 8} - {\__wi_update_x_value:nn \l__wi_initial_int \l__wi_final_int}} } - \int_incr:N \l__wi_arrow_int + {\int_compare:nNnT \l__wa_pos_of_arrow_int = {-1} + {\int_compare:nNnT \l__wa_initial_int = \l__wa_first_line_of_group_int + {\seq_put_left:NV \l__wa_first_arrows_of_group_seq \l__wa_arrow_int} + \int_compare:nNnTF \l__wa_final_int > \l__wa_last_line_of_group_int + {\int_set_eq:NN \l__wa_last_line_of_group_int \l__wa_final_int + \seq_clear:N \l__wa_last_arrows_of_group_seq + \seq_put_left:NV \l__wa_last_arrows_of_group_seq \l__wa_arrow_int} + {\int_compare:nNnT \l__wa_final_int = \l__wa_last_line_of_group_int + {\seq_put_left:NV \l__wa_last_arrows_of_group_seq \l__wa_arrow_int}}}} + \int_compare:nNnT \l__wa_pos_of_arrow_int = {-1} + { \int_compare:nT {\l__wa_pos_arrow_int != 8} + {\__wa_update_x_value:nn \l__wa_initial_int \l__wa_final_int}} } + \int_incr:N \l__wa_arrow_int } - \int_compare:nT {\l__wi_pos_arrows_int != 7} - {\__wi_draw_arrows:nn \l__wi_first_arrow_of_group_int \g__wi_arrow_int} + \int_compare:nT {\l__wa_pos_arrow_int != 7} + {\__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int \g__wa_arrow_int} } \cs_generate_variant:Nn \keys_set:nn {no} -\cs_new_protected:Nn \__wi_keys_set: {\keys_set:no {WithArrows/General}} -\cs_new_protected:Nn \__wi_draw_arrows:nn +\cs_new_protected:Nn \__wa_keys_set: {\keys_set:no {WithArrows/General}} +\cs_new_protected:Nn \__wa_draw_arrows:nn {\group_begin: - \int_zero_new:N \l__wi_first_arrow_int - \int_set:Nn \l__wi_first_arrow_int {#1} - \int_zero_new:N \l__wi_last_arrow_int - \int_set:Nn \l__wi_last_arrow_int {#2} - \int_set:Nn \l__wi_arrow_int \l__wi_first_arrow_int - \int_until_do:nNnn \l__wi_arrow_int > \l__wi_last_arrow_int + \int_zero_new:N \l__wa_first_arrow_int + \int_set:Nn \l__wa_first_arrow_int {#1} + \int_zero_new:N \l__wa_last_arrow_int + \int_set:Nn \l__wa_last_arrow_int {#2} + \int_set:Nn \l__wa_arrow_int \l__wa_first_arrow_int + \int_until_do:nNnn \l__wa_arrow_int > \l__wa_last_arrow_int { - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {initial} \l_tmpa_tl - \int_set:Nn \l__wi_initial_int {\l_tmpa_tl} - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + \int_set:Nn \l__wa_initial_int {\l_tmpa_tl} + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {final} \l_tmpa_tl - \int_set:Nn \l__wi_final_int {\l_tmpa_tl} - \int_compare:nNnT \l__wi_final_int < {\g__wi_line_int + 1} - \__wi_draw_arrows_i: - \int_incr:N \l__wi_arrow_int + \int_set:Nn \l__wa_final_int {\l_tmpa_tl} + \int_compare:nNnT \l__wa_final_int < {\g__wa_line_int + 1} + \__wa_draw_arrows_i: + \int_incr:N \l__wa_arrow_int } \group_end: } -\cs_new_protected:Nn \__wi_draw_arrows_i: +\cs_new_protected:Nn \__wa_draw_arrows_i: {\group_begin: - \int_set:Nn \l__wi_level_int 3 - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str - _\int_use:N\l__wi_arrow_int _prop} {options} \l_tmpa_tl + \int_set:Nn \l__wa_level_int 3 + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str + _\int_use:N\l__wa_arrow_int _prop} {options} \l_tmpa_tl \exp_args:NNo \exp_args:No - \__wi_keys_set: {\l_tmpa_tl,tikz={xshift = \l__wi_xoffset_dim}} - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + \__wa_keys_set: {\l_tmpa_tl,tikz={xshift = \l__wa_xoffset_dim}} + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {position} \l_tmpa_tl \int_set:Nn \l_tmpa_int \l_tmpa_tl \int_compare:nNnF \l_tmpa_int = {-1} - {\int_set_eq:NN \l__wi_pos_arrows_int \l_tmpa_int} - \bool_set_false:N \l__wi_initial_r_bool - \bool_set_false:N \l__wi_final_r_bool - \int_case:nn \l__wi_pos_arrows_int - {0 {\bool_set_true:N \l__wi_final_r_bool} - 2 {\bool_set_true:N \l__wi_initial_r_bool} - 3 {\bool_set_true:N \l__wi_initial_r_bool - \bool_set_true:N \l__wi_final_r_bool}} - \int_compare:nNnT \l__wi_pos_arrows_int = 5 - { \dim_set:Nn \l__wi_x_dim {-\c_max_dim} - \__wi_update_x_value:nn \l__wi_initial_int \l__wi_final_int } - \tl_set:Nx \l__wi_initial_tl - {\int_use:N\l__wi_initial_int-\bool_if:NTF\l__wi_initial_r_bool rl .south} - \tl_set:Nx \l__wi_final_tl - {\int_use:N\l__wi_final_int-\bool_if:NTF\l__wi_final_r_bool rl .north} - \prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop} + {\int_set_eq:NN \l__wa_pos_arrow_int \l_tmpa_int} + \bool_set_false:N \l__wa_initial_r_bool + \bool_set_false:N \l__wa_final_r_bool + \int_case:nn \l__wa_pos_arrow_int + {0 {\bool_set_true:N \l__wa_final_r_bool} + 2 {\bool_set_true:N \l__wa_initial_r_bool} + 3 {\bool_set_true:N \l__wa_initial_r_bool + \bool_set_true:N \l__wa_final_r_bool}} + \int_compare:nNnT \l__wa_pos_arrow_int = 5 + { \dim_set:Nn \l__wa_x_dim {-\c_max_dim} + \__wa_update_x_value:nn \l__wa_initial_int \l__wa_final_int } + \tl_set:Nx \l__wa_initial_tl + {\int_use:N\l__wa_initial_int-\bool_if:NTF\l__wa_initial_r_bool rl .south} + \tl_set:Nx \l__wa_final_tl + {\int_use:N\l__wa_final_int-\bool_if:NTF\l__wa_final_r_bool rl .north} + \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} {label} \l_tmpa_tl - \seq_if_in:NxTF \l__wi_first_arrows_of_group_seq {\int_use:N \l__wi_arrow_int} + \seq_if_in:NxTF \l__wa_first_arrows_of_group_seq {\int_use:N \l__wa_arrow_int} {\bool_set_true:N \l_tmpa_bool} {\bool_set_false:N \l_tmpa_bool} - \seq_if_in:NxTF \l__wi_last_arrows_of_group_seq {\int_use:N \l__wi_arrow_int} + \seq_if_in:NxTF \l__wa_last_arrows_of_group_seq {\int_use:N \l__wa_arrow_int} {\bool_set_true:N \l_tmpb_bool} {\bool_set_false:N \l_tmpb_bool} - \int_compare:nNnT \l__wi_pos_arrows_int = 5 + \int_compare:nNnT \l__wa_pos_arrow_int = 5 {\bool_set_true:N \l_tmpa_bool \bool_set_true:N \l_tmpb_bool} - \begin{tikzpicture} [__wi_standard] - \tikz@scan@one@point\pgfutil@firstofone (\l__wi_initial_tl) + \begin{tikzpicture} [__wa_standard] + \tikz@scan@one@point\pgfutil@firstofone (\l__wa_initial_tl) \tl_gset:Nx \g_tmpa_tl - {\int_compare:nNnTF \l__wi_pos_arrows_int < 5 + {\int_compare:nNnTF \l__wa_pos_arrow_int < 5 { \dim_use:N \pgf@x } - { \dim_use:N \l__wi_x_dim } , + { \dim_use:N \l__wa_x_dim } , \bool_if:NTF \l_tmpa_bool - { \dim_eval:n {\pgf@y + \l__wi_start_adjust_dim }} + { \dim_eval:n {\pgf@y + \l__wa_start_adjust_dim }} { \dim_use:N \pgf@y } } - \tikz@scan@one@point\pgfutil@firstofone (\l__wi_final_tl) + \tikz@scan@one@point\pgfutil@firstofone (\l__wa_final_tl) \tl_gset:Nx \g_tmpb_tl - {\int_compare:nNnTF \l__wi_pos_arrows_int < 5 + {\int_compare:nNnTF \l__wa_pos_arrow_int < 5 { \dim_use:N \pgf@x } - { \dim_use:N \l__wi_x_dim } , + { \dim_use:N \l__wa_x_dim } , \bool_if:NTF \l_tmpb_bool - { \dim_eval:n {\pgf@y - \l__wi_end_adjust_dim }} + { \dim_eval:n {\pgf@y - \l__wa_end_adjust_dim }} { \dim_use:N \pgf@y }} \end{tikzpicture} - \__wi_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl + \__wa_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl \group_end: } -\cs_new_protected:Nn \__wi_def_function_tmpa:n - {\cs_set:Nn \__wi_tmpa:nnn - {\begin{tikzpicture}[__wi_standard,every~path/.style = {WithArrows/arrow}] +\cs_new_protected:Nn \__wa_def_function_tmpa:n + {\cs_set:Nn \__wa_tmpa:nnn + {\begin{tikzpicture}[__wa_standard,every~path/.style = {WithArrows/arrow}] #1 \end{tikzpicture}}} -\cs_new_protected:Nn \__wi_draw_arrow:nnn +\cs_new_protected:Nn \__wa_draw_arrow:nnn { - \bool_if:nT {\l__wi_wrap_lines_bool && \l__wi_in_DispWithArrows_bool} - { \tl_set_eq:NN \l__wi_tikz_code_tl \c__wi_tikz_code_wrap_lines_tl } - \exp_args:No \__wi_def_function_tmpa:n \l__wi_tikz_code_tl - \__wi_tmpa:nnn {#1} {#2} {#3} } -\cs_generate_variant:Nn \__wi_draw_arrow:nnn {nno} -\tl_set:Nn \c__wi_tikz_code_wrap_lines_tl + \bool_if:nT {\l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool} + { \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_wrap_lines_tl } + \exp_args:No \__wa_def_function_tmpa:n \l__wa_tikz_code_tl + \__wa_tmpa:nnn {#1} {#2} {#3} } +\cs_generate_variant:Nn \__wa_draw_arrow:nnn {nno} +\tl_set:Nn \c__wa_tikz_code_wrap_lines_tl { - \draw (#1) to node (__wi_label) {} (#2) ; - \tikz@parse@node \pgfutil@firstofone (__wi_label.west) - \dim_set:Nn \l_tmpa_dim {\g__wi_right_x_dim - \pgf@x - 0.3333 em} + \draw (#1) to node (__wa_label) {} (#2) ; + \tikz@parse@node \pgfutil@firstofone (__wa_label.west) + \dim_set:Nn \l_tmpa_dim {\g__wa_right_x_dim - \pgf@x - 0.3333 em} \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; \tl_if_empty:NF \g_tmpa_tl {\dim_set:Nn \l_tmpb_dim \g_tmpa_tl \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim - {\path (__wi_label.west) + {\path (__wa_label.west) node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] {#3} ; } } -\cs_new_protected:Nn \__wi_update_x_value:nn - {\int_step_inline:nnnn {#1} 1 {#2} - {\begin{tikzpicture} [__wi_standard] +\cs_new_protected:Nn \__wa_update_x_value:nn + {\int_step_inline:nnn {#1} {#2} + {\begin{tikzpicture} [__wa_standard] \tikz@scan@one@point\pgfutil@firstofone (##1-l) - \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l__wi_x_dim \pgf@x } + \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l__wa_x_dim \pgf@x } \end{tikzpicture} - \dim_set_eq:NN \l__wi_x_dim \g_tmpa_dim } } -\cs_new:Npn \WithArrowsLastEnv {\int_use:N \g__wi_last_env_int} + \dim_set_eq:NN \l__wa_x_dim \g_tmpa_dim } } +\cs_new:Npn \WithArrowsLastEnv {\int_use:N \g__wa_last_env_int} \keys_define:nn {WithArrows/CodeAfter} {tikz .code:n = \tikzset {WithArrows/arrow/.append~style = {#1}} , tikz .value_required:n = true, rr .value_forbidden:n = true, - rr .code:n = \__wi_analyze_option_position:n 0 , + rr .code:n = \__wa_analyze_option_position:n 0 , ll .value_forbidden:n = true, - ll .code:n = \__wi_analyze_option_position:n 1 , + ll .code:n = \__wa_analyze_option_position:n 1 , rl .value_forbidden:n = true, - rl .code:n = \__wi_analyze_option_position:n 2 , + rl .code:n = \__wa_analyze_option_position:n 2 , lr .value_forbidden:n = true, - lr .code:n = \__wi_analyze_option_position:n 3 , + lr .code:n = \__wa_analyze_option_position:n 3 , v .value_forbidden:n = true, - v .code:n = \__wi_analyze_option_position:n 4 , - TikzCode .tl_set:N = \l__wi_tikz_code_tl, + v .code:n = \__wa_analyze_option_position:n 4 , + TikzCode .tl_set:N = \l__wa_tikz_code_tl, TikzCode .value_required:n = true, - xoffset .dim_set:N = \l__wi_xoffset_dim, + xoffset .dim_set:N = \l__wa_xoffset_dim, xoffset .value_required:n = true} -\NewDocumentCommand \__wi_Arrow_code_after {O{} mmm O{}} - {\int_set:Nn \l__wi_pos_arrows_int 1 - \int_set:Nn \l__wi_previous_pos_arrows_int {-1} +\NewDocumentCommand \__wa_Arrow_code_after {O{} mmm !O{}} + {\int_set:Nn \l__wa_pos_arrow_int 1 + \int_set:Nn \l__wa_previous_pos_arrow_int {-1} \group_begin: - \int_set:Nn \l__wi_level_int 3 + \int_set:Nn \l__wa_level_int 3 \keys_set:nn {WithArrows/CodeAfter} - {#1,#5,tikz={xshift = \l__wi_xoffset_dim}} - \bool_set_false:N \l__wi_initial_r_bool - \bool_set_false:N \l__wi_final_r_bool - \int_case:nn \l__wi_pos_arrows_int - {0 {\bool_set_true:N \l__wi_initial_r_bool - \bool_set_true:N \l__wi_final_r_bool} - 2 {\bool_set_true:N \l__wi_initial_r_bool} - 3 {\bool_set_true:N \l__wi_final_r_bool}} - \cs_if_free:cTF {pgf@sh@ns@wa-\l__wi_prefix_str-#2-l} - {\__wi_error:nx {Wrong~line~specification~in~Arrow} {#2}} - {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wi_prefix_str-#3-l} - {\__wi_error:nx {Wrong~line~specification~in~Arrow} {#3}} - {\int_compare:nNnTF \l__wi_pos_arrows_int = 4 - {\begin{tikzpicture} [__wi_standard] + {#1,#5,tikz={xshift = \l__wa_xoffset_dim}} + \bool_set_false:N \l__wa_initial_r_bool + \bool_set_false:N \l__wa_final_r_bool + \int_case:nn \l__wa_pos_arrow_int + {0 {\bool_set_true:N \l__wa_initial_r_bool + \bool_set_true:N \l__wa_final_r_bool} + 2 {\bool_set_true:N \l__wa_initial_r_bool} + 3 {\bool_set_true:N \l__wa_final_r_bool}} + \cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-#2-l} + {\__wa_error:nx {Wrong~line~in~Arrow} {#2}} + {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-#3-l} + {\__wa_error:nx {Wrong~line~in~Arrow} {#3}} + {\int_compare:nNnTF \l__wa_pos_arrow_int = 4 + {\begin{tikzpicture} [__wa_standard] \tikz@scan@one@point\pgfutil@firstofone(#2-l.south) \dim_set_eq:NN \l_tmpa_dim \pgf@x \dim_set_eq:NN \l_tmpb_dim \pgf@y @@ -896,24 +899,24 @@ \tl_gset:Nx \g_tmpb_tl {\dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y} \end{tikzpicture} } - {\begin{tikzpicture} [__wi_standard] + {\begin{tikzpicture} [__wa_standard] \tikz@scan@one@point\pgfutil@firstofone - (#2-\bool_if:NTF\l__wi_initial_r_bool rl .south) + (#2-\bool_if:NTF\l__wa_initial_r_bool rl .south) \tl_gset:Nx \g_tmpa_tl {\dim_use:N \pgf@x , \dim_use:N \pgf@y} \tikz@scan@one@point\pgfutil@firstofone - (#3-\bool_if:NTF\l__wi_final_r_bool rl .north) + (#3-\bool_if:NTF\l__wa_final_r_bool rl .north) \tl_gset:Nx \g_tmpb_tl {\dim_use:N \pgf@x , \dim_use:N \pgf@y} \end{tikzpicture}} - \__wi_draw_arrow:nnn {\g_tmpa_tl} {\g_tmpb_tl} {#4} }} + \__wa_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl {#4} }} \group_end: } -\cs_new_protected:Nn \__wi_MultiArrow:nn +\cs_new_protected:Nn \__wa_MultiArrow:nn { - \foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wi_prefix_str-\x-l} - {\__wi_error:nx {Wrong~line~specification~in~MultiArrow} \x } + \foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\x-l} + {\__wa_error:nx {Wrong~line~specification~in~MultiArrow} \x } {\clist_gput_right:Nx \g_tmpa_clist \x}} \int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2 - {\__wi_error:n {Too~small~specification~for~MultiArrow}} + {\__wa_error:n {Too~small~specification~for~MultiArrow}} {\clist_sort:Nn \g_tmpa_clist {\int_compare:nNnTF {##1} > {##2} {\sort_return_swapped:} @@ -921,29 +924,29 @@ \clist_pop:NN \g_tmpa_clist \l_tmpa_tl \clist_reverse:N \g_tmpa_clist \clist_pop:NN \g_tmpa_clist \l_tmpb_tl - \exp_args:Nx \__wi_MultiArrow_i:n {\g_tmpa_clist} - \begin{tikzpicture}[__wi_standard,every~path/.style={WithArrows/arrow}] - \draw [<->] ([xshift = \l__wi_xoffset_dim]\l_tmpa_tl-r.south) + \exp_args:Nx \__wa_MultiArrow_i:n {\g_tmpa_clist} + \begin{tikzpicture}[__wa_standard,every~path/.style={WithArrows/arrow}] + \draw [<->] ([xshift = \l__wa_xoffset_dim]\l_tmpa_tl-r.south) -- ++(5mm,0) - -- node (__wi_label) {} - ([xshift = \l__wi_xoffset_dim+5mm]\l_tmpb_tl-r.south) - -- ([xshift = \l__wi_xoffset_dim]\l_tmpb_tl-r.south) ; - \tikz@parse@node \pgfutil@firstofone (__wi_label.west) + -- node (__wa_label) {} + ([xshift = \l__wa_xoffset_dim+5mm]\l_tmpb_tl-r.south) + -- ([xshift = \l__wa_xoffset_dim]\l_tmpb_tl-r.south) ; + \tikz@parse@node \pgfutil@firstofone (__wa_label.west) \dim_set:Nn \l_tmpa_dim {20 cm} \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; \tl_if_empty:NF \g_tmpa_tl {\dim_set:Nn \l_tmpa_dim \g_tmpa_tl} - \bool_if:nT {\l__wi_wrap_lines_bool && \l__wi_in_DispWithArrows_bool} - {\dim_set:Nn \l_tmpb_dim {\g__wi_right_x_dim - \pgf@x - 0.3333 em} + \bool_if:nT {\l__wa_wrap_lines_bool && \l__wa_in_DispWithArrows_bool} + {\dim_set:Nn \l_tmpb_dim {\g__wa_right_x_dim - \pgf@x - 0.3333 em} \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} - \path (__wi_label.west) + \path (__wa_label.west) node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] {#2} ; \end{tikzpicture} } } -\cs_new_protected:Nn \__wi_MultiArrow_i:n - {\begin{tikzpicture}[__wi_standard,every~path/.style={WithArrows/arrow}] +\cs_new_protected:Nn \__wa_MultiArrow_i:n + {\begin{tikzpicture}[__wa_standard,every~path/.style={WithArrows/arrow}] \foreach \k in {#1} - {\draw[<-] ([xshift = \l__wi_xoffset_dim]\k-r.south) -- ++(5mm,0) ;} ; + {\draw[<-] ([xshift = \l__wa_xoffset_dim]\k-r.south) -- ++(5mm,0) ;} ; \end{tikzpicture}} \msg_new:nnn {witharrows} {AllowLineWithoutAmpersand} @@ -952,58 +955,61 @@ "AllowLineWithoutAmpersand"~will~probably~be~deleted~in~a~future~version.~ However,~you~can~go~on~for~this~time.} \msg_new:nnn {witharrows} - {Option~unknown} + {Unknown~option} {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~ meaningless~in~the~context.~If~you~go~on,~it~will~be~ignored.} \msg_new:nnn {witharrows} - {Third~column~in~an~environment~{WithArrows}} - {By~default,~an~environment~\{WithArrows\}~can~only~have~two~columns.~ - Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str - \str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~ - you~should~use~the~option~"MoreColumns"~at~a~global~level~or~for~ - an~environment.~However,~you~can~go~one~for~this~time.} + {Third~column~in~WithArrows} + {By~default,~an~environment~\{\l__wa_type_env_tl\}~can~only~have~ + two~columns.~Maybe~you~have~forgotten~a~ + \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~ + two~columns,~you~should~use~the~option~"MoreColumns"~at~a~global~ + level~or~for~ an~environment.~However,~you~can~go~one~for~ + this~time.} \msg_new:nnn {witharrows} - {Third~column~in~an~environment~{DispWithArrows}} - {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~ - have~two~columns.~If~you~go~on,~you~may~have~an~incorrect~output.} + {Third~column~in~DispWithArrows} + {An~environment~\{\l__wa_type_env_tl\}~can~only~have~two~columns.~ + Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ at~the~end~ + of~row~\int_use:N\g__wa_line_int.~If~you~go~on,~you~may~have~other~errors.} \msg_new:nnn {witharrows} - {The~option~"jump"~must~be~non~negative} + {Negative~value~for~jump} {You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~ - \token_to_str:N\Arrow.~ You~can~create~an~arrow~going~backwards~with~ - the~option~"<-"~of~Tikz.} + \l__wa_string_Arrow_for_messages_str.~ + You~can~create~an~arrow~going~backwards~with~ the~option~"<-"~of~Tikz.} \msg_new:nnn {witharrows} {Too~few~lines~for~an~arrow} - {An~arrow~specified~in~line~\int_use:N \l__wi_initial_int\ can't~be~drawn~ + {An~arrow~specified~in~line~\int_use:N \l__wa_initial_int\ can't~be~drawn~ because~it~arrives~after~the~last~line~of~the~environment~(remind~that~ - the~command~\token_to_str:N\Arrow\ must~be~in~the~*start*~line~ - of~the~arrow).~If~you~go~on,~this~arrow~will~be~ignored.} + the~command~\l__wa_string_Arrow_for_messages_str.~ + must~be~in~the~*start*~line~of~the~arrow).~ + If~you~go~on,~this~arrow~will~be~ignored.} \msg_new:nnn {witharrows} - {{WithArrows}~used~outside~math~mode} - {The~environment~\{WithArrows\}~should~be~used~only~in~math~mode.~ + {WithArrows~outside~math~mode} + {The~environment~\{\l__wa_type_env_tl\}~should~be~used~only~in~math~mode.~ Nevertheless,~you~can~go~on.} \msg_new:nnn {witharrows} - {{DispWithArrows}~used~in~math~mode} - {The~environment~\{DispWithArrows\}~should~be~used~only~outside~math~mode.~ - If~you~go~on,~you~will~have~other~errors.} + {DispWithArrows~in~math~mode} + {The~environment~\{\l__wa_type_env_tl\}~should~be~used~only~ + outside~math~mode.~If~you~go~on,~you~will~have~other~errors.} \msg_new:nnn {witharrows} - {Two~options~are~incompatible} + {Incompatible~options} {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~but~ this~option~is~incompatible~or~redundant~with~the~option~" - \int_case:nn\l__wi_previous_pos_arrows_int - {0 {rr} + \int_case:nn\l__wa_previous_pos_arrow_int + {0 {lr} 1 {ll} 2 {rl} - 3 {lr} + 3 {rr} 4 {v} 5 {i} 6 {groups} 7 {group}}"~ set~in~the~same~ - \int_case:nn\l__wi_level_int + \int_case:nn\l__wa_level_int {1 {command~\token_to_str:N\WithArrowsOptions} 2 {declaration~of~options~of~the~environment~ - \{\@currenvir\}} - 3 {command~\token_to_str:N\Arrow}}.~ + \{\l__wa_type_env_tl\}} + 3 {command~\l__wa_string_Arrow_for_messages_str}}.~ If~you~go~on,~I~will~use~the~option~"\tl_use:N\l_keys_key_tl".} \msg_new:nnn {witharrows} {Option~will~be~ignored} @@ -1011,14 +1017,11 @@ If~you~go~on,~it~will~be~ignored.} \msg_new:nnn {witharrows} {Arrow~in~first~column} - {You~should~not~use~the~command~\token_to_str:N\Arrow\ - \str_if_eq:NNF \l__wi_CommandName_tl \l_tmpa_tl - {(renamed~in~\str_use:N \c_backslash_str - \tl_use:N \l__wi_CommandName_tl)~} - ~in~the~first~column~but~only~in~the~second~column.\\ + {You~should~not~use~the~command~\l__wa_string_Arrow_for_messages_str\ + in~the~first~column~but~only~in~the~second~column.\\ However~you~can~go~on~for~this~time.} \msg_new:nnn {witharrows} - {Wrong~line~specification~in~Arrow} + {Wrong~line~in~Arrow} {The~specification~of~line~"#1"~you~use~in~\token_to_str:N\Arrow\ ~doesn't~exist.\\ If~you~go~on,~the~arrow~will~be~ignored.} @@ -1037,151 +1040,234 @@ (or~mathtools).~If~you~go~on,~the~command~\token_to_str:N\tag\ will~be~used~instead.} \msg_new:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} + {Command~not~allowed~in~DispWithArrows} {The~command~\token_to_str:N #1 - is~not~allowed~in~the~first~column~of~\{DispWithArrows\}~but~ + is~not~allowed~in~the~first~column~of~\{\l__wa_type_env_tl\}~but~ only~in~the~second~column.~If~you~go~on,~this~command~will~be~ignored.} \msg_new:nnn {witharrows} - {Command~not~allowed~in~{WithArrows}} - {The~command~\token_to_str:N #1 - is~not~allowed~in~\{WithArrows\}~but~is~allowed~in~the~second~ - column~of~\{DispWithArrows\}~If~you~go~on,~this~command~will~be~ignored.} + {Command~not~allowed~in~WithArrows} + {The~command~\token_to_str:N #1 is~not~allowed~in~\{\l__wa_type_env_tl\}~ + (it's~allowed~in~the~second~column~of~\{DispWithArrows\}).~If~you~go~on, + ~this~command~will~be~ignored.} \msg_new:nnn {witharrows} {Multiple~tags} {You~can't~use~twice~the~command~\token_to_str:N\tag\ - in~a~line~of~the~environment~\{\@currenvir\}.~If~you~go~on,~the~tag~ + in~a~line~of~the~environment~\{\l__wa_type_env_tl\}.~If~you~go~on,~the~tag~ '#1'~will~be~used.} \msg_new:nnn {witharrows} {Multiple~labels} {Normally,~we~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\@currenvir\}.~ + twice~in~a~line~of~the~environment~\{\l__wa_type_env_tl\}.~ However,~you~can~go~on.~ - \bool_if:NT \c__wi_showlabels_loaded_bool + \bool_if:NT \c__wa_showlabels_loaded_bool {However,~only~the~last~label~will~be~shown~by~showlabels.~} If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~ "AllowMultipleLabels"~at~the~global~or~environment~level.} \msg_new:nnn {witharrows} {Multiple~labels~with~cleveref} {Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ - twice~in~a~line~of~the~environment~\{\@currenvir\}.~ + twice~in~a~line~of~the~environment~\{\l__wa_type_env_tl\}.~ If~you~go~on,~you~may~have~undefined~references.} -\coffin_new:N \l__wi_halign_coffin -\NewDocumentEnvironment {CasesWithArrows} {m O{}} +\msg_new:nnn {witharrows} + {Inexistent~v-node} + {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.~If~you~go~on,~you~may~have~an~incorrect~output.} +\msg_new:nnn {witharrows} + {Option~incompatible~with~group} + {You~try~to~use~the~option~"\tl_use:N\l_keys_key_tl"~while~ + you~are~using~the~option~" + \int_compare:nNnTF \l__wa_pos_arrow_int = 5 + {group} + {groups}".~ + It's~incompatible.~You~can~go~on~ignoring~this~option~ + "\tl_use:N\l_keys_key_tl"~but~you~should~correct~your~code.} +\coffin_new:N \l__wa_halign_coffin +\NewDocumentEnvironment {CasesWithArrows} {m !O{}} {\hbox_set:Nn \l_tmpa_box {$\left\{\vcenter to 1cm {} \right.$} - \dim_zero_new:N \l__wi_delim_wd_dim - \dim_set:Nn \l__wi_delim_wd_dim {\box_wd:N \l_tmpa_box} - \box_clear_new:N \l__wi_left_part_box - \hbox_set:Nn \l__wi_left_part_box - {$\bool_if:NT \l__wi_displaystyle_bool \displaystyle #1 {}$} - \bool_if:nT \c__wi_mathtools_loaded_bool + \dim_zero_new:N \l__wa_delim_wd_dim + \dim_set:Nn \l__wa_delim_wd_dim {\box_wd:N \l_tmpa_box} + \box_clear_new:N \l__wa_left_part_box + \hbox_set:Nn \l__wa_left_part_box + {$\bool_if:NT \l__wa_displaystyle_bool \displaystyle #1 {}$} + \bool_if:nT \c__wa_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\MT_showonlyrefs_false: \MH_set_boolean_T:n {show_only_refs} - \clist_set:Nn \l__wi_tags_clist {all}}} - \bool_if:NT \c__wi_amsmath_loaded_bool \intertext@ + \clist_set:Nn \l__wa_tags_clist {all}}} + \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ \if_mode_math: - \__wi_error:n {{DispWithArrows}~used~in~math~mode} + \__wa_error:n {DispWithArrows~in~math~mode} \fi: - \bool_set_true:N \l__wi_in_DispWithArrows_bool + \bool_set_true:N \l__wa_in_DispWithArrows_bool % - \__wi_pre_environment:n {#2} + \__wa_pre_environment:n {#2} \nointerlineskip \hbox_to_wd:nn {0.6\linewidth} {} $$ \spread@equation - \vcoffin_set:Nnw \l__wi_halign_coffin \displaywidth - \bool_if:NTF \l__wi_fleqn_bool + \vcoffin_set:Nnw \l__wa_halign_coffin \displaywidth + \bool_if:NTF \l__wa_fleqn_bool {\tabskip = \c_zero_skip} {\tabskip = 0 pt plus 1000 pt minus 1000 pt} - \bool_if:NTF \c__wi_amsmath_loaded_bool - {\cs_set_eq:NN \__wi_old_label \ltx@label} - {\cs_set_eq:NN \__wi_old_label \label} + \bool_if:NTF \c__wa_amsmath_loaded_bool + {\cs_set_eq:NN \__wa_old_label \ltx@label} + {\cs_set_eq:NN \__wa_old_label \label} \halign to \displaywidth \bgroup - \int_gincr:N \g__wi_line_int - \cs_set_eq:cN \l__wi_CommandName_tl \__wi_Arrow_first_column: - \bool_set_true:N \l__wi_in_first_column_bool - \strut - \bool_if:NT \l__wi_fleqn_bool - {\skip_horizontal:n \l__wi_mathindent_dim} + \int_gincr:N \g__wa_line_int + \cs_set_eq:cN \l__wa_CommandName_str \__wa_Arrow_first_column: + \bool_set_true:N \l__wa_in_first_column_bool + \bool_if:NT \l__wa_fleqn_bool + {\skip_horizontal:n \l__wa_mathindent_dim} \hfil - \skip_horizontal:n {\box_wd:N \l__wi_left_part_box + \l__wi_delim_wd_dim} - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {##}$ + \skip_horizontal:n {\box_wd:N \l__wa_left_part_box + \l__wa_delim_wd_dim} + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ \tabskip = \c_zero_skip & - \clist_if_in:NVT \l__wi_tags_clist \g__wi_line_int - {\clist_set:Nn \l__wi_tags_clist {all}} - \cs_set:Npn \notag {\clist_clear:N \l__wi_tags_clist} - $\bool_if:NT \l__wi_displaystyle_bool \displaystyle {{}##}$ + \clist_if_in:NVT \l__wa_tags_clist \g__wa_line_int + {\clist_set:Nn \l__wa_tags_clist {all}} + \cs_set:Npn \notag {\clist_clear:N \l__wa_tags_clist} + $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ \tabskip = 0 pt plus 1000 pt minus 1000 pt \tikz [remember~picture,overlay] - \node [__wi_node_style, - name = wa-\l__wi_prefix_str-\int_use:N\g__wi_line_int-l, - alias = {\tl_if_empty:NF \l__wi_name_tl - {\l__wi_name_tl-\int_use:N\g__wi_line_int-l}} ] {} ; + \node [__wa_node_style, + name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l, + alias = {\tl_if_empty:NF \l__wa_name_tl + {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \node [__wi_node_style, - name = wa-\l__wi_prefix_str-\int_use:N\g__wi_line_int-r, - alias = {\tl_if_empty:NF \l__wi_name_tl - {\l__wi_name_tl-\int_use:N\g__wi_line_int-r}} ] {} ; - \bool_if:NT \l__wi_shownodenames_bool - {\hbox_overlap_right:n {\small wa-\l__wi_prefix_str - -\int_use:N\g__wi_line_int}} + \node [__wa_node_style, + name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r, + alias = {\tl_if_empty:NF \l__wa_name_tl + {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ; + \bool_if:NT \l__wa_shownodenames_bool + {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str + -\int_use:N\g__wa_line_int}} & ## \tabskip = \c_zero_skip - && \__wi_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \__wa_error:n {Third~column~in~DispWithArrows} \if_false: ## \fi: \cr} - {\clist_if_in:NnT {last} \l__wi_tags_clist - {\clist_set:Nn \l__wi_tags_clist {all}} + {\clist_if_in:NnT \l__wa_tags_clist {last} + {\clist_set:Nn \l__wa_tags_clist {all}} \\ \egroup \unskip\unpenalty\unskip\unpenalty \box_set_to_last:N \l_tmpa_box \nointerlineskip \box_use:N \l_tmpa_box - \dim_gzero_new:N \g__wi_alignment_dim - \dim_gset:Nn \g__wi_alignment_dim {\box_wd:N \l_tmpa_box} - \box_clear_new:N \l__wi_new_box - \hbox_set:Nn \l__wi_new_box {\hbox_unpack_clear:N \l_tmpa_box} - \dim_compare:nNnT {\box_wd:N \l__wi_new_box} < \g__wi_alignment_dim - {\dim_gset:Nn \g__wi_alignment_dim {\box_wd:N \l__wi_new_box}} + \dim_gzero_new:N \g__wa_alignment_dim + \dim_gset:Nn \g__wa_alignment_dim {\box_wd:N \l_tmpa_box} + \box_clear_new:N \l__wa_new_box + \hbox_set:Nn \l__wa_new_box {\hbox_unpack_clear:N \l_tmpa_box} + \dim_compare:nNnT {\box_wd:N \l__wa_new_box} < \g__wa_alignment_dim + {\dim_gset:Nn \g__wa_alignment_dim {\box_wd:N \l__wa_new_box}} \vcoffin_set_end: \hbox_to_wd:nn \displaywidth { - \bool_if:NTF \l__wi_fleqn_bool - {\skip_horizontal:n \l__wi_mathindent_dim} + \bool_if:NTF \l__wa_fleqn_bool + {\skip_horizontal:n \l__wa_mathindent_dim} {\hfil} - \hbox_to_wd:nn \g__wi_alignment_dim - { \box_use_drop:N \l__wi_left_part_box - \dim_set:Nn \l_tmpa_dim { \box_ht:N \l__wi_halign_coffin - + \box_dp:N \l__wi_halign_coffin} + \hbox_to_wd:nn \g__wa_alignment_dim + { \box_use_drop:N \l__wa_left_part_box + \dim_set:Nn \l_tmpa_dim { \box_ht:N \l__wa_halign_coffin + + \box_dp:N \l__wa_halign_coffin} $\left\{ \vcenter to \l_tmpa_dim {\vfil} \right.$} \hfil} \coffin_typeset:Nnnnn - \l__wi_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim + \l__wa_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim $$ - \__wi_post_environment: - \bool_if:nT \c__wi_mathtools_loaded_bool + \__wa_post_environment: + \bool_if:nT \c__wa_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} \MT_showonlyrefs_true:} - \bool_if:NT \g__wi_footnote_bool \endsavenotes + \bool_if:NT \g__wa_footnote_bool \endsavenotes \ignorespacesafterend } \NewDocumentCommand \WithArrowsNewStyle {mm} { \keys_if_exist:nnTF {WithArrows/General} {#1} - {\__wi_error:nn {Key~already~defined} {#1}} + {\__wa_error:nn {Key~already~defined} {#1}} {\keys_define:nn {WithArrows/General} - {#1 .code:n = {\int_compare:nNnTF \l__wi_level_int < 3 - {\keys_set:nn {WithArrows/General} {#2}} - {\__wi_error:n {Option~unknown}}}} + {#1 .code:n = {\int_compare:nNnTF \l__wa_level_int < 3 + {\bool_set_eq:NN \l_tmpa_bool \l__wa_in_WithArrows_bool + \bool_set_eq:NN \l_tmpb_bool \l__wa_in_DispWithArrows_bool + \bool_set_false:N \l__wa_in_WithArrows_bool + \bool_set_false:N \l__wa_in_DispWithArrows_bool + \keys_set_known:nnN {WithArrows/General} {#2} \l_tmpa_tl + \keys_set_known:nVN {WithArrows/GlobalOrEnv} + \l_tmpa_tl \l_tmpb_tl + \bool_set_eq:NN \l__wa_in_WithArrows_bool \l_tmpa_bool + \bool_set_eq:NN \l__wa_in_DispWithArrows_bool \l_tmpb_bool} + {\__wa_error:n {Unknown~option}}}} \group_begin: + \msg_set:nnn {witharrows} + {Option~will~be~ignored} + {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~or~can't~be~ + used~in~\token_to_str:N\WithArrowsNewStyle.~If~you~go~on,~ + this~option~will~be~ignored~in~the~definition~of~style~'#1'.} + \msg_set:nnn {witharrows} + {Unknown~option} + {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown.~If~you~go~on,~ + this~option~will~be~ignored~in~the~definition~of~style~'#1'.} \WithArrowsOptions{#2} \group_end:} } \msg_new:nnn {witharrows} {Key~already~defined} {The~key~'#1'~is~already~defined.~If~you~go~on,~ your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored.} +\tl_set:Nn \c__wa_tikz_code_up_tl + {\draw[rounded~corners] + let \p1 = (#1), + \p2 = (#2) + in (\p1) -- node {\dim_set:Nn \l_tmpa_dim {\x2-\x1} + \begin{varwidth}\l_tmpa_dim + \raggedright + #3 + \end{varwidth}} + (\x2,\y1) -- (\p2) ;} +\tl_set:Nn \c__wa_tikz_code_down_tl + {\draw[rounded~corners] + let \p1 = (#1), + \p2 = (#2) + in (\p1) -- (\x1,\y2) -- + node {\dim_set:Nn \l_tmpa_dim {\x1-\x2} + \begin{varwidth}\l_tmpa_dim + \raggedright + #3 + \end{varwidth}} + (\p2) ;} +\keys_define:nn {WithArrows/General} + {up .value_forbidden:n = true, + up .code:n = {\int_compare:nNnTF \l__wa_level_int = 3 + {\bool_if:NTF \c__wa_varwidth_loaded_bool + {\cs_if_exist:cTF {tikz@library@calc@loaded} + {\int_set:Nn \l__wa_pos_arrow_int 1 + \bool_set_false:N \l__wa_wrap_lines_bool + \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_up_tl} + {\__wa_error:n {calc~not~loaded}}} + {\__wa_error:n {varwidth~not~loaded}}} + {\__wa_error:n {Unknown~option}}}, + down .value_forbidden:n = true, + down .code:n = {\int_compare:nNnTF \l__wa_level_int = 3 + {\bool_if:NTF \c__wa_varwidth_loaded_bool + {\cs_if_exist:cTF {tikz@library@calc@loaded} + {\int_set:Nn \l__wa_pos_arrow_int 1 + \bool_set_false:N \l__wa_wrap_lines_bool + \tl_set_eq:NN \l__wa_tikz_code_tl \c__wa_tikz_code_down_tl} + {\__wa_error:n {calc~not~loaded}}} + {\__wa_error:n {varwidth~not~loaded}}} + {\__wa_error:n {Unknown~option}}}} +\msg_new:nnn {witharrows} + {varwidth~not~loaded} + {You~can't~use~the~option~"\l_keys_key_tl"~because~ + you~don't~have~loaded~the~package~ + varwidth.~If~you~go~on,~this~option~will~be~forgotten.} +\msg_new:nnn {witharrows} + {calc~not~loaded} + {You~can't~use~the~option~"\l_keys_key_tl"~because~you~don't~have~loaded~the~ + Tikz~library~calc.You~should~add~"\token_to_str:N\usetikzlibrary{calc}" + ~in~your~preamble.~ + ~If~you~go~on,~this~option~will~be~forgotten.} \endinput %% %% End of file `witharrows.sty'. |