diff options
author | Karl Berry <karl@freefriends.org> | 2018-09-14 20:56:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-09-14 20:56:16 +0000 |
commit | 50b0453246d1f9763026b4a59dfab62eecb4901f (patch) | |
tree | 3ca01a1353c1ff7d8f0a36487f578f4fd012e1e2 | |
parent | ccd1b1b3d130d56c728e4f9e8a411a7d5c6c202c (diff) |
witharrows (14sep18)
git-svn-id: svn://tug.org/texlive/trunk@48667 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/witharrows.pdf | bin | 314641 -> 322581 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/witharrows/witharrows.dtx | 483 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 1114 |
3 files changed, 872 insertions, 725 deletions
diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf Binary files differindex f7e27367573..efcdc42e180 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 c08ec2504c7..d5535702e84 100644 --- a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx +++ b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{1.9} -\def\myfiledate{2018/08/17} +\def\myfileversion{1.10} +\def\myfiledate{2018/09/13} % % %<*batchfile> @@ -44,7 +44,7 @@ version 2005/12/01 or later. \endgroup %</batchfile> % -%<@@=wa> +%<@@=ww> %<*driver> \documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by witharrows) \usepackage{xltxtra} @@ -74,8 +74,8 @@ version 2005/12/01 or later. % \maketitle % % \begin{abstract} -% The LaTeX package \pkg{witharrows} provides an environment |{WithArrows}| which is similar to environment -% |{aligned}| of \pkg{amsmath} (and \pkg{mathtools}) but gives the possibility to draw arrows on the right side of +% The LaTeX package \pkg{witharrows} provides environments |{WithArrows}| and |{DispWithArrows}| similar to the environments +% |{aligned}| and |{align}| of \pkg{amsmath} but with the possibility to draw arrows on the right side of % the alignment. These arrows are usually used to give explanations concerning the mathematical calculus presented. % \end{abstract} % @@ -83,7 +83,7 @@ version 2005/12/01 or later. % \vskip1cm % This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by the classical workflow % |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two compilations may be necessary. This package requires the -% packages \pkg{expl3}, \pkg{xparse} and \pkg{tikz}. The following Tikz libraries \pkg{arrows.meta} and +% packages \pkg{expl3}, \pkg{xparse} and \pkg{tikz}. The Tikz libraries \pkg{arrows.meta} and % \pkg{bending} are also required. % % \bigskip @@ -266,8 +266,8 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \bigskip -% In the environments |{DispWithArrows}| and |{DispWithArrows*}|, there is an option |wrap-line|. With this option, -% the lines of the labels are automaticly wrapped on the right: see p.~\pageref{wrap-lines}. +% In the environments |{DispWithArrows}| and |{DispWithArrows*}|, there is an option |wrap-lines|. With this option, +% the lines of the labels are automatically wrapped on the right: see p.~\pageref{wrap-lines}. % % \interitem % If we want to change the font of the text associated to the arrow, we can, of course, put a command like @@ -288,10 +288,12 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \interitem -% If we put commands |\\| in the text to force newlines, a command of font placed in the beginning of the text will -% have effect only until the first command |\\| (like in an environment |{tabular}|). That's why Tikz gives a option -% |font| to modify the font of the whole text. Nevertheless, if we use the option |tikz={font={\bfseries}}|, the -% default specification of |\small| and |\itshape| will be overwritten. +% It's possible to put commands |\\| in the text to force new lines\footnote{By default, this is not possible in a +% Tikz node. However, in \pkg{witharrows}, the nodes are created with the option |align=left|, and, thus, it becomes +% possible.}. However, if we put a |\\| , a command of font placed in the beginning of the text will have effect +% only until the first command |\\| (like in an environment |{tabular}|). That's why Tikz gives an option |font| to +% modify the font of the whole text. Nevertheless, if we use the option |tikz={font={\bfseries}}|, the default +% specification of |\small| and |\itshape| will be overwritten. % % % \begin{Verbatim} % $\begin{WithArrows} @@ -371,12 +373,12 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \interitem -% The version 1.3 of \pkg{witharrows} give two options for a fine tuning of the arrows: +% There are also two options for a fine tuning of the arrows: % % \begin{itemize} -% \item the option |ystart| set the vertical distance between the base line of the text and the start of the arrow +% \item the option |ystart| sets the vertical distance between the base line of the text and the start of the arrow % (default value: 0.4 ex); -% \item the option |ygap| set the vertical distance between two consecutive arrows (default value: 0.4~ex). +% \item the option |ygap| sets the vertical distance between two consecutive arrows (default value: 0.4~ex). % \end{itemize} % % @@ -412,8 +414,10 @@ version 2005/12/01 or later. % Almost all the options can also be set at the document level with the command |\WithArrowsOptions|. In this case, % the scope of the declarations is the current TeX group (these declarations are ``semi-global''). For example, if % we want all the environments |{WithArrows}| composed in |\displaystyle| with blue arrows, we can write -% |\WithArrowsOptions{displaystyle,tikz=blue}|.\footnote{Since version 1.4 of \pkg{witharrows}, it's no longer possible -% to give these options directly when loading the package, \emph{i.e.} with the command |\usepackage| in the preamble.} +% |\WithArrowsOptions{displaystyle,tikz=blue}|.\footnote{It's also possible to configure \pkg{witharrows} by +% modifying the Tikz style |WithArrows/arrow| which is the style used by \pkg{witharrows} when drawing an arrow. +% For example, to have the labels in blue with roman (upright) types, one can use the following instruction: +% |\tikzset{WithArrows/arrow/.append style = {blue, font = {}}}|.} % % \begin{Verbatim} % ~emphase#\WithArrowsOptions{displaystyle,tikz=blue}@ @@ -480,9 +484,9 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \medskip -% Special commands are available in |CodeAfter| : a command |\NbLines| which gives the number of lines (=rows) of +% Special commands are available in |CodeAfter|: a command |\NbLines| which gives the number of lines (=rows) of % the current environment (this is a command and not a counter), a special form of the command |\Arrow| and the -% command |\MultiArrow| : these commands are described in the section concerning the nested environments, +% command |\MultiArrow|: these commands are described in the section concerning the nested environments, % p.~\pageref{NestedEnv}. % % @@ -1121,8 +1125,8 @@ version 2005/12/01 or later. % % \begin{tikzpicture}[remember picture,overlay] % \draw [WithArrows/arrow] -% ($(~emphase#first@-1-r.south)+(3mm,0)$) -% to ($(~emphase#second@-1-r.north)+(3mm,0)$) ; +% ([xshift=3mm]~emphase#first@-1-r.south) +% to ([xshift=3mm]~emphase#second@-1-r.north) ; % \end{tikzpicture} % \end{Verbatim} % @@ -1142,8 +1146,8 @@ version 2005/12/01 or later. % % \begin{tikzpicture}[remember picture,overlay] % \draw [WithArrows/arrow] -% ($(first-1-r.south)+(3mm,0)$) -% to ($(second-1-r.north)+(3mm,0)$) ; +% ([xshift=3mm]first-1-r.south) +% to ([xshift=3mm]second-1-r.north) ; % \end{tikzpicture} % % \section{The environment \{DispWithArrows\}} @@ -1154,14 +1158,14 @@ version 2005/12/01 or later. % the environments |{align}| and |{flalign}| of |amsmath|. % % \medskip -% The environment |{DispWithArrows}| must be used \emph{outside} math mode. +% The environment |{DispWithArrows}| must be used \emph{outside} math mode. Like |{align}|, it should be used in +% horizontal mode. % \begin{Verbatim} % \begin{~emphase#DispWithArrows@} % A & = (a+1)^2 \Arrow{we expand} \\ % & = a^2 + 2a + 1 % \end{~emphase#DispWithArrows@} % \end{Verbatim} -% % \begin{DispWithArrows} % A & = (a+1)^2 \Arrow{we expand} \\ % & = a^2 + 2a + 1 @@ -1174,8 +1178,7 @@ version 2005/12/01 or later. % \pkg{mathtools}) is loaded, it's also possible to use |\tag*| which, as in \pkg{amsmath}, typesets the tag % without the parenthesis.} % -% It's also possible to put a label to the line of an equation with the command |\label|.\footnote{As in the -% environment |{align}| of \pkg{amsmath}, it's not possible to put two commands |\label| in the same line.} +% It's also possible to put a label to the line of an equation with the command |\label|. % % These commands must be in the second column of the environment. % \begin{Verbatim} @@ -1184,7 +1187,6 @@ version 2005/12/01 or later. % & = a^2 + 2a + 1 ~emphase#\tag{$\star$} \label{my-equation}@ % \end{DispWithArrows} % \end{Verbatim} -% % \begin{DispWithArrows} % A & = (a+1)^2 \Arrow{we expand} \notag \\ % & = a^2 + 2a + 1 \tag{$\star$} \label{my-equation} @@ -1202,7 +1204,6 @@ version 2005/12/01 or later. % & = a^2 + 2a + 1 % \end{~emphase#DispWithArrows*@} % \end{Verbatim} -% % \begin{DispWithArrows*} % A & = (a+1)^2 \Arrow{we expand} \\ % & = a^2 + 2a + 1 @@ -1219,7 +1220,6 @@ version 2005/12/01 or later. % & = a^2 + 2a + 1 % \end{DispWithArrows} % \end{Verbatim} -% % \begin{DispWithArrows}[fleqn,mathindent = 1cm] % A & = (a+1)^2 \Arrow{we expand} \\ % & = a^2 + 2a + 1 @@ -1236,8 +1236,8 @@ version 2005/12/01 or later. % |\intertext| in the environments |{DispWithArrows}| and |{DispWithArrows*}| (and even the |\intertext| of % \pkg{nccmath} if this package is loaded). % -% If the option |leqno| is used (for the document or when the package \pkg{amsmath} is loaded), the labels will be -% composed on the left also for the environments |{DispWithArrows}| et |{DispWithArrows*}|. +% If the option |leqno| is used as a class option, the labels will be composed on the left also for the +% environments |{DispWithArrows}| et |{DispWithArrows*}|. % % \bigskip % The environment |{DispWithArrows}| is similar to the environment |{align}| of \pkg{amsmath}. However, @@ -1247,9 +1247,10 @@ version 2005/12/01 or later. % There are differences between |{DispWithArrows}| and |{align}|. % \begin{itemize} % \item The environment |{DispWithArrows}| allows only two columns. -% \item With |{DispWithArrows}|, there is no control of a collision between an equation and its tag. +% \item With |{DispWithArrows}|, an error is raised if there is a collision between an equation and its tag but the +% tag is not composed on the following line. % \item An environment |{DispWithArrows}| is always unbreakable (even with |\allowdisplaybreaks| of \pkg{amsmath}). -% \item The commands |\label|, |\tag|, |\notag|, |\nonumber| are allowed only in the second column. +% \item The commands |\label|, |\tag|, |\notag| and |\nonumber| are allowed only in the second column. % \item % \begin{bfseries} % Last but not least, by default, the elements of a \texttt{\{DispWithArrows\}} are composed in \texttt{textstyle} and not in @@ -1268,7 +1269,7 @@ version 2005/12/01 or later. % % \bigskip % The environments |{DispWithArrows}| and |{DispWithArrows*}| provide an option |wrap-lines|. With this option, -% the lines of the label are automaticly wrapped on the right.\label{wrap-lines} +% the lines of the label are automatically wrapped on the right.\label{wrap-lines} % % \begin{Verbatim} % \begin{DispWithArrows*}[displaystyle,~emphase#wrap-lines@] @@ -1277,18 +1278,16 @@ version 2005/12/01 or later. % \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\ % & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n} % {1-e^{i\frac{\pi}{2n}}}\right) -% \Arrow{This line has been wrapped automaticly.} \\ +% \Arrow{This line has been wrapped automatically.} \\ % & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) % \end{DispWithArrows*} % \end{Verbatim} -% -% % \begin{DispWithArrows*}[displaystyle,wrap-lines] % S_n % & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) % \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\ % & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right) -% \Arrow{This line has been wrapped automaticly.} \\ +% \Arrow{This line has been wrapped automatically.} \\ % & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) % \end{DispWithArrows*} % @@ -1497,7 +1496,9 @@ version 2005/12/01 or later. % \bigskip % \subsection{Examples with the option TikzCode} % -% We recall that the option |TikzCode| is the Tikz code used by \pkg{witharrows} to draw the arrows. +% We recall that the option |TikzCode| is the Tikz code used by \pkg{witharrows} to draw the arrows.\footnote{If an +% environment |{DispWithArrows}| or |{DispWithArrows*}| is used with the option |wrap-lines|, the value of the +% option |TikzCode| is not used for this environment (but is used for the environments nested inside).} % % \smallskip % The value by defaut of |TikzCode| is \verb|\draw (#1) to node {#3} (#2) ;| where the three markers |#1|, |#2| and @@ -1628,7 +1629,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{Verbatim} -% $\begin{WithArrows}[~emphase#CodeAfter = {\NumberedLoop}@] +% $\begin{WithArrows}[~emphase#CodeAfter = \NumberedLoop@] % a.\;& f \text{ est continuous on } E \\ % b.\;& f \text{ est continuous in } 0 \\ % c.\;& f \text{ is bounded on the unit sphere} \\ @@ -1646,7 +1647,7 @@ version 2005/12/01 or later. % \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\NbLines}{\NbLines}} % % -% $\begin{WithArrows}[CodeAfter = {\NumberedLoop}] +% $\begin{WithArrows}[CodeAfter = \NumberedLoop] % a.\;& f \text{ est continuous on } E \\ % b.\;& f \text{ est continuous in } 0 \\ % c.\;& f \text{ is bounded on the unit sphere} \\ @@ -1729,6 +1730,7 @@ version 2005/12/01 or later. \bool_new:N \g_@@_footnote_bool % \end{macrocode} % +% % \medskip % We define a set of keys |WithArrows/package| for these options. However, first, we define a ``level of options'' % |\l_@@_level_int| even if, in the version \myfileversion{} of \pkg{witharrows}, this integer is not used by the @@ -1737,18 +1739,30 @@ version 2005/12/01 or later. \int_new:N \l_@@_level_int % \end{macrocode} % +% % \begin{macrocode} \keys_define:nn {WithArrows/package} - {footnote .bool_gset:N = \g_@@_footnote_bool, - footnotehyper .bool_gset:N = \g_@@_footnotehyper_bool} + {footnote .bool_gset:N = \g_@@_footnote_bool, + footnotehyper .bool_gset:N = \g_@@_footnotehyper_bool, + unknown .code:n = \msg_fatal:nn {witharrows} + {Option~unknown~for~package}} % \end{macrocode} % +% \begin{macrocode} +\msg_new:nnn {witharrows} + {Option~unknown~for~package} + {You~can't~use~the~option~"\tl_use:N\l_keys_key_tl"~when~loading~the~ + package~witharrows.} +% \end{macrocode} +% +% % \bigskip % We process the options when the package is loaded (with |\usepackage|). % \begin{macrocode} \ProcessKeysOptions {WithArrows/package} % \end{macrocode} % +% % \medskip % \begin{macrocode} \msg_new:nnn {witharrows} @@ -1810,9 +1824,32 @@ version 2005/12/01 or later. % environments |{WithArrows}| and |{DispWithArrows}|). % % \bigskip +% \subsection{The class option leqno} +% +% The boolean |\c_@@_leqno_bool| will indicate if the class option |leqno| is used. When this option is used in LaTeX, +% the command |\@eqnnum| is redefined (as one can see in the file |leqno.clo|). That's enough to put the labels on +% the left in our environments |{DispWithArrows}| and |{DispWithArrows*}|. However, that's not enough when our +% option |wrap-lines| is used. That's why we have to know if this option is used as a class option. With the +% following programmation, |leqno| \emph{can't} be given as an option of \pkg{witharrows} (by design). +% \begin{macrocode} +\bool_new:N \c_@@_leqno_bool +\DeclareOption {leqno} {\bool_set_true:N \c_@@_leqno_bool} +\DeclareOption* {} +\ProcessOptions \relax +% \end{macrocode} +% +% +% +% \bigskip % \subsection{Some technical definitions} % -% We create booleans in order to known if some packages are loaded. For example, for the package \pkg{amsmath}, +% \begin{macrocode} +\cs_new_protected:Nn \@@_msg_error:n + {\msg_error:nn {witharrows} {#1}} +% \end{macrocode} +% +% \medskip +% We create booleans in order to know if some packages are loaded. For example, for the package \pkg{amsmath}, % the boolean is called |\c_@@_amsmath_loaded_bool|.\footnote{It's not possible to use |\@ifpackageloaded| in the % core of the functions because |\@ifpackageloaded| is available only in the preamble.} % \begin{macrocode} @@ -1858,10 +1895,14 @@ 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|). % \begin{macrocode} \tikzset{WithArrows/arrow/.style = { align = left, +% \end{macrocode} +% We have put the option |align = left| because we want to give the user the possibility of using |\\| in the labels. +% \begin{macrocode} auto = left, - font = {\small\itshape}, + font = \small\itshape, WithArrows/arrow/tips, bend~left = 45, -> }} @@ -2026,7 +2067,7 @@ version 2005/12/01 or later. % \begin{macrocode} \seq_new:N \l_@@_labels_seq \cs_set:Nn \@@_label:n {\seq_if_empty:NF \l_@@_labels_seq - {\msg_error:nn {witharrows} {Multiple~labels}} + {\@@_msg_error:n {Multiple~labels}} \seq_put_right:Nn \l_@@_labels_seq {#1} % \end{macrocode} % @@ -2094,16 +2135,16 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn {WithArrows/GlobalOrEnv} { t .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\int_set:Nn \l_@@_pos_env_int 0} - {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + {\int_set:Nn \l_@@_pos_env_int 0} + {\@@_msg_error:n {Option~will~be~ignored}}}, t .value_forbidden:n = true, c .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\int_set:Nn \l_@@_pos_env_int 1} - {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + {\int_set:Nn \l_@@_pos_env_int 1} + {\@@_msg_error:n {Option~will~be~ignored}}}, c .value_forbidden:n = true, b .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\int_set:Nn \l_@@_pos_env_int 2} - {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + {\int_set:Nn \l_@@_pos_env_int 2} + {\@@_msg_error:n {Option~will~be~ignored}}}, b .value_forbidden:n = true, % \end{macrocode} % @@ -2188,8 +2229,7 @@ version 2005/12/01 or later. % leftmost position. % \begin{macrocode} group .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} + {\@@_msg_error:n {Two~options~are~incompatible}} \int_set:Nn \l_@@_previous_pos_arrows_int 6 \int_set:Nn \l_@@_pos_arrows_int 6} , group .value_forbidden:n = true, @@ -2202,8 +2242,7 @@ version 2005/12/01 or later. % for a individual key. % \begin{macrocode} groups .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} + {\@@_msg_error:n {Two~options~are~incompatible}} \int_set:Nn \l_@@_previous_pos_arrows_int 7 \int_set:Nn \l_@@_pos_arrows_int 7} , groups .value_forbidden:n = true, @@ -2214,7 +2253,7 @@ version 2005/12/01 or later. % the eventual |\begin{savenotes}|). % \begin{macrocode} CodeBefore .code:n = {\int_compare:nNnTF \l_@@_level_int = 1 - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\tl_put_right:Nn \l_@@_code_before_tl {#1}}} , CodeBefore .value_required:n = true, % \end{macrocode} @@ -2224,7 +2263,7 @@ version 2005/12/01 or later. % eventual |\end{savenotes}|). % \begin{macrocode} CodeAfter .code:n = {\int_compare:nNnTF \l_@@_level_int = 1 - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\tl_put_right:Nn \l_@@_code_after_tl {#1}}} , CodeAfter .value_required:n = true, % \end{macrocode} @@ -2235,7 +2274,7 @@ version 2005/12/01 or later. % the environment). % \begin{macrocode} name .code:n = {\int_compare:nNnTF \l_@@_level_int = 1 - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\tl_set:Nn \l_@@_name_tl {#1}}} , name .value_required:n = true, % \end{macrocode} @@ -2244,7 +2283,7 @@ version 2005/12/01 or later. % The option |fleqn| indicates wether the environments |{DispWithArrows}| are composed centered or flush left. % \begin{macrocode} fleqn .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l_@@_fleqn_bool} {\bool_set_false:N \l_@@_fleqn_bool}}}, @@ -2255,7 +2294,7 @@ version 2005/12/01 or later. % The option |mathindent| is the left margin of the environments |{DispWithArrows}| when the option |fleqn| is used. % \begin{macrocode} mathindent .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\dim_set:Nn \l_@@_mathindent_dim {#1}}}, mathindent .value_required:n = true, % \end{macrocode} @@ -2264,7 +2303,7 @@ version 2005/12/01 or later. % The option |notag| indicates wether the environments |{DispWithArrows}| will be without tags (like |{DispWithArrows*}|). % \begin{macrocode} notag .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l_@@_notag_bool} {\bool_set_false:N \l_@@_notag_bool}}}, @@ -2277,26 +2316,26 @@ version 2005/12/01 or later. % |{DispWithArrows}| or |{DispWithArrows*}|. % \begin{macrocode} AllowMultipleLabels .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\msg_redirect_name:nnn {witharrows} {Multiple~labels} {none}}}, AllowMultipleLabels .value_forbidden:n = true, -% \begin{macrocode} +% \end{macrocode} % % \bigskip % With the option |wrap-lines|, a special |TikzCode| is used in the environments |{DispWithArrows}| and -% |{DispWithArrows*}| and, with this |TikzCode|, the lines of the labels are automaticly wrapped on the right. +% |{DispWithArrows*}| and, with this |TikzCode|, the lines of the labels are automatically wrapped on the right. % \begin{macrocode} wrap-lines .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + {\@@_msg_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l_@@_wrap_lines_bool} {\bool_set_false:N \l_@@_wrap_lines_bool}}}, wrap-lines .default:n = true, % \end{macrocode} % \begin{macrocode} - unknown .code:n = \msg_error:nn {witharrows} {Option~unknown} + unknown .code:n = \@@_msg_error:n {Option~unknown} } % \end{macrocode} % @@ -2340,8 +2379,7 @@ 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} - {\msg_error:nn {witharrows} - {Option~incompatible~with~"group(s)"}} + {\@@_msg_error:n {Option~incompatible~with~"group(s)"}} {\dim_set:Nn \l_@@_xoffset_dim {#1}}} , xoffset .value_required:n = true, % \end{macrocode} @@ -2353,8 +2391,7 @@ version 2005/12/01 or later. % \begin{macrocode} jot .code:n = {\int_compare:nNnTF \l_@@_level_int = 2 {\dim_set:Nn \jot {#1}} - {\msg_error:nn {witharrows} - {Option~will~be~ignored}}} , + {\@@_msg_error:n {Option~will~be~ignored}}} , jot .value_required:n = true, % \end{macrocode} % @@ -2365,16 +2402,15 @@ version 2005/12/01 or later. % \begin{macrocode} interline .code:n = {\int_compare:nNnTF \l_@@_level_int = 2 {\skip_set:Nn \l_@@_interline_skip {#1}} - {\msg_error:nn {witharrows} - {Option~will~be~ignored}}} , + {\@@_msg_error:n {Option~will~be~ignored}}} , interline .value_required:n = true, % \end{macrocode} % % \bigskip % Eventually, a key |jump| (see below) and a key for unknown keys. % \begin{macrocode} - jump .code:n = \msg_error:nn {witharrows} {Option~will~be~ignored} , - unknown .code:n = \msg_error:nn {witharrows} {Option~unknown} + jump .code:n = \@@_msg_error:n {Option~will~be~ignored} , + unknown .code:n = \@@_msg_error:n {Option~unknown} } % \end{macrocode} % @@ -2387,8 +2423,7 @@ version 2005/12/01 or later. \keys_define:nn {WithArrows/jump} {jump .code:n = {\int_set:Nn \l_@@_jump_int {#1} \int_compare:nNnF \l_@@_jump_int > 0 - {\msg_error:nn {witharrows} - {The~option~"jump"~must~be~non~negative}}} , + {\@@_msg_error:n {The~option~"jump"~must~be~non~negative}}} , jump .value_required:n = true} % \end{macrocode} % @@ -2398,8 +2433,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Nn \@@_analyze_option_position:n {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} + {\@@_msg_error:n {Two~options~are~incompatible}} \int_set:Nn \l_@@_previous_pos_arrows_int {#1} % \end{macrocode} % @@ -2410,8 +2444,7 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:nTF { \int_compare_p:nNn \l_@@_level_int = 3 && \int_compare_p:nNn \l_@@_pos_arrows_int > 5} - {\msg_error:nn {witharrows} - {Option~incompatible~with~"group(s)"}} + {\@@_msg_error:n {Option~incompatible~with~"group(s)"}} {\int_set:Nn \l_@@_pos_arrows_int {#1}}} % \end{macrocode} % @@ -2504,7 +2537,7 @@ version 2005/12/01 or later. % comparison) before the |\msg_error:nn|. % \begin{macrocode} {\tl_set:Nn \l_tmpa_tl {Arrow} - \msg_error:nn {witharrows} {Arrow~in~first~column} + \@@_msg_error:n {Arrow~in~first~column} \@@_Arrow} % \end{macrocode} % @@ -2620,8 +2653,7 @@ version 2005/12/01 or later. \NewDocumentEnvironment {WithArrows} {O{}} { \bool_set_true:N \l_@@_in_witharrows_bool \reverse_if:N \if_mode_math: - \msg_error:nn {witharrows} - {{WithArrows}~used~outside~math~mode} + \@@_msg_error:n {{WithArrows}~used~outside~math~mode} \fi: \cs_set:Npn \notag {\msg_error:nnn {witharrows} {Command~not~allowed~in~{WithArrows}} @@ -2715,7 +2747,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} - && \msg_error:nn {witharrows} {Third~column~in~an~environment~{WithArrows}} + && \@@_msg_error:n {Third~column~in~an~environment~{WithArrows}} $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$ \cr } @@ -2728,7 +2760,15 @@ version 2005/12/01 or later. {\crcr \egroup \egroup - \@@_post_environment:} + \@@_post_environment: +% \end{macrocode} +% +% \bigskip +% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment +% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}). +% \begin{macrocode} + \bool_if:NT \g_@@_footnote_bool {\end{savenotes}} +} % \end{macrocode} % This is the end of the environment |{WithArrows}|. % @@ -2743,7 +2783,7 @@ version 2005/12/01 or later. % an \textsc{pgf} error for an unknown node since the nodes are created in the second column). % \begin{macrocode} {\int_compare:nNnT \g_@@_line_bis_int < \g_@@_line_int - {\msg_error:nn {witharrows} {All~lines~must~have~an~ampersand}} + {\@@_msg_error:n {All~lines~must~have~an~ampersand}} % \end{macrocode} % % \bigskip @@ -2782,12 +2822,6 @@ version 2005/12/01 or later. \group_end: % \end{macrocode} % -% \bigskip -% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment -% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}). -% \begin{macrocode} - \bool_if:NT \g_@@_footnote_bool {\end{savenotes}} -% \end{macrocode} % % \bigskip % We update the position-in-the-tree. First, we drop the last component and then we increment the last element. @@ -2851,8 +2885,7 @@ version 2005/12/01 or later. % If there is no tag to put, we use as well the third column because you want to raise an error if the user uses % more than two columns. % \begin{macrocode} - {& \tikz [remember~picture,overlay] - \coordinate [name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-v ] ; } + {& \tikz [@@_standard] \coordinate (\int_use:N\g_@@_line_int-v) ; } { % \end{macrocode} % Here, we can't use |\refstepcounter{equation}| because if the user has issued a |\tag| command, we have to use @@ -2893,15 +2926,16 @@ version 2005/12/01 or later. % \end{macrocode} % % Then, an action done by \pkg{cleveref} in its redefinition of |\refstepcounter|. The package \pkg{cleveref} -% creates in the |aux| file a command |\cref@currentlabel| similar to |\@current| but with more informations. +% creates in the |aux| file a command |\cref@currentlabel| similar to |\@currentlabel| but with more informations. % \begin{macrocode} \bool_if:NT \c_@@_cleveref_loaded_bool {\cref@constructprefix{equation}{\cref@result} \@ifundefined{cref@equation@alias} {\def\@tempa{equation}} {\def\@tempa{\csname cref@equation@alias\endcsname}} - \protected@edef\cref@currentlabel{[\@tempa][\arabic{equation}][\cref@result] - \p@equation \g_tmpa_tl}} + \protected@edef\cref@currentlabel + {[\@tempa][\arabic{equation}][\cref@result] + \p@equation \g_tmpa_tl}} % \end{macrocode} % % Then, an action done by \pkg{typedref} in its redefinition of |\refstepcounter|. The command |\sr@name| is a @@ -2924,13 +2958,16 @@ version 2005/12/01 or later. \bool_if:NT \g_tmpa_bool {\cs_set:Npn \tagform@ {}} % \end{macrocode} % We use |\@eqnnum| (we recall that there are two definitions of |\@eqnnum|, a standard definition and another, loaded -% if the option |\leqno| is used). +% if the class option |leqno| is used). However, of course, the position of the |v|-node is not the same wether the +% option |leqno| is used or not. That's here that we use the flag |\c_@@_leqno_bool|. % \begin{macrocode} \hbox_overlap_left:n - { \tikz [@@_standard] - \coordinate [name = \int_use:N \g_@@_line_int-v ] ; - \quad - \@eqnnum} + {\bool_if:NF \c_@@_leqno_bool + {\tikz [@@_standard] \coordinate (\int_use:N\g_@@_line_int-v) ;} + \quad + \@eqnnum } + \bool_if:NT \c_@@_leqno_bool + {\tikz [@@_standard] \coordinate (\int_use:N \g_@@_line_int-v) ;} }} \cr\noalign{\skip_vertical:n {#1 + \l_@@_interline_skip} \scan_stop:}} @@ -2953,7 +2990,7 @@ version 2005/12/01 or later. \NewDocumentEnvironment {DispWithArrows} {O{}} { % \end{macrocode} -% If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we deactivate the code of \pkg{mathtools} for +% If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we disable the code of \pkg{mathtools} for % the option |showonlyrefs| with the command |\MT_showonlyrefs_false:| (it will be reactivated at the end of % the environment). % \begin{macrocode} @@ -2971,17 +3008,18 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ \if_mode_math: - \msg_error:nn {witharrows} - {{DispWithArrows}~used~in~math~mode} + \@@_msg_error:n {{DispWithArrows}~used~in~math~mode} \fi: \bool_set_false:N \l_@@_in_witharrows_bool \@@_pre_environment:n {#1} % \end{macrocode} % We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a redefinition of |\[|. However, we -% put the two following lines which are in the definition of |\[|. +% put the following lines which are in the definition of |\[| even though they are in case of misuse. % \begin{macrocode} - \nointerlineskip - \makebox[.6\linewidth]{} + \if_mode_vertical: + \nointerlineskip + \makebox[.6\linewidth]{} + \fi: $$ % \end{macrocode} % We use a |\vcenter| in order to prevent page breaks in the environment. @@ -3002,14 +3040,14 @@ version 2005/12/01 or later. {Command~not~allowed~in~{DispWithArrows}} {\notag}} \cs_set:Npn \nonumber {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\nonumber}} + {Command~not~allowed~in~{DispWithArrows}} + {\nonumber}} \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\tag}} + {Command~not~allowed~in~{DispWithArrows}} + {\tag}} \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\label}} + {Command~not~allowed~in~{DispWithArrows}} + {\label}} \halign to \displaywidth \bgroup \int_gincr:N \g_@@_line_int \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_first_column: @@ -3043,7 +3081,7 @@ version 2005/12/01 or later. -\int_use:N\g_@@_line_int}} & ## \tabskip = \c_zero_skip - && \msg_error:nn {witharrows} {Third~column~in~an~environment~{DispWithArrows}} + && \@@_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} \iffalse ## \fi \cr} {\\ @@ -3055,13 +3093,12 @@ version 2005/12/01 or later. % The following |\egroup| is for the |\vcenter| (aimed to prevent page breaks). % \begin{macrocode} \egroup - $$ % \end{macrocode} % % If the option |wrap-lines| is used (only in |{DispWithArrows}| and |{DispWithArrows*}|), we compute % |\g_@@_x_right_dim|. As a first approximation, |\g_@@_x_right_dim| is the $x$-value of the right side of the % current composition box. In fact, we must take into account the potential labels of the equations. That's why -% we compute |\g_@@_x_right_dim| with the |v|-nodes of each row specificaly built in this goal. |\g_@@_x_right_dim| +% we compute |\g_@@_x_right_dim| with the |v|-nodes of each row specifically built in this goal. |\g_@@_x_right_dim| % is the minimal value of the $x$-value of these nodes. % \begin{macrocode} \bool_if:NT \l_@@_wrap_lines_bool @@ -3075,7 +3112,22 @@ version 2005/12/01 or later. {\dim_gset:Nn \g_@@_x_right_dim \l_tmpa_dim} } \end{tikzpicture}} % \end{macrocode} -% +% +% \bigskip +% We test wether there is a collision between a line and a label of equation. If there is no problem, we should +% probably merge this code with the previous one. +% \begin{macrocode} + {\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 + \tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-l) + \dim_set:Nn \l_tmpb_dim \pgf@x + \dim_compare:nNnT \l_tmpb_dim > \l_tmpa_dim + {\@@_msg_error:n {Collision}}} + \end{tikzpicture}} +% \end{macrocode} +% % \bigskip % The code in |\@@_post_environment:| is common to |{WithArrows}| and |{DispWithArrows}|. % \begin{macrocode} @@ -3088,6 +3140,13 @@ version 2005/12/01 or later. \bool_if:nT \c_@@_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} \MT_showonlyrefs_true:} + $$ +% \end{macrocode} +% \bigskip +% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment +% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}). +% \begin{macrocode} + \bool_if:NT \g_@@_footnote_bool {\end{savenotes}} \ignorespacesafterend } % \end{macrocode} @@ -3112,7 +3171,7 @@ version 2005/12/01 or later. % |\@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} - { \msg_error:nn {witharrows} {tag*~without~amsmath} } + { \@@_msg_error:n {tag*~without~amsmath} } } % \end{macrocode} % @@ -3291,11 +3350,11 @@ version 2005/12/01 or later. % the case where the user goes on and we try to avoid other errors.} % \begin{macrocode} \int_compare:nNnTF \l_@@_final_int > \g_@@_line_int - {\msg_error:nn {witharrows} {Too~few~lines~for~an~arrow}} - {\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-\int_use:N\l_@@_initial_int-l} - { \msg_error:nn {witharrows} {A~PGF~node~doesn't~exist} } - {\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-\int_use:N\l_@@_final_int-l} - { \msg_error:nn {witharrows} {A~PGF~node~doesn't~exist} } + {\@@_msg_error:n {Too~few~lines~for~an~arrow}} + {\cs_if_free:cTF{pgf@sh@ns@wa-\l_@@_prefix_str-\int_use:N\l_@@_initial_int-l} + { \@@_msg_error:n {A~PGF~node~doesn't~exist} } + {\cs_if_free:cTF{pgf@sh@ns@wa-\l_@@_prefix_str-\int_use:N\l_@@_final_int-l} + { \@@_msg_error:n {A~PGF~node~doesn't~exist} } {\@@_draw_arrows_i:}}} \int_incr:N \l_@@_arrow_int } @@ -3467,20 +3526,15 @@ version 2005/12/01 or later. \cs_new_protected:Nn \@@_draw_arrow:nnn { % \end{macrocode} +% % \medskip -% If the option |wrap-lines| is used, we have to use a special version of |TikzCode|. Here is the use of -% |\g_@@_x_right_dim| which has been computed previously with the |v|-nodes. +% 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|). % \begin{macrocode} \bool_if:nT {\l_@@_wrap_lines_bool && ! \l_@@_in_witharrows_bool} - {\tl_set:Nn \l_@@_tikz_code_tl - {\draw (##1) to node (@@_label) {} (##2) ; - \tikz@parse@node \pgfutil@firstofone (@@_label.west) - \path (@@_label.west) - node [anchor = west, - text~width = \dim_eval:n {\g_@@_x_right_dim - \pgf@x - 0.3333 em}] - {##3} ; }} + { \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_wrap_lines_tl } % \end{macrocode} -% |0.3333 em| is the default value of |inner sep| in the nodes of Tikz. Maybe we should put the exact Tikz parameter. +% % \medskip % Now, the main lines of this function |\@@_draw_arrow:nnn|. % \begin{macrocode} @@ -3489,7 +3543,49 @@ version 2005/12/01 or later. \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|). +% \begin{macrocode} +\tl_set:Nn \c_@@_tikz_code_wrap_lines_tl + { +% \end{macrocode} +% First, we draw the arrow without the label. +% \begin{macrocode} + \draw (#1) to node (@@_label) {} (#2) ; +% \end{macrocode} +% We retrieve in |\pgf@x| the abscissa of the left-side of the label we will put. +% \begin{macrocode} + \tikz@parse@node \pgfutil@firstofone (@@_label.west) +% \end{macrocode} +% We compute in |\l_tmpa_dim| the maximal width possible for the label. |0.3333 em| is the default value of +% |inner sep| in the nodes of Tikz. Maybe we should put the exact Tikz parameter. Here is the use of +% |\g_@@_x_right_dim| which has been computed previously with the |v|-nodes. +% \begin{macrocode} + \dim_set:Nn \l_tmpa_dim {\g_@@_x_right_dim - \pgf@x - 0.3333 em} +% \end{macrocode} +% We retrieve in |\g_tmpa_tl| the current value of the Tikz parameter ``|text width|''.\footnote{In fact, it's not +% the current value of ``|text width|'': it's the value of ``|text width|'' set in the option |tikz| provided by +% \pkg{witharrows}. These options are given to Tikz in a ``|every path|''. That's why we have to retrieve it in a path.} +% \begin{macrocode} + \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; +% \end{macrocode} +% Maybe the current value of the parameter ``|text width|'' is shorter than |\l_tmpa_dim|. In this case, we must +% use ``|text width|'' (we update |\l_tmpa_dim|). +% \begin{macrocode} + \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}} +% \end{macrocode} +% Now, we can put the label with the right value for |``text width''|. +% \begin{macrocode} + \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim + {\path (@@_label.west) + node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] + {#3} ; } } +% \end{macrocode} +% % \bigskip % The command |\@@_update_x_value:nn| will analyze the lines\footnote{If a line has no ampersand, this line is % ignored. In fact, we raise an error if there is a line without ampersand but, nonetheless, we consider the case @@ -3499,7 +3595,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} \c_one {#2} + {\int_step_inline:nnnn {#1} 1 {#2} {\cs_if_exist:cT {pgf@sh@ns@wa-\l_@@_prefix_str-##1-l} {\begin{tikzpicture} [@@_standard] \tikz@scan@one@point\pgfutil@firstofone (##1-l) @@ -3579,15 +3675,17 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_tmpb_dim \pgf@y \tikz@scan@one@point\pgfutil@firstofone(#3-l.north) \dim_set:Nn \l_tmpa_dim {\dim_max:nn \l_tmpa_dim \pgf@x} - \tl_gset:Nx \g_tmpa_tl {\dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim} - \tl_gset:Nx \g_tmpb_tl {\dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y} + \tl_gset:Nx \g_tmpa_tl + {\dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim} + \tl_gset:Nx \g_tmpb_tl + {\dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y} \end{tikzpicture} } {\begin{tikzpicture} [@@_standard] \tikz@scan@one@point\pgfutil@firstofone - (#2-\bool_if:NTF\l_@@_initial_r_bool rl .south) + (#2-\bool_if:NTF\l_@@_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_@@_final_r_bool rl .north) + (#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} }} @@ -3618,7 +3716,7 @@ version 2005/12/01 or later. % We sort the list |\g_tmpa_clist| because we want to extract the minimum and the maximum. % \begin{macrocode} \int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2 - {\msg_error:nn {witharrows} {Too~small~specification~for~MultiArrow}} + {\@@_msg_error:n {Too~small~specification~for~MultiArrow}} {\clist_sort:Nn \g_tmpa_clist {\int_compare:nNnTF {##1} > {##2} {\sort_return_swapped:} @@ -3629,8 +3727,8 @@ version 2005/12/01 or later. \clist_pop:NN \g_tmpa_clist \l_tmpa_tl % \end{macrocode} % -% We extract the maximum in |\l_tmpb_tl|. The remaining list (in |\g_tmpa_clist| will be sorted in decreasing order -% but never mind...). +% We extract the maximum in |\l_tmpb_tl|. The remaining list (in |\g_tmpa_clist|) will be sorted in decreasing order +% but never mind... % \begin{macrocode} \clist_reverse:N \g_tmpa_clist \clist_pop:NN \g_tmpa_clist \l_tmpb_tl @@ -3639,7 +3737,7 @@ version 2005/12/01 or later. % We draw the teeth of the rak (except the first one and the last one) with the auxiliary function % |\@@_MultiArrow_i:n|. This auxiliary fonction is necessary to expand the specification of the list in the % |\foreach| loop. The first and the last teeth of the rak can't be drawn the same way as the others (think, for -% example, to the case of the option ``rounded corners'' is used). +% example, to the case of the option ``|rounded corners|'' is used). % \begin{macrocode} \exp_args:Nx \@@_MultiArrow_i:n {\g_tmpa_clist} % \end{macrocode} @@ -3653,13 +3751,15 @@ version 2005/12/01 or later. ([xshift = \l_@@_xoffset_dim+5mm]\l_tmpb_tl-r.south) -- ([xshift = \l_@@_xoffset_dim]\l_tmpb_tl-r.south) ; \tikz@parse@node \pgfutil@firstofone (@@_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_@@_wrap_lines_bool && ! \l_@@_in_witharrows_bool} + {\dim_set:Nn \l_tmpb_dim {\g_@@_x_right_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 (@@_label.west) - node [anchor = west, - text~width = - {\bool_if:nTF {\l_@@_wrap_lines_bool && ! \l_@@_in_witharrows_bool} - {\dim_eval:n {\g_@@_x_right_dim - \pgf@x - 0.3333 em}} - {20 cm}} - ] {#2} ; + node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] {#2} ; \end{tikzpicture} } } \cs_new_protected:Nn \@@_MultiArrow_i:n @@ -3672,6 +3772,22 @@ version 2005/12/01 or later. % % \bigskip % \subsection{The error messages of the package} +% +% \begin{macrocode} +\msg_new:nnn {witharrows} + {Option~unknown} + {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} + {Collision} + {You~have~a~collision~(or~almost~a~collision)~at~the~end~of~row~ + \int_use:N\g_@@_line_int.~ + You~can~go~on~but~maybe~you~will~have~overlapping~texts.} +% \end{macrocode} +% % \begin{macrocode} \msg_new:nnn {witharrows} {Third~column~in~an~environment~{WithArrows}} @@ -3748,7 +3864,7 @@ version 2005/12/01 or later. {All~lines~must~have~an~ampersand} {All~lines~of~an~environment~\{WithArrows\}~should~ have~an~second~column~(because~the~nodes~are~created~ - in~the~second~column).~However,~you~can~go~but~you~will~ + in~the~second~column).~However,~you~can~go~on~but~you~will~ have~an~error~if~one~of~your~arrows~needs~an~PGF~ node~absent~by~lack~of~ampersand.~If~you~don't~want~to~ see~this~message~again,~you~can~use~the~option~ @@ -3777,12 +3893,6 @@ version 2005/12/01 or later. % \end{macrocode} % % -% \begin{macrocode} -\msg_new:nnn {witharrows} - {Option~unknown} - {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} @@ -3791,11 +3901,7 @@ version 2005/12/01 or later. \tl_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.~ - This~is~a~restriction~of~the~version~1.3~of~the~ - package~witharrows~(in~the~aim~of~developping~further~ - ~a~new~functionality~with~\token_to_str:N\Arrow\ in~the~ - first~column).\\ + ~in~the~first~column~but~only~in~the~second~column.\\ However~you~can~go~on~for~this~time.} % \end{macrocode} % @@ -3898,8 +4004,7 @@ version 2005/12/01 or later. \bool_set_true:N \l_@@_notag_bool}} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ \if_mode_math: - \msg_error:nn {witharrows} - {{DispWithArrows}~used~in~math~mode} + \@@_msg_error:n {{DispWithArrows}~used~in~math~mode} \fi: \bool_set_false:N \l_@@_in_witharrows_bool % @@ -3916,17 +4021,17 @@ version 2005/12/01 or later. {\cs_set_eq:NN \_@@_old_label \ltx@label} {\cs_set_eq:NN \_@@_old_label \label} \cs_set:Npn \notag {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\notag}} + {Command~not~allowed~in~{DispWithArrows}} + {\notag}} \cs_set:Npn \nonumber {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\nonumber}} + {Command~not~allowed~in~{DispWithArrows}} + {\nonumber}} \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\tag}} + {Command~not~allowed~in~{DispWithArrows}} + {\tag}} \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\label}} + {Command~not~allowed~in~{DispWithArrows}} + {\label}} \halign to \displaywidth \bgroup \int_gincr:N \g_@@_line_int \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_first_column: @@ -3949,19 +4054,19 @@ version 2005/12/01 or later. \node [@@_node_style, name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-l, alias = {\tl_if_empty:NF \l_@@_name_tl - {\l_@@_name_tl-\int_use:N\g_@@_line_int-l}} ] {} ; + {\l_@@_name_tl-\int_use:N\g_@@_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \node [@@_node_style, - name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-r, - alias = {\tl_if_empty:NF \l_@@_name_tl - {\l_@@_name_tl-\int_use:N\g_@@_line_int-r}} ] {} ; + \node [@@_node_style, + name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-r, + alias = {\tl_if_empty:NF \l_@@_name_tl + {\l_@@_name_tl-\int_use:N\g_@@_line_int-r}} ] {} ; \bool_if:NT \l_@@_shownodenames_bool {\hbox_overlap_right:n {\small wa-\l_@@_prefix_str -\int_use:N\g_@@_line_int}} & ## \tabskip = \c_zero_skip - && \msg_error:nn {witharrows} {Third~column~in~an~environment~{DispWithArrows}} + && \@@_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} \if_false: ## \fi: \cr} { \\ @@ -3988,7 +4093,8 @@ version 2005/12/01 or later. + \box_dp:N \l_@@_halign_coffin} $\left\{ \vcenter to \l_tmpa_dim {\vfil} \right.$} \hfil} - \coffin_typeset:Nnnnn \l_@@_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim + \coffin_typeset:Nnnnn + \l_@@_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim $$ \_@@_post_environment: \bool_if:nT \c_@@_mathtools_loaded_bool @@ -4065,9 +4171,20 @@ version 2005/12/01 or later. % % \subsection{Changes between 1.8 and 1.9} % -% New options |wrap-lines| for the environments |{DispWithArrows}| and |{DispWithArrows*}|. +% New option |wrap-lines| for the environments |{DispWithArrows}| and |{DispWithArrows*}|. +% +% \subsection{Changes between 1.9 and 1.10} +% +% If the option |wrap-lines| is used, the option ``|text width|'' of Tikz is still active: if the value given to +% ``|text width|'' is lower than the width computed by |wrap-lines|, this value is used to wrap the lines. +% +% The option |wrap-lines| is now fully compatible with the class option |leqno|. +% +% Correction of a bug: |\nointerlineskip| and |\makebox[.6\linewidth]{}| should be inserted in |{DispWithArrows}| +% only in vertical mode. +% % \endinput % % Local Variables: % TeX-fold-mode: nil -% End: +% End diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index f9bb8aa968a..5b9bb5d4710 100644 --- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{1.9} -\def\myfiledate{2018/08/17} +\def\myfileversion{1.10} +\def\myfiledate{2018/09/13} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} \RequirePackage{l3keys2e} @@ -29,12 +29,18 @@ {\myfileversion} {Draws arrows for explanations on the right} \RequirePackage{xparse} -\bool_new:N \g__wa_footnotehyper_bool -\bool_new:N \g__wa_footnote_bool -\int_new:N \l__wa_level_int +\bool_new:N \g__ww_footnotehyper_bool +\bool_new:N \g__ww_footnote_bool +\int_new:N \l__ww_level_int \keys_define:nn {WithArrows/package} - {footnote .bool_gset:N = \g__wa_footnote_bool, - footnotehyper .bool_gset:N = \g__wa_footnotehyper_bool} + {footnote .bool_gset:N = \g__ww_footnote_bool, + footnotehyper .bool_gset:N = \g__ww_footnotehyper_bool, + unknown .code:n = \msg_fatal:nn {witharrows} + {Option~unknown~for~package}} +\msg_new:nnn {witharrows} + {Option~unknown~for~package} + {You~can't~use~the~option~"\tl_use:N\l_keys_key_tl"~when~loading~the~ + package~witharrows.} \ProcessKeysOptions {WithArrows/package} \msg_new:nnn {witharrows} {Option~incompatible~with~Beamer} @@ -54,7 +60,7 @@ If~you~want,~you~can~use~the~option~"footnote"~and~the~footnotes~ within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~ of~the~package~footnote.} -\bool_if:NT \g__wa_footnote_bool +\bool_if:NT \g__ww_footnote_bool {\@ifclassloaded {beamer} {\msg_fatal:nn {witharrows} {Option~incompatible~with~Beamer}} @@ -64,7 +70,7 @@ {footnote~with~footnotehyper~package}} {} \usepackage{footnote}} -\bool_if:NT \g__wa_footnotehyper_bool +\bool_if:NT \g__ww_footnotehyper_bool {\@ifclassloaded {beamer} {\msg_fatal:nn {witharrows} {Option~incompatible~with~Beamer}} @@ -74,91 +80,97 @@ {footnotehyper~with~footnote~package}} {} \usepackage{footnotehyper} - \bool_gset_true:N \g__wa_footnote_bool} + \bool_gset_true:N \g__ww_footnote_bool} +\bool_new:N \c__ww_leqno_bool +\DeclareOption {leqno} {\bool_set_true:N \c__ww_leqno_bool} +\DeclareOption* {} +\ProcessOptions \relax +\cs_new_protected:Nn \__ww_msg_error:n + {\msg_error:nn {witharrows} {#1}} \AtBeginDocument{\clist_map_inline:nn {amsmath,mathtools,autonum,cleveref,hyperref,typedref} - {\bool_new:c {c__wa_#1_loaded_bool} + {\bool_new:c {c__ww_#1_loaded_bool} \@ifpackageloaded {#1} - {\bool_set_true:c {c__wa_#1_loaded_bool}} + {\bool_set_true:c {c__ww_#1_loaded_bool}} {}}} -\tikzset{__wa_node_style/.style= { - above = \l__wa_ystart_dim, +\tikzset{__ww_node_style/.style= { + above = \l__ww_ystart_dim, inner~sep = 0 pt, minimum~width = 0pt, - minimum~height = \l__wa_ygap_dim, + minimum~height = \l__ww_ygap_dim, red, - \bool_if:NT \l__wa_shownodes_bool {draw} }} -\tikzset{__wa_standard/.style= { remember~picture, + \bool_if:NT \l__ww_shownodes_bool {draw} }} +\tikzset{__ww_standard/.style= { remember~picture, overlay, - name~prefix = wa-\l__wa_prefix_str- }} + name~prefix = wa-\l__ww_prefix_str- }} \tikzset{WithArrows/arrow/tips/.style = { > = {Straight~Barb[scale=1.2,bend]} }} \tikzset{WithArrows/arrow/.style = { align = left, auto = left, - font = {\small\itshape}, + font = \small\itshape, WithArrows/arrow/tips, bend~left = 45, -> }} \AtBeginDocument - {\bool_if:NF \c__wa_amsmath_loaded_bool + {\bool_if:NF \c__ww_amsmath_loaded_bool {\cs_set_protected:Npn \spread@equation {\openup\jot \cs_set_protected:Npn \spread@equation {}}}} -\bool_new:N \l__wa_in_witharrows_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_arrows_int -\int_new:N \l__wa_previous_pos_arrows_int -\dim_new:N \g__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 -\seq_new:N \g__wa_line_bis_int_seq -\int_new:N \g__wa_line_bis_int -\tl_new:N \l__wa_name_tl -\bool_new:N \l__wa_notag_bool -\tl_new:N \l__wa_tag_tl -\bool_new:N \l__wa_tag_star_bool -\seq_new:N \l__wa_labels_seq -\cs_set:Nn \__wa_label:n {\seq_if_empty:NF \l__wa_labels_seq - {\msg_error:nn {witharrows} {Multiple~labels}} - \seq_put_right:Nn \l__wa_labels_seq {#1} - \bool_if:nT \c__wa_mathtools_loaded_bool +\bool_new:N \l__ww_in_witharrows_bool +\seq_new:N \g__ww_position_in_the_tree_seq +\seq_gput_right:Nn \g__ww_position_in_the_tree_seq 1 +\int_new:N \g__ww_last_env_int +\skip_new:N \l__ww_interline_skip +\int_new:N \l__ww_pos_env_int +\dim_new:N \l__ww_xoffset_dim +\dim_set:Nn \l__ww_xoffset_dim {3mm} +\int_new:N \l__ww_pos_arrows_int +\int_new:N \l__ww_previous_pos_arrows_int +\dim_new:N \g__ww_x_dim +\seq_new:N \g__ww_arrow_int_seq +\int_new:N \g__ww_arrow_int +\seq_new:N \g__ww_line_int_seq +\int_new:N \g__ww_line_int +\seq_new:N \g__ww_line_bis_int_seq +\int_new:N \g__ww_line_bis_int +\tl_new:N \l__ww_name_tl +\bool_new:N \l__ww_notag_bool +\tl_new:N \l__ww_tag_tl +\bool_new:N \l__ww_tag_star_bool +\seq_new:N \l__ww_labels_seq +\cs_set:Nn \__ww_label:n {\seq_if_empty:NF \l__ww_labels_seq + {\__ww_msg_error:n {Multiple~labels}} + \seq_put_right:Nn \l__ww_labels_seq {#1} + \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\cs_if_exist:cTF {MT_r_#1} - {\bool_set_false:N \l__wa_notag_bool} - {\bool_set_true:N \l__wa_notag_bool}}} - \bool_if:nT \c__wa_autonum_loaded_bool + {\bool_set_false:N \l__ww_notag_bool} + {\bool_set_true:N \l__ww_notag_bool}}} + \bool_if:nT \c__ww_autonum_loaded_bool {\cs_if_exist:cTF {autonum@#1Referenced} - {\bool_set_false:N \l__wa_notag_bool} - {\bool_set_true:N \l__wa_notag_bool}}} -\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 -\int_set:Nn \l__wa_level_int 1 + {\bool_set_false:N \l__ww_notag_bool} + {\bool_set_true:N \l__ww_notag_bool}}} +\bool_new:N \l__ww_fleqn_bool +\dim_new:N \l__ww_mathindent_dim +\dim_set:Nn \l__ww_mathindent_dim {25pt} +\bool_new:N \l__ww_wrap_lines_bool +\int_set:Nn \l__ww_level_int 1 \keys_define:nn {WithArrows/GlobalOrEnv} - { t .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\int_set:Nn \l__wa_pos_env_int 0} - {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + { t .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\int_set:Nn \l__ww_pos_env_int 0} + {\__ww_msg_error:n {Option~will~be~ignored}}}, t .value_forbidden:n = true, - c .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\int_set:Nn \l__wa_pos_env_int 1} - {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + c .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\int_set:Nn \l__ww_pos_env_int 1} + {\__ww_msg_error:n {Option~will~be~ignored}}}, c .value_forbidden:n = true, - b .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\int_set:Nn \l__wa_pos_env_int 2} - {\msg_error:nn {witharrows} {Option~will~be~ignored}}}, + b .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\int_set:Nn \l__ww_pos_env_int 2} + {\__ww_msg_error:n {Option~will~be~ignored}}}, b .value_forbidden:n = true, - ygap .dim_set:N = \l__wa_ygap_dim, + ygap .dim_set:N = \l__ww_ygap_dim, ygap .value_required:n = true, ygap .initial:n = 0.4 ex, - ystart .dim_set:N = \l__wa_ystart_dim, + ystart .dim_set:N = \l__ww_ystart_dim, ystart .value_required:n = true, ystart .initial:n = 0.4 ex, MoreColumns .code:n = { \msg_redirect_name:nnn @@ -171,179 +183,170 @@ {All~lines~must~have~an~ampersand} {none} }, AllowLineWithoutAmpersand .value_forbidden:n = true, - CommandName .tl_set:N = \l__wa_CommandName_tl, + CommandName .tl_set:N = \l__ww_CommandName_tl, CommandName .initial:n = Arrow , CommandName .value_required:n = true, - TikzCode .tl_set:N = \l__wa_tikz_code_tl, + TikzCode .tl_set:N = \l__ww_tikz_code_tl, TikzCode .initial:n = \draw~(#1)~to~node{#3}~(#2)~; , TikzCode .value_required:n = true, - displaystyle .bool_set:N = \l__wa_displaystyle_bool, + displaystyle .bool_set:N = \l__ww_displaystyle_bool, displaystyle .initial:n = false, - shownodes .bool_set:N = \l__wa_shownodes_bool, + shownodes .bool_set:N = \l__ww_shownodes_bool, shownodes .initial:n = false, - shownodenames .bool_set:N = \l__wa_shownodenames_bool, + shownodenames .bool_set:N = \l__ww_shownodenames_bool, shownodenames .initial:n = false, - group .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrows_int > {-1} - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \int_set:Nn \l__wa_previous_pos_arrows_int 6 - \int_set:Nn \l__wa_pos_arrows_int 6} , + group .code:n = {\int_compare:nNnT \l__ww_previous_pos_arrows_int > {-1} + {\__ww_msg_error:n {Two~options~are~incompatible}} + \int_set:Nn \l__ww_previous_pos_arrows_int 6 + \int_set:Nn \l__ww_pos_arrows_int 6} , group .value_forbidden:n = true, - groups .code:n = {\int_compare:nNnT \l__wa_previous_pos_arrows_int > {-1} - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \int_set:Nn \l__wa_previous_pos_arrows_int 7 - \int_set:Nn \l__wa_pos_arrows_int 7} , + groups .code:n = {\int_compare:nNnT \l__ww_previous_pos_arrows_int > {-1} + {\__ww_msg_error:n {Two~options~are~incompatible}} + \int_set:Nn \l__ww_previous_pos_arrows_int 7 + \int_set:Nn \l__ww_pos_arrows_int 7} , groups .value_forbidden:n = true, - CodeBefore .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 - {\msg_error:nn {witharrows} {Option~will~be~ignored}} - {\tl_put_right:Nn \l__wa_code_before_tl {#1}}} , + CodeBefore .code:n = {\int_compare:nNnTF \l__ww_level_int = 1 + {\__ww_msg_error:n {Option~will~be~ignored}} + {\tl_put_right:Nn \l__ww_code_before_tl {#1}}} , CodeBefore .value_required:n = true, - CodeAfter .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 - {\msg_error:nn {witharrows} {Option~will~be~ignored}} - {\tl_put_right:Nn \l__wa_code_after_tl {#1}}} , + CodeAfter .code:n = {\int_compare:nNnTF \l__ww_level_int = 1 + {\__ww_msg_error:n {Option~will~be~ignored}} + {\tl_put_right:Nn \l__ww_code_after_tl {#1}}} , CodeAfter .value_required:n = true, - name .code:n = {\int_compare:nNnTF \l__wa_level_int = 1 - {\msg_error:nn {witharrows} {Option~will~be~ignored}} - {\tl_set:Nn \l__wa_name_tl {#1}}} , + name .code:n = {\int_compare:nNnTF \l__ww_level_int = 1 + {\__ww_msg_error:n {Option~will~be~ignored}} + {\tl_set:Nn \l__ww_name_tl {#1}}} , name .value_required:n = true, - fleqn .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + fleqn .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\__ww_msg_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wa_fleqn_bool} - {\bool_set_false:N \l__wa_fleqn_bool}}}, + {\bool_set_true:N \l__ww_fleqn_bool} + {\bool_set_false:N \l__ww_fleqn_bool}}}, fleqn .default:n = true, - mathindent .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} - {\dim_set:Nn \l__wa_mathindent_dim {#1}}}, + mathindent .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\__ww_msg_error:n {Option~will~be~ignored}} + {\dim_set:Nn \l__ww_mathindent_dim {#1}}}, mathindent .value_required:n = true, - notag .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + notag .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\__ww_msg_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wa_notag_bool} - {\bool_set_false:N \l__wa_notag_bool}}}, + {\bool_set_true:N \l__ww_notag_bool} + {\bool_set_false:N \l__ww_notag_bool}}}, notag .default:n = true, nonumber .meta:n = notag, - AllowMultipleLabels .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + AllowMultipleLabels .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\__ww_msg_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__wa_in_witharrows_bool - {\msg_error:nn {witharrows} {Option~will~be~ignored}} + wrap-lines .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool + {\__ww_msg_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} - {\bool_set_true:N \l__wa_wrap_lines_bool} - {\bool_set_false:N \l__wa_wrap_lines_bool}}}, + {\bool_set_true:N \l__ww_wrap_lines_bool} + {\bool_set_false:N \l__ww_wrap_lines_bool}}}, wrap-lines .default:n = true, - unknown .code:n = \msg_error:nn {witharrows} {Option~unknown} + unknown .code:n = \__ww_msg_error:n {Option~unknown} } \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 = \__wa_analyze_option_position:n 0 , + rr .code:n = \__ww_analyze_option_position:n 0 , ll .value_forbidden:n = true, - ll .code:n = \__wa_analyze_option_position:n 1 , + ll .code:n = \__ww_analyze_option_position:n 1 , rl .value_forbidden:n = true, - rl .code:n = \__wa_analyze_option_position:n 2 , + rl .code:n = \__ww_analyze_option_position:n 2 , lr .value_forbidden:n = true, - lr .code:n = \__wa_analyze_option_position:n 3 , + lr .code:n = \__ww_analyze_option_position:n 3 , i .value_forbidden:n = true, - 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_arrows_int > 5} - {\msg_error:nn {witharrows} - {Option~incompatible~with~"group(s)"}} - {\dim_set:Nn \l__wa_xoffset_dim {#1}}} , + i .code:n = \__ww_analyze_option_position:n 5 , + xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__ww_level_int = 3 && + \int_compare_p:nNn \l__ww_pos_arrows_int > 5} + {\__ww_msg_error:n {Option~incompatible~with~"group(s)"}} + {\dim_set:Nn \l__ww_xoffset_dim {#1}}} , xoffset .value_required:n = true, - jot .code:n = {\int_compare:nNnTF \l__wa_level_int = 2 + jot .code:n = {\int_compare:nNnTF \l__ww_level_int = 2 {\dim_set:Nn \jot {#1}} - {\msg_error:nn {witharrows} - {Option~will~be~ignored}}} , + {\__ww_msg_error:n {Option~will~be~ignored}}} , jot .value_required:n = true, - interline .code:n = {\int_compare:nNnTF \l__wa_level_int = 2 - {\skip_set:Nn \l__wa_interline_skip {#1}} - {\msg_error:nn {witharrows} - {Option~will~be~ignored}}} , + interline .code:n = {\int_compare:nNnTF \l__ww_level_int = 2 + {\skip_set:Nn \l__ww_interline_skip {#1}} + {\__ww_msg_error:n {Option~will~be~ignored}}} , interline .value_required:n = true, - jump .code:n = \msg_error:nn {witharrows} {Option~will~be~ignored} , - unknown .code:n = \msg_error:nn {witharrows} {Option~unknown} + jump .code:n = \__ww_msg_error:n {Option~will~be~ignored} , + unknown .code:n = \__ww_msg_error:n {Option~unknown} } \keys_define:nn {WithArrows/jump} - {jump .code:n = {\int_set:Nn \l__wa_jump_int {#1} - \int_compare:nNnF \l__wa_jump_int > 0 - {\msg_error:nn {witharrows} - {The~option~"jump"~must~be~non~negative}}} , + {jump .code:n = {\int_set:Nn \l__ww_jump_int {#1} + \int_compare:nNnF \l__ww_jump_int > 0 + {\__ww_msg_error:n {The~option~"jump"~must~be~non~negative}}} , jump .value_required:n = true} -\cs_new_protected:Nn \__wa_analyze_option_position:n - {\int_compare:nNnT \l__wa_previous_pos_arrows_int > {-1} - {\msg_error:nn {witharrows} - {Two~options~are~incompatible}} - \int_set:Nn \l__wa_previous_pos_arrows_int {#1} - \bool_if:nTF { \int_compare_p:nNn \l__wa_level_int = 3 && - \int_compare_p:nNn \l__wa_pos_arrows_int > 5} - {\msg_error:nn {witharrows} - {Option~incompatible~with~"group(s)"}} - {\int_set:Nn \l__wa_pos_arrows_int {#1}}} +\cs_new_protected:Nn \__ww_analyze_option_position:n + {\int_compare:nNnT \l__ww_previous_pos_arrows_int > {-1} + {\__ww_msg_error:n {Two~options~are~incompatible}} + \int_set:Nn \l__ww_previous_pos_arrows_int {#1} + \bool_if:nTF { \int_compare_p:nNn \l__ww_level_int = 3 && + \int_compare_p:nNn \l__ww_pos_arrows_int > 5} + {\__ww_msg_error:n {Option~incompatible~with~"group(s)"}} + {\int_set:Nn \l__ww_pos_arrows_int {#1}}} \NewDocumentCommand \WithArrowsOptions {m} - {\int_set:Nn \l__wa_previous_pos_arrows_int {-1} + {\int_set:Nn \l__ww_previous_pos_arrows_int {-1} \keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl} -\NewDocumentCommand \__wa_Arrow {O{} m O{}} +\NewDocumentCommand \__ww_Arrow {O{} m O{}} { - \int_gincr:N \g__wa_arrow_int - \int_zero_new:N \l__wa_jump_int - \int_set:Nn \l__wa_jump_int 1 + \int_gincr:N \g__ww_arrow_int + \int_zero_new:N \l__ww_jump_int + \int_set:Nn \l__ww_jump_int 1 \keys_set_known:nnN {WithArrows/jump} {#1,#3} \l_tmpa_tl - \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 {initial} \g__ww_line_int + \int_set:Nn \l_tmpa_int {\g__ww_line_int + \l__ww_jump_int} \prop_put:NnV \l_tmpa_prop {final} \l_tmpa_int \prop_put:NnV \l_tmpa_prop {options} \l_tmpa_tl \prop_put:Nnn \l_tmpa_prop {label} {#2} \prop_gclear_new:c - {g__wa_arrow_\l__wa_prefix_str _\int_use:N\g__wa_arrow_int _prop} + {g__ww_arrow_\l__ww_prefix_str _\int_use:N\g__ww_arrow_int _prop} \prop_gset_eq:cN - {g__wa_arrow_\l__wa_prefix_str _\int_use:N\g__wa_arrow_int _prop} + {g__ww_arrow_\l__ww_prefix_str _\int_use:N\g__ww_arrow_int _prop} \l_tmpa_prop } -\cs_new_protected:Nn \__wa_Arrow_first_column: +\cs_new_protected:Nn \__ww_Arrow_first_column: {\tl_set:Nn \l_tmpa_tl {Arrow} - \msg_error:nn {witharrows} {Arrow~in~first~column} - \__wa_Arrow} -\cs_new_protected:Nn \__wa_pre_environment:n - { \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:NV \g__wa_line_bis_int_seq \g__wa_line_bis_int - \int_gzero:N \g__wa_line_bis_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 + \__ww_msg_error:n {Arrow~in~first~column} + \__ww_Arrow} +\cs_new_protected:Nn \__ww_pre_environment:n + { \seq_gput_right:NV \g__ww_arrow_int_seq \g__ww_arrow_int + \int_gzero:N \g__ww_arrow_int + \seq_gput_right:NV \g__ww_line_int_seq \g__ww_line_int + \int_gzero:N \g__ww_line_int + \seq_gput_right:NV \g__ww_line_bis_int_seq \g__ww_line_bis_int + \int_gzero:N \g__ww_line_bis_int + \seq_gput_right:Nn \g__ww_position_in_the_tree_seq 1 + \seq_set_eq:NN \l_tmpa_seq \g__ww_position_in_the_tree_seq \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl - \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: + \str_clear_new:N \l__ww_prefix_str + \str_set:Nx \l__ww_prefix_str {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}} + \cs_set_eq:NN \\ \__ww_cr: \dim_zero:N \mathsurround - \int_zero_new:N \l__wa_initial_int - \int_zero_new:N \l__wa_final_int - \int_zero_new:N \l__wa_arrow_int - \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_arrows_int {-1} - \int_set:Nn \l__wa_level_int 2 + \int_zero_new:N \l__ww_initial_int + \int_zero_new:N \l__ww_final_int + \int_zero_new:N \l__ww_arrow_int + \skip_zero:N \l__ww_interline_skip + \tl_clear_new:N \l__ww_code_before_tl + \tl_clear_new:N \l__ww_code_after_tl + \int_set:Nn \l__ww_previous_pos_arrows_int {-1} + \int_set:Nn \l__ww_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__wa_footnote_bool {\begin{savenotes}} - \l__wa_code_before_tl - \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow} + \bool_if:NT \g__ww_footnote_bool {\begin{savenotes}} + \l__ww_code_before_tl + \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow} \NewDocumentEnvironment {WithArrows} {O{}} - { \bool_set_true:N \l__wa_in_witharrows_bool + { \bool_set_true:N \l__ww_in_witharrows_bool \reverse_if:N \if_mode_math: - \msg_error:nn {witharrows} - {{WithArrows}~used~outside~math~mode} + \__ww_msg_error:n {{WithArrows}~used~outside~math~mode} \fi: \cs_set:Npn \notag {\msg_error:nnn {witharrows} {Command~not~allowed~in~{WithArrows}} @@ -357,430 +360,454 @@ \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows} {Command~not~allowed~in~{WithArrows}} {\label}} - \__wa_pre_environment:n {#1} - \int_case:nn \l__wa_pos_env_int + \__ww_pre_environment:n {#1} + \int_case:nn \l__ww_pos_env_int {0 {\vtop} 1 {\vcenter} 2 {\vbox}} \bgroup \spread@equation \ialign\bgroup - \int_gincr:N \g__wa_line_int - \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow_first_column: + \int_gincr:N \g__ww_line_int + \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow_first_column: \strut\hfil - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {##}$ & - \int_gincr:N \g__wa_line_bis_int - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ + \int_gincr:N \g__ww_line_bis_int + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {{}##}$ \tikz [remember~picture,overlay] - \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}} ] {} ; + \node [__ww_node_style, + name = wa-\l__ww_prefix_str-\int_use:N\g__ww_line_int-l, + alias = {\tl_if_empty:NF \l__ww_name_tl + {\l__ww_name_tl-\int_use:N\g__ww_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \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}} - && \msg_error:nn {witharrows} {Third~column~in~an~environment~{WithArrows}} - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ + \node [__ww_node_style, + name = wa-\l__ww_prefix_str-\int_use:N\g__ww_line_int-r, + alias = {\tl_if_empty:NF \l__ww_name_tl + {\l__ww_name_tl-\int_use:N\g__ww_line_int-r}} ] {} ; + \bool_if:NT \l__ww_shownodenames_bool + {\hbox_overlap_right:n {\small wa-\l__ww_prefix_str + -\int_use:N\g__ww_line_int}} + && \__ww_msg_error:n {Third~column~in~an~environment~{WithArrows}} + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {##}$ \cr } {\crcr \egroup \egroup - \__wa_post_environment:} -\cs_new_protected:Nn \__wa_post_environment: - {\int_compare:nNnT \g__wa_line_bis_int < \g__wa_line_int - {\msg_error:nn {witharrows} {All~lines~must~have~an~ampersand}} - \int_compare:nNnT \g__wa_arrow_int > 0 - {\int_compare:nNnTF \l__wa_pos_arrows_int > 5 - \__wa_draw_arrows: - {\__wa_draw_arrows:nn 1 \g__wa_arrow_int}} + \__ww_post_environment: + \bool_if:NT \g__ww_footnote_bool {\end{savenotes}} +} +\cs_new_protected:Nn \__ww_post_environment: + {\int_compare:nNnT \g__ww_line_bis_int < \g__ww_line_int + {\__ww_msg_error:n {All~lines~must~have~an~ampersand}} + \int_compare:nNnT \g__ww_arrow_int > 0 + {\int_compare:nNnTF \l__ww_pos_arrows_int > 5 + \__ww_draw_arrows: + {\__ww_draw_arrows:nn 1 \g__ww_arrow_int}} \group_begin: - \tikzset{every~picture/.style = __wa_standard} - \cs_set:Npn \NbLines {\int_use:N \g__wa_line_int} - \cs_set_eq:NN \MultiArrow \__wa_MultiArrow:nn - \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow_code_after - \l__wa_code_after_tl + \tikzset{every~picture/.style = __ww_standard} + \cs_set:Npn \NbLines {\int_use:N \g__ww_line_int} + \cs_set_eq:NN \MultiArrow \__ww_MultiArrow:nn + \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow_code_after + \l__ww_code_after_tl \group_end: - \bool_if:NT \g__wa_footnote_bool {\end{savenotes}} - \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__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} - \seq_gpop_right:NN \g__wa_line_bis_int_seq \l_tmpa_tl - \int_gset:Nn \g__wa_line_bis_int {\l_tmpa_tl} + \seq_gpop_right:NN \g__ww_position_in_the_tree_seq \l_tmpa_tl + \seq_gpop_right:NN \g__ww_position_in_the_tree_seq \l_tmpa_tl + \seq_gput_right:Nx \g__ww_position_in_the_tree_seq {\int_eval:n {\l_tmpa_tl+1}} + \int_compare:nNnT {\seq_count:N \g__ww_position_in_the_tree_seq} = 1 + {\int_gincr:N \g__ww_last_env_int} + \seq_gpop_right:NN \g__ww_arrow_int_seq {\l_tmpa_tl} + \int_gset:Nn \g__ww_arrow_int {\l_tmpa_tl} + \seq_gpop_right:NN \g__ww_line_int_seq \l_tmpa_tl + \int_gset:Nn \g__ww_line_int {\l_tmpa_tl} + \seq_gpop_right:NN \g__ww_line_bis_int_seq \l_tmpa_tl + \int_gset:Nn \g__ww_line_bis_int {\l_tmpa_tl} } -\cs_new_protected:Nn \__wa_cr: +\cs_new_protected:Nn \__ww_cr: {\scan_stop: \group_align_safe_begin: - \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] + \peek_meaning_remove:NTF * \__ww_cr_i: \__ww_cr_i:} +\cs_new_protected:Nn \__ww_cr_i: + {\peek_meaning:NTF [ {\__ww_cr_ii:} {\__ww_cr_ii:[\c_zero_dim]} } +\cs_new_protected:Npn \__ww_cr_ii:[#1] {\group_align_safe_end: - \bool_if:NF \l__wa_in_witharrows_bool - {\bool_if:NTF \l__wa_notag_bool - {& \tikz [remember~picture,overlay] - \coordinate [name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-v ] ; } + \bool_if:NF \l__ww_in_witharrows_bool + {\bool_if:NTF \l__ww_notag_bool + {& \tikz [__ww_standard] \coordinate (\int_use:N\g__ww_line_int-v) ; } { - \tl_if_empty:NT \l__wa_tag_tl + \tl_if_empty:NT \l__ww_tag_tl {\int_gincr:N \c@equation} \cs_gset:Npx \g_tmpa_tl - {\tl_if_empty:NTF \l__wa_tag_tl + {\tl_if_empty:NTF \l__ww_tag_tl \theequation - \l__wa_tag_tl} - \seq_if_empty:NF \l__wa_labels_seq + \l__ww_tag_tl} + \seq_if_empty:NF \l__ww_labels_seq { \cs_set:Npx \@currentlabel {\p@equation \g_tmpa_tl} - \bool_if:NT \c__wa_hyperref_loaded_bool + \bool_if:NT \c__ww_hyperref_loaded_bool {\cs_set:Npn \This@name {equation} \hyper@refstepcounter{equation}} - \bool_if:NT \c__wa_cleveref_loaded_bool + \bool_if:NT \c__ww_cleveref_loaded_bool {\cref@constructprefix{equation}{\cref@result} \@ifundefined{cref@equation@alias} {\def\@tempa{equation}} {\def\@tempa{\csname cref@equation@alias\endcsname}} - \protected@edef\cref@currentlabel{[\@tempa][\arabic{equation}][\cref@result] - \p@equation \g_tmpa_tl}} - \bool_if:NT \c__wa_typedref_loaded_bool + \protected@edef\cref@currentlabel + {[\@tempa][\arabic{equation}][\cref@result] + \p@equation \g_tmpa_tl}} + \bool_if:NT \c__ww_typedref_loaded_bool {\cs_set:Npn \sr@name {equation}} - \seq_map_function:NN \l__wa_labels_seq \__wa_old_label} - \bool_gset_eq:NN \g_tmpa_bool \l__wa_tag_star_bool + \seq_map_function:NN \l__ww_labels_seq \__ww_old_label} + \bool_gset_eq:NN \g_tmpa_bool \l__ww_tag_star_bool & \cs_set_eq:NN \theequation \g_tmpa_tl \bool_if:NT \g_tmpa_bool {\cs_set:Npn \tagform@ {}} \hbox_overlap_left:n - { \tikz [__wa_standard] - \coordinate [name = \int_use:N \g__wa_line_int-v ] ; - \quad - \@eqnnum} + {\bool_if:NF \c__ww_leqno_bool + {\tikz [__ww_standard] \coordinate (\int_use:N\g__ww_line_int-v) ;} + \quad + \@eqnnum } + \bool_if:NT \c__ww_leqno_bool + {\tikz [__ww_standard] \coordinate (\int_use:N \g__ww_line_int-v) ;} }} - \cr\noalign{\skip_vertical:n {#1 + \l__wa_interline_skip} + \cr\noalign{\skip_vertical:n {#1 + \l__ww_interline_skip} \scan_stop:}} \NewDocumentEnvironment {DispWithArrows} {O{}} { - \bool_if:nT \c__wa_mathtools_loaded_bool + \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\MT_showonlyrefs_false: \MH_set_boolean_T:n {show_only_refs} - \bool_set_true:N \l__wa_notag_bool}} - \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ + \bool_set_true:N \l__ww_notag_bool}} + \bool_if:NT \c__ww_amsmath_loaded_bool \intertext@ \if_mode_math: - \msg_error:nn {witharrows} - {{DispWithArrows}~used~in~math~mode} + \__ww_msg_error:n {{DispWithArrows}~used~in~math~mode} + \fi: + \bool_set_false:N \l__ww_in_witharrows_bool + \__ww_pre_environment:n {#1} + \if_mode_vertical: + \nointerlineskip + \makebox[.6\linewidth]{} \fi: - \bool_set_false:N \l__wa_in_witharrows_bool - \__wa_pre_environment:n {#1} - \nointerlineskip - \makebox[.6\linewidth]{} $$ \vcenter \bgroup \spread@equation - \bool_if:NTF \l__wa_fleqn_bool + \bool_if:NTF \l__ww_fleqn_bool {\tabskip = \c_zero_skip} {\tabskip = 0 pt plus 1000 pt minus 1000 pt} - \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} + \bool_if:NTF \c__ww_amsmath_loaded_bool + {\cs_set_eq:NN \__ww_old_label \ltx@label} + {\cs_set_eq:NN \__ww_old_label \label} \cs_set:Npn \notag {\msg_error:nnn {witharrows} {Command~not~allowed~in~{DispWithArrows}} {\notag}} \cs_set:Npn \nonumber {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\nonumber}} + {Command~not~allowed~in~{DispWithArrows}} + {\nonumber}} \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\tag}} + {Command~not~allowed~in~{DispWithArrows}} + {\tag}} \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\label}} + {Command~not~allowed~in~{DispWithArrows}} + {\label}} \halign to \displaywidth \bgroup - \int_gincr:N \g__wa_line_int - \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow_first_column: + \int_gincr:N \g__ww_line_int + \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow_first_column: \strut - \bool_if:NT \l__wa_fleqn_bool - {\skip_horizontal:n \l__wa_mathindent_dim} + \bool_if:NT \l__ww_fleqn_bool + {\skip_horizontal:n \l__ww_mathindent_dim} \hfil - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {##}$ \tabskip = \c_zero_skip & - \cs_set:Npn \notag {\bool_set_true:N \l__wa_notag_bool} + \cs_set:Npn \notag {\bool_set_true:N \l__ww_notag_bool} \cs_set_eq:NN \nonumber \notag - \cs_set_eq:NN \tag \__wa_tag - \cs_set_eq:NN \label \__wa_label:n - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ + \cs_set_eq:NN \tag \__ww_tag + \cs_set_eq:NN \label \__ww_label:n + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {{}##}$ \tabskip = 0 pt plus 1000 pt minus 1000 pt - \int_gincr:N \g__wa_line_bis_int + \int_gincr:N \g__ww_line_bis_int \tikz [remember~picture,overlay] - \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}} ] {} ; + \node [__ww_node_style, + name = wa-\l__ww_prefix_str-\int_use:N\g__ww_line_int-l, + alias = {\tl_if_empty:NF \l__ww_name_tl + {\l__ww_name_tl-\int_use:N\g__ww_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \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}} + \node [__ww_node_style, + name = wa-\l__ww_prefix_str-\int_use:N\g__ww_line_int-r, + alias = {\tl_if_empty:NF \l__ww_name_tl + {\l__ww_name_tl-\int_use:N\g__ww_line_int-r}} ] {} ; + \bool_if:NT \l__ww_shownodenames_bool + {\hbox_overlap_right:n {\small wa-\l__ww_prefix_str + -\int_use:N\g__ww_line_int}} & ## \tabskip = \c_zero_skip - && \msg_error:nn {witharrows} {Third~column~in~an~environment~{DispWithArrows}} + && \__ww_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} \iffalse ## \fi \cr} {\\ \egroup \egroup - $$ - \bool_if:NT \l__wa_wrap_lines_bool - {\dim_gzero_new:N \g__wa_x_right_dim - \dim_gset:Nn \g__wa_x_right_dim \c_max_dim - \begin{tikzpicture} [__wa_standard] - \int_step_variable:nnnNn 1 1 \g__wa_line_int \l_tmpa_int + \bool_if:NT \l__ww_wrap_lines_bool + {\dim_gzero_new:N \g__ww_x_right_dim + \dim_gset:Nn \g__ww_x_right_dim \c_max_dim + \begin{tikzpicture} [__ww_standard] + \int_step_variable:nnnNn 1 1 \g__ww_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__wa_x_right_dim - {\dim_gset:Nn \g__wa_x_right_dim \l_tmpa_dim} } + \dim_compare:nNnT \l_tmpa_dim < \g__ww_x_right_dim + {\dim_gset:Nn \g__ww_x_right_dim \l_tmpa_dim} } \end{tikzpicture}} - \__wa_post_environment: - \bool_if:nT \c__wa_mathtools_loaded_bool + {\begin{tikzpicture} [__ww_standard] + \int_step_variable:nnnNn 1 1 \g__ww_line_int \l_tmpa_int + {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) + \dim_set:Nn \l_tmpa_dim \pgf@x + \tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-l) + \dim_set:Nn \l_tmpb_dim \pgf@x + \dim_compare:nNnT \l_tmpb_dim > \l_tmpa_dim + {\__ww_msg_error:n {Collision}}} + \end{tikzpicture}} + \__ww_post_environment: + \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} \MT_showonlyrefs_true:} + $$ + \bool_if:NT \g__ww_footnote_bool {\end{savenotes}} \ignorespacesafterend } -\NewDocumentCommand \__wa_tag {sm} - {\tl_if_empty:NF \l__wa_tag_tl +\NewDocumentCommand \__ww_tag {sm} + {\tl_if_empty:NF \l__ww_tag_tl {\msg_error:nnn {witharrows} {Multiple~tags} {#2}} - \bool_set_false:N \l__wa_notag_bool - \bool_if:nT \c__wa_mathtools_loaded_bool + \bool_set_false:N \l__ww_notag_bool + \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\MH_if_boolean:nF {show_manual_tags} - {\bool_set_true:N \l__wa_notag_bool}}} - \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} - { \msg_error:nn {witharrows} {tag*~without~amsmath} } + {\bool_set_true:N \l__ww_notag_bool}}} + \tl_set:Nn \l__ww_tag_tl {#2} + \bool_set:Nn \l__ww_tag_star_bool {#1} + \bool_if:nT {#1 && ! \bool_if_p:N \c__ww_amsmath_loaded_bool} + { \__ww_msg_error:n {tag*~without~amsmath} } } \NewDocumentEnvironment {DispWithArrows*} {} {\WithArrowsOptions{notag} \DispWithArrows} {\endDispWithArrows} -\cs_new_protected:Nn \__wa_draw_arrows: +\cs_new_protected:Nn \__ww_draw_arrows: { \group_begin: - \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 - \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 + \int_zero_new:N \l__ww_first_arrow_of_group_int + \int_zero_new:N \l__ww_first_line_of_group_int + \int_zero_new:N \l__ww_last_line_of_group_int + \bool_set_true:N \l__ww_new_group_bool + \int_set:Nn \l__ww_arrow_int 1 + \int_until_do:nNnn \l__ww_arrow_int > \g__ww_arrow_int { - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} + \prop_get:cnN {g__ww_arrow_\l__ww_prefix_str _\int_use:N\l__ww_arrow_int _prop} {initial} \l_tmpa_tl - \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} + \int_set:Nn \l__ww_initial_int {\l_tmpa_tl} + \prop_get:cnN {g__ww_arrow_\l__ww_prefix_str _\int_use:N\l__ww_arrow_int _prop} {final} \l_tmpa_tl - \int_set:Nn \l__wa_final_int {\l_tmpa_tl} - \bool_if:nT { \int_compare_p:nNn \l__wa_pos_arrows_int = 7 - && \int_compare_p:nNn \l__wa_arrow_int > 1 + \int_set:Nn \l__ww_final_int {\l_tmpa_tl} + \bool_if:nT { \int_compare_p:nNn \l__ww_pos_arrows_int = 7 + && \int_compare_p:nNn \l__ww_arrow_int > 1 && \int_compare_p:nNn - \l__wa_initial_int > \l__wa_last_line_of_group_int} - {\__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:Nn \l__wa_first_arrow_of_group_int \l__wa_arrow_int - \int_set:Nn \l__wa_first_line_of_group_int \l__wa_initial_int - \int_set:Nn \l__wa_last_line_of_group_int \l__wa_final_int - \begin{tikzpicture} [__wa_standard] - \tikz@parse@node\pgfutil@firstofone (\int_use:N\l__wa_initial_int-l) - \dim_gset:Nn \g__wa_x_dim \pgf@x + \l__ww_initial_int > \l__ww_last_line_of_group_int} + {\__ww_draw_arrows:nn \l__ww_first_arrow_of_group_int {\l__ww_arrow_int - 1} + \bool_set_true:N \l__ww_new_group_bool} + \bool_if:nTF \l__ww_new_group_bool + {\bool_set_false:N \l__ww_new_group_bool + \int_set:Nn \l__ww_first_arrow_of_group_int \l__ww_arrow_int + \int_set:Nn \l__ww_first_line_of_group_int \l__ww_initial_int + \int_set:Nn \l__ww_last_line_of_group_int \l__ww_final_int + \begin{tikzpicture} [__ww_standard] + \tikz@parse@node\pgfutil@firstofone (\int_use:N\l__ww_initial_int-l) + \dim_gset:Nn \g__ww_x_dim \pgf@x \end{tikzpicture} } - {\int_set:Nn \l__wa_last_line_of_group_int - {\int_max:nn \l__wa_last_line_of_group_int \l__wa_final_int}} - \__wa_update_x_value:nn \l__wa_initial_int \l__wa_final_int - \int_incr:N \l__wa_arrow_int + {\int_set:Nn \l__ww_last_line_of_group_int + {\int_max:nn \l__ww_last_line_of_group_int \l__ww_final_int}} + \__ww_update_x_value:nn \l__ww_initial_int \l__ww_final_int + \int_incr:N \l__ww_arrow_int } - \__wa_draw_arrows:nn \l__wa_first_arrow_of_group_int \g__wa_arrow_int + \__ww_draw_arrows:nn \l__ww_first_arrow_of_group_int \g__ww_arrow_int \group_end: } \cs_generate_variant:Nn \keys_set:nn {no} -\cs_new_protected:Nn \__wa_keys_set: {\keys_set:no {WithArrows/General}} -\cs_new_protected:Nn \__wa_draw_arrows:nn +\cs_new_protected:Nn \__ww_keys_set: {\keys_set:no {WithArrows/General}} +\cs_new_protected:Nn \__ww_draw_arrows:nn {\group_begin: - \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 + \int_zero_new:N \l__ww_first_arrow_int + \int_set:Nn \l__ww_first_arrow_int {#1} + \int_zero_new:N \l__ww_last_arrow_int + \int_set:Nn \l__ww_last_arrow_int {#2} + \int_set:Nn \l__ww_arrow_int \l__ww_first_arrow_int + \int_until_do:nNnn \l__ww_arrow_int > \l__ww_last_arrow_int { - \prop_get:cnN {g__wa_arrow_\l__wa_prefix_str _\int_use:N\l__wa_arrow_int _prop} + \prop_get:cnN {g__ww_arrow_\l__ww_prefix_str _\int_use:N\l__ww_arrow_int _prop} {initial} \l_tmpa_tl - \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} + \int_set:Nn \l__ww_initial_int {\l_tmpa_tl} + \prop_get:cnN {g__ww_arrow_\l__ww_prefix_str _\int_use:N\l__ww_arrow_int _prop} {final} \l_tmpa_tl - \int_set:Nn \l__wa_final_int {\l_tmpa_tl} - \int_compare:nNnTF \l__wa_final_int > \g__wa_line_int - {\msg_error:nn {witharrows} {Too~few~lines~for~an~arrow}} - {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\int_use:N\l__wa_initial_int-l} - { \msg_error:nn {witharrows} {A~PGF~node~doesn't~exist} } - {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\int_use:N\l__wa_final_int-l} - { \msg_error:nn {witharrows} {A~PGF~node~doesn't~exist} } - {\__wa_draw_arrows_i:}}} - \int_incr:N \l__wa_arrow_int + \int_set:Nn \l__ww_final_int {\l_tmpa_tl} + \int_compare:nNnTF \l__ww_final_int > \g__ww_line_int + {\__ww_msg_error:n {Too~few~lines~for~an~arrow}} + {\cs_if_free:cTF{pgf@sh@ns@wa-\l__ww_prefix_str-\int_use:N\l__ww_initial_int-l} + { \__ww_msg_error:n {A~PGF~node~doesn't~exist} } + {\cs_if_free:cTF{pgf@sh@ns@wa-\l__ww_prefix_str-\int_use:N\l__ww_final_int-l} + { \__ww_msg_error:n {A~PGF~node~doesn't~exist} } + {\__ww_draw_arrows_i:}}} + \int_incr:N \l__ww_arrow_int } \group_end: } -\cs_new:Nn \__wa_draw_arrows_i: +\cs_new:Nn \__ww_draw_arrows_i: {\group_begin: - \int_set:Nn \l__wa_previous_pos_arrows_int {-1} - \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 + \int_set:Nn \l__ww_previous_pos_arrows_int {-1} + \int_set:Nn \l__ww_level_int 3 + \prop_get:cnN {g__ww_arrow_\l__ww_prefix_str + _\int_use:N\l__ww_arrow_int _prop} {options} \l_tmpa_tl \exp_args:NNo \exp_args:No - \__wa_keys_set: {\l_tmpa_tl,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_arrows_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}} - \int_compare:nNnT \l__wa_pos_arrows_int = 5 + \__ww_keys_set: {\l_tmpa_tl,tikz={xshift = \l__ww_xoffset_dim}} + \bool_set_false:N \l__ww_initial_r_bool + \bool_set_false:N \l__ww_final_r_bool + \int_case:nn \l__ww_pos_arrows_int + {0 {\bool_set_true:N \l__ww_initial_r_bool + \bool_set_true:N \l__ww_final_r_bool} + 2 {\bool_set_true:N \l__ww_initial_r_bool} + 3 {\bool_set_true:N \l__ww_final_r_bool}} + \int_compare:nNnT \l__ww_pos_arrows_int = 5 { - \begin{tikzpicture} [__wa_standard] - \tikz@parse@node\pgfutil@firstofone (\int_use:N\l__wa_initial_int-l) - \dim_gset:Nn \g__wa_x_dim \pgf@x + \begin{tikzpicture} [__ww_standard] + \tikz@parse@node\pgfutil@firstofone (\int_use:N\l__ww_initial_int-l) + \dim_gset:Nn \g__ww_x_dim \pgf@x \end{tikzpicture} - \__wa_update_x_value:nn \l__wa_initial_int \l__wa_final_int + \__ww_update_x_value:nn \l__ww_initial_int \l__ww_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} + \tl_set:Nx \l__ww_initial_tl + {\int_use:N\l__ww_initial_int-\bool_if:NTF\l__ww_initial_r_bool rl .south} + \tl_set:Nx \l__ww_final_tl + {\int_use:N\l__ww_final_int-\bool_if:NTF\l__ww_final_r_bool rl .north} + \prop_get:cnN {g__ww_arrow_\l__ww_prefix_str _\int_use:N\l__ww_arrow_int _prop} {label} \l_tmpa_tl - \int_compare:nNnTF \l__wa_pos_arrows_int < 5 - {\begin{tikzpicture} [__wa_standard] - \tikz@scan@one@point\pgfutil@firstofone(\l__wa_initial_tl) + \int_compare:nNnTF \l__ww_pos_arrows_int < 5 + {\begin{tikzpicture} [__ww_standard] + \tikz@scan@one@point\pgfutil@firstofone(\l__ww_initial_tl) \tl_gset:Nx \g_tmpa_tl {\dim_use:N\pgf@x,\dim_use:N\pgf@y} - \tikz@scan@one@point\pgfutil@firstofone(\l__wa_final_tl) + \tikz@scan@one@point\pgfutil@firstofone(\l__ww_final_tl) \tl_gset:Nx \g_tmpb_tl {\dim_use:N\pgf@x,\dim_use:N\pgf@y} \end{tikzpicture} } - {\begin{tikzpicture} [__wa_standard] - \tikz@scan@one@point\pgfutil@firstofone (\l__wa_initial_tl) - \tl_gset:Nx \g_tmpa_tl {\dim_use:N \g__wa_x_dim , \dim_use:N \pgf@y} - \tikz@scan@one@point\pgfutil@firstofone (\l__wa_final_tl) - \tl_gset:Nx \g_tmpb_tl {\dim_use:N \g__wa_x_dim , \dim_use:N \pgf@y} + {\begin{tikzpicture} [__ww_standard] + \tikz@scan@one@point\pgfutil@firstofone (\l__ww_initial_tl) + \tl_gset:Nx \g_tmpa_tl {\dim_use:N \g__ww_x_dim , \dim_use:N \pgf@y} + \tikz@scan@one@point\pgfutil@firstofone (\l__ww_final_tl) + \tl_gset:Nx \g_tmpb_tl {\dim_use:N \g__ww_x_dim , \dim_use:N \pgf@y} \end{tikzpicture}} - \__wa_draw_arrow:nno {\g_tmpa_tl} {\g_tmpb_tl} {\l_tmpa_tl} + \__ww_draw_arrow:nno {\g_tmpa_tl} {\g_tmpb_tl} {\l_tmpa_tl} \group_end: } -\cs_new_protected:Nn \__wa_def_function_tmpa:n - {\cs_set:Nn \__wa_tmpa:nnn - {\begin{tikzpicture}[__wa_standard,every~path/.style = {WithArrows/arrow}] +\cs_new_protected:Nn \__ww_def_function_tmpa:n + {\cs_set:Nn \__ww_tmpa:nnn + {\begin{tikzpicture}[__ww_standard,every~path/.style = {WithArrows/arrow}] #1 \end{tikzpicture}}} -\cs_new_protected:Nn \__wa_draw_arrow:nnn +\cs_new_protected:Nn \__ww_draw_arrow:nnn { - \bool_if:nT {\l__wa_wrap_lines_bool && ! \l__wa_in_witharrows_bool} - {\tl_set:Nn \l__wa_tikz_code_tl - {\draw (##1) to node (__wa_label) {} (##2) ; - \tikz@parse@node \pgfutil@firstofone (__wa_label.west) - \path (__wa_label.west) - node [anchor = west, - text~width = \dim_eval:n {\g__wa_x_right_dim - \pgf@x - 0.3333 em}] - {##3} ; }} - \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} -\cs_new_protected:Nn \__wa_update_x_value:nn - {\int_step_inline:nnnn {#1} \c_one {#2} - {\cs_if_exist:cT {pgf@sh@ns@wa-\l__wa_prefix_str-##1-l} - {\begin{tikzpicture} [__wa_standard] + \bool_if:nT {\l__ww_wrap_lines_bool && ! \l__ww_in_witharrows_bool} + { \tl_set_eq:NN \l__ww_tikz_code_tl \c__ww_tikz_code_wrap_lines_tl } + \exp_args:No \__ww_def_function_tmpa:n \l__ww_tikz_code_tl + \__ww_tmpa:nnn {#1} {#2} {#3} } +\cs_generate_variant:Nn \__ww_draw_arrow:nnn {nno} +\tl_set:Nn \c__ww_tikz_code_wrap_lines_tl + { + \draw (#1) to node (__ww_label) {} (#2) ; + \tikz@parse@node \pgfutil@firstofone (__ww_label.west) + \dim_set:Nn \l_tmpa_dim {\g__ww_x_right_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 (__ww_label.west) + node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] + {#3} ; } } +\cs_new_protected:Nn \__ww_update_x_value:nn + {\int_step_inline:nnnn {#1} 1 {#2} + {\cs_if_exist:cT {pgf@sh@ns@wa-\l__ww_prefix_str-##1-l} + {\begin{tikzpicture} [__ww_standard] \tikz@scan@one@point\pgfutil@firstofone (##1-l) - \dim_gset:Nn \g__wa_x_dim {\dim_max:nn \g__wa_x_dim \pgf@x} + \dim_gset:Nn \g__ww_x_dim {\dim_max:nn \g__ww_x_dim \pgf@x} \end{tikzpicture} } } } -\cs_new:Npn \WithArrowsLastEnv {\int_use:N \g__wa_last_env_int} +\cs_new:Npn \WithArrowsLastEnv {\int_use:N \g__ww_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 = \__wa_analyze_option_position:n 0 , + rr .code:n = \__ww_analyze_option_position:n 0 , ll .value_forbidden:n = true, - ll .code:n = \__wa_analyze_option_position:n 1 , + ll .code:n = \__ww_analyze_option_position:n 1 , rl .value_forbidden:n = true, - rl .code:n = \__wa_analyze_option_position:n 2 , + rl .code:n = \__ww_analyze_option_position:n 2 , lr .value_forbidden:n = true, - lr .code:n = \__wa_analyze_option_position:n 3 , + lr .code:n = \__ww_analyze_option_position:n 3 , v .value_forbidden:n = true, - v .code:n = \__wa_analyze_option_position:n 4 , - TikzCode .tl_set:N = \l__wa_tikz_code_tl, + v .code:n = \__ww_analyze_option_position:n 4 , + TikzCode .tl_set:N = \l__ww_tikz_code_tl, TikzCode .value_required:n = true, - xoffset .dim_set:N = \l__wa_xoffset_dim, + xoffset .dim_set:N = \l__ww_xoffset_dim, xoffset .value_required:n = true} -\NewDocumentCommand \__wa_Arrow_code_after {O{} mmm O{}} - {\int_set:Nn \l__wa_pos_arrows_int 1 - \int_set:Nn \l__wa_previous_pos_arrows_int {-1} +\NewDocumentCommand \__ww_Arrow_code_after {O{} mmm O{}} + {\int_set:Nn \l__ww_pos_arrows_int 1 + \int_set:Nn \l__ww_previous_pos_arrows_int {-1} \group_begin: - \int_set:Nn \l__wa_level_int 3 + \int_set:Nn \l__ww_level_int 3 \keys_set:nn {WithArrows/CodeAfter} - {#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_arrows_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} + {#1,#5,tikz={xshift = \l__ww_xoffset_dim}} + \bool_set_false:N \l__ww_initial_r_bool + \bool_set_false:N \l__ww_final_r_bool + \int_case:nn \l__ww_pos_arrows_int + {0 {\bool_set_true:N \l__ww_initial_r_bool + \bool_set_true:N \l__ww_final_r_bool} + 2 {\bool_set_true:N \l__ww_initial_r_bool} + 3 {\bool_set_true:N \l__ww_final_r_bool}} + \cs_if_free:cTF {pgf@sh@ns@wa-\l__ww_prefix_str-#2-l} {\msg_error:nnx {witharrows} {Wrong~line~specification~in~Arrow} {#2}} - {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-#3-l} + {\cs_if_free:cTF {pgf@sh@ns@wa-\l__ww_prefix_str-#3-l} {\msg_error:nnx {witharrows} {Wrong~line~specification~in~Arrow} {#3}} - {\int_compare:nNnTF \l__wa_pos_arrows_int = 4 - {\begin{tikzpicture} [__wa_standard] + {\int_compare:nNnTF \l__ww_pos_arrows_int = 4 + {\begin{tikzpicture} [__ww_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 \tikz@scan@one@point\pgfutil@firstofone(#3-l.north) \dim_set:Nn \l_tmpa_dim {\dim_max:nn \l_tmpa_dim \pgf@x} - \tl_gset:Nx \g_tmpa_tl {\dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim} - \tl_gset:Nx \g_tmpb_tl {\dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y} + \tl_gset:Nx \g_tmpa_tl + {\dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim} + \tl_gset:Nx \g_tmpb_tl + {\dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y} \end{tikzpicture} } - {\begin{tikzpicture} [__wa_standard] + {\begin{tikzpicture} [__ww_standard] \tikz@scan@one@point\pgfutil@firstofone - (#2-\bool_if:NTF\l__wa_initial_r_bool rl .south) + (#2-\bool_if:NTF\l__ww_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__wa_final_r_bool rl .north) + (#3-\bool_if:NTF\l__ww_final_r_bool rl .north) \tl_gset:Nx \g_tmpb_tl {\dim_use:N \pgf@x , \dim_use:N \pgf@y} \end{tikzpicture}} - \__wa_draw_arrow:nnn {\g_tmpa_tl} {\g_tmpb_tl} {#4} }} + \__ww_draw_arrow:nnn {\g_tmpa_tl} {\g_tmpb_tl} {#4} }} \group_end: } -\cs_new_protected:Nn \__wa_MultiArrow:nn +\cs_new_protected:Nn \__ww_MultiArrow:nn { - \foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wa_prefix_str-\x-l} + \foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l__ww_prefix_str-\x-l} {\msg_error:nnx {witharrows} {Wrong~line~specification~in~MultiArrow} {\x}} {\clist_gput_right:Nx \g_tmpa_clist {\x}}} \int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2 - {\msg_error:nn {witharrows} {Too~small~specification~for~MultiArrow}} + {\__ww_msg_error:n {Too~small~specification~for~MultiArrow}} {\clist_sort:Nn \g_tmpa_clist {\int_compare:nNnTF {##1} > {##2} {\sort_return_swapped:} @@ -788,29 +815,40 @@ \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 \__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) + \exp_args:Nx \__ww_MultiArrow_i:n {\g_tmpa_clist} + \begin{tikzpicture}[__ww_standard,every~path/.style={WithArrows/arrow}] + \draw [<->] ([xshift = \l__ww_xoffset_dim]\l_tmpa_tl-r.south) -- ++(5mm,0) - -- 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) - \path (__wa_label.west) - node [anchor = west, - text~width = - {\bool_if:nTF {\l__wa_wrap_lines_bool && ! \l__wa_in_witharrows_bool} - {\dim_eval:n {\g__wa_x_right_dim - \pgf@x - 0.3333 em}} - {20 cm}} - ] {#2} ; + -- node (__ww_label) {} + ([xshift = \l__ww_xoffset_dim+5mm]\l_tmpb_tl-r.south) + -- ([xshift = \l__ww_xoffset_dim]\l_tmpb_tl-r.south) ; + \tikz@parse@node \pgfutil@firstofone (__ww_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__ww_wrap_lines_bool && ! \l__ww_in_witharrows_bool} + {\dim_set:Nn \l_tmpb_dim {\g__ww_x_right_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 (__ww_label.west) + node [anchor = west, text~width = \dim_use:N \l_tmpa_dim] {#2} ; \end{tikzpicture} } } -\cs_new_protected:Nn \__wa_MultiArrow_i:n - {\begin{tikzpicture}[__wa_standard,every~path/.style={WithArrows/arrow}] +\cs_new_protected:Nn \__ww_MultiArrow_i:n + {\begin{tikzpicture}[__ww_standard,every~path/.style={WithArrows/arrow}] \foreach \k in {#1} - {\draw[<-] ([xshift = \l__wa_xoffset_dim]\k-r.south) -- ++(5mm,0) ;} ; + {\draw[<-] ([xshift = \l__ww_xoffset_dim]\k-r.south) -- ++(5mm,0) ;} ; \end{tikzpicture}} \msg_new:nnn {witharrows} + {Option~unknown} + {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} + {Collision} + {You~have~a~collision~(or~almost~a~collision)~at~the~end~of~row~ + \int_use:N\g__ww_line_int.~ + You~can~go~on~but~maybe~you~will~have~overlapping~texts.} +\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 @@ -828,7 +866,7 @@ the~option~"<-"~of~Tikz.} \msg_new:nnn {witharrows} {Too~few~lines~for~an~arrow} - {An~arrow~specified~in~line~\int_use:N \l__wa_initial_int\ can't~be~drawn~ + {An~arrow~specified~in~line~\int_use:N \l__ww_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.} @@ -844,7 +882,7 @@ {Two~options~are~incompatible} {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__wa_previous_pos_arrows_int + \int_case:nn\l__ww_previous_pos_arrows_int {0 {rr} 1 {ll} 2 {rl} @@ -854,7 +892,7 @@ 6 {group} 7 {groups}}"~ set~in~the~same~ - \int_case:nn\l__wa_level_int + \int_case:nn\l__ww_level_int {1 {command~\token_to_str:N\WithArrowsOptions} 2 {declaration~of~options~of~the~environment~ \{\@currenvir\}} @@ -864,7 +902,7 @@ {All~lines~must~have~an~ampersand} {All~lines~of~an~environment~\{WithArrows\}~should~ have~an~second~column~(because~the~nodes~are~created~ - in~the~second~column).~However,~you~can~go~but~you~will~ + in~the~second~column).~However,~you~can~go~on~but~you~will~ have~an~error~if~one~of~your~arrows~needs~an~PGF~ node~absent~by~lack~of~ampersand.~If~you~don't~want~to~ see~this~message~again,~you~can~use~the~option~ @@ -875,7 +913,7 @@ {Option~incompatible~with~"group(s)"} {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_arrows_int = 5 + \int_compare:nNnTF \l__ww_pos_arrows_int = 5 {group} {groups}".~ It's~incompatible.~You~can~go~on~ignoring~this~option~ @@ -885,20 +923,12 @@ {The~option~"\tl_use:N\l_keys_key_tl"~can't~be~used~here.~ If~you~go~on,~it~will~be~ignored.} \msg_new:nnn {witharrows} - {Option~unknown} - {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} {Arrow~in~first~column} {You~should~not~use~the~command~\token_to_str:N\Arrow\ - \tl_if_eq:NNF \l__wa_CommandName_tl \l_tmpa_tl + \tl_if_eq:NNF \l__ww_CommandName_tl \l_tmpa_tl {(renamed~in~\str_use:N \c_backslash_str - \tl_use:N \l__wa_CommandName_tl)~} - ~in~the~first~column~but~only~in~the~second~column.~ - This~is~a~restriction~of~the~version~1.3~of~the~ - package~witharrows~(in~the~aim~of~developping~further~ - ~a~new~functionality~with~\token_to_str:N\Arrow\ in~the~ - first~column).\\ + \tl_use:N \l__ww_CommandName_tl)~} + ~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} @@ -949,85 +979,84 @@ If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~ "AllowMultipleLabels"~at~the~global~or~ environment~level~(this~doesn't~work~if~you~use~cleveref).} -\coffin_new:N \l__wa_halign_coffin +\coffin_new:N \l__ww_halign_coffin \NewDocumentEnvironment {CasesWithArrows} {m O{}} {\hbox_set:Nn \l_tmpa_box {$\left\{\vcenter to 1cm {} \right.$} - \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 + \dim_zero_new:N \l__ww_delim_wd_dim + \dim_set:Nn \l__ww_delim_wd_dim {\box_wd:N \l_tmpa_box} + \box_clear_new:N \l__ww_left_part_box + \hbox_set:Nn \l__ww_left_part_box + {$\bool_if:NT \l__ww_displaystyle_bool \displaystyle #1 {}$} + \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} {\MT_showonlyrefs_false: \MH_set_boolean_T:n {show_only_refs} - \bool_set_true:N \l__wa_notag_bool}} - \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@ + \bool_set_true:N \l__ww_notag_bool}} + \bool_if:NT \c__ww_amsmath_loaded_bool \intertext@ \if_mode_math: - \msg_error:nn {witharrows} - {{DispWithArrows}~used~in~math~mode} + \__ww_msg_error:n {{DispWithArrows}~used~in~math~mode} \fi: - \bool_set_false:N \l__wa_in_witharrows_bool + \bool_set_false:N \l__ww_in_witharrows_bool % - \__wa_pre_environment:n {#2} + \__ww_pre_environment:n {#2} \nointerlineskip \hbox_to_wd:nn {0.6\linewidth} {} $$ \spread@equation - \vcoffin_set:Nnw \l__wa_halign_coffin \displaywidth - \bool_if:NTF \l__wa_fleqn_bool + \vcoffin_set:Nnw \l__ww_halign_coffin \displaywidth + \bool_if:NTF \l__ww_fleqn_bool {\tabskip = \c_zero_skip} {\tabskip = 0 pt plus 1000 pt minus 1000 pt} - \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} + \bool_if:NTF \c__ww_amsmath_loaded_bool + {\cs_set_eq:NN \__ww_old_label \ltx@label} + {\cs_set_eq:NN \__ww_old_label \label} \cs_set:Npn \notag {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\notag}} + {Command~not~allowed~in~{DispWithArrows}} + {\notag}} \cs_set:Npn \nonumber {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\nonumber}} + {Command~not~allowed~in~{DispWithArrows}} + {\nonumber}} \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\tag}} + {Command~not~allowed~in~{DispWithArrows}} + {\tag}} \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows} - {Command~not~allowed~in~{DispWithArrows}} - {\label}} + {Command~not~allowed~in~{DispWithArrows}} + {\label}} \halign to \displaywidth \bgroup - \int_gincr:N \g__wa_line_int - \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow_first_column: + \int_gincr:N \g__ww_line_int + \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow_first_column: \strut - \bool_if:NT \l__wa_fleqn_bool - {\skip_horizontal:n \l__wa_mathindent_dim} + \bool_if:NT \l__ww_fleqn_bool + {\skip_horizontal:n \l__ww_mathindent_dim} \hfil - \skip_horizontal:n {\box_wd:N \l__wa_left_part_box + \l__wa_delim_wd_dim} - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$ + \skip_horizontal:n {\box_wd:N \l__ww_left_part_box + \l__ww_delim_wd_dim} + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {##}$ \tabskip = \c_zero_skip & - \cs_set:Npn \notag {\bool_set_true:N \l__wa_notag_bool} + \cs_set:Npn \notag {\bool_set_true:N \l__ww_notag_bool} \cs_set_eq:NN \nonumber \notag - \cs_set_eq:NN \tag \__wa_tag - \cs_set_eq:NN \label \__wa_label:n - $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$ + \cs_set_eq:NN \tag \__ww_tag + \cs_set_eq:NN \label \__ww_label:n + $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {{}##}$ \tabskip = 0 pt plus 1000 pt minus 1000 pt - \int_gincr:N \g__wa_line_bis_int + \int_gincr:N \g__ww_line_bis_int \tikz [remember~picture,overlay] - \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}} ] {} ; + \node [__ww_node_style, + name = wa-\l__ww_prefix_str-\int_use:N\g__ww_line_int-l, + alias = {\tl_if_empty:NF \l__ww_name_tl + {\l__ww_name_tl-\int_use:N\g__ww_line_int-l}} ] {} ; \hfil \tikz [remember~picture,overlay] - \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}} + \node [__ww_node_style, + name = wa-\l__ww_prefix_str-\int_use:N\g__ww_line_int-r, + alias = {\tl_if_empty:NF \l__ww_name_tl + {\l__ww_name_tl-\int_use:N\g__ww_line_int-r}} ] {} ; + \bool_if:NT \l__ww_shownodenames_bool + {\hbox_overlap_right:n {\small wa-\l__ww_prefix_str + -\int_use:N\g__ww_line_int}} & ## \tabskip = \c_zero_skip - && \msg_error:nn {witharrows} {Third~column~in~an~environment~{DispWithArrows}} + && \__ww_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} \if_false: ## \fi: \cr} { \\ @@ -1036,28 +1065,29 @@ \box_set_to_last:N \l_tmpa_box \nointerlineskip \box_use:N \l_tmpa_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}} + \dim_gzero_new:N \g__ww_alignment_dim + \dim_gset:Nn \g__ww_alignment_dim {\box_wd:N \l_tmpa_box} + \box_clear_new:N \l__ww_new_box + \hbox_set:Nn \l__ww_new_box {\hbox_unpack_clear:N \l_tmpa_box} + \dim_compare:nNnT {\box_wd:N \l__ww_new_box} < \g__ww_alignment_dim + {\dim_gset:Nn \g__ww_alignment_dim {\box_wd:N \l__ww_new_box}} \vcoffin_set_end: \hbox_to_wd:nn \displaywidth { - \bool_if:NTF \l__wa_fleqn_bool - {\skip_horizontal:n \l__wa_mathindent_dim} + \bool_if:NTF \l__ww_fleqn_bool + {\skip_horizontal:n \l__ww_mathindent_dim} {\hfil} - \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} + \hbox_to_wd:nn \g__ww_alignment_dim + { \box_use_drop:N \l__ww_left_part_box + \dim_set:Nn \l_tmpa_dim { \box_ht:N \l__ww_halign_coffin + + \box_dp:N \l__ww_halign_coffin} $\left\{ \vcenter to \l_tmpa_dim {\vfil} \right.$} \hfil} - \coffin_typeset:Nnnnn \l__wa_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim + \coffin_typeset:Nnnnn + \l__ww_halign_coffin {l} {vc} {-\displaywidth} \c_zero_dim $$ - \__wa_post_environment: - \bool_if:nT \c__wa_mathtools_loaded_bool + \__ww_post_environment: + \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} \MT_showonlyrefs_true:} \ignorespacesafterend |