texlive[48304] Master/texmf-dist: witharrows

commits+karl at tug.org commits+karl at tug.org
Sun Jul 29 22:56:10 CEST 2018


Revision: 48304
          http://tug.org/svn/texlive?view=revision&revision=48304
Author:   karl
Date:     2018-07-29 22:56:10 +0200 (Sun, 29 Jul 2018)
Log Message:
-----------
witharrows

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf
    trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
    trunk/Master/texmf-dist/source/latex/witharrows/witharrows.ins
    trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty

Modified: trunk/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx	2018-07-29 00:24:15 UTC (rev 48303)
+++ trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx	2018-07-29 20:56:10 UTC (rev 48304)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2017 by F. Pantigny
+% Copyright (C) 2017-2018 by F. Pantigny
 % -----------------------------------
 %
 % This file may be distributed and/or modified under the
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{1.7}
-\def\myfiledate{2018/07/18}
+\def\myfileversion{1.8}
+\def\myfiledate{2018/07/25}
 %
 %
 %<*batchfile>
@@ -584,9 +584,9 @@
 % \bigskip
 % The environment |{WithArrows}| gives also a |groups| option (with a \emph{s} in the name). With this option, the
 % arrows are divided into several ``groups''. Each group is a set of connected\footnote{More precisely: for each
-% arrow $a$, we note $i(a)$ the number of its initial row and $f(a)$ the number of its final line ; for two arrows
+% arrow $a$, we note $i(a)$ the number of its initial row and $f(a)$ the number of its final line; for two arrows
 % $a$ and $b$, we say that $a \sim b$ when
-% $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq \varnothing$ ; the groups are the
+% $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq \varnothing$; the groups are the
 % equivalence classes of the transitive closure of $\sim$.} arrows. All the arrows of a given group are grouped on
 % a same vertical line and at a leftmost position.
 %
@@ -604,7 +604,7 @@
 % \bigskip
 % If desired, the option |group| or the option |groups| can be given to the command |\WithArrowsOptions| so that it will become
 % the default value. In this case, it's still possible to come back to the default behaviour for a given
-% environment |{WithArrows}| with the option |rr|: |\begin{WithArrows}{rr}|
+% environment |{WithArrows}| with the option |rr|: |\begin{WithArrows}[rr]|
 %
 %
 % \section{Comparison with the environment \{aligned\}}
@@ -779,7 +779,7 @@
 %
 %
 % \medskip 
-% The following is composed with |{WithArrows}[c,displaystyle]|. The results are stricly identical.\footnote{In
+% The following is composed with |{WithArrows}[c,displaystyle]|. The results are strictly identical.\footnote{In
 % versions of \pkg{amsmath} older than the 5~nov.~2016, an thin space was added on the left of an environment
 % |{aligned}|. The new versions do not add this space and neither do |{WithArrows}|.}\par\nobreak
 %
@@ -1170,7 +1170,8 @@
 % \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|.
+% 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.}
 % 
 % These commands must be in the second column of the environment.
 % \begin{Verbatim}
@@ -1188,8 +1189,9 @@
 % |\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.
+% It's also possible to suppress all the autogenerated numbers with the option |notag| (or |nonumber|), at the
+% global or environment level. There is also an environment |{DispWithArrows*}| which suppresses all these
+% numbers.\footnote{Even in this case, it's possible to put a ``manual tag'' with the command |\tag|.}
 % \begin{Verbatim}
 % \begin{~emphase#DispWithArrows*@}
 % A & = (a+1)^2 \Arrow{we expand} \\
@@ -1204,8 +1206,8 @@
 %
 % \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.
+% standard classes of LaTeX). In this case, the left margin can be controlled with the option |mathindent| (with a
+% name inspired by the parameter |\mathindent| of standard LaTeX). The default value of this parameter is 25~pt.
 %
 % \begin{Verbatim}
 % \begin{DispWithArrows}[~emphase#fleqn,mathindent = 1cm@]
@@ -1226,27 +1228,40 @@
 % 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 package \pkg{amsmath} is loaded, it's possible to use the environment |{subequations}| and 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
+% \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}). 
+% |{DispWithArrows}| is not constructed upon |{align}| (in fact, it's possible to use \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}.
+% 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 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 
 % \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}
+% \end{itemize}
 % 
