texlive[71390] Master/texmf-dist: nicematrix (30may24)

commits+karl at tug.org commits+karl at tug.org
Thu May 30 21:57:31 CEST 2024


Revision: 71390
          https://tug.org/svn/texlive?view=revision&revision=71390
Author:   karl
Date:     2024-05-30 21:57:31 +0200 (Thu, 30 May 2024)
Log Message:
-----------
nicematrix (30may24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/nicematrix/README.md
    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/doc/latex/nicematrix/nicematrix.tex
    trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx
    trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/README.md	2024-05-30 19:57:12 UTC (rev 71389)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/README.md	2024-05-30 19:57:31 UTC (rev 71390)
@@ -4,6 +4,8 @@
 
 CTAN page: `https://ctan.org/pkg/nicematrix`
 
+GitHub page: `github.com/fpantigny/nicematrix`
+
 ## License
 The LaTeX extension `nicematrix` is distributed under the LPPL 1.3 license.
 

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

Index: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf	2024-05-30 19:57:12 UTC (rev 71389)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf	2024-05-30 19:57:31 UTC (rev 71390)

Property changes on: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
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	2024-05-30 19:57:12 UTC (rev 71389)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2024-05-30 19:57:31 UTC (rev 71390)
@@ -516,10 +516,11 @@
 de rangées n'est pas indiqué, ou bien est égal à |*|, le bloc s'étend jusqu'à la
 dernière rangée (idem pour les colonnes).
 
-\item Le deuxième argument est le contenu du bloc. On peut utiliser |\\| dans ce
-contenu pour avoir un contenu sur plusieurs lignes. Dans |{NiceTabular}|,
-|{NiceTabular*}| et |{NiceTabularX}|, le contenu est composé en mode texte
-tandis que, dans les autres environnements, il est composé en mode mathématique.
+\item Le deuxième argument est le contenu du bloc. 
+
+Dans |{NiceTabular}|, |{NiceTabular*}| et |{NiceTabularX}|, le contenu est
+composé en mode texte tandis que, dans les autres environnements, il est composé
+en mode mathématique.
 \end{itemize}
 
 \interitem
@@ -641,12 +642,12 @@
 applicables à un chemin de TikZ). Pour des exemples d'utilisation de cette clé
 |tikz|, voir p.~\pageref{tikz-key-examples}.
 
-\colorbox{yellow!50}{\textbf{Nouveau 6.24}}\enskip En fait, dans la liste des
-clés fournies à |tikz|, on peut mettre une clé \Definition{offset}. Cette clé
-n'est pas fournie par TikZ mais par \pkg{nicematrix}. Elle réduit le rectangle
-correspondant au bloc par une marge (horizontalement et verticalement) égale à
-la valeur (passée à |offset|). C'est ce rectangle réduit qui sera le chemin
-exécuté par TikZ avec comme options les autres clés passées à la clé |tikz|.
+En fait, dans la liste des clés fournies à |tikz|, on peut mettre une clé
+\Definition{offset}. Cette clé n'est pas fournie par TikZ mais par
+\pkg{nicematrix}. Elle réduit le rectangle correspondant au bloc par une marge
+(horizontalement et verticalement) égale à la valeur (passée à |offset|). C'est
+ce rectangle réduit qui sera le chemin exécuté par TikZ avec comme options les
+autres clés passées à la clé |tikz|.
 \end{itemize}
 
 
@@ -725,10 +726,11 @@
 |W{...}{...}|, |V{...}| et~|X|), le contenu du bloc est mis en forme comme un
 paragraphe de cette largeur.
 
-\item La spécification d'alignement horizontal donnée par le type de
-colonne (|c|, |r| ou |l|) est prise en compte pour le bloc (mais le bloc peut
-avoir sa propre spécification d'alignement horizontal :
-cf.~\ref{horizontal-bloc} p.~\pageref{horizontal-bloc}). 
+\item La spécification d'alignement horizontal donnée par le type de colonne
+(|c|, |r| ou |l|) est prise en compte pour le bloc. Pour un bloc dans une
+colonne de type |p{...}| (sans option à |p|), c'est un alignement |c| qui est
+retenu. Le bloc peut bien sûr avoir sa propre spécification d'alignement
+horizontal : cf.~\ref{horizontal-bloc} p.~\pageref{horizontal-bloc}.
 
 \item Les spécifications de fontes imposées à une colonne via la construction
 |>{...}| dans le préambule du tableau sont prises en compte pour les
@@ -836,8 +838,9 @@
 
 \label{horizontal-bloc}
 
-La commande |\Block| admet les clés |l|, |c| et |r| pour la position horizontale
-du contenu du bloc (calé à gauche, centré ou bien calé à droite).
+La commande |\Block| admet les clés \Definition{l}, \Definition{c} et
+\Definition{r} pour la position horizontale du contenu du bloc (calé à gauche,
+centré ou bien calé à droite).
 
 \medskip
 \begin{Code}[width=10.6cm]
@@ -899,7 +902,8 @@
 \medskip
 Pour avoir un positionnement horizontal du contenu du bloc qui s'appuie sur les
 limites des colonnes du tableau LaTeX (et non sur le contenu de ces colonnes),
-il faut utiliser les clés |L|, |R| et |C| de la commande |\Block|.
+il faut utiliser les clés \Definition{L}, \Definition{R} et \Definition{C} de la
+commande |\Block|. 
 
 \medskip
 Voici le même exemple avec la clé |C| pour le premier bloc.
@@ -935,8 +939,18 @@
 \end{NiceTabular}
 \end{center}
 
+\bigskip
+\colorbox{yellow!50}{\bfseries Nouveau 6.28}\par\nobreak
 
+\smallskip
+La commande |\Block| accepte aussi la clé |p|. Avec cette clé, le contenu du
+bloc est composé comme un paragraphe (de manière similaire à une colonne
+standard de type |p|). Cette clé peut s'utiliser en conjonction avec les clés
+|l|, |c| ou |r| et, alors, le paragraphe est composé avec |\raggedright|,
+|\centering| ou |\raggedleft|. Avec la clé |j|, le paragraphe est composé de
+manière justifiée.
 
+
 \subsection{Positionnement vertical du contenu des blocs}
 
 
@@ -962,7 +976,8 @@
 
 Il n'y a pas de marge verticale. Néanmoins, le contenu du bloc est (toujours)
 composé en interne dans une |{minipage}|, un |{tabular}| ou un |{array}|, ce qui
-fait qu'il y a souvent déjà une marge.
+fait qu'il y a souvent déjà une marge. Si besoin est, on peut toujours ajouter
+un |\strut|.
 
 \item Avec la clé \Definition{B}, le contenu du bloc est calé vers le bas.
 \end{itemize}
@@ -1063,6 +1078,85 @@
 
 \end{scope}
 
+
+\subsection{\textbackslash\textbackslash\ et \& dans les blocs}
+
+\index{ampersand-in-blocks}
+
+\colorbox{yellow!50}{\bfseries Nouveau 6.28}\par\nobreak
+
+\medskip
+L'extension \pkg{nicematrix} offre la possibilité d'utiliser directement |\\| et
+|&| dans le contenu d'un bloc (dans le but de formater son contenu) mais il y a
+quelques restrictions.
+
+\begin{itemize}
+\item On ne doit pas utiliser |&| et |\\| dans le même bloc.
+
+\item Pour |\\|, il n'y a pas d'autres restrictions. On peut utiliser
+|\\| dans un bloc pour composer du texte sur plusieurs lignes.  
+
+\item Pour pouvoir utiliser |&|, la clé |ampersand-in-blocks| doit avoir été
+activée. Le bloc est alors divisé en sous-blocs comme illustré ci-desous.
+Attention toutefois : quand |ampersand-in-blocks| est utilisée, l'argument
+(principal) de la commande |\Block| est découpé syntaxiquement au niveau des
+esperluettes |&|, celles entre accolades sont masquées mais pas celles dans un
+environnement.\footnote{On ne peut donc écrire :
+  |\Block[ampersand-in-blocks]{}{\begin{array}{cc}1&2\end{array}}|. Bien sûr, on
+  peut le faire sans la clé |ampersand-in-blocks|.}
+\end{itemize}
+
+\bigskip
+L'esperluette |&| permet de diviser horizontalement un bloc en sous-blocs \emph{de même taille}.
+
+\medskip
+\begin{Code}[width=85mm]
+\begin{NiceTabular}{ll}%
+   [hvlines,ampersand-in-blocks]
+  & les cinq premiers entiers naturels \\
+3 & \Block{un&deux&trois} \\
+4 & \Block{un&deux&trois& quatre} \\
+5 & \Block{un&deux&trois&quatre&cinq} \\
+\end{NiceTabular}
+\end{Code}
+%
+\begin{NiceTabular}{ll}%
+   [hvlines,ampersand-in-blocks]
+  & les cinq premiers entiers naturels \\ 
+3 & \Block{}{un & deux & trois} \\
+4 & \Block{}{un& deux & trois & quatre} \\
+5 & \Block{}{un & deux & trois & quatre & cinq} \\
+\end{NiceTabular}
+
+\medskip
+Comme on le voit, le bloc (qui était ici mono-case) a été divisé en sous-cases
+de même taille. Dans le cas présent, on aurait peut-être préféré le codage
+suivant :
+
+\medskip
+\begin{Code}[width=85mm]
+\begin{NiceTabular}{lccccc}%
+   [hvlines,ampersand-in-blocks]
+  & \Block{1-5}{les cinq premiers 
+                 entiers naturels} \\ 
+3 & \Block{1-5}{un & deux & trois} \\
+4 & \Block{1-5}{un& deux & trois & quatre} \\
+5 & un & deux & trois & quatre & cinq \\
+\end{NiceTabular}
+\end{Code}
+%
+\begin{NiceTabular}{lccccc}%
+   [hvlines,ampersand-in-blocks]
+  & \Block{1-5}{les cinq premiers entiers naturels} \\ 
+3 & \Block{1-5}{un & deux & trois} \\
+4 & \Block{1-5}{un& deux & trois & quatre} \\
+5 & un & deux & trois & quatre & cinq \\
+\end{NiceTabular}
+
+Dans ce codage, il s'agit de blocs de taille |1-5| qui sont coupés en trois et
+quatre sous-blocs.
+
+
 \index{Blocs@\textbf{Blocs dans les tableaux}|)}
 
 \section{Les filets horizontaux et verticaux}
@@ -1315,7 +1409,7 @@
 
 \medskip
 \begin{Code}[width=10cm]
-\begin{NiceTabular}{|c|\emph{[color=blue]}c|}
+\begin{NiceTabular}{| c | \emph{[color=blue]} c |}
 \Hline
 a & b \\
 \emph{\Hline[color=red]}
@@ -1643,7 +1737,8 @@
 \item la clé \Definition{color} fixe la couleur des filets ;
 
 \item la clé \Definition{sep-color} fixe la couleur entre deux filets consécutifs (n'a
-d'intérêt que dans le cas où la clé |multiplicity| est utilisée).
+d'intérêt que dans le cas où la clé |multiplicity| est utilisée). Le nom de
+cette clé est inspirée par la commande |\doublerulesepcolor| de \pkg{colortbl}.
 \end{itemize}
 
 \medskip
@@ -1680,6 +1775,51 @@
 \end{center}
 
 
+\bigskip
+La clé |sep-color| avec la valeur |white| peut être en particulier utile en cas
+de filet double au-dessus d'une case colorée (pour éviter que la couleur ne
+s'applique aussi entre les deux filets).
+
+
+\begin{scope}
+\NiceMatrixOptions
+  {
+    custom-line = 
+     {
+       command = DoubleRule , 
+       multiplicity = 2 , 
+       sep-color = white
+     }
+  }
+
+
+\begin{Code}[width=10cm]
+\NiceMatrixOptions
+  {
+    custom-line = 
+     {
+       command = DoubleRule , 
+       multiplicity = 2 , 
+       \emph{sep-color = white}
+     }
+  }
+
+\begin{NiceTabular}{ccc}[color-inside]
+un & deux & trois \\
+\emph{\DoubleRule}
+quatre & \cellcolor{yellow} cinq & six \\
+\end{NiceTabular}
+\end{Code}
+\begin{NiceTabular}{ccc}[color-inside]
+un & deux & trois \\
+\DoubleRule
+quatre & \cellcolor{yellow} cinq & six \\
+\end{NiceTabular}
+
+\end{scope}
+
+
+\bigskip
 \item \emph{Deuxième possibilité}\par\nobreak
 
 \index{tikzz at tikz!clé de «custom-line»}
@@ -1691,7 +1831,7 @@
 qui doit être une liste de couples \textsl{clé=valeur} applicables à un chemin
 TikZ.
 
-Par défaut aucune réservation de place n'est faite pour le filet qui sera tracé
+Par défaut, aucune réservation de place n'est faite pour le filet qui sera tracé
 avec TikZ. On peut demander une réservation (horizontale pour un filet vertical
 et verticale pour un filet horizontal) avec la clé |total-width| qui est donc en
 quelque sorte la largeur du filet qui sera tracé (cette largeur n'est \emph{pas}
@@ -1736,7 +1876,7 @@
 \end{center}
 
 \medskip
-\item \emph{Troisième possibilité} : la clé |dotted|\par\nobreak
+\item \emph{Troisième possibilité} : la clé \Definition{dotted}\par\nobreak
 \label{dotted}
 \index{dotted (clé de «custom-line»)}
 \indexcommand{hdottedline}
@@ -1753,15 +1893,14 @@
 p.~\pageref{Cdots}).
 
 \medskip
-L'extension \pkg{nicematrix} prédéfinit en fait les commandes |\hdottedline| et
-|\cdottedline| et la lettre «|:|» pour ces filets en
-pointillés.\footnote{Néanmoins, l'utilisateur peut écraser ces définitions de
+L'extension \pkg{nicematrix} prédéfinit en fait les commandes \Definition{hdottedline} et
+\Definition{cdottedline} et la lettre «|:|» pour ces filets en pointillés.\footnote{Néanmoins, l'utilisateur peut écraser ces définitions de
   |\hdottedline|, |\cdottedline| et de «|:|» avec |custom-line| s'il le souhaite
   (par exemple pour les remplacer par des lignes en tiretés).}
 
 \smallskip
 \begin{Code}
-% présent dans nicematrix.sty
+\emph{% présent dans nicematrix.sty}
 \NiceMatrixOptions
   { 
     custom-line = 
@@ -2527,12 +2666,11 @@
 \end{center}
 
 \bigskip
-\colorbox{yellow!50}{\textbf{Nouveau 6.25}}\enskip Chaque utilisation de
-|\rowlistcolors| (et de |\rowcolors| qui en est un cas particulier) met un
-terme aux éventuels schémas\footnote{On a écrit \emph{schémas} au pluriel car on
-  peut avoir plusieurs schémas en cours s'ils portent sur des colonnes
-  différentes.} de coloriage en cours qui auraient été spécifiés par une
-commande |\rowlistcolors| précédente.
+Chaque utilisation de |\rowlistcolors| (et de |\rowcolors| qui en est un cas
+particulier) met un terme aux éventuels schémas\footnote{On a écrit
+  \emph{schémas} au pluriel car on peut avoir plusieurs schémas en cours s'ils
+  portent sur des colonnes différentes.} de coloriage en cours qui auraient été
+spécifiés par une commande |\rowlistcolors| précédente.
 
 En particulier, on peut engager un coloriage des rangées avec
 |\rowlistcolors{...}| et l'arrêter par un |\rowlistcolors{}| avec argument vide.
@@ -2567,10 +2705,9 @@
 
 \index{nocolor}
 
-\colorbox{yellow!50}{\textbf{Nouveau 6.26}}\enskip L'extension \pkg{nicematrix}
-propose la couleur spéciale |nocolor| utilisable dans toutes les commandes de
-coloriage fournies par \pkg{nicematrix} (dans le |\CodeBefore| ou bien dans le
-tableau proprement dit).
+L'extension \pkg{nicematrix} propose la couleur spéciale |nocolor| utilisable
+dans toutes les commandes de coloriage fournies par \pkg{nicematrix} (dans le
+|\CodeBefore| ou bien dans le tableau proprement dit).
 
 Les cases marquées par cette couleur ne seront pas coloriées, quelles que soient
 les autres commandes de coloriage qui auraient pu s'appliquer à ces cases. 
@@ -2767,7 +2904,7 @@
  \end{bNiceMatrix} \\ \\
 \begin{bNiceMatrix}
  1   & 1245345 \\  345 & 2
-\end{bNiceMatrix}
+\end{bNiceMatrix} \\
 \end{array}$
 \emph{\end{NiceMatrixBlock}}
 \end{Code}
@@ -2778,8 +2915,8 @@
  \end{bNiceMatrix} \\ \\
 \begin{bNiceMatrix}
  1   & 1245345 \\  345 & 2
-\end{bNiceMatrix}
-\end{array}$
+\end{bNiceMatrix} \\
+\end{array}$ 
 \end{NiceMatrixBlock}
 
 
@@ -4291,16 +4428,16 @@
 \index{empty (clé de \texttt{\textbackslash TikzEveryCell})}
 \index{non empty (clé de \texttt{\textbackslash TikzEveryCell})}
 
-\colorbox{yellow!50}{\textbf{Nouveau 6.24}}\enskip La commande |\TikzEveryCell|
-exécute avec TikZ le chemin rectangulaire qui correspond à chaque case du
-tableau, avec comme paramètres TikZ l'argument de |\TikzEveryCell|. Cet argument
-doit être une liste de couples \textsl{clé=valeur} applicables à un chemin TikZ.
-En fait, cette commande s'applique à chaque case du tableau, exceptées celles
-situées dans les rangées et colonnes extérieures (cf.~p.~\pageref{exterior}) et
-celles situées dans les coins vides (quand la clé |corners| est utilisée:
-cf.~p.~\pageref{corners}). Elle s'applique en fait aussi à chaque bloc (sauf
-ceux qui ont la clé |transparent|) et ne s'applique pas aux cases individuelles
-situées dans ces blocs.
+La commande |\TikzEveryCell| exécute avec TikZ le chemin rectangulaire qui
+correspond à chaque case du tableau, avec comme paramètres TikZ l'argument de
+|\TikzEveryCell|. Cet argument doit être une liste de couples
+\textsl{clé=valeur} applicables à un chemin TikZ. En fait, cette commande
+s'applique à chaque case du tableau, exceptées celles situées dans les rangées
+et colonnes extérieures (cf.~p.~\pageref{exterior}) et celles situées dans les
+coins vides (quand la clé |corners| est utilisée: cf.~p.~\pageref{corners}).
+Elle s'applique en fait aussi à chaque bloc (sauf ceux qui ont la clé
+|transparent|) et ne s'applique pas aux cases individuelles situées dans ces
+blocs.
 
 \medskip
 En fait, dans la liste des clés passée en argument on peut mettre une clé
@@ -5209,12 +5346,11 @@
 
 \medskip
 \index{light-syntax-expanded}
-\colorbox{yellow!50}{\textbf{Nouveau 6.27}}\enskip La clé
-|light-syntax-expanded| a le même comportement que la clé |light-syntax| mais
-avec cette différence que le corps de l'environnement est complètement développé
-(au sens de TeX\footnote{Plus précisément, il s'agit d'une expansion de type |e|
-de L3.}) avant découpe en lignes (mais après l'extraction de l'éventuel
-|\CodeAfter|).
+La clé |light-syntax-expanded| a le même comportement que la clé |light-syntax|
+mais avec cette différence que le corps de l'environnement est complètement
+développé (au sens de TeX\footnote{Plus précisément, il s'agit d'une expansion
+  de type |e| de L3.}) avant découpe en lignes (mais après l'extraction de
+l'éventuel |\CodeAfter|).
 
 
 \subsection{Couleur des délimiteurs}
@@ -5319,7 +5455,7 @@
 \medskip
 Comme la création de ces nœuds requiert du temps et de la mémoire, il est
 possible de la désactiver ponctuellement avec la clé |no-cell-nodes| pour
-accéler les compilations. 
+accélerer les compilations. 
 
 \medskip
 Tous les nœuds du document doivent avoir des noms deux à deux distincts et le
@@ -5774,9 +5910,14 @@
 du préfixe habituel) à l'intersection du filet horizontal de numéro $i$ et du
 filet vertical de numéro~$i$ (ou plutôt la position potentielle de ces filets
 car ils ne sont peut-être pas tracés). Le dernier nœud a aussi un alias nommé
-simplement |last|. Il existe aussi un nœud nommé $i$|.5| à mi-chemin entre le
-nœud $i$ et le nœud $i+1$.
+simplement |last|. 
 
+\smallskip
+\colorbox{yellow!50}{\textbf{Modification 6.28}}\enskip Il existe aussi des nœuds nommés
+$i$|.1|, $i$|.2|, ... , $i$|.9| intermédiaires entre le nœud~$i$ et le
+nœud~$i+1$ (avant la version 6.28, seul le nœud $i$|.5| existait).
+
+\smallskip
 Ces nœuds sont accessibles dans le
 |\CodeAfter| mais aussi dans le |\CodeBefore|.
 
@@ -6193,10 +6334,18 @@
 
 \medskip
 L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess}
