texlive[60042] Master/texmf-dist: nicematrix (24jul21)

commits+karl at tug.org commits+karl at tug.org
Sat Jul 24 22:47:43 CEST 2021


Revision: 60042
          http://tug.org/svn/texlive?view=revision&revision=60042
Author:   karl
Date:     2021-07-24 22:47:43 +0200 (Sat, 24 Jul 2021)
Log Message:
-----------
nicematrix (24jul21)

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

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

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2021-07-24 20:47:27 UTC (rev 60041)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2021-07-24 20:47:43 UTC (rev 60042)
@@ -29,8 +29,6 @@
 \titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
 \titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex}
 
-\usepackage{multicol}
-\setlength{\columnseprule}{0.4pt}
 \def\LetterAt{@}
 
 \def\interitem{\vspace{7mm plus 2 mm minus 3mm}}          
@@ -524,7 +522,7 @@
 couleur (la valeur par défaut de cette clé est la couleur courante des filets du
 tableau) ;
 \item la clé |color| prend en argument une couleur et l'applique au contenu et
-trace également le cadre avec cette couleur.
+trace également le cadre avec cette couleur ;
 \item la clé |line-width| fixe la largeur des filets servant pour le cadre (n'a
 d'intérêt que si |draw| ou |hvlines| est utilisée) ;
 \item la clé |rounded-corners| impose des coins arrondis (pour le cadre dessiné
@@ -536,7 +534,15 @@
 |right|, |top| et |bottom| ;
 \item les clés |t| et |b| réglent la ligne de base qui sera donnée au bloc quand
 celui-ci est constitué de plusieurs lignes (séparées par la commande |\\|) ;
-\item la clé |hvlines| trace tous les filets horizontaux et verticaux dans le bloc.
+\item la clé |hvlines| trace tous les filets horizontaux et verticaux dans le
+bloc ;
+\item \colorbox{yellow!50}{\textbf{Nouveau 5.19}}\enskip quand la clé |tikz| est
+utilisée, le chemin Tikz correspondant au rectangle délimitant le bloc est
+exécuté avec Tikz\footnote{Tikz doit être chargé préalablement (par défaut,
+  \pkg{nicematrix} ne charge que \textsc{pgf}), faute de quoi, une erreur sera
+  levée.} en utilisant comme options la valeur de cette clé |tikz| (qui doit
+donc être une liste de clés Tikz applicables à un chemin de Tikz). Pour des
+exemple d'utilisation de cette clé |tikz|, voir p.~\pageref{tikz-key-examples}.
 \end{itemize}
 
 
@@ -932,7 +938,7 @@
 Les outils proposés par \pkg{nicematrix} pour tracer des filets sont les
 suivants :
 \begin{itemize}
-\item les clés |hlines|, |vlines| et |hvlines| ;
+\item les clés |hlines|, |vlines|, |hvlines| et |hvlines-except-borders|;
 \item le spécificateur «\verb+|+» dans le préambule (pour les environnements à
 préambule) ;
 \item la commande |\Hline|.
@@ -986,7 +992,7 @@
 
 
 
-\subsubsection{La clé hvlines}
+\subsubsection{Les clés hvlines et hvlines-except-borders}
 \label{hvlines}
 
 La clé |hvlines|, qui ne prend pas de valeur, est la conjonction des clés
@@ -1739,7 +1745,7 @@
 
 \colorbox{yellow!50}{\bfseries Nouveau 5.18}\enskip La commande |\RowStyle|
 prend en argument des instructions de mise en forme qui seront appliquées à
-chacune des cellules restantes sur la rangée en cours.
+chacune des cases restantes sur la rangée en cours.
 
 \medskip
 Elle prend aussi en premier argument optionnel, entre crochets, une liste de
@@ -2902,8 +2908,8 @@
 \begin{scope}
 \fvset{commandchars=\~\#\!}
 \begin{Verbatim}
-\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-\toprule
+\begin{NiceTabular}{@{}llr@{}}
+\toprule \RowStyle{\bfseries}
 Nom & Prénom & Date de naissance \\
 \midrule
 Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}!
@@ -2918,8 +2924,8 @@
 \end{scope}
 
 \begin{center}
-\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-\toprule
+\begin{NiceTabular}{@{}llr@{}}
+\toprule \RowStyle{\bfseries}
 Nom & Prénom & Date de naissance \\
 \midrule
 Achard\tabularnote{La famille Achard est une très ancienne famille du Poitou.} 
@@ -3844,11 +3850,11 @@
 Les nœuds que l'on vient de décrire ne sont pas accessibles par défaut dans le
 |\CodeBefore| (décrit p.~\pageref{code-before}). \par\nobreak
 
-\colorbox{yellow!50}{\textbf{Nouveau 5.16}}\enskip On peut rendre ces nœuds
-accessibles dans le |\CodeBefore| en utilisant la clé |create-cell-nodes| du
-mot-clé |\CodeBefore| (dans ce cas-là, les nœuds sont créés une première fois
-avant la construction du tableau en utilisant des informations écrites dans le
-fichier |aux| puis recréés lors de la composition du tableau proprement dit).
+On peut rendre ces nœuds accessibles dans le |\CodeBefore| en utilisant la clé
+|create-cell-nodes| du mot-clé |\CodeBefore| (dans ce cas-là, les nœuds sont
+créés une première fois avant la construction du tableau en utilisant des
+informations écrites dans le fichier |aux| puis recréés lors de la composition
+du tableau proprement dit).
 
 
 \subsection{Les nœuds indiquant la position des filets}
@@ -4294,6 +4300,44 @@
 
 \section{Exemples}
 
+\subsection{Utilisation de la clé «tikz» de la commande \textbackslash Block}
+
+\label{tikz-key-examples}
+
+
+\begin{Verbatim}
+\ttfamily \small
+\begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines]
+  \Block[~emphase#tikz={pattern=grid,pattern color=lightgray}@]{}
+    {pattern = grid,\\ pattern color = lightgray}
+& \Block[~emphase#tikz={pattern = north west lines,pattern color=blue}@]{}
+    {pattern = north west lines,\\ pattern color = blue}
+& \Block[~emphase#tikz={outer color = red!50, inner color=white }@]{2-1}
+    {outer color = red!50,\\ inner color = white} \\
+  \Block[~emphase#tikz={pattern = sixpointed stars, pattern color = blue!15}@]{}
+    {pattern = sixpointed stars,\\ pattern color = blue!15}
+& \Block[~emphase#tikz={left color = blue!50}@]{}
+    {left color = blue!50} \\
+\end{NiceTabular}
+\end{Verbatim}
+
+\begin{center}
+\ttfamily \small
+\begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines]
+  \Block[tikz={pattern=grid,pattern color=lightgray}]{}
+    {pattern = grid,\\ pattern color = lightgray}
+& \Block[tikz={pattern = north west lines,pattern color=blue}]{}
+    {pattern = north west lines,\\ pattern color = blue}
+& \Block[tikz={outer color = red!50, inner color=white }]{2-1}
+    {outer color = red!50,\\ inner color = white} \\
+  \Block[tikz={pattern = sixpointed stars, pattern color = blue!15}]{}
+    {pattern = sixpointed stars,\\ pattern color = blue!15}
+& \Block[tikz={left color = blue!50}]{}
+    {left color = blue!50} \\
+\end{NiceTabular}
+\end{center}
+
+
 \subsection{Notes dans les tableaux}
 
 \label{ex:notes}
@@ -4362,8 +4406,8 @@
 \ExplSyntaxOff
 \fvset{commandchars=\~\#\!}
 \begin{Verbatim}
-\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-\toprule
+\begin{NiceTabular}{@{}llr@{}}
+\toprule \RowStyle{\bfseries}
 Nom & Prénom & Date de naissance \\
 \midrule
 Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}!
@@ -4377,8 +4421,8 @@
 \end{Verbatim}
 
 \begin{center}
-\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-\toprule
+\begin{NiceTabular}{@{}llr@{}}
+\toprule \RowStyle{\bfseries}
 Nom & Prénom & Date de naissance \\
 \midrule
 Achard\tabularnote{La famille Achard est une très ancienne famille du Poitou.} 

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

Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2021-07-24 20:47:27 UTC (rev 60041)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2021-07-24 20:47:43 UTC (rev 60042)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{5.18}
-\def\myfiledate{2021/07/15}
+\def\myfileversion{5.19}
+\def\myfiledate{2021/07/23}
 %
 %
 %<*batchfile>
@@ -65,8 +65,6 @@
 \usepackage{titlesec}
 \titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
 \titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex}
-\usepackage{multicol}
-\setlength{\columnseprule}{0.4pt}
 \usepackage{footnotehyper}
 \usepackage{varwidth}
 \def\LetterAt{@}
@@ -160,7 +158,7 @@
 % The package \pkg{nicematrix} is entirely contained in the file
 % |nicematrix.sty|. This file may be put in the current directory or in a
 % |texmf| tree. However, the best is to install \pkg{nicematrix} with a TeX
-% distribution as MiKTeX, TeXlive or MacTeX.
+% distribution such as MiKTeX, TeXlive or MacTeX.
 %
 % \bigskip
 % \emph{Remark}: If you use LaTeX via Internet with, for example, Overleaf, you
@@ -583,7 +581,15 @@
 % by |left|, |right|, |top| and |bottom|;
 % \item the keys |t| and |b| fix the base line that will be given to the block
 % when it has a multi-line content (the lines are separated by |\\|);
-% \item the keys |hvlines| draws all the vertical and horizontal rules in the block.
+% \item the keys |hvlines| draws all the vertical and horizontal rules in the
+% block;
+% \item \colorbox{yellow!50}{\textbf{New 5.19}}\enskip when the key |tikz| is
+% used, the Tikz path corresponding of the rectangle which delimits the block is
+% executed with Tikz\footnote{Tikz should be loaded (by default,
+% \pkg{nicematrix} only loads \textsc{pgf}) and, 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). For examples, cf.
+% p.~\pageref{tikz-key-examples}.
 % \end{itemize}
 % 
 % \interitem
@@ -955,7 +961,7 @@
 %
 % Here are the tools provided by \pkg{nicematrix} for the rules.
 % \begin{itemize}
-% \item the keys |hlines|, |vlines| and |hvlines|;
+% \item the keys |hlines|, |vlines|, |hvlines| and |hvlines-except-borders|;
 % \item the specifier ``\verb+|+'' in the preamble (for the environments with
 % preamble);
 % \item the command |\Hline|.
@@ -967,7 +973,7 @@
 % \begin{itemize} 
 % \item These blocks are:
 % \begin{itemize}
-% \item the blocks created by the command |\Block|\footnote{And also the command \verb|\multicolumn| also
+% \item the blocks created by the command |\Block|\footnote{And also the command \verb|\multicolumn| but
 % it's recommended to use instead |\Block| in the environments of
 % \pkg{nicematrix}.} presented
 % p.~\pageref{Block};
@@ -1007,7 +1013,7 @@
 %
 %
 %
-% \subsubsection{The key hvlines}
+% \subsubsection{The keys hvlines and hvlines-except-borders}
 % \label{hvlines}
 %
 % The key |hvlines| (no value) is the conjonction of the keys |hlines| and |vlines|.
@@ -1035,7 +1041,7 @@
 %
 % \bigskip
 % \colorbox{yellow!50}{\bfseries New 5.17}\enskip The key
-% |hvlines-except-corners| is similar to the key |hvlines| but does not draw the
+% |hvlines-except-borders| is similar to the key |hvlines| but does not draw the
 % rules on the horizontal and vertical borders of the array.
 %
 % \subsubsection{The (empty) corners}
@@ -1438,7 +1444,7 @@
 % \begin{BVerbatim}[boxwidth=9cm,baseline=c]
 % $\begin{NiceArray}{lll}[hvlines] 
 % \CodeBefore
-%   ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@
+%   ~emphase#\rowcolor{red!15}{1,3-5,8-}@
 % \Body
 % a_1 & b_1 & c_1 \\
 % a_2 & b_2 & c_2 \\
@@ -2670,7 +2676,7 @@
 % \bigskip
 % \colorbox{yellow!50}{\bfseries New 5.18}\enskip In fact, the command
 % |\SubMatrix| also takes in two optional arguments specified by the
-% traditionnal symbols |^| and |_| for material in superscript and subscript.
+% traditional symbols |^| and |_| for material in superscript and subscript.
 %
 % \medskip
 % \begin{scope}
@@ -2697,7 +2703,7 @@
 % \bigskip
 % The options of the command |\SubMatrix| are as follows:
 % \begin{itemize}
-% \item |left-xshift| and |right-shift| shift horizontally the delimiters (there
+% \item |left-xshift| and |right-xshift| shift horizontally the delimiters (there
 % exists also the key |xshift| which fixes both parameters);
 % \item |extra-height| adds a quantity to the total height of the delimiters
 % (height |\ht| + depth |\dp|);
@@ -2869,8 +2875,8 @@
 % \begin{scope}
 % \fvset{commandchars=\~\#\!}
 % \begin{Verbatim}
-% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-% \toprule
+% \begin{NiceTabular}{@{}llr@{}}
+% \toprule \RowStyle{\bfseries}
 % Last name & First name & Birth day \\
 % \midrule
 % Achard\tabularnote{~emphase#Achard is an old family of the Poitou.!} 
@@ -2885,8 +2891,8 @@
 % \end{scope}
 % 
 % \begin{center}
-% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-% \toprule
+% \begin{NiceTabular}{@{}llr@{}}
+% \toprule \RowStyle{\bfseries}
 % Last name & First name & Birth day \\
 % \midrule
 % Achard\tabularnote{Achard is an old family of the Poitou.} 
@@ -3796,11 +3802,11 @@
 % The nodes we have described are not available by default in the |\CodeBefore|
 % (described p.~\pageref{code-before}).\par\nobreak
 %
-% \colorbox{yellow!50}{\textbf{New 5.16}}\enskip It's possible to have these
-% nodes available in the |\CodeBefore| by using the key |create-cell-nodes| of
-% the keyword |\CodeBefore| (in that case, the nodes are created first before
-% the construction of the array by using informations written on the |aux| file
-% and created a second time during the contruction of the array itself).
+% It's possible to have these nodes available in the |\CodeBefore| by using the
+% key |create-cell-nodes| of the keyword |\CodeBefore| (in that case, the nodes
+% are created first before the construction of the array by using informations
+% written on the |aux| file and created a second time during the contruction of
+% the array itself).
 % 
 % \subsection{The nodes which indicate the position of the rules}
 %
@@ -4232,6 +4238,43 @@
 % 
 % \section{Examples}
 %
+% \subsection{Utilisation of the key ``tikz'' of the command \textbackslash Block}
+%\label{tikz-key-examples}
+%
+%
+% \begin{Verbatim}
+% \ttfamily \small
+% \begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines]
+%   \Block[~emphase#tikz={pattern=grid,pattern color=lightgray}@]{}
+%     {pattern = grid,\\ pattern color = lightgray}
+% & \Block[~emphase#tikz={pattern = north west lines,pattern color=blue}@]{}
+%     {pattern = north west lines,\\ pattern color = blue}
+% & \Block[~emphase#tikz={outer color = red!50, inner color=white }@]{2-1}
+%     {outer color = red!50,\\ inner color = white} \\
+%   \Block[~emphase#tikz={pattern = sixpointed stars, pattern color = blue!15}@]{}
+%     {pattern = sixpointed stars,\\ pattern color = blue!15}
+% & \Block[~emphase#tikz={left color = blue!50}@]{}
+%     {left color = blue!50} \\
+% \end{NiceTabular}
+% \end{Verbatim}
+%
+% \begin{center}
+% \ttfamily \small
+% \begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines]
+%   \Block[tikz={pattern=grid,pattern color=lightgray}]{}
+%     {pattern = grid,\\ pattern color = lightgray}
+% & \Block[tikz={pattern = north west lines,pattern color=blue}]{}
+%     {pattern = north west lines,\\ pattern color = blue}
+% & \Block[tikz={outer color = red!50, inner color=white }]{2-1}
+%     {outer color = red!50,\\ inner color = white} \\
+%   \Block[tikz={pattern = sixpointed stars, pattern color = blue!15}]{}
+%     {pattern = sixpointed stars,\\ pattern color = blue!15}
+% & \Block[tikz={left color = blue!50}]{}
+%     {left color = blue!50} \\
+% \end{NiceTabular}
+% \end{center}
+%
+%
 % \subsection{Notes in the tabulars}
 %
 % \label{ex:notes}
@@ -4302,8 +4345,8 @@
 %   }
 % \ExplSyntaxOff
 % \begin{Verbatim}
-% \begin{NiceTabular}{~@{}llr~@{}}[first-row,code-for-first-row = \bfseries]
-% \toprule
+% \begin{NiceTabular}{~@{}llr~@{}}
+% \toprule \RowStyle{\bfseries}
 % Last name & First name & Birth day \\
 % \midrule
 % Achard\tabularnote{~emphase#Achard is an old family of the Poitou.@} 
@@ -4317,8 +4360,8 @@
 % \end{Verbatim}
 %
 % \begin{center}
-% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
-% \toprule
+% \begin{NiceTabular}{@{}llr@{}}
+% \toprule \RowStyle{\bfseries}
 % Last name & First name & Birth day \\
 % \midrule
 % Achard\tabularnote{Achard is an old family of the Poitou.} 
@@ -5002,7 +5045,8 @@
 %    \end{macrocode}
 %
 % 
-% We give the traditional declaration of a package written with |expl3|:
+% We give the traditional declaration of a package written with the L3
+% programming layer. 
 %    \begin{macrocode}
 \RequirePackage{l3keys2e}
 \ProvidesExplPackage
@@ -5250,10 +5294,6 @@
   } 
 %    \end{macrocode}
 % 
-% We need that line for the case where you use \verb+||+ with \pkg{colortbl} loaded.
-%    \begin{macrocode}
-\cs_set_protected:Npn \CT at drsc@ { }
-%    \end{macrocode}
 %
 % \bigskip 
 % We have to redefine |\cline| for several reasons. The command |\@@_cline| will
@@ -5478,7 +5518,8 @@
 % For compatibility with versions prior to 5.0, we provide a load-time option
 % |define_L_C_R|. With this option, it's possible to use the letters |L|, |C|
 % and |R| instead of |l|, |c| and |r| in the preamble of the environments of
-% \pkg{nicematrix} as it was mandatory before version~5.0.
+% \pkg{nicematrix} as it was mandatory before version~5.0. This key will
+% probably be deleted in a future version.
 %    \begin{macrocode}
 \bool_new:N \c_@@_define_L_C_R_bool
 %    \end{macrocode}
@@ -5639,6 +5680,7 @@
 \tl_new:N \g_@@_aux_tl
 %    \end{macrocode}  
 % 
+%
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_test_if_math_mode:
@@ -5743,7 +5785,22 @@
 \tl_new:N \l_@@_rules_color_tl
 %    \end{macrocode}
 %
+% \bigskip
+% The number of letters |X| in the preamble of the array.
+%    \begin{macrocode}
+\int_new:N \g_@@_nb_of_X_int
+%    \end{macrocode}
 % 
+% If there is at least one |X|-column in the preamble of the array, the
+% following flag will be raised via the |aux| file. The length
+% |l_@@_x_columns_dim| will be the width of the |X|-columns. That value is
+% computed after the contruction of the array during the first compilation in
+% order to be used in the following run.
+%    \begin{macrocode}
+\bool_new:N \l_@@_X_columns_aux_bool
+\dim_new:N \l_@@_X_columns_dim
+%    \end{macrocode}
+% 
 % \bigskip
 % This boolean will be used only to detect in an expandable way whether we are
 % at the beginning of the (potential) column zero, in order to raise an error if
@@ -5805,9 +5862,9 @@
 %    \end{macrocode}
 % 
 % \bigskip
-% \pkg{expl3} provides scratch dimensions |\l_tmpa_dim| and |\l_tmpb_dim|. We
-% creates two more in the same spirit (if they don't exist yet: that's why we
-% use |\dim_zero_new:N|).
+% The L3 programming layer provides scratch dimensions |\l_tmpa_dim| and
+% |\l_tmpb_dim|. We creates two more in the same spirit (if they don't exist
+% yet: that's why we use |\dim_zero_new:N|).
 %    \begin{macrocode}
 \dim_zero_new:N \l_tmpc_dim 
 \dim_zero_new:N \l_tmpd_dim
@@ -5933,11 +5990,12 @@
 %    \end{macrocode}
 % 
 % \medskip 
-% The following parameters correspond to the keys |fill|, |draw|, |borders| and 
-% |rounded-corners| of the command |\Block|.
+% The following parameters correspond to the keys |fill|, |draw|, |tikz|, |borders|,
+% and |rounded-corners| of the command |\Block|.
 %    \begin{macrocode}
 \tl_new:N \l_@@_fill_tl
 \tl_new:N \l_@@_draw_tl
+\seq_new:N \l_@@_tikz_seq
 \clist_new:N \l_@@_borders_clist
 \dim_new:N \l_@@_rounded_corners_dim
 %    \end{macrocode}
@@ -5946,8 +6004,7 @@
 % |corners| is used). 
 % 
 % \medskip
-% The following token list correspond to the key |color| of the command
-% |\Block|. 
+% The following token list correspond to the key |color| of the command |\Block|. 
 %    \begin{macrocode}
 \tl_new:N \l_@@_color_tl
 %    \end{macrocode}
@@ -7126,8 +7183,14 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_Cell:
   { 
-    \tl_gclear:N \g_@@_exit_cell_tl
 %    \end{macrocode}
+% The token list |\g_@@_post_treatment_cell_tl| will be set during the
+% composition of the box |\l_@@_cell_box| and will be used \emph{after} the
+% composition in order to modify that box (that's why it's called a
+% \emph{post-treatment}). 
+%    \begin{macrocode}
+    \tl_gclear:N \g_@@_post_treatment_cell_tl
+%    \end{macrocode}
 % At the beginning of the cell, we link |\CodeAfter| to a command which do
 % \emph{not} begin with |\omit| (whereas the standard version of |\CodeAfter|
 % begins with |\omit|).
@@ -7285,7 +7348,12 @@
   { 
     \@@_math_toggle_token: 
     \hbox_set_end:
-    \g_@@_exit_cell_tl
+%    \end{macrocode}
+% The token list |\g_@@_post_treatment_cell_tl| is (potentially) set during the 
+% composition of the box |\l_@@_cell_box| and is used now \emph{after} the
+% composition in order to modify that box.
+%    \begin{macrocode}
+    \g_@@_post_treatment_cell_tl
     \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
     \@@_adjust_size_box:
 %    \end{macrocode}
@@ -8044,7 +8112,7 @@
       { 
         \tl_gput_right:Nn \g_@@_row_style_tl
           {
-            \tl_gput_right:Nn \g_@@_exit_cell_tl 
+            \tl_gput_right:Nn \g_@@_post_treatment_cell_tl 
               { \dim_set:Nn \l_@@_cell_space_top_limit_dim { #1 } }
           }
       } ,
@@ -8053,7 +8121,7 @@
       { 
         \tl_gput_right:Nn \g_@@_row_style_tl
           {
-            \tl_gput_right:Nn \g_@@_exit_cell_tl 
+            \tl_gput_right:Nn \g_@@_post_treatment_cell_tl 
               { \dim_set:Nn \l_@@_cell_space_bottom_limit_dim { #1 } }
           }
       } ,
@@ -8439,6 +8507,29 @@
 % End of the construction of the array (in the box |\l_@@_the_array_box|).
 %
 % \bigskip
+% Now, if there is at least one |X|-column in the environment, we compute the
+% width that those columns will have (in the next compilation).
+%    \begin{macrocode}
+    \int_compare:nNnT \g_@@_nb_of_X_int > 0 
+      { 
+        \bool_if:NTF \l_@@_X_columns_aux_bool 
+          { \dim_set_eq:NN \l_tmpa_dim \l_@@_X_columns_dim }
+          {
+            \dim_set:Nn \l_tmpa_dim 
+              { 
+                ( \textwidth - \box_wd:N \l_@@_the_array_box ) 
+                / \int_use:N \g_@@_nb_of_X_int 
+              } 
+          }
+        \tl_gput_right:Nx \g_@@_aux_tl
+          {
+            \bool_set_true:N \l_@@_X_columns_aux_bool
+            \dim_set:Nn \l_@@_X_columns_dim { \dim_use:N \l_tmpa_dim } 
+          }
+      }
+%    \end{macrocode}
+% 
+% \bigskip
 % It the user has used the key |last-row| with a value, we control that the
 % given value is correct (since we have just constructed the array, we know the
 % real number of rows of the array).
@@ -8626,10 +8717,11 @@
 % current environment.
 %    \begin{macrocode}
     \iow_now:Nn \@mainaux { \ExplSyntaxOn }
+    \iow_now:Nn \@mainaux { \char_set_catcode_space:n { 32 }  }
     \iow_now:Nx \@mainaux 
       {
         \tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl } 
-          \iow_newline: { \iow_newline: \exp_not:V \g_@@_aux_tl } 
+          { \exp_not:V \g_@@_aux_tl } 
       }
     \iow_now:Nn \@mainaux { \ExplSyntaxOff }
 %    \end{macrocode}
@@ -8660,7 +8752,7 @@
 % using |\newcolumntype|).
 %
 % Since we use the tools of \pkg{array} to do this expansion, we will have a
-% programmation which is not in the style of \pkg{expl3}.
+% programmation which is not in the style of the L3 programming layer.
 % 
 %
 % \bigskip
@@ -8686,7 +8778,7 @@
 %    \end{macrocode}
 %
 % First, we have to store our preamble in the token register |\@temptokena|
-% (those ``token registers'' are \emph{not} supported by \pkg{expl3}).
+% (those ``token registers'' are \emph{not} supported by the L3 programming layer).
 %    \begin{macrocode}
         \exp_args:NV \@temptokena \g_@@_preamble_tl 
 %    \end{macrocode}
@@ -8729,6 +8821,10 @@
               }
           }
 %    \end{macrocode}
+% The number of letters |X| in the preamble of the array.
+%    \begin{macrocode}
+        \int_gzero:N \g_@@_nb_of_X_int
+%    \end{macrocode}
 % The sequence |\g_@@_cols_vlsim_seq| will contain the numbers of the columns
 % where you will to have to draw vertical lines in the potential sub-matrices
 % (hence the name |vlism|). 
@@ -8784,7 +8880,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% We complete the preamble with the potential ``exterior columns''.
+% We complete the preamble with the potential ``exterior columns'' (on both sides).
 %    \begin{macrocode}
     \int_compare:nNnTF \l_@@_first_col_int = 0
       { \tl_gput_left:NV \g_@@_preamble_tl \c_@@_preamble_first_col_tl }
@@ -8811,7 +8907,7 @@
           { \tl_gput_right:Nn \g_@@_preamble_tl { @ { } } }
       }
 %    \end{macrocode}
-% We add a last column to raise a good error message when the user put more
+% We add a last column to raise a good error message when the user puts more
 % columns than allowed by its preamble. However, for technical reasons, it's not
 % possible to do that in |{NiceTabular*}| (|\l_@@_tabular_width_dim|=0pt).
 %    \begin{macrocode}
@@ -8837,8 +8933,8 @@
         @ { \@@_patch_preamble_ii:nn #1 }
         | { \@@_patch_preamble_iii:n #1 }
         p { \@@_patch_preamble_iv:nnn t #1 }
-        m { \@@_patch_preamble_iv:nnn c #1 }
         b { \@@_patch_preamble_iv:nnn b #1 }
+        m { \@@_patch_preamble_iv:nnn b #1 }
         \@@_w: { \@@_patch_preamble_v:nnnn { }                          #1 } 
         \@@_W: { \@@_patch_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 } 
         \@@_true_c: { \@@_patch_preamble_vi:n #1 }
@@ -8848,6 +8944,7 @@
         )  { \@@_patch_preamble_viii:nn #1 }       
         ]  { \@@_patch_preamble_viii:nn #1 }       
         \} { \@@_patch_preamble_viii:nn #1 }       
+        X  { \@@_patch_preamble_xii: }
         C { \@@_error:nn { old~column~type } #1 }
         L { \@@_error:nn { old~column~type } #1 }
         R { \@@_error:nn { old~column~type } #1 }
@@ -8959,7 +9056,7 @@
 %    \end{macrocode}
 % 
 % \medskip
-% For |p|, |m| and |b|
+% For |p| and |b|
 %    \begin{macrocode}  
 \cs_new_protected:Npn \@@_patch_preamble_iv:nnn #1 #2 #3
   {  
@@ -8968,14 +9065,29 @@
         > { 
             \@@_Cell: 
             \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
-            \mode_leave_vertical: 
+%    \end{macrocode}
+% The following lines have been taken from |array.sty|.
+%    \begin{macrocode}
+            \everypar
+              {
+                \vrule height \box_ht:N \@arstrutbox width \c_zero_dim
+                \everypar { }
+              }
+            \g_@@_row_style_tl % added the 2021-07-17
             \arraybackslash
-            \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt
           } 
         c 
         < { 
-            \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt
+%    \end{macrocode}
+% The following line has been taken from |array.sty|.
+%    \begin{macrocode}
+            \@finalstrut \@arstrutbox
             \end { minipage } 
+%    \end{macrocode}
+% If the letter in the preamble is |m|, you require a post-treatment for the box
+% |\l_@@_cell_box|.
+%    \begin{macrocode}
+            \str_if_eq:nnT { #2 } m \@@_center_cell_box:
             \@@_end_Cell: 
           } 
       }
@@ -8987,6 +9099,42 @@
   }
 %    \end{macrocode}
 % 
+% \bigskip
+% The following command will be used in |m|-columns in order to center
+% vertically the box. In fact, despite its name, the command does not always
+% center the cell. Indeed, if there is only one row in the cell, it should not
+% be centered vertically. It's not possible to know the number of rows of the
+% cell. However, you consider (as in \pkg{array}) that if the height of the cell
+% is no more that the height of |\@arstrutbox|, there is only one row.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_center_cell_box:
+  {
+%    \end{macrocode}
+% By putting instructions in |\g_@@_post_treatment_cell_tl|, we require a
+% post-treatment of the box |\l_@@_cell_box|. 
+%    \begin{macrocode}
+    \tl_gput_right:Nn \g_@@_post_treatment_cell_tl
+      {
+        \int_compare:nNnT 
+          { \box_ht:N \l_@@_cell_box } 
+          > 
+          { \box_ht:N \@arstrutbox }
+          { 
+            \hbox_set:Nn \l_@@_cell_box
+              {
+                \box_move_down:nn
+                  { 
+                    ( \box_ht:N \l_@@_cell_box - \box_ht:N \@arstrutbox 
+                    + \baselineskip ) / 2 
+                  }
+                { \box_use:N \l_@@_cell_box }
+              }
+          } 
+      }
+  }
+%    \end{macrocode}
+% 
+% 
 % \medskip
 % For |w| and |W|
 %    \begin{macrocode}
@@ -9192,8 +9340,43 @@
   }
 %    \end{macrocode}
 %
-%
 % \bigskip
+% For the case of a letter |X|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_preamble_xii:
+  {
+    \int_gincr:N \g_@@_nb_of_X_int
+%    \end{macrocode}
+% We test whether you know the width of the |X|-columns by reading the value in
+% the |aux| file (of course, this is not possible at the first compilation).
+%    \begin{macrocode}
+    \bool_if:NTF \l_@@_X_columns_aux_bool
+      { \exp_args:NNNV \@@_patch_preamble_iv:nnn t p \l_@@_X_columns_dim }
+      {
+        \tl_gput_right:Nn \g_@@_preamble_tl 
+          { 
+            > { 
+                \@@_Cell: 
+                \tl_set:Nn \l_@@_cell_type_tl { c } 
+%    \end{macrocode}
+% The following code will nullify the box of the cell.
+%    \begin{macrocode}
+                \tl_gput_right:Nn \g_@@_post_treatment_cell_tl 
+                  { \hbox_set:Nn \l_@@_cell_box { } }
+%    \end{macrocode}
+% The content of the cell is composed in |\l_tmpa_box| which will be discarded.
+%    \begin{macrocode}
+              } 
+            c 
+            < { \@@_end_Cell: }
+          }  
+        \int_gincr:N \c at jCol
+        \@@_patch_preamble_x:n
+      }
+  }
+%    \end{macrocode}
+% 
+% \bigskip
 % \subsection*{The redefinition of \textbackslash multicolumn}
 %
 % \medskip
@@ -9555,8 +9738,14 @@
 % notes (that means that a |\vtop{\hsize=...}| is not enough).
 %    \begin{macrocode}
     \begin { minipage } [ t ] { \box_wd:N \l_@@_the_array_box }
-    \box_use_drop:N \l_@@_the_array_box 
 %    \end{macrocode}
+% The |\hbox| avoids that the |pgfpicture| inside |\@@_draw_blocks| adds a extra
+% vertical space before the notes.
+%    \begin{macrocode}
+      \hbox:n 
+        { 
+          \box_use_drop:N \l_@@_the_array_box 
+%    \end{macrocode}
 % We have to draw the blocks right now because there may be tabular notes in
 % some blocks (which are not mono-column: the blocks which are mono-column
 % have been composed in boxes yet)... and we have to create (potentially) the
@@ -9563,8 +9752,9 @@
 % extra nodes before creating the blocks since there are |medium| nodes to create
 % for the blocks.
 %    \begin{macrocode}
-    \@@_create_extra_nodes:
-    \seq_if_empty:NF \g_@@_blocks_seq \@@_draw_blocks: 
+         \@@_create_extra_nodes:
+         \seq_if_empty:NF \g_@@_blocks_seq \@@_draw_blocks: 
+       }
     \bool_lazy_or:nnT
       { \int_compare_p:nNn \c at tabularnote > 0 }
       { ! \tl_if_empty_p:V \l_@@_tabularnote_tl }
@@ -9729,6 +9919,10 @@
         \vcenter 
           { 
             \vbox_to_ht:nn 
+%    \end{macrocode}
+% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available
+% on Overleaf. 
+%    \begin{macrocode}
               { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
               { }
           }
@@ -9742,6 +9936,10 @@
         \c_math_toggle_token
         \left .
         \vbox_to_ht:nn 
+%    \end{macrocode}
+% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available
+% on Overleaf. 
+%    \begin{macrocode}
           { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
           { }
         \right #2
@@ -10022,8 +10220,8 @@
 %    \begin{macrocode}
     \int_gset:Nn \g_tmpa_int 1            
     \bool_if:NTF \g_@@_last_col_found_bool
-      { \prg_replicate:nn { \g_@@_col_total_int - 3 } }
-      { \prg_replicate:nn { \g_@@_col_total_int - 2 } }
+      { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 3 } 0 } }
+      { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 2 } 0 } }
       { 
         & 
         \omit
@@ -10465,8 +10663,7 @@
             \int_use:N \l_@@_first_col_int ,
             \int_use:N \c at jCol ,
             \int_use:N \g_@@_col_total_int 
-          }
-        \iow_newline:
+          } 
       }
 %    \end{macrocode}
 % We write also the potential content of |\g_@@_pos_of_blocks_seq| (it will be
@@ -10478,7 +10675,6 @@
           { 
             \seq_gset_from_clist:Nn \exp_not:N \g_@@_pos_of_blocks_seq
               { \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , }
-            \iow_newline:
           }
       }
     \seq_if_empty:NF \g_@@_multicolumn_cells_seq
@@ -10487,10 +10683,8 @@
           { 
             \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_cells_seq
               { \seq_use:Nnnn \g_@@_multicolumn_cells_seq , , , }
-            \iow_newline:
             \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_sizes_seq
               { \seq_use:Nnnn \g_@@_multicolumn_sizes_seq , , , }
-            \iow_newline:
           }
       }
 %    \end{macrocode}
@@ -10674,12 +10868,12 @@
           {
             \tl_gset:Nn \exp_not:N \g_@@_code_before_tl 
               { \exp_not:V \g_nicematrix_code_before_tl }
-            \iow_newline:
           }
         \bool_set_true:N \l_@@_code_before_bool
       }
 %    \end{macrocode}
-% 
+%
+%
 %    \begin{macrocode}
     % \bool_if:NT \l_@@_code_before_bool \@@_write_aux_for_cell_nodes:
 %    \end{macrocode}
@@ -11787,7 +11981,7 @@
 %
 % 
 % \bigskip
-% \subsection*{The actual instructions for drawing the dotted line with Tikz}
+% \subsection*{The actual instructions for drawing the dotted lines with Tikz}
 %
 % The command |\@@_draw_line:| should be used in a |{pgfpicture}|. It has six
 % implicit arguments:
@@ -11916,7 +12110,7 @@
     \group_begin:
 %    \end{macrocode}
 % The dimension |\l_@@_l_dim| is the length $\ell$ of the line to draw. We use
-% the floating point reals of \pkg{expl3} to compute this length.
+% the floating point reals of the L3 programming layer to compute this length.
 %    \begin{macrocode}
       \dim_zero_new:N \l_@@_l_dim
       \dim_set:Nn \l_@@_l_dim
@@ -13373,10 +13567,13 @@
     \dim_set_eq:NN \l_tmpb_dim \pgf at x
     \@@_qpoint:n { row - \@@_succ:n { #4 } }
     \dim_set_eq:NN \l_tmpc_dim \pgf at y
-    \bool_lazy_and:nnT
-      { \int_compare_p:nNn { #2 } > 1 }
-      { ! \tl_if_blank_p:V \CT at drsc@ }
+    \bool_lazy_all:nT
       {
+        { \int_compare_p:nNn { #2 } > 1 }
+        { \cs_if_exist_p:N \CT at drsc@ } % condition added in version 5.18a
+        { ! \tl_if_blank_p:V \CT at drsc@ }
+      }
+      {
         \group_begin:
         \CT at drsc@
         \dim_add:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
@@ -13768,7 +13965,6 @@
           {
             \seq_set_from_clist:Nn \exp_not:N \l_@@_corners_cells_seq 
               { \seq_use:Nnnn \l_@@_corners_cells_seq , , , }
-            \iow_newline:
           }
       }
   }
@@ -14701,9 +14897,15 @@
 % why we have two macros: |\@@_Block_iv:nnnnn| and |\@@_Block_v:nnnnn| (the five
 % arguments of those macros are provided by curryfication).
 %    \begin{macrocode}
-    \bool_lazy_or:nnTF 
-      { \int_compare_p:nNn { \l_tmpa_int } = 1 }
-      { \int_compare_p:nNn { \l_tmpb_int } = 1 }
+    \bool_if:nTF 
+      { 
+        ( 
+          \int_compare_p:nNn { \l_tmpa_int } = 1 
+             ||
+          \int_compare_p:nNn { \l_tmpb_int } = 1  
+        ) 
+        && ! \tl_if_empty_p:n { #5 }
+      }
       { \exp_args:Nxx \@@_Block_iv:nnnnn }
       { \exp_args:Nxx \@@_Block_v:nnnnn }
     { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } 
@@ -14742,9 +14944,9 @@
 %    \end{macrocode}
 % For a mono-column block, if the user has specified a color for the column in
 % the preamble of the array, we want to fix that color in the box we construct.
-% We do that with |\set at color| and not |\color_ensure_current:| because that
-% command seems to be bugged: it doesn't work in XeLaTeX when \pkg{fontspec} is
-% loaded.
+% We do that with |\set at color| and not |\color_ensure_current:| (in order to use
+% |\color_ensure_current:| safely, you should load \pkg{l3backend} before the
+% |\documentclass| with |\RequirePackage{expl3}|).
 %    \begin{macrocode}
         \tl_if_empty:NTF \l_@@_color_tl
           { \int_compare:nNnT { #2 } = 1 \set at color }
@@ -14932,6 +15134,11 @@
 %   \begin{macrocode}
 \keys_define:nn { NiceMatrix / Block / SecondPass }
   {
+    tikz .code:n = 
+      \bool_if:NTF \c_@@_tikz_loaded_bool
+        { \seq_put_right:Nn \l_@@_tikz_seq { { #1 } } }
+        { \@@_error:n { tikz~key~without~tikz } } ,
+    tikz .value_required:n = true ,
     fill .tl_set:N = \l_@@_fill_tl ,
     fill .value_required:n = true ,
     draw .tl_set:N = \l_@@_draw_tl ,
@@ -15031,7 +15238,7 @@
 % 
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_Block_v:nnnnnn #1 #2 #3 #4 #5 #6
-  { 
+  {  
 %    \end{macrocode}
 % The sequence of the positions of the blocks will be used when drawing the rules
 % (in fact, there is also the |\multicolumn| and the |\diagbox| in that sequence). 
@@ -15107,6 +15314,21 @@
           }  
       }
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+    \seq_if_empty:NF \l_@@_tikz_seq
+      {
+        \tl_gput_right:Nx \g_nicematrix_code_before_tl
+          {
+            \@@_block_tikz:nnnnn
+              { #1 }
+              { #2 }
+              { \int_use:N \l_@@_last_row_int }
+              { \int_use:N \l_@@_last_col_int }
+              { \seq_use:Nn \l_@@_tikz_seq { , } }
+          }
+      }
+%    \end{macrocode}
 % 
 % \medskip
 %    \begin{macrocode}
@@ -15630,7 +15852,26 @@
     line-width .dim_set:N = \l_@@_line_width_dim 
   }
 %    \end{macrocode}
+%
+% \bigskip
+% The following command will be used if the key |tikz| has been used for the
+% command |\Block|. The arguments |#1| and |#2| are the coordinates of the first
+% cell and |#3| and |#4| the coordinates of the last cell of the block. |#5| is
+% a comma-separated list of the Tikz keys used with the path.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_block_tikz:nnnnn #1 #2 #3 #4 #5
+  {
+    \begin { tikzpicture }
+    \clist_map_inline:nn { #5 }
+      {
+        \path [ ##1 ] 
+              ( #1 -| #2 ) rectangle ( \@@_succ:n { #3 } -| \@@_succ:n { #4 } ) ; 
+      }
+    \end { tikzpicture }
+  }
+%    \end{macrocode}
 % 
+% 
 % \subsection*{How to draw the dotted lines transparently}
 %    \begin{macrocode}
 \cs_set_protected:Npn \@@_renew_matrix:
@@ -16821,7 +17062,7 @@
   }
 %    \end{macrocode}
 % 
-%
+% 
 %    \begin{macrocode}
 \@@_msg_new:nn { too~much~cols~for~matrix~with~last~col }
   { 
@@ -17121,6 +17362,15 @@
     If~you~go~on,~this~specification~of~border~will~be~ignored.
   }
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { tikz~key~without~tikz }
+  {
+    You~can't~use~the~key~'tikz'~for~the~command~'\token_to_str:N
+    \Block'~because~you~have~not~loaded~Tikz.~
+    If~you~go~on,~this~key~will~be~ignored.
+  }
+%    \end{macrocode}
 % 
 %    \begin{macrocode}
 \@@_msg_new:nn { last-col~non~empty~for~NiceArray }
@@ -17257,7 +17507,7 @@
   }
   {
     The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~
-    hvlines,~l,~line-width,~rounded-corners,~r~and~t. 
+    hvlines,~l,~line-width,~rounded-corners,~r,~t~and~tikz. 
   }
 %    \end{macrocode}
 %
@@ -18064,6 +18314,10 @@
 % 
 % New command |\RowStyle|
 % 
+% \subsection*{Changes between versions 5.18 and 5.19}
+% 
+% New key |tikz| for the command |\Block|.
+%
 % \PrintIndex
 % 
 % \tableofcontents

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2021-07-24 20:47:27 UTC (rev 60041)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2021-07-24 20:47:43 UTC (rev 60042)
@@ -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{5.18}
-\def\myfiledate{2021/07/15}
+\def\myfileversion{5.19}
+\def\myfiledate{2021/07/23}
 \RequirePackage{pgfcore}
 \usepgfmodule{shapes}
 \RequirePackage{l3keys2e}
@@ -152,7 +152,6 @@
           }
       }
   }
-\cs_set_protected:Npn \CT at drsc@ { }
 \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
   {
@@ -326,6 +325,9 @@
 \int_new:N \l__nicematrix_old_iRow_int
 \int_new:N \l__nicematrix_old_jCol_int
 \tl_new:N \l__nicematrix_rules_color_tl
+\int_new:N \g__nicematrix_nb_of_X_int
+\bool_new:N \l__nicematrix_X_columns_aux_bool
+\dim_new:N \l__nicematrix_X_columns_dim
 \bool_new:N \g__nicematrix_after_col_zero_bool
 \bool_new:N \g__nicematrix_row_of_col_done_bool
 \bool_new:N \g__nicematrix_not_empty_cell_bool
@@ -357,6 +359,7 @@
 \int_new:N \g__nicematrix_static_num_of_col_int
 \tl_new:N \l__nicematrix_fill_tl
 \tl_new:N \l__nicematrix_draw_tl
+\seq_new:N \l__nicematrix_tikz_seq
 \clist_new:N \l__nicematrix_borders_clist
 \dim_new:N \l__nicematrix_rounded_corners_dim
 \tl_new:N \l__nicematrix_color_tl
@@ -900,7 +903,7 @@
   }
 \cs_new_protected:Npn \__nicematrix_Cell:
   {
-    \tl_gclear:N \g__nicematrix_exit_cell_tl
+    \tl_gclear:N \g__nicematrix_post_treatment_cell_tl
     \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:n
     \int_gincr:N \c at jCol
     \int_compare:nNnT \c at jCol = 1
@@ -1004,7 +1007,7 @@
   {
     \__nicematrix_math_toggle_token:
     \hbox_set_end:
-    \g__nicematrix_exit_cell_tl
+    \g__nicematrix_post_treatment_cell_tl
     \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
     \__nicematrix_adjust_size_box:
     \box_set_ht:Nn \l__nicematrix_cell_box
@@ -1351,7 +1354,7 @@
       {
         \tl_gput_right:Nn \g__nicematrix_row_style_tl
           {
-            \tl_gput_right:Nn \g__nicematrix_exit_cell_tl
+            \tl_gput_right:Nn \g__nicematrix_post_treatment_cell_tl
               { \dim_set:Nn \l__nicematrix_cell_space_top_limit_dim { #1 } }
           }
       } ,
@@ -1360,7 +1363,7 @@
       {
         \tl_gput_right:Nn \g__nicematrix_row_style_tl
           {
-            \tl_gput_right:Nn \g__nicematrix_exit_cell_tl
+            \tl_gput_right:Nn \g__nicematrix_post_treatment_cell_tl
               { \dim_set:Nn \l__nicematrix_cell_space_bottom_limit_dim { #1 } }
           }
       } ,
@@ -1550,6 +1553,23 @@
     \skip_horizontal:N \l__nicematrix_right_margin_dim
     \skip_horizontal:N \l__nicematrix_extra_right_margin_dim
     \hbox_set_end:
+    \int_compare:nNnT \g__nicematrix_nb_of_X_int > 0
+      {
+        \bool_if:NTF \l__nicematrix_X_columns_aux_bool
+          { \dim_set_eq:NN \l_tmpa_dim \l__nicematrix_X_columns_dim }
+          {
+            \dim_set:Nn \l_tmpa_dim
+              {
+                ( \textwidth - \box_wd:N \l__nicematrix_the_array_box )
+                / \int_use:N \g__nicematrix_nb_of_X_int
+              }
+          }
+        \tl_gput_right:Nx \g__nicematrix_aux_tl
+          {
+            \bool_set_true:N \l__nicematrix_X_columns_aux_bool
+            \dim_set:Nn \l__nicematrix_X_columns_dim { \dim_use:N \l_tmpa_dim }
+          }
+      }
     \int_compare:nNnT \l__nicematrix_last_row_int > { -2 }
       {
         \bool_if:NF \l__nicematrix_last_row_without_value_bool
@@ -1647,10 +1667,11 @@
     \__nicematrix_after_array:
     \egroup
     \iow_now:Nn \@mainaux { \ExplSyntaxOn }
+    \iow_now:Nn \@mainaux { \char_set_catcode_space:n { 32 }  }
     \iow_now:Nx \@mainaux
       {
         \tl_gset:cn { c__nicematrix_ \int_use:N \g__nicematrix_env_int _ tl }
-          \iow_newline: { \iow_newline: \exp_not:V \g__nicematrix_aux_tl }
+          { \exp_not:V \g__nicematrix_aux_tl }
       }
     \iow_now:Nn \@mainaux { \ExplSyntaxOff }
     \bool_if:NT \c__nicematrix_footnote_bool \endsavenotes
@@ -1680,6 +1701,7 @@
                   { ! { \skip_horizontal:N \arrayrulewidth } }
               }
           }
+        \int_gzero:N \g__nicematrix_nb_of_X_int
         \seq_clear:N \g__nicematrix_cols_vlism_seq
         \int_zero:N \l_tmpa_int
         \exp_after:wN \__nicematrix_patch_preamble:n \the \@temptokena \q_stop
@@ -1740,8 +1762,8 @@
         @ { \__nicematrix_patch_preamble_ii:nn #1 }
         | { \__nicematrix_patch_preamble_iii:n #1 }
         p { \__nicematrix_patch_preamble_iv:nnn t #1 }
-        m { \__nicematrix_patch_preamble_iv:nnn c #1 }
         b { \__nicematrix_patch_preamble_iv:nnn b #1 }
+        m { \__nicematrix_patch_preamble_iv:nnn b #1 }
         \__nicematrix_w: { \__nicematrix_patch_preamble_v:nnnn { }                          #1 }
         \__nicematrix_W: { \__nicematrix_patch_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
         \__nicematrix_true_c: { \__nicematrix_patch_preamble_vi:n #1 }
@@ -1751,6 +1773,7 @@
         )  { \__nicematrix_patch_preamble_viii:nn #1 }
         ]  { \__nicematrix_patch_preamble_viii:nn #1 }
         \} { \__nicematrix_patch_preamble_viii:nn #1 }
+        X  { \__nicematrix_patch_preamble_xii: }
         C { \__nicematrix_error:nn { old~column~type } #1 }
         L { \__nicematrix_error:nn { old~column~type } #1 }
         R { \__nicematrix_error:nn { old~column~type } #1 }
@@ -1837,14 +1860,19 @@
         > {
             \__nicematrix_Cell:
             \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
-            \mode_leave_vertical:
+            \everypar
+              {
+                \vrule height \box_ht:N \@arstrutbox width \c_zero_dim
+                \everypar { }
+              }
+            \g__nicematrix_row_style_tl % added the 2021-07-17
             \arraybackslash
-            \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt
           }
         c
         < {
-            \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt
+            \@finalstrut \@arstrutbox
             \end { minipage }
+            \str_if_eq:nnT { #2 } m \__nicematrix_center_cell_box:
             \__nicematrix_end_Cell:
           }
       }
@@ -1851,6 +1879,27 @@
     \int_gincr:N \c at jCol
     \__nicematrix_patch_preamble_x:n
   }
+\cs_new_protected:Npn \__nicematrix_center_cell_box:
+  {
+    \tl_gput_right:Nn \g__nicematrix_post_treatment_cell_tl
+      {
+        \int_compare:nNnT
+          { \box_ht:N \l__nicematrix_cell_box }
+          >
+          { \box_ht:N \@arstrutbox }
+          {
+            \hbox_set:Nn \l__nicematrix_cell_box
+              {
+                \box_move_down:nn
+                  {
+                    ( \box_ht:N \l__nicematrix_cell_box - \box_ht:N \@arstrutbox
+                    + \baselineskip ) / 2
+                  }
+                { \box_use:N \l__nicematrix_cell_box }
+              }
+          }
+      }
+  }
 \cs_new_protected:Npn \__nicematrix_patch_preamble_v:nnnn #1 #2 #3 #4
   {
     \tl_gput_right:Nn \g__nicematrix_preamble_tl
@@ -1993,6 +2042,27 @@
     \tl_gput_right:Nn \g__nicematrix_preamble_tl { < { #1 } }
     \__nicematrix_patch_preamble_x:n
   }
+\cs_new_protected:Npn \__nicematrix_patch_preamble_xii:
+  {
+    \int_gincr:N \g__nicematrix_nb_of_X_int
+    \bool_if:NTF \l__nicematrix_X_columns_aux_bool
+      { \exp_args:NNNV \__nicematrix_patch_preamble_iv:nnn t p \l__nicematrix_X_columns_dim }
+      {
+        \tl_gput_right:Nn \g__nicematrix_preamble_tl
+          {
+            > {
+                \__nicematrix_Cell:
+                \tl_set:Nn \l__nicematrix_cell_type_tl { c }
+                \tl_gput_right:Nn \g__nicematrix_post_treatment_cell_tl
+                  { \hbox_set:Nn \l__nicematrix_cell_box { } }
+              }
+            c
+            < { \__nicematrix_end_Cell: }
+          }
+        \int_gincr:N \c at jCol
+        \__nicematrix_patch_preamble_x:n
+      }
+  }
 \cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3
   {
     \multispan { #1 }
@@ -2201,9 +2271,12 @@
           { \box_wd:N \l__nicematrix_the_array_box - \arraycolsep }
       }
     \begin { minipage } [ t ] { \box_wd:N \l__nicematrix_the_array_box }
-    \box_use_drop:N \l__nicematrix_the_array_box
-    \__nicematrix_create_extra_nodes:
-    \seq_if_empty:NF \g__nicematrix_blocks_seq \__nicematrix_draw_blocks:
+      \hbox:n
+        {
+          \box_use_drop:N \l__nicematrix_the_array_box
+         \__nicematrix_create_extra_nodes:
+         \seq_if_empty:NF \g__nicematrix_blocks_seq \__nicematrix_draw_blocks:
+       }
     \bool_lazy_or:nnT
       { \int_compare_p:nNn \c at tabularnote > 0 }
       { ! \tl_if_empty_p:V \l__nicematrix_tabularnote_tl }
@@ -2484,8 +2557,8 @@
       }
     \int_gset:Nn \g_tmpa_int 1
     \bool_if:NTF \g__nicematrix_last_col_found_bool
-      { \prg_replicate:nn { \g__nicematrix_col_total_int - 3 } }
-      { \prg_replicate:nn { \g__nicematrix_col_total_int - 2 } }
+      { \prg_replicate:nn { \int_max:nn { \g__nicematrix_col_total_int - 3 } 0 } }
+      { \prg_replicate:nn { \int_max:nn { \g__nicematrix_col_total_int - 2 } 0 } }
       {
         &
         \omit
@@ -2761,7 +2834,6 @@
             \int_use:N \c at jCol ,
             \int_use:N \g__nicematrix_col_total_int
           }
-        \iow_newline:
       }
     \seq_if_empty:NF \g__nicematrix_pos_of_blocks_seq
       {
@@ -2769,7 +2841,6 @@
           {
             \seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_pos_of_blocks_seq
               { \seq_use:Nnnn \g__nicematrix_pos_of_blocks_seq , , , }
-            \iow_newline:
           }
       }
     \seq_if_empty:NF \g__nicematrix_multicolumn_cells_seq
@@ -2778,10 +2849,8 @@
           {
             \seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_multicolumn_cells_seq
               { \seq_use:Nnnn \g__nicematrix_multicolumn_cells_seq , , , }
-            \iow_newline:
             \seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_multicolumn_sizes_seq
               { \seq_use:Nnnn \g__nicematrix_multicolumn_sizes_seq , , , }
-            \iow_newline:
           }
       }
     \__nicematrix_create_diag_nodes:
@@ -2853,7 +2922,6 @@
           {
             \tl_gset:Nn \exp_not:N \g__nicematrix_code_before_tl
               { \exp_not:V \g_nicematrix_code_before_tl }
-            \iow_newline:
           }
         \bool_set_true:N \l__nicematrix_code_before_bool
       }
@@ -4513,10 +4581,13 @@
     \dim_set_eq:NN \l_tmpb_dim \pgf at x
     \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { #4 } }
     \dim_set_eq:NN \l_tmpc_dim \pgf at y
-    \bool_lazy_and:nnT
-      { \int_compare_p:nNn { #2 } > 1 }
-      { ! \tl_if_blank_p:V \CT at drsc@ }
+    \bool_lazy_all:nT
       {
+        { \int_compare_p:nNn { #2 } > 1 }
+        { \cs_if_exist_p:N \CT at drsc@ } % condition added in version 5.18a
+        { ! \tl_if_blank_p:V \CT at drsc@ }
+      }
+      {
         \group_begin:
         \CT at drsc@
         \dim_add:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
@@ -4780,7 +4851,6 @@
           {
             \seq_set_from_clist:Nn \exp_not:N \l__nicematrix_corners_cells_seq
               { \seq_use:Nnnn \l__nicematrix_corners_cells_seq , , , }
-            \iow_newline:
           }
       }
   }
@@ -5238,9 +5308,15 @@
         { \int_eval:n { \c at iRow + \l_tmpa_int - 1 } }
         { \int_eval:n { \c at jCol + \l_tmpb_int - 1 } }
       }
-    \bool_lazy_or:nnTF
-      { \int_compare_p:nNn { \l_tmpa_int } = 1 }
-      { \int_compare_p:nNn { \l_tmpb_int } = 1 }
+    \bool_if:nTF
+      {
+        (
+          \int_compare_p:nNn { \l_tmpa_int } = 1
+             ||
+          \int_compare_p:nNn { \l_tmpb_int } = 1
+        )
+        && ! \tl_if_empty_p:n { #5 }
+      }
       { \exp_args:Nxx \__nicematrix_Block_iv:nnnnn }
       { \exp_args:Nxx \__nicematrix_Block_v:nnnnn }
     { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 }
@@ -5397,6 +5473,11 @@
   }
 \keys_define:nn { NiceMatrix / Block / SecondPass }
   {
+    tikz .code:n =
+      \bool_if:NTF \c__nicematrix_tikz_loaded_bool
+        { \seq_put_right:Nn \l__nicematrix_tikz_seq { { #1 } } }
+        { \__nicematrix_error:n { tikz~key~without~tikz } } ,
+    tikz .value_required:n = true ,
     fill .tl_set:N = \l__nicematrix_fill_tl ,
     fill .value_required:n = true ,
     draw .tl_set:N = \l__nicematrix_draw_tl ,
@@ -5517,6 +5598,18 @@
               { \dim_use:N \l__nicematrix_rounded_corners_dim }
           }
       }
+    \seq_if_empty:NF \l__nicematrix_tikz_seq
+      {
+        \tl_gput_right:Nx \g_nicematrix_code_before_tl
+          {
+            \__nicematrix_block_tikz:nnnnn
+              { #1 }
+              { #2 }
+              { \int_use:N \l__nicematrix_last_row_int }
+              { \int_use:N \l__nicematrix_last_col_int }
+              { \seq_use:Nn \l__nicematrix_tikz_seq { , } }
+          }
+      }
     \cs_set_protected_nopar:Npn \diagbox ##1 ##2
       {
         \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
@@ -5850,6 +5943,16 @@
     rounded-corners .default:n = 4 pt ,
     line-width .dim_set:N = \l__nicematrix_line_width_dim
   }
+\cs_new_protected:Npn \__nicematrix_block_tikz:nnnnn #1 #2 #3 #4 #5
+  {
+    \begin { tikzpicture }
+    \clist_map_inline:nn { #5 }
+      {
+        \path [ ##1 ]
+              ( #1 -| #2 ) rectangle ( \__nicematrix_succ:n { #3 } -| \__nicematrix_succ:n { #4 } ) ;
+      }
+    \end { tikzpicture }
+  }
 \cs_set_protected:Npn \__nicematrix_renew_matrix:
   {
     \RenewDocumentEnvironment { pmatrix } { }
@@ -6770,6 +6873,12 @@
     values~are:~left,~right,~top~and~bottom.\\
     If~you~go~on,~this~specification~of~border~will~be~ignored.
   }
+\__nicematrix_msg_new:nn { tikz~key~without~tikz }
+  {
+    You~can't~use~the~key~'tikz'~for~the~command~'\token_to_str:N
+    \Block'~because~you~have~not~loaded~Tikz.~
+    If~you~go~on,~this~key~will~be~ignored.
+  }
 \__nicematrix_msg_new:nn { last-col~non~empty~for~NiceArray }
   {
     In~the~\__nicematrix_full_name_env:,~you~must~use~the~key~
@@ -6860,7 +6969,7 @@
   }
   {
     The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~
-    hvlines,~l,~line-width,~rounded-corners,~r~and~t.
+    hvlines,~l,~line-width,~rounded-corners,~r,~t~and~tikz.
   }
 \__nicematrix_msg_new:nnn { Unknown~key~for~CodeAfter }
   {



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