summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-12-31 22:11:36 +0000
committerKarl Berry <karl@freefriends.org>2018-12-31 22:11:36 +0000
commit440eb8a24af18f4a49dbf2ed73a84c5bf68484a4 (patch)
tree632aaec912e5ce3f0fa81c158cec3900494c88f5 /Master
parent9eae0ca750e90444fd2bd73f570a005120851d46 (diff)
witharrows (31dec18)
git-svn-id: svn://tug.org/texlive/trunk@49561 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/witharrows/README.md8
-rw-r--r--Master/texmf-dist/doc/latex/witharrows/witharrows.pdfbin346302 -> 353107 bytes
-rw-r--r--Master/texmf-dist/source/latex/witharrows/witharrows.dtx562
-rw-r--r--Master/texmf-dist/tex/latex/witharrows/witharrows.sty200
4 files changed, 486 insertions, 284 deletions
diff --git a/Master/texmf-dist/doc/latex/witharrows/README.md b/Master/texmf-dist/doc/latex/witharrows/README.md
index 1c2534bc9c2..fdaf611cbf9 100644
--- a/Master/texmf-dist/doc/latex/witharrows/README.md
+++ b/Master/texmf-dist/doc/latex/witharrows/README.md
@@ -6,9 +6,11 @@ The LaTeX extension `witharrows` is distributed under the LPPL 1.3 license.
## Presentation
This extension has been written by F. Pantigny (`fpantigny@wanadoo.fr`).
-The extension `witharrows` gives a LaTeX environment `{WithArrows}` which is similar
-to the environment `{aligned}` of `amsmath` but which gives the possibility to draw arrows
-on the right side of the equations for explanations.
+
+The LaTeX package `witharrows` provides environments `{WithArrows}` and `{DispWithArrows}`
+similar to the environments `{aligned}` and `{align}` of `amsmath` but with the possibility to draw arrows on the right side of the alignment. These arrows are usually used to give explanations concerning the mathematical calculus presented.
+
+
## Installation
diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf
index b3857d4f69a..d4892e3ee01 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 9a3bdbdb2ec..0dace1ef4da 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.12}
-\def\myfiledate{2018/11/26}
+\def\myfileversion{1.13}
+\def\myfiledate{2018/12/31}
%
%
%<*batchfile>
@@ -246,7 +246,8 @@ version 2005/12/01 or later.
% p.~\pageref{TikzCode}.
%
% \interitem
-% One of the most useful options is ``|text width|'' to control the width of the text associated to the arrow.
+% It's possible to use the Tikz option ``|text width|'' to control the width of the text associated to the
+% arrow.\footnote{It's possible to avoid the hyphenations of the words with the option ``|align = flush left|'' of Tikz.}
% %
% \begin{Verbatim}
% $\begin{WithArrows}
@@ -265,6 +266,7 @@ version 2005/12/01 or later.
% & = a^2 + 2ab + b^2 + 2a + 2b +1
% \end{WithArrows}$
%
+%
% \bigskip
% In the environments |{DispWithArrows}| and |{DispWithArrows*}|, there is an option |wrap-lines|. With this option,
% the lines of the labels are automatically wrapped on the right: see p.~\pageref{wrap-lines}.
@@ -372,42 +374,6 @@ version 2005/12/01 or later.
% & = \frac73
% \end{WithArrows}$
%
-% \interitem
-% There are also two options for a fine tuning of the arrows:
-%
-% \begin{itemize}
-% \item the option |ystart| sets the vertical distance between the base line of the text and the start of the arrow
-% (default value: 0.4 ex);
-% \item the option |ygap| sets the vertical distance between two consecutive arrows (default value: 0.4~ex).
-% \end{itemize}
-%
-%
-% \bigskip
-% $\begin{WithArrows}[interline=1mm]
-% (\cos x + \sin x)^2 & = \cos^2 x +2 \cos x \sin x + \sin^2 x\Arrow{}\tikz[remember picture] \coordinate (A) ; \\
-% & = \cos^2x + \sin^2x + 2\sin x\cos x \Arrow{} \\
-% & = 1 + \sin(2x)
-% \end{WithArrows}$
-%
-% \begin{tikzpicture}[remember picture,overlay,blue]
-% \draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ;;
-% \draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ;;
-% \draw (B) -- (C) ;
-% \draw[<-] (B) to ++(0,0.2) ;
-% \draw[<-] (C) to ++(0,-0.2) ;
-% \path (C) node[right=1mm] {\texttt{ystart}} ;
-% \draw (wa-\WithArrowsLastEnv-2-r.north) to ++(3,0) coordinate (E) to ++(0.1,0);
-% \draw (wa-\WithArrowsLastEnv-2-r.south) to ++(3,0) coordinate (F) to ++(0.1,0);
-% \draw (E) -- (F) ;
-% \draw[<-] (E) to ++(0,0.2) ;
-% \draw[<-] (F) to ++(0,-0.2) ;
-% \path (F) node[right=1mm] {\texttt{ygap}} ;
-% \end{tikzpicture}
-%
-%
-% \bigskip
-% \emph{Remark}: It's also possible to use the options ``|shorten <|'' and ``|shorten >|'' of Tikz (via the option
-% |tikz| of \pkg{witharrows}).
%
%
% \interitem
@@ -468,7 +434,7 @@ version 2005/12/01 or later.
%
% \interitem
% The environment |{WithArrows}| gives also two options |CodeBefore| and |CodeAfter| for LaTeX code that will be
-% executed at the beginning and at the end of the environment. Theses options are not designed to be hooks (they
+% executed at the beginning and at the end of the environment. These options are not designed to be hooks (they
% are avalaible only at the environment level and they are not applied to the nested environments).
% %
% \begin{Verbatim}
@@ -644,6 +610,9 @@ version 2005/12/01 or later.
% & = \frac1{\cos^nx}\cdot\frac{\sin(n+1)x}{\sin x}
% \end{WithArrows}$
%
+% \interitem
+%
+%
% \section{Comparison with the environment \{aligned\}}
%
% |{WithArrows}| bears similarities with the environment |{aligned}| of the extension \pkg{amsmath}. These are only
@@ -652,8 +621,8 @@ version 2005/12/01 or later.
%
% \interitem
% As in the environments of \pkg{amsmath}, it's possible to change the spacing between two given rows with the
-% option of the command |\\| of end of line (it's also possible to use |\\*| but is has exactly the same effect as
-% |\\| since an environment |{WithArrows}| is always unbreakable).
+% option of the command |\\| of end of line (it's also possible to use |\\*| but it has exactly the same effect as
+% |\\| since an environment |{WithArrows}| is always unbreakable). This option is designed to be used with positive values.
% %
% \begin{Verbatim}
% $\begin{WithArrows}
@@ -673,7 +642,7 @@ version 2005/12/01 or later.
% In the environments of \pkg{amsmath} (or \pkg{mathtools}), the spacing between rows is fixed by a parameter
% called |\jot| (it's a dimension and not a skip). That's also the case for the environment |{WithArrows}|. An
% option |jot| has been given to the environment |{WithArrows}| in order to change the value of this parameter
-% |\jot| for an given environment.\footnote{It's also possible to change |\jot| with the environment |{spreadlines}|
+% |\jot| for a given environment.\footnote{It's also possible to change |\jot| with the environment |{spreadlines}|
% of \pkg{mathtools}.}
% %
% \begin{Verbatim}
@@ -997,7 +966,7 @@ version 2005/12/01 or later.
% The package \pkg{witharrows} gives also another command available only in |CodeAfter|: the command
% |\MultiArrow|. This command draws a ``rak''. The list of the rows of the environment concerned by this rak are
% given in the first argument of the command |\MultiArrow|. This list is given with the syntax of the list in a
-% |\foreach| command of \pkg{pgfkeys}.
+% |\foreach| command of \pkg{pgffor}.
%
%
% \begin{Verbatim}
@@ -1223,8 +1192,9 @@ version 2005/12/01 or later.
%
% \medskip
% 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. For example, it's possible to use it to put the symbol |\square| (of
-% \pkg{amssymb}). This symbol is often used to mark the end of a proof.
+% typesets the tag without the parenthesis. For example, it's possible to use it to put the symbol |\square| of
+% \pkg{amssymb}. This symbol is often used to mark the end of a proof.\footnote{Notice that the environment
+% |{DispWithArrows}| is compatible with the command |\qedhere| of \pkg{amsthm}.}
% \begin{Verbatim}
% \begin{DispWithArrows}
% A & = (a+1)^2 \Arrow{we expand} \notag \\
@@ -1352,16 +1322,17 @@ version 2005/12/01 or later.
%
% \bigskip
% Concerning the references, the package \pkg{witharrows} is compatible with the extensions \pkg{autonum},
-% \pkg{cleveref}, \pkg{fancyref}, \pkg{fncylab}, \pkg{hyperref}, \pkg{listlbls}, \pkg{prettyref}, \pkg{refstyle},
-% \pkg{refcheck}, \pkg{showlabels}, \pkg{smartref}, \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}, \pkg{fancyref}, \pkg{fncylab}, \pkg{hyperref}, \pkg{listlbls}, \pkg{prettyref},
+% \pkg{refcheck}, \pkg{refstyle}, \pkg{showlabels}, \pkg{smartref}, \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).
%
% \bigskip
% The environments |{DispWithArrows}| and |{DispWithArrows*}| provide an option |wrap-lines|. With this option,
-% the lines of the label are automatically wrapped on the right.\label{wrap-lines}
+% the lines of the label are automatically wrapped on the right.\footnote{It's possible to avoid the hyphenations
+% of the words with the option ``|align = flush left|'' of Tikz.}\label{wrap-lines}
%
% \begin{Verbatim}
% \begin{DispWithArrows*}[displaystyle,~emphase#wrap-lines@]
@@ -1402,7 +1373,7 @@ version 2005/12/01 or later.
% the arrows of this environment but only for the arrows in the nested environments |{WithArrows}|.}
%
% \smallskip
-% The value of this option must be a 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 semicolon) with three markers
% |#1|, |#2| and |#3| for the start point, the end point and the label of the arrow.
%
% \bigskip
@@ -1457,13 +1428,13 @@ version 2005/12/01 or later.
% & \Longleftrightarrow x = -1
% \end{WithArrows}\]
%
-%
% \bigskip
% The environments |{DispWithArrows}| and its starred version |{DispWithArrows*}| provide a command
% |\WithArrowsRightX| which can be used in a definition of |TikzCode|. This command gives the
% $x$-value of the right side of the composition box (taking into account the eventual tags of the equations). For
% an example of use, see p.~\pageref{example-WithArrowsRightX}.
%
+%
% \bigskip
% \subsection{The command WithArrowsNewStyle}
%
@@ -1478,6 +1449,87 @@ version 2005/12/01 or later.
% the optional arguments of |{WithArrows}| and |{DispWithArrows}|).
%
% For an example of use, see p.~\pageref{example-WithArrowsRightX}.
+%
+%
+% \bigskip
+% \subsection{Vertical positioning of the arrows}
+%
+% There are four parameters for fine tuning of the vertical positioning of the arrows : |ygap|, |ystart|,
+% |start-adjust| and |end-adjust|.
+%
+% \medskip
+% We first explain the behaviour when the parameters |start-adjust| and |end-adjust| are equal to zero:
+% \begin{itemize}
+% \item the option |ystart| sets the vertical distance between the base line of the text and the start of the arrow
+% (default value: 0.4 ex);
+% \item the option |ygap| sets the vertical distance between two consecutive arrows (default value: 0.4~ex).
+% \end{itemize}
+%
+%
+% \bigskip
+% $\begin{WithArrows}[interline=1mm, adjust = 0pt]
+% (\cos x + \sin x)^2 & = \cos^2 x +2 \cos x \sin x + \sin^2 x\Arrow{}\tikz[remember picture] \coordinate (A) ; \\
+% & = \cos^2x + \sin^2x + 2\sin x\cos x \Arrow{} \\
+% & = 1 + \sin(2x)
+% \end{WithArrows}$
+%
+% \begin{tikzpicture}[remember picture,overlay,blue]
+% \draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ;;
+% \draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ;;
+% \draw (B) -- (C) ;
+% \draw[<-] (B) to ++(0,0.2) ;
+% \draw[<-] (C) to ++(0,-0.2) ;
+% \path (C) node[right=1mm] {\texttt{ystart}} ;
+% \draw (wa-\WithArrowsLastEnv-2-r.north) to ++(3,0) coordinate (E) to ++(0.1,0);
+% \draw (wa-\WithArrowsLastEnv-2-r.south) to ++(3,0) coordinate (F) to ++(0.1,0);
+% \draw (E) -- (F) ;
+% \draw[<-] (E) to ++(0,0.2) ;
+% \draw[<-] (F) to ++(0,-0.2) ;
+% \path (F) node[right=1mm] {\texttt{ygap}} ;
+% \end{tikzpicture}
+%
+% \interitem
+% However, for aesthetic reasons, when it's possible, \pkg{witharrows} starts the arrow a bit higher (by an amount
+% |start-adjust|) and ends the arrow a bit lower (by an amount |end-adjust|). By default, both parameters
+% |start-adjust| and |end-adjust| are equal to $0.4$~ex.
+%
+% \bigskip
+% Here is for example the behaviour without the mechanism of |start-adjust| and |end-adjust| (this was the standard
+% behaviour for versions prior to 1.13).
+% % \begin{Verbatim}
+% $\begin{WithArrows}~emphase#[start-adjust=0pt, end-adjust=0pt]@
+% A & = (a+1)^2 \Arrow{we expand} \\
+% & = a^2 + 2a + 1
+% \end{WithArrows}$
+% \end{Verbatim}
+%
+% $\begin{WithArrows}[start-adjust=0pt, end-adjust=0pt]
+% A & = (a+1)^2 \Arrow{we expand} \\
+% & = a^2 + 2a + 1
+% \end{WithArrows}$
+%
+%
+% \bigskip
+% Here is the standard behaviour since version 1.13 (the parameters |start-adjust| and |end-ajust| are used with
+% the default value $0.4$~ex). The arrow is longer and the result is more aesthetic.
+%
+% \medskip
+% $\begin{WithArrows}
+% A & = (a+1)^2 \Arrow{we expand} \\
+% & = a^2 + 2a + 1
+% \end{WithArrows}$
+%
+%
+% \bigskip
+% It's also possible to use the option |adjust| which sets both |start-adjust| and |end-ajust|.
+%
+% \bigskip
+% Since the mechanism of |start-adjust| and |end-ajust| has been added in version 1.13 of \pkg{witharrows}, that
+% version is not stricty compatible with older versions. However, it's possible to restore the previous behaviour
+% simply by setting |start-adjust| and |end-adjust| to $0$~pt :
+% \begin{Verbatim}
+% \WithArrowsOptions{adjust = 0pt}
+% \end{Verbatim}
%
% \bigskip
% \subsection{Footnotes in the environments of witharrows}
@@ -1524,14 +1576,14 @@ version 2005/12/01 or later.
% %
% \begin{Verbatim}
% $\begin{WithArrows}
-% &f(x) \ge g(x) \Arrow{by squaring both sides} \\
+% & f(x) \ge g(x) \Arrow{by squaring both sides} \\
% & f(x)^2 \ge g(x)^2 \Arrow{by moving to left side} \\
% & f(x)^2 - g(x)^2 \ge 0
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
-% &f(x) \ge g(x) \Arrow{by squaring both sides} \\
+% & f(x) \ge g(x) \Arrow{by squaring both sides} \\
% & f(x)^2 \ge g(x)^2 \Arrow{by moving to left side} \\
% & f(x)^2 - g(x)^2 \ge 0
% \end{WithArrows}$
@@ -1851,11 +1903,12 @@ version 2005/12/01 or later.
% b.\;& f \text{ est continuous in } 0 \\
% c.\;& f \text{ is bounded on the unit sphere} \\
% d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\
-% e.\;& f \text{ is lipschitzian} \\
+% e.\;& f \text{ is lipschitzian}
% \end{WithArrows}$
%
% \end{scope}
%
+%
% \section{Implementation}
%
% \subsection{Declaration of the package and extensions loaded}
@@ -1868,6 +1921,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\RequirePackage{tikz}
\usetikzlibrary{arrows.meta,bending}
+\RequirePackage{expl3}[2018-01-01]
% \end{macrocode}
%
% \bigskip
@@ -1883,7 +1937,7 @@ version 2005/12/01 or later.
%
% \bigskip
% The package \pkg{xparse} will be used to define the environments |{WithArrows}|, |{DispWithArrows}|,
-% |{DispWithArrows*}| and the document-level commands |\Arrow| and |\WithArrowsOptions|.
+% |{DispWithArrows*}| and the commands |\Arrow|, |\WithArrowsOptions| and |\WithArrowsNewStyle|.
% \begin{macrocode}
\RequirePackage{xparse}
% \end{macrocode}
@@ -1998,9 +2052,8 @@ version 2005/12/01 or later.
\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}| (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}|).
+% known if we have to insert an environnement |{savenotes}| (the |\savenotes| is in |\@@_pre_environment:n|
+% and |\endsavenotes| at the end of the environments |{WithArrows}| and |{DispWithArrows}|).
%
% \bigskip
% \subsection{The class option leqno}
@@ -2027,6 +2080,7 @@ version 2005/12/01 or later.
{\msg_error:nn {witharrows} {#1}}
\cs_new_protected:Nn \@@_error:nn
{\msg_error:nnn {witharrows} {#1} {#2}}
+\cs_generate_variant:Nn \@@_error:nn {nx}
% \end{macrocode}
%
% \begin{macrocode}
@@ -2154,10 +2208,10 @@ version 2005/12/01 or later.
{\bool_if:NF \c_@@_amsmath_loaded_bool
{\cs_set_protected:Npn \spread@equation
{\openup\jot
- \cs_set_protected:Npn \spread@equation {}}}}
+ \cs_set_eq:NN \spread@equation \prg_do_nothing:}}}
% \end{macrocode}
% Don't put |\cs_set_eq:NN \spread@equation \prog_do_nothing:| in the last line because this would raise errors
-% with nested environments.
+% with nested environments. |\cs_set_protected:Npn \spread@equation {}|
%
%
% \bigskip
@@ -2165,7 +2219,7 @@ version 2005/12/01 or later.
%
%
% The boolean |\l_@@_in_WithArrows_bool| will be raised in an environment |{WithArrows}| and the
-% boolean |\l_@@_in_dispwitharrows_bool| in a an environment |{DispWithArrows}| or |{DispWithArrows*}|.
+% boolean |\l_@@_in_dispwitharrows_bool| in an environment |{DispWithArrows}| or |{DispWithArrows*}|.
% \begin{macrocode}
\bool_new:N \l_@@_in_WithArrows_bool
\bool_new:N \l_@@_in_DispWithArrows_bool
@@ -2203,6 +2257,7 @@ version 2005/12/01 or later.
\dim_set:Nn \l_@@_xoffset_dim {3mm}
% \end{macrocode}
%
+%
% \bigskip
% The integer |\l_@@_pos_arrows_int| indicates the position of the arrows with the following code (the option |v|
% is accessible only for the arrows in |CodeAfter| where the options |i|, |group| et |groups| are not available).
@@ -2211,7 +2266,7 @@ version 2005/12/01 or later.
% \begin{tabular}{l}
% \begin{tabular}{@{}l*8c@{}}
% \toprule
-% option & |rr| & |ll| & |rl| & |lr| & |v| & |i| & |group| & |groups| \\
+% option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\
% \midrule
% |\l_@@_pos_arrows_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\
% \bottomrule
@@ -2219,9 +2274,11 @@ version 2005/12/01 or later.
% \footnotesize The option |v| can be used only in |\Arrow| in |CodeAfter| (see below).
% \end{tabular}
% \end{center}
+%
%
% \begin{macrocode}
\int_new:N \l_@@_pos_arrows_int
+\int_set:Nn \l_@@_pos_arrows_int 3
% \end{macrocode}
%
% \medskip
@@ -2315,7 +2372,7 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% The boolean |\l_@@_in_first_column_bool| will be used to known wether we are in the first column of the
+% The boolean |\l_@@_in_first_column_bool| will be used to know wether we are in the first column of the
% environment |{WithArrows}| or |{DispWithArrows}|.
% \begin{macrocode}
\bool_new:N \l_@@_in_first_column_bool
@@ -2327,6 +2384,16 @@ version 2005/12/01 or later.
\bool_new:N \l_@@_initial_l_bool
% \end{macrocode}
%
+% \bigskip
+% The dimension |\l_@@_start_adjust_dim| and |\l_@@_end_adjust_dim| correspond to the options
+% |start-adjust| and |end-adjust|.
+% \begin{macrocode}
+\dim_new:N \l_@@_start_adjust_dim
+\dim_set:Nn \l_@@_start_adjust_dim {0.4ex}
+\dim_new:N \l_@@_end_adjust_dim
+\dim_set:Nn \l_@@_end_adjust_dim {0.4ex}
+% \end{macrocode}
+%
%
% \bigskip
% \subsection{The definition of the options}
@@ -2389,6 +2456,7 @@ version 2005/12/01 or later.
ystart .initial:n = 0.4 ex,
% \end{macrocode}
%
+%
% \bigskip
% Usually, the number of columns in a |{WithArrows}| environment is limited to 2. Nevertheless, it's possible to
% have more columns with the option |MoreColumns|.
@@ -2404,8 +2472,7 @@ version 2005/12/01 or later.
% \bigskip
% The option |AllowLineWithoutAmpersand| is obsolete and will be deleted in a future version.
% \begin{macrocode}
- AllowLineWithoutAmpersand .code:n = { \msg_error:nn
- {witharrows}
+ AllowLineWithoutAmpersand .code:n = { \@@_error:n
{AllowLineWithoutAmpersand}},
AllowLineWithoutAmpersand .value_forbidden:n = true,
% \end{macrocode}
@@ -2453,27 +2520,25 @@ version 2005/12/01 or later.
% \begin{macrocode}
group .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1}
{\@@_error:n {Two~options~are~incompatible}}
- \int_set:Nn \l_@@_previous_pos_arrows_int 6
- \int_set:Nn \l_@@_pos_arrows_int 6} ,
+ \int_set:Nn \l_@@_previous_pos_arrows_int 7
+ \int_set:Nn \l_@@_pos_arrows_int 7} ,
group .value_forbidden:n = true,
% \end{macrocode}
%
% \bigskip
% With the option |groups| (with a \emph{s}), the arrows of the environment are divided in groups by an argument of
-% connexity, and, in each group, the arrows are vertical with the same abscissa and at a leftmost position. When
-% the option |group| or |groups| is used, it's not possible to specify another option of position like |ll|, |lr|, etc.
-% for a individual key.
+% connexity, and, in each group, the arrows are vertical with the same abscissa and at a leftmost position.
% \begin{macrocode}
groups .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1}
{\@@_error:n {Two~options~are~incompatible}}
- \int_set:Nn \l_@@_previous_pos_arrows_int 7
- \int_set:Nn \l_@@_pos_arrows_int 7} ,
+ \int_set:Nn \l_@@_previous_pos_arrows_int 6
+ \int_set:Nn \l_@@_pos_arrows_int 6} ,
groups .value_forbidden:n = true,
% \end{macrocode}
%
% \bigskip
% The option |CodeBefore| gives a code that is executed at the beginning of the environment |{WithArrows}| (after
-% the eventual |\begin{savenotes}|).
+% the eventual |\savenotes|).
% \begin{macrocode}
CodeBefore .code:n = {\int_compare:nNnTF \l_@@_level_int = 1
{\@@_error:n {Option~will~be~ignored}}
@@ -2482,8 +2547,8 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The option |CodeAfter| gives a code that is executed at the end of the environment |{WithArrows}| (after the
-% eventual |\end{savenotes}|).
+% The option |CodeAfter| gives a code that is executed at the end of the environment |{WithArrows}| (before the
+% eventual |\endsavenotes|).
% \begin{macrocode}
CodeAfter .code:n = {\int_compare:nNnTF \l_@@_level_int = 1
{\@@_error:n {Option~will~be~ignored}}
@@ -2507,7 +2572,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
fleqn .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool
{\@@_error:n {Option~will~be~ignored}}
- {\tl_if_eq:nnTF {#1} {true}
+ {\str_if_eq:nnTF {#1} {true}
{\bool_set_true:N \l_@@_fleqn_bool}
{\bool_set_false:N \l_@@_fleqn_bool}}},
fleqn .default:n = true,
@@ -2527,7 +2592,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
notag .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool
{\@@_error:n {Option~will~be~ignored}}
- {\tl_if_eq:nnTF {#1} {true}
+ {\str_if_eq:nnTF {#1} {true}
{\clist_clear:N \l_@@_tags_clist}
{\clist_set:Nn \l_@@_tags_clist {all}}}},
notag .default:n = true,
@@ -2552,7 +2617,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
wrap-lines .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool
{\@@_error:n {Option~will~be~ignored}}
- {\tl_if_eq:nnTF {#1} {true}
+ {\str_if_eq:nnTF {#1} {true}
{\bool_set_true:N \l_@@_wrap_lines_bool}
{\bool_set_false:N \l_@@_wrap_lines_bool}}},
wrap-lines .default:n = true,
@@ -2596,13 +2661,13 @@ version 2005/12/01 or later.
% |lr| and |i| and that's why a dedicated fonction |\@@_analyze_option_position:n| has been written (see below).
% \begin{macrocode}
rr .value_forbidden:n = true,
- rr .code:n = \@@_analyze_option_position:n 0 ,
+ rr .code:n = \@@_analyze_option_position:n 3 ,
ll .value_forbidden:n = true,
ll .code:n = \@@_analyze_option_position:n 1 ,
rl .value_forbidden:n = true,
rl .code:n = \@@_analyze_option_position:n 2 ,
lr .value_forbidden:n = true,
- lr .code:n = \@@_analyze_option_position:n 3 ,
+ lr .code:n = \@@_analyze_option_position:n 0 ,
i .value_forbidden:n = true,
i .code:n = \@@_analyze_option_position:n 5 ,
% \end{macrocode}
@@ -2644,6 +2709,18 @@ version 2005/12/01 or later.
interline .value_required:n = true,
% \end{macrocode}
%
+% The dimensions |\l_@@_start_adjust_dim| and |\l_@@_end_adjust_dim| are the vertical shift added to some arrows.
+% \begin{macrocode}
+ start-adjust .dim_set:N = \l_@@_start_adjust_dim,
+ start-adjust .value_required:n = true,
+ end-adjust .dim_set:N = \l_@@_end_adjust_dim,
+ end-adjust .value_required:n = true,
+ adjust .code:n = {\dim_set:Nn \l_@@_start_adjust_dim {#1}
+ \dim_set:Nn \l_@@_end_adjust_dim {#1} },
+ adjust .value_required:n = true,
+% \end{macrocode}
+%
+%
% \bigskip
% Eventually, a key |jump| (see below) and a key for unknown keys.
% \begin{macrocode}
@@ -2655,9 +2732,8 @@ version 2005/12/01 or later.
%
% \bigskip
% The key |jump| indicates the number of lines jumped by the arrow (1 by default). This key will be extracted when
-% the command |\Arrow| will be executed. That's why there is a special module for this key. The key |jump| is
-% extracted in the command |\Arrow| because we want to compute right away the final line of the arrow (this will be
-% useful for the options |group| and |groups|).
+% the command |\Arrow| will be executed because we want to compute right away the final line of the arrow (this
+% will be useful for the options |group| and |groups|).
% \begin{macrocode}
\keys_define:nn {WithArrows/Arrow}
{jump .code:n = {\int_set:Nn \l_@@_jump_int {#1}
@@ -2665,13 +2741,13 @@ version 2005/12/01 or later.
{\@@_error:n {The~option~"jump"~must~be~non~negative}}} ,
jump .value_required:n = true,
rr .value_forbidden:n = true,
- rr .code:n = \@@_analyze_option_position:n 0 ,
+ rr .code:n = \@@_analyze_option_position:n 3 ,
ll .value_forbidden:n = true,
ll .code:n = \@@_analyze_option_position:n 1 ,
rl .value_forbidden:n = true,
rl .code:n = \@@_analyze_option_position:n 2 ,
lr .value_forbidden:n = true,
- lr .code:n = \@@_analyze_option_position:n 3 ,
+ lr .code:n = \@@_analyze_option_position:n 0 ,
i .value_forbidden:n = true,
i .code:n = \@@_analyze_option_position:n 5 }
% \end{macrocode}
@@ -2887,16 +2963,17 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment
-% |{savenotes}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}).
+% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with a pair
+% |\savenotes|-|\endsavenotes| (of the package \pkg{footnote} or the package \pkg{footnotehyper}). We don't use an
+% environment |{savenotes}| because there is a |\@currenvir| in some error messages.
% \begin{macrocode}
- \bool_if:NT \g_@@_footnote_bool {\savenotes}
+ \bool_if:NT \g_@@_footnote_bool \savenotes
% \end{macrocode}
%
% \bigskip
% We execute the code |\l_@@_code_before_tl| of the option |CodeBefore| of the environment after the eventual
-% |\begin{savenotes}| and, symetricaly, we will execute the |\l_@@_code_after_tl| before the eventual
-% |\end{savenotes}| (we have a good reason for the last point : we want to extract the footnotes of the arrows
+% |\savenotes| and, symetrically, we will execute the |\l_@@_code_after_tl| before the eventual
+% |\endsavenotes| (we have a good reason for the last point : we want to extract the footnotes of the arrows
% executed in the |CodeAfter|).
% \begin{macrocode}
\l_@@_code_before_tl
@@ -3013,7 +3090,7 @@ version 2005/12/01 or later.
% We begin the second part of the environment |{WithArrows}|. We have two |\egroup|\,: one for the
% |\halign| and one for the |\vtop| (or |\vcenter| or |\vbox|).
% \begin{macrocode}
- {\crcr
+ {\\
\egroup
\egroup
\@@_post_environment:
@@ -3021,9 +3098,10 @@ version 2005/12/01 or later.
%
% \bigskip
% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment
-% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}).
+% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}). We don't use an
+% environment |{savenotes}| because there is a |\@currenvir| in some error messages.
% \begin{macrocode}
- \bool_if:NT \g_@@_footnote_bool {\endsavenotes}
+ \bool_if:NT \g_@@_footnote_bool \endsavenotes
}
% \end{macrocode}
% This is the end of the environment |{WithArrows}|.
@@ -3043,18 +3121,9 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% It there is really arrows in the environment, we draw the arrows:
-% \begin{itemize}
-% \item if neither option |group| or |groups| is used, we can draw directly ;
-% \item if option |group| or option |groups| is used (|\l_@@_pos_arrows_int| > 5), we have to draw the
-% arrows group by group ; the macro |\@@_draw_arrows:| does the work.
-% \end{itemize}
-%
+% It there is really arrows in the environment, we draw the arrows.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_arrow_int > 0
- {\int_compare:nNnTF \l_@@_pos_arrows_int > 5
- \@@_draw_arrows:
- {\@@_draw_arrows:nn 1 \g_@@_arrow_int}}
+ \int_compare:nNnT \g_@@_arrow_int > 0 \@@_scan_arrows:
% \end{macrocode}
%
% \bigskip
@@ -3117,9 +3186,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Nn \@@_cr:
{\scan_stop:
+% \end{macrocode}
% \bigskip
% \begin{macrocode}
- \bool_if:NT \l_@@_in_first_column_bool {& {} }
+ \bool_if:NT \l_@@_in_first_column_bool { & {} }
\group_align_safe_begin:
\peek_meaning_remove:NTF * \@@_cr_i: \@@_cr_i:}
% \end{macrocode}
@@ -3221,7 +3291,7 @@ version 2005/12/01 or later.
& \@@_restore:N \l_@@_tag_star_bool
\@@_restore:N \l_@@_qedhere_bool
\bool_if:NT \l_@@_qedhere_bool
- {\hbox_overlap_left:n {\@@_qedhere_i:}}
+ {\hbox_overlap_left:n \@@_qedhere_i:}
\cs_set_eq:NN \theequation \g_tmpa_tl
\bool_if:NT \l_@@_tag_star_bool {\cs_set:Npn \tagform@ {}}
% \end{macrocode}
@@ -3239,7 +3309,7 @@ version 2005/12/01 or later.
{\@@_save:N \l_@@_qedhere_bool
& \@@_restore:N \l_@@_qedhere_bool
\bool_if:NT \l_@@_qedhere_bool
- {\hbox_overlap_left:n {\@@_qedhere_i:}}
+ {\hbox_overlap_left:n \@@_qedhere_i:}
\tikz [@@_standard] \coordinate (\int_use:N\g_@@_line_int-v) ; }
}
\cr\noalign{\skip_vertical:n {#1 + \l_@@_interline_skip}
@@ -3256,12 +3326,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Nn \@@_if_in_second_col_of_disp:nn
{\bool_if:NTF \l_@@_in_WithArrows_bool
- {\msg_error:nnn {witharrows}
- {Command~not~allowed~in~{WithArrows}}
+ {\@@_error:nn {Command~not~allowed~in~{WithArrows}}
{#1}}
{\bool_if:NTF \l_@@_in_first_column_bool
- {\msg_error:nnn {witharrows}
- {Command~not~allowed~in~{DispWithArrows}}
+ {\@@_error:nn {Command~not~allowed~in~{DispWithArrows}}
{#1}}
{#2}}}
% \end{macrocode}
@@ -3281,7 +3349,7 @@ version 2005/12/01 or later.
\NewDocumentCommand \@@_tag {sm}
{\@@_if_in_second_col_of_disp:nn {\tag}
{\tl_if_empty:NF \l_@@_tag_tl
- {\msg_error:nnn {witharrows} {Multiple~tags} {#2}}
+ {\@@_error:nn {Multiple~tags} {#2}}
\clist_set:Nn \l_@@_tags_clist {all}
\bool_if:nT \c_@@_mathtools_loaded_bool
{\MH_if_boolean:nT {show_only_refs}
@@ -3345,7 +3413,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% In the third column of the |\halign| of |{DispWithArrows}|, a command |\@@_qedhere_i:| will be
-% issued if the flag |\l_@@_qedhere_bool| has been raised. The code of this command is a adaptation of the code of
+% issued if the flag |\l_@@_qedhere_bool| has been raised. The code of this command is an adaptation of the code of
% |\qedhere| in \pkg{amsthm}.
% \begin{macrocode}
\cs_new_protected:Nn \@@_qedhere_i: {\group_begin:
@@ -3482,7 +3550,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\bool_if:NT \l_@@_in_DispWithArrows_bool
{\dim_gzero_new:N \g_@@_right_x_dim
- \dim_gset:Nn \g_@@_right_x_dim \c_max_dim
+ \dim_gset_eq:NN \g_@@_right_x_dim \c_max_dim
\begin{tikzpicture} [@@_standard]
\int_step_variable:nnnNn 1 1 \g_@@_line_int \l_tmpa_int
{\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v)
@@ -3510,17 +3578,14 @@ version 2005/12/01 or later.
% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment
% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}).
% \begin{macrocode}
- \bool_if:NT \g_@@_footnote_bool {\endsavenotes}
+ \bool_if:NT \g_@@_footnote_bool \endsavenotes
\ignorespacesafterend
}
% \end{macrocode}
%
-%
-%
-%
% \bigskip
% 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.
+% and |\end{DispWithArrows}| because there is a |\@currenvir| in some error messages.
% \begin{macrocode}
\NewDocumentEnvironment {DispWithArrows*} {}
{\WithArrowsOptions{notag}
@@ -3532,16 +3597,35 @@ version 2005/12/01 or later.
% \subsection{We draw the arrows}
%
% \bigskip
-% |\@@_draw_arrows:| draws the arrows when the option |group| or the option |groups| is used. In both cases, we have
-% to compute the $x$-value of a group of arrows before actually drawing the arrows of that group. The arrows will
-% actually be drawn by the macro |\@@_draw_arrows:nn|.
+% The arrows are divided in groups. There is two reasons for this division.
+% \begin{itemize}
+% \item If the option |group| or the option |groups| is used, all the arrows are drawn on a same vertical at an
+% abscissa of |\l_@@_x_dim|.
+% \item For aesthetic reasons, the starting point of all the starting arrows of a group is raised upwards by the
+% value |\l_@@_start_adjust_dim|. Idem for the ending arrows.
+% \end{itemize}
%
+% \medskip
+% If the option |group| is used (|\l_@@_pos_arrows_int| = 7), we scan the arrows twice: in the first step we only
+% compute the value of |\l_@@_x_dim| for the whole group, and, in the second step (|\l_@@_pos_arrows_int| is set to
+% 8), we divide the arrows in groups (for the vertical adjustement) and we actually draw the arrows.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_scan_arrows:
+ { \group_begin:
+ \int_compare:nNnT \l_@@_pos_arrows_int = 7
+ { \@@_scan_arrows_i:
+ \int_set:Nn \l_@@_pos_arrows_int 8 }
+ \@@_scan_arrows_i:
+ \group_end:}
+% \end{macrocode}
+%
+% \bigskip
% If an environment |{WithArrows}| is composed with the option |group| or the option |groups|, it's still possible
% to put arrows with their option of position (|ll|, |rr|, |rl|, |lr| or |i|). Such arrows will be said to be
% ``independant''.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_draw_arrows:
- { \group_begin:
+\cs_new_protected:Nn \@@_scan_arrows_i:
+ {
% \end{macrocode}
%
% \bigskip
@@ -3550,17 +3634,26 @@ version 2005/12/01 or later.
% |\l_@@_first_line_of_group_int| will be the first line involved in the group of arrows (equal to the initial line
% of the first arrow of the group because the option |jump| is always positive).
%
+% |\l_@@_first_arrows_of_group_seq| will the list the arrows of the group starting at the first line of the group
+% (we may have several arrows starting from the same line). We have to known all these arrows because of the
+% adjustement by |\l_@@_start_adjust_dim|.
+%
% |\l_@@_last_line_of_group_int| will be the last line involved in the group (impossible to guess in advance).
+%
+% |\l_@@_last_arrows_of_group_seq| will the list of all the arrows of the group ending at the last line of the
+% group (impossible to guess in advance).
% \begin{macrocode}
\int_zero_new:N \l_@@_first_arrow_of_group_int
\int_zero_new:N \l_@@_first_line_of_group_int
\int_zero_new:N \l_@@_last_line_of_group_int
+ \seq_clear_new:N \l_@@_first_arrows_of_group_seq
+ \seq_clear_new:N \l_@@_last_arrows_of_group_seq
\bool_set_true:N \l_@@_new_group_bool
% \end{macrocode}
%
% \bigskip
% We begin a loop over all the arrows of the environment. Inside this loop, if a group is finished, we will draw
-% the lines of that group.
+% the arrows of that group.
% \begin{macrocode}
\int_set:Nn \l_@@_arrow_int 1
\int_until_do:nNnn \l_@@_arrow_int > \g_@@_arrow_int
@@ -3591,14 +3684,17 @@ version 2005/12/01 or later.
\int_compare:nNnTF \l_@@_final_int > \g_@@_line_int
{\@@_error:n {Too~few~lines~for~an~arrow}}
% \end{macrocode}
+%
% \bigskip
% We test if the previous arrow was in fact the last arrow of a group. In this case, we have to draw all the arrows
-% of that group (with the $x$-value computed in |\l_@@_x_dim|).
-% \begin{macrocode}
- {\bool_if:nT { \int_compare_p:nNn \l_@@_pos_arrows_int = 7
- && \int_compare_p:nNn \l_@@_arrow_int > 1
- && \int_compare_p:nNn
- \l_@@_initial_int > \l_@@_last_line_of_group_int}
+% of that group, except if you are with the option |group| and in the first step of treatment (|\l_@@_pos_arrows_int| = 7).
+% \begin{macrocode}
+ {\bool_if:nT {\int_compare_p:nNn \l_@@_arrow_int > 1
+ &&
+ \int_compare_p:nNn
+ \l_@@_initial_int > \l_@@_last_line_of_group_int
+ &&
+ \int_compare_p:n {\l_@@_pos_arrows_int != 7}}
{\@@_draw_arrows:nn \l_@@_first_arrow_of_group_int {\l_@@_arrow_int - 1}
\bool_set_true:N \l_@@_new_group_bool}
% \end{macrocode}
@@ -3607,16 +3703,30 @@ version 2005/12/01 or later.
% The flag |\l_@@_new_group_bool| indicates if we have to begin a new group of arrows. In fact, we have to begin a
% new group in two circonstancies: if we are at the first arrow of the environment (that's why the flag is raised
% before the beginning of the loop) and if we have just finished a group (that's why the flag is raised in the
-% previous conditionnal). At the beginning of a group, we have to initialize four variables:
-% |\l_@@_first_arrow_int|, |\l_@@_first_line_of_group_int|, |\l_@@_last_line_of_group| and |\l_@@_x_dim|.
-% The last two will evolve during the construction of the group.
+% previous conditionnal). At the beginning of a group, we have to initialize the following variables:
+% |\l_@@_first_arrow_int|, |\l_@@_first_line_of_group_int|, |\l_@@_last_line_of_group|,
+% |\l_@@_first_arrows_of_group_seq|, |\l_@@_last_arrows_of_group_seq|.
+%
% \begin{macrocode}
\bool_if:nTF \l_@@_new_group_bool
{\bool_set_false:N \l_@@_new_group_bool
\int_set:Nn \l_@@_first_arrow_of_group_int \l_@@_arrow_int
\int_set:Nn \l_@@_first_line_of_group_int \l_@@_initial_int
\int_set:Nn \l_@@_last_line_of_group_int \l_@@_final_int
- \dim_set:Nn \l_@@_x_dim {-\c_max_dim}
+ \seq_clear:N \l_@@_first_arrows_of_group_seq
+ \seq_put_left:Nx \l_@@_first_arrows_of_group_seq
+ {\int_use:N \l_@@_arrow_int}
+ \seq_clear:N \l_@@_last_arrows_of_group_seq
+ \seq_put_left:Nx \l_@@_last_arrows_of_group_seq
+ {\int_use:N \l_@@_arrow_int}
+% \end{macrocode}
+%
+% If we are in option |group| and in the second step of treatment (|\l_@@_pos_arrows_int| = 8), we don't initialize
+% |\l_@@_x_dim| because we want to use the same value of |\l_@@_x_dim| (computed during the first step) for all the
+% groups.
+% \begin{macrocode}
+ \int_compare:nT {\l_@@_pos_arrows_int != 8}
+ {\dim_set:Nn \l_@@_x_dim {-\c_max_dim}}
}
% \end{macrocode}
%
@@ -3626,16 +3736,28 @@ version 2005/12/01 or later.
% the end of the group.
% \begin{macrocode}
{\int_compare:nNnT \l_@@_pos_of_arrow_int = {-1}
- {\int_set:Nn \l_@@_last_line_of_group_int
- {\int_max:nn \l_@@_last_line_of_group_int \l_@@_final_int}}}
+ {\int_compare:nNnT \l_@@_initial_int = \l_@@_first_line_of_group_int
+ {\seq_put_left:Nx \l_@@_first_arrows_of_group_seq
+ {\int_use:N \l_@@_arrow_int}}
+ \int_compare:nNnTF \l_@@_final_int > \l_@@_last_line_of_group_int
+ {\int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int
+ \seq_clear:N \l_@@_last_arrows_of_group_seq
+ \seq_put_left:Nx \l_@@_last_arrows_of_group_seq
+ {\int_use:N \l_@@_arrow_int}}
+ {\int_compare:nNnT \l_@@_final_int = \l_@@_last_line_of_group_int
+ {\seq_put_left:Nx \l_@@_last_arrows_of_group_seq
+ {\int_use:N \l_@@_arrow_int}}}}}
% \end{macrocode}
%
% \bigskip
-% If the arrow is independant (|\l_@@_pos_of_arrow_int| non negative), you update the current $x$-value (in
-% |\l_@@_x_dim|) with the dedicated command |\@@_update_x_value:nn|.
+% If the arrow is not independant, we update the current $x$-value (in |\l_@@_x_dim|) with the dedicated command
+% |\@@_update_x_value:nn|. If we are in option |group| and in the second step of treatment (|\l_@@_pos_arrows_int|
+% = 8), we don't initialize |\l_@@_x_dim| because we want to use the same value of |\l_@@_x_dim| (computed during
+% the first step) for all the groups.
% \begin{macrocode}
\int_compare:nNnT \l_@@_pos_of_arrow_int = {-1}
- {\@@_update_x_value:nn \l_@@_initial_int \l_@@_final_int} }
+ { \int_compare:nT {\l_@@_pos_arrows_int != 8}
+ {\@@_update_x_value:nn \l_@@_initial_int \l_@@_final_int}} }
% \end{macrocode}
%
% \bigskip
@@ -3646,10 +3768,12 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% After the last arrow of the environment, we have to draw the last group of arrows.
+% After the last arrow of the environment, we have to draw the last group of arrows. If we are in option |group|
+% and in the first step of treatment (|\l_@@_pos_arrows_int| = 7), we don't draw because, in the first step, we don't
+% draw anything.
% \begin{macrocode}
- \@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int
- \group_end:
+ \int_compare:nT {\l_@@_pos_arrows_int != 7}
+ {\@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int}
}
% \end{macrocode}
%
@@ -3698,14 +3822,11 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% If the arrow ends after the last line of the environment, we raise an error (we recall that, after the
-% construction of the |\halign|, |\g_@@_line_int| is the total number of lines of the environment). However, if the
-% option |group| or the option |groups| is in force, we don't raise an error because the error has already been
-% raised in |\@@_draw_arrows:|.
+% If the arrow ends after the last line of the environment, we don't draw the arrow (an error has already been
+% raised in |\@@_scan_arrows:|). We recall that, after the construction of the |\halign|, |\g_@@_line_int| is the
+% total number of lines of the environment).
% \begin{macrocode}
- \int_compare:nNnTF \l_@@_final_int > \g_@@_line_int
- {\int_compare:nNnT \l_@@_pos_arrows_int < 6
- {\@@_error:n {Too~few~lines~for~an~arrow}}}
+ \int_compare:nNnT \l_@@_final_int < {\g_@@_line_int + 1}
\@@_draw_arrows_i:
\int_incr:N \l_@@_arrow_int
}
@@ -3718,7 +3839,7 @@ version 2005/12/01 or later.
% options of the arrows (but we remind that the options |ll|, |rr|, |rl|, |lr|, |i| and |jump| have already been
% extracted and are not present in the field |options| of the property list of the arrow).
% \begin{macrocode}
-\cs_new:Nn \@@_draw_arrows_i:
+\cs_new_protected:Nn \@@_draw_arrows_i:
{\group_begin:
\int_set:Nn \l_@@_level_int 3
% \end{macrocode}
@@ -3751,10 +3872,10 @@ version 2005/12/01 or later.
\bool_set_false:N \l_@@_initial_r_bool
\bool_set_false:N \l_@@_final_r_bool
\int_case:nn \l_@@_pos_arrows_int
- {0 {\bool_set_true:N \l_@@_initial_r_bool
- \bool_set_true:N \l_@@_final_r_bool}
+ {0 {\bool_set_true:N \l_@@_final_r_bool}
2 {\bool_set_true:N \l_@@_initial_r_bool}
- 3 {\bool_set_true:N \l_@@_final_r_bool}}
+ 3 {\bool_set_true:N \l_@@_initial_r_bool
+ \bool_set_true:N \l_@@_final_r_bool}}
% \end{macrocode}
%
% \bigskip
@@ -3762,7 +3883,7 @@ version 2005/12/01 or later.
% \begin{tabular}{l}
% \begin{tabular}{@{}l*8c@{}}
% \toprule
-% option & |rr| & |ll| & |rl| & |lr| & |v| & |i| & |group| & |groups| \\
+% option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\
% \midrule
% |\l_@@_pos_arrows_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\
% \bottomrule
@@ -3795,36 +3916,61 @@ version 2005/12/01 or later.
% nodes created have the shape of small vertical segments: use option |shownodes| to visualize the nodes).
%
% \bigskip
-% The label of the arrow will is stored in |\l_tmpa_tl|.
+% The label of the arrow will be stored in |\l_tmpa_tl|.
% \begin{macrocode}
\prop_get:cnN {g_@@_arrow_\l_@@_prefix_str _\int_use:N\l_@@_arrow_int _prop}
{label}
\l_tmpa_tl
% \end{macrocode}
%
-% \bigskip
-% We have to compute the coordinates of the extremities of the arrow. We retrieve the coordinates in |\g_tmpa_tl|
-% and |\g_tmpb_tl|. This extraction of the coordinates is necessary because we must give coordinates and not nodes
-% (even anchored) to |\@@_draw_arrow:nnn| to have the |xshift| correct.
-% \begin{macrocode}
- \int_compare:nNnTF \l_@@_pos_arrows_int < 5
- {\begin{tikzpicture} [@@_standard]
- \tikz@scan@one@point\pgfutil@firstofone(\l_@@_initial_tl)
- \tl_gset:Nx \g_tmpa_tl {\dim_use:N\pgf@x,\dim_use:N\pgf@y}
- \tikz@scan@one@point\pgfutil@firstofone(\l_@@_final_tl)
- \tl_gset:Nx \g_tmpb_tl {\dim_use:N\pgf@x,\dim_use:N\pgf@y}
- \end{tikzpicture}
-}
+% \bigskip
+% Now, we have to know if the arrow starts at the first line of the group and/or ends at the last line of the group.
+% That's the reason why we have stored in |\l_@@_first_arrows_of_group_seq| the list of all the arrows starting at
+% the first line of the group and in |\l_@@_last_arrows_of_group_seq| the list of all the arrows ending at the last
+% line of the group. We compute these values in the booleans |\l_tmpa_bool| and |\l_tmpb_bool|. These computations
+% can't be done in the following |{tikzpicture}| because the command |\seq_if_in:NTF| which is \emph{not}
+% expandable.
+% \begin{macrocode}
+ \seq_if_in:NxTF \l_@@_first_arrows_of_group_seq {\int_use:N \l_@@_arrow_int}
+ {\bool_set_true:N \l_tmpa_bool}
+ {\bool_set_false:N \l_tmpa_bool}
+ \seq_if_in:NxTF \l_@@_last_arrows_of_group_seq {\int_use:N \l_@@_arrow_int}
+ {\bool_set_true:N \l_tmpb_bool}
+ {\bool_set_false:N \l_tmpb_bool}
+ \int_compare:nNnT \l_@@_pos_arrows_int = 5
+ {\bool_set_true:N \l_tmpa_bool
+ \bool_set_true:N \l_tmpb_bool}
% \end{macrocode}
+%
+% \bigskip
+% We compute and store in |\g_tmpa_tl| and |\g_tmpb_tl| the exact coordinates of the extremities of the arrow.
+% \begin{itemize}
+% \item Concerning the $x$-values, the abscissa computed in |\l_@@_x_dim| will be used if the option of position
+% is |i|, |group| or |groups|.
+% \item Concerning the $y$-values, an adjustement is done for each arrow starting at the first line of the group
+% and each arrow ending at the last line of the group (with the values of |\l_@@_start_adjust_dim| and
+% |\l_@@_end_adjust_dim|).
+% \end{itemize}
%
-% If we use option |i| or |group| or |groups|, we use the abscissa specially computed in |\l_@@_x_dim|.
% \begin{macrocode}
- {\begin{tikzpicture} [@@_standard]
- \tikz@scan@one@point\pgfutil@firstofone (\l_@@_initial_tl)
- \tl_gset:Nx \g_tmpa_tl {\dim_use:N \l_@@_x_dim , \dim_use:N \pgf@y}
- \tikz@scan@one@point\pgfutil@firstofone (\l_@@_final_tl)
- \tl_gset:Nx \g_tmpb_tl {\dim_use:N \l_@@_x_dim , \dim_use:N \pgf@y}
- \end{tikzpicture}}
+ \begin{tikzpicture} [@@_standard]
+ \tikz@scan@one@point\pgfutil@firstofone (\l_@@_initial_tl)
+ \tl_gset:Nx \g_tmpa_tl
+ {\int_compare:nNnTF \l_@@_pos_arrows_int < 5
+ { \dim_use:N \pgf@x }
+ { \dim_use:N \l_@@_x_dim } ,
+ \bool_if:NTF \l_tmpa_bool
+ { \dim_eval:n {\pgf@y + \l_@@_start_adjust_dim }}
+ { \dim_use:N \pgf@y } }
+ \tikz@scan@one@point\pgfutil@firstofone (\l_@@_final_tl)
+ \tl_gset:Nx \g_tmpb_tl
+ {\int_compare:nNnTF \l_@@_pos_arrows_int < 5
+ { \dim_use:N \pgf@x }
+ { \dim_use:N \l_@@_x_dim } ,
+ \bool_if:NTF \l_tmpb_bool
+ { \dim_eval:n {\pgf@y - \l_@@_end_adjust_dim }}
+ { \dim_use:N \pgf@y }}
+ \end{tikzpicture}
% \end{macrocode}
%
% \bigskip
@@ -3838,7 +3984,7 @@ version 2005/12/01 or later.
% (like \Verb|\ltmpatl|) or use the package \pkg{underscore} (with this package, the characters \emph{underscore}
% will be rescanned without errors, even in text mode).}
% \begin{macrocode}
- \@@_draw_arrow:nno {\g_tmpa_tl} {\g_tmpb_tl} {\l_tmpa_tl}
+ \@@_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl
% \end{macrocode}
%
% \smallskip
@@ -3930,14 +4076,14 @@ version 2005/12/01 or later.
% \bigskip
% The command |\@@_update_x_value:nn| will analyze the lines between |#1| and |#2| in order to modify
% |\l_@@_x_dim| in consequence. More precisely, |\l_@@_x_dim| is increased if a line longer than the current value
-% of |\l_@@_x_dim| is found. |\@@_update_x_value:nn| is used in |\@@_draw_arrows:| (for options |group| and
+% of |\l_@@_x_dim| is found. |\@@_update_x_value:nn| is used in |\@@_scan_arrows:| (for options |group| and
% |groups|) and in |\@@_draw_arrows:nn| (for option |i|).
% \begin{macrocode}
\cs_new_protected:Nn \@@_update_x_value:nn
{\int_step_inline:nnnn {#1} 1 {#2}
{\begin{tikzpicture} [@@_standard]
\tikz@scan@one@point\pgfutil@firstofone (##1-l)
- \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l_@@_x_dim \pgf@x}
+ \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l_@@_x_dim \pgf@x }
\end{tikzpicture}
\dim_set_eq:NN \l_@@_x_dim \g_tmpa_dim } }
% \end{macrocode}
@@ -4004,9 +4150,9 @@ version 2005/12/01 or later.
% We test wether the two Tikz nodes |(#2-l)| and |(#3-l)| really exist. If not, the arrow won't be drawn.
% \begin{macrocode}
\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-#2-l}
- {\msg_error:nnx {witharrows} {Wrong~line~specification~in~Arrow} {#2}}
+ {\@@_error:nx {Wrong~line~specification~in~Arrow} {#2}}
{\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-#3-l}
- {\msg_error:nnx {witharrows} {Wrong~line~specification~in~Arrow} {#3}}
+ {\@@_error:nx {Wrong~line~specification~in~Arrow} {#3}}
{\int_compare:nNnTF \l_@@_pos_arrows_int = 4
{\begin{tikzpicture} [@@_standard]
\tikz@scan@one@point\pgfutil@firstofone(#2-l.south)
@@ -4047,10 +4193,8 @@ version 2005/12/01 or later.
% |\foreach| and that's why we construct the list in |\g_tmpa_clist|.
% \begin{macrocode}
\foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l_@@_prefix_str-\x-l}
- {\msg_error:nnx {witharrows}
- {Wrong~line~specification~in~MultiArrow}
- {\x}}
- {\clist_gput_right:Nx \g_tmpa_clist {\x}}}
+ {\@@_error:nx {Wrong~line~specification~in~MultiArrow} \x }
+ {\clist_gput_right:Nx \g_tmpa_clist \x}}
% \end{macrocode}
% We sort the list |\g_tmpa_clist| because we want to extract the minimum and the maximum.
% \begin{macrocode}
@@ -4189,8 +4333,8 @@ version 2005/12/01 or later.
3 {lr}
4 {v}
5 {i}
- 6 {group}
- 7 {groups}}"~
+ 6 {groups}
+ 7 {group}}"~
set~in~the~same~
\int_case:nn\l_@@_level_int
{1 {command~\token_to_str:N\WithArrowsOptions}
@@ -4214,7 +4358,7 @@ version 2005/12/01 or later.
\msg_new:nnn {witharrows}
{Arrow~in~first~column}
{You~should~not~use~the~command~\token_to_str:N\Arrow\
- \tl_if_eq:NNF \l_@@_CommandName_tl \l_tmpa_tl
+ \str_if_eq:NNF \l_@@_CommandName_tl \l_tmpa_tl
{(renamed~in~\str_use:N \c_backslash_str
\tl_use:N \l_@@_CommandName_tl)~}
~in~the~first~column~but~only~in~the~second~column.\\
@@ -4402,6 +4546,7 @@ version 2005/12/01 or later.
\bool_if:nT \c_@@_mathtools_loaded_bool
{\MH_if_boolean:nT {show_only_refs}
\MT_showonlyrefs_true:}
+ \bool_if:NT \g_@@_footnote_bool \endsavenotes
\ignorespacesafterend
}
% \end{macrocode}
@@ -4438,7 +4583,7 @@ version 2005/12/01 or later.
%
% \section{History}
%
-% \subsection{Changes between versions 1.0 and 1.1}
+% \subsection*{Changes between versions 1.0 and 1.1}
%
% Option for the command |\\| and option |interline|
%
@@ -4450,7 +4595,7 @@ version 2005/12/01 or later.
%
% Creation of a \textsc{dtx} file
%
-% \subsection{Changes between versions 1.1 and 1.2}
+% \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| (this extension and these libraries are loaded silently by \pkg{witharrows}).
@@ -4459,18 +4604,18 @@ version 2005/12/01 or later.
%
% Better error messages
%
-% \subsection{Changes between versions 1.2 and 1.3}
+% \subsection*{Changes between versions 1.2 and 1.3}
%
% New options |ygap| and |ystart| for fine tuning.
%
% Minor bugs.
%
-% \subsection{Changes between versions 1.3 and 1.4}
+% \subsection*{Changes between versions 1.3 and 1.4}
%
% The package \pkg{footnote} is no longer loaded by default. Instead, two options |footnote| and |footnotehyper| have
% been added. In particular, \pkg{witharrows} becomes compatible with \cls{beamer}.
%
-% \subsection{Changes between versions 1.4 and 1.5}
+% \subsection*{Changes between versions 1.4 and 1.5}
%
% The Tikz code used to draw the arrows can be changed with the option |TikzCode|.
%
@@ -4480,32 +4625,30 @@ version 2005/12/01 or later.
%
% A command |\MultiArrow| is available in |CodeAfter| to draw arrows of other shapes.
%
-% \subsection{Changes between versions 1.5 and 1.6}
+% \subsection*{Changes between versions 1.5 and 1.6}
%
% The code has been improved to be faster and the Tikz library |calc| is no longer required.
%
% A new option |name| is available for the environments |{WithArrows}|.
%
-% \subsubsection{Changes between 1.6 and 1.6.1}
-%
-% Correction of a bug that leads to incompatibility with |\usetikzlibrary{babel}|.
+% In the version 1.6.1, correction of a bug that leads to incompatibility with |\usetikzlibrary{babel}|.
%
-% \subsection{Changes between 1.6.1 and 1.7}
+% \subsection*{Changes between 1.6.1 and 1.7}
%
% New environments |{DispWithArrows}| and |{DispWithArrows*}|.
%
-% \subsection{Changes between 1.7 and 1.8}
+% \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}.
%
-% \subsection{Changes between 1.8 and 1.9}
+% \subsection*{Changes between 1.8 and 1.9}
%
% New option |wrap-lines| for the environments |{DispWithArrows}| and |{DispWithArrows*}|.
%
-% \subsection{Changes between 1.9 and 1.10}
+% \subsection*{Changes between 1.9 and 1.10}
%
% If the option |wrap-lines| is used, the option ``|text width|'' of Tikz is still active: if the value given to
% ``|text width|'' is lower than the width computed by |wrap-lines|, this value is used to wrap the lines.
@@ -4515,11 +4658,11 @@ version 2005/12/01 or later.
% Correction of a bug: |\nointerlineskip| and |\makebox[.6\linewidth]{}| should be inserted in |{DispWithArrows}|
% only in vertical mode.
%
-% \subsection{Changes between 1.10 and 1.11}
+% \subsection*{Changes between 1.10 and 1.11}
%
% New commands |\WithArrowsNewStyle| and |\WithArrowsRightX|.
%
-% \subsection{Changes between 1.11 and 1.12}
+% \subsection*{Changes between 1.11 and 1.12}
%
% New command |\tagnextline|.
%
@@ -4533,6 +4676,17 @@ version 2005/12/01 or later.
% Compatibility with the packages \pkg{refcheck}, \pkg{showlabels} and \pkg{listlbls}.
%
% The option |\AllowLineWithoutAmpersand| is deprecated because lines without ampersands are now always allowed.
+%
+% \subsection*{Changes between 1.12 and 1.13}
+%
+% Options |start-adjust|, |end-adjust| and |adjust|.
+%
+% This version is not stricty compatible with previous ones. To restore the behaviour of the previous versions, one
+% has to use the option |adjust| with the value $0$~pt :
+%
+% \begin{Verbatim}
+% \WithArrowsOptions{adjust = 0pt}
+% \end{Verbatim}
%
% \endinput
%
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
index d363263a6c0..e7809aa70b2 100644
--- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
+++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
@@ -18,10 +18,11 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{1.12}
-\def\myfiledate{2018/11/26}
+\def\myfileversion{1.13}
+\def\myfiledate{2018/12/31}
\RequirePackage{tikz}
\usetikzlibrary{arrows.meta,bending}
+\RequirePackage{expl3}[2018-01-01]
\RequirePackage{l3keys2e}
\ProvidesExplPackage
{witharrows}
@@ -89,6 +90,7 @@
{\msg_error:nn {witharrows} {#1}}
\cs_new_protected:Nn \__wi_error:nn
{\msg_error:nnn {witharrows} {#1} {#2}}
+\cs_generate_variant:Nn \__wi_error:nn {nx}
\cs_new_protected:Nn \__wi_bool_new:N
{\bool_if_exist:NTF #1
{\bool_set_false:N #1}
@@ -138,7 +140,7 @@
{\bool_if:NF \c__wi_amsmath_loaded_bool
{\cs_set_protected:Npn \spread@equation
{\openup\jot
- \cs_set_protected:Npn \spread@equation {}}}}
+ \cs_set_eq:NN \spread@equation \prg_do_nothing:}}}
\bool_new:N \l__wi_in_WithArrows_bool
\bool_new:N \l__wi_in_DispWithArrows_bool
\seq_new:N \g__wi_position_in_the_tree_seq
@@ -149,6 +151,7 @@
\dim_new:N \l__wi_xoffset_dim
\dim_set:Nn \l__wi_xoffset_dim {3mm}
\int_new:N \l__wi_pos_arrows_int
+\int_set:Nn \l__wi_pos_arrows_int 3
\int_new:N \l__wi_previous_pos_arrows_int
\dim_new:N \l__wi_x_dim
\seq_new:N \g__wi_arrow_int_seq
@@ -167,6 +170,10 @@
\bool_new:N \l__wi_in_first_column_bool
\bool_new:N \l__wi_initial_r_bool
\bool_new:N \l__wi_initial_l_bool
+\dim_new:N \l__wi_start_adjust_dim
+\dim_set:Nn \l__wi_start_adjust_dim {0.4ex}
+\dim_new:N \l__wi_end_adjust_dim
+\dim_set:Nn \l__wi_end_adjust_dim {0.4ex}
\int_set:Nn \l__wi_level_int 1
\keys_define:nn {WithArrows/GlobalOrEnv}
{ t .code:n = {\bool_if:NTF \l__wi_in_DispWithArrows_bool
@@ -192,8 +199,7 @@
{Third~column~in~an~environment~{WithArrows}}
{none} },
MoreColumns .value_forbidden:n = true,
- AllowLineWithoutAmpersand .code:n = { \msg_error:nn
- {witharrows}
+ AllowLineWithoutAmpersand .code:n = { \__wi_error:n
{AllowLineWithoutAmpersand}},
AllowLineWithoutAmpersand .value_forbidden:n = true,
CommandName .tl_set:N = \l__wi_CommandName_tl,
@@ -210,13 +216,13 @@
shownodenames .initial:n = false,
group .code:n = {\int_compare:nNnT \l__wi_previous_pos_arrows_int > {-1}
{\__wi_error:n {Two~options~are~incompatible}}
- \int_set:Nn \l__wi_previous_pos_arrows_int 6
- \int_set:Nn \l__wi_pos_arrows_int 6} ,
+ \int_set:Nn \l__wi_previous_pos_arrows_int 7
+ \int_set:Nn \l__wi_pos_arrows_int 7} ,
group .value_forbidden:n = true,
groups .code:n = {\int_compare:nNnT \l__wi_previous_pos_arrows_int > {-1}
{\__wi_error:n {Two~options~are~incompatible}}
- \int_set:Nn \l__wi_previous_pos_arrows_int 7
- \int_set:Nn \l__wi_pos_arrows_int 7} ,
+ \int_set:Nn \l__wi_previous_pos_arrows_int 6
+ \int_set:Nn \l__wi_pos_arrows_int 6} ,
groups .value_forbidden:n = true,
CodeBefore .code:n = {\int_compare:nNnTF \l__wi_level_int = 1
{\__wi_error:n {Option~will~be~ignored}}
@@ -232,7 +238,7 @@
name .value_required:n = true,
fleqn .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool
{\__wi_error:n {Option~will~be~ignored}}
- {\tl_if_eq:nnTF {#1} {true}
+ {\str_if_eq:nnTF {#1} {true}
{\bool_set_true:N \l__wi_fleqn_bool}
{\bool_set_false:N \l__wi_fleqn_bool}}},
fleqn .default:n = true,
@@ -242,7 +248,7 @@
mathindent .value_required:n = true,
notag .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool
{\__wi_error:n {Option~will~be~ignored}}
- {\tl_if_eq:nnTF {#1} {true}
+ {\str_if_eq:nnTF {#1} {true}
{\clist_clear:N \l__wi_tags_clist}
{\clist_set:Nn \l__wi_tags_clist {all}}}},
notag .default:n = true,
@@ -255,7 +261,7 @@
AllowMultipleLabels .value_forbidden:n = true,
wrap-lines .code:n = {\bool_if:NTF \l__wi_in_WithArrows_bool
{\__wi_error:n {Option~will~be~ignored}}
- {\tl_if_eq:nnTF {#1} {true}
+ {\str_if_eq:nnTF {#1} {true}
{\bool_set_true:N \l__wi_wrap_lines_bool}
{\bool_set_false:N \l__wi_wrap_lines_bool}}},
wrap-lines .default:n = true,
@@ -273,13 +279,13 @@
tikz .initial:n = {},
tikz .value_required:n = true,
rr .value_forbidden:n = true,
- rr .code:n = \__wi_analyze_option_position:n 0 ,
+ rr .code:n = \__wi_analyze_option_position:n 3 ,
ll .value_forbidden:n = true,
ll .code:n = \__wi_analyze_option_position:n 1 ,
rl .value_forbidden:n = true,
rl .code:n = \__wi_analyze_option_position:n 2 ,
lr .value_forbidden:n = true,
- lr .code:n = \__wi_analyze_option_position:n 3 ,
+ lr .code:n = \__wi_analyze_option_position:n 0 ,
i .value_forbidden:n = true,
i .code:n = \__wi_analyze_option_position:n 5 ,
xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__wi_level_int = 3 &&
@@ -295,6 +301,13 @@
{\skip_set:Nn \l__wi_interline_skip {#1}}
{\__wi_error:n {Option~will~be~ignored}}} ,
interline .value_required:n = true,
+ start-adjust .dim_set:N = \l__wi_start_adjust_dim,
+ start-adjust .value_required:n = true,
+ end-adjust .dim_set:N = \l__wi_end_adjust_dim,
+ end-adjust .value_required:n = true,
+ adjust .code:n = {\dim_set:Nn \l__wi_start_adjust_dim {#1}
+ \dim_set:Nn \l__wi_end_adjust_dim {#1} },
+ adjust .value_required:n = true,
jump .code:n = {\int_compare:nNnF \l__wi_level_int = 3
{\__wi_error:n {Option~will~be~ignored}}} ,
unknown .code:n = \__wi_error:n {Option~unknown}
@@ -305,13 +318,13 @@
{\__wi_error:n {The~option~"jump"~must~be~non~negative}}} ,
jump .value_required:n = true,
rr .value_forbidden:n = true,
- rr .code:n = \__wi_analyze_option_position:n 0 ,
+ rr .code:n = \__wi_analyze_option_position:n 3 ,
ll .value_forbidden:n = true,
ll .code:n = \__wi_analyze_option_position:n 1 ,
rl .value_forbidden:n = true,
rl .code:n = \__wi_analyze_option_position:n 2 ,
lr .value_forbidden:n = true,
- lr .code:n = \__wi_analyze_option_position:n 3 ,
+ lr .code:n = \__wi_analyze_option_position:n 0 ,
i .value_forbidden:n = true,
i .code:n = \__wi_analyze_option_position:n 5 }
\cs_new_protected:Nn \__wi_analyze_option_position:n
@@ -373,7 +386,7 @@
\int_set:Nn \l__wi_level_int 2
\keys_set_known:nnN {WithArrows/General} {#1} \l_tmpa_tl
\keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl
- \bool_if:NT \g__wi_footnote_bool {\savenotes}
+ \bool_if:NT \g__wi_footnote_bool \savenotes
\l__wi_code_before_tl
\cs_set_eq:cN \l__wi_CommandName_tl \__wi_Arrow}
\NewDocumentEnvironment {WithArrows} {O{}}
@@ -420,18 +433,15 @@
$\bool_if:NT \l__wi_displaystyle_bool \displaystyle {##}$
\cr
}
- {\crcr
+ {\\
\egroup
\egroup
\__wi_post_environment:
- \bool_if:NT \g__wi_footnote_bool {\endsavenotes}
+ \bool_if:NT \g__wi_footnote_bool \endsavenotes
}
\cs_new_protected:Nn \__wi_post_environment:
{\cs_set:Npn \WithArrowsRightX {\g__wi_right_x_dim}
- \int_compare:nNnT \g__wi_arrow_int > 0
- {\int_compare:nNnTF \l__wi_pos_arrows_int > 5
- \__wi_draw_arrows:
- {\__wi_draw_arrows:nn 1 \g__wi_arrow_int}}
+ \int_compare:nNnT \g__wi_arrow_int > 0 \__wi_scan_arrows:
\group_begin:
\tikzset{every~picture/.style = __wi_standard}
\cs_set:Npn \WithArrowsNbLines {\int_use:N \g__wi_line_int}
@@ -452,7 +462,7 @@
}
\cs_new_protected:Nn \__wi_cr:
{\scan_stop:
- \bool_if:NT \l__wi_in_first_column_bool {& {} }
+ \bool_if:NT \l__wi_in_first_column_bool { & {} }
\group_align_safe_begin:
\peek_meaning_remove:NTF * \__wi_cr_i: \__wi_cr_i:}
\cs_new_protected:Nn \__wi_cr_i:
@@ -494,7 +504,7 @@
& \__wi_restore:N \l__wi_tag_star_bool
\__wi_restore:N \l__wi_qedhere_bool
\bool_if:NT \l__wi_qedhere_bool
- {\hbox_overlap_left:n {\__wi_qedhere_i:}}
+ {\hbox_overlap_left:n \__wi_qedhere_i:}
\cs_set_eq:NN \theequation \g_tmpa_tl
\bool_if:NT \l__wi_tag_star_bool {\cs_set:Npn \tagform@ {}}
\hbox_overlap_left:n
@@ -507,19 +517,17 @@
{\__wi_save:N \l__wi_qedhere_bool
& \__wi_restore:N \l__wi_qedhere_bool
\bool_if:NT \l__wi_qedhere_bool
- {\hbox_overlap_left:n {\__wi_qedhere_i:}}
+ {\hbox_overlap_left:n \__wi_qedhere_i:}
\tikz [__wi_standard] \coordinate (\int_use:N\g__wi_line_int-v) ; }
}
\cr\noalign{\skip_vertical:n {#1 + \l__wi_interline_skip}
\scan_stop:}}
\cs_new_protected:Nn \__wi_if_in_second_col_of_disp:nn
{\bool_if:NTF \l__wi_in_WithArrows_bool
- {\msg_error:nnn {witharrows}
- {Command~not~allowed~in~{WithArrows}}
+ {\__wi_error:nn {Command~not~allowed~in~{WithArrows}}
{#1}}
{\bool_if:NTF \l__wi_in_first_column_bool
- {\msg_error:nnn {witharrows}
- {Command~not~allowed~in~{DispWithArrows}}
+ {\__wi_error:nn {Command~not~allowed~in~{DispWithArrows}}
{#1}}
{#2}}}
\cs_new_protected:Nn \__wi_notag:
@@ -528,7 +536,7 @@
\NewDocumentCommand \__wi_tag {sm}
{\__wi_if_in_second_col_of_disp:nn {\tag}
{\tl_if_empty:NF \l__wi_tag_tl
- {\msg_error:nnn {witharrows} {Multiple~tags} {#2}}
+ {\__wi_error:nn {Multiple~tags} {#2}}
\clist_set:Nn \l__wi_tags_clist {all}
\bool_if:nT \c__wi_mathtools_loaded_bool
{\MH_if_boolean:nT {show_only_refs}
@@ -635,7 +643,7 @@
\egroup
\bool_if:NT \l__wi_in_DispWithArrows_bool
{\dim_gzero_new:N \g__wi_right_x_dim
- \dim_gset:Nn \g__wi_right_x_dim \c_max_dim
+ \dim_gset_eq:NN \g__wi_right_x_dim \c_max_dim
\begin{tikzpicture} [__wi_standard]
\int_step_variable:nnnNn 1 1 \g__wi_line_int \l_tmpa_int
{\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v)
@@ -648,18 +656,27 @@
{\MH_if_boolean:nT {show_only_refs}
\MT_showonlyrefs_true:}
$$
- \bool_if:NT \g__wi_footnote_bool {\endsavenotes}
+ \bool_if:NT \g__wi_footnote_bool \endsavenotes
\ignorespacesafterend
}
\NewDocumentEnvironment {DispWithArrows*} {}
{\WithArrowsOptions{notag}
\DispWithArrows}
{\endDispWithArrows}
-\cs_new_protected:Nn \__wi_draw_arrows:
- { \group_begin:
+\cs_new_protected:Nn \__wi_scan_arrows:
+ { \group_begin:
+ \int_compare:nNnT \l__wi_pos_arrows_int = 7
+ { \__wi_scan_arrows_i:
+ \int_set:Nn \l__wi_pos_arrows_int 8 }
+ \__wi_scan_arrows_i:
+ \group_end:}
+\cs_new_protected:Nn \__wi_scan_arrows_i:
+ {
\int_zero_new:N \l__wi_first_arrow_of_group_int
\int_zero_new:N \l__wi_first_line_of_group_int
\int_zero_new:N \l__wi_last_line_of_group_int
+ \seq_clear_new:N \l__wi_first_arrows_of_group_seq
+ \seq_clear_new:N \l__wi_last_arrows_of_group_seq
\bool_set_true:N \l__wi_new_group_bool
\int_set:Nn \l__wi_arrow_int 1
\int_until_do:nNnn \l__wi_arrow_int > \g__wi_arrow_int
@@ -675,10 +692,12 @@
\int_set:Nn \l__wi_pos_of_arrow_int \l_tmpa_tl
\int_compare:nNnTF \l__wi_final_int > \g__wi_line_int
{\__wi_error:n {Too~few~lines~for~an~arrow}}
- {\bool_if:nT { \int_compare_p:nNn \l__wi_pos_arrows_int = 7
- && \int_compare_p:nNn \l__wi_arrow_int > 1
- && \int_compare_p:nNn
- \l__wi_initial_int > \l__wi_last_line_of_group_int}
+ {\bool_if:nT {\int_compare_p:nNn \l__wi_arrow_int > 1
+ &&
+ \int_compare_p:nNn
+ \l__wi_initial_int > \l__wi_last_line_of_group_int
+ &&
+ \int_compare_p:n {\l__wi_pos_arrows_int != 7}}
{\__wi_draw_arrows:nn \l__wi_first_arrow_of_group_int {\l__wi_arrow_int - 1}
\bool_set_true:N \l__wi_new_group_bool}
\bool_if:nTF \l__wi_new_group_bool
@@ -686,17 +705,34 @@
\int_set:Nn \l__wi_first_arrow_of_group_int \l__wi_arrow_int
\int_set:Nn \l__wi_first_line_of_group_int \l__wi_initial_int
\int_set:Nn \l__wi_last_line_of_group_int \l__wi_final_int
- \dim_set:Nn \l__wi_x_dim {-\c_max_dim}
+ \seq_clear:N \l__wi_first_arrows_of_group_seq
+ \seq_put_left:Nx \l__wi_first_arrows_of_group_seq
+ {\int_use:N \l__wi_arrow_int}
+ \seq_clear:N \l__wi_last_arrows_of_group_seq
+ \seq_put_left:Nx \l__wi_last_arrows_of_group_seq
+ {\int_use:N \l__wi_arrow_int}
+ \int_compare:nT {\l__wi_pos_arrows_int != 8}
+ {\dim_set:Nn \l__wi_x_dim {-\c_max_dim}}
}
{\int_compare:nNnT \l__wi_pos_of_arrow_int = {-1}
- {\int_set:Nn \l__wi_last_line_of_group_int
- {\int_max:nn \l__wi_last_line_of_group_int \l__wi_final_int}}}
+ {\int_compare:nNnT \l__wi_initial_int = \l__wi_first_line_of_group_int
+ {\seq_put_left:Nx \l__wi_first_arrows_of_group_seq
+ {\int_use:N \l__wi_arrow_int}}
+ \int_compare:nNnTF \l__wi_final_int > \l__wi_last_line_of_group_int
+ {\int_set_eq:NN \l__wi_last_line_of_group_int \l__wi_final_int
+ \seq_clear:N \l__wi_last_arrows_of_group_seq
+ \seq_put_left:Nx \l__wi_last_arrows_of_group_seq
+ {\int_use:N \l__wi_arrow_int}}
+ {\int_compare:nNnT \l__wi_final_int = \l__wi_last_line_of_group_int
+ {\seq_put_left:Nx \l__wi_last_arrows_of_group_seq
+ {\int_use:N \l__wi_arrow_int}}}}}
\int_compare:nNnT \l__wi_pos_of_arrow_int = {-1}
- {\__wi_update_x_value:nn \l__wi_initial_int \l__wi_final_int} }
+ { \int_compare:nT {\l__wi_pos_arrows_int != 8}
+ {\__wi_update_x_value:nn \l__wi_initial_int \l__wi_final_int}} }
\int_incr:N \l__wi_arrow_int
}
- \__wi_draw_arrows:nn \l__wi_first_arrow_of_group_int \g__wi_arrow_int
- \group_end:
+ \int_compare:nT {\l__wi_pos_arrows_int != 7}
+ {\__wi_draw_arrows:nn \l__wi_first_arrow_of_group_int \g__wi_arrow_int}
}
\cs_generate_variant:Nn \keys_set:nn {no}
\cs_new_protected:Nn \__wi_keys_set: {\keys_set:no {WithArrows/General}}
@@ -715,15 +751,13 @@
\prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop}
{final} \l_tmpa_tl
\int_set:Nn \l__wi_final_int {\l_tmpa_tl}
- \int_compare:nNnTF \l__wi_final_int > \g__wi_line_int
- {\int_compare:nNnT \l__wi_pos_arrows_int < 6
- {\__wi_error:n {Too~few~lines~for~an~arrow}}}
+ \int_compare:nNnT \l__wi_final_int < {\g__wi_line_int + 1}
\__wi_draw_arrows_i:
\int_incr:N \l__wi_arrow_int
}
\group_end:
}
-\cs_new:Nn \__wi_draw_arrows_i:
+\cs_new_protected:Nn \__wi_draw_arrows_i:
{\group_begin:
\int_set:Nn \l__wi_level_int 3
\prop_get:cnN {g__wi_arrow_\l__wi_prefix_str
@@ -738,10 +772,10 @@
\bool_set_false:N \l__wi_initial_r_bool
\bool_set_false:N \l__wi_final_r_bool
\int_case:nn \l__wi_pos_arrows_int
- {0 {\bool_set_true:N \l__wi_initial_r_bool
- \bool_set_true:N \l__wi_final_r_bool}
+ {0 {\bool_set_true:N \l__wi_final_r_bool}
2 {\bool_set_true:N \l__wi_initial_r_bool}
- 3 {\bool_set_true:N \l__wi_final_r_bool}}
+ 3 {\bool_set_true:N \l__wi_initial_r_bool
+ \bool_set_true:N \l__wi_final_r_bool}}
\int_compare:nNnT \l__wi_pos_arrows_int = 5
{ \dim_set:Nn \l__wi_x_dim {-\c_max_dim}
\__wi_update_x_value:nn \l__wi_initial_int \l__wi_final_int }
@@ -752,21 +786,34 @@
\prop_get:cnN {g__wi_arrow_\l__wi_prefix_str _\int_use:N\l__wi_arrow_int _prop}
{label}
\l_tmpa_tl
- \int_compare:nNnTF \l__wi_pos_arrows_int < 5
- {\begin{tikzpicture} [__wi_standard]
- \tikz@scan@one@point\pgfutil@firstofone(\l__wi_initial_tl)
- \tl_gset:Nx \g_tmpa_tl {\dim_use:N\pgf@x,\dim_use:N\pgf@y}
- \tikz@scan@one@point\pgfutil@firstofone(\l__wi_final_tl)
- \tl_gset:Nx \g_tmpb_tl {\dim_use:N\pgf@x,\dim_use:N\pgf@y}
- \end{tikzpicture}
-}
- {\begin{tikzpicture} [__wi_standard]
- \tikz@scan@one@point\pgfutil@firstofone (\l__wi_initial_tl)
- \tl_gset:Nx \g_tmpa_tl {\dim_use:N \l__wi_x_dim , \dim_use:N \pgf@y}
- \tikz@scan@one@point\pgfutil@firstofone (\l__wi_final_tl)
- \tl_gset:Nx \g_tmpb_tl {\dim_use:N \l__wi_x_dim , \dim_use:N \pgf@y}
- \end{tikzpicture}}
- \__wi_draw_arrow:nno {\g_tmpa_tl} {\g_tmpb_tl} {\l_tmpa_tl}
+ \seq_if_in:NxTF \l__wi_first_arrows_of_group_seq {\int_use:N \l__wi_arrow_int}
+ {\bool_set_true:N \l_tmpa_bool}
+ {\bool_set_false:N \l_tmpa_bool}
+ \seq_if_in:NxTF \l__wi_last_arrows_of_group_seq {\int_use:N \l__wi_arrow_int}
+ {\bool_set_true:N \l_tmpb_bool}
+ {\bool_set_false:N \l_tmpb_bool}
+ \int_compare:nNnT \l__wi_pos_arrows_int = 5
+ {\bool_set_true:N \l_tmpa_bool
+ \bool_set_true:N \l_tmpb_bool}
+ \begin{tikzpicture} [__wi_standard]
+ \tikz@scan@one@point\pgfutil@firstofone (\l__wi_initial_tl)
+ \tl_gset:Nx \g_tmpa_tl
+ {\int_compare:nNnTF \l__wi_pos_arrows_int < 5
+ { \dim_use:N \pgf@x }
+ { \dim_use:N \l__wi_x_dim } ,
+ \bool_if:NTF \l_tmpa_bool
+ { \dim_eval:n {\pgf@y + \l__wi_start_adjust_dim }}
+ { \dim_use:N \pgf@y } }
+ \tikz@scan@one@point\pgfutil@firstofone (\l__wi_final_tl)
+ \tl_gset:Nx \g_tmpb_tl
+ {\int_compare:nNnTF \l__wi_pos_arrows_int < 5
+ { \dim_use:N \pgf@x }
+ { \dim_use:N \l__wi_x_dim } ,
+ \bool_if:NTF \l_tmpb_bool
+ { \dim_eval:n {\pgf@y - \l__wi_end_adjust_dim }}
+ { \dim_use:N \pgf@y }}
+ \end{tikzpicture}
+ \__wi_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl
\group_end: }
\cs_new_protected:Nn \__wi_def_function_tmpa:n
{\cs_set:Nn \__wi_tmpa:nnn
@@ -798,7 +845,7 @@
{\int_step_inline:nnnn {#1} 1 {#2}
{\begin{tikzpicture} [__wi_standard]
\tikz@scan@one@point\pgfutil@firstofone (##1-l)
- \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l__wi_x_dim \pgf@x}
+ \dim_gset:Nn \g_tmpa_dim {\dim_max:nn \l__wi_x_dim \pgf@x }
\end{tikzpicture}
\dim_set_eq:NN \l__wi_x_dim \g_tmpa_dim } }
\cs_new:Npn \WithArrowsLastEnv {\int_use:N \g__wi_last_env_int}
@@ -834,9 +881,9 @@
2 {\bool_set_true:N \l__wi_initial_r_bool}
3 {\bool_set_true:N \l__wi_final_r_bool}}
\cs_if_free:cTF {pgf@sh@ns@wa-\l__wi_prefix_str-#2-l}
- {\msg_error:nnx {witharrows} {Wrong~line~specification~in~Arrow} {#2}}
+ {\__wi_error:nx {Wrong~line~specification~in~Arrow} {#2}}
{\cs_if_free:cTF {pgf@sh@ns@wa-\l__wi_prefix_str-#3-l}
- {\msg_error:nnx {witharrows} {Wrong~line~specification~in~Arrow} {#3}}
+ {\__wi_error:nx {Wrong~line~specification~in~Arrow} {#3}}
{\int_compare:nNnTF \l__wi_pos_arrows_int = 4
{\begin{tikzpicture} [__wi_standard]
\tikz@scan@one@point\pgfutil@firstofone(#2-l.south)
@@ -863,10 +910,8 @@
\cs_new_protected:Nn \__wi_MultiArrow:nn
{
\foreach \x in {#1} {\cs_if_free:cTF {pgf@sh@ns@wa-\l__wi_prefix_str-\x-l}
- {\msg_error:nnx {witharrows}
- {Wrong~line~specification~in~MultiArrow}
- {\x}}
- {\clist_gput_right:Nx \g_tmpa_clist {\x}}}
+ {\__wi_error:nx {Wrong~line~specification~in~MultiArrow} \x }
+ {\clist_gput_right:Nx \g_tmpa_clist \x}}
\int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2
{\__wi_error:n {Too~small~specification~for~MultiArrow}}
{\clist_sort:Nn \g_tmpa_clist
@@ -951,8 +996,8 @@
3 {lr}
4 {v}
5 {i}
- 6 {group}
- 7 {groups}}"~
+ 6 {groups}
+ 7 {group}}"~
set~in~the~same~
\int_case:nn\l__wi_level_int
{1 {command~\token_to_str:N\WithArrowsOptions}
@@ -967,7 +1012,7 @@
\msg_new:nnn {witharrows}
{Arrow~in~first~column}
{You~should~not~use~the~command~\token_to_str:N\Arrow\
- \tl_if_eq:NNF \l__wi_CommandName_tl \l_tmpa_tl
+ \str_if_eq:NNF \l__wi_CommandName_tl \l_tmpa_tl
{(renamed~in~\str_use:N \c_backslash_str
\tl_use:N \l__wi_CommandName_tl)~}
~in~the~first~column~but~only~in~the~second~column.\\
@@ -1120,6 +1165,7 @@
\bool_if:nT \c__wi_mathtools_loaded_bool
{\MH_if_boolean:nT {show_only_refs}
\MT_showonlyrefs_true:}
+ \bool_if:NT \g__wi_footnote_bool \endsavenotes
\ignorespacesafterend
}
\NewDocumentCommand \WithArrowsNewStyle {mm}