+% \bigskip 
+% Concerning the references, the package \pkg{witharrows} is compatible with the extensions \pkg{autonum},
+% \pkg{cleveref}, \pkg{fancyref}, \pkg{hyperref}, \pkg{prettyref}, \pkg{refstyle}, \pkg{typedref} and
+% \pkg{varioref}, and with the options |showonlyrefs| and |showmanualtags| of \pkg{mathtools}.\footnote{We recall
+% that \pkg{varioref}, \pkg{hyperref}, \pkg{cleveref} and \pkg{autonum} must be loaded in this order. The package
+% \pkg{witharrows} can be loaded anywhere.}
+%
+% It is not compatible with \pkg{showkeys} (not all the labels are shown).
+%
 % \section{Advanced features}
 %
 %
@@ -1687,8 +1702,8 @@
 %
 %    \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}
 %    \end{macrocode}
 %
 % \bigskip
@@ -1753,11 +1768,25 @@
        \bool_gset_true:N \g_@@_footnote_bool}
 %    \end{macrocode}
 % The flag |\g_@@_footnote_bool| is raised and so, we will only have to test |\g_@@_footnote_bool| in order to
-% known if we have to insert an environnement |{savenotes}| (see the definition of environnement |{WithArrows}|).
+% known if we have to insert an environnement |{savenotes}| (the |\begin{savenotes}| is in |\@@_pre_environment:n|
+% and |\end{savenotes}| in |\@@_post_environment:| which are executed at the beginning and at the end of the
+% environments |{WithArrows}| and |{DispWithArrows}|).
 %
 % \bigskip
 % \subsection{Some technical definitions}
 %
