From d94b7a8c132734a1bc4046d54a75c7882c4c2619 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 2 Oct 2019 03:01:29 +0000
Subject: CTAN sync 201910020301

---
 macros/latex/contrib/nicematrix/nicematrix.dtx | 958 +++++++++++--------------
 1 file changed, 439 insertions(+), 519 deletions(-)

(limited to 'macros/latex/contrib/nicematrix/nicematrix.dtx')

diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 684b34c5b4..44a38c9a0b 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{3.2a}
-\def\myfiledate{2019/09/21}
+\def\myfileversion{3.3}
+\def\myfiledate{2019/10/01}
 %
 %
 %<*batchfile>
@@ -211,7 +211,7 @@ c & c & b & a & e
 % \{VNiceMatrix\} &               & \{NiceArrayWithDelims\} \\
 % \end{tabular}
 % \end{ttfamily}
-%b
+%
 %
 % \medskip
 % By default, the environments |{NiceMatrix}|, |{pNiceMatrix}|, |{bNiceMatrix}|,
@@ -229,9 +229,8 @@ c & c & b & a & e
 % |W|, the cells are composed in math mode (in the environments of
 % \pkg{nicematrix}) whereas in |{array}| of \pkg{array}, they are composed in text mode.}, "|",
 % |>{...}|, |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but the letters |p|,
-% |m| and |b| should not be used. The environment |{NiceArray}| and its variants
-% provide also options to draw exterior rows and columns. See p.~\pageref{NiceArray}
-% the section relating to |{NiceArray}|
+% |m| and |b| should not be used. See p.~\pageref{NiceArray} the section
+% relating to |{NiceArray}|.
 % 
 % 
 % \section{The continuous dotted lines}
@@ -337,13 +336,15 @@ c & c & b & a & e
 % 0       &        & \Cdots & 0 
 % \end{bNiceMatrix}$
 %
-% \bigskip e
+% \bigskip 
 % There are also other means to change the size of the matrix. Someone might
 % want to use the optional argument of the command~|\\| for the vertical
 % dimension and a command~|\hspace*| in a cell for the horizontal
-% dimension.\footnote{It's also possible to fix the width of a column 
-% by using the environment |{NiceArray}| (or one of its variants) with a column of
-% type~|w| or~|W|: see p.~\pageref{width}}
+% dimension.\footnote{In \pkg{nicematrix}, one should use |\hspace*| and not
+% |\hspace| for such an usage because \pkg{nicematrix} loads \pkg{array}. One
+% may also remark that it's possible to fix the width of a column by using the
+% environment |{NiceArray}| (or one of its variants) with a column of type~|w|
+% or~|W|: see p.~\pageref{width}} 
 % 
 % However, a command~|\hspace*| might interfer with the construction of the
 % dotted lines. That's why the package \pkg{nicematrix} provides a
@@ -534,12 +535,14 @@ c & c & b & a & e
 % \subsection{How to generate the continuous dotted lines transparently}
 %
 % The package \pkg{nicematrix} provides an option called |transparent| for using
-% existing code transparently in the environments |{matrix}|. This option can be
-% set as option of |\usepackage| or with the command |\NiceMatrixOptions|.
-% 
-%
-% In fact, this option is an alias for the conjonction of two options:
-% |renew-dots| and |renew-matrix|.
+% existing code transparently in the environments of the \pkg{amsmath} :
+% |{matrix}|, |{pmatrix}|, |{bmatrix}|, etc. In fact, this
+% option is an alias for the conjonction of two options: 
+% |renew-dots| and |renew-matrix|.\footnote{The options |renew-dots|,
+% |renew-matrix| and |transparent| can be fixed with the command
+% |\NiceMatrixOptiosn| like the other options. However, they can also be fixed
+% as options of the command |\usepackage| (it's an exception for these three
+% specific options.)}
 %
 % \smallskip
 %
@@ -869,46 +872,78 @@ c & c & b & a & e
 % \end{pNiceArray}$
 %
 %
