summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/witharrows/witharrows.pdfbin271901 -> 294971 bytes
-rw-r--r--Master/texmf-dist/source/latex/witharrows/witharrows.dtx565
-rw-r--r--Master/texmf-dist/tex/latex/witharrows/witharrows.sty222
3 files changed, 720 insertions, 67 deletions
diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf
index 8bc1d84ef2f..3aead7b8db9 100644
--- a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf
+++ b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
index 4261c65e89f..7e15855743c 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.6.1}
-\def\myfiledate{2018/05/18}
+\def\myfileversion{1.7}
+\def\myfiledate{2018/07/18}
%
%
%<*batchfile>
@@ -108,6 +108,12 @@ version 2005/12/01 or later.
% The arrow has been drawn with the command |\Arrow| on the row from which it starts. The command |\Arrow| must be used
% in the second column (the best way is to put it at the end of the second cell of the row as in the previous example).
%
+% \medskip
+% The environment |{WithArrows}| bears similarities with the environment |{aligned}| of |amsmath| (and
+% |mathtools|). The extension \pkg{witharrows} also provides an environment |{DispWithArrows}| which is similar to
+% the environment |{align}| of |amsmath|: cf. p. \pageref{DispWithArrows}.
+%
+%
% \section{Options for the shape of the arrows}
%
% The command |\Arrow| has several options. These options can be put between square brackets, before, or after the
@@ -153,7 +159,7 @@ version 2005/12/01 or later.
% \end{WithArrows}$
%
% \interitem
-% The option |xoffset| shift the arrows to the right (we usually don't want the arrows to be stucked on the text).
+% The option |xoffset| shifts the arrows to the right (we usually don't want the arrows to be stucked on the text).
% The default value of |xoffset| is $3$~mm.
%
% \begin{Verbatim}
@@ -660,7 +666,7 @@ version 2005/12/01 or later.
% & \Leftrightarrow \left\{
% \begin{aligned}
% x+y & = 0 \\
-% x+2y & = 0 \\
+% x+2y & = 0
% \end{aligned}
% \right.
% \end{WithArrows}$
@@ -673,7 +679,7 @@ version 2005/12/01 or later.
% & \Leftrightarrow \left\{
% \begin{aligned}
% x+y & = 0 \\
-% x+2y & = 0 \\
+% x+2y & = 0
% \end{aligned}
% \right.
% \end{WithArrows}$
@@ -1100,13 +1106,13 @@ version 2005/12/01 or later.
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#name=first@]
% A & = B \\
-% & = C \\
+% & = C
% \end{WithArrows}$
%
% \bigskip
% $\begin{WithArrows}[~emphase#name=second@]
% A' & = B' \\
-% & = C' \\
+% & = C'
% \end{WithArrows}$
%
% \begin{tikzpicture}[remember picture,overlay]
@@ -1120,13 +1126,13 @@ version 2005/12/01 or later.
% \begin{center}
% $\begin{WithArrows}[name=first]
% A & = B \\
-% & = C \\
+% & = C
% \end{WithArrows}$
%
% \bigskip
% $\begin{WithArrows}[name=second]
% A' & = B' \\
-% & = C' \\
+% & = C'
% \end{WithArrows}$
% \end{center}
%
@@ -1136,7 +1142,111 @@ version 2005/12/01 or later.
% to ($(second-1-r.north)+(3mm,0)$) ;
% \end{tikzpicture}
%
+% \section{The environment \{DispWithArrows\}}
+% \label{DispWithArrows}
+%
+% As previously said, the environment |{WithArrows}| bears similarities with the environment |{aligned}| of
+% |amsmath| (and |mathtools|). This extension also provides an environment |{DispWithArrows}| which is similar to
+% the environments |{align}| and |{flalign}| of |amsmath|.
+%
+% \medskip
+% The environment |{DispWithArrows}| must be used \emph{outside} math 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
+% \end{DispWithArrows}
+%
+% \medskip
+% It's possible to use the command |\notag| (or |\nonumber|) to suppress a tag.
+%
+% It's possible to use the command |\tag| to put a special tag (e.g. $\star$).\footnote{If \pkg{amsmath} (or
+% \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|.
+%
+% These commands must be in the second column of the environment.
+% \begin{Verbatim}
+% \begin{DispWithArrows}
+% A & = (a+1)^2 \Arrow{we expand} ~emphase#\notag@ \\
+% & = 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}
+% \end{DispWithArrows}
+% A link to the equation \eqref{my-equation}. This link has been composed with |\eqref{my-equation}| (the command
+% |\eqref| is a command of \pkg{amsmath}).
+%
+% \medskip
+% It's also possible to suppress all the numbers with the option |notag| (or |nonumber|), at the global or
+% environment level. There is also an environment |{DispWithArrows*}| which suppresses all the numbers.
+% \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
+% \end{DispWithArrows*}
+%
+% \medskip
+% With the option |fleqn|, the environment is composed flush left (in a way similar to the option |fleqn| of the
+% class \cls{article}). In this case, the left margin can be controlled with the option |mathindent| (with a name
+% inspired by the parameter |\mathindent| of standard LaTeX). The default value of this parameter is 25~pt.
+%
+% \begin{Verbatim}
+% \begin{DispWithArrows}[~emphase#fleqn,mathindent = 1cm@]
+% A & = (a+1)^2 \Arrow{we expand} \\
+% & = a^2 + 2a + 1
+% \end{DispWithArrows}
+% \end{Verbatim}
+%
+% \begin{DispWithArrows}[fleqn,mathindent = 1cm]
+% A & = (a+1)^2 \Arrow{we expand} \\
+% & = a^2 + 2a + 1
+% \end{DispWithArrows}
+%
+% \medskip
+% \emph{Remark} : By design, the option |fleqn| of \pkg{witharrows} is independant of the option |fleqn| of LaTeX.
+% Indeed, since the environments of \pkg{witharrows} are meant to be used with arrows on the right side, the
+% user may want to use \pkg{witharrows} with the option |fleqn| (in order to have more space on the right of the
+% equations for the arrows) while still centering the classical equations.
+%
+% \bigskip
+% If the package \pkg{amsmath} is loaded, it's possible to use the command |\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*}|.
+%
+% \bigskip
+% The environment |{DispWithArrows}| is similar to the environment |{align}| of \pkg{amsmath}. However,
+% |{DispWithArrows}| is not constructed upon |{align}| (in fact, it's possible \pkg{witharrows} without
+% \pkg{amsmath}).
+%
+% There are differences between |{DispWithArrows}| and |{align}|. The environment |{DispWithArrows}| allows only 2
+% columns. With |{DispWithArrows}|, there is no control of a collision between an equation and its tag. An
+% environment |{DispWithArrows}| is always unbreakable (even with |\allowdisplaybreaks| of \pkg{amsmath}). The
+% commands |\label|, |\tag|, |\notag|, |\nonumber| are allowed only in the second column. The labels of
+% |{DispWithArrows}| are not always drawn by \pkg{showkeys}.
+% \begin{bfseries}
+% Last but not least, by default, the elements of a \texttt{\{DispWithArrows\}} are composed in \texttt{textstyle} and not in
+% \texttt{displaystyle} (it's possible to change this point with the option \texttt{displaystyle}).
+% \end{bfseries}
+%
% \section{Advanced features}
%
%
@@ -1144,10 +1254,10 @@ version 2005/12/01 or later.
%
% \label{TikzCode}
%
-% The option |TikzCode| allows the user to change the shape of the arrow.
+% The option |TikzCode| allows the user to change the shape of the arrows.
%
% \smallskip
-% The value of this option must be an valid Tikz drawing instruction (with the final semi-colon) with three markers
+% The value of this option must be a valid Tikz drawing instruction (with the final semi-colon) with three markers
% |#1|, |#2| and |#3| for the start point, the end point and the label of the arrow.
%
% \bigskip
@@ -1203,9 +1313,9 @@ version 2005/12/01 or later.
% \end{WithArrows}\]
%
% \bigskip
-% \subsection{Footnotes in the environment WithArrows}
+% \subsection{Footnotes in the environments of witharrows}
%
-% If you want to put footnotes in an environment |{WithArrows}|, you can use a pair
+% If you want to put footnotes in an environment |{WithArrows}| or |{DispWithArrows}|, you can use a pair
% |\footnotemark|--|\footnotetext|.
%
% \smallskip
@@ -1272,7 +1382,7 @@ version 2005/12/01 or later.
% & \Leftrightarrow x = \frac45\cos\arcsin\frac5{13} + \frac5{13} \cos\arcsin\frac45
% \Arrow{$\forall x \in [-1,1], \cos(\arcsin x) = \sqrt{1-x^2}$} \\
% & \Leftrightarrow x = \frac45\sqrt{1-\bigl(\frac5{13}\bigr)^2}
-% + \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2} \\
+% + \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2}
% \end{WithArrows}$
% \end{Verbatim}
%
@@ -1285,7 +1395,7 @@ version 2005/12/01 or later.
% & \Leftrightarrow x = \frac45\cos\arcsin\frac5{13} + \frac5{13} \cos\arcsin\frac45
% \Arrow{$\forall x \in [-1,1], \cos(\arcsin x) = \sqrt{1-x^2}$} \\
% & \Leftrightarrow x = \frac45\sqrt{1-\bigl(\frac5{13}\bigr)^2}
-% + \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2} \\
+% + \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2}
% \end{WithArrows}$
%
%
@@ -1499,7 +1609,7 @@ version 2005/12/01 or later.
% of |TikzCode|:
%
% \begin{Verbatim}
-% TikzCode = {\draw (~#1) to node {\footnotesize (~#3)} (~#2) ;}}
+% TikzCode = {\draw (~#1) to node {\footnotesize (~#3)} (~#2) ;}
% \end{Verbatim}
%
% \WithArrowsOptions{TikzCode = {\draw (#1) to node {\footnotesize (#3)} (#2) ;}}
@@ -1540,8 +1650,8 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The package \pkg{xparse} will be used to define the environment |{WithArrows}| and the document-level commands
-% |\Arrow| and |\WithArrowsOptions|.
+% The package \pkg{xparse} will be used to define the environments |{WithArrows}|, |{DispWithArrows}|,
+% |{DispWithArrows*}| and the document-level commands |\Arrow| and |\WithArrowsOptions|.
% \begin{macrocode}
\RequirePackage{xparse}
% \end{macrocode}
@@ -1712,6 +1822,12 @@ version 2005/12/01 or later.
% \bigskip
% \subsection{Variables}
%
+% The boolean |\l_@@_in_witharrows_bool| will be raised if (and only if) we are in an environment |{WithArrows}|
+% (and not in an environment |{DispWithArrows}| or |{DispWithArrows*}|).
+% \begin{macrocode}
+\bool_new:N \l_@@_in_witharrows_bool
+% \end{macrocode}
+%
% The following sequence is the position of the last environment |{WithArrows}| in the tree of the nested
% environments |{WithArrows}|.
% \begin{macrocode}
@@ -1815,6 +1931,51 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_new:N \l_@@_name_tl
% \end{macrocode}
+%
+% \bigskip
+% The boolean |\l_@@_notag_bool| will be used in |{DispWithArrows}|. In particular, it will be raised when the
+% command |\notag| is used.
+% \begin{macrocode}
+\bool_new:N \l_@@_notag_bool
+% \end{macrocode}
+%
+% \bigskip
+% The token list |\l_@@_tag_tl| will contain the argument of the command |\tag|.
+% \begin{macrocode}
+\tl_new:N \l_@@_tag_tl
+% \end{macrocode}
+%
+% \bigskip
+% The boolean |\l_@@_tag_star_bool| will be raised if the user uses the command |\tag| with a star.
+% \begin{macrocode}
+\bool_new:N \l_@@_tag_star_bool
+% \end{macrocode}
+%
+% \bigskip
+% The command |\@@_label:n| will be linked to |\label| in the second column of the |\halign| of the environment
+% |{DispWithArrows}|. This command will store its argument in the token list |\l_@@_label_tl|.
+% \begin{macrocode}
+\tl_new:N \l_@@_label_tl
+\cs_set:Nn \@@_label:n {\tl_set:Nn \l_@@_label_tl {#1}}
+% \end{macrocode}
+%
+%
+% \bigskip
+% The boolean |\l_@@_fleqn_bool| indicates wether the environments |{DispWithArrows}| must be composed flush left or
+% centered. It corresponds to the option |fleqn|.
+% \begin{macrocode}
+\bool_new:N \l_@@_fleqn_bool
+% \end{macrocode}
+%
+% \bigskip
+% The dimension |\l_@@_mathindent_dim| is used only by the environments |{DispWithArrows}| : it's the left margin of
+% the environments |{DispWithArrows}| if the environment |{DispWithArrows}| is composed flush left (option |fleqn|).
+% \begin{macrocode}
+\dim_new:N \l_@@_mathindent_dim
+\dim_set:Nn \l_@@_mathindent_dim {25pt}
+% \end{macrocode}
+%
+%
% \bigskip
% \subsection{The definition of the options}
%
@@ -1840,14 +2001,21 @@ version 2005/12/01 or later.
%
% \medskip
% The options |t|, |c| and |b| indicate if we will create a |\vtop|, a |\vcenter| or a |\vbox|. This information is
-% stored in the variable |\l_@@_pos_env_int|.
+% stored in the variable |\l_@@_pos_env_int|. Of course, they are available only in |{WithArrows}| and not in
+% |{DispWithArrows}| or |{DispWithArrows*}|
% \begin{macrocode}
\keys_define:nn {WithArrows/GlobalOrEnv}
- { t .code:n = \int_set:Nn \l_@@_pos_env_int 0,
+ { 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}}},
t .value_forbidden:n = true,
- c .code:n = \int_set:Nn \l_@@_pos_env_int 1,
+ 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}}},
c .value_forbidden:n = true,
- b .code:n = \int_set:Nn \l_@@_pos_env_int 2,
+ 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}}},
b .value_forbidden:n = true,
% \end{macrocode}
%
@@ -1873,7 +2041,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
MoreColumns .code:n = { \msg_redirect_name:nnn
{witharrows}
- {Third~column~in~an~environment}
+ {Third~column~in~an~environment~{WithArrows}}
{none} },
MoreColumns .value_forbidden:n = true,
% \end{macrocode}
@@ -1982,6 +2150,38 @@ version 2005/12/01 or later.
{\msg_error:nn {witharrows} {Option~will~be~ignored}}
{\tl_set:Nn \l_@@_name_tl {#1}}} ,
name .value_required:n = true,
+% \end{macrocode}
+%
+% \bigskip
+% 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}}
+ {\tl_if_eq:nnTF {#1} {true}
+ {\bool_set_true:N \l_@@_fleqn_bool}
+ {\bool_set_false:N \l_@@_fleqn_bool}}},
+ fleqn .default:n = true,
+% \end{macrocode}
+%
+% \bigskip
+% 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}}
+ {\dim_set:Nn \l_@@_mathindent_dim {#1}}},
+ mathindent .value_required:n = true,
+% \end{macrocode}
+%
+% \bigskip
+% 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}}
+ {\tl_if_eq:nnTF {#1} {true}
+ {\bool_set_true:N \l_@@_notag_bool}
+ {\bool_set_false:N \l_@@_notag_bool}}},
+ notag .default:n = true,
+ nonumber .meta:n = notag,
unknown .code:n = \msg_error:nn {witharrows} {Option~unknown}
}
% \end{macrocode}
@@ -2198,12 +2398,16 @@ version 2005/12/01 or later.
% \bigskip
% \subsection{The environment \{WithArrows\}}
%
-%
-% The environment |{WithArrows}| starts with the initialisation of the three counters |\g_@@_arrow_int|,
+% The command |\@@_pre_environement:| is a code common to the environments |{WithArrows}| and |{DispWithArrows}|.
+% The argument is the options given to the environment.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_pre_environment:n
+% \end{macrocode}
+%
+% First the initialisation of the three counters |\g_@@_arrow_int|,
% |\g_@@_line_int| and |\g_@@_line_bis_int|. However, we have to save their previous values with the three stacks
% created for this end.
% \begin{macrocode}
-\NewDocumentEnvironment {WithArrows} {O{}}
{ \seq_gput_right:NV \g_@@_arrow_int_seq \g_@@_arrow_int
\int_gzero:N \g_@@_arrow_int
\seq_gput_right:NV \g_@@_line_int_seq \g_@@_line_int
@@ -2231,16 +2435,6 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The environment |{WithArrows}| must be used in math mode.
-% \begin{macrocode}
- \reverse_if:N \if_mode_math:
- \msg_error:nn {witharrows}
- {{WithArrows}~used~outside~math~mode}
- \fi:
-% \end{macrocode}
-%
-%
-% \bigskip
% We define the command |\\| to be the command |\@@_cr:| (defined below).
% \begin{macrocode}
\cs_set_eq:NN \\ \@@_cr:
@@ -2296,16 +2490,40 @@ version 2005/12/01 or later.
\l_@@_code_before_tl
% \end{macrocode}
%
-%
% \bigskip
% If the user has given a value for the option |CommandName| (at the global or at the \emph{environment} level), a
% command with this name is defined locally in the environment with meaning |\@@_Arrow|. The default value of the
% option |CommandName| is ``|Arrow|'' and thus, by default, the name of the command will be |\Arrow|.
% \begin{macrocode}
- \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow
+ \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow}
% \end{macrocode}
+% This is the end of |\@@_pre_environment:n|.
+%
%
% \bigskip
+% Now, we begin the environment |{WithArrows}|.
+% \begin{macrocode}
+\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}
+ \fi:
+ \cs_set:Npn \notag {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\notag}}
+ \cs_set:Npn \nonumber {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\nonumber}}
+ \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\tag}}
+ \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\label}}
+ \@@_pre_environment:n {#1}
+% \end{macrocode}
+% \bigskip
% The environment begins with a |\vtop|, a |\vcenter| or a |\vbox|\footnote{Notice that the use of
% |\vtop| seems color-safe here...} depending of the value of |\l_@@_pos_env_int| (fixed by the options
% |t|, |c| or |b|). The environment |{WithArrows}| must be used in math mode\footnote{An error is raised if the
@@ -2393,7 +2611,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}
+ && \msg_error:nn {witharrows} {Third~column~in~an~environment~{WithArrows}}
$\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$
\cr
}
@@ -2406,13 +2624,21 @@ version 2005/12/01 or later.
{\crcr
\egroup
\egroup
+ \@@_post_environment:}
% \end{macrocode}
+% This is the end of the environment |{WithArrows}|.
+%
%
% \bigskip
+% The command |\@@_post_environment:| is a code common to the second part of the environment |{WithArrows}| and the
+% environment |{DispWithArrows}|.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_post_environment:
+% \end{macrocode}
% If there is a line without the second column, we raise an error (a line without the second column could generate
% 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
+ {\int_compare:nNnT \g_@@_line_bis_int < \g_@@_line_int
{\msg_error:nn {witharrows} {All~lines~must~have~an~ampersand}}
% \end{macrocode}
%
@@ -2487,7 +2713,7 @@ version 2005/12/01 or later.
\int_gset:Nn \g_@@_line_bis_int {\l_tmpa_tl}
}
% \end{macrocode}
-% That's the end of the environment |{WithArrows}|.
+% That's the end of the command |\@@_post_environment:|.
%
% \bigskip
% We give now the definition of |\@@_cr:| which is the definition of |\\| in an environment |{WithArrows}|. The two
@@ -2495,9 +2721,9 @@ version 2005/12/01 or later.
% purpose: test the token that follows in a |\halign| structure.
%
% First, we remove an eventual token |*| since the commands |\\| and |\\*| are equivalent in an environment
-% |{WithArrows}| (an environment |{WithArrows}|, like an environment |{aligned}| of \pkg{amsmath} is always unbreakable).
+% |{WithArrows}| (an environment |{WithArrows}|, like an environment |{aligned}| of \pkg{amsmath}, is always unbreakable).
% \begin{macrocode}
-\cs_set_protected:Nn \@@_cr:
+\cs_new_protected:Nn \@@_cr:
{\scan_stop:
\group_align_safe_begin:
\peek_meaning_remove:NTF * \@@_cr_i: \@@_cr_i:}
@@ -2507,17 +2733,213 @@ version 2005/12/01 or later.
% Then, we peek the next token to see if it's a |[|. In this case, the command |\\| has an optional argument which
% is the vertical skip (=glue) to put.
% \begin{macrocode}
-\cs_set_protected:Nn \@@_cr_i:
+\cs_new_protected:Nn \@@_cr_i:
{\peek_meaning:NTF [ {\@@_cr_ii:} {\@@_cr_ii:[\c_zero_dim]} }
\cs_new_protected:Npn \@@_cr_ii:[#1]
{\group_align_safe_end:
+% \end{macrocode}
+% For the environment |{DispWithArrows}|, the behaviour of |\\| is different because we add the third column which
+% is the column for the tag (number of the equation).
+% \begin{macrocode}
+ \bool_if:NF \l_@@_in_witharrows_bool
+ {\bool_if:NTF \l_@@_notag_bool
+% \end{macrocode}
+% 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}
+ {&}
+ {
+% \end{macrocode}
+% Here, we can't use |\refstepcounter{equation}| (even the |\refstepcounter| modified by |\hyperref|) because if
+% the user has issued a |\tag| command, we have to use |\l_@@_tag_tl| and not |\theequation|. That's why we do the
+% incrementation of the counter ``manually'' and, the, we insert some code inspired by the code of |\refstepcounter|.
+% \begin{macrocode}
+ \tl_if_empty:NT \l_@@_tag_tl
+ {\int_gincr:N \c@equation}
+% \end{macrocode}
+%
+% We store in |\g_tmpa_tl| the tag we will have to compose at the end in the line. We use a global variable because
+% we will use it in the \emph{next} cell (after the |&|).
+% \begin{macrocode}
+ \cs_gset:Npx \g_tmpa_tl
+ {\tl_if_empty:NTF \l_@@_tag_tl
+ \theequation
+ \l_@@_tag_tl}
+ \tl_if_empty:NF \l_@@_label_tl
+ {
+% \end{macrocode}
+% The following code is inspired from the definition of |\refstepcounter| in |source2e|.
+% \begin{macrocode}
+ \cs_set_eq:NN \@currentlabel \g_tmpa_tl
+% \end{macrocode}
+% The following code is inspired from the redefinition of |\refstepcounter| done by \pkg{hyperref}. It is executed
+% only if \pkg{hyperref} has been loaded.
+% \begin{macrocode}
+ \cs_if_exist:NT \hyper@refstepcounter
+ {\cs_set:Npn \This@name {equation}
+ \hyper@refstepcounter{equation}}
+% \end{macrocode}
+% Now, we can issue the command |\label|.
+% \begin{macrocode}
+ \@@_old_label {\l_@@_label_tl}}
+% \end{macrocode}
+% We store the boolean |\l_@@_tag_star_bool| in the global variable |\g_tmpa_bool| because we will use it in the
+% \emph{next} cell (after the |&|).
+% \begin{macrocode}
+ \bool_gset_eq:NN \g_tmpa_bool \l_@@_tag_star_bool
+ & \cs_set_eq:NN \theequation \g_tmpa_tl
+ \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).
+% \begin{macrocode}
+ \hbox_overlap_left:n \@eqnnum
+ }}
\cr\noalign{\skip_vertical:n {#1 + \l_@@_interline_skip}
\scan_stop:}}
% \end{macrocode}
-% According of the documentation of \pkg{expl3}, the previous addition in ``|#1 + \l_@@_interline_skip|'' is really
+% According to the documentation of \pkg{expl3}, the previous addition in ``|#1 + \l_@@_interline_skip|'' is really
% an addition of skips (=glues).
%
% \bigskip
+% \subsection{The environment \{DispWithArrows\}}
+%
+%
+% For the environment |{DispWithArrows}|, the construction is a construction of the type:
+%
+% |\[\vcenter{\halign to \displaywith {...}}\]|
+%
+% The purpose of the |\vcenter| is to have an environment unbreakable.
+%
+% \bigskip
+% \begin{macrocode}
+\NewDocumentEnvironment {DispWithArrows} {O{}}
+ {
+% \end{macrocode}
+% The command |\intertext@| is a command of \pkg{amsmath} which loads the definition of |\intertext| (if it is
+% loaded, the package \pkg{nccmath} gives a new defintion of |\intertext@|).
+% \begin{macrocode}
+ \cs_if_exist_use:N \intertext@
+ \if_mode_math:
+ \msg_error:nn {witharrows}
+ {{DispWithArrows}~used~in~math~mode}
+ \fi:
+ \bool_set_false:N \l_@@_in_witharrows_bool
+ \@@_pre_environment:n {#1}
+% \end{macrocode}
+% We use a |\vcenter| in order to prevent page breaks in the environment.
+% \begin{macrocode}
+ \begin{displaymath}
+ \vcenter \bgroup
+ \spread@equation
+ \bool_if:NTF \l_@@_fleqn_bool
+ {\tabskip = \c_zero_skip}
+ {\tabskip = 0 pt plus 1000 pt minus 1000 pt}
+% \end{macrocode}
+% If \pkg{amsmath} is loaded, the LaTeX version of |\label| is stored in |\ltx@label|. If not, it's, of course,
+% stored in |\label|. We store this definition of |\label| because we will redefine |\label| in the environment.
+% \begin{macrocode}
+ \cs_if_exist:NTF \ltx@label
+ {\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}}
+ \cs_set:Npn \nonumber {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\nonumber}}
+ \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\tag}}
+ \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows}
+ {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:
+ \strut
+ \bool_if:NT \l_@@_fleqn_bool
+ {\hspace{\l_@@_mathindent_dim}}
+ \hfil
+ $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$
+ \tabskip = \c_zero_skip
+ &
+ \cs_set:Npn \notag {\bool_set_true:N \l_@@_notag_bool}
+ \cs_set_eq:NN \nonumber \notag
+ \cs_set_eq:NN \tag \@@_tag
+ \cs_set_eq:NN \label \@@_label:n
+ $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {{}##}$
+ \tabskip = 0 pt plus 1000 pt minus 1000 pt
+ \int_gincr:N \g_@@_line_bis_int
+ \tl_if_empty:NTF \l_@@_name_tl
+ {\tikz [remember~picture,overlay]
+ \node [_@@_node_style,
+ name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-l] {} ;}
+ {\tikz [remember~picture,overlay]
+ \node [_@@_node_style,
+ name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-l,
+ alias = \l_@@_name_tl-\int_use:N\g_@@_line_int-l] {} ;}
+ \hfil
+ \tl_if_empty:NTF \l_@@_name_tl
+ {\tikz [remember~picture,overlay]
+ \node [_@@_node_style,
+ name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-r] {} ;}
+ {\tikz [remember~picture,overlay]
+ \node [_@@_node_style,
+ name = wa-\l_@@_prefix_str-\int_use:N\g_@@_line_int-r,
+ alias = \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}}
+ \iffalse ## \fi
+ \cr}
+ {\\
+% \end{macrocode}
+% The following |\egroup| is for the |\halign|.
+% \begin{macrocode}
+ \egroup
+% \end{macrocode}
+% The following |\egroup| is for the |\vcenter| (aimed to prevent page breaks).
+% \begin{macrocode}
+ \egroup
+ \end{displaymath}
+ \@@_post_environment:
+ \ignorespacesafterend
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
+% The command |\@@_tag| will be linked to |\tag| in the environment |{DispWithArrows}|.
+% \begin{macrocode}
+\NewDocumentCommand \@@_tag {sm}
+ {\bool_set_false:N \l_@@_notag_bool
+ \tl_set:Nn \l_@@_tag_tl {#2}
+ \bool_set:Nn \l_@@_tag_star_bool {#1}
+% \end{macrocode}
+% The starred version |\tag*| can't be use if \pkg{amsmath} has not been loaded because this version does the job
+% by desactivating the command |\tagform@| inserted by \pkg{amsmath} in the (two versions of the) command
+% |\@eqnnum|.\footnote{There are two versions of |@eqnnum|, a standard version and a version for the option |leqno|.}
+% \begin{macrocode}
+ \bool_if:nT {#1 && ! \cs_if_exist_p:N \tagform@}
+ { \msg_error:nn {witharrows} {tag*~without~amsmath} }
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
+% With the environment |{DispWithArrows*}|, the equations are not numbered.
+% \begin{macrocode}
+\NewDocumentEnvironment {DispWithArrows*} {}
+ {\WithArrowsOptions{notag}
+ \DispWithArrows}
+ {\endDispWithArrows}
+% \end{macrocode}
+%
+% \bigskip
% \subsection{We draw the arrows}
%
% \bigskip
@@ -2622,7 +3044,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% After the last arrow of the environment, you have to draw the last group of arrows.
+% After the last arrow of the environment, we have to draw the last group of arrows.
% \begin{macrocode}
\@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int
\group_end:
@@ -3036,7 +3458,7 @@ version 2005/12/01 or later.
% \subsection{The error messages of the package}
% \begin{macrocode}
\msg_new:nnn {witharrows}
- {Third~column~in~an~environment}
+ {Third~column~in~an~environment~{WithArrows}}
{By~default,~an~environment~\{WithArrows\}~can~only~have~two~columns.~
Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str
\str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~
@@ -3046,6 +3468,13 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\msg_new:nnn {witharrows}
+ {Third~column~in~an~environment~{DispWithArrows}}
+ {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~have~two~columns.~
+ If~you~go~on,~you~may~have~an~incorrect~output.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
{The~option~"jump"~must~be~non~negative}
{You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~
\token_to_str:N\Arrow.~ You~can~create~an~arrow~going~backwards~with~
@@ -3070,6 +3499,13 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\msg_new:nnn {witharrows}
+ {{DispWithArrows}~used~in~math~mode}
+ {The~environment~\{DispWithArrows\}~should~be~used~only~outside~math~mode.~
+ If~you~go~on,~you~will~have~other~errors.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
{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~"
@@ -3098,7 +3534,7 @@ version 2005/12/01 or later.
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~
AllowLineWithoutAmpersand.}
- {Morevoer, the~ampersand~can~be~implicit~
+ {Moreover, the~ampersand~can~be~implicit~
(e.g.~if~you~use~\token_to_str:N\MoveEqLeft\ of~mathtools).}
% \end{macrocode}
%
@@ -3176,6 +3612,33 @@ version 2005/12/01 or later.
If~you~go~on,~the~arrow~will~be~ignored.}
% \end{macrocode}
%
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
+ {tag*~without~amsmath}
+ {We~can't~use~\token_to_str:N\tag*~because~you~haven't~load~amsmath~
+ (or~mathtools).~If~you~go~on,~the~command~\token_to_str:N\tag\
+ will~be~used~instead.}
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {The~command~\token_to_str:N #1
+ is~not~allowed~in~the~first~column~of~\{DispWithArrows\}~but~
+ only~in~the~second~column~(and,~of~course,~in~the~
+ environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\msg_new:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {The~command~\token_to_str:N #1
+ is~not~allowed~in~\{WithArrows\}~but~is~allowed~in~the~second~
+ column~of~\{DispWithArrows\}~(and,~of~course,~in~the~
+ environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
+% \end{macrocode}
% \section{History}
%
% \subsection{Changes between versions 1.0 and 1.1}
@@ -3193,7 +3656,7 @@ version 2005/12/01 or later.
% \subsection{Changes between versions 1.1 and 1.2}
%
% The package \pkg{witharrows} can now be loaded without having loaded previously \pkg{tikz} and the libraries
-% |arrow.meta| and |bending|.
+% |arrow.meta| and |bending| (this extension and these libraries are loaded silently by \pkg{witharrows}).
%
% New option |groups| (with a \emph{s})
%
@@ -3229,6 +3692,10 @@ version 2005/12/01 or later.
% \subsubsection{Changes between 1.6 and 1.6.1}
%
% Correction of a bug that leads to incompatibility with |\usetikzlibrary{babel}|.
+%
+% \subsection{Changes between 1.6.1 and 1.7}
+%
+% New environment |{DispWithArrows}|.
% \endinput
%
% Local Variables:
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
index 734bd4b0386..81837e0a9af 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.6.1}
-\def\myfiledate{2018/05/18}
+\def\myfileversion{1.7}
+\def\myfiledate{2018/07/18}
\RequirePackage{tikz}
\usetikzlibrary{arrows.meta,bending}
\RequirePackage{l3keys2e}
@@ -96,6 +96,7 @@
{\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
@@ -113,13 +114,27 @@
\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
+\tl_new:N \l__wa_label_tl
+\cs_set:Nn \__wa_label:n {\tl_set:Nn \l__wa_label_tl {#1}}
+\bool_new:N \l__wa_fleqn_bool
+\dim_new:N \l__wa_mathindent_dim
+\dim_set:Nn \l__wa_mathindent_dim {25pt}
\int_set:Nn \l__wa_level_int 1
\keys_define:nn {WithArrows/GlobalOrEnv}
- { t .code:n = \int_set:Nn \l__wa_pos_env_int 0,
+ { 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 .value_forbidden:n = true,
- c .code:n = \int_set:Nn \l__wa_pos_env_int 1,
+ 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 .value_forbidden:n = true,
- b .code:n = \int_set:Nn \l__wa_pos_env_int 2,
+ 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 .value_forbidden:n = true,
ygap .dim_set:N = \l__wa_ygap_dim,
ygap .value_required:n = true,
@@ -129,7 +144,7 @@
ystart .initial:n = 0.4 ex,
MoreColumns .code:n = { \msg_redirect_name:nnn
{witharrows}
- {Third~column~in~an~environment}
+ {Third~column~in~an~environment~{WithArrows}}
{none} },
MoreColumns .value_forbidden:n = true,
AllowLineWithoutAmpersand .code:n = { \msg_redirect_name:nnn
@@ -173,6 +188,23 @@
{\msg_error:nn {witharrows} {Option~will~be~ignored}}
{\tl_set:Nn \l__wa_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}}
+ {\tl_if_eq:nnTF {#1} {true}
+ {\bool_set_true:N \l__wa_fleqn_bool}
+ {\bool_set_false:N \l__wa_fleqn_bool}}},
+ fleqn .default:n = true,
+ mathindent .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}
+ {\dim_set:Nn \l__wa_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}}
+ {\tl_if_eq:nnTF {#1} {true}
+ {\bool_set_true:N \l__wa_notag_bool}
+ {\bool_set_false:N \l__wa_notag_bool}}},
+ notag .default:n = true,
+ nonumber .meta:n = notag,
unknown .code:n = \msg_error:nn {witharrows} {Option~unknown}
}
\keys_define:nn {WithArrows/General}
@@ -249,7 +281,7 @@
{\tl_set:Nn \l_tmpa_tl {Arrow}
\msg_error:nn {witharrows} {Arrow~in~first~column}
\__wa_Arrow}
-\NewDocumentEnvironment {WithArrows} {O{}}
+\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
@@ -261,10 +293,6 @@
\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 {-} {-} {-}}
- \reverse_if:N \if_mode_math:
- \msg_error:nn {witharrows}
- {{WithArrows}~used~outside~math~mode}
- \fi:
\cs_set_eq:NN \\ \__wa_cr:
\dim_zero:N \mathsurround
\int_zero_new:N \l__wa_initial_int
@@ -279,7 +307,26 @@
\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
+ \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow}
+\NewDocumentEnvironment {WithArrows} {O{}}
+ { \bool_set_true:N \l__wa_in_witharrows_bool
+ \reverse_if:N \if_mode_math:
+ \msg_error:nn {witharrows}
+ {{WithArrows}~used~outside~math~mode}
+ \fi:
+ \cs_set:Npn \notag {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\notag}}
+ \cs_set:Npn \nonumber {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\nonumber}}
+ \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {\tag}}
+ \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
{0 {\vtop}
1 {\vcenter}
@@ -314,14 +361,16 @@
\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}
+ && \msg_error:nn {witharrows} {Third~column~in~an~environment~{WithArrows}}
$\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$
\cr
}
{\crcr
\egroup
\egroup
- \int_compare:nNnT \g__wa_line_bis_int < \g__wa_line_int
+ \__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
@@ -347,16 +396,128 @@
\seq_gpop_right:NN \g__wa_line_bis_int_seq \l_tmpa_tl
\int_gset:Nn \g__wa_line_bis_int {\l_tmpa_tl}
}
-\cs_set_protected:Nn \__wa_cr:
+\cs_new_protected:Nn \__wa_cr:
{\scan_stop:
\group_align_safe_begin:
\peek_meaning_remove:NTF * \__wa_cr_i: \__wa_cr_i:}
-\cs_set_protected:Nn \__wa_cr_i:
+\cs_new_protected:Nn \__wa_cr_i:
{\peek_meaning:NTF [ {\__wa_cr_ii:} {\__wa_cr_ii:[\c_zero_dim]} }
\cs_new_protected:Npn \__wa_cr_ii:[#1]
{\group_align_safe_end:
+ \bool_if:NF \l__wa_in_witharrows_bool
+ {\bool_if:NTF \l__wa_notag_bool
+ {&}
+ {
+ \tl_if_empty:NT \l__wa_tag_tl
+ {\int_gincr:N \c@equation}
+ \cs_gset:Npx \g_tmpa_tl
+ {\tl_if_empty:NTF \l__wa_tag_tl
+ \theequation
+ \l__wa_tag_tl}
+ \tl_if_empty:NF \l__wa_label_tl
+ {
+ \cs_set_eq:NN \@currentlabel \g_tmpa_tl
+ \cs_if_exist:NT \hyper@refstepcounter
+ {\cs_set:Npn \This@name {equation}
+ \hyper@refstepcounter{equation}}
+ \__wa_old_label {\l__wa_label_tl}}
+ \bool_gset_eq:NN \g_tmpa_bool \l__wa_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 \@eqnnum
+ }}
\cr\noalign{\skip_vertical:n {#1 + \l__wa_interline_skip}
\scan_stop:}}
+\NewDocumentEnvironment {DispWithArrows} {O{}}
+ {
+ \cs_if_exist_use:N \intertext@
+ \if_mode_math:
+ \msg_error:nn {witharrows}
+ {{DispWithArrows}~used~in~math~mode}
+ \fi:
+ \bool_set_false:N \l__wa_in_witharrows_bool
+ \__wa_pre_environment:n {#1}
+ \begin{displaymath}
+ \vcenter \bgroup
+ \spread@equation
+ \bool_if:NTF \l__wa_fleqn_bool
+ {\tabskip = \c_zero_skip}
+ {\tabskip = 0 pt plus 1000 pt minus 1000 pt}
+ \cs_if_exist:NTF \ltx@label
+ {\cs_set_eq:NN \__wa_old_label \ltx@label}
+ {\cs_set_eq:NN \__wa_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}}
+ \cs_set:Npn \tag ##1 {\msg_error:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {\tag}}
+ \cs_set:Npn \label ##1 {\msg_error:nnn {witharrows}
+ {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:
+ \strut
+ \bool_if:NT \l__wa_fleqn_bool
+ {\hspace{\l__wa_mathindent_dim}}
+ \hfil
+ $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$
+ \tabskip = \c_zero_skip
+ &
+ \cs_set:Npn \notag {\bool_set_true:N \l__wa_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 {{}##}$
+ \tabskip = 0 pt plus 1000 pt minus 1000 pt
+ \int_gincr:N \g__wa_line_bis_int
+ \tl_if_empty:NTF \l__wa_name_tl
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l] {} ;}
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l,
+ alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-l] {} ;}
+ \hfil
+ \tl_if_empty:NTF \l__wa_name_tl
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r] {} ;}
+ {\tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r,
+ alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-r] {} ;}
+ \bool_if:NT \l__wa_shownodenames_bool
+ {\hbox_overlap_right:n {\small wa-\l__wa_prefix_str
+ -\int_use:N\g__wa_line_int}}
+ & ##
+ \tabskip = \c_zero_skip
+ && \msg_error:nn {witharrows} {Third~column~in~an~environment~{DispWithArrows}}
+ \iffalse ## \fi
+ \cr}
+ {\\
+ \egroup
+ \egroup
+ \end{displaymath}
+ \__wa_post_environment:
+ \ignorespacesafterend
+ }
+\NewDocumentCommand \__wa_tag {sm}
+ {\bool_set_false: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 && ! \cs_if_exist_p:N \tagform@}
+ { \msg_error:nn {witharrows} {tag*~without~amsmath} }
+ }
+\NewDocumentEnvironment {DispWithArrows*} {}
+ {\WithArrowsOptions{notag}
+ \DispWithArrows}
+ {\endDispWithArrows}
\cs_new_protected:Nn \__wa_draw_arrows:
{ \group_begin:
\int_zero_new:N \l__wa_first_arrow_of_group_int
@@ -573,13 +734,17 @@
{\draw[<-] ($(\k-r.south)+(\l__wa_xoffset_dim,0)$) -- ++(5mm,0) ;} ;
\end{tikzpicture}}
\msg_new:nnn {witharrows}
- {Third~column~in~an~environment}
+ {Third~column~in~an~environment~{WithArrows}}
{By~default,~an~environment~\{WithArrows\}~can~only~have~two~columns.~
Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str
\str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~
you~should~use~the~option~"MoreColumns"~at~a~global~level~or~for~
an~environment.~However,~you~can~go~one~for~this~time.}
\msg_new:nnn {witharrows}
+ {Third~column~in~an~environment~{DispWithArrows}}
+ {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~have~two~columns.~
+ If~you~go~on,~you~may~have~an~incorrect~output.}
+\msg_new:nnn {witharrows}
{The~option~"jump"~must~be~non~negative}
{You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~
\token_to_str:N\Arrow.~ You~can~create~an~arrow~going~backwards~with~
@@ -595,6 +760,10 @@
{The~environment~\{WithArrows\}~should~be~used~only~in~math~mode.~
Nevertheless,~you~can~go~on.}
\msg_new:nnn {witharrows}
+ {{DispWithArrows}~used~in~math~mode}
+ {The~environment~\{DispWithArrows\}~should~be~used~only~outside~math~mode.~
+ If~you~go~on,~you~will~have~other~errors.}
+\msg_new:nnn {witharrows}
{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~"
@@ -620,7 +789,7 @@
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~
AllowLineWithoutAmpersand.}
- {Morevoer, the~ampersand~can~be~implicit~
+ {Moreover, the~ampersand~can~be~implicit~
(e.g.~if~you~use~\token_to_str:N\MoveEqLeft\ of~mathtools).}
\msg_new:nnn {witharrows}
{Option~incompatible~with~"group(s)"}
@@ -670,6 +839,23 @@
{A~PGF~node~necessary~to~draw~an~arrow~doesn't~exist~
because~you~didn't~put~an~ampersand~in~the~corresponding~line.~
If~you~go~on,~the~arrow~will~be~ignored.}
+\msg_new:nnn {witharrows}
+ {tag*~without~amsmath}
+ {We~can't~use~\token_to_str:N\tag*~because~you~haven't~load~amsmath~
+ (or~mathtools).~If~you~go~on,~the~command~\token_to_str:N\tag\
+ will~be~used~instead.}
+\msg_new:nnn {witharrows}
+ {Command~not~allowed~in~{DispWithArrows}}
+ {The~command~\token_to_str:N #1
+ is~not~allowed~in~the~first~column~of~\{DispWithArrows\}~but~
+ only~in~the~second~column~(and,~of~course,~in~the~
+ environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
+\msg_new:nnn {witharrows}
+ {Command~not~allowed~in~{WithArrows}}
+ {The~command~\token_to_str:N #1
+ is~not~allowed~in~\{WithArrows\}~but~is~allowed~in~the~second~
+ column~of~\{DispWithArrows\}~(and,~of~course,~in~the~
+ environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
\endinput
%%
%% End of file `witharrows.sty'.