summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-12 21:55:59 +0000
committerKarl Berry <karl@freefriends.org>2019-03-12 21:55:59 +0000
commit2d7d658f747fa6401c8784dfb3bc9be079986f25 (patch)
tree32c26756e7c94e0a1ab9bf2afd7187fdab8fbf24 /Master/texmf-dist/source/latex
parent27570b0335d858aae49821a98ebe3944b288ba40 (diff)
witharrows (12mar19)
git-svn-id: svn://tug.org/texlive/trunk@50356 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/witharrows/witharrows.dtx1539
1 files changed, 827 insertions, 712 deletions
diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
index 09e887cd57d..d8993abebd4 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.15}
-\def\myfiledate{2019/02/20}
+\def\myfileversion{1.16}
+\def\myfiledate{2019/03/11}
%
%
%<*batchfile>
@@ -44,7 +44,7 @@ version 2005/12/01 or later.
\endgroup
%</batchfile>
%
-%<@@=witharrows>
+%<@@=wa>
%<*driver>
\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by witharrows)
\usepackage{xltxtra}
@@ -69,8 +69,9 @@ version 2005/12/01 or later.
%</driver>
% \fi
% \VerbatimFootnotes
-% \title{The package \pkg{witharrows}\thanks{This document corresponds to the version~\myfileversion\space of \pkg{witharrows},
-% at the date of~\myfiledate.}} \author{F. Pantigny \\ \texttt{fpantigny@wanadoo.fr}}
+% \title{The package \pkg{witharrows}\thanks{This document corresponds to the
+% version~\myfileversion\space of \pkg{witharrows}, at the date
+% of~\myfiledate.}} \author{F. Pantigny \\ \texttt{fpantigny@wanadoo.fr}}
%
% \maketitle
%
@@ -83,12 +84,12 @@ version 2005/12/01 or later.
% \end{abstract}
%
%
-% \vskip1cm
-% This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by
-% the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two
-% compilations may be necessary. This package requires the packages \pkg{expl3},
-% \pkg{xparse} and \pkg{tikz}. The Tikz libraries \pkg{arrows.meta} and
-% \pkg{bending} are also required.
+% \vspace{1cm}
+% This package can be used with |xelatex|, |lualatex|, |pdflatex|
+% but also by the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe
+% Distiller). Several compilations may be necessary. This package requires the
+% packages \pkg{expl3}, \pkg{xparse} and \pkg{tikz}. The Tikz libraries
+% \pkg{arrows.meta} and \pkg{bending} are also required.
%
% \bigskip
% This package provides an environment |{WithArrows}| to construct alignments of
@@ -528,7 +529,8 @@ version 2005/12/01 or later.
% & = \int_0^{\frac{\pi}4} \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)d u \\
% & = \int_0^{\frac{\pi}4}\ln\left(1+\frac{1-\tan u}{1+\tan u}\right)\, d u \\
% & =\int_0^{\frac{\pi}4}\ln\left(\frac{1+\tan u+1-\tan u}{1+\tan u}\right) d u
-% \Arrow[ll,jump=2,tikz={text width = 5cm}]{This arrow uses a \texttt{ll} option and a \texttt{jump} equal to $2$}\\
+% \Arrow[ll,jump=2,tikz={text width = 5cm}]{This arrow uses a \texttt{ll} option
+% and a \texttt{jump} equal to $2$}\\
% & =\int_0^{\frac{\pi}4} \ln\left(\frac2{1+\tan u}\right)\, d u\\
% & =\int_0^{\frac{\pi}4}\bigl(\ln2-\ln(1+\tan u)\bigr)\, d u \\
% & =\frac{\pi}4\ln2-\int_0^{\frac{\pi}4}\ln(1+\tan u)\, d u \\
@@ -1025,7 +1027,7 @@ version 2005/12/01 or later.
% for the command~|\Arrow| in |CodeAfter|. However, it's always possible to
% translate an arrow with |xoffset| (or |xshift| of Tikz).
% \begin{Verbatim}
-% $\begin{WithArrows}[CodeAfter = \Arrow~emphase#[v]@{1-2}{2-2}{division by $2$} ]
+% $\begin{WithArrows}[CodeAfter=\Arrow~emphase#[v]@{1-2}{2-2}{division by $2$}]
% \varphi(x,y)=0
% & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
% .........
@@ -1409,7 +1411,8 @@ version 2005/12/01 or later.
% \begin{DispWithArrows}[displaystyle]
% S_{2(p+1)}
% & =\sum_{k=1}^{2(p+1)} (-1)^k k^2 \\
-% & \smash[b]{=\sum_{k=1}^{2p}(-1)^kk^2+(-1)^{2p+1}(2p+1)^2+(-1)^{2p+2}(2p+2)^2} \tagnextline \\
+% & \smash[b]{=\sum_{k=1}^{2p}(-1)^kk^2+(-1)^{2p+1}(2p+1)^2+(-1)^{2p+2}(2p+2)^2}
+% \tagnextline \\
% &= S_{2p}-(2p+1)^2+(2p+2)^2\\
% &= 2p^2+p-4p^2-4p-1+4p^2+8p+4\\
% &= 2p^2+5p+3
@@ -1419,39 +1422,6 @@ version 2005/12/01 or later.
% \end{center}
%
%
-% \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 to use \pkg{witharrows} without \pkg{amsmath}).
-%
-% There are differences between |{DispWithArrows}| and |{align}|.
-% \begin{itemize}
-% \item The environment |{DispWithArrows}| allows only two columns.
-% \item The environment |{DispWithArrows}| can not be inserted in an environment
-% |{gather}| of \pkg{amsmath}.
-% \item An environment |{DispWithArrows}| is always unbreakable (even with
-% |\allowdisplaybreaks| of \pkg{amsmath}).
-% \item The commands |\label|, |\tag|, |\notag| and |\nonumber| are allowed only
-% in the second column.
-% \item
-% \begin{bfseries}
-% Last but not least, by default, the elements of a \texttt{\{DispWithArrows\}}
-% are composed in \texttt{textstyle} and not in \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{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
@@ -1474,7 +1444,8 @@ version 2005/12/01 or later.
% S_n
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\
-% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)
+% & = \frac1n \Re \left(
+% \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}} \right)
% \Arrow{This line has been wrapped automatically.} \\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right)
% \end{DispWithArrows*}
@@ -1485,8 +1456,83 @@ version 2005/12/01 or later.
% it applies to the instructions |\Arrow| and |\MultiArrow| of the |CodeAfter|
% of the environments |{DispWithArrows}| or |{DispWithArrows*}|.
%
+% \vspace{1cm}
+% We have said that the environments |{DispWithArrows}| and |{DispWithArrows*}|
+% should be used in horizontal mode and not in vertical mode. However, there is
+% an exception. These environments can be used directly after a |\item| of a
+% LaTeX list. In this case, no vertical space is added before the
+% environment.\footnote{It's possible to disable this feature with the option |standard-behaviour-with-items|.}
+%
+% \medskip
+% Here is an example. The use of |{DispWithArrows}| gives the ability to tag an
+% equation (and also to use |wrap-lines|).
+%
+% \begin{Verbatim}
+% ~emphase#\begin{enumerate}@
+% ~emphase#\item @
+% \begin{DispWithArrows}%
+% [displaystyle, wrap-lines, tagged-lines = last, fleqn, mathindent = 0 pt]
+% S_n
+% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
+% \Arrow{we use the formula for a sum of terms of a geometric progression of
+% ratio $e^{i\frac{2\pi}n}$}\\
+% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}
+% {1-e^{i\frac{\pi}{2n}}}\right)
+% \Arrow{$\bigl(e^{i\frac{\pi}{2n}}\bigr)^n = e^{i\frac{\pi}2}=i$} \\
+% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right)
+% \end{DispWithArrows}
+% ~emphase#\end{enumerate}@
+% \end{Verbatim}
+% \begin{enumerate}
+% \item
+% \begin{DispWithArrows}[displaystyle, wrap-lines, tagged-lines = last, fleqn, mathindent = 0 pt]
+% S_n
+% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
+% \Arrow{we use the formula for a sum of terms of a geometric progression of
+% ratio $e^{i\frac{2\pi}n}$}\\
+% & = \frac1n \Re \left(
+% \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}} \right)
+% \Arrow{$\bigl(e^{i\frac{\pi}{2n}}\bigr)^n = e^{i\frac{\pi}2}=i$} \\
+% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right)
+% \end{DispWithArrows}
+% \end{enumerate}
+%
+% \vspace{1cm}
+% The environment |{DispWithArrows}| is similar to the environment |{align}| of
+% \pkg{amsmath}. However, |{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}|.
+% \begin{itemize}
+% \item The environment |{DispWithArrows}| allows only two columns.
+% \item The environment |{DispWithArrows}| can not be inserted in an environment
+% |{gather}| of \pkg{amsmath}.
+% \item An environment |{DispWithArrows}| is always unbreakable (even with
+% |\allowdisplaybreaks| of \pkg{amsmath}).
+% \item The commands |\label|, |\tag|, |\notag| and |\nonumber| are allowed only
+% in the second column.
+% \item After an |\item| of a LaTeX list, no vertical space is added.
+% \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{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).
%
+%
% \section{Advanced features}
%
%
@@ -1714,6 +1760,15 @@ version 2005/12/01 or later.
% \end{WithArrows}$
%
% \bigskip
+% \subsection{Option no-arrows}
+%
+% The option |no-arrows| is a convenience given to the user. With this option
+% the arrows are not drawn. However, an analyse of the arrows is done and some
+% errors can be raised, for example if an arrow would arrive after the last row
+% of the environment.
+%
+%
+% \bigskip
% \subsection{Note for developpers}
%
% If you want to construct an environment upon an environment of
@@ -1750,7 +1805,9 @@ version 2005/12/01 or later.
% \DispWithArrows}
% {\endDispWithArrows}
% \end{Verbatim}
-%
+%
+%
+%
% \section{Examples}
%
% \subsection{With only one column}
@@ -2296,14 +2353,6 @@ version 2005/12/01 or later.
\cs_generate_variant:Nn \@@_error:nn { n x }
% \end{macrocode}
%
-% \begin{macrocode}
-\cs_new_protected:Nn \@@_bool_new:N
- {
- \bool_if_exist:NTF #1
- { \bool_set_false:N #1 }
- { \bool_new:N #1 }
- }
-% \end{macrocode}
%
% \medskip
% We create booleans in order to know if some packages are loaded. For example,
@@ -2334,29 +2383,32 @@ version 2005/12/01 or later.
% \begin{macrocode}
\sys_if_engine_luatex:TF
{
- \cs_new_protected:Nn \@@_strcmp:nn
+ \cs_new_protected:Npn \@@_strcmp:nn #1 #2
{ \lua_now:e { l3kernel.strcmp('#1','#2') } }
}
- { \cs_new_protected:Nn \@@_strcmp:nn { \pdftex_strcmp:D { #1 } { #2 } } }
+ {
+ \cs_new_protected:Npn \@@_strcmp:nn #1 #2
+ { \pdftex_strcmp:D { #1 } { #2 } }
+ }
% \end{macrocode}
%
% \bigskip
% We can now define a command |\@@_sort_seq:N| which will sort a sequence.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_sort_seq:N
+\cs_new_protected:Npn \@@_sort_seq:N #1
{
\seq_sort:Nn #1
- {
- \int_compare:nNnTF
- {
- \@@_strcmp:nn
- { \str_lower_case:n { ##1 } }
- { \str_lower_case:n { ##2 } }
- }
- > 0
- \sort_return_swapped:
- \sort_return_same:
- }
+ {
+ \int_compare:nNnTF
+ {
+ \@@_strcmp:nn
+ { \str_lower_case:n { ##1 } }
+ { \str_lower_case:n { ##2 } }
+ }
+ > 0
+ \sort_return_swapped:
+ \sort_return_same:
+ }
}
% \end{macrocode}
%
@@ -2374,7 +2426,7 @@ version 2005/12/01 or later.
% variable is determinated by the suffix \texttt{\slshape type} and is used to
% apply the corresponding \pkg{expl3} commands.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_save:N
+\cs_new_protected:Npn \@@_save:N #1
{
\seq_set_split:Nxx \l_tmpa_seq
{ \char_generate:nn { `_ } { 12 } }
@@ -2399,7 +2451,7 @@ version 2005/12/01 or later.
% The command |\@@_restore:N| affects to the \pkg{expl3} variable the value of
% the (previously) set value of the corresponding \emph{global} variable.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_restore:N
+\cs_new_protected:Npn \@@_restore:N #1
{
\seq_set_split:Nxx \l_tmpa_seq
{ \char_generate:nn { `_ } { 12 } }
@@ -2471,8 +2523,10 @@ version 2005/12/01 or later.
% it will be passed to |every~path|).
% \begin{macrocode}
\tikzset
- { WithArrows / arrow / .style =
- { align = left ,
+ {
+ WithArrows / arrow / .style =
+ {
+ align = left ,
% \end{macrocode}
%
% We have put the option |align = left| because we want to give the user the
@@ -2526,6 +2580,7 @@ version 2005/12/01 or later.
\bool_new:N \l_@@_in_CodeAfter_bool
% \end{macrocode}
%
+% \bigskip
% The following sequence is the position of the last environment |{WithArrows}|
% in the tree of the nested environments |{WithArrows}|.
% \begin{macrocode}
@@ -2542,27 +2597,14 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The following skip (=glue) is the vertical space inserted between two lines
-% (=rows) of the |\halign|.
-% \begin{macrocode}
-\skip_new:N \l_@@_interline_skip
-% \end{macrocode}
-%
-% \bigskip
-% The following integer indicates the position of the box that will be created:
+% The following integer indicates the position of the box that will be created
+% for an environment |{WithArrows}| (not an environment |{DispWithArrows}|) :
% 0 (=|t|=|\vtop|), 1~(=|c|=|\vcenter|) or 2 (=|b|=|\vbox|).
% \begin{macrocode}
\int_new:N \l_@@_pos_env_int
% \end{macrocode}
%
% \bigskip
-% \begin{macrocode}
-\dim_new:N \l_@@_xoffset_dim
-\dim_set:Nn \l_@@_xoffset_dim { 3 mm }
-% \end{macrocode}
-%
-%
-% \bigskip
% The integer |\l_@@_pos_arrow_int| indicates the position of the arrow with the
% following code (the option |v| is accessible only for the arrows in
% |CodeAfter| where the options |i|, |group| et |groups| are not available).
@@ -2581,29 +2623,11 @@ version 2005/12/01 or later.
% \end{tabular}
% \end{center}
%
-%
% \begin{macrocode}
\int_new:N \l_@@_pos_arrow_int
\int_set:Nn \l_@@_pos_arrow_int 3
% \end{macrocode}
%
-% \medskip
-% The variable |\l_@@_input_line_str| will be used only to store, for each
-% command |\Arrow| the line (in the TeX file) where the command is issued. This
-% information will be stored in the field |input-line| of the arrow. As of now,
-% This information is used only in the error message of a arrow impossible to
-% draw because after the last row of the environment.
-% \begin{macrocode}
-\str_new:N \l_@@_input_line_str
-% \end{macrocode}
-%
-% \bigskip
-% The dimension |\l_@@_x_dim| will be used to compute the $x$-value for some
-% vertical arrows when one of the options |i|, |group| and |groups| (values 5, 6
-% and 7 of |\l_@@_pos_arrow_int|) is used.
-% \begin{macrocode}
-\dim_new:N \l_@@_x_dim
-% \end{macrocode}
%
% \bigskip
% In the |\halign| of an environment |{WithArrows}| or |{DispWithArrows}|, we
@@ -2625,33 +2649,8 @@ version 2005/12/01 or later.
\int_new:N \g_@@_line_int
% \end{macrocode}
%
-%
-%
-% \bigskip
-% The boolean |\l_@@_fleqn_bool| indicates wether the environments
-% |{DispWithArrows}| must be composed flush left or centered. It corresponds to
-% the option |fleqn|.
-% \begin{macrocode}
-\bool_new:N \l_@@_fleqn_bool
-% \end{macrocode}
%
% \bigskip
-% The dimension |\l_@@_mathindent_dim| is used only by the environments
-% |{DispWithArrows}|: it's the left margin of the environments
-% |{DispWithArrows}| if the environment |{DispWithArrows}| is composed flush
-% left (option |fleqn|).
-% \begin{macrocode}
-\dim_new:N \l_@@_mathindent_dim
-\dim_set:Nn \l_@@_mathindent_dim { 25 pt }
-% \end{macrocode}
-%
-% \bigskip
-% The boolean |\l_@@_wrap_lines_bool| corresponds to the option |wrap-lines|.
-% \begin{macrocode}
-\bool_new:N \l_@@_wrap_lines_bool
-% \end{macrocode}
-%
-% \bigskip
% For the environment |{DispWithArrows}|, the comma list |\l_@@_tags_clist| will
% be the list of the numbers of lines to be tagged (with the counter |equation|
% of LaTeX). In fact, |\l_@@_tags_clist| may contain non negative integers but
@@ -2661,50 +2660,6 @@ version 2005/12/01 or later.
\clist_set:Nn \l_@@_tags_clist { all }
% \end{macrocode}
%
-% \bigskip
-% The token list |\l_@@_tag_tl| will contain the argument of the command |\tag|.
-% \begin{macrocode}
-\tl_new:N \l_@@_tag_tl
-% \end{macrocode}
-%
-% \bigskip
-% The boolean |\l_@@_tag_star_bool| will be raised if the user uses the command
-% |\tag| with a star.
-% \begin{macrocode}
-\bool_new:N \l_@@_tag_star_bool
-% \end{macrocode}
-%
-%
-% \bigskip
-% The 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
-% \end{macrocode}
-%
-% \bigskip
-% \begin{macrocode}
-\bool_new:N \l_@@_initial_r_bool
-\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.4 ex }
-\dim_new:N \l_@@_end_adjust_dim
-\dim_set:Nn \l_@@_end_adjust_dim { 0.4 ex }
-% \end{macrocode}
-%
-% \bigskip
-% The parameter |\l_@@_status_arrow_str| will be used to store the ``status'' of
-% an individual arrow. It will be used to fill the field ``status'' in the
-% property list describing an arrow.
-% \begin{macrocode}
-\str_new:N \l_@@_status_arrow_str
-% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
@@ -2714,18 +2669,31 @@ version 2005/12/01 or later.
% \bigskip
% The string |\l_@@_string_Arrow_for_msg_str| is only a string that will be
% displayed in some error messages. For example, if |CommandName| is defined to
-% be |Explanation|, the string |\l_@@_string_Arrow_for_msg_str| will contain
-% ``|\Arrow alias \Explanation|''.
+% be |Explanation|, this string will contain ``|\Arrow alias \Explanation|''.
% \begin{macrocode}
\str_set:Nx \l_@@_string_Arrow_for_msg_str { \token_to_str:N \Arrow }
% \end{macrocode}
%
+% \bigskip
+% The sequence |\g_@@_names_seq| will be the list of all the names of
+% environments used (via the option |name|) in the document: two environments
+% must not have the same name. However, it's possible to use the option
+% |allow-duplicate-names|.
% \begin{macrocode}
-\bool_new:N \l_@@_displaystyle_bool
-\bool_new:N \l_@@_show_node_names_bool
+\seq_new:N \g_@@_names_seq
% \end{macrocode}
%
-%
+% \bigskip
+% The boolean |\l_@@_sbwi_bool| corresponds to the option
+% |standard-behaviour-with-items|. Since the version 1.16 of \pkg{witharrows},
+% no vertical space is added between an |\item| of a LaTeX list and an
+% environment |{DispWithArrows}|. With the option
+% |standard-behaviour-with-items|, it's possible to restore the previous
+% behaviour (which corresponds to the standard behaviour of |{align}| of
+% \pkg{amsmath}). |\l_@@_sbwi_bool| is the boolean corresponding to this option.
+% \begin{macrocode}
+\bool_new:N \l_@@_sbwi_bool
+% \end{macrocode}
%
% \bigskip
% \subsection{The definition of the options}
@@ -2749,9 +2717,11 @@ version 2005/12/01 or later.
% When we scan a list of options, we want to be able to raise an error if two
% options of position of the arrows are present. That's why we keep
% the first option of position in a variable called |\l_@@_previous_key_str|.
+% The following function |\@@_eval_if_allowed:n| will execute its argument only
+% if a first key of position has not been set (and raise an error elsewhere).
%
% \begin{macrocode}
-\cs_new_protected:Nn \@@_eval_if_allowed:n
+\cs_new_protected:Npn \@@_eval_if_allowed:n #1
{
\str_if_empty:NTF \l_@@_previous_key_str
{
@@ -2764,7 +2734,7 @@ version 2005/12/01 or later.
%
%
% \begin{macrocode}
-\cs_new_protected:Nn \@@_fix_pos_option:n
+\cs_new_protected:Npn \@@_fix_pos_option:n #1
{ \@@_eval_if_allowed:n { \int_set:Nn \l_@@_pos_arrow_int { #1 } } }
% \end{macrocode}
%
@@ -2833,18 +2803,35 @@ version 2005/12/01 or later.
i .code:n = \@@_fix_pos_option:n 5 ,
xoffset .dim_set:N = \l_@@_xoffset_dim ,
xoffset .value_required:n = true ,
+ xoffset .initial:n = 3 mm ,
jot .dim_set:N = \jot ,
jot .value_required:n = true ,
interline .skip_set:N = \l_@@_interline_skip ,
interline .value_required:n = true ,
start-adjust .dim_set:N = \l_@@_start_adjust_dim ,
start-adjust .value_required:n = true ,
+ start-adjust .initial:n = 0.4 ex ,
end-adjust .dim_set:N = \l_@@_end_adjust_dim ,
end-adjust .value_required:n = true ,
+ end-adjust .initial:n = 0.4 ex ,
adjust .code:n =
+ \dim_zero_new:N \l_@@_start_adjust_dim
\dim_set:Nn \l_@@_start_adjust_dim { #1 }
+ \dim_zero_new:N \l_@@_end_adjust_dim
\dim_set:Nn \l_@@_end_adjust_dim { #1 } ,
- adjust .value_required:n = true
+ adjust .value_required:n = true ,
+% \end{macrocode}
+%
+% \medskip
+% With the option |no-arrows|, the arrows won't be drawn. However, the ``first
+% pass'' of the arrows is done and some errors may be detected. The
+% nullification of |\@@_draw_arrows:nn| is for the standard arrows and the
+% nullification of |\@@_draw_arrow:nnn| is for ``Arrow in CodeAfter''.
+% \begin{macrocode}
+ no-arrows .code:n =
+ \cs_set_eq:NN \@@_draw_arrows:nn \use_none:nn
+ \cs_set_eq:NN \@@_draw_arrow:nnn \use_none:nnn ,
+ no-arrows .value_forbidden:n = true ,
}
% \end{macrocode}
%
@@ -2855,7 +2842,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { WithArrows / WithArrowsSpecific }
{
- t .code:n = \int_set:Nn \l_@@_pos_env_int 0 ,
+ t .code:n = \int_set:Nn \l_@@_pos_env_int O ,
t .value_forbidden:n = true ,
c .code:n = \int_set:Nn \l_@@_pos_env_int 1 ,
c .value_forbidden:n = true ,
@@ -2875,6 +2862,7 @@ version 2005/12/01 or later.
fleqn .default:n = true ,
mathindent .dim_set:N = \l_@@_mathindent_dim ,
mathindent .value_required:n = true ,
+ mathindent .initial:n = 25 pt ,
notag .code:n =
\str_if_eq:nnTF { #1 } { true }
{ \clist_clear:N \l_@@_tags_clist }
@@ -2893,39 +2881,77 @@ version 2005/12/01 or later.
\clist_remove_all:Nn \l_@@_tags_clist { first }
\clist_put_left:Nn \l_@@_tags_clist \c_one_int
} ,
- tagged-lines .value_required:n = true
+ tagged-lines .value_required:n = true ,
+% \end{macrocode}
+%
+% Since the version 1.16 of \pkg{witharrows}, no vertical space is added between
+% an |\item| of a LaTeX list and an environment |{DispWithArrows}|. With the
+% option |standard-behaviour-with-items|, it's possible to restore the previous
+% behaviour (which corresponds to the standard behaviour of |{align}| of
+% \pkg{amsmath}).
+% \begin{macrocode}
+ standard-behaviour-with-items .bool_set:N = \l_@@_sbwi_bool ,
+ standard-behaviour-with-items .default:n = true
}
% \end{macrocode}
%
+% \bigskip
+% Now a set of keys which will be used in all the environments (but not in
+% |\WithArrowsOptions}|).
%
+% \begin{macrocode}
+\keys_define:nn { WithArrows / Env }
+ {
+ name .code:n =
+ \seq_if_in:NnTF \g_@@_names_seq { #1 }
+ { \@@_error:n { Duplicate~name } }
+ { \seq_gput_left:Nn \g_@@_names_seq { #1 } }
+ \str_set:Nn \l_@@_name_str { #1 } ,
+ name .value_required:n = true ,
+ CodeBefore .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } ,
+ CodeBefore .value_required:n = true,
+ CodeAfter .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } ,
+ CodeAfter .value_required:n = true
+ }
+% \end{macrocode}
+%
% \bigskip
-% Now, we begin the construction of the set of keys that will be used in the
-% environments |{WithArrows}|.
+% Now, we begin the construction of the major sets of keys which are named
+% ``|WithArrows / WithArrows|'', ``|WithArrows / DispWithArrows|'' and
+% ``|WithArrows / WithArrowsOptions|''. Each of these sets of keys will be
+% completed after.
% \begin{macrocode}
\keys_define:nn { WithArrows }
{
WithArrows .inherit:n =
{
WithArrows / Global ,
- WithArrows / WithArrowsSpecific
- }
+ WithArrows / WithArrowsSpecific ,
+ WithArrows / Env
+ } ,
+ DispWithArrows .inherit:n =
+ {
+ WithArrows / DispWithArrowsSpecific ,
+ WithArrows / Global ,
+ WithArrows / Env ,
+ } ,
+ WithArrowsOptions .inherit:n =
+ {
+ WithArrows / Global ,
+ WithArrows / WithArrowsSpecific ,
+ WithArrows / DispWithArrowsSpecific
+ }
}
% \end{macrocode}
%
% \medskip
% \begin{macrocode}
\keys_define:nn { WithArrows / WithArrows }
- {
- name .tl_set:N = \l_@@_name_str ,
- name .value_required:n = true ,
- CodeBefore .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } ,
- CodeBefore .value_required:n = true,
- CodeAfter .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } ,
- CodeAfter .value_required:n = true ,
- unknown .code:n =
- \@@_sort_seq:N \l_@@_options_WithArrows_seq
- \@@_error:n { Unknown~option~WithArrows }
- }
+ {
+ unknown .code:n =
+ \@@_sort_seq:N \l_@@_options_WithArrows_seq
+ \@@_error:n { Unknown~option~WithArrows }
+ }
% \end{macrocode}
%
% \bigskip
@@ -2935,36 +2961,17 @@ version 2005/12/01 or later.
\seq_set_from_clist:Nn \l_@@_options_WithArrows_seq
{
adjust, b, c, CodeAfter, CodeBefore, CommandName, displaystyle, end-adjust,
- group, groups, i, interline, jot, ll, lr, more-columns, name, rl, rr,
- show-node-names, show-nodes, start-adjust, t, tikz, TikzCode, xoffset, ygap,
- ystart
+ group, groups, i, interline, jot, ll, lr, more-columns, name, no-arrows, rl,
+ rr, show-node-names, show-nodes, start-adjust, t, tikz, TikzCode, xoffset,
+ ygap, ystart
}
% \end{macrocode}
%
-% \bigskip
-% Now, we construct the keys set which will be used in the environments
-% |{DispWithArrows}| and |{DispWithArrows*}|.
-% \begin{macrocode}
-\keys_define:nn { WithArrows }
- {
- DispWithArrows .inherit:n =
- {
- WithArrows / DispWithArrowsSpecific ,
- WithArrows / Global
- }
- }
-% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
\keys_define:nn { WithArrows / DispWithArrows }
{
- name .tl_set:N = \l_@@_name_str ,
- name .value_required:n = true ,
- CodeBefore .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } ,
- CodeBefore .value_required:n = true ,
- CodeAfter .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } ,
- CodeAfter .value_required:n = true ,
unknown .code:n =
\@@_sort_seq:N \l_@@_options_DispWithArrows_seq
\@@_error:n { Unknown~option~DispWithArrows }
@@ -2979,28 +2986,19 @@ version 2005/12/01 or later.
{
allow-multiple-labels, CodeAfter, CodeBefore, CommandName, TikzCode, adjust,
displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
- mathindent, name, nonumber, notag, rl, rr, show-node-names, show-nodes,
- start-adjust, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart
+ mathindent, name, no-arrows, nonumber, notag, rl, rr, show-node-names,
+ show-nodes, start-adjust, tagged-lines, tikz, wrap-lines, xoffset, ygap,
+ ystart
}
% \end{macrocode}
%
-% \bigskip
-% Now, we construct the keys set which will be used with the command |\WithArrowsOptions|.
-% \begin{macrocode}
-\keys_define:nn { WithArrows }
- {
- WithArrowsOptions .inherit:n =
- {
- WithArrows / Global ,
- WithArrows / WithArrowsSpecific ,
- WithArrows / DispWithArrowsSpecific
- }
- }
-% \end{macrocode}
%
% \begin{macrocode}
\keys_define:nn { WithArrows / WithArrowsOptions }
{
+ allow-duplicate-names .code:n =
+ \@@_msg_redirect_name:nn { Duplicate~name } { none } ,
+ allow-duplicate-names .value_forbidden:n = true ,
unknown .code:n =
\@@_sort_seq:N \l_@@_options_WithArrowsOptions_seq
\@@_error:n { Unknown~option~WithArrowsOptions }
@@ -3014,10 +3012,11 @@ version 2005/12/01 or later.
% \begin{macrocode}
\seq_set_from_clist:Nn \l_@@_options_WithArrowsOptions_seq
{
- allow-multiple-labels, b, c, CommandName, more-columns, TikzCode, adjust,
- displaystyle, end-adjust, fleqn, group, groups, i, interline, jot, ll, lr,
- mathindent, nonumber, notag, rl, rr, show-node-names, show-nodes,
- start-adjust, t, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart
+ allow-duplicate-names, allow-multiple-labels, b, c, CommandName,
+ more-columns, TikzCode, adjust, displaystyle, end-adjust, fleqn, group,
+ groups, i, interline, jot, ll, lr, mathindent, no-arrows, nonumber, notag,
+ rl, rr, show-node-names, show-nodes, standard-behaviour-with-items,
+ start-adjust, t, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart
}
% \end{macrocode}
%
@@ -3028,7 +3027,7 @@ version 2005/12/01 or later.
% the field ``status'' of the arrow. Another value of the field ``status'' is
% ``new-group''.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_set_independent:
+\cs_new_protected:Npn \@@_set_independent:
{
\str_if_empty:NTF \l_@@_previous_key_str
{
@@ -3047,7 +3046,7 @@ version 2005/12/01 or later.
% (after the end of the environment |{WithArrows}| or |{DispWithArrows}|). Now,
% we present the keys set for the first pass. The main goal is to extract
% informations which will be necessary during the scan of the arrows. For
-% instance, we have to known if some arrows are ``independent'' or use the
+% instance, we have to know if some arrows are ``independent'' or use the
% option ``new-group''.
% \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / FirstPass }
@@ -3120,7 +3119,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{macrocode}
-\cs_new_protected:Nn \@@_fix_pos_arrow:n
+\cs_new_protected:Npn \@@_fix_pos_arrow:n #1
{
\str_if_empty:NT \l_@@_previous_key_str
{
@@ -3132,9 +3131,9 @@ version 2005/12/01 or later.
%
% \bigskip
% The options of the individual commands |\Arrows| are scanned twice. The second
-% pass is just before the drawing of the arrow. In this set of keys, we don't put
-% an item for the unknown keys because an unknown key would have been already
-% detected during the first pass.
+% pass is just before the drawing of the arrow. In this set of keys, we don't
+% put an item for the unknown keys because an unknown key would have been
+% already detected during the first pass.
%
% \begin{macrocode}
\keys_define:nn {WithArrows / Arrow / SecondPass }
@@ -3281,7 +3280,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{macrocode}
-\cs_new_protected:Nn \@@_Arrow_first_column:
+\cs_new_protected:Npn \@@_Arrow_first_column:
{ \@@_error:n { Arrow~in~first~column } \@@_Arrow }
% \end{macrocode}
%
@@ -3293,7 +3292,7 @@ version 2005/12/01 or later.
% |{WithArrows}| and |{DispWithArrows}|. The argument is the list of options
% given to the environment.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_pre_environment:n
+\cs_new_protected:Npn \@@_pre_environment:n #1
% \end{macrocode}
%
% First the initialisation of |\l_@@_type_env_str| which is the name of the
@@ -3321,6 +3320,33 @@ version 2005/12/01 or later.
% \begin{macrocode}
\str_clear_new:N \l_@@_name_str
% \end{macrocode}
+%
+% \bigskip
+% The parameter |\l_@@_status_arrow_str| will be used to store the ``status'' of
+% an individual arrow. It will be used to fill the field ``status'' in the
+% property list describing an arrow.
+% \begin{macrocode}
+ \str_clear_new:N \l_@@_status_arrow_str
+% \end{macrocode}
+%
+% \bigskip
+% The dimension |\l_@@_x_dim| will be used to compute the $x$-value for some
+% vertical arrows when one of the options |i|, |group| and |groups| (values 5, 6
+% and 7 of |\l_@@_pos_arrow_int|) is used.
+% \begin{macrocode}
+ \dim_zero_new:N \l_@@_x_dim
+% \end{macrocode}
+%
+% \medskip
+% The variable |\l_@@_input_line_str| will be used only to store, for each
+% command |\Arrow| the line (in the TeX file) where the command is issued. This
+% information will be stored in the field ``input-line'' of the arrow. As of
+% now, this information is used only in the error message of a arrow impossible
+% to draw (because it arrives after the last row of the environment).
+% \begin{macrocode}
+ \str_clear_new:N \l_@@_input_line_str
+% \end{macrocode}
+%
%
% The initialisation of the counters |\g_@@_arrow_int| and |\g_@@_line_int|.
% However, we have to save their previous values with the two stacks created for
@@ -3371,6 +3397,13 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% 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_set_false:N \l_@@_in_first_column_bool
+% \end{macrocode}
+%
+% \bigskip
% In (the second column of) |{DispWithArrows}|, it's possible to put several
% labels (for the same number of equation). That's why these labels will be
% stored in a sequence |\l_@@_labels_seq|.
@@ -3379,7 +3412,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
- \@@_bool_new:N \l_@@_tag_next_line_bool
+ \bool_set_false:N \l_@@_tag_next_line_bool
% \end{macrocode}
%
% \bigskip
@@ -3402,7 +3435,8 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% We process the options given to the environment |{WithArrows}| or |{DispWithArrows}|.
+% We process the options given to the environment |{WithArrows}| or
+% |{DispWithArrows}|.
% \begin{macrocode}
\str_clear_new:N \l_@@_previous_key_str
\bool_if:NT \l_@@_in_WithArrows_bool
@@ -3437,6 +3471,12 @@ version 2005/12/01 or later.
% will be |\Arrow|.
% \begin{macrocode}
\cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow
+ \cs_set_eq:NN \notag \@@_notag:
+ \cs_set_eq:NN \nonumber \@@_notag:
+ \cs_set_eq:NN \tag \@@_tag
+ \cs_set_eq:NN \@@_old_label \label
+ \cs_set_eq:NN \label \@@_label:n
+ \cs_set_eq:NN \tagnextline \@@_tagnextline:
}
% \end{macrocode}
% This is the end of |\@@_pre_environment:n|.
@@ -3453,11 +3493,6 @@ version 2005/12/01 or later.
\if_mode_math: \else:
\@@_error:n { WithArrows~outside~math~mode }
\fi:
- \cs_set_eq:NN \notag \@@_notag:
- \cs_set_eq:NN \nonumber \@@_notag:
- \cs_set_eq:NN \tag \@@_tag
- \cs_set_eq:NN \label \@@_label:n
- \cs_set_eq:NN \tagnextline \@@_tagnextline:
% \end{macrocode}
% \bigskip
% The environment begins with a |\vtop|, a |\vcenter| or a
@@ -3599,7 +3634,7 @@ version 2005/12/01 or later.
% The command |\@@_post_environment:| is a code common to the second part of the
% environment |{WithArrows}| and the environment |{DispWithArrows}|.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_post_environment:
+\cs_new_protected:Npn \@@_post_environment:
% \end{macrocode}
%
% \bigskip
@@ -3677,14 +3712,15 @@ version 2005/12/01 or later.
% We give now the definition of |\@@_cr:| which is the definition of |\\| in an
% environment |{WithArrows}|. The two \pkg{expl3} commands
% |\group_align_safe_begin:| and |\group_align_safe_end:| are specifically
-% designed for this purpose: test the token that follows in a |\halign|
+% designed for this purpose: test the token that follows in an |\halign|
% structure.
%
-% First, we remove an eventual token |*| since the commands |\\| and |\\*| are
-% equivalent in an environment |{WithArrows}| (an environment |{WithArrows}|,
-% like an environment |{aligned}| of \pkg{amsmath}, is always unbreakable).
+% First, we remove an eventual token |*| (just after the |\\|: there should not
+% be space between the two) since the commands |\\| and |\\*| are equivalent in
+% an environment |{WithArrows}| (an environment |{WithArrows}|, like an
+% environment |{aligned}| of \pkg{amsmath}, is always unbreakable).
% \begin{macrocode}
-\cs_new_protected:Nn \@@_cr:
+\cs_new_protected:Npn \@@_cr:
{
\scan_stop:
\bool_if:NT \l_@@_in_first_column_bool { & { } }
@@ -3697,7 +3733,7 @@ version 2005/12/01 or later.
% Then, we peek the next token to see if it's a |[|. In this case, the command
% |\\| has an optional argument which is the vertical skip (=glue) to put.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_cr_i:
+\cs_new_protected:Npn \@@_cr_i:
{ \peek_meaning:NTF [ \@@_cr_ii: { \@@_cr_ii: [ \c_zero_dim ] } }
% \end{macrocode}
%
@@ -3761,10 +3797,10 @@ version 2005/12/01 or later.
% |\refstepcounter|.
% \begin{macrocode}
\bool_if:NT \c_@@_hyperref_loaded_bool
- {
- \cs_set:Npn \This@name { equation }
- \hyper@refstepcounter { equation }
- }
+ {
+ \str_set:Nn \This@name { equation }
+ \hyper@refstepcounter { equation }
+ }
% \end{macrocode}
% Then, an action done by \pkg{cleveref} in its redefinition of
% |\refstepcounter|. The package \pkg{cleveref} creates in the |aux| file a
@@ -3772,31 +3808,24 @@ version 2005/12/01 or later.
% informations.
% \begin{macrocode}
\bool_if:NT \c_@@_cleveref_loaded_bool
- {
- \cref@constructprefix { equation } { \cref@result }
- \protected@edef \cref@currentlabel
- {
- [
- \cs_if_exist:NTF \cref@equation@alias
- \cref@equation@alias
- { equation }
- ]
- [ \arabic { equation } ] [ \cref@result ]
- \p@equation \g_tmpa_tl
- }
- }
-% \end{macrocode}
-% Then, an action done by \pkg{typedref} in its redefinition of
-% |\refstepcounter|. The command |\sr@name| is a prefix added to the name of the
-% label by the redefinition of |\label| done by \pkg{typedref}.
-% \begin{macrocode}
- \bool_if:NT \c_@@_typedref_loaded_bool
- { \cs_set:Npn \sr@name { equation } }
+ {
+ \cref@constructprefix { equation } \cref@result
+ \protected@edef \cref@currentlabel
+ {
+ [
+ \cs_if_exist:NTF \cref@equation@alias
+ \cref@equation@alias
+ { equation }
+ ]
+ [ \arabic { equation } ] [ \cref@result ]
+ \p@equation \g_tmpa_tl
+ }
+ }
% \end{macrocode}
% Now, we can issue the command |\label| (some packages 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|).
+% labels (it's possible with \pkg{witharrows} 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
}
@@ -3820,7 +3849,7 @@ version 2005/12/01 or later.
{ \hbox_overlap_left:n \@@_qedhere_i: }
\cs_set_eq:NN \theequation \g_tmpa_tl
\bool_if:NT \l_@@_tag_star_bool
- { \cs_set_eq:NN \tagform@ \prg_do_nothing: }
+ { \cs_set_eq:NN \tagform@ \prg_do_nothing: }
% \end{macrocode}
% We use |\@eqnnum| (we recall that there are two definitions of |\@eqnnum|, a
% standard definition and another, loaded if the class option |leqno| is used).
@@ -3853,7 +3882,7 @@ version 2005/12/01 or later.
\tikz [ @@_standard ]
\coordinate ( \int_use:N \g_@@_line_int - v ) ;
}
- }
+ }
\cr \noalign { \skip_vertical:n { #1 + \l_@@_interline_skip } \scan_stop: }
}
% \end{macrocode}
@@ -3873,7 +3902,7 @@ version 2005/12/01 or later.
% |\@@_if_in_second_col_of_disp:Nn| is the name of the command used in the error
% message and the second is the code to execute.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_if_in_second_col_of_disp:Nn
+\cs_new_protected:Npn \@@_if_in_second_col_of_disp:Nn #1 #2
{
\bool_if:NTF \l_@@_in_WithArrows_bool
{ \@@_error:nn { Not~allowed~in~WithArrows } { #1 } }
@@ -3889,7 +3918,7 @@ version 2005/12/01 or later.
% The command |\@@_notag:| will be linked to |\notag| and |\nonumber| in the
% environments |{WithArrows}| and |{DispWithArrows}|.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_notag:
+\cs_new_protected:Npn \@@_notag:
{ \@@_if_in_second_col_of_disp:Nn \notag { \clist_clear:N \l_@@_tags_clist } }
% \end{macrocode}
%
@@ -3904,7 +3933,7 @@ version 2005/12/01 or later.
\@@_if_in_second_col_of_disp:Nn \tag
{
\tl_if_empty:NF \l_@@_tag_tl
- { \@@_error:nn { Multiple~tags } { #2 } }
+ { \@@_error:nn { Multiple~tags } { #2 } }
\clist_set:Nn \l_@@_tags_clist { all }
\bool_if:nT \c_@@_mathtools_loaded_bool
{
@@ -3936,7 +3965,7 @@ version 2005/12/01 or later.
% \pkg{amsmath}). That's why we store the differents labels of a same line in a
% sequence |\l_@@_labels_seq|.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_label:n
+\cs_new_protected:Npn \@@_label:n #1
{
\@@_if_in_second_col_of_disp:Nn \label
{
@@ -3948,14 +3977,14 @@ version 2005/12/01 or later.
}
\seq_put_right:Nn \l_@@_labels_seq { #1 }
\bool_if:nT \c_@@_mathtools_loaded_bool
- {
- \MH_if_boolean:nT { show_only_refs }
- {
- \cs_if_exist:cTF { MT_r_#1 }
- { \clist_set:Nn \l_@@_tags_clist { all } }
- { \clist_clear:N \l_@@_tags_clist }
- }
- }
+ {
+ \MH_if_boolean:nT { show_only_refs }
+ {
+ \cs_if_exist:cTF { MT_r_#1 }
+ { \clist_set:Nn \l_@@_tags_clist { all } }
+ { \clist_clear:N \l_@@_tags_clist }
+ }
+ }
\bool_if:nT \c_@@_autonum_loaded_bool
{
\cs_if_exist:cTF { autonum@#1Referenced }
@@ -3970,7 +3999,7 @@ version 2005/12/01 or later.
% The command |\@@_tagnextline:| will be linked to |\tagnextline| in the
% environments |{WithArrows}| and |{DispWithArrows}|.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_tagnextline:
+\cs_new_protected:Npn \@@_tagnextline:
{
\@@_if_in_second_col_of_disp:Nn \tagnextline
{ \bool_set_true:N \l_@@_tag_next_line_bool }
@@ -3988,8 +4017,7 @@ version 2005/12/01 or later.
% the package \pkg{amsthm} has been loaded). |\@@_qedhere:| raises the boolean
% |\l_@@_qedhere_bool|.
% \begin{macrocode}
-\bool_new:N \l_@@_qedhere_bool
-\cs_new_protected:Nn \@@_qedhere: { \bool_set_true:N \l_@@_qedhere_bool }
+\cs_new_protected:Npn \@@_qedhere: { \bool_set_true:N \l_@@_qedhere_bool }
% \end{macrocode}
%
% In the third column of the |\halign| of |{DispWithArrows}|, a command
@@ -3997,7 +4025,7 @@ version 2005/12/01 or later.
% 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:
+\cs_new_protected:Npn \@@_qedhere_i:
{
\group_begin:
\cs_set_eq:NN \qed \qedsymbol
@@ -4021,12 +4049,13 @@ version 2005/12/01 or later.
% For the environment |{DispWithArrows}|, the construction is a construction of
% the type:
%
-% |\[\vcenter{\halign to \displaywith {...}}\]|
+% |\[\vcenter{\halign to \displaywidth {...}}\]|
%
% The purpose of the |\vcenter| is to have an environment unbreakable.
%
% \bigskip
% \begin{macrocode}
+\bool_new:N \l_@@_inlabel_bool
\NewDocumentEnvironment { DispWithArrows } { ! O { } }
{
% \end{macrocode}
@@ -4049,40 +4078,88 @@ version 2005/12/01 or later.
}
}
% \end{macrocode}
+%
+% An action done by \pkg{typedref} in its redefinition of |\refstepcounter|. The
+% command |\sr@name| is a prefix added to the name of the label by the
+% redefinition of |\label| done by \pkg{typedref}.
+% \begin{macrocode}
+ \bool_if:NT \c_@@_typedref_loaded_bool { \str_set:Nn \sr@name { equation } }
+% \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@
\bool_set_true:N \l_@@_in_DispWithArrows_bool
\@@_pre_environment:n { #1 }
+% \end{macrocode}
+%
+% Since the version 1.16 of \pkg{witharrows}, no space is added between an
+% |\item| of a LaTeX list and an environment |{DispWithArrows}| except with the
+% option |standard-behaviour-with-items| stored in the boolean
+% |\l_@@_sbwi_bool|. We have to know if we are just after an |\item| and this
+% information will be stored in |\l_@@_inlabel_bool|.
+% \begin{macrocode}
+ \bool_if:NF \l_@@_sbwi_bool
+ {
+ \if@inlabel
+ \bool_set_true:N \l_@@_inlabel_bool
+ \fi
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The token list |\l_@@_tag_tl| will contain the argument of the command |\tag|.
+% \begin{macrocode}
+ \tl_clear_new:N \l_@@_tag_tl
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+ \bool_set_false:N \l_@@_qedhere_bool
+% \end{macrocode}
+%
+% \bigskip
+% The boolean |\l_@@_tag_star_bool| will be raised if the user uses the command
+% |\tag| with a star.
+% \begin{macrocode}
+ \bool_set_false:N \l_@@_tag_star_bool
+% \end{macrocode}
+%
+% \begin{macrocode}
\if_mode_math:
\@@_error:n { DispWithArrows~in~math~mode }
\fi:
% \end{macrocode}
+%
+% \bigskip
+% The construction is not exactly the same wether we are just after an |\item|
+% of a LaTeX list or not. We know if we are after un |\item| thanks to the
+% boolean |\l_@@_inlabel_bool|.
+% \begin{macrocode}
+ \bool_if:NTF \l_@@_inlabel_bool
+ { $ } % $
+ {
+% \end{macrocode}
% We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a
% redefinition of |\[|. However, we put the following lines which are in the
% definition of |\[| even though they are in case of misuse.
% \begin{macrocode}
- \if_mode_vertical:
- \nointerlineskip
- \makebox [ .6 \linewidth ] { }
- \fi:
- $$
+ \if_mode_vertical:
+ \nointerlineskip
+ \hbox_to_wd:nn { .6 \linewidth } { }
+ \fi:
+ $$
+ }
% \end{macrocode}
% We use a |\vcenter| in order to prevent page breaks in the environment.
% \begin{macrocode}
- \vcenter \bgroup
+ \bool_if:NTF \l_@@_inlabel_bool \vtop \vcenter \bgroup
\spread@equation
\bool_if:NTF \l_@@_fleqn_bool
{ \tabskip = \c_zero_skip }
{ \tabskip = 0 pt plus 1000 pt minus 1000 pt }
- \cs_set_eq:NN \@@_old_label \label
- \cs_set_eq:NN \notag \@@_notag:
- \cs_set_eq:NN \nonumber \@@_notag:
- \cs_set_eq:NN \tag \@@_tag
- \cs_set_eq:NN \label \@@_label:n
- \cs_set_eq:NN \tagnextline \@@_tagnextline:
- \halign to \displaywidth
+ \halign to \bool_if:NTF \l_@@_inlabel_bool \linewidth \displaywidth
\bgroup
\int_gincr:N \g_@@_line_int
\cs_set_eq:cN \l_@@_CommandName_str \@@_Arrow_first_column:
@@ -4097,7 +4174,7 @@ version 2005/12/01 or later.
\tabskip = \c_zero_skip
&
\clist_if_in:NVT \l_@@_tags_clist \g_@@_line_int
- { \clist_set:Nn \l_@@_tags_clist { all } }
+ { \clist_set:Nn \l_@@_tags_clist { all } }
% \end{macrocode}
% The command |\qedhere| of \pkg{amsthm} is redefined here.
% \begin{macrocode}
@@ -4136,16 +4213,22 @@ version 2005/12/01 or later.
]
;
\bool_if:NT \l_@@_show_node_names_bool
- {
- \hbox_overlap_right:n
- { \small wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int }
- }
+ {
+ \hbox_overlap_right:n
+ { \small wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int }
+ }
&
- ##
+% \end{macrocode}
+%
+% We put now the contents of the third column in math mode because because we
+% don't want an error if the user uses a third column with contents in math
+% mode: the error will be in the next cell.
+% \begin{macrocode}
+ $ ## $
\tabskip = \c_zero_skip
&&
\@@_error:n { Third~column~in~DispWithArrows }
- \iffalse ## \fi
+ \bool_if:nT \c_false_bool { ## }
\cr
}
% \end{macrocode}
@@ -4179,17 +4262,17 @@ version 2005/12/01 or later.
\dim_gset_eq:NN \g_@@_right_x_dim \c_max_dim
\begin { tikzpicture } [ @@_standard ]
\int_step_variable:nNn \g_@@_line_int \l_tmpa_int
- {
- \cs_if_free:cTF
- { pgf@sh@ns@wa - \l_@@_prefix_str - \l_tmpa_int - v }
- { \@@_error:n { Inexistent~v-node } }
- {
- \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v )
- \dim_set:Nn \l_tmpa_dim \pgf@x
- \dim_compare:nNnT \l_tmpa_dim < \g_@@_right_x_dim
- { \dim_gset:Nn \g_@@_right_x_dim \l_tmpa_dim }
- }
- }
+ {
+ \cs_if_free:cTF
+ { pgf@sh@ns@wa - \l_@@_prefix_str - \l_tmpa_int - v }
+ { \@@_error:n { Inexistent~v-node } }
+ {
+ \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v )
+ \dim_set:Nn \l_tmpa_dim \pgf@x
+ \dim_compare:nNnT \l_tmpa_dim < \g_@@_right_x_dim
+ { \dim_gset:Nn \g_@@_right_x_dim \l_tmpa_dim }
+ }
+ }
\end { tikzpicture }
}
% \end{macrocode}
@@ -4207,7 +4290,11 @@ version 2005/12/01 or later.
% \begin{macrocode}
\bool_if:nT \c_@@_mathtools_loaded_bool
{ \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: }
- $$
+ \bool_if:NTF \l_@@_inlabel_bool
+ { $ % $
+ \skip_vertical:N \belowdisplayskip
+ }
+ { $$ }
% \end{macrocode}
%
% \bigskip
@@ -4225,12 +4312,12 @@ version 2005/12/01 or later.
% don't put |\begin{DispWithArrows}| and |\end{DispWithArrows}| because there is
% a |\@currenvir| in some error messages.
% \begin{macrocode}
-\NewDocumentEnvironment { DispWithArrows* } {}
- {
- \WithArrowsOptions { notag }
- \DispWithArrows
- }
- { \endDispWithArrows }
+\NewDocumentEnvironment { DispWithArrows* } { }
+ {
+ \WithArrowsOptions { notag }
+ \DispWithArrows
+ }
+ \endDispWithArrows
% \end{macrocode}
%
%
@@ -4239,8 +4326,8 @@ version 2005/12/01 or later.
% \bigskip
% 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 If the option |group| or the option |groups| is used, all the arrows of
+% a group 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.
@@ -4253,26 +4340,22 @@ version 2005/12/01 or later.
% 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_arrow_int = 7
+\cs_new_protected:Npn \@@_scan_arrows:
+ {
+ \group_begin:
+ \int_compare:nNnT \l_@@_pos_arrow_int = 7
{
\@@_scan_arrows_i:
\int_set:Nn \l_@@_pos_arrow_int 8
}
- \@@_scan_arrows_i:
- \group_end:
- }
+ \@@_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
-% ``independent''.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_scan_arrows_i:
+\cs_new_protected:Npn \@@_scan_arrows_i:
{
% \end{macrocode}
%
@@ -4283,22 +4366,30 @@ version 2005/12/01 or later.
% 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_@@_first_arrows_seq| will be 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 know 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
+% |\l_@@_last_arrows_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
+ \seq_clear_new:N \l_@@_first_arrows_seq
+ \seq_clear_new:N \l_@@_last_arrows_seq
+% \end{macrocode}
+%
+% \medskip
+% The boolean |\l_@@_new_group_bool| is a switch that we will use the indicate
+% that a group is finished (and the lines of that group have to be drawn). This
+% boolean is not directed connected to the option |new-group| of an individual
+% arrow.
+% \begin{macrocode}
\bool_set_true:N \l_@@_new_group_bool
% \end{macrocode}
%
@@ -4313,9 +4404,8 @@ version 2005/12/01 or later.
%
% \bigskip
% We extract from the property list of the current arrow the fields ``initial'',
-% ``final'' and ``position'' and we store these values in |\l_@@_initial_int|,
-% |\l_@@_final_int| and |\l_@@_pos_of_arrow_int|. However, we have to do a
-% conversion because the components of a property list are token lists.
+% ``final'', ``status'' and ``input-line''. For the two former, we have to do
+% conversions to integers.
% \begin{macrocode}
\prop_get:cnN
{ g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
@@ -4334,67 +4424,99 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% If the arrow arrives 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). The arrow will be completely
+% We recall that, after the construction of the |\halign|, |\g_@@_line_int| is
+% the total number of lines of the environment. Therefore, the conditionnal
+% |\l_@@_final_int > \g_@@_line_int| tests wether an arrow arrives after the
+% last line of the environment. In this case, we raise an error (except in the
+% second step of treatment for the option |group|). The arrow will be completely
% ignored, even for the computation of |\l_@@_x_dim|.
% \begin{macrocode}
\int_compare:nNnTF \l_@@_final_int > \g_@@_line_int
- { \@@_error:n { Too~few~lines~for~an~arrow } }
+ {
+ \int_compare:nNnF \l_@@_pos_arrow_int = 8
+ { \_@@_error:n { Too~few~lines~for~an~arrow } }
+ }
+ \@@_code_for_possible_arrow:
+% \end{macrocode}
+%
+% \bigskip
+% Incrementation of the index of the loop (and end of the loop).
+% \begin{macrocode}
+ \int_incr:N \l_@@_arrow_int
+ }
+% \end{macrocode}
+%
+% \bigskip
+% After the last arrow of the environment, we have to draw the last group of
+% arrows. If we are in option |group| and in the first step of treatment
+% (|\l_@@_pos_arrow_int| = 7), we don't draw because, in the first step, we
+% don't draw anything. If there is no arrow in the group, we don't draw (this
+% situation occurs when all the arrows of the potential group arrives after the
+% last line of the environment).
+% \begin{macrocode}
+ \bool_if:nT
+ {
+ \int_compare_p:n { \l_@@_pos_arrow_int != 7 }
+ &&
+ \int_compare_p:nNn \l_@@_first_arrow_of_group_int > 0
+ }
+ { \@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int }
+ }
% \end{macrocode}
%
% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_code_for_possible_arrow:
+ {
+% \end{macrocode}
% We test if the previous arrow was in fact the last arrow of a group. In this
-% case, we have to draw all the arrows of that group, except if you are with the
+% case, we have to draw all the arrows of that group, except if we are with the
% option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = 7).
% \begin{macrocode}
- {
- \bool_if:nT
- {
- \int_compare_p:nNn \l_@@_arrow_int > 1
- &&
- ( \int_compare_p:n
- { \l_@@_initial_int > \l_@@_last_line_of_group_int }
- &&
- \int_compare_p:n { \l_@@_pos_arrow_int != 7 }
- ||
- \str_if_eq_p:Vn \l_@@_status_arrow_str { new-group }
- )
- }
- {
- \int_compare:nNnF \l_@@_first_arrow_of_group_int = 0
- {
- \@@_draw_arrows:nn
- \l_@@_first_arrow_of_group_int
- { \l_@@_arrow_int - 1 }
- }
- \bool_set_true:N \l_@@_new_group_bool
- }
+ \bool_if:nT
+ {
+ \int_compare_p:nNn \l_@@_arrow_int > \c_one_int
+ &&
+ ( \int_compare_p:n { \l_@@_initial_int > \l_@@_last_line_of_group_int }
+ &&
+ \int_compare_p:n { \l_@@_pos_arrow_int != 7 }
+ ||
+ \str_if_eq_p:Vn \l_@@_status_arrow_str { new-group }
+ )
+ }
+ {
+ \int_compare:nNnF \l_@@_first_arrow_of_group_int = \c_zero_int
+ {
+ \@@_draw_arrows:nn
+ \l_@@_first_arrow_of_group_int
+ { \l_@@_arrow_int - 1 }
+ }
+ \bool_set_true:N \l_@@_new_group_bool
+ }
% \end{macrocode}
%
-% \bigskip
+% \bigskip
% 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 the following variables: |\l_@@_first_arrow_int|,
+% arrows. In fact, we have to begin a new group in three circonstancies: if we
+% are at the first arrow of the environment (that's why the flag is raised
+% before the beginning of the loop), if we have just finished a group (that's
+% why the flag is raised in the previous conditionnal, for topological reasons
+% or if the previous arrows had the status ``new-group''). 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|.
+% |\l_@@_first_arrows_seq|, |\l_@@_last_arrows_seq|.
%
% \begin{macrocode}
- \bool_if:nTF \l_@@_new_group_bool
- {
- \bool_set_false:N \l_@@_new_group_bool
- \int_set_eq:NN \l_@@_first_arrow_of_group_int \l_@@_arrow_int
- \int_set_eq:NN \l_@@_first_line_of_group_int \l_@@_initial_int
- \int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int
- \seq_clear:N \l_@@_first_arrows_of_group_seq
- \seq_put_left:NV \l_@@_first_arrows_of_group_seq
- \l_@@_arrow_int
- \seq_clear:N \l_@@_last_arrows_of_group_seq
- \seq_put_left:NV \l_@@_last_arrows_of_group_seq
- \l_@@_arrow_int
+ \bool_if:nTF \l_@@_new_group_bool
+ {
+ \bool_set_false:N \l_@@_new_group_bool
+ \int_set_eq:NN \l_@@_first_arrow_of_group_int \l_@@_arrow_int
+ \int_set_eq:NN \l_@@_first_line_of_group_int \l_@@_initial_int
+ \int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int
+ \seq_clear:N \l_@@_first_arrows_seq
+ \seq_put_left:NV \l_@@_first_arrows_seq \l_@@_arrow_int
+ \seq_clear:N \l_@@_last_arrows_seq
+ \seq_put_left:NV \l_@@_last_arrows_seq \l_@@_arrow_int
% \end{macrocode}
%
% If we are in option |group| and in the second step of treatment
@@ -4402,45 +4524,42 @@ version 2005/12/01 or later.
% 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_arrow_int != 8 }
- { \dim_set:Nn \l_@@_x_dim { - \c_max_dim } }
- }
+ \int_compare:nT { \l_@@_pos_arrow_int != 8 }
+ { \dim_set:Nn \l_@@_x_dim { - \c_max_dim } }
+ }
% \end{macrocode}
%
% \bigskip
-% If we are not at the beginning of a new group, we actualize
-% |\l_@@_last_line_of_group_int|. If the arrow is independent, we don't take
-% into account this arrow for the detection of the end of the group.
+% If we are not at the beginning of a new group.
% \begin{macrocode}
- {
- \bool_if:nF
- { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
- {
- \int_compare:nT
- { \l_@@_initial_int = \l_@@_first_line_of_group_int }
- {
- \seq_put_left:NV \l_@@_first_arrows_of_group_seq
- \l_@@_arrow_int
- }
- \int_compare:nTF
- { \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:NV \l_@@_last_arrows_of_group_seq
- \l_@@_arrow_int
- }
- {
- \int_compare:nNnT
- \l_@@_final_int = \l_@@_last_line_of_group_int
- {
- \seq_put_left:NV \l_@@_last_arrows_of_group_seq
- \l_@@_arrow_int
- }
- }
- }
- }
+ {
+% \end{macrocode}
+%
+% If the arrow is independent, we don't take into account this arrow for the
+% detection of the end of the group.
+% \begin{macrocode}
+ \bool_if:nF
+ { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
+ {
+% \end{macrocode}
+% If the arrow is not independant, the arrow belongs to the current group and we
+% have to take it into account in some variables.
+% \begin{macrocode}
+ \int_compare:nT
+ { \l_@@_initial_int = \l_@@_first_line_of_group_int }
+ { \seq_put_left:NV \l_@@_first_arrows_seq \l_@@_arrow_int }
+ \int_compare:nNnTF \l_@@_final_int > \l_@@_last_line_of_group_int
+ {
+ \int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int
+ \seq_clear:N \l_@@_last_arrows_seq
+ \seq_put_left:NV \l_@@_last_arrows_seq \l_@@_arrow_int
+ }
+ {
+ \int_compare:nNnT \l_@@_final_int = \l_@@_last_line_of_group_int
+ { \seq_put_left:NV \l_@@_last_arrows_seq \l_@@_arrow_int }
+ }
+ }
+ }
% \end{macrocode}
%
% \bigskip
@@ -4450,48 +4569,31 @@ version 2005/12/01 or later.
% 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}
- \bool_if:nF
- { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
- {
- \int_compare:nT { \l_@@_pos_arrow_int != 8 }
- { \@@_update_x:nn \l_@@_initial_int \l_@@_final_int }
- }
- }
-% \end{macrocode}
-%
-% \bigskip
-% Incrementation of the index of the loop (and end of the loop).
-% \begin{macrocode}
- \int_incr:N \l_@@_arrow_int
- }
-% \end{macrocode}
-%
-% \bigskip
-% After the last arrow of the environment, we have to draw the last group of
-% arrows. If we are in option |group| and in the first step of treatment
-% (|\l_@@_pos_arrow_int| = 7), we don't draw because, in the first step, we
-% don't draw anything.
-% \begin{macrocode}
- \int_compare:nT { \l_@@_pos_arrow_int != 7 }
- { \@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int }
+ \bool_if:nF { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
+ {
+ \int_compare:nT { \l_@@_pos_arrow_int != 8 }
+ { \@@_update_x:nn \l_@@_initial_int \l_@@_final_int }
+ }
}
% \end{macrocode}
%
+%
% \bigskip
% The following code is necessary because we will have to expand an argument
% exactly 3 times.
% \begin{macrocode}
\cs_generate_variant:Nn \keys_set:nn { n o }
-\cs_new_protected:Nn \@@_keys_set:
+\cs_new_protected:Npn \@@_keys_set:
{ \keys_set_known:no { WithArrows / Arrow / SecondPass } }
% \end{macrocode}
%
% \bigskip
% The macro |\@@_draw_arrows:nn| draws all the arrows whose numbers are between
% |#1| and |#2|. |#1| and |#2| must be expressions that expands to an integer
-% (they are expanded in the beginning of the macro).
+% (they are expanded in the beginning of the macro). This macro is nullified by
+% the option |no-arrows|.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_draw_arrows:nn
+\cs_new_protected:Npn \@@_draw_arrows:nn #1 #2
{
\group_begin:
\int_zero_new:N \l_@@_first_arrow_int
@@ -4545,7 +4647,7 @@ version 2005/12/01 or later.
% 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_protected:Nn \@@_draw_arrows_i:
+\cs_new_protected:Npn \@@_draw_arrows_i:
{
\group_begin:
% \end{macrocode}
@@ -4573,7 +4675,8 @@ version 2005/12/01 or later.
{
0 { \bool_set_true:N \l_@@_final_r_bool }
2 { \bool_set_true:N \l_@@_initial_r_bool }
- 3 {
+ 3
+ {
\bool_set_true:N \l_@@_initial_r_bool
\bool_set_true:N \l_@@_final_r_bool
}
@@ -4585,9 +4688,9 @@ version 2005/12/01 or later.
% \begin{tabular}{l}
% \begin{tabular}{@{}l*8c@{}}
% \toprule
-% option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\
+% option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\
% \midrule
-% |\l_@@_pos_arrow_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\
+% |\l_@@_pos_arrow_int| & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ \\
% \bottomrule
% \end{tabular} \\
% \footnotesize The option |v| can be used only in |\Arrow| in |CodeAfter| (see
@@ -4602,10 +4705,10 @@ version 2005/12/01 or later.
% option |group| or the option |groups| is used).
% \begin{macrocode}
\int_compare:nNnT \l_@@_pos_arrow_int = 5
- {
- \dim_set:Nn \l_@@_x_dim { - \c_max_dim }
- \@@_update_x:nn \l_@@_initial_int \l_@@_final_int
- }
+ {
+ \dim_set:Nn \l_@@_x_dim { - \c_max_dim }
+ \@@_update_x:nn \l_@@_initial_int \l_@@_final_int
+ }
% \end{macrocode}
%
% \bigskip
@@ -4615,9 +4718,12 @@ version 2005/12/01 or later.
% $x$-value --- but always the same $y$-value). Idem for |\l_@@_final_tl|.
% \begin{macrocode}
\tl_set:Nx \l_@@_initial_tl
- { \int_use:N \l_@@_initial_int - \bool_if:NTF \l_@@_initial_r_bool rl .south }
+ {
+ \int_use:N \l_@@_initial_int - \bool_if:NTF \l_@@_initial_r_bool rl
+ .south
+ }
\tl_set:Nx \l_@@_final_tl
- { \int_use:N \l_@@_final_int - \bool_if:NTF \l_@@_final_r_bool rl .north }
+ { \int_use:N \l_@@_final_int - \bool_if:NTF \l_@@_final_r_bool rl .north }
% \end{macrocode}
% We use ``|.south|'' and ``|.north|'' because we want a small gap between two
% consecutive arrows (and the Tikz nodes created have the shape of small
@@ -4635,26 +4741,26 @@ version 2005/12/01 or later.
% \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
+% |\l_@@_first_arrows_seq| the list of all the arrows starting at the
+% first line of the group and in |\l_@@_last_arrows_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 }
+ \seq_if_in:NxTF \l_@@_first_arrows_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_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_arrow_int = 5
- {
- \bool_set_true:N \l_tmpa_bool
- \bool_set_true:N \l_tmpb_bool
- }
+ {
+ \bool_set_true:N \l_tmpa_bool
+ \bool_set_true:N \l_tmpb_bool
+ }
% \end{macrocode}
%
% \bigskip
@@ -4672,26 +4778,26 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\begin { tikzpicture } [ @@_standard ]
- \tikz@scan@one@point \pgfutil@firstofone ( \l_@@_initial_tl )
- \tl_gset:Nx \g_tmpa_tl
- {
- \int_compare:nNnTF \l_@@_pos_arrow_int < 5
- { \dim_use:N \pgf@x }
- { \dim_use:N \l_@@_x_dim } ,
- \bool_if:NTF \l_tmpa_bool
- { \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_arrow_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 }
- }
+ \tikz@scan@one@point \pgfutil@firstofone ( \l_@@_initial_tl )
+ \tl_gset:Nx \g_tmpa_tl
+ {
+ \int_compare:nNnTF \l_@@_pos_arrow_int < 5
+ { \dim_use:N \pgf@x }
+ { \dim_use:N \l_@@_x_dim } ,
+ \bool_if:NTF \l_tmpa_bool
+ { \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_arrow_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}
%
@@ -4729,7 +4835,7 @@ version 2005/12/01 or later.
% That's why we create a function |\@@_def_function_tmpa:n| which will create
% the function |\@@_tmpa:nnn|.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_def_function_tmpa:n
+\cs_new_protected:Npn \@@_def_function_tmpa:n #1
{
\cs_set:Npn \@@_tmpa:nnn ##1 ##2 ##3
{
@@ -4748,7 +4854,7 @@ version 2005/12/01 or later.
% When we draw the arrow (with |\@@_draw_arrow:nnn|), we first create the
% function |\@@_tmpa:nnn| and, then, we use the function |\@@_tmpa:nnn| :
% \begin{macrocode}
-\cs_new_protected:Nn \@@_draw_arrow:nnn
+\cs_new_protected:Npn \@@_draw_arrow:nnn #1 #2 #3
{
% \end{macrocode}
%
@@ -4805,11 +4911,11 @@ version 2005/12/01 or later.
% |\l_tmpa_dim|).
% \begin{macrocode}
\tl_if_empty:NF \g_tmpa_tl
- {
- \dim_set:Nn \l_tmpb_dim \g_tmpa_tl
- \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
- { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
- }
+ {
+ \dim_set:Nn \l_tmpb_dim \g_tmpa_tl
+ \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
+ { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
+ }
% \end{macrocode}
% Now, we can put the label with the right value for ``|text width|''.
% \begin{macrocode}
@@ -4830,16 +4936,16 @@ version 2005/12/01 or later.
% (for options |group| and |groups|) and in |\@@_draw_arrows:nn| (for option
% |i|).
% \begin{macrocode}
-\cs_new_protected:Nn \@@_update_x:nn
+\cs_new_protected:Npn \@@_update_x:nn #1 #2
{
\int_step_inline:nnn { #1 } { #2 }
- {
- \begin { tikzpicture } [ @@_standard ]
- \tikz@scan@one@point \pgfutil@firstofone ( ##1 - l )
- \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \l_@@_x_dim \pgf@x }
- \end { tikzpicture }
- \dim_set_eq:NN \l_@@_x_dim \g_tmpa_dim
- }
+ {
+ \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 }
+ \end { tikzpicture }
+ \dim_set_eq:NN \l_@@_x_dim \g_tmpa_dim
+ }
}
% \end{macrocode}
%
@@ -4886,7 +4992,7 @@ version 2005/12/01 or later.
unknown .code:n =
\@@_sort_seq:N \l_@@_options_Arrow_CodeAfter_seq
\@@_error:n { Unknown~option~Arrow~in~CodeAfter }
- }
+ }
% \end{macrocode}
%
% \bigskip
@@ -4894,7 +5000,7 @@ version 2005/12/01 or later.
% will be used in the error messages and can be modified dynamically.
% \begin{macrocode}
\seq_set_from_clist:Nn \l_@@_options_Arrow_CodeAfter_seq
- { ll, lr, rl, rr, tikz, TikzCode, v, x, offset }
+ { ll, lr, rl, rr, tikz, TikzCode, v, x, offset }
% \end{macrocode}
%
% \bigskip
@@ -4975,7 +5081,7 @@ version 2005/12/01 or later.
% |CodeAfter| is executed.
%
% \begin{macrocode}
-\cs_new_protected:Nn \@@_MultiArrow:nn
+\cs_new_protected:Npn \@@_MultiArrow:nn #1 #2
{
% \end{macrocode}
% The user of the command |\MultiArrow| (in |CodeAfter|) will be able to specify
@@ -4996,26 +5102,26 @@ version 2005/12/01 or later.
% the maximum.
% \begin{macrocode}
\int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 }
- { \@@_error:n { Too~small~specification~for~MultiArrow } }
- {
- \clist_sort:Nn \g_tmpa_clist
- {
- \int_compare:nTF { ##1 > ##2 }
- \sort_return_swapped:
- \sort_return_same:
- }
+ { \@@_error:n { Too~small~specification~for~MultiArrow } }
+ {
+ \clist_sort:Nn \g_tmpa_clist
+ {
+ \int_compare:nTF { ##1 > ##2 }
+ \sort_return_swapped:
+ \sort_return_same:
+ }
% \end{macrocode}
% We extract the minimum in |\l_tmpa_tl| (it must be an integer but we store it
% in a token list of \pkg{expl3}).
% \begin{macrocode}
- \clist_pop:NN \g_tmpa_clist \l_tmpa_tl
+ \clist_pop:NN \g_tmpa_clist \l_tmpa_tl
% \end{macrocode}
%
% We extract the maximum in |\l_tmpb_tl|. The remaining list (in
% |\g_tmpa_clist|) will be sorted in decreasing order but never mind...
% \begin{macrocode}
- \clist_reverse:N \g_tmpa_clist
- \clist_pop:NN \g_tmpa_clist \l_tmpb_tl
+ \clist_reverse:N \g_tmpa_clist
+ \clist_pop:NN \g_tmpa_clist \l_tmpb_tl
% \end{macrocode}
%
% We draw the teeth of the rak (except the first one and the last one) with the
@@ -5024,41 +5130,41 @@ version 2005/12/01 or later.
% the last teeth of the rak can't be drawn the same way as the others (think,
% for example, to the case of the option ``|rounded corners|'' is used).
% \begin{macrocode}
- \exp_args:NV \@@_MultiArrow_i:n \g_tmpa_clist
+ \exp_args:NV \@@_MultiArrow_i:n \g_tmpa_clist
% \end{macrocode}
%
% Now, we draw the rest of the structure.
% \begin{macrocode}
- \begin { tikzpicture }
- [
- @@_standard ,
- every~path /.style = { WithArrows / arrow }
- ]
- \draw [<->] ([xshift = \l_@@_xoffset_dim]\l_tmpa_tl-r.south)
- -- ++(5mm,0)
- -- node (@@_label) {}
- ([xshift = \l_@@_xoffset_dim+5mm]\l_tmpb_tl-r.south)
- -- ([xshift = \l_@@_xoffset_dim]\l_tmpb_tl-r.south) ;
- \tikz@parse@node \pgfutil@firstofone (@@_label.west)
- \dim_set:Nn \l_tmpa_dim { 20 cm }
- \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ;
- \tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl }
- \bool_if:nT { \l_@@_wrap_lines_bool && \l_@@_in_DispWithArrows_bool }
- {
- \dim_set:Nn \l_tmpb_dim
- { \g_@@_right_x_dim - \pgf@x - 0.3333 em }
- \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
- { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
- }
- \path (@@_label.west)
- node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ;
- \end{tikzpicture}
+ \begin { tikzpicture }
+ [
+ @@_standard ,
+ every~path / .style = { WithArrows / arrow }
+ ]
+ \draw [<->] ([xshift = \l_@@_xoffset_dim]\l_tmpa_tl-r.south)
+ -- ++(5mm,0)
+ -- node (@@_label) {}
+ ([xshift = \l_@@_xoffset_dim+5mm]\l_tmpb_tl-r.south)
+ -- ([xshift = \l_@@_xoffset_dim]\l_tmpb_tl-r.south) ;
+ \tikz@parse@node \pgfutil@firstofone (@@_label.west)
+ \dim_set:Nn \l_tmpa_dim { 20 cm }
+ \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ;
+ \tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl }
+ \bool_if:nT { \l_@@_wrap_lines_bool && \l_@@_in_DispWithArrows_bool }
+ {
+ \dim_set:Nn \l_tmpb_dim
+ { \g_@@_right_x_dim - \pgf@x - 0.3333 em }
+ \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
+ { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
+ }
+ \path (@@_label.west)
+ node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ;
+ \end{tikzpicture}
}
- }
+ }
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new_protected:Nn \@@_MultiArrow_i:n
+\cs_new_protected:Npn \@@_MultiArrow_i:n #1
{
\begin {tikzpicture }
[
@@ -5085,10 +5191,10 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn { Value~for~a~key }
- {
- The~key~'\l_keys_key_tl'~should~be~used~without~value. \\
- However,~you~can~go~on~for~this~time.
- }
+ {
+ The~key~'\l_keys_key_tl'~should~be~used~without~value. \\
+ However,~you~can~go~on~for~this~time.
+ }
% \end{macrocode}
%
% \begin{macrocode}
@@ -5166,14 +5272,14 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn { Third~column~in~WithArrows }
- {
- By~default,~an~environment~\{\l_@@_type_env_str\}~can~only~have~
- two~columns.~Maybe~you~have~forgotten~a~
- \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~
- two~columns,~you~should~use~the~option~'more-columns'~at~a~global~
- level~or~for~an~environment. \\
- However,~you~can~go~one~for~this~time.
- }
+ {
+ By~default,~an~environment~\{\l_@@_type_env_str\}~can~only~have~
+ two~columns.~Maybe~you~have~forgotten~a~
+ \c_backslash_str\c_backslash_str.~If~you~really~want~more~than~
+ two~columns,~you~should~use~the~option~'more-columns'~at~a~global~
+ level~or~for~an~environment. \\
+ However,~you~can~go~one~for~this~time.
+ }
% \end{macrocode}
%
% \begin{macrocode}
@@ -5188,14 +5294,14 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn { Negative~jump }
- {
- You~can't~use~a~negative~value~for~the~option~'jump'~of~command~
- \l_@@_string_Arrow_for_msg_str\
- in~the~row~\int_use:N \g_@@_line_int\
- of~your~environment~\{\l_@@_type_env_str\}.~
- You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\
- \c_@@_option_ignored_str
- }
+ {
+ You~can't~use~a~negative~value~for~the~option~'jump'~of~command~
+ \l_@@_string_Arrow_for_msg_str\
+ in~the~row~\int_use:N \g_@@_line_int\
+ of~your~environment~\{\l_@@_type_env_str\}.~
+ You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\
+ \c_@@_option_ignored_str
+ }
% \end{macrocode}
%
% \begin{macrocode}
@@ -5212,28 +5318,29 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn
- { Too~few~lines~for~an~arrow }
- { Line~\l_@@_input_line_str\
- :~an~arrow~specified~in~the~row~\int_use:N \l_@@_initial_int\
- of~your~environment~\{\l_@@_type_env_str\}~can't~be~drawn~
- because~it~arrives~after~the~last~row~of~the~environment. \\
- If~you~go~on,~this~arrow~will~be~ignored.
- }
+ { Too~few~lines~for~an~arrow }
+ { Line~\l_@@_input_line_str\
+ :~an~arrow~specified~in~the~row~\int_use:N \l_@@_initial_int\
+ of~your~environment~\{\l_@@_type_env_str\}~can't~be~drawn~
+ because~it~arrives~after~the~last~row~of~the~environment. \\
+ If~you~go~on,~this~arrow~will~be~ignored.
+ }
% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { WithArrows~outside~math~mode }
- {
- The~environment~\{\l_@@_type_env_str\}~should~be~used~only~in~math~mode. \\
- Nevertheless,~you~can~go~on.
- }
+ {
+ The~environment~\{\l_@@_type_env_str\}~should~be~used~only~in~math~mode~
+ like~the~environment~\{aligned\}~of~amsmath. \\
+ Nevertheless,~you~can~go~on.
+ }
% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { DispWithArrows~in~math~mode }
{
- The~environment~\{\l_@@_type_env_str\}~should~be~used~only~
- outside~math~mode. \\
+ The~environment~\{\l_@@_type_env_str\}~should~be~used~only~outside~math~
+ mode~like~the~environment~\{align\}~of~amsmath. \\
If~you~go~on,~you~will~have~other~errors.
}
% \end{macrocode}
@@ -5291,7 +5398,8 @@ version 2005/12/01 or later.
draw~an~arrow~going~to~it~self~from~the~line~'#1'.~This~is~not~possible. \\
If~you~go~on,~this~command~will~be~ignored.
}
-%
+% \end{macrocode}
+%
% \begin{macrocode}
\@@_msg_new:nn { Wrong~line~specification~in~MultiArrow }
{
@@ -5340,11 +5448,11 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn { Multiple~tags }
- {
- You~can't~use~twice~the~command~\token_to_str:N\tag\
- in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\
- If~you~go~on,~the~tag~'#1'~will~be~used.
- }
+ {
+ You~can't~use~twice~the~command~\token_to_str:N\tag\
+ in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\
+ If~you~go~on,~the~tag~'#1'~will~be~used.
+ }
% \end{macrocode}
%
%
@@ -5384,12 +5492,13 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn { Option~xoffset~forbidden }
- { You~can't~use~the~option~'xoffset'~in~the~command~
+ {
+ You~can't~use~the~option~'xoffset'~in~the~command~
\l_@@_string_Arrow_for_msg_str\
while~you~are~using~the~option~
' \int_compare:nNnTF \l_@@_pos_arrow_int = 7
- { group }
- { groups } '. \\
+ { group }
+ { groups } '. \\
\c_@@_option_ignored_str
}
% \end{macrocode}
@@ -5403,56 +5512,31 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \WithArrowsNewStyle { m m }
{
- \keys_if_exist:nnTF { WithArrows / WithArrows } { #1 }
+ \keys_if_exist:nnTF { WithArrows / Global } { #1 }
{ \@@_error:nn { Key~already~defined } { #1 } }
{
- \keys_define:nn { WithArrows / WithArrows }
- {
- #1 .code:n =
- {
- \keys_define:nn { WithArrows / WithArrows }
- { unknown .code:n = \prg_do_nothing: }
- \keys_set:nn { WithArrows / WithArrows } { #2 }
- \keys_define:nn { WithArrows / WithArrows }
- { unknown .code:n =
- \@@_error:n { Unknown~option~WithArrows }}
- }
- }
- \seq_put_right:Nn \l_@@_options_WithArrows_seq {#1}
- \keys_define:nn { WithArrows / DispWithArrows }
- {
- #1 .code:n =
- {
- \keys_define:nn { WithArrows / DispWithArrows }
- { unknown .code:n = \prg_do_nothing: }
- \keys_set:nn { WithArrows / DispWithArrows } { #2 }
- \keys_define:nn {WithArrows / DispWithArrows }
- { unknown .code:n =
- \@@_error:n { Unknown~option~DispWithArrows }}
- }
- }
- \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { #1 }
- \keys_define:nn { WithArrows / WithArrowsOptions }
- {
- #1 .code:n =
- { \keys_set:nn { WithArrows / WithArrowsOptions } { #2 } }
- }
- \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { #1 }
+ \keys_define:nn { WithArrows / Global }
+ {
+ #1 .code:n =
+ { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } }
+ }
+ \seq_put_right:Nn \l_@@_options_WithArrows_seq {#1}
+ \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { #1 }
+ \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { #1 }
% \end{macrocode}
% We now set the options in a TeX group in order to detect if some keys in |#2|
% are unknown. If a key is unknown, an error will be raised. However, the key
-% will, even so, be stored in the definition of key~|#1|. When the key~|#1| will
-% be used, the error will be raised again.
+% will, even so, be stored in the definition of key~|#1|.
% \begin{macrocode}
- \group_begin:
- \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions }
- {
- The~option~'\l_keys_key_tl'~can't~be~set~in~the~
- definition~of~a~style. \\
- If~you~go~on,~this~key~will~not~be~written~in~the~style~'#1'.
- }
- \WithArrowsOptions { #2 }
- \group_end:
+ \group_begin:
+ \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions }
+ {
+ The~option~'\l_keys_key_tl'~can't~be~set~in~the~
+ definition~of~a~style.~You~can~go~on~for~this~time~
+ but~you~should~suppress~this~key.
+ }
+ \WithArrowsOptions { #2 }
+ \group_end:
}
}
% \end{macrocode}
@@ -5503,18 +5587,18 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_const:Nn \c_@@_tikz_code_down_tl
{
- \draw [ rounded~corners ]
- let \p1 = (#1) ,
- \p2 = (#2)
- in (\p1) -- (\x1,\y2) --
- node {
- \dim_set:Nn \l_tmpa_dim { \x1 - \x2 }
- \begin { varwidth } \l_tmpa_dim
- \raggedright
- #3
- \end { varwidth }
- }
- (\p2) ;
+ \draw [ rounded~corners ]
+ let \p1 = (#1) ,
+ \p2 = (#2)
+ in (\p1) -- (\x1,\y2) --
+ node {
+ \dim_set:Nn \l_tmpa_dim { \x1 - \x2 }
+ \begin { varwidth } \l_tmpa_dim
+ \raggedright
+ #3
+ \end { varwidth }
+ }
+ (\p2) ;
}
% \end{macrocode}
%
@@ -5531,45 +5615,47 @@ version 2005/12/01 or later.
% \bigskip
% \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / SecondPass }
- {
- up .code:n = \str_if_empty:NT \l_@@_previous_key_str
- {
- \str_set:Nn \l_@@_previous_key_str { up }
- \bool_if:NTF \c_@@_varwidth_loaded_bool
- {
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \int_set:Nn \l_@@_pos_arrow_int \c_one_int
+ {
+ up .code:n =
+ \str_if_empty:NT \l_@@_previous_key_str
+ {
+ \str_set:Nn \l_@@_previous_key_str { up }
+ \bool_if:NTF \c_@@_varwidth_loaded_bool
+ {
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
+ {
+ \int_set:Nn \l_@@_pos_arrow_int \c_one_int
% \end{macrocode}
% We have to set |\l_@@_wrap_lines_bool| to |false| because, otherwise, if the
% option |wrap_lines| is used at a higher level (global or environment), we will
% have a special affectation to |TikzCode| that will overwrite our affectation.
% \begin{macrocode}
- \bool_set_false:N \l_@@_wrap_lines_bool
- \tl_set_eq:NN \l_@@_tikz_code_tl
- \c_@@_tikz_code_up_tl
- }
- { \@@_error:n { calc~not~loaded } }
- }
- { \@@_error:n { varwidth~not~loaded } }
- } ,
- down .code:n = \str_if_empty:NT \l_@@_previous_key_str
- {
- \str_set:Nn \l_@@_previous_key_str { down }
- \bool_if:NTF \c_@@_varwidth_loaded_bool
- {
- \cs_if_exist:cTF { tikz@library@calc@loaded }
- {
- \int_set:Nn \l_@@_pos_arrow_int \c_one_int
- \bool_set_false:N \l_@@_wrap_lines_bool
- \tl_set_eq:NN \l_@@_tikz_code_tl
- \c_@@_tikz_code_down_tl
- }
- { \@@_error:n { calc~not~loaded } }
- }
- { \@@_error:n { varwidth~not~loaded } }
- }
- }
+ \bool_set_false:N \l_@@_wrap_lines_bool
+ \tl_set_eq:NN \l_@@_tikz_code_tl
+ \c_@@_tikz_code_up_tl
+ }
+ { \@@_error:n { calc~not~loaded } }
+ }
+ { \@@_error:n { varwidth~not~loaded } }
+ } ,
+ down .code:n =
+ \str_if_empty:NT \l_@@_previous_key_str
+ {
+ \str_set:Nn \l_@@_previous_key_str { down }
+ \bool_if:NTF \c_@@_varwidth_loaded_bool
+ {
+ \cs_if_exist:cTF { tikz@library@calc@loaded }
+ {
+ \int_set:Nn \l_@@_pos_arrow_int \c_one_int
+ \bool_set_false:N \l_@@_wrap_lines_bool
+ \tl_set_eq:NN \l_@@_tikz_code_tl
+ \c_@@_tikz_code_down_tl
+ }
+ { \@@_error:n { calc~not~loaded } }
+ }
+ { \@@_error:n { varwidth~not~loaded } }
+ }
+ }
% \end{macrocode}
%
% \begin{macrocode}
@@ -5597,6 +5683,23 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \begin{macrocode}
+\@@_msg_new:nnn { Duplicate~name }
+ {
+ The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
+ the~same~environment~name~twice.~You~can~go~on,~but,~
+ maybe,~you~will~have~incorrect~results. \\
+ For~a~list~of~the~names~already~used,~type~H~<return>. \\
+ If~you~don't~want~to~see~this~message~again,~use~the~option~
+ 'allow-duplicate-names'.
+ }
+ {
+ The~names~already~defined~in~this~document~are:~
+ \seq_use:Nnnn \g_@@_names_seq { ,~ } { ,~ } { ~and~ }.
+ }
+% \end{macrocode}
+%
+%
% \section{History}
%
% \subsection*{Changes between versions 1.0 and 1.1}
@@ -5746,6 +5849,18 @@ version 2005/12/01 or later.
% possible to externalize the Tikz elements constructed by \pkg{witharrows}
% because they use the options |overlay| and |remember picture|.}
%
+% \subsection*{Changes between 1.15 et 1.16}
+%
+% Option |no-arrows|
+%
+% The behaviour of |{DispWithArrows}| after an |\item| of a LaTeX list has been
+% changed : no vertical is added. The previous behaviour can be restored with
+% the option |standard-behaviour-with-items|.
+%
+% A given name can no longer be used for two distinct environments. However,
+% it's possible to deactivate this control with the option
+% |allow-duplicate-names|.
+%
% \endinput
% Local Variables:
% TeX-fold-mode: nil