-% \vspace{1cm}
-% With the environment |{NiceArray}| and its the variants, it's possible to
-% compose exterior rows and columns with the options |first-row|, |last-row|,
-% |first-col| and |last-col|. 
+% \bigskip
+% In fact, the environment |{pNiceArray}| and its variants are based upon a
+% more general environment, called |{NiceArrayWithDelims}|. The first two
+% mandatory arguments of this environment are the left and right delimiters used
+% in the construction of the matrix. It's possible to use
+% |{NiceArrayWithDelims}| if we want to use atypical delimiters.
+%
+% \medskip
+% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
+% $\begin{~emphase#NiceArrayWithDelims@}
+%    {\downarrow}{\downarrow}{CCC}
+% 1 & 2 & 3 \\
+% 4 & 5 & 6 \\
+% 7 & 8 & 9 \\
+% \end{~emphase#NiceArrayWithDelims@}$
+% \end{BVerbatim}
+% $\begin{NiceArrayWithDelims}
+%    {\downarrow}{\downarrow}{CCC}
+% 1 & 2 & 3 \\
+% 4 & 5 & 6 \\
+% 7 & 8 & 9 \\
+% \end{NiceArrayWithDelims}$
+%
+%
+% \bigskip
+% \section{The exterior row 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}.
 % \label{exterior}
 %
-% There is no specification of column to provide for the potential ``first
-% column'' (it will automatically be a |R| column) and for the potential ``last
-% column'' (it will automatically be a |L| column).
+% A potential first row has the number $0$ (and not $1$). Idem for the potential
+% first column. In general cases, one must specify the number of the last row
+% and the number of the last column as values of |last-row| and |last-col|.
 % 
 % \begin{Verbatim}
-% $\begin{pNiceArray}{CCCC}[~emphase#first-row,last-row,first-col,last-col@]
+% $\begin{pNiceMatrix}[~emphase#first-row,last-row=5,first-col,last-col=5@]
 %     & C_1    & C_2    & C_3    & C_4    &     \\
 % L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\
 % L_2 & a_{21} & a_{22} & a_{23} & a_{24} & L_2 \\
 % L_3 & a_{31} & a_{32} & a_{33} & a_{34} & L_3 \\
 % L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\
 %     & C_1    & C_2    & C_3    & C_4    &     
-% \end{pNiceArray}$
+% \end{pNiceMatrix}$
 % \end{Verbatim}
 %
-% \[\begin{pNiceArray}{CCCC}[first-row,last-row,first-col,last-col]
+% \[\begin{pNiceMatrix}[first-row,last-row=5,first-col,last-col=5]
 %     & C_1    & C_2    & C_3    & C_4    &     \\
 % L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\
 % L_2 & a_{21} & a_{22} & a_{23} & a_{24} & L_2 \\
 % L_3 & a_{31} & a_{32} & a_{33} & a_{34} & L_3 \\
 % L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\
 %     & C_1    & C_2    & C_3    & C_4    &     
-% \end{pNiceArray}\]
+% \end{pNiceMatrix}\]
 %
 % \bigskip
-% However, there is a particularity for the option |last-row|: when LaTeX
-% composes an array (with the TeX command |\halign|) it composes it row by row
-% and there is no direct way to know if we are at the last row before the
-% composition of that row. That's why \pkg{nicematrix} writes in the |aux| file
-% the number of rows of the array in order to use it at the next run.
-% Nevertheless, it's possible to give directly the number of rows as the value
-% of the key |last-row|. It that way, \pkg{nicematrix} will know the correct
-% value by the first compilation.
-%
+% We have several remarks to do.
+% \begin{itemize}
+% \item For the environments with an explicit preamble (i.e. |{NiceArray}| and
+% its variants), no letter must be given in the preamble for the potential first
+% column and the potential last column: the first column will be automatically
+% (and necessarily) of type |R| and the last column will be automatically of
+% type |L|).
+% \item In an environment with an explicit preamble, the option |last-col| must
+% be used \emph{without} value: the number of columns will be automatically
+% computed from the preamble of the array.
+% \item For the potential last row, the option |last-row| may, in fact, be used
+% without value. In this case, \pkg{nicematrix} computes, during the first
+% compilation, the number of row of the array and writes that information in the
+% |.aux| file for the second run. In the following example, the option
+% |last-row| will be used without value.
+% \end{itemize}
+% 
 % \bigskip
 % It's possible to control the appearance of these rows and columns with options
 % |code-for-first-row|, |code-for-last-row|, |code-for-first-col| and
@@ -961,10 +996,6 @@ c & c & b & a & e
 % \pkg{array}. On another note, if one really wants a vertical rule running in
 % the first and in the last row, he should use |!{\vline}| instead of \verb+|+
 % in the preamble of the array.} 
-% \item The ``first row'' of an environment |{pNiceArray}| has the number $0$, and not
-% $1$. Idem for the ``first column''. This number is used for the names of the Tikz
-% nodes (the names of these nodes are used, for example, by the command |\line|
-% in |code-after|). 
 % \item Logically, the potential option |columns-width| (described
 % p.~\pageref{width}) doesn't apply to the ``first column'' and ``last column''. 
 % \item For technical reasons, it's not possible to use the option of the command |\\|
@@ -975,30 +1006,6 @@ c & c & b & a & e
 % 
 % 
 %
-% \bigskip
-% In fact, the environment |{pNiceArray}| and its variants are based upon a
-% more general environment, called |{NiceArrayWithDelims}|. The first two
-% mandatory arguments of this environment are the left and right delimiters used
-% in the construction of the matrix. It's possible to use
-% |{NiceArrayWithDelims}| if we want to use atypical delimiters.
-%
-% \medskip
-% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
-% $\begin{~emphase#NiceArrayWithDelims@}
-%    {\downarrow}{\downarrow}{CCC}[last-col]
-% 1 & 2 & 3 & L_1 \\
-% 4 & 5 & 6 & L_2 \\
-% 7 & 8 & 9 & L_3
-% \end{~emphase#NiceArrayWithDelims@}$
-% \end{BVerbatim}
-% $\begin{NiceArrayWithDelims}
-%    {\downarrow}{\downarrow}{CCC}[last-col]
-% 1 & 2 & 3 & L_1 \\
-% 4 & 5 & 6 & L_2 \\
-% 7 & 8 & 9 & L_3
-% \end{NiceArrayWithDelims}$
-%
-%
 %
 % \section{The dotted lines to separate rows or columns}
 %
@@ -1122,8 +1129,8 @@ c & c & b & a & e
 %
 %
 % \bigskip
-% It's also possible to fix the width of all the columns of a matrix directly
-% with the option |columns-width| (in all the environments of \pkg{nicematrix}).
+% In the environments of \pkg{nicematrix}, it's also possible to fix the width
+% of all the columns of a matrix directly with the option |columns-width|.
 % 
 % \medskip
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
@@ -1146,8 +1153,10 @@ c & c & b & a & e
 %
 % \bigskip
 % It's possible to give the value |auto| to the option |columns-width|: all the
-% columns of the array will have a width equal to the widest cell of the array.
-% \textbf{Two or three compilations may be necessary.}\par\nobreak
+% columns of the array will have a width equal to the widest cell of the
+% array.\footnote{The result is achieved with only one compilation (but Tikz
+% will have written informations in the |.aux| file and a message requiring a
+% second compilation will appear).}\par\nobreak 
 %
 % \medskip
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
@@ -1221,6 +1230,10 @@ c & c & b & a & e
 % \end{pNiceMatrix}$
 % \end{NiceMatrixBlock}
 %
+% \medskip
+% \textbf{Several compilations may be necessary to achieve the job.}
+%
+%
 % \section{Block matrices}
 %
 % In the environments of \pkg{nicematrix}, it's possible to use the command
@@ -1258,11 +1271,12 @@ c & c & b & a & e
 % \end{scope}
 %
 % \bigskip
-% One may wish raise the size of the ``$A$'' placed in the block of the previous 
-% example. Since this element is composed in math mode, it's not possible to use
-% directly a command like |\large|, |\Large| and |\LARGE|. That's why the command
-% |\Block| provides an option between angle brackets to specificy some TeX code
-% which will be inserted before the beginning of the math mode.
+% One may wish to raise the size of the ``$A$'' placed in the block of the
+% previous  example. Since this element is composed in math mode, it's not
+% possible to use directly a command like |\large|, |\Large| and |\LARGE|.
+% That's why the command |\Block| provides an option between angle brackets to
+% specificy some TeX code which will be inserted before the beginning of the
+% math mode. 
 %
 % \medskip
 % \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
@@ -2429,8 +2443,16 @@ c & c & b & a & e
 %    \end{macrocode}
 % 
 % \bigskip
+% We also define a counter to count the environments |{NiceMatrixBlock}|.
+%    \begin{macrocode}
+\int_new:N \g_@@_NiceMatrixBlock_int
+%    \end{macrocode}
+%
+% \bigskip
 % The dimension |\l_@@_columns_width_dim| will be used when the options specify
-% that all the columns must have the same width.
+% 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).
 %    \begin{macrocode}
 \dim_new:N \l_@@_columns_width_dim
 %    \end{macrocode}
@@ -2461,7 +2483,6 @@ c & c & b & a & e
 % position (|t|, |b| or |c|). 
 %    \begin{macrocode}
 \bool_new:N \l_@@_NiceArray_bool
-\bool_new:N \g_@@_NiceArray_bool
 %    \end{macrocode}
 % 
 %
@@ -2536,6 +2557,10 @@ c & c & b & a & e
 %    \begin{macrocode}
 \str_new:N \g_@@_type_env_str
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+\tl_new:N \g_@@_code_after_tl
+%    \end{macrocode}
 % 
 % \bigskip
 % \subsubsection{Variables for the exterior rows and columns}
@@ -2554,7 +2579,6 @@ c & c & b & a & e
 %    \begin{macrocode}
 \int_new:N \l_@@_first_row_int
 \int_set:Nn \l_@@_first_row_int 1
-\int_new:N \g_@@_first_row_int
 %    \end{macrocode}
 %
 % \medskip
@@ -2565,7 +2589,6 @@ c & c & b & a & e
 %    \begin{macrocode}
 \int_new:N \l_@@_first_col_int
 \int_set:Nn \l_@@_first_col_int 1
-\int_new:N \g_@@_first_col_int
 %    \end{macrocode}
 % 
 % \medskip
@@ -2578,7 +2601,6 @@ c & c & b & a & e
 %    \begin{macrocode}
 \int_new:N \l_@@_last_row_int 
 \int_set:Nn \l_@@_last_row_int { -2 }
-\int_new:N \g_@@_last_row_int 
 %    \end{macrocode}
 %
 % \smallskip
@@ -2590,18 +2612,19 @@ c & c & b & a & e
 % value from the |aux| file, the value of the counter won't be $-1$ any longer.}
 %    \begin{macrocode}
 \bool_new:N \l_@@_last_row_without_value_bool
-\bool_new:N \g_@@_last_row_without_value_bool
 %    \end{macrocode}
 %
 % \medskip
 % \item \textbf{Last column}\par\nobreak
 %
-% For the eventual ``last column'', we have a boolean an not an integer.
+% For the eventual ``last column'', we use an integer. A value of $-1$ means
+% that there is no last column.
 %    \begin{macrocode}
-\bool_new:N \l_@@_last_col_bool 
+\int_new:N \l_@@_last_col_int
+\int_set:Nn \l_@@_last_col_int { -1 }
 %    \end{macrocode}
 %
-% However, we have also another boolean. Consider the following code: 
+% However, we have also a boolean. Consider the following code: 
 % \begin{center}
 % \begin{BVerbatim}
 % \begin{pNiceArray}{CC}[last-col]
@@ -2807,20 +2830,11 @@ c & c & b & a & e
 % 
 % 
 % \bigskip
-% We don't want to patch any existing code. That's why some code must be
-% executed in a |\group_insert_after:N|. That's why the parameters used in that
-% code must be transfered outside the current group. To do this, we copy those
-% quantities in global variables just before the |\group_insert_after:N|.
-% Therefore, for those quantities, we have two parameters, one local and one
-% global. For example, we have |\l_@@_name_str| and |\g_@@_name_str|. 
-%
-% \bigskip
 % The token list |\l_@@_name_str| will contain the optional name of the
 % environment: this name can be used to access to the Tikz nodes created in the
 % array from outside the environment.  
 %    \begin{macrocode}
 \str_new:N \l_@@_name_str
-\str_new:N \g_@@_name_str
 %    \end{macrocode}
 %
 % \bigskip
@@ -2837,8 +2851,6 @@ c & c & b & a & e
 %    \begin{macrocode}
 \dim_new:N \l_@@_left_margin_dim
 \dim_new:N \l_@@_right_margin_dim
-\dim_new:N \g_@@_left_margin_dim
-\dim_new:N \g_@@_right_margin_dim
 \dim_new:N \g_@@_width_last_col_dim
 \dim_new:N \g_@@_width_first_col_dim
 %    \end{macrocode}
@@ -2850,7 +2862,6 @@ c & c & b & a & e
 %    \begin{macrocode}
 \dim_new:N \l_@@_extra_left_margin_dim
 \dim_new:N \l_@@_extra_right_margin_dim
-\dim_new:N \g_@@_extra_right_margin_dim
 %    \end{macrocode}
 % 
 %
@@ -2861,6 +2872,14 @@ c & c & b & a & e
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Global }
   {
+    code-for-first-col .tl_set:N = \l_@@_code_for_first_col_tl ,
+    code-for-first-col .value_required:n = true ,
+    code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl ,
+    code-for-last-col .value_required:n = true ,
+    code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl ,
+    code-for-first-row .value_required:n = true ,
+    code-for-last-row .tl_set:N = \l_@@_code_for_last_row_tl ,
+    code-for-last-row .value_required:n = true ,
     small .bool_set:N = \l_@@_small_bool ,
     hlines .bool_set:N = \l_@@_hlines_bool ,
     parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
@@ -2872,6 +2891,7 @@ c & c & b & a & e
 % |\Vdots| and |\Ddots|. 
 %    \begin{macrocode}
     renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
+    renew-dots .value_forbidden:n = true ,
     nullify-dots .bool_set:N = \l_@@_nullify_dots_bool ,
 %    \end{macrocode}
 %
@@ -2897,23 +2917,6 @@ c & c & b & a & e
 %    \end{macrocode}
 %
 % \bigskip
-% The following set of keys concerns the options to \emph{customize} the
-% exterior rows and columns, that is to say the options |code-for-first-row|, etc.
-%    \begin{macrocode}     
-\keys_define:nn { NiceMatrix / Code }
-  {
-    code-for-first-col .tl_set:N = \l_@@_code_for_first_col_tl ,
-    code-for-first-col .value_required:n = true ,
-    code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl ,
-    code-for-last-col .value_required:n = true ,
-    code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl ,
-    code-for-first-row .value_required:n = true ,
-    code-for-last-row .tl_set:N = \l_@@_code_for_last_row_tl ,
-    code-for-last-row .value_required:n = true ,
-  }
-%    \end{macrocode}
-% 
-% \bigskip
 % We define a set of keys used by the environments of \pkg{nicematrix} (but not
 % by the command |\NiceMatrixOptions|). 
 %    \begin{macrocode}
@@ -2932,8 +2935,11 @@ c & c & b & a & e
       \str_set_eq:NN \l_@@_name_str \l_tmpa_str ,
     name .value_required:n = true ,
     code-after .tl_gset:N = \g_@@_code_after_tl ,
-    code-after .initial:n = \c_empty_tl ,
     code-after .value_required:n = true ,
+    first-col .code:n = \int_zero:N \l_@@_first_col_int , 
+    first-row .code:n = \int_zero:N \l_@@_first_row_int ,
+    last-row .int_set:N = \l_@@_last_row_int ,
+    last-row .default:n = -1 ,
   }
 %    \end{macrocode}
 % 
@@ -2946,7 +2952,6 @@ c & c & b & a & e
     NiceMatrixOptions .inherit:n = 
       {  
         NiceMatrix / Global ,
-        NiceMatrix / Code 
       } ,
     NiceMatrix .inherit:n = 
       { 
@@ -2957,13 +2962,11 @@ c & c & b & a & e
       { 
         NiceMatrix / Global ,
         NiceMatrix / Env ,
-        NiceMatrix / Code 
       } ,
     pNiceArray .inherit:n = 
       { 
         NiceMatrix / Global ,
         NiceMatrix / Env ,
-        NiceMatrix / Code 
       } 
   }
 %    \end{macrocode}
@@ -3038,7 +3041,6 @@ c & c & b & a & e
           { \@@_error:n { Bad~value~for~letter~for~dotted~lines } } 
       } ,
     letter-for-dotted-lines .value_required:n = true ,
-    letter-for-dotted-lines .initial:n = \c_colon_str ,
 %    \end{macrocode}
 %
 % \bigskip
@@ -3047,7 +3049,11 @@ c & c & b & a & e
   }
 %    \end{macrocode}
 %
