texlive[59811] Master/texmf-dist: nicematrix (2jul21)

commits+karl at tug.org commits+karl at tug.org
Fri Jul 2 21:58:15 CEST 2021


Revision: 59811
          http://tug.org/svn/texlive?view=revision&revision=59811
Author:   karl
Date:     2021-07-02 21:58:15 +0200 (Fri, 02 Jul 2021)
Log Message:
-----------
nicematrix (2jul21)

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-02 19:58:00 UTC (rev 59810)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2021-07-02 19:58:15 UTC (rev 59811)
@@ -213,8 +213,9 @@
 \begin{Verbatim}
 \usepackage[define-L-C-R]{nicematrix}
 \end{Verbatim}
+\textbf{Cette clé sera probablement supprimée dans une future version de
+  \pkg{nicematrix}.} 
 
-
 \section{L'espace vertical entre les rangées}
 
 Il est bien connu que certaines rangées des tableaux créés par défaut avec
@@ -688,12 +689,13 @@
 
 
 
-\subsection{Petite remarque}
+\subsection{Positionnement horizontal du contenu des blocs}
 
-On remarquera que le centrage horizontal du contenu des blocs est
-correct même si un espacement des colonnes a été demandé par une instruction
-comme |!{\qquad}| dans le préambule (ce n'est pas le cas avec |\multicolumn|).
-Dans l'exemple suivant, l'en-tête «Premier groupe» est correctement centré.
+Par défaut, le positionnement horizontal des contenus des blocs est calculé sur
+le \emph{contenu} des colonnes impliquées. De ce fait, dans l'exemple suivant,
+l'en-tête «Premier groupe» est correctement centré même si un espacement
+des colonnes a été demandé par une instruction comme |!{\qquad}| dans le
+préambule (ce n'est pas le cas avec |\multicolumn|). 
 
 \medskip
 \begin{center}
@@ -701,8 +703,8 @@
 \begin{BVerbatim}
 \begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc~@{}}
 \toprule
-& ~emphase#\Block{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} \\
-Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
+Rang & ~emphase#\Block{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} \\
+     & 1A & 1B & 1C & 2A & 2B & 2C \\
 \midrule
  1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
  2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -717,8 +719,8 @@
 \begin{center}
 \begin{NiceTabular}{@{}c!{\qquad}ccc!{\qquad}ccc@{}}
 \toprule
-& \Block{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\
-Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
+Rang & \Block{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\
+     & 1A & 1B & 1C & 2A & 2B & 2C \\
 \midrule
  1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
  2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -728,8 +730,12 @@
 \end{NiceTabular}
 \end{center}
 
+\medskip
+\colorbox{yellow!50}{\bfseries Nouveau 5.17}\enskip 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|.
 
-
 \section{Les filets horizontaux et verticaux}
 
 Les techniques habituelles pour tracer des filets peuvent être utilisées dans
@@ -1004,7 +1010,13 @@
 \end{NiceTabular}
 \end{center}
 
+
 \bigskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.17}}\enskip La clé
+|hvlines-except-borders| est similaire à la clé |hvlines| mais ne trace pas les
+filets sur les bords horizontaux et verticaux du tableau.
+
+\bigskip
 \subsubsection{Les coins (vides)}
 \label{corners}
 
@@ -1016,7 +1028,7 @@
 \emph{coin}) la réunion de toutes les cases vides situées dans au moins un
 rectangle entièrement constitué de cases vides partant de ce coin.\footnote{Pour
   être complet, on doit préciser que toute case située dans un bloc (même si
-  elle vide) n'est pas prise en compte pour la détermination des coins. Ce
+  elle est vide) n'est pas prise en compte pour la détermination des coins. Ce
   comportement est naturel.}
 
 \smallskip
@@ -4158,6 +4170,10 @@
 fixer la largeur des colonnes sans interférer avec le tracé des lignes en
 pointillés par \pkg{nicematrix}.
 
+\medskip
+\item Une case d'une colonne de type |p|, |m| ou |t| est toujours non vide.
+\emph{Attention} : Ne pas se fier à ce point car il est susceptible de changer. 
+
 \end{itemize}
 
 
@@ -4710,7 +4726,7 @@
 
 On remarquera que les traits que l'on vient de tracer sont dessinés \emph{après}
 la matrice sans modifier la position des composantes de celle-ci. En revanche,
-les traits tracés par |\hline|, le spécificateur «\verb+|+» ou les options
+les traits tracés par |\hline|, |\Hline|, le spécificateur «\verb+|+» ou les options
 |hlines|, |vlines| et |hvlines| «écartent» les composantes de la
 matrice.\footnote{Pour la commande |\cline|, voir la remarque
   p.~\pageref{remark-cline}.}

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-02 19:58:00 UTC (rev 59810)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2021-07-02 19:58:15 UTC (rev 59811)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{5.16}
-\def\myfiledate{2021/06/20}
+\def\myfileversion{5.17}
+\def\myfiledate{2021/07/01}
 %
 %
 %<*batchfile>
@@ -263,8 +263,9 @@
 % \begin{Verbatim}
 % \usepackage[define-L-C-R]{nicematrix}
 % \end{Verbatim}
+% \textbf{This key will probably be deleted in a future version of
+% \pkg{nicematrix}.} 
 %
-%
 % \section{The vertical space between the rows}
 %
 % It's well known that some rows of the arrays created by default with LaTeX
@@ -725,13 +726,14 @@
 % 
 %
 %
-% \subsection{A small remark}
+% \subsection{Horizontal position of the content of the block}
 %
-% One should remark that the horizontal centering of the contents of the blocks
-% is correct even when an instruction such as |!{\qquad}| has been used in the
-% preamble of the array in order to increase the space between two columns (this
-% is not the case with |\multicolumn|). In the following example, the header
-% ``First group'' is correctly centered.
+% By default, the horizontal position of the content of a block is computed
+% by using the positions of the \emph{contents} of the columns implied in that
+% block. That's why, in the following example, the header ``First group'' is
+% correctly centered despite the instruction |!{\qquad}| in the preamble which
+% has been used to increase the space between the columns (this
+% is not the behaviour of |\multicolumn|).
 %
 % \medskip
 % \begin{center}
@@ -739,8 +741,8 @@
 % \begin{BVerbatim}
 % \begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}}
 % \toprule
-% & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\
-% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
+% Rank & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\
+%      & 1A & 1B & 1C & 2A & 2B & 2C \\
 % \midrule
 %  1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
 %  2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -755,8 +757,8 @@
 % \begin{center}
 % \begin{NiceTabular}{@{}c!{\qquad}ccc!{\qquad}ccc@{}}
 % \toprule
-% & \Block{1-3}{First group} & & & \Block{1-3}{Second group} \\
-% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
+% Rank & \Block{1-3}{First group} & & & \Block{1-3}{Second group} \\
+%      & 1A & 1B & 1C & 2A & 2B & 2C \\
 % \midrule
 %  1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
 %  2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -766,6 +768,11 @@
 % \end{NiceTabular}
 % \end{center}
 %
+% \medskip
+% \colorbox{yellow!50}{\bfseries New 5.17}\enskip 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|.
 %
 %
 % \section{The rules}
@@ -1026,6 +1033,10 @@
 % \end{NiceTabular}
 % \end{center}
 %