+% We create booleans in order to known 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}
+\AtBeginDocument{\clist_map_inline:nn
+                    {amsmath,mathtools,autonum,cleveref,hyperref,typedref}
+                    {\bool_new:c {c_@@_#1_loaded_bool}
+                     \@ifpackageloaded {#1}
+                           {\bool_set_true:c {c_@@_#1_loaded_bool}}
+                           {}}}
+%    \end{macrocode}
+%
 % We define a Tikz style |@@_node_style| for the nodes that will be created in the |\halign|. The nodes are Tikz
 % nodes of shape ``rectangle'' but with zero width. An arrow between two nodes starts from the \emph{south} anchor
 % of the first node and arrives at the \emph{north} anchor of the second node.
@@ -1807,13 +1836,14 @@
 % possible to use the environments of \pkg{amsmath} (e.g. |{aligned}|) in an environment |{WithArrows}|.
 % 
 % Nevertheless, we want the extension \pkg{witharrows} available without \pkg{amsmath}. That's why we give a
-% definition of |\spread at equation| (this definition will be loaded only if \pkg{amsmath} --- or \pkg{mathtools} --- has
-% not been loaded yet).
+% definition of |\spread at equation| if \pkg{amsmath} is not loaded (you put the code in a |\AtBeginDocument| because
+% the flag |\c_@@_amsmath_loaded_bool| is itself set in a |\AtBeginDocument|).
 %    \begin{macrocode}
-\cs_if_free:NT \spread at equation
-    {\cs_set_protected:Npn \spread at equation
-               {\openup\jot   
-                \cs_set_protected:Npn \spread at equation {}}}
+\AtBeginDocument
+    {\bool_if:NF \c_@@_amsmath_loaded_bool
+       {\cs_set_protected:Npn \spread at equation
+           {\openup\jot   
+            \cs_set_protected:Npn \spread at equation {}}}}
 %    \end{macrocode}
 % Don't put |\cs_set_eq:NN \spread at equation \prog_do_nothing:| in the last line because this would raise errors
 % with nested environments.
@@ -1822,6 +1852,7 @@
 % \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}
@@ -1953,11 +1984,28 @@
 %
 % \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|. 
+% |{DispWithArrows}|. It's possible to put several labels for the same line (it's not possible in the environments
+% of \pkg{amsmath}). That's why we store the differents labels of a same line in a sequence |\l_@@_labels_seq|.
 %    \begin{macrocode}
-\tl_new:N \l_@@_label_tl
-\cs_set:Nn \@@_label:n {\tl_set:Nn \l_@@_label_tl {#1}}
+\seq_new:N \l_@@_labels_seq
+\cs_set:Nn \@@_label:n {\seq_if_empty:NF \l_@@_labels_seq 
+                           {\msg_error:nn {witharrows} {Multiple~labels}}
+                        \seq_put_right:Nn \l_@@_labels_seq {#1}
 %    \end{macrocode}
+% In order to be compatible with the option |showonlyrefs|, we have to use internals of \pkg{mathtools}. By
+% security, we provide an option |code-of-mathtools| which can be switched off if the internals of \pkg{mathtools}
+% are changed.
+%    \begin{macrocode}
+                        \bool_if:nT \c_@@_mathtools_loaded_bool
+                           {\MH_if_boolean:nT {show_only_refs} 
+                               {\cs_if_exist:cTF {MT_r_#1}
+                                 {\bool_set_false:N \l_@@_notag_bool}
+                                 {\bool_set_true:N \l_@@_notag_bool}}}
+                        \bool_if:nT \c_@@_autonum_loaded_bool
+                               {\cs_if_exist:cTF {autonum@#1Referenced}
+                                 {\bool_set_false:N \l_@@_notag_bool}
+                                 {\bool_set_true:N \l_@@_notag_bool}}}
+%    \end{macrocode}
 %
 %
 % \bigskip
@@ -1968,7 +2016,7 @@
 %    \end{macrocode}
 % 
 % \bigskip
-% The dimension |\l_@@_mathindent_dim| is used only by the environments |{DispWithArrows}| : it's the left margin of
+% 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
@@ -1975,7 +2023,6 @@
 \dim_set:Nn \l_@@_mathindent_dim {25pt}
 %    \end{macrocode}
 % 
-%
 % \bigskip
 % \subsection{The definition of the options}
 %
@@ -2182,6 +2229,19 @@
                                  {\bool_set_false:N \l_@@_notag_bool}}},
       notag   .default:n = true,
       nonumber .meta:n   = notag,
+%    \end{macrocode}
+% 
+% \bigskip
+% The option |AllowMultipleLabels| indicates wether multiple labels are allowed for the same line of an environment
+% |{DispWithArrows}| or |{DispWithArrows*}|.
+%    \begin{macrocode}
+      AllowMultipleLabels .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool
+                                         {\msg_error:nn {witharrows} {Option~will~be~ignored}}
+                                         {\msg_redirect_name:nnn {witharrows} 
+                                                           {Multiple~labels}
+                                                           {none}}},
+      AllowMultipleLabels .value_forbidden:n = true,
+      fleqn   .default:n = true,
       unknown .code:n  = \msg_error:nn {witharrows} {Option~unknown}
      }
 %    \end{macrocode}
@@ -2575,18 +2635,11 @@
 % We create the ``left node'' of the line (when using macros in Tikz node names, the macros have to be fully
 % expandable: here, |\tl_use:N| and |\int_use:N| are fully expandable).
 %    \begin{macrocode}
-           \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] {} ;}
-%    \end{macrocode}
-% If the environment |{WithArrows}| has a name (given with the option |name|), the node has also an alias
-% constructed with this name.
-%    \begin{macrocode}
-              {\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] {} ;}
+           \tikz [remember~picture,overlay] 
+                 \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}} ] {} ;
            \hfil
 %    \end{macrocode}
 %
@@ -2594,14 +2647,11 @@
 % Now, after the |\hfil|, we create the ``right node'' and, if the option |shownodenames| is raised, the name of
 % the node is written in the document (useful for debugging).
 %    \begin{macrocode}
-           \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] {} ;}
+           \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}} ] {} ;
            \bool_if:NT \l_@@_shownodenames_bool
                 {\hbox_overlap_right:n {\small wa-\l_@@_prefix_str
                                                  -\int_use:N\g_@@_line_int}}