-%
+%    \begin{macrocode}
+\str_new:N \l_@@_letter_for_dotted_lines_str
+\str_set_eq:NN \l_@@_letter_for_dotted_lines_str \c_colon_str
+%    \end{macrocode}
+%       
 % \bigskip
 % |\NiceMatrixOptions| is the command of the \pkg{nicematrix} package to fix
 % options at the document level. The scope of these specifications is the
@@ -3064,15 +3070,19 @@ c & c & b & a & e
 %
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / NiceMatrix }
-  { unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } }
+  { 
+    last-col .code:n = \tl_if_empty:nTF {#1}
+                         { \@@_error:n { last-col~empty~for~NiceMatrix } }
+                         { \int_set:Nn \l_@@_last_col_int { #1 } } ,
+    unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } 
+  }
 %    \end{macrocode}
 %
 %
-% \bigskip
 % 
 % \bigskip
-% We finalise the definition of the set of keys 
-% ``|NiceMatrix / NiceArray|'' with the options specific to |{NiceArray}|.
+% We finalise the definition of the set of keys ``|NiceMatrix / NiceArray|''
+% with the options specific to |{NiceArray}|. 
 %
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / NiceArray }
@@ -3086,11 +3096,15 @@ c & c & b & a & e
     c .code:n = \str_set:Nn \l_@@_pos_env_str c ,
     t .code:n = \str_set:Nn \l_@@_pos_env_str t ,
     b .code:n = \str_set:Nn \l_@@_pos_env_str b ,
-    first-col .code:n = \int_zero:N \l_@@_first_col_int , 
-    last-col .bool_set:N = \l_@@_last_col_bool ,
-    first-row .code:n = \int_zero:N \l_@@_first_row_int ,
-    last-row .int_set:N = \l_@@_last_row_int ,
-    last-row .default:n = -1 ,
+%    \end{macrocode}
+% 
+% In the environments |{NiceArray}| and its variants, the option |last-col| must
+% be used without value because the number of columns of the array can be read
+% in the preamble of the array.
+%    \begin{macrocode}
+    last-col .code:n = \tl_if_empty:nF {#1}
+                         { \@@_error:n { last-col~non~empty~for~NiceArray } } 
+                       \int_zero:N \l_@@_last_col_int ,
     unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray } 
   }
 %    \end{macrocode}
@@ -3101,16 +3115,18 @@ c & c & b & a & e
 \keys_define:nn { NiceMatrix / pNiceArray }
   { 
     first-col .code:n = \int_zero:N \l_@@_first_col_int , 
-    last-col .bool_set:N = \l_@@_last_col_bool ,
+    last-col .code:n = \tl_if_empty:nF {#1}
+                         { \@@_error:n { last-col~non~empty~for~NiceArray } } 
+                       \int_zero:N \l_@@_last_col_int ,
     first-row .code:n = \int_zero:N \l_@@_first_row_int ,
     last-row .int_set:N = \l_@@_last_row_int ,
     last-row .default:n = -1 ,
-    unknown .code:n = \@@_error:n { Unknown~option~for~pNiceArray } 
+    unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } 
   }
 %    \end{macrocode}
 %
 %
-% \subsection{Code common to \{NiceArrayWithDelims\} and \{NiceMatrix\}}
+% \subsection{Important code used by \{NiceArrayWithDelims\} }
 %
 % The pseudo-environment |\@@_Cell:|--|\@@_end_Cell:| will be used to format the
 % cells of the array. In the code, the affectations are global because this
@@ -3327,8 +3343,8 @@ c & c & b & a & e
 % \interitem
 % The argument of the following command |\@@_instruction_of_type:n| defined
 % below is the type of the instruction (|Cdots|, |Vdots|, |Ddots|, etc.). This
-% command writes in the correspondint |\g_@@_|\textsl{type}|_lines_tl| the
-% instruction that will really draw the line after the construction of the
+% command writes in the corresponding |\g_@@_|\textsl{type}|_lines_tl| the
+% instruction which will really draw the line after the construction of the
 % matrix. 
 %
 % \medskip
@@ -3348,8 +3364,10 @@ c & c & b & a & e
 % 7 & \Cdots \\
 % \end{pNiceMatrix}$
 %
+% \smallskip
 % the content of |\g_@@_Cdots_lines_tl| will be:
 % 
+% \smallskip
 % \begin{scope}
 % \color{gray}
 % \verb|\@@_draw_Cdots:nn {2}{2}|
