texlive[55079] Master/texmf-dist: nicematrix (10may20)

commits+karl at tug.org commits+karl at tug.org
Sun May 10 00:07:16 CEST 2020


Revision: 55079
          http://tug.org/svn/texlive?view=revision&revision=55079
Author:   karl
Date:     2020-05-10 00:07:16 +0200 (Sun, 10 May 2020)
Log Message:
-----------
nicematrix (10may20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
    trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
    trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
    trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
    trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2020-05-09 22:06:57 UTC (rev 55078)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2020-05-09 22:07:16 UTC (rev 55079)
@@ -10,8 +10,9 @@
 \usepackage{amsmath}
 
 \usepackage{array}
-\usepackage{colortbl}
 \usepackage{nicematrix}
+% \usepackage{colortbl}
+
 \usepackage{tikz}
 \usetikzlibrary{fit}
 
@@ -21,7 +22,7 @@
 \usepackage{siunitx}
 
 
-\usepackage{arydshln}
+% \usepackage{arydshln}
 \usepackage{verbatim}
 
 % We use \MakeShortVerb of shortvrb and not \DefineShortVerb of fancyvrb
@@ -84,9 +85,9 @@
 
 \begin{abstract}
 L'extension LaTeX \pkg{nicematrix} fournit de nouveaux environnements similaires aux environnements classiques
-|{array}| et |{matrix}| mais avec des fonctionnalités supplémentaires. Parmi ces fonctionnalités figurent la
-possibilité de fixer la largeur des colonnes et de tracer des traits en pointillés continus entre les cases du
-tableau.
+|{tabular}|, |{array}| et |{matrix}| mais avec des fonctionnalités supplémentaires. Parmi ces fonctionnalités
+figurent la possibilité de fixer la largeur des colonnes et de tracer des traits en pointillés continus entre les
+cases du tableau.
 \end{abstract}
 
 \vspace{1cm}
@@ -107,9 +108,7 @@
 Cette extension fournit quelques outils supplémentaires pour dessiner des matrices (au sens mathématique). Les
 principales caractéristiques sont les suivantes :
 \begin{itemize}\setlength{\itemsep}{0pt}
-\item des lignes en pointillés continues\footnote{Si l'option de classe
-\texttt{draft} est utilisée, ces lignes en pointillés ne sont pas tracées pour
-accélérer la compilation.} ;
+\item des lignes en pointillés continues ;
 \item des rangées et colonnes extérieures pour les labels ;
 \item un contrôle sur la largeur des colonnes.
 \end{itemize}
@@ -134,9 +133,6 @@
 Une commande|\NiceMatrixOptions| est fournie pour régler les options (la portée des options fixées par cette
 commande est le groupe TeX courant).
 
-
-
-
 \bigskip
 \textbf{Un exemple d'utilisation pour les lignes en pointillés continues}
 
@@ -193,17 +189,17 @@
 \begin{ttfamily}
 \setlength{\tabcolsep}{3mm}
 \begin{tabular}{llll}
-\{NiceMatrix\}  & \{NiceArray\} & \{pNiceArray\}          \\
-\{pNiceMatrix\} &               & \{bNiceArray\}          \\
-\{bNiceMatrix\} &               & \{BNiceArray\}          \\
-\{BNiceMatrix\} &               & \{vNiceArray\}          \\
-\{vNiceMatrix\} &               & \{VNiceArray\}          \\
-\{VNiceMatrix\} &               & \{NiceArrayWithDelims\} \\
+\{NiceMatrix\}  & \{NiceArray\}  & \{NiceTabular\} \\
+\{pNiceMatrix\} & \{pNiceArray\} \\
+\{bNiceMatrix\} & \{bNiceArray\} \\
+\{BNiceMatrix\} & \{BNiceArray\} \\
+\{vNiceMatrix\} & \{vNiceArray\} \\
+\{VNiceMatrix\} & \{VNiceArray\} \\
+                & \{NiceArrayWithDelims\}
 \end{tabular}
 \end{ttfamily}
 
 
-
 \medskip
 Par défaut, les environnements |{NiceMatrix}|, |{pNiceMatrix}|, |{bNiceMatrix}|, |{BNiceMatrix}|, |{vNiceMatrix}|
 et |{VNiceMatrix}| se comportent quasiment comme les environnements correspondants de \pkg{amsmath} : |{matrix}|,
@@ -211,14 +207,14 @@
 
 
 \medskip
-L'environnement |{NiceArray}| est similaire à l'environnement |{array}| de l'extension |{array}|. Néanmoins, pour
-des raisons techniques, dans le préambule de l'environnement |{NiceArray}|, l'utilisateur doit utiliser les lettres
-|L|, |C| et~|R| au lieu de |l|, |c| et |r|. Il est possible d'utiliser les constructions |w{...}{...}|,
-|W{...}{...}|\footnote{Pour les colonnes de type |w| et |W|, les cases sont composées en mode mathématique (dans
-  les environnements de \pkg{nicematrix}) alors que dans |{array}| de \pkg{array}, elles sont composées en mode
-  texte.}, \verb+|+, |>{...}|, |<{...}|, |@{...}|, |!{...}| et |*{n}{...}| mais les lettres |p|, |m| et |b| ne
-doivent pas être employées. Voir p.~\pageref{NiceArray} la partie concernant |{NiceArray}|.
+Les environnements |{NiceArray}| et |{NiceTabular}| sont similaires aux environnements |{array}| et |{tabular}| de
+l'extension |{array}|. Néanmoins, pour des raisons techniques, dans le préambule de ces environnements,
+l'utilisateur doit utiliser les lettres |L|, |C| et~|R| au lieu de |l|, |c| et |r|. Il est possible d'utiliser les
+constructions |p{...}|, |m{...}|, |b{...}|, |w{...}{...}|, |W{...}{...}|, \verb+|+, |>{...}|, |<{...}|, |@{...}|,
+|!{...}| et |*{n}{...}|.
 
+Voir p.~\pageref{NiceArray} la partie concernant |{NiceArray}| et |{NiceTabular}|.
+
 \section{Les lignes en pointillés continues}
 
 À l'intérieur des environnements de l'extension \pkg{nicematrix}, de nouvelles commandes sont définies : |\Ldots|,
@@ -358,12 +354,12 @@
 \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 $A = \begin{pmatrix}
 h & i & j & k & l & m \\
-x &   &   &   &   & x \\
+x &   &   &   &   & x 
 \end{pmatrix}$
 \end{BVerbatim}
 $A = \begin{pmatrix}
 h & i & j & k & l & m \\
-x   &     &     &    &     & x \\
+x   &     &     &    &     & x 
 \end{pmatrix}$
 
 
@@ -375,12 +371,12 @@
 \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 $B = \begin{pmatrix}
 h & i & j & k & l & m \\
-x & \ldots & \ldots  & \ldots & \ldots & x \\
+x & \ldots & \ldots  & \ldots & \ldots & x 
 \end{pmatrix}$
 \end{BVerbatim}
 $B = \begin{pmatrix}
 h & i & j & k & l & m \\
-x   & \ldots   & \ldots  & \ldots & \ldots & x \\
+x   & \ldots   & \ldots  & \ldots & \ldots & x 
 \end{pmatrix}$
 
 \bigskip
@@ -391,12 +387,12 @@
 \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 $C = \begin{pNiceMatrix}
 h & i & j & k & l & m \\
-x & \Ldots & \Ldots & \Ldots & \Ldots & x \\
+x & \Ldots & \Ldots & \Ldots & \Ldots & x 
 \end{pNiceMatrix}$
 \end{BVerbatim}
 $C = \begin{pNiceMatrix}
 h & i & j & k & l & m \\
-x & \Ldots & \Ldots  & \Ldots & \Ldots & x \\
+x & \Ldots & \Ldots  & \Ldots & \Ldots & x 
 \end{pNiceMatrix}$
 
 \bigskip
@@ -408,12 +404,12 @@
 \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 $D = \begin{pNiceMatrix}[~emphase#nullify-dots@]
 h & i & j & k & l & m \\
-x & \Ldots & & & & x \\
+x & \Ldots & & & & x 
 \end{pNiceMatrix}$
 \end{BVerbatim}
 $D = \begin{pNiceMatrix}[nullify-dots]
 h & i & j & k & l & m \\
-x & \Ldots & &  &  & x \\
+x & \Ldots & &  &  & x 
 \end{pNiceMatrix}$
 
 \medskip
@@ -459,7 +455,7 @@
 1 & 2 & 3 & 4 & 5 \\
   & ~emphase#\Hdotsfor{3}@ \\
 1 & 2 & 3 & 4 & 5 \\
-1 & 2 & 3 & 4 & 5 \\
+1 & 2 & 3 & 4 & 5 
 \end{pNiceMatrix}$
 \end{BVerbatim}
 $\begin{pNiceMatrix}
@@ -469,7 +465,7 @@
 1 & 2 & 3 & 4 & 5 
 \end{pNiceMatrix}$
 
-
+\medskip
 Remarque : Contrairement à la commande |\hdotsfor| de \pkg{amsmath}, la commande |\Hdotsfor| est utilisable lorsque
 l'extension \pkg{colortbl} est chargée (mais vous risquez d'avoir des problèmes si vous utilisez |\rowcolor| sur la
 même rangée que |\Hdotsfor|).
@@ -535,13 +531,13 @@
 $\begin{bNiceMatrix}
 1 & \hspace*{1cm}            & 0 \\[8mm]
   & ~emphase#\Ddots^{n \text{ times}}@ &   \\
-0 &                          & 1 \\
+0 &                          & 1 
 \end{bNiceMatrix}$
 \end{BVerbatim}
 $\begin{bNiceMatrix}
 1 & \hspace*{1cm}            & 0 \\[8mm]
   & \Ddots^{n \text{ times}} &   \\
-0 &                          & 1 \\
+0 &                          & 1 
 \end{bNiceMatrix}$
 
 \subsection{Personnalisation des lignes en pointillés}
@@ -606,7 +602,7 @@
 \bigskip
 Voulant proposer des lignes avec des points ronds dans le style de celui de |\ldots| (au moins celui des fontes
 \emph{Computer Modern}), l'extension \pkg{nicematrix} contient en interne son propre système de ligne en pointillés
-(qui, au passage n'utilise que \pkg{pgf} et non \pkg{tikz}). Ce style est appelé le style |standard|. Cette valeur
+(qui, au passage, n'utilise que \pkg{pgf} et non \pkg{tikz}). Ce style est appelé le style |standard|. Cette valeur
 est la valeur initiale du paramètre |xdots/line-style|.
 
 \bigskip
@@ -883,45 +879,23 @@
 
 \medskip
 Pour améliorer la lisibilité du code, une syntaxe alternative est proposée : on peut spécifier les instructions du
-|code-after| à la fin de l'environnement, après le mot-clé |\CodeAfter|.
+|code-after| à la fin de l'environnement, après le mot-clé |\CodeAfter|. Pour un exemple, voir page
+\pageref{exemple-CodeAfter}.
 
-\medskip
-\begin{BVerbatim}[baseline=c,boxwidth=11cm]
-\NiceMatrixOptions{xdots/shorten = 0.6 em}
-\begin{pNiceMatrix}
-I       & 0      & \Cdots  &0     \\
-0       & I      & \Ddots  &\Vdots\\
-\Vdots  &\Ddots  & I       &0     \\
-0       &\Cdots  & 0       &I
-~emphase#\CodeAfter@
-~emphase#\line{2-2}{3-3}@
-\end{pNiceMatrix}
-\end{BVerbatim}
-\begin{scope}
-\NiceMatrixOptions{xdots/shorten = 0.6 em}
-$\begin{pNiceMatrix}
-I       & 0      & \Cdots  &0     \\
-0       & I      & \Ddots  &\Vdots\\
-\Vdots  &\Ddots  & I       &0     \\
-0       &\Cdots  & 0       &I
-\CodeAfter
-\line{2-2}{3-3}
-\end{pNiceMatrix}$
-\end{scope}
-
-
-\section{L'environnement \{NiceArray\} et ses variantes}
+\section{Les environnements \{NiceArray\} et \{NiceTabular\}}
 \label{NiceArray}
 
-L'environnement |{NiceArray}| est similaire à l'environnement |{array}|. Comme pour |{array}|, l'argument
-obligatoire est le préambule du tableau. Néanmoins, pour des raisons techniques, l'utilisateur doit utiliser les
-lettres |L|, |C| et |R|\footnote{Les types de colonnes |L|, |C| et |R| sont définis localement à l'intérieur de
-  |{NiceArray}| avec la commande |\newcolumntype| de \pkg{array}. Cette définition masque une éventuelle définition
-  précédente. En fait, les types de colonnes |w| et |W| sont également redéfinis.} au lieu de |l|, |c| et |r|.
+Les environnements |{NiceArray}| et |{NiceTabular}| sont similaires aux environnements |{array}| et |{tabular}|.
+L'argument obligatoire est le préambule du tableau. Néanmoins, pour des raisons techniques, l'utilisateur doit
+utiliser les lettres |L|, |C| et |R|\footnote{Les types de colonnes |L|, |C| et |R| sont définis localement à
+  l'intérieur de |{NiceArray}| avec la commande |\newcolumntype| de \pkg{array}. Cette définition masque une
+  éventuelle définition précédente.} au lieu de |l|, |c| et |r|. Dans une commande |\multicolumn|, on doit
+également utiliser les lettres |L|, |C| et |R|.
 
-Il est possible d'utiliser les constructions |w{...}{...}|, |W{...}{...}|, \verb+|+, |>{...}|, |<{...}|, |@{...}|,
-|!{...}| et |*{n}{...}| mais les lettres |p|, |m| et |b| ne doivent pas être employées.\footnote{Dans une commande
-  |\multicolumn|, on doit également utiliser les lettres |L|, |C| et |R|.}
+Il est possible d'utiliser les constructions |p{...}|, |m{...}|, |b{...}|, |w{...}{...}|, |W{...}{...}|, \verb+|+,
+|>{...}|, |<{...}|, |@{...}|, |!{...}| et |*{n}{...}|. Néanmoins, dans l'environnement |{NiceArray}| (et ses
+variantes), le contenu des colonnes de type |w| ou |W| est composé en mode mathématique (dans |{array}| de
+\pkg{array}, elles sont composées en mode texte).
 
 \bigskip
 Sans surprise, l'extension \pkg{nicematrix} fournit également les variantes |{pNiceArray}|, |{vNiceArray}|,
@@ -980,7 +954,7 @@
    {\downarrow}{\uparrow}{CCC}[margin]
 1 & 2 & 3 \\
 4 & 5 & 6 \\
-7 & 8 & 9 \\
+7 & 8 & 9 
 \end{~emphase#NiceArrayWithDelims@}$
 \end{BVerbatim}
 $\begin{NiceArrayWithDelims}
@@ -987,19 +961,19 @@
    {\downarrow}{\uparrow}{CCC}[margin]
 1 & 2 & 3 \\
 4 & 5 & 6 \\
-7 & 8 & 9 \\
+7 & 8 & 9 
 \end{NiceArrayWithDelims}$
 
 \bigskip
 \subsection{Le positionnement vertical des matrices}
 
-L'extension \pkg{nicematrix} propose aussi une option |baseline| par la position verticale des matrices. Cette
+L'extension \pkg{nicematrix} propose aussi une option |baseline| pour la position verticale des matrices. Cette
 option |baseline| prend comme valeur un entier qui indique le numéro de rangée dont la ligne de base servira de
-ligne de base pour l'environnement |{NiceArray}|.
+ligne de base pour le tableau.
 
 \medskip
 \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-$A = \begin{pNiceMatrix}[baseline=2]
+$A = \begin{pNiceMatrix}[~emphase#baseline=2@]
 \frac{1}{\sqrt{1+p^2}} & p & 1-p \\
 1 & 1 & 1 \\
 1 & p & 1+p
@@ -1134,7 +1108,7 @@
 composition de la «dernière rangée» et de la «dernière colonne».
 
 \begin{itemize}
-\item Dans le cas d'un environnement avec préambule, comme |{NiceArray}| ou |{pNiceArray}|, le nombre de colonnes
+\item Dans le cas d'un environnement avec préambule, comme |{NiceTabular}| ou |{pNiceArray}|, le nombre de colonnes
 se déduit évidemment du préambule.
 
 \item Dans le cas où l'option |light-syntax| (cf. p. \pageref{light-syntax}) est utilisée, \pkg{nicematrix} profite
@@ -1146,7 +1120,7 @@
 et l'écrit dans le fichier |.aux| pour pouvoir l'utiliser à la compilation suivante.
 
 \textsl{Néanmoins, il est possible de donner le numéro de la dernière rangée et le numéro de la dernière colonne en
-arguments des options |last-row| et |last-col| pour ce qui permettra d'accélérer le processus complet de
+arguments des options |last-row| et |last-col|, ce qui permettra d'accélérer le processus complet de
 compilation.} C'est ce que nous ferons dans la suite.
 \end{itemize}
 
@@ -1294,38 +1268,9 @@
 
 \bigskip
 Il est possible de changer dans \pkg{nicematrix} la lettre utilisée pour indiquer dans le préambule un trait
-vertical en pointillés avec l'option |letter-for-dotted-lines| disponible dans |\NiceMatrixOptions|. Par exemple,
-dans ce document, nous avons chargé l'extension \pkg{arydshln} qui utilise la lettre «|:|» pour indiquer un trait
-vertical en tiretés. Par conséquent, en utilisant l'option |letter-for-dotted-lines|, on peut utiliser les traits
-verticaux fournis à la fois par \pkg{arydshln} et par \pkg{nicematrix}.
+vertical en pointillés avec l'option |letter-for-dotted-lines| disponible dans |\NiceMatrixOptions|.
 
 
-\medskip
-\begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
-\NiceMatrixOptions{letter-for-dotted-lines = I}
-\arrayrulecolor{blue}
-\begin{pNiceArray}{~emphase#C|C:CIC@}
-1 & 2 & 3 & 4 \\
-5 & 6 & 7 & 8 \\
-9 & 10 & 11 & 12
-\end{pNiceArray}
-\arrayrulecolor{black}
-\end{BVerbatim}
-\begin{scope}
-\arrayrulecolor{blue}
-\NiceMatrixOptions{letter-for-dotted-lines = I}
-$\begin{pNiceArray}{C|C:CIC}
-1 & 2 & 3 & 4 \\
-5 & 6 & 7 & 8 \\
-9 & 10 & 11 & 12
-\end{pNiceArray}$
-\arrayrulecolor{black}
-\end{scope}
-
-\smallskip
-On a utilisé |\arrayrulecolor| de \pkg{colortbl} pour colorier les trois traits.
-
-
 \bigskip
 \emph{Remarque} : Quand l'extension \pkg{array} (sur laquelle s'appuie \pkg{nicematrix}) est chargée, les traits
 verticaux et horizontaux que l'on insère rendent le tableau plus large ou plus long d'une quantité égale à la
@@ -1540,6 +1485,175 @@
 (mais on peut écrire |\Block{|$i$|-|$j$|}<>{<}| avec le résultat attendu).
 
 
+\section{Les couleurs des rangées et des colonnes}
+
+L'extension \pkg{colortbl} permet de colorier des cellules, des rangées ou des colonnes d'un tableau. Néanmoins,
+l'affichage du \textsc{pdf} résultant n'est pas toujours parfait, en particulier quand on utilise également des
+filets. Dans certains lecteurs de \textsc{pdf}, des filets verticaux semblent disparaître. De fines lignes
+blanches peuvent également apparaître.
+
+\medskip
+La version 4.0 de \pkg{nicematrix} propose des outils similaires qui ne présentent pas ces inconvénients. Elle
+propose une option |code-before| pour du code qui sera exécuté \emph{avant} le tracé du tableau. Dans ce
+|code-before|, de nouvelles commandes sont disponibles : |\cellcolor|, |\rectanglecolor|, |\rowcolor|,
+|\columncolor|, |\rowcolors| et |\chessboardcolors|.
+
+\medskip
+\begin{itemize}
+\item La commande |\cellcolor| tient son nom de la commande |\cellcolor| de \pkg{colortbl}.
+
+Elle prend en arguments une couleur et une liste de cellules sous le format $i$-$j$ où $i$ est le numéro de ligne
+et $j$ le numéro de colonne.
+
+\medskip
+\begin{scope}
+\hfuzz=10cm
+\begin{BVerbatim}[boxwidth=10cm,baseline=c]
+\begin{NiceTabular}{|C|C|C|}[code-before = ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@]
+\hline
+a & b & c \\ \hline
+e & f & g \\ \hline
+h & i & j \\ \hline
+\end{NiceTabular}
+\end{BVerbatim}
+\begin{NiceTabular}{|C|C|C|}[code-before = \cellcolor{red!15}{3-1,2-2,1-3}]
+\hline
+a & b & c \\ \hline
+e & f & g \\ \hline
+h & i & j \\ \hline
+\end{NiceTabular}
+\end{scope}
+
+\bigskip
+\item La commande |\rectanglecolor| prend trois arguments. Le premier est la couleur, les deux suivants fournissent
+la case en haut à gauche et la case en bas à droite du rectangle.
+
+\medskip
+\begin{scope}
+\hfuzz=10cm
+\begin{BVerbatim}[boxwidth=10cm,baseline=c]
+\begin{NiceTabular}{|C|C|C|}[code-before = ~emphase#\rectanglecolor{red!15}{2-2}{3-3}@]
+\hline
+a & b & c \\ \hline
+e & f & g \\ \hline
+h & i & j \\ \hline
+\end{NiceTabular}
+\end{BVerbatim}
+\begin{NiceTabular}{|C|C|C|}[code-before = \rectanglecolor{red!15}{2-2}{3-3}]
+\hline
+a & b & c \\ \hline
+e & f & g \\ \hline
+h & i & j \\ \hline
+\end{NiceTabular}
+\end{scope}
+
+
+
+\bigskip
+\item La commande |\rowcolor| doit son nom à la commande |\rowcolor| de \pkg{colortbl}. Son premier argument est la
+couleur et le deuxième est une liste de numéros de rangées ou bien d'intervalles de rangées sous la forme
+$a$-$b$ (un intervalle de la forme $a$- représente toutes les rangées à partir de la rangée~$a$).
+
+\medskip
+
+\begin{scope}
+\hfuzz=10cm
+\begin{BVerbatim}[boxwidth=9cm,baseline=c]
+$\begin{NiceArray}{LLL}[hvlines, ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@]
+a_1 & b_1 & c_1 \\
+a_2 & b_2 & c_2 \\
+a_3 & b_3 & c_3 \\
+a_4 & b_4 & c_4 \\
+a_5 & b_5 & c_5 \\
+a_6 & b_6 & c_6 \\
+a_7 & b_7 & c_7 \\
+a_8 & b_8 & c_8 \\
+a_9 & b_9 & c_9 \\
+a_{10} & b_{10} & c_{10} \\
+\end{NiceArray}$
+\end{BVerbatim}
+%
+$\begin{NiceArray}{LLL}%
+[baseline=4,hvlines, code-before = \rowcolor{red!15}{1,3-5,8-}]
+a_1 & b_1 & c_1 \\
+a_2 & b_2 & c_2 \\
+a_3 & b_3 & c_3 \\
+a_4 & b_4 & c_4 \\
+a_5 & b_5 & c_5 \\
+a_6 & b_6 & c_6 \\
+a_7 & b_7 & c_7 \\
+a_8 & b_8 & c_8 \\
+a_9 & b_9 & c_9 \\
+a_{10} & b_{10} & c_{10} \\
+\end{NiceArray}$
+\end{scope}
+
+
+\bigskip
+\item La commande |\columncolor| doit son nom à la commande |\columncolor| de \pkg{colortbl}. Sa syntaxe est
+similaire à celle de |\rowcolor|.
+
+\bigskip
+\item La commande |\rowcolors| (avec un \emph{s}) doit son nom à la commande |\rowcolors| de \pkg{xcolor}. Le
+\emph{s} rappelle qu'il y a deux couleurs. Elle colorie alternativement les rangées avec les deux couleurs à partir
+de la rangée dont le numéro est donné en premier argument.
+
+\medskip
+
+
+\begin{scope}
+\hfuzz=10cm
+\begin{BVerbatim}[baseline=c,boxwidth=9cm]
+\begin{NiceTabular}{LR}%
+[~emphase#code-before = \rowcolor{red!15}{1} \rowcolors{3}{blue!10}{}@]
+\toprule
+Ville & habitants \\
+\midrule
+Pau & 80000 \\
+Paris & 2000000 \\
+Toulouse & 700000 \\
+Reims & 40000 \\
+\bottomrule
+\end{NiceTabular}
+\end{BVerbatim}
+\begin{NiceTabular}{LR}[code-before =\rowcolor{red!15}{1} \rowcolors{3}{blue!10}{}]
+\toprule
+Ville & habitants \\
+\midrule
+Pau & 80000 \\
+Paris & 2000000 \\
+Toulouse & 700000 \\
+Reims & 40000 \\
+\bottomrule
+\end{NiceTabular}
+\end{scope}
+
+\bigskip
+\item La commande |\chessboardcolors| prend en arguments deux couleurs et colorie les cellules en quinconces avec
+les deux couleurs.
+
+\medskip
+\begin{scope}
+\hfuzz=10cm
+\begin{BVerbatim}[baseline=c,boxwidth=9cm]
+$\begin{pNiceMatrix}[R,margin, ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@]
+1 & -1 & 1 \\
+-1 & 1 & -1 \\
+1 & -1 & 1 
+\end{pNiceMatrix}$
+\end{BVerbatim}
+$\begin{pNiceMatrix}%
+[baseline=1, R, margin, code-before = \chessboardcolors{red!15}{blue!15}]
+1 & -1 & 1 \\
+-1 & 1 & -1 \\
+1 & -1 & 1 
+\end{pNiceMatrix}$
+\end{scope}
+
+\end{itemize}
+
+
+
 \section{Fonctionnalités avancées}
 
 \subsection{Option d'alignement dans NiceMatrix}
@@ -1581,7 +1695,7 @@
 e_1 & e_2 & e_3       \\
 1   & 2   & 3   & e_1 \\
 4   & 5   & 6   & e_2 \\
-7   & 8   & 9   & e_3 \\
+7   & 8   & 9   & e_3 
 \end{pNiceMatrix}$
 \end{BVerbatim}
 \begin{varwidth}{10cm}
@@ -1597,7 +1711,7 @@
 \end{varwidth}
 
 \bigskip
-Si la commande |\rotate| est utilisée dans la ``dernière rangée'' (extérieure à la matrice), les éléments qui
+Si la commande |\rotate| est utilisée dans la «dernière rangée» (extérieure à la matrice), les éléments qui
 subissent cette rotation sont alignés vers le haut.
 
 \bigskip
@@ -1609,7 +1723,7 @@
 1   & 2   & 3   & e_1 \\
 4   & 5   & 6   & e_2 \\
 7   & 8   & 9   & e_3 \\
-\text{image de } e_1 & e_2 & e_3 \\
+\text{image de } e_1 & e_2 & e_3 
 \end{pNiceMatrix}$
 \end{BVerbatim}
 \begin{varwidth}{10cm}
@@ -1620,7 +1734,7 @@
 1   & 2   & 3  & e_1 \\
 4   & 5   & 6  & e_2 \\
 7   & 8   & 9  & e_3 \\
-\text{image de } e_1 & e_2 & e_3 \\
+\text{image de } e_1 & e_2 & e_3 
 \end{pNiceMatrix}$
 \end{varwidth}
 
@@ -1641,7 +1755,7 @@
                             columns-width = 3mm ] 
 1 & -2 & 3 & 4 & 5 \\
 0 & 3  & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\
-0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\
+0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 
 \end{bNiceArray}$
 \end{Verbatim}
 %
@@ -1648,7 +1762,7 @@
 \[\begin{bNiceArray}{CCCC|C}[small, last-col, code-for-last-col = \scriptscriptstyle, columns-width=3mm]
 1 & -2 & 3 & 4 & 5 \\
 0 & 3  & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\
-0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\
+0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 
 \end{bNiceArray}\]
 
 
@@ -1710,8 +1824,8 @@
 
 \bigskip
 L'extension \pkg{nicematrix} propose aussi des commandes pour composer automatiquement des matrices à partir d'un
-motif général. Ces commandes sont nommées |\pAutoNiceMatrix|, |\bAutoNiceMatrix|, |\vAutoNiceMatrix|,
-|\VAutoNiceMatrix| et |\BAutoNiceMatrix|.
+motif général. Ces commandes sont nommées |\AutoNiceMatrix|, |\pAutoNiceMatrix|, |\bAutoNiceMatrix|,
+|\vAutoNiceMatrix|, |\VAutoNiceMatrix| et |\BAutoNiceMatrix|.
 
 Chacune de ces commandes prend deux arguments obligatoires : le premier est la taille de la matrice, sous la forme 
 $n$-$p$, où $n$ est le nombre de rangées et $p$ est le nombre de colonnes et le deuxième est le motif (c'est-à-dire
@@ -1740,11 +1854,12 @@
 \medskip
 Dans l'exemple suivant, on utilise la commande |\arrayrulecolor| de \pkg{colortbl}.
 
+
+
 \medskip
 \begin{BVerbatim}[baseline=c,boxwidth=11cm]
 \arrayrulecolor{blue}
-$\begin{NiceArray}{CCCC}%
- [~emphase#hvlines@,first-row,first-col]
+$\begin{NiceArray}{CCCC}[~emphase#hvlines@,first-row,first-col]
   & e & a & b & c \\
 e & e & a & b & c \\
 a & a & e & c & b \\
@@ -1765,8 +1880,9 @@
 \arrayrulecolor{black}
 
 
+
 \bigskip
-Il y a néanmoins une différence entre l'utilisation de l'option |vlines| et du spécificateur ``\verb+|+'' dans le
+Il y a néanmoins une différence entre l'utilisation de l'option |vlines| et du spécificateur «\verb+|+» dans le
 préambule de l'environnement : les filets tracés par |vlines| traversent les double-filets horizontaux tracés par
 |\hline\hline|. 
 
@@ -2031,7 +2147,7 @@
 \begin{Verbatim}
 \begin{pmatrix}
 a & b \\
-c \\
+c 
 \end{pmatrix}
 \end{Verbatim}
 
@@ -2068,12 +2184,7 @@
 |{NiceArray}| (les autres environnements de l'extension \pkg{nicematrix} ne sont pas affectés).
 
 
-\subsection{L'option de classe draft}
 
-Quand l'option de classe |draft| est utilisée, les lignes en pointillés ne sont pas tracées, pour accélérer la
-compilation.
-
-
 \subsection{Un problème technique avec l'argument de \textbackslash\textbackslash}
 
 
@@ -2144,8 +2255,8 @@
 La version 3.0 de \pkg{nicematrix} a introduit l'environnement |{pNiceArray}| (et ses variantes) avec les options
 |first-row|, |last-row|, |first-col| et |last-col|.
 
-Par conséquent, les environnements suivants, présents dans les versions précédentes de \pkg{nicematrix} sont devenus
-obsolètes :
+Par conséquent, les environnements suivants, présents dans les versions précédentes de \pkg{nicematrix} ont été
+supprimés. 
 %
 \begin{itemize}
 \item |{NiceArrayCwithDelims}| ;
@@ -2156,10 +2267,8 @@
 |{VNiceArrayRC}|.
 \end{itemize}
 
-\medskip
-Depuis la version 3.12 de \pkg{nicematrix}, on ne peut utiliser ces environnements que si on a chargé l'extension
-\pkg{nicematrix} avec l'option |obsolete-environments|. Il faut toutefois avoir conscience que ces environnements
-seront certainement supprimés dans une prochaine version de \pkg{nicematrix}.
+Le code correspondant est toutefois encore présent à la fin du fichier |nicematrix.sty|, après une
+commande |\file_input_stop:|. 
 
 
 
@@ -2337,7 +2446,7 @@
 \Vdots[line-style={solid,<->}]_{n \text{ rows}} 
        & 1 & 1 & 1 &  & 1 \\
        & 1 & 1 & 1 &  & 1 \\
-       & 1 & 1 & 1 & \Ldots & 1 \\
+       & 1 & 1 & 1 & \Ldots & 1 
 \end{pNiceMatrix}$
 \end{Verbatim}
 
@@ -2351,7 +2460,7 @@
        & 1 & 1 & 1 &  & 1 \\
 \Vdots[line-style={solid,<->}]_{n \text{ rows}} & 1 & 1 & 1 &  & 1 \\
        & 1 & 1 & 1 &  & 1 \\
-       & 1 & 1 & 1 & \Ldots & 1 \\
+       & 1 & 1 & 1 & \Ldots & 1 
 \end{pNiceMatrix}\]
 \end{scope}
 
@@ -2366,9 +2475,10 @@
 \bigskip
 \begin{BVerbatim}
 ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
-\NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+\NiceMatrixOptions
+ { last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
 \setlength{\extrarowheight}{1mm}
-$\begin{pNiceArray}{CCCC:C}[last-col]
+$\begin{pNiceArray}{CCCC:C}
   1  1  1   1   1 ;
   2  4  8  16   9 ;
   3  9 27  81  36 ;
@@ -2375,7 +2485,7 @@
   4 16 64 256 100 
 \end{pNiceArray}$
 \medskip
-$\begin{pNiceArray}{CCCC:C}[last-col]
+$\begin{pNiceArray}{CCCC:C}
   1  1  1   1  1 ;
   0  2  6  14  7        { L_2 \gets -2 L_1 + L_2 } ;
   0  6 24  78 33        { L_3 \gets -3 L_1 + L_3 } ;
@@ -2389,10 +2499,10 @@
 
 \begin{multicols}{2}
 \begin{NiceMatrixBlock}[auto-columns-width]
-\NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+\NiceMatrixOptions{last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
 \setlength{\extrarowheight}{1mm}
 
-\enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+\enskip $\begin{pNiceArray}{CCCC:C}
 1  1  1   1   1 ;
 2  4  8  16   9 ;
 3  9 27  81  36 ;
@@ -2401,7 +2511,7 @@
 
 \medskip
 
-\enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+\enskip $\begin{pNiceArray}{CCCC:C}
 1  1  1   1  1 ;
 0  2  6  14  7 { L_2 \gets -2 L_1 + L_2 } ;
 0  6 24  78 33 { L_3 \gets -3 L_1 + L_3 } ;
@@ -2410,7 +2520,7 @@
 
 \medskip
 
-\enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+\enskip $\begin{pNiceArray}{CCCC:C}
 1 1  1  1 1 ;
 0 1  3  7 \frac72    { L_2 \gets \frac12 L_2 } ;
 0 3 12 39 \frac{33}2 { L_3 \gets \frac12 L_3 } ;
@@ -2419,7 +2529,7 @@
 
 \medskip
 
-\enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+\enskip $\begin{pNiceArray}{CCCC:C}
 1 1  1   1 1       ;
 0 1  3   7 \frac72 ;
 0 0  3  18 6        { L_3 \gets -3 L_2 + L_3 } ;
@@ -2428,7 +2538,7 @@
 
 \medskip
 
-\enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+\enskip $\begin{pNiceArray}{CCCC:C}
 1 1  1   1 1       ;
 0 1  3   7 \frac72 ;
 0 0  1   6 2        { L_3 \gets \frac13 L_3 } ;
@@ -2437,7 +2547,7 @@
 
 \medskip
 
-\enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+\enskip $\begin{pNiceArray}{CCCC:C}
 1 1 1  1 1       ;
 0 1 3  7 \frac72 ;
 0 0 1  6 2       ;
@@ -2471,6 +2581,8 @@
 voulons recréer des nœuds identiques aux premiers, nous devons fixer |inner sep = 0pt| (si on ne fait
 pas cela, les nouveaux nœuds seront plus grands que les nœuds d'origine créés par \pkg{nicematrix}).
 
+\label{exemple-CodeAfter}
+
 \begin{Verbatim}
 $\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin = 2pt]
   a_{11} & a_{12} & a_{13} & a_{14} \\
@@ -2578,27 +2690,8 @@
 la case en haut à gauche (où a été utilisée la commande |\Block|). Si on a demandé la création des nœuds |medium|,
 alors un nœud de ce type est aussi créé pour ce bloc avec un nom suffixé par |-medium|.
 
-\medskip
-% $\begin{pNiceMatrix}[margin,create-medium-nodes]
-%   \Block{3-3}<\Large>{A} & & & 0 \\
-%   & \hspace*{1cm} & & \Vdots \\
-%   & & & 0 \\
-%   0 & \Cdots& 0 & 0
-% \CodeAfter
-%   \tikz \node [~emphase#highlight = (1-1-block-medium)@] {} ;
-% \end{pNiceMatrix}$
-% \end{BVerbatim}
-% $\begin{pNiceMatrix}[margin,create-medium-nodes]
-% \Block{3-3}<\Large>{A} & & & 0 \\
-% & \hspace*{1cm} & & \Vdots \\
-% & & & 0 \\
-% 0 & \Cdots& 0 & 0
-% \CodeAfter
-% \tikz \node [highlight = (1-1-block-medium)] {} ;
-% \end{pNiceMatrix}$
 
 
-
 \vspace{1cm}
 On considère maintenant la matrice suivante que l'on a appelée |exemple|.
 
@@ -2775,7 +2868,7 @@
     & \Vdots &        &        &        & \Vdots \\
 ~emphase#L_i@ & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
     & \Vdots &        &        &        & \Vdots \\
-    & a_{n1} & \Cdots &        &        & a_{nn} \\
+    & a_{n1} & \Cdots &        &        & a_{nn} 
 \end{bNiceArray}
 & 
 \end{Verbatim}

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2020-05-09 22:06:57 UTC (rev 55078)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2020-05-09 22:07:16 UTC (rev 55079)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{3.15}
-\def\myfiledate{2020/04/06}
+\def\myfileversion{4.0}
+\def\myfiledate{2020/05/08}
 %
 %
 %<*batchfile>
@@ -51,7 +51,6 @@
 \usepackage[xetex]{geometry}
 \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
 
-\usepackage{colortbl}
 \usepackage{tikz}
 \usetikzlibrary{fit}
 \usepackage{nicematrix}
@@ -66,7 +65,6 @@
 \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}
 \usepackage{multicol}
-\usepackage{arydshln}
 \setlength{\columnseprule}{0.4pt}
 \usepackage{footnotehyper}
 \usepackage{varwidth}
@@ -73,6 +71,35 @@
 \parindent 0pt
 
 \EnableCrossrefs
+\makeatletter
+\ExplSyntaxOn
+\DoNotIndex{\begin,\end}
+\DoNotIndex{\c at iRow,\c at jCol,\theiRow,\thejCol}
+\DoNotIndex{\pgfpicture,\endpgfpicture,\tikzpicture,\endtikzpicture}
+\DoNotIndex{\pgfpoint,\pgfnode,\pgfnodealias,\pgfcoordinate}
+\DoNotIndex{\pgf at x,\pgf at y}
+\DoNotIndex{\int_add:Nn,\int_case:nnTF,\int_compare:nNnTF,\int_compare:nTF,
+  \int_compare_p:nNn,\int_decr:N,\int_eval:n,\int_add:Nn,\int_gdecr:N,\int_gincr:N
+  \int_gset:Nn,\int_gset_eq:NN,\int_gzero:N,\int_gzero_new:N,\int_if_odd:nTF,
+  \int_max:nn,\int_new:N,\int_set:Nn,\int_set_eq:NN,\int_step_inline:nnn,
+  \int_step_variable:nNn,\int_step_variable:nnNn,\int_sub:Nn,\int_use:N,\int_zero:N,
+  \int_zero_new:N,\g_tmpa_int,\l_tmpa_int,\l_tmpb_int
+}
+\DoNotIndex{\dim_abs:n,\dim_add:Nn,\dim_compare:nNnTF,\dim_compare_p:nNn,
+\dim_const:Nn,\dim_eval:n,\dim_gadd:Nn,\dim_gset:Nn,\dim_gset_eq:NN,
+\dim_gset:Nn,\dim_gset_eq:NN,\dim_gsub:Nn,\dim_gzero_new:N,\dim_max:nn,
+\dim_min:nn,\dim_new:N,\dim_ration:nn,\dim_set:Nn,\dim_set_eq:NN,\dim_sub:Nn,
+\dim_use:N,\dim_zero:N,\dim_zero_new:N,\g_tmpa_dim,\l_tmpa_dim,\l_tmpb_dim,
+\c_zero_dim}
+\DoNotIndex{\cs_new_protected:Npn,\cs_new:Npn,\cs_set_eq:NN,
+\cs_set_protected:Npn}
+\DoNotIndex{\bool_if:NTF,\bool_new:N,\bool_set_false:N,\bool_set_true:N,\l_tmpa_bool}
+\DoNotIndex{\group_begin:,\group_end:,\c_math_toggle_token}
+\DoNotIndex{\tl_set:Nn,\l_tmpa_tl}
+\ExplSyntaxOff
+\makeatother
+
+
 \begin{document}
 \DocInput{nicematrix.dtx}
 \end{document}
@@ -96,9 +123,10 @@
 %
 % \begin{abstract}
 % The LaTeX package \pkg{nicematrix} provides new environments similar to the
-% classical environments |{array}| and |{matrix}| but with some additional
-% features. Among these features are the possibilities to fix the width of the
-% columns and to draw continuous ellipsis dots between the cells of the array.
+% classical environments |{tabular}|, |{array}| and |{matrix}| but with some
+% additional features. Among these features are the possibilities to fix the
+% width of the columns and to draw continuous ellipsis dots between the cells of
+% the array.
 % \end{abstract}
 %
 % \vspace{1cm}
@@ -120,8 +148,7 @@
 % This package provides some new tools to draw mathematical matrices. The main
 % features are the following:
 % \begin{itemize}\setlength{\itemsep}{0pt}
-% \item continuous dotted lines\footnote{If the class option |draft| is
-% used, these dotted lines will not be drawn for a faster compilation.};
+% \item continuous dotted lines;
 % \item exterior rows and columns for labels;
 % \item a control of the width of the columns.
 % \end{itemize}
@@ -197,12 +224,13 @@
 % \begin{ttfamily}
 % \setlength{\tabcolsep}{3mm}
 % \begin{tabular}{llll}
-% \{NiceMatrix\}  & \{NiceArray\} & \{pNiceArray\}          \\
-% \{pNiceMatrix\} &               & \{bNiceArray\}          \\
-% \{bNiceMatrix\} &               & \{BNiceArray\}          \\
-% \{BNiceMatrix\} &               & \{vNiceArray\}          \\
-% \{vNiceMatrix\} &               & \{VNiceArray\}          \\
-% \{VNiceMatrix\} &               & \{NiceArrayWithDelims\} \\
+% \{NiceMatrix\}  & \{NiceArray\}  & \{NiceTabular\} \\
+% \{pNiceMatrix\} & \{pNiceArray\} \\
+% \{bNiceMatrix\} & \{bNiceArray\} \\
+% \{BNiceMatrix\} & \{BNiceArray\} \\
+% \{vNiceMatrix\} & \{vNiceArray\} \\
+% \{VNiceMatrix\} & \{VNiceArray\} \\
+%                 & \{NiceArrayWithDelims\}
 % \end{tabular}
 % \end{ttfamily}
 %
@@ -215,16 +243,15 @@
 % 
 %
 % \medskip
-% The environment |{NiceArray}| is similar to the environment |{array}| of the
-% package |{array}|. However, for technical reasons, in the preamble of the
-% environment |{NiceArray}|, the user must use the letters |L|, |C| and~|R|
+% The environments |{NiceArray}| and |{NiceTabular}| are similar to the
+% environments |{array}| and |{tabular}| of the
+% package |{array}|. However, for technical reasons, in the preamble of these
+% environments, the user must use the letters |L|, |C| and~|R|
 % instead of |l|, |c| and |r|. It's possible to use the constructions
-% |w{...}{...}|, |W{...}{...}|\footnote{However, for the columns of type |w| and
-% |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. See p.~\pageref{NiceArray}
-% the section relating to |{NiceArray}|.
+% |w{...}{...}|, |W{...}{...}|, "|", |>{...}|, |<{...}|, |@{...}|, |!{...}| and
+% |*{n}{...}| but the letters |p|, |m| and |b| should not be used. 
+%
+% See p.~\pageref{NiceArray} the section relating to |{NiceArray}| and |{NiceTabular}|.
 % 
 % 
 % \section{The continuous dotted lines}
@@ -372,12 +399,12 @@
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 % $A = \begin{pmatrix}
 % h & i & j & k & l & m \\
-% x &   &   &   &   & x \\
+% x &   &   &   &   & x 
 % \end{pmatrix}$
 % \end{BVerbatim}
 % $A = \begin{pmatrix}
 % h & i & j & k & l & m \\
-% x   &     &     &    &     & x \\
+% x   &     &     &    &     & x 
 % \end{pmatrix}$
 %
 %
@@ -389,12 +416,12 @@
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 % $B = \begin{pmatrix}
 % h & i & j & k & l & m \\
-% x & \ldots & \ldots  & \ldots & \ldots & x \\
+% x & \ldots & \ldots  & \ldots & \ldots & x 
 % \end{pmatrix}$
 % \end{BVerbatim}
 % $B = \begin{pmatrix}
 % h & i & j & k & l & m \\
-% x   & \ldots   & \ldots  & \ldots & \ldots & x \\
+% x   & \ldots   & \ldots  & \ldots & \ldots & x 
 % \end{pmatrix}$
 %
 % \bigskip
@@ -406,12 +433,12 @@
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 % $C = \begin{pNiceMatrix}
 % h & i & j & k & l & m \\
-% x & \Ldots & \Ldots & \Ldots & \Ldots & x \\
+% x & \Ldots & \Ldots & \Ldots & \Ldots & x 
 % \end{pNiceMatrix}$
 % \end{BVerbatim}
 % $C = \begin{pNiceMatrix}
 % h & i & j & k & l & m \\
-% x & \Ldots & \Ldots  & \Ldots & \Ldots & x \\
+% x & \Ldots & \Ldots  & \Ldots & \Ldots & x 
 % \end{pNiceMatrix}$
 %
 % \bigskip
@@ -424,12 +451,12 @@
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
 % $D = \begin{pNiceMatrix}[~emphase#nullify-dots@]
 % h & i & j & k & l & m \\
-% x & \Ldots & & & & x \\
+% x & \Ldots & & & & x 
 % \end{pNiceMatrix}$
 % \end{BVerbatim}
 % $D = \begin{pNiceMatrix}[nullify-dots]
 % h & i & j & k & l & m \\
-% x & \Ldots & &  &  & x \\
+% x & \Ldots & &  &  & x 
 % \end{pNiceMatrix}$
 %
 % \medskip
@@ -558,13 +585,13 @@
 % $\begin{bNiceMatrix}
 % 1 & \hspace*{1cm}            & 0 \\[8mm]
 %   & ~emphase#\Ddots^{n \text{ times}}@ &   \\
-% 0 &                          & 1 \\
+% 0 &                          & 1 
 % \end{bNiceMatrix}$
 % \end{BVerbatim}
 % $\begin{bNiceMatrix}
 % 1 & \hspace*{1cm}            & 0 \\[8mm]
 %   & \Ddots^{n \text{ times}} &   \\
-% 0 &                          & 1 \\
+% 0 &                          & 1 
 % \end{bNiceMatrix}$
 %
 % \subsection{Customization of the dotted lines}
@@ -918,47 +945,28 @@
 % \medskip
 % For the readability of the code, an alternative syntax is provided: it's
 % possible to give the instructions of the |\code-after| at the end of the
-% environment, after the keyword |\CodeAfter|.
+% environment, after the keyword |\CodeAfter|. For an example, cf.
+% p.~\pageref{example-CodeAfter}. 
 %
-% \medskip
-% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
-% \NiceMatrixOptions{xdots/shorten = 0.6 em}
-% \begin{pNiceMatrix}
-% I       & 0      & \Cdots  &0     \\
-% 0       & I      & \Ddots  &\Vdots\\
-% \Vdots  &\Ddots  & I       &0     \\
-% 0       &\Cdots  & 0       &I
-% ~emphase#\CodeAfter@
-% ~emphase#\line{2-2}{3-3}@
-% \end{pNiceMatrix}
-% \end{BVerbatim}
-% \begin{scope}
-% \NiceMatrixOptions{xdots/shorten = 0.6 em}
-% $\begin{pNiceMatrix}
-% I       & 0      & \Cdots  &0     \\
-% 0       & I      & \Ddots  &\Vdots\\
-% \Vdots  &\Ddots  & I       &0     \\
-% 0       &\Cdots  & 0       &I
-% \CodeAfter
-% \line{2-2}{3-3}
-% \end{pNiceMatrix}$
-% \end{scope}
 % 
-% \section{The environment \{NiceArray\} and its variants}
+% \section{The environments \{NiceArray\} and \{NiceTabular\}}
 % \label{NiceArray}
 %
-% The environment |{NiceArray}| is similar to the environment |{array}|. As for
-% |{array}|, the mandatory argument is the preamble of the array. However, for
-% technical reasons, in this preamble, the user must use the letters |L|, |C|
-% and~|R|\footnote{The column types |L|, |C| and |R| are defined locally inside
-% |{NiceArray}| with |\newcolumntype| of \pkg{array}. This definition overrides
-% an eventual previous definition. In fact, the column types |w| and |W| are
-% also redefined.} instead of |l|, |c| and |r|. It's possible
-% to use the constructions |w{...}{...}|, |W{...}{...}|, "|", |>{...}|,
-% |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but the letters |p|, |m| and |b|
-% should not be used.\footnote{In a command |\multicolumn|, one should also use
-% the letters |L|, |C|, |R|.} 
+% The environments |{NiceArray}| and |{NiceTabular}| are similar to the
+% environments |{array}| and |{tabular}|. The mandatory argument is the preamble
+% of the array. However, for technical reasons, in this preamble, the user must
+% use the letters |L|, |C| and~|R|\footnote{The column types |L|, |C| and |R|
+% are defined locally inside |{NiceArray}| with |\newcolumntype| of \pkg{array}.
+% This definition overrides an eventual previous definition.} instead of |l|,
+% |c| and |r|. In a command |\multicolumn|, one should also use the letters |L|,
+% |C|, |R|.
 %
+% It's possible to use the constructions |p{...}|, |m{...}|, |b{...}|,
+% |w{...}{...}|, |W{...}{...}|, "|", |>{...}|, |<{...}|, |@{...}|, |!{...}| and
+% |*{n}{...}|. However, in the environment |{NiceArray}| (and its variants), the
+% content of the columns of type |w| or |W| is composed in math mode (in
+% |{array}| of \pkg{array}, they are composed in text mode).
+%
 % \bigskip
 % The package \pkg{nicematrix} provides also the variants |{pNiceArray}|, 
 %|{vNiceArray}|, |{VNiceArray}|, |{bNiceArray}| and |{BNiceArray}|.
@@ -1016,7 +1024,7 @@
 %    {\downarrow}{\uparrow}{CCC}[margin]
 % 1 & 2 & 3 \\
 % 4 & 5 & 6 \\
-% 7 & 8 & 9 \\
+% 7 & 8 & 9 
 % \end{~emphase#NiceArrayWithDelims@}$
 % \end{BVerbatim}
 % $\begin{NiceArrayWithDelims}
@@ -1023,7 +1031,7 @@
 %    {\downarrow}{\uparrow}{CCC}[margin]
 % 1 & 2 & 3 \\
 % 4 & 5 & 6 \\
-% 7 & 8 & 9 \\
+% 7 & 8 & 9 
 % \end{NiceArrayWithDelims}$
 %
 %
@@ -1036,7 +1044,7 @@
 %
 % \medskip
 % \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% $A = \begin{pNiceMatrix}[baseline=2]
+% $A = \begin{pNiceMatrix}[~emphase#baseline=2@]
 % \frac{1}{\sqrt{1+p^2}} & p & 1-p \\
 % 1 & 1 & 1 \\
 % 1 & p & 1+p
@@ -1170,7 +1178,7 @@
 % columns which are needed for the composition of the ``last row'' and ``last
 % column''.
 % \begin{itemize}
-% \item For the environments with explicit preamble, like |{NiceArray}| and
+% \item For the environments with explicit preamble, like |{NiceTabular}| and
 % |{pNiceArray}|, the number of columns can obviously be computed from the
 % preamble.
 %
@@ -1184,10 +1192,10 @@
 % columns during the first compilation and write the result in the |aux| file
 % for the next run.
 % 
-% \textsl{However, it's possible to provide the number of the last row and the number of
-% the last column as values of the options |last-row| and |last-col|, tending to
-% an acceleration of the whole compilation of the document.} That's what we will
-% do throughout the rest of the document.
+% \textsl{However, it's possible to provide the number of the last row and the
+% number of the last column as values of the options |last-row| and |last-col|,
+% tending to an acceleration of the whole compilation of the document.} That's
+% what we will do throughout the rest of the document.
 % \end{itemize}
 % \end{itemize}
 % 
@@ -1343,37 +1351,8 @@
 % \bigskip
 % It's possible to change in \pkg{nicematrix} the letter used to specify a
 % vertical dotted line with the option |letter-for-dotted-lines| available in
-% |\NiceMatrixOptions|. For example, in this document, we have loaded the
-% package \pkg{arydshln} which uses the letter ``|:|'' to specify a vertical
-% dashed line. Thus, by using |letter-for-dotted-lines|, we can use the
-% vertical lines of both \pkg{arydshln} and \pkg{nicematrix}.
+% |\NiceMatrixOptions|. 
 % 
-% \medskip
-% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
-% \NiceMatrixOptions{letter-for-dotted-lines = I}
-% \arrayrulecolor{blue}
-% \left(\begin{NiceArray}{~emphase#C|C:CIC@}
-% 1 & 2 & 3 & 4 \\
-% 5 & 6 & 7 & 8 \\
-% 9 & 10 & 11 & 12
-% \end{NiceArray}\right)
-% \arrayrulecolor{black}
-% \end{BVerbatim}
-% \begin{scope}
-% \NiceMatrixOptions{letter-for-dotted-lines = I}
-% \arrayrulecolor{blue}
-% $\left(\begin{NiceArray}{C|C:CIC}
-% 1 & 2 & 3 & 4 \\
-% 5 & 6 & 7 & 8 \\
-% 9 & 10 & 11 & 12
-% \end{NiceArray}\right)$
-% \arrayrulecolor{black}
-% \end{scope}
-% 
-% \smallskip
-% We have used the command |\arrayrulecolor| (de \pkg{colortbl}) to draw in blue
-% the three rules.
-%
 % \bigskip
 % \emph{Remark} : In the package \pkg{array} (on which the package
 % \pkg{nicematrix} relies), horizontal and vertical rules make the array larger
@@ -1462,11 +1441,11 @@
 % \begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
 % ~emphase#\NiceMatrixOptions{columns-width=10mm}@
 % $\begin{pNiceMatrix}
-% a & b \\ c & d \\
+% a & b \\ c & d 
 % \end{pNiceMatrix}
 % = 
 % \begin{pNiceMatrix}
-% 1   & 1245 \\ 345 & 2 \\
+% 1   & 1245 \\ 345 & 2 
 % \end{pNiceMatrix}$
 % \end{BVerbatim}
 % \begin{scope}
@@ -1473,12 +1452,12 @@
 % \NiceMatrixOptions{columns-width=10mm}
 % $\begin{pNiceMatrix}
 % a & b \\
-% c & d \\
+% c & d 
 % \end{pNiceMatrix}
 % = 
 % \begin{pNiceMatrix}
 % 1   & 1245 \\
-% 345 & 2 \\
+% 345 & 2 
 % \end{pNiceMatrix}$
 % \end{scope}
 % 
@@ -1496,21 +1475,21 @@
 % \begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
 % ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
 % $\begin{pNiceMatrix}
-% a & b \\ c & d \\
+% a & b \\ c & d 
 % \end{pNiceMatrix}
 % = 
 % \begin{pNiceMatrix}
-% 1   & 1245 \\ 345 & 2 \\
+% 1   & 1245 \\ 345 & 2 
 % \end{pNiceMatrix}$
 % ~emphase#\end{NiceMatrixBlock}@
 % \end{BVerbatim}
 % \begin{NiceMatrixBlock}[auto-columns-width]
 % $\begin{pNiceMatrix}
-% a & b \\ c & d \\
+% a & b \\ c & d 
 % \end{pNiceMatrix}
 % = 
 % \begin{pNiceMatrix}
-% 1   & 1245 \\  345 & 2 \\
+% 1   & 1245 \\  345 & 2 
 % \end{pNiceMatrix}$
 % \end{NiceMatrixBlock}
 %
@@ -1601,7 +1580,182 @@
 % For technical reasons, you can't write |\Block{|$i$|-|$j$|}{<}|. But you can
 % write |\Block{|$i$|-|$j$|}<>{<}| with the expected result.
 % 
+%
+% \section{The color of the rows and columns}
+%
+% With the classical package \pkg{colortbl}, it's possible to color the cells,
+% rows and columns of a tabular. However, the resulting \textsc{pdf} is not
+% always perfectly displayed by the \textsc{pdf} viewers, in particular in
+% conjonction with rules. With some \textsc{pdf} viewers, some vertical rules
+% seem to vanish. On the other side, some thin horizontal white lines may appear
+% in some circonstances.
+%
+%
+% \medskip
+% The version 4.0 of \pkg{nicematrix} provide similar tools which do not
+% present these drawbacks. This version provides a key |code-before| for some
+% code which will be executed \emph{before} the drawing of the tabular. In this
+% |code-before|, new commands are available: |\cellcolor|, |\rectanglecolor|,
+% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors|.
+%
+% \medskip
+% \begin{itemize}
+% \item The command |\cellcolor| takes its name from the command |\cellcolor| of
+% \pkg{colortbl}.
+%
+% This command takes in arguments a color and a list of cells, each of which
+% with the format $i$-$j$ where $i$ is the number of row and $j$ the number of
+% colummn of the cell.
+%
+%
+% \medskip
+% \begin{scope}
+% \hfuzz=10cm
+% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
+% \begin{NiceTabular}{|C|C|C|}[code-before = ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@] 
+% \hline
+% a & b & c \\ \hline
+% e & f & g \\ \hline
+% h & i & j \\ \hline
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \begin{NiceTabular}{|C|C|C|}[code-before = \cellcolor{red!15}{3-1,2-2,1-3}]
+% \hline
+% a & b & c \\ \hline
+% e & f & g \\ \hline
+% h & i & j \\ \hline
+% \end{NiceTabular}
+% \end{scope}
 % 
+% \bigskip
+% \item The command |\rectanglecolor| takes three arguments. The first is the
+% color. The second is the upper-left cell of the rectangle and the third is
+% the lower-right cell of the rectangle. 
+%
+% \medskip
+% \begin{scope}
+% \hfuzz=10cm
+% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
+% \begin{NiceTabular}{|C|C|C|}[code-before = ~emphase#\rectanglecolor{red!15}{2-2}{3-3}@]
+% \hline
+% a & b & c \\ \hline
+% e & f & g \\ \hline
+% h & i & j \\ \hline
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \begin{NiceTabular}{|C|C|C|}[code-before = \rectanglecolor{red!15}{2-2}{3-3}]
+% \hline
+% a & b & c \\ \hline
+% e & f & g \\ \hline
+% h & i & j \\ \hline
+% \end{NiceTabular}
+% \end{scope}
+% 
+%
+%
+% \bigskip
+% \item The command |\rowcolor| takes its name from the command |\rowcolor| of
+% \pkg{colortbl}. Its first argument is the color and the second is a
+% comma-separated list of rows or interval of rows with the form $a$-$b$ (an
+% interval of the form $a$- represent all the rows from the row $a$ until the end).
+% 
+% \medskip
+% \begin{scope}
+% \hfuzz = 10cm
+% \begin{BVerbatim}[boxwidth=9cm,baseline=c]
+% $\begin{NiceArray}{LLL}[hvlines, ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@]
+% a_1 & b_1 & c_1 \\
+% a_2 & b_2 & c_2 \\
+% a_3 & b_3 & c_3 \\
+% a_4 & b_4 & c_4 \\
+% a_5 & b_5 & c_5 \\
+% a_6 & b_6 & c_6 \\
+% a_7 & b_7 & c_7 \\
+% a_8 & b_8 & c_8 \\
+% a_9 & b_9 & c_9 \\
+% a_{10} & b_{10} & c_{10} \\
+% \end{NiceArray}$
+% \end{BVerbatim}
+% $\begin{NiceArray}{LLL}[baseline=4,hvlines, code-before = \rowcolor{red!15}{1,3-5,8-}]
+% a_1 & b_1 & c_1 \\
+% a_2 & b_2 & c_2 \\
+% a_3 & b_3 & c_3 \\
+% a_4 & b_4 & c_4 \\
+% a_5 & b_5 & c_5 \\
+% a_6 & b_6 & c_6 \\
+% a_7 & b_7 & c_7 \\
+% a_8 & b_8 & c_8 \\
+% a_9 & b_9 & c_9 \\
+% a_{10} & b_{10} & c_{10} \\
+% \end{NiceArray}$
+% \end{scope}
+% 
+%
+% \bigskip
+% \item The command |\columncolor| takes its name from the command
+% |\columncolor| of \pkg{colortbl}. Its syntax is similar to the syntaxe of
+% |\rowcolor|.
+% 
+% \bigskip
+% \item The command |\rowcolors| (with a \emph{s}) takes its name from the
+% command |\rowcolors| of \pkg{xcolor}. The \emph{s} emphasizes the fact that
+% there is \emph{two} colors. This command colors alternately the rows of the
+% tabular, beginning with the row whose number is given in first argument. The
+% two other arguments are the colors.
+% 
+% \medskip
+% \begin{scope}
+% \hfuzz=10cm
+% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% \begin{NiceTabular}{LR}%
+% [~emphase#code-before = \rowcolor{red!15}{1} \rowcolors{3}{blue!10}{}@]
+% \toprule
+% Town & Habitants \\
+% \midrule
+% Pau & 80000 \\
+% Paris & 2000000 \\
+% Toulouse & 700000 \\
+% Reims & 40000 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \begin{NiceTabular}{LR}[code-before =\rowcolor{red!15}{1} \rowcolors{3}{blue!10}{}]
+% \toprule
+% Ville & habitants \\
+% \midrule
+% Pau & 80000 \\
+% Paris & 2000000 \\
+% Toulouse & 700000 \\
+% Reims & 40000 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{scope}
+% 
+% \bigskip
+% \item The command |\chessboardcolors| take in arguments two colors and colors
+% the cells of the tabular in quincunx with these colors.
+%
+% \medskip
+% \begin{scope}
+% \hfuzz=10cm
+% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% $\begin{pNiceMatrix}[R,margin, ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@]
+% 1 & -1 & 1 \\
+% -1 & 1 & -1 \\
+% 1 & -1 & 1 
+% \end{pNiceMatrix}$
+% \end{BVerbatim}
+% $\begin{pNiceMatrix}[R,baseline=1, margin, code-before = \chessboardcolors{red!15}{blue!15}]
+% 1 & -1 & 1 \\
+% -1 & 1 & -1 \\
+% 1 & -1 & 1 
+% \end{pNiceMatrix}$
+% \end{scope}
+% 
+% \end{itemize}
+%
+%
+% 
 % \section{Advanced features}
 %
 %
@@ -1645,7 +1799,7 @@
 % e_1 & e_2 & e_3       \\
 % 1   & 2   & 3   & e_1 \\
 % 4   & 5   & 6   & e_2 \\
-% 7   & 8   & 9   & e_3 \\
+% 7   & 8   & 9   & e_3 
 % \end{pNiceMatrix}$
 % \end{BVerbatim}
 % \begin{varwidth}{10cm}
@@ -1656,7 +1810,7 @@
 % e_1 & e_2 & e_3 \\
 % 1   & 2   & 3  & e_1 \\
 % 4   & 5   & 6  & e_2 \\
-% 7   & 8   & 9  & e_3 \\
+% 7   & 8   & 9  & e_3 
 % \end{pNiceMatrix}$
 % \end{varwidth}
 %
@@ -1673,7 +1827,7 @@
 % 1   & 2   & 3   & e_1 \\
 % 4   & 5   & 6   & e_2 \\
 % 7   & 8   & 9   & e_3 \\
-% \text{image of } e_1 & e_2 & e_3 \\
+% \text{image of } e_1 & e_2 & e_3 
 % \end{pNiceMatrix}$
 % \end{BVerbatim}
 % \begin{varwidth}{10cm}
@@ -1684,7 +1838,7 @@
 % 1   & 2   & 3  & e_1 \\
 % 4   & 5   & 6  & e_2 \\
 % 7   & 8   & 9  & e_3 \\
-% \text{image of } e_1 & e_2 & e_3 \\
+% \text{image of } e_1 & e_2 & e_3 
 % \end{pNiceMatrix}$
 % \end{varwidth}
 %
@@ -1707,7 +1861,7 @@
 %                             columns-width = 3mm ] 
 % 1 & -2 & 3 & 4 & 5 \\
 % 0 & 3  & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\
-% 0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\
+% 0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 
 % \end{bNiceArray}$
 % \end{Verbatim}
 % %
@@ -1716,7 +1870,7 @@
 %                      columns-width=3mm]
 % 1 & -2 & 3 & 4 & 5 \\
 % 0 & 3  & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\
-% 0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\
+% 0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 
 % \end{bNiceArray}\]
 %
 %
@@ -1781,7 +1935,7 @@
 % \bigskip
 % The package \pkg{nicematrix} also provides commands in order to compose
 % automatically matrices from a general pattern. These commands are
-% |\pAutoNiceMatrix|, |\bAutoNiceMatrix|, |\vAutoNiceMatrix|,
+% |\AutoNiceMatrix|, |\pAutoNiceMatrix|, |\bAutoNiceMatrix|, |\vAutoNiceMatrix|,
 % |\VAutoNiceMatrix| and |\BAutoNiceMatrix|.
 %
 % These commands take two mandatory arguments. The first is the format of the
@@ -1818,7 +1972,7 @@
 % \arrayrulecolor{blue}
 % $\begin{NiceArray}{CCCC}%
 %  [~emphase#hvlines@,first-row,first-col]
-% %   & e & a & b & c \\
+%   & e & a & b & c \\
 % e & e & a & b & c \\
 % a & a & e & c & b \\
 % b & b & c & e & a \\
@@ -1869,7 +2023,7 @@
 % $\begin{pNiceMatrix}[vlines]
 % 1 & 2 & 3 & 4 & 5 & 6 \\
 % 1 & 2 & 3 & 4 & 5 & 6 \\
-% 1 & 2 & 3 & 4 & 5 & 6 \\
+% 1 & 2 & 3 & 4 & 5 & 6 
 % \end{pNiceMatrix}$
 % \end{BVerbatim}
 % \begin{scope}
@@ -1877,7 +2031,7 @@
 % $\begin{pNiceMatrix}[vlines]
 % 1 & 2 & 3 & 4 & 5 & 6 \\
 % 1 & 2 & 3 & 4 & 5 & 6 \\
-% 1 & 2 & 3 & 4 & 5 & 6 \\
+% 1 & 2 & 3 & 4 & 5 & 6 
 % \end{pNiceMatrix}$
 % \end{scope}
 %
@@ -2156,10 +2310,6 @@
 % environments of \pkg{nicematrix} are not affected).
 %
 %
-% \subsection{The class option draft}
-%
-% When the class option |draft| is used, the dotted lines are not drawn, for a
-% faster compilation.
 % 
 % \subsection{A technical problem with the argument of
 % \textbackslash\textbackslash}
@@ -2228,7 +2378,7 @@
 % \end{pNiceMatrix}$
 %
 %
-% \subsection{Obsolete environments}      
+% \subsection{Obsolete environments which have been deleted}     
 % 
 % The version 3.0 of \pkg{nicematrix} has introduced the environment
 % |{pNiceArray}| (and its variants) with the options |first-row|, |last-row|,
@@ -2235,7 +2385,7 @@
 % |first-col| and |last-col|. 
 %
 % Consequently the following environments present in previous versions of
-% \pkg{nicematrix} are deprecated:
+% have been deleted from \pkg{nicematrix}.
 % %
 % \begin{itemize}
 % \item |{NiceArrayCwithDelims}| ;
@@ -2245,13 +2395,10 @@
 % \item |{pNiceArrayRC}|, |{bNiceArrayRC}|, |{BNiceArrayRC}|, |{vNiceArrayRC}|,
 % |{VNiceArrayRC}|.
 % \end{itemize}
-%       
-% Since the version 3.12, the only way to use these environments is loading
-% \pkg{nicematrix} with the option |obsolete-environments|.
+% 
+% However, the definition of those environments is still available (temporarily)
+% at the end of the file |nicematrix.sty| after a command |\file_input_stop:|.
 %
-% However, these environments will certainly be completely deleted in a future
-% version of \pkg{nicematrix}.
-%
 % \section{Examples}
 %
 % \subsection{Dotted lines}
@@ -2428,7 +2575,7 @@
 %        & 1 & 1 & 1 &  & 1 \\
 % \Vdots[line-style={solid,<->}]_{n \text{ rows}} & 1 & 1 & 1 &  & 1 \\
 %        & 1 & 1 & 1 &  & 1 \\
-%        & 1 & 1 & 1 & \Ldots & 1 \\
+%        & 1 & 1 & 1 & \Ldots & 1 
 % \end{pNiceMatrix}$
 % \end{Verbatim}
 %
@@ -2442,7 +2589,7 @@
 %        & 1 & 1 & 1 &  & 1 \\
 % \Vdots[line-style={solid,<->}]_{n \text{ rows}} & 1 & 1 & 1 &  & 1 \\
 %        & 1 & 1 & 1 &  & 1 \\
-%        & 1 & 1 & 1 & \Ldots & 1 \\
+%        & 1 & 1 & 1 & \Ldots & 1 
 % \end{pNiceMatrix}\]
 % \end{scope}
 %
@@ -2457,9 +2604,10 @@
 % \bigskip
 % \begin{BVerbatim}
 % ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
-% \NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+% \NiceMatrixOptions
+%  { last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
 % \setlength{\extrarowheight}{1mm}
-% $\begin{pNiceArray}{CCCC:C}[last-col]
+% $\begin{pNiceArray}{CCCC:C}
 %   1  1  1   1   1 ;
 %   2  4  8  16   9 ;
 %   3  9 27  81  36 ;
@@ -2466,7 +2614,7 @@
 %   4 16 64 256 100 
 % \end{pNiceArray}$
 % \medskip
-% $\begin{pNiceArray}{CCCC:C}[last-col]
+% $\begin{pNiceArray}{CCCC:C}
 %   1  1  1   1  1 ;
 %   0  2  6  14  7        { L_2 \gets -2 L_1 + L_2 } ;
 %   0  6 24  78 33        { L_3 \gets -3 L_1 + L_3 } ;
@@ -2475,15 +2623,15 @@
 % ...
 % ~emphase#\end{NiceMatrixBlock}@
 % \end{BVerbatim}
-% 
+%
 % \bigskip
-% 
-% % \begin{multicols}{2}
+%
+% \begin{multicols}{2}
 % \begin{NiceMatrixBlock}[auto-columns-width]
-% \NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+% \NiceMatrixOptions{last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
 % \setlength{\extrarowheight}{1mm}
 %
-% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+% \enskip $\begin{pNiceArray}{CCCC:C}
 % 1  1  1   1   1 ;
 % 2  4  8  16   9 ;
 % 3  9 27  81  36 ;
@@ -2492,7 +2640,7 @@
 %
 % \medskip
 %
-% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+% \enskip $\begin{pNiceArray}{CCCC:C}
 % 1  1  1   1  1 ;
 % 0  2  6  14  7 { L_2 \gets -2 L_1 + L_2 } ;
 % 0  6 24  78 33 { L_3 \gets -3 L_1 + L_3 } ;
@@ -2501,7 +2649,7 @@
 %
 % \medskip
 %
-% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+% \enskip $\begin{pNiceArray}{CCCC:C}
 % 1 1  1  1 1 ;
 % 0 1  3  7 \frac72    { L_2 \gets \frac12 L_2 } ;
 % 0 3 12 39 \frac{33}2 { L_3 \gets \frac12 L_3 } ;
@@ -2510,7 +2658,7 @@
 %
 % \medskip
 %
-% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+% \enskip $\begin{pNiceArray}{CCCC:C}
 % 1 1  1   1 1       ;
 % 0 1  3   7 \frac72 ;
 % 0 0  3  18 6        { L_3 \gets -3 L_2 + L_3 } ;
@@ -2519,7 +2667,7 @@
 %
 % \medskip
 %
-% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+% \enskip $\begin{pNiceArray}{CCCC:C}
 % 1 1  1   1 1       ;
 % 0 1  3   7 \frac72 ;
 % 0 0  1   6 2        { L_3 \gets \frac13 L_3 } ;
@@ -2528,7 +2676,7 @@
 %
 % \medskip
 %
-% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
+% \enskip $\begin{pNiceArray}{CCCC:C}
 % 1 1 1  1 1       ;
 % 0 1 3  7 \frac72 ;
 % 0 0 1  6 2       ;
@@ -2544,7 +2692,7 @@
 % \label{highlight}
 % The following examples require Tikz (by default, \pkg{nicematrix} only loads
 % \textsc{pgf}) and the Tikz library |fit|. The following lines in the preamble
-% of your document may do the job:
+% of your document do the job:
 % \begin{verbatim}
 % \usepackage{tikz}
 % \usetikzlibrary{fit}
@@ -2562,6 +2710,8 @@
 % don't do that, the new nodes will be larger that the nodes created by
 % \pkg{nicematrix}). 
 %
+% \label{example-CodeAfter}
+%
 % \begin{Verbatim}
 % $\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin = 2pt]
 %   a_{11} & a_{12} & a_{13} & a_{14} \\
@@ -2879,7 +3029,7 @@
 %     & \Vdots &        &        &        & \Vdots \\
 % L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
 %     & \Vdots &        &        &        & \Vdots \\
-%     & a_{n1} & \Cdots &        &        & a_{nn} \\
+%     & a_{n1} & \Cdots &        &        & a_{nn} 
 % \end{bNiceArray}
 % & 
 % \end{Verbatim}
@@ -3010,24 +3160,12 @@
     You~can~go~on~but~you~will~probably~have~other~errors~
     if~you~use~the~functionalities~of~nicematrix.
   }
-\cs_if_exist:NF \l_keys_key_str
-  { \msg_error:nn { nicematrix } { expl3~too~old } }
+\cs_if_exist:NF \l_keys_key_str 
+  { \msg_error:nn { nicematrix } { expl3~too~old } } 
 %    \end{macrocode}
 %
 %
 % \bigskip
-% We test the class option |draft|. In this case, we raise the flag
-% |\c_@@_draft_bool| because we won't draw the dotted lines if the option
-% |draft| is used.
-%    \begin{macrocode}
-\bool_new:N \c_@@_draft_bool
-\DeclareOption { draft } { \bool_set_true:N \c_@@_draft_bool }
-\DeclareOption* { }
-\ProcessOptions \relax
-%    \end{macrocode}
-%
-%
-% 
 % The command for the treatment of the options of |\usepackage| is at the end of
 % this package for technical reasons. 
 % 
@@ -3059,10 +3197,15 @@
 % \bigskip
 % \subsection*{Technical  definitions}
 %
+%
 %    \begin{macrocode}
+\bool_new:N \c_@@_booktabs_loaded_bool
 \bool_new:N \c_@@_tikz_loaded_bool
 \AtBeginDocument
   {
+    \@ifpackageloaded { booktabs }
+      { \bool_set_true:N \c_@@_booktabs_loaded_bool }
+      { }
     \@ifpackageloaded { tikz }
       { 
 %    \end{macrocode}
@@ -3071,8 +3214,8 @@
 % between |{pgfpicture}| and |{tikzpicture}| can't be done dynamically with a
 % conditional because, when the Tikz library |external| is loaded by the user,
 % the pair |\tikzpicture|-|\endtikpicture| (or
-% |\begin{tikzpicture}-\end{tikzpicture}| must be statically ``visible'' (even
-% when extenalization is not activated).
+% |\begin{tikzpicture}-\end{tikzpicture}|) must be statically ``visible'' (even
+% when externalization is not activated).
 %
 % That's why we create |\c_@@_pgfortikzpicture_tl| and
 % |\c_@@_endpgfortikzpicture_tl| which will be used to construct in a
@@ -3102,19 +3245,7 @@
   { }
 %    \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 { \msg_warning:nn { nicematrix }  { Draft~mode } }
-%    \end{macrocode}
-% 
-%
 % \bigskip
 % We define a command |\iddots| similar to |\ddots| ($\ddots$) but with dots
 % going forward ($\iddots$). We use |\ProvideDocumentCommand| of \pkg{xparse},
@@ -3141,6 +3272,204 @@
 % This definition is a variant of the standard definition of |\ddots|.
 %
 %
+% \bigskip
+% In the |aux| file, we will have the references of the PGF/Tikz nodes created
+% by \pkg{nicematrix}. However, when \pkg{booktabs} is used, some nodes (more
+% precisely, some |row| nodes) will be defined twice because their position will
+% be modified. In order to avoid an error message in this case, we will redefine
+% |\pgfutil at check@rerun| in the |aux| file.
+%    \begin{macrocode}
+\AtBeginDocument 
+  {     
+    \@ifpackageloaded { booktabs } 
+      { \iow_now:Nn \@mainaux \nicematrix at redefine@check at rerun } 
+      { } 
+  }
+\cs_set_protected:Npn \nicematrix at redefine@check at rerun
+  {
+    \cs_set_eq:NN \@@_old_pgfutil at check@rerun \pgfutil at check@rerun
+%    \end{macrocode}
+% The new version of |\pgfutil at check@rerun| will not check the PGF nodes whose
+% names start with |nm-| (which is the prefix for the nodes creates by
+% \pkg{nicematrix}). 
+%    \begin{macrocode}
+    \cs_set_protected:Npn \pgfutil at check@rerun ##1 ##2
+      {
+        \str_set:Nx \l_tmpa_str { \tl_range:nnn { ##1 } 1 3 }
+        \str_if_eq:VnF \l_tmpa_str { nm- } 
+          { \@@_old_pgfutil at check@rerun { ##1 } { ##2 } }
+      }    
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% We have to know whether \pkg{colortbl} is loaded in particular for the
+% redefinition of |\everycr|.
+%    \begin{macrocode}
+\bool_new:N \c_@@_colortbl_loaded_bool 
+\AtBeginDocument 
+  { 
+    \@ifpackageloaded { colortbl }
+      { \bool_set_true:N \c_@@_colortbl_loaded_bool }
+      { 
+%    \end{macrocode}
+% The command |\CT at arc@| is a command of \pkg{colortbl} which sets the color of
+% the rules in the array. We will use it to store the instruction of color for
+% the rules even if \pkg{colortbl} is not loaded.
+%    \begin{macrocode}
+        \cs_set_protected:Npn \CT at arc@ { }
+        \NewDocumentCommand { \arrayrulecolor } { m }
+          { \tl_gset:Nn \CT at arc@ { \color { #1 } } }
+%    \end{macrocode}
+% The following line are from the redefinition of |\hline| of standard LaTeX by
+% \pkg{colortbl} (\pkg{array} does not redefine |\hline|).
+%    \begin{macrocode}
+        \cs_set:Npn \hline
+          {
+            \noalign { \ifnum 0 = `} \fi
+            \let \hskip \vskip
+            \let \vrule \hrule
+            \let \@width \@height
+            { \CT at arc@ \vline } 
+            \futurelet \reserved at a
+            \@xhline
+          }
+      }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% The following command are only for efficiency. It 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 }
+\cs_new:Npn \@@_pred:n #1 { \the \numexpr #1 - 1 \relax }
+%    \end{macrocode}
+%
+% \bigskip
+% \textbf{The column S of siunitx}\par\nobreak
+%
+% \medskip
+% We want to know whether the package \pkg{siunitx} is loaded and, if it is
+% loaded, we redefine the |S| columns of \pkg{siunitx}.
+%    \begin{macrocode}
+\bool_new:N \c_@@_siunitx_loaded_bool 
+\AtBeginDocument 
+  { 
+    \@ifpackageloaded { siunitx }
+      { \bool_set_true:N \c_@@_siunitx_loaded_bool }
+      { } 
+  }
+%    \end{macrocode}
+% 
+% \medskip
+% The command |\NC at rewrite@S| is a LaTeX command created by \pkg{siunitx} in
+% connection with the |S| column. In the code of \pkg{siunitx}, this command is
+% defined by:
+% \begin{Verbatim}[commandchars=\~\!\+, formatcom = \small]
+% \renewcommand*{\NC at rewrite@S}[1][]
+%   {
+%     \@temptokena \exp_after:wN
+%       {
+%         \tex_the:D \@temptokena
+%         > { \__siunitx_table_collect_begin: S {#1} }
+%         c
+%         < { \__siunitx_table_print: }
+%       }
+%     \NC at find
+%   } 
+% \end{Verbatim}
+% We want to patch this command (in the environments of \pkg{nicematrix}) in
+% order to have:
+% \begin{Verbatim}[commandchars=\~\!\+, formatcom = \small]
+% \renewcommand*{\NC at rewrite@S}[1][]
+%   {
+%     \@temptokena \exp_after:wN
+%       {
+%         \tex_the:D \@temptokena
+%         > { ~emphase!\@@_Cell:+ \__siunitx_table_collect_begin: S {#1} }
+%         c
+%         < { \__siunitx_table_print: ~emphase!\@@_end_Cell:+ }
+%       }
+%     \NC at find
+%   } 
+% \end{Verbatim}
+% However, we don't want do use explicitly any private command of \pkg{siunitx}.
+% That's why we will extract the name of the two |\__siunitx...| commands by
+% their position in the code of |\NC at rewrite@S|. 
+%
+% Since the command |\NC at rewrite@S| appends some tokens to the \emph{toks} list
+% |\@temptokena|, we use the LaTeX command |\NC at rewrite@S| in a group
+% (|\group_begin:|--|\group_end:|) and we extract the two command names which
+% are in the toks |\@temptokena|. However, this extraction can be done only
+% when \pkg{siunitx} is loaded (and it may be loaded after \pkg{nicematrix})
+% and, in fact, after the beginning of the document --- because some
+% instructions of \pkg{siunitx} are executed in a |\AtBeginDocument|). That's
+% why this extraction will be done only at the first use of an
+% environment of \pkg{nicematrix} with the command |\@@_adapt_S_column:|. 
+%    \begin{macrocode}
+\cs_set_protected:Npn \@@_adapt_S_column:
+  {
+    \bool_if:NT \c_@@_siunitx_loaded_bool
+      { 
+        \group_begin:
+        \@temptokena = { }
+%    \end{macrocode}
+% We protect |\NC at find| which is at the end of |\NC at rewrite@S|.
+%    \begin{macrocode}
+        \cs_set_eq:NN \NC at find \prg_do_nothing:
+        \NC at rewrite@S { }
+%    \end{macrocode}
+% Conversion of the \emph{toks} |\@temptokena| in a token list of \pkg{expl3}
+% (the toks are not supported by \pkg{expl3} but we can, nevertheless, use the
+% option |V| for |\tl_gset:NV|).
+%    \begin{macrocode}
+        \tl_gset:NV \g_tmpa_tl \@temptokena 
+        \group_end:
+        \tl_new:N \c_@@_table_collect_begin_tl
+        \tl_set:Nx \l_tmpa_tl { \tl_item:Nn \g_tmpa_tl 2 }
+        \tl_gset:Nx \c_@@_table_collect_begin_tl { \tl_item:Nn \l_tmpa_tl 1 }
+        \tl_new:N \c_@@_table_print_tl
+        \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } }
+%    \end{macrocode}
+% The token lists |\c_@@_table_collect_begin_tl| and |\c_@@_table_print_tl|
+% contain now the two commands of \pkg{siunitx}.
+% 
+% \smallskip
+% If the adaptation has been done, the command |\@@_adapt_S_column:| becomes
+% no-op (globally). 
+%    \begin{macrocode}
+        \cs_gset_eq:NN \@@_adapt_S_column: \prg_do_nothing:
+      }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% The command |\@@_renew_NC at rewrite@S:| will be used in each environment of
+% \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment
+% (only if the boolean |\c_@@_siunitx_loaded_bool| is raised, of course).
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_renew_NC at rewrite@S:
+  {
+    \renewcommand*{\NC at rewrite@S}[1][]
+      {
+        \@temptokena \exp_after:wN
+          {
+            \tex_the:D \@temptokena
+            > { \@@_Cell: \c_@@_table_collect_begin_tl S {##1} }
+            c
+            < { \c_@@_table_print_tl \@@_end_Cell: }
+          }
+        \NC at find
+      }
+  }
+%    \end{macrocode}
+%
+%
+% \bigskip
+% \subsection*{Parameters}
+%
+% 
 % \bigskip 
 % The following counter will count the environments |{NiceArray}|. The value of
 % this counter will be used to prefix the names of the Tikz nodes created in the
@@ -3148,15 +3477,24 @@
 %    \begin{macrocode}
 \int_new:N \g_@@_env_int
 %    \end{macrocode}
-% 
+%
+% \bigskip
+% The following command is only a syntaxic shortcut. It must \emph{not} be
+% protected (it will be used in names of \textsc{pgf} nodes).
 %    \begin{macrocode}
 \cs_new:Npn \@@_env: { nm - \int_use:N \g_@@_env_int } 
-\cs_new_protected:Npn \@@_qpoint: #1 
+%    \end{macrocode}
+%
+% \bigskip
+% The following command is only a syntaxic shortcut. The |q| in |qpoint| means 
+% \emph{quick}. 
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_qpoint:n #1 
   { \pgfpointanchor { \@@_env: - #1 } { center } } 
 %    \end{macrocode}
 % 
 % \bigskip
-% We also define a counter to count the environments |{NiceMatrixBlock}|.
+% the following counter will count the environments |{NiceMatrixBlock}|.
 %    \begin{macrocode}
 \int_new:N \g_@@_NiceMatrixBlock_int
 %    \end{macrocode}
@@ -3179,7 +3517,6 @@
 \seq_new:N \g_@@_names_seq
 %    \end{macrocode}
 %
-
 % \bigskip
 % We want to know if we are in an environment of \pkg{nicematrix} because we
 % will raise an error if the user tries to use nested environments.
@@ -3186,7 +3523,6 @@
 %    \begin{macrocode}
 \bool_new:N \l_@@_in_env_bool
 %    \end{macrocode}
-% 
 %
 % \bigskip
 % If the user uses |{NiceArray}| (and not another environment relying upon
@@ -3198,9 +3534,14 @@
 \bool_new:N \l_@@_NiceArray_bool
 %    \end{macrocode}
 % 
-%
 % \bigskip
+% If the user uses |{NiceTabular}|, we will raise the following flag.
 %    \begin{macrocode}
+\bool_new:N \l_@@_NiceTabular_bool
+%    \end{macrocode}
+% 
+% \bigskip
+%    \begin{macrocode}
 \cs_new_protected:Npn \@@_test_if_math_mode:
   { 
     \if_mode_math: \else:
@@ -3210,67 +3551,23 @@
 %    \end{macrocode}
 %
 % 
-% 
 % \bigskip
-% We have to know whether \pkg{colortbl} is loaded for the redefinition of
-% |\everycr| and |\vline| and for the options |hlines| and |vlines|.
+% The following colors will be used to memorize le color of the potential ``first
+% col'' and the potential ``first row''.
 %    \begin{macrocode}
-\bool_new:N \c_@@_colortbl_loaded_bool 
-\AtBeginDocument 
-  { 
-    \@ifpackageloaded { colortbl }
-      { 
-        \bool_set_true:N \c_@@_colortbl_loaded_bool 
-        \cs_set_protected:Npn \@@_vline_i: { { \CT at arc@ \vline } }
-      }
-      { } 
-  }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
 \colorlet { nicematrix-last-col } { . }
 \colorlet { nicematrix-last-row } { . }
 %    \end{macrocode}
-% 
 % \bigskip
-% The length |\l_@@_inter_dots_dim| is the distance between two dots for the
-% dotted lines. The default value is 0.45~em but it will be changed if the
-% option |small| is used.
+% The following string is the name of the current environment or the current
+% command of \pkg{nicematrix} (despite its name which contains \textsl{env}).
 %    \begin{macrocode}
-\dim_new:N \l_@@_inter_dots_dim
-\dim_set:Nn \l_@@_inter_dots_dim { 0.45 em }
+\str_new:N \g_@@_name_env_str
 %    \end{macrocode}
-%
-% \bigskip
-% The length |\l_@@_xdots_shorten_dim| is the minimal distance between a
-% node (in fact an anchor of that node) and a dotted line (we say ``minimal''
-% because, by definition, a dotted line is not a continuous line and, therefore,
-% this distance may vary a little).
-%    \begin{macrocode}
-\dim_new:N \l_@@_xdots_shorten_dim
-\dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em }
-%    \end{macrocode}
 % 
 % \bigskip
-% The length |\l_@@_radius_dim| is the radius of the dots for the dotted lines
-% (for |\hdottedline| and |\dottedline| and for all the other dotted lines when
-% |line-style| is equal to |standard|, which is the initial value). The initial
-% value is 0.53~pt but it will be changed if the option |small| is used (to
-% 0.37~pt).
-%    \begin{macrocode}
-\dim_new:N \l_@@_radius_dim
-\dim_set:Nn \l_@@_radius_dim { 0.53 pt }
-%    \end{macrocode}
-%
-% \bigskip
-% The name of the current environment or the current command (despite the name
-% which contains \textsl{env}).
-%    \begin{macrocode}
-\str_new:N \g_@@_name_env_str
-%    \end{macrocode}
-% 
-% The string |\g_@@_com_or_env_str| will contain the word \emph{command} or
-% \emph{environment} whether we are in a command of \pkg{nicematrix} or a an
+% The following string will contain the word \emph{command} or
+% \emph{environment} whether we are in a command of \pkg{nicematrix} or in an
 % environment of \pkg{nicematrix}. The default value is \emph{environment}.
 %    \begin{macrocode}
 \str_new:N \g_@@_com_or_env_str
@@ -3277,10 +3574,10 @@
 \str_set:Nn \g_@@_com_or_env_str { environment }
 %    \end{macrocode}
 % 
-% The following control sequence will be able to reconstruct the full name of
-% the current command or environment (despite the name which contains
-% \textsl{env}). This command must \emph{not} be protected since it's used in
-% error messages.
+% \bigskip
+% The following command will be able to reconstruct the full name of the current
+% command or environment (despite its name which contains \textsl{env}). This
+% command must \emph{not} be protected since it will be used in error messages.
 %    \begin{macrocode}
 \cs_new:Npn \@@_full_name_env:
   { 
@@ -3291,35 +3588,56 @@
 %    \end{macrocode}
 % 
 % \bigskip
+% The following token list corresponds to the option |code-after| (it's also
+% possible to set the value of that parameter with the command |\CodeAfter|).
 %    \begin{macrocode}
-\tl_new:N \g_@@_internal_code_after_tl
 \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
+% The following token list has a function similar to |\g_@@_code_after_tl| but
+% it is used internally by \pkg{nicematrix}. In fact, we have to distinguish
+% between |\g_@@_code_after_tl| and |\g_@@_internal_code_after_tl| because we
+% must take care of the order in which instructions stored in that paremeters
+% are executed.
+%    \begin{macrocode}
+\tl_new:N \g_@@_internal_code_after_tl
+%    \end{macrocode}
+% 
+% \bigskip
+% The counters |\l_@@_old_iRow_int| and |\l_@@_old_jCol_int| will be used to
+% save the values of the potential 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
+\int_new:N \l_@@_old_iRow_int
+\int_new:N \l_@@_old_jCol_int
 %    \end{macrocode}
 %
 % The TeX counters |\c at iRow| and |\c at jCol| will be created in the beginning of
 % |{NiceArrayWithDelims}| (if they don't exist previously).
 % 
+% \bigskip
+% A kind of false row will be inserted at the end of the array for the
+% construction of the |col| nodes (and also to fix the width of the columns when
+% |columns-width| is used). When this special row will be created, we will raise
+% the flag |\g_@@_row_of_col_done_bool| in order to avoid some actions set in
+% the redefinition of |\everycr| when the last |\cr| of the |\halign| will occur
+% (after that row of |col| nodes).
 %    \begin{macrocode}
 \bool_new:N \g_@@_row_of_col_done_bool
 %    \end{macrocode}
 % 
+% \bigskip
+% The following flag will be raised when the key |code-before| is used in the
+% environment. Indeed, if there is a |code-before| in the environment, we will
+% manage to have the |row| nodes and the |col| nodes available \emph{before} the 
+% creation of the array.
 %    \begin{macrocode}
-\tl_new:N \l_@@_initial_suffix_tl 
-\tl_new:N \l_@@_initial_anchor_tl 
-\tl_new:N \l_@@_final_suffix_tl 
-\tl_new:N \l_@@_final_anchor_tl 
-%    \end{macrocode}
+\bool_new:N \l_@@_code_before_bool
+%    \end{macrocode} 
 % 
+% \bigskip
+% The following dimensions will be used when drawing the dotted lines.
 %    \begin{macrocode}
 \dim_new:N \l_@@_x_initial_dim
 \dim_new:N \l_@@_y_initial_dim
@@ -3327,25 +3645,37 @@
 \dim_new:N \l_@@_y_final_dim
 %    \end{macrocode}
 % 
+% \bigskip
+% \pkg{expl3} provides scratch dimension |\l_tmpa_dim| and |\l_tmpd_dim|. We
+% creates two other in the same spirit (if they don't exist yet : that's why we
+% use |\dim_zero_new:N|).
 %    \begin{macrocode}
-\dim_new:N \l_tmpc_dim
-\dim_new:N \l_tmpd_dim
+\dim_zero_new:N \l_tmpc_dim 
+\dim_zero_new:N \l_tmpd_dim
 %    \end{macrocode}
 %
+% \bigskip
+% Some cells will be declared as ``empty'' (for example a cell with the
+% instrution |\Cdot|).
 %    \begin{macrocode}
 \bool_new:N \g_@@_empty_cell_bool
 %    \end{macrocode}
 % 
-% \medskip
-% The token list |\l_@@_xdots_line_style_tl| corresponds to the option |tikz| of the
-% commands |\Cdots|, |\Ldots|, etc. and of the options |line-style| for the
-% environments and |\NiceMatrixOptions|. The constant |\c_@@_standard_tl| will
-% be used in some tests.
+% \bigskip
+% The following dimension will be used to save the current value of
+% |\arraycolsep|.
 %    \begin{macrocode}
-\tl_new:N \l_@@_xdots_line_style_tl
-\tl_const:Nn \c_@@_standard_tl { standard }
-\tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl
+\dim_new:N \@@_old_arraycolsep_dim 
 %    \end{macrocode}
+%
+% \bigskip
+% The following dimensions will be used internally to compute the width of the
+% potential ``first column'' and ``last column''.
+%    \begin{macrocode}
+\dim_new:N \g_@@_width_last_col_dim
+\dim_new:N \g_@@_width_first_col_dim
+%    \end{macrocode}
+%
 % 
 % \bigskip
 % \textbf{Variables for the exterior rows and columns}\par\nobreak
@@ -3360,8 +3690,7 @@
 % \item \textbf{First row}\par\nobreak
 % The integer |\l_@@_first_row_int| is the number of the first row of the
 % array. The default value is $1$, but, if the option |first-row| is used,
-% the value will be~$0$. As usual, the global version is for the passage in the
-% |\group_insert_after:N|. 
+% the value will be~$0$. 
 %    \begin{macrocode}
 \int_new:N \l_@@_first_row_int
 \int_set:Nn \l_@@_first_row_int 1
@@ -3409,7 +3738,7 @@
 % \medskip
 % \item \textbf{Last column}\par\nobreak
 %
-% For the eventual ``last column'', we use an integer. A value of $-2$ means
+% For the potential ``last column'', we use an integer. A value of $-2$ means
 % that there is no last column. A value of $-1$ means that there is a last
 % column but we don't know its value because the user has used the option
 % |last-col| without value (it's possible in an environment without preamble
@@ -3438,138 +3767,13 @@
 % This boolean is set to |false| at the end of |\@@_pre_array:|.
 % \end{itemize}
 %       
-% \bigskip
-% \textbf{The column S of siunitx}\par\nobreak
-%
-% \medskip
-% We want to know whether the package \pkg{siunitx} is loaded and, if it is
-% loaded, we redefine the |S| columns of \pkg{siunitx}.
-%    \begin{macrocode}
-\bool_new:N \c_@@_siunitx_loaded_bool 
-\AtBeginDocument 
-  { 
-    \@ifpackageloaded { siunitx }
-      { \bool_set_true:N \c_@@_siunitx_loaded_bool }
-      { } 
-  }
-%    \end{macrocode}
 % 
-% \medskip
-% The command |\NC at rewrite@S| is a LaTeX command created by \pkg{siunitx} in
-% connection with the |S| column. In the code of \pkg{siunitx}, this command is
-% defined by:
-% \begin{Verbatim}[commandchars=\~\!\+, formatcom = \small]
-% \renewcommand*{\NC at rewrite@S}[1][]
-%   {
-%     \@temptokena \exp_after:wN
-%       {
-%         \tex_the:D \@temptokena
-%         > { \__siunitx_table_collect_begin: S {#1} }
-%         c
-%         < { \__siunitx_table_print: }
-%       }
-%     \NC at find
-%   } 
-% \end{Verbatim}
-% We want to patch this command (in the environments of \pkg{nicematrix}) in
-% order to have:
-% \begin{Verbatim}[commandchars=\~\!\+, formatcom = \small]
-% \renewcommand*{\NC at rewrite@S}[1][]
-%   {
-%     \@temptokena \exp_after:wN
-%       {
-%         \tex_the:D \@temptokena
-%         > { ~emphase!\@@_Cell:+ \__siunitx_table_collect_begin: S {#1} }
-%         c
-%         < { \__siunitx_table_print: ~emphase!\@@_end_Cell:+ }
-%       }
-%     \NC at find
-%   } 
-% \end{Verbatim}
-% However, we don't want do use explicitly any private command of \pkg{siunitx}.
-% That's why we will extract the name of the two |\__siunitx...| commands by
-% their position in the code of |\NC at rewrite@S|. 
-%
-% Since the command |\NC at rewrite@S| appends some tokens to the \emph{toks} list
-% |\@temptokena|, we use the LaTeX command |\NC at rewrite@S| in a group
-% (|\group_begin:|--|\group_end:|) and we extract the two command names which
-% are in the toks |\@temptokena|. However, this extraction can be done only
-% when \pkg{siunitx} is loaded (and it may be loaded after \pkg{nicematrix})
-% and, in fact, after the beginning of the document --- because some
-% instructions of \pkg{siunitx} are executed in a |\AtBeginDocument|). That's
-% why this extraction will be done only at the first use of an
-% environment of \pkg{nicematrix} with the command |\@@_adapt_S_column:|. 
-%    \begin{macrocode}
-\cs_set_protected:Npn \@@_adapt_S_column:
-  {
-    \bool_if:NT \c_@@_siunitx_loaded_bool
-      { 
-        \group_begin:
-        \@temptokena = { }
-%    \end{macrocode}
-% We protect |\NC at find| which is at the end of |\NC at rewrite@S|.
-%    \begin{macrocode}
-        \cs_set_eq:NN \NC at find \prg_do_nothing:
-        \NC at rewrite@S { }
-%    \end{macrocode}
-% Conversion of the \emph{toks} |\@temptokena| in a token list of \pkg{expl3}
-% (the toks are not supported by \pkg{expl3} but we can, nevertheless, use the
-% option |V| for |\tl_gset:NV|).
-%    \begin{macrocode}
-        \tl_gset:NV \g_tmpa_tl \@temptokena 
-        \group_end:
-        \tl_new:N \c_@@_table_collect_begin_tl
-        \tl_set:Nx \l_tmpa_tl { \tl_item:Nn \g_tmpa_tl 2 }
-        \tl_gset:Nx \c_@@_table_collect_begin_tl { \tl_item:Nn \l_tmpa_tl 1 }
-        \tl_new:N \c_@@_table_print_tl
-        \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } }
-%    \end{macrocode}
-% The token lists |\c_@@_table_collect_begin_tl| and |\c_@@_table_print_tl|
-% contain now the two commands of \pkg{siunitx}.
 % 
-% \smallskip
-% If the adaptation has been done, the command |\@@_adapt_S_column:| becomes
-% no-op (globally). 
-%    \begin{macrocode}
-        \cs_gset_eq:NN \@@_adapt_S_column: \prg_do_nothing:
-      }
-  }
-%    \end{macrocode}
-%
-% \bigskip
-% The command |\@@_renew_NC at rewrite@S:| will be used in each environment of
-% \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment
-% (only if the boolean |\c_@@_siunitx_loaded_bool| is raised, of course).
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_renew_NC at rewrite@S:
-  {
-    \renewcommand*{\NC at rewrite@S}[1][]
-      {
-        \@temptokena \exp_after:wN
-          {
-            \tex_the:D \@temptokena
-            > { \@@_Cell: \c_@@_table_collect_begin_tl S {##1} }
-            c
-            < { \c_@@_table_print_tl \@@_end_Cell: }
-          }
-        \NC at find
-      }
-  }
-%    \end{macrocode}
-% 
-% \bigskip
-% The following command is only for efficiency. It 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 }
-\cs_new:Npn \@@_pred:n #1 { \the \numexpr #1 - 1 \relax }
-%    \end{macrocode}
-% 
 % \subsection*{Command for creation of rectangle nodes}
 %
 % 
-% The following command should be used in a |{pgfpicture}|. It creates an
-% rectangular (empty but with a name) when the four corners are given.
+% The following command should be used in a |{pgfpicture}|. It creates a
+% rectangle (empty but with a name).
 % 
 % |#1| is the name of the node which will be created;
 % |#2| and |#3| are the coordinates of one of the corner of the rectangle;
@@ -3637,6 +3841,54 @@
 % \bigskip 
 % \subsection*{The options}
 % 
+% 
+% The following dimensions correspond to the options |cell-space-top-limit| and co
+% (these parameters are inspired by the package \pkg{cellspace}). 
+%    \begin{macrocode}
+\dim_new:N \l_@@_cell_space_top_limit_dim
+\dim_new:N \l_@@_cell_space_bottom_limit_dim
+%    \end{macrocode}
+%
+% \bigskip
+% The following dimension is the distance between two dots for the dotted lines
+% (when |line-style| is equal to |standard|, which is the initial value). The
+% initial value is 0.45~em but it will be changed if the option |small| is used.
+%    \begin{macrocode}
+\dim_new:N \l_@@_inter_dots_dim
+\dim_set:Nn \l_@@_inter_dots_dim { 0.45 em }
+%    \end{macrocode}
+%
+% \bigskip
+% The following dimension is the minimal distance between a node (in fact an
+% anchor of that node) and a dotted line (we say ``minimal'' because, by
+% definition, a dotted line is not a continuous line and, therefore, this
+% distance may vary a little).
+%    \begin{macrocode}
+\dim_new:N \l_@@_xdots_shorten_dim
+\dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em }
+%    \end{macrocode}
+% 
+% \bigskip
+% The following dimension is the radius of the dots for the dotted lines (when
+% |line-style| is equal to |standard|, which is the initial value). The initial
+% value is 0.53~pt but it will be changed if the option |small| is used.
+%    \begin{macrocode}
+\dim_new:N \l_@@_radius_dim
+\dim_set:Nn \l_@@_radius_dim { 0.53 pt }
+%    \end{macrocode}
+%
+% \bigskip
+% The token list |\l_@@_xdots_line_style_tl| corresponds to the option |tikz| of the
+% commands |\Cdots|, |\Ldots|, etc. and of the options |line-style| for the
+% environments and |\NiceMatrixOptions|. The constant |\c_@@_standard_tl| will
+% be used in some tests.
+%    \begin{macrocode}
+\tl_new:N \l_@@_xdots_line_style_tl
+\tl_const:Nn \c_@@_standard_tl { standard }
+\tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl
+%    \end{macrocode}
+%
+% \bigskip
 % The boolean |\l_@@_light_syntax_bool| corresponds to the option |light-syntax|.
 %    \begin{macrocode}
 \bool_new:N \l_@@_light_syntax_bool
@@ -3643,7 +3895,7 @@
 %    \end{macrocode}
 % 
 % \bigskip
-% The token list |\l_@@_baseline_str| may contain one of the three values |t|,
+% The string |\l_@@_baseline_str| may contain one of the three values |t|,
 % |c| or |b| as in the option of the environment |{array}|. However, it may also
 % contain an integer (which represents the number of the row to which align the
 % array). 
@@ -3698,7 +3950,7 @@
 % 
 % 
 % \bigskip
-% The token list |\l_@@_name_str| will contain the optional name of the
+% The string |\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}
@@ -3723,13 +3975,6 @@
 \dim_new:N \l_@@_right_margin_dim
 %    \end{macrocode}
 %
-% \bigskip
-% The following dimensions will be used internally to compute the width of the
-% potential ``first column'' and ``last column''.
-%    \begin{macrocode}
-\dim_new:N \g_@@_width_last_col_dim
-\dim_new:N \g_@@_width_first_col_dim
-%    \end{macrocode}
 %                              
 % \bigskip
 % The dimensions |\l_@@_extra_left_margin_dim| and
@@ -3809,6 +4054,10 @@
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Global }
   {
+    cell-space-top-limit .dim_set:N = \l_@@_cell_space_top_limit_dim ,
+    cell-space-top-limit .value_required:n = true ,
+    cell-space-bottom-limit .dim_set:N = \l_@@_cell_space_bottom_limit_dim ,
+    cell-space-bottom-limit .value_required:n = true ,
     xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , 
     max-delimiter-width .bool_set:N = \l_@@_max_delimiter_width_bool ,
     light-syntax .bool_set:N = \l_@@_light_syntax_bool ,
@@ -3815,6 +4064,10 @@
     light-syntax .default:n = true , 
     end-of-row .tl_set:N = \l_@@_end_of_row_tl ,
     end-of-row .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 ,
     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 ,
@@ -3823,7 +4076,6 @@
     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 ,
     vlines .bool_set:N = \l_@@_vlines_bool ,
     hvlines .meta:n = { hlines , vlines } , 
@@ -3831,19 +4083,13 @@
 %    \end{macrocode}
 %
 % \bigskip
-% With the option |renew-dots|, the command |\cdots|, |\ldots|, |\vdots| and
-% |\ddots| are redefined and behave like the commands |\Cdots|, |\Ldots|,
-% |\Vdots| and |\Ddots|. 
+% With the option |renew-dots|, the command |\cdots|, |\ldots|, |\vdots|,
+% |\ddots|, etc. are redefined and behave like the commands |\Cdots|, |\Ldots|,
+% |\Vdots|, |\Ddots|, etc.
 %    \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}
-%
-% \bigskip
-% In some circonstancies, the ``medium nodes'' are created automatically, for
-% example when a dotted line has an ``open'' extremity (idem for the ``large nodes'').
-%    \begin{macrocode}
     create-medium-nodes .bool_set:N = \l_@@_medium_nodes_bool ,
     create-large-nodes .bool_set:N = \l_@@_large_nodes_bool ,
     create-extra-nodes .meta:n = 
@@ -3868,6 +4114,14 @@
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Env }
   {
+    code-before .code:n = 
+     { 
+       \tl_if_empty:nF { #1 } 
+         {
+           \tl_set:Nn \l_@@_code_before_tl { #1 }
+           \bool_set_true:N \l_@@_code_before_bool 
+         }
+     } ,
 %    \end{macrocode}
 % \bigskip
 % The options |c|, |t| and |b| of the environment |{NiceArray}| have the same
@@ -3900,10 +4154,6 @@
     name .value_required:n = true ,
     code-after .tl_gset:N = \g_@@_code_after_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}
 %
@@ -3925,6 +4175,12 @@
         NiceMatrix / Env ,
       } ,
     NiceMatrix / xdots .inherit:n = NiceMatrix / xdots ,
+    NiceTabular .inherit:n = 
+      {
+        NiceMatrix / Global ,
+        NiceMatrix / Env
+      } ,
+    NiceTabular / xdots .inherit:n = NiceMatrix / xdots ,
     NiceArray .inherit:n = 
       { 
         NiceMatrix / Global ,
@@ -3948,6 +4204,11 @@
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / NiceMatrixOptions }
   { 
+    last-col .code:n = \tl_if_empty:nF { #1 }
+                         { \@@_error:n { last-col~non~empty~for~NiceMatrixOptions } } 
+                       \int_zero:N \l_@@_last_col_int ,
+    small .bool_set:N = \l_@@_small_bool ,
+    small .value_forbidden:n = true ,
 %    \end{macrocode}
 %                              
 % With the option |renew-matrix|, the environment |{matrix}| of \pkg{amsmath}
@@ -3981,7 +4242,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% Usually, an error is raised when the user tries to give the same to name two
+% Usually, an error is raised when the user tries to give the same name to two
 % distincts environments of \pkg{nicematrix} (theses names are global and not
 % local to the current TeX scope). However, the option |allow-duplicate-names|
 % disables this feature. 
@@ -4041,6 +4302,11 @@
     r .code:n = \tl_set:Nn \l_@@_type_of_col_tl R ,
     L .code:n = \tl_set:Nn \l_@@_type_of_col_tl L ,
     R .code:n = \tl_set:Nn \l_@@_type_of_col_tl R ,
+    S .code:n = \bool_if:NTF \c_@@_siunitx_loaded_bool
+                  { \tl_set:Nn \l_@@_type_of_col_tl S }
+                  { \@@_error:n { option~S~without~siunitx } } ,
+    small .bool_set:N = \l_@@_small_bool ,
+    small .value_forbidden:n = true ,
     unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } 
   }
 %    \end{macrocode}
@@ -4060,6 +4326,8 @@
 % be used without value because the number of columns of the array is read
 % from the preamble of the array.
 %    \begin{macrocode}
+    small .bool_set:N = \l_@@_small_bool ,
+    small .value_forbidden:n = true ,
     last-col .code:n = \tl_if_empty:nF { #1 }
                          { \@@_error:n { last-col~non~empty~for~NiceArray } } 
                        \int_zero:N \l_@@_last_col_int ,
@@ -4077,13 +4345,23 @@
                          { \@@_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 ,
+    small .bool_set:N = \l_@@_small_bool ,
+    small .value_forbidden:n = true ,
     unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } 
   }
 %    \end{macrocode}
 %
+% \bigskip
+% We finalise the definition of the set of keys ``|NiceMatrix / NiceTabular|''
+% with the options specific to |{NiceTabular}|. 
 %
+%    \begin{macrocode}
+\keys_define:nn { NiceMatrix / NiceTabular }
+  {
+    unknown .code:n = \@@_error:n { Unknown~option~for~NiceTabular } 
+  }
+%    \end{macrocode}
+% 
 % \bigskip
 % \subsection*{Important code used by \{NiceArrayWithDelims\} }
 %
@@ -4110,12 +4388,15 @@
 %    \end{macrocode}
 % The content of the cell is composed in the box |\l_@@_cell_box| because we want
 % to compute some dimensions of the box. The |\hbox_set_end:| corresponding to
-% this |\hbox_set:Nw| will be in the |\@@_end_Cell:| (and the
+% this |\hbox_set:Nw| will be in the |\@@_end_Cell:| (and the potential
 % |\c_math_toggle_token| also).
 %    \begin{macrocode}
     \hbox_set:Nw \l_@@_cell_box 
-    \c_math_toggle_token
-    \bool_if:NT \l_@@_small_bool \scriptstyle 
+    \bool_if:NF \l_@@_NiceTabular_bool 
+      { 
+        \c_math_toggle_token
+        \bool_if:NT \l_@@_small_bool \scriptstyle 
+      }
 %    \end{macrocode}
 % 
 % We will call \emph{corners} of the matrix the cases which are at the
@@ -4158,12 +4439,12 @@
     \pgfrememberpicturepositiononpagetrue
     \pgfcoordinate 
       { \@@_env: - row - \int_use:N \c at iRow - base } 
-      \pgfpointorigin 
+      { \pgfpoint \c_zero_dim { 0.5 \arrayrulewidth } }
     \str_if_empty:NF \l_@@_name_str
       {
         \pgfnodealias 
+          { \l_@@_name_str - row - \int_use:N \c at iRow - base } 
           { \@@_env: - row - \int_use:N \c at iRow - base } 
-          { \l_@@_name_str - row - \int_use:N \c at iRow - base } 
       }
     \endpgfpicture
   }
@@ -4199,14 +4480,20 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_end_Cell:
   { 
-    \c_math_toggle_token 
+    \bool_if:NF \l_@@_NiceTabular_bool \c_math_toggle_token 
     \hbox_set_end:
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+    \box_set_ht:Nn \l_@@_cell_box
+      { \box_ht:N \l_@@_cell_box + \l_@@_cell_space_top_limit_dim }
+    \box_set_dp:Nn \l_@@_cell_box
+      { \box_dp:N \l_@@_cell_box + \l_@@_cell_space_bottom_limit_dim }
+%    \end{macrocode}
+%
 % We want to compute in |\g_@@_max_cell_width_dim| the width of the widest cell
 % of the array (except the cells of the ``first column'' and the ``last
 % column''). 
-% 
 %    \begin{macrocode}
     \dim_gset:Nn \g_@@_max_cell_width_dim
       { \dim_max:nn \g_@@_max_cell_width_dim { \box_wd:N \l_@@_cell_box } }
@@ -4242,10 +4529,7 @@
 % \end{itemize}
 %    \begin{macrocode}
     \bool_if:NTF \g_@@_empty_cell_bool
-      { 
-        \box_use_drop:N \l_@@_cell_box 
-        \bool_gset_false:N \g_@@_empty_cell_bool
-      }
+      { \box_use_drop:N \l_@@_cell_box }
       {
         \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim
           \@@_node_for_the_cell:
@@ -4300,13 +4584,13 @@
 % \begin{pNiceMatrix}
 % 1 & 2 & 3 & 4 \\
 % 5 & \Cdots & & 6 \\
-% 7 & \Cdots[color=red] \\
+% 7 & \Cdots[color=red] 
 % \end{pNiceMatrix}
 % \end{BVerbatim}
 % $\begin{pNiceMatrix}
 % 1 & 2 & 3 & 4 \\
 % 5 & \Cdots & & 6 \\
-% 7 & \Cdots[color=red] \\
+% 7 & \Cdots[color=red] 
 % \end{pNiceMatrix}$
 %
 % \smallskip
@@ -4322,29 +4606,23 @@
 % 
 % 
 % \bigskip
-% We begin with a test of the flag |\c_@@_draft_bool| because, if the key
-% |draft| is used, the dotted lines are not drawn.
 %    \begin{macrocode}
-\bool_if:NTF \c_@@_draft_bool
-  { \cs_set_protected:Npn \@@_instruction_of_type:nn #1 #2 { } }
-  {
-    \cs_new_protected:Npn \@@_instruction_of_type:nn #1 #2
-      { 
+\cs_new_protected:Npn \@@_instruction_of_type:nn #1 #2
+  { 
 %    \end{macrocode}
 % It's important to use a |\tl_gput_right:cx| and not a |\tl_gput_left:cx|
 % because we want the |\Ddots| lines to be drawn in the order of appearance
 % in the array (for parallelisation).
 %    \begin{macrocode}
-        \tl_gput_right:cx 
-          { g_@@_ #1 _ lines _ tl }
-          { 
-            \use:c { @@ _ draw _ #1 : nnn }
-              { \int_use:N \c at iRow } 
-              { \int_use:N \c at jCol }
-              { \exp_not:n { #2 } } 
-          }
-      }  
-  }
+    \tl_gput_right:cx 
+      { g_@@_ #1 _ lines _ tl }
+      { 
+        \use:c { @@ _ draw _ #1 : nnn }
+          { \int_use:N \c at iRow } 
+          { \int_use:N \c at jCol }
+          { \exp_not:n { #2 } } 
+      }
+  }  
 %    \end{macrocode}
 %
 %  
@@ -4380,58 +4658,126 @@
 % |\ialign| in the environment |{NiceArrayWithDelims}| but restore the standard
 % version for use in the cells of the array.
 %    \begin{macrocode}
-\cs_set_eq:NN \@@_standard_ialign: \ialign
+\cs_set_eq:NN \@@_old_ialign: \ialign
 %    \end{macrocode}
 % 
-% \bigskip
-% The following must \emph{not} be protected because it begins with |\noalign|. 
-%    \begin{macrocode}
-\cs_new:Npn \@@_everycr: { \noalign { \@@_everycr_i: } }
-%    \end{macrocode}
 %
+% The following command creates a |row| node (and not a row of nodes!).
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_everycr_i:
-  { 
-    \int_gzero:N \c at jCol 
+\cs_new_protected:Npn \@@_create_row_node:
+  {
 %    \end{macrocode}
 % The |\hbox:n| (or |\hbox|) is mandatory.
 %    \begin{macrocode}
     \hbox
       {
+        \bool_if:NT \l_@@_code_before_bool
+          { 
+            \vtop
+              {
+                \skip_vertical:N 0.5\arrayrulewidth 
+                \pgfsys at markposition { \@@_env: - row - \@@_succ:n \c at iRow } 
+                \skip_vertical:N -0.5\arrayrulewidth 
+              }
+          }  
         \pgfpicture 
         \pgfrememberpicturepositiononpagetrue
         \pgfcoordinate { \@@_env: - row - \@@_succ:n \c at iRow }  
-          \pgfpointorigin 
+          { \pgfpoint \c_zero_dim { - 0.5 \arrayrulewidth } } 
         \str_if_empty:NF \l_@@_name_str
           {
             \pgfnodealias 
-              { \@@_env: - row - \int_use:N \c at iRow - row } 
-              { \l_@@_name_str - row - \int_use:N \c at iRow - row } 
+              { \l_@@_name_str - row - \int_use:N \c at iRow } 
+              { \@@_env: - row - \int_use:N \c at iRow } 
           }   
         \endpgfpicture  
-      }
+      }  
+  }
 %    \end{macrocode}
-% We add the potential horizontal lines specified by the option |hlines|.
+%
+% 
+%
+% \bigskip
+% The following must \emph{not} be protected because it begins with |\noalign|. 
 %    \begin{macrocode}
-    \bool_if:NT \l_@@_hlines_bool
+\cs_new:Npn \@@_everycr: { \noalign { \@@_everycr_i: } }
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_everycr_i:
+  { 
+    \int_gzero:N \c at jCol 
+    \bool_if:NF \g_@@_row_of_col_done_bool
       {
+        \@@_create_row_node:
 %    \end{macrocode}
+% We add the potential horizontal lines specified by the option |hlines|.
+%    \begin{macrocode}
+        \bool_if:NT \l_@@_hlines_bool
+          {
+%    \end{macrocode}
 % The counter |\c at 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 \c at iRow > { -1 }
-          {
-            \bool_if:NF \g_@@_row_of_col_done_bool
+            \int_compare:nNnT \c at iRow > { -1 }
               {
                 \int_compare:nNnF \c at iRow = \l_@@_last_row_int 
-                  {
-                    \bool_if:NTF \c_@@_colortbl_loaded_bool
-                      { { \CT at arc@ \hrule height \arrayrulewidth } } 
-                      { \hrule height \arrayrulewidth } 
-                  }
-              }
+%    \end{macrocode}
+% The command |\CT at arc@| is a command of \pkg{colortbl} which sets the color of
+% the rules in the array. The package \pkg{nicematrix} uses it even if
+% \pkg{colortbl} is not loaded. We use a TeX group in order to limit the scope
+% of |\CT at arc@|.
+%    \begin{macrocode}
+                  { { \CT at arc@ \hrule height \arrayrulewidth } }
+              } 
+          }
+      }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% The command |\@@_newcolumntype| is the command |\newcolumntype| of
+% \pkg{array} without the warnings for redefinitions of columns types (we will
+% use it to redefine the columns types |w|, |W|, |p|, |m| and |b|).
+%    \begin{macrocode}
+\cs_set_protected:Npn \@@_newcolumntype #1
+  {
+    \cs_if_free:cT { NC @ find @ #1 }
+      { \NC at list \expandafter { \the \NC at list \NC at do #1 } }
+    \cs_set:cpn {NC @ find @ #1 } ##1 #1 { \NC@ { ##1 } }
+    \peek_meaning:NTF [ 
+      { \newcol@ #1 }
+      { \newcol@ #1 [ 0 ] }
+  }
+%    \end{macrocode}
+% 
+%
+% \bigskip
+% The following command will be used to redefine the column types |p|, |m| and
+% |b|. That means that it will be used three times. The first argument is the
+% letter of the column type (|p|, |m| or |b|). The second is the letter of
+% position for the environment |{minipage}| (|t|, |c| or |b|).
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_define_columntype:nn #1 #2
+  {
+%    \end{macrocode}
+% We don't want a warning for redefinition of the column type. That's why we use
+% |\@@_newcolumntype| and not |\newcolumntype|.
+%    \begin{macrocode}
+    \@@_newcolumntype #1 [ 1 ] 
+      { 
+        > { 
+            \@@_Cell: 
+            \begin { minipage } [ #2 ] { ##1 } 
+            \mode_leave_vertical: \box_use:N \@arstrutbox 
           } 
+%    \end{macrocode}
+% Here, we put |c| but we would have the result with |l| or |r|.
+%    \begin{macrocode}
+        c 
+        < { \box_use:N \@arstrutbox \end { minipage } \@@_end_Cell: } 
       }
   }
 %    \end{macrocode}
@@ -4444,12 +4790,26 @@
 %   \begin{macrocode}
 \cs_new_protected:Npn \@@_pre_array:
   {
+%    \end{macrocode}
+% If \pkg{booktabs} is loaded, we have to patch the macro |\@BTnormal| which is
+% a macro of \pkg{booktabs}. The macro |\@BTnormal| draws an horizontal rule but
+% it occurs after a vertical skip done by a low level TeX command. When this
+% macro |\@BTnormal| occurs, the |row| node has yet been inserted by
+% \pkg{nicematrix} \emph{before} the vertical skip (and thus, at a wrong place).
+% That why we decide to create a new |row| node (for the same row). We patch the
+% macro |\@BTnormal| to create this |row| node. This new |row| node will
+% overwrite the previous definition of that |row| node and we have managed to
+% avoid the error messages of that redefinition
+% \footnote{cf. |\nicematrix at redefine@check at rerun|}.
+%    \begin{macrocode}
+    \bool_if:NT \c_@@_booktabs_loaded_bool
+      { \tl_put_left:Nn \@BTnormal \@@_create_row_node: }
     \box_clear_new:N \l_@@_cell_box
     \cs_if_exist:NT \theiRow
-      { \int_set_eq:NN \l_@@_save_iRow_int \c at iRow }
+      { \int_set_eq:NN \l_@@_old_iRow_int \c at iRow }
     \int_gzero_new:N \c at iRow
     \cs_if_exist:NT \thejCol
-      { \int_set_eq:NN \l_@@_save_jCol_int \c at jCol }
+      { \int_set_eq:NN \l_@@_old_jCol_int \c at jCol }
     \int_gzero_new:N \c at jCol
     \normalbaselines
 %    \end{macrocode}
@@ -4475,6 +4835,8 @@
 %    \begin{macrocode}
     \cs_set:Npn \ialign 
       { 
+        \bool_if:NT \l_@@_NiceTabular_bool 
+          { \dim_set_eq:NN \arraycolsep \@@_old_arraycolsep_dim }
         \bool_if:NTF \c_@@_colortbl_loaded_bool
           {
             \CT at everycr 
@@ -4513,31 +4875,24 @@
 % After its first use, the definition of |\ialign| will revert
 % automatically to its default definition. With this programmation, we will
 % have, in the cells of the array, a clean version of |\ialign|.\footnote{The
-% user will probably not employ directly |\ialign| in the array...  but more
+% user will probably not use directly |\ialign| in the array...  but more
 % likely environments that utilize |\ialign| internally (e.g.: |{substack}|).}
 %    \begin{macrocode}
-        \cs_set_eq:NN \ialign \@@_standard_ialign:
+        \cs_set_eq:NN \ialign \@@_old_ialign:
         \halign 
       }
 %    \end{macrocode}
 %                                                   
-% 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}
-    \newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
-    \newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
-    \newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
-%    \end{macrocode}    
 % We keep in memory the old versions or |\ldots|, |\cdots|, etc. only because we
 % use them inside |\phantom| commands in order that the new commands |\Ldots|,
 % |\Cdots|, etc. give the same spacing (except when the option |nullify-dots| is
 % used). 
 %    \begin{macrocode}
-    \cs_set_eq:NN \@@_ldots \ldots
-    \cs_set_eq:NN \@@_cdots \cdots
-    \cs_set_eq:NN \@@_vdots \vdots
-    \cs_set_eq:NN \@@_ddots \ddots
-    \cs_set_eq:NN \@@_iddots \iddots
+    \cs_set_eq:NN \@@_old_ldots \ldots
+    \cs_set_eq:NN \@@_old_cdots \cdots
+    \cs_set_eq:NN \@@_old_vdots \vdots
+    \cs_set_eq:NN \@@_old_ddots \ddots
+    \cs_set_eq:NN \@@_old_iddots \iddots
     \cs_set_eq:NN \firsthline \hline
     \cs_set_eq:NN \lasthline \hline
     \cs_set_eq:NN \Ldots \@@_Ldots
@@ -4548,11 +4903,14 @@
     \cs_set_eq:NN \hdottedline \@@_hdottedline:
     \cs_set_eq:NN \Hspace \@@_Hspace:
     \cs_set_eq:NN \Hdotsfor \@@_Hdotsfor:
+    \cs_set_eq:NN \Vdotsfor \@@_Vdotsfor:
     \cs_set_eq:NN \multicolumn \@@_multicolumn:nnn
     \cs_set_eq:NN \Block \@@_Block:
     \cs_set_eq:NN \rotate \@@_rotate:
     \cs_set_eq:NN \OnlyMainNiceMatrix \@@_OnlyMainNiceMatrix:n
+    \cs_set_eq:NN \dotfill \@@_dotfill:
     \cs_set_eq:NN \CodeAfter \@@_CodeAfter:n
+    \cs_set_eq:NN \slashbox \@@_slashbox:nn
     \bool_if:NT \l_@@_renew_dots_bool
       { 
         \cs_set_eq:NN \ldots \@@_Ldots
@@ -4604,14 +4962,31 @@
     \cs_set_eq:NN \@ifnextchar \new at 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
-% |\prg_do_nothing:|.
+% \bigskip
+% 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}|. We use |\@@_newcolumntype|
+% because it will be slightly quicker thant |\newcolumtype|.
 %    \begin{macrocode}
-    \cs_set_eq:NN \NC at find@w \relax
-    \cs_set_eq:NN \NC at find@W \relax
-    \newcolumntype w [ 2 ]
+    \@@_newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
+    \@@_newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
+    \@@_newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
+%    \end{macrocode}
+%
+% \bigskip
+% We redefine the column types |p|, |m| and |b|. The command
+% |\@@_define_columntype:nn| is only used here.
+%    \begin{macrocode}
+    \@@_define_columntype:nn p t
+    \@@_define_columntype:nn m c
+    \@@_define_columntype:nn b b
+%    \end{macrocode}    
+%
+% \bigskip
+% We redefine the column types |w| and |W|. We use |\@@_newcolumntype| instead
+% of |\newcolumtype| because we don't want warnings for column types already
+% defined. 
+%    \begin{macrocode}
+    \@@_newcolumntype w [ 2 ]
       {
         > {
             \hbox_set:Nw \l_@@_cell_box
@@ -4630,7 +5005,7 @@
                { \box_use_drop:N \l_@@_cell_box }  
           }
       }
-    \newcolumntype W [ 2 ]
+    \@@_newcolumntype W [ 2 ]
       {
         > {
             \hbox_set:Nw \l_@@_cell_box
@@ -4726,7 +5101,7 @@
     \tl_gclear_new:N \g_@@_Vdots_lines_tl
     \tl_gclear_new:N \g_@@_Ddots_lines_tl
     \tl_gclear_new:N \g_@@_Iddots_lines_tl
-    \tl_gclear_new:N \g_@@_Hdotsfor_lines_tl
+    \tl_gclear_new:N \g_@@_HVdotsfor_lines_tl
  }
 %    \end{macrocode}
 % 
@@ -4742,7 +5117,9 @@
     \str_if_empty:NT \g_@@_name_env_str 
       { \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } } 
     \@@_adapt_S_column:
-    \@@_test_if_math_mode:
+    \bool_if:NTF \l_@@_NiceTabular_bool 
+      \mode_leave_vertical:
+      \@@_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}
@@ -4785,6 +5162,98 @@
     { #3 , #5 } 
 %    \end{macrocode}
 % 
+% \bigskip
+% If the key |code-before| is used, we have to create the |col| nodes and the
+% |row| nodes before the creation of the array. First, we have to test whether
+% the size of the array has been written in the |aux| file in a previous run. In 
+% this case, a command |\@@_size_|{\slshape\ttfamily nb_of_env}|:| has been
+% created. 
+%    \begin{macrocode}
+    \bool_if:NT \l_@@_code_before_bool
+      { 
+        \seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq }
+          { 
+%    \end{macrocode}
+% First, we give values to the LaTeX counters |iRow| and |jCol|. We remind that,
+% in the |code-before| (and in the |code-after|) they represent the numbers of
+% rows and columns of the array (without the potential last row and last column).
+%    \begin{macrocode}
+            \int_zero_new:N \c at iRow
+            \int_set:Nn \c at iRow
+              { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 }
+            \int_zero_new:N \c at jCol
+            \int_set:Nn \c at jCol
+              { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 }
+%    \end{macrocode}
+% We have to adjust the values of |\c at iRow| and |\c at jCol| to take into account
+% the potential last row and last column. A value of $-2$ for
+% |\l_@@_last_row_int| means that there is no last row. Idem for the columns.
+%    \begin{macrocode}
+            \int_compare:nNnF \l_@@_last_row_int = { -2 } 
+              { \int_decr:N \c at iRow } 
+            \int_compare:nNnF \l_@@_last_col_int = { -2 } 
+              { \int_decr:N \c at jCol } 
+%    \end{macrocode}
+%
+% Now, we will create all the |col| nodes and |row| nodes with the informations
+% written in the |aux| file. You use the technique described in the page~1229 of
+% |pgfmanual.pdf|, version~3.1.4b.
+%    \begin{macrocode}
+            \pgfsys at markposition { \@@_env: - position }
+            \pgfsys at getposition { \@@_env: - position } \@@_picture_position: 
+            \pgfpicture
+%    \end{macrocode}
+% First, the creation of the |row| nodes.
+%    \begin{macrocode}
+            \int_step_inline:nnn 
+              { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 1 }
+              { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 + 1 }
+              {
+                \pgfsys at getposition { \@@_env: - row - ##1 } \@@_node_position:
+                \pgfcoordinate { \@@_env: - row - ##1 }
+                  { \pgfpointdiff \@@_picture_position: \@@_node_position: }
+              }
+%    \end{macrocode}
+% Now, the creation of the |col| nodes.
+%    \begin{macrocode}
+            \int_step_inline:nnn 
+              { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 3 }
+              { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 + 1 }
+              {
+                \pgfsys at getposition { \@@_env: - col - ##1 } \@@_node_position:
+                \pgfcoordinate { \@@_env: - col - ##1 }
+                  { \pgfpointdiff \@@_picture_position: \@@_node_position: }
+              }
+            \endpgfpicture
+            \group_begin:
+              \bool_if:NT \c_@@_tikz_loaded_bool
+                {  
+%    \end{macrocode}
+% Be careful: we must \emph{not} put ``|remember picture|'' in the |\pgfset|.
+%    \begin{macrocode}
+                  \pgfset 
+                    { 
+                      every~picture / .style = 
+                       { overlay , name~prefix = \@@_env: - }
+                    }  
+                }  
+              \cs_set_eq:NN \cellcolor \@@_cellcolor:nn
+              \cs_set_eq:NN \rectanglecolor \@@_rectanglecolor:nnn
+              \cs_set_eq:NN \rowcolor \@@_rowcolor:nn
+              \cs_set_eq:NN \rowcolors \@@_rowcolors:nnn
+              \cs_set_eq:NN \columncolor \@@_columncolor:nn
+              \cs_set_eq:NN \chessboardcolors \@@_chessboardcolors:nn
+%    \end{macrocode}
+% We compose the |code-before| in math mode in order to nullify the spaces put
+% by the user between instructions in the |code-before|.
+%    \begin{macrocode}
+              \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
+              \l_@@_code_before_tl 
+              \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
+            \group_end:
+          }
+      }
+%    \end{macrocode}
 % 
 % A value of $-1$ for the counter |\l_@@_last_row_int| means that the user has
 % used the option |last-row| without value, that is to say without specifying
@@ -4897,6 +5366,7 @@
         \bool_lazy_all:nT 
           { 
             \l_@@_NiceArray_bool 
+            { \bool_not_p:n \l_@@_NiceTabular_bool }
             { \bool_not_p:n \l_@@_vlines_bool } 
             { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
           }
@@ -4908,6 +5378,7 @@
         \bool_lazy_all:nT
           { 
             \l_@@_NiceArray_bool 
+            { \bool_not_p:n \l_@@_NiceTabular_bool }
             { \bool_not_p:n \l_@@_vlines_bool }
             { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
           }
@@ -4921,6 +5392,22 @@
 %    \begin{macrocode}
     \hbox_set:Nw \l_@@_the_array_box
 %    \end{macrocode}
+% Here is a trick. We will call |\array| and, at the beginning, |\array| will set
+% |\col at sep| equal to the current value of |\arraycolsep|. In we are in an
+% environment |{NiceTabular}|, we would like that |\array| sets |\col at sep| equal
+% to the current value of |\tabcolsep|. That's why we set |\arraycolsep| equal
+% to |\tabcolsep|. However, the value of |\tabcolsep| in each cell of the array
+% should be equal to the current value of |\tabcolsep| outside |{NiceTabular}|.
+% That's why we save the current value of |\arraycolsep| and we will restore the
+% value just before the |\halign|. It's possible because we do a redefinition of
+% |\ialign| (see just below).
+%    \begin{macrocode}
+    \bool_if:NT \l_@@_NiceTabular_bool 
+      { 
+        \dim_set_eq:NN \@@_old_arraycolsep_dim \arraycolsep
+        \dim_set_eq:NN \arraycolsep \tabcolsep 
+      }
+%    \end{macrocode}
 % If the key |\vlines| is used, we increase |\arraycolsep| by
 % |0.5\arrayrulewidth| in order to reserve space for the width of the vertical
 % rules drawn with Tikz after the end of the array. However, the first
@@ -4932,12 +5419,16 @@
         \dim_add:Nn \arraycolsep { 0.5 \arrayrulewidth } 
         \skip_horizontal:N  0.5\arrayrulewidth  
       }
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
     \skip_horizontal:N \l_@@_left_margin_dim 
     \skip_horizontal:N \l_@@_extra_left_margin_dim 
     \c_math_toggle_token
     \bool_if:NTF \l_@@_light_syntax_bool
-      { \begin { @@-light-syntax } }
-      { \begin { @@-normal-syntax } } 
+      { \use:c { @@-light-syntax } }
+      { \use:c { @@-normal-syntax } }
   }
 %    \end{macrocode}
 %
@@ -4945,8 +5436,8 @@
 %    \begin{macrocode}
   {  
     \bool_if:NTF \l_@@_light_syntax_bool
-      { \end { @@-light-syntax } }
-      { \end { @@-normal-syntax } }
+      { \use:c { end @@-light-syntax } }
+      { \use:c { end @@-normal-syntax } }
     \c_math_toggle_token
     \skip_horizontal:N \l_@@_right_margin_dim 
     \skip_horizontal:N \l_@@_extra_right_margin_dim 
@@ -4964,7 +5455,7 @@
 %
 % \bigskip
 % It the user has used the key |last-row| with a value, we control that the
-% given value is correct (since we have just contructed the array, we know the
+% given value is correct (since we have just constructed the array, we know the
 % real number of rows of the array).
 %    \begin{macrocode}
     \int_compare:nNnT \l_@@_last_row_int > { -2 }
@@ -5027,9 +5518,9 @@
         \str_if_eq:VnTF \l_@@_baseline_str { b }
           { 
            \pgfpicture
-             \@@_qpoint: { row - 1 } 
+             \@@_qpoint:n { row - 1 } 
              \dim_gset_eq:NN \g_tmpa_dim \pgf at y
-             \@@_qpoint: { row - \int_use:N \c at iRow - base }
+             \@@_qpoint:n { row - \int_use:N \c at iRow - base }
              \dim_gsub:Nn \g_tmpa_dim \pgf at y
            \endpgfpicture
            \int_compare:nNnT \l_@@_first_row_int = 0 
@@ -5063,9 +5554,9 @@
                     \int_set:Nn \l_tmpa_int 1
                   }
                 \pgfpicture
-                \@@_qpoint: { row - 1 } 
+                \@@_qpoint:n { row - 1 } 
                 \dim_gset_eq:NN \g_tmpa_dim \pgf at y
-                \@@_qpoint: { row - \int_use:N \l_tmpa_int - base }
+                \@@_qpoint:n { row - \int_use:N \l_tmpa_int - base }
                 \dim_gsub:Nn \g_tmpa_dim \pgf at y
                 \endpgfpicture
                 \int_compare:nNnT \l_@@_first_row_int = 0 
@@ -5122,9 +5613,13 @@
                 \skip_vertical:N -\l_tmpa_dim 
                 \hbox
                   {
-                    \skip_horizontal:N -\arraycolsep 
+                    \bool_if:NTF \l_@@_NiceTabular_bool
+                      { \skip_horizontal:N -\tabcolsep }
+                      { \skip_horizontal:N -\arraycolsep }
                     \box_use_drop:N \l_@@_the_array_box
-                    \skip_horizontal:N -\arraycolsep 
+                    \bool_if:NTF \l_@@_NiceTabular_bool
+                      { \skip_horizontal:N -\tabcolsep }
+                      { \skip_horizontal:N -\arraycolsep }
                   }
 %    \end{macrocode}
 % We take into account the ``last row'' (we have previously computed its total
@@ -5203,9 +5698,9 @@
         \int_set:Nn \l_tmpa_int 1
       }
     \pgfpicture
-      \@@_qpoint: { row - 1 } 
+      \@@_qpoint:n { row - 1 } 
       \dim_gset_eq:NN \g_tmpa_dim \pgf at y
-      \@@_qpoint: { row - \@@_succ:n \c at iRow }
+      \@@_qpoint:n { row - \@@_succ:n \c at iRow }
       \dim_gadd:Nn \g_tmpa_dim \pgf at y
       \dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim }
 %    \end{macrocode}
@@ -5212,7 +5707,7 @@
 % Now, |\g_tmpa_dim| contains the $y$-value of the center of the array (the
 % delimiters are centered in relation with this value).
 %    \begin{macrocode}
-      \@@_qpoint: { row - \int_use:N \l_tmpa_int - base }
+      \@@_qpoint:n { row - \int_use:N \l_tmpa_int - base }
       \dim_gsub:Nn \g_tmpa_dim \pgf at y
 %    \end{macrocode}
 % We take into account the position of the mathematical axis.
@@ -5314,6 +5809,7 @@
 % \bigskip
 % When the key |light-syntax| is used, we use an environment which takes its whole
 % body as an argument (with the specifier |b| of \pkg{xparse}). 
+% % \label{code-light-syntax}
 %    \begin{macrocode}
 \NewDocumentEnvironment { @@-light-syntax } { b }
   { 
@@ -5331,9 +5827,32 @@
           { \@@_fatal:n { double-backslash~in~light-syntax } }
       }
 %    \end{macrocode}
-% The body of the environment, which is stored in the argument |#1|, is now
-% splitted into items (and \emph{not} tokens) 
+% Now, you extract the |code-after| or the body of the environment. Maybe, there
+% is no command |\CodeAfter| in the body. That's why you put a marker
+% |\CodeAfter| after |#1|. If there is yet a |\CodeAfter| in |#1|, this second
+% (or third...) |\CodeAfter| will be catched in the value of
+% |\g_@@_code_after_tl|. That doesn't matter because |\CodeAfter| will be set to 
+% \textsl{no-op} before the execution of |\g_@@_code_after_tl|.
 %    \begin{macrocode}
+    \@@_light_syntax_i #1 \CodeAfter \q_stop
+  }
+%    \end{macrocode}
+% Now, the second part of the environment. It is empty. That's not surprising
+% because we have caught the whole body of the environment with the specifier
+% |b| provided by \pkg{xparse}.
+%    \begin{macrocode}
+  { }
+%    \end{macrocode}
+%
+% 
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_light_syntax_i #1\CodeAfter #2\q_stop 
+  {
+    \tl_gput_right:Nn \g_@@_code_after_tl { #2 }
+%    \end{macrocode}
+% The body of the array, which is stored in the argument |#1|, is now
+% splitted into items (and \emph{not} tokens).
+%    \begin{macrocode}
     \seq_gclear_new:N \g_@@_rows_seq
     \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl
     \exp_args:NNV \seq_gset_split:Nnn \g_@@_rows_seq \l_@@_end_of_row_tl { #1 }
@@ -5361,11 +5880,10 @@
     \endarray
   }
 %    \end{macrocode}
-% Now, the second part of the environment. It is empty. That's not surprising
-% because we have caught the whole body of the environment with the specifier
-% |b| provided by \pkg{xparse}.
+% 
 %    \begin{macrocode}
-  { }
+\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
+  { \tl_if_empty:nF { #1 } { \\ \@@_line_with_light_syntax_i:n { #1 } } } 
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -5375,22 +5893,10 @@
     \seq_gset_split:Nnn \g_@@_cells_seq { ~ } { #1 }
     \seq_gpop_left:NN \g_@@_cells_seq \l_tmpa_tl
     \l_tmpa_tl
-    \seq_map_function:NN \g_@@_cells_seq \@@_cell_with_light_syntax:n
+    \seq_map_inline:Nn \g_@@_cells_seq { & ##1 }
   }
 %    \end{macrocode}
-% 
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
-  { 
-    \tl_if_empty:nF { #1 }
-      { \\ \@@_line_with_light_syntax_i:n { #1 } }
-  } 
-%    \end{macrocode}
 %
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_cell_with_light_syntax:n #1 { & #1 }
-%    \end{macrocode}
-% 
 % \bigskip
 % The following command is used by the code which detects whether the
 % environment is empty (we raise a fatal error in this case: it's only a
@@ -5410,7 +5916,7 @@
 %
 % \bigskip
 % The command |\@@_create_col_nodes:| will construct a special last row.
-% That last row is a false row used to create the |col|-nodes and to fix the
+% That last row is a false row used to create the |col| nodes and to fix the
 % width of the columns (when the array is constructed with an option which
 % specify the width of the columns).
 %    \begin{macrocode}
@@ -5421,12 +5927,14 @@
     \int_compare:nNnT \l_@@_first_col_int = 0 
       { 
         \omit 
-        \skip_horizontal:N -2\arraycolsep
+        \skip_horizontal:N  -2\col at sep 
+        \bool_if:NT \l_@@_code_before_bool
+          { \pgfsys at markposition { \@@_env: - col - 0 } } 
         \pgfpicture 
         \pgfrememberpicturepositiononpagetrue
         \pgfcoordinate { \@@_env: - col - 0 } \pgfpointorigin 
         \str_if_empty:NF \l_@@_name_str
-          { \pgfnodealias { \@@_env: - col - 0 } { \l_@@_name_str - col - 0 } }  
+          { \pgfnodealias { \l_@@_name_str - col - 0 } { \@@_env: - col - 0 } }  
         \endpgfpicture
         & 
       }
@@ -5436,15 +5944,46 @@
 %    \begin{macrocode}
     \bool_gset_true:N \g_@@_row_of_col_done_bool
 %    \end{macrocode}
-% First, we put a ``|col|'' node on the left of the first column (of course, we
+% 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}
-    \pgfpicture 
-    \pgfrememberpicturepositiononpagetrue
-    \pgfcoordinate { \@@_env: - col - 1 } \pgfpointorigin 
-    \str_if_empty:NF \l_@@_name_str
-      { \pgfnodealias { \@@_env: - col - 1 } { \l_@@_name_str - col - 1 } }  
-    \endpgfpicture
+    \int_compare:nNnTF \l_@@_first_col_int = 0 
+      {
+        \bool_if:NT \l_@@_code_before_bool
+          { 
+            \hbox
+              {
+                \skip_horizontal:N -0.5\arrayrulewidth 
+                \pgfsys at markposition { \@@_env: - col - 1 } 
+                \skip_horizontal:N 0.5\arrayrulewidth 
+              }
+          } 
+        \pgfpicture 
+        \pgfrememberpicturepositiononpagetrue
+        \pgfcoordinate { \@@_env: - col - 1 } 
+          { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim } 
+        \str_if_empty:NF \l_@@_name_str
+          { \pgfnodealias { \l_@@_name_str - col - 1 } { \@@_env: - col - 1 } }  
+        \endpgfpicture
+      }
+      {
+        \bool_if:NT \l_@@_code_before_bool
+          { 
+            \hbox
+              {
+                \skip_horizontal:N 0.5 \arrayrulewidth
+                \pgfsys at markposition { \@@_env: - col - 1 } 
+                \skip_horizontal:N -0.5\arrayrulewidth 
+              }
+          } 
+        \pgfpicture 
+        \pgfrememberpicturepositiononpagetrue
+        \pgfcoordinate { \@@_env: - col - 1 } 
+          { \pgfpoint { 0.5 \arrayrulewidth } \c_zero_dim }       
+        \str_if_empty:NF \l_@@_name_str
+          { \pgfnodealias { \l_@@_name_str - col - 1 } { \@@_env: - col - 1 } }  
+        \endpgfpicture
+      }
 %    \end{macrocode}
 % We compute in |\g_tmpa_skip| the common width of the columns (it's a skip and
 % not a dimension). We use a global variable because we are in a cell of an
@@ -5465,16 +6004,26 @@
           { \bool_not_p:n \l_@@_block_auto_columns_width_bool }
           { \skip_gset_eq:NN \g_tmpa_skip \g_@@_max_cell_width_dim } 
           { \skip_gset_eq:NN \g_tmpa_skip \l_@@_columns_width_dim } 
-        \skip_gadd:Nn \g_tmpa_skip { 2 \arraycolsep } 
+        \skip_gadd:Nn \g_tmpa_skip { 2 \col at sep } 
       }
     \skip_horizontal:N \g_tmpa_skip
     \hbox
       { 
+        \bool_if:NT \l_@@_code_before_bool
+          { 
+            \hbox
+              {
+                \skip_horizontal:N -0.5\arrayrulewidth 
+                \pgfsys at markposition { \@@_env: - col - 2 } 
+                \skip_horizontal:N 0.5\arrayrulewidth 
+              }
+          }   
         \pgfpicture 
         \pgfrememberpicturepositiononpagetrue
-        \pgfcoordinate { \@@_env: - col - 2 } \pgfpointorigin 
+        \pgfcoordinate { \@@_env: - col - 2 } 
+          { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim } 
         \str_if_empty:NF \l_@@_name_str
-          { \pgfnodealias { \@@_env: - col - 2 } { \l_@@_name_str - col - 2 } } 
+          { \pgfnodealias { \l_@@_name_str - col - 2 } { \@@_env: - col - 2 } } 
         \endpgfpicture
       }
 %    \end{macrocode}
@@ -5486,32 +6035,45 @@
       { \prg_replicate:nn { \g_@@_col_total_int - 2 } }
       { \prg_replicate:nn { \g_@@_col_total_int - 1 } }
       { 
-         & 
-         \omit
+        & 
+        \omit
 %    \end{macrocode}
 % 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_skip
+        \int_gincr:N \g_tmpa_int 
+        \skip_horizontal:N \g_tmpa_skip
+        \bool_if:NT \l_@@_code_before_bool
+          { 
+            \hbox
+              {
+                \skip_horizontal:N -0.5\arrayrulewidth
+                \pgfsys at markposition { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
+                \skip_horizontal:N 0.5\arrayrulewidth 
+              }
+          }   
 %    \end{macrocode}
-% We create the ``|col|'' node on the right of the current column.
+% We create the |col| node on the right of the current column.
 %    \begin{macrocode}
-         \pgfpicture
-           \pgfrememberpicturepositiononpagetrue
-           \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
-             \pgfpointorigin 
-           \str_if_empty:NF \l_@@_name_str
-             {
-               \pgfnodealias 
-                 { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
-                 { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int }
-             }   
-         \endpgfpicture  
+        \pgfpicture
+          \pgfrememberpicturepositiononpagetrue
+          \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
+            { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim } 
+          \str_if_empty:NF \l_@@_name_str
+            {
+              \pgfnodealias 
+                { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int }
+                { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
+            }   
+        \endpgfpicture  
       }
     \bool_if:NT \g_@@_last_col_found_bool
       {
-        \skip_horizontal:N 2\arraycolsep
+        \bool_if:NT \l_@@_code_before_bool
+          { 
+            \pgfsys at markposition { \@@_env: - col - \@@_succ:n \g_@@_col_total_int }
+          } 
+        \skip_horizontal:N 2\col at sep
         \pgfpicture 
         \pgfrememberpicturepositiononpagetrue
         \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } 
@@ -5519,11 +6081,11 @@
         \str_if_empty:NF \l_@@_name_str
           { 
             \pgfnodealias 
+              { \l_@@_name_str - col - \@@_succ:n \g_@@_col_total_int } 
               { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } 
-              { \l_@@_name_str - col - \@@_succ:n \g_@@_col_total_int } 
           }  
         \endpgfpicture
-        \skip_horizontal:N -2\arraycolsep
+        \skip_horizontal:N -2\col at sep
       }
     \cr
   }
@@ -5544,7 +6106,7 @@
 % have to compute some dimensions of this box.
 %    \begin{macrocode}
         \hbox_set:Nw \l_@@_cell_box 
-        \c_math_toggle_token
+        \bool_if:NF \l_@@_NiceTabular_bool \c_math_toggle_token
         \bool_if:NT \l_@@_small_bool \scriptstyle
 %    \end{macrocode}
 % We insert |\l_@@_code_for_first_col_tl|... but we don't insert it in the
@@ -5569,7 +6131,7 @@
     l
     < 
       { 
-        \c_math_toggle_token
+        \bool_if:NF \l_@@_NiceTabular_bool \c_math_toggle_token
         \hbox_set_end:
         \@@_update_for_first_and_last_row:
 %    \end{macrocode}
@@ -5591,7 +6153,7 @@
             \skip_horizontal:N \l_@@_left_margin_dim 
             \skip_horizontal:N \l_@@_extra_left_margin_dim
           }
-        \skip_horizontal:N -2\arraycolsep 
+        \skip_horizontal:N -2\col at sep 
       }
   }
 %    \end{macrocode}
@@ -5616,7 +6178,7 @@
 % have to compute some dimensions of this box.
 %    \begin{macrocode}
         \hbox_set:Nw \l_@@_cell_box 
-          \c_math_toggle_token
+          \bool_if:NF \l_@@_NiceTabular_bool \c_math_toggle_token
           \bool_if:NT \l_@@_small_bool \scriptstyle 
 %    \end{macrocode}
 % We insert |\l_@@_code_for_last_col_tl|... but we don't insert it in the
@@ -5636,7 +6198,7 @@
     l
     < 
       { 
-        \c_math_toggle_token
+        \bool_if:NF \l_@@_NiceTabular_bool \c_math_toggle_token
         \hbox_set_end:
         \@@_update_for_first_and_last_row:
 %    \end{macrocode}
@@ -5645,7 +6207,7 @@
 %    \begin{macrocode}
         \dim_gset:Nn \g_@@_width_last_col_dim
           { \dim_max:nn \g_@@_width_last_col_dim { \box_wd:N \l_@@_cell_box } }
-        \skip_horizontal:N -2\arraycolsep 
+        \skip_horizontal:N -2\col at sep 
 %    \end{macrocode}
 % The content of the cell is inserted in an overlapping position.
 % \label{overlap-right}
@@ -5758,7 +6320,7 @@
         \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 }
         \exp_args:Nnx \@@_begin_of_NiceMatrix:nn { #1 } \l_@@_type_of_col_tl 
       }
-      { \end { #1 NiceArray } }
+      { \use:c { end #1 NiceArray } }
   }
 %    \end{macrocode}
 %
@@ -5765,7 +6327,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_begin_of_NiceMatrix:nn #1 #2
   {
-    \begin { #1 NiceArray } 
+    \use:c { #1 NiceArray } 
       { 
         * 
           { 
@@ -5787,8 +6349,18 @@
 \@@_define_env:n V
 %    \end{macrocode}
 %
+% \bigskip
+% \subsection*{The environment \{NiceTabular\}}
+%    \begin{macrocode}
+\NewDocumentEnvironment { NiceTabular } { O { } m ! O { } }
+  { 
+    \keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 }
+    \bool_set_true:N \l_@@_NiceTabular_bool 
+    \NiceArray { #2 }
+  }
+  { \endNiceArray }
+%    \end{macrocode}
 % 
-%
 % 
 % \bigskip
 % \subsection*{After the construction of the array}
@@ -5873,7 +6445,38 @@
       }
 %    \end{macrocode}
 % 
-%
+% If the key |code-before| is used, we have to write on the |aux| file the actual
+% size of the array.
+%    \begin{macrocode}
+    \bool_if:NT \l_@@_code_before_bool
+      {
+        \iow_now:Nn \@mainaux \ExplSyntaxOn
+        \iow_now:Nx \@mainaux
+          { \seq_clear_new:c { @@_size _ \int_use:N \g_@@_env_int _ seq } }
+        \iow_now:Nx \@mainaux
+          {
+            \seq_gset_from_clist:cn { @@_size _ \int_use:N \g_@@_env_int _ seq }
+              { 
+                \int_use:N \l_@@_first_row_int , 
+                \int_use:N \g_@@_row_total_int ,
+                \int_use:N \l_@@_first_col_int ,
+%    \end{macrocode}
+% If the user has used a key |last-row| in an environment with preamble (like
+% |{pNiceArray}|) and that that last row has not been found, we have to
+% increment the value because it will be decreased when used in the |code-before|.
+%    \begin{macrocode}
+                \bool_lazy_and:nnTF
+                  { \int_compare_p:nNn \l_@@_last_col_int > { -2 } }
+                  { \bool_not_p:n \g_@@_last_col_found_bool }
+                  \@@_succ:n 
+                  \int_use:N 
+                \g_@@_col_total_int 
+              }
+          }   
+        \iow_now:Nn \@mainaux \ExplSyntaxOff
+      } 
+%    \end{macrocode}
+% 
 % By default, the diagonal lines will be parallelized\footnote{It's possible to
 % use the option |parallelize-diags| to disable this parallelization.}. There
 % are two types of diagonals lines: the $|\Ddots|$ diagonals and the |\Iddots|
@@ -5936,7 +6539,7 @@
 %
 %
 % \bigskip
-% Now, we really draw the lines. 
+% Now, we really draw the dotted lines. 
 %    \begin{macrocode}
     \@@_draw_dotted_lines:
 %    \end{macrocode}
@@ -5950,7 +6553,7 @@
     \tl_gclear:N \g_@@_internal_code_after_tl
     \bool_if:NT \c_@@_tikz_loaded_bool
       {  
-        \tikzset 
+        \tikzset
           { 
             every~picture / .style = 
               { 
@@ -5961,6 +6564,16 @@
           }  
       }
     \cs_set_eq:NN \line \@@_line
+%    \end{macrocode}
+% When |light-syntax| is used, we insert systematically a |\CodeAfter| in the
+% flow. Thus, it's possible to have two instructions |\CodeAfter| and the second
+% one is eventually present in |\g_@@_code_after_tl|. That's why we set
+% |\Code-after| to be \textsl{no-op} now.
+%    \begin{macrocode}
+    \cs_set_eq:NN \CodeAfter \prg_do_nothing:
+%    \end{macrocode}
+% And here's the |code-after|:
+%    \begin{macrocode}
     \g_@@_code_after_tl 
     \tl_gclear:N \g_@@_code_after_tl
     \group_end:
@@ -5994,7 +6607,7 @@
   {
     \pgfrememberpicturepositiononpagetrue
     \pgf at relevantforpicturesizefalse
-    \g_@@_Hdotsfor_lines_tl
+    \g_@@_HVdotsfor_lines_tl
     \g_@@_Vdots_lines_tl
     \g_@@_Ddots_lines_tl
     \g_@@_Iddots_lines_tl
@@ -6007,8 +6620,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_restore_iRow_jCol:
   {
-    \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c at iRow \l_@@_save_iRow_int } 
-    \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c at jCol \l_@@_save_jCol_int } 
+    \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c at iRow \l_@@_old_iRow_int } 
+    \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c at jCol \l_@@_old_jCol_int } 
   }
 %    \end{macrocode}
 %
@@ -6239,10 +6852,6 @@
 % 
 % \medskip
 %    \begin{macrocode}
-\cs_new:Nn \@@_initial_cell: 
-  { \@@_env: - \int_use:N \l_@@_initial_i_int - \int_use:N \l_@@_initial_j_int }  
-\cs_new:Nn \@@_final_cell: 
-  { \@@_env: - \int_use:N \l_@@_final_i_int - \int_use:N \l_@@_final_j_int }  
 \cs_new_protected:Npn \@@_set_initial_coords:
   { 
     \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
@@ -6255,12 +6864,24 @@
   }
 \cs_new_protected:Npn \@@_set_initial_coords_from_anchor:n #1
   {
-    \pgfpointanchor \@@_initial_cell: { #1 } 
+    \pgfpointanchor 
+      { 
+        \@@_env: 
+        - \int_use:N \l_@@_initial_i_int 
+        - \int_use:N \l_@@_initial_j_int 
+      }   
+      { #1 } 
     \@@_set_initial_coords:
   }
 \cs_new_protected:Npn \@@_set_final_coords_from_anchor:n #1
   {
-    \pgfpointanchor \@@_final_cell: { #1 } 
+    \pgfpointanchor 
+      { 
+        \@@_env: 
+        - \int_use:N \l_@@_final_i_int 
+        - \int_use:N \l_@@_final_j_int 
+      }   
+      { #1 } 
     \@@_set_final_coords:
   }
 %    \end{macrocode}
@@ -6317,25 +6938,28 @@
   { 
     \bool_if:NTF \l_@@_initial_open_bool
       {
-        \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int }
+        \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
         \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x 
-        \dim_add:Nn \l_@@_x_initial_dim \arraycolsep 
-        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int - base }
+        \dim_add:Nn \l_@@_x_initial_dim 
+           { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } 
+        \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base }
         \dim_set_eq:NN \l_@@_y_initial_dim \pgf at y
       }
       { \@@_set_initial_coords_from_anchor:n { base~east } }
     \bool_if:NTF \l_@@_final_open_bool
       {
-        \@@_qpoint: { col - \@@_succ:n \l_@@_final_j_int }
+        \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
         \dim_set_eq:NN \l_@@_x_final_dim \pgf at x 
-        \dim_sub:Nn \l_@@_x_final_dim \arraycolsep 
-        \@@_qpoint: { row - \int_use:N \l_@@_final_i_int - base }
+        \dim_sub:Nn \l_@@_x_final_dim 
+           { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } 
+        \@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base }
         \dim_set_eq:NN \l_@@_y_final_dim \pgf at y
       }
       { \@@_set_final_coords_from_anchor:n { base~west } } 
 %    \end{macrocode}
 % We raise the line of a quantity equal to the radius of the dots because we
-% want the dots really ``on'' the line of texte.
+% want the dots really ``on'' the line of texte. Of course, maybe we should not
+% do that when the option |line-style| is used (?).
 %    \begin{macrocode}
     \dim_add:Nn \l_@@_y_initial_dim \l_@@_radius_dim
     \dim_add:Nn \l_@@_y_final_dim \l_@@_radius_dim
@@ -6393,16 +7017,18 @@
   {
     \bool_if:NTF \l_@@_initial_open_bool
       { 
-        \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int } 
+        \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int } 
         \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x 
-        \dim_add:Nn \l_@@_x_initial_dim \arraycolsep 
+        \dim_add:Nn \l_@@_x_initial_dim 
+           { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } 
       }
       { \@@_set_initial_coords_from_anchor:n { mid~east } }
     \bool_if:NTF \l_@@_final_open_bool
       { 
-        \@@_qpoint: { col - \@@_succ:n \l_@@_final_j_int }
+        \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
         \dim_set_eq:NN \l_@@_x_final_dim \pgf at x 
-        \dim_sub:Nn \l_@@_x_final_dim \arraycolsep 
+        \dim_sub:Nn \l_@@_x_final_dim 
+           { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } 
       }
       { \@@_set_final_coords_from_anchor:n { mid~west } }
     \bool_lazy_and:nnTF
@@ -6409,9 +7035,9 @@
       \l_@@_initial_open_bool 
       \l_@@_final_open_bool 
       {
-        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int }
+        \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
         \dim_set_eq:NN \l_tmpa_dim \pgf at y
-        \@@_qpoint: { row - \@@_succ:n \l_@@_initial_i_int }
+        \@@_qpoint:n { row - \@@_succ:n \l_@@_initial_i_int }
         \dim_set:Nn \l_@@_y_initial_dim { ( \l_tmpa_dim + \pgf at y ) / 2 } 
         \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim
       }     
@@ -6464,6 +7090,8 @@
 % \item |\l_@@_final_j_int| 
 % \item |\l_@@_final_open_bool|. 
 % \end{itemize}
+%
+% The following function is also used by |\Vdotsfor|.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_actually_draw_Vdots:
   {
@@ -6485,13 +7113,13 @@
 %    \begin{macrocode}
     \bool_if:NTF \l_@@_initial_open_bool
       { 
-        \@@_qpoint: { row - 1 }
+        \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
         \dim_set_eq:NN \l_@@_y_initial_dim \pgf at y
       }
       { \@@_set_initial_coords_from_anchor:n { south } }
     \bool_if:NTF \l_@@_final_open_bool
       { 
-        \@@_qpoint: { row - \@@_succ:n \c at iRow }
+        \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
         \dim_set_eq:NN \l_@@_y_final_dim \pgf at y 
       }
       { \@@_set_final_coords_from_anchor:n { north } }     
@@ -6499,11 +7127,27 @@
       {
         \bool_if:NTF \l_@@_final_open_bool
           {
-            \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int }
+            \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
             \dim_set_eq:NN \l_tmpa_dim \pgf at x
-            \@@_qpoint: { col - \@@_succ:n \l_@@_initial_j_int }
+            \@@_qpoint:n { col - \@@_succ:n \l_@@_initial_j_int }
             \dim_set:Nn \l_@@_x_initial_dim { ( \pgf at x + \l_tmpa_dim ) / 2 } 
             \dim_set_eq:NN \l_@@_x_final_dim \l_@@_x_initial_dim
+%    \end{macrocode}
+% We may think that the final user won't use a ``last column'' which contains
+% only a command |\Vdots|. However, if the |\Vdots| is in fact used to draw, not
+% a dotted line, but an arrow (to indicate the number of rows of the matrix), it
+% may be really encountered.
+%    \begin{macrocode}
+            \int_compare:nNnT \l_@@_last_col_int > { -2 }
+              {
+                \int_compare:nNnT \l_@@_initial_j_int = \g_@@_col_total_int
+                  {
+                    \dim_set_eq:NN \l_tmpa_dim \l_@@_right_margin_dim
+                    \dim_add:Nn \l_tmpa_dim \l_@@_extra_right_margin_dim
+                    \dim_add:Nn \l_@@_x_initial_dim \l_tmpa_dim
+                    \dim_add:Nn \l_@@_x_final_dim \l_tmpa_dim
+                  } 
+              }
           }
           { \dim_set_eq:NN \l_@@_x_initial_dim \l_@@_x_final_dim }
       }
@@ -6574,17 +7218,17 @@
   {
     \bool_if:NTF \l_@@_initial_open_bool
       {
-        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int }
+        \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
         \dim_set_eq:NN \l_@@_y_initial_dim \pgf at y
-        \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int }
+        \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
         \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
       }
       { \@@_set_initial_coords_from_anchor:n { south~east } }
     \bool_if:NTF \l_@@_final_open_bool
       {
-        \@@_qpoint: { row - \@@_succ:n \l_@@_final_i_int }
+        \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
         \dim_set_eq:NN \l_@@_y_final_dim \pgf at y
-        \@@_qpoint: { col - \@@_succ:n \l_@@_final_j_int }
+        \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
         \dim_set_eq:NN \l_@@_x_final_dim \pgf at x
       }
       { \@@_set_final_coords_from_anchor:n { north~west } }     
@@ -6671,17 +7315,17 @@
   {
     \bool_if:NTF \l_@@_initial_open_bool
       {
-        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int }
+        \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
         \dim_set_eq:NN \l_@@_y_initial_dim \pgf at y
-        \@@_qpoint: { col - \@@_succ:n \l_@@_initial_j_int }
+        \@@_qpoint:n { col - \@@_succ:n \l_@@_initial_j_int }
         \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
       }
       { \@@_set_initial_coords_from_anchor:n { south~west } }
     \bool_if:NTF \l_@@_final_open_bool
       {
-        \@@_qpoint: { row - \@@_succ:n \l_@@_final_i_int }
+        \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
         \dim_set_eq:NN \l_@@_y_final_dim \pgf at y
-        \@@_qpoint: { col - \int_use:N \l_@@_final_j_int }
+        \@@_qpoint:n { col - \int_use:N \l_@@_final_j_int }
         \dim_set_eq:NN \l_@@_x_final_dim \pgf at x
       }
       { \@@_set_final_coords_from_anchor:n { north~east } } 
@@ -7015,8 +7659,19 @@
       { 
         \bool_if:nTF { #1 } 
           { \@@_error:n { starred~commands } }
-          { \@@_instruction_of_type:nn { Ldots } { #2 , down = #3 , up = #4 } }  
-        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_ldots }
+          { 
+            \int_compare:nNnTF \c at jCol = 0 
+              { \@@_error:nn { in~first~col } \Ldots }
+              { 
+                \int_compare:nNnTF \c at jCol = \l_@@_last_col_int
+                  { \@@_error:nn { in~last~col } \Ldots }
+                  { 
+                     \@@_instruction_of_type:nn { Ldots } 
+                       { #2 , down = #3 , up = #4 } 
+                  }  
+              }
+          }
+        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_old_ldots }
         \bool_gset_true:N \g_@@_empty_cell_bool
       } 
 %    \end{macrocode}
@@ -7027,8 +7682,19 @@
       { 
         \bool_if:nTF { #1 } 
           { \@@_error:n { starred~commands } }
-          { \@@_instruction_of_type:nn { Cdots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_cdots }
+          { 
+            \int_compare:nNnTF \c at jCol = 0 
+              { \@@_error:nn { in~first~col } \Cdots }
+              { 
+                \int_compare:nNnTF \c at jCol = \l_@@_last_col_int
+                  { \@@_error:nn { in~last~col } \Cdots }
+                  { 
+                     \@@_instruction_of_type:nn { Cdots } 
+                       { #2 , down = #3 , up = #4 } 
+                  }  
+              }
+          }
+        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_old_cdots }
         \bool_gset_true:N \g_@@_empty_cell_bool
       } 
 %    \end{macrocode}
@@ -7039,8 +7705,17 @@
       {
         \bool_if:nTF { #1 } 
           { \@@_error:n { starred~commands } }
-          { \@@_instruction_of_type:nn { Vdots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_vdots }
+            \int_compare:nNnTF \c at iRow = 0 
+              { \@@_error:nn { in~first~row } \Vdots }
+              { 
+                \int_compare:nNnTF \c at iRow = \l_@@_last_row_int
+                  { \@@_error:nn { in~last~row } \Vdots }
+                  { 
+                     \@@_instruction_of_type:nn { Vdots } 
+                       { #2 , down = #3 , up = #4 } 
+                  }  
+              }
+        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_old_vdots }
         \bool_gset_true:N \g_@@_empty_cell_bool
       } 
 %    \end{macrocode}
@@ -7051,8 +7726,26 @@
       { 
         \bool_if:nTF { #1 } 
           { \@@_error:n { starred~commands } }
-          { \@@_instruction_of_type:nn { Ddots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_ddots }
+          { 
+            \int_case:nnF \c at iRow
+              {
+                0                  { \@@_error:nn { in~first~row } \Ddots } 
+                \l_@@_last_row_int { \@@_error:nn { in~last~row } \Ddots }
+              }
+              { 
+                \int_case:nnF \c at jCol
+                  {
+                    0                  { \@@_error:nn { in~first~col } \Ddots }  
+                    \l_@@_last_col_int { \@@_error:nn { in~last~col } \Ddots }  
+                  }
+                  {
+                    \@@_instruction_of_type:nn { Ddots } 
+                      { #2 , down = #3 , up = #4 } 
+                  } 
+       
+              }
+          }          
+        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_old_ddots }
         \bool_gset_true:N \g_@@_empty_cell_bool
       } 
 %    \end{macrocode}
@@ -7063,8 +7756,26 @@
       { 
         \bool_if:nTF { #1 } 
           { \@@_error:n { starred~commands } }
-          { \@@_instruction_of_type:nn { Iddots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_iddots }
+          { 
+            \int_case:nnF \c at iRow
+              {
+                0                  { \@@_error:nn { in~first~row } \Iddots } 
+                \l_@@_last_row_int { \@@_error:nn { in~last~row } \Iddots }
+              }
+              { 
+                \int_case:nnF \c at jCol
+                  {
+                    0                  { \@@_error:nn { in~first~col } \Iddots }  
+                    \l_@@_last_col_int { \@@_error:nn { in~last~col } \Iddots }  
+                  }
+                  {
+                    \@@_instruction_of_type:nn { Iddots } 
+                      { #2 , down = #3 , up = #4 } 
+                  } 
+       
+              }
+          }          
+        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_old_iddots }
         \bool_gset_true:N \g_@@_empty_cell_bool
       } 
   }
@@ -7095,7 +7806,7 @@
     \int_compare:nNnT #1 > 1
       {
         \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
-          { \int_eval:n \c at iRow - \int_use:N \c at jCol }
+          { \int_use:N \c at iRow - \int_use:N \c at jCol }
         \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } 
       }
     \int_gadd:Nn \c at jCol { #1 - 1 }
@@ -7105,11 +7816,8 @@
 %
 % \bigskip
 % The command |\@@_Hdotsfor| will be linked to |\Hdotsfor| in
-% |{NiceArrayWithDelims}|. This command uses an optional argument (as does
-% |\hdotsfor|) but this argument is discarded (in |\hdotsfor|, this argument is 
-% used for fine tuning of the space between two consecutive dots). Tikz nodes
-% are created also the implicit cells of the |\Hdotsfor| (maybe we should modify
-% that point).
+% |{NiceArrayWithDelims}|. Tikz nodes are created also in the implicit cells of
+% the |\Hdotsfor| (maybe we should modify that point).
 %
 % \medskip
 % This command must \emph{not} be protected since it begins with |\multicolumn|. 
@@ -7121,12 +7829,6 @@
   }
 %    \end{macrocode}
 %
-%    \begin{macrocode}
-\ExplSyntaxOff
-\def \@tempa  { O { } m O { } E { _ ^ } { { } { } } }
-\ExplSyntaxOn
-\tl_set_eq:NN \l_@@_a_signature_tl \@tempa
-%    \end{macrocode}
 %
 % The command |\@@_Hdotsfor_i| is defined with the tools of \pkg{xparse} because
 % it has an optional argument. Note that such a command defined by
@@ -7137,28 +7839,24 @@
   {
     \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } }
     \tl_set_rescan:Nno  \l_@@_argspec_tl { } \l_@@_argspec_tl
-    \bool_if:NTF \c_@@_draft_bool
-      {  
 %    \end{macrocode}
 % We don't put |!| before the last optionnal argument for homogeneity with
 % |\Cdots|, etc. which have only one optional argument.
 %    \begin{macrocode}
-        \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_i \l_@@_argspec_tl 
-          { \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } } } 
-      }
+    \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_i \l_@@_argspec_tl
       {
-        \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_i \l_@@_argspec_tl
+        \tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl
           {
-            \tl_gput_right:Nx \g_@@_Hdotsfor_lines_tl
-              {
-                \@@_Hdotsfor:nnnn 
-                  { \int_use:N \c at iRow } 
-                  { \int_use:N \c at jCol } 
-                  { #2 }  
-                  { #1 , #3 , down = #4 , up = #5 }
-              }
-            \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
-          } 
+            \@@_Hdotsfor:nnnn 
+              { \int_use:N \c at iRow } 
+              { \int_use:N \c at jCol } 
+              { #2 }  
+              { 
+                #1 , #3 , 
+                down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
+              } 
+          }
+        \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
       } 
   }
 %    \end{macrocode}
@@ -7240,11 +7938,111 @@
       { \cs_set:cpn { @@ _ dotted _ #1 - ##1 } { } }
   }
 %    \end{macrocode}
-% 
 %
-% \bigskip
-% The control sequence |\@@_rotate:| will be linked to |\rotate| in
-% |{NiceArrayWithDelims}|. 
+% \bigskip 
+%    \begin{macrocode}
+\AtBeginDocument
+  {
+    \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } }
+    \tl_set_rescan:Nno  \l_@@_argspec_tl { } \l_@@_argspec_tl
+    \exp_args:NNV \NewDocumentCommand \@@_Vdotsfor: \l_@@_argspec_tl
+      {
+        \tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl
+          {
+            \@@_Vdotsfor:nnnn 
+              { \int_use:N \c at iRow } 
+              { \int_use:N \c at jCol } 
+              { #2 }  
+              { 
+                #1 , #3 ,
+                down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
+              } 
+          }
+      } 
+  }
+%    \end{macrocode}
+% Enf of |\AtBeginDocument|.
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_Vdotsfor:nnnn #1 #2 #3 #4
+  { 
+    \bool_set_false:N \l_@@_initial_open_bool
+    \bool_set_false:N \l_@@_final_open_bool
+%    \end{macrocode}
+% For the column, it's easy.
+%    \begin{macrocode}
+    \int_set:Nn \l_@@_initial_j_int { #2 }
+    \int_set_eq:NN \l_@@_final_j_int \l_@@_initial_j_int
+%    \end{macrocode}
+% For the row, it's a bit more complicated.
+%    \begin{macrocode}
+    \int_compare:nNnTF #1 = 1
+      { 
+        \int_set:Nn \l_@@_initial_i_int 1
+        \bool_set_true:N \l_@@_initial_open_bool
+      }
+      {
+        \cs_if_exist:cTF 
+          { 
+            pgf @ sh @ ns @ \@@_env: 
+            - \int_eval:n { #1 - 1 }
+            - \int_use:N \l_@@_initial_j_int
+          }
+          { \int_set:Nn \l_@@_initial_i_int { #1 - 1 } }
+          { 
+            \int_set:Nn \l_@@_initial_i_int { #1 }
+            \bool_set_true:N \l_@@_initial_open_bool
+          }
+      }
+    \int_compare:nNnTF { #1 + #3 -1 } = \c at iRow
+      { 
+        \int_set:Nn \l_@@_final_i_int { #1 + #3 - 1 }
+        \bool_set_true:N \l_@@_final_open_bool
+      }
+      {
+        \cs_if_exist:cTF 
+          { 
+            pgf @ sh @ ns @ \@@_env: 
+            - \int_eval:n { #1 + #3 }
+            - \int_use:N \l_@@_final_j_int
+          }
+          { \int_set:Nn \l_@@_final_i_int { #1 + #3 } }
+          { 
+            \int_set:Nn \l_@@_final_i_int { #1 + #3 - 1 }
+            \bool_set_true:N \l_@@_final_open_bool
+          }
+      }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+    \group_begin:
+    \int_compare:nNnTF { #2 } = 0
+      { \color { nicematrix-first-col } }
+      { 
+        \int_compare:nNnT { #2 } = \g_@@_col_total_int
+          { \color { nicematrix-last-col } }
+      }
+    \keys_set:nn { NiceMatrix / xdots } { #4 }
+    \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+    \@@_actually_draw_Vdots:
+    \group_end:
+%    \end{macrocode}
+%
+% \medskip
+% We declare all the cells concerned by the |\Vdotsfor| as ``dotted'' (for the
+% dotted lines created by |\Cdots|, |\Ldots|, etc., this job is done by
+% |\@@_find_extremities_of_line:nnnn|). This declaration is done by defining a
+% special control sequence (to nil).
+%    \begin{macrocode}
+    \int_step_inline:nnn { #1 } { #1 + #3 - 1 }
+      { \cs_set:cpn { @@ _ dotted _ ##1 - #2 } { } }
+  }
+%    \end{macrocode}
+%
+%
+% \vspace{1cm}
+% The command |\@@_rotate:| will be linked to |\rotate| in
+% |{NiceArrayWithDelims}|.  
 % 
 % The command will exit three levels of groups in order
 % to execute the command 
@@ -7297,12 +8095,6 @@
   { \int_eval:n { #1 } - \int_eval:n { #2 } }
 %    \end{macrocode}
 %
-%    \begin{macrocode}
-\ExplSyntaxOff
-\def \@tempa  { O { } m m ! O { } E { _ ^ } { { } { } } }
-\ExplSyntaxOn
-\tl_set_eq:NN \l_@@_a_signature_tl \@tempa
-%    \end{macrocode}
 %
 % \medskip
 % With the following construction, the command |\@@_double_int_eval:n| is
@@ -7331,24 +8123,20 @@
 %    \end{macrocode}
 % 
 %    \begin{macrocode}
-\bool_if:NTF \c_@@_draft_bool
-  { \cs_new_protected:Npn \@@_line_i:nn #1 #2  { } }
+\cs_new_protected:Npn \@@_line_i:nn #1 #2
   {
-    \cs_new_protected:Npn \@@_line_i:nn #1 #2
+    \bool_set_false:N \l_@@_initial_open_bool
+    \bool_set_false:N \l_@@_final_open_bool
+    \bool_if:nTF
       {
-        \bool_set_false:N \l_@@_initial_open_bool
-        \bool_set_false:N \l_@@_final_open_bool
-        \bool_if:nTF
-          {
-            \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 }  
-              || 
-            \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 } 
-          }
-          { 
-            \@@_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 }
-          } 
-          { \@@_draw_line_ii:nn { #1 } { #2 } }
+        \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 }  
+          || 
+        \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 } 
       }
+      { 
+        \@@_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 }
+      } 
+      { \@@_draw_line_ii:nn { #1 } { #2 } }
   }
 %    \end{macrocode}
 %
@@ -7377,10 +8165,10 @@
 \cs_new_protected:Npn \@@_draw_line_iii:nn #1 #2 
   {
     \pgfrememberpicturepositiononpagetrue
-    \pgfpointshapeborder { \@@_env: - #1 } { \@@_qpoint: { #2 } }
+    \pgfpointshapeborder { \@@_env: - #1 } { \@@_qpoint:n { #2 } }
     \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
     \dim_set_eq:NN \l_@@_y_initial_dim \pgf at y
-    \pgfpointshapeborder { \@@_env: - #2 } { \@@_qpoint: { #1 } }
+    \pgfpointshapeborder { \@@_env: - #2 } { \@@_qpoint:n { #1 } }
     \dim_set_eq:NN \l_@@_x_final_dim \pgf at x
     \dim_set_eq:NN \l_@@_y_final_dim \pgf at y
     \@@_draw_line:
@@ -7393,6 +8181,214 @@
 % lines must be parallelized). 
 %
 % \bigskip
+% \subsection*{Commands available in the code-before}
+%
+% In the beginning of the |code-before|, the command |\@@_rowcolor:nn| will be
+% linked to |\rowcolor| and the command |\@@_columncolor:nn| to |\columncolor|.
+% 
+%    \begin{macrocode}
+\cs_set_protected:Npn \@@_cut_on_hyphen:w #1-#2\q_stop
+  {
+    \tl_set:Nn \l_tmpa_tl { #1 }
+    \tl_set:Nn \l_tmpb_tl { #2 }
+  }
+%    \end{macrocode}
+%
+% 
+% \bigskip
+% Here an example : |\@@_rowcolor:nn {red!15} {1,3,5-7,10-}|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_rowcolor:nn #1 #2
+  { 
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+%    \end{macrocode}
+% |\l_tmpa_dim| is the $x$-value of the left side of the rows.
+%    \begin{macrocode}
+        \@@_qpoint:n { col - \@@_succ:n \c at jCol }
+        \dim_set_eq:NN \l_tmpa_dim \pgf at x
+        \clist_map_inline:nn { #2 } 
+          { 
+            \tl_set:Nn \l_tmpa_tl { ##1 }
+            \tl_if_in:NnTF \l_tmpa_tl { - } 
+              { \@@_cut_on_hyphen:w ##1 \q_stop }  
+              { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop }  
+            \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }  
+            \tl_if_empty:NT \l_tmpb_tl
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+            \int_compare:nNnT \l_tmpb_tl > \c at iRow
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+%    \end{macrocode}
+% Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|.
+%    \begin{macrocode}
+            \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl }
+            \pgfpathrectanglecorners
+              { \@@_qpoint:n { row - \l_tmpa_tl } }
+              { \pgfpoint \l_tmpa_dim \pgf at y } 
+          }
+        \pgfusepathqfill
+        \endpgfpicture
+      }
+  }
+%    \end{macrocode}
+% 
+% \bigskip
+% Here an example : |\@@_columncolor:nn {red!15} {1,3,5-7,10-}|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_columncolor:nn #1 #2
+  { 
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \@@_qpoint:n { row - 1 }
+%    \end{macrocode}
+% |\l_tmpa_dim| is the $y$-value of the top of the columns et |\l_tmpb_dim| is
+% the $y$-value of the bottom.
+%    \begin{macrocode}
+        \dim_set_eq:NN \l_tmpa_dim \pgf at y
+        \@@_qpoint:n { row - \@@_succ:n \c at iRow }
+        \dim_set_eq:NN \l_tmpb_dim \pgf at y
+        \clist_map_inline:nn { #2 } 
+          { 
+            \tl_set:Nn \l_tmpa_tl { ##1 }
+            \tl_if_in:NnTF \l_tmpa_tl { - } 
+              { \@@_cut_on_hyphen:w ##1 \q_stop }  
+              { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop }  
+            \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }   
+            \tl_if_empty:NT \l_tmpb_tl
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+            \int_compare:nNnT \l_tmpb_tl > \c at jCol
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+%    \end{macrocode}
+% Now, the numbers of both columns are in |\l_tmpa_tl| and |\l_tmpb_tl|.
+%    \begin{macrocode}
+            \@@_qpoint:n { col - \l_tmpa_tl }
+            \dim_set_eq:NN \l_tmpc_dim \pgf at x
+            \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
+            \pgfpathrectanglecorners
+              { \pgfpoint \l_tmpc_dim \l_tmpa_dim }
+              { \pgfpoint \pgf at x \l_tmpb_dim } 
+          }
+        \pgfusepathqfill
+        \endpgfpicture
+     }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% Here an example : |\@@_cellcolor:nn {red!15}{2-3,3-4,4-5,5-6}|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_cellcolor:nn #1 #2
+  {
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \clist_map_inline:nn { #2 } 
+          {
+            \@@_cut_on_hyphen:w ##1 \q_stop
+            \@@_qpoint:n { row - \l_tmpa_tl } 
+            \bool_lazy_and:nnT 
+              { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
+              { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
+              { 
+                \dim_set_eq:NN \l_tmpb_dim \pgf at y
+                \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl }
+                \dim_set_eq:NN \l_tmpa_dim \pgf at y
+                \@@_qpoint:n { col - \l_tmpb_tl }
+                \dim_set_eq:NN \l_tmpc_dim \pgf at x
+                \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
+                \dim_set_eq:NN \l_tmpd_dim \pgf at x
+                \pgfpathrectanglecorners
+                  { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
+                  { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
+              }
+          }
+        \pgfusepathqfill
+        \endpgfpicture
+     }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% Here an example : |\@@_rectanglecolor:nn {red!15}{2-3}{5-6}|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_rectanglecolor:nnn #1 #2 #3
+  {
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \@@_cut_on_hyphen:w #2 \q_stop
+        \bool_lazy_and:nnT 
+          { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
+          { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
+          {
+            \@@_qpoint:n { row - \l_tmpa_tl } 
+            \dim_set_eq:NN \l_tmpb_dim \pgf at y
+            \@@_qpoint:n { col - \l_tmpb_tl }
+            \@@_cut_on_hyphen:w #3 \q_stop
+            \int_compare:nNnT \l_tmpa_tl > \c at iRow
+              { \tl_set:Nx \l_tmpa_tl { \int_use:N \c at iRow } }
+            \int_compare:nNnT \l_tmpb_tl > \c at jCol
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+            \dim_set_eq:NN \l_tmpc_dim \pgf at x
+            \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl }
+            \dim_set_eq:NN \l_tmpa_dim \pgf at y
+            \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
+            \dim_set_eq:NN \l_tmpd_dim \pgf at x
+            \pgfpathrectanglecorners
+              { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
+              { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
+            \pgfusepathqfill
+          }
+        \endpgfpicture
+      }
+  }
+%    \end{macrocode}
+%
+%
+% \bigskip
+% The command |\rowcolors| (accessible in the |code-before|) is inspired by the
+% command |\rowcolors| of the package \pkg{xcolor} (with the option |table|).
+% However, the command |\rowcolors| of \pkg{nicematrix} has \emph{not} the
+% optional argument of the command |\rowcolors| of \pkg{xcolor}.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_rowcolors:nnn #1 #2 #3
+  {
+    \int_step_inline:nnn { #1 } { \int_use:N \c at iRow }
+      {
+        \int_if_odd:nTF { ##1 }
+          { \@@_rowcolor:nn { #2 } { ##1 } }
+          { \@@_rowcolor:nn { #3 } { ##1 } }
+      }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_chessboardcolors:nn #1 #2
+  {
+    \int_step_inline:nn { \int_use:N \c at iRow }
+      {
+        \int_step_inline:nn { \int_use:N \c at jCol }
+          {
+            \int_if_even:nTF { ####1 + ##1 }
+              { \@@_cellcolor:nn { #1 } { ####1 - ##1 } }
+              { \@@_cellcolor:nn { #2 } { ####1 - ##1 } }
+          }
+      }
+  }
+%    \end{macrocode}
+% 
+% \bigskip
 % \subsection*{The vertical rules}
 %
 % We give to the user the possibility to define new types of columns (with
@@ -7465,26 +8461,22 @@
 % consecutive specifiers ``"|"'' (in a preambule like "ccc||ccc").
 %
 % That's why we have done a redefinition of the macro |\@arrayrule| of
-% \pkg{array} and this redefinition will add |\@@_vline:| instead of |\vline| to
-% the preamble (that definition is in the beginning of |{NiceArrayWithDelims}|).
+% \pkg{array} and this redefinition will add |\@@_vline:| instead of |\vline|
+% in the preamble (that definition is in the beginning of
+% |{NiceArrayWithDelims}|). 
 %
 % Here is the definition of |\@@_vline:|. This definition \emph{must} be
 % protected because you don't want that macro expanded during the construction
 % of the preamble (the tests in |\@@_OnlyMainNiceMatrix:n| must be effective in
-% each row and not once for all when the preamble is constructed).
-% 
-% \medskip
+% each row and not once for all when the preamble is constructed). The command
+% |\CT at arc@| is a command of \pkg{colortbl} which sets the color of the rules in
+% the array. The package \pkg{nicematrix} uses it even if \pkg{colortbl} is not
+% loaded.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_vline: { \@@_OnlyMainNiceMatrix:n { \@@_vline_i: } } 
+\cs_new_protected:Npn \@@_vline:
+  { \@@_OnlyMainNiceMatrix:n { { \CT at arc@ \vline } } } 
 %    \end{macrocode}
 %
-% If \pkg{colortbl} is loaded, the following macro will be redefined (in a
-% |\AtBeginDocument|) to take into account the color fixed by |\arrayrulecolor|
-% of \pkg{colortbl}. 
-%    \begin{macrocode}
-\cs_set_eq:NN \@@_vline_i: \vline
-%    \end{macrocode}
-%
 % \bigskip
 % The command |\@@_draw_vlines| will be executed when the user uses the option
 % |vlines| (which draws all the vlines of the array).
@@ -7493,9 +8485,12 @@
   {
     \group_begin:
 %    \end{macrocode}
-% The command |\CT at arc@| is a command of color from \pkg{colortbl}.
+%
+% The command |\CT at arc@| is a command of \pkg{colortbl} which sets the color of
+% the rules in the array. The package \pkg{nicematrix} uses it even if
+% \pkg{colortbl} is not loaded.
 %    \begin{macrocode}
-    \bool_if:NT \c_@@_colortbl_loaded_bool \CT at arc@
+    \CT at arc@
     \pgfpicture 
     \pgfrememberpicturepositiononpagetrue
     \pgf at relevantforpicturesizefalse
@@ -7503,10 +8498,10 @@
 %    \end{macrocode}
 % First, we compute in |\l_tmpa_dim| the height of the rules we have to draw.
 %    \begin{macrocode}
-    \@@_qpoint: {row - 1 }
+    \@@_qpoint:n { row - 1 }
     \dim_set_eq:NN \l_tmpa_dim \pgf at y
     \pgfusepathqfill
-    \@@_qpoint: { row - \@@_succ:n \c at iRow } 
+    \@@_qpoint:n { row - \@@_succ:n \c at iRow } 
     \dim_sub:Nn \l_tmpa_dim \pgf at y 
     \pgfusepathqfill
 %    \end{macrocode}
@@ -7521,53 +8516,28 @@
 % We adjust the value of |\l_tmpa_dim| by the width of the horizontal rule just 
 % before the ``last row''.
 %    \begin{macrocode}
-        \@@_qpoint: { row - \@@_succ:n\c at iRow } 
+        \@@_qpoint:n { row - \@@_succ:n\c at iRow } 
         \dim_add:Nn \l_tmpa_dim \pgf at y
-        \@@_qpoint: { row - \@@_succ:n \g_@@_row_total_int } 
+        \@@_qpoint:n { row - \@@_succ:n \g_@@_row_total_int } 
         \dim_sub:Nn \l_tmpa_dim \pgf at y
         \dim_sub:Nn \l_tmpa_dim \l_tmpb_dim
        }
+    \dim_add:Nn \l_tmpa_dim \arrayrulewidth
 %    \end{macrocode}
 %
-% Now, we can draw the lines with a loop. 
+%
+% Now, we can draw the vertical rules with a loop. 
 %    \begin{macrocode}
     \int_step_inline:nnn 
       { \bool_if:NTF \l_@@_NiceArray_bool 1 2 } 
       { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c at jCol } \c at jCol } 
-      {          
-        \pgfpathmoveto
-          {
-            \pgfpointadd
-              { \@@_qpoint: { col - ##1 } }
-              { 
-                \pgfpoint 
-                  { 
-                    -0.5 \arrayrulewidth 
-                    \int_compare:nNnT { ##1 } = 1
-                      { 
-                        \int_compare:nNnT \l_@@_first_col_int = 1
-                          { + \arrayrulewidth }
-                      }
-                  } 
-                  { \l_tmpb_dim } 
-              }
-          }
+      { 
+        \pgfpathmoveto { \@@_qpoint:n { col - ##1 } }
         \pgfpathlineto
           {
             \pgfpointadd
-              { \@@_qpoint: { col - ##1 } }
-              { 
-                \pgfpoint 
-                  { 
-                    -0.5 \arrayrulewidth 
-                    \int_compare:nNnT { ##1 } = 1
-                      { 
-                        \int_compare:nNnT \l_@@_first_col_int = 1
-                          { + \arrayrulewidth }
-                      }
-                  } 
-                  { \l_tmpb_dim + \l_tmpa_dim } 
-              }
+              { \@@_qpoint:n { col - ##1 } }
+              { \pgfpoint \c_zero_dim { \l_tmpb_dim + \l_tmpa_dim } }
           }
       }
     \pgfusepathqstroke
@@ -7581,7 +8551,7 @@
 % \subsection*{The commands to draw dotted lines to separate columns and rows}
 %
 % These commands don't use the normal nodes, the medium nor the large nodes.
-% They only use the |col|-nodes and the |row|-nodes.
+% They only use the |col| nodes and the |row| nodes.
 %
 % \textbf{Horizontal dotted lines}\par\nobreak
 %
@@ -7589,14 +8559,10 @@
 % The following command must \emph{not} be protected because it's meant to be
 % expanded in a |\noalign|.
 %    \begin{macrocode}
-\bool_if:NTF \c_@@_draft_bool
-  { \cs_new:Npn \@@_hdottedline: { } }
+\cs_new:Npn \@@_hdottedline: 
   {
-    \cs_new:Npn \@@_hdottedline: 
-      {
-        \noalign { \skip_vertical:N 2\l_@@_radius_dim } 
-        \@@_hdottedline_i:
-      }
+    \noalign { \skip_vertical:N 2\l_@@_radius_dim } 
+    \@@_hdottedline_i:
   }
 %    \end{macrocode}
 %
@@ -7645,7 +8611,7 @@
 \cs_new_protected:Npn \@@_hdottedline_i:n #1
   {
     \pgfrememberpicturepositiononpagetrue
-    \@@_qpoint: { row - #1 } 
+    \@@_qpoint:n { row - #1 } 
 %    \end{macrocode}
 % We do a translation par |-\l_@@_radius_dim| because we want the dotted line to
 % have exactly the same position as a vertical rule drawn by ``"|"''
@@ -7671,7 +8637,7 @@
 % \hline 
 % 1 & 2 & 3 & 4 \\
 % \hdottedline 
-% 1 & 2 & 3 & 4 \\
+% 1 & 2 & 3 & 4 
 % \end{bNiceMatrix}
 % \end{BVerbatim}
 % $\begin{bNiceMatrix}
@@ -7679,7 +8645,7 @@
 % \hline 
 % 1 & 2 & 3 & 4 \\
 % \hdottedline 
-% 1 & 2 & 3 & 4 \\
+% 1 & 2 & 3 & 4 
 % \end{bNiceMatrix}$
 %
 % \smallskip
@@ -7693,7 +8659,7 @@
 % \hline 
 % 1 & 2 & 3 & 4 \\
 % \hdottedline 
-% 1 & 2 & 3 & 4 \\
+% 1 & 2 & 3 & 4 
 % \end{bNiceMatrix}
 % \end{BVerbatim}
 % $\begin{bNiceMatrix}[margin]
@@ -7701,17 +8667,25 @@
 % \hline 
 % 1 & 2 & 3 & 4 \\
 % \hdottedline 
-% 1 & 2 & 3 & 4 \\
+% 1 & 2 & 3 & 4 
 % \end{bNiceMatrix}$
 %
 % \medskip
 %    \begin{macrocode}
-    \@@_qpoint: { col - 1 } 
+    \@@_qpoint:n { col - 1 } 
     \dim_set:Nn \l_@@_x_initial_dim 
-      { \pgf at x + \arraycolsep - \l_@@_left_margin_dim } 
-    \@@_qpoint: { col - \@@_succ:n \c at jCol } 
+      { 
+        \pgf at x + 
+        \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep 
+        - \l_@@_left_margin_dim 
+      } 
+    \@@_qpoint:n { col - \@@_succ:n \c at jCol } 
     \dim_set:Nn \l_@@_x_final_dim 
-      { \pgf at x - \arraycolsep + \l_@@_right_margin_dim }
+      {            
+        \pgf at x - 
+        \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep 
+        + \l_@@_right_margin_dim 
+      }
 %    \end{macrocode}
 % For reasons purely aesthetic, we do an adjustment in the case of a rounded
 % bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a
@@ -7743,30 +8717,26 @@
 %
 % \medskip
 %    \begin{macrocode}
-\bool_if:nTF \c_@@_draft_bool
-  { \cs_new_protected:Npn \@@_vdottedline:n #1 { } }
+\cs_new_protected:Npn \@@_vdottedline:n #1
   {
-    \cs_new_protected:Npn \@@_vdottedline:n #1
-      {
-        \bool_set_true:N \l_@@_initial_open_bool 
-        \bool_set_true:N \l_@@_final_open_bool 
+    \bool_set_true:N \l_@@_initial_open_bool 
+    \bool_set_true:N \l_@@_final_open_bool 
 %    \end{macrocode}
 % We recall that, when externalization is used, |\tikzpicture| and
 % |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly
 % ``visible''. 
 %    \begin{macrocode}
-        \bool_if:NTF \c_@@_tikz_loaded_bool
-          {
-            \tikzpicture
-            \@@_vdottedline_i:n { #1 }
-            \endtikzpicture
-          }
-          {
-            \pgfpicture
-            \@@_vdottedline_i:n { #1 }
-            \endpgfpicture
-          }
+    \bool_if:NTF \c_@@_tikz_loaded_bool
+      {
+        \tikzpicture
+        \@@_vdottedline_i:n { #1 }
+        \endtikzpicture
       }
+      {
+        \pgfpicture
+        \@@_vdottedline_i:n { #1 }
+        \endpgfpicture
+      }
   }
 %    \end{macrocode}
 %
@@ -7775,11 +8745,13 @@
 \cs_new_protected:Npn \@@_vdottedline_i:n #1
   {
 %    \end{macrocode}
-% The command |\CT at arc@| is a command of color from \pkg{colortbl}.
+% The command |\CT at arc@| is a command of \pkg{colortbl} which sets the color of
+% the rules in the array. The package \pkg{nicematrix} uses it even if \pkg{colortbl} is not
+% loaded.
 %    \begin{macrocode}
-    \bool_if:NT \c_@@_colortbl_loaded_bool \CT at arc@
+    \CT at arc@
     \pgfrememberpicturepositiononpagetrue
-    \@@_qpoint: { col - \int_eval:n { #1 + 1 } } 
+    \@@_qpoint:n { col - \int_eval:n { #1 + 1 } } 
 %    \end{macrocode}
 % We do a translation par |-\l_@@_radius_dim| because we want the dotted line to
 % have exactly the same position as a vertical rule drawn by ``"|"''
@@ -7787,13 +8759,13 @@
 %    \begin{macrocode}
     \dim_set:Nn \l_@@_x_initial_dim { \pgf at x - \l_@@_radius_dim }
     \dim_set:Nn \l_@@_x_final_dim { \pgf at x - \l_@@_radius_dim }
-    \@@_qpoint: { row - 1 } 
+    \@@_qpoint:n { row - 1 } 
 %    \end{macrocode}
 % We arbitrary decrease the height of the dotted line by a quantity equal to
 % |\l_@@_inter_dots_dim| in order to improve the visual impact.
 %    \begin{macrocode}
     \dim_set:Nn \l_@@_y_initial_dim { \pgf at y - 0.5 \l_@@_inter_dots_dim }  
-    \@@_qpoint: { row - \@@_succ:n \c at iRow } 
+    \@@_qpoint:n { row - \@@_succ:n \c at iRow } 
     \dim_set:Nn \l_@@_y_final_dim { \pgf at y + 0.5 \l_@@_inter_dots_dim } 
 %    \end{macrocode}
 % As for now, we have no option to control the style of the lines drawn by
@@ -7984,7 +8956,7 @@
         \dim_compare:nNnT 
           { \dim_use:c { l_@@_row _ \@@_i: _ min _ dim } } = \c_max_dim
           { 
-            \@@_qpoint: { row - \@@_i: - base }
+            \@@_qpoint:n { row - \@@_i: - base }
             \dim_set:cn { l_@@_row _ \@@_i: _ max _ dim } \pgf at y 
             \dim_set:cn { l_@@_row _ \@@_i: _ min _ dim } \pgf at y 
           }
@@ -7994,7 +8966,7 @@
         \dim_compare:nNnT 
           { \dim_use:c { l_@@_column _ \@@_j: _ min _ dim } } = \c_max_dim 
           { 
-            \@@_qpoint: { col - \@@_j: }
+            \@@_qpoint:n { col - \@@_j: }
             \dim_set:cn { l_@@_column _ \@@_j: _ max _ dim } \pgf at y 
             \dim_set:cn { l_@@_column _ \@@_j: _ min _ dim } \pgf at y 
           }
@@ -8110,9 +9082,9 @@
         \dim_set_eq:cc { l_@@_column _ \@@_succ:n \@@_j: _ min _ dim }
           { l_@@_column _ \@@_j: _ max _ dim } 
       }
-%     \end{macrocode}
+%    \end{macrocode}
 % Here, we have to use |\dim_sub:cn| because of the number 1 in the name.
-%     \begin{macrocode}
+%    \begin{macrocode}
     \dim_sub:cn 
       { l_@@_column _ 1 _ min _ dim } 
       \l_@@_left_margin_dim
@@ -8125,7 +9097,7 @@
 %
 %
 % \bigskip
-% The control sequence |\@@_create_nodes:| is used twice: for the construction
+% The command |\@@_create_nodes:| is used twice: for the construction
 % of the ``medium nodes'' and for the construction of the ``large nodes''. The
 % nodes are constructed with the value of all the dimensions
 % \texttt{l_@@_row_\textsl{i}_min_dim}, \texttt{l_@@_row_\textsl{i}_max_dim},
@@ -8318,13 +9290,13 @@
         \pgfpicture 
           \pgfrememberpicturepositiononpagetrue
           \pgf at relevantforpicturesizefalse
-          \@@_qpoint: { row - #1 } 
+          \@@_qpoint:n { row - #1 } 
           \dim_set_eq:NN \l_tmpa_dim \pgf at y
-          \@@_qpoint: { col - #2 } 
+          \@@_qpoint:n { col - #2 } 
           \dim_set_eq:NN \l_tmpb_dim \pgf at x
-          \@@_qpoint: { row - \@@_succ:n { #3 } } 
+          \@@_qpoint:n { row - \@@_succ:n { #3 } } 
           \dim_set_eq:NN \l_tmpc_dim \pgf at y
-          \@@_qpoint: { col - \@@_succ:n { #4 } } 
+          \@@_qpoint:n { col - \@@_succ:n { #4 } } 
           \dim_set_eq:NN \l_tmpd_dim \pgf at x
 %    \end{macrocode}
 % 
@@ -8337,24 +9309,19 @@
               \begin { pgfscope }
               \pgfsetfillcolor { white }
 %    \end{macrocode}
-% Usually, the vertical rules are \emph{before} the |col|-nodes. But there is an
-% exception: if there is no ``first col'', the first vertical rule is after the
-% col node.\footnote{That's true for the vertical rules drawn by ``"|"'' due to
-% the conception of |{array}| (of \pkg{array}) and we have managed to have the
-% same behaviour with |vlines|.}
 % 
-% Since we don't want the white rectangle to erase a part of this
-% first rule, we have to do an adjustment in this case.
-% \emph{after} the ``col node''. 
 %    \begin{macrocode}
-              \int_compare:nNnT { #2 } = 1
+              \pgfpathrectanglecorners 
                 { 
-                  \int_compare:nNnT \l_@@_first_col_int = 1 
-                    { \dim_add:Nn \l_tmpb_dim \arrayrulewidth }
+                  \pgfpoint 
+                    { \l_tmpb_dim + 0.5 \arrayrulewidth }
+                    { \l_tmpa_dim - 0.5 \arrayrulewidth }
+                } 
+                { 
+                  \pgfpoint 
+                    { \l_tmpd_dim - 0.5 \arrayrulewidth }
+                    { \l_tmpc_dim + 0.5 \arrayrulewidth }
                 }
-              \pgfpathrectanglecorners 
-                { \pgfpoint \l_tmpb_dim { \l_tmpa_dim - \arrayrulewidth } } 
-                { \pgfpoint { \l_tmpd_dim - \arrayrulewidth } \l_tmpc_dim }
               \pgfusepathqfill
               \end { pgfscope }
             }
@@ -8398,11 +9365,11 @@
 % |\pgfcoordinate| on the baseline of the row, in the first column of the array.
 % Now, we retrieve the $y$-value of that node and we store it in |\l_tmpa_dim|.
 %    \begin{macrocode}
-            \pgfextracty \l_tmpa_dim { \@@_qpoint: { row - #1 - base } }
+            \pgfextracty \l_tmpa_dim { \@@_qpoint:n { row - #1 - base } }
 %    \end{macrocode}
 % We retrieve (in |\pgf at x|) the $x$-value of the center of the block.
 %    \begin{macrocode}
-            \@@_qpoint: { #1 - #2 - block } 
+            \@@_qpoint:n { #1 - #2 - block } 
 %    \end{macrocode}
 % We put the label of the block which has been composed in |\l_@@_cell_box|.
 %    \begin{macrocode}
@@ -8418,7 +9385,7 @@
 % |\l_@@_cell_box|). 
 %    \begin{macrocode}
           { 
-            \pgftransformshift { \@@_qpoint: { #1 - #2 - block } }
+            \pgftransformshift { \@@_qpoint:n { #1 - #2 - block } }
             \pgfnode { rectangle } { center } 
               { \box_use_drop:N \l_@@_cell_box } { } { }
           }   
@@ -8519,9 +9486,106 @@
 \@@_define_com:nnn V \| \|
 \@@_define_com:nnn B \{ \}
 %    \end{macrocode}
+%
+% \bigskip
+% We define also an command |\AutoNiceMatrix| similar to the environment |{NiceMatrix}|.
+%    \begin{macrocode}
+\NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } } 
+  {
+    \group_begin:
+      \bool_set_true:N \l_@@_NiceArray_bool
+      \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ] 
+    \group_end:
+  }
+%    \end{macrocode}
 % 
+% \subsection*{The redefinition of the command \textbackslash dotfill }
+%
+%    \begin{macrocode}
+\cs_set_eq:NN \@@_dotfill \dotfill
+\cs_new_protected:Npn \@@_dotfill: 
+  { 
+%    \end{macrocode}
+% First, we insert |\@@_dotfill| (which is the saved version of |\dotfill|) in
+% case of use of |\dotfill| ``internally'' in the cell (e.g. |\hbox to 1cm {\dotfill}|).
+%    \begin{macrocode}
+    \@@_dotfill
+    \group_insert_after:N \@@_dotfill_i: 
+  }
+\cs_new_protected:Npn \@@_dotfill_i: { \group_insert_after:N \@@_dotfill_ii: }
+\cs_new_protected:Npn \@@_dotfill_ii: { \group_insert_after:N \@@_dotfill_iii: } 
+%    \end{macrocode}
+% Now, if the box if not empty (unfornately, we can't actually test whether the
+% box is empty and that's why we only consider it's width), we insert
+% |\@@_dotfill| (which is the saved version of |\dotfill|) in the cell of the
+% array, and it will extends, since it's no longer in |\l_@@_cell_box|.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_dotfill_iii: 
+  { \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim  \@@_dotfill } 
+%    \end{macrocode}
+% 
+% \subsection*{The command \textbackslash slashbox}
+%
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_slashbox:nn #1 #2
+  {
+    \tl_gput_right:Nx \g_@@_internal_code_after_tl    
+      { 
+        \@@_actually_slashbox:nnnn 
+          { \int_use:N \c at iRow } { \int_use:N \c at jCol } { #1 } { #2 }
+      }
+  }
+%    \end{macrocode}
+% 
+% \medskip
+% The two arguments of |\@@_actually_slashbox:nn| are the number of row and the
+% number of column of the cell to slash. The two other are the elements to draw
+% below and above the diagonal line.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_actually_slashbox:nnnn #1 #2 #3 #4
+  {
+    \pgfpicture
+    \pgf at relevantforpicturesizefalse
+    \pgfrememberpicturepositiononpagetrue
+    \@@_qpoint:n { row - #1 }
+    \dim_set_eq:NN \l_tmpa_dim \pgf at y
+    \@@_qpoint:n { col - #2 }
+    \dim_set_eq:NN \l_tmpb_dim \pgf at x
+    \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
+    \@@_qpoint:n { row - \@@_succ:n { #1 } }
+    \dim_set_eq:NN \l_tmpc_dim \pgf at y 
+    \@@_qpoint:n { col - \@@_succ:n { #2 } }
+    \dim_set_eq:NN \l_tmpd_dim \pgf at x
+    \pgfpathlineto { \pgfpoint \l_tmpd_dim \l_tmpc_dim }
+    {
+%    \end{macrocode}
+% The command |\CT at arc@| is a command of \pkg{colortbl} which sets the color of
+% the rules in the array. The package \pkg{nicematrix} uses it even if \pkg{colortbl} is not
+% loaded.
+%    \begin{macrocode}
+       \CT at arc@
+       \pgfsetroundcap
+       \pgfusepathqstroke
+    }
+    \pgfset { inner~sep = 1 pt }
+    \pgfscope
+    \pgftransformshift { \pgfpoint \l_tmpb_dim \l_tmpc_dim }
+    \pgfnode { rectangle } { south~west } { $ #3 $ } { } { }
+    \endpgfscope
+    \pgftransformshift { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
+    \pgfnode { rectangle } { north~east } { $ #4 $  } { } { }
+    \endpgfpicture
+  }
+%    \end{macrocode}
+% 
 % \subsection*{The command \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
+% definition of the environment |{@@-light-syntax}| on
+% p.~\pageref{code-light-syntax}. 
+% 
 % The command |\CodeAfter| catches everything until the end of the current
 % environment (of \pkg{nicematrix}).
 %
@@ -8542,7 +9606,8 @@
 % If this is really the end of the current environment (of \pkg{nicematrix}), we
 % put back the command |\end| and its argument in the TeX flow.
 %    \begin{macrocode}
-    \bool_if:NTF { \str_if_eq_p:Vn \g_@@_name_env_str { #1 } }
+    \str_set:NV \l_tmpa_str \@currenvir
+    \bool_if:NTF { \str_if_eq_p:Vn \l_tmpa_str { #1 } }
       { \end { #1 } }
 %    \end{macrocode}
 % It this is not the |\end| we are looking for, we put those tokens in
@@ -8560,6 +9625,18 @@
 % \bigskip
 % \subsection*{We process the options}
 %
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { obsolete~environments }
+  {
+    The~obsolete~environments~(eg.~{pNiceArrayC})~have~been~deleted~
+    from~the~package~nicematrix.\\
+    However,~if~you~still~want~to~use~them,~you~will~find~the~code~for~
+    those~environments~at~the~end~of~the~file~'nicematrix.sty',~after~
+    a~command~'\token_to_str:N\file_input_stop:'.
+  }
+%    \end{macrocode}
+% 
 % We process the options when the package is loaded (with |\usepackage|) but we
 % recommend to use |\NiceMatrixOptions| instead. 
 %
@@ -8570,7 +9647,6 @@
 % Of course, the command |\NiceMatrix| must be defined before such an
 % instruction is executed. 
 %    \begin{macrocode}
-\bool_new:N \c_@@_obsolete_environments_bool
 \keys_define:nn { NiceMatrix / Package }
   {
     renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
@@ -8579,9 +9655,7 @@
     renew-matrix .value_forbidden:n = true ,
     transparent .meta:n = { renew-dots , renew-matrix } ,
     transparent .value_forbidden:n = true,
-    obsolete-environments .bool_set:N = \c_@@_obsolete_environments_bool ,
-    obsolete-environments .value_forbidden:n = true ,
-    obsolete-environments .default:n = true ,
+    obsolete-environments .code:n = \@@_fatal:n { obsolete~environments },
     starred-commands .code:n = 
       \@@_msg_redirect_name:nn { starred~commands } { none } ,
     starred-commands .value_forbidden:n = true ,
@@ -8650,7 +9724,7 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_message_hdotsfor:
   {
-    \tl_if_empty:VF \g_@@_Hdotsfor_lines_tl
+    \tl_if_empty:VF \g_@@_HVdotsfor_lines_tl
       { ~Maybe~your~use~of~\token_to_str:N \Hdotsfor\ is~incorrect.}
   }
 %    \end{macrocode}
@@ -8692,7 +9766,47 @@
   }
 %    \end{macrocode}
 %
-%  
+%    \begin{macrocode}
+\@@_msg_new:nn { in~first~col }
+  {
+    You~can't~use~the~command~#1 in~the~first~column~(number~0)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\@@_msg_new:nn { in~last~col }
+  {
+    You~can't~use~the~command~#1 in~the~last~column~(exterior)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { in~first~row }
+  {
+    You~can't~use~the~command~#1 in~the~first~row~(number~0)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\@@_msg_new:nn { in~last~row }
+  {
+    You~can't~use~the~command~#1 in~the~last~row~(exterior)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { option~S~without~siunitx }
+  {
+    You~can't~use~the~option~'S'~in~your~environment~\@@_full_name_env:
+    because~you~have~not~loaded~siunitx.\\
+    If~you~go~on,~this~option~will~be~ignored.
+  }
+%    \end{macrocode}
+% 
 %    \begin{macrocode}  
 \@@_msg_new:nn { bad~option~for~line-style }
   {
@@ -8782,6 +9896,16 @@
   }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\@@_msg_new:nn { last-col~non~empty~for~NiceMatrixOptions }
+  {
+    In~\NiceMatrixoptions,~you~must~use~the~option~
+    'last-col'~without~value.\\
+    However,~you~can~go~on~for~this~time~
+    (the~value~'\l_keys_value_tl'~will~be~ignored). 
+  }
+%    \end{macrocode}
+%
 % 
 %    \begin{macrocode}
 \@@_msg_new:nn { Block~too~large }
@@ -8843,6 +9967,8 @@
     The~available~options~are~(in~alphabetic~order):~
     allow-duplicate-names,~
     code-for-first-col,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
     code-for-first-row,~
     code-for-last-col,~
     code-for-last-row,~
@@ -8851,8 +9977,12 @@
     create-large-nodes,~
     end-of-row,~
     exterior-arraycolsep,~
+    first-col,~
+    first-row,~
     hlines,~
     hvlines,~
+    last-col,~
+    last-row,~
     left-margin,~
     letter-for-dotted-lines,~
     light-syntax,~
@@ -8883,6 +10013,8 @@
     b,~
     baseline,~
     c,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
     code-after,~
     code-for-first-col,~
     code-for-first-row,~
@@ -8934,6 +10066,8 @@
     b,~
     baseline,~
     c,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
     code-after,~
     code-for-first-col,~
     code-for-first-row,~
@@ -8961,6 +10095,7 @@
     r~(=R),~
     renew-dots,~
     right-margin,~
+    S,~
     small,~
     t,~
     vlines,~
@@ -8970,7 +10105,55 @@
   }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\@@_msg_new:nnn { Unknown~option~for~NiceTabular }
+  { 
+    The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~
+    \{NiceTabular\}. \\
+    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):~
+    b,~
+    baseline,~
+    c,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
+    code-after,~
+    code-for-first-col,~
+    code-for-first-row,~
+    code-for-last-col,~
+    code-for-last-row,~
+    columns-width,~
+    create-extra-nodes,~
+    create-medium-nodes,~
+    create-large-nodes,~
+    end-of-row,~
+    extra-left-margin,~
+    extra-right-margin,~
+    first-col,~
+    first-row,~
+    hlines,~
+    hvlines,~
+    last-col,~
+    last-row,~
+    left-margin,~
+    light-syntax,~
+    name,~
+    nullify-dots,~
+    parallelize-diags,~
+    renew-dots,~
+    right-margin,~
+    t,~
+    vlines,~
+    xdots/color,~
+    xdots/shorten~and~
+    xdots/line-style.
+  }
+%    \end{macrocode}
 %
+%
 %    \begin{macrocode}
 \@@_msg_new:nnn { Duplicate~name }
   { 
@@ -9013,87 +10196,85 @@
 % completly deleted in a future version.
 %
 %    \begin{macrocode} 
-\bool_if:NT \c_@@_obsolete_environments_bool
+\file_input_stop:
+\NewDocumentEnvironment { pNiceArrayC } { }
   {
-    \NewDocumentEnvironment { pNiceArrayC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \pNiceArray
-      }
-      { \endpNiceArray }
-     \NewDocumentEnvironment { bNiceArrayC } { }
-       {
-         \int_zero:N \l_@@_last_col_int 
-         \bNiceArray
-       }
-       { \endbNiceArray }
-    \NewDocumentEnvironment { BNiceArrayC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \BNiceArray
-      }
-      { \endBNiceArray }
-    \NewDocumentEnvironment { vNiceArrayC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \vNiceArray
-      }
-      { \endvNiceArray }
-    \NewDocumentEnvironment { VNiceArrayC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \VNiceArray
-      }
-      { \endVNiceArray }
-    \NewDocumentEnvironment { pNiceArrayRC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \int_zero:N \l_@@_first_row_int 
-        \pNiceArray
-      }
-      { \endpNiceArray }
-    \NewDocumentEnvironment { bNiceArrayRC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \int_zero:N \l_@@_first_row_int 
-        \bNiceArray
-      }
-      { \endbNiceArray }
-    \NewDocumentEnvironment { BNiceArrayRC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \int_zero:N \l_@@_first_row_int 
-        \BNiceArray
-      }
-      { \endBNiceArray }
-    \NewDocumentEnvironment { vNiceArrayRC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \int_zero:N \l_@@_first_row_int 
-        \vNiceArray
-      }
-      { \endvNiceArray }
-    \NewDocumentEnvironment { VNiceArrayRC } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \int_zero:N \l_@@_first_row_int 
-        \VNiceArray
-      }
-      { \endVNiceArray }
-    \NewDocumentEnvironment { NiceArrayCwithDelims } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \NiceArrayWithDelims
-      }
-      { \endNiceArrayWithDelims }
-    \NewDocumentEnvironment { NiceArrayRCwithDelims } { }
-      {
-        \int_zero:N \l_@@_last_col_int 
-        \int_zero:N \l_@@_first_row_int 
-        \NiceArrayWithDelims
-      }
-      { \endNiceArrayWithDelims }
+    \int_zero:N \l_@@_last_col_int 
+    \pNiceArray
   }
+  { \endpNiceArray }
+ \NewDocumentEnvironment { bNiceArrayC } { }
+   {
+     \int_zero:N \l_@@_last_col_int 
+     \bNiceArray
+   }
+   { \endbNiceArray }
+\NewDocumentEnvironment { BNiceArrayC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \BNiceArray
+  }
+  { \endBNiceArray }
+\NewDocumentEnvironment { vNiceArrayC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \vNiceArray
+  }
+  { \endvNiceArray }
+\NewDocumentEnvironment { VNiceArrayC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \VNiceArray
+  }
+  { \endVNiceArray }
+\NewDocumentEnvironment { pNiceArrayRC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \int_zero:N \l_@@_first_row_int 
+    \pNiceArray
+  }
+  { \endpNiceArray }
+\NewDocumentEnvironment { bNiceArrayRC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \int_zero:N \l_@@_first_row_int 
+    \bNiceArray
+  }
+  { \endbNiceArray }
+\NewDocumentEnvironment { BNiceArrayRC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \int_zero:N \l_@@_first_row_int 
+    \BNiceArray
+  }
+  { \endBNiceArray }
+\NewDocumentEnvironment { vNiceArrayRC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \int_zero:N \l_@@_first_row_int 
+    \vNiceArray
+  }
+  { \endvNiceArray }
+\NewDocumentEnvironment { VNiceArrayRC } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \int_zero:N \l_@@_first_row_int 
+    \VNiceArray
+  }
+  { \endVNiceArray }
+\NewDocumentEnvironment { NiceArrayCwithDelims } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \NiceArrayWithDelims
+  }
+  { \endNiceArrayWithDelims }
+\NewDocumentEnvironment { NiceArrayRCwithDelims } { }
+  {
+    \int_zero:N \l_@@_last_col_int 
+    \int_zero:N \l_@@_first_row_int 
+    \NiceArrayWithDelims
+  }
+  { \endNiceArrayWithDelims }
 %    \end{macrocode}
 %
 %
@@ -9164,8 +10345,6 @@
 % possible to externalize the Tikz elements constructed by \pkg{nicematrix}
 % because they use the options |overlay| and |remember picture|.} 
 % 
-% \subsection*{Changes between version 2.1 and 2.1.2}
-% Option |draft|: with this option, the dotted lines are not drawn (quicker).
 %
 % \subsection*{Changes between version 2.1.2 and 2.1.3}
 %
@@ -9218,10 +10397,7 @@
 % 
 % Option |hlines|.
 % 
-% A warning is issued when the |draft| mode is used. In this case, the dotted
-% lines are not drawn.
 %
-%
 % \subsection*{Changes between version 2.3 and 3.0}
 %
 % Modification of |\Hdotsfor|. Now |\Hdotsfor| erases the |\vlines| (of ``"|"'')
@@ -9393,6 +10569,14 @@
 % 
 % New command |\CodeAfter| (in the environments of \pkg{nicematrix}).
 %
+%
+% \subsection*{Changes between versions 3.15 and 4.0}
+%
+% New environment |{NiceTabular}|
+%
+% Commands to color cells, row and columns with a perfect result in the \textsc{pdf}.
+% 
+% 
 % \PrintIndex
 % 
 % \tableofcontents

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2020-05-09 22:06:57 UTC (rev 55078)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2020-05-09 22:07:16 UTC (rev 55079)
@@ -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{3.15}
-\def\myfiledate{2020/04/06}
+\def\myfileversion{4.0}
+\def\myfiledate{2020/05/08}
 \RequirePackage{pgfcore}
 \usepgfmodule{shapes}
 \RequirePackage{l3keys2e}
@@ -36,10 +36,6 @@
   }
 \cs_if_exist:NF \l_keys_key_str
   { \msg_error:nn { nicematrix } { expl3~too~old } }
-\bool_new:N \c__nicematrix_draft_bool
-\DeclareOption { draft } { \bool_set_true:N \c__nicematrix_draft_bool }
-\DeclareOption* { }
-\ProcessOptions \relax
 \RequirePackage { array }
 \RequirePackage { amsmath }
 \RequirePackage { xparse }
@@ -52,9 +48,13 @@
 \cs_new_protected:Npn \__nicematrix_msg_new:nnn { \msg_new:nnnn { nicematrix } }
 \cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn
   { \msg_redirect_name:nnn { nicematrix } }
+\bool_new:N \c__nicematrix_booktabs_loaded_bool
 \bool_new:N \c__nicematrix_tikz_loaded_bool
 \AtBeginDocument
   {
+    \@ifpackageloaded { booktabs }
+      { \bool_set_true:N \c__nicematrix_booktabs_loaded_bool }
+      { }
     \@ifpackageloaded { tikz }
       {
         \bool_set_true:N \c__nicematrix_tikz_loaded_bool
@@ -73,9 +73,6 @@
 \@ifclassloaded { revtex4-2 }
   { \bool_set_true:N \c__nicematrix_revtex_bool }
   { }
-\__nicematrix_msg_new:nn { Draft~mode }
-  { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. }
-\bool_if:NT \c__nicematrix_draft_bool { \msg_warning:nn { nicematrix }  { Draft~mode } }
 \ProvideDocumentCommand \iddots { }
   {
     \mathinner
@@ -90,79 +87,45 @@
         \tex_mkern:D 1 mu
       }
   }
-\int_new:N \g__nicematrix_env_int
-\cs_new:Npn \__nicematrix_env: { nm - \int_use:N \g__nicematrix_env_int }
-\cs_new_protected:Npn \__nicematrix_qpoint: #1
-  { \pgfpointanchor { \__nicematrix_env: - #1 } { center } }
-\int_new:N \g__nicematrix_NiceMatrixBlock_int
-\dim_new:N \l__nicematrix_columns_width_dim
-\seq_new:N \g__nicematrix_names_seq
-
-\bool_new:N \l__nicematrix_in_env_bool
-\bool_new:N \l__nicematrix_NiceArray_bool
-\cs_new_protected:Npn \__nicematrix_test_if_math_mode:
+\AtBeginDocument
   {
-    \if_mode_math: \else:
-      \__nicematrix_fatal:n { Outside~math~mode }
-    \fi:
+    \@ifpackageloaded { booktabs }
+      { \iow_now:Nn \@mainaux \nicematrix at redefine@check at rerun }
+      { }
   }
+\cs_set_protected:Npn \nicematrix at redefine@check at rerun
+  {
+    \cs_set_eq:NN \__nicematrix_old_pgfutil at check@rerun \pgfutil at check@rerun
+    \cs_set_protected:Npn \pgfutil at check@rerun ##1 ##2
+      {
+        \str_set:Nx \l_tmpa_str { \tl_range:nnn { ##1 } 1 3 }
+        \str_if_eq:VnF \l_tmpa_str { nm- }
+          { \__nicematrix_old_pgfutil at check@rerun { ##1 } { ##2 } }
+      }
+  }
 \bool_new:N \c__nicematrix_colortbl_loaded_bool
 \AtBeginDocument
   {
     \@ifpackageloaded { colortbl }
+      { \bool_set_true:N \c__nicematrix_colortbl_loaded_bool }
       {
-        \bool_set_true:N \c__nicematrix_colortbl_loaded_bool
-        \cs_set_protected:Npn \__nicematrix_vline_i: { { \CT at arc@ \vline } }
+        \cs_set_protected:Npn \CT at arc@ { }
+        \NewDocumentCommand { \arrayrulecolor } { m }
+          { \tl_gset:Nn \CT at arc@ { \color { #1 } } }
+        \cs_set:Npn \hline
+          {
+            \noalign { \ifnum 0 = `} \fi
+            \let \hskip \vskip
+            \let \vrule \hrule
+            \let \@width \@height
+            { \CT at arc@ \vline }
+            \futurelet \reserved at a
+            \@xhline
+          }
       }
-      { }
   }
-\colorlet { nicematrix-last-col } { . }
-\colorlet { nicematrix-last-row } { . }
-\dim_new:N \l__nicematrix_inter_dots_dim
-\dim_set:Nn \l__nicematrix_inter_dots_dim { 0.45 em }
-\dim_new:N \l__nicematrix_xdots_shorten_dim
-\dim_set:Nn \l__nicematrix_xdots_shorten_dim { 0.3 em }
-\dim_new:N \l__nicematrix_radius_dim
-\dim_set:Nn \l__nicematrix_radius_dim { 0.53 pt }
-\str_new:N \g__nicematrix_name_env_str
-\str_new:N \g__nicematrix_com_or_env_str
-\str_set:Nn \g__nicematrix_com_or_env_str { environment }
-\cs_new:Npn \__nicematrix_full_name_env:
-  {
-    \str_if_eq:VnTF \g__nicematrix_com_or_env_str { command }
-      { command \space \c_backslash_str \g__nicematrix_name_env_str }
-      { environment \space \{ \g__nicematrix_name_env_str \} }
-  }
-\tl_new:N \g__nicematrix_internal_code_after_tl
-\tl_new:N \g__nicematrix_code_after_tl
-\int_new:N \l__nicematrix_save_iRow_int
-\int_new:N \l__nicematrix_save_jCol_int
-\bool_new:N \g__nicematrix_row_of_col_done_bool
-\tl_new:N \l__nicematrix_initial_suffix_tl
-\tl_new:N \l__nicematrix_initial_anchor_tl
-\tl_new:N \l__nicematrix_final_suffix_tl
-\tl_new:N \l__nicematrix_final_anchor_tl
-\dim_new:N \l__nicematrix_x_initial_dim
-\dim_new:N \l__nicematrix_y_initial_dim
-\dim_new:N \l__nicematrix_x_final_dim
-\dim_new:N \l__nicematrix_y_final_dim
-\dim_new:N \l_tmpc_dim
-\dim_new:N \l_tmpd_dim
-\bool_new:N \g__nicematrix_empty_cell_bool
-\tl_new:N \l__nicematrix_xdots_line_style_tl
-\tl_const:Nn \c__nicematrix_standard_tl { standard }
-\tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl
-\int_new:N \l__nicematrix_first_row_int
-\int_set:Nn \l__nicematrix_first_row_int 1
-\int_new:N \l__nicematrix_first_col_int
-\int_set:Nn \l__nicematrix_first_col_int 1
-\int_new:N \l__nicematrix_last_row_int
-\int_set:Nn \l__nicematrix_last_row_int { -2 }
-\bool_new:N \l__nicematrix_last_row_without_value_bool
-\bool_new:N \l__nicematrix_last_col_without_value_bool
-\int_new:N \l__nicematrix_last_col_int
-\int_set:Nn \l__nicematrix_last_col_int { -2 }
-\bool_new:N \g__nicematrix_last_col_found_bool
+\cs_new:Npn \__nicematrix_succ:n #1 { \the \numexpr #1 + 1 \relax }
+\cs_new:Npn \__nicematrix_pred:n #1 { \the \numexpr #1 - 1 \relax }
 \bool_new:N \c__nicematrix_siunitx_loaded_bool
 \AtBeginDocument
   {
@@ -202,8 +165,60 @@
         \NC at find
       }
   }
-\cs_new:Npn \__nicematrix_succ:n #1 { \the \numexpr #1 + 1 \relax }
-\cs_new:Npn \__nicematrix_pred:n #1 { \the \numexpr #1 - 1 \relax }
+\int_new:N \g__nicematrix_env_int
+\cs_new:Npn \__nicematrix_env: { nm - \int_use:N \g__nicematrix_env_int }
+\cs_new_protected:Npn \__nicematrix_qpoint:n #1
+  { \pgfpointanchor { \__nicematrix_env: - #1 } { center } }
+\int_new:N \g__nicematrix_NiceMatrixBlock_int
+\dim_new:N \l__nicematrix_columns_width_dim
+\seq_new:N \g__nicematrix_names_seq
+\bool_new:N \l__nicematrix_in_env_bool
+\bool_new:N \l__nicematrix_NiceArray_bool
+\bool_new:N \l__nicematrix_NiceTabular_bool
+\cs_new_protected:Npn \__nicematrix_test_if_math_mode:
+  {
+    \if_mode_math: \else:
+      \__nicematrix_fatal:n { Outside~math~mode }
+    \fi:
+  }
+\colorlet { nicematrix-last-col } { . }
+\colorlet { nicematrix-last-row } { . }
+\str_new:N \g__nicematrix_name_env_str
+\str_new:N \g__nicematrix_com_or_env_str
+\str_set:Nn \g__nicematrix_com_or_env_str { environment }
+\cs_new:Npn \__nicematrix_full_name_env:
+  {
+    \str_if_eq:VnTF \g__nicematrix_com_or_env_str { command }
+      { command \space \c_backslash_str \g__nicematrix_name_env_str }
+      { environment \space \{ \g__nicematrix_name_env_str \} }
+  }
+\tl_new:N \g__nicematrix_code_after_tl
+\tl_new:N \g__nicematrix_internal_code_after_tl
+\int_new:N \l__nicematrix_old_iRow_int
+\int_new:N \l__nicematrix_old_jCol_int
+\bool_new:N \g__nicematrix_row_of_col_done_bool
+\bool_new:N \l__nicematrix_code_before_bool
+\dim_new:N \l__nicematrix_x_initial_dim
+\dim_new:N \l__nicematrix_y_initial_dim
+\dim_new:N \l__nicematrix_x_final_dim
+\dim_new:N \l__nicematrix_y_final_dim
+\dim_zero_new:N \l_tmpc_dim
+\dim_zero_new:N \l_tmpd_dim
+\bool_new:N \g__nicematrix_empty_cell_bool
+\dim_new:N \__nicematrix_old_arraycolsep_dim
+\dim_new:N \g__nicematrix_width_last_col_dim
+\dim_new:N \g__nicematrix_width_first_col_dim
+\int_new:N \l__nicematrix_first_row_int
+\int_set:Nn \l__nicematrix_first_row_int 1
+\int_new:N \l__nicematrix_first_col_int
+\int_set:Nn \l__nicematrix_first_col_int 1
+\int_new:N \l__nicematrix_last_row_int
+\int_set:Nn \l__nicematrix_last_row_int { -2 }
+\bool_new:N \l__nicematrix_last_row_without_value_bool
+\bool_new:N \l__nicematrix_last_col_without_value_bool
+\int_new:N \l__nicematrix_last_col_int
+\int_set:Nn \l__nicematrix_last_col_int { -2 }
+\bool_new:N \g__nicematrix_last_col_found_bool
 \cs_new_protected:Npn \__nicematrix_pgf_rect_node:nnnnn #1 #2 #3 #4 #5
   {
     \begin { pgfscope }
@@ -253,6 +268,17 @@
       { }
     \end { pgfscope }
   }
+\dim_new:N \l__nicematrix_cell_space_top_limit_dim
+\dim_new:N \l__nicematrix_cell_space_bottom_limit_dim
+\dim_new:N \l__nicematrix_inter_dots_dim
+\dim_set:Nn \l__nicematrix_inter_dots_dim { 0.45 em }
+\dim_new:N \l__nicematrix_xdots_shorten_dim
+\dim_set:Nn \l__nicematrix_xdots_shorten_dim { 0.3 em }
+\dim_new:N \l__nicematrix_radius_dim
+\dim_set:Nn \l__nicematrix_radius_dim { 0.53 pt }
+\tl_new:N \l__nicematrix_xdots_line_style_tl
+\tl_const:Nn \c__nicematrix_standard_tl { standard }
+\tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl
 \bool_new:N \l__nicematrix_light_syntax_bool
 \str_new:N \l__nicematrix_baseline_str
 \str_set:Nn \l__nicematrix_baseline_str c
@@ -268,8 +294,6 @@
 \bool_new:N \l__nicematrix_large_nodes_bool
 \dim_new:N \l__nicematrix_left_margin_dim
 \dim_new:N \l__nicematrix_right_margin_dim
-\dim_new:N \g__nicematrix_width_last_col_dim
-\dim_new:N \g__nicematrix_width_first_col_dim
 \dim_new:N \l__nicematrix_extra_left_margin_dim
 \dim_new:N \l__nicematrix_extra_right_margin_dim
 \tl_new:N \l__nicematrix_end_of_row_tl
@@ -297,6 +321,10 @@
   }
 \keys_define:nn { NiceMatrix / Global }
   {
+    cell-space-top-limit .dim_set:N = \l__nicematrix_cell_space_top_limit_dim ,
+    cell-space-top-limit .value_required:n = true ,
+    cell-space-bottom-limit .dim_set:N = \l__nicematrix_cell_space_bottom_limit_dim ,
+    cell-space-bottom-limit .value_required:n = true ,
     xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } ,
     max-delimiter-width .bool_set:N = \l__nicematrix_max_delimiter_width_bool ,
     light-syntax .bool_set:N = \l__nicematrix_light_syntax_bool ,
@@ -303,6 +331,10 @@
     light-syntax .default:n = true ,
     end-of-row .tl_set:N = \l__nicematrix_end_of_row_tl ,
     end-of-row .value_required:n = true ,
+    first-col .code:n = \int_zero:N \l__nicematrix_first_col_int ,
+    first-row .code:n = \int_zero:N \l__nicematrix_first_row_int ,
+    last-row .int_set:N = \l__nicematrix_last_row_int ,
+    last-row .default:n = -1 ,
     code-for-first-col .tl_set:N = \l__nicematrix_code_for_first_col_tl ,
     code-for-first-col .value_required:n = true ,
     code-for-last-col .tl_set:N = \l__nicematrix_code_for_last_col_tl ,
@@ -311,7 +343,6 @@
     code-for-first-row .value_required:n = true ,
     code-for-last-row .tl_set:N = \l__nicematrix_code_for_last_row_tl ,
     code-for-last-row .value_required:n = true ,
-    small .bool_set:N = \l__nicematrix_small_bool ,
     hlines .bool_set:N = \l__nicematrix_hlines_bool ,
     vlines .bool_set:N = \l__nicematrix_vlines_bool ,
     hvlines .meta:n = { hlines , vlines } ,
@@ -337,6 +368,14 @@
   }
 \keys_define:nn { NiceMatrix / Env }
   {
+    code-before .code:n =
+     {
+       \tl_if_empty:nF { #1 }
+         {
+           \tl_set:Nn \l__nicematrix_code_before_tl { #1 }
+           \bool_set_true:N \l__nicematrix_code_before_bool
+         }
+     } ,
     c .code:n = \str_set:Nn \l__nicematrix_baseline_str c ,
     t .code:n = \str_set:Nn \l__nicematrix_baseline_str t ,
     b .code:n = \str_set:Nn \l__nicematrix_baseline_str b ,
@@ -359,10 +398,6 @@
     name .value_required:n = true ,
     code-after .tl_gset:N = \g__nicematrix_code_after_tl ,
     code-after .value_required:n = true ,
-    first-col .code:n = \int_zero:N \l__nicematrix_first_col_int ,
-    first-row .code:n = \int_zero:N \l__nicematrix_first_row_int ,
-    last-row .int_set:N = \l__nicematrix_last_row_int ,
-    last-row .default:n = -1 ,
   }
 \keys_define:nn { NiceMatrix }
   {
@@ -377,6 +412,12 @@
         NiceMatrix / Env ,
       } ,
     NiceMatrix / xdots .inherit:n = NiceMatrix / xdots ,
+    NiceTabular .inherit:n =
+      {
+        NiceMatrix / Global ,
+        NiceMatrix / Env
+      } ,
+    NiceTabular / xdots .inherit:n = NiceMatrix / xdots ,
     NiceArray .inherit:n =
       {
         NiceMatrix / Global ,
@@ -392,6 +433,11 @@
   }
 \keys_define:nn { NiceMatrix / NiceMatrixOptions }
   {
+    last-col .code:n = \tl_if_empty:nF { #1 }
+                         { \__nicematrix_error:n { last-col~non~empty~for~NiceMatrixOptions } }
+                       \int_zero:N \l__nicematrix_last_col_int ,
+    small .bool_set:N = \l__nicematrix_small_bool ,
+    small .value_forbidden:n = true ,
     renew-matrix .code:n = \__nicematrix_renew_matrix: ,
     renew-matrix .value_forbidden:n = true ,
     transparent .meta:n = { renew-dots , renew-matrix } ,
@@ -429,10 +475,17 @@
     r .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl R ,
     L .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl L ,
     R .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl R ,
+    S .code:n = \bool_if:NTF \c__nicematrix_siunitx_loaded_bool
+                  { \tl_set:Nn \l__nicematrix_type_of_col_tl S }
+                  { \__nicematrix_error:n { option~S~without~siunitx } } ,
+    small .bool_set:N = \l__nicematrix_small_bool ,
+    small .value_forbidden:n = true ,
     unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix }
   }
 \keys_define:nn { NiceMatrix / NiceArray }
   {
+    small .bool_set:N = \l__nicematrix_small_bool ,
+    small .value_forbidden:n = true ,
     last-col .code:n = \tl_if_empty:nF { #1 }
                          { \__nicematrix_error:n { last-col~non~empty~for~NiceArray } }
                        \int_zero:N \l__nicematrix_last_col_int ,
@@ -445,10 +498,14 @@
                          { \__nicematrix_error:n { last-col~non~empty~for~NiceArray } }
                        \int_zero:N \l__nicematrix_last_col_int ,
     first-row .code:n = \int_zero:N \l__nicematrix_first_row_int ,
-    last-row .int_set:N = \l__nicematrix_last_row_int ,
-    last-row .default:n = -1 ,
+    small .bool_set:N = \l__nicematrix_small_bool ,
+    small .value_forbidden:n = true ,
     unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix }
   }
+\keys_define:nn { NiceMatrix / NiceTabular }
+  {
+    unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceTabular }
+  }
 \cs_new_protected:Npn \__nicematrix_Cell:
   {
     \int_gincr:N \c at jCol
@@ -456,8 +513,11 @@
       { \int_compare:nNnT \l__nicematrix_first_col_int = 1 \__nicematrix_begin_of_row: }
     \int_gset:Nn \g__nicematrix_col_total_int { \int_max:nn \g__nicematrix_col_total_int \c at jCol }
     \hbox_set:Nw \l__nicematrix_cell_box
-    \c_math_toggle_token
-    \bool_if:NT \l__nicematrix_small_bool \scriptstyle
+    \bool_if:NF \l__nicematrix_NiceTabular_bool
+      {
+        \c_math_toggle_token
+        \bool_if:NT \l__nicematrix_small_bool \scriptstyle
+      }
     \int_compare:nNnTF \c at iRow = 0
       {
         \int_compare:nNnT \c at jCol > 0
@@ -484,12 +544,12 @@
     \pgfrememberpicturepositiononpagetrue
     \pgfcoordinate
       { \__nicematrix_env: - row - \int_use:N \c at iRow - base }
-      \pgfpointorigin
+      { \pgfpoint \c_zero_dim { 0.5 \arrayrulewidth } }
     \str_if_empty:NF \l__nicematrix_name_str
       {
         \pgfnodealias
+          { \l__nicematrix_name_str - row - \int_use:N \c at iRow - base }
           { \__nicematrix_env: - row - \int_use:N \c at iRow - base }
-          { \l__nicematrix_name_str - row - \int_use:N \c at iRow - base }
       }
     \endpgfpicture
   }
@@ -512,17 +572,18 @@
   }
 \cs_new_protected:Npn \__nicematrix_end_Cell:
   {
-    \c_math_toggle_token
+    \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token
     \hbox_set_end:
+    \box_set_ht:Nn \l__nicematrix_cell_box
+      { \box_ht:N \l__nicematrix_cell_box + \l__nicematrix_cell_space_top_limit_dim }
+    \box_set_dp:Nn \l__nicematrix_cell_box
+      { \box_dp:N \l__nicematrix_cell_box + \l__nicematrix_cell_space_bottom_limit_dim }
     \dim_gset:Nn \g__nicematrix_max_cell_width_dim
       { \dim_max:nn \g__nicematrix_max_cell_width_dim { \box_wd:N \l__nicematrix_cell_box } }
     \__nicematrix_update_for_first_and_last_row:
     \bool_if:NTF \g__nicematrix_empty_cell_bool
+      { \box_use_drop:N \l__nicematrix_cell_box }
       {
-        \box_use_drop:N \l__nicematrix_cell_box
-        \bool_gset_false:N \g__nicematrix_empty_cell_bool
-      }
-      {
         \dim_compare:nNnTF { \box_wd:N \l__nicematrix_cell_box } > \c_zero_dim
           \__nicematrix_node_for_the_cell:
           { \box_use_drop:N \l__nicematrix_cell_box }
@@ -553,19 +614,15 @@
       }
     \endpgfpicture
   }
-\bool_if:NTF \c__nicematrix_draft_bool
-  { \cs_set_protected:Npn \__nicematrix_instruction_of_type:nn #1 #2 { } }
+\cs_new_protected:Npn \__nicematrix_instruction_of_type:nn #1 #2
   {
-    \cs_new_protected:Npn \__nicematrix_instruction_of_type:nn #1 #2
+    \tl_gput_right:cx
+      { g__nicematrix_ #1 _ lines _ tl }
       {
-        \tl_gput_right:cx
-          { g__nicematrix_ #1 _ lines _ tl }
-          {
-            \use:c { __nicematrix _ draw _ #1 : nnn }
-              { \int_use:N \c at iRow }
-              { \int_use:N \c at jCol }
-              { \exp_not:n { #2 } }
-          }
+        \use:c { __nicematrix _ draw _ #1 : nnn }
+          { \int_use:N \c at iRow }
+          { \int_use:N \c at jCol }
+          { \exp_not:n { #2 } }
       }
   }
 \cs_new_protected:Npn \__nicematrix_array:
@@ -581,49 +638,82 @@
       \array
     [ \str_if_eq:VnTF \l__nicematrix_baseline_str c c t ]
   }
-\cs_set_eq:NN \__nicematrix_standard_ialign: \ialign
-\cs_new:Npn \__nicematrix_everycr: { \noalign { \__nicematrix_everycr_i: } }
-\cs_new_protected:Npn \__nicematrix_everycr_i:
+\cs_set_eq:NN \__nicematrix_old_ialign: \ialign
+\cs_new_protected:Npn \__nicematrix_create_row_node:
   {
-    \int_gzero:N \c at jCol
     \hbox
       {
+        \bool_if:NT \l__nicematrix_code_before_bool
+          {
+            \vtop
+              {
+                \skip_vertical:N 0.5\arrayrulewidth
+                \pgfsys at markposition { \__nicematrix_env: - row - \__nicematrix_succ:n \c at iRow }
+                \skip_vertical:N -0.5\arrayrulewidth
+              }
+          }
         \pgfpicture
         \pgfrememberpicturepositiononpagetrue
         \pgfcoordinate { \__nicematrix_env: - row - \__nicematrix_succ:n \c at iRow }
-          \pgfpointorigin
+          { \pgfpoint \c_zero_dim { - 0.5 \arrayrulewidth } }
         \str_if_empty:NF \l__nicematrix_name_str
           {
             \pgfnodealias
-              { \__nicematrix_env: - row - \int_use:N \c at iRow - row }
-              { \l__nicematrix_name_str - row - \int_use:N \c at iRow - row }
+              { \l__nicematrix_name_str - row - \int_use:N \c at iRow }
+              { \__nicematrix_env: - row - \int_use:N \c at iRow }
           }
         \endpgfpicture
       }
-    \bool_if:NT \l__nicematrix_hlines_bool
+  }
+\cs_new:Npn \__nicematrix_everycr: { \noalign { \__nicematrix_everycr_i: } }
+\cs_new_protected:Npn \__nicematrix_everycr_i:
+  {
+    \int_gzero:N \c at jCol
+    \bool_if:NF \g__nicematrix_row_of_col_done_bool
       {
-        \int_compare:nNnT \c at iRow > { -1 }
+        \__nicematrix_create_row_node:
+        \bool_if:NT \l__nicematrix_hlines_bool
           {
-            \bool_if:NF \g__nicematrix_row_of_col_done_bool
+            \int_compare:nNnT \c at iRow > { -1 }
               {
                 \int_compare:nNnF \c at iRow = \l__nicematrix_last_row_int
-                  {
-                    \bool_if:NTF \c__nicematrix_colortbl_loaded_bool
-                      { { \CT at arc@ \hrule height \arrayrulewidth } }
-                      { \hrule height \arrayrulewidth }
-                  }
+                  { { \CT at arc@ \hrule height \arrayrulewidth } }
               }
           }
       }
   }
+\cs_set_protected:Npn \__nicematrix_newcolumntype #1
+  {
+    \cs_if_free:cT { NC @ find @ #1 }
+      { \NC at list \expandafter { \the \NC at list \NC at do #1 } }
+    \cs_set:cpn {NC @ find @ #1 } ##1 #1 { \NC@ { ##1 } }
+    \peek_meaning:NTF [
+      { \newcol@ #1 }
+      { \newcol@ #1 [ 0 ] }
+  }
+\cs_new_protected:Npn \__nicematrix_define_columntype:nn #1 #2
+  {
+    \__nicematrix_newcolumntype #1 [ 1 ]
+      {
+        > {
+            \__nicematrix_Cell:
+            \begin { minipage } [ #2 ] { ##1 }
+            \mode_leave_vertical: \box_use:N \@arstrutbox
+          }
+        c
+        < { \box_use:N \@arstrutbox \end { minipage } \__nicematrix_end_Cell: }
+      }
+  }
 \cs_new_protected:Npn \__nicematrix_pre_array:
   {
+    \bool_if:NT \c__nicematrix_booktabs_loaded_bool
+      { \tl_put_left:Nn \@BTnormal \__nicematrix_create_row_node: }
     \box_clear_new:N \l__nicematrix_cell_box
     \cs_if_exist:NT \theiRow
-      { \int_set_eq:NN \l__nicematrix_save_iRow_int \c at iRow }
+      { \int_set_eq:NN \l__nicematrix_old_iRow_int \c at iRow }
     \int_gzero_new:N \c at iRow
     \cs_if_exist:NT \thejCol
-      { \int_set_eq:NN \l__nicematrix_save_jCol_int \c at jCol }
+      { \int_set_eq:NN \l__nicematrix_old_jCol_int \c at jCol }
     \int_gzero_new:N \c at jCol
     \normalbaselines
     \bool_if:NT \l__nicematrix_small_bool
@@ -633,6 +723,8 @@
       }
     \cs_set:Npn \ialign
       {
+        \bool_if:NT \l__nicematrix_NiceTabular_bool
+          { \dim_set_eq:NN \arraycolsep \__nicematrix_old_arraycolsep_dim }
         \bool_if:NTF \c__nicematrix_colortbl_loaded_bool
           {
             \CT at everycr
@@ -654,17 +746,14 @@
         \dim_gset:Nn \g__nicematrix_ht_last_row_dim { \box_ht:N \@arstrutbox }
         \dim_gzero_new:N \g__nicematrix_dp_last_row_dim
         \dim_gset:Nn \g__nicematrix_dp_last_row_dim { \box_dp:N \@arstrutbox }
-        \cs_set_eq:NN \ialign \__nicematrix_standard_ialign:
+        \cs_set_eq:NN \ialign \__nicematrix_old_ialign:
         \halign
       }
-    \newcolumntype L { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: }
-    \newcolumntype C { > \__nicematrix_Cell: c < \__nicematrix_end_Cell: }
-    \newcolumntype R { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: }
-    \cs_set_eq:NN \__nicematrix_ldots \ldots
-    \cs_set_eq:NN \__nicematrix_cdots \cdots
-    \cs_set_eq:NN \__nicematrix_vdots \vdots
-    \cs_set_eq:NN \__nicematrix_ddots \ddots
-    \cs_set_eq:NN \__nicematrix_iddots \iddots
+    \cs_set_eq:NN \__nicematrix_old_ldots \ldots
+    \cs_set_eq:NN \__nicematrix_old_cdots \cdots
+    \cs_set_eq:NN \__nicematrix_old_vdots \vdots
+    \cs_set_eq:NN \__nicematrix_old_ddots \ddots
+    \cs_set_eq:NN \__nicematrix_old_iddots \iddots
     \cs_set_eq:NN \firsthline \hline
     \cs_set_eq:NN \lasthline \hline
     \cs_set_eq:NN \Ldots \__nicematrix_Ldots
@@ -675,11 +764,14 @@
     \cs_set_eq:NN \hdottedline \__nicematrix_hdottedline:
     \cs_set_eq:NN \Hspace \__nicematrix_Hspace:
     \cs_set_eq:NN \Hdotsfor \__nicematrix_Hdotsfor:
+    \cs_set_eq:NN \Vdotsfor \__nicematrix_Vdotsfor:
     \cs_set_eq:NN \multicolumn \__nicematrix_multicolumn:nnn
     \cs_set_eq:NN \Block \__nicematrix_Block:
     \cs_set_eq:NN \rotate \__nicematrix_rotate:
     \cs_set_eq:NN \OnlyMainNiceMatrix \__nicematrix_OnlyMainNiceMatrix:n
+    \cs_set_eq:NN \dotfill \__nicematrix_dotfill:
     \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter:n
+    \cs_set_eq:NN \slashbox \__nicematrix_slashbox:nn
     \bool_if:NT \l__nicematrix_renew_dots_bool
       {
         \cs_set_eq:NN \ldots \__nicematrix_Ldots
@@ -696,9 +788,13 @@
     \int_gzero_new:N \g__nicematrix_row_total_int
     \int_gzero_new:N \g__nicematrix_col_total_int
     \cs_set_eq:NN \@ifnextchar \new at ifnextchar
-    \cs_set_eq:NN \NC at find@w \relax
-    \cs_set_eq:NN \NC at find@W \relax
-    \newcolumntype w [ 2 ]
+    \__nicematrix_newcolumntype L { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: }
+    \__nicematrix_newcolumntype C { > \__nicematrix_Cell: c < \__nicematrix_end_Cell: }
+    \__nicematrix_newcolumntype R { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: }
+    \__nicematrix_define_columntype:nn p t
+    \__nicematrix_define_columntype:nn m c
+    \__nicematrix_define_columntype:nn b b
+    \__nicematrix_newcolumntype w [ 2 ]
       {
         > {
             \hbox_set:Nw \l__nicematrix_cell_box
@@ -712,7 +808,7 @@
                { \box_use_drop:N \l__nicematrix_cell_box }
           }
       }
-    \newcolumntype W [ 2 ]
+    \__nicematrix_newcolumntype W [ 2 ]
       {
         > {
             \hbox_set:Nw \l__nicematrix_cell_box
@@ -755,7 +851,7 @@
     \tl_gclear_new:N \g__nicematrix_Vdots_lines_tl
     \tl_gclear_new:N \g__nicematrix_Ddots_lines_tl
     \tl_gclear_new:N \g__nicematrix_Iddots_lines_tl
-    \tl_gclear_new:N \g__nicematrix_Hdotsfor_lines_tl
+    \tl_gclear_new:N \g__nicematrix_HVdotsfor_lines_tl
  }
 \NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } }
   {
@@ -765,7 +861,9 @@
     \str_if_empty:NT \g__nicematrix_name_env_str
       { \str_gset:Nn \g__nicematrix_name_env_str { NiceArrayWithDelims } }
     \__nicematrix_adapt_S_column:
-    \__nicematrix_test_if_math_mode:
+    \bool_if:NTF \l__nicematrix_NiceTabular_bool
+      \mode_leave_vertical:
+      \__nicematrix_test_if_math_mode:
     \bool_if:NT \l__nicematrix_in_env_bool { \__nicematrix_fatal:n { Yet~in~env } }
     \bool_set_true:N \l__nicematrix_in_env_bool
     \cs_if_exist:NT \tikz at library@external at loaded
@@ -782,6 +880,61 @@
       { \keys_set:nn { NiceMatrix / NiceArray } }
       { \keys_set:nn { NiceMatrix / pNiceArray } }
     { #3 , #5 }
+    \bool_if:NT \l__nicematrix_code_before_bool
+      {
+        \seq_if_exist:cT { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq }
+          {
+            \int_zero_new:N \c at iRow
+            \int_set:Nn \c at iRow
+              { \seq_item:cn { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq } 2 }
+            \int_zero_new:N \c at jCol
+            \int_set:Nn \c at jCol
+              { \seq_item:cn { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq } 4 }
+            \int_compare:nNnF \l__nicematrix_last_row_int = { -2 }
+              { \int_decr:N \c at iRow }
+            \int_compare:nNnF \l__nicematrix_last_col_int = { -2 }
+              { \int_decr:N \c at jCol }
+            \pgfsys at markposition { \__nicematrix_env: - position }
+            \pgfsys at getposition { \__nicematrix_env: - position } \__nicematrix_picture_position:
+            \pgfpicture
+            \int_step_inline:nnn
+              { \seq_item:cn { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq } 1 }
+              { \seq_item:cn { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq } 2 + 1 }
+              {
+                \pgfsys at getposition { \__nicematrix_env: - row - ##1 } \__nicematrix_node_position:
+                \pgfcoordinate { \__nicematrix_env: - row - ##1 }
+                  { \pgfpointdiff \__nicematrix_picture_position: \__nicematrix_node_position: }
+              }
+            \int_step_inline:nnn
+              { \seq_item:cn { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq } 3 }
+              { \seq_item:cn { __nicematrix_size_ \int_use:N \g__nicematrix_env_int _ seq } 4 + 1 }
+              {
+                \pgfsys at getposition { \__nicematrix_env: - col - ##1 } \__nicematrix_node_position:
+                \pgfcoordinate { \__nicematrix_env: - col - ##1 }
+                  { \pgfpointdiff \__nicematrix_picture_position: \__nicematrix_node_position: }
+              }
+            \endpgfpicture
+            \group_begin:
+              \bool_if:NT \c__nicematrix_tikz_loaded_bool
+                {
+                  \pgfset
+                    {
+                      every~picture / .style =
+                       { overlay , name~prefix = \__nicematrix_env: - }
+                    }
+                }
+              \cs_set_eq:NN \cellcolor \__nicematrix_cellcolor:nn
+              \cs_set_eq:NN \rectanglecolor \__nicematrix_rectanglecolor:nnn
+              \cs_set_eq:NN \rowcolor \__nicematrix_rowcolor:nn
+              \cs_set_eq:NN \rowcolors \__nicematrix_rowcolors:nnn
+              \cs_set_eq:NN \columncolor \__nicematrix_columncolor:nn
+              \cs_set_eq:NN \chessboardcolors \__nicematrix_chessboardcolors:nn
+              \bool_if:NT \l__nicematrix_NiceTabular_bool \c_math_toggle_token
+              \l__nicematrix_code_before_tl
+              \bool_if:NT \l__nicematrix_NiceTabular_bool \c_math_toggle_token
+            \group_end:
+          }
+      }
     \int_compare:nNnT \l__nicematrix_last_row_int > { -2 }
       {
         \tl_put_right:Nn \__nicematrix_update_for_first_and_last_row:
@@ -851,6 +1004,7 @@
         \bool_lazy_all:nT
           {
             \l__nicematrix_NiceArray_bool
+            { \bool_not_p:n \l__nicematrix_NiceTabular_bool }
             { \bool_not_p:n \l__nicematrix_vlines_bool }
             { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
           }
@@ -862,6 +1016,7 @@
         \bool_lazy_all:nT
           {
             \l__nicematrix_NiceArray_bool
+            { \bool_not_p:n \l__nicematrix_NiceTabular_bool }
             { \bool_not_p:n \l__nicematrix_vlines_bool }
             { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
           }
@@ -869,6 +1024,11 @@
       }
     \tl_put_right:Nn \l_tmpa_tl { > { \__nicematrix_error_too_much_cols: } L }
     \hbox_set:Nw \l__nicematrix_the_array_box
+    \bool_if:NT \l__nicematrix_NiceTabular_bool
+      {
+        \dim_set_eq:NN \__nicematrix_old_arraycolsep_dim \arraycolsep
+        \dim_set_eq:NN \arraycolsep \tabcolsep
+      }
     \bool_if:NT \l__nicematrix_vlines_bool
       {
         \dim_add:Nn \arraycolsep { 0.5 \arrayrulewidth }
@@ -878,13 +1038,13 @@
     \skip_horizontal:N \l__nicematrix_extra_left_margin_dim
     \c_math_toggle_token
     \bool_if:NTF \l__nicematrix_light_syntax_bool
-      { \begin { __nicematrix-light-syntax } }
-      { \begin { __nicematrix-normal-syntax } }
+      { \use:c { __nicematrix-light-syntax } }
+      { \use:c { __nicematrix-normal-syntax } }
   }
   {
     \bool_if:NTF \l__nicematrix_light_syntax_bool
-      { \end { __nicematrix-light-syntax } }
-      { \end { __nicematrix-normal-syntax } }
+      { \use:c { end __nicematrix-light-syntax } }
+      { \use:c { end __nicematrix-normal-syntax } }
     \c_math_toggle_token
     \skip_horizontal:N \l__nicematrix_right_margin_dim
     \skip_horizontal:N \l__nicematrix_extra_right_margin_dim
@@ -915,9 +1075,9 @@
         \str_if_eq:VnTF \l__nicematrix_baseline_str { b }
           {
            \pgfpicture
-             \__nicematrix_qpoint: { row - 1 }
+             \__nicematrix_qpoint:n { row - 1 }
              \dim_gset_eq:NN \g_tmpa_dim \pgf at y
-             \__nicematrix_qpoint: { row - \int_use:N \c at iRow - base }
+             \__nicematrix_qpoint:n { row - \int_use:N \c at iRow - base }
              \dim_gsub:Nn \g_tmpa_dim \pgf at y
            \endpgfpicture
            \int_compare:nNnT \l__nicematrix_first_row_int = 0
@@ -944,9 +1104,9 @@
                     \int_set:Nn \l_tmpa_int 1
                   }
                 \pgfpicture
-                \__nicematrix_qpoint: { row - 1 }
+                \__nicematrix_qpoint:n { row - 1 }
                 \dim_gset_eq:NN \g_tmpa_dim \pgf at y
-                \__nicematrix_qpoint: { row - \int_use:N \l_tmpa_int - base }
+                \__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int - base }
                 \dim_gsub:Nn \g_tmpa_dim \pgf at y
                 \endpgfpicture
                 \int_compare:nNnT \l__nicematrix_first_row_int = 0
@@ -981,9 +1141,13 @@
                 \skip_vertical:N -\l_tmpa_dim
                 \hbox
                   {
-                    \skip_horizontal:N -\arraycolsep
+                    \bool_if:NTF \l__nicematrix_NiceTabular_bool
+                      { \skip_horizontal:N -\tabcolsep }
+                      { \skip_horizontal:N -\arraycolsep }
                     \box_use_drop:N \l__nicematrix_the_array_box
-                    \skip_horizontal:N -\arraycolsep
+                    \bool_if:NTF \l__nicematrix_NiceTabular_bool
+                      { \skip_horizontal:N -\tabcolsep }
+                      { \skip_horizontal:N -\arraycolsep }
                   }
                 \skip_vertical:N -\l_tmpb_dim
               }
@@ -1027,12 +1191,12 @@
         \int_set:Nn \l_tmpa_int 1
       }
     \pgfpicture
-      \__nicematrix_qpoint: { row - 1 }
+      \__nicematrix_qpoint:n { row - 1 }
       \dim_gset_eq:NN \g_tmpa_dim \pgf at y
-      \__nicematrix_qpoint: { row - \__nicematrix_succ:n \c at iRow }
+      \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c at iRow }
       \dim_gadd:Nn \g_tmpa_dim \pgf at y
       \dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim }
-      \__nicematrix_qpoint: { row - \int_use:N \l_tmpa_int - base }
+      \__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int - base }
       \dim_gsub:Nn \g_tmpa_dim \pgf at y
       \dim_gsub:Nn \g_tmpa_dim { \fontdimen22 \textfont2 }
     \endpgfpicture
@@ -1096,6 +1260,12 @@
         \tl_if_eq:nnT { ##1 } { \\ }
           { \__nicematrix_fatal:n { double-backslash~in~light-syntax } }
       }
+    \__nicematrix_light_syntax_i #1 \CodeAfter \q_stop
+  }
+  { }
+\cs_new_protected:Npn \__nicematrix_light_syntax_i #1\CodeAfter #2\q_stop
+  {
+    \tl_gput_right:Nn \g__nicematrix_code_after_tl { #2 }
     \seq_gclear_new:N \g__nicematrix_rows_seq
     \tl_set_rescan:Nno \l__nicematrix_end_of_row_tl { } \l__nicematrix_end_of_row_tl
     \exp_args:NNV \seq_gset_split:Nnn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 }
@@ -1108,7 +1278,8 @@
     \__nicematrix_create_col_nodes:
     \endarray
   }
-  { }
+\cs_new_protected:Npn \__nicematrix_line_with_light_syntax:n #1
+  { \tl_if_empty:nF { #1 } { \\ \__nicematrix_line_with_light_syntax_i:n { #1 } } }
 \cs_new_protected:Npn \__nicematrix_line_with_light_syntax_i:n #1
   {
     \seq_gclear_new:N \g__nicematrix_cells_seq
@@ -1115,14 +1286,8 @@
     \seq_gset_split:Nnn \g__nicematrix_cells_seq { ~ } { #1 }
     \seq_gpop_left:NN \g__nicematrix_cells_seq \l_tmpa_tl
     \l_tmpa_tl
-    \seq_map_function:NN \g__nicematrix_cells_seq \__nicematrix_cell_with_light_syntax:n
+    \seq_map_inline:Nn \g__nicematrix_cells_seq { & ##1 }
   }
-\cs_new_protected:Npn \__nicematrix_line_with_light_syntax:n #1
-  {
-    \tl_if_empty:nF { #1 }
-      { \\ \__nicematrix_line_with_light_syntax_i:n { #1 } }
-  }
-\cs_new_protected:Npn \__nicematrix_cell_with_light_syntax:n #1 { & #1 }
 \cs_new_protected:Npn \__nicematrix_analyze_end:Nn #1 #2
   {
     \str_if_eq:VnT \g__nicematrix_name_env_str { #2 }
@@ -1136,23 +1301,56 @@
     \int_compare:nNnT \l__nicematrix_first_col_int = 0
       {
         \omit
-        \skip_horizontal:N -2\arraycolsep
+        \skip_horizontal:N  -2\col at sep
+        \bool_if:NT \l__nicematrix_code_before_bool
+          { \pgfsys at markposition { \__nicematrix_env: - col - 0 } }
         \pgfpicture
         \pgfrememberpicturepositiononpagetrue
         \pgfcoordinate { \__nicematrix_env: - col - 0 } \pgfpointorigin
         \str_if_empty:NF \l__nicematrix_name_str
-          { \pgfnodealias { \__nicematrix_env: - col - 0 } { \l__nicematrix_name_str - col - 0 } }
+          { \pgfnodealias { \l__nicematrix_name_str - col - 0 } { \__nicematrix_env: - col - 0 } }
         \endpgfpicture
         &
       }
     \omit
     \bool_gset_true:N \g__nicematrix_row_of_col_done_bool
-    \pgfpicture
-    \pgfrememberpicturepositiononpagetrue
-    \pgfcoordinate { \__nicematrix_env: - col - 1 } \pgfpointorigin
-    \str_if_empty:NF \l__nicematrix_name_str
-      { \pgfnodealias { \__nicematrix_env: - col - 1 } { \l__nicematrix_name_str - col - 1 } }
-    \endpgfpicture
+    \int_compare:nNnTF \l__nicematrix_first_col_int = 0
+      {
+        \bool_if:NT \l__nicematrix_code_before_bool
+          {
+            \hbox
+              {
+                \skip_horizontal:N -0.5\arrayrulewidth
+                \pgfsys at markposition { \__nicematrix_env: - col - 1 }
+                \skip_horizontal:N 0.5\arrayrulewidth
+              }
+          }
+        \pgfpicture
+        \pgfrememberpicturepositiononpagetrue
+        \pgfcoordinate { \__nicematrix_env: - col - 1 }
+          { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim }
+        \str_if_empty:NF \l__nicematrix_name_str
+          { \pgfnodealias { \l__nicematrix_name_str - col - 1 } { \__nicematrix_env: - col - 1 } }
+        \endpgfpicture
+      }
+      {
+        \bool_if:NT \l__nicematrix_code_before_bool
+          {
+            \hbox
+              {
+                \skip_horizontal:N 0.5 \arrayrulewidth
+                \pgfsys at markposition { \__nicematrix_env: - col - 1 }
+                \skip_horizontal:N -0.5\arrayrulewidth
+              }
+          }
+        \pgfpicture
+        \pgfrememberpicturepositiononpagetrue
+        \pgfcoordinate { \__nicematrix_env: - col - 1 }
+          { \pgfpoint { 0.5 \arrayrulewidth } \c_zero_dim }
+        \str_if_empty:NF \l__nicematrix_name_str
+          { \pgfnodealias { \l__nicematrix_name_str - col - 1 } { \__nicematrix_env: - col - 1 } }
+        \endpgfpicture
+      }
     \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill }
     \bool_if:NF \l__nicematrix_auto_columns_width_bool
       { \dim_compare:nNnT \l__nicematrix_columns_width_dim > \c_zero_dim }
@@ -1162,16 +1360,26 @@
           { \bool_not_p:n \l__nicematrix_block_auto_columns_width_bool }
           { \skip_gset_eq:NN \g_tmpa_skip \g__nicematrix_max_cell_width_dim }
           { \skip_gset_eq:NN \g_tmpa_skip \l__nicematrix_columns_width_dim }
-        \skip_gadd:Nn \g_tmpa_skip { 2 \arraycolsep }
+        \skip_gadd:Nn \g_tmpa_skip { 2 \col at sep }
       }
     \skip_horizontal:N \g_tmpa_skip
     \hbox
       {
+        \bool_if:NT \l__nicematrix_code_before_bool
+          {
+            \hbox
+              {
+                \skip_horizontal:N -0.5\arrayrulewidth
+                \pgfsys at markposition { \__nicematrix_env: - col - 2 }
+                \skip_horizontal:N 0.5\arrayrulewidth
+              }
+          }
         \pgfpicture
         \pgfrememberpicturepositiononpagetrue
-        \pgfcoordinate { \__nicematrix_env: - col - 2 } \pgfpointorigin
+        \pgfcoordinate { \__nicematrix_env: - col - 2 }
+          { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim }
         \str_if_empty:NF \l__nicematrix_name_str
-          { \pgfnodealias { \__nicematrix_env: - col - 2 } { \l__nicematrix_name_str - col - 2 } }
+          { \pgfnodealias { \l__nicematrix_name_str - col - 2 } { \__nicematrix_env: - col - 2 } }
         \endpgfpicture
       }
     \int_gset:Nn \g_tmpa_int 1
@@ -1179,25 +1387,38 @@
       { \prg_replicate:nn { \g__nicematrix_col_total_int - 2 } }
       { \prg_replicate:nn { \g__nicematrix_col_total_int - 1 } }
       {
-         &
-         \omit
-         \int_gincr:N \g_tmpa_int
-         \skip_horizontal:N \g_tmpa_skip
-         \pgfpicture
-           \pgfrememberpicturepositiononpagetrue
-           \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
-             \pgfpointorigin
-           \str_if_empty:NF \l__nicematrix_name_str
-             {
-               \pgfnodealias
-                 { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
-                 { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g_tmpa_int }
-             }
-         \endpgfpicture
+        &
+        \omit
+        \int_gincr:N \g_tmpa_int
+        \skip_horizontal:N \g_tmpa_skip
+        \bool_if:NT \l__nicematrix_code_before_bool
+          {
+            \hbox
+              {
+                \skip_horizontal:N -0.5\arrayrulewidth
+                \pgfsys at markposition { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+                \skip_horizontal:N 0.5\arrayrulewidth
+              }
+          }
+        \pgfpicture
+          \pgfrememberpicturepositiononpagetrue
+          \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+            { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim }
+          \str_if_empty:NF \l__nicematrix_name_str
+            {
+              \pgfnodealias
+                { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g_tmpa_int }
+                { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+            }
+        \endpgfpicture
       }
     \bool_if:NT \g__nicematrix_last_col_found_bool
       {
-        \skip_horizontal:N 2\arraycolsep
+        \bool_if:NT \l__nicematrix_code_before_bool
+          {
+            \pgfsys at markposition { \__nicematrix_env: - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
+          }
+        \skip_horizontal:N 2\col at sep
         \pgfpicture
         \pgfrememberpicturepositiononpagetrue
         \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
@@ -1205,11 +1426,11 @@
         \str_if_empty:NF \l__nicematrix_name_str
           {
             \pgfnodealias
+              { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
               { \__nicematrix_env: - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
-              { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
           }
         \endpgfpicture
-        \skip_horizontal:N -2\arraycolsep
+        \skip_horizontal:N -2\col at sep
       }
     \cr
   }
@@ -1219,7 +1440,7 @@
       {
         \__nicematrix_begin_of_row:
         \hbox_set:Nw \l__nicematrix_cell_box
-        \c_math_toggle_token
+        \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token
         \bool_if:NT \l__nicematrix_small_bool \scriptstyle
         \bool_lazy_and:nnT
           { \int_compare_p:nNn \c at iRow > 0 }
@@ -1236,7 +1457,7 @@
     l
     <
       {
-        \c_math_toggle_token
+        \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token
         \hbox_set_end:
         \__nicematrix_update_for_first_and_last_row:
         \dim_gset:Nn \g__nicematrix_width_first_col_dim
@@ -1250,7 +1471,7 @@
             \skip_horizontal:N \l__nicematrix_left_margin_dim
             \skip_horizontal:N \l__nicematrix_extra_left_margin_dim
           }
-        \skip_horizontal:N -2\arraycolsep
+        \skip_horizontal:N -2\col at sep
       }
   }
 \tl_const:Nn \c__nicematrix_preamble_last_col_tl
@@ -1261,7 +1482,7 @@
         \int_gincr:N \c at jCol
         \int_gset_eq:NN \g__nicematrix_col_total_int \c at jCol
         \hbox_set:Nw \l__nicematrix_cell_box
-          \c_math_toggle_token
+          \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token
           \bool_if:NT \l__nicematrix_small_bool \scriptstyle
         \int_compare:nNnT \c at iRow > 0
           {
@@ -1277,12 +1498,12 @@
     l
     <
       {
-        \c_math_toggle_token
+        \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token
         \hbox_set_end:
         \__nicematrix_update_for_first_and_last_row:
         \dim_gset:Nn \g__nicematrix_width_last_col_dim
           { \dim_max:nn \g__nicematrix_width_last_col_dim { \box_wd:N \l__nicematrix_cell_box } }
-        \skip_horizontal:N -2\arraycolsep
+        \skip_horizontal:N -2\col at sep
         \hbox_overlap_right:n
           {
             \dim_compare:nNnT { \box_wd:N \l__nicematrix_cell_box } > \c_zero_dim
@@ -1352,11 +1573,11 @@
         \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 }
         \exp_args:Nnx \__nicematrix_begin_of_NiceMatrix:nn { #1 } \l__nicematrix_type_of_col_tl
       }
-      { \end { #1 NiceArray } }
+      { \use:c { end #1 NiceArray } }
   }
 \cs_new_protected:Npn \__nicematrix_begin_of_NiceMatrix:nn #1 #2
   {
-    \begin { #1 NiceArray }
+    \use:c { #1 NiceArray }
       {
         *
           {
@@ -1373,6 +1594,13 @@
 \__nicematrix_define_env:n B
 \__nicematrix_define_env:n v
 \__nicematrix_define_env:n V
+\NewDocumentEnvironment { NiceTabular } { O { } m ! O { } }
+  {
+    \keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 }
+    \bool_set_true:N \l__nicematrix_NiceTabular_bool
+    \NiceArray { #2 }
+  }
+  { \endNiceArray }
 \cs_new_protected:Npn \__nicematrix_after_array:
   {
     \group_begin:
@@ -1419,6 +1647,28 @@
             \iow_shipout:Nn \@mainaux \ExplSyntaxOff
           }
       }
+    \bool_if:NT \l__nicematrix_code_before_bool
+      {
+        \iow_now:Nn \@mainaux \ExplSyntaxOn
+        \iow_now:Nx \@mainaux
+          { \seq_clear_new:c { __nicematrix_size _ \int_use:N \g__nicematrix_env_int _ seq } }
+        \iow_now:Nx \@mainaux
+          {
+            \seq_gset_from_clist:cn { __nicematrix_size _ \int_use:N \g__nicematrix_env_int _ seq }
+              {
+                \int_use:N \l__nicematrix_first_row_int ,
+                \int_use:N \g__nicematrix_row_total_int ,
+                \int_use:N \l__nicematrix_first_col_int ,
+                \bool_lazy_and:nnTF
+                  { \int_compare_p:nNn \l__nicematrix_last_col_int > { -2 } }
+                  { \bool_not_p:n \g__nicematrix_last_col_found_bool }
+                  \__nicematrix_succ:n
+                  \int_use:N
+                \g__nicematrix_col_total_int
+              }
+          }
+        \iow_now:Nn \@mainaux \ExplSyntaxOff
+      }
     \bool_if:NT \l__nicematrix_parallelize_diags_bool
       {
         \int_gzero_new:N \g__nicematrix_ddots_int
@@ -1464,6 +1714,7 @@
           }
       }
     \cs_set_eq:NN \line \__nicematrix_line
+    \cs_set_eq:NN \CodeAfter \prg_do_nothing:
     \g__nicematrix_code_after_tl
     \tl_gclear:N \g__nicematrix_code_after_tl
     \group_end:
@@ -1483,7 +1734,7 @@
   {
     \pgfrememberpicturepositiononpagetrue
     \pgf at relevantforpicturesizefalse
-    \g__nicematrix_Hdotsfor_lines_tl
+    \g__nicematrix_HVdotsfor_lines_tl
     \g__nicematrix_Vdots_lines_tl
     \g__nicematrix_Ddots_lines_tl
     \g__nicematrix_Iddots_lines_tl
@@ -1492,8 +1743,8 @@
   }
 \cs_new_protected:Npn \__nicematrix_restore_iRow_jCol:
   {
-    \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c at iRow \l__nicematrix_save_iRow_int }
-    \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c at jCol \l__nicematrix_save_jCol_int }
+    \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c at iRow \l__nicematrix_old_iRow_int }
+    \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c at jCol \l__nicematrix_old_jCol_int }
   }
 \cs_new_protected:Npn \__nicematrix_find_extremities_of_line:nnnn #1 #2 #3 #4
   {
@@ -1639,10 +1890,6 @@
           }
       }
   }
-\cs_new:Nn \__nicematrix_initial_cell:
-  { \__nicematrix_env: - \int_use:N \l__nicematrix_initial_i_int - \int_use:N \l__nicematrix_initial_j_int }
-\cs_new:Nn \__nicematrix_final_cell:
-  { \__nicematrix_env: - \int_use:N \l__nicematrix_final_i_int - \int_use:N \l__nicematrix_final_j_int }
 \cs_new_protected:Npn \__nicematrix_set_initial_coords:
   {
     \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
@@ -1655,12 +1902,24 @@
   }
 \cs_new_protected:Npn \__nicematrix_set_initial_coords_from_anchor:n #1
   {
-    \pgfpointanchor \__nicematrix_initial_cell: { #1 }
+    \pgfpointanchor
+      {
+        \__nicematrix_env:
+        - \int_use:N \l__nicematrix_initial_i_int
+        - \int_use:N \l__nicematrix_initial_j_int
+      }
+      { #1 }
     \__nicematrix_set_initial_coords:
   }
 \cs_new_protected:Npn \__nicematrix_set_final_coords_from_anchor:n #1
   {
-    \pgfpointanchor \__nicematrix_final_cell: { #1 }
+    \pgfpointanchor
+      {
+        \__nicematrix_env:
+        - \int_use:N \l__nicematrix_final_i_int
+        - \int_use:N \l__nicematrix_final_j_int
+      }
+      { #1 }
     \__nicematrix_set_final_coords:
   }
 \cs_new_protected:Npn \__nicematrix_draw_Ldots:nnn #1 #2 #3
@@ -1685,19 +1944,21 @@
   {
     \bool_if:NTF \l__nicematrix_initial_open_bool
       {
-        \__nicematrix_qpoint: { col - \int_use:N \l__nicematrix_initial_j_int }
+        \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_initial_j_int }
         \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
-        \dim_add:Nn \l__nicematrix_x_initial_dim \arraycolsep
-        \__nicematrix_qpoint: { row - \int_use:N \l__nicematrix_initial_i_int - base }
+        \dim_add:Nn \l__nicematrix_x_initial_dim
+           { \bool_if:NTF \l__nicematrix_NiceTabular_bool \tabcolsep \arraycolsep }
+        \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int - base }
         \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y
       }
       { \__nicematrix_set_initial_coords_from_anchor:n { base~east } }
     \bool_if:NTF \l__nicematrix_final_open_bool
       {
-        \__nicematrix_qpoint: { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
+        \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
         \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x
-        \dim_sub:Nn \l__nicematrix_x_final_dim \arraycolsep
-        \__nicematrix_qpoint: { row - \int_use:N \l__nicematrix_final_i_int - base }
+        \dim_sub:Nn \l__nicematrix_x_final_dim
+           { \bool_if:NTF \l__nicematrix_NiceTabular_bool \tabcolsep \arraycolsep }
+        \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_final_i_int - base }
         \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y
       }
       { \__nicematrix_set_final_coords_from_anchor:n { base~west } }
@@ -1727,16 +1988,18 @@
   {
     \bool_if:NTF \l__nicematrix_initial_open_bool
       {
-        \__nicematrix_qpoint: { col - \int_use:N \l__nicematrix_initial_j_int }
+        \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_initial_j_int }
         \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
-        \dim_add:Nn \l__nicematrix_x_initial_dim \arraycolsep
+        \dim_add:Nn \l__nicematrix_x_initial_dim
+           { \bool_if:NTF \l__nicematrix_NiceTabular_bool \tabcolsep \arraycolsep }
       }
       { \__nicematrix_set_initial_coords_from_anchor:n { mid~east } }
     \bool_if:NTF \l__nicematrix_final_open_bool
       {
-        \__nicematrix_qpoint: { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
+        \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
         \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x
-        \dim_sub:Nn \l__nicematrix_x_final_dim \arraycolsep
+        \dim_sub:Nn \l__nicematrix_x_final_dim
+           { \bool_if:NTF \l__nicematrix_NiceTabular_bool \tabcolsep \arraycolsep }
       }
       { \__nicematrix_set_final_coords_from_anchor:n { mid~west } }
     \bool_lazy_and:nnTF
@@ -1743,9 +2006,9 @@
       \l__nicematrix_initial_open_bool
       \l__nicematrix_final_open_bool
       {
-        \__nicematrix_qpoint: { row - \int_use:N \l__nicematrix_initial_i_int }
+        \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int }
         \dim_set_eq:NN \l_tmpa_dim \pgf at y
-        \__nicematrix_qpoint: { row - \__nicematrix_succ:n \l__nicematrix_initial_i_int }
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l__nicematrix_initial_i_int }
         \dim_set:Nn \l__nicematrix_y_initial_dim { ( \l_tmpa_dim + \pgf at y ) / 2 }
         \dim_set_eq:NN \l__nicematrix_y_final_dim \l__nicematrix_y_initial_dim
       }
@@ -1787,13 +2050,13 @@
       }
     \bool_if:NTF \l__nicematrix_initial_open_bool
       {
-        \__nicematrix_qpoint: { row - 1 }
+        \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int }
         \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y
       }
       { \__nicematrix_set_initial_coords_from_anchor:n { south } }
     \bool_if:NTF \l__nicematrix_final_open_bool
       {
-        \__nicematrix_qpoint: { row - \__nicematrix_succ:n \c at iRow }
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l__nicematrix_final_i_int }
         \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y
       }
       { \__nicematrix_set_final_coords_from_anchor:n { north } }
@@ -1801,11 +2064,21 @@
       {
         \bool_if:NTF \l__nicematrix_final_open_bool
           {
-            \__nicematrix_qpoint: { col - \int_use:N \l__nicematrix_initial_j_int }
+            \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_initial_j_int }
             \dim_set_eq:NN \l_tmpa_dim \pgf at x
-            \__nicematrix_qpoint: { col - \__nicematrix_succ:n \l__nicematrix_initial_j_int }
+            \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_initial_j_int }
             \dim_set:Nn \l__nicematrix_x_initial_dim { ( \pgf at x + \l_tmpa_dim ) / 2 }
             \dim_set_eq:NN \l__nicematrix_x_final_dim \l__nicematrix_x_initial_dim
+            \int_compare:nNnT \l__nicematrix_last_col_int > { -2 }
+              {
+                \int_compare:nNnT \l__nicematrix_initial_j_int = \g__nicematrix_col_total_int
+                  {
+                    \dim_set_eq:NN \l_tmpa_dim \l__nicematrix_right_margin_dim
+                    \dim_add:Nn \l_tmpa_dim \l__nicematrix_extra_right_margin_dim
+                    \dim_add:Nn \l__nicematrix_x_initial_dim \l_tmpa_dim
+                    \dim_add:Nn \l__nicematrix_x_final_dim \l_tmpa_dim
+                  }
+              }
           }
           { \dim_set_eq:NN \l__nicematrix_x_initial_dim \l__nicematrix_x_final_dim }
       }
@@ -1842,17 +2115,17 @@
   {
     \bool_if:NTF \l__nicematrix_initial_open_bool
       {
-        \__nicematrix_qpoint: { row - \int_use:N \l__nicematrix_initial_i_int }
+        \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int }
         \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y
-        \__nicematrix_qpoint: { col - \int_use:N \l__nicematrix_initial_j_int }
+        \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_initial_j_int }
         \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
       }
       { \__nicematrix_set_initial_coords_from_anchor:n { south~east } }
     \bool_if:NTF \l__nicematrix_final_open_bool
       {
-        \__nicematrix_qpoint: { row - \__nicematrix_succ:n \l__nicematrix_final_i_int }
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l__nicematrix_final_i_int }
         \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y
-        \__nicematrix_qpoint: { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
+        \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
         \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x
       }
       { \__nicematrix_set_final_coords_from_anchor:n { north~west } }
@@ -1893,17 +2166,17 @@
   {
     \bool_if:NTF \l__nicematrix_initial_open_bool
       {
-        \__nicematrix_qpoint: { row - \int_use:N \l__nicematrix_initial_i_int }
+        \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int }
         \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y
-        \__nicematrix_qpoint: { col - \__nicematrix_succ:n \l__nicematrix_initial_j_int }
+        \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_initial_j_int }
         \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
       }
       { \__nicematrix_set_initial_coords_from_anchor:n { south~west } }
     \bool_if:NTF \l__nicematrix_final_open_bool
       {
-        \__nicematrix_qpoint: { row - \__nicematrix_succ:n \l__nicematrix_final_i_int }
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l__nicematrix_final_i_int }
         \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y
-        \__nicematrix_qpoint: { col - \int_use:N \l__nicematrix_final_j_int }
+        \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_final_j_int }
         \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x
       }
       { \__nicematrix_set_final_coords_from_anchor:n { north~east } }
@@ -2121,8 +2394,19 @@
       {
         \bool_if:nTF { #1 }
           { \__nicematrix_error:n { starred~commands } }
-          { \__nicematrix_instruction_of_type:nn { Ldots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_ldots }
+          {
+            \int_compare:nNnTF \c at jCol = 0
+              { \__nicematrix_error:nn { in~first~col } \Ldots }
+              {
+                \int_compare:nNnTF \c at jCol = \l__nicematrix_last_col_int
+                  { \__nicematrix_error:nn { in~last~col } \Ldots }
+                  {
+                     \__nicematrix_instruction_of_type:nn { Ldots }
+                       { #2 , down = #3 , up = #4 }
+                  }
+              }
+          }
+        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_old_ldots }
         \bool_gset_true:N \g__nicematrix_empty_cell_bool
       }
     \exp_args:NNV \NewDocumentCommand \__nicematrix_Cdots \l__nicematrix_argspec_tl
@@ -2129,8 +2413,19 @@
       {
         \bool_if:nTF { #1 }
           { \__nicematrix_error:n { starred~commands } }
-          { \__nicematrix_instruction_of_type:nn { Cdots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_cdots }
+          {
+            \int_compare:nNnTF \c at jCol = 0
+              { \__nicematrix_error:nn { in~first~col } \Cdots }
+              {
+                \int_compare:nNnTF \c at jCol = \l__nicematrix_last_col_int
+                  { \__nicematrix_error:nn { in~last~col } \Cdots }
+                  {
+                     \__nicematrix_instruction_of_type:nn { Cdots }
+                       { #2 , down = #3 , up = #4 }
+                  }
+              }
+          }
+        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_old_cdots }
         \bool_gset_true:N \g__nicematrix_empty_cell_bool
       }
     \exp_args:NNV \NewDocumentCommand \__nicematrix_Vdots \l__nicematrix_argspec_tl
@@ -2137,8 +2432,17 @@
       {
         \bool_if:nTF { #1 }
           { \__nicematrix_error:n { starred~commands } }
-          { \__nicematrix_instruction_of_type:nn { Vdots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_vdots }
+            \int_compare:nNnTF \c at iRow = 0
+              { \__nicematrix_error:nn { in~first~row } \Vdots }
+              {
+                \int_compare:nNnTF \c at iRow = \l__nicematrix_last_row_int
+                  { \__nicematrix_error:nn { in~last~row } \Vdots }
+                  {
+                     \__nicematrix_instruction_of_type:nn { Vdots }
+                       { #2 , down = #3 , up = #4 }
+                  }
+              }
+        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_old_vdots }
         \bool_gset_true:N \g__nicematrix_empty_cell_bool
       }
     \exp_args:NNV \NewDocumentCommand \__nicematrix_Ddots \l__nicematrix_argspec_tl
@@ -2145,8 +2449,26 @@
       {
         \bool_if:nTF { #1 }
           { \__nicematrix_error:n { starred~commands } }
-          { \__nicematrix_instruction_of_type:nn { Ddots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_ddots }
+          {
+            \int_case:nnF \c at iRow
+              {
+                0                  { \__nicematrix_error:nn { in~first~row } \Ddots }
+                \l__nicematrix_last_row_int { \__nicematrix_error:nn { in~last~row } \Ddots }
+              }
+              {
+                \int_case:nnF \c at jCol
+                  {
+                    0                  { \__nicematrix_error:nn { in~first~col } \Ddots }
+                    \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Ddots }
+                  }
+                  {
+                    \__nicematrix_instruction_of_type:nn { Ddots }
+                      { #2 , down = #3 , up = #4 }
+                  }
+
+              }
+          }
+        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_old_ddots }
         \bool_gset_true:N \g__nicematrix_empty_cell_bool
       }
     \exp_args:NNV \NewDocumentCommand \__nicematrix_Iddots \l__nicematrix_argspec_tl
@@ -2153,8 +2475,26 @@
       {
         \bool_if:nTF { #1 }
           { \__nicematrix_error:n { starred~commands } }
-          { \__nicematrix_instruction_of_type:nn { Iddots } { #2 , down = #3 , up = #4 } }
-        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_iddots }
+          {
+            \int_case:nnF \c at iRow
+              {
+                0                  { \__nicematrix_error:nn { in~first~row } \Iddots }
+                \l__nicematrix_last_row_int { \__nicematrix_error:nn { in~last~row } \Iddots }
+              }
+              {
+                \int_case:nnF \c at jCol
+                  {
+                    0                  { \__nicematrix_error:nn { in~first~col } \Iddots }
+                    \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Iddots }
+                  }
+                  {
+                    \__nicematrix_instruction_of_type:nn { Iddots }
+                      { #2 , down = #3 , up = #4 }
+                  }
+
+              }
+          }
+        \bool_if:NF \l__nicematrix_nullify_dots_bool { \phantom \__nicematrix_old_iddots }
         \bool_gset_true:N \g__nicematrix_empty_cell_bool
       }
   }
@@ -2170,7 +2510,7 @@
     \int_compare:nNnT #1 > 1
       {
         \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
-          { \int_eval:n \c at iRow - \int_use:N \c at jCol }
+          { \int_use:N \c at iRow - \int_use:N \c at jCol }
         \seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 }
       }
     \int_gadd:Nn \c at jCol { #1 - 1 }
@@ -2180,32 +2520,24 @@
     \multicolumn { 1 } { C } { }
     \__nicematrix_Hdotsfor_i
   }
-\ExplSyntaxOff
-\def \@tempa  { O { } m O { } E { _ ^ } { { } { } } }
-\ExplSyntaxOn
-\tl_set_eq:NN \l__nicematrix_a_signature_tl \@tempa
 \AtBeginDocument
   {
     \tl_set:Nn \l__nicematrix_argspec_tl { O { } m O { } E { _ ^ } { { } { } } }
     \tl_set_rescan:Nno  \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
-    \bool_if:NTF \c__nicematrix_draft_bool
+    \exp_args:NNV \NewDocumentCommand \__nicematrix_Hdotsfor_i \l__nicematrix_argspec_tl
       {
-        \exp_args:NNV \NewDocumentCommand \__nicematrix_Hdotsfor_i \l__nicematrix_argspec_tl
-          { \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } } }
-      }
-      {
-        \exp_args:NNV \NewDocumentCommand \__nicematrix_Hdotsfor_i \l__nicematrix_argspec_tl
+        \tl_gput_right:Nx \g__nicematrix_HVdotsfor_lines_tl
           {
-            \tl_gput_right:Nx \g__nicematrix_Hdotsfor_lines_tl
+            \__nicematrix_Hdotsfor:nnnn
+              { \int_use:N \c at iRow }
+              { \int_use:N \c at jCol }
+              { #2 }
               {
-                \__nicematrix_Hdotsfor:nnnn
-                  { \int_use:N \c at iRow }
-                  { \int_use:N \c at jCol }
-                  { #2 }
-                  { #1 , #3 , down = #4 , up = #5 }
+                #1 , #3 ,
+                down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
               }
-            \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
           }
+        \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
       }
   }
 \cs_new_protected:Npn \__nicematrix_Hdotsfor:nnnn #1 #2 #3 #4
@@ -2264,6 +2596,81 @@
     \int_step_inline:nnn { #2 } { #2 + #3 - 1 }
       { \cs_set:cpn { __nicematrix _ dotted _ #1 - ##1 } { } }
   }
+\AtBeginDocument
+  {
+    \tl_set:Nn \l__nicematrix_argspec_tl { O { } m O { } E { _ ^ } { { } { } } }
+    \tl_set_rescan:Nno  \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
+    \exp_args:NNV \NewDocumentCommand \__nicematrix_Vdotsfor: \l__nicematrix_argspec_tl
+      {
+        \tl_gput_right:Nx \g__nicematrix_HVdotsfor_lines_tl
+          {
+            \__nicematrix_Vdotsfor:nnnn
+              { \int_use:N \c at iRow }
+              { \int_use:N \c at jCol }
+              { #2 }
+              {
+                #1 , #3 ,
+                down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
+              }
+          }
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_Vdotsfor:nnnn #1 #2 #3 #4
+  {
+    \bool_set_false:N \l__nicematrix_initial_open_bool
+    \bool_set_false:N \l__nicematrix_final_open_bool
+    \int_set:Nn \l__nicematrix_initial_j_int { #2 }
+    \int_set_eq:NN \l__nicematrix_final_j_int \l__nicematrix_initial_j_int
+    \int_compare:nNnTF #1 = 1
+      {
+        \int_set:Nn \l__nicematrix_initial_i_int 1
+        \bool_set_true:N \l__nicematrix_initial_open_bool
+      }
+      {
+        \cs_if_exist:cTF
+          {
+            pgf @ sh @ ns @ \__nicematrix_env:
+            - \int_eval:n { #1 - 1 }
+            - \int_use:N \l__nicematrix_initial_j_int
+          }
+          { \int_set:Nn \l__nicematrix_initial_i_int { #1 - 1 } }
+          {
+            \int_set:Nn \l__nicematrix_initial_i_int { #1 }
+            \bool_set_true:N \l__nicematrix_initial_open_bool
+          }
+      }
+    \int_compare:nNnTF { #1 + #3 -1 } = \c at iRow
+      {
+        \int_set:Nn \l__nicematrix_final_i_int { #1 + #3 - 1 }
+        \bool_set_true:N \l__nicematrix_final_open_bool
+      }
+      {
+        \cs_if_exist:cTF
+          {
+            pgf @ sh @ ns @ \__nicematrix_env:
+            - \int_eval:n { #1 + #3 }
+            - \int_use:N \l__nicematrix_final_j_int
+          }
+          { \int_set:Nn \l__nicematrix_final_i_int { #1 + #3 } }
+          {
+            \int_set:Nn \l__nicematrix_final_i_int { #1 + #3 - 1 }
+            \bool_set_true:N \l__nicematrix_final_open_bool
+          }
+      }
+    \group_begin:
+    \int_compare:nNnTF { #2 } = 0
+      { \color { nicematrix-first-col } }
+      {
+        \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int
+          { \color { nicematrix-last-col } }
+      }
+    \keys_set:nn { NiceMatrix / xdots } { #4 }
+    \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+    \__nicematrix_actually_draw_Vdots:
+    \group_end:
+    \int_step_inline:nnn { #1 } { #1 + #3 - 1 }
+      { \cs_set:cpn { __nicematrix _ dotted _ ##1 - #2 } { } }
+  }
 \cs_new_protected:Npn \__nicematrix_rotate: { \group_insert_after:N \__nicematrix_rotate_i: }
 \cs_new_protected:Npn \__nicematrix_rotate_i: { \group_insert_after:N \__nicematrix_rotate_ii: }
 \cs_new_protected:Npn \__nicematrix_rotate_ii: { \group_insert_after:N \__nicematrix_rotate_iii: }
@@ -2282,10 +2689,6 @@
   }
 \cs_new:Npn \__nicematrix_double_int_eval:n #1-#2 \q_stop
   { \int_eval:n { #1 } - \int_eval:n { #2 } }
-\ExplSyntaxOff
-\def \@tempa  { O { } m m ! O { } E { _ ^ } { { } { } } }
-\ExplSyntaxOn
-\tl_set_eq:NN \l__nicematrix_a_signature_tl \@tempa
 \AtBeginDocument
   {
     \tl_set:Nn \l__nicematrix_argspec_tl { O { } m m ! O { } E { _ ^ } { { } { } } }
@@ -2304,24 +2707,20 @@
         \group_end:
       }
   }
-\bool_if:NTF \c__nicematrix_draft_bool
-  { \cs_new_protected:Npn \__nicematrix_line_i:nn #1 #2  { } }
+\cs_new_protected:Npn \__nicematrix_line_i:nn #1 #2
   {
-    \cs_new_protected:Npn \__nicematrix_line_i:nn #1 #2
+    \bool_set_false:N \l__nicematrix_initial_open_bool
+    \bool_set_false:N \l__nicematrix_final_open_bool
+    \bool_if:nTF
       {
-        \bool_set_false:N \l__nicematrix_initial_open_bool
-        \bool_set_false:N \l__nicematrix_final_open_bool
-        \bool_if:nTF
-          {
-            \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #1 }
-              ||
-            \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #2 }
-          }
-          {
-            \__nicematrix_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 }
-          }
-          { \__nicematrix_draw_line_ii:nn { #1 } { #2 } }
+        \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #1 }
+          ||
+        \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #2 }
       }
+      {
+        \__nicematrix_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 }
+      }
+      { \__nicematrix_draw_line_ii:nn { #1 } { #2 } }
   }
 \AtBeginDocument
   {
@@ -2335,14 +2734,166 @@
 \cs_new_protected:Npn \__nicematrix_draw_line_iii:nn #1 #2
   {
     \pgfrememberpicturepositiononpagetrue
-    \pgfpointshapeborder { \__nicematrix_env: - #1 } { \__nicematrix_qpoint: { #2 } }
+    \pgfpointshapeborder { \__nicematrix_env: - #1 } { \__nicematrix_qpoint:n { #2 } }
     \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
     \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y
-    \pgfpointshapeborder { \__nicematrix_env: - #2 } { \__nicematrix_qpoint: { #1 } }
+    \pgfpointshapeborder { \__nicematrix_env: - #2 } { \__nicematrix_qpoint:n { #1 } }
     \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x
     \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y
     \__nicematrix_draw_line:
   }
+\cs_set_protected:Npn \__nicematrix_cut_on_hyphen:w #1-#2\q_stop
+  {
+    \tl_set:Nn \l_tmpa_tl { #1 }
+    \tl_set:Nn \l_tmpb_tl { #2 }
+  }
+\cs_new_protected:Npn \__nicematrix_rowcolor:nn #1 #2
+  {
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \c at jCol }
+        \dim_set_eq:NN \l_tmpa_dim \pgf at x
+        \clist_map_inline:nn { #2 }
+          {
+            \tl_set:Nn \l_tmpa_tl { ##1 }
+            \tl_if_in:NnTF \l_tmpa_tl { - }
+              { \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
+              { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
+            \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
+            \tl_if_empty:NT \l_tmpb_tl
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+            \int_compare:nNnT \l_tmpb_tl > \c at iRow
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+            \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpb_tl }
+            \pgfpathrectanglecorners
+              { \__nicematrix_qpoint:n { row - \l_tmpa_tl } }
+              { \pgfpoint \l_tmpa_dim \pgf at y }
+          }
+        \pgfusepathqfill
+        \endpgfpicture
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_columncolor:nn #1 #2
+  {
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \__nicematrix_qpoint:n { row - 1 }
+        \dim_set_eq:NN \l_tmpa_dim \pgf at y
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c at iRow }
+        \dim_set_eq:NN \l_tmpb_dim \pgf at y
+        \clist_map_inline:nn { #2 }
+          {
+            \tl_set:Nn \l_tmpa_tl { ##1 }
+            \tl_if_in:NnTF \l_tmpa_tl { - }
+              { \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
+              { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
+            \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
+            \tl_if_empty:NT \l_tmpb_tl
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+            \int_compare:nNnT \l_tmpb_tl > \c at jCol
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+            \__nicematrix_qpoint:n { col - \l_tmpa_tl }
+            \dim_set_eq:NN \l_tmpc_dim \pgf at x
+            \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
+            \pgfpathrectanglecorners
+              { \pgfpoint \l_tmpc_dim \l_tmpa_dim }
+              { \pgfpoint \pgf at x \l_tmpb_dim }
+          }
+        \pgfusepathqfill
+        \endpgfpicture
+     }
+  }
+\cs_new_protected:Npn \__nicematrix_cellcolor:nn #1 #2
+  {
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \clist_map_inline:nn { #2 }
+          {
+            \__nicematrix_cut_on_hyphen:w ##1 \q_stop
+            \__nicematrix_qpoint:n { row - \l_tmpa_tl }
+            \bool_lazy_and:nnT
+              { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
+              { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
+              {
+                \dim_set_eq:NN \l_tmpb_dim \pgf at y
+                \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpa_tl }
+                \dim_set_eq:NN \l_tmpa_dim \pgf at y
+                \__nicematrix_qpoint:n { col - \l_tmpb_tl }
+                \dim_set_eq:NN \l_tmpc_dim \pgf at x
+                \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
+                \dim_set_eq:NN \l_tmpd_dim \pgf at x
+                \pgfpathrectanglecorners
+                  { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
+                  { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
+              }
+          }
+        \pgfusepathqfill
+        \endpgfpicture
+     }
+  }
+\cs_new_protected:Npn \__nicematrix_rectanglecolor:nnn #1 #2 #3
+  {
+    \tl_if_blank:nF { #1 }
+      {
+        \pgfpicture
+        \pgf at relevantforpicturesizefalse
+        \pgfsetfillcolor { #1 }
+        \__nicematrix_cut_on_hyphen:w #2 \q_stop
+        \bool_lazy_and:nnT
+          { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
+          { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
+          {
+            \__nicematrix_qpoint:n { row - \l_tmpa_tl }
+            \dim_set_eq:NN \l_tmpb_dim \pgf at y
+            \__nicematrix_qpoint:n { col - \l_tmpb_tl }
+            \__nicematrix_cut_on_hyphen:w #3 \q_stop
+            \int_compare:nNnT \l_tmpa_tl > \c at iRow
+              { \tl_set:Nx \l_tmpa_tl { \int_use:N \c at iRow } }
+            \int_compare:nNnT \l_tmpb_tl > \c at jCol
+              { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+            \dim_set_eq:NN \l_tmpc_dim \pgf at x
+            \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpa_tl }
+            \dim_set_eq:NN \l_tmpa_dim \pgf at y
+            \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
+            \dim_set_eq:NN \l_tmpd_dim \pgf at x
+            \pgfpathrectanglecorners
+              { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
+              { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
+            \pgfusepathqfill
+          }
+        \endpgfpicture
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_rowcolors:nnn #1 #2 #3
+  {
+    \int_step_inline:nnn { #1 } { \int_use:N \c at iRow }
+      {
+        \int_if_odd:nTF { ##1 }
+          { \__nicematrix_rowcolor:nn { #2 } { ##1 } }
+          { \__nicematrix_rowcolor:nn { #3 } { ##1 } }
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_chessboardcolors:nn #1 #2
+  {
+    \int_step_inline:nn { \int_use:N \c at iRow }
+      {
+        \int_step_inline:nn { \int_use:N \c at jCol }
+          {
+            \int_if_even:nTF { ####1 + ##1 }
+              { \__nicematrix_cellcolor:nn { #1 } { ####1 - ##1 } }
+              { \__nicematrix_cellcolor:nn { #2 } { ####1 - ##1 } }
+          }
+      }
+  }
 \cs_set_eq:NN \OnlyMainNiceMatrix \use:n
 \cs_new_protected:Npn \__nicematrix_OnlyMainNiceMatrix:n #1
   {
@@ -2362,20 +2913,20 @@
     \int_compare:nNnF \c at iRow = 0
       { \int_compare:nNnF \c at iRow = \l__nicematrix_last_row_int { #1 } }
   }
-\cs_new_protected:Npn \__nicematrix_vline: { \__nicematrix_OnlyMainNiceMatrix:n { \__nicematrix_vline_i: } }
-\cs_set_eq:NN \__nicematrix_vline_i: \vline
+\cs_new_protected:Npn \__nicematrix_vline:
+  { \__nicematrix_OnlyMainNiceMatrix:n { { \CT at arc@ \vline } } }
 \cs_new_protected:Npn \__nicematrix_draw_vlines:
   {
     \group_begin:
-    \bool_if:NT \c__nicematrix_colortbl_loaded_bool \CT at arc@
+    \CT at arc@
     \pgfpicture
     \pgfrememberpicturepositiononpagetrue
     \pgf at relevantforpicturesizefalse
     \pgfsetlinewidth \arrayrulewidth
-    \__nicematrix_qpoint: {row - 1 }
+    \__nicematrix_qpoint:n { row - 1 }
     \dim_set_eq:NN \l_tmpa_dim \pgf at y
     \pgfusepathqfill
-    \__nicematrix_qpoint: { row - \__nicematrix_succ:n \c at iRow }
+    \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c at iRow }
     \dim_sub:Nn \l_tmpa_dim \pgf at y
     \pgfusepathqfill
     \dim_zero:N \l_tmpb_dim
@@ -2383,49 +2934,23 @@
       {
         \dim_set_eq:NN \l_tmpb_dim \g__nicematrix_dp_last_row_dim
         \dim_add:Nn \l_tmpb_dim \g__nicematrix_ht_last_row_dim
-        \__nicematrix_qpoint: { row - \__nicematrix_succ:n\c at iRow }
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n\c at iRow }
         \dim_add:Nn \l_tmpa_dim \pgf at y
-        \__nicematrix_qpoint: { row - \__nicematrix_succ:n \g__nicematrix_row_total_int }
+        \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \g__nicematrix_row_total_int }
         \dim_sub:Nn \l_tmpa_dim \pgf at y
         \dim_sub:Nn \l_tmpa_dim \l_tmpb_dim
        }
+    \dim_add:Nn \l_tmpa_dim \arrayrulewidth
     \int_step_inline:nnn
       { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 }
       { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c at jCol } \c at jCol }
       {
-        \pgfpathmoveto
-          {
-            \pgfpointadd
-              { \__nicematrix_qpoint: { col - ##1 } }
-              {
-                \pgfpoint
-                  {
-                    -0.5 \arrayrulewidth
-                    \int_compare:nNnT { ##1 } = 1
-                      {
-                        \int_compare:nNnT \l__nicematrix_first_col_int = 1
-                          { + \arrayrulewidth }
-                      }
-                  }
-                  { \l_tmpb_dim }
-              }
-          }
+        \pgfpathmoveto { \__nicematrix_qpoint:n { col - ##1 } }
         \pgfpathlineto
           {
             \pgfpointadd
-              { \__nicematrix_qpoint: { col - ##1 } }
-              {
-                \pgfpoint
-                  {
-                    -0.5 \arrayrulewidth
-                    \int_compare:nNnT { ##1 } = 1
-                      {
-                        \int_compare:nNnT \l__nicematrix_first_col_int = 1
-                          { + \arrayrulewidth }
-                      }
-                  }
-                  { \l_tmpb_dim + \l_tmpa_dim }
-              }
+              { \__nicematrix_qpoint:n { col - ##1 } }
+              { \pgfpoint \c_zero_dim { \l_tmpb_dim + \l_tmpa_dim } }
           }
       }
     \pgfusepathqstroke
@@ -2432,14 +2957,10 @@
     \endpgfpicture
     \group_end:
   }
-\bool_if:NTF \c__nicematrix_draft_bool
-  { \cs_new:Npn \__nicematrix_hdottedline: { } }
+\cs_new:Npn \__nicematrix_hdottedline:
   {
-    \cs_new:Npn \__nicematrix_hdottedline:
-      {
-        \noalign { \skip_vertical:N 2\l__nicematrix_radius_dim }
-        \__nicematrix_hdottedline_i:
-      }
+    \noalign { \skip_vertical:N 2\l__nicematrix_radius_dim }
+    \__nicematrix_hdottedline_i:
   }
 \cs_new_protected:Npn \__nicematrix_hdottedline_i:
   {
@@ -2460,16 +2981,24 @@
 \cs_new_protected:Npn \__nicematrix_hdottedline_i:n #1
   {
     \pgfrememberpicturepositiononpagetrue
-    \__nicematrix_qpoint: { row - #1 }
+    \__nicematrix_qpoint:n { row - #1 }
     \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y
     \dim_sub:Nn \l__nicematrix_y_initial_dim \l__nicematrix_radius_dim
     \dim_set_eq:NN \l__nicematrix_y_final_dim \l__nicematrix_y_initial_dim
-    \__nicematrix_qpoint: { col - 1 }
+    \__nicematrix_qpoint:n { col - 1 }
     \dim_set:Nn \l__nicematrix_x_initial_dim
-      { \pgf at x + \arraycolsep - \l__nicematrix_left_margin_dim }
-    \__nicematrix_qpoint: { col - \__nicematrix_succ:n \c at jCol }
+      {
+        \pgf at x +
+        \bool_if:NTF \l__nicematrix_NiceTabular_bool \tabcolsep \arraycolsep
+        - \l__nicematrix_left_margin_dim
+      }
+    \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \c at jCol }
     \dim_set:Nn \l__nicematrix_x_final_dim
-      { \pgf at x - \arraycolsep + \l__nicematrix_right_margin_dim }
+      {
+        \pgf at x -
+        \bool_if:NTF \l__nicematrix_NiceTabular_bool \tabcolsep \arraycolsep
+        + \l__nicematrix_right_margin_dim
+      }
     \tl_set:Nn \l_tmpa_tl { ( }
     \tl_if_eq:NNF \l__nicematrix_left_delim_tl \l_tmpa_tl
       { \dim_gadd:Nn \l__nicematrix_x_initial_dim  { 0.5 \l__nicematrix_inter_dots_dim } }
@@ -2479,36 +3008,32 @@
     \tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl
     \__nicematrix_draw_line:
   }
-\bool_if:nTF \c__nicematrix_draft_bool
-  { \cs_new_protected:Npn \__nicematrix_vdottedline:n #1 { } }
+\cs_new_protected:Npn \__nicematrix_vdottedline:n #1
   {
-    \cs_new_protected:Npn \__nicematrix_vdottedline:n #1
+    \bool_set_true:N \l__nicematrix_initial_open_bool
+    \bool_set_true:N \l__nicematrix_final_open_bool
+    \bool_if:NTF \c__nicematrix_tikz_loaded_bool
       {
-        \bool_set_true:N \l__nicematrix_initial_open_bool
-        \bool_set_true:N \l__nicematrix_final_open_bool
-        \bool_if:NTF \c__nicematrix_tikz_loaded_bool
-          {
-            \tikzpicture
-            \__nicematrix_vdottedline_i:n { #1 }
-            \endtikzpicture
-          }
-          {
-            \pgfpicture
-            \__nicematrix_vdottedline_i:n { #1 }
-            \endpgfpicture
-          }
+        \tikzpicture
+        \__nicematrix_vdottedline_i:n { #1 }
+        \endtikzpicture
       }
+      {
+        \pgfpicture
+        \__nicematrix_vdottedline_i:n { #1 }
+        \endpgfpicture
+      }
   }
 \cs_new_protected:Npn \__nicematrix_vdottedline_i:n #1
   {
-    \bool_if:NT \c__nicematrix_colortbl_loaded_bool \CT at arc@
+    \CT at arc@
     \pgfrememberpicturepositiononpagetrue
-    \__nicematrix_qpoint: { col - \int_eval:n { #1 + 1 } }
+    \__nicematrix_qpoint:n { col - \int_eval:n { #1 + 1 } }
     \dim_set:Nn \l__nicematrix_x_initial_dim { \pgf at x - \l__nicematrix_radius_dim }
     \dim_set:Nn \l__nicematrix_x_final_dim { \pgf at x - \l__nicematrix_radius_dim }
-    \__nicematrix_qpoint: { row - 1 }
+    \__nicematrix_qpoint:n { row - 1 }
     \dim_set:Nn \l__nicematrix_y_initial_dim { \pgf at y - 0.5 \l__nicematrix_inter_dots_dim }
-    \__nicematrix_qpoint: { row - \__nicematrix_succ:n \c at iRow }
+    \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c at iRow }
     \dim_set:Nn \l__nicematrix_y_final_dim { \pgf at y + 0.5 \l__nicematrix_inter_dots_dim }
     \tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl
     \__nicematrix_draw_line:
@@ -2600,7 +3125,7 @@
         \dim_compare:nNnT
           { \dim_use:c { l__nicematrix_row _ \__nicematrix_i: _ min _ dim } } = \c_max_dim
           {
-            \__nicematrix_qpoint: { row - \__nicematrix_i: - base }
+            \__nicematrix_qpoint:n { row - \__nicematrix_i: - base }
             \dim_set:cn { l__nicematrix_row _ \__nicematrix_i: _ max _ dim } \pgf at y
             \dim_set:cn { l__nicematrix_row _ \__nicematrix_i: _ min _ dim } \pgf at y
           }
@@ -2610,7 +3135,7 @@
         \dim_compare:nNnT
           { \dim_use:c { l__nicematrix_column _ \__nicematrix_j: _ min _ dim } } = \c_max_dim
           {
-            \__nicematrix_qpoint: { col - \__nicematrix_j: }
+            \__nicematrix_qpoint:n { col - \__nicematrix_j: }
             \dim_set:cn { l__nicematrix_column _ \__nicematrix_j: _ max _ dim } \pgf at y
             \dim_set:cn { l__nicematrix_column _ \__nicematrix_j: _ min _ dim } \pgf at y
           }
@@ -2779,26 +3304,29 @@
         \pgfpicture
           \pgfrememberpicturepositiononpagetrue
           \pgf at relevantforpicturesizefalse
-          \__nicematrix_qpoint: { row - #1 }
+          \__nicematrix_qpoint:n { row - #1 }
           \dim_set_eq:NN \l_tmpa_dim \pgf at y
-          \__nicematrix_qpoint: { col - #2 }
+          \__nicematrix_qpoint:n { col - #2 }
           \dim_set_eq:NN \l_tmpb_dim \pgf at x
-          \__nicematrix_qpoint: { row - \__nicematrix_succ:n { #3 } }
+          \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { #3 } }
           \dim_set_eq:NN \l_tmpc_dim \pgf at y
-          \__nicematrix_qpoint: { col - \__nicematrix_succ:n { #4 } }
+          \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #4 } }
           \dim_set_eq:NN \l_tmpd_dim \pgf at x
           \bool_if:NT \l__nicematrix_white_bool
             {
               \begin { pgfscope }
               \pgfsetfillcolor { white }
-              \int_compare:nNnT { #2 } = 1
+              \pgfpathrectanglecorners
                 {
-                  \int_compare:nNnT \l__nicematrix_first_col_int = 1
-                    { \dim_add:Nn \l_tmpb_dim \arrayrulewidth }
+                  \pgfpoint
+                    { \l_tmpb_dim + 0.5 \arrayrulewidth }
+                    { \l_tmpa_dim - 0.5 \arrayrulewidth }
                 }
-              \pgfpathrectanglecorners
-                { \pgfpoint \l_tmpb_dim { \l_tmpa_dim - \arrayrulewidth } }
-                { \pgfpoint { \l_tmpd_dim - \arrayrulewidth } \l_tmpc_dim }
+                {
+                  \pgfpoint
+                    { \l_tmpd_dim - 0.5 \arrayrulewidth }
+                    { \l_tmpc_dim + 0.5 \arrayrulewidth }
+                }
               \pgfusepathqfill
               \end { pgfscope }
             }
@@ -2817,14 +3345,14 @@
           }
         \int_compare:nNnTF { #1 } = { #3 }
           {
-            \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint: { row - #1 - base } }
-            \__nicematrix_qpoint: { #1 - #2 - block }
+            \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } }
+            \__nicematrix_qpoint:n { #1 - #2 - block }
             \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
             \pgfnode { rectangle } { base }
               { \box_use_drop:N \l__nicematrix_cell_box } { } { }
           }
           {
-            \pgftransformshift { \__nicematrix_qpoint: { #1 - #2 - block } }
+            \pgftransformshift { \__nicematrix_qpoint:n { #1 - #2 - block } }
             \pgfnode { rectangle } { center }
               { \box_use_drop:N \l__nicematrix_cell_box } { } { }
           }
@@ -2895,6 +3423,60 @@
 \__nicematrix_define_com:nnn v | |
 \__nicematrix_define_com:nnn V \| \|
 \__nicematrix_define_com:nnn B \{ \}
+\NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } }
+  {
+    \group_begin:
+      \bool_set_true:N \l__nicematrix_NiceArray_bool
+      \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ]
+    \group_end:
+  }
+\cs_set_eq:NN \__nicematrix_dotfill \dotfill
+\cs_new_protected:Npn \__nicematrix_dotfill:
+  {
+    \__nicematrix_dotfill
+    \group_insert_after:N \__nicematrix_dotfill_i:
+  }
+\cs_new_protected:Npn \__nicematrix_dotfill_i: { \group_insert_after:N \__nicematrix_dotfill_ii: }
+\cs_new_protected:Npn \__nicematrix_dotfill_ii: { \group_insert_after:N \__nicematrix_dotfill_iii: }
+\cs_new_protected:Npn \__nicematrix_dotfill_iii:
+  { \dim_compare:nNnT { \box_wd:N \l__nicematrix_cell_box } = \c_zero_dim  \__nicematrix_dotfill }
+\cs_new_protected:Npn \__nicematrix_slashbox:nn #1 #2
+  {
+    \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+      {
+        \__nicematrix_actually_slashbox:nnnn
+          { \int_use:N \c at iRow } { \int_use:N \c at jCol } { #1 } { #2 }
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_actually_slashbox:nnnn #1 #2 #3 #4
+  {
+    \pgfpicture
+    \pgf at relevantforpicturesizefalse
+    \pgfrememberpicturepositiononpagetrue
+    \__nicematrix_qpoint:n { row - #1 }
+    \dim_set_eq:NN \l_tmpa_dim \pgf at y
+    \__nicematrix_qpoint:n { col - #2 }
+    \dim_set_eq:NN \l_tmpb_dim \pgf at x
+    \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
+    \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { #1 } }
+    \dim_set_eq:NN \l_tmpc_dim \pgf at y
+    \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #2 } }
+    \dim_set_eq:NN \l_tmpd_dim \pgf at x
+    \pgfpathlineto { \pgfpoint \l_tmpd_dim \l_tmpc_dim }
+    {
+       \CT at arc@
+       \pgfsetroundcap
+       \pgfusepathqstroke
+    }
+    \pgfset { inner~sep = 1 pt }
+    \pgfscope
+    \pgftransformshift { \pgfpoint \l_tmpb_dim \l_tmpc_dim }
+    \pgfnode { rectangle } { south~west } { $ #3 $ } { } { }
+    \endpgfscope
+    \pgftransformshift { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
+    \pgfnode { rectangle } { north~east } { $ #4 $  } { } { }
+    \endpgfpicture
+  }
 \cs_new_protected:Npn \__nicematrix_CodeAfter:n #1 \end
   {
     \tl_gput_right:Nn \g__nicematrix_code_after_tl { #1 }
@@ -2902,7 +3484,8 @@
   }
 \cs_new_protected:Npn \__nicematrix_CodeAfter_i:n #1
   {
-    \bool_if:NTF { \str_if_eq_p:Vn \g__nicematrix_name_env_str { #1 } }
+    \str_set:NV \l_tmpa_str \@currenvir
+    \bool_if:NTF { \str_if_eq_p:Vn \l_tmpa_str { #1 } }
       { \end { #1 } }
       {
         \tl_gput_right:Nn \g__nicematrix_code_after_tl { \end { #1 } }
@@ -2909,7 +3492,14 @@
         \__nicematrix_CodeAfter:n
       }
   }
-\bool_new:N \c__nicematrix_obsolete_environments_bool
+\__nicematrix_msg_new:nn { obsolete~environments }
+  {
+    The~obsolete~environments~(eg.~{pNiceArrayC})~have~been~deleted~
+    from~the~package~nicematrix.\\
+    However,~if~you~still~want~to~use~them,~you~will~find~the~code~for~
+    those~environments~at~the~end~of~the~file~'nicematrix.sty',~after~
+    a~command~'\token_to_str:N\file_input_stop:'.
+  }
 \keys_define:nn { NiceMatrix / Package }
   {
     renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool ,
@@ -2918,9 +3508,7 @@
     renew-matrix .value_forbidden:n = true ,
     transparent .meta:n = { renew-dots , renew-matrix } ,
     transparent .value_forbidden:n = true,
-    obsolete-environments .bool_set:N = \c__nicematrix_obsolete_environments_bool ,
-    obsolete-environments .value_forbidden:n = true ,
-    obsolete-environments .default:n = true ,
+    obsolete-environments .code:n = \__nicematrix_fatal:n { obsolete~environments },
     starred-commands .code:n =
       \__nicematrix_msg_redirect_name:nn { starred~commands } { none } ,
     starred-commands .value_forbidden:n = true ,
@@ -2961,7 +3549,7 @@
   }
 \cs_new:Npn \__nicematrix_message_hdotsfor:
   {
-    \tl_if_empty:VF \g__nicematrix_Hdotsfor_lines_tl
+    \tl_if_empty:VF \g__nicematrix_HVdotsfor_lines_tl
       { ~Maybe~your~use~of~\token_to_str:N \Hdotsfor\ is~incorrect.}
   }
 \__nicematrix_msg_new:nn { too~much~cols~for~matrix~with~last~col }
@@ -2986,6 +3574,32 @@
     \int_eval:n { \c at jCol - 1 }~(plus~the~potential~exterior~ones).~
     This~error~is~fatal.
   }
+\__nicematrix_msg_new:nn { in~first~col }
+  {
+    You~can't~use~the~command~#1 in~the~first~column~(number~0)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+\__nicematrix_msg_new:nn { in~last~col }
+  {
+    You~can't~use~the~command~#1 in~the~last~column~(exterior)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+\__nicematrix_msg_new:nn { in~first~row }
+  {
+    You~can't~use~the~command~#1 in~the~first~row~(number~0)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+\__nicematrix_msg_new:nn { in~last~row }
+  {
+    You~can't~use~the~command~#1 in~the~last~row~(exterior)~of~the~array.\\
+    If~you~go~on,~this~command~will~be~ignored.
+  }
+\__nicematrix_msg_new:nn { option~S~without~siunitx }
+  {
+    You~can't~use~the~option~'S'~in~your~environment~\__nicematrix_full_name_env:
+    because~you~have~not~loaded~siunitx.\\
+    If~you~go~on,~this~option~will~be~ignored.
+  }
 \__nicematrix_msg_new:nn { bad~option~for~line-style }
   {
     Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~
@@ -3043,6 +3657,13 @@
     However,~you~can~go~on~for~this~time~
     (the~value~'\l_keys_value_tl'~will~be~ignored).
   }
+\__nicematrix_msg_new:nn { last-col~non~empty~for~NiceMatrixOptions }
+  {
+    In~\NiceMatrixoptions,~you~must~use~the~option~
+    'last-col'~without~value.\\
+    However,~you~can~go~on~for~this~time~
+    (the~value~'\l_keys_value_tl'~will~be~ignored).
+  }
 \__nicematrix_msg_new:nn { Block~too~large }
   {
     You~try~to~draw~a~block~in~the~cell~#1-#2~of~your~matrix~but~the~matrix~is~
@@ -3084,6 +3705,8 @@
     The~available~options~are~(in~alphabetic~order):~
     allow-duplicate-names,~
     code-for-first-col,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
     code-for-first-row,~
     code-for-last-col,~
     code-for-last-row,~
@@ -3092,8 +3715,12 @@
     create-large-nodes,~
     end-of-row,~
     exterior-arraycolsep,~
+    first-col,~
+    first-row,~
     hlines,~
     hvlines,~
+    last-col,~
+    last-row,~
     left-margin,~
     letter-for-dotted-lines,~
     light-syntax,~
@@ -3121,6 +3748,8 @@
     b,~
     baseline,~
     c,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
     code-after,~
     code-for-first-col,~
     code-for-first-row,~
@@ -3165,6 +3794,8 @@
     b,~
     baseline,~
     c,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
     code-after,~
     code-for-first-col,~
     code-for-first-row,~
@@ -3192,6 +3823,7 @@
     r~(=R),~
     renew-dots,~
     right-margin,~
+    S,~
     small,~
     t,~
     vlines,~
@@ -3199,6 +3831,51 @@
     xdots/shorten~and~
     xdots/line-style.
   }
+\__nicematrix_msg_new:nnn { Unknown~option~for~NiceTabular }
+  {
+    The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~
+    \{NiceTabular\}. \\
+    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):~
+    b,~
+    baseline,~
+    c,~
+    cell-space-bottom-limit,~
+    cell-space-top-limit,~
+    code-after,~
+    code-for-first-col,~
+    code-for-first-row,~
+    code-for-last-col,~
+    code-for-last-row,~
+    columns-width,~
+    create-extra-nodes,~
+    create-medium-nodes,~
+    create-large-nodes,~
+    end-of-row,~
+    extra-left-margin,~
+    extra-right-margin,~
+    first-col,~
+    first-row,~
+    hlines,~
+    hvlines,~
+    last-col,~
+    last-row,~
+    left-margin,~
+    light-syntax,~
+    name,~
+    nullify-dots,~
+    parallelize-diags,~
+    renew-dots,~
+    right-margin,~
+    t,~
+    vlines,~
+    xdots/color,~
+    xdots/shorten~and~
+    xdots/line-style.
+  }
 \__nicematrix_msg_new:nnn { Duplicate~name }
   {
     The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
@@ -3223,87 +3900,85 @@
     and~R~in~the~preamble~of~your~environment. \\
     This~error~is~fatal.
   }
-\bool_if:NT \c__nicematrix_obsolete_environments_bool
+\file_input_stop:
+\NewDocumentEnvironment { pNiceArrayC } { }
   {
-    \NewDocumentEnvironment { pNiceArrayC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \pNiceArray
-      }
-      { \endpNiceArray }
-     \NewDocumentEnvironment { bNiceArrayC } { }
-       {
-         \int_zero:N \l__nicematrix_last_col_int
-         \bNiceArray
-       }
-       { \endbNiceArray }
-    \NewDocumentEnvironment { BNiceArrayC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \BNiceArray
-      }
-      { \endBNiceArray }
-    \NewDocumentEnvironment { vNiceArrayC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \vNiceArray
-      }
-      { \endvNiceArray }
-    \NewDocumentEnvironment { VNiceArrayC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \VNiceArray
-      }
-      { \endVNiceArray }
-    \NewDocumentEnvironment { pNiceArrayRC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \int_zero:N \l__nicematrix_first_row_int
-        \pNiceArray
-      }
-      { \endpNiceArray }
-    \NewDocumentEnvironment { bNiceArrayRC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \int_zero:N \l__nicematrix_first_row_int
-        \bNiceArray
-      }
-      { \endbNiceArray }
-    \NewDocumentEnvironment { BNiceArrayRC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \int_zero:N \l__nicematrix_first_row_int
-        \BNiceArray
-      }
-      { \endBNiceArray }
-    \NewDocumentEnvironment { vNiceArrayRC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \int_zero:N \l__nicematrix_first_row_int
-        \vNiceArray
-      }
-      { \endvNiceArray }
-    \NewDocumentEnvironment { VNiceArrayRC } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \int_zero:N \l__nicematrix_first_row_int
-        \VNiceArray
-      }
-      { \endVNiceArray }
-    \NewDocumentEnvironment { NiceArrayCwithDelims } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \NiceArrayWithDelims
-      }
-      { \endNiceArrayWithDelims }
-    \NewDocumentEnvironment { NiceArrayRCwithDelims } { }
-      {
-        \int_zero:N \l__nicematrix_last_col_int
-        \int_zero:N \l__nicematrix_first_row_int
-        \NiceArrayWithDelims
-      }
-      { \endNiceArrayWithDelims }
+    \int_zero:N \l__nicematrix_last_col_int
+    \pNiceArray
   }
+  { \endpNiceArray }
+ \NewDocumentEnvironment { bNiceArrayC } { }
+   {
+     \int_zero:N \l__nicematrix_last_col_int
+     \bNiceArray
+   }
+   { \endbNiceArray }
+\NewDocumentEnvironment { BNiceArrayC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \BNiceArray
+  }
+  { \endBNiceArray }
+\NewDocumentEnvironment { vNiceArrayC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \vNiceArray
+  }
+  { \endvNiceArray }
+\NewDocumentEnvironment { VNiceArrayC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \VNiceArray
+  }
+  { \endVNiceArray }
+\NewDocumentEnvironment { pNiceArrayRC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \int_zero:N \l__nicematrix_first_row_int
+    \pNiceArray
+  }
+  { \endpNiceArray }
+\NewDocumentEnvironment { bNiceArrayRC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \int_zero:N \l__nicematrix_first_row_int
+    \bNiceArray
+  }
+  { \endbNiceArray }
+\NewDocumentEnvironment { BNiceArrayRC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \int_zero:N \l__nicematrix_first_row_int
+    \BNiceArray
+  }
+  { \endBNiceArray }
+\NewDocumentEnvironment { vNiceArrayRC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \int_zero:N \l__nicematrix_first_row_int
+    \vNiceArray
+  }
+  { \endvNiceArray }
+\NewDocumentEnvironment { VNiceArrayRC } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \int_zero:N \l__nicematrix_first_row_int
+    \VNiceArray
+  }
+  { \endVNiceArray }
+\NewDocumentEnvironment { NiceArrayCwithDelims } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \NiceArrayWithDelims
+  }
+  { \endNiceArrayWithDelims }
+\NewDocumentEnvironment { NiceArrayRCwithDelims } { }
+  {
+    \int_zero:N \l__nicematrix_last_col_int
+    \int_zero:N \l__nicematrix_first_row_int
+    \NiceArrayWithDelims
+  }
+  { \endNiceArrayWithDelims }
 
 \endinput
 %%



More information about the tex-live-commits mailing list.