@@ -2750,15 +2800,16 @@
                 {&}
                 {
 %    \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|.
+% Here, we can't use |\refstepcounter{equation}| because if the user has issued a |\tag| command, we have to use
+% |\l_@@_tag_tl| and not |\theequation|. That's why we have to do the job done by |\refstepcounter| manually.
+% 
+% First, the incrementation of the counter (potentialy).
 %    \begin{macrocode}
                  \tl_if_empty:NT \l_@@_tag_tl
                     {\int_gincr:N \c at 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 store in |\g_tmpa_tl| the tag we will have to compose at the end of 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
@@ -2765,24 +2816,51 @@
                       {\tl_if_empty:NTF \l_@@_tag_tl
                           \theequation 
                           \l_@@_tag_tl}
-                 \tl_if_empty:NF \l_@@_label_tl
+%    \end{macrocode}
+% It's possible to put several labels for the same line (it's not possible in the environments
+% of \pkg{amsmath}). That's why the differents labels of a same line are stored in a sequence |\l_@@_labels_seq|.
+%    \begin{macrocode}
+                 \seq_if_empty:NF \l_@@_labels_seq
                       {
 %    \end{macrocode}
-% The following code is inspired from the definition of |\refstepcounter| in |source2e|.
+% Now, we do the job done by |\refstepcounter| and by the redefinitions of |\refstepcounter| done by some packages
+% (the incrementation of the counter has been done yet).
+%
+% First an action which is in the definition of |\refstepcounter| in |source2e|.
 %    \begin{macrocode}
-                       \cs_set_eq:NN \@currentlabel \g_tmpa_tl
+                       \cs_set:Npx \@currentlabel {\p at equation \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.
+% Then, an action done by \pkg{hyperref} in its redefinition of |\refstepcounter|.
 %    \begin{macrocode}
-                       \cs_if_exist:NT \hyper at refstepcounter
+                       \bool_if:NT \c_@@_hyperref_loaded_bool
                             {\cs_set:Npn \This at name {equation}
                              \hyper at refstepcounter{equation}}
 %    \end{macrocode}
-% Now, we can issue the command |\label|.
+%
+% Then, an action done by \pkg{cleveref} in its redefinition of |\refstepcounter|. The package \pkg{cleveref}
+% creates in the |aux| file a command |\cref at currentlabel| similar to |\@current| but with more informations.
+%    \begin{macrocode}        
+                       \bool_if:NT \c_@@_cleveref_loaded_bool
+                           {\cref at constructprefix{equation}{\cref at result}
+                            \@ifundefined{cref at equation@alias}
+                                  {\def\@tempa{equation}}
+                                  {\def\@tempa{\csname cref at equation@alias\endcsname}}
+                            \protected at edef\cref at currentlabel{[\@tempa][\arabic{equation}][\cref at result]
+                                                              \p at equation \g_tmpa_tl}}
+%    \end{macrocode}
+% 
+% Then, an action done by \pkg{typedref} in its redefinition of |\refstepcounter|. The command |\sr at name| is a
+% prefix added to the name of the label by the redefinition of |\label| done by \pkg{typedref}.
 %    \begin{macrocode}
-                       \@@_old_label {\l_@@_label_tl}}
+                       \bool_if:NT \c_@@_typedref_loaded_bool
+                          {\cs_set:Npn \sr at name {equation}}
 %    \end{macrocode}
+% Now, we can issue the command |\label| (some package may have redefined |\label|, for example \pkg{typedref}) for
+% each item in the sequence of the labels (it's possible to put several labels to the same line and that's why the
+% labels are in the sequence |\l_@@_labels_seq|).
+%    \begin{macrocode}
+                       \seq_map_function:NN \l_@@_labels_seq \@@_old_label}
+%    \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}
@@ -2816,10 +2894,23 @@
 \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@|).
+% If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we deactivate 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}
-           \cs_if_exist_use:N \intertext@
+          \bool_if:nT \c_@@_mathtools_loaded_bool 
+                 {\MH_if_boolean:nT {show_only_refs} 
+                    {\MT_showonlyrefs_false:
+%    \end{macrocode}
+% However, we have to re-raise the flag |{show_only_refs}| of \pkg{mhsetup} because it has been switched off by
+% |\MT_showonlyrefs_false:| and we will use it in the code of the new version of |\label|.
+%    \begin{macrocode}
+                      \MH_set_boolean_T:n {show_only_refs}
+                      \bool_set_true:N \l_@@_notag_bool}}
+%    \end{macrocode}
+% The command |\intertext@| is a command of \pkg{amsmath} which loads the definition of |\intertext|.
+%    \begin{macrocode}
+           \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@
            \if_mode_math:
                \msg_error:nn {witharrows} 
                              {{DispWithArrows}~used~in~math~mode}
