diff options
author | Karl Berry <karl@freefriends.org> | 2019-07-25 21:48:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-07-25 21:48:26 +0000 |
commit | ec3a1bbf576519b69cf12fcc14267ade3068da69 (patch) | |
tree | f6a524640176a5d507f2dd8d79f7794a26c11957 /Master/texmf-dist/source | |
parent | 6f54e9bce9a4265696b1c53257542ebbb8a3222d (diff) |
witharrows (25jul19)
git-svn-id: svn://tug.org/texlive/trunk@51728 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/witharrows/witharrows.dtx | 982 |
1 files changed, 727 insertions, 255 deletions
diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx index c9b463ca716..f814d93b32b 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.17} -\def\myfiledate{2019/07/09} +\def\myfileversion{1.18} +\def\myfiledate{2019/07/24} % % %<*batchfile> @@ -44,11 +44,11 @@ version 2005/12/01 or later. \endgroup %</batchfile> % -%<@@=wa> +%<@@=wi> %<*driver> \documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by witharrows) \usepackage{xltxtra} -\usepackage{geometry} +\usepackage[xetex]{geometry} \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} \usepackage[footnotehyper]{witharrows} \usetikzlibrary{calc} @@ -61,6 +61,7 @@ version 2005/12/01 or later. \def\emphase{\bgroup\color{RoyalPurple}\let\next=} \fvset{commandchars=\~\#\@,formatcom={\color{gray}}} \DeclareMathOperator{\re}{Re} +\skip \footins = 2 \bigskipamount \parindent 0pt \DisableCrossrefs \begin{document} @@ -75,6 +76,15 @@ version 2005/12/01 or later. % % \maketitle % +% \hypersetup{ +% pdfinfo = { +% Title = { The extension 'witharrows' }, +% Subject = { A LaTeX extension } , +% Author = { F. Pantigny } +% } +% } +% +% % \begin{abstract} % The LaTeX package \pkg{witharrows} provides environments |{WithArrows}| and % |{DispWithArrows}| similar to the environments |{aligned}| and |{align}| of @@ -98,7 +108,7 @@ version 2005/12/01 or later. % \begin{Verbatim} % $\begin{WithArrows} % A & = (a+1)^2 ~emphase#\Arrow{we expand}@ \\ -% & = a^2 + 2a + 1 +% & = a^2 + 2a + 1 % don't put \\ here % \end{WithArrows}$ % \end{Verbatim} % @@ -117,9 +127,9 @@ version 2005/12/01 or later. % % \medskip % The environment |{WithArrows}| bears similarities with the environment -% |{aligned}| of |amsmath| (and |mathtools|). The extension \pkg{witharrows} +% |{aligned}| of \pkg{amsmath} (and |mathtools|). The extension \pkg{witharrows} % also provides an environment |{DispWithArrows}| which is similar to the -% environment |{align}| of |amsmath|: cf. p. \pageref{DispWithArrows}. +% environment |{align}| of \pkg{amsmath}: cf. p. \pageref{DispWithArrows}. % % % \section{Options for the shape of the arrows} @@ -164,7 +174,7 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \interitem -% The option |xoffset| shifts the arrows to the right (we usually don't want the +% The option |xoffset| shifts the arrow to the right (we usually don't want the % arrows to be stucked on the text). The default value of |xoffset| is $3$~mm. % \begin{Verbatim} % $\begin{WithArrows} @@ -217,7 +227,7 @@ version 2005/12/01 or later. % % \interitem % It's also possible to suppress both tips of the arrow with the Tikz option -% |-|. +% ``|-|''. % \begin{Verbatim} % $\begin{WithArrows} % A & = (a+1)^2 \Arrow[~emphase#tikz=-@]{very classical} \\ @@ -247,7 +257,7 @@ version 2005/12/01 or later. % % \smallskip % In fact, it's possible to change more drastically the shape or the arrows with -% the option |tikz-code| (presented p.~\pageref{tikz-code}. +% the option |tikz-code| (presented p.~\pageref{tikz-code}). % % \interitem % It's possible to use the Tikz option ``|text width|'' to control the width of @@ -323,16 +333,16 @@ version 2005/12/01 or later. % % \medskip % If we want exactly the same result as previously, we have to give to the -% option |font| the value |{\itshape\small\bfseries}|. +% option |font| the value |\itshape\small\bfseries|. % % % \interitem -% Almost all the options can be given directly between square brackets to the -% environment |{WithArrows}|. \textbf{There must be no space before the opening -% bracket (|[|) of the options of the environment.} The options apply to all the -% arrows of the environment.\footnote{They also apply to the nested environments -% |{WithArrows}| (with the logical exceptions of |interline|, |code-before| and -% |code-after|).} +% The options can be given directly between square brackets to the environment +% |{WithArrows}|. There must be no space between the |\begin{WithArrows}| and +% the opening bracket (|[|) of the options of the environment. Such options +% apply to all the arrows of the environment.\footnote{They also apply to the +% nested environments |{WithArrows}| (with the logical exceptions of +% |interline|, |code-before| and |code-after|).} % % % \begin{Verbatim} % $\begin{WithArrows}[~emphase#tikz=blue@] @@ -457,7 +467,7 @@ version 2005/12/01 or later. % % % \interitem -% The environment |{WithArrows}| gives also two options |code-before| and +% The environment |{WithArrows}| provides also two options |code-before| and % |code-after|\footnote{For historical reasons, there are aliases for these % options: |CodeBefore| and |CodeAfter|.} for LaTeX code that will be executed % at the beginning and at the end of the environment. These options are not @@ -519,9 +529,9 @@ version 2005/12/01 or later. % k & \;\le\; & t & \;\le\; & k+1 \\ % \frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} % \Arrow{we can integrate the inequalities since $k \leq k+1$ } \\ -% \int\limits_k^{k+1} \frac{\text{d} t}{k+1} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{t} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{k} \\ +% \int\limits_k^{k+1} \frac{d t}{k+1} +% & \le & \int\limits_k^{k+1} \frac{dt}{t} +% & \le & \int\limits_k^{k+1} \frac{dt}{k} \\ % \frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} % \end{DispWithArrows*} % \end{Verbatim} @@ -532,9 +542,9 @@ version 2005/12/01 or later. % k & \;\le\; & t & \;\le\; & k+1 \\ % \frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} % \Arrow{we can integrate the inequalities since $k \leq k+1$ } \\ -% \int\limits_k^{k+1} \frac{\text{d} t}{k+1} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{t} -% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{k} \\ +% \int\limits_k^{k+1} \frac{d t}{k+1} +% & \le & \int\limits_k^{k+1} \frac{dt}{t} +% & \le & \int\limits_k^{k+1} \frac{dt}{k} \\ % \frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} % \end{DispWithArrows*} % @@ -568,7 +578,7 @@ version 2005/12/01 or later. % on the right side of the array. These nodes will be called \emph{right nodes}. % % By default, the arrows use the right nodes. We will say that they are in |rr| -% mode ($r$ for \emph{right}). These arrows are |vertical| (we will say that an +% mode ($r$ for \emph{right}). These arrows are vertical (we will say that an % arrow is \emph{vertical} when its two ends have the same abscissa). % % @@ -882,7 +892,7 @@ version 2005/12/01 or later. % % \smallskip % \begin{Verbatim} -% On pose\enskip $~emphase#\left\{@ +% Let's set\enskip $~emphase#\left\{@ % \begin{WithArrows}[~emphase#c@] % f(x) & = 3x^3+2x^2-x+4 % \Arrow[tikz=-]{both are polynoms}\\ @@ -892,7 +902,7 @@ version 2005/12/01 or later. % \end{Verbatim} % % -% On pose\enskip $\left\{ +% Let's set\enskip $\left\{ % \begin{WithArrows}[c] % f(x) & = 3x^3+2x^2-x+4 % \Arrow[tikz=-]{both are polynoms}\\ @@ -1197,7 +1207,8 @@ version 2005/12/01 or later. % nodes: % \begin{itemize} % \item the command |\WithArrowsLastEnv| gives the number of the last -% environment of level~$0$; +% environment of level~$0$ (\emph{i.e.} which is not included in another +% environnment of the package \pkg{witharrows}); % % \item a name can be given to a given environment with the option |name| and, % in this case, the nodes created in the environment will have aliases @@ -1313,9 +1324,9 @@ version 2005/12/01 or later. % \label{DispWithArrows} % % As previously said, the environment |{WithArrows}| bears similarities with the -% environment |{aligned}| of |amsmath| (and |mathtools|). This extension also +% environment |{aligned}| of \pkg{amsmath} (and |mathtools|). This extension also % provides an environment |{DispWithArrows}| which is similar to the -% environments |{align}| and |{flalign}| of |amsmath|. +% environments |{align}| and |{flalign}| of \pkg{amsmath}. % % \medskip % The environment |{DispWithArrows}| must be used \emph{outside} math mode. Like @@ -1434,18 +1445,52 @@ version 2005/12/01 or later. % more space on the right of the equations for the arrows) while still centering % the classical equations. % -% \bigskip -% If the package \pkg{amsmath} is loaded, it's possible to use the environment -% |{subequations}| and the command |\intertext| in the environments -% |{DispWithArrows}| and |{DispWithArrows*}| (and even the |\intertext| of -% \pkg{nccmath} if this package is loaded). -% +% \medskip % If the option |leqno| is used as a class option, the labels will be composed % on the left also for the environments |{DispWithArrows}| and % |{DispWithArrows*}|.\footnote{The package \pkg{amsmath} has an option |leqno| % but \pkg{witharrows}, of course, is not aware of that option: \pkg{witharrows} % only checks the option |leqno| of the document class.} % +% \medskip +% If the package \pkg{amsmath} is loaded, it's possible to use the command +% |\intertext| in the environments |{DispWithArrows}|. It's also possible to use +% the environment |{subequations}|. However, there is, for the environments +% |{DispWithArrows}| an option |subequations| to encapsulate the environment in +% an environment |{subequations}|. +% +% \medskip +% In the following example, the key |{subequations}| is fixed by the command +% |\WithArrowsOptions|. Each environment |{DispWithArrows}| will subnumerated +% (in the scope of the |\WithArrowsOptions|) +% \begin{Verbatim} +% ~emphase#\WithArrowsOptions{subequations}@ +% First environment. +% \begin{DispWithArrows} +% A & = B \\ +% & = C +% \end{DispWithArrows} +% Second environment. +% \begin{DispWithArrows} +% D & = E \\ +% & = F +% \end{DispWithArrows} +% \end{Verbatim} +% % +% \begin{scope} +% \WithArrowsOptions{subequations} +% First environment. +% \begin{DispWithArrows} +% A & = B \\ +% & = C +% \end{DispWithArrows} +% Second environment. +% \begin{DispWithArrows} +% D & = E \\ +% & = F +% \end{DispWithArrows} +% \end{scope} +% % \bigskip % If there is not enough space to put the tag at the end of a line, there is no % automatic positioning of the label on the next line (as in the environments of @@ -1591,9 +1636,84 @@ version 2005/12/01 or later. % It is not compatible with \pkg{showkeys} (not all the labels are shown). % % -% \section{Advanced features} % % +% \subsection{The option <...> of DispWithArrows} +% +% The environment |{DispWithArrows}| provides an option |left-brace|. When present, +% the value of this option is composed on the left, followed by a curly brace +% (hence the name) and the body of the environment.\footnote{The option +% |left-brace| can also be used without value: in this case, only the brace is drawn...} +% +% For lisibility, this option |left-brace| is also available with a special +% syntax: it's possible to give this option between angle brackets +% (\verb|<| and \verb|>|) just after \verb|{DispWithArrows}| (before the optional +% arguments between square brackets). +% +% \bigskip +% The following code is an example of multi-case equations.\footnote{The +% environment |{cases}| of \pkg{amsmath} is a way to compose such multi-cases +% equations. However, it's not possible to use the automatic numbering of +% equations with this environment. The environment |{numcases}| of the extension +% \pkg{cases} (written by Donald Arseneau) provides this possibility but, of +% course, it's not possible to draw arrows with this extension.} +% +% \medskip +% +% \begin{BVerbatim} +% \begin{DispWithArrows}~emphase#< \binom{n}{p} = >@[format = ll,fleqn,displaystyle] +% 0 & \quad \text{if } p > n +% \Arrow{if fact, it's a special case\\ of the following one} \\ +% \frac{n(n-1)\cdots(n-p+1)}{p!} & \quad \text{if } 0 \leq p \leq n \\ +% 0 & \quad \text{if } p < 0 +% \end{DispWithArrows} +% \end{BVerbatim} +% % +% \begin{DispWithArrows}< \binom{n}{p} = >[format = ll,fleqn,displaystyle] +% 0 & \quad \text{if } p > n +% \Arrow{if fact, it's a special case\\ of the following one} \\ +% \frac{n(n-1)\cdots(n-p+1)}{p!} & \quad \text{if } 0 \leq p \leq n \\ +% 0 & \quad \text{if } p < 0 +% \end{DispWithArrows} +% +% \interitem +% It's possible to use the environment |{subequations}| of \pkg{amsmath}. +% +% \begin{Verbatim} +% \begin{subequations} +% \label{system} +% \begin{DispWithArrows}< (\ref*{system}) \Leftrightarrow >[format = l] +% x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ +% xy+xz+yz=-2 \\ +% xyz = -15 \label{last-equation} +% \end{DispWithArrows} +% \end{subequations} +% \end{Verbatim} +% % +% \begin{subequations} +% \label{system} +% \begin{DispWithArrows}< (\ref*{system}) \Leftrightarrow >[format = l] +% x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ +% xy+xz+yz=-2 \\ +% xyz = -15 \label{last-equation} +% \end{DispWithArrows} +% \end{subequations} +% +% \bigskip +% The whole system is the equation \eqref{system} (this reference has been coded +% by |\eqref{system}|) whereas the last equation is the equation +% \eqref{last-equation} (this reference has been coded by +% |\eqref{last-equation}|). The command |\ref*| used in the code above is +% provided by \pkg{hyperref}. It's a variant of |\ref| which doesn't create +% interactive link. +% +% \bigskip +% With the option \verb|replace-curly-brace-by|, it's possible to replace the +% left curly brace can be replaced by another extensible delimiter. +% +% \bigskip +% \section{Advanced features} +% % \subsection{The option tikz-code : how to change the shape of the arrows} % % \label{tikz-code} @@ -1869,9 +1989,12 @@ version 2005/12/01 or later. % % \subsection{\textbackslash MoveEqLeft} % -% It's possible to use |\MoveEqLeft| of \pkg{mathtools} (if we don't want -% ampersand on the first line): -% % +% It's possible to use |\MoveEqLeft| of \pkg{mathtools}. Don't forget that +% |\MoveEqLeft| has also the value of an ampersand (|&|). That's important for the +% placement of an eventual command |\Arrow|. +% +% +% % \begin{Verbatim}[formatcom=\small\color{gray}] % $\begin{WithArrows}[interline=0.5ex] % ~emphase#\MoveEqLeft@ \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} @@ -2262,6 +2385,11 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_msg_new:nnn { \msg_new:nnnn { witharrows } } \cs_new_protected:Npn \@@_msg_redirect_name:nn { \msg_redirect_name:nnn { witharrows } } +\cs_new_protected:Npn \@@_error:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \@@_warning:n { \msg_error:nn { witharrows } } +\cs_new_protected:Npn \@@_fatal:n { \msg_fatal:nn { witharrows } } +\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { witharrows } } +\cs_generate_variant:Nn \@@_error:nn { n x } % \end{macrocode} % % \medskip @@ -2272,7 +2400,7 @@ version 2005/12/01 or later. footnote .bool_gset:N = \g_@@_footnote_bool , footnotehyper .bool_gset:N = \g_@@_footnotehyper_bool , unknown .code:n = - \msg_fatal:nn { witharrows } { Option~unknown~for~package } + \@@_fatal:n { Option~unknown~for~package } } % \end{macrocode} % @@ -2298,7 +2426,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { Option~incompatible~with~Beamer } { The~option~'\l_keys_key_tl'\ is~incompatible~ - with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. + with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. } % \end{macrocode} % @@ -2309,7 +2437,8 @@ version 2005/12/01 or later. footnotehyper~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~ within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnotehyper. + of~the~package~footnotehyper.\\ + If~you~go~on,~the~package~footnote~won't~be~loaded. } % \end{macrocode} % @@ -2320,7 +2449,8 @@ version 2005/12/01 or later. footnote~has~already~been~loaded.~ If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~ within~the~environments~of~witharrows~will~be~extracted~with~the~tools~ - of~the~package~footnote. + of~the~package~footnote.\\ + If~you~go~on,~the~package~footnotehyper~won't~be~loaded. } % \end{macrocode} % @@ -2329,12 +2459,12 @@ version 2005/12/01 or later. \bool_if:NT \g_@@_footnote_bool { \@ifclassloaded { beamer } - { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } - { } - \@ifpackageloaded { footnotehyper } - { \msg_fatal:nn { witharrows } { footnote~with~footnotehyper~package } } - { } - \usepackage { footnote } + { \msg_info:nn { witharrows } { Option~incompatible~with~Beamer } } + { + \@ifpackageloaded { footnotehyper } + { \@@_error:n { footnote~with~footnotehyper~package } } + { \usepackage { footnote } } + } } % \end{macrocode} % @@ -2342,12 +2472,12 @@ version 2005/12/01 or later. \bool_if:NT \g_@@_footnotehyper_bool { \@ifclassloaded { beamer } - { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } } - { } - \@ifpackageloaded { footnote } - { \msg_fatal:nn { witharrows } { footnotehyper~with~footnote~package } } - { } - \usepackage { footnotehyper } + { \@@_info:n { Option~incompatible~with~Beamer } } + { + \@ifpackageloaded { footnote } + { \@@_error:n { footnotehyper~with~footnote~package } } + { \usepackage { footnotehyper } } + } \bool_gset_true:N \g_@@_footnote_bool } % \end{macrocode} @@ -2380,11 +2510,6 @@ version 2005/12/01 or later. % \bigskip % \subsection{Some technical definitions} % -% \begin{macrocode} -\cs_new_protected:Npn \@@_error:n { \msg_error:nn { witharrows } } -\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { witharrows } } -\cs_generate_variant:Nn \@@_error:nn { n x } -% \end{macrocode} % % \begin{macrocode} \cs_generate_variant:Nn \tl_put_right:Nn { N v } @@ -2403,7 +2528,7 @@ version 2005/12/01 or later. \clist_map_inline:nn { amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels, - typedref, varwidth + typedref, unicode-math, varwidth } { \bool_new:c { c_@@_#1_loaded_bool } @@ -2449,6 +2574,25 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% The following command converts each item of a sequence from |tl| to |str|. It +% will be used when creating list of keys (a key name is always a |str|). +% \begin{macrocode} +\cs_new_protected:Npn \@@_convert_to_str_seq:N #1 + { + \seq_clear:N \l_tmpa_seq + \seq_map_inline:Nn #1 + { + \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } } + } + \seq_set_eq:NN #1 \l_tmpa_seq + } +\cs_new_protected:Npn \@@_set_seq_of_str_from_clist:Nn #1 #2 + { + \seq_set_from_clist:Nn #1 { #2 } + \@@_convert_to_str_seq:N #1 + } +% \end{macrocode} % % \bigskip % The command |\@@_save:N| saves a \pkg{expl3} variable by creating a global @@ -2574,6 +2718,21 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The option |subequations| is an option which uses the environment +% |{subequations}| of \pkg{amsmath}. That's why, if \pkg{amsmath} is loaded, we +% add the key |subequations| to the list of the keys available in +% |\WithArrowsOptions| and |{DispWithArrows}|. +% \begin{macrocode} +\AtBeginDocument + { + \bool_if:NTF \c_@@_amsmath_loaded_bool + { + \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { subequations } + \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { subequations } + } +% \end{macrocode} +% +% \bigskip % In order to increase the interline in the environments |{WithArrows}|, % |{DispWithArrows}|, etc., we will use the command |\spread@equation| of % \pkg{amsmath}. When used, this command becomes no-op (in the current TeX @@ -2585,11 +2744,8 @@ version 2005/12/01 or later. % \pkg{amsmath} is not loaded (we put the code in a |\AtBeginDocument| because % the flag |\c_@@_amsmath_loaded_bool| is itself set in a |\AtBeginDocument|). % \begin{macrocode} -\AtBeginDocument - { - \bool_if:NF \c_@@_amsmath_loaded_bool { - \cs_set_protected:Npn \spread@equation + \cs_new_protected:Npn \spread@equation { \openup \jot \cs_set_eq:NN \spread@equation \prg_do_nothing: @@ -2599,12 +2755,9 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% For the construction of the preambles of the environments |{WithArrows}| and -% |{DispWithArrows}|, we will have to insert the token |#| (catcode 6). We put it -% in a \emph{toks register} of TeX (with no equivalent in \pkg{expl3}). % \begin{macrocode} -\newtoks \@@_parameter_token -\@@_parameter_token = { # } +\tl_new:N \l_@@_left_brace_tl +\tl_set_eq:NN \l_@@_left_brace_tl \c_novalue_tl % \end{macrocode} % % \bigskip @@ -2679,6 +2832,7 @@ version 2005/12/01 or later. % \item |\g_@@_col_int| to count the column of the |\halign|. % \end{itemize} % +% % These counters will be incremented in a cell of the |\halign| and, therefore, % the incrementation must be global. However, we want to be able to include a % |{WithArrows}| in another |{WithArrows}|. To do so, we must restore the @@ -2769,8 +2923,7 @@ version 2005/12/01 or later. \bool_new:N \l_@@_final_r_bool \tl_new:N \l_@@_initial_tl \tl_new:N \l_@@_final_tl -\int_new:N \l_@@_nb_of_columns_int -\bool_new:N \l_@@_last_col_bool +\int_new:N \l_@@_nb_cols_int % \end{macrocode} % % \bigskip @@ -2782,7 +2935,12 @@ version 2005/12/01 or later. \str_new:N \l_@@_format_str % \end{macrocode} % -% +% \bigskip +% The option boolean corresponds to the option |subequations|. +% \begin{macrocode} +\bool_new:N \l_@@_subequations_bool +% \end{macrocode} +% % \bigskip % \subsection{The definition of the options} % @@ -2904,11 +3062,7 @@ version 2005/12/01 or later. 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 .meta:n = { start-adjust = #1 , end-adjust = #1 } , adjust .value_required:n = true , % \end{macrocode} % @@ -2916,7 +3070,7 @@ version 2005/12/01 or later. % 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 code-after''. +% nullification of |\@@_draw_arrow:nnn| is for ``Arrow in |code-after|''. % \begin{macrocode} no-arrows .code:n = \cs_set_eq:NN \@@_draw_arrows:nn \use_none:nn @@ -2942,6 +3096,26 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The following list of the (left) extensible delimiters of LaTeX is only for +% the validation of the key |replace-left-brace-by|. +% \begin{macrocode} +\clist_new:N \c_@@_extensible_delimiters_clist +\clist_set:Nn \c_@@_extensible_delimiters_clist + { + \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor + } +\AtBeginDocument + { + \bool_if:nT + { \c_@@_amsmath_loaded_bool || \use:c { c_@@_unicode-math_loaded_bool } } + { + \clist_put_right:Nn \c_@@_extensible_delimiters_clist { \lvert, \lVert } + } + } +% \end{macrocode} +% +% +% \bigskip % Now a set of keys specific to the environments |{DispWithArrows}| and % |{DispWithArrows*}| (and not |{WithArrows}|). Despite its name, this set of % keys will also be used in |\WithArrowsOptions|. @@ -2958,6 +3132,23 @@ version 2005/12/01 or later. { \clist_clear:N \l_@@_tags_clist } { \clist_set:Nn \l_@@_tags_clist { all } } , notag .default:n = true , +% \end{macrocode} +% Since the option |subequations| is an option which insert the environment +% |{DispWithArrows}| in an environment |{subequations}| of \pkg{amsmath}, we +% must test whether the package \pkg{amsmath} is loaded. +% \begin{macrocode} + subequations .code:n = + \bool_if:NTF \c_@@_amsmath_loaded_bool + { \bool_set_true:N \l_@@_subequations_bool } + { + \@@_error:n { amsmath~not~loaded } + \group_begin: + \globaldefs = 1 + \@@_msg_redirect_name:nn { amsmath~not~loaded } { info } + \group_end: + } , + subequations .default:n = true , + subequations .value_forbidden:n = true , nonumber .meta:n = notag , allow-multiple-labels .code:n = \@@_msg_redirect_name:nn { Multiple~labels } { none } , @@ -2972,6 +3163,15 @@ version 2005/12/01 or later. \clist_put_left:Nn \l_@@_tags_clist \c_one_int } , tagged-lines .value_required:n = true , + replace-left-brace-by .code:n = + { + \clist_if_in:NnTF + \c_@@_extensible_delimiters_clist + { #1 } + { \tl_set:Nn \l_@@_replace_left_brace_by_tl { #1 } } + { \@@_error:n { Bad~value~for~replace~brace~by } } + } , + replace-left-brace-by .initial:n = \lbrace , % \end{macrocode} % % Since the version 1.16 of \pkg{witharrows}, no vertical space is added between @@ -2985,6 +3185,7 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \bigskip % Now a set of keys which will be used in all the environments (but not in % |\WithArrowsOptions}|). @@ -2993,10 +3194,15 @@ version 2005/12/01 or later. \keys_define:nn { WithArrows / Env } { name .code:n = - \seq_if_in:NnTF \g_@@_names_seq { #1 } +% \end{macrocode} +% First, we convert the value in a |str| because the list of the names will be a +% list of |str|. +% \begin{macrocode} + \str_set:Nn \l_tmpa_str { #1 } + \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str { \@@_error:n { Duplicate~name } } - { \seq_gput_left:Nn \g_@@_names_seq { #1 } } - \str_set:Nn \l_@@_name_str { #1 } , + { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str } + \str_set_eq:NN \l_@@_name_str \l_tmpa_str , name .value_required:n = true , code-before .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } , code-before .value_required:n = true, @@ -3004,34 +3210,21 @@ version 2005/12/01 or later. code-after .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } , code-after .value_required:n = true , CodeAfter .meta:n = { code-after = #1 } , - format .code:n = \@@_set_option_format:n { #1 }, + format .code:n = + \tl_if_empty:nTF { #1 } + { \@@_error:n { Invalid~option~format } } + { + \regex_match:nnTF { \A[rcl]*\Z } { #1 } + { \tl_set:Nn \l_@@_format_str { #1 } } + { \@@_error:n { Invalid~option~format } } + } , format .value_required:n = true , } % \end{macrocode} % -% \medskip -% An option |format| should contain only the letters |r|, |c| and |l|. That's -% why we write a function to validate and set the value given to |format|. -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_option_format:n #1 - { - \bool_set_true:N \l_tmpa_bool - \str_map_inline:nn { #1 } - { - \str_if_in:nnF {rcl} { ##1 } - { - \bool_set_false:N \l_tmpa_bool - \@@_error:n { Invalid~option~format } - \str_map_break: - } - } - \bool_if:NT \l_tmpa_bool { \tl_set:Nn \l_@@_format_str { #1 } } - } -% \end{macrocode} -% % % \bigskip -% Now, we begin the construction of the major sets of keys which are named +% Now, we begin the construction of the major sets of keys, named % ``|WithArrows / WithArrows|'', ``|WithArrows / DispWithArrows|'' and % ``|WithArrows / WithArrowsOptions|''. Each of these sets of keys will be % completed after. @@ -3061,17 +3254,23 @@ version 2005/12/01 or later. % % % \bigskip -% A sequence of the options available in |{WithArrows}|. This sequence will be -% used in the error messages and can be modified dynamically. +% A sequence of |str| for the options available in |{WithArrows}|. This sequence +% will be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_WithArrows_seq -\seq_set_from_clist:Nn \l_@@_options_WithArrows_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_WithArrows_seq { - adjust, b, c, code-after, code-before, command-name, displaystyle, end-adjust, - format, group, groups, i, interline, jot, ll, lr, more-columns, name, - no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz, - tikz-code, xoffset, ygap, ystart + adjust, b, c, code-after, code-before, command-name, + displaystyle, end-adjust, + format, group, groups, i, + interline, jot, ll, + lr, more-columns, name, + no-arrows, rl, rr, + show-node-names, show-nodes, start-adjust, + t, tikz, tikz-code, + xoffset, ygap, ystart } +\@@_convert_to_str_seq:N \l_@@_options_WithArrows_seq % \end{macrocode} % % \medskip @@ -3088,6 +3287,7 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { WithArrows / DispWithArrows } { + left-brace .tl_set:N = \l_@@_left_brace_tl , unknown .code:n = \@@_sort_seq:N \l_@@_options_DispWithArrows_seq \@@_error:n { Unknown~option~DispWithArrows } @@ -3099,13 +3299,13 @@ version 2005/12/01 or later. % be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_DispWithArrows_seq -\seq_set_from_clist:Nn \l_@@_options_DispWithArrows_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_DispWithArrows_seq { allow-multiple-labels, code-after, code-before, command-name, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot, - ll, lr, mathindent, name, no-arrows, nonumber, notag, rl, rr, - show-node-names, show-nodes, start-adjust, tagged-lines, tikz, wrap-lines, - xoffset, ygap, ystart + left-brace, ll, lr, mathindent, name, no-arrows, nonumber, notag, + replace-left-brace-by, rl, rr, show-node-names, show-nodes, start-adjust, + tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart } % \end{macrocode} % @@ -3128,7 +3328,7 @@ version 2005/12/01 or later. % will be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_WithArrowsOptions_seq -\seq_set_from_clist:Nn \l_@@_options_WithArrowsOptions_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_WithArrowsOptions_seq { allow-duplicate-names, allow-multiple-labels, b, c, command-name, more-columns, tikz-code, adjust, displaystyle, end-adjust, fleqn, group, @@ -3151,7 +3351,7 @@ version 2005/12/01 or later. { \str_set_eq:NN \l_@@_previous_key_str \l_keys_key_tl \str_set:Nn \l_@@_status_arrow_str { independent } - \str_if_eq:VnF \l_keys_value_tl { NoValue } + \str_if_eq:VnF \l_keys_value_tl { NoValue } { \@@_error:n { Value~for~a~key } } } { \@@_error:n { Incompatible~options~in~Arrow } } @@ -3219,6 +3419,12 @@ version 2005/12/01 or later. adjust .value_required:n = true , unknown .code:n = \@@_sort_seq:N \l_@@_options_Arrow_seq + \seq_if_in:NVTF \l_@@_options_WithArrows_seq \l_keys_key_tl + { + \str_set:Nn \l_tmpa_str + { ~However,~this~key~can~be~used~in~the~options~of~\{WithArrows\}. } + } + { \str_clear:N \l_tmpa_str } \@@_error:n { Unknown~option~in~Arrow } } % \end{macrocode} @@ -3229,7 +3435,7 @@ version 2005/12/01 or later. % the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_Arrow_seq -\seq_set_from_clist:Nn \l_@@_options_Arrow_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_Arrow_seq { adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code, xoffset @@ -3485,6 +3691,23 @@ version 2005/12/01 or later. \seq_gput_right:NV \g_@@_col_int_seq \g_@@_col_int \int_gzero:N \g_@@_col_int % \end{macrocode} +% +% In the preamble of the |\halign|, there will be \emph{two} counters of the +% columns. The aim of this programmation is to detect the utilisation of a +% command |\omit| in a cell of the |\halign| (it should be forbidden). +% For example, in the part of the preamble concerning the third column (if there +% is a third column in the environment), we will have the following instructions : +% \begin{Verbatim} +% \int_gincr:N \g_~@~@_col_int +% \int_gset:Nn \g_~@~@_static_col_int 3 +% \end{Verbatim} +% The counter |\g_@@_col_int| is incremented dynamically and the second is +% static. If the user has used a command |\omit|, the dynamic incrementation is +% not done in the cell and, at this end of the row, the difference between the +% counters may infer the presence of |\omit| at least once. +% \begin{macrocode} + \int_gzero_new:N \g_@@_static_col_int +% \end{macrocode} % % \bigskip % We also have to update the position on the nesting tree. @@ -3537,12 +3760,6 @@ version 2005/12/01 or later. \str_set:Nn \l_@@_format_str { rl } % \end{macrocode} % -% \bigskip -% The boolean |\l_@@_last_col_bool| will be used only during the construction of -% the preamble (in |\@@_construct_halign:|). -% \begin{macrocode} - \bool_set_true:N \l_@@_last_col_bool -% \end{macrocode} % % % \bigskip @@ -3599,17 +3816,33 @@ version 2005/12/01 or later. % command |\@@_Arrow:|. % % \medskip -% The counter |\l_@@_nb_of_columns_int| is the number of columns in the +% The counter |\l_@@_nb_cols_int| is the number of columns in the % |\halign| (excepted the column for the labels of equations in -% |{DispWithArrows}| and excepted evenutals other columns in |{WithArrows}| if -% the user uses the option |more-columns|). +% |{DispWithArrows}| and excepted eventuals other columns in |{WithArrows}| allowed +% by the option |more-columns|). % \begin{macrocode} - \int_set:Nn \l_@@_nb_of_columns_int { \str_count:N \l_@@_format_str } + \int_set:Nn \l_@@_nb_cols_int { \str_count:N \l_@@_format_str } % \end{macrocode} +% +% \medskip +% Be careful! The following counter |\g_@@_col_int| will be used for two usages: +% \begin{itemize} +% \item during, the construction of the preamble of the |\halign|, it will be +% used as counter for the number of the column under construction in the +% preamble (since the preamble is constructed backwards, |\g_@@_col_int| will go +% decreasing from |\l_@@_nb_cols_int| to $1$) ; +% \item once the preamble constructed, the primitive |\halign| is executed, and, +% in each row of the |\halign|, the counter |\g_@@_col_int| will be increased +% from column to column. +% \end{itemize} % +% \begin{macrocode} + \int_gset_eq:NN \g_@@_col_int \l_@@_nb_cols_int +% \end{macrocode} +% % \medskip -% We convert the format in a sequence because we use it as a stack in the -% construction of the preamble. +% We convert the format in a sequence because we use it as a stack (with the top +% of the stack at the end of the sequence) in the construction of the preamble. % \begin{macrocode} \seq_clear_new:N \l_@@_format_seq \seq_set_split:NnV \l_@@_format_seq { } \l_@@_format_str @@ -3645,7 +3878,7 @@ version 2005/12/01 or later. % % \begin{macrocode} \cs_set_eq:NN \notag \@@_notag: - \cs_set_eq:NN \nonumber \@@_notag: + \cs_set_eq:NN \nonumber \@@_nonumber: \cs_set_eq:NN \tag \@@_tag \cs_set_eq:NN \@@_old_label \label \cs_set_eq:NN \label \@@_label:n @@ -3662,8 +3895,8 @@ version 2005/12/01 or later. % the last column (more precisely: except the part concerning the construction % of the left node and the right node). % -% The same function |\@@_construct_halign:| will be used both for |{WithArrows}| -% and |{DispWithArrows}|. +% The same function |\@@_construct_halign:| will be used both for the +% environment |{WithArrows}| and the environment |{DispWithArrows}|. % % Several important points must be noted concerning that construction of the % preamble. @@ -3678,6 +3911,9 @@ version 2005/12/01 or later. % expansion of the preamble gives the ability of controlling which parts of the % code will be expanded during the construction of the preamble (other parts % will be expanded and executed only during the execution of the |\halign|). +% \item The counter |\g_@@_col_int| is used during the loop of the construction +% of the preamble but, it will also appears in the preamble (we could have +% chosen two differents counters but this way saves a counter). % \end{itemize} % % \begin{macrocode} @@ -3693,17 +3929,17 @@ version 2005/12/01 or later. \use:x { % \end{macrocode} -% Before the recursive call of |\@@_construct_halign:|, -% we lower the flag |\l_@@_last_col_bool| in order that all the recursive calls -% will know that they are not in the last column. But, during the construction -% of the first column, it is \emph{not} lowered because |\bool_set_false:N|, -% which is protected, won't be expanded by the |\use:x|. +% Before the recursive call of |\@@_construct_halign:|, we decrease the integer +% |\g_@@_col_bool|. But, during the construction of the column which is +% constructed first (that is to say which is the last column of the |\halign|), +% it is \emph{not} lowered because |\int_decr:N|, which is protected, won't be +% expanded by the |\use:x|. % % We begin the construction of a generic column. % \begin{macrocode} - \bool_set_false:N \l_@@_last_col_bool + \int_gdecr:N \g_@@_col_int \@@_construct_halign: - \bool_if:NT \l_@@_last_col_bool + \int_compare:nNnT \g_@@_col_int = \l_@@_nb_cols_int { % \end{macrocode} % We redefine the command |\Arrow| (or the name given to the corresponding @@ -3732,19 +3968,20 @@ version 2005/12/01 or later. \str_if_eq:VnT \l_@@_type_col_str { c } \hfil \str_if_eq:VnT \l_@@_type_col_str { r } \hfill \int_gincr:N \g_@@_col_int - $ % $ + \int_gset:Nn \g_@@_static_col_int { \int_use:N \g_@@_col_int } + \c_math_toggle_token { { } \bool_if:NT \l_@@_displaystyle_bool \displaystyle #### } - $ % $ - \bool_if:NTF \l_@@_last_col_bool + \c_math_toggle_token + \int_compare:nNnTF \g_@@_col_int = \l_@@_nb_cols_int { \@@_construct_nodes: } { % \end{macrocode} % The following glue (|\hfil|) will be added only if we are not in the last cell -% because, in the last cell, a glue is added beetween the nodes (in +% because, in the last cell, a glue (=skip) is added between the nodes (in % |\@@_construct_nodes:|). % \begin{macrocode} \str_if_eq:VnT \l_@@_type_col_str { l } \hfil @@ -3765,14 +4002,18 @@ version 2005/12/01 or later. \bgroup } { - \halign to - \bool_if:NTF \l_@@_inlabel_bool \linewidth \displaywidth + \halign to \l_@@_linewidth_dim \bgroup \bool_if:NT \l_@@_fleqn_bool { \skip_horizontal:N \l_@@_mathindent_dim } } \int_gincr:N \g_@@_line_int \int_gzero:N \g_@@_col_int + \tl_if_eq:NNF \l_@@_left_brace_tl \c_novalue_tl + { + \skip_horizontal:n + { \box_wd:N \l_@@_left_brace_box + \l_@@_delim_wd_dim } + } \strut } } @@ -3781,8 +4022,8 @@ version 2005/12/01 or later. % % \bigskip % The command |\@@_construct_nodes:| is only for the lisibility of the code -% because, in fact, it is used only once. It construct the ``left node'' and the -% ``right node'' at the end of each row of the arrow. +% because, in fact, it is used only once. It constructs the ``left node'' and +% the ``right node'' at the end of each row of the arrow. % \begin{macrocode} \cs_new_protected:Npn \@@_construct_nodes: { @@ -3838,7 +4079,6 @@ version 2005/12/01 or later. % \bigskip % \subsubsection{The environment \{WithArrows\}} % -% % % \begin{macrocode} \NewDocumentEnvironment { WithArrows } { ! O { } } @@ -3864,7 +4104,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% We begin the |\halign| and the preamble. +% We begin the |\halign| and the preamble. During the construction of the +% preamble, |\l_tmpa_int| will be incremented during each column constructed. % \begin{macrocode} \@@_construct_halign: % \end{macrocode} @@ -3881,10 +4122,10 @@ version 2005/12/01 or later. % \begin{macrocode} && \@@_error:n { Too~much~columns~in~WithArrows } - $ + \c_math_toggle_token \bool_if:NT \l_@@_displaystyle_bool \displaystyle { ## } - $ + \c_math_toggle_token \cr } % \end{macrocode} @@ -4012,7 +4253,13 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_cr: { \scan_stop: - \prg_replicate:nn { \l_@@_nb_of_columns_int - \g_@@_col_int } { & { } } +% \end{macrocode} +% We try to detect some |\omit| (as of now, an |\omit| in the last column is +% not detected). +% \begin{macrocode} + \int_compare:nNnF \g_@@_col_int = \g_@@_static_col_int + { \@@_error:n { omit~probably~used } } + \prg_replicate:nn { \l_@@_nb_cols_int - \g_@@_static_col_int } { & { } } \group_align_safe_begin: \peek_meaning_remove:NTF * \@@_cr_i: \@@_cr_i: } @@ -4027,15 +4274,36 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% Now, we test if the next token is the token |\end|. Indeed, we want to test if +% the following tokens are |\end{WithArrows}| (or |\end{DispWithArrows}|, etc). +% In this case, we raise an error because the user must not put "\\" at the end +% of its alignment. % \begin{macrocode} \cs_new_protected:Npn \@@_cr_ii: [ #1 ] { + \peek_meaning_ignore_spaces:NTF \end + { + \@@_cr_iii:n { #1 } +% \end{macrocode} +% The analyse of the argument of the token |\end| must be after the +% |\group_align_safe_end:| which is the beginning of |\@@_cr_iii:n|. +% \begin{macrocode} + \@@_analyze_end:Nn + } + { \@@_cr_iii:n { #1 } } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_cr_iii:n #1 + { \group_align_safe_end: % \end{macrocode} % For the environment |{DispWithArrows}|, the behaviour of |\\| is different -% because we add the third column which is the column for the tag (number of the -% equation). Even if there is no tag, the third column is used for the -% |v|-nodes. +% because we add the last column which is the column for the tag (number of the +% equation). Even if there is no tag, this column is used for the +% |v|-nodes.\footnote{The |v|-nodes are used to compute the abscissa of the +% right margin, used by the option |wrap-lines|.} % \begin{macrocode} \bool_if:NT \l_@@_in_DispWithArrows_bool % \end{macrocode} @@ -4172,12 +4440,39 @@ version 2005/12/01 or later. \coordinate ( \int_use:N \g_@@_line_int - v ) ; } } - \cr \noalign { \skip_vertical:n { #1 + \l_@@_interline_skip } \scan_stop: } + \dim_compare:nNnT { #1 } < \c_zero_dim + { \@@_error:n { option~of~cr~negative } } + \dim_set:Nn \l_tmpa_dim { \dim_max:nn { #1 } \c_zero_dim } + \cr + \noalign + { + \skip_vertical:n { \l_tmpa_dim + \l_@@_interline_skip } + \scan_stop: + } } % \end{macrocode} % According to the documentation of \pkg{expl3}, the previous addition in % ``|#1 + \l_@@_interline_skip|'' is really an addition of skips (=glues). % +% +% The following command will be used when, after a |\\| (and its optional +% arguments) there is a |\end|. You want to known if this is the end of the +% environment |{WithArrows}| (or |{DispWithArrows}|, etc.) because, in this +% case, we will explain that the environment must not be ended by |\\|. If it is +% not the case, that means it's a classical situation of LaTeX environments not +% correctly imbricated and there will be a LaTeX error. +% \begin{macrocode} +\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2 + { + \exp_args:NV \str_if_eq:nnT \l_@@_type_env_str { #2 } + { \@@_warning:n { newline~at~the~end~of~env } } +% \end{macrocode} +% We reput in the stream the |\end{...}| we have extracted. +% \begin{macrocode} + \end { #2 } + } +% \end{macrocode} +% % \bigskip % \subsubsection{The environment \{DispWithArrows\}} % @@ -4188,23 +4483,24 @@ version 2005/12/01 or later. % % The purpose of the |\vtop| is to have an environment unbreakable. % -% However, if we are juste after an item of a LaTeX list, the construction is -% slightly different: +% However, if we are juste after an item of a LaTeX list or at the beginning of +% a |{minipage}|, the construction is slightly different: % % |\[\vtop{\halign to \linewidth {...}}\]| % % % \bigskip -% The boolean |\l_@@_inlabel_bool| will be raised if we are just after a |\item| -% of a list of LaTeX. +% The boolean |\l_@@_in_label_or_minipage_bool| will be raised if we are just after a |\item| +% of a list of LaTeX or at the beginning of a |{minipage}|. % \begin{macrocode} -\bool_new:N \l_@@_inlabel_bool +\bool_new:N \l_@@_in_label_or_minipage_bool % \end{macrocode} % % % \begin{macrocode} -\NewDocumentEnvironment { DispWithArrows } { ! O { } } +\NewDocumentEnvironment { DispWithArrows } { ! d < > ! O { } } { + \bool_set_true:N \l_@@_in_DispWithArrows_bool % \end{macrocode} % If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we disable % the code of \pkg{mathtools} for the option |showonlyrefs| with the command @@ -4237,23 +4533,58 @@ version 2005/12/01 or later. % definition of |\intertext|. % \begin{macrocode} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ - \bool_set_true:N \l_@@_in_DispWithArrows_bool - \@@_pre_halign:n { #1 } + \IfValueT { #1 } { \tl_set:Nn \l_@@_left_brace_tl { #1 } } + \@@_pre_halign:n { #2 } % \end{macrocode} % +% If |subequations| is used, we encapsulate the environment in an +% environment |{subequations}| of \pkg{amsmath}. +% \begin{macrocode} + \bool_if:NT \l_@@_subequations_bool { \begin { subequations } } +% \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|. +% information will be stored in |\l_@@_in_label_or_minipage_bool|. % \begin{macrocode} \bool_if:NF \l_@@_sbwi_bool { \if@inlabel - \bool_set_true:N \l_@@_inlabel_bool + \bool_set_true:N \l_@@_in_label_or_minipage_bool + \fi + \if@minipage + \bool_set_true:N \l_@@_in_label_or_minipage_bool \fi } % \end{macrocode} +% +% +% \begin{macrocode} + \tl_if_eq:NNF \l_@@_left_brace_tl \c_novalue_tl + { + \hbox_set:Nn \l_tmpa_box + { + \c_math_toggle_token + \left \l_@@_replace_left_brace_by_tl \vcenter to 1 cm { } \right. + \c_math_toggle_token + } + \dim_zero_new:N \l_@@_delim_wd_dim + \dim_set:Nn \l_@@_delim_wd_dim { \box_wd:N \l_tmpa_box } + \box_clear_new:N \l_@@_left_brace_box + \hbox_set:Nn \l_@@_left_brace_box + { + \group_begin: + \cs_set_eq:NN \label \@@_old_label + \c_math_toggle_token + \bool_if:NT \l_@@_displaystyle_bool \displaystyle + \l_@@_left_brace_tl + { } + \c_math_toggle_token + \group_end: + } + } +% \end{macrocode} % % \bigskip % The token list |\l_@@_tag_tl| will contain the argument of the command |\tag|. @@ -4275,17 +4606,17 @@ version 2005/12/01 or later. % % \begin{macrocode} \if_mode_math: - \@@_error:n { DispWithArrows~in~math~mode } + \@@_fatal:n { DispWithArrows~in~math~mode } \fi: % \end{macrocode} % % \bigskip % The construction is not exactly the same whether we are just after an |\item| % of a LaTeX list or not. We know if we are after an |\item| thanks to the -% boolean |\l_@@_inlabel_bool|. +% boolean |\l_@@_in_label_or_minipage_bool|. % \begin{macrocode} - \bool_if:NTF \l_@@_inlabel_bool - { $ } % $ + \bool_if:NTF \l_@@_in_label_or_minipage_bool + { \c_math_toggle_token } { % \end{macrocode} % We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a @@ -4296,15 +4627,25 @@ version 2005/12/01 or later. \nointerlineskip \hbox_to_wd:nn { .6 \linewidth } { } \fi: - $$ + \c_math_toggle_token \c_math_toggle_token } % \end{macrocode} -% We use a |\vtop| in order to prevent page breaks in the environment. +% +% \begin{macrocode} + \dim_zero_new:N \l_@@_linewidth_dim + \bool_if:NTF \l_@@_in_label_or_minipage_bool + { \dim_set_eq:NN \l_@@_linewidth_dim \linewidth } + { \dim_set_eq:NN \l_@@_linewidth_dim \displaywidth } +% \end{macrocode} +% +% % \begin{macrocode} - \vtop \bgroup - \bool_if:NTF \l_@@_fleqn_bool - { \tabskip = \c_zero_skip } - { \tabskip = 0 pt plus 1000 pt minus 1000 pt } + \box_clear_new:N \l_@@_halign_box + \setbox \l_@@_halign_box \vtop \bgroup + \tabskip = + \bool_if:NTF \l_@@_fleqn_bool + \c_zero_skip + { 0 pt plus 1000 pt minus 1000 pt } % \end{macrocode} % % @@ -4314,7 +4655,7 @@ version 2005/12/01 or later. & % \end{macrocode} % -% If the user try to use more columns than the lenght of the format, we have to +% If the user tries to use more columns than the length of the format, we have to % raise an error. However, the error won't be in the next column which is the % columns for the labels of the equations. The error will be after... and it % must be after. That means that we must not have an error in the next column @@ -4324,7 +4665,7 @@ version 2005/12/01 or later. $ ## $ \tabskip = \c_zero_skip && - \@@_error:n { Too~much~columns~in~DispWithArrows } + \@@_fatal:n { Too~much~columns~in~DispWithArrows } \bool_if:nT \c_false_bool { ## } \cr } @@ -4341,13 +4682,54 @@ version 2005/12/01 or later. % The following |\egroup| is for the |\halign|. % \begin{macrocode} \egroup -% \end{macrocode} -% The following |\egroup| is for the |\vtop|. + \unskip \unpenalty \unskip \unpenalty + \box_set_to_last:N \l_tmpa_box + \nointerlineskip + \box_use:N \l_tmpa_box + \dim_gzero_new:N \g_@@_alignment_dim + \dim_gset:Nn \g_@@_alignment_dim { \box_wd:N \l_tmpa_box } + \box_clear_new:N \l_@@_new_box + \hbox_set:Nn \l_@@_new_box { \hbox_unpack_clear:N \l_tmpa_box } + \dim_compare:nNnT + { \box_wd:N \l_@@_new_box } < \g_@@_alignment_dim + { \dim_gset:Nn \g_@@_alignment_dim { \box_wd:N \l_@@_new_box } } +% \end{macrocode} +% The |\egroup| is for the box |\l_@@_halign_box|. % \begin{macrocode} - \egroup + \egroup % \end{macrocode} % -% +% \begin{macrocode} + \tl_if_eq:NNTF \l_@@_left_brace_tl \c_novalue_tl + { \box_use_drop:N \l_@@_halign_box } + { + \hbox_to_wd:nn \l_@@_linewidth_dim + { + \bool_if:NTF \l_@@_fleqn_bool + { \skip_horizontal:n \l_@@_mathindent_dim } + \hfil + \hbox_to_wd:nn \g_@@_alignment_dim + { + \box_use_drop:N \l_@@_left_brace_box + \dim_set:Nn \l_tmpa_dim + { + \box_ht:N \l_@@_halign_box + + \box_dp:N \l_@@_halign_box + } + \c_math_toggle_token + \left \l_@@_replace_left_brace_by_tl + \vcenter to \l_tmpa_dim { \vfil } + \right. + \c_math_toggle_token + \hfil + } + \hfil + } + \skip_horizontal:n { - \l_@@_linewidth_dim } + \vcenter { \box_use_drop:N \l_@@_halign_box } + } +% \end{macrocode} +% % We compute the dimension |\g_@@_right_x_dim|. As a first approximation, % |\g_@@_right_x_dim| is the $x$-value of the right side of the current % composition box. In fact, we must take into account the potential labels of @@ -4362,7 +4744,7 @@ version 2005/12/01 or later. { \cs_if_free:cTF { pgf@sh@ns@wa - \l_@@_prefix_str - \l_tmpa_int - v } - { \@@_error:n { Inexistent~v-node } } + { \@@_fatal:n { Inexistent~v-node } } { \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v ) \dim_set:Nn \l_tmpa_dim \pgf@x @@ -4373,6 +4755,7 @@ version 2005/12/01 or later. \end { tikzpicture } % \end{macrocode} % +% % \bigskip % The code in |\@@_post_halign:| is common to |{WithArrows}| and % |{DispWithArrows}|. @@ -4386,12 +4769,16 @@ 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 + \bool_if:NTF \l_@@_in_label_or_minipage_bool { - $ % $ + \c_math_toggle_token \skip_vertical:N \belowdisplayskip } - { $$ } + { \c_math_toggle_token \c_math_toggle_token } +% \end{macrocode} +% +% \begin{macrocode} + \bool_if:NT \l_@@_subequations_bool { \end { subequations } } % \end{macrocode} % % \bigskip @@ -4399,7 +4786,7 @@ version 2005/12/01 or later. % extract the footnotes with an environment |{savenotes}| (of the package % \pkg{footnote} or the package \pkg{footnotehyper}). % \begin{macrocode} - \bool_if:NT \g_@@_footnote_bool { \end {savenotes } } + \bool_if:NT \g_@@_footnote_bool { \end { savenotes } } \ignorespacesafterend } % \end{macrocode} @@ -4435,7 +4822,7 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_in_WithArrows_bool { \@@_error:nn { Not~allowed~in~WithArrows } { #1 } } { - \int_compare:nNnTF \g_@@_col_int < \l_@@_nb_of_columns_int + \int_compare:nNnTF \g_@@_col_int < \l_@@_nb_cols_int { \@@_error:nn { Not~allowed~in~DispWithArrows } { #1 } } { #2 } } @@ -4443,18 +4830,25 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The command |\@@_notag:| will be linked to |\notag| and |\nonumber| in the -% environments |{WithArrows}| and |{DispWithArrows}|. +% The command |\@@_notag:| will be linked to the command |\notag| and also to +% in the environments |{WithArrows}| and |{DispWithArrows}|. % \begin{macrocode} \cs_new_protected:Npn \@@_notag: { \@@_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l_@@_tags_clist } } % \end{macrocode} % -% % \bigskip -% The command |\@@_tag| will be linked to |\tag| in the environments -% |{WithArrows}| and |{DispWithArrows}|. We use |\NewDocumentCommand| because -% this command has a starred version. +% The command |\@@_nonumber:| will be linked to the command |\nonumber| and also to +% in the environments |{WithArrows}| and |{DispWithArrows}|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_nonumber: + { \@@_if_in_last_col_of_disp:Nn \nonumber { \clist_clear:N \l_@@_tags_clist } } +% \end{macrocode} +% +% \bigskip +% The command |\@@_tag| will be linked to |\tag| in |{WithArrows}| and +% |{DispWithArrows}|. We do the definition with |\NewDocumentCommand| because this +% command has a starred version. % \begin{macrocode} \NewDocumentCommand \@@_tag { s m } { @@ -4524,8 +4918,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The command |\@@_tagnextline:| will be linked to |\tagnextline| in the -% environments |{DispWithArrows}|. +% The command |\@@_tagnextline:| will be linked to |\tagnextline| in +% |{DispWithArrows}|. % \begin{macrocode} \cs_new_protected:Npn \@@_tagnextline: { @@ -4549,7 +4943,8 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_set_qedhere: { \cs_set_eq:NN \qedhere \@@_qedhere: } % \end{macrocode} % -% In the third column of the |\halign| of |{DispWithArrows}|, a command +% In the last column of the |\halign| of |{DispWithArrows}| (column of the +% labels, that is to say the numbers of the equations), a command % |\@@_qedhere_i:| will be 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}. @@ -4686,7 +5081,7 @@ version 2005/12/01 or later. \int_compare:nNnTF \l_@@_final_int > \g_@@_line_int { \int_compare:nNnF \l_@@_pos_arrow_int = 8 - { \_@@_error:n { Too~few~lines~for~an~arrow } } + { \@@_error:n { Too~few~lines~for~an~arrow } } } \@@_code_for_possible_arrow: % \end{macrocode} @@ -4703,7 +5098,7 @@ version 2005/12/01 or later. % 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 +% situation occurs when all the arrows of the potential group arrive after the % last line of the environment). % \begin{macrocode} \bool_if:nT @@ -4721,9 +5116,10 @@ version 2005/12/01 or later. \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 we are with the -% option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = 7). +% We test whether 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 we are with +% the option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = +% 7). % \begin{macrocode} \bool_if:nT { @@ -4997,7 +5393,7 @@ version 2005/12/01 or later. % 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| +% done in the following |{tikzpicture}| because the command |\seq_if_in:NnTF| % which is \emph{not} expandable. % \begin{macrocode} \seq_if_in:NxTF \l_@@_first_arrows_seq @@ -5144,11 +5540,11 @@ version 2005/12/01 or later. \tikz@parse@node \pgfutil@firstofone ( @@_label.west ) % \end{macrocode} % We compute in |\l_tmpa_dim| the maximal width possible for the label. -% |0.3333 em| is the default value of |inner sep| in the nodes of Tikz. Maybe we -% should put the exact Tikz parameter. Here is the use of |\g_@@_right_x_dim| -% which has been computed previously with the |v|-nodes. +% Here is the use of |\g_@@_right_x_dim| which has been computed previously with +% the |v|-nodes. % \begin{macrocode} - \dim_set:Nn \l_tmpa_dim { \g_@@_right_x_dim - \pgf@x - 0.3333 em } + \dim_set:Nn \l_tmpa_dim + { \g_@@_right_x_dim - \pgf@x - \pgfkeysvalueof { / pgf / inner~xsep } } % \end{macrocode} % We retrieve in |\g_tmpa_tl| the current value of the Tikz parameter % ``|text width|''.\footnote{In fact, it's not the current value of @@ -5248,11 +5644,11 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% A sequence of the options available in |\Arrow| in |\code-after|. This sequence +% A sequence of the options available in |\Arrow| in |code-after|. This sequence % will be used in the error messages and can be modified dynamically. % \begin{macrocode} \seq_new:N \l_@@_options_Arrow_code_after_seq -\seq_set_from_clist:Nn \l_@@_options_Arrow_code_after_seq +\@@_set_seq_of_str_from_clist:Nn \l_@@_options_Arrow_code_after_seq { ll, lr, rl, rr, tikz, tikz-code, v, x, offset } % \end{macrocode} % @@ -5268,7 +5664,8 @@ 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_arrow_int - { 0 + { + 0 { \bool_set_true:N \l_@@_initial_r_bool \bool_set_true:N \l_@@_final_r_bool @@ -5445,9 +5842,64 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { amsmath~not~loaded } + { + You~can't~use~the~option~'\l_keys_key_tl'~because~the~ + package~'amsmath'~has~not~been~loaded.\\ + If~you~go~on,~this~option~will~be~ignored~in~the~rest~ + of~the~document. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { Bad~value~for~replace~brace~by } + { + Bad~value~for~the~option~'\l_keys_key_tl'.~The~value~must~be~ + an~extensible~left~delimiter.~The~possible~values~are:~ + \token_to_str:N \{,~(,~[,~\token_to_str:N \lbrace,~ + \token_to_str:N \lbrack,~\token_to_str:N \lgroup,~ + \token_to_str:N \langle,~\token_to_str:N \lmoustache,~ + \token_to_str:N \lfloor\ and~\token_to_str:N \lceil\ + (and~\token_to_str:N \lvert\ and~\token_to_str:N \lVert\ + if~amsmath~or~unicode-math~is~loaded).\\ + \c_@@_option_ignored_str + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { option~of~cr~negative } + { + The~argument~of~the~command~\token_to_str:N\\~ + should~be~positive~in~the~row~\int_use:N \g_@@_line_int\ + of~your~environment~\{\l_@@_type_env_str\}.\\ + \c_@@_option_ignored_str + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { omit~probably~used } + { + There~is~a~problem.~Maybe~you~have~used~a~command~ + \token_to_str:N\omit\ in~the~line~\int_use:N \g_@@_line_int\ + (or~another~line)~of~your~environment~\{\l_@@_type_env_str\}.\\ + You~can~go~on~but~you~may~have~others~errors. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { newline~at~the~end~of~env } + { + Your~environment~\{\l_@@_type_env_str\}~should~not~end~with~ + a~\token_to_str:N \\.\\ + This~warning~might~become~an~error~in~a~future~version. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Invalid~option~format } { - The~option~'format'~should~contain~only~letters~r,~c~and~l.\\ + The~key~'format'~should~contain~only~letters~r,~c~and~l~and~ + must~not~be~empty.\\ \c_@@_option_ignored_str } % \end{macrocode} @@ -5463,10 +5915,10 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~in~Arrow } { - The~option~'\l_keys_key_tl'~ - is~unknown~for~the~command~\l_@@_string_Arrow_for_msg_str\ - in~the~row~\int_use:N \g_@@_line_int\ - of~your~environment~\{\l_@@_type_env_str\}. \\ + The~key~'\l_keys_key_tl'~is~unknown~for~the~command~ + \l_@@_string_Arrow_for_msg_str\ in~the~row~ + \int_use:N \g_@@_line_int\ of~your~environment~ + \{\l_@@_type_env_str\}. \l_tmpa_str \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5480,7 +5932,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~WithArrows } { - The~option~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ + The~key~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5493,7 +5945,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~DispWithArrows } { - The~option~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ + The~key~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5506,7 +5958,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~WithArrowsOptions } { - The~option~'\l_keys_key_tl'~is~unknown~in~ + The~key~'\l_keys_key_tl'~is~unknown~in~ \token_to_str:N \WithArrowsOptions. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. @@ -5520,9 +5972,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~Arrow~in~code-after } { - The~option~'\l_keys_key_tl'~is~unknown~in~ - \token_to_str:N \Arrow\ - in~\token_to_str:N \code-after. \\ + The~key~'\l_keys_key_tl'~is~unknown~in~ + \token_to_str:N \Arrow\ in~code-after. \\ \c_@@_option_ignored_str \\ For~a~list~of~the~available~keys,~type~H~<return>. } @@ -5537,7 +5988,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { Too~much~columns~in~WithArrows } { Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N - \l_@@_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~ + \l_@@_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~ If~you~really~want~to~use~more~columns~(after~the~arrows)~you~should~use~ the~option~'more-columns'~at~a~global~level~or~for~an~environment. \\ @@ -5549,10 +6000,10 @@ version 2005/12/01 or later. \@@_msg_new:nn { Too~much~columns~in~DispWithArrows } { Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N - \l_@@_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~ + \l_@@_nb_cols_int\ columns~and~you~try~to~use~one~more.~ Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ at~the~end~of~row~\int_use:N \g_@@_line_int. \\ - If~you~go~on,~you~may~have~other~errors. + This~error~is~fatal. } % \end{macrocode} % @@ -5583,7 +6034,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Too~few~lines~for~an~arrow } - { Line~\l_@@_input_line_str\ + { + 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. \\ @@ -5605,7 +6057,7 @@ version 2005/12/01 or later. { 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. + This~error~is~fatal. } % \end{macrocode} % @@ -5639,7 +6091,8 @@ version 2005/12/01 or later. \@@_msg_new:nn { Arrow~not~in~last~column } { You~should~use~the~command~\l_@@_string_Arrow_for_msg_str\ - only~in~the~last~column~of~your~environment~\{\l_@@_type_env_str\}.\\ + only~in~the~last~column~(column~\int_use:N\l_@@_nb_cols_int)~ + of~your~environment~\{\l_@@_type_env_str\}.\\ However~you~can~go~on~for~this~time. } % \end{macrocode} @@ -5694,7 +6147,8 @@ version 2005/12/01 or later. \@@_msg_new:nn { Not~allowed~in~DispWithArrows } { The~command~\token_to_str:N #1 - is~allowed~only~in~the~last~columnm~of~\{\l_@@_type_env_str\}. \\ + is~allowed~only~in~the~last~column~ + (column~\int_use:N\l_@@_nb_cols_int)~of~\{\l_@@_type_env_str\}. \\ \c_@@_option_ignored_str } % \end{macrocode} @@ -5746,9 +6200,9 @@ version 2005/12/01 or later. { There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\ instead~of~a~command~\token_to_str:N\\~at~the~end~of~ - the~row~\int_use:N \l_tmpa_int\ + the~row~\l_tmpa_int\ of~your~environment~\{\l_@@_type_env_str\}. \\ - If~you~go~on,~you~may~have~an~incorrect~output. + This~error~is~fatal. } % \end{macrocode} % @@ -5765,6 +6219,22 @@ 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} +% % % % \subsection{The command \textbackslash WithArrowsNewStyle} @@ -5782,9 +6252,11 @@ version 2005/12/01 or later. #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 } + \seq_put_right:Nx \l_@@_options_WithArrows_seq { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l_@@_options_DispWithArrows_seq + { \tl_to_str:n { #1 } } + \seq_put_right:Nx \l_@@_options_WithArrowsOptions_seq + { \tl_to_str:N { #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 @@ -5793,7 +6265,7 @@ version 2005/12/01 or later. \group_begin: \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions } { - The~option~'\l_keys_key_tl'~can't~be~set~in~the~ + The~key~'\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. } @@ -5822,7 +6294,7 @@ version 2005/12/01 or later. % This code is the only part of the code of \pkg{witharrows} which uses the % package \pkg{varwidth} and also the Tikz library |calc|. That's why we have % decided not to load this package and this library. If they are not loaded, the -% user will have an error only if he uses the option |up| or the option |down|. +% user will have an error only when using the option |up| or the option |down|. % % \medskip % The token list |\c_@@_tikz_code_up_tl| is the value of |tikz-code| which will @@ -5919,6 +6391,8 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% % % \begin{macrocode} \seq_put_right:Nn \l_@@_options_Arrow_seq { down } @@ -5944,24 +6418,8 @@ version 2005/12/01 or later. \c_@@_option_ignored_str } % \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} @@ -6081,7 +6539,7 @@ version 2005/12/01 or later. % % \smallskip % Replacement of some options |O { }| in commands and environments defined with -% \pkg{xparse} by |! O { }| (because a recent version of \pkg{xparse} introduced +% \pkg{xparse} by |! O { }| (a recent version of \pkg{xparse} introduced % the specifier |!| and modified the default behaviour of the last optional % arguments: % |//www.texdev.net/2018/04/21/xparse-optional-arguments-at-the-end|). @@ -6123,7 +6581,21 @@ version 2005/12/01 or later. % \subsection*{Changes between 1.16 and 1.17} % % Option |format| +% +% \subsection*{Changes between 1.17 and 1.18} +% +% New option |<...>| for |{DispWithArrows}|. +% +% Option |subequations|. +% +% Warning when |{WithArrows}| or |{DispWithArrows}| ends by "\\". % +% No space before an environnement |{DispWithArrows}| if we are at the beginning +% of a |{minipage}|. +% \PrintIndex +% +% \tableofcontents +% % \endinput % Local Variables: % TeX-fold-mode: nil |