+% \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
+% rules on the horizontal and vertical borders of the array.
 %
 % \subsubsection{The (empty) corners}
 %
@@ -4099,6 +4110,11 @@
 % meaning as |\hspace| except that the cell where it is used is considered as
 % empty. This command can be used to fix the width of some columns of the matrix
 % without interfering with \pkg{nicematrix}.
+%
+% \medskip
+% \item A cell of a column of type |p|, |m| or |t| is always considered as not
+% emtpy. \emph{Caution} : One should not rely upon that point because it may
+% change if a future version of \pkg{nicematrix}.
 % % \end{itemize}
 %
 %
@@ -4644,7 +4660,7 @@
 % 
 % We should remark that the rules we have drawn are drawn \emph{after} the
 % construction of the array and thus, they don't spread the cells of the array.
-% We recall that, on the other side, the command |\hline|, the specifier ``"|"''
+% We recall that, on the other side, the commands |\hline| and |\Hline|, the specifier ``"|"''
 % and the options |hlines|, |vlines| and |hvlines| spread the
 % cells.\footnote{For the command |\cline|, see the remark
 % p.~\pageref{remark-cline}.}
@@ -5867,17 +5883,27 @@
 %    \end{macrocode}
 % 
 % \medskip
-% The parameters of position of the label of a block. For the horizontal
-% position, the possible values are |c|, |r| and |l|. For the vertical position,
-% the possible values are |c|, |t| and |b|. Of course, it would be interesting to
-% program a key |T| and a key |B|.
+% The parameters of the horizontal position of the label of a block. If the user
+% uses the key |c| or |C|, the value is |c|. If the user uses the key |l| or
+% |L|, the value is |l|. If the user uses the key |r| or |R|, the value is |r|.
+% If the user has used a capital letter, the boolean
+% |\l_@@_hpos_of_block_cap_bool| will be raised (in the second pass of the
+% analyze of the keys of the command |\Block|).
 %    \begin{macrocode}
 \tl_new:N \l_@@_hpos_of_block_tl
 \tl_set:Nn \l_@@_hpos_of_block_tl { c }
+\bool_new:N \l_@@_hpos_of_block_cap_bool
+%    \end{macrocode}
+%
+% \medskip
+% For the vertical position, the possible values are |c|, |t| and |b|. Of
+% course, it would be interesting to program a key |T| and a key |B|.
+%    \begin{macrocode}
 \tl_new:N \l_@@_vpos_of_block_tl
 \tl_set:Nn \l_@@_vpos_of_block_tl { c }
 %    \end{macrocode}
 %
+% 
 % \medskip
 % Used when the key |draw-first| is used for |\Ddots| or |\Iddots|.
 %    \begin{macrocode}
@@ -6428,6 +6454,14 @@
 %    \end{macrocode}
 %
 % \bigskip
+% The boolean |\l_@@_except_borders_bool| will be raised when the key
+% |hvlines-except-borders| will be used (but that key has also other effects).
+%    \begin{macrocode}
+\bool_new:N \l_@@_except_borders_bool
+%    \end{macrocode}
+% 
+%
+% \bigskip
 % The dimension |\l_@@_left_margin_dim| correspond to the option |left-margin|.
 % Idem for the right margin. These parameters are involved in the creation of
 % the ``medium nodes'' but also in the placement of the delimiters and the
@@ -6592,6 +6626,12 @@
         \clist_set:Nn \l_@@_vlines_clist { all }
         \clist_set:Nn \l_@@_hlines_clist { all }
       } ,
+    hvlines-except-borders .code:n = 
+      { 
+        \clist_set:Nn \l_@@_vlines_clist { all }
+        \clist_set:Nn \l_@@_hlines_clist { all }
+        \bool_set_true:N \l_@@_except_borders_bool
+      } ,
     parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
 %    \end{macrocode}
 %
@@ -8549,6 +8589,10 @@
 %    \begin{macrocode}
         \int_gzero:N \c at jCol
         \tl_gclear:N \g_@@_preamble_tl 
+%    \end{macrocode}
+% |\g_tmpb_bool| will be raised if you have a \verb+|+ at the end of the preamble.
+%    \begin{macrocode}
+        \bool_gset_false:N \g_tmpb_bool
         \tl_if_eq:NnTF \l_@@_vlines_clist { all } 
           { 
             \tl_gset:Nn \g_@@_preamble_tl 
@@ -8609,7 +8653,13 @@
       { ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } }
       { \bool_set_false:N \l_@@_NiceArray_bool } 
 %    \end{macrocode}
-% 
+%
+% \medskip
+% We want to remind whether there is a specifier \verb+|+ at the end of the preamble. 
+%    \begin{macrocode}
+    \bool_if:NT \g_tmpb_bool { \bool_set_true:N \l_@@_bar_at_end_of_pream_bool } 
+%    \end{macrocode}
+%
 % \bigskip
 % We complete the preamble with the potential ``exterior columns''.
 %    \begin{macrocode}
@@ -8774,11 +8824,16 @@
         \tl_gput_right:Nx \g_@@_internal_code_after_tl
           { \@@_vline:nn { \@@_succ:n \c at jCol } { \int_use:N \l_tmpa_int } }
         \int_zero:N \l_tmpa_int
+        \str_if_eq:nnT { #1 } { \q_stop }
+          { \bool_gset_true:N \g_tmpb_bool }
         \@@_patch_preamble:n #1 
       }
   }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\bool_new:N \l_@@_bar_at_end_of_pream_bool
+%    \end{macrocode}
 % 
 % \medskip
 % For |p|, |m| and |b|