@@ -2827,9 +2918,15 @@
            \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 |\[|.
+%    \begin{macrocode}
+           \nointerlineskip
+           \makebox[.6\linewidth]{}
+           $$
+%    \end{macrocode}
 % We use a |\vcenter| in order to prevent page breaks in the environment.
 %    \begin{macrocode}
-           \begin{displaymath}
            \vcenter \bgroup 
            \spread at equation 
            \bool_if:NTF \l_@@_fleqn_bool
@@ -2839,7 +2936,7 @@
 % If \pkg{amsmath} is loaded, the LaTeX version of |\label| is stored in |\ltx at 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 at label 
+           \bool_if:NTF \c_@@_amsmath_loaded_bool
               {\cs_set_eq:NN \_@@_old_label \ltx at label}  
               {\cs_set_eq:NN \_@@_old_label \label}
            \cs_set:Npn \notag {\msg_error:nnn {witharrows} 
@@ -2859,7 +2956,7 @@
              \cs_set_eq:cN \l_@@_CommandName_tl \@@_Arrow_first_column:
              \strut
              \bool_if:NT \l_@@_fleqn_bool
-                   {\hspace{\l_@@_mathindent_dim}}
+                   {\skip_horizontal:n \l_@@_mathindent_dim}
              \hfil
              $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$
              \tabskip = \c_zero_skip
@@ -2871,23 +2968,17 @@
              $\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] {} ;}
+             \tikz [remember~picture,overlay]
+                  \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}} ] {} ;
              \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] {} ;}
+             \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}} ] {} ;
              \bool_if:NT \l_@@_shownodenames_bool
                   {\hbox_overlap_right:n {\small wa-\l_@@_prefix_str
                                                    -\int_use:N\g_@@_line_int}}
@@ -2905,8 +2996,19 @@
 % The following |\egroup| is for the |\vcenter| (aimed to prevent page breaks).
 %    \begin{macrocode}
            \egroup 
-           \end{displaymath}
+           $$
+%    \end{macrocode}
+% The code in |\@@_post_environment:| is common to |{WithArrows}| and |{DispWithArrows}|.
+%    \begin{macrocode}
            \@@_post_environment:
+%    \end{macrocode}
+% If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we reactivate the code of \pkg{mathtools} for
+% the option |showonlyrefs| with the command |\MT_showonlyrefs_true:| (it has been desactivated in the beginning of
+% the environment).
+%    \begin{macrocode}
+           \bool_if:nT \c_@@_mathtools_loaded_bool
+                    {\MH_if_boolean:nT {show_only_refs} 
+                          \MT_showonlyrefs_true:}
            \ignorespacesafterend
            }
 %    \end{macrocode}
@@ -2916,7 +3018,13 @@
 % 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_if_empty:NF \l_@@_tag_tl