@@ -3430,7 +3448,7 @@ c & c & b & a & e
 %    \begin{macrocode}
         \int_compare:nNnT \g_@@_row_int > { -1 }
           {
-            \int_compare:nNnF \g_@@_row_int = \g_@@_last_row_int  
+            \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int  
               { 
                 \hrule \@height \arrayrulewidth
                 \skip_vertical:n { - \arrayrulewidth }
@@ -3441,14 +3459,14 @@ c & c & b & a & e
 %    \end{macrocode}
 % 
 % \bigskip
-% The following code |\@@_pre_array:| is used in |{NiceArray}| and in
-% |{NiceMatrix}|. It contains code that will be executed \emph{before} the
-% construction of the array.
+% The following code |\@@_pre_array:| is used in |{NiceArrayWithDelims}|. It
+% exists as a standalone macro only for lisibility.
 % \label{prearray}
 %
 %   \begin{macrocode}
 \cs_new_protected:Npn \@@_pre_array:
-  { 
+  {
+    \tl_clear:N \g_@@_code_after_tl
 %    \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
@@ -3463,61 +3481,20 @@ c & c & b & a & e
       }
 %    \end{macrocode}
 %
-% If the user requires all the columns to have a width equal to the widest cell
-% of the array, we read this length in the file |.aux| (of, course, this is
-% possible only on the second run of LaTeX: on the first run, the dimension
-% |\l_@@_columns_width_dim| will be set to zero --- and the columns will have
-% their natural width). Remark that, even if the environment has a name (see
-% just below) we have to write in the |aux| file the information with the number
-% of environment because of |auto-columns-width| of |{NiceMatrixBlock}|.
-%    \begin{macrocode}
-    \bool_if:NT \l_@@_auto_columns_width_bool
-      { 
-        \group_insert_after:N \@@_write_max_cell_width:
-        \cs_if_free:cTF { _@@_max_cell_width_ \int_use:N \g_@@_env_int }
-          { \dim_zero:N \l_@@_columns_width_dim }
-          { 
-            \dim_set:Nx \l_@@_columns_width_dim 
-              { \use:c { _@@_max_cell_width _ \int_use:N \g_@@_env_int } } 
-          } 
-%    \end{macrocode}
-% If the environment has a name, we read the value of the maximal value of the
-% columns from |_@@_name_cell_width|{\ttfamily\slshape name} (the value will be
-% the correct value even if the number of the environment has changed (for
-% example because the user has created or deleted an environment before the
-% current one)). 
-%    \begin{macrocode}
-        \str_if_empty:NF \l_@@_name_str
-          { 
-            \cs_if_free:cF { _@@_max_cell_width_ \l_@@_name_str }
-              { 
-                \dim_set:Nx \l_@@_columns_width_dim 
-                  { \use:c { _@@_max_cell_width_ \l_@@_name_str } }
-              }
-          }
-      }
-%    \end{macrocode}
-% We don't want to patch any code and that's why some code is executed in a
-% |\group_insert_after:N|. In particular, in this |\group_insert_after:N|, we
-% will have to know the value of some parameters like |\l_@@_extra_nodes_bool|.
-% That's why we transit via a global version for some variables.
+% 
+% \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|).
+% 
 %    \begin{macrocode}
     \bool_gset_eq:NN \g_@@_extra_nodes_bool \l_@@_extra_nodes_bool
-    \dim_gset_eq:NN \g_@@_left_margin_dim \l_@@_left_margin_dim
-    \dim_gset_eq:NN \g_@@_right_margin_dim \l_@@_right_margin_dim
-    \dim_gset_eq:NN \g_@@_extra_right_margin_dim \l_@@_extra_right_margin_dim
-    \int_gset_eq:NN \g_@@_last_row_int \l_@@_last_row_int
-    \tl_gset_eq:NN \g_@@_name_str \l_@@_name_str
-    \int_gset_eq:NN \g_@@_first_row_int \l_@@_first_row_int 
-    \int_gset_eq:NN \g_@@_first_col_int \l_@@_first_col_int 
-    \bool_gset_eq:NN \g_@@_NiceArray_bool \l_@@_NiceArray_bool
-    \bool_gset_eq:NN \g_@@_last_row_without_value_bool 
-      \l_@@_last_row_without_value_bool
-    \bool_gset_eq:NN \g_@@_small_bool \l_@@_small_bool
 %    \end{macrocode}
+%
+% \bigskip
 % The environment |{array}| uses internally the command |\ialign|. We change the
 % definition of |\ialign| for several reasons. In particular, |\ialign| sets
-% |\everycr| to |{ }|. However, we have to change the value of |\everycr|.
+% |\everycr| to |{ }| and we \emph{need} to have to change the value of |\everycr|.
 %    \begin{macrocode}
     \cs_set:Npn \ialign 
       { 
@@ -3532,6 +3509,7 @@ c & c & b & a & e
           { \everycr { \@@_everycr: } }
         \tabskip = \c_zero_skip
 %    \end{macrocode}
+%
 % The box |\@arstrutbox| is a box constructed in the beginning of the
 % environment |{array}|. The construction of that box takes into account the
 % current values of |\arraystretch|\footnote{The option |small| of
@@ -3575,24 +3553,10 @@ c & c & b & a & e
 % We define the new column types |L|, |C| and |R| that must be used instead of
 % |l|, |c| and |r| in the preamble of |{NiceArray}|.
 %    \begin{macrocode}
-    \dim_compare:nNnTF \l_@@_columns_width_dim = \c_zero_dim
-      {
-       \newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
-       \newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
-       \newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
-      }
-%    \end{macrocode}
-% If there is an option that specify that all the columns must have the same
-% width, the column types~|L|, |C| and~|R| are in fact defined upon the column
-% type~|w| of \pkg{array} which is, in fact, redefined below. 
-%    \begin{macrocode}
-      {
-       \newcolumntype L { w l { \dim_use:N \l_@@_columns_width_dim } }
-       \newcolumntype C { w c { \dim_use:N \l_@@_columns_width_dim } }
-       \newcolumntype R { w r { \dim_use:N \l_@@_columns_width_dim } } 
-      }
-%    \end{macrocode}
-% 
+    \newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
+    \newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
+    \newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
+%    \end{macrocode}    
 %
 %    \begin{macrocode}
     \cs_set_eq:NN \Ldots \@@_Ldots
@@ -3759,14 +3723,6 @@ c & c & b & a & e
     \cs_if_exist:NT \tikz@library@external@loaded
       { \tikzset { external / export = false } }
 %    \end{macrocode}
-% In |{NiceArrayWithDelims}|, it would have been possible to avoid the
-% |\group_insert_after:N| and to put |\@@_after_array| in the second
-% part of the environment |{NiceArrayWithDelims}|. However, it's not possible to
-% do that in |{NiceMatrix}| (because of the option |renew-matrix|) and that's
-% why we use this technique in |{NiceArrayWithDelims}| and in |{NiceMatrix}|.
-%   \begin{macrocode}
-    \group_insert_after:N \@@_after_array:
-%    \end{macrocode}
 %
 % We increment the counter |\g_@@_env_int| which counts the environments
 % of the extension.
@@ -3807,7 +3763,7 @@ c & c & b & a & e
 % A value based on the name is more reliable than a value based on the number of
 % the environment.
 %    \begin{macrocode}
-        \str_if_empty:NTF \g_@@_name_str
+        \str_if_empty:NTF \l_@@_name_str
           {
             \cs_if_exist:cT { @@_last_row_ \int_use:N \g_@@_env_int } 
               { 
@@ -3816,10 +3772,10 @@ c & c & b & a & e
               }  
           }
           {
-            \cs_if_exist:cT { @@_last_row_ \g_@@_name_str } 
+            \cs_if_exist:cT { @@_last_row_ \l_@@_name_str } 
               { 
                 \int_set:Nn \l_@@_last_row_int 
-                  { \use:c { @@_last_row_ \g_@@_name_str } }
+                  { \use:c { @@_last_row_ \l_@@_name_str } }
               }  
           }
       }
@@ -3833,8 +3789,8 @@ c & c & b & a & e
 % \medskip
 % We compute the width of the two delimiters.
 %    \begin{macrocode}
-    \dim_zero_new:N \g_@@_left_delim_dim
-    \dim_zero_new:N \g_@@_right_delim_dim
+    \dim_gzero_new:N \g_@@_left_delim_dim
+    \dim_gzero_new:N \g_@@_right_delim_dim
     \bool_if:NTF \l_@@_NiceArray_bool
       {
         \dim_gset:Nn \g_@@_left_delim_dim { 2 \arraycolsep }
@@ -3884,7 +3840,7 @@ c & c & b & a & e
               { \tl_put_left:Nn \l_tmpa_tl { @ { } } }
           }
       }
-    \bool_if:NTF \l_@@_last_col_bool
+    \int_compare:nNnTF \l_@@_last_col_int > { -1 }
       { \tl_put_right:NV \l_tmpa_tl \c_@@_preamble_last_col_tl }
       { 
         \bool_if:NT \l_@@_NiceArray_bool
@@ -3911,27 +3867,99 @@ c & c & b & a & e
 %    \end{macrocode}
 %
 % \bigskip
-% We begin the second part of the environment |{NiceArrayWithDelims}|.
+% We begin the second part of the environment |{NiceArrayWithDelims}|. If all
+% the columns must have the same width (if the user has used the option
+% |columns-width| or the option |auto-column-width| of the environment
+% |{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|).
+% 
 %    \begin{macrocode}
   { 
+    \bool_if:nT
+      {
+        ( \l_@@_auto_columns_width_bool && ! \l_@@_block_auto_columns_width_bool)
+        || \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim
+      }
+      {
+        \crcr
+        \int_compare:nNnT \l_@@_first_col_int = 0 { \omit & }
+        \omit
+%    \end{macrocode}
+% 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}
+        \tikz [ remember~picture , overlay ]
+          \coordinate [ name = nm - \int_use:N \g_@@_env_int - col - 0 ] ;
+%    \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 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}
+        \bool_if:nTF 
+          { 
+            \l_@@_auto_columns_width_bool 
+            && ! \l_@@_block_auto_columns_width_bool 
+          }
+          { 
+            \dim_gset:Nn \g_tmpa_dim
+              { \g_@@_max_cell_width_dim + 2 \arraycolsep } 
+          }
+          { 
+            \dim_gset:Nn \g_tmpa_dim
+              { \l_@@_columns_width_dim + 2 \arraycolsep } 
+            }
+        \skip_horizontal:N \g_tmpa_dim
+%    \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
+% 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 - 2 } }
+          { \prg_replicate:nn { \g_@@_col_total_int - 1 } }
+          { 
+             & 
+             \omit
+%    \end{marocode}
+% The incrementation of the counter |\g_tmpa_int| must be done after the |\omit|
+% of the cell.
+%    \begin{macrocode}
+             \int_gincr:N \g_tmpa_int 
+             \skip_horizontal:N \g_tmpa_dim
+%    \end{macrocode}
+% We create a ``|col|'' node on the right of the current column.
+%    \begin{macrocode}
+             \tikz [ remember~picture , overlay ]
+               \coordinate             
+                 [
+                   name = nm - \int_use:N \g_@@_env_int -
+                          col - \int_use:N \g_tmpa_int
+                 ] ; 
+          }
+      }
     \endarray
     \c_math_toggle_token
-    \skip_horizontal:n \g_@@_right_margin_dim 
-    \skip_horizontal:n \g_@@_extra_right_margin_dim 
+    \skip_horizontal:n \l_@@_right_margin_dim 
+    \skip_horizontal:n \l_@@_extra_right_margin_dim 
     \hbox_set_end:
 %    \end{macrocode}
 %
 % \bigskip
 %
 %    \begin{macrocode}
-    \int_compare:nNnT \g_@@_last_row_int > { -2 }
+    \int_compare:nNnT \l_@@_last_row_int > { -2 }
       {
-        \bool_if:NF \g_@@_last_row_without_value_bool
+        \bool_if:NF \l_@@_last_row_without_value_bool
           {
-            \int_compare:nNnF \g_@@_last_row_int = \g_@@_row_int
+            \int_compare:nNnF \l_@@_last_row_int = \g_@@_row_int
               { 
                 \@@_error:n { Wrong~last~row } 
-                \int_gset_eq:NN \g_@@_last_row_int \g_@@_row_int
+                \int_gset_eq:NN \l_@@_last_row_int \g_@@_row_int
               }
           } 
       }
@@ -3977,7 +4005,7 @@ c & c & b & a & e
 % column'' has been constructed in an overlapping position and that we have computed
 % its width in |\g_@@_width_first_col_dim|: see p.~\pageref{overlap-left}).
 %    \begin{macrocode}