@@ -8870,7 +8925,7 @@
         \str_if_eq:VnTF \g_@@_left_delim_tl { . }
           { 
 %    \end{macrocode}
-% In that case, in fact, the firt letter of the preamble must be considered as
+% In that case, in fact, the first letter of the preamble must be considered as
 % the left delimiter of the array.
 %    \begin{macrocode}
             \tl_gset:Nn \g_@@_left_delim_tl { #1 } 
@@ -8879,29 +8934,26 @@
           }
           {  
             \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } 
-            \tl_gput_right:Nx \g_@@_internal_code_after_tl
-              { \@@_delimiter:nnn #1 { \@@_succ:n \c at jCol } \c_true_bool }  
-            \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
-              {
-                \@@_error:nn { delimiter~after~opening } { #2 } 
-                \@@_patch_preamble:n
-              }
-              { \@@_patch_preamble:n #2 }
+            \@@_patch_preamble_vii_i:nn { #1 } { #2 }
           }
       }
+      { \@@_patch_preamble_vii_i:nn { #1 } { #2 } } 
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_preamble_vii_i:nn #1 #2
+  {
+    \tl_gput_right:Nx \g_@@_internal_code_after_tl
+      { \@@_delimiter:nnn #1 { \@@_succ:n \c at jCol } \c_true_bool }  
+    \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
       {
-        \tl_gput_right:Nx \g_@@_internal_code_after_tl
-          { \@@_delimiter:nnn #1 { \@@_succ:n \c at jCol } \c_true_bool }  
-        \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
-          {
-            \@@_error:nn { delimiter~after~opening } { #2 } 
-            \@@_patch_preamble:n
-          }
-          { \@@_patch_preamble:n #2 }
+        \@@_error:nn { delimiter~after~opening } { #2 } 
+        \@@_patch_preamble:n
       }
+      { \@@_patch_preamble:n #2 }
   }
 %    \end{macrocode}
-%
 % 
 % \bigskip
 % For |)|, |]| and |\}|. We have two arguments for the following command because
@@ -9018,8 +9070,260 @@
 %    \end{macrocode}
 %
 %
+% \bigskip
+% \subsection{The redefinition of \textbackslash multicolumn}
+%
+% \medskip
+% The following command must \emph{not} be protected since it begins with
+% |\multispan| (a TeX primitive).
+%    \begin{macrocode}
+\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
+  { 
+    \multispan { #1 }
+    \begingroup
+%    \end{macrocode}
+%
+% \medskip
+% You do the expansion of the (small) preamble with the tools of \pkg{array}.
+%    \begin{macrocode}
+    \@temptokena = { #2 }
+    \@tempswatrue
+    \@whilesw \if at tempswa \fi { \@tempswafalse \the \NC at list }
+%    \end{macrocode}
 % 
+% \medskip
+% Now, we patch the (small) preamble as we have done with the main preamble of
+% the array.
+%    \begin{macrocode}
+    \tl_gclear:N \g_@@_preamble_tl
+    \exp_after:wN \@@_patch_m_preamble:n \the \@temptokena \q_stop
+%    \end{macrocode}
+%
+% \medskip
+% The following line creates the preamble. This line is a adaptation of a line
+% of the initial definition of |\multicolumn|.
+%    \begin{macrocode}
+    \exp_args:NV \@mkpream \g_@@_preamble_tl
+%    \end{macrocode}
+%
+% \medskip
+% Now, you do a treatment specific to \pkg{nicematrix} which has no equivalent
+% in the original definition of |\multicolumn|.
+%    \begin{macrocode}
+    \int_compare:nNnT { #1 } > 1
+      {
+        \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
+          { \int_use:N \c at iRow - \@@_succ:n \c at jCol }
+        \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } 
+        \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
+          { 
+            { \int_use:N \c at iRow } 
+            { \int_eval:n { \c at jCol + 1 } }
+            { \int_use:N \c at iRow }
+            { \int_eval:n { \c at jCol + #1 } }
+          }
+      }
+%    \end{macrocode}
+%
+% \medskip
+% The following lines were in the original definition of |\multicolumn|.
+%    \begin{macrocode}
+    \cs_set:Npn \@sharp { #3 }
+    \set at typeset@protect
+    \cs_set_eq:NN \@startpbox \@@startpbox
+    \cs_set_eq:NN \@endpbox \@@endpbox
+    \@arstrut 
+    \@preamble
+    \hbox { }
+    \endgroup
+    \int_gadd:Nn \c at jCol { #1 - 1 }
+    \int_compare:nNnT \c at jCol > \g_@@_col_total_int
+      { \int_gset_eq:NN \g_@@_col_total_int \c at jCol } 
+    \ignorespaces
+  }
+%    \end{macrocode}
+%
 % \bigskip
+% The following commands will patch the (small) preamble of the |\multicolumn|.
+% All those commands have a |m| in their name to recall that they deal with the
+% redefinition of |\multicolumn|.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble:n #1
+  {
+    \str_case:nnF { #1 }
+      {
+        c { \@@_patch_m_preamble_i:n #1 }
+        l { \@@_patch_m_preamble_i:n #1 }
+        r { \@@_patch_m_preamble_i:n #1 }
+        > { \@@_patch_m_preamble_ii:nn #1 }
+        ! { \@@_patch_m_preamble_ii:nn #1 }
+        @ { \@@_patch_m_preamble_ii:nn #1 }
+        | { \@@_patch_m_preamble_iii:n #1 }
+        p { \@@_patch_m_preamble_iv:nnn t #1 }
+        m { \@@_patch_m_preamble_iv:nnn c #1 }
+        b { \@@_patch_m_preamble_iv:nnn b #1 }
+        \@@_w: { \@@_patch_m_preamble_v:nnnn { }                          #1 } 
+        \@@_W: { \@@_patch_m_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 } 
+        \@@_true_c: { \@@_patch_m_preamble_vi:n #1 }
+        C { \@@_error:nn { old~column~type } #1 }
+        L { \@@_error:nn { old~column~type } #1 }
+        R { \@@_error:nn { old~column~type } #1 }
+        \q_stop { }
+      }
+      { \@@_fatal:nn { unknown~column~type } { #1 } }
+  }
+%    \end{macrocode}
+%
+% \medskip
+% For |c|, |l| and |r|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_i:n #1
+  { 
+    \tl_gput_right:Nn \g_@@_preamble_tl 
+      { 
+        > { \@@_Cell: \tl_set:Nn \l_@@_cell_type_tl { #1 } } 
+        #1 
+        < \@@_end_Cell:
+      }  
+%    \end{macrocode}
+%
+% We test for the presence of a |<|.
+%    \begin{macrocode}
+    \@@_patch_m_preamble_x:n
+  }
+%    \end{macrocode}
+% 
+% \medskip
+% For |>|, |!| and |@|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_ii:nn #1 #2
+  {  
+    \tl_gput_right:Nn \g_@@_preamble_tl { #1 { #2 } }
+    \@@_patch_m_preamble:n
+  }
+%    \end{macrocode}
+%
+% 
+% \medskip
+% For \verb+|+
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_iii:n #1
+  { 
+    \tl_gput_right:Nn \g_@@_preamble_tl { #1 }
+    \@@_patch_m_preamble:n
+  }
+%    \end{macrocode}
+%
+% \medskip
+% For |p|, |m| and |b|
+%    \begin{macrocode}  
+\cs_new_protected:Npn \@@_patch_m_preamble_iv:nnn #1 #2 #3
+  {  
+    \tl_gput_right:Nn \g_@@_preamble_tl
+      {
+        > { 
+            \@@_Cell: 
+            \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
+            \mode_leave_vertical: 
+            \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 { minipage } 
+            \@@_end_Cell: 
+          } 
+      }
+%    \end{macrocode}
+% We test for the presence of a |<|.
+%    \begin{macrocode}
+    \@@_patch_m_preamble_x:n
+  }
+%    \end{macrocode}
+% 
+% \medskip
+% For |w| and |W|
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_v:nnnn #1 #2 #3 #4
+  {  
+    \tl_gput_right:Nn \g_@@_preamble_tl
+      {
+        > {
+            \hbox_set:Nw \l_@@_cell_box
+            \@@_Cell:
+            \tl_set:Nn \l_@@_cell_type_tl { #3 }
+          }
+        c
+        < {
+            \@@_end_Cell:
+            #1
+            \hbox_set_end: 
+            \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
+            \@@_adjust_size_box:
+            \makebox [ #4 ] [ #3 ] { \box_use_drop:N \l_@@_cell_box }   
+          }
+      }
+%    \end{macrocode}
+% We test for the presence of a |<|.
+%    \begin{macrocode}
+    \@@_patch_m_preamble_x:n
+  }
+%    \end{macrocode}
+%
+% \medskip
+% For |\@@_true_c:| which will appear in our redefinition of the columns of type
+% |S| (of \pkg{siunitx}).
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_vi:n #1
+  {
+    \tl_gput_right:Nn \g_@@_preamble_tl { c }
+%    \end{macrocode}
+% We test for the presence of a |<|.
+%    \begin{macrocode}
+    \@@_patch_m_preamble_x:n
+  }
+%    \end{macrocode}
+%
+% 
+% After a specifier of column, we have to test whether there is one or several
+% |<{..}| because, after those potential |<{...}|, we have to insert
+% |!{\skip_horizontal:N ...}| when the key |vlines| is used.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_x:n #1
+  {
+    \str_if_eq:nnTF { #1 } { < }
+      \@@_patch_m_preamble_ix:n 
+      { 
+        \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+          { 
+            \tl_gput_right:Nn \g_@@_preamble_tl 
+              { ! { \skip_horizontal:N \arrayrulewidth } }
+          } 
+          { 
+            \exp_args:NNx 
+            \clist_if_in:NnT \l_@@_vlines_clist { \@@_succ:n \c at jCol } 
+              { 
+                \tl_gput_right:Nn \g_@@_preamble_tl 
+                  { ! { \skip_horizontal:N \arrayrulewidth } }
+              } 
+          }
+        \@@_patch_m_preamble:n { #1 }
+      }
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_ix:n #1
+  {
+    \tl_gput_right:Nn \g_@@_preamble_tl { < { #1 } }
+    \@@_patch_m_preamble_x:n
+  }
+%    \end{macrocode}
+%
+%
+%
+% \bigskip
 % The command |\@@_put_box_in_flow:| puts the box |\l_tmpa_box| (which contains
 % the array) in the flow. It is used for the environments with delimiters.
 % First, we have to modify the height and the depth to take back into account
@@ -9457,7 +9761,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
-% specify the width of the columns).
+% specifies the width of the columns).
 %    \begin{macrocode}
 \cs_new:Npn \@@_create_col_nodes:
   {
@@ -9609,11 +9913,28 @@
             }   
         \endpgfpicture  
       }
+%    \end{macrocode}
+% 
+% \bigskip
+% We want to remove the exterior |\arraycolsep| of a environment |{NiceArray}|. 
+%    \begin{macrocode}
+    \bool_lazy_all:nT 
+      { 
+        \l_@@_NiceArray_bool 
+        { \bool_not_p:n \l_@@_NiceTabular_bool }
+        { \clist_if_empty_p:N \l_@@_vlines_clist } 
+        { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
+        { ! \l_@@_bar_at_end_of_pream_bool }
+      }
+      { \skip_horizontal:n { - \col at sep } }
+%    \end{macrocode}
+%
+% \bigskip
+%    \begin{macrocode}
     \bool_if:NT \g_@@_last_col_found_bool
       {
         \hbox_overlap_right:n
           {
-            % \skip_horizontal:N \col at sep
             \skip_horizontal:N \g_@@_width_last_col_dim 
             \bool_if:NT \l_@@_code_before_bool
               { 
@@ -11703,62 +12024,10 @@
   }
 %    \end{macrocode}
 %
-%
-% \bigskip
-% In the environment |{NiceArray}|, the command |\multicolumn| will be linked to
-% the following command |\@@_multicolumn:nnn|.
 %    \begin{macrocode}
 \cs_set_eq:NN \@@_old_multicolumn \multicolumn
-\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
-  { 
 %    \end{macrocode}
-% We have to act in an expandable way since it will begin by a |\multicolumn|.
-%    \begin{macrocode}
-    \exp_args:NNe 
-      \@@_old_multicolumn 
-      { #1 } 
-      { 
-        \exp_args:Ne \str_case:nn { \str_foldcase:n { #2 } }
-          {
-             l { > \@@_Cell: l < \@@_end_Cell: }
-             r { > \@@_Cell: r < \@@_end_Cell: }
-             c { > \@@_Cell: c < \@@_end_Cell: }
-             { l | } { > \@@_Cell: l < \@@_end_Cell: | }
-             { r | } { > \@@_Cell: r < \@@_end_Cell: | }
-             { c | } { > \@@_Cell: c < \@@_end_Cell: | }
-             { | l } { | > \@@_Cell: l < \@@_end_Cell: }
-             { | r } { | > \@@_Cell: r < \@@_end_Cell: }
-             { | c } { | > \@@_Cell: c < \@@_end_Cell: }
-             { | l | } { | > \@@_Cell: l < \@@_end_Cell: | }
-             { | r | } { | > \@@_Cell: r < \@@_end_Cell: | }
-             { | c | } { | > \@@_Cell: c < \@@_end_Cell: | }
-          }
-      }       
-      { #3 } 
-%    \end{macrocode}
-% The |\peek_remove_spaces:n| is mandatory.
-%    \begin{macrocode}
-    \peek_remove_spaces:n
-      {
-        \int_compare:nNnT #1 > 1
-          {
-            \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
-              { \int_use:N \c at iRow - \int_use:N \c at jCol }
-            \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } 
-            \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
-              { 
-                { \int_use:N \c at iRow } 
-                { \int_use:N \c at jCol }
-                { \int_use:N \c at iRow }
-                { \int_eval:n { \c at jCol + #1 - 1 } }
-              }
-          }
-        \int_gadd:Nn \c at jCol { #1 - 1 }
-        \int_compare:nNnT \c at jCol > \g_@@_col_total_int
-          { \int_gset_eq:NN \g_@@_col_total_int \c at jCol } 
-     }
-  }
-%    \end{macrocode}
+% 
 %
 %
 % \bigskip
@@ -11813,7 +12082,8 @@
               { #2 }  
               { 
                 #1 , #3 , 
-                down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
+                down = \exp_not:n { #4 } , 
+                up = \exp_not:n { #5 }
               } 
           }   
         \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { c } { } }
@@ -12950,7 +13220,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% The command |\@@_draw_hlines:| draws all the vertical rules excepted in the
+% The command |\@@_draw_vlines:| draws all the vertical rules excepted in the
 % blocks, in the virtual blocks (determined by a command such as |\Cdots|) and in
 % the corners (if the key |corners| is used).
 %    \begin{macrocode}
@@ -12957,9 +13227,16 @@
 \cs_new_protected:Npn \@@_draw_vlines:
   {
     \int_step_inline:nnn 
-      { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
-      { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c at jCol } \c at jCol }
       { 
+        \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+          1 2 
+      }
+      { 
+        \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+          { \@@_succ:n \c at jCol } 
+          \c at jCol 
+      }
+      { 
         \tl_if_eq:NnF \l_@@_vlines_clist { all } 
           { \clist_if_in:NnT \l_@@_vlines_clist { ##1 } }
           { \@@_vline:nn { ##1 } 1 }
@@ -13131,9 +13408,16 @@
 \cs_new_protected:Npn \@@_draw_hlines:
   {
     \int_step_inline:nnn 
-      { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
-      { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c at iRow } \c at iRow }  
       { 
+        \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+          1 2 
+      }
+      { 
+        \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+          { \@@_succ:n \c at iRow } 
+          \c at iRow
+      }
+      { 
         \tl_if_eq:NnF \l_@@_hlines_clist { all } 
           { \clist_if_in:NnT \l_@@_hlines_clist { ##1 } }
           { \@@_hline:nn { ##1 } 1 }
@@ -13180,7 +13464,6 @@
 % 
 % \subsection*{The key hvlines}
 %
-%
 % The following command tests whether the current position in the array (given by
 % |\l_tmpa_tl| for the row and |\l_tmpb_tl| for the column) would provide an
 % horizontal rule towards the right in the block delimited by the four arguments
@@ -13603,7 +13886,6 @@
 % \bigskip
 % \textbf{Vertical dotted lines}\par\nobreak
 %
-%
 % \medskip
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_vdottedline:n #1
@@ -14106,6 +14388,12 @@
     r .value_forbidden:n = true ,
     c .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c ,
     c .value_forbidden:n = true ,
+    L .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl l ,
+    L .value_forbidden:n = true ,
+    R .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl r ,
+    R .value_forbidden:n = true ,
+    C .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c ,
+    C .value_forbidden:n = true ,
     t .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl t ,
     t .value_forbidden:n = true ,
     b .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl b ,
@@ -14461,6 +14749,15 @@
     r .value_forbidden:n = true ,
     c .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c ,
     c .value_forbidden:n = true ,
+    L .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl l 
+                \bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
+    L .value_forbidden:n = true ,
+    R .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl r 
+                \bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
+    R .value_forbidden:n = true ,
+    C .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c 
+                \bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
+    C .value_forbidden:n = true ,
     t .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl t ,
     t .value_forbidden:n = true ,
     b .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl b ,
@@ -14634,9 +14931,8 @@
 % |!{\hspace{1cm}}| in the preamble which increases the space between the
 % columns (by adding, in fact, that space to the previous column, that is to say
 % the second column of the tabular), we will create \emph{two} nodes relative to
-% the block: the node |1-1-block| and the node |1-1-block-short|. The latter
-% will be used by \pkg{nicematrix} to put the label of the node. The first one
-% won't be used explicitely.
+% the block: the node |1-1-block| and the node |1-1-block-short|. 
+% 
 % \begin{Verbatim}
 % \begin{NiceTabular}{cc!{\hspace{1cm}}c}
 % \Block{2-2}{our block} &      & one    \\
@@ -14705,58 +15001,71 @@
 %    \end{macrocode}
 % 
 % \medskip
-% We construct the |short| node.
+% Now, we create the ``short node'' which, in general, will be used to put the
+% label (that is to say the content of the node). However, if one the keys |L|, |C| or
+% |R| is used (that information is provided by the boolean 
+% |\l_@@_hpos_of_block_cap_bool|), we don't need to create that node since the
+% normal node is used to put the label.
+%
 %    \begin{macrocode}
-      \dim_set_eq:NN \l_tmpb_dim \c_max_dim 
-      \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+      \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
+            {
+%    \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 }
+              \cs_if_exist:cT
+                { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
                 {
-                  \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
-                  \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }  
+                  \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 }
+          \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
             {
-              \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+              \@@_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 } 
                 {
-                  \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 }
+                  \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 - \@@_succ:n { \l_@@_last_col_int } } 
+              \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_tmpd_dim = { - \c_max_dim }
-        {
-          \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } 
-          \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
@@ -14806,7 +15115,10 @@
 % We retrieve (in |\pgf at x|) the $x$-value of the center of the block.
 %    \begin{macrocode}
         \pgfpointanchor 
-          { \@@_env: - #1 - #2 - block - short } 
+          { 
+            \@@_env: - #1 - #2 - block 
+            \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+          } 
           {
             \str_case:Vn \l_@@_hpos_of_block_tl
               {
@@ -14853,7 +15165,10 @@
         \pgftransformshift
           {
             \pgfpointanchor 
-              { \@@_env: - #1 - #2 - block - short } 
+              { 
+                \@@_env: - #1 - #2 - block 
+                \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+              }
               {
                 \str_case:Vn \l_@@_hpos_of_block_tl
                   {
@@ -15148,6 +15463,18 @@
 %    \end{macrocode}
 %
 %
+% \bigskip
+% We will extract the potential keys |l|, |r| and |c| and pass the other keys to
+% the environment |{NiceArrayWithDelims}|.
+%    \begin{macrocode} 
+\keys_define:nn { NiceMatrix / Auto }
+  {
+    l .code:n = \tl_set:Nn \l_@@_type_of_col_tl l ,
+    r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
+    c .code:n = \tl_set:Nn \l_@@_type_of_col_tl c 
+  }
+%    \end{macrocode}
+% 
 %    \begin{macrocode}
 \NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } } 
   {
@@ -15154,8 +15481,18 @@
     \int_zero_new:N \l_@@_nb_rows_int
     \int_zero_new:N \l_@@_nb_cols_int
     \@@_set_size:n #4 \q_stop
-    \begin { NiceArrayWithDelims } { #1 } { #2 } 
-      { * { \l_@@_nb_cols_int } { c } } [ #3 , #5 , #7 ] 
+%    \end{macrocode}
+% The group is for the protection of |\l_@@_type_of_col_tl|.
+%    \begin{macrocode}
+    \group_begin:
+    \tl_set:Nn \l_@@_type_of_col_tl c 
+    \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl
+    \use:x 
+      {
+        \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } 
+          { * { \int_use:N \l_@@_nb_cols_int } { \l_@@_type_of_col_tl } } 
+          [ \l_tmpa_tl ] 
+      }
     \int_compare:nNnT \l_@@_first_row_int = 0
       { 
         \int_compare:nNnT \l_@@_first_col_int = 0 { & } 
@@ -15166,7 +15503,7 @@
       { 
         \int_compare:nNnT \l_@@_first_col_int = 0 { & }
 %    \end{macrocode}
-% You put |{ }| before |#6| to avoid a hasty expansion of a potential
+% We put |{ }| before |#6| to avoid a hasty expansion of a potential
 % |\arabic{iRow}| at the beginning of the row which would result in an incorrect
 % value of that |iRow| (since |iRow| is incremented in the first cell of the row
 % of the |\halign|).
@@ -15181,6 +15518,7 @@
         \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\  
       }
     \end { NiceArrayWithDelims }
+    \group_end:
   }
 %    \end{macrocode}
 % 
@@ -16108,10 +16446,20 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+\@@_msg_new:nn { define-L-C-R }
+  {
+    You~have~used~the~key~'define-L-C-R'.~Please~note~that~this~key~
+    will~probably~be~deleted~in~a~future~version~of~'nicematrix'.\\
+    However,~you~can~go~on.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Package }
   {
-    define-L-C-R .bool_set:N = \c_@@_define_L_C_R_bool ,
-    define-L-C-R .default:n = true ,
+    define-L-C-R .code:n = 
+      \@@_error:n { define-L-C-R }
+      \bool_set_true:N \c_@@_define_L_C_R_bool ,
     renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
     renew-dots .value_forbidden:n = true ,
     renew-matrix .code:n = \@@_renew_matrix: ,
@@ -17465,7 +17813,7 @@
 % The version 5.15b is compatible with the version 3.0+ of \pkg{siunitx}
 % (previous versions were not).
 %
-% % \subsection*{Changes between versions 5.15 and 5.16}
+% \subsection*{Changes between versions 5.15 and 5.16}
 %
 % It's now possible to use the cells corresponding to the contents of the nodes
 % (of the form |i-j|) in the |\CodeBefore| when the key |create-cell-nodes| of
@@ -17472,6 +17820,18 @@
 % that |\CodeBefore| is used. The medium and the large nodes are also available
 % if the corresponding keys are used.
 %
+% \subsection*{Changes between versions 5.16 and 5.17}
+% 
+% The key |define-L-C-R| (only available at load-time) now raises a (non fatal)
+% error (that key will probably be deleted in a future version of \pkg{nicematrix}).
+%
+% Keys |L|, |C| and |R| for the command |\Block|.
+% 
+% Key |hvlines-except-borders|.
+%
+% It's now possible to use a key |l|, |r| or |c| with the command
+% |\pAutoNiceMatrix| (and the similar ones).
+% 
 % \PrintIndex
 % 
 % \tableofcontents

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2021-07-02 19:58:00 UTC (rev 59810)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2021-07-02 19:58:15 UTC (rev 59811)
@@ -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.16}
-\def\myfiledate{2021/06/20}
+\def\myfileversion{5.17}
+\def\myfiledate{2021/07/01}
 \RequirePackage{pgfcore}
 \usepgfmodule{shapes}
 \RequirePackage{l3keys2e}
@@ -360,6 +360,7 @@
 \dim_new:N \l__nicematrix_line_width_dim
 \tl_new:N \l__nicematrix_hpos_of_block_tl
 \tl_set:Nn \l__nicematrix_hpos_of_block_tl { c }
+\bool_new:N \l__nicematrix_hpos_of_block_cap_bool
 \tl_new:N \l__nicematrix_vpos_of_block_tl
 \tl_set:Nn \l__nicematrix_vpos_of_block_tl { c }
 \bool_new:N \l__nicematrix_draw_first_bool
@@ -528,6 +529,7 @@
 \str_new:N \l__nicematrix_name_str
 \bool_new:N \l__nicematrix_medium_nodes_bool
 \bool_new:N \l__nicematrix_large_nodes_bool
+\bool_new:N \l__nicematrix_except_borders_bool
 \dim_new:N \l__nicematrix_left_margin_dim
 \dim_new:N \l__nicematrix_right_margin_dim
 \dim_new:N \l__nicematrix_extra_left_margin_dim
@@ -616,6 +618,12 @@
         \clist_set:Nn \l__nicematrix_vlines_clist { all }
         \clist_set:Nn \l__nicematrix_hlines_clist { all }
       } ,
+    hvlines-except-borders .code:n =
+      {
+        \clist_set:Nn \l__nicematrix_vlines_clist { all }
+        \clist_set:Nn \l__nicematrix_hlines_clist { all }
+        \bool_set_true:N \l__nicematrix_except_borders_bool
+      } ,
     parallelize-diags .bool_set:N = \l__nicematrix_parallelize_diags_bool ,
     renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool ,
     renew-dots .value_forbidden:n = true ,
@@ -1616,6 +1624,7 @@
         \@whilesw \if at tempswa \fi { \@tempswafalse \the \NC at list }
         \int_gzero:N \c at jCol
         \tl_gclear:N \g__nicematrix_preamble_tl
+        \bool_gset_false:N \g_tmpb_bool
         \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all }
           {
             \tl_gset:Nn \g__nicematrix_preamble_tl
@@ -1645,6 +1654,7 @@
       { ! \str_if_eq_p:Vn \g__nicematrix_left_delim_tl { . } }
       { ! \str_if_eq_p:Vn \g__nicematrix_right_delim_tl { . } }
       { \bool_set_false:N \l__nicematrix_NiceArray_bool }
+    \bool_if:NT \g_tmpb_bool { \bool_set_true:N \l__nicematrix_bar_at_end_of_pream_bool }
     \int_compare:nNnTF \l__nicematrix_first_col_int = 0
       { \tl_gput_left:NV \g__nicematrix_preamble_tl \c__nicematrix_preamble_first_col_tl }
       {
@@ -1771,9 +1781,12 @@
         \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
           { \__nicematrix_vline:nn { \__nicematrix_succ:n \c at jCol } { \int_use:N \l_tmpa_int } }
         \int_zero:N \l_tmpa_int
+        \str_if_eq:nnT { #1 } { \q_stop }
+          { \bool_gset_true:N \g_tmpb_bool }
         \__nicematrix_patch_preamble:n #1
       }
   }
+\bool_new:N \l__nicematrix_bar_at_end_of_pream_bool
 \cs_new_protected:Npn \__nicematrix_patch_preamble_iv:nnn #1 #2 #3
   {
     \tl_gput_right:Nn \g__nicematrix_preamble_tl
@@ -1836,26 +1849,21 @@
           }
           {
             \tl_gput_right:Nn \g__nicematrix_preamble_tl { ! { \enskip } }
-            \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
-              { \__nicematrix_delimiter:nnn #1 { \__nicematrix_succ:n \c at jCol } \c_true_bool }
-            \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
-              {
-                \__nicematrix_error:nn { delimiter~after~opening } { #2 }
-                \__nicematrix_patch_preamble:n
-              }
-              { \__nicematrix_patch_preamble:n #2 }
+            \__nicematrix_patch_preamble_vii_i:nn { #1 } { #2 }
           }
       }
+      { \__nicematrix_patch_preamble_vii_i:nn { #1 } { #2 } }
+  }
+\cs_new_protected:Npn \__nicematrix_patch_preamble_vii_i:nn #1 #2
+  {
+    \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+      { \__nicematrix_delimiter:nnn #1 { \__nicematrix_succ:n \c at jCol } \c_true_bool }
+    \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
       {
-        \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
-          { \__nicematrix_delimiter:nnn #1 { \__nicematrix_succ:n \c at jCol } \c_true_bool }
-        \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
-          {
-            \__nicematrix_error:nn { delimiter~after~opening } { #2 }
-            \__nicematrix_patch_preamble:n
-          }
-          { \__nicematrix_patch_preamble:n #2 }
+        \__nicematrix_error:nn { delimiter~after~opening } { #2 }
+        \__nicematrix_patch_preamble:n
       }
+      { \__nicematrix_patch_preamble:n #2 }
   }
 \cs_new_protected:Npn \__nicematrix_patch_preamble_viii:nn #1 #2
   {
@@ -1942,6 +1950,158 @@
     \tl_gput_right:Nn \g__nicematrix_preamble_tl { < { #1 } }
     \__nicematrix_patch_preamble_x:n
   }
+\cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3
+  {
+    \multispan { #1 }
+    \begingroup
+    \@temptokena = { #2 }
+    \@tempswatrue
+    \@whilesw \if at tempswa \fi { \@tempswafalse \the \NC at list }
+    \tl_gclear:N \g__nicematrix_preamble_tl
+    \exp_after:wN \__nicematrix_patch_m_preamble:n \the \@temptokena \q_stop
+    \exp_args:NV \@mkpream \g__nicematrix_preamble_tl
+    \int_compare:nNnT { #1 } > 1
+      {
+        \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
+          { \int_use:N \c at iRow - \__nicematrix_succ:n \c at jCol }
+        \seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 }
+        \seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq
+          {
+            { \int_use:N \c at iRow }
+            { \int_eval:n { \c at jCol + 1 } }
+            { \int_use:N \c at iRow }
+            { \int_eval:n { \c at jCol + #1 } }
+          }
+      }
+    \cs_set:Npn \@sharp { #3 }
+    \set at typeset@protect
+    \cs_set_eq:NN \@startpbox \__nicematrixstartpbox
+    \cs_set_eq:NN \@endpbox \__nicematrixendpbox
+    \@arstrut
+    \@preamble
+    \hbox { }
+    \endgroup
+    \int_gadd:Nn \c at jCol { #1 - 1 }
+    \int_compare:nNnT \c at jCol > \g__nicematrix_col_total_int
+      { \int_gset_eq:NN \g__nicematrix_col_total_int \c at jCol }
+    \ignorespaces
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble:n #1
+  {
+    \str_case:nnF { #1 }
+      {
+        c { \__nicematrix_patch_m_preamble_i:n #1 }
+        l { \__nicematrix_patch_m_preamble_i:n #1 }
+        r { \__nicematrix_patch_m_preamble_i:n #1 }
+        > { \__nicematrix_patch_m_preamble_ii:nn #1 }
+        ! { \__nicematrix_patch_m_preamble_ii:nn #1 }
+        @ { \__nicematrix_patch_m_preamble_ii:nn #1 }
+        | { \__nicematrix_patch_m_preamble_iii:n #1 }
+        p { \__nicematrix_patch_m_preamble_iv:nnn t #1 }
+        m { \__nicematrix_patch_m_preamble_iv:nnn c #1 }
+        b { \__nicematrix_patch_m_preamble_iv:nnn b #1 }
+        \__nicematrix_w: { \__nicematrix_patch_m_preamble_v:nnnn { }                          #1 }
+        \__nicematrix_W: { \__nicematrix_patch_m_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
+        \__nicematrix_true_c: { \__nicematrix_patch_m_preamble_vi:n #1 }
+        C { \__nicematrix_error:nn { old~column~type } #1 }
+        L { \__nicematrix_error:nn { old~column~type } #1 }
+        R { \__nicematrix_error:nn { old~column~type } #1 }
+        \q_stop { }
+      }
+      { \__nicematrix_fatal:nn { unknown~column~type } { #1 } }
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_i:n #1
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl
+      {
+        > { \__nicematrix_Cell: \tl_set:Nn \l__nicematrix_cell_type_tl { #1 } }
+        #1
+        < \__nicematrix_end_Cell:
+      }
+    \__nicematrix_patch_m_preamble_x:n
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_ii:nn #1 #2
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl { #1 { #2 } }
+    \__nicematrix_patch_m_preamble:n
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_iii:n #1
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl { #1 }
+    \__nicematrix_patch_m_preamble:n
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_iv:nnn #1 #2 #3
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl
+      {
+        > {
+            \__nicematrix_Cell:
+            \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
+            \mode_leave_vertical:
+            \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 { minipage }
+            \__nicematrix_end_Cell:
+          }
+      }
+    \__nicematrix_patch_m_preamble_x:n
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_v:nnnn #1 #2 #3 #4
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl
+      {
+        > {
+            \hbox_set:Nw \l__nicematrix_cell_box
+            \__nicematrix_Cell:
+            \tl_set:Nn \l__nicematrix_cell_type_tl { #3 }
+          }
+        c
+        < {
+            \__nicematrix_end_Cell:
+            #1
+            \hbox_set_end:
+            \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
+            \__nicematrix_adjust_size_box:
+            \makebox [ #4 ] [ #3 ] { \box_use_drop:N \l__nicematrix_cell_box }
+          }
+      }
+    \__nicematrix_patch_m_preamble_x:n
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_vi:n #1
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl { c }
+    \__nicematrix_patch_m_preamble_x:n
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_x:n #1
+  {
+    \str_if_eq:nnTF { #1 } { < }
+      \__nicematrix_patch_m_preamble_ix:n
+      {
+        \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all }
+          {
+            \tl_gput_right:Nn \g__nicematrix_preamble_tl
+              { ! { \skip_horizontal:N \arrayrulewidth } }
+          }
+          {
+            \exp_args:NNx
+            \clist_if_in:NnT \l__nicematrix_vlines_clist { \__nicematrix_succ:n \c at jCol }
+              {
+                \tl_gput_right:Nn \g__nicematrix_preamble_tl
+                  { ! { \skip_horizontal:N \arrayrulewidth } }
+              }
+          }
+        \__nicematrix_patch_m_preamble:n { #1 }
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_patch_m_preamble_ix:n #1
+  {
+    \tl_gput_right:Nn \g__nicematrix_preamble_tl { < { #1 } }
+    \__nicematrix_patch_m_preamble_x:n
+  }
 \cs_new_protected:Npn \__nicematrix_put_box_in_flow:
   {
     \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim }
@@ -2305,11 +2465,19 @@
             }
         \endpgfpicture
       }
+    \bool_lazy_all:nT
+      {
+        \l__nicematrix_NiceArray_bool
+        { \bool_not_p:n \l__nicematrix_NiceTabular_bool }
+        { \clist_if_empty_p:N \l__nicematrix_vlines_clist }
+        { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
+        { ! \l__nicematrix_bar_at_end_of_pream_bool }
+      }
+      { \skip_horizontal:n { - \col at sep } }
     \bool_if:NT \g__nicematrix_last_col_found_bool
       {
         \hbox_overlap_right:n
           {
-            % \skip_horizontal:N \col at sep
             \skip_horizontal:N \g__nicematrix_width_last_col_dim
             \bool_if:NT \l__nicematrix_code_before_bool
               {
@@ -3583,49 +3751,6 @@
    \hspace
   }
 \cs_set_eq:NN \__nicematrix_old_multicolumn \multicolumn
-\cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3
-  {
-    \exp_args:NNe
-      \__nicematrix_old_multicolumn
-      { #1 }
-      {
-        \exp_args:Ne \str_case:nn { \str_foldcase:n { #2 } }
-          {
-             l { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: }
-             r { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: }
-             c { > \__nicematrix_Cell: c < \__nicematrix_end_Cell: }
-             { l | } { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: | }
-             { r | } { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: | }
-             { c | } { > \__nicematrix_Cell: c < \__nicematrix_end_Cell: | }
-             { | l } { | > \__nicematrix_Cell: l < \__nicematrix_end_Cell: }
-             { | r } { | > \__nicematrix_Cell: r < \__nicematrix_end_Cell: }
-             { | c } { | > \__nicematrix_Cell: c < \__nicematrix_end_Cell: }
-             { | l | } { | > \__nicematrix_Cell: l < \__nicematrix_end_Cell: | }
-             { | r | } { | > \__nicematrix_Cell: r < \__nicematrix_end_Cell: | }
-             { | c | } { | > \__nicematrix_Cell: c < \__nicematrix_end_Cell: | }
-          }
-      }
-      { #3 }
-    \peek_remove_spaces:n
-      {
-        \int_compare:nNnT #1 > 1
-          {
-            \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
-              { \int_use:N \c at iRow - \int_use:N \c at jCol }
-            \seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 }
-            \seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq
-              {
-                { \int_use:N \c at iRow }
-                { \int_use:N \c at jCol }
-                { \int_use:N \c at iRow }
-                { \int_eval:n { \c at jCol + #1 - 1 } }
-              }
-          }
-        \int_gadd:Nn \c at jCol { #1 - 1 }
-        \int_compare:nNnT \c at jCol > \g__nicematrix_col_total_int
-          { \int_gset_eq:NN \g__nicematrix_col_total_int \c at jCol }
-     }
-  }
 \cs_new:Npn \__nicematrix_Hdotsfor:
   {
     \bool_lazy_and:nnTF
@@ -3658,7 +3783,8 @@
               { #2 }
               {
                 #1 , #3 ,
-                down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
+                down = \exp_not:n { #4 } ,
+                up = \exp_not:n { #5 }
               }
           }
         \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { c } { } }
@@ -4328,9 +4454,16 @@
 \cs_new_protected:Npn \__nicematrix_draw_vlines:
   {
     \int_step_inline:nnn
-      { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 }
-      { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c at jCol } \c at jCol }
       {
+        \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool }
+          1 2
+      }
+      {
+        \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool }
+          { \__nicematrix_succ:n \c at jCol }
+          \c at jCol
+      }
+      {
         \tl_if_eq:NnF \l__nicematrix_vlines_clist { all }
           { \clist_if_in:NnT \l__nicematrix_vlines_clist { ##1 } }
           { \__nicematrix_vline:nn { ##1 } 1 }
@@ -4451,9 +4584,16 @@
 \cs_new_protected:Npn \__nicematrix_draw_hlines:
   {
     \int_step_inline:nnn
-      { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 }
-      { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c at iRow } \c at iRow }
       {
+        \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool }
+          1 2
+      }
+      {
+        \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool }
+          { \__nicematrix_succ:n \c at iRow }
+          \c at iRow
+      }
+      {
         \tl_if_eq:NnF \l__nicematrix_hlines_clist { all }
           { \clist_if_in:NnT \l__nicematrix_hlines_clist { ##1 } }
           { \__nicematrix_hline:nn { ##1 } 1 }
@@ -4953,6 +5093,12 @@
     r .value_forbidden:n = true ,
     c .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c ,
     c .value_forbidden:n = true ,
+    L .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl l ,
+    L .value_forbidden:n = true ,
+    R .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl r ,
+    R .value_forbidden:n = true ,
+    C .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c ,
+    C .value_forbidden:n = true ,
     t .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl t ,
     t .value_forbidden:n = true ,
     b .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl b ,
@@ -5176,6 +5322,15 @@
     r .value_forbidden:n = true ,
     c .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c ,
     c .value_forbidden:n = true ,
+    L .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl l
+                \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool ,
+    L .value_forbidden:n = true ,
+    R .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl r
+                \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool ,
+    R .value_forbidden:n = true ,
+    C .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c
+                \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool ,
+    C .value_forbidden:n = true ,
     t .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl t ,
     t .value_forbidden:n = true ,
     b .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl b ,
@@ -5297,47 +5452,50 @@
         { \__nicematrix_env: - #1 - #2 - block }
         \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
       \end { pgfscope }
-      \dim_set_eq:NN \l_tmpb_dim \c_max_dim
-      \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+      \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool
         {
-          \cs_if_exist:cT
-            { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
+          \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+          \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
             {
-              \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
+              \cs_if_exist:cT
+                { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
                 {
-                  \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west }
-                  \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
+                  \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_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 }
+          \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
             {
-              \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
+              \__nicematrix_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__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 }
                 {
-                  \pgfpointanchor
-                    { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
-                    { east }
-                  \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf at x }
+                  \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_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf at x }
+                    }
                 }
             }
+          \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
+            {
+              \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
+              \dim_set_eq:NN \l_tmpd_dim \pgf at x
+            }
+          \__nicematrix_pgf_rect_node:nnnnn
+            { \__nicematrix_env: - #1 - #2 - block - short }
+            \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
         }
-      \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
-        {
-          \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
-          \dim_set_eq:NN \l_tmpd_dim \pgf at x
-        }
-      \__nicematrix_pgf_rect_node:nnnnn
-        { \__nicematrix_env: - #1 - #2 - block - short }
-        \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
     \bool_if:NT \l__nicematrix_medium_nodes_bool
       {
         \__nicematrix_pgf_rect_node:nnn
@@ -5362,8 +5520,11 @@
           }
             \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } }
         \pgfpointanchor
-          { \__nicematrix_env: - #1 - #2 - block - short }
           {
+            \__nicematrix_env: - #1 - #2 - block
+            \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
+          }
+          {
             \str_case:Vn \l__nicematrix_hpos_of_block_tl
               {
                 c { center }
@@ -5396,8 +5557,11 @@
         \pgftransformshift
           {
             \pgfpointanchor
-              { \__nicematrix_env: - #1 - #2 - block - short }
               {
+                \__nicematrix_env: - #1 - #2 - block
+                \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
+              }
+              {
                 \str_case:Vn \l__nicematrix_hpos_of_block_tl
                   {
                     c { center }
@@ -5614,13 +5778,26 @@
     \int_set:Nn \l__nicematrix_nb_rows_int { #1 }
     \int_set:Nn \l__nicematrix_nb_cols_int { #2 }
   }
+\keys_define:nn { NiceMatrix / Auto }
+  {
+    l .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl l ,
+    r .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl r ,
+    c .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl c
+  }
 \NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } }
   {
     \int_zero_new:N \l__nicematrix_nb_rows_int
     \int_zero_new:N \l__nicematrix_nb_cols_int
     \__nicematrix_set_size:n #4 \q_stop
-    \begin { NiceArrayWithDelims } { #1 } { #2 }
-      { * { \l__nicematrix_nb_cols_int } { c } } [ #3 , #5 , #7 ]
+    \group_begin:
+    \tl_set:Nn \l__nicematrix_type_of_col_tl c
+    \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl
+    \use:x
+      {
+        \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
+          { * { \int_use:N \l__nicematrix_nb_cols_int } { \l__nicematrix_type_of_col_tl } }
+          [ \l_tmpa_tl ]
+      }
     \int_compare:nNnT \l__nicematrix_first_row_int = 0
       {
         \int_compare:nNnT \l__nicematrix_first_col_int = 0 { & }
@@ -5640,6 +5817,7 @@
         \int_compare:nNnT \l__nicematrix_last_col_int > { -1 } { & } \\
       }
     \end { NiceArrayWithDelims }
+    \group_end:
   }
 \cs_set_protected:Npn \__nicematrix_define_com:nnn #1 #2 #3
   {
@@ -6193,10 +6371,17 @@
     is~not~clear).~You~should~use~the~conjonction~of~'renew-dots'~
     and~'renew-matrix'.~However,~you~can~go~on.
   }
+\__nicematrix_msg_new:nn { define-L-C-R }
+  {
+    You~have~used~the~key~'define-L-C-R'.~Please~note~that~this~key~
+    will~probably~be~deleted~in~a~future~version~of~'nicematrix'.\\
+    However,~you~can~go~on.
+  }
 \keys_define:nn { NiceMatrix / Package }
   {
-    define-L-C-R .bool_set:N = \c__nicematrix_define_L_C_R_bool ,
-    define-L-C-R .default:n = true ,
+    define-L-C-R .code:n =
+      \__nicematrix_error:n { define-L-C-R }
+      \bool_set_true:N \c__nicematrix_define_L_C_R_bool ,
     renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool ,
     renew-dots .value_forbidden:n = true ,
     renew-matrix .code:n = \__nicematrix_renew_matrix: ,



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