diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-29 21:24:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-29 21:24:28 +0000 |
commit | 3b3b42b1273d6ac4e7182964334a2487c05fee64 (patch) | |
tree | 74f30b98f2dc2899d3cc8efc6652dea8cd89a42a /Master/texmf-dist/source | |
parent | bfb7d42bbf34b6ee0ddee805cba07b7238a5c556 (diff) |
nicematrix (29oct19)
git-svn-id: svn://tug.org/texlive/trunk@52573 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 672 |
1 files changed, 441 insertions, 231 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index 47271a5452e..4f3effcd146 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{3.5} -\def\myfiledate{2019/10/13} +\def\myfileversion{3.6} +\def\myfiledate{2019/10/29} % % %<*batchfile> @@ -67,9 +67,9 @@ c & c & b & a & e \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}}} +\fvset{commandchars=\~\#\@,formatcom=\color{gray}} \usepackage{titlesec} \titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex} \titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex} @@ -92,9 +92,9 @@ c & c & b & a & e % { % pdfinfo = % { -% Title = { The extension 'nicematrix' } , -% Subject = { A LaTeX extension } , -% Author = { F. Pantigny } +% Title = The extension 'nicematrix' , +% Subject = A LaTeX extension , +% Author = F. Pantigny % } % } % @@ -794,13 +794,13 @@ c & c & b & a & e % % \medskip % \begin{BVerbatim}[baseline=c,boxwidth=12cm] -% $\begin{pNiceMatrix}[~emphase#code-after = {\line {1-1} {3-3}}@] +% $\begin{pNiceMatrix}[~emphase#code-after = \line{1-1}{3-3}@] % 0 & 0 & 0 \\ % 0 & & 0 \\ % 0 & 0 & 0 % \end{pNiceMatrix}$ % \end{BVerbatim} -% $\begin{pNiceMatrix}[code-after = {\line {1-1} {3-3}}] +% $\begin{pNiceMatrix}[code-after = \line{1-1}{3-3}] % 0 & 0 & 0 \\ % 0 & & 0 \\ % 0 & 0 & 0 @@ -898,7 +898,7 @@ c & c & b & a & e % % % \bigskip -% \section{The exterior row and columns} +% \section{The exterior rows and columns} % The options |first-row|, |last-row|, |first-col| and |last-col| allow the % composition of exterior rows and columns in the environments of % \pkg{nicematrix}. @@ -988,7 +988,7 @@ c & c & b & a & e % % % \emph{Remarks} -% \begin{itemize} +% \begin{itemize}[beginpenalty=10000] % \item As shown in the previous example, an horizontal rule (drawn by |\hline|) % doesn't extend in the exterior columns and a vertical rule (specified by a % ``\verb+|+'' in the preamble of the array) doesn't extend in the exterior @@ -1359,6 +1359,43 @@ c & c & b & a & e % \item the characteristics of the dotted lines are also modified. % \end{itemize} % +% \section{The counters iRow and jCol} +% +% In the cells of the array, it's possible to use the LaTeX counters |iRow| and +% |jCol| which represents the number of the current row and the number of the +% current col\footnote{We recall that the first row (if it exists) has the +% number~$0$ and that the first col (if it exists) has also the number~$0$).}. Of +% course, the user must not change the value of the these counters which are +% used internally by \pkg{nicematrix}. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +% $\begin{pNiceMatrix}% don't forget the % +% [first-row, +% first-col, +% code-for-first-row = \mathbf{~emphase#\alph{jCol}@} , +% code-for-first-col = \mathbf{~emphase#\arabic{iRow}@} ] +% & & & & \\ +% & 1 & 2 & 3 & 4 \\ +% & 5 & 6 & 7 & 8 \\ +% & 9 & 10 & 11 & 12 +% \end{pNiceMatrix}$ +% \end{BVerbatim} +% $\begin{pNiceMatrix}[first-row, +% first-col, +% code-for-first-row = \mathbf{\alph{jCol}} , +% code-for-first-col = \mathbf{\arabic{iRow}} ] +% & & & & \\ +% & 1 & 2 & 3 & 4 \\ +% & 5 & 6 & 7 & 8 \\ +% & 9 & 10 & 11 & 12 +% \end{pNiceMatrix}$ +% +% \smallskip +% If LaTeX counters called |iRow| and |jCol| are defined in the document by +% extensions other than \pkg{nicematrix} (or by the user), they are shadowed in +% the environements of \pkg{nicematrix}. +% % \section{The option hlines} % % You can add horizontal rules between rows in the environments of @@ -1385,8 +1422,7 @@ c & c & b & a & e % If the package \pkg{siunitx} is loaded (before or after \pkg{nicematrix}), % it's possible to use the |S| column type of \pkg{siunitx} in the environments % of \pkg{nicematrix}. The implementation doesn't use explicitly any private -% macro of \pkg{siunitx}. The |d| columns of the package \pkg{dcolumn} are not -% supported by \pkg{nicematrix}. +% macro of \pkg{siunitx}. % % % \medskip @@ -1407,6 +1443,8 @@ c & c & b & a & e % 7.2 & 0 & \Cdots & 0 % \end{pNiceArray}$ % +% On the other hand, the |d| columns of the package \pkg{dcolumn} are not +% supported by \pkg{nicematrix}. % % \section{Technical remarks} % @@ -2280,25 +2318,25 @@ c & c & b & a & e % $\begin{array}{cc} % & % \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row] -% & & C_j \\ +% & & C_j \\ % b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\ -% \Vdots & & \Vdots & & \Vdots \\ -% & & b_{kj} \\ -% & & \Vdots \\ -% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} +% \Vdots & & \Vdots & & \Vdots \\ +% & & b_{kj} \\ +% & & \Vdots \\ +% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} % \end{bNiceArray} \\ \\ % \begin{bNiceArray}{CC>{\strut}CCC}[name=A,first-col] -% & a_{11} & \Cdots & & & a_{nn} \\ -% & \Vdots & & & & \Vdots \\ +% & a_{11} & \Cdots & & & a_{nn} \\ +% & \Vdots & & & & \Vdots \\ % L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\ -% & \Vdots & & & & \Vdots \\ -% & a_{n1} & \Cdots & & & a_{nn} \\ +% & \Vdots & & & & \Vdots \\ +% & a_{n1} & \Cdots & & & a_{nn} \\ % \end{bNiceArray} % & % \begin{bNiceArray}{CC>{\strut}CCC} -% & & & & \\ +% & & & & \\ % & & \Vdots \\ -% \Cdots & & c_{ij} \\ +% \Cdots & & c_{ij} \\ % \\ % \\ % \end{bNiceArray} @@ -2330,14 +2368,11 @@ c & c & b & a & e % % \smallskip % Of course, the package \pkg{nicematrix} uses the features of the package -% \pkg{array}. It tries to be independant of its implementation. Unfortunately, -% it was not possible to be strictly independant: the package \pkg{nicematrix} +% \pkg{array}. It tries to be independent of its implementation. Unfortunately, +% it was not possible to be strictly independent: the package \pkg{nicematrix} % relies upon the fact that the package |{array}| uses |\ialign| to begin the % |\halign|. % -% \smallskip -% The desire to do no modification to existing code leads to complications in -% the code of this extension. % % \subsection{Declaration of the package and extensions loaded} % @@ -2353,7 +2388,7 @@ c & c & b & a & e % \begin{macrocode} \RequirePackage{tikz} \usetikzlibrary{fit} -\RequirePackage{expl3}[2019/02/15] +\RequirePackage{expl3}[2019/07/01] % \end{macrocode} % % We give the traditionnal declaration of a package written with |expl3|: @@ -2387,7 +2422,7 @@ c & c & b & a & e % \begin{macrocode} \RequirePackage { array } \RequirePackage { amsmath } -\RequirePackage { xparse } [ 2018-10-17 ] +\RequirePackage { xparse } [ 2018-07-01 ] % \end{macrocode} % % \bigskip @@ -2422,6 +2457,13 @@ c & c & b & a & e { } % \end{macrocode} % +% +% The following message must be defined right now because it may be used during +% the loading of the package. +% \begin{macrocode} +\@@_msg_new:nn { Draft~mode } + { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. } +% \end{macrocode} % % \begin{macrocode} \bool_if:NT \c_@@_draft_bool @@ -2471,7 +2513,7 @@ c & c & b & a & e % The dimension |\l_@@_columns_width_dim| will be used when the options specify % that all the columns must have the same width (but, if the key |columns-width| % is used with the special value |auto|, the boolean -% |l_@@_auto_columns_width_bool| will be raised). +% |l_@@_auto_columns_width_bool| also will be raised). % \begin{macrocode} \dim_new:N \l_@@_columns_width_dim % \end{macrocode} @@ -2565,7 +2607,7 @@ c & c & b & a & e \dim_set:Nn \l_@@_inter_dots_dim { 0.45 em } % \end{macrocode} % The length |\l_@@_radius_dim| is the radius of the dots for the dotted lines. -% The default value is 0.34~pt but it will changed if the option |small| is +% The default value is 0.34~pt but it will be changed if the option |small| is % used. % \begin{macrocode} \dim_new:N \l_@@_radius_dim @@ -2582,6 +2624,19 @@ c & c & b & a & e \tl_new:N \g_@@_code_after_tl % \end{macrocode} % +% +% \bigskip +% The counters |\l_@@_save_iRow_int| and |\l_@@_save_jCol_int| will be used to +% save the values of the eventual LaTeX counters |iRow| and |jCol|. These LaTeX +% counters will be restored at the end of the environment. +% \begin{macrocode} +\int_new:N \l_@@_save_iRow_int +\int_new:N \l_@@_save_jCol_int +% \end{macrocode} +% +% The TeX counters |\c@iRow| and |\c@jCol| will be created in the beginning of +% the environment |{NiceArrayWithDelims}| (if they don't exist previously). +% % \bigskip % \subsubsection{Variables for the exterior rows and columns} % @@ -2844,7 +2899,7 @@ c & c & b & a & e % \bigskip % The following flag will be used when the current options specify that all the % columns of the array must have the same width equal to the largest width of a -% cell of the array (except the cell of the potential exterior columns). +% cell of the array (except the cells of the potential exterior columns). % \begin{macrocode} \bool_new:N \l_@@_auto_columns_width_bool % \end{macrocode} @@ -2918,10 +2973,9 @@ c & c & b & a & e % % \bigskip % An option to test whether the extra nodes will be created (these nodes are the -% ``medium nodes'' and ``large nodes''). In some circonstancies, the extra nodes -% are created automatically, for example when a dotted line has an ``open'' -% extremity.\footnote{In fact, we should not because, if there is a |w|~node, -% the |w|~node is used instead of the ``medium'' node.} +% ``medium nodes'' and the ``large nodes''). In some circonstancies, the extra +% nodes are created automatically, for example when a dotted line has an +% ``open'' extremity. % \begin{macrocode} create-extra-nodes .bool_set:N = \l_@@_extra_nodes_bool , left-margin .dim_set:N = \l_@@_left_margin_dim , @@ -2949,11 +3003,13 @@ c & c & b & a & e { \dim_set:Nn \l_@@_columns_width_dim { #1 } } , columns-width .value_required:n = true , name .code:n = - \str_set:Nn \l_tmpa_str { #1 } - \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str - { \@@_error:nn { Duplicate~name } { #1 } } - { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str } - \str_set_eq:NN \l_@@_name_str \l_tmpa_str , + \unless \ifmeasuring@ + \str_set:Nn \l_tmpa_str { #1 } + \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str + { \@@_error:nn { Duplicate~name } { #1 } } + { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str } + \str_set_eq:NN \l_@@_name_str \l_tmpa_str + \fi , name .value_required:n = true , code-after .tl_gset:N = \g_@@_code_after_tl , code-after .value_required:n = true , @@ -3158,21 +3214,21 @@ c & c & b & a & e \cs_new_protected:Nn \@@_Cell: { % \end{macrocode} -% We increment |\g_@@_col_int|, which is the counter of the columns. +% We increment |\c@jCol|, which is the counter of the columns. % \begin{macrocode} - \int_gincr:N \g_@@_col_int + \int_gincr:N \c@jCol % \end{macrocode} % Now, we increment the counter of the rows. We don't do this incrementation in % the |\everycr| because some packages, like \pkg{arydshln}, create special rows % in the |\halign| that we don't want to take into account. % \begin{macrocode} - \int_compare:nNnT \g_@@_col_int = \c_one_int + \int_compare:nNnT \c@jCol = \c_one_int { \int_compare:nNnT \l_@@_first_col_int = \c_one_int \@@_begin_of_row: } \int_gset:Nn \g_@@_col_total_int - { \int_max:nn \g_@@_col_total_int \g_@@_col_int } + { \int_max:nn \g_@@_col_total_int \c@jCol } % \end{macrocode} % The content of the cell is composed in the box |\l_tmpa_box| because we want % to compute some dimensions of the box. The |\hbox_set_end:| corresponding to @@ -3182,10 +3238,21 @@ c & c & b & a & e \hbox_set:Nw \l_tmpa_box \c_math_toggle_token \bool_if:NT \l_@@_small_bool \scriptstyle - \int_compare:nNnTF \g_@@_row_int = \c_zero_int - \l_@@_code_for_first_row_tl +% \end{macrocode} +% +% We will call \emph{corners} of the matrix the cases which are at the +% intersection of the exterior rows and exterior columns (of course, the four +% corners doesn't always exist simultaneously). In a corner of the matrix, it +% would be logical to use none of the codes |\l_@@_code_for_first_row_tl| and +% \emph{al}. As for now, this result is acheived only for the north-west corner +% (this allows an automatic numerotation of the rows ans the columns with |iRow| +% and |jCol| with the first col and the first row --- probably the preferential +% choice for such a numerotation). +% \begin{macrocode} + \int_compare:nNnTF \c@iRow = \c_zero_int + { \int_compare:nNnT \c@jCol > \c_zero_int \l_@@_code_for_first_row_tl } { - \int_compare:nNnT \g_@@_row_int = \l_@@_last_row_int + \int_compare:nNnT \c@iRow = \l_@@_last_row_int \l_@@_code_for_last_row_tl } } @@ -3198,7 +3265,7 @@ c & c & b & a & e % \begin{macrocode} \cs_new_protected:Nn \@@_begin_of_row: { - \int_gincr:N \g_@@_row_int + \int_gincr:N \c@iRow \dim_gset_eq:NN \g_@@_dp_ante_last_row_dim \g_@@_dp_last_row_dim \dim_gzero:N \g_@@_dp_last_row_dim \dim_gzero:N \g_@@_ht_last_row_dim @@ -3213,14 +3280,14 @@ c & c & b & a & e % \begin{macrocode} \cs_new_protected:Npn \@@_actualization_for_first_and_last_row: { - \int_compare:nNnT \g_@@_row_int = \c_zero_int + \int_compare:nNnT \c@iRow = \c_zero_int { \dim_gset:Nn \g_@@_dp_row_zero_dim { \dim_max:nn \g_@@_dp_row_zero_dim { \box_dp:N \l_tmpa_box } } \dim_gset:Nn \g_@@_ht_row_zero_dim { \dim_max:nn \g_@@_ht_row_zero_dim { \box_ht:N \l_tmpa_box } } } - \int_compare:nNnT \g_@@_row_int = \c_one_int + \int_compare:nNnT \c@iRow = \c_one_int { \dim_gset:Nn \g_@@_ht_row_one_dim { \dim_max:nn \g_@@_ht_row_one_dim { \box_ht:N \l_tmpa_box } } @@ -3266,14 +3333,14 @@ c & c & b & a & e [ anchor = base , name = nm - \int_use:N \g_@@_env_int - - \int_use:N \g_@@_row_int - - \int_use:N \g_@@_col_int , + \int_use:N \c@iRow - + \int_use:N \c@jCol , alias = \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - - \int_use:N \g_@@_row_int - - \int_use:N \g_@@_col_int + \int_use:N \c@iRow - + \int_use:N \c@jCol } ] \bgroup @@ -3342,14 +3409,14 @@ c & c & b & a & e [ node~contents = { } , name = nm - \int_use:N \g_@@_env_int - - \int_use:N \g_@@_row_int - - \int_use:N \g_@@_col_int - w, + \int_use:N \c@iRow - + \int_use:N \c@jCol - w, alias = \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - - \int_use:N \g_@@_row_int - - \int_use:N \g_@@_col_int - w + \int_use:N \c@iRow - + \int_use:N \c@jCol - w } , inner~sep = \c_zero_dim , fit = (@@~south~west) (@@~north~east) @@ -3414,8 +3481,8 @@ c & c & b & a & e { g_@@_ #1 _ lines _ tl } { \use:c { @@ _ draw _ #1 : nn } - { \int_use:N \g_@@_row_int } - { \int_use:N \g_@@_col_int } + { \int_use:N \c@iRow } + { \int_use:N \c@jCol } } } } @@ -3459,17 +3526,17 @@ c & c & b & a & e % \begin{macrocode} \cs_new_protected:Npn \@@_everycr_i: { - \int_gzero:N \g_@@_col_int + \int_gzero:N \c@jCol \bool_if:NT \l_@@_hlines_bool { % \end{macrocode} -% The counter |\g_@@_row_int| has the value $-1$ only if there is a ``first +% The counter |\c@iRow| has the value $-1$ only if there is a ``first % row'' and that we are before that ``first row'', i.e. just before the % beginning of the array. % \begin{macrocode} - \int_compare:nNnT \g_@@_row_int > { -1 } + \int_compare:nNnT \c@iRow > { -1 } { - \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int + \int_compare:nNnF \c@iRow = \l_@@_last_row_int { \hrule \@height \arrayrulewidth \skip_vertical:n { - \arrayrulewidth } @@ -3487,6 +3554,13 @@ c & c & b & a & e % \begin{macrocode} \cs_new_protected:Npn \@@_pre_array: { + \cs_if_exist:NT \theiRow + { \int_set_eq:NN \l_@@_save_iRow_int \c@iRow } + \int_gzero_new:N \c@iRow + \cs_if_exist:NT \thejCol + { \int_set_eq:NN \l_@@_save_jCol_int \c@jCol } + \int_gzero_new:N \c@jCol + \normalbaselines % \end{macrocode} % If the option |small| is used, we have to do some tuning. In particular, we % change the value of |\arraystretch| (this parameter is used in the @@ -3505,7 +3579,7 @@ c & c & b & a & e % \medskip % We switch to a global version of the boolean |\g_@@_extra_nodes_bool|, % because, in some circonstancies, the boolean will be raised from inside a -% cell of the |\halign| (in particular in a column of type |w|). +% cell of the |\halign| (in particular in a column of type~|w|). % % \begin{macrocode} \bool_gset_eq:NN \g_@@_extra_nodes_bool \l_@@_extra_nodes_bool @@ -3614,14 +3688,13 @@ c & c & b & a & e % \end{macrocode} % % -% The counter |\g_@@_row_int| will be used to count the rows of the array (its +% The counter |\c@iRow| will be used to count the rows of the array (its % incrementation will be in the first cell of the row). % \begin{macrocode} - \int_gzero_new:N \g_@@_row_int - \int_gset:Nn \g_@@_row_int { \l_@@_first_row_int - 1 } + \int_gset:Nn \c@iRow { \l_@@_first_row_int - 1 } % \end{macrocode} % -% At the end of the environment |{array}|, |\g_@@_row_int| will be the total +% At the end of the environment |{array}|, |\c@iRow| will be the total % number de rows and |\g_@@_row_total_int| will be the number or rows excepted % the last row (if |\l_@@_last_row_bool| has been raised with the option % |last-row|). @@ -3629,18 +3702,18 @@ c & c & b & a & e \int_gzero_new:N \g_@@_row_total_int % \end{macrocode} % -% The counter |\g_@@_col_int| will be used to count the columns of the array. +% The counter |\c@jCol| will be used to count the columns of the array. % Since we want to know the total number of columns of the matrix, we also % create a counter |\g_@@_col_total_int|. These counters are updated in the % command |\@@_Cell:| executed at the beginning of each cell. % \begin{macrocode} - \int_gzero_new:N \g_@@_col_int \int_gzero_new:N \g_@@_col_total_int % \end{macrocode} % % \begin{macrocode} \cs_set_eq:NN \@ifnextchar \new@ifnextchar % \end{macrocode} +% % We nullify the definitions of the column types |w| and |W| before their % redefinition because we want to avoid a warning in the log file for a % redefinition of a column type. We must put |\relax| and not @@ -3670,7 +3743,17 @@ c & c & b & a & e ! { \skip_horizontal:n { 0.53 pt } - \bool_gset_true:N \g_@@_extra_nodes_bool +% \end{macrocode} +% If the array is an array with all the columns of the same width, we don't ask +% for the creation of the extra nodes because we will use the ``|col|'' nodes +% for the vertical dotted line. +% \begin{macrocode} + \bool_if:nF + { + \l_@@_auto_columns_width_bool + || \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim + } + { \bool_gset_true:N \g_@@_extra_nodes_bool } % \end{macrocode} % % \medskip @@ -3693,15 +3776,15 @@ c & c & b & a & e % ``|:|'' encountered during the parsing has already been taken into account in % the |code-after|. % \begin{macrocode} - \int_compare:nNnT \g_@@_col_int > \g_@@_last_vdotted_col_int + \int_compare:nNnT \c@jCol > \g_@@_last_vdotted_col_int { - \int_gset_eq:NN \g_@@_last_vdotted_col_int \g_@@_col_int + \int_gset_eq:NN \g_@@_last_vdotted_col_int \c@jCol \tl_gput_right:Nx \g_@@_code_after_tl % \end{macrocode} % The command |\@@_vdottedline:n| is protected, and, therefore, won't be % expanded before writing on |\g_@@_code_after_tl|. % \begin{macrocode} - { \@@_vdottedline:n { \int_use:N \g_@@_col_int } } + { \@@_vdottedline:n { \int_use:N \c@jCol } } } } } @@ -3899,13 +3982,13 @@ c & c & b & a & e % |{NiceMatrixBlock}|), we add a row in the array to fix the width of the % columns and construct the ``|col|'' nodes |nm-|\textsl{a}|-col-|\textsl{j} % (these nodes will be used by the horizontal open dotted lines and by the -% potential commands |\@@_vdottedline:n|). +% commands |\@@_vdottedline:n|). % % \begin{macrocode} { \bool_if:nT { - ( \l_@@_auto_columns_width_bool && ! \l_@@_block_auto_columns_width_bool) + \l_@@_auto_columns_width_bool || \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim } { @@ -3916,11 +3999,13 @@ c & c & b & a & e % First, we put a ``|col|'' node on the left of the first column (of course, we % have to do that \emph{after} the |\omit|). % \begin{macrocode} + \skip_horizontal:N \arraycolsep \tikz [ remember~picture , overlay ] \coordinate [ name = nm - \int_use:N \g_@@_env_int - col - 0 ] ; + \skip_horizontal:n { - \arraycolsep } % \end{macrocode} % We compute in |\g_tmpa_dim| the common width of the columns. We use a global -% variable because we are in a cell of an |\halign| and that we have to use this +% variable because we are in a cell of an |\halign| and because we have to use this % variable in other cells (of the same row). The affectation of |\g_tmpa_dim|, % like all the affectations, must be done after the |\omit| of the cell. % \begin{macrocode} @@ -3936,18 +4021,20 @@ c & c & b & a & e { \dim_gset:Nn \g_tmpa_dim { \l_@@_columns_width_dim + 2 \arraycolsep } - } + } \skip_horizontal:N \g_tmpa_dim + \tikz [ remember~picture , overlay ] + \coordinate [ name = nm - \int_use:N \g_@@_env_int - col - 1 ] ; % \end{macrocode} % We begin a loop over the columns. The integer |\g_tmpa_int| will be the -% number of columns of the current cell. This integer is not used to fix the +% number of the current column. This integer is not used to fix the % width of the column (since all the columns have the same width equal to % |\g_@@_tmpa_dim|) but for the Tikz nodes. % \begin{macrocode} \int_gset:Nn \g_tmpa_int 1 \bool_if:nTF \g_@@_last_col_found_bool + { \prg_replicate:nn { \g_@@_col_total_int - 3 } } { \prg_replicate:nn { \g_@@_col_total_int - 2 } } - { \prg_replicate:nn { \g_@@_col_total_int - 1 } } { & \omit @@ -3967,6 +4054,22 @@ c & c & b & a & e col - \int_use:N \g_tmpa_int ] ; } +% \end{macrocode} +% For the last column, we want a special treatment because of the final +% |\arraycolsep|. +% \begin{macrocode} + & + \omit + \int_gincr:N \g_tmpa_int + \skip_horizontal:N \g_tmpa_dim + \skip_horizontal:n { - \arraycolsep } + \tikz [ remember~picture , overlay ] + \coordinate + [ + name = nm - \int_use:N \g_@@_env_int - + col - \int_use:N \g_tmpa_int + ] ; + \skip_horizontal:N \arraycolsep } \endarray \c_math_toggle_token @@ -3982,10 +4085,10 @@ c & c & b & a & e { \bool_if:NF \l_@@_last_row_without_value_bool { - \int_compare:nNnF \l_@@_last_row_int = \g_@@_row_int + \int_compare:nNnF \l_@@_last_row_int = \c@iRow { \@@_error:n { Wrong~last~row } - \int_gset_eq:NN \l_@@_last_row_int \g_@@_row_int + \int_gset_eq:NN \l_@@_last_row_int \c@iRow } } } @@ -3997,12 +4100,8 @@ c & c & b & a & e % \begin{macrocode} \int_compare:nNnTF \l_@@_first_row_int = \c_zero_int { - \dim_set:Nn \l_tmpa_dim - { - \g_@@_ht_row_one_dim + \g_@@_dp_row_zero_dim - + \lineskip - + \g_@@_ht_row_zero_dim - \g_@@_ht_row_one_dim - } + \dim_set:Nn \l_tmpa_dim + { \g_@@_dp_row_zero_dim + \lineskip + \g_@@_ht_row_zero_dim } } { \dim_zero:N \l_tmpa_dim } % \end{macrocode} @@ -4016,11 +4115,7 @@ c & c & b & a & e \int_compare:nNnTF \l_@@_last_row_int > { -2 } { \dim_set:Nn \l_tmpb_dim - { - \g_@@_ht_last_row_dim + \g_@@_dp_ante_last_row_dim - + \lineskip - + \g_@@_dp_last_row_dim - \g_@@_dp_ante_last_row_dim - } + { \g_@@_ht_last_row_dim + \lineskip + \g_@@_dp_last_row_dim } } { \dim_zero:N \l_tmpb_dim } % \end{macrocode} @@ -4136,7 +4231,7 @@ c & c & b & a & e \hbox_set:Nw \l_tmpa_box \c_math_toggle_token \bool_if:NT \l_@@_small_bool \scriptstyle - \l_@@_code_for_first_col_tl + \int_compare:nNnT \c@iRow > \c_zero_int \l_@@_code_for_first_col_tl } l < @@ -4173,13 +4268,13 @@ c & c & b & a & e name = nm - \int_use:N \g_@@_env_int - - \int_use:N \g_@@_row_int - + \int_use:N \c@iRow - 0 , alias = \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - - \int_use:N \g_@@_row_int - + \int_use:N \c@iRow - 0 } ] @@ -4209,9 +4304,9 @@ c & c & b & a & e % column'' is really used. % \begin{macrocode} \bool_gset_true:N \g_@@_last_col_found_bool - \int_gincr:N \g_@@_col_int + \int_gincr:N \c@jCol \int_gset:Nn \g_@@_col_total_int - { \int_max:nn \g_@@_col_total_int \g_@@_col_int } + { \int_max:nn \g_@@_col_total_int \c@jCol } % \end{macrocode} % The contents of the cell is constructed in the box |\l_tmpa_box| because we % have to compute some dimensions of this box. @@ -4263,14 +4358,14 @@ c & c & b & a & e name = nm - \int_use:N \g_@@_env_int - - \int_use:N \g_@@_row_int - - \int_use:N \g_@@_col_int , + \int_use:N \c@iRow - + \int_use:N \c@jCol , alias = \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - - \int_use:N \g_@@_row_int - - \int_use:N \g_@@_col_int + \int_use:N \c@iRow - + \int_use:N \c@jCol } ] { \box_use:N \l_tmpa_box } ; @@ -4395,10 +4490,6 @@ c & c & b & a & e \@@_define_env:n V % \end{macrocode} % -% -% \bigskip -% \subsection{Automatic width of the cells} -% % % \bigskip % \subsection{How to know whether a cell is ``empty''} @@ -4504,15 +4595,16 @@ c & c & b & a & e % % \subsection{After the construction of the array} % -% The macro |\@@_after_array:| is called (via |\group_insert_after:N|) in -% |{NiceArrayWithDelims}| and |{NiceMatrix}|. % % \begin{macrocode} \cs_new_protected:Nn \@@_after_array: { - \int_compare:nNnTF \g_@@_row_int > \c_zero_int + \int_compare:nNnTF \c@iRow > \c_zero_int \@@_after_array_i: - { \@@_error:n { Zero~row } } + { + \@@_error:n { Zero~row } + \@@_restore_iRow_jCol: + } } % \end{macrocode} % @@ -4527,22 +4619,22 @@ c & c & b & a & e \cs_if_exist:NT \tikz@library@external@loaded { \tikzset { external / export = false } } % \end{macrocode} -% Now, the definition of |\g_@@_col_int| and -% |\g_@@_col_total_int| change: |\g_@@_col_int| will be the number of +% Now, the definition of |\c@jCol| and +% |\g_@@_col_total_int| change: |\c@jCol| will be the number of % columns without the ``last column''; |\g_@@_col_total_int| will be the % number of columns with this ``last column''.\footnote{We remind that the % potential ``first column'' has the number~$0$.} % \begin{macrocode} - \int_gset_eq:NN \g_@@_col_int \g_@@_col_total_int - \bool_if:nT \g_@@_last_col_found_bool { \int_gdecr:N \g_@@_col_int } + \int_gset_eq:NN \c@jCol \g_@@_col_total_int + \bool_if:nT \g_@@_last_col_found_bool { \int_gdecr:N \c@jCol } % \end{macrocode} % -% We fix also the value of |\g_@@_row_int| and |\g_@@_row_total_int| with the +% We fix also the value of |\c@iRow| and |\g_@@_row_total_int| with the % same principle. % \begin{macrocode} - \int_gset_eq:NN \g_@@_row_total_int \g_@@_row_int + \int_gset_eq:NN \g_@@_row_total_int \c@iRow \int_compare:nNnT \l_@@_last_row_int > { -1 } - { \int_gsub:Nn \g_@@_row_int \c_one_int } + { \int_gsub:Nn \c@iRow \c_one_int } % \end{macrocode} % % In the user has used the option |last-row| without value, we write in the @@ -4642,17 +4734,26 @@ c & c & b & a & e \tikzset { every~picture / .style = - { - overlay , - remember~picture , - name~prefix = nm - \int_use:N \g_@@_env_int - - } + { + overlay , + remember~picture , + name~prefix = nm - \int_use:N \g_@@_env_int - + } } \cs_set_eq:NN \line \@@_line:nn \g_@@_code_after_tl \tl_gclear:N \g_@@_code_after_tl \group_end: \str_gclear:N \g_@@_type_env_str + \@@_restore_iRow_jCol: + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Nn \@@_restore_iRow_jCol: + { + \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c@iRow \l_@@_save_iRow_int } + \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c@jCol \l_@@_save_jCol_int } } % \end{macrocode} % @@ -4733,7 +4834,7 @@ c & c & b & a & e % We test if we are still in the matrix. % \begin{macrocode} \bool_set_false:N \l_@@_final_open_bool - \int_compare:nNnTF \l_@@_final_i_int > \g_@@_row_int + \int_compare:nNnTF \l_@@_final_i_int > \c@iRow { \int_compare:nNnT { #3 } = 1 { \bool_set_true:N \l_@@_final_open_bool } @@ -4745,7 +4846,7 @@ c & c & b & a & e { \bool_set_true:N \l_@@_final_open_bool } } { - \int_compare:nNnT \l_@@_final_j_int > \g_@@_col_int + \int_compare:nNnT \l_@@_final_j_int > \c@jCol { \int_compare:nNnT { #4 } = 1 { \bool_set_true:N \l_@@_final_open_bool } @@ -4837,7 +4938,7 @@ c & c & b & a & e { \bool_set_true:N \l_@@_initial_open_bool } } { - \int_compare:nNnT \l_@@_initial_j_int > \g_@@_col_int + \int_compare:nNnT \l_@@_initial_j_int > \c@jCol { \int_compare:nNnT { #4 } = { -1 } { \bool_set_true:N \l_@@_initial_open_bool } @@ -4941,6 +5042,47 @@ c & c & b & a & e \cs_generate_variant:Nn \@@_retrieve_coords:nn { x x } % \end{macrocode} % +% \interitem +% For the horizontal lines with open extremities, we must take into account the +% ``|col|'' nodes created in the environments which have a fixed width of the +% columns. The following command will recompute the $x$-value of the extremities +% in this case (erasing the value computed in |\@@_retrieve_coords:nn|). +% \begin{macrocode} +\cs_new_protected:Nn \@@_adjust_with_col_nodes: + { + \bool_if:NT \l_@@_initial_open_bool + { + \cs_if_exist:cT + { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - col - 0 } + { + \begin { tikzpicture } [ remember~picture ] + \tikz@parse@node \pgfutil@firstofone + ( nm - \int_use:N \g_@@_env_int - col - 0 ) + \dim_gset:Nn \g_@@_x_initial_dim \pgf@x + \end { tikzpicture } + } + } + \bool_if:NT \l_@@_final_open_bool + { + \cs_if_exist:cT + { + pgf@sh@ns@nm - \int_use:N \g_@@_env_int - col - + \int_use:N \c@jCol + } + { + \begin { tikzpicture } [ remember~picture ] + \tikz@parse@node \pgfutil@firstofone + ( + nm - \int_use:N \g_@@_env_int - col - + \int_use:N \c@jCol + ) + \dim_gset:Nn \g_@@_x_final_dim \pgf@x + \end { tikzpicture } + } + } + } +% \end{macrocode} +% % \interitem % \begin{macrocode} \cs_new_protected:Nn \@@_draw_Ldots:nn @@ -4996,6 +5138,7 @@ c & c & b & a & e } { .base~west } } + \@@_adjust_with_col_nodes: \bool_if:NT \l_@@_initial_open_bool { \dim_gset_eq:NN \g_@@_y_initial_dim \g_@@_y_final_dim } \bool_if:NT \l_@@_final_open_bool @@ -5051,6 +5194,7 @@ c & c & b & a & e } { .mid~west } } + \@@_adjust_with_col_nodes: \bool_if:NT \l_@@_initial_open_bool { \dim_gset_eq:NN \g_@@_y_initial_dim \g_@@_y_final_dim } \bool_if:NT \l_@@_final_open_bool @@ -5365,7 +5509,7 @@ c & c & b & a & e \l_tmpb_int } \begin { tikzpicture } [ overlay ] - \int_step_inline:nnnn 0 1 \l_tmpa_int + \int_step_inline:nnn 0 \l_tmpa_int { \pgfpathcircle { \pgfpoint { \g_@@_x_initial_dim } { \g_@@_y_initial_dim } } @@ -5400,7 +5544,7 @@ c & c & b & a & e \cs_new_protected:Nn \@@_add_to_empty_cells: { \cs_gset:cpx - { @@ _ empty _ \int_use:N \g_@@_row_int - \int_use:N \g_@@_col_int } + { @@ _ empty _ \int_use:N \c@iRow - \int_use:N \c@jCol } { \int_use:N \g_@@_env_int } } % \end{macrocode} @@ -5485,10 +5629,10 @@ c & c & b & a & e \int_compare:nNnT #1 > 1 { \seq_gput_left:Nx \g_@@_multicolumn_cells_seq - { \int_eval:n \g_@@_row_int - \int_use:N \g_@@_col_int } + { \int_eval:n \c@iRow - \int_use:N \c@jCol } \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } } - \int_gadd:Nn \g_@@_col_int { #1 - 1 } + \int_gadd:Nn \c@jCol { #1 - 1 } } % \end{macrocode} % @@ -5526,8 +5670,8 @@ c & c & b & a & e \tl_gput_right:Nx \g_@@_Hdotsfor_lines_tl { \@@_draw_Hdotsfor:nnn - { \int_use:N \g_@@_row_int } - { \int_use:N \g_@@_col_int } + { \int_use:N \c@iRow } + { \int_use:N \c@jCol } { #2 } } \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } } @@ -5563,7 +5707,7 @@ c & c & b & a & e \bool_set_true:N \l_@@_initial_open_bool } } - \int_compare:nNnTF { #2 + #3 -1 } = \g_@@_col_int + \int_compare:nNnTF { #2 + #3 -1 } = \c@jCol { \int_set:Nn \l_@@_final_j_int { #2 + #3 - 1 } \bool_set_true:N \l_@@_final_open_bool @@ -5601,34 +5745,41 @@ c & c & b & a & e % \begin{macrocode} \cs_new_protected:Nn \@@_line:nn { - \dim_zero_new:N \g_@@_x_initial_dim - \dim_zero_new:N \g_@@_y_initial_dim - \dim_zero_new:N \g_@@_x_final_dim - \dim_zero_new:N \g_@@_y_final_dim - \bool_set_false:N \l_@@_initial_open_bool - \bool_set_false:N \l_@@_final_open_bool - \bool_if:nTF + \bool_if:NF \c_@@_draft_bool { - \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #1 } - && - \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #2 } - } - { - \begin { tikzpicture } - \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ; - \tikz@parse@node \pgfutil@firstofone ( i ) - \dim_gset:Nn \g_@@_x_initial_dim \pgf@x - \dim_gset:Nn \g_@@_y_initial_dim \pgf@y - \tikz@parse@node \pgfutil@firstofone ( f ) - \dim_gset:Nn \g_@@_x_final_dim \pgf@x - \dim_gset:Nn \g_@@_y_final_dim \pgf@y - \end { tikzpicture } - \@@_draw_tikz_line: + \dim_zero_new:N \g_@@_x_initial_dim + \dim_zero_new:N \g_@@_y_initial_dim + \dim_zero_new:N \g_@@_x_final_dim + \dim_zero_new:N \g_@@_y_final_dim + \bool_set_false:N \l_@@_initial_open_bool + \bool_set_false:N \l_@@_final_open_bool + \bool_if:nTF + { + \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #1 } + && + \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #2 } + } + { + \begin { tikzpicture } + \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ; + \tikz@parse@node \pgfutil@firstofone ( i ) + \dim_gset:Nn \g_@@_x_initial_dim \pgf@x + \dim_gset:Nn \g_@@_y_initial_dim \pgf@y + \tikz@parse@node \pgfutil@firstofone ( f ) + \dim_gset:Nn \g_@@_x_final_dim \pgf@x + \dim_gset:Nn \g_@@_y_final_dim \pgf@y + \end { tikzpicture } + \@@_draw_tikz_line: + } + { + \@@_error:nnn { unknown~cell~for~line~in~code-after } + { #1 } { #2 } + } } - { \@@_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 } } } % \end{macrocode} % +% % The commands |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, and |\Iddots| don't use % this command because they have to do other settings (for example, the diagonal % lines must be parallelized). @@ -5727,7 +5878,6 @@ c & c & b & a & e \int_compare:nNnTF #1 = \c_zero_int { \@@_error:n { Use~of~:~in~first~position } } { - \@@_create_extra_nodes: \bool_if:NF \c_@@_draft_bool { \dim_zero_new:N \g_@@_x_initial_dim @@ -5737,50 +5887,63 @@ c & c & b & a & e \bool_set_true:N \l_@@_initial_open_bool \bool_set_true:N \l_@@_final_open_bool % \end{macrocode} -% In order to have the coordinates of the line to draw, we use the ``large -% nodes''. -% \begin{macrocode} - \begin { tikzpicture } [ remember~picture ] - \tikz@parse@node\pgfutil@firstofone - ( 1 - #1 - large .north~east ) - \dim_gset:Nn \g_@@_x_initial_dim \pgf@x - \dim_gset:Nn \g_@@_y_initial_dim \pgf@y - \tikz@parse@node\pgfutil@firstofone - ( \int_use:N \g_@@_row_int - #1 - large .south~east ) - \dim_gset:Nn \g_@@_x_final_dim \pgf@x - \dim_gset:Nn \g_@@_y_final_dim \pgf@y - \end { tikzpicture } -% \end{macrocode} -% However, if the previous column was constructed with a letter |w|, we use the -% |w|-nodes to change the $x$-value of the nodes. +% If a ``|col|'' node exists (if the array has been constructed with a fixed +% width of column), we use it. % \begin{macrocode} - \cs_if_exist:cT - { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - 1 - #1 - w } + \cs_if_exist:cTF + { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - col - #1 } { \begin { tikzpicture } [ remember~picture ] \tikz@parse@node\pgfutil@firstofone - ( 1 - #1 - w .north~east ) + ( col - #1 ) \dim_gset:Nn \g_@@_x_initial_dim \pgf@x - \tikz@parse@node\pgfutil@firstofone - ( \int_use:N \g_@@_row_int - #1 - w .south~east ) \dim_gset:Nn \g_@@_x_final_dim \pgf@x + \dim_gset:Nn \g_@@_y_final_dim \pgf@y \end { tikzpicture } - \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep - \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep + \dim_gset:Nn \g_@@_y_initial_dim { - \c_max_dim } + \int_step_inline:nn \c@jCol + { + \begin { tikzpicture } [ remember~picture ] + \tikz@parse@node\pgfutil@firstofone + ( 1 - ##1 . north~east ) + \dim_gset:Nn \g_@@_y_initial_dim + { \dim_max:nn \g_@@_y_initial_dim \pgf@y } + \end { tikzpicture } + } } % \end{macrocode} -% However, if a node of column exists (if the array has been constructed with a -% fixed width of column), we use it. +% If not, we use the ``large node''. % \begin{macrocode} - \cs_if_exist:cT - { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - col - #1 } { \begin { tikzpicture } [ remember~picture ] \tikz@parse@node\pgfutil@firstofone - ( col - #1 ) + ( 1 - #1 - large .north~east ) \dim_gset:Nn \g_@@_x_initial_dim \pgf@x + \dim_gset:Nn \g_@@_y_initial_dim \pgf@y + \tikz@parse@node\pgfutil@firstofone + ( \int_use:N \c@iRow - #1 - large .south~east ) \dim_gset:Nn \g_@@_x_final_dim \pgf@x + \dim_gset:Nn \g_@@_y_final_dim \pgf@y \end { tikzpicture } +% \end{macrocode} +% However, if the previous column was constructed with a letter |w|, we use the +% |w|-nodes (and we erase the previous computation of the $x$-value of the +% vertical dotted line). +% \begin{macrocode} + \cs_if_exist:cT + { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - 1 - #1 - w } + { + \begin { tikzpicture } [ remember~picture ] + \tikz@parse@node\pgfutil@firstofone + ( 1 - #1 - w .north~east ) + \dim_gset:Nn \g_@@_x_initial_dim \pgf@x + \tikz@parse@node\pgfutil@firstofone + ( \int_use:N \c@iRow - #1 - w .south~east ) + \dim_gset:Nn \g_@@_x_final_dim \pgf@x + \end { tikzpicture } + \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep + \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep + } } \@@_draw_tikz_line: } @@ -5789,7 +5952,6 @@ c & c & b & a & e % \end{macrocode} % % -% % \bigskip % \subsection{The vertical rules} % @@ -5800,7 +5962,7 @@ c & c & b & a & e % with |\newcolumntype|: % \begin{Verbatim}[commandchars=\~\#\+] % \newcolumntype { | } -% { ! { \int_compare:nNnF \g_@@_row_int = \c_zero_int \vline } } +% { ! { \int_compare:nNnF \c@iRow = \c_zero_int \vline } } % \end{Verbatim} % % However, this code fails is the user uses "\DefineShortVerb{\|}" of @@ -5820,45 +5982,45 @@ c & c & b & a & e { \int_compare:nNnTF \l_@@_first_col_int = \c_zero_int { - \int_compare:nNnTF \g_@@_col_int = \c_zero_int + \int_compare:nNnTF \c@jCol = \c_zero_int { \int_compare:nNnTF \l_@@_first_row_int = \c_zero_int { - \int_compare:nNnF \g_@@_row_int = \c_zero_int + \int_compare:nNnF \c@iRow = \c_zero_int { - \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int + \int_compare:nNnF \c@iRow = \l_@@_last_row_int \@@_vline_i: } } { - \int_compare:nNnF \g_@@_row_int = \c_zero_int + \int_compare:nNnF \c@iRow = \c_zero_int { - \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int + \int_compare:nNnF \c@iRow = \l_@@_last_row_int \@@_vline_i: } } } { - \int_compare:nNnF \g_@@_row_int = \c_zero_int + \int_compare:nNnF \c@iRow = \c_zero_int { - \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int + \int_compare:nNnF \c@iRow = \l_@@_last_row_int \@@_vline_i: } } } { - \int_compare:nNnTF \g_@@_col_int = \c_zero_int + \int_compare:nNnTF \c@jCol = \c_zero_int { - \int_compare:nNnF \g_@@_row_int = { -1 } + \int_compare:nNnF \c@iRow = { -1 } { - \int_compare:nNnF \g_@@_row_int = { \l_@@_last_row_int - 1 } + \int_compare:nNnF \c@iRow = { \l_@@_last_row_int - 1 } \@@_vline_i: } } { - \int_compare:nNnF \g_@@_row_int = \c_zero_int + \int_compare:nNnF \c@iRow = \c_zero_int { - \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int + \int_compare:nNnF \c@iRow = \l_@@_last_row_int \@@_vline_i: } } @@ -6043,7 +6205,7 @@ c & c & b & a & e % \bigskip % For ``large nodes'', the exterior rows and columns don't interfer. % That's why the loop over the rows will start at 1 and the loop over the -% columns will stop at $|\g_@@_col_int|$ (and not |\g_@@_col_total_int|). Idem +% columns will stop at $|\c@jCol|$ (and not |\g_@@_col_total_int|). Idem % for the rows. % \begin{macrocode} \int_set:Nn \l_@@_first_row_int 1 @@ -6054,7 +6216,7 @@ c & c & b & a & e % \texttt{l_@@_column_\textsl{j}_min_dim} and % \texttt{l_@@_column_\textsl{j}_max_dim}. % \begin{macrocode} - \int_step_variable:nNn { \g_@@_row_int - 1 } \@@_i: + \int_step_variable:nNn { \c@iRow - 1 } \@@_i: { \dim_set:cn { l_@@_row _ \@@_i: _ min _ dim } { @@ -6067,7 +6229,7 @@ c & c & b & a & e \dim_set_eq:cc { l_@@_row _ \int_eval:n { \@@_i: + 1 } _ max _ dim } { l_@@_row_\@@_i: _min_dim } } - \int_step_variable:nNn { \g_@@_col_int - 1 } \@@_j: + \int_step_variable:nNn { \c@jCol - 1 } \@@_j: { \dim_set:cn { l_@@_column _ \@@_j: _ max _ dim } { @@ -6086,7 +6248,7 @@ c & c & b & a & e { l_@@_column _ 1 _ min _ dim } \l_@@_left_margin_dim \dim_add:cn - { l_@@_column _ \int_use:N \g_@@_col_int _ max _ dim } + { l_@@_column _ \int_use:N \c@jCol _ max _ dim } \l_@@_right_margin_dim % \end{macrocode} % Now, we can actually create the ``large nodes''. @@ -6112,7 +6274,7 @@ c & c & b & a & e \dim_gset:Nn \g_tmpa_dim \pgf@x \tikz@parse@node \pgfutil@firstofone ( nm - \int_use:N \g_@@_env_int - 1 - - \int_use:N \g_@@_col_int - large .north~east ) + \int_use:N \c@jCol - large .north~east ) \dim_gset:Nn \g_tmpb_dim \pgf@x \end { tikzpicture } \iow_now:Nn \@mainaux \ExplSyntaxOn @@ -6220,7 +6382,8 @@ c & c & b & a & e inner~sep = \c_zero_dim , name = nm - \int_use:N \g_@@_env_int - \@@_i: - \@@_j: , alias = - \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - \@@_i: - \@@_j: } + \str_if_empty:NF \l_@@_name_str + { \l_@@_name_str - \@@_i: - \@@_j: } ] ; } @@ -6298,10 +6461,10 @@ c & c & b & a & e \tl_gput_left:Nx \g_@@_code_after_tl { \@@_Block_iv:nnnnn - { \int_use:N \g_@@_row_int } - { \int_use:N \g_@@_col_int } - { \int_eval:n { \g_@@_row_int + #1 - 1 } } - { \int_eval:n { \g_@@_col_int + #2 - 1 } } + { \int_use:N \c@iRow } + { \int_use:N \c@jCol } + { \int_eval:n { \c@iRow + #1 - 1 } } + { \int_eval:n { \c@jCol + #2 - 1 } } \exp_not:n { { #3 $ #4 $ } } } } @@ -6335,8 +6498,8 @@ c & c & b & a & e { \bool_if:nTF { - \int_compare_p:nNn { #3 } > \g_@@_row_int - || \int_compare_p:nNn { #4 } > \g_@@_col_int + \int_compare_p:nNn { #3 } > \c@iRow + || \int_compare_p:nNn { #4 } > \c@jCol } { \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } } { @@ -6461,17 +6624,13 @@ c & c & b & a & e \@@_msg_new:nn { Wrong~last~row } { You~have~used~'last-row=\int_use:N \l_@@_last_row_int'~but~your~environment~ - \{\g_@@_type_env_str\}~seems~to~have~\int_use:N \g_@@_row_int\ - rows.~If~you~go~on,~the~value~of~\int_use:N \g_@@_row_int\ + \{\g_@@_type_env_str\}~seems~to~have~\int_use:N \c@iRow + rows.~If~you~go~on,~the~value~of~\int_use:N \c@iRow will~be~used~for~last~row.~You~can~avoid~this~problem~by~using~'last-row'~ without~value~(more~compilations~might~be~necessary). } % \end{macrocode} % -% \begin{macrocode} -\@@_msg_new:nn { Draft~mode } - { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. } -% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { Yet~in~env } @@ -6616,6 +6775,8 @@ c & c & b & a & e } % \end{macrocode} % +% The following message should be changed because, normally, there can be any +% longer artefact in the environments of \pkg{amsmath}. % \begin{macrocode} \@@_msg_new:nnn { Duplicate~name } { @@ -6623,7 +6784,7 @@ c & c & b & a & e the~same~environment~name~twice.~You~can~go~on,~but,~ maybe,~you~will~have~incorrect~results~especially~ if~you~use~'columns-width=auto'.~If~you~use~nicematrix~inside~some~ - environments~of~amsmath,~this~error~may~be~an~artefact.~In~this~case, + environments~of~amsmath,~this~error~may~be~an~artefact.~In~this~case,~ use~the~option~'allow-duplicate-names'.\\ For~a~list~of~the~names~already~used,~type~H~<return>. \\ } @@ -6658,14 +6819,24 @@ c & c & b & a & e first~position~of~the~preamble~of~the~environment~\{\g_@@_type_env_str\}. \\ If~you~go~on,~this~dotted~line~will~be~ignored. } -% \end{macrocode} +% \end{macrocode} % % % \subsection{Obsolete environments} % +% \begin{macrocode} +\@@_msg_new:nn { Obsolete~environment } + { + The~environment~\{\@currenvir\}~is~obsolete.~ + We~should~use~#1~instead. + } +% \end{macrocode} +% % \begin{macrocode} \NewDocumentEnvironment { pNiceArrayC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~option~'last-col' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \pNiceArray } @@ -6675,6 +6846,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { bNiceArrayC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~option~'last-col' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \bNiceArray } @@ -6684,6 +6857,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { BNiceArrayC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~option~'last-col' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \BNiceArray } @@ -6693,6 +6868,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { vNiceArrayC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~option~'last-col' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \vNiceArray } @@ -6702,6 +6879,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { VNiceArrayC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~option~'last-col' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \VNiceArray } @@ -6711,6 +6890,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { pNiceArrayRC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~options~'last-col'~and~'first-row' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \int_set:Nn \l_@@_first_row_int \c_zero_int \pNiceArray @@ -6721,6 +6902,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { bNiceArrayRC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~options~'last-col'~and~'first-row' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \int_set:Nn \l_@@_first_row_int \c_zero_int \bNiceArray @@ -6731,6 +6914,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { BNiceArrayRC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~options~'last-col'~and~'first-row' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \int_set:Nn \l_@@_first_row_int \c_zero_int \BNiceArray @@ -6741,6 +6926,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { vNiceArrayRC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~options~'last-col'~and~'first-row' } \bool_set_true:N \l_@@_last_col_bool \int_set:Nn \l_@@_first_row_int \c_zero_int \vNiceArray @@ -6751,6 +6938,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { VNiceArrayRC } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~options~'last-col'~and~'first-row' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \int_set:Nn \l_@@_first_row_int \c_zero_int \VNiceArray @@ -6761,6 +6950,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { NiceArrayCwithDelims } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~option~'last-col' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \NiceArrayWithDelims } @@ -6770,6 +6961,8 @@ c & c & b & a & e % \begin{macrocode} \NewDocumentEnvironment { NiceArrayRCwithDelims } { } { + \msg_info:nnn { nicematrix } { Obsolete~environment } + { the~options~'last-col'~and~'first-row' } \int_set:Nn \l_@@_last_col_int \c_zero_dim \int_set:Nn \l_@@_first_row_int \c_zero_int \NiceArrayWithDelims @@ -6778,7 +6971,7 @@ c & c & b & a & e % \end{macrocode} % % -% +% \vspace{1cm} % \section{History} % % \subsection*{Changes between versions 1.0 and 1.1} @@ -6850,15 +7043,15 @@ c & c & b & a & e % \subsection*{Changes between version 2.1.2 and 2.1.3} % % When searching the end of a dotted line from a command like |\Cdots| issued in -% the ``main matrix'' (not in the column |C|), the cells in the column |C| are -% considered as outside the matrix. That means that it's possible to do the -% following matrix with only a |\Cdots| command (and a single |\Vdots|). -% \[\begin{pNiceArrayRC}{Wc{5mm}CWc{5mm}} +% the ``main matrix'' (not in the exterior column), the cells in the exterior +% column are considered as outside the matrix. That means that it's possible to +% do the following matrix with only a |\Cdots| command (and a single |\Vdots|). +% \[\begin{pNiceArray}{Wc{5mm}CWc{5mm}}[first-row,last-col] % & C_j & \\ % \mbox{\Large $0$} & \Vdots & \mbox{\Large $0$} \\ % & \strut a & \Cdots & L_i \\ % \mbox{\Large $0$} & & \mbox{\Large $0$} \\ -% \end{pNiceArrayRC}\] +% \end{pNiceArray}\] % % \subsection*{Changes between version 2.1.3 and 2.1.4} % @@ -6907,7 +7100,7 @@ c & c & b & a & e % Modification of |\Hdotsfor|. Now |\Hdotsfor| erases the |\vlines| (of ``"|"'') % as |\hdotsfor| does. % -% Composition of exterior rows and columns of the four sides of the matrix (and +% Composition of exterior rows and columns on the four sides of the matrix (and % not only on two sides) with the options |first-row|, |last-row|, |first-col| % and |last-col|. % @@ -6918,8 +7111,8 @@ c & c & b & a & e % Error message when the user gives an incorrect value for |last-row|. % % A dotted line can no longer cross another dotted line (except the dotted lines -% drawn by |\cdottedline|, |:| (in the preamble of the array) and |\line| in -% |code-after|. +% drawn by |\cdottedline|, the symbol |:| (in the preamble of the array) and +% |\line| in |code-after|. % % The starred versions of |\Cdots|, |\Ldots|, etc. are now deprecated because, % with the new implementation, they become pointless. These starred versions @@ -6960,8 +7153,24 @@ c & c & b & a & e % \pkg{nicematrix} when the class \cls{standalone} or the package % \pkg{standalone} is used. % +% \subsection*{Changes between version 3.4 and 3.5} +% +% Correction on a bug on the two previous versions where the |code-after| was +% not executed. % +% \subsection*{Changes between version 3.5 and 3.6} +% +% LaTeX counters |iRow| and |jCol| available in the cells of the array. +% +% Addition of |\normalbaselines| before the construction of the array: in +% environments like |{align}| of \pkg{amsmath} the value of |\baselineskip| is +% changed and if the options |first-row| and |last-row| were used in an +% environment of \pkg{nicematrix}, the position of the delimiters was wrong. % +% A warning is written in the |.log| file if an obsolete environment is used. +% +% There is no longer artificial errors |Duplicate~name| in the environments of +% \pkg{amsmath}. % \PrintIndex % % \tableofcontents @@ -6970,6 +7179,7 @@ c & c & b & a & e % Local Variables: % TeX-fold-mode: t % TeX-fold-preserve-comments: nil +% ispell-local-dictionary: english % fill-column: 80 % End: |