From c07683ab02e932a7b03babfc0e20c349010481bb Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 10 Dec 2019 22:17:20 +0000 Subject: witharrows (10dec19) git-svn-id: svn://tug.org/texlive/trunk@53089 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/generic/witharrows/witharrows.dtx | 145 ++++++++++++--------- 1 file changed, 85 insertions(+), 60 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/generic/witharrows/witharrows.dtx b/Master/texmf-dist/source/generic/witharrows/witharrows.dtx index 96fd85f7f6a..8aef1584bb9 100644 --- a/Master/texmf-dist/source/generic/witharrows/witharrows.dtx +++ b/Master/texmf-dist/source/generic/witharrows/witharrows.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{2.1} -\def\myfiledate{2019/10/21} +\def\myfileversion{2.2} +\def\myfiledate{2019/12/10} % % %<*batchfile> @@ -57,7 +57,7 @@ version 2005/12/01 or later. \usepackage{varwidth} \labelformat{equation}{(#1)} \NewDocumentEnvironment {scope} {} {} {} -\def\interitem{\vskip 7mm plus 2 mm minus 3mm} +\def\interitem{\vspace{7mm plus 2 mm minus 3mm}} \def\emphase{\bgroup\color{RoyalPurple}\let\next=} \fvset{commandchars=\~\#\@,formatcom={\color{gray}}} \DeclareMathOperator{\re}{Re} @@ -80,9 +80,9 @@ version 2005/12/01 or later. % { % pdfinfo = % { -% Title = { The extension 'witharrows' } , -% Subject = { An extension for plain-TeX and LaTeX} , -% Author = { F. Pantigny } +% Title = The extension 'witharrows' , +% Subject = An extension for plain-TeX and LaTeX , +% Author = F. Pantigny % } % } % @@ -180,7 +180,7 @@ version 2005/12/01 or later. % % \interitem % 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. +% arrows to be stucked on the text). The initial value of |xoffset| is $3$~mm. % \begin{Verbatim} % $\begin{WithArrows} % A & = \bigl((a+b)+1\bigr)^2 @@ -508,7 +508,7 @@ version 2005/12/01 or later. % it's possible to use the environment with an arbitrary number of columns with % the option |format|. The value given to this option is like the preamble of an % environment |{array}|, that is to say a sequence of letters |r|, |c| and |l|. -% The default value of the option |format| is, in fact, |rl|. +% The initial value of the option |format| is, in fact, |rl|. % % \bigskip % For exemple, if we want only one column left-aligned, we use the option |format=l|. @@ -879,7 +879,7 @@ version 2005/12/01 or later. % % \interitem % Like the environment |{aligned}|, |{WithArrows}| has an option of placement -% which can assume the values |t|, |c| or |b|. However, the default value is not +% which can assume the values |t|, |c| or |b|. However, the initial value is not % |c| but |t|. If desired, it's possible to have the |c| value as the default % with the command |\WithArrowsOptions{c}| at the beginning of the document. % % @@ -1032,7 +1032,7 @@ version 2005/12/01 or later. % % \smallskip % A command |\Arrow| in |code-after| takes three arguments : -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item a specification of the start row of the arrow ; % \item a specification of the end row of the arrow ; % \item the label of the arrow. @@ -1095,7 +1095,7 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \bigskip -% The options allowed for a command |\Arrow| in |code-after| are : |ll|, |lr|, +% The options allowed for a command |\Arrow| in |code-after| are: |ll|, |lr|, % |rl|, |rr|, |v|, |xoffset|, |tikz| and |tikz-code|. Except |v|, which is % specific to |\Arrow| in |code-after|, all these options have their usual % meaning. @@ -1215,7 +1215,7 @@ version 2005/12/01 or later. % \medskip % The package \pkg{witharrows} provides some tools facilitating the use of these % nodes: -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item the command |\WithArrowsLastEnv| gives the number of the last % environment of level~$0$ (\emph{i.e.} which is not included in another % environment of the package \pkg{witharrows}); @@ -1372,7 +1372,7 @@ version 2005/12/01 or later. % & = a^2 + 2a + 1 \tag{$\star$} \label{my-equation} % \end{DispWithArrows} % A link to the equation \ref{my-equation}.\footnote{In this document, the -% references has been customized with |\labelformat{equation}{(#1)}|} +% references have been customized with |\labelformat{equation}{(#1)}| in the preamble.} % % % \medskip @@ -1434,7 +1434,7 @@ version 2005/12/01 or later. % With the option |fleqn|, the environment is composed flush left (in a way % similar to the option |fleqn| of the standard classes of LaTeX). In this case, % the left margin can be controlled with the option |mathindent| (with a name -% inspired by the parameter |\mathindent| of standard LaTeX). The default value +% inspired by the parameter |\mathindent| of standard LaTeX). The initial value % of this parameter is 25~pt. % % \begin{Verbatim} @@ -1449,7 +1449,7 @@ version 2005/12/01 or later. % \end{DispWithArrows} % % \medskip -% \emph{Remark} : By design, the option |fleqn| of \pkg{witharrows} is +% \emph{Remark}: By design, the option |fleqn| of \pkg{witharrows} is % independent of the option |fleqn| of LaTeX. Indeed, since the environments of % \pkg{witharrows} are meant to be used with arrows on the right side, the user % may want to use \pkg{witharrows} with the option |fleqn| (in order to have @@ -1467,12 +1467,12 @@ version 2005/12/01 or later. % 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 +% |{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 +% |\WithArrowsOptions|. Each environment |{DispWithArrows}| will be subnumerated % (in the scope of the |\WithArrowsOptions|) % \begin{Verbatim} % ~emphase#\WithArrowsOptions{subequations}@ @@ -1616,7 +1616,7 @@ version 2005/12/01 or later. % (in fact, it's possible to use \pkg{witharrows} without \pkg{amsmath}). % % There are differences between |{DispWithArrows}| and |{align}|. -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item The environment |{DispWithArrows}| cannot be inserted in an environment % |{gather}| of \pkg{amsmath}. % \item An environment |{DispWithArrows}| is always unbreakable (even with @@ -1688,10 +1688,10 @@ version 2005/12/01 or later. % % \interitem % In the following example, we subnumerate the equations with the option -% |subnumerate| (available when the package \pkg{amsmath} is loaded). +% |subequations| (available when the package \pkg{amsmath} is loaded). % % \begin{Verbatim} -% \begin{DispWithArrows}~emphase#< \label{system} (\ref*{system}) \Leftrightarrow >@[ +% \begin{DispWithArrows}~emphase#< \label{system} \ref*{system} \Leftrightarrow >@[ % format = l, subequations ] % x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ % xy+xz+yz=-2 \\ @@ -1699,7 +1699,7 @@ version 2005/12/01 or later. % \end{DispWithArrows} % \end{Verbatim} % % -% \begin{DispWithArrows}< \label{system} (\ref*{system}) \Leftrightarrow >[ +% \begin{DispWithArrows}< \label{system} \ref*{system} \Leftrightarrow >[ % format = l, subequations] % x+y+z = -3 \Arrow[tikz=-,jump=2]{3 equations} \\ % xy+xz+yz=-2 \\ @@ -1708,7 +1708,7 @@ version 2005/12/01 or later. % % % \bigskip -% The whole system is the equation \eqref{system} (this reference has been coded +% The whole system is the equation \ref{system} (this reference has been coded % by |\ref{system}|) whereas the last equation is the equation % \ref{last-equation} (this reference has been coded by % |\ref{last-equation}|). The command |\ref*| used in the code above is @@ -1748,7 +1748,7 @@ version 2005/12/01 or later. % % \medskip % The version of \pkg{witharrows} for plain-TeX doesn't provide all the -% functionnlities of the LaTeX version. In particular, the funcionnalities which +% functionnalities of the LaTeX version. In particular, the functionnalities which % deal with the number of the equations are not available (since they rely upon % the system of tags of LaTeX). % @@ -1857,11 +1857,11 @@ version 2005/12/01 or later. % \medskip % We first explain the behaviour when the parameters |start-adjust| and % |end-adjust| are equal to zero: -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item the option |ystart| sets the vertical distance between the base line of -% the text and the start of the arrow (default value: 0.4 ex); +% the text and the start of the arrow (initial value: 0.4 ex); % \item the option |ygap| sets the vertical distance between two consecutive -% arrows (default value: 0.4~ex). +% arrows (initial value: 0.4~ex). % \end{itemize} % % @@ -1911,7 +1911,7 @@ version 2005/12/01 or later. % % \bigskip % Here is the standard behaviour since version 1.13 (the parameters -% |start-adjust| and |end-ajust| are used with the default value $0.4$~ex). The +% |start-adjust| and |end-ajust| are used with the initial value $0.4$~ex). The % arrow is longer and the result is more aesthetic. % % \medskip @@ -1929,8 +1929,8 @@ version 2005/12/01 or later. % Since the version 2.1 of \pkg{witharrows}, an arrow of |jump| equal to~$1$ has % a maximal length\footnote{We call \emph{length} of an arrow the difference % between the $y$-value of its start point and the $y$~value of its end point.} -% equal to the parameter |max-length-of-arrow|. The default value of this -% parameter est $2$~cm. +% equal to the parameter |max-length-of-arrow|. The initial value of this +% parameter is $2$~cm. % % In the following example, the value of |max-length-of-arrow| has been fixed to % $1.5$~cm. @@ -1949,7 +1949,7 @@ version 2005/12/01 or later. % $L_2 \gets L_2-L_1$ \\ % $L_3 \gets L_3-L_1$ \\ % $L_4 \gets L_4-L_1$ \\ -% $L_5 \gets L_5-L_1$ % don't put \\ ici +% $L_5 \gets L_5-L_1$ % don't put \\ here % } \\ % & = % \begin{vmatrix} @@ -2423,14 +2423,12 @@ version 2005/12/01 or later. % |expl3| code fails.\footnote{cf. % |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|} % -% \begin{macrocode} -%<@@=wa> -% \end{macrocode} +% <@@=witharrows> % % \begin{macrocode} %<*LaTeX> \RequirePackage{tikz} -\RequirePackage{expl3}[2019/02/15] +\RequirePackage{expl3}[2019/07/01] % %<*plain-TeX> \input tikz.tex @@ -2457,7 +2455,7 @@ version 2005/12/01 or later. % |{WithArrows}|, |{DispWithArrows}|, |{DispWithArrows*}| and the commands % |\Arrow|, |\WithArrowsOptions| and |\WithArrowsNewStyle|. % \begin{macrocode} -\RequirePackage { xparse } [ 2018-10-17 ] +\RequirePackage { xparse } [ 2019-01-01 ] % % \end{macrocode} % @@ -2955,10 +2953,10 @@ version 2005/12/01 or later. % \bigskip % In the |\halign| of an environment |{WithArrows}| or |{DispWithArrows}|, we % will have to use four counters: -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item |\g_@@_arrow_int| to count the arrows created in the environment ; % \item |\g_@@_line_int| to count the lines of the |\halign| ; -% \item |\g_@@_col_int| to count the column of the |\halign|. +% \item |\g_@@_col_int| to count the columns of the |\halign|. % \end{itemize} % % @@ -2975,13 +2973,23 @@ version 2005/12/01 or later. \seq_new:N \g_@@_col_int_seq \int_new:N \g_@@_col_int % \end{macrocode} +% +% We will also use a ``static'' version of the counter of columns, called +% |\g_@@_static_col_int|. The value will be set directly in each cell of the +% array by an instruction in the template of the |\halign|. The aim of this +% programmation is to try to detect some utilisation of |\omit| (which should be +% forbidden) in the cells of the |\halign|. +% \begin{macrocode} +\seq_new:N \g_@@_static_col_int_seq +\int_new:N \g_@@_static_col_int +% \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 -% also three special values, |first|, |last| and |all|. +% also three special values: |first|, |last| and |all|. % \begin{macrocode} %<*LaTeX> \clist_new:N \l_@@_tags_clist @@ -3005,7 +3013,7 @@ version 2005/12/01 or later. % \bigskip % If the user has given a value for the option |command-name| (at the global or % at the \emph{environment} level), a command with this name is defined locally -% in the environment with meaning |\@@_Arrow|. The default value of the option +% in the environment with meaning |\@@_Arrow|. The initial value of the option % |command-name| is ``|Arrow|'' and thus, by default, the name of the command % will be |\Arrow|. % \begin{macrocode} @@ -3071,7 +3079,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The option boolean corresponds to the option |subequations|. +% The option |\l_@@_subequations_bool| corresponds to the option |subequations|. % \begin{macrocode} %<*LaTeX> \bool_new:N \l_@@_subequations_bool @@ -3082,7 +3090,7 @@ version 2005/12/01 or later. % \subsection{The definition of the options} % % There are four levels where options can be set: -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item with |\usepackage[...]{witharrows}|: this level will be called % \emph{package} level; % \item with |\WithArrowsOptions{...}|: this level will be called \emph{global} @@ -3856,9 +3864,9 @@ version 2005/12/01 or later. % \end{macrocode} % % -% The initialization of the counters |\g_@@_arrow_int|, |\g_@@_line_int| and -% |\g_@@_col_int|. However, we have to save their previous values with the -% stacks created for this end. +% The initialization of the counters |\g_@@_arrow_int|, |\g_@@_line_int|, +% |\g_@@_col_int| and |\g_@@_static_col_int|. However, we have to save their +% previous values with the stacks created for this end. % \begin{macrocode} \seq_gput_right:NV \g_@@_arrow_int_seq \g_@@_arrow_int \int_gzero:N \g_@@_arrow_int @@ -3866,6 +3874,8 @@ version 2005/12/01 or later. \int_gzero:N \g_@@_line_int \seq_gput_right:NV \g_@@_col_int_seq \g_@@_col_int \int_gzero:N \g_@@_col_int + \seq_gput_right:NV \g_@@_static_col_int_seq \g_@@_static_col_int + \int_gzero:N \g_@@_static_col_int % \end{macrocode} % % In the preamble of the |\halign|, there will be \emph{two} counters of the @@ -3875,15 +3885,12 @@ version 2005/12/01 or later. % 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 +% \int_set: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 +% not done in the cell and, at the 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. @@ -3924,14 +3931,14 @@ version 2005/12/01 or later. % % \medskip % The counter |\l_@@_jump_int| corresponds to the option |jump|. Now, we set the -% default value for this option. +% initial value for this option. % \begin{macrocode} \int_set:Nn \l_@@_jump_int \c_one_int % \end{macrocode} % % \medskip % The string |\l_@@_format_str| corresponds to the option |format|. Now, we set -% the default value for this option. +% the initial value for this option. % \begin{macrocode} \str_set:Nn \l_@@_format_str { rl } % \end{macrocode} @@ -4004,7 +4011,7 @@ version 2005/12/01 or later. % % \medskip % Be careful! The following counter |\g_@@_col_int| will be used for two usages: -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \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 @@ -4082,7 +4089,7 @@ version 2005/12/01 or later. % % Several important points must be noted concerning that construction of the % preamble. -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item The construction of the preamble is done by reading backwards the % format |\l_@@_format_str| and adding the corresponding tokens in the input % stream of TeX. That means that the part of the preamble concerning the last @@ -4379,8 +4386,17 @@ version 2005/12/01 or later. \cs_set:Npn \WithArrowsRightX { \g_@@_right_x_dim } % \end{macrocode} % +% \bigskip +% We use |\normalbaselines| of plain-TeX because we have used +% |\spread@equation| (of \pkg{amsmath} or defined directly if \pkg{amsmath} is +% not loaded) and you don't want |\spread@equation| to have effects in the +% labels of the arrows. +% \begin{macrocode} + \normalbaselines +% \end{macrocode} +% % \bigskip -% It there is really arrows in the environment, we draw the arrows. +% If there is really arrows in the environment, we draw the arrows. % \begin{macrocode} \int_compare:nNnT \g_@@_arrow_int > 0 { @@ -4444,7 +4460,7 @@ version 2005/12/01 or later. % % \bigskip % Finally, we restore the previous values of the counters |\g_@@_arrow_int|, -% |\g_@@_line_int| and |\g_@@_col_int|. It is recalled that we manage three +% |\g_@@_col_int| and |\g_@@_static_col_int|. It is recalled that we manage four % stacks in order to be able to do such a restoration. % \begin{macrocode} \seq_gpop_right:NN \g_@@_arrow_int_seq \l_tmpa_tl @@ -4453,6 +4469,8 @@ version 2005/12/01 or later. \int_gset:Nn \g_@@_line_int \l_tmpa_tl \seq_gpop_right:NN \g_@@_col_int_seq \l_tmpa_tl \int_gset:Nn \g_@@_col_int \l_tmpa_tl + \seq_gpop_right:NN \g_@@_static_col_int_seq \l_tmpa_tl + \int_gset:Nn \g_@@_static_col_int \l_tmpa_tl } % \end{macrocode} % That's the end of the command |\@@_post_halign:|. @@ -4699,7 +4717,7 @@ version 2005/12/01 or later. { \exp_args:NV \str_if_eq:nnT \l_@@_type_env_str { #2 } { - \@@_warning:n { newline~at~the~end~of~env } + \@@_error:n { newline~at~the~end~of~env } \group_begin: \globaldefs = 1 \@@_msg_redirect_name:nn { newline~at~the~end~of~env } { none } @@ -5300,7 +5318,7 @@ version 2005/12/01 or later. % % \bigskip % The arrows are divided in groups. There is two reasons for this division. -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \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 @@ -5742,7 +5760,7 @@ version 2005/12/01 or later. % \bigskip % We compute and store in |\g_tmpa_tl| and |\g_tmpb_tl| the exact coordinates of % the extremities of the arrow. -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item Concerning the % $x$-values, the abscissa computed in |\l_@@_x_dim| will be used if the option % of position is |i|, |group| or |groups|. @@ -6365,7 +6383,8 @@ version 2005/12/01 or later. { The~environments~of~witharrows~(\{WithArrows\}~and~ \{DispWithArrows\})~should~not~end~by~\token_to_str:N \\.\\ - This~warning~might~become~an~error~in~a~future~version. + However,~you~can~go~on~for~this~time.~No~similar~error~will~be~ + raised~in~this~document. } % % \end{macrocode} @@ -7127,12 +7146,18 @@ version 2005/12/01 or later. % A version of \pkg{witharrows} is available for plain-TeX. % % -% \subsection*{Changes between 2.0 and 2.1 } +% \subsection*{Changes between 2.0 and 2.1} % % Option |max-length-of-arrow|. % % Validation with regular expression for the first argument of |\MultiArrow|. % +% \subsection*{Changes between 2.1 and 2.2} +% +% Addition of |\normalbaselines| at the beginning of |\@@_post_halign:|. +% +% The warning for an environment ending by |\\| has been transformed in |error|. +% % \PrintIndex % % \tableofcontents -- cgit v1.2.3