-    \int_compare:nNnT \g_@@_first_col_int = \c_zero_int
+    \int_compare:nNnT \l_@@_first_col_int = \c_zero_int
       { 
         \skip_horizontal:n \arraycolsep
         \skip_horizontal:n \g_@@_width_first_col_dim 
@@ -3989,9 +4017,9 @@ c & c & b & a & e
 % into account the option of position (|t|, |c| or |b|). We begin with
 % |{NiceArray}|. 
 %    \begin{macrocode}
-    \bool_if:NTF \g_@@_NiceArray_bool
+    \bool_if:NTF \l_@@_NiceArray_bool
       { 
-        \int_compare:nNnT \g_@@_first_row_int = \c_zero_int
+        \int_compare:nNnT \l_@@_first_row_int = \c_zero_int
           { 
             \str_if_eq:VnTF \l_@@_pos_env_str { t }
               {
@@ -4000,7 +4028,7 @@ c & c & b & a & e
               }
           }
           {
-            \bool_if:NT \g_@@_last_row_int
+            \int_compare:nNnT \l_@@_last_row_int > 0
               {
                 \str_if_eq:VnT \l_@@_pos_env_str { b }
                   {
@@ -4059,10 +4087,12 @@ c & c & b & a & e
         \skip_horizontal:n \g_@@_width_last_col_dim 
         \skip_horizontal:n \arraycolsep 
       }
+    \@@_after_array:
   }
 %    \end{macrocode}
 % This is the end of the environment |{NiceArrayWithDelims}|.
 %
+% 
 % \interitem
 % Here is the preamble for the ``first column'' (if the user uses the key |first-col|)
 %    \begin{macrocode}
@@ -4249,7 +4279,8 @@ c & c & b & a & e
 %   \begin{macrocode}
 \NewDocumentEnvironment { pNiceArray } { }
   {
-    \str_gset:Nn \g_@@_type_env_str { pNiceArray }
+    \str_if_empty:NT \g_@@_type_env_str 
+      { \str_gset:Nn \g_@@_type_env_str { pNiceArray } }
     \@@_test_if_math_mode:
     \NiceArrayWithDelims ( )
   }
@@ -4259,7 +4290,8 @@ c & c & b & a & e
 %   \begin{macrocode}
 \NewDocumentEnvironment { bNiceArray } { }
   {
-    \str_gset:Nn \g_@@_type_env_str { bNiceArray }
+    \str_if_empty:NT \g_@@_type_env_str 
+      { \str_gset:Nn \g_@@_type_env_str { NiceArray } }
     \@@_test_if_math_mode:
     \NiceArrayWithDelims [ ]
   }
@@ -4269,7 +4301,8 @@ c & c & b & a & e
 %   \begin{macrocode}
 \NewDocumentEnvironment { BNiceArray } { }
   {
-    \str_gset:Nn \g_@@_type_env_str { BNiceArray }
+    \str_if_empty:NT \g_@@_type_env_str 
+      { \str_gset:Nn \g_@@_type_env_str { BNiceArray } }
     \@@_test_if_math_mode:
     \NiceArrayWithDelims \{ \}
   }
@@ -4279,7 +4312,8 @@ c & c & b & a & e
 %   \begin{macrocode}
 \NewDocumentEnvironment { vNiceArray } { }
   {
-    \str_gset:Nn \g_@@_type_env_str { vNiceArray }
+    \str_if_empty:NT \g_@@_type_env_str 
+      { \str_gset:Nn \g_@@_type_env_str { vNiceArray } }
     \@@_test_if_math_mode:
     \NiceArrayWithDelims | |
   }
@@ -4289,7 +4323,8 @@ c & c & b & a & e
 %   \begin{macrocode}
 \NewDocumentEnvironment { VNiceArray } { }
   {
-    \str_gset:Nn \g_@@_type_env_str { VNiceArray }
+    \str_if_empty:NT \g_@@_type_env_str 
+      { \str_gset:Nn \g_@@_type_env_str { VNiceArray } }
     \@@_test_if_math_mode:
     \NiceArrayWithDelims \| \|
   }
@@ -4299,165 +4334,41 @@ c & c & b & a & e
 % \bigskip
 % \subsection{The environment \{NiceMatrix\} and its variants}
 %
-% Our environment |{NiceMatrix}| must have the same second part as the
-% environment |{matrix}| of \pkg{amsmath} (because of the programmation of the
-% option |renew-matrix|). Hence, this second part is the following: 
-% 
-% \begin{Verbatim}
-%          \endarray
-%          \skip_horizontal:n { - \arraycolsep }
-% \end{Verbatim}
-% 
-% That's why in the definition of |{NiceMatrix}|, we have to use |\array| and
-% not |\begin{array}|. This command |\array| is in |\@@_array:| (we have written
-% this command because of the redefinition of |\array| done in the classes
-% \cls{revtex4-1} and \cls{revtex4-2}).
-%
-% In order to execute code after the array, we use a command
-% |\group_insert_after:N|. 
-% 
-% \medskip
-% Here's the definition of |{NiceMatrix}|:
-%    \begin{macrocode}
-\NewDocumentEnvironment { NiceMatrix } { ! O { } }
-  { 
-    \str_if_empty:NT \g_@@_type_env_str 
-      { \str_gset:Nn \g_@@_type_env_str { NiceMatrix } }
-    \@@_test_if_math_mode:
-    \bool_if:NT \l_@@_in_env_bool { \@@_fatal:n { Yet~in~env } } 
-    \bool_set_true:N \l_@@_in_env_bool
-%    \end{macrocode}
-% We have to deactivate the potential externalisation of Tikz because
-% \pkg{nicematrix} uses Tikz with |remember picture|.
-%    \begin{macrocode} 
-    \cs_if_exist:NT \tikz@library@external@loaded
-      { \tikzset { external / export = false } }
-%    \end{macrocode}
-% The instruction for actual drawing of the dotted lines must be in a
-% |\group_insert_after:N| because the second part of the environment must be the
-% same as in |{array}| (for the option |renew-matrix|).
 %    \begin{macrocode}
-    \group_insert_after:N \@@_after_array:
-    \int_gincr:N \g_@@_env_int
-    \bool_if:NF \l_@@_block_auto_columns_width_bool
-      { \dim_gzero_new:N \g_@@_max_cell_width_dim }
-    \keys_set:nn { NiceMatrix / NiceMatrix } { #1 }
-%    \end{macrocode}
-% The macro |\@@_pre_array:| is defined above (see p.~\pageref{prearray}). It
-% is also used in |{NiceArrayWithDelims}|.
-%    \begin{macrocode}      
-    \@@_pre_array:
-    \skip_horizontal:n { - \arraycolsep } 
-    \skip_horizontal:n \l_@@_left_margin_dim 
-    \skip_horizontal:n \l_@@_extra_left_margin_dim 
-    \str_set:Nn \l_@@_pos_env_str c
-    \bool_set_false:N \l_@@_exterior_arraycolsep_bool
-    \@@_array: { * \c@MaxMatrixCols C }
-  }
-  { 
-    \endarray
-    \skip_horizontal:n { - \arraycolsep } 
-%    \end{macrocode}
-% The two following lines are, of course, not in the second part of |{array}|,
-% but that doesn't matter because, when |renew-matrix| is used, 
-% |\g_@@_right_margin_dim| and |\g_@@_extra_right_margin_dim| will be equal to $0$~pt.
-%    \begin{macrocode}
-    \skip_horizontal:n \g_@@_right_margin_dim
-    \skip_horizontal:n \g_@@_extra_right_margin_dim
-  }
-%    \end{macrocode}
-%
-% \interitem
-% We create the variants of the environment |{NiceMatrix}|.
-%    \begin{macrocode}
-\NewDocumentEnvironment { pNiceMatrix } { }
-  { 
-    \str_gset:Nn \g_@@_type_env_str { pNiceMatrix }
-    \@@_test_if_math_mode: 
-    \left( \begin{NiceMatrix} 
-  }
-  { \end{NiceMatrix} \right) }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\NewDocumentEnvironment { bNiceMatrix } { }
-  { 
-    \str_gset:Nn \g_@@_type_env_str { bNiceMatrix }
-    \@@_test_if_math_mode: 
-    \left[ \begin{NiceMatrix} 
-  }
-  { \end{NiceMatrix} \right] }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\NewDocumentEnvironment { BNiceMatrix } { }
-  { 
-    \str_gset:Nn \g_@@_type_env_str { BNiceMatrix }
-    \@@_test_if_math_mode: 
-    \left\{ \begin{NiceMatrix} 
-  }
-  { \end{NiceMatrix} \right\} }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\NewDocumentEnvironment { vNiceMatrix } { }
-  { 
-    \str_gset:Nn \g_@@_type_env_str { vNiceMatrix }
-    \@@_test_if_math_mode: 
-    \left\lvert \begin{NiceMatrix} 
+\cs_new_protected:Npn \@@_define_env:n #1
+  {
+    \NewDocumentEnvironment { #1 NiceMatrix } { ! O { } }
+      {
+        \str_gset:Nn \g_@@_type_env_str { #1 NiceMatrix } 
+        \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 }
+        \begin { #1 NiceArray } 
+          { 
+            * 
+              { 
+                \int_compare:nNnTF \l_@@_last_col_int = { -1 }  
+                  \c@MaxMatrixCols
+                  { \int_eval:n { \l_@@_last_col_int - 1 } }
+              } 
+              C 
+          } 
+      }
+      { \end { #1 NiceArray } }
   }
-  { \end{NiceMatrix} \right\rvert }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\NewDocumentEnvironment { VNiceMatrix } { }
-  { 
-    \str_gset:Nn \g_@@_type_env_str { VNiceMatrix }
-    \@@_test_if_math_mode: 
-    \left\lVert \begin{NiceMatrix} 
-  }
-  { \end{NiceMatrix} \right\rVert }
+\@@_define_env:n { }
+\@@_define_env:n p 
+\@@_define_env:n b 
+\@@_define_env:n B
+\@@_define_env:n v
+\@@_define_env:n V
 %    \end{macrocode}
 %
 %
 % \bigskip
 % \subsection{Automatic width of the cells}
 %
-% For the option |columns-width=auto| (or the option |auto-columns-width|
-% of the environment |{NiceMatrixBlock}|), we want to know the maximal width of
-% the cells of the array (except the cells of the ``exterior'' column of an
-% environment of the kind of |{pNiceAccayC}|). This length can be known only
-% after the end of the construction of the array (or at the end of the
-% environment |{NiceMatrixBlock}|). That's why we store this value in the main
-% |.aux| file and it will be available in the next run. We write a dedicated
-% command for this because it will be called in a~|\group_insert_after:N|. 
-%    \begin{macrocode}
-\cs_new_protected:Nn \@@_write_max_cell_width:
-  { 
-    \bool_if:NF \l_@@_block_auto_columns_width_bool
-      { 
-        \iow_now:Nn \@mainaux \ExplSyntaxOn 
-        \iow_now:Nx \@mainaux 
-          { 
-            \cs_gset:cpn { @@_max_cell_width_ \int_use:N \g_@@_env_int }
-              { \dim_use:N \g_@@_max_cell_width_dim } 
-          }
-%    \end{macrocode}
-% If the environment has a name, we also create an alias named
-% |\@@_max_cell_width_|{\ttfamily\slshape name}.
-%    \begin{macrocode}
-        \str_if_empty:NF \g_@@_name_str
-          {
-            \iow_now:Nx \@mainaux 
-              {
-                \cs_gset:cpn { @@_max_cell_width_ \g_@@_name_str } 
-                  { \dim_use:N \g_@@_max_cell_width_dim } 
-              } 
-          }
-        \iow_now:Nn \@mainaux \ExplSyntaxOff  
-      } 
-  }
-%    \end{macrocode}
 % 
 % \bigskip
 % \subsection{How to know whether a cell is ``empty''}
@@ -4599,14 +4510,14 @@ c & c & b & a & e
 % same principle.
 %    \begin{macrocode}
     \int_gset_eq:NN \g_@@_row_total_int \g_@@_row_int
-    \int_compare:nNnT \g_@@_last_row_int > { -1 }
+    \int_compare:nNnT \l_@@_last_row_int > { -1 }
       { \int_gsub:Nn \g_@@_row_int \c_one_int }
 %    \end{macrocode}
 %
 % In the user has used the option |last-row| without value, we write in the
 % |aux| file the number of that last row for the next run.
 %    \begin{macrocode}
-    \bool_if:NT \g_@@_last_row_without_value_bool
+    \bool_if:NT \l_@@_last_row_without_value_bool
       {
         \iow_now:Nn \@mainaux \ExplSyntaxOn 
         \iow_now:Nx \@mainaux 
@@ -4619,11 +4530,11 @@ c & c & b & a & e
 % because it's more reliable than a value based on the number of the
 % environment. 
 %    \begin{macrocode}
-        \str_if_empty:NF \g_@@_name_str
+        \str_if_empty:NF \l_@@_name_str
           { 
             \iow_now:Nx \@mainaux 
               { 
-                \cs_gset:cpn { @@_last_row_ \g_@@_name_str } 
+                \cs_gset:cpn { @@_last_row_ \l_@@_name_str } 
                   { \int_use:N \g_@@_row_total_int }
               }  
           }
@@ -4675,7 +4586,7 @@ c & c & b & a & e
 % If the option |small| is used, the values |\l_@@_radius_dim| and
 % |\l_@@_inter_dots_dim| (used to draw the dotted lines) are changed.
 %    \begin{macrocode}     
-    \bool_if:NT \g_@@_small_bool 
+    \bool_if:NT \l_@@_small_bool 
       { 
         \dim_set:Nn \l_@@_radius_dim { 0.37 pt }
         \dim_set:Nn \l_@@_inter_dots_dim { 0.25 em } 
@@ -5025,8 +4936,7 @@ c & c & b & a & e
         \bool_if:NTF \l_@@_initial_open_bool
           {
 %    \end{macrocode}
-% If a |w| node exists (created when the key |columns-width| is used), we use
-% the |w| node for the extremity.
+% If a |w| node exists we use the |w| node for the extremity.
 %    \begin{macrocode}
            \cs_if_exist:cTF
              { 
@@ -5405,8 +5315,9 @@ c & c & b & a & e
           {  
             ( \g_@@_x_final_dim - \g_@@_x_initial_dim ) *
             \dim_ratio:nn 
-              { \l_@@_l_dim - \l_@@_inter_dots_dim * \l_tmpa_int } { \l_@@_l_dim * 2 } *
-            \l_tmpb_int
+            { \l_@@_l_dim - \l_@@_inter_dots_dim * \l_tmpa_int }
+            { \l_@@_l_dim * 2 }
+            * \l_tmpb_int
           }
 %    \end{macrocode}
 % (In a multiplication of a dimension and an integer, the integer must always be
@@ -5714,7 +5625,7 @@ c & c & b & a & e
     \cs_set:Npn \@@_dotfill:
       { 
 %    \end{macrocode}
-% If the option |small| is used, we change the space between two dots (we can't
+% If the option |small| is used, we change the space between dots (we can't
 % use |\l_@@_inter_dots_dim| which will be set after the construction of the
 % array). We can't put the |\bool_if:NT| in the first argument of
 % |\hbox_to_wd:nn| because |\cleaders| is a special TeX primitive.
@@ -5751,7 +5662,7 @@ c & c & b & a & e
             \hbox_to_wd:nn 
               { 
                 \l_tmpa_dim + 2 \arraycolsep 
-                - \l_@@_left_margin_dim - \g_@@_right_margin_dim 
+                - \l_@@_left_margin_dim - \l_@@_right_margin_dim 
               } 
             \@@_dotfill: 
           }
@@ -5759,8 +5670,6 @@ c & c & b & a & e
   }
 %    \end{macrocode}
 %
-%
-%
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_vdottedline:n
@@ -5795,14 +5704,8 @@ c & c & b & a & e
               \dim_gset:Nn \g_@@_y_final_dim \pgf@y
             \end { tikzpicture }
 %    \end{macrocode}
-% However, if the |w|-nodes are created in the previous column (that is if the
-% previous column was constructed explicitly or implicitly\footnote{A column is
-% constructed implicitly with the letter |w| if the option |columns-width| is
-% used or if the environment |{NiceMatrixBlock}| is used with the option
-% |auto-columns-width|.} with a letter |w|), we use the |w|-nodes to change the
-% $x$-value of the nodes in order to have the dotted lines perfectly aligned
-% when we use the environment |{NiceMatrixBlock}| with the option
-% |auto-columns-width|.
+% However, if the previous column was constructed with a letter |w|, we use the
+% |w|-nodes to change the $x$-value of the nodes.
 %    \begin{macrocode}
             \cs_if_exist:cT
               { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - 1 - #1 - w }
@@ -5818,6 +5721,20 @@ c & c & b & a & e
                 \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep
                 \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep
               }
+%    \end{macrocode}
+% However, if a node of column 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 - col - #1 }
+              {
+                \begin { tikzpicture } [ remember~picture ]
+                  \tikz@parse@node\pgfutil@firstofone
+                    ( col - #1 )
+                  \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
+                  \dim_gset:Nn \g_@@_x_final_dim \pgf@x
+                \end { tikzpicture }
+              }
             \@@_draw_tikz_line:
           } 
       }
@@ -5938,9 +5855,17 @@ c & c & b & a & e
 %    \begin{macrocode}
 \NewDocumentEnvironment { NiceMatrixBlock } { ! O { } }
   {
+    \int_gincr:N \g_@@_NiceMatrixBlock_int
+    \dim_zero:N \l_@@_columns_width_dim
     \keys_set:nn { NiceMatrix / NiceMatrixBlock } { #1 }
-    \int_zero_new:N \l_@@_first_env_block_int
-    \int_set:Nn \l_@@_first_env_block_int { \g_@@_env_int + 1 }
+    \bool_if:NT \l_@@_block_auto_columns_width_bool
+      {
+        \cs_if_exist:cT { @@_max_cell_width_ \int_use:N \g_@@_NiceMatrixBlock_int }
+          {
+            \dim_set:Nx \l_@@_columns_width_dim
+              { \use:c { @@_max_cell_width _ \int_use:N \g_@@_NiceMatrixBlock_int } }
+          } 
+      }
   }
 %    \end{macrocode}
 %
@@ -5954,13 +5879,11 @@ c & c & b & a & e
     \bool_if:NT \l_@@_block_auto_columns_width_bool
       {
         \iow_now:Nn \@mainaux \ExplSyntaxOn
-        \int_step_inline:nnnn \l_@@_first_env_block_int 1 \g_@@_env_int
+        \iow_now:Nx \@mainaux         
           { 
-            \iow_now:Nx \@mainaux         
-              { 
-                \cs_gset:cpn { @@ _ max _ cell _ width _ ##1 } 
-                  { \dim_use:N \g_@@_max_cell_width_dim }
-              }
+            \cs_gset:cpn 
+              { @@ _ max _ cell _ width _ \int_use:N \g_@@_NiceMatrixBlock_int } 
+              { \dim_use:N \g_@@_max_cell_width_dim }
           }
         \iow_now:Nn \@mainaux \ExplSyntaxOff
       }
@@ -6002,14 +5925,14 @@ c & c & b & a & e
 \cs_new_protected:Nn \@@_create_extra_nodes:
   {
     \begin { tikzpicture } [ remember~picture , overlay ]
-      \int_step_variable:nnNn \g_@@_first_row_int \g_@@_row_total_int \@@_i:
+      \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
         { 
           \dim_zero_new:c { l_@@_row_\@@_i: _min_dim } 
           \dim_set_eq:cN { l_@@_row_\@@_i: _min_dim } \c_max_dim
           \dim_zero_new:c { l_@@_row_\@@_i: _max_dim } 
           \dim_set:cn { l_@@_row_\@@_i: _max_dim } { - \c_max_dim }
         }
-      \int_step_variable:nnNn \g_@@_first_col_int \g_@@_col_total_int \@@_j:
+      \int_step_variable:nnNn \l_@@_first_col_int \g_@@_col_total_int \@@_j:
         {
           \dim_zero_new:c { l_@@_column_\@@_j: _min_dim } 
           \dim_set_eq:cN { l_@@_column_\@@_j: _min_dim } \c_max_dim
@@ -6019,10 +5942,10 @@ c & c & b & a & e
 %    \end{macrocode}
 % We begin the two nested loops over the rows and the columns of the array.
 %    \begin{macrocode}
-      \int_step_variable:nnNn \g_@@_first_row_int \g_@@_row_total_int \@@_i:
+      \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
         { 
           \int_step_variable:nnNn 
-            \g_@@_first_col_int \g_@@_col_total_int \@@_j: 
+            \l_@@_first_col_int \g_@@_col_total_int \@@_j: 
 %    \end{macrocode}
 % Maybe the cell ($i$-$j$) is an implicit cell (that is to say a cell after
 % implicit ampersands |&|). In this case, of course, we don't update the
@@ -6075,8 +5998,8 @@ c & c & b & a & e
 % 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 for the rows.
 %     \begin{macrocode}
-      \int_set:Nn \g_@@_first_row_int 1
-      \int_set:Nn \g_@@_first_col_int 1
+      \int_set:Nn \l_@@_first_row_int 1
+      \int_set:Nn \l_@@_first_col_int 1
 %    \end{macrocode}
 % We have to change the values of all the dimensions
 % \texttt{l_@@_row_\textsl{i}_min_dim}, \texttt{l_@@_row_\textsl{i}_max_dim},
@@ -6113,10 +6036,10 @@ c & c & b & a & e
         }
       \dim_sub:cn 
         { l_@@_column _ 1 _ min _ dim } 
-        \g_@@_left_margin_dim
+        \l_@@_left_margin_dim
       \dim_add:cn 
         { l_@@_column _ \int_use:N \g_@@_col_int _ max _ dim } 
-        \g_@@_right_margin_dim
+        \l_@@_right_margin_dim
 %    \end{macrocode}
 % Now, we can actually create the ``large nodes''.
 %    \begin{macrocode}
@@ -6167,9 +6090,9 @@ c & c & b & a & e
 %     \begin{macrocode}
 \cs_new_protected:Nn \@@_create_nodes:
   { 
-    \int_step_variable:nnNn \g_@@_first_row_int \g_@@_row_total_int \@@_i:
+    \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
       { 
-        \int_step_variable:nnNn \g_@@_first_col_int \g_@@_col_total_int \@@_j:
+        \int_step_variable:nnNn \l_@@_first_col_int \g_@@_col_total_int \@@_j:
 %    \end{macrocode}
 % We create two ponctual nodes for the extremities of a diagonal of the
 % rectangular node we want to create. These nodes |(@@~south~west)| and
@@ -6196,8 +6119,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 \g_@@_name_str 
-                    { \g_@@_name_str - \@@_i: - \@@_j: }
+                  \str_if_empty:NF \l_@@_name_str 
+                    { \l_@@_name_str - \@@_i: - \@@_j: }
               ] 
               ; 
           }
@@ -6208,7 +6131,7 @@ c & c & b & a & e
 % |\multicolumn{|$n$|}{...}{...}| with $n$>1 was issued and in
 % |\g_@@_multicolumn_sizes_seq| the correspondant values of $n$. 
 %    \begin{macrocode}
-    \@@_seq_mapthread_function:NNN 
+    \seq_mapthread_function:NNN 
       \g_@@_multicolumn_cells_seq 
       \g_@@_multicolumn_sizes_seq
       \@@_node_for_multicolumn:nn
@@ -6249,7 +6172,7 @@ 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 \g_@@_name_str { \g_@@_name_str - \@@_i: - \@@_j: }
+          \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - \@@_i: - \@@_j: }
       ] 
       ; 
   }
@@ -6385,6 +6308,29 @@ c & c & b & a & e
   }
 %    \end{macrocode}
 %                          
+% % \subsection{How to draw the dotted lines transparently}
+%    \begin{macrocode}
+\cs_set_protected:Npn \@@_renew_matrix:
+  { 
+    \RenewDocumentEnvironment { pmatrix } { }
+      { \pNiceMatrix } 
+      { \endpNiceMatrix }
+    \RenewDocumentEnvironment { vmatrix } { }
+      { \vNiceMatrix }
+      { \endvNiceMatrix }
+    \RenewDocumentEnvironment { Vmatrix } { }
+      { \VNiceMatrix }
+      { \endVNiceMatrix }
+    \RenewDocumentEnvironment { bmatrix } { }
+      { \bNiceMatrix }
+      { \endbNiceMatrix }
+    \RenewDocumentEnvironment { Bmatrix } { }
+      { \BNiceMatrix }
+      { \endBNiceMatrix }
+  }
+%    \end{macrocode}
+%
+%
 %
 % \subsection{We process the options}
 %
@@ -6398,12 +6344,41 @@ c & c & b & a & e
 % Of course, the command |\NiceMatrix| must be defined before such an
 % instruction is executed. 
 %    \begin{macrocode}
-\ProcessKeysOptions { NiceMatrix }
+\keys_define:nn { NiceMatrix / Package }
+  {
+    renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
+    renew-dots .value_forbidden:n = true ,
+    renew-matrix .code:n = \@@_renew_matrix: ,
+    renew-matrix .value_forbidden:n = true ,
+    transparent .meta:n = { renew-dots , renew-matrix } ,
+    transparent .value_forbidden:n = true,
+  }
+\ProcessKeysOptions { NiceMatrix / Package }
 %    \end{macrocode}
 %
 % \subsection{Error messages of the package}
 %
 %    \begin{macrocode}
+\@@_msg_new:nn { last-col~non~empty~for~NiceArray }
+  {
+    In~the~environment~\{\g_@@_type_env_str\},~you~must~use~the~option~
+    'last-col'~without~value~(the~number~of~columns~is~known~by~the~
+    preamble~of~the~environment).\\
+    However,~you~can~go~on~for~this~time~
+    (the~value~'\l_keys_value_tl'~will~be~ignored). 
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { last-col~empty~for~NiceMatrix }
+  {
+    In~the~environment~\{\g_@@_type_env_str\}~you~can't~use~the~option~
+    'last-col'~without~value.~You~must~give~the~number~of~that~last~column.\\
+    If~you~go~on~this~option~will~be~ignored.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \@@_msg_new:nn { Block~too~large }
   {
     You~try~to~draw~a~block~in~the~cell~#1-#2~of~your~matrix~but~the~matrix~is~
@@ -6425,7 +6400,7 @@ c & c & b & a & e
 %    \begin{macrocode}
 \@@_msg_new:nn { Wrong~last~row }
   { 
-    You~have~used~'last-row=\int_use:N \g_@@_last_row_int'~but~your~environment~
+    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\ 
     will~be~used~for~last~row.~You~can~avoid~this~problem~by~using~'last-row'~
@@ -6502,7 +6477,7 @@ c & c & b & a & e
     renew-dots,~
     renew-matrix,~
     right-margin,~
-    small,~
+    small~
     and~transparent
   }
 %    \end{macrocode}
@@ -6528,50 +6503,28 @@ c & c & b & a & e
     create-extra-nodes,~
     extra-left-margin,~
     extra-right-margin,~
+    first-col,~
+    first-row,~
     hlines,~
+    last-col,~
+    last-row,~
     left-margin,~
     name,~
     nullify-dots,~
     parallelize-diags,~
     renew-dots,~
     right-margin,~
-    small,~
+    small~
     and~t.
   }
 %    \end{macrocode}
 %
-%
-%    \begin{macrocode}
-\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
-  { 
-    The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
-    \{NiceMatrix\}~and~its~variants. \\
-    If~you~go~on,~it~will~be~ignored. \\
-    For~a~list~of~the~available~options,~type~H~<return>.
-  }
-  { 
-    The~available~options~are~(in~alphabetic~order):~
-    code-after,~
-    columns-width,~
-    create-extra-nodes,~
-    extra-left-margin,~
-    extra-right-margin,~
-    hlines,~
-    left-margin,~
-    name,~
-    nullify-dots,~
-    parallelize-diags,~
-    renew-dots,~
-    right-margin~
-    and~small.
-  }
-%    \end{macrocode}
-% 
 % \medskip
-% Despite its name, the following set of keys will be used for |{pNiceArray}|
-% but also |{vNiceArray}|, |{VNiceArray}|, etc. but not for |{NiceArray}|.
+% This error message is used for the set of keys |NiceMatrix/NiceMatrix| and
+% |NiceMatrix/pNiceArray| (but not by |NiceMatrix/NiceArray| (because, for this
+% set of keys, there is also the options |t|, |c| and~|b|).
 %    \begin{macrocode}
-\@@_msg_new:nnn { Unknown~option~for~pNiceArray }
+\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
   { 
     The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
     \{\g_@@_type_env_str\}. \\
@@ -6591,9 +6544,9 @@ c & c & b & a & e
     extra-right-margin,~
     first-col,~
     first-row,~
+    hlines,~
     last-col,~
     last-row,~
-    hlines,~
     left-margin,~
     name,~
     nullify-dots,~
@@ -6646,54 +6599,7 @@ 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}
-%
-% 
-% \subsection{Code for \textbackslash seq_mapthread_function:NNN}
-%
-% In |\@@_create_nodes:| (used twice in |\@@_create_extra_nodes:| to create the
-% ``medium nodes'' and ``large nodes''), we want to use
-% |\seq_mapthread_function:NNN| which is in \pkg{l3candidates}). For security,
-% we define a function |\@@_seq_mapthread_function:NNN|. We will delete the
-% following code when |\seq_mapthread_function:NNN| will be in \pkg{l3seq}.
-%    \begin{macrocode}
-\cs_new:Npn \@@_seq_mapthread_function:NNN #1 #2 #3
-  { 
-   \group_begin:
-%    \end{macrocode}
-% In the group, we can use |\seq_pop:NN| safely.
-%    \begin{macrocode}
-   \int_step_inline:nn { \seq_count:N #1 }
-     { 
-       \seq_pop:NN #1 \l_tmpa_tl
-       \seq_pop:NN #2 \l_tmpb_tl
-       \exp_args:NVV #3 \l_tmpa_tl \l_tmpb_tl
-     }
-   \group_end:
-  }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\cs_set_protected:Npn \@@_renew_matrix:
-  { 
-    \RenewDocumentEnvironment { pmatrix } { }
-      { \pNiceMatrix } 
-      { \endpNiceMatrix }
-    \RenewDocumentEnvironment { vmatrix } { }
-      { \vNiceMatrix }
-      { \endvNiceMatrix }
-    \RenewDocumentEnvironment { Vmatrix } { }
-      { \VNiceMatrix }
-      { \endVNiceMatrix }
-    \RenewDocumentEnvironment { bmatrix } { }
-      { \bNiceMatrix }
-      { \endbNiceMatrix }
-    \RenewDocumentEnvironment { Bmatrix } { }
-      { \BNiceMatrix }
-      { \endBNiceMatrix }
-  }
-%    \end{macrocode}
-%
+%   \end{macrocode}
 %
 %
 % \subsection{Obsolete environments}
@@ -6701,7 +6607,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { pNiceArrayC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \pNiceArray
   }
   { \endpNiceArray }
@@ -6710,7 +6616,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { bNiceArrayC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \bNiceArray
   }
   { \endbNiceArray }
@@ -6719,7 +6625,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { BNiceArrayC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \BNiceArray
   }
   { \endBNiceArray }
@@ -6728,7 +6634,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { vNiceArrayC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \vNiceArray
   }
   { \endvNiceArray }
@@ -6737,7 +6643,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { VNiceArrayC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \VNiceArray
   }
   { \endVNiceArray }
@@ -6746,7 +6652,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { pNiceArrayRC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \int_set:Nn \l_@@_first_row_int \c_zero_int
     \pNiceArray
   }
@@ -6756,7 +6662,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { bNiceArrayRC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \int_set:Nn \l_@@_first_row_int \c_zero_int
     \bNiceArray
   }
@@ -6766,7 +6672,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { BNiceArrayRC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \int_set:Nn \l_@@_first_row_int \c_zero_int
     \BNiceArray
   }
@@ -6786,7 +6692,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { VNiceArrayRC } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \int_set:Nn \l_@@_first_row_int \c_zero_int
     \VNiceArray
   }
@@ -6796,7 +6702,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { NiceArrayCwithDelims } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \NiceArrayWithDelims
   }
   { \endNiceArrayWithDelims }
@@ -6805,7 +6711,7 @@ c & c & b & a & e
 %    \begin{macrocode} 
 \NewDocumentEnvironment { NiceArrayRCwithDelims } { }
   {
-    \bool_set_true:N \l_@@_last_col_bool
+    \int_set:Nn \l_@@_last_col_int \c_zero_dim
     \int_set:Nn \l_@@_first_row_int \c_zero_int
     \NiceArrayWithDelims
   }
@@ -6972,7 +6878,20 @@ c & c & b & a & e
 %
 % Option |small|.
 %
+% \subsection*{Changes between version 3.2 and 3.3}
+%
+% The options |first-row|, |last-row|, |first-col| and |last-col| are now
+% available in the environments |{NiceMatrix}|, |{pNiceMatrix}|,
+% |{bNiceMatrix}|, etc.
+%
+% The option |columns-width=auto| doesn't need any more a second compilation.
+% 
+% The options |renew-dots|, |renew-matrix| and |transparent| are now available
+% as package options (as said in the documentation).
 %
+% The previous version of \pkg{nicematrix} was incompatible with a recent
+% version of \pkg{expl3} (released 2019/09/30). This version is compatible.
+% 
 % \PrintIndex
 % 
 % \tableofcontents
@@ -6983,3 +6902,4 @@ c & c & b & a & e
 % TeX-fold-preserve-comments: nil
 % fill-column: 80
 % End:
+
-- 
cgit v1.2.3