+          {\msg_error:nnn {witharrows} {Multiple~tags} {#2}}
+     \bool_set_false:N \l_@@_notag_bool 
+     \bool_if:nT \c_@@_mathtools_loaded_bool
+           {\MH_if_boolean:nT {show_only_refs}
+                {\MH_if_boolean:nF {show_manual_tags}
+                    {\bool_set_true:N \l_@@_notag_bool}}}
      \tl_set:Nn \l_@@_tag_tl {#2}
      \bool_set:Nn \l_@@_tag_star_bool {#1}
 %    \end{macrocode}
@@ -2924,7 +3032,7 @@
 % 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@}
+     \bool_if:nT {#1 && ! \bool_if_p:N \c_@@_amsmath_loaded_bool}
           { \msg_error:nn {witharrows} {tag*~without~amsmath} }
     }
 %    \end{macrocode}
@@ -2931,7 +3039,8 @@
 % 
 %
 % \bigskip
-% With the environment |{DispWithArrows*}|, the equations are not numbered.
+% With the environment |{DispWithArrows*}|, the equations are not numbered. We don't put |\begin{DispWithArrows}|
+% and |\end{DispWithArrows}| because there is a |\@currenvir| in an error message.
 %    \begin{macrocode}
 \NewDocumentEnvironment {DispWithArrows*} {}
      {\WithArrowsOptions{notag}
@@ -3117,7 +3226,7 @@
 %
 % \bigskip
 % The macro |\@@_draw_arrows_i:| is only for the lisibility of the code. This macro will draw the current arrow 
-% if the arrow is not impossible (that is to say if the Tikz node exists). The first |\group_begin:| is for the
+% if the arrow is not impossible (that is to say if the Tikz nodes exist). The first |\group_begin:| is for the
 % options of the arrow.
 %    \begin{macrocode}
 \cs_new:Nn \@@_draw_arrows_i:
@@ -3469,8 +3578,8 @@
 %    \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.}
+             {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~
+              have~two~columns.~If~you~go~on,~you~may~have~an~incorrect~output.}
 %    \end{macrocode}
 %
 %    \begin{macrocode}          
@@ -3518,21 +3627,24 @@
                   5 {i}
                   6 {group}
                   7 {groups}}"~
-             previously~set~in~the~same~
+             set~in~the~same~
              \int_case:nn\l_@@_level_int 
                   {1 {command~\token_to_str:N\WithArrowsOptions}
-                   2 {declaration~of~options~of~the~environment~\{WithArrows\}}
+                   2 {declaration~of~options~of~the~environment~
+                      \{\@currenvir\}}
                    3 {command~\token_to_str:N\Arrow}}.~
-             If~you~go~on,~I~will~overwrite~the~first~option.}
+             If~you~go~on,~I~will~use~the~option~"\tl_use:N\l_keys_key_tl".}
 %    \end{macrocode}
 %
 %    \begin{macrocode}          
 \msg_new:nnnn {witharrows}
               {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~ 
-               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~
+              {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~ 
+               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.} 
               {Moreover, the~ampersand~can~be~implicit~
                (e.g.~if~you~use~\token_to_str:N\MoveEqLeft\ of~mathtools).}
@@ -3639,6 +3751,27 @@
               column~of~\{DispWithArrows\}~(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}
+             {Multiple~tags}
+             {You~can't~use~twice~the~command~\token_to_str:N\tag\ 
+              in~a~line~of~the~environment~\{\@currenvir\}.~If~you~go~on,~the~tag~ 
+              '#1'~will~be~used.}
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
+\msg_new:nnn {witharrows}
+             {Multiple~labels}
+             {Normaly,~we~can't~use~the~command~\token_to_str:N\label\ 
+              twice~in~a~line~of~the~environment~\{\@currenvir\}.~
+              However,~you~can~go~on.~
+              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).}
+%    \end{macrocode}
+%
 % \section{History}
 %
 % \subsection{Changes between versions 1.0 and 1.1}
@@ -3696,6 +3829,14 @@
 % \subsection{Changes between 1.6.1 and 1.7}
 %
 % New environment |{DispWithArrows}|.
+%
+% \subsection{Changes between 1.7 and 1.8}
+%
+% The numbers and tags of the environment |{DispWithArrows}| are now compatible with all the major LaTeX packages
+% concerning references (\pkg{autonum}, \pkg{cleveref}, \pkg{fancyref}, \pkg{hyperref}, \pkg{prettyref},
+% \pkg{refstyle}, \pkg{typedref} and \pkg{varioref}) and with the options |showonlyrefs| and |showmanualtags| of
+% \pkg{mathtools}.
+%
 % \endinput
 %
 % Local Variables:

Modified: trunk/Master/texmf-dist/source/latex/witharrows/witharrows.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/witharrows/witharrows.ins	2018-07-29 00:24:15 UTC (rev 48303)
+++ trunk/Master/texmf-dist/source/latex/witharrows/witharrows.ins	2018-07-29 20:56:10 UTC (rev 48304)
@@ -1,5 +1,5 @@
 %%
-%% Copyright (C) 2017 by F. Pantigny
+%% Copyright (C) 2017-2018 by F. Pantigny
 %%
 %%
 %% This file may be distributed and/or modified under the
@@ -17,7 +17,7 @@
 \usedir{tex/latex/witharrows}
 \preamble
 
-Copyright (C) 2017 by F. Pantigny
+Copyright (C) 2017-2018 by F. Pantigny
 
 This file may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either