-(car cette classe n'est pas compatible avec PGF-TikZ).\footnote{Voir
-  \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}
+car cette classe n'est pas compatible avec PGF-TikZ. Il existe néanmoins une
+parade simple qui consiste à écrire:\footnote{Voir
+  \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}\par\nobreak
 
+\begin{Code}
+\let\TeXyear\year
+\documentclass{IEEEaccess}
+\let\year\TeXyear
+\end{Code}
+
 \medskip
+% l'information suivante est toujours d'actualité le 23 avril 2024
 Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{aastex631} (de
 l'\emph{American Astronomical Society}), on doit ajouter dans le préambule du
 fichier les lignes suivantes :
@@ -6780,7 +6929,7 @@
     last-col, code-for-last-col = \color{blue}\scriptstyle,
     vlines = 5 ,
     matrix/columns-type = r ,
-    no-cell-nodes
+    no-cell-nodes % facultatif
   }
 \setlength{\extrarowheight}{1mm}
 \end{NiceMatrixBlock}
@@ -6882,7 +7031,7 @@
     last-col, code-for-last-col = \color{blue}\scriptstyle,
     vlines = 5 ,
     matrix/columns-type = r ,
-    no-cell-nodes
+    no-cell-nodes % facultatif
   }
 \setlength{\extrarowheight}{1mm}
 
@@ -7093,7 +7242,7 @@
 \label{exemple-CodeAfter}
 
 \begin{Code}
-$\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue]
+$\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue,no-cell-nodes]
 \emph{\Block[draw]{}{a_{11}}} & a_{12} & a_{13} & a_{14} \\
 a_{21} & \emph{\Block[draw]{}{a_{22}}} & a_{23} & a_{24} \\
 a_{31} & a_{32} & \emph{\Block[draw]{}{a_{33}}} & a_{34} \\
@@ -7101,7 +7250,7 @@
 \end{pNiceArray}$
 \end{Code}
 %
-\[\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue]
+\[\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue,no-cell-nodes]
 \Block[draw]{}{a_{11}} & a_{12} & a_{13} & a_{14} \\
 a_{21} & \Block[draw]{}{a_{22}} & a_{23} & a_{24} \\
 a_{31} & a_{32} & \Block[draw]{}{a_{33}} & a_{34} \\
@@ -7126,7 +7275,8 @@
 \index{rowcolor@\texttt{\textbackslash rowcolor}!commande en tableau|textit}
 
 \begin{Code}
-\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside]
+\begin{pNiceArray}{>{\strut}cccc}% <-- % obligatoire
+    [margin, extra-margin=2pt,color-inside,no-cell-nodes]
   \emph{\rowcolor{red!15}}A_{11} & A_{12} & A_{13} & A_{14} \\
   A_{21} & \emph{\rowcolor{red!15}}A_{22} & A_{23} & A_{24} \\
   A_{31} & A_{32} & \emph{\rowcolor{red!15}}A_{33} & A_{34} \\
@@ -7136,7 +7286,7 @@
 
 
 
-\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside]
+\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside,no-cell-nodes]
   \rowcolor{red!15}A_{11} & A_{12} & A_{13} & A_{14} \\
   A_{21} & \rowcolor{red!15}A_{22} & A_{23} & A_{24} \\
   A_{31} & A_{32} & \rowcolor{red!15}A_{33} & A_{34} \\

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

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex	2024-05-30 19:57:12 UTC (rev 71389)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex	2024-05-30 19:57:31 UTC (rev 71390)
@@ -486,8 +486,7 @@
 value is |1-1|. If the number of rows is not specified, or equal to |*|, the
 block extends until the last row (idem for the columns).
 
-\item The second argument is the content of the block. It's possible to use
-|\\| in that content to have a content on several lines. In |{NiceTabular}|,
+\item The second argument is the content of the block. In |{NiceTabular}|,
 |{NiceTabular*}| and |{NiceTabularX}|, the content of the block is composed in
 text mode whereas, in the other environments, it is composed in math mode.
 \end{itemize}
@@ -614,13 +613,13 @@
 if it's not, an error will be raised.} by using as options the value of that
 key |tikz| (which must be a list of keys allowed for a TikZ path). 
 
-\colorbox{yellow!50}{\textbf{New 6.24}}\enskip In fact, in the list of the keys
-provided  by the user as value of |tikz|, it's possible to put a key
-\Definition{offset}. That key is not provided by TikZ but by \pkg{nicematrix}.
-It will narrow the rectangular frame corresponding to the block by a margin
-(horizontally and vertically) equal to the value (of that key |offset|). That
-new frame, a bit narrower, will be executed by TikZ with options which are the
-other keys in the list of keys provided as value to the key |tikz| of |\Block|.
+In fact, in the list of the keys provided by the user as value of |tikz|, it's
+possible to put a key \Definition{offset}. That key is not provided by TikZ but
+by \pkg{nicematrix}. It will narrow the rectangular frame corresponding to the
+block by a margin (horizontally and vertically) equal to the value (of that key
+|offset|). That new frame, a bit narrower, will be executed by TikZ with options
+which are the other keys in the list of keys provided as value to the key |tikz|
+of |\Block|.
 
 For examples, cf. p.~\pageref{tikz-key-examples}.
 \end{itemize}
@@ -694,9 +693,10 @@
 formatted as a paragraph of that width.
 
 \item The specification of the horizontal position provided by the type of
-column (|c|, |r| or |l|) is taken into account for the blocks (but the
-|\Block| may have its own specification of alignment:
-cf.~\ref{horizontal-block} p.~\pageref{horizontal-block}).
+column (|c|, |r| or |l|) is taken into account for the blocks. For a block in a
+column ot type |p{...}| (without option for |p|) , the alignment |c| will be
+used for the block. Of course, the |\Block| may have its own specification of
+alignment: cf.~\ref{horizontal-block} p.~\pageref{horizontal-block}.
 
 \item The specifications of font specified for the column by a construction
 |>{...}| in the preamble of the array are taken into account for the
@@ -800,8 +800,8 @@
 
 \label{horizontal-block}
 
-The command |\Block| accepts the keys |l|, |c| and |r| for the horizontal
-position of its content.
+The command |\Block| accepts the keys \Definition{l}, \Definition{c} and
+\Definition{r} for the horizontal position of its content.
 
 \medskip
 \begin{Code}[width=10.6cm]
@@ -863,10 +863,10 @@
 \end{center}
 
 \medskip
-In order to have an horizontal positionning of the content of the block
-computed with the limits of the columns of the LaTeX array (and not with the
-contents of those columns), one may use the key |L|, |R| and |C| of the
-command |\Block|.
+In order to have an horizontal positionning of the content of the block computed
+with the limits of the columns of the LaTeX array (and not with the contents of
+those columns), one may use the key \Definition{L}, \Definition{R} and
+\Definition{C} of the command |\Block|.
 
 \medskip
 Here is the same example with the key |C| for the first block.
@@ -904,6 +904,16 @@
 \end{center}
 
 
+\bigskip
+\colorbox{yellow!50}{\bfseries New 6.28}\par\nobreak
+
+\smallskip
+The command |\Block| supports also a key |p|. With that key, the content of the
+block is formatted like a paragraph (as in a column of type |p|). That key may
+be used in conjunction with the key |l|, |c| or |r|, and, in that case, the
+paragraph is formatted with |\raggedright|, |\centering| or |\raggedleft|. With
+the key |j|, the paragraph is justified.
+
 \subsection{Vertical position of the content of the block}
 
 \label{vertical-pos-block}
@@ -925,7 +935,8 @@
 
 No vertical margin is added. However, the contents of the block is (always)
 composed by \pkg{nicematrix} in a |{minipage}|, a |{tabular}| or an |{array}|
-and, hence, there will still remain a margin (in most cases).
+and, hence, there will still remain a margin (in most cases). If needed, it's
+always possible to add a |\strut|...
 
 \item With the key \Definition{B}, the content of the block is set downwards.
 \end{itemize}
@@ -1028,6 +1039,61 @@
 
 \end{scope}
 
+\subsection{\textbackslash\textbackslash\ and \& in the blocks}
+
+\index{ampersand-in-blocks}
+
+\colorbox{yellow!50}{\bfseries New 6.28}\par\nobreak
+
+The extension \pkg{nicemtrix} provides the ability to use |\\| and |&| directly
+in the content of a block (in order to format its contents) but there is some rectrictions.
+
+\begin{itemize}
+\item One must not use both |\\| and |&| in the same block.
+
+\item For |\\|, there is no other restriction. It's possible to use |\\| in a
+block to format a text on several rows.
+
+\item In order to use |&|, the key |ampersand-in-blocks| must been activated. Then,
+the block is divided in sub-blocks as illustrated below. Be careful: with
+|ampersand-in-blocks| is in force, the (main) argument of the command |\Block|
+is syntactically divided into sub-blocks by splitting on the ampersands~|&|, the
+ampersands between curly braced are protected but not those in an
+environment.\footnote{It's not possible to write
+  |\Block[ampersand-in-blocks]{}{\begin{array}{cc}1&2\end{array}}|. Of course,
+  it's possible without the key |ampersand-in-blocks|.}
+\end{itemize}
+
+When the key |ampersand-in-blocks|
+As we can see, the blocks (which was are in fact mono-cell blocks) are divided
+into sub-blocks of the same size. However, maybe the following code would be prefered.
+
+\medskip
+\begin{Code}[width=85mm]
+\begin{NiceTabular}{lccccc}%
+   [hvlines,ampersand-in-blocks]
+  & \Block{1-5}{the five first
+                 natural numbers} \\ 
+3 & \Block{1-5}{one & two & three} \\
+4 & \Block{1-5}{one& two & three & four} \\
+5 & one & two & three & four & five \\
+\end{NiceTabular}
+\end{Code}
+%
+\begin{NiceTabular}{lccccc}%
+   [hvlines,ampersand-in-blocks]
+  & \Block{1-5}{the five first natural numbers} \\ 
+3 & \Block{1-5}{one & two & three} \\
+4 & \Block{1-5}{one& two & three & four} \\
+5 & one & two & three & four & five \\
+\end{NiceTabular}
+
+\medskip
+In this code, we have blocks of size |1-5| which are divided into three or four
+sub-blocks. 
+
+
+
 \index{Blocks@\textbf{Blocks in the tabulars}|)}
 
 
@@ -1264,7 +1330,7 @@
 
 \medskip
 \begin{Code}[width=10cm]
-\begin{NiceTabular}{|c\emph{|[color=blue]}c|}
+\begin{NiceTabular}{ | c \emph{|[color=blue]} c |}
 \Hline
 a & b \\
 \emph{\Hline[color=red]}
@@ -1587,7 +1653,8 @@
 \item the key |color| sets the color of the rules ;
 
 \item the key |sep-color| sets the color between two successive rules (should be
-used only in conjonction with |multiplicity|).
+used only in conjonction with |multiplicity|). The name of that key is inspired
+by the command |\doublerulesepcolor| of \pkg{colortbl}.
 \end{itemize}
 
 \medskip
@@ -1625,6 +1692,51 @@
 
 
 \bigskip
+The key |sep-color| with the value |white| may also be used in case of an
+horizontal double-rule on the top of a colored cell (if we want the space
+between both rules above the cell not colored by the color of the cell).
+
+\begin{scope}
+\NiceMatrixOptions
+  {
+    custom-line = 
+     {
+       command = DoubleRule , 
+       multiplicity = 2 , 
+       sep-color = white
+     }
+  }
+
+
+\begin{Code}[width=10cm]
+\NiceMatrixOptions
+  {
+    custom-line = 
+     {
+       command = DoubleRule , 
+       multiplicity = 2 , 
+       \emph{sep-color = white}
+     }
+  }
+
+\begin{NiceTabular}{ccc}[color-inside]
+one & two & three \\
+\emph{\DoubleRule}
+four & \cellcolor{yellow} five & six \\
+\end{NiceTabular}
+\end{Code}
+\begin{NiceTabular}{ccc}[color-inside]
+one & two & three \\
+\DoubleRule
+four & \cellcolor{yellow} five & six \\
+\end{NiceTabular}
+
+\end{scope}
+
+
+
+
+\bigskip
 \item \emph{Second possibility}\par\nobreak
 
 \index{tikzz at tikz!key of ``custom-line''}
@@ -1682,7 +1794,7 @@
 \end{scope}
 
 \bigskip
-\item \emph{Third possibility} : the key |dotted|
+\item \emph{Third possibility} : the key \Definition{dotted}
 \label{dotted}
 \index{dotted (key of ``custom-line'')}
 \indexcommand{hdottedline}
@@ -1696,15 +1808,15 @@
 dotted rules are also used by \pkg{nicematrix} to draw continuous dotted rules
 between cells of the matrix with |\Cdots|, |\Vdots|, etc. (cf. p.~\pageref{Cdots}).
 
-In fact, \pkg{nicematrix} defines by default the commands |\hdottedline| and
-|\cdottedline |and the letter ``|:|'' for those dotted
-rules.\footnote{However, it's possible to overwrite those definitions with a
-|custom-line| (in order, for example, to switch to dashed lines).}
+In fact, \pkg{nicematrix} defines by default the commands
+\Definition{hdottedline} and \Definition{cdottedline} and the letter ``|:|'' for
+those dotted rules.\footnote{However, it's possible to overwrite those
+  definitions with a |custom-line| (in order, for example, to switch to dashed
+  lines).}
 
 \smallskip
 \begin{Code}
