summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-13 20:58:46 +0000
committerKarl Berry <karl@freefriends.org>2020-06-13 20:58:46 +0000
commit525515c8d9df4f6ece9b285a88e58f01bee94de8 (patch)
tree4df4391dbad3fbc961bd7d008f337536c1907529
parent51a537961f8cc72485841891fd8527a5e9c5f6c5 (diff)
nicematrix (13jun20)
git-svn-id: svn://tug.org/texlive/trunk@55539 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdfbin355481 -> 356758 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex37
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdfbin873835 -> 882583 bytes
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx219
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty67
5 files changed, 279 insertions, 44 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
index c5d481ad72f..24432563ff4 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
index d79a0f3727f..a8c0fdd4351 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
@@ -378,8 +378,45 @@ arum & iris & jacinthe & muguet
\end{center}
+\interitem
+On remarquera que les centrage horizontal du contenu des blocs est correct même si un espacement des colonnes a été
+demandé par une instruction comme |!{\qquad}| dans le préambule (ce n'est pas le cas avec |\multicolumn|). Dans
+l'exemple suivant, l'en-tête «Premier groupe» est correctement centré.
+
+\medskip
+\begin{center}
+\begin{BVerbatim}
+\begin{NiceTabular}{C!{\qquad}CCC~emphase#!{\qquad}@CCC}
+\toprule
+& ~emphase#\Block{1-3}{Premier groupe}@ & & & \Block{1-3}{Deuxième groupe} \\
+Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
+\midrule
+ 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
+ 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
+ 3 & 0.783 & 0.885 & 0.015 & 0.306 & 0.643 & 0.263\\
+ 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\
+\bottomrule
+\end{NiceTabular}
+\end{BVerbatim}
+\end{center}
\bigskip
+\begin{center}
+\begin{NiceTabular}{C!{\qquad}CCC!{\qquad}CCC}
+\toprule
+& \Block{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\
+Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
+\midrule
+ 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
+ 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
+ 3 & 0.783 & 0.885 & 0.015 & 0.306 & 0.643 & 0.263\\
+ 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\
+\bottomrule
+\end{NiceTabular}
+\end{center}
+
+
+\interitem
On peut aussi utiliser la commande |\Block| dans des matrices mathématiques.
\medskip
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
index 184e8e4a595..31fb149271d 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index e957be5dc92..a3e658e7572 100644
--- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
+++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2018-2019 by F. Pantigny
+% Copyright (C) 2018-2020 by F. Pantigny
% -----------------------------------
%
% This file may be distributed and/or modified under the
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{4.2}
-\def\myfiledate{2020/06/07}
+\def\myfileversion{4.3}
+\def\myfiledate{2020/06/12}
%
%
%<*batchfile>
@@ -434,9 +434,49 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{center}
%
-%
+% \interitem
+% On should remark that the horizontal centering of the contents of the blocks
+% is correct even when an instruction such as |!{\qquad}| has been used in the
+% preamble of the array in order to increase the space between two columns (this
+% is not the case with |\multicolumn|). In the following example, the header
+% ``First group'' is correctly centered.
%
% \medskip
+% \begin{center}
+% \begin{BVerbatim}
+% \begin{NiceTabular}{C!{\qquad}CCC~emphase#!{\qquad}@CCC}
+% \toprule
+% & ~emphase#\Block{1-3}{First group}@ & & & \Block{1-3}{Second group} \\
+% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
+% \midrule
+% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
+% 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
+% 3 & 0.783 & 0.885 & 0.015 & 0.306 & 0.643 & 0.263\\
+% 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\
+% \bottomrule
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \end{center}
+%
+% \bigskip
+% \begin{center}
+% \begin{NiceTabular}{C!{\qquad}CCC!{\qquad}CCC}
+% \toprule
+% & \Block{1-3}{First group} & & & \Block{1-3}{Second group} \\
+% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
+% \midrule
+% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
+% 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
+% 3 & 0.783 & 0.885 & 0.015 & 0.306 & 0.643 & 0.263\\
+% 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\
+% \bottomrule
+% \end{NiceTabular}
+% \end{center}
+%
+%
+%
+%
+% \interitem
% It's also possible to use the command |\Block| in mathematical matrices.
%
% \medskip
@@ -3659,7 +3699,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The following commands are only for efficiency. It must \emph{not} be protected
+% The following commands are only for efficiency. They must \emph{not} be protected
% because it will be used (for instance) in names of \textsc{pgf} nodes.
% \begin{macrocode}
\cs_new:Npn \@@_succ:n #1 { \the \numexpr #1 + 1 \relax }
@@ -4049,9 +4089,8 @@ version 2005/12/01 or later.
% \begin{macrocode}
\seq_new:N \g_@@_pos_of_blocks_seq
% \end{macrocode}
-% The sequence |\g_@@_pos_of_blocks_seq| will be used by the test of
-% non-overlapping of two blocks and when we will draw the rules required by the
-% key |hvlines| (these rules won't be drawn within the blocks).
+% The sequence |\g_@@_pos_of_blocks_seq| when we will draw the rules required by
+% the key |hvlines| (these rules won't be drawn within the blocks).
%
% \bigskip
% We will also manage a sequence for the positions of the dotted lines. These
@@ -7884,9 +7923,9 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:
{
- \begin { scope }
- \exp_args:No \@@_draw_non_standard_dotted_line:n
- { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl }
+ \begin { scope }
+ \exp_args:No \@@_draw_non_standard_dotted_line:n
+ { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl }
}
% \end{macrocode}
% We have used the fact that, in \textsc{pgf}, un color name can be put directly
@@ -9211,7 +9250,7 @@ version 2005/12/01 or later.
{
\int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
{
- \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
{ \bool_gset_false:N \g_tmpa_bool }
}
}
@@ -9871,10 +9910,10 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% \subsection*{Block matrices}
+% \subsection*{The blocks}
%
-% The code in this section if for the construction of \emph{block matrices}. It
-% has no direct link with the environment |{NiceMatrixBlock}|.
+% The code deals with the command |\Block|. This command has no direct link with
+% the environment |{NiceMatrixBlock}|.
%
%
% The following command will be linked to |\Block| in the environments of
@@ -9882,8 +9921,10 @@ version 2005/12/01 or later.
% because it has an optional argument between |<| and |>| (for TeX instructions
% put before the math mode of the label)
%
+% It's mandatory to use a expandable command (probably because of the first
+% optional argument ?).
% \begin{macrocode}
-\NewDocumentCommand \@@_Block: { O { } m D < > { } m }
+\NewExpandableDocumentCommand \@@_Block: { O { } m D < > { } m }
{ \@@_Block_i #2 \q_stop { #1 } { #3 } { #4 } }
% \end{macrocode}
%
@@ -9909,10 +9950,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_set:Nx \l_tmpa_tl
{
- { \int_use:N \c@iRow }
- { \int_use:N \c@jCol }
- { \int_eval:n { \c@iRow + #1 - 1 } }
- { \int_eval:n { \c@jCol + #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 } }
}
% \end{macrocode}
% Now, |\l_tmpa_tl| constains a ``object'' corresponding to the position of the
@@ -9944,7 +9985,9 @@ version 2005/12/01 or later.
%
% \bigskip
% The key |tikz| is for Tikz options used when the \textsc{pgf} node of the
-% block is created.
+% block is created (the ``normal'' block node and not the ``short'' one nor the
+% ``medium'' one). \textbf{In fact, as for now, it is \emph{not} documented}. Is
+% it really a good idea to provide such a key?
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Block }
{
@@ -9965,7 +10008,8 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6
{
% \end{macrocode}
-% The group is for the keys.
+% The group is for the keys (even if, as for new, there is only one key, called
+% |tikz| and not documented).
% \begin{macrocode}
\group_begin:
\keys_set:nn { NiceMatrix / Block } { #5 }
@@ -9973,7 +10017,7 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\bool_lazy_or:nnTF
- { \int_compare_p:nNn { #3 } > \c@iRow }
+ { \int_compare_p:nNn { #3 } > \g_@@_row_total_int }
{ \int_compare_p:nNn { #4 } > \c@jCol }
{ \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
{
@@ -9984,7 +10028,54 @@ version 2005/12/01 or later.
\hbox_set:Nn \l_@@_cell_box { #6 }
% \end{macrocode}
%
-% \medskip
+% \bigskip
+% Let's consider the following |{NiceTabular}|. Because of the instruction
+% |!{\hspace{1cm}}| in the preamble which increases the space between the
+% columns (by adding, in fact, that space to the previous column, that is to say
+% the second column of the tabular), we will create \emph{two} nodes relative to
+% the block: the node |1-1-block| and the node |1-1-block-short|. The latter
+% will be used by \pkg{nicematrix} to put the label of the node. The first one
+% won't be used explicitely.
+% \begin{Verbatim}
+% \begin{NiceTabular}{CC!{\hspace{1cm}}C}
+% \Block{2-2}{our block} & & one \\
+% & & two \\
+% three & four & five \\
+% six & seven & eight \\
+% \end{NiceTabular}
+% \end{Verbatim}
+%
+% \tikzset{highlight/.style={rectangle,
+% fill=red!15,
+% blend mode = multiply,
+% rounded corners = 0pt,
+% inner sep=0pt,
+% fit = #1}}
+%
+% \begin{tabular}{c!{\hspace{1cm}}c}
+% We highlight the node |1-1-block|
+% & We highlight the node |1-1-block-short| \\[2mm]
+% \begin{NiceTabular}{CC!{\hspace{1cm}}C}
+% \Block{2-2}{our block} & & one \\
+% & & two \\
+% three & four & five \\
+% six & seven & eight \\
+% \CodeAfter
+% \tikz \node [highlight = (1-1-block)] { } ;
+% \end{NiceTabular}
+% &
+% \begin{NiceTabular}{CC!{\hspace{1cm}}C}
+% \Block{2-2}{our block} & & one \\
+% & & two \\
+% three & four & five \\
+% six & seven & eight \\
+% \CodeAfter
+% \tikz \node [highlight = (1-1-block-short)] { } ;
+% \end{NiceTabular}
+% \end{tabular}
+%
+%
+% \bigskip
% The construction of the node corresponding to the merged cells.
% \begin{macrocode}
\pgfpicture
@@ -10012,7 +10103,55 @@ version 2005/12/01 or later.
\l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
\end { pgfscope }
% \end{macrocode}
+%
+%
%
+% \medskip
+% We construct the |short| node.
+% \begin{macrocode}
+ \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ {
+% \end{macrocode}
+% We recall that, when a cell is empty, no (normal) node is created in that
+% cell. That's why we test the existence of the node before using it.
+% \begin{macrocode}
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
+ {
+ \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
+ \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x }
+ }
+ }
+% \end{macrocode}
+% If all the cells of the column were empty, |\l_tmpb_dim| has still the same
+% value |\c_max_dim|. In that case, you use for |\l_tmpb_dim| the value of the
+% position of the vertical rule.
+% \begin{macrocode}
+ \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ {
+ \@@_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf@x
+ }
+ \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - #4 }
+ {
+ \pgfpointanchor { \@@_env: - ##1 - #4 } { east }
+ \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x }
+ }
+ }
+ \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
+ {
+ \@@_qpoint:n { col - \@@_succ:n { #4 } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf@x
+ }
+ \@@_pgf_rect_node:nnnnn
+ { \@@_env: - #1 - #2 - block - short }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
+% \end{macrocode}
%
% \medskip
% If the creation of the ``medium nodes'' is required, we create a ``medium
@@ -10033,6 +10172,16 @@ version 2005/12/01 or later.
\int_compare:nNnTF { #1 } = { #3 }
{
% \end{macrocode}
+% We take into account the case of a block of one row in the ``first row'' or
+% the ``end row''.
+% \begin{macrocode}
+ \int_compare:nNnTF { #1 } = 0
+ { \l_@@_code_for_first_row_tl }
+ {
+ \int_compare:nNnT { #1 } = \l_@@_last_row_int
+ \l_@@_code_for_last_row_tl
+ }
+% \end{macrocode}
% If the block has only one row, we want the label of the block perfectly
% aligned on the baseline of the row. That's why we have constructed a
% |\pgfcoordinate| on the baseline of the row, in the first column of the array.
@@ -10042,7 +10191,7 @@ version 2005/12/01 or later.
% \end{macrocode}
% We retrieve (in |\pgf@x|) the $x$-value of the center of the block.
% \begin{macrocode}
- \@@_qpoint:n { #1 - #2 - block }
+ \@@_qpoint:n { #1 - #2 - block - short }
% \end{macrocode}
% We put the label of the block which has been composed in |\l_@@_cell_box|.
% \begin{macrocode}
@@ -10054,11 +10203,11 @@ version 2005/12/01 or later.
%
% \medskip
% If the number of rows is different of $1$, we put the label of the block in
-% the center of the node (the label of the block has been composed in
+% the center of the (short) node (the label of the block has been composed in
% |\l_@@_cell_box|).
% \begin{macrocode}
{
- \pgftransformshift { \@@_qpoint:n { #1 - #2 - block } }
+ \pgftransformshift { \@@_qpoint:n { #1 - #2 - block - short } }
\pgfnode { rectangle } { center }
{ \box_use_drop:N \l_@@_cell_box } { } { }
}
@@ -10172,6 +10321,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \bigskip
% \subsection*{The redefinition of the command \textbackslash dotfill }
%
% \begin{macrocode}
@@ -10199,6 +10349,7 @@ version 2005/12/01 or later.
{ \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim \@@_dotfill }
% \end{macrocode}
%
+% \bigskip
% \subsection*{The command \textbackslash diagbox}
%
%
@@ -10256,7 +10407,8 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \subsection*{The command \textbackslash CodeAfter}
+% \bigskip
+% \subsection*{The keyword \textbackslash CodeAfter}
%
% In fact, in this subsection, we define the user command |\CodeAfter| for the
% case of the ``normal syntax''. For the case of ``light-syntax'', see the
@@ -10286,7 +10438,7 @@ version 2005/12/01 or later.
\str_if_eq:eeTF \@currenvir { #1 }
{ \end { #1 } }
% \end{macrocode}
-% It this is not the |\end| we are looking for, we put those tokens in
+% If this is not the |\end| we are looking for, we put those tokens in
% |\g_@@_code_after_tl| and we go on searching for the next command |\end| with
% a recursive call to the command |\@@_CodeAfter:n|.
% \begin{macrocode}
@@ -10302,7 +10454,6 @@ version 2005/12/01 or later.
% \bigskip
% \subsection*{We process the options at package loading}
%
-%
%
% We process the options when the package is loaded (with |\usepackage|) but we
% recommend to use |\NiceMatrixOptions| instead.
@@ -11151,6 +11302,14 @@ version 2005/12/01 or later.
% It's now possible to write |\begin{pNiceMatrix}a&b\\c&d\end{pNiceMatrix}^2|
% with the expected result.
%
+% \subsection*{Changes between versions 4.2 and 4.3}
+%
+% The horizontal centering of the content of a |\Block| is correct even when an
+% instruction such as |!{\qquad}| is used in the preamble of the array.
+%
+% It's now possible to use the command |\Block| in the ``last row''.
+%
+%
% \PrintIndex
%
% \tableofcontents
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index b4a7ec1366c..d286a1bb15c 100644
--- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
+++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
@@ -18,8 +18,8 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{4.2}
-\def\myfiledate{2020/06/07}
+\def\myfileversion{4.3}
+\def\myfiledate{2020/06/12}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -2297,9 +2297,9 @@
}
\cs_new_protected:Npn \__nicematrix_draw_non_standard_dotted_line:
{
- \begin { scope }
- \exp_args:No \__nicematrix_draw_non_standard_dotted_line:n
- { \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl }
+ \begin { scope }
+ \exp_args:No \__nicematrix_draw_non_standard_dotted_line:n
+ { \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl }
}
\cs_new_protected:Npn \__nicematrix_draw_non_standard_dotted_line:n #1
{
@@ -3165,7 +3165,7 @@
{
\int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
{
- \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
{ \bool_gset_false:N \g_tmpa_bool }
}
}
@@ -3487,17 +3487,17 @@
{ \int_use:N \g__nicematrix_env_int - \__nicematrix_i: - \__nicematrix_j: \l__nicematrix_suffix_tl}
}
}
-\NewDocumentCommand \__nicematrix_Block: { O { } m D < > { } m }
+\NewExpandableDocumentCommand \__nicematrix_Block: { O { } m D < > { } m }
{ \__nicematrix_Block_i #2 \q_stop { #1 } { #3 } { #4 } }
\cs_new:Npn \__nicematrix_Block_i #1-#2 \q_stop { \__nicematrix_Block_ii:nnnnn { #1 } { #2 } }
\cs_new_protected:Npn \__nicematrix_Block_ii:nnnnn #1 #2 #3 #4 #5
{
\tl_set:Nx \l_tmpa_tl
{
- { \int_use:N \c@iRow }
- { \int_use:N \c@jCol }
- { \int_eval:n { \c@iRow + #1 - 1 } }
- { \int_eval:n { \c@jCol + #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 } }
}
\seq_gput_left:NV \g__nicematrix_pos_of_blocks_seq \l_tmpa_tl
\seq_gput_left:Nx \g__nicematrix_blocks_seq
@@ -3519,7 +3519,7 @@
\group_begin:
\keys_set:nn { NiceMatrix / Block } { #5 }
\bool_lazy_or:nnTF
- { \int_compare_p:nNn { #3 } > \c@iRow }
+ { \int_compare_p:nNn { #3 } > \g__nicematrix_row_total_int }
{ \int_compare_p:nNn { #4 } > \c@jCol }
{ \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
{
@@ -3541,6 +3541,39 @@
{ \__nicematrix_env: - #1 - #2 - block }
\l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
\end { pgfscope }
+ \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+ \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
+ {
+ \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west }
+ \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x }
+ }
+ }
+ \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ {
+ \__nicematrix_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf@x
+ }
+ \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
+ \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #4 }
+ {
+ \pgfpointanchor { \__nicematrix_env: - ##1 - #4 } { east }
+ \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x }
+ }
+ }
+ \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
+ {
+ \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #4 } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf@x
+ }
+ \__nicematrix_pgf_rect_node:nnnnn
+ { \__nicematrix_env: - #1 - #2 - block - short }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
\bool_if:NT \l__nicematrix_medium_nodes_bool
{
\__nicematrix_pgf_rect_node:nnn
@@ -3550,14 +3583,20 @@
}
\int_compare:nNnTF { #1 } = { #3 }
{
+ \int_compare:nNnTF { #1 } = 0
+ { \l__nicematrix_code_for_first_row_tl }
+ {
+ \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int
+ \l__nicematrix_code_for_last_row_tl
+ }
\pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } }
- \__nicematrix_qpoint:n { #1 - #2 - block }
+ \__nicematrix_qpoint:n { #1 - #2 - block - short }
\pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim }
\pgfnode { rectangle } { base }
{ \box_use_drop:N \l__nicematrix_cell_box } { } { }
}
{
- \pgftransformshift { \__nicematrix_qpoint:n { #1 - #2 - block } }
+ \pgftransformshift { \__nicematrix_qpoint:n { #1 - #2 - block - short } }
\pgfnode { rectangle } { center }
{ \box_use_drop:N \l__nicematrix_cell_box } { } { }
}