Modified: trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty	2018-07-29 00:24:15 UTC (rev 48303)
+++ trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty	2018-07-29 20:56:10 UTC (rev 48304)
@@ -6,7 +6,7 @@
 %%
 %% witharrows.dtx  (with options: `package')
 %% 
-%% Copyright (C) 2017 by F. Pantigny
+%% Copyright (C) 2017-2018 by F. Pantigny
 %% 
 %% This file may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either
@@ -18,8 +18,8 @@
 %% and version 1.3 or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\myfileversion{1.7}
-\def\myfiledate{2018/07/18}
+\def\myfileversion{1.8}
+\def\myfiledate{2018/07/25}
 \RequirePackage{tikz}
 \usetikzlibrary{arrows.meta,bending}
 \RequirePackage{l3keys2e}
@@ -33,8 +33,8 @@
 \bool_new:N \g__wa_footnote_bool
 \int_new:N \l__wa_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__wa_footnote_bool,
+       footnotehyper     .bool_gset:N = \g__wa_footnotehyper_bool}
 \ProcessKeysOptions {WithArrows/package}
 \msg_new:nnn {witharrows}
              {Option~incompatible~with~Beamer}
@@ -75,6 +75,12 @@
            {}
        \usepackage{footnotehyper}
        \bool_gset_true:N \g__wa_footnote_bool}
+\AtBeginDocument{\clist_map_inline:nn
+                    {amsmath,mathtools,autonum,cleveref,hyperref,typedref}
+                    {\bool_new:c {c__wa_#1_loaded_bool}
+                     \@ifpackageloaded {#1}
+                           {\bool_set_true:c {c__wa_#1_loaded_bool}}
+                           {}}}
 \tikzset{__wa_node_style/.style= {
                above = \l__wa_ystart_dim,
                inner~sep = 0 pt,
@@ -92,10 +98,11 @@
                                       WithArrows/arrow/tips,
                                       bend~left = 45,
                                       -> }}
-\cs_if_free:NT \spread at equation
-    {\cs_set_protected:Npn \spread at equation
-               {\openup\jot
-                \cs_set_protected:Npn \spread at equation {}}}
+\AtBeginDocument
+    {\bool_if:NF \c__wa_amsmath_loaded_bool
+       {\cs_set_protected:Npn \spread at equation
+           {\openup\jot
+            \cs_set_protected:Npn \spread at 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
@@ -117,8 +124,19 @@
 \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}}
+\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
+                           {\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
+                               {\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}
@@ -205,6 +223,13 @@
                                  {\bool_set_false:N \l__wa_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}}
+                                         {\msg_redirect_name:nnn {witharrows}
+                                                           {Multiple~labels}
+                                                           {none}}},
+      AllowMultipleLabels .value_forbidden:n = true,
+      fleqn   .default:n = true,
       unknown .code:n  = \msg_error:nn {witharrows} {Option~unknown}
      }
 \keys_define:nn {WithArrows/General}
@@ -341,23 +366,17 @@
            &
            \int_gincr:N \g__wa_line_bis_int
            $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$
-           \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] {} ;}
+           \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}} ] {} ;
            \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] {} ;}
+           \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}}
@@ -414,13 +433,22 @@
                       {\tl_if_empty:NTF \l__wa_tag_tl
                           \theequation
                           \l__wa_tag_tl}
-                 \tl_if_empty:NF \l__wa_label_tl
+                 \seq_if_empty:NF \l__wa_labels_seq
                       {
-                       \cs_set_eq:NN \@currentlabel \g_tmpa_tl
-                       \cs_if_exist:NT \hyper at refstepcounter
+                       \cs_set:Npx \@currentlabel {\p at equation \g_tmpa_tl}
+                       \bool_if:NT \c__wa_hyperref_loaded_bool
                             {\cs_set:Npn \This at name {equation}
                              \hyper at refstepcounter{equation}}
-                       \__wa_old_label {\l__wa_label_tl}}
+                       \bool_if:NT \c__wa_cleveref_loaded_bool
+                           {\cref at constructprefix{equation}{\cref at result}
+                            \@ifundefined{cref at equation@alias}
+                                  {\def\@tempa{equation}}
+                                  {\def\@tempa{\csname cref at equation@alias\endcsname}}
+                            \protected at edef\cref at currentlabel{[\@tempa][\arabic{equation}][\cref at result]
+                                                              \p at equation \g_tmpa_tl}}
+                       \bool_if:NT \c__wa_typedref_loaded_bool
+                          {\cs_set:Npn \sr at 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
                  & \cs_set_eq:NN \theequation \g_tmpa_tl
                    \bool_if:NT \g_tmpa_bool {\cs_set:Npn \tagform@ {}}
@@ -430,7 +458,12 @@
        \scan_stop:}}
 \NewDocumentEnvironment {DispWithArrows} {O{}}
          {
-           \cs_if_exist_use:N \intertext@
+          \bool_if:nT \c__wa_mathtools_loaded_bool
+                 {\MH_if_boolean:nT {show_only_refs}
+                    {\MT_showonlyrefs_false:
+                      \MH_set_boolean_T:n {show_only_refs}
+                      \bool_set_true:N \l__wa_notag_bool}}
+           \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@
            \if_mode_math:
                \msg_error:nn {witharrows}
                              {{DispWithArrows}~used~in~math~mode}
@@ -437,13 +470,15 @@
            \fi:
            \bool_set_false:N \l__wa_in_witharrows_bool
            \__wa_pre_environment:n {#1}
-           \begin{displaymath}
+           \nointerlineskip
+           \makebox[.6\linewidth]{}
+           $$
            \vcenter \bgroup
            \spread at 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 at label
+           \bool_if:NTF \c__wa_amsmath_loaded_bool
               {\cs_set_eq:NN \__wa_old_label \ltx at label}
               {\cs_set_eq:NN \__wa_old_label \label}
            \cs_set:Npn \notag {\msg_error:nnn {witharrows}
@@ -463,7 +498,7 @@
              \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}}
+                   {\skip_horizontal:n \l__wa_mathindent_dim}
              \hfil
              $\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$
              \tabskip = \c_zero_skip
@@ -475,23 +510,17 @@
              $\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] {} ;}
+             \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}} ] {} ;
              \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] {} ;}
+             \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}}
@@ -503,15 +532,24 @@
           {\\
            \egroup
            \egroup
-           \end{displaymath}
+           $$
            \__wa_post_environment:
+           \bool_if:nT \c__wa_mathtools_loaded_bool
+                    {\MH_if_boolean:nT {show_only_refs}
+                          \MT_showonlyrefs_true:}
            \ignorespacesafterend
            }
 \NewDocumentCommand \__wa_tag {sm}
-    {\bool_set_false:N \l__wa_notag_bool
+    {\tl_if_empty:NF \l__wa_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
+           {\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 && ! \cs_if_exist_p:N \tagform@}
+     \bool_if:nT {#1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool}
           { \msg_error:nn {witharrows} {tag*~without~amsmath} }
     }
 \NewDocumentEnvironment {DispWithArrows*} {}
@@ -742,8 +780,8 @@
               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.}
+             {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~
@@ -776,18 +814,21 @@
                   5 {i}
                   6 {group}
                   7 {groups}}"~
-             previously~set~in~the~same~
+             set~in~the~same~
              \int_case:nn\l__wa_level_int
                   {1 {command~\token_to_str:N\WithArrowsOptions}
-                   2 {declaration~of~options~of~the~environment~\{WithArrows\}}
+                   2 {declaration~of~options~of~the~environment~
+                      \{\@currenvir\}}
                    3 {command~\token_to_str:N\Arrow}}.~
-             If~you~go~on,~I~will~overwrite~the~first~option.}
+             If~you~go~on,~I~will~use~the~option~"\tl_use:N\l_keys_key_tl".}
 \msg_new:nnnn {witharrows}
               {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~
-               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~
+              {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~
+               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.}
               {Moreover, the~ampersand~can~be~implicit~
                (e.g.~if~you~use~\token_to_str:N\MoveEqLeft\ of~mathtools).}
@@ -856,6 +897,19 @@
               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.}
+\msg_new:nnn {witharrows}
+             {Multiple~tags}
+             {You~can't~use~twice~the~command~\token_to_str:N\tag\
+              in~a~line~of~the~environment~\{\@currenvir\}.~If~you~go~on,~the~tag~
+              '#1'~will~be~used.}
+\msg_new:nnn {witharrows}
+             {Multiple~labels}
+             {Normaly,~we~can't~use~the~command~\token_to_str:N\label\
+              twice~in~a~line~of~the~environment~\{\@currenvir\}.~
+              However,~you~can~go~on.~
+              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).}
 \endinput
 %%
 %% End of file `witharrows.sty'.



More information about the tex-live-commits mailing list