-
-\NiceMatrixOptions % \textsl{present in nicematrix.sty}
+\NiceMatrixOptions \emph{% \textsl{present in nicematrix.sty}}
   { 
     custom-line = 
       { 
@@ -2453,14 +2565,13 @@
 \end{center}
 
 \bigskip
-\colorbox{yellow!50}{\textbf{New 6.25}}\enskip Each use of the command
-|\rowlistcolors| (or |\rowcolors|, which is, in fact, a special case of
-|\rowlistcolors|) stops the potential coloring schemes\footnote{We say
-  \emph{schemes} in plural form because it's possible to start simultaneously
-  several coloring schemes if they apply on different columns.} specified by a
-previous command |\rowlistcolors|. In particular, it's possible to start
-coloring the rows with |\rowlistcolors{...}| and stop coloring by a command
-|\rowlistcolors| with an empty argument.
+Each use of the |\rowlistcolors| (or |\rowcolors|, which is, in fact, a
+special case of |\rowlistcolors|) stops the potential coloring
+schemes\footnote{We say \emph{schemes} in plural form because it's possible to
+  start simultaneously several coloring schemes if they apply on different
+  columns.} specified by a previous command |\rowlistcolors|. In particular,
+it's possible to start coloring the rows with |\rowlistcolors{...}| and stop
+coloring by a command |\rowlistcolors| with an empty argument.
 
 \bigskip
 \begin{Code}[width=10cm]
@@ -2493,10 +2604,9 @@
 
 \index{nocolor}
 
-\colorbox{yellow!50}{\textbf{New 6.26}}\enskip The extension \pkg{nicematrix}
-provides the special color |nocolor| which may be used in all the coloring
-commands provided by \pkg{nicematrix} (in the |\CodeBefore| or the array
-itself).
+The extension \pkg{nicematrix} provides the special color |nocolor| which may be
+used in all the coloring commands provided by \pkg{nicematrix} (in the
+|\CodeBefore| or the array itself).
 
 The cells marked by this color won't be colored, whatever the other instructions
 of coloring which may apply to these cells.
@@ -2686,7 +2796,7 @@
  \end{bNiceMatrix} \\ \\
 \begin{bNiceMatrix}
  1   & 1245345 \\  345 & 2 
-\end{bNiceMatrix}
+\end{bNiceMatrix} \\
 \end{array}$
 \emph{\end{NiceMatrixBlock}}
 \end{Code}
@@ -2697,7 +2807,7 @@
  \end{bNiceMatrix} \\ \\
 \begin{bNiceMatrix}
  1   & 1245345 \\  345 & 2 
-\end{bNiceMatrix}
+\end{bNiceMatrix} \\
 \end{array}$
 \end{NiceMatrixBlock}
 
@@ -4198,9 +4308,8 @@
 \index{empty (key of \texttt{\textbackslash TikzEveryCell})}
 \index{non empty (key of \texttt{\textbackslash TikzEveryCell})}
 
-
-\colorbox{yellow!50}{\textbf{New 6.24}}\enskip The command |\TikzEveryCell|
-execute with TikZ the rectangular path corresponding to each cell of the tabular
+The command |\TikzEveryCell|
+executes with TikZ the rectangular path corresponding to each cell of the tabular
 with parameters of TikZ the argument of |\TikzEveryCell|. That argument must be
 a list of \textsl{key=value} pairs which may be applied to a TikZ path. In fact,
 the command applies to each of the tabular, except those in the exterior rows
@@ -5089,9 +5198,9 @@
 
 \medskip
 \index{light-syntax-expanded}
-\colorbox{yellow!50}{\textbf{New 6.27}}\enskip The key |light-syntax-expanded|
-has the same behaviour as the key |light-syntax| but the body of the
-environment is expanded (in the TeX sens\footnote{More precisely, it's a
+
+The key |light-syntax-expanded| has the same behaviour as the key |light-syntax|
+but the body of the environment is expanded (in the TeX sens\footnote{More precisely, it's a
 expansion of type |e| of L3.}) before being splitted in lines (but
 after the extraction of a potential |\CodeAfter|).
 
@@ -5649,9 +5758,14 @@
 the classical prefix) at the intersection of the horizontal rule of number~$i$
 and the vertical rule of number~$i$ (more specifically the potential position
 of those rules because maybe there are not actually drawn). The last node has
-also an alias called |last|. There is also a node called $i$|.5| midway
-between the node $i$ and the node $i+1$.
+also an alias called |last|. 
 
+\smallskip
+\colorbox{yellow!50}{\bfseries Modification 6.28}\enskip There are also nodes
+called $i$|.1|, $i$|.2|, … , $i$|.9| between the node~$i$ and the node~$i+1$
+(before the version 6.28, there was only the node $i$|.5|).
+
+\smallskip
 These nodes are available in the |\CodeBefore| and the |\CodeAfter|.
 
 \begin{center}
@@ -6054,10 +6168,20 @@
 \index{Incompatibilities}
 
 The package \pkg{nicematrix} is not compatible with the class \cls{ieeeaccess}
-(because that class is not compatible with PGF/TikZ).\footnote{See
- \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}} 
+because that class is not compatible with PGF/TikZ. However, there is a simple
+workaround by writing:\footnote{See
+ \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}\par\nobreak 
 
+\begin{Code}
+\let\TeXyear\year
+\documentclass{IEEEaccess}
+\let\year\TeXyear
+\end{Code}
+
+
+
 \bigskip
+% the following requirement is still in force on April 23, 2024
 In order to use \pkg{nicematrix} with the class \cls{aastex631}
 (of the \emph{American Astronomical Society}), you have to
 add the following lines in the preamble of your document :
@@ -6089,7 +6213,7 @@
 \bigskip
 The package \pkg{nicematrix} is not fully compatible with the package
 \pkg{arydshln} (because this package redefines many internals of \pkg{array})
-and does support the columns~|V| of \pkg{boldline} (because the letter |V| is
+and does not support the columns~|V| of \pkg{boldline} (because the letter |V| is
 reserved for the columns~|V| of \pkg{varwidth}). By any means, \pkg{nicematrix}
 provides, with the key |custom-line| (cf. part~\ref{custom-line},
 p.~\pageref{custom-line}), tools to draw dashed rules and rules of different
@@ -6621,7 +6745,7 @@
     last-col, code-for-last-col = \color{blue}\scriptstyle,
     vlines = 5 ,
     matrix/columns-type = r ,
-    no-cell-nodes
+    no-cell-nodes % only for speedup
   }
 \setlength{\extrarowheight}{1mm}
 
@@ -6720,7 +6844,7 @@
     last-col, code-for-last-col = \color{blue}\scriptstyle,
     vlines = 5 ,
     matrix/columns-type = r ,
-    no-cell-nodes 
+    no-cell-nodes % only for speedup
   }
 \setlength{\extrarowheight}{1mm}
 
@@ -6933,7 +7057,7 @@
 
 
 \begin{Code}
-$\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue]
+$\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue,no-cell-nodes]
 \emph{\Block[draw]{}{a_{11}}} & a_{12} & a_{13} & a_{14} \\
 a_{21} & \Block[draw]{}{a_{22}} & a_{23} & a_{24} \\
 a_{31} & a_{32} & \Block[draw]{}{a_{33}} & a_{34} \\
@@ -6940,7 +7064,7 @@
 a_{41} & a_{42} & a_{43} & \Block[draw]{}{a_{44}} \\
 \end{pNiceArray}$
 \end{Code}
-\[\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue]
+\[\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue,no-cell-nodes]
 \Block[draw]{}{a_{11}} & a_{12} & a_{13} & a_{14} \\
 a_{21} & \Block[draw]{}{a_{22}} & a_{23} & a_{24} \\
 a_{31} & a_{32} & \Block[draw]{}{a_{33}} & a_{34} \\
@@ -6966,7 +7090,8 @@
 
 \medskip
 \begin{Code}
-\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside]
+\begin{pNiceArray}{>{\strut}cccc}% <-- % mandatory
+   [margin, extra-margin=2pt,color-inside,no-cell-nodes]
   \emph{\rowcolor{red!15}}A_{11} & A_{12} & A_{13} & A_{14} \\
   A_{21} & \emph{\rowcolor{red!15}}A_{22} & A_{23} & A_{24} \\
   A_{31} & A_{32} & \emph{\rowcolor{red!15}}A_{33} & A_{34} \\
@@ -6974,7 +7099,7 @@
 \end{pNiceArray}
 \end{Code}
 
-\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside]
+\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside,no-cell-nodes]
   \rowcolor{red!15}A_{11} & A_{12} & A_{13} & A_{14} \\
   A_{21} & \rowcolor{red!15}A_{22} & A_{23} & A_{24} \\
   A_{31} & A_{32} & \rowcolor{red!15}A_{33} & A_{34} \\
@@ -7281,8 +7406,17 @@
 \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
 }
 
-\subsection*{Changes between version 6.25 and 6.26}
+\subsection*{Changes between version 6.27 and 6.28}
 
+Sub-blocks with the character |&| (when the key |ampersand-in-block| is in
+force).
+
+Keys |p| and |j| for the command |\Block|.
+
+PGF nodes i.1, i.2, i.3, etc.
+
+\subsection*{Changes between version 6.26 and 6.27}
+
 New key |light-syntax-expanded|.
 
 \subsection*{Changes between version 6.25 and 6.26}

Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx	2024-05-30 19:57:12 UTC (rev 71389)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx	2024-05-30 19:57:31 UTC (rev 71390)
@@ -17,8 +17,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{6.27b}
-\def\myfiledate{2024/04/23}
+\def\myfileversion{6.28}
+\def\myfiledate{2024/05/29}
 %
 %
 %<*batchfile>  
@@ -102,26 +102,12 @@
 %
 %
 % \bigskip
-% By default, the package \pkg{nicematrix} doesn't patch any existing code.
+% The development of the extension \pkg{nicematrix} is done on the following GitHub
+% depot:
 %
-% \smallskip
-% However, when the option |renew-dots| is used, the commands |\cdots|,
-% |\ldots|, |\dots|, |\vdots|, |\ddots| and |\iddots| are redefined in the
-% environments provided by \pkg{nicematrix}. In the same way, if the option
-% |renew-matrix| is used, the environment |{matrix}| of \pkg{amsmath} is
-% redefined.
+% \verb|https://github.com/fpantigny/nicematrix|
 %
-% \smallskip
-% On the other hand, the environment |{array}| is never redefined.
-%
-% \smallskip
-% Of course, the package \pkg{nicematrix} uses the features of the package
-% \pkg{array}. It tries to be independent of its implementation. Unfortunately,
-% it was not possible to be strictly independent. For example, the package
-% \pkg{nicematrix} relies upon the fact that the package |{array}| uses
-% |\ialign| to begin the |\halign|. 
 % 
-% 
 % \bigskip
 % \section{Declaration of the package and packages loaded}
 %
@@ -170,6 +156,8 @@
 % the Tagging Project. 
 %    \begin{macrocode}
 \bool_const:Nn \c_@@_tagging_array_bool { \cs_if_exist_p:N \ar at ialign }
+\bool_const:Nn \c_@@_testphase_table_bool
+  { \IfPackageLoadedTF { latex-lab-testphase-table } \c_true_bool \c_false_bool }
 %    \end{macrocode}
 % 
 %
@@ -415,8 +403,8 @@
 %    \end{macrocode}
 % 
 %   \begin{macrocode}
-\cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
-\cs_generate_variant:Nn \str_lowercase:n { V }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N o n }
+\cs_generate_variant:Nn \str_lowercase:n { o }
 %    \end{macrocode}
 %
 % \medskip
@@ -565,8 +553,8 @@
 % the rules even if \pkg{colortbl} is not loaded. 
 %    \begin{macrocode}
         \cs_set_protected:Npn \CT at arc@ { }
-        \cs_set:Npn \arrayrulecolor #1 # { \CT at arc { #1 } }
-        \cs_set:Npn \CT at arc #1 #2
+        \cs_set_nopar:Npn \arrayrulecolor #1 # { \CT at arc { #1 } }
+        \cs_set_nopar:Npn \CT at arc #1 #2
           {
             \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign 
               { \cs_gset_nopar:Npn \CT at arc@ { \color #1 { #2 } } } 
@@ -574,13 +562,13 @@
 %    \end{macrocode}
 % Idem for |\CT at drs@|.
 %    \begin{macrocode}
-        \cs_set:Npn \doublerulesepcolor #1 # { \CT at drs { #1 } }
-        \cs_set:Npn \CT at drs #1 #2 
+        \cs_set_nopar:Npn \doublerulesepcolor #1 # { \CT at drs { #1 } }
+        \cs_set_nopar:Npn \CT at drs #1 #2 
           {
             \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign 
               { \cs_gset:Npn \CT at drsc@ { \color #1 { #2 } } }
           }
-        \cs_set:Npn \hline
+        \cs_set_nopar:Npn \hline
           {
             \noalign { \ifnum 0 = `} \fi
             \cs_set_eq:NN \hskip \vskip
@@ -599,8 +587,8 @@
 % be linked to |\cline| in the beginning of |{NiceArrayWithDelims}|. The
 % following commands must \emph{not} be protected.
 %    \begin{macrocode}
-\cs_set:Npn \@@_standard_cline #1 { \@@_standard_cline:w #1 \q_stop }
-\cs_set:Npn \@@_standard_cline:w #1-#2 \q_stop
+\cs_set_nopar:Npn \@@_standard_cline #1 { \@@_standard_cline:w #1 \q_stop }
+\cs_set_nopar:Npn \@@_standard_cline:w #1-#2 \q_stop
   {
     \int_if_zero:nT \l_@@_first_col_int { \omit & }
     \int_compare:nNnT { #1 } > \c_one_int 
@@ -694,8 +682,8 @@
     \tl_if_blank:nF { #1 }
       {
         \tl_if_head_eq_meaning:nNTF { #1 } [
-          { \cs_set:Npn \CT at arc@ { \color #1 } }
-          { \cs_set:Npn \CT at arc@ { \color { #1 } } }
+          { \cs_set_nopar:Npn \CT at arc@ { \color #1 } }
+          { \cs_set_nopar:Npn \CT at arc@ { \color { #1 } } }
       }
   }
 \cs_generate_variant:Nn \@@_set_CT at arc@:n { o }
@@ -706,8 +694,8 @@
 \cs_new_protected:Npn \@@_set_CT at drsc@:n #1 
   { 
     \tl_if_head_eq_meaning:nNTF { #1 } [
-      { \cs_set:Npn \CT at drsc@ { \color #1 } }
-      { \cs_set:Npn \CT at drsc@ { \color { #1 } } }
+      { \cs_set_nopar:Npn \CT at drsc@ { \color #1 } }
+      { \cs_set_nopar:Npn \CT at drsc@ { \color { #1 } } }
   }
 \cs_generate_variant:Nn \@@_set_CT at drsc@:n { o }
 %    \end{macrocode}
@@ -732,10 +720,6 @@
 \cs_generate_variant:Nn \@@_color:n { o }
 %    \end{macrocode}
 % 
-% \bigskip
-%    \begin{macrocode}
-\cs_set_eq:NN \@@_old_pgfpointanchor \pgfpointanchor
-%    \end{macrocode}
 % 
 % \bigskip
 %    \begin{macrocode}
@@ -970,6 +954,7 @@
 \bool_new:N \g_@@_rotate_bool
 %    \end{macrocode}
 %
+%
 % \bigskip
 % The following boolean will be raise then the command |\rotate| is used with
 % the key |c|.
@@ -1110,12 +1095,12 @@
 % 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
-% and we have to use |\str_if_eq:VnTF| and not |\tl_if_eq:NnTF| because we need
+% and we have to use |\str_if_eq:onTF| and not |\tl_if_eq:NnTF| because we need
 % to be fully expandable).
 %    \begin{macrocode}
 \cs_new:Npn \@@_full_name_env:
   { 
-    \str_if_eq:VnTF \g_@@_com_or_env_str { command }
+    \str_if_eq:onTF \g_@@_com_or_env_str { command }
       { command \space \c_backslash_str \g_@@_name_env_str }
       { environment \space \{ \g_@@_name_env_str \} }
   }
@@ -1163,7 +1148,15 @@
 \bool_new:N \l_@@_in_code_after_bool
 %    \end{macrocode}
 % 
+% 
 % \bigskip
+% The following parameter will be raised when a block content a |&| in its
+% content (=label).
+%    \begin{macrocode}
+\bool_new:N \l_@@_ampersand_bool
+%    \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.
@@ -1275,11 +1268,21 @@
 % The L3 programming layer provides scratch dimensions |\l_tmpa_dim| and
 % |\l_tmpb_dim|. We creates two more in the same spirit.
 %    \begin{macrocode}
-\dim_zero_new:N \l_@@_tmpc_dim 
-\dim_zero_new:N \l_@@_tmpd_dim
+\dim_new:N \l_@@_tmpc_dim 
+\dim_new:N \l_@@_tmpd_dim
 %    \end{macrocode}
 %
 % \bigskip
+%    \begin{macrocode}
+\dim_new:N \g_@@_dp_row_zero_dim
+\dim_new:N \g_@@_ht_row_zero_dim
+\dim_new:N \g_@@_ht_row_one_dim
+\dim_new:N \g_@@_dp_ante_last_row_dim
+\dim_new:N \g_@@_ht_last_row_dim
+\dim_new:N \g_@@_dp_last_row_dim
+%    \end{macrocode}
+% 
+% \bigskip
 % Some cells will be declared as ``empty'' (for example a cell with an
 % instruction |\Cdots|).
 %    \begin{macrocode}
@@ -1475,6 +1478,7 @@
 \str_new:N \l_@@_hpos_block_str
 \str_set:Nn \l_@@_hpos_block_str { c }
 \bool_new:N \l_@@_hpos_of_block_cap_bool
+\bool_new:N \l_@@_p_block_bool
 %    \end{macrocode}
 %
 % \medskip
@@ -2261,6 +2265,12 @@
 \tl_new:N \l_@@_baseline_tl 
 \tl_set:Nn \l_@@_baseline_tl { c }
 %    \end{macrocode}
+%
+% \bigskip
+% The following parameter corresponds to the key |ampersand-in-blocks|
+%    \begin{macrocode}
+\bool_new:N \l_@@_amp_in_blocks_bool
+%    \end{macrocode}
 % 
 % \bigskip
 % The flag |\l_@@_exterior_arraycolsep_bool| corresponds to the option
@@ -2492,6 +2502,8 @@
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Global }
   {
+    ampersand-in-blocks .bool_set:N = \l_@@_amp_in_blocks_bool , 
+    ampersand-in-blocks .default:n = true , 
     no-cell-nodes .code:n = 
       \cs_set_protected:Npn \@@_node_for_cell: 
         { \box_use_drop:N \l_@@_cell_box } ,
@@ -3475,10 +3487,10 @@
 %    \end{macrocode}
 % |\l_@@_baseline_tl| may have the value |t|, |c| or |b|. However, if the value
 % is |b|, we compose the |\array| (of \pkg{array}) with the option |t| and the
-% right translation will be done further. Remark that |\str_if_eq:VnTF| is
+% right translation will be done further. Remark that |\str_if_eq:onTF| is
 % fully expandable and we need something fully expandable here.
 %    \begin{macrocode}
-    [ \str_if_eq:VnTF \l_@@_baseline_tl c c t ]
+    [ \str_if_eq:onTF \l_@@_baseline_tl c c t ]
   }
 %    \end{macrocode}
 %
@@ -3554,7 +3566,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_everycr_i:
   { 
-    \bool_if:NT \c_@@_tagging_array_bool
+    \bool_if:NT \c_@@_testphase_table_bool
       {
         \tbl_if_row_was_started:T { \UseTaggingSocket { tbl / row / end } }
         \tbl_update_cell_data_for_next_row:
@@ -3587,10 +3599,7 @@
                   {
                     \int_compare:nNnF \c at iRow = \l_@@_last_row_int 
 %    \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}
                       { \hrule height \arrayrulewidth width \c_zero_dim }
                   } 
@@ -3636,21 +3645,21 @@
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_redefine_everycr: { \everycr { \@@_everycr: } } 
-\hook_gput_code:nnn { begindocument } { . }
-  {
-    \IfPackageLoadedTF { colortbl }
-      {
-        \cs_set_protected:Npn \@@_redefine_everycr:
-          {
-            \CT at everycr 
-              { 
-                \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
-                \@@_everycr:
-              }
-          }
-      }
-      { } 
-  }
+   \hook_gput_code:nnn { begindocument } { . }
+     {
+       \IfPackageLoadedTF { colortbl }
+         {
+           \cs_set_protected:Npn \@@_redefine_everycr:
+             {
+               \CT at everycr 
+                 { 
+                   \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
+                   \@@_everycr:
+                 }
+             }
+         }
+         { } 
+    }
 %    \end{macrocode}
 % 
 % If \pkg{booktabs} is loaded, we have to patch the macro |\@BTnormal| which is
@@ -3688,16 +3697,11 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_some_initialization:
   {
-    \dim_gzero_new:N \g_@@_dp_row_zero_dim
     \dim_gset:Nn \g_@@_dp_row_zero_dim { \box_dp:N \@arstrutbox }
-    \dim_gzero_new:N \g_@@_ht_row_zero_dim
     \dim_gset:Nn \g_@@_ht_row_zero_dim { \box_ht:N \@arstrutbox }
-    \dim_gzero_new:N \g_@@_ht_row_one_dim
-    \dim_gset:Nn \g_@@_ht_row_one_dim { \box_ht:N \@arstrutbox }
-    \dim_gzero_new:N \g_@@_dp_ante_last_row_dim
-    \dim_gzero_new:N \g_@@_ht_last_row_dim
+    \dim_gset_eq:NN \g_@@_ht_row_one_dim \g_@@_ht_row_zero_dim
+    \dim_gzero:N \g_@@_dp_ante_last_row_dim
     \dim_gset:Nn \g_@@_ht_last_row_dim { \box_ht:N \@arstrutbox }
-    \dim_gzero_new:N \g_@@_dp_last_row_dim
     \dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \@arstrutbox }
   }
 %    \end{macrocode}
@@ -3735,7 +3739,7 @@
         \cs_set_nopar:Npn \arraystretch { 0.47 }
         \dim_set:Nn \arraycolsep { 1.45 pt }
 %    \end{macrocode}
-% By default, |\@@_small_scripstyle:| is null.
+% By default, |\@@_tuning_key_small:| is no-op.
 %    \begin{macrocode}
         \cs_set_eq:NN \@@_tuning_key_small: \scriptstyle 
       }
@@ -3763,9 +3767,9 @@
       {
         \cs_set_nopar:Npn \ar at ialign 
           { 
-            \tbl_init_cell_data_for_table:
+            \bool_if:NT \c_@@_testphase_table_bool \tbl_init_cell_data_for_table:
             \@@_redefine_everycr:
-            \tabskip = \c_zero_skip
+            \dim_zero:N \tabskip 
             \@@_some_initialization:
 %    \end{macrocode}
 %
@@ -3786,7 +3790,7 @@
         \cs_set_nopar:Npn \ialign 
           { 
             \@@_redefine_everycr:
-            \tabskip = \c_zero_skip
+            \dim_zero:N \tabskip 
             \@@_some_initialization:
             \cs_set_eq:NN \ialign \@@_old_ialign:
             \halign 
@@ -4061,7 +4065,9 @@
 % |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the second
 % part of the environment (and the closing |\c_math_toggle_token| also).
 %    \begin{macrocode}
-    \hbox_set:Nw \l_@@_the_array_box 
+    \hbox_set:Nw \l_@@_the_array_box
+    \bool_if:NT \c_@@_testphase_table_bool
+      { \UseTaggingSocket { tbl / hmode / begin } }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -4101,7 +4107,7 @@
 % \section{The \textbackslash CodeBefore}
 % 
 % The following command will be executed if the |\CodeBefore| has to be actually
-% executed (that commmand will be used only once and is present only for legibility).
+% executed (that commmand will be used only once and is present alone only for legibility).
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_pre_code_before:
   {
@@ -4426,6 +4432,7 @@
     \tl_gset:Nn \g_@@_left_delim_tl { #1 }
     \tl_gset:Nn \g_@@_right_delim_tl { #2 }
     \tl_gset:Nn \g_@@_user_preamble_tl { #4 }
+    \tl_if_empty:NT \g_@@_user_preamble_tl { \@@_fatal:n { empty~preamble } } 
 %    \end{macrocode}
 %   
 %
@@ -4545,7 +4552,7 @@
 % command |\@@_CodeBefore_Body:w|. After that job, the command |\@@_CodeBefore_Body:w|
 % will go on with |\@@_pre_array:|.
 %    \begin{macrocode}
-    \IfBooleanTF { #6 } \@@_CodeBefore_Body:w \@@_pre_array: 
+    \bool_if:nTF { #6 } \@@_CodeBefore_Body:w \@@_pre_array: 
   }
 %    \end{macrocode}
 % 
@@ -4558,6 +4565,18 @@
     \c_math_toggle_token
     \skip_horizontal:N \l_@@_right_margin_dim 
     \skip_horizontal:N \l_@@_extra_right_margin_dim 
+ 
+    % % awful workaround
+    \int_compare:nNnT \g_@@_col_total_int = \c_one_int
+      {
+        \dim_compare:nNnT \l_@@_columns_width_dim > \c_zero_dim 
+          { 
+            \skip_horizontal:N - \l_@@_columns_width_dim 
+            \bool_if:NTF \l_@@_tabular_bool 
+              { \skip_horizontal:n { - 2 \tabcolsep } }
+              { \skip_horizontal:n { - 2 \arraycolsep } }
+          }
+      }
     \hbox_set_end:
 %    \end{macrocode}
 % End of the construction of the array (in the box |\l_@@_the_array_box|).
@@ -4798,7 +4817,7 @@
 %
 % \bigskip 
 % The final user provides a preamble, but we must convert that preamble into a
-% preamble that will be given to |{array}| (of the package \pkg{array}).
+% preamble which will be given to |{array}| (of the package \pkg{array}).
 %
 % \bigskip
 % The preamble given by the final user is stored in |\g_@@_user_preamble_tl|.
@@ -4872,6 +4891,12 @@
   {
     \IfPackageLoadedTF { colortbl } 
       {
+%    \end{macrocode}
+% When \pkg{colortbl} is used, we have to catch the tokens |\columncolor| in the
+% preamble because, otherwise, \pkg{colortbl} will catch them and the colored
+% panels won't be drawn by \pkg{nicematrix} but by \pkg{colortbl} (with an
+% output which is not perfect).
+%    \begin{macrocode}
         \regex_const:Nn \c_@@_columncolor_regex { \c { columncolor } } 
         \cs_new_protected:Npn \@@_replace_columncolor:
           {
@@ -5186,7 +5211,7 @@
 % 
 % 
 % \medskip
-% For |p|, |b| and |m|. 
+% For |p| but also |b| and |m|. 
 %    \begin{macrocode}
 \cs_new:Npn \@@_p #1
   { 
@@ -5262,7 +5287,7 @@
               { \tl_clear:N \exp_not:N \l_@@_hpos_cell_tl } 
               { 
                 \cs_set_nopar:Npn \exp_not:N \l_@@_hpos_cell_tl 
-                  { \str_lowercase:V \l_@@_hpos_col_str } 
+                  { \str_lowercase:o \l_@@_hpos_col_str } 
               } 
             \str_case:on \l_@@_hpos_col_str 
               {
@@ -5288,7 +5313,7 @@
 %    \end{macrocode}
 % We use |\str_lowercase:n| to convert |R| to |r|, etc.
 %    \begin{macrocode}
-              { \str_lowercase:V \l_@@_hpos_col_str }
+              { \str_lowercase:o \l_@@_hpos_col_str }
           }
       }
 %    \end{macrocode}
@@ -5341,6 +5366,8 @@
 % mono-column blocks.
 %    \begin{macrocode}
             \dim_set:Nn \l_@@_col_width_dim { #2 }
+            \bool_if:NT \c_@@_testphase_table_bool
+              { \tag_struct_begin:n { tag = Div } }
             \@@_cell_begin:w 
 %    \end{macrocode}
 % We use the form |\minipage|--|\endminipage| (|\varwidth|--|\endvarwidth|) for
@@ -5355,6 +5382,7 @@
                 \vrule height \box_ht:N \@arstrutbox width \c_zero_dim
                 \everypar { }
               }
+            \bool_if:NT \c_@@_testphase_table_bool \tagpdfparaOn
 %    \end{macrocode}
 % Now, the potential code for the horizontal position of the content of the cell
 % (|\centering|, |\raggedright|, |\RaggedRight|, etc.).
@@ -5381,6 +5409,7 @@
 %    \begin{macrocode}
             #4
             \@@_cell_end: 
+            \bool_if:NT \c_@@_testphase_table_bool \tag_struct_end:
           } 
       }
   }
@@ -6032,7 +6061,9 @@
     \multispan { #1 }
     \cs_set_eq:NN \@@_update_max_cell_width: \prg_do_nothing: 
     \begingroup
-    \cs_set:Npn \@addamp 
+    \bool_if:NT \c_@@_testphase_table_bool
+      { \tbl_update_multicolumn_cell_data:n { #1 } }
+    \cs_set_nopar:Npn \@addamp 
       { \legacy_if:nTF { @firstamp } { \@firstampfalse } { \@preamerr 5 } } 
 %    \end{macrocode}
 %
@@ -6051,6 +6082,8 @@
     \exp_args:No \@mkpream \g_@@_preamble_tl
     \@addtopreamble \@empty
     \endgroup
+    \bool_if:NT \c_@@_testphase_table_bool
+      { \UseTaggingSocket { tbl / colspan } { #1 } }
 %    \end{macrocode}
 %
 % \medskip
@@ -6084,7 +6117,7 @@
 % \medskip
 % The following lines were in the original definition of |\multicolumn|.
 %    \begin{macrocode}
-    \cs_set:Npn \@sharp { #3 }
+    \cs_set_nopar:Npn \@sharp { #3 }
     \@arstrut 
     \@preamble
     \null
@@ -6804,7 +6837,7 @@
     \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl
     \bool_if:NTF \l_@@_light_syntax_expanded_bool
       \seq_set_split:Nee
-      \seq_set_split:NVn 
+      \seq_set_split:Non 
       \l_@@_rows_seq \l_@@_end_of_row_tl { #1 }
 %    \end{macrocode}
 % We delete the last row if it is empty.
@@ -6913,7 +6946,7 @@
 % 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
 % width of the columns (when the array is constructed with an option which
-% specifies the width of the columns).
+% specifies the width of the columns such as |columns-width|).
 %    \begin{macrocode}
 \cs_new:Npn \@@_create_col_nodes:
   {
@@ -7080,7 +7113,7 @@
           { \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } }
         \skip_horizontal:N \g_tmpa_skip 
         \int_gincr:N \g_tmpa_int 
-        \bool_lazy_any:nF % modified 2023/12/13
+        \bool_lazy_any:nF 
           { 
             \g_@@_delims_bool 
             \l_@@_tabular_bool 
@@ -7160,7 +7193,7 @@
             \endpgfpicture
           }
       }
-    \cr
+  % \cr
   }
 %    \end{macrocode}
 %
@@ -7492,7 +7525,11 @@
     \@@_settings_for_tabular:
     \NiceArray { #2 }
   }
-  { \endNiceArray }
+  { 
+    \endNiceArray 
+    \bool_if:NT \c_@@_testphase_table_bool
+      { \UseTaggingSocket { tbl / hmode / end } }
+  }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -7982,7 +8019,7 @@
 %
 % \bigskip
 % We define a new \textsc{pgf} shape for the diag nodes because we want to
-% provide a anchor called |.5| for those nodes.
+% provide an anchor called |.5| for those nodes.
 %    \begin{macrocode}
 \pgfdeclareshape { @@_diag_node }
   {
@@ -7993,6 +8030,14 @@
       }
     \anchor { 5 } { \five }
     \anchor { center } { \pgfpointorigin }
+    \anchor { 1 } { \five \pgf at x = 0.2 \pgf at x \pgf at y = 0.2 \pgf at y }
+    \anchor { 2 } { \five \pgf at x = 0.4 \pgf at x \pgf at y = 0.4 \pgf at y }
+    \anchor { 3 } { \five \pgf at x = 0.6 \pgf at x \pgf at y = 0.6 \pgf at y }
+    \anchor { 4 } { \five \pgf at x = 0.8 \pgf at x \pgf at y = 0.8 \pgf at y }
+    \anchor { 6 } { \five \pgf at x = 1.2 \pgf at x \pgf at y = 1.2 \pgf at y }
+    \anchor { 7 } { \five \pgf at x = 1.4 \pgf at x \pgf at y = 1.4 \pgf at y }
+    \anchor { 8 } { \five \pgf at x = 1.6 \pgf at x \pgf at y = 1.6 \pgf at y }
+    \anchor { 9 } { \five \pgf at x = 1.8 \pgf at x \pgf at y = 1.8 \pgf at y }
   }
 %    \end{macrocode}
 % 
@@ -12916,6 +12961,9 @@
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Block / FirstPass }
   {
+    j .code:n = \str_set:Nn \l_@@_hpos_block_str j 
+                \bool_set_true:N \l_@@_p_block_bool , 
+    j .value_forbidden:n = true ,
     l .code:n = \str_set:Nn \l_@@_hpos_block_str l ,
     l .value_forbidden:n = true ,
     r .code:n = \str_set:Nn \l_@@_hpos_block_str r ,
@@ -12936,6 +12984,8 @@
     b .value_forbidden:n = true ,
     B .code:n = \str_set:Nn \l_@@_vpos_block_str B ,
     B .value_forbidden:n = true ,
+    p .code:n = \bool_set_true:N \l_@@_p_block_bool , 
+    p .value_forbidden:n = true ,
     color .code:n = 
       \@@_color:n { #1 }
       \tl_set_rescan:Nnn 
@@ -13066,18 +13116,28 @@
 % 
 %
 % \medskip
-% If the block is mono-column or mono-row, we have a special treatment. That's
-% why we have two macros: |\@@_Block_iv:nnnnn| and |\@@_Block_v:nnnnn| (the five
+% We have different treatments when the key |p| is used and when the block is
+% mono-column or mono-row, etc. That's why we have several macros:
+% |\@@_Block_iv:nnnnn|, |\@@_Block_v:nnnnn|, |\@@_Block_vi:nnnn|, etc. (the five
 % arguments of those macros are provided by curryfication).
 %    \begin{macrocode}
-    \bool_if:nTF 
-      { 
-        ( 
-          \int_compare_p:nNn \l_tmpa_int = \c_one_int 
-             ||
-          \int_compare_p:nNn \l_tmpb_int = \c_one_int  
-        ) 
-        && ! \tl_if_empty_p:n { #5 }
+    \bool_set_false:N \l_tmpa_bool
+    \bool_if:NT \l_@@_amp_in_blocks_bool
+      { \tl_if_in:nnT { #5 } { & } { \bool_set_true:N \l_tmpa_bool } }
+    \bool_if:NTF \l_tmpa_bool
+      { \exp_args:Nee \@@_Block_vii:nnnnn }
+      {
+        \bool_if:NTF \l_@@_p_block_bool 
+          { \exp_args:Nee \@@_Block_vi:nnnnn }
+          {
+            \bool_if:nTF 
+              { 
+                ( 
+                  \int_compare_p:nNn \l_tmpa_int = \c_one_int 
+                     ||
+                  \int_compare_p:nNn \l_tmpb_int = \c_one_int  
+                ) 
+                && ! \tl_if_empty_p:n { #5 }
 %    \end{macrocode}
 % For the blocks mono-column, we will compose right now in a box in order to
 % compute its width and take that width into account for the width of the
@@ -13087,10 +13147,12 @@
 % column, it's imperative. Otherwise, the process for the determination of the
 % widths of the columns will be wrong.
 %    \begin{macrocode}
-        && ! \l_@@_X_bool 
+                && ! \l_@@_X_bool 
+              }
+              { \exp_args:Nee \@@_Block_iv:nnnnn }
+              { \exp_args:Nee \@@_Block_v:nnnnn }
+          }
       }
-      { \exp_args:Nee \@@_Block_iv:nnnnn }
-      { \exp_args:Nee \@@_Block_v:nnnnn }
     { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } 
   }
 %    \end{macrocode}
@@ -13098,12 +13160,13 @@
 % 
 % \bigskip
 % The following macro is for the case of a |\Block| which is mono-row or
-% mono-column (or both). In that case, the content of the block is composed
-% right now in a box (because we have to take into account the dimensions of
-% that box for the width of the current column or the height and the depth of the
-% current row). However, that box will be put in the array \emph{after the
-% construction of the array} (by using \textsc{pgf}) with |\@@_draw_blocks:| and
-% above all |\@@_Block_v:nnnnnn| which will do the main job.
+% mono-column (or both) and don't use the key~|p|. In that case, the content of
+% the block is composed right now in a box (because we have to take into account
+% the dimensions of that box for the width of the current column or the height
+% and the depth of the current row). However, that box will be put in the array
+% \emph{after the construction of the array} (by using \textsc{pgf}) with
+% |\@@_draw_blocks:| and above all |\@@_Block_v:nnnnnn| which will do the main
+% job.
 %
 % |#1| is $i$ (the number of rows of the block), |#2| is $j$ (the number of
 % columns of the block), |#3| is the list of \textsl{key=values} pairs, |#4| are
@@ -13209,7 +13272,7 @@
                 \use:e
                   {
                     \exp_not:N \begin { minipage }%
-                      [ \str_lowercase:V \l_@@_vpos_block_str ] 
+                      [ \str_lowercase:o \l_@@_vpos_block_str ] 
                       { \l_@@_col_width_dim }
                      \str_case:on \l_@@_hpos_block_str
                        { c \centering r \raggedleft l \raggedright }
@@ -13224,7 +13287,7 @@
                 \use:e 
                   { 
                     \exp_not:N \begin { tabular }%
-                      [ \str_lowercase:V \l_@@_vpos_block_str ] 
+                      [ \str_lowercase:o \l_@@_vpos_block_str ] 
                       { @ { } \l_@@_hpos_block_str @ { } }
                   }  
                   #5 
@@ -13240,7 +13303,7 @@
             \use:e 
               { 
                 \exp_not:N \begin { array }% 
-                  [ \str_lowercase:V \l_@@_vpos_block_str ] 
+                  [ \str_lowercase:o \l_@@_vpos_block_str ] 
                   { @ { } \l_@@_hpos_block_str @ { } } 
               }
               #5 
@@ -13254,7 +13317,7 @@
 % \bigskip
 % If there were |\rotate| (which raises |\g_@@_rotate_bool|) in the content of
 % the |\Block|, we do a rotation of the box (and we also adjust the
-% baseline the rotated box).
+% baseline of the rotated box).
 %    \begin{macrocode}
     \bool_if:NT \g_@@_rotate_bool \@@_rotate_box_of_block:
 %    \end{macrocode}
@@ -13275,37 +13338,29 @@
           } 
       }
 %    \end{macrocode}
-% If we are in a mono-row block and if that block has no vertical option for the
-% position\footnote{If the block has a key of a vertical position, that means
-% that it has to be put in a vertical space determined by the \emph{others}
-% cells of the row. Therefore there is no point creating space here. Moreover,
-% that would lead to problems when a multi-row block with a position key such as
-% |b| or |B|.}, we take into account the height and the depth of that block for the
-% height and the depth of the row.
+% If we are in a mono-row block we take into account the height and the depth of
+% that block for the height and the depth of the row.
 %    \begin{macrocode}
-     \str_if_eq:VnT \l_@@_vpos_block_str { c }
+     \int_compare:nNnT { #1 } = \c_one_int
        {
-         \int_compare:nNnT { #1 } = \c_one_int
+         \dim_gset:Nn \g_@@_blocks_ht_dim
            {
-             \dim_gset:Nn \g_@@_blocks_ht_dim
+             \dim_max:nn
+               \g_@@_blocks_ht_dim
                {
-                 \dim_max:nn
-                   \g_@@_blocks_ht_dim
-                   {
-                     \box_ht:c 
-                       { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } 
-                   }
-               } 
-             \dim_gset:Nn \g_@@_blocks_dp_dim
+                 \box_ht:c 
+                   { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } 
+               }
+           } 
+         \dim_gset:Nn \g_@@_blocks_dp_dim
+           {
+             \dim_max:nn
+               \g_@@_blocks_dp_dim
                {
-                 \dim_max:nn
-                   \g_@@_blocks_dp_dim
-                   {
-                     \box_dp:c 
-                       { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } 
-                   }
-               } 
-           }
+                 \box_dp:c 
+                   { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } 
+               }
+           } 
        }
     \seq_gput_right:Nx \g_@@_blocks_seq
       {   
@@ -13340,6 +13395,8 @@
   }
 %    \end{macrocode}
 %
+%
+%
 % \bigskip
 %    \begin{macrocode}
 \cs_new:Npn \@@_adjust_hpos_rotate:
@@ -13398,10 +13455,10 @@
 % 
 % \bigskip
 % The following macro is for the standard case, where the block is not mono-row
-% and not mono-column. In that case, the content of the block is \emph{not}
-% composed right now in a box. The composition in a box will be done further,
-% just after the construction of the array (cf. |\@@_draw_blocks:| and
-% above all |\@@_Block_v:nnnnnn|). 
+% and not mono-column and does not use the key |p|). In that case, the content of
+% the block is \emph{not} composed right now in a box. The composition in a box
+% will be done further, just after the construction of the array (cf.
+% |\@@_draw_blocks:| and above all |\@@_Block_v:nnnnnn|).
 %
 % |#1| is $i$ (the number of rows of the block), |#2| is $j$ (the number of
 % columns of the block), |#3| is the list of \textsl{key=values} pairs, |#4| are
@@ -13434,18 +13491,20 @@
 % the tabular is the same as the external alignment of the tabular (that is to
 % say the position of the block in its zone of merged cells).
 %    \begin{macrocode}
-                   \use:e 
-                     { 
-                       \exp_not:N \begin { tabular } [ \l_@@_vpos_block_str ] 
-                       { @ { } \l_@@_hpos_block_str @ { } } 
-                     }
-                     #5 
-                   \end { tabular } 
+                  \bool_if:NT \c_@@_testphase_table_bool 
+                     { \tag_stop:n { table } } 
+                  \use:e 
+                    { 
+                      \exp_not:N \begin { tabular } [ \l_@@_vpos_block_str ] 
+                      { @ { } \l_@@_hpos_block_str @ { } } 
+                    }
+                    #5 
+                  \end { tabular } 
                 }
               \group_end:
             } 
 %    \end{macrocode}
-% When we are \emph{not} in an environments |{NiceTabular}| (or similar).
+% When we are \emph{not} in an environment |{NiceTabular}| (or similar).
 %    \begin{macrocode}
             { 
               \group_begin:
@@ -13473,6 +13532,40 @@
       }  
   } 
 %    \end{macrocode}
+%
+% \bigskip
+% The following macro is for the case of a |\Block| which uses the key~|p|.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_Block_vi:nnnnn #1 #2 #3 #4 #5 
+  {
+    \seq_gput_right:Nx \g_@@_blocks_seq
+      {   
+        \l_tmpa_tl
+        { \exp_not:n { #3 } }
+        {
+          \group_begin:
+          \exp_not:n { #4 #5 }
+          \group_end:
+        }
+      }
+  }
+%    \end{macrocode}
+%
+%
+% \bigskip
+% The following macro is for the case of a |\Block| which uses the key~|p|.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_Block_vii:nnnnn #1 #2 #3 #4 #5 
+  {
+    \seq_gput_right:Nx \g_@@_blocks_seq
+      {   
+        \l_tmpa_tl
+        { \exp_not:n { #3 } }
+        { \exp_not:n { #4 #5 } }
+      }
+  }
+%    \end{macrocode}
+%
 % 
 % \bigskip
 % We recall that the options of the command |\Block| are analyzed twice: first
@@ -13523,6 +13616,8 @@
 % Some keys have not a property |.value_required:n| (or similar) because they
 % are in |FirstPass|. 
 %    \begin{macrocode}
+    j .code:n = \str_set:Nn \l_@@_hpos_block_str j 
+                \bool_set_true:N \l_@@_p_block_bool ,
     l .code:n = \str_set:Nn \l_@@_hpos_block_str l ,
     r .code:n = \str_set:Nn \l_@@_hpos_block_str r ,
     c .code:n = \str_set:Nn \l_@@_hpos_block_str c ,
@@ -13536,9 +13631,11 @@
     T .code:n = \str_set:Nn \l_@@_vpos_block_str T ,
     b .code:n = \str_set:Nn \l_@@_vpos_block_str b ,
     B .code:n = \str_set:Nn \l_@@_vpos_block_str B ,
-    m .code:n = \str_set:Nn \l_@@_vpos_block_str { c } , 
+    m .code:n = \str_set:Nn \l_@@_vpos_block_str c , 
     m .value_forbidden:n = true ,
     v-center .meta:n = m ,
+    p .code:n = \bool_set_true:N \l_@@_p_block_bool ,
+    p .value_forbidden:n = true ,
     name .tl_set:N = \l_@@_block_name_str ,
     name .value_required:n = true ,
     name .initial:n = ,
@@ -13636,8 +13733,17 @@
     \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
 %    \end{macrocode}
 % 
+%
+% If the content of the block contains |&|, we will have a special treatement
+% (since the cell must be divided in several sub-cells).
 %    \begin{macrocode}
-    \bool_if:NT \l_@@_vlines_block_bool
+    \tl_if_in:nnT { #6 } { & } { \bool_set_true:N \l_@@_ampersand_bool }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+    \bool_lazy_and:nnT 
+      \l_@@_vlines_block_bool 
+      { ! \l_@@_ampersand_bool }
       {
         \tl_gput_right:Nx \g_nicematrix_code_after_tl
           { 
@@ -13768,11 +13874,6 @@
       }  
 %    \end{macrocode}
 % 
-% \medskip
-%    \begin{macrocode}
-    \hbox_set:Nn \l_@@_cell_box { \set at color #6 }
-    \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
-%    \end{macrocode}
 %
 % \bigskip
 % Let's consider the following |{NiceTabular}|. Because of the instruction
@@ -13825,38 +13926,40 @@
 % The construction of the node corresponding to the merged cells.
 %    \begin{macrocode}
     \pgfpicture 
-      \pgfrememberpicturepositiononpagetrue
-      \pgf at relevantforpicturesizefalse 
-      \@@_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
-      \@@_qpoint:n { row - \int_eval:n { \l_@@_last_row_int + 1 } } 
-      \dim_set_eq:NN \l_@@_tmpc_dim \pgf at y
-      \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } 
-      \dim_set_eq:NN \l_@@_tmpd_dim \pgf at x
+    \pgfrememberpicturepositiononpagetrue
+    \pgf at relevantforpicturesizefalse 
+    \@@_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
+    \@@_qpoint:n { row - \int_eval:n { \l_@@_last_row_int + 1 } } 
+    \dim_set_eq:NN \l_@@_tmpc_dim \pgf at y
+    \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } 
+    \dim_set_eq:NN \l_@@_tmpd_dim \pgf at x
 %    \end{macrocode}
 %
+%
+%
 % We construct the node for the block with the name |(#1-#2-block)|.
 %
 % The function |\@@_pgf_rect_node:nnnnn| takes in as arguments the name of the node
 % and the four coordinates of two opposite corner points of the rectangle.
 %    \begin{macrocode}
-      \@@_pgf_rect_node:nnnnn
-        { \@@_env: - #1 - #2 - block }
-        \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim 
-      \str_if_empty:NF \l_@@_block_name_str
-        {
-          \pgfnodealias 
-            { \@@_env: - \l_@@_block_name_str }
-            { \@@_env: - #1 - #2 - block }
-          \str_if_empty:NF \l_@@_name_str
-            {
-              \pgfnodealias 
-                { \l_@@_name_str - \l_@@_block_name_str }
-                { \@@_env: - #1 - #2 - block }
-            }
-        }
+    \@@_pgf_rect_node:nnnnn
+      { \@@_env: - #1 - #2 - block }
+      \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim 
+    \str_if_empty:NF \l_@@_block_name_str
+      {
+        \pgfnodealias 
+          { \@@_env: - \l_@@_block_name_str }
+          { \@@_env: - #1 - #2 - block }
+        \str_if_empty:NF \l_@@_name_str
+          {
+            \pgfnodealias 
+              { \l_@@_name_str - \l_@@_block_name_str }
+              { \@@_env: - #1 - #2 - block }
+          }
+      }
 %    \end{macrocode}
 % 
 % \medskip
@@ -13867,64 +13970,64 @@
 % normal node is used to put the label.
 %
 %    \begin{macrocode}
-      \bool_if:NF \l_@@_hpos_of_block_cap_bool
-        {
-          \dim_set_eq:NN \l_tmpb_dim \c_max_dim 
+    \bool_if:NF \l_@@_hpos_of_block_cap_bool
+      {
+        \dim_set_eq:NN \l_tmpb_dim \c_max_dim 
 %    \end{macrocode}
 % The short node is constructed by taking into account the \emph{contents} of
 % the columns involved in at least one cell of the block. That's why we have to
 % do a loop over the rows of the array.
 %    \begin{macrocode}
-          \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
-            {
+        \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+          {
 %    \end{macrocode}
 % We recall that, when a cell is empty, no (normal) node is created in that
 % cell. That's why we test the existence of the node before using it.
 %    \begin{macrocode}
-              \cs_if_exist:cT
-                { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
-                {
-                  \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
-                    {
-                      \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
-                      \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }  
-                    }
-                }
-            }
+            \cs_if_exist:cT
+              { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
+              {
+                \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+                  {
+                    \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
+                    \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }  
+                  }
+              }
+          }
 %    \end{macrocode}
 % If all the cells of the column were empty, |\l_tmpb_dim| has still the same
 % value |\c_max_dim|. In that case, you use for |\l_tmpb_dim| the value of the
 % position of the vertical rule. 
 %    \begin{macrocode}
-          \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
-            {
-              \@@_qpoint:n { col - #2 } 
-              \dim_set_eq:NN \l_tmpb_dim \pgf at x
-            }
-          \dim_set:Nn \l_@@_tmpd_dim { - \c_max_dim }
-          \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
-            {
-              \cs_if_exist:cT
-                { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } 
-                {
-                  \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
-                    {
-                      \pgfpointanchor 
-                        { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }  
-                        { east } 
-                      \dim_set:Nn \l_@@_tmpd_dim { \dim_max:nn \l_@@_tmpd_dim \pgf at x }
-                    }
-                }
-            }
-          \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim }
-            {
-              \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } 
-              \dim_set_eq:NN \l_@@_tmpd_dim \pgf at x
-            }
-          \@@_pgf_rect_node:nnnnn
-            { \@@_env: - #1 - #2 - block - short }
-            \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim 
-        }
+        \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+          {
+            \@@_qpoint:n { col - #2 } 
+            \dim_set_eq:NN \l_tmpb_dim \pgf at x
+          }
+        \dim_set:Nn \l_@@_tmpd_dim { - \c_max_dim }
+        \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+          {
+            \cs_if_exist:cT
+              { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } 
+              {
+                \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+                  {
+                    \pgfpointanchor 
+                      { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }  
+                      { east } 
+                    \dim_set:Nn \l_@@_tmpd_dim { \dim_max:nn \l_@@_tmpd_dim \pgf at x }
+                  }
+              }
+          }
+        \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim }
+          {
+            \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } 
+            \dim_set_eq:NN \l_@@_tmpd_dim \pgf at x
+          }
+        \@@_pgf_rect_node:nnnnn
+          { \@@_env: - #1 - #2 - block - short }
+          \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim 
+      }
 %    \end{macrocode}
 % 
 % \medskip
@@ -13946,145 +14049,273 @@
               { south~east }  
           } 
       }
+    \endpgfpicture
 %    \end{macrocode}
 %
+% \bigskip
+%    \begin{macrocode}
+  \bool_if:NTF \l_@@_ampersand_bool
+    { 
+      \seq_set_split:Nnn \l_tmpa_seq { & } { #6 }
+      \int_zero_new:N \l_@@_split_int 
+      \int_set:Nn \l_@@_split_int { \seq_count:N \l_tmpa_seq } 
+      \pgfpicture 
+      \pgfrememberpicturepositiononpagetrue
+      \pgf at relevantforpicturesizefalse 
+      \@@_qpoint:n { row - #1 }
+      \dim_set_eq:NN \l_@@_tmpc_dim \pgf at y
+      \@@_qpoint:n { row - \int_eval:n { #3 + 1 } }
+      \dim_set_eq:NN \l_@@_tmpd_dim \pgf at y
+      \@@_qpoint:n { col - #2 }
+      \dim_set_eq:NN \l_tmpa_dim \pgf at x
+      \@@_qpoint:n { col - \int_eval:n { #4 + 1 } } 
+      \dim_set:Nn \l_tmpb_dim 
+        { ( \pgf at x - \l_tmpa_dim ) / \int_use:N \l_@@_split_int }
+      \bool_lazy_or:nnT 
+        \l_@@_vlines_block_bool 
+        { \tl_if_eq_p:NN \l_@@_vlines_clist \c_@@_all_tl }
+        {
+          \int_step_inline:nn { \l_@@_split_int - 1 } 
+            { 
+              \pgfpathmoveto 
+                { 
+                  \pgfpoint 
+                    { \l_tmpa_dim + ##1 \l_tmpb_dim }
+                    \l_@@_tmpc_dim 
+                }
+              \pgfpathlineto
+                { 
+                  \pgfpoint 
+                    { \l_tmpa_dim + ##1 \l_tmpb_dim }
+                    \l_@@_tmpd_dim 
+                }
+              \CT at arc@
+              \pgfsetlinewidth { 1.1 \arrayrulewidth }
+              \pgfsetrectcap
+              \pgfusepathqstroke
+            }
+        }
+      \@@_qpoint:n { row - #1 - base }
+      \dim_set_eq:NN \l_@@_tmpc_dim \pgf at y 
+      \int_step_inline:nn \l_@@_split_int 
+        { 
+          \group_begin:
+          \dim_set:Nn \col at sep
+            { \bool_if:NTF \l_@@_tabular_bool \tabcolsep \arraycolsep }
+          \pgftransformshift
+            {
+              \pgfpoint
+                {
+                  \str_case:on \l_@@_hpos_block_str
+                    {
+                      l { \l_tmpa_dim + ##1 \l_tmpb_dim - \l_tmpb_dim + \col at sep}
+                      c { \l_tmpa_dim + ##1 \l_tmpb_dim - 0.5 \l_tmpb_dim }
+                      r { \l_tmpa_dim + ##1 \l_tmpb_dim - \col at sep }
+                    }
+                }
+                { \l_@@_tmpc_dim }
+            }      
+          \pgfset 
+            { 
+              inner~xsep = \c_zero_dim ,
+              inner~ysep = \c_zero_dim 
+            } 
+          \pgfnode 
+            { rectangle }
+            {
+              \str_case:on \l_@@_hpos_block_str
+                {
+                  c { base }
+                  l { base~west }
+                  r { base~east }
+                }
+            }
+            { \seq_item:Nn \l_tmpa_seq { ##1 } } { } { }
+           \group_end:
+        }
+      \endpgfpicture
+    }
+    {
+      \bool_if:NTF \l_@@_p_block_bool
+        { 
+%    \end{macrocode}
+% When the final user has used the key~|p|, we have to compute the width.
+%    \begin{macrocode}
+            \pgfpicture 
+              \pgfrememberpicturepositiononpagetrue
+              \pgf at relevantforpicturesizefalse 
+              \bool_if:NTF \l_@@_hpos_of_block_cap_bool
+                {
+                  \@@_qpoint:n { col - #2 } 
+                  \dim_gset_eq:NN \g_tmpa_dim \pgf at x
+                  \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } 
+                }
+                {
+                  \pgfpointanchor { \@@_env: - #1 - #2 - block - short } { west }
+                  \dim_gset_eq:NN \g_tmpa_dim \pgf at x
+                  \pgfpointanchor { \@@_env: - #1 - #2 - block - short } { east }
+                }
+              \dim_gset:Nn \g_tmpb_dim { \pgf at x - \g_tmpa_dim }
+            \endpgfpicture
+            \hbox_set:Nn \l_@@_cell_box 
+              {
+                \begin { minipage } [ \str_lowercase:o \l_@@_vpos_block_str ] 
+                  { \g_tmpb_dim }
+                \str_case:on \l_@@_hpos_block_str
+                  { c \centering r \raggedleft l \raggedright j { } }
+                #6
+                \end { minipage }
+              }
+          }
+          { \hbox_set:Nn \l_@@_cell_box { \set at color #6 } }
+        \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
+%    \end{macrocode}
 %
-% \medskip
+% \bigskip
 % Now, we will put the label of the block.
 %    \begin{macrocode}
-    \bool_lazy_any:nTF
-      {
-        { \str_if_eq_p:on \l_@@_vpos_block_str { c } }
-        { \str_if_eq_p:on \l_@@_vpos_block_str { T } }
-        { \str_if_eq_p:on \l_@@_vpos_block_str { B } }
-      }
+        \pgfpicture
+        \pgfrememberpicturepositiononpagetrue
+        \pgf at relevantforpicturesizefalse 
+        \bool_lazy_any:nTF
+          {
+            { \str_if_eq_p:on \l_@@_vpos_block_str { c } }
+            { \str_if_eq_p:on \l_@@_vpos_block_str { T } }
+            { \str_if_eq_p:on \l_@@_vpos_block_str { B } }
+          }
 %    \end{macrocode}
 % \medskip
 %    \begin{macrocode}
-      { 
+          { 
 %    \end{macrocode}
 % If we are in the first column, we must put the block as if it was with the key~|r|.
 %    \begin{macrocode}
-        \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str }
+            \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str }
 %    \end{macrocode}
 % If we are in the last column, we must put the block as if it was with the key~|l|.
 %    \begin{macrocode}
-        \bool_if:nT \g_@@_last_col_found_bool 
-          {
-            \int_compare:nNnT { #2 } = \g_@@_col_total_int
-              { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str }
-          }
+            \bool_if:nT \g_@@_last_col_found_bool 
+              {
+                \int_compare:nNnT { #2 } = \g_@@_col_total_int
+                  { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str }
+              }
 %    \end{macrocode}
 % |\l_tmpa_tl| will contain the anchor of the \textsc{pgf} node which will be used.
 %    \begin{macrocode}
-        \tl_set:Nx \l_tmpa_tl 
-          {
-            \str_case:on \l_@@_vpos_block_str
+            \tl_set:Nx \l_tmpa_tl 
               {
-                c { 
-                    \str_case:on \l_@@_hpos_block_str
-                      {
-                        c { center } 
-                        l { west } 
-                        r { east } 
-                      }
+                \str_case:on \l_@@_vpos_block_str
+                  {
+                    c { 
+                        \str_case:on \l_@@_hpos_block_str
+                          {
+                            c { center } 
+                            l { west } 
+                            r { east } 
+                            j { center }
+                          }
 
-                  } 
-                T { 
-                    \str_case:on \l_@@_hpos_block_str
-                      {
-                        c { north } 
-                        l { north~west } 
-                        r { north~east } 
-                      }
+                      } 
+                    T { 
+                        \str_case:on \l_@@_hpos_block_str
+                          {
+                            c { north } 
+                            l { north~west } 
+                            r { north~east } 
+                            j { north }
+                          }
 
-                  } 
-                B { 
-                    \str_case:on \l_@@_hpos_block_str
-                      {
-                        c { south} 
-                        l { south~west } 
-                        r { south~east }
-                      }
+                      } 
+                    B { 
+                        \str_case:on \l_@@_hpos_block_str
+                          {
+                            c { south } 
+                            l { south~west } 
+                            r { south~east }
+                            j { south }
+                          }
 
-                  } 
+                      } 
+                  }
               }
-          }
 %    \end{macrocode}
 %    \begin{macrocode}
-        \pgftransformshift
-          {
-            \pgfpointanchor 
+            \pgftransformshift
+              {
+                \pgfpointanchor 
+                  { 
+                    \@@_env: - #1 - #2 - block 
+                    \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+                  }
+                  { \l_tmpa_tl }
+              }
+            \pgfset 
               { 
-                \@@_env: - #1 - #2 - block 
-                \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
-              }
+                inner~xsep = \c_zero_dim ,
+                inner~ysep = \c_zero_dim 
+              } 
+            \pgfnode 
+              { rectangle } 
               { \l_tmpa_tl }
-          }
-        \pgfset 
-          { 
-            inner~xsep = \c_zero_dim ,
-            inner~ysep = \c_zero_dim 
-          } 
-        \pgfnode 
-          { rectangle } 
-          { \l_tmpa_tl }
-          { \box_use_drop:N \l_@@_cell_box } { } { }
-      }   
+              { \box_use_drop:N \l_@@_cell_box } { } { }
+          }   
 %    \end{macrocode}
 % End of the case when |\l_@@_vpos_block_str| is equal to |c|, |T| or |B|.
 % Now, the other cases.
 %    \begin{macrocode}
-      { 
+          { 
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-        \pgfextracty \l_tmpa_dim 
-          { 
-            \@@_qpoint:n 
+            \pgfextracty \l_tmpa_dim 
               { 
-                row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 }  
-                - base 
+                \@@_qpoint:n 
+                  { 
+                    row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 }  
+                    - base 
+                  } 
               } 
-          } 
-        \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } 
+            \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } 
 %    \end{macrocode}
 % We retrieve (in |\pgf at x|) the $x$-value of the center of the block.
 %    \begin{macrocode}
-        \pgfpointanchor 
-          { 
-            \@@_env: - #1 - #2 - block 
-            \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
-          } 
-          {
-            \str_case:on \l_@@_hpos_block_str
+            \pgfpointanchor 
+              { 
+                \@@_env: - #1 - #2 - block 
+                \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+              } 
               {
-                c { center } 
-                l { west } 
-                r { east } 
-              }
-          } 
+                \str_case:on \l_@@_hpos_block_str
+                  {
+                    c { center } 
+                    l { west } 
+                    r { east } 
+                    j { center }
+                  }
+              } 
 %    \end{macrocode}
 % We put the label of the block which has been composed in |\l_@@_cell_box|.
 %    \begin{macrocode}
-        \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
-        \pgfset { inner~sep = \c_zero_dim }
-        \pgfnode 
-          { rectangle } 
-          {
-             \str_case:on \l_@@_hpos_block_str
+            \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
+            \pgfset { inner~sep = \c_zero_dim }
+            \pgfnode 
+              { rectangle } 
               {
-                c { base } 
-                l { base~west } 
-                r { base~east } 
+                 \str_case:on \l_@@_hpos_block_str
+                  {
+                    c { base } 
+                    l { base~west } 
+                    r { base~east } 
+                    j { base }
+                  } 
               } 
-          } 
-          { \box_use_drop:N \l_@@_cell_box } { } { }
-      }
+              { \box_use_drop:N \l_@@_cell_box } { } { }
+          }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-    \endpgfpicture
+        \endpgfpicture
+      }
     \group_end:
   }
 %    \end{macrocode}
@@ -15764,9 +15995,9 @@
 %    \begin{macrocode}
 \NewDocumentCommand \@@_ShowCellNames_CodeBefore { }
  {
-   \dim_zero_new:N \g_@@_tmpc_dim
-   \dim_zero_new:N \g_@@_tmpd_dim
-   \dim_zero_new:N \g_@@_tmpe_dim
+   \dim_gzero_new:N \g_@@_tmpc_dim
+   \dim_gzero_new:N \g_@@_tmpd_dim
+   \dim_gzero_new:N \g_@@_tmpe_dim
    \int_step_inline:nn \c at iRow
      {
        \begin { pgfpicture }
@@ -15850,9 +16081,9 @@
        \pgfusepathqfill
        \endpgfpicture
      }
-   \dim_zero_new:N \g_@@_tmpc_dim
-   \dim_zero_new:N \g_@@_tmpd_dim
-   \dim_zero_new:N \g_@@_tmpe_dim
+   \dim_gzero_new:N \g_@@_tmpc_dim
+   \dim_gzero_new:N \g_@@_tmpd_dim
+   \dim_gzero_new:N \g_@@_tmpe_dim
    \int_step_inline:nn \c at iRow
      {
        \bool_if:NTF \l_@@_in_code_after_bool
@@ -16224,6 +16455,15 @@
   }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\@@_msg_new:nn { empty~preamble }
+  {
+    Empty~preamble.\\
+    The~preamble~of~your~\@@_full_name_env:\ is~empty.\\
+    This~error~is~fatal.
+  }
+%    \end{macrocode}
+% 
 %
 %    \begin{macrocode}
 \@@_msg_new:nn { in~first~col }
@@ -16471,7 +16711,7 @@
     Incompatible~keys.\\
     You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~
     '\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\
-    Maybe~it~will~possible~in~future~version.\\
+    However,~you~can~put~several~commands~\token_to_str:N \Block.\\
     Your~key~will~be~discarded.
   }
 %    \end{macrocode}
@@ -16512,7 +16752,7 @@
 \@@_msg_new:nn { ragged2e~not~loaded }
   {
     You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~
-    your~column~'\l_@@_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:V
+    your~column~'\l_@@_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:o
     \l_keys_key_str'~will~be~used~instead. 
   }
 %    \end{macrocode}
@@ -17121,6 +17361,7 @@
     create-extra-nodes,~
     create-medium-nodes,~
     create-large-nodes,~
+    custom-line,~
     delimiters~(several~subkeys),~
     end-of-row,~
     first-col,~

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2024-05-30 19:57:12 UTC (rev 71389)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2024-05-30 19:57:31 UTC (rev 71390)
@@ -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{6.27b}
-\def\myfiledate{2024/04/23}
+\def\myfileversion{6.28}
+\def\myfiledate{2024/05/29}
 \RequirePackage{pgfcore}
 \usepgfmodule{shapes}
 \RequirePackage{l3keys2e}
@@ -31,6 +31,8 @@
 \RequirePackage { amsmath }
 \RequirePackage { array }
 \bool_const:Nn \c__nicematrix_tagging_array_bool { \cs_if_exist_p:N \ar at ialign }
+\bool_const:Nn \c__nicematrix_testphase_table_bool
+  { \IfPackageLoadedTF { latex-lab-testphase-table } \c_true_bool \c_false_bool }
 \cs_new_protected:Npn \__nicematrix_error:n { \msg_error:nn { nicematrix } }
 \cs_new_protected:Npn \__nicematrix_warning:n { \msg_warning:nn { nicematrix } }
 \cs_new_protected:Npn \__nicematrix_error:nn { \msg_error:nnn { nicematrix } }
@@ -153,8 +155,8 @@
 \str_const:Nn \c__nicematrix_j_str { j }
 \str_const:Nn \c__nicematrix_si_str { si }
 \tl_new:N \l__nicematrix_argspec_tl
-\cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
-\cs_generate_variant:Nn \str_lowercase:n { V }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N o n }
+\cs_generate_variant:Nn \str_lowercase:n { o }
 \hook_gput_code:nnn { begindocument } { . }
   {
     \IfPackageLoadedTF { tikz }
@@ -224,19 +226,19 @@
       { }
       {
         \cs_set_protected:Npn \CT at arc@ { }
-        \cs_set:Npn \arrayrulecolor #1 # { \CT at arc { #1 } }
-        \cs_set:Npn \CT at arc #1 #2
+        \cs_set_nopar:Npn \arrayrulecolor #1 # { \CT at arc { #1 } }
+        \cs_set_nopar:Npn \CT at arc #1 #2
           {
             \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
               { \cs_gset_nopar:Npn \CT at arc@ { \color #1 { #2 } } }
           }
-        \cs_set:Npn \doublerulesepcolor #1 # { \CT at drs { #1 } }
-        \cs_set:Npn \CT at drs #1 #2
+        \cs_set_nopar:Npn \doublerulesepcolor #1 # { \CT at drs { #1 } }
+        \cs_set_nopar:Npn \CT at drs #1 #2
           {
             \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
               { \cs_gset:Npn \CT at drsc@ { \color #1 { #2 } } }
           }
-        \cs_set:Npn \hline
+        \cs_set_nopar:Npn \hline
           {
             \noalign { \ifnum 0 = `} \fi
             \cs_set_eq:NN \hskip \vskip
@@ -248,8 +250,8 @@
           }
       }
   }
-\cs_set:Npn \__nicematrix_standard_cline #1 { \__nicematrix_standard_cline:w #1 \q_stop }
-\cs_set:Npn \__nicematrix_standard_cline:w #1-#2 \q_stop
+\cs_set_nopar:Npn \__nicematrix_standard_cline #1 { \__nicematrix_standard_cline:w #1 \q_stop }
+\cs_set_nopar:Npn \__nicematrix_standard_cline:w #1-#2 \q_stop
   {
     \int_if_zero:nT \l__nicematrix_first_col_int { \omit & }
     \int_compare:nNnT { #1 } > \c_one_int
@@ -296,8 +298,8 @@
     \tl_if_blank:nF { #1 }
       {
         \tl_if_head_eq_meaning:nNTF { #1 } [
-          { \cs_set:Npn \CT at arc@ { \color #1 } }
-          { \cs_set:Npn \CT at arc@ { \color { #1 } } }
+          { \cs_set_nopar:Npn \CT at arc@ { \color #1 } }
+          { \cs_set_nopar:Npn \CT at arc@ { \color { #1 } } }
       }
   }
 \cs_generate_variant:Nn \__nicematrix_set_CT at arc@:n { o }
@@ -304,8 +306,8 @@
 \cs_new_protected:Npn \__nicematrix_set_CT at drsc@:n #1
   {
     \tl_if_head_eq_meaning:nNTF { #1 } [
-      { \cs_set:Npn \CT at drsc@ { \color #1 } }
-      { \cs_set:Npn \CT at drsc@ { \color { #1 } } }
+      { \cs_set_nopar:Npn \CT at drsc@ { \color #1 } }
+      { \cs_set_nopar:Npn \CT at drsc@ { \color { #1 } } }
   }
 \cs_generate_variant:Nn \__nicematrix_set_CT at drsc@:n { o }
 \cs_new:Npn \__nicematrix_exp_color_arg:Nn #1 #2
@@ -318,7 +320,6 @@
 \cs_new_protected:Npn \__nicematrix_color:n #1
   { \tl_if_blank:nF { #1 } { \__nicematrix_exp_color_arg:Nn \color { #1 } } }
 \cs_generate_variant:Nn \__nicematrix_color:n { o }
-\cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor
 \cs_new_protected:Npn \__nicematrix_rescan_for_spanish:N #1
   {
     \tl_set_rescan:Nno
@@ -396,7 +397,7 @@
 \bool_new:N \l__nicematrix_bold_row_style_bool
 \cs_new:Npn \__nicematrix_full_name_env:
   {
-    \str_if_eq:VnTF \g__nicematrix_com_or_env_str { command }
+    \str_if_eq:onTF \g__nicematrix_com_or_env_str { command }
       { command \space \c_backslash_str \g__nicematrix_name_env_str }
       { environment \space \{ \g__nicematrix_name_env_str \} }
   }
@@ -407,6 +408,7 @@
 \tl_new:N \g__nicematrix_pre_code_after_tl
 \tl_new:N \g_nicematrix_code_after_tl
 \bool_new:N \l__nicematrix_in_code_after_bool
+\bool_new:N \l__nicematrix_ampersand_bool
 \int_new:N \l__nicematrix_old_iRow_int
 \int_new:N \l__nicematrix_old_jCol_int
 \seq_new:N \l__nicematrix_custom_line_commands_seq
@@ -424,8 +426,14 @@
 \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__nicematrix_tmpc_dim
-\dim_zero_new:N \l__nicematrix_tmpd_dim
+\dim_new:N \l__nicematrix_tmpc_dim
+\dim_new:N \l__nicematrix_tmpd_dim
+\dim_new:N \g__nicematrix_dp_row_zero_dim
+\dim_new:N \g__nicematrix_ht_row_zero_dim
+\dim_new:N \g__nicematrix_ht_row_one_dim
+\dim_new:N \g__nicematrix_dp_ante_last_row_dim
+\dim_new:N \g__nicematrix_ht_last_row_dim
+\dim_new:N \g__nicematrix_dp_last_row_dim
 \bool_new:N \g__nicematrix_empty_cell_bool
 \dim_new:N \g__nicematrix_width_last_col_dim
 \dim_new:N \g__nicematrix_width_first_col_dim
@@ -462,6 +470,7 @@
 \str_new:N \l__nicematrix_hpos_block_str
 \str_set:Nn \l__nicematrix_hpos_block_str { c }
 \bool_new:N \l__nicematrix_hpos_of_block_cap_bool
+\bool_new:N \l__nicematrix_p_block_bool
 \bool_new:N \l__nicematrix_nocolor_used_bool
 \str_new:N \l__nicematrix_vpos_block_str
 \str_set:Nn \l__nicematrix_vpos_block_str { c }
@@ -761,6 +770,7 @@
 \bool_new:N \l__nicematrix_light_syntax_expanded_bool
 \tl_new:N \l__nicematrix_baseline_tl
 \tl_set:Nn \l__nicematrix_baseline_tl { c }
+\bool_new:N \l__nicematrix_amp_in_blocks_bool
 \bool_new:N \l__nicematrix_exterior_arraycolsep_bool
 \bool_new:N \l__nicematrix_parallelize_diags_bool
 \bool_set_true:N \l__nicematrix_parallelize_diags_bool
@@ -840,6 +850,8 @@
   }
 \keys_define:nn { NiceMatrix / Global }
   {
+    ampersand-in-blocks .bool_set:N = \l__nicematrix_amp_in_blocks_bool ,
+    ampersand-in-blocks .default:n = true ,
     no-cell-nodes .code:n =
       \cs_set_protected:Npn \__nicematrix_node_for_cell:
         { \box_use_drop:N \l__nicematrix_cell_box } ,
@@ -1442,7 +1454,7 @@
       { \cs_set_nopar:Npn \@halignto { } }
       { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l__nicematrix_tabular_width_dim } }
     \@tabarray
-    [ \str_if_eq:VnTF \l__nicematrix_baseline_tl c c t ]
+    [ \str_if_eq:onTF \l__nicematrix_baseline_tl c c t ]
   }
 \bool_if:NTF \c__nicematrix_tagging_array_bool
   { \cs_set_eq:NN \__nicematrix_old_ar at ialign: \ar at ialign }
@@ -1485,7 +1497,7 @@
 \cs_new:Npn \__nicematrix_everycr: { \noalign { \__nicematrix_everycr_i: } }
 \cs_new_protected:Npn \__nicematrix_everycr_i:
   {
-    \bool_if:NT \c__nicematrix_tagging_array_bool
+    \bool_if:NT \c__nicematrix_testphase_table_bool
       {
         \tbl_if_row_was_started:T { \UseTaggingSocket { tbl / row / end } }
         \tbl_update_cell_data_for_next_row:
@@ -1533,23 +1545,23 @@
       }
   }
 \cs_new_protected:Npn \__nicematrix_redefine_everycr: { \everycr { \__nicematrix_everycr: } }
+   \hook_gput_code:nnn { begindocument } { . }
+     {
+       \IfPackageLoadedTF { colortbl }
+         {
+           \cs_set_protected:Npn \__nicematrix_redefine_everycr:
+             {
+               \CT at everycr
+                 {
+                   \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
+                   \__nicematrix_everycr:
+                 }
+             }
+         }
+         { }
+    }
 \hook_gput_code:nnn { begindocument } { . }
   {
-    \IfPackageLoadedTF { colortbl }
-      {
-        \cs_set_protected:Npn \__nicematrix_redefine_everycr:
-          {
-            \CT at everycr
-              {
-                \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
-                \__nicematrix_everycr:
-              }
-          }
-      }
-      { }
-  }
-\hook_gput_code:nnn { begindocument } { . }
-  {
     \IfPackageLoadedTF { booktabs }
       {
         \cs_new_protected:Npn \__nicematrix_patch_booktabs:
@@ -1559,16 +1571,11 @@
   }
 \cs_new_protected:Npn \__nicematrix_some_initialization:
   {
-    \dim_gzero_new:N \g__nicematrix_dp_row_zero_dim
     \dim_gset:Nn \g__nicematrix_dp_row_zero_dim { \box_dp:N \@arstrutbox }
-    \dim_gzero_new:N \g__nicematrix_ht_row_zero_dim
     \dim_gset:Nn \g__nicematrix_ht_row_zero_dim { \box_ht:N \@arstrutbox }
-    \dim_gzero_new:N \g__nicematrix_ht_row_one_dim
-    \dim_gset:Nn \g__nicematrix_ht_row_one_dim { \box_ht:N \@arstrutbox }
-    \dim_gzero_new:N \g__nicematrix_dp_ante_last_row_dim
-    \dim_gzero_new:N \g__nicematrix_ht_last_row_dim
+    \dim_gset_eq:NN \g__nicematrix_ht_row_one_dim \g__nicematrix_ht_row_zero_dim
+    \dim_gzero:N \g__nicematrix_dp_ante_last_row_dim
     \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_new_protected:Npn \__nicematrix_pre_array_ii:
@@ -1597,9 +1604,9 @@
       {
         \cs_set_nopar:Npn \ar at ialign
           {
-            \tbl_init_cell_data_for_table:
+            \bool_if:NT \c__nicematrix_testphase_table_bool \tbl_init_cell_data_for_table:
             \__nicematrix_redefine_everycr:
-            \tabskip = \c_zero_skip
+            \dim_zero:N \tabskip
             \__nicematrix_some_initialization:
             \cs_set_eq:NN \ar at ialign \__nicematrix_old_ar at ialign:
             \halign
@@ -1609,7 +1616,7 @@
         \cs_set_nopar:Npn \ialign
           {
             \__nicematrix_redefine_everycr:
-            \tabskip = \c_zero_skip
+            \dim_zero:N \tabskip
             \__nicematrix_some_initialization:
             \cs_set_eq:NN \ialign \__nicematrix_old_ialign:
             \halign
@@ -1731,6 +1738,8 @@
         \dim_gset_eq:NN \l__nicematrix_right_delim_dim \l__nicematrix_left_delim_dim
       }
     \hbox_set:Nw \l__nicematrix_the_array_box
+    \bool_if:NT \c__nicematrix_testphase_table_bool
+      { \UseTaggingSocket { tbl / hmode / begin } }
     \skip_horizontal:N \l__nicematrix_left_margin_dim
     \skip_horizontal:N \l__nicematrix_extra_left_margin_dim
     \c_math_toggle_token
@@ -1931,6 +1940,7 @@
     \tl_gset:Nn \g__nicematrix_left_delim_tl { #1 }
     \tl_gset:Nn \g__nicematrix_right_delim_tl { #2 }
     \tl_gset:Nn \g__nicematrix_user_preamble_tl { #4 }
+    \tl_if_empty:NT \g__nicematrix_user_preamble_tl { \__nicematrix_fatal:n { empty~preamble } }
     \int_gzero:N \g__nicematrix_block_box_int
     \dim_zero:N \g__nicematrix_width_last_col_dim
     \dim_zero:N \g__nicematrix_width_first_col_dim
@@ -1977,7 +1987,7 @@
       { \keys_set:nn { NiceMatrix / NiceArray } }
     { #3 , #5 }
     \__nicematrix_set_CT at arc@:o \l__nicematrix_rules_color_tl
-    \IfBooleanTF { #6 } \__nicematrix_CodeBefore_Body:w \__nicematrix_pre_array:
+    \bool_if:nTF { #6 } \__nicematrix_CodeBefore_Body:w \__nicematrix_pre_array:
   }
   {
     \bool_if:NTF \l__nicematrix_light_syntax_bool
@@ -1986,6 +1996,18 @@
     \c_math_toggle_token
     \skip_horizontal:N \l__nicematrix_right_margin_dim
     \skip_horizontal:N \l__nicematrix_extra_right_margin_dim
+
+    % % awful workaround
+    \int_compare:nNnT \g__nicematrix_col_total_int = \c_one_int
+      {
+        \dim_compare:nNnT \l__nicematrix_columns_width_dim > \c_zero_dim
+          {
+            \skip_horizontal:N - \l__nicematrix_columns_width_dim
+            \bool_if:NTF \l__nicematrix_tabular_bool
+              { \skip_horizontal:n { - 2 \tabcolsep } }
+              { \skip_horizontal:n { - 2 \arraycolsep } }
+          }
+      }
     \hbox_set_end:
     \bool_if:NT \l__nicematrix_width_used_bool
       {
@@ -2387,7 +2409,7 @@
               { \tl_clear:N \exp_not:N \l__nicematrix_hpos_cell_tl }
               {
                 \cs_set_nopar:Npn \exp_not:N \l__nicematrix_hpos_cell_tl
-                  { \str_lowercase:V \l__nicematrix_hpos_col_str }
+                  { \str_lowercase:o \l__nicematrix_hpos_col_str }
               }
             \str_case:on \l__nicematrix_hpos_col_str
               {
@@ -2410,7 +2432,7 @@
                 { j } { c }
                 { si } { c }
               }
-              { \str_lowercase:V \l__nicematrix_hpos_col_str }
+              { \str_lowercase:o \l__nicematrix_hpos_col_str }
           }
       }
     \int_gincr:N \c at jCol
@@ -2427,6 +2449,8 @@
       {
         > {
             \dim_set:Nn \l__nicematrix_col_width_dim { #2 }
+            \bool_if:NT \c__nicematrix_testphase_table_bool
+              { \tag_struct_begin:n { tag = Div } }
             \__nicematrix_cell_begin:w
             \use:c { #7 } [ #1 ] { #2 }
             \everypar
@@ -2434,6 +2458,7 @@
                 \vrule height \box_ht:N \@arstrutbox width \c_zero_dim
                 \everypar { }
               }
+            \bool_if:NT \c__nicematrix_testphase_table_bool \tagpdfparaOn
             #3
             \g__nicematrix_row_style_tl
             \arraybackslash
@@ -2446,6 +2471,7 @@
             \use:c { end #7 }
             #4
             \__nicematrix_cell_end:
+            \bool_if:NT \c__nicematrix_testphase_table_bool \tag_struct_end:
           }
       }
   }
@@ -2826,7 +2852,9 @@
     \multispan { #1 }
     \cs_set_eq:NN \__nicematrix_update_max_cell_width: \prg_do_nothing:
     \begingroup
-    \cs_set:Npn \@addamp
+    \bool_if:NT \c__nicematrix_testphase_table_bool
+      { \tbl_update_multicolumn_cell_data:n { #1 } }
+    \cs_set_nopar:Npn \@addamp
       { \legacy_if:nTF { @firstamp } { \@firstampfalse } { \@preamerr 5 } }
     \tl_gclear:N \g__nicematrix_preamble_tl
     \__nicematrix_make_m_preamble:n #2 \q_stop
@@ -2833,6 +2861,8 @@
     \exp_args:No \@mkpream \g__nicematrix_preamble_tl
     \@addtopreamble \@empty
     \endgroup
+    \bool_if:NT \c__nicematrix_testphase_table_bool
+      { \UseTaggingSocket { tbl / colspan } { #1 } }
     \int_compare:nNnT { #1 } > \c_one_int
       {
         \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
@@ -2855,7 +2885,7 @@
             { } % for the name of the block
           }
       }
-    \cs_set:Npn \@sharp { #3 }
+    \cs_set_nopar:Npn \@sharp { #3 }
     \@arstrut
     \@preamble
     \null
@@ -3282,7 +3312,7 @@
     \tl_set_rescan:Nno \l__nicematrix_end_of_row_tl { } \l__nicematrix_end_of_row_tl
     \bool_if:NTF \l__nicematrix_light_syntax_expanded_bool
       \seq_set_split:Nee
-      \seq_set_split:NVn
+      \seq_set_split:Non
       \l__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 }
     \seq_pop_right:NN \l__nicematrix_rows_seq \l_tmpa_tl
     \tl_if_empty:NF \l_tmpa_tl
@@ -3457,7 +3487,7 @@
           { \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } }
         \skip_horizontal:N \g_tmpa_skip
         \int_gincr:N \g_tmpa_int
-        \bool_lazy_any:nF % modified 2023/12/13
+        \bool_lazy_any:nF
           {
             \g__nicematrix_delims_bool
             \l__nicematrix_tabular_bool
@@ -3527,7 +3557,7 @@
             \endpgfpicture
           }
       }
-    \cr
+  % \cr
   }
 \tl_const:Nn \c__nicematrix_preamble_first_col_tl
   {
@@ -3735,7 +3765,11 @@
     \__nicematrix_settings_for_tabular:
     \NiceArray { #2 }
   }
-  { \endNiceArray }
+  {
+    \endNiceArray
+    \bool_if:NT \c__nicematrix_testphase_table_bool
+      { \UseTaggingSocket { tbl / hmode / end } }
+  }
 \cs_new_protected:Npn \__nicematrix_settings_for_tabular:
   {
     \bool_set_true:N \l__nicematrix_tabular_bool
@@ -4003,6 +4037,14 @@
       }
     \anchor { 5 } { \five }
     \anchor { center } { \pgfpointorigin }
+    \anchor { 1 } { \five \pgf at x = 0.2 \pgf at x \pgf at y = 0.2 \pgf at y }
+    \anchor { 2 } { \five \pgf at x = 0.4 \pgf at x \pgf at y = 0.4 \pgf at y }
+    \anchor { 3 } { \five \pgf at x = 0.6 \pgf at x \pgf at y = 0.6 \pgf at y }
+    \anchor { 4 } { \five \pgf at x = 0.8 \pgf at x \pgf at y = 0.8 \pgf at y }
+    \anchor { 6 } { \five \pgf at x = 1.2 \pgf at x \pgf at y = 1.2 \pgf at y }
+    \anchor { 7 } { \five \pgf at x = 1.4 \pgf at x \pgf at y = 1.4 \pgf at y }
+    \anchor { 8 } { \five \pgf at x = 1.6 \pgf at x \pgf at y = 1.6 \pgf at y }
+    \anchor { 9 } { \five \pgf at x = 1.8 \pgf at x \pgf at y = 1.8 \pgf at y }
   }
 \cs_new_protected:Npn \__nicematrix_create_diag_nodes:
   {
@@ -7017,6 +7059,9 @@
   }
 \keys_define:nn { NiceMatrix / Block / FirstPass }
   {
+    j .code:n = \str_set:Nn \l__nicematrix_hpos_block_str j
+                \bool_set_true:N \l__nicematrix_p_block_bool ,
+    j .value_forbidden:n = true ,
     l .code:n = \str_set:Nn \l__nicematrix_hpos_block_str l ,
     l .value_forbidden:n = true ,
     r .code:n = \str_set:Nn \l__nicematrix_hpos_block_str r ,
@@ -7037,6 +7082,8 @@
     b .value_forbidden:n = true ,
     B .code:n = \str_set:Nn \l__nicematrix_vpos_block_str B ,
     B .value_forbidden:n = true ,
+    p .code:n = \bool_set_true:N \l__nicematrix_p_block_bool ,
+    p .value_forbidden:n = true ,
     color .code:n =
       \__nicematrix_color:n { #1 }
       \tl_set_rescan:Nnn
@@ -7095,18 +7142,29 @@
         { \int_eval:n { \c at iRow + \l_tmpa_int - 1 } }
         { \int_eval:n { \c at jCol + \l_tmpb_int - 1 } }
       }
-    \bool_if:nTF
+    \bool_set_false:N \l_tmpa_bool
+    \bool_if:NT \l__nicematrix_amp_in_blocks_bool
+      { \tl_if_in:nnT { #5 } { & } { \bool_set_true:N \l_tmpa_bool } }
+    \bool_if:NTF \l_tmpa_bool
+      { \exp_args:Nee \__nicematrix_Block_vii:nnnnn }
       {
-        (
-          \int_compare_p:nNn \l_tmpa_int = \c_one_int
-             ||
-          \int_compare_p:nNn \l_tmpb_int = \c_one_int
-        )
-        && ! \tl_if_empty_p:n { #5 }
-        && ! \l__nicematrix_X_bool
+        \bool_if:NTF \l__nicematrix_p_block_bool
+          { \exp_args:Nee \__nicematrix_Block_vi:nnnnn }
+          {
+            \bool_if:nTF
+              {
+                (
+                  \int_compare_p:nNn \l_tmpa_int = \c_one_int
+                     ||
+                  \int_compare_p:nNn \l_tmpb_int = \c_one_int
+                )
+                && ! \tl_if_empty_p:n { #5 }
+                && ! \l__nicematrix_X_bool
+              }
+              { \exp_args:Nee \__nicematrix_Block_iv:nnnnn }
+              { \exp_args:Nee \__nicematrix_Block_v:nnnnn }
+          }
       }
-      { \exp_args:Nee \__nicematrix_Block_iv:nnnnn }
-      { \exp_args:Nee \__nicematrix_Block_v:nnnnn }
     { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 }
   }
 \cs_new_protected:Npn \__nicematrix_Block_iv:nnnnn #1 #2 #3 #4 #5
@@ -7159,7 +7217,7 @@
                 \use:e
                   {
                     \exp_not:N \begin { minipage }%
-                      [ \str_lowercase:V \l__nicematrix_vpos_block_str ]
+                      [ \str_lowercase:o \l__nicematrix_vpos_block_str ]
                       { \l__nicematrix_col_width_dim }
                      \str_case:on \l__nicematrix_hpos_block_str
                        { c \centering r \raggedleft l \raggedright }
@@ -7171,7 +7229,7 @@
                 \use:e
                   {
                     \exp_not:N \begin { tabular }%
-                      [ \str_lowercase:V \l__nicematrix_vpos_block_str ]
+                      [ \str_lowercase:o \l__nicematrix_vpos_block_str ]
                       { @ { } \l__nicematrix_hpos_block_str @ { } }
                   }
                   #5
@@ -7183,7 +7241,7 @@
             \use:e
               {
                 \exp_not:N \begin { array }%
-                  [ \str_lowercase:V \l__nicematrix_vpos_block_str ]
+                  [ \str_lowercase:o \l__nicematrix_vpos_block_str ]
                   { @ { } \l__nicematrix_hpos_block_str @ { } }
               }
               #5
@@ -7204,27 +7262,24 @@
               }
           }
       }
-     \str_if_eq:VnT \l__nicematrix_vpos_block_str { c }
+     \int_compare:nNnT { #1 } = \c_one_int
        {
-         \int_compare:nNnT { #1 } = \c_one_int
+         \dim_gset:Nn \g__nicematrix_blocks_ht_dim
            {
-             \dim_gset:Nn \g__nicematrix_blocks_ht_dim
+             \dim_max:nn
+               \g__nicematrix_blocks_ht_dim
                {
-                 \dim_max:nn
-                   \g__nicematrix_blocks_ht_dim
-                   {
-                     \box_ht:c
-                       { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
-                   }
+                 \box_ht:c
+                   { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
                }
-             \dim_gset:Nn \g__nicematrix_blocks_dp_dim
+           }
+         \dim_gset:Nn \g__nicematrix_blocks_dp_dim
+           {
+             \dim_max:nn
+               \g__nicematrix_blocks_dp_dim
                {
-                 \dim_max:nn
-                   \g__nicematrix_blocks_dp_dim
-                   {
-                     \box_dp:c
-                       { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
-                   }
+                 \box_dp:c
+                   { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
                }
            }
        }
@@ -7310,13 +7365,15 @@
                 {
                   \dim_zero:N \extrarowheight
                   #4
-                   \use:e
-                     {
-                       \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_block_str ]
-                       { @ { } \l__nicematrix_hpos_block_str @ { } }
-                     }
-                     #5
-                   \end { tabular }
+                  \bool_if:NT \c__nicematrix_testphase_table_bool
+                     { \tag_stop:n { table } }
+                  \use:e
+                    {
+                      \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_block_str ]
+                      { @ { } \l__nicematrix_hpos_block_str @ { } }
+                    }
+                    #5
+                  \end { tabular }
                 }
               \group_end:
             }
@@ -7342,6 +7399,28 @@
         }
       }
   }
+\cs_new_protected:Npn \__nicematrix_Block_vi:nnnnn #1 #2 #3 #4 #5
+  {
+    \seq_gput_right:Nx \g__nicematrix_blocks_seq
+      {
+        \l_tmpa_tl
+        { \exp_not:n { #3 } }
+        {
+          \group_begin:
+          \exp_not:n { #4 #5 }
+          \group_end:
+        }
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_Block_vii:nnnnn #1 #2 #3 #4 #5
+  {
+    \seq_gput_right:Nx \g__nicematrix_blocks_seq
+      {
+        \l_tmpa_tl
+        { \exp_not:n { #3 } }
+        { \exp_not:n { #4 #5 } }
+      }
+  }
 \keys_define:nn { NiceMatrix / Block / SecondPass }
   {
     tikz .code:n =
@@ -7380,6 +7459,8 @@
     hlines .default:n = true ,
     line-width .dim_set:N = \l__nicematrix_line_width_dim ,
     line-width .value_required:n = true ,
+    j .code:n = \str_set:Nn \l__nicematrix_hpos_block_str j
+                \bool_set_true:N \l__nicematrix_p_block_bool ,
     l .code:n = \str_set:Nn \l__nicematrix_hpos_block_str l ,
     r .code:n = \str_set:Nn \l__nicematrix_hpos_block_str r ,
     c .code:n = \str_set:Nn \l__nicematrix_hpos_block_str c ,
@@ -7393,9 +7474,11 @@
     T .code:n = \str_set:Nn \l__nicematrix_vpos_block_str T ,
     b .code:n = \str_set:Nn \l__nicematrix_vpos_block_str b ,
     B .code:n = \str_set:Nn \l__nicematrix_vpos_block_str B ,
-    m .code:n = \str_set:Nn \l__nicematrix_vpos_block_str { c } ,
+    m .code:n = \str_set:Nn \l__nicematrix_vpos_block_str c ,
     m .value_forbidden:n = true ,
     v-center .meta:n = m ,
+    p .code:n = \bool_set_true:N \l__nicematrix_p_block_bool ,
+    p .value_forbidden:n = true ,
     name .tl_set:N = \l__nicematrix_block_name_str ,
     name .value_required:n = true ,
     name .initial:n = ,
@@ -7451,7 +7534,10 @@
     \int_compare:nNnT { #1 } = { #3 }
       { \str_set:Nn \l__nicematrix_vpos_block_str { t } }
     \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
-    \bool_if:NT \l__nicematrix_vlines_block_bool
+    \tl_if_in:nnT { #6 } { & } { \bool_set_true:N \l__nicematrix_ampersand_bool }
+    \bool_lazy_and:nnT
+      \l__nicematrix_vlines_block_bool
+      { ! \l__nicematrix_ampersand_bool }
       {
         \tl_gput_right:Nx \g_nicematrix_code_after_tl
           {
@@ -7555,195 +7641,315 @@
               { \exp_not:n { ##1 } } { \exp_not:n { ##2 } }
           }
       }
-    \hbox_set:Nn \l__nicematrix_cell_box { \set at color #6 }
-    \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
     \pgfpicture
+    \pgfrememberpicturepositiononpagetrue
+    \pgf at relevantforpicturesizefalse
+    \__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
+    \__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_last_row_int + 1 } }
+    \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at y
+    \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
+    \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at x
+    \__nicematrix_pgf_rect_node:nnnnn
+      { \__nicematrix_env: - #1 - #2 - block }
+      \l_tmpb_dim \l_tmpa_dim \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim
+    \str_if_empty:NF \l__nicematrix_block_name_str
+      {
+        \pgfnodealias
+          { \__nicematrix_env: - \l__nicematrix_block_name_str }
+          { \__nicematrix_env: - #1 - #2 - block }
+        \str_if_empty:NF \l__nicematrix_name_str
+          {
+            \pgfnodealias
+              { \l__nicematrix_name_str - \l__nicematrix_block_name_str }
+              { \__nicematrix_env: - #1 - #2 - block }
+          }
+      }
+    \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool
+      {
+        \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+        \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+          {
+            \cs_if_exist:cT
+              { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
+              {
+                \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
+                  {
+                    \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west }
+                    \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
+                  }
+              }
+          }
+        \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+          {
+            \__nicematrix_qpoint:n { col - #2 }
+            \dim_set_eq:NN \l_tmpb_dim \pgf at x
+          }
+        \dim_set:Nn \l__nicematrix_tmpd_dim { - \c_max_dim }
+        \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+          {
+            \cs_if_exist:cT
+              { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
+              {
+                \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
+                  {
+                    \pgfpointanchor
+                      { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
+                      { east }
+                    \dim_set:Nn \l__nicematrix_tmpd_dim { \dim_max:nn \l__nicematrix_tmpd_dim \pgf at x }
+                  }
+              }
+          }
+        \dim_compare:nNnT \l__nicematrix_tmpd_dim = { - \c_max_dim }
+          {
+            \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
+            \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at x
+          }
+        \__nicematrix_pgf_rect_node:nnnnn
+          { \__nicematrix_env: - #1 - #2 - block - short }
+          \l_tmpb_dim \l_tmpa_dim \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim
+      }
+    \bool_if:NT \l__nicematrix_medium_nodes_bool
+      {
+        \__nicematrix_pgf_rect_node:nnn
+          { \__nicematrix_env: - #1 - #2 - block - medium }
+          { \pgfpointanchor { \__nicematrix_env: - #1 - #2 - medium } { north~west } }
+          {
+            \pgfpointanchor
+              { \__nicematrix_env:
+                - \int_use:N \l__nicematrix_last_row_int
+                - \int_use:N \l__nicematrix_last_col_int - medium
+              }
+              { south~east }
+          }
+      }
+    \endpgfpicture
+  \bool_if:NTF \l__nicematrix_ampersand_bool
+    {
+      \seq_set_split:Nnn \l_tmpa_seq { & } { #6 }
+      \int_zero_new:N \l__nicematrix_split_int
+      \int_set:Nn \l__nicematrix_split_int { \seq_count:N \l_tmpa_seq }
+      \pgfpicture
       \pgfrememberpicturepositiononpagetrue
       \pgf at relevantforpicturesizefalse
       \__nicematrix_qpoint:n { row - #1 }
-      \dim_set_eq:NN \l_tmpa_dim \pgf at y
+      \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at y
+      \__nicematrix_qpoint:n { row - \int_eval:n { #3 + 1 } }
+      \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at y
       \__nicematrix_qpoint:n { col - #2 }
-      \dim_set_eq:NN \l_tmpb_dim \pgf at x
-      \__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_last_row_int + 1 } }
-      \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at y
-      \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
-      \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at x
-      \__nicematrix_pgf_rect_node:nnnnn
-        { \__nicematrix_env: - #1 - #2 - block }
-        \l_tmpb_dim \l_tmpa_dim \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim
-      \str_if_empty:NF \l__nicematrix_block_name_str
+      \dim_set_eq:NN \l_tmpa_dim \pgf at x
+      \__nicematrix_qpoint:n { col - \int_eval:n { #4 + 1 } }
+      \dim_set:Nn \l_tmpb_dim
+        { ( \pgf at x - \l_tmpa_dim ) / \int_use:N \l__nicematrix_split_int }
+      \bool_lazy_or:nnT
+        \l__nicematrix_vlines_block_bool
+        { \tl_if_eq_p:NN \l__nicematrix_vlines_clist \c__nicematrix_all_tl }
         {
-          \pgfnodealias
-            { \__nicematrix_env: - \l__nicematrix_block_name_str }
-            { \__nicematrix_env: - #1 - #2 - block }
-          \str_if_empty:NF \l__nicematrix_name_str
+          \int_step_inline:nn { \l__nicematrix_split_int - 1 }
             {
-              \pgfnodealias
-                { \l__nicematrix_name_str - \l__nicematrix_block_name_str }
-                { \__nicematrix_env: - #1 - #2 - block }
+              \pgfpathmoveto
+                {
+                  \pgfpoint
+                    { \l_tmpa_dim + ##1 \l_tmpb_dim }
+                    \l__nicematrix_tmpc_dim
+                }
+              \pgfpathlineto
+                {
+                  \pgfpoint
+                    { \l_tmpa_dim + ##1 \l_tmpb_dim }
+                    \l__nicematrix_tmpd_dim
+                }
+              \CT at arc@
+              \pgfsetlinewidth { 1.1 \arrayrulewidth }
+              \pgfsetrectcap
+              \pgfusepathqstroke
             }
         }
-      \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool
+      \__nicematrix_qpoint:n { row - #1 - base }
+      \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at y
+      \int_step_inline:nn \l__nicematrix_split_int
         {
-          \dim_set_eq:NN \l_tmpb_dim \c_max_dim
-          \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+          \group_begin:
+          \dim_set:Nn \col at sep
+            { \bool_if:NTF \l__nicematrix_tabular_bool \tabcolsep \arraycolsep }
+          \pgftransformshift
             {
-              \cs_if_exist:cT
-                { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
+              \pgfpoint
                 {
-                  \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
+                  \str_case:on \l__nicematrix_hpos_block_str
                     {
-                      \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west }
-                      \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
+                      l { \l_tmpa_dim + ##1 \l_tmpb_dim - \l_tmpb_dim + \col at sep}
+                      c { \l_tmpa_dim + ##1 \l_tmpb_dim - 0.5 \l_tmpb_dim }
+                      r { \l_tmpa_dim + ##1 \l_tmpb_dim - \col at sep }
                     }
                 }
+                { \l__nicematrix_tmpc_dim }
             }
-          \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+          \pgfset
             {
-              \__nicematrix_qpoint:n { col - #2 }
-              \dim_set_eq:NN \l_tmpb_dim \pgf at x
+              inner~xsep = \c_zero_dim ,
+              inner~ysep = \c_zero_dim
             }
-          \dim_set:Nn \l__nicematrix_tmpd_dim { - \c_max_dim }
-          \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+          \pgfnode
+            { rectangle }
             {
-              \cs_if_exist:cT
-                { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
+              \str_case:on \l__nicematrix_hpos_block_str
                 {
-                  \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
-                    {
-                      \pgfpointanchor
-                        { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
-                        { east }
-                      \dim_set:Nn \l__nicematrix_tmpd_dim { \dim_max:nn \l__nicematrix_tmpd_dim \pgf at x }
-                    }
+                  c { base }
+                  l { base~west }
+                  r { base~east }
                 }
             }
-          \dim_compare:nNnT \l__nicematrix_tmpd_dim = { - \c_max_dim }
-            {
-              \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
-              \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at x
-            }
-          \__nicematrix_pgf_rect_node:nnnnn
-            { \__nicematrix_env: - #1 - #2 - block - short }
-            \l_tmpb_dim \l_tmpa_dim \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim
+            { \seq_item:Nn \l_tmpa_seq { ##1 } } { } { }
+           \group_end:
         }
-    \bool_if:NT \l__nicematrix_medium_nodes_bool
-      {
-        \__nicematrix_pgf_rect_node:nnn
-          { \__nicematrix_env: - #1 - #2 - block - medium }
-          { \pgfpointanchor { \__nicematrix_env: - #1 - #2 - medium } { north~west } }
-          {
-            \pgfpointanchor
-              { \__nicematrix_env:
-                - \int_use:N \l__nicematrix_last_row_int
-                - \int_use:N \l__nicematrix_last_col_int - medium
+      \endpgfpicture
+    }
+    {
+      \bool_if:NTF \l__nicematrix_p_block_bool
+        {
+            \pgfpicture
+              \pgfrememberpicturepositiononpagetrue
+              \pgf at relevantforpicturesizefalse
+              \bool_if:NTF \l__nicematrix_hpos_of_block_cap_bool
+                {
+                  \__nicematrix_qpoint:n { col - #2 }
+                  \dim_gset_eq:NN \g_tmpa_dim \pgf at x
+                  \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
+                }
+                {
+                  \pgfpointanchor { \__nicematrix_env: - #1 - #2 - block - short } { west }
+                  \dim_gset_eq:NN \g_tmpa_dim \pgf at x
+                  \pgfpointanchor { \__nicematrix_env: - #1 - #2 - block - short } { east }
+                }
+              \dim_gset:Nn \g_tmpb_dim { \pgf at x - \g_tmpa_dim }
+            \endpgfpicture
+            \hbox_set:Nn \l__nicematrix_cell_box
+              {
+                \begin { minipage } [ \str_lowercase:o \l__nicematrix_vpos_block_str ]
+                  { \g_tmpb_dim }
+                \str_case:on \l__nicematrix_hpos_block_str
+                  { c \centering r \raggedleft l \raggedright j { } }
+                #6
+                \end { minipage }
               }
-              { south~east }
           }
-      }
-    \bool_lazy_any:nTF
-      {
-        { \str_if_eq_p:on \l__nicematrix_vpos_block_str { c } }
-        { \str_if_eq_p:on \l__nicematrix_vpos_block_str { T } }
-        { \str_if_eq_p:on \l__nicematrix_vpos_block_str { B } }
-      }
-      {
-        \int_if_zero:nT { #2 } { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_r_str }
-        \bool_if:nT \g__nicematrix_last_col_found_bool
+          { \hbox_set:Nn \l__nicematrix_cell_box { \set at color #6 } }
+        \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
+        \pgfpicture
+        \pgfrememberpicturepositiononpagetrue
+        \pgf at relevantforpicturesizefalse
+        \bool_lazy_any:nTF
           {
-            \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int
-              { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_l_str }
+            { \str_if_eq_p:on \l__nicematrix_vpos_block_str { c } }
+            { \str_if_eq_p:on \l__nicematrix_vpos_block_str { T } }
+            { \str_if_eq_p:on \l__nicematrix_vpos_block_str { B } }
           }
-        \tl_set:Nx \l_tmpa_tl
           {
-            \str_case:on \l__nicematrix_vpos_block_str
+            \int_if_zero:nT { #2 } { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_r_str }
+            \bool_if:nT \g__nicematrix_last_col_found_bool
               {
-                c {
-                    \str_case:on \l__nicematrix_hpos_block_str
-                      {
-                        c { center }
-                        l { west }
-                        r { east }
+                \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int
+                  { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_l_str }
+              }
+            \tl_set:Nx \l_tmpa_tl
+              {
+                \str_case:on \l__nicematrix_vpos_block_str
+                  {
+                    c {
+                        \str_case:on \l__nicematrix_hpos_block_str
+                          {
+                            c { center }
+                            l { west }
+                            r { east }
+                            j { center }
+                          }
+
                       }
+                    T {
+                        \str_case:on \l__nicematrix_hpos_block_str
+                          {
+                            c { north }
+                            l { north~west }
+                            r { north~east }
+                            j { north }
+                          }
 
-                  }
-                T {
-                    \str_case:on \l__nicematrix_hpos_block_str
-                      {
-                        c { north }
-                        l { north~west }
-                        r { north~east }
                       }
+                    B {
+                        \str_case:on \l__nicematrix_hpos_block_str
+                          {
+                            c { south }
+                            l { south~west }
+                            r { south~east }
+                            j { south }
+                          }
 
-                  }
-                B {
-                    \str_case:on \l__nicematrix_hpos_block_str
-                      {
-                        c { south}
-                        l { south~west }
-                        r { south~east }
                       }
-
                   }
               }
+            \pgftransformshift
+              {
+                \pgfpointanchor
+                  {
+                    \__nicematrix_env: - #1 - #2 - block
+                    \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
+                  }
+                  { \l_tmpa_tl }
+              }
+            \pgfset
+              {
+                inner~xsep = \c_zero_dim ,
+                inner~ysep = \c_zero_dim
+              }
+            \pgfnode
+              { rectangle }
+              { \l_tmpa_tl }
+              { \box_use_drop:N \l__nicematrix_cell_box } { } { }
           }
-        \pgftransformshift
           {
+            \pgfextracty \l_tmpa_dim
+              {
+                \__nicematrix_qpoint:n
+                  {
+                    row - \str_if_eq:onTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
+                    - base
+                  }
+              }
+            \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
             \pgfpointanchor
               {
                 \__nicematrix_env: - #1 - #2 - block
                 \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
               }
-              { \l_tmpa_tl }
-          }
-        \pgfset
-          {
-            inner~xsep = \c_zero_dim ,
-            inner~ysep = \c_zero_dim
-          }
-        \pgfnode
-          { rectangle }
-          { \l_tmpa_tl }
-          { \box_use_drop:N \l__nicematrix_cell_box } { } { }
-      }
-      {
-        \pgfextracty \l_tmpa_dim
-          {
-            \__nicematrix_qpoint:n
               {
-                row - \str_if_eq:onTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
-                - base
+                \str_case:on \l__nicematrix_hpos_block_str
+                  {
+                    c { center }
+                    l { west }
+                    r { east }
+                    j { center }
+                  }
               }
-          }
-        \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
-        \pgfpointanchor
-          {
-            \__nicematrix_env: - #1 - #2 - block
-            \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
-          }
-          {
-            \str_case:on \l__nicematrix_hpos_block_str
+            \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
+            \pgfset { inner~sep = \c_zero_dim }
+            \pgfnode
+              { rectangle }
               {
-                c { center }
-                l { west }
-                r { east }
+                 \str_case:on \l__nicematrix_hpos_block_str
+                  {
+                    c { base }
+                    l { base~west }
+                    r { base~east }
+                    j { base }
+                  }
               }
+              { \box_use_drop:N \l__nicematrix_cell_box } { } { }
           }
-        \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
-        \pgfset { inner~sep = \c_zero_dim }
-        \pgfnode
-          { rectangle }
-          {
-             \str_case:on \l__nicematrix_hpos_block_str
-              {
-                c { base }
-                l { base~west }
-                r { base~east }
-              }
-          }
-          { \box_use_drop:N \l__nicematrix_cell_box } { } { }
+        \endpgfpicture
       }
-    \endpgfpicture
     \group_end:
   }
 \cs_new_protected:Npn \__nicematrix_stroke_block:nnn #1 #2 #3
@@ -8886,9 +9092,9 @@
   }
 \NewDocumentCommand \__nicematrix_ShowCellNames_CodeBefore { }
  {
-   \dim_zero_new:N \g__nicematrix_tmpc_dim
-   \dim_zero_new:N \g__nicematrix_tmpd_dim
-   \dim_zero_new:N \g__nicematrix_tmpe_dim
+   \dim_gzero_new:N \g__nicematrix_tmpc_dim
+   \dim_gzero_new:N \g__nicematrix_tmpd_dim
+   \dim_gzero_new:N \g__nicematrix_tmpe_dim
    \int_step_inline:nn \c at iRow
      {
        \begin { pgfpicture }
@@ -8969,9 +9175,9 @@
        \pgfusepathqfill
        \endpgfpicture
      }
-   \dim_zero_new:N \g__nicematrix_tmpc_dim
-   \dim_zero_new:N \g__nicematrix_tmpd_dim
-   \dim_zero_new:N \g__nicematrix_tmpe_dim
+   \dim_gzero_new:N \g__nicematrix_tmpc_dim
+   \dim_gzero_new:N \g__nicematrix_tmpd_dim
+   \dim_gzero_new:N \g__nicematrix_tmpe_dim
    \int_step_inline:nn \c at iRow
      {
        \bool_if:NTF \l__nicematrix_in_code_after_bool
@@ -9221,6 +9427,12 @@
     The~columns~you~did~not~used~won't~be~created.\\
     You~won't~have~similar~error~message~till~the~end~of~the~document.
   }
+\__nicematrix_msg_new:nn { empty~preamble }
+  {
+    Empty~preamble.\\
+    The~preamble~of~your~\__nicematrix_full_name_env:\ is~empty.\\
+    This~error~is~fatal.
+  }
 \__nicematrix_msg_new:nn { in~first~col }
   {
     Erroneous~use.\\
@@ -9393,7 +9605,7 @@
     Incompatible~keys.\\
     You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~
     '\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\
-    Maybe~it~will~possible~in~future~version.\\
+    However,~you~can~put~several~commands~\token_to_str:N \Block.\\
     Your~key~will~be~discarded.
   }
 \__nicematrix_msg_new:nn { bad~value~for~baseline }
@@ -9422,7 +9634,7 @@
 \__nicematrix_msg_new:nn { ragged2e~not~loaded }
   {
     You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~
-    your~column~'\l__nicematrix_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:V
+    your~column~'\l__nicematrix_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:o
     \l_keys_key_str'~will~be~used~instead.
   }
 \__nicematrix_msg_new:nn { Invalid~name }
@@ -9880,6 +10092,7 @@
     create-extra-nodes,~
     create-medium-nodes,~
     create-large-nodes,~
+    custom-line,~
     delimiters~(several~subkeys),~
     end-of-row,~
     first-col,~



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