texlive[63993] Master/texmf-dist: nicematrix (28jul22)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 28 22:06:08 CEST 2022


Revision: 63993
          http://tug.org/svn/texlive?view=revision&revision=63993
Author:   karl
Date:     2022-07-28 22:06:07 +0200 (Thu, 28 Jul 2022)
Log Message:
-----------
nicematrix (28jul22)

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	2022-07-28 20:05:53 UTC (rev 63992)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex	2022-07-28 20:06:07 UTC (rev 63993)
@@ -15,6 +15,7 @@
 \usepackage{enumitem}
 \usepackage{siunitx}
 \usepackage{verbatim}
+\usepackage{caption}
 
 % We use \MakeShortVerb of shortvrb and not \DefineShortVerb of fancyvrb
 % because we don't want the contents of short verbatim colored in gray
@@ -772,7 +773,7 @@
 Dans les environnements de \pkg{nicematrix}, les filets verticaux spécifiés par
 \verb+|+ dans le préambule des environnements ne sont jamais coupés, même en cas
 de ligne incomplète ou de double filet horizontal spécifié par |\hline\hline|
-(il n'y a pas besoin d'utiliser \pkg{hhline}).
+(il n'y a pas besoin d'utiliser l'extension \pkg{hhline}).
 
 \medskip
 \begin{BVerbatim}[baseline=c,boxwidth=10cm]
@@ -1342,9 +1343,8 @@
 \end{BVerbatim}
 
 \bigskip
-Dans les environnements de \pkg{nicematrix}, il est donc possible d'utiliser les
-commandes |\hdottedline| et |\cdottedline| pour tracer des filets horizontaux en
-pointillés. 
+Il est donc possible d'utiliser les commandes |\hdottedline| et |\cdottedline|
+pour tracer des filets horizontaux en pointillés.
 
 \medskip
 \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
@@ -1352,7 +1352,7 @@
 1 & 2 & 3 & 4 & 5 \\
 ~emphase#\hdottedline@
 6 & 7 & 8 & 9 & 10 \\
- emphase#\cdottedline{1,4-5}@
+~emphase#\cdottedline{1,4-5}@
 11 & 12 & 13 & 14 & 15
 \end{pNiceMatrix}
 \end{BVerbatim}
@@ -1447,13 +1447,10 @@
 
 \medskip
 L'extension \pkg{nicematrix} fournit une clé |code-before| pour du code qui sera
-exécuté avant le tracé du tableau.
+exécuté avant le tracé du tableau. Une syntaxe alternative est proposée : on
+peut placer le contenu de ce |code-before| entre les mots-clés |\CodeBefore| et
+|\Body| juste au début de l'environnement.
 
-\smallskip
-Une syntaxe alternative est proposée : on peut placer le contenu de ce
-|code-before| entre les mots-clés |\CodeBefore| et |\Body| juste au début de
-l'environnement.
-
 \begin{Verbatim}
 \begin{pNiceArray}{~textsl#preamble@}
 ~emphase#\CodeBefore@
@@ -3322,10 +3319,36 @@
 \end{pNiceMatrix}$
 
 
-\section{Les notes dans les tableaux}
+\section{Les légendes et les notes dans les tableaux}
 
 \label{s:notes}
 
+\subsection{La légendes des tableaux}
+
+\colorbox{yellow!50}{\bfseries Nouveau 6.12}\enskip L'environnement
+|{NiceTabular}| proposent des clés |caption|, |short-caption| et |label| à
+utiliser lorsque le tableau est inséré dans un environnment flottant
+(typiquement un environnement |{table}|).
+
+\smallskip
+L'intérêt d'utiliser cette clé |caption| plutôt que la commande classique
+|\caption| est que la légende, si elle longue, est justifiée à la largeur du
+tableau (sans avoir à utiliser l'extension \pkg{threeparttable} ou l'extension
+\pkg{floatrow}). 
+
+\smallskip
+Par défaut, la légende est placée au-dessous du tableau. Pour avoir la légence
+placée au-dessus, il convient d'utiliser la clé |caption-above| dans
+|\NiceMatrixOptions|. 
+
+\smallskip
+La clé |short-caption| correspond à l'argument optionnel de la commande
+classique |\caption| et la clé |label| correspond bien sûr à la commande |\label|.
+
+\smallskip
+Voir table \ref{t:tabularnote}, p.~\pageref{t:tabularnote} un exemple
+d'utilisation des clés |caption| et |label|.
+
 \subsection{Les notes de pied de page}
 
 \smallskip
@@ -3409,7 +3432,10 @@
 \begin{itemize}
 \item La commande |\tabularnote| est en fait utilisable avant
 l'environnement de \pkg{nicematrix}, le but étant de pouvoir l'utiliser sur le
-titre inséré par |\caption| dans un environnement |{table}| de LaTeX.
+titre inséré par |\caption| dans un environnement |{table}| de LaTeX (ou dans la
+commande |\captionof| de l'extension \pkg{caption}). Sans surprise, il est
+également possible de l'utiliser dans la légende rentrée avec la clé |caption|
+de l'environnement |{NiceTabular}|.
 
 \item Si plusieurs commandes |\tabularnote{...}| se suivent \emph{sans aucun espace
   entre elles}, les appels de notes correspondants sont composés ensemble,
@@ -3431,11 +3457,12 @@
 \pkg{nicematrix}), la clé |notes/bottomrule| permet de faire tracer un
 |\bottomrule| de \pkg{booktabs} \emph{après} les notes.
 
-\item \colorbox{yellow!50}{\textbf{Nouveau 6.8}}\enskip Lorsque plusieurs
-commandes |\tabularnote| sont utilisées avec le même argument, une seule note
-est insérée en fin de tableau (mais tous les labels sont marqués). Il est
-possible de désactiver cette fonctionnalité avec la clé
-|notes/detect-duplicates|
+\item Lorsque plusieurs commandes |\tabularnote| sont utilisées avec le même
+argument, une seule note est insérée en fin de tableau (mais tous les labels
+sont marqués). Il est possible de désactiver cette fonctionnalité avec la clé
+|notes/detect-duplicates|.\footnote{Pour des raisons techniques, il n'est pas
+  autorisé de mettre des |\tabularnote| avec exactement le même argument dans la
+  légende.}
 
 \item Il est possible de référencer une note de tableau (avec la commande
 |\label| placée après le |\tabularnote|).
@@ -3442,19 +3469,23 @@
 \end{itemize}
 %
 Voir sur la table \ref{t:tabularnote}, p.~\pageref{t:tabularnote}, certaines de ces
-remarques illustrées. Cette table a été composée avec le code suivant.
+remarques illustrées. Cette table a été composée avec le code suivant
+(l'extension \pkg{caption} a été chargée dans ce document).
 
 \begin{center}
 \fvset{commandchars=\~\#\!}
 \begin{Verbatim}[formatcom=\small\color{gray}]
 \begin{table}
-\setlength{\belowcaptionskip}{1ex}
 \centering
-\caption{Utilisation de \texttt{\textbackslash
-    tabularnote}~emphase#\tabularnote{On peut mettre une note dans le titre.}!}
-\label{t:tabularnote}
+\NiceMatrixOptions{caption-above}
 \begin{NiceTabular}{@{}llc@{}}%
-  [~emphase#notes/bottomrule!, tabularnote = Un peu de texte avant les notes.]
+  [
+   caption = Un tableau dont la légende a été rentrée avec la clé \texttt{caption}
+              ~emphase#\tabularnote{On peut mettre une note dans la légende.}! ,
+   label = t:tabularnote ,
+   tabularnote = Un peu de texte avant les notes. ,
+   notes/bottomrule
+  ]
 \toprule
 Nom & Prénom & Durée de vie \\
 \midrule
@@ -3471,14 +3502,17 @@
 \end{Verbatim}
 \end{center}
 
-\begin{table}[hb]
-\setlength{\belowcaptionskip}{1ex}
+\begin{table}[hbt]
 \centering
-\caption{Utilisation de \texttt{\textbackslash tabularnote}\tabularnote{On peut
-    mettre une note dans le titre.}}
-\label{t:tabularnote}
+\NiceMatrixOptions{caption-above}
 \begin{NiceTabular}{@{}llc@{}}%
-  [notes/bottomrule, tabularnote = Un peu de texte avant les notes.]
+  [
+   caption = Un tableau dont la légende a été rentrée avec la clé \texttt{caption}
+              \tabularnote{On peut mettre une note dans la légende.} ,
+   label = t:tabularnote, 
+   tabularnote = Un peu de texte avant les notes. ,
+   notes/bottomrule
+  ]
 \toprule
 Nom & Prénom & Durée de vie \\
 \midrule
@@ -4637,7 +4671,7 @@
 
 
 On peut alors programmer cette commande |\crossbox| de la manière suivante, qui
-utilise explicitement la variable publique |\g_nicematrix_code_after_tl|.
+utilise explicitement la variable publique |\g_nicematrix_code_before_tl|.
 
 
 \begin{scope}
@@ -4653,7 +4687,7 @@
 
 \NewDocumentCommand \crossbox { ! O { } }
   {
-    \tl_gput_right:Nx §emphase¤\g_nicematrix_code_after_tlμ
+    \tl_gput_right:Nx §emphase¤\g_nicematrix_code_before_tlμ
       {
         \__pantigny_crossbox:nnn
           { \int_use:c { c at iRow } }
@@ -4677,7 +4711,7 @@
 
 \NewDocumentCommand \crossbox { ! O { } }
   {
-    \tl_gput_right:Nx \g_nicematrix_code_after_tl
+    \tl_gput_right:Nx \g_nicematrix_code_before_tl
       {
         \__pantigny_crossbox:nnn
           { \int_use:c { c at iRow } }
@@ -4710,11 +4744,9 @@
 \section{Remarques techniques}
 
 Première remarque : l'extension \pkg{nicematrix} doit être chargée après
-l'extension \pkg{underscore}. Si ce n'est pas le cas, une erreur est levée.
+l'extension \pkg{underscore}. 
 
 
-
-
 \subsection{Lignes diagonales}
 
 \label{parallelization}

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	2022-07-28 20:05:53 UTC (rev 63992)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2022-07-28 20:06:07 UTC (rev 63993)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{6.11}
-\def\myfiledate{2022/07/16}
+\def\myfileversion{6.12}
+\def\myfiledate{2022/07/28}
 %
 %
 %<*batchfile>
@@ -56,6 +56,7 @@
 \usetikzlibrary{fit,patterns,arrows.meta,decorations.pathmorphing}
 \usepackage{nicematrix}
 \usepackage{siunitx}
+\usepackage{caption}
 \usepackage{varwidth}
 \usepackage[auto-lang=false]{lipsum}
 
@@ -806,7 +807,7 @@
 % In the environments of \pkg{nicematrix}, the vertical rules specified by
 % \verb+|+ in the preambles of the environments are never broken, even by an
 % incomplete row or by a double horizontal rule specified by |\hline\hline|
-% (there is no need to use \pkg{hhline}).
+% (there is no need to use the package~\pkg{hhline}).
 %
 % \bigskip
 % \begin{BVerbatim}[baseline=c,boxwidth=10cm]
@@ -1359,7 +1360,7 @@
 % 1 & 2 & 3 & 4 & 5 \\
 % ~emphase#\hdottedline@
 % 6 & 7 & 8 & 9 & 10 \\
-%  emphase#\cdottedline{1,4-5}@
+% ~emphase#\cdottedline{1,4-5}@
 % 11 & 12 & 13 & 14 & 15 
 % \end{pNiceMatrix}
 % \end{BVerbatim}
@@ -3283,10 +3284,37 @@
 %
 % 
 % 
-% \section{The notes in the tabulars}
+% \section{Captions and notes in the tabulars}
 %
 % \label{s:notes}
 %
+% \subsection{Caption of a tabular}
+%
+% \smallskip
+% \colorbox{yellow!50}{\bfseries New 6.12}\enskip The environment
+% |{NiceTabular}| provides the keys |caption|, |short-caption| and |label| which
+% may be used when the tabular is inserted in a floating environment (typically
+% the environment |{table}|).
+%
+% \smallskip
+% With the key |caption|, the caption, when it is long, is wrapped at the width
+% of the tabular (without the use of the package \pkg{threeparttable} or the
+% package \pkg{floatrow}).
+%
+% \smallskip
+% By default, the caption is composed below the tabular. With the key
+% |caption-above|, available in |\NiceMatrixOptions|, the caption will be
+% composed above de tabular.
+%
+% \smallskip
+% The key |short-caption| corresponds to the optional argument of the clasical
+% command |\caption| and the key |label| corresponds, of course, to the command
+% |\label|. 
+% 
+% \smallskip
+% See table \ref{t:tabularnote}, p.~\pageref{t:tabularnote} for an example of
+% use the keys |caption| and |label|.
+%
 % \subsection{The footnotes}
 %
 % \smallskip
@@ -3296,8 +3324,6 @@
 % with the other notes of the document.
 %
 % \smallskip
-%
-% \smallskip
 % If \pkg{nicematrix} is loaded with the option |footnote| (with
 % |\usepackage[footnote]{nicematrix}| or with |\PassOptionsToPackage|), the
 % package \pkg{footnote} is loaded (if it is not yet loaded) and it is used to
@@ -3388,13 +3414,17 @@
 %
 % \item The command |\tabularnote| may be used \emph{before}
 % the environment of \pkg{nicematrix}. Thus, it's possible to use it on the
-% title inserted by |\caption| in an environment |{table}| of LaTeX.
+% title inserted by |\caption| in an environment |{table}| of LaTeX (or in a
+% command |\captionof| of the package \pkg{caption}). It's also possible, as
+% expected, to use the command |\tabularnote| in the caption provided by the
+% \emph{key} |caption| of the environment |{NiceTabaular}|.
 %
-% \colorbox{yellow!50}{\textbf{New 6.8}}\enskip If several commands
-% |\tabularnote| are used in a tabular with the same argument, only one note is
-% inserted at the end of the tabular (but all the labels are composed, of
-% course). It's possible to control that feature with the key
-% |notes/detect-duplicates|.
+% If several commands |\tabularnote| are used in a tabular with the same
+% argument, only one note is inserted at the end of the tabular (but all the
+% labels are composed, of course). It's possible to control that feature with
+% the key |notes/detect-duplicates|.\footnote{For technical reasons, the final
+% user is not allowed to put several commands |\tabularnote| with exactly the
+% same argument in the caption of the tabular.}
 %
 % \item It's possible to create a reference to a tabular note created by |\tabularnote|
 % (with the usual command |\label| used after the |\tabularnote|).
@@ -3402,19 +3432,22 @@
 % %
 % For an illustration of some of those remarks, see table
 % \ref{t:tabularnote}, p.~\pageref{t:tabularnote}. This table has been composed
-% with the following code.
+% with the following code (the package \pkg{caption} has been loaded in this document).
 %
 % \begin{center}
 % \fvset{commandchars=\~\#\!}
 % \begin{Verbatim}[formatcom=\small\color{gray}]
 % \begin{table}
-% \setlength{\belowcaptionskip}{1ex}
 % \centering
-% \caption{Use of \texttt{\textbackslash tabularnote}~emphase#\tabularnote{It's possible!
-%     ~emphase#to put a note in the caption.}}!
-% \label{t:tabularnote}
+% \NiceMatrixOptions{caption-above}
 % \begin{NiceTabular}{@{}llc@{}
-% [~emphase#notes/bottomrule!, tabularnote = Some text before the notes.]
+%   [
+%     caption = A tabular whose caption has been specified by the key
+%       \texttt{caption}~emphase#\tabularnote{It's possible to put a tabular note in the caption}! ,
+%     label = t:tabularnote ,
+%     tabularnote = Some text before the notes. ,
+%     notes/bottomrule
+%   ]
 % \toprule
 % Last name & First name & Length of life \\
 % \midrule
@@ -3432,14 +3465,16 @@
 % \end{center}
 % 
 %
-% \begin{table}[hb]
-% \setlength{\belowcaptionskip}{1ex}
+% \begin{table}[hbt]
 % \centering
-% \caption{Use of \texttt{\textbackslash tabularnote}\tabularnote{It's possible
-%     to put a note in the caption.}}
-% \label{t:tabularnote}
-% \begin{NiceTabular}{@{}llc@{}}[notes/bottomrule, 
-%    tabularnote = Some text before the notes.] 
+% \NiceMatrixOptions{caption-above}
+% \begin{NiceTabular}{@{}llc@{}}[
+%     caption = A tabular whose caption has been specified by the key
+%     \texttt{caption}\tabularnote{It's possible to put a tabular note in the caption} ,
+%     label = t:tabularnote ,
+%     tabularnote = Some text before the notes. ,
+%     notes/bottomrule
+%   ]
 % \toprule
 % Last name & First name & Length of life \\
 % \midrule
@@ -4572,7 +4607,7 @@
 % Tikz before the drawing.
 %
 % It's possible to program such command |\crossbox| as follows, explicitely
-% using the public variable |\g_nicematrix_code_after_tl|.
+% using the public variable |\g_nicematrix_code_before_tl|.
 %
 % \begin{scope}
 % \fvset{commandchars=\§\¤\μ}
@@ -4587,7 +4622,7 @@
 %
 % \NewDocumentCommand \crossbox { ! O { } }
 %   {
-%     \tl_gput_right:Nx §emphase¤\g_nicematrix_code_after_tlμ
+%     \tl_gput_right:Nx §emphase¤\g_nicematrix_code_before_tlμ
 %       { 
 %         \__pantigny_crossbox:nnn 
 %           { \int_use:c { c at iRow } } 
@@ -4611,7 +4646,7 @@
 %
 % \NewDocumentCommand \crossbox { ! O { } }
 %   {
-%     \tl_gput_right:Nx \g_nicematrix_code_after_tl
+%     \tl_gput_right:Nx \g_nicematrix_code_before_tl
 %       { 
 %         \__pantigny_crossbox:nnn 
 %           { \int_use:c { c at iRow } } 
@@ -4642,8 +4677,8 @@
 %
 % \section{Technical remarks}
 % 
+% First remark: the package \pkg{underscore} must be loaded before \pkg{nicematrix}.
 % 
-% 
 % \subsection{Diagonal lines} 
 %
 % \label{parallelization}
@@ -5773,6 +5808,7 @@
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_error:n { \msg_error:nn { nicematrix } }
+\cs_new_protected:Npn \@@_warning:n { \msg_warning:nn { nicematrix } }
 \cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { nicematrix } }
 \cs_generate_variant:Nn \@@_error:nn { n x } 
 \cs_new_protected:Npn \@@_error:nnn { \msg_error:nnnn { nicematrix } }
@@ -5794,7 +5830,15 @@
       { \msg_new:nnnn { nicematrix } { #1 } { #2 } { #3 } }
   }
 %    \end{macrocode}
-%
+% 
+% \bigskip
+% We also create a command which will genereate usually an error but only a
+% warning on Overleaf. The argument is given by currification.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_error_or_warning:n 
+  { \bool_if:NTF \c_@@_messages_for_Overleaf_bool \@@_warning:n \@@_error:n }
+%    \end{macrocode}
+% 
 % We try to detect whether the compilation is done on Overleaf. We use
 % |\c_sys_jobname_str| because, with Overleaf, the value of |\c_sys_jobname_str|
 % is always ``|output|''.
@@ -5807,6 +5851,23 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_msg_redirect_name:nn 
   { \msg_redirect_name:nnn { nicematrix } }
+\cs_new_protected:Npn \@@_gredirect_none:n #1 
+  {
+    \group_begin:
+    \globaldefs = 1
+    \@@_msg_redirect_name:nn { #1 } { none }
+    \group_end:
+  }
+\cs_new_protected:Npn \@@_err_gredirect_none:n #1 
+  {
+    \@@_error:n { #1 }
+    \@@_gredirect_none:n { #1 }
+  }
+\cs_new_protected:Npn \@@_warning_gredirect_none:n #1 
+  {
+    \@@_warning:n { #1 }
+    \@@_gredirect_none:n { #1 }
+  }
 %    \end{macrocode}
 %
 % 
@@ -5829,9 +5890,6 @@
     \@ifpackageloaded { varwidth }
       { \bool_const:Nn \c_@@_varwidth_loaded_bool { \c_true_bool } }
       { \bool_const:Nn \c_@@_varwidth_loaded_bool { \c_false_bool } }
-    \@ifpackageloaded { arydshln }
-      { \bool_const:Nn \c_@@_arydshln_loaded_bool { \c_true_bool } }
-      { \bool_const:Nn \c_@@_arydshln_loaded_bool { \c_false_bool } }
     \@ifpackageloaded { booktabs }
       { \bool_const:Nn \c_@@_booktabs_loaded_bool { \c_true_bool } }
       { \bool_const:Nn \c_@@_booktabs_loaded_bool { \c_false_bool } }
@@ -5841,7 +5899,9 @@
     \@ifpackageloaded { tabularx }
       { \bool_const:Nn \c_@@_tabularx_loaded_bool { \c_true_bool } }
       { \bool_const:Nn \c_@@_tabularx_loaded_bool { \c_false_bool } }
-      { }
+    \@ifpackageloaded { floatrow }
+      { \bool_const:Nn \c_@@_floatrow_loaded_bool { \c_true_bool } }
+      { \bool_const:Nn \c_@@_floatrow_loaded_bool { \c_false_bool } }
     \@ifpackageloaded { tikz }
       { 
 %    \end{macrocode}
@@ -6262,6 +6322,14 @@
 %    \end{macrocode}
 %
 % \bigskip
+% If, in a tabular, there is a tabular note in a caption that must be composed
+% \emph{above} the tabular, we will store in |\l_@@_note_in_caption_int| the
+% number of notes in that caption. It will be stored in the |aux| file.
+%    \begin{macrocode}
+\int_new:N \l_@@_note_in_caption_int
+%    \end{macrocode}
+% 
+% \bigskip
 % The dimension |\l_@@_columns_width_dim| will be used when the options specify
 % that all the columns must have the same width (but, if the key |columns-width|
 % is used with the special value |auto|, the boolean
@@ -6413,6 +6481,10 @@
 %    \begin{macrocode}
 \bool_new:N \l_@@_X_column_bool 
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+\bool_new:N \g_@@_caption_finished_bool
+%    \end{macrocode}
 % 
 % \bigskip
 % We will write in |\g_@@_aux_tl| all the instructions that we have to write on
@@ -6645,8 +6717,14 @@
 \bool_new:N \g_@@_empty_cell_bool
 %    \end{macrocode}
 % 
-%
 % \bigskip
+% The following boolean will be used to deal with the commands |\tabularnote| in
+% the caption (command |\caption| or key |caption|).
+%    \begin{macrocode}
+\bool_new:N \g_@@_second_composition_bool
+%    \end{macrocode}
+% 
+% \bigskip
 % The following dimensions will be used internally to compute the width of the
 % potential ``first column'' and ``last column''.
 %    \begin{macrocode}
@@ -6859,7 +6937,14 @@
 \bool_new:N \l_@@_dotted_bool
 %    \end{macrocode}
 %
+% \bigskip
+% The following flag will be set to true during the composition of a caption
+% specified (by the key |caption|).
+%    \begin{macrocode}
+\bool_new:N \l_@@_in_caption_bool
+%    \end{macrocode}
 % 
+% 
 % \bigskip
 % \textbf{Variables for the exterior rows and columns}\par\nobreak
 %
@@ -6993,6 +7078,38 @@
 % \subsection*{The command \textbackslash tabularnote}
 %
 % \bigskip
+% Of course, it's possible to use |\tabularnote| in the main tabular. But there
+% is also the possibility to use that command in the caption of the tabular. And
+% the caption may be specified by two means:
+%
+% \begin{itemize}
+% \item The caption may of course be provided by the command |\caption| in a
+% floating environment. Of course, a command |\tabularnote| in that |\caption| 
+% makes sens only if the |\caption| is \emph{before} the |{tabular}|.
+% \item It's also possible to use |\tabularnote| in the value of the key
+% |caption| of the |{NiceTabular}| when the key |caption-above| is in force.
+% However, in that case, one must remind that the caption is composed
+% \emph{after} the composition of the box which contains the main tabular
+% (that's mandatory since that caption must be wrapped with a line width equal
+% to the width ot the tabular). However, we want the labels of the successive
+% tabular notes in the logical order. That's why:
+% \begin{itemize}
+% \item The number of tabular notes present in the caption will be written on
+% the |aux| file and available in |\l_@@_note_in_caption_int|.
+% \item During the composition of the main tabular, the tabular notes will be
+% numbered from |\l_@@_note_in_caption_int|+1 and the notes will be stored in
+% |\g_@@_notes_seq|. 
+% \item During the composition of the caption (value of |\l_@@_caption_tl|), the
+% tabular notes will be numbered from $1$ to |\l_@@_note_in_caption_int| and the
+% notes themselves will be stored in |\g_@@_notes_in_caption_seq|.
+% \item After the composition of the main tabular and after the composition of
+% the caption, the sequences |\g_@@_notes_in_caption_seq| and |\g_@@_notes_seq|
+% will be merged (in that order) and the notes will be composed.
+% \end{itemize}
+% \end{itemize}
+% 
+% 
+% \bigskip
 % The LaTeX counter |tabularnote| will be used to count the tabular notes during
 % the construction of the array (this counter won't be used during the
 % composition of the notes at the end of the array). You use a LaTeX counter
@@ -7002,14 +7119,13 @@
 \newcounter { tabularnote }
 %    \end{macrocode}
 %
-% \bigskip
-% We will store in the following sequence the tabular notes of a given array.
 %    \begin{macrocode}
-\seq_new:N \g_@@_tabularnotes_seq
+\seq_new:N \g_@@_notes_seq
+\seq_new:N \g_@@_notes_in_caption_seq
 %    \end{macrocode}
 %
 % \bigskip
-% However, before the actual tabular notes, it's possible to put a text
+% Before the actual tabular notes, it's possible to put a text
 % specified by the key |tabularnote| of the environment. The token list
 % |\l_@@_tabularnote_tl| corresponds to the value of that key.
 %    \begin{macrocode}
@@ -7017,12 +7133,11 @@
 %    \end{macrocode}
 % 
 % \bigskip
+% We prepare the tools for the formatting of the references of the footnotes (in
+% the tabular itself). There may have several references of footnote at the same
+% point and we have to take into account that point.
 %    \begin{macrocode}
 \seq_new:N \l_@@_notes_labels_seq
-%    \end{macrocode}
-%
-% \bigskip
-%    \begin{macrocode}
 \newcounter{nicematrix_draft}
 \cs_new_protected:Npn \@@_notes_format:n #1
   { 
@@ -7052,7 +7167,7 @@
 % 
 % \bigskip
 % We define |\thetabularnote| because it will be used by LaTeX if the user want
-% to reference a footnote which has been marked by a |\label|. The TeX group is
+% to reference a tabular  which has been marked by a |\label|. The TeX group is
 % for the case where the user has put an instruction such as |\color{red}| in
 % |\@@_notes_style:n|.
 %    \begin{macrocode}
@@ -7073,7 +7188,10 @@
     \bool_if:nTF { ! \c_@@_enumitem_loaded_bool }
       { 
         \NewDocumentCommand \tabularnote { m }
-          { \@@_error:n { enumitem~not~loaded } }
+          { 
+            \@@_error_or_warning:n { enumitem~not~loaded } 
+            \@@_gredirect_none:n { enumitem~not~loaded } 
+          }
       }
       { 
 %    \end{macrocode}
@@ -7102,78 +7220,94 @@
           }
 %    \end{macrocode}
 % 
-% \medskip
-% The command |\tabularnote| is available in the whole document (and not only in
-% the environments of \pkg{nicematrix}) because we want it to be available in
-% the caption of a |{table}| (before the following |{NiceTabular}| or
-% |{NiceArray}|). That's also the reason why the variables |\c at tabularnote| and
-% |\g_@@_tabularnotes_seq| will be cleared at the end of the environment of
-% \pkg{nicematrix} (and not at the beginning).
-%
+% \bigskip
+% One must remind that we have allowed a |\tabular| in the caption and
+% that caption may also be found in the list of tables (|\listoftables|). We
+% want the command |\tabularnote| be no-op during the composition of that list.
+% That's why we program |\tabularnote| to be no-op excepted in a floating
+% environment or in an environment of \pkg{nicematrix}.
 %    \begin{macrocode}
         \NewDocumentCommand \tabularnote { m }
           {
-            \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool }
-              { \@@_error:n { tabularnote~forbidden } }
-              {
+            \bool_if:nT { \cs_if_exist_p:N \@captype || \l_@@_in_env_bool }
+              { 
+                \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool }
+                  { \@@_error:n { tabularnote~forbidden } }
+                  {
+                    \bool_if:NTF \l_@@_in_caption_bool
+                      { \@@_tabularnote_ii:n { #1 } }
+                      { \@@_tabularnote_i:n { #1 } }
+                  }
+              }
+          }
 %    \end{macrocode}
+%
+% \bigskip
+% For the version in normal conditions, that is to say not in the key |caption|.
+%    \begin{macrocode}
+        \cs_new_protected:Npn \@@_tabularnote_i:n #1
+          {
+%    \end{macrocode}
 % You have to see whether the argument of |\tabularnote| has yet been used as
 % argument of another |\tabularnote| in the same tabular. In that case, there
 % will be only one note (for both commands |\tabularnote|) at the end of the
 % tabular. We search the argument of our command |\tabularnote| in the
-% |\g_@@_tabularnotes_seq|. The position in the sequence will be stored in
+% |\g_@@_notes_seq|. The position in the sequence will be stored in
 % |\l_tmpa_int| (0 if the text is not in the sequence yet).
 %    \begin{macrocode}
-                \int_zero:N \l_tmpa_int
-                \bool_if:NT \l_@@_notes_detect_duplicates_bool
+            \int_zero:N \l_tmpa_int
+            \bool_if:NT \l_@@_notes_detect_duplicates_bool
+              {
+                \seq_map_indexed_inline:Nn \g_@@_notes_seq
                   {
-                    \seq_map_indexed_inline:Nn \g_@@_tabularnotes_seq
-                      {
-                        \tl_if_eq:nnT { #1 } { ##2 } 
-                          { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: }
-                      }
+                    \tl_if_eq:nnT { #1 } { ##2 } 
+                      { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: }
                   }
-                \int_compare:nNnTF \l_tmpa_int = 0 
-                  {
-                    \stepcounter { tabularnote }
-                    \seq_put_right:Nx \l_@@_notes_labels_seq
-                      { \@@_notes_format:n { \int_use:c { c @ tabularnote } } }
-                    \seq_gput_right:Nn \g_@@_tabularnotes_seq { #1 } 
-                  }
-                  {
-                    \seq_put_right:Nx \l_@@_notes_labels_seq
-                      { \@@_notes_format:n { \int_use:N \l_tmpa_int } }
-                  }
-                \peek_meaning:NF \tabularnote
-                  {
+                \int_compare:nNnF \l_tmpa_int = 0 
+                  { \int_add:Nn \l_tmpa_int \l_@@_note_in_caption_int }
+              }
+            \int_compare:nNnTF \l_tmpa_int = 0 
+              {
+                \int_gincr:N \c at tabularnote 
+                \seq_put_right:Nx \l_@@_notes_labels_seq
+                  { \@@_notes_format:n { \int_use:c { c @ tabularnote } } }
+                \seq_gput_right:Nn \g_@@_notes_seq { #1 } 
+              }
+              {
+                \seq_put_right:Nx \l_@@_notes_labels_seq
+                  { \@@_notes_format:n { \int_use:N \l_tmpa_int } }
+              }
+            \peek_meaning:NF \tabularnote
+              {
 %    \end{macrocode}
 % If the following token is \emph{not} a |\tabularnote|, we have finished the
 % sequence of successive commands |\tabularnote| and we have to format the
 % labels of these tabular notes (in the array). We compose those labels in a box
 % |\l_tmpa_box| because we will do a special construction in order to have this
-% box in a overlapping position if we are at the end of a cell.
+% box in an overlapping position if we are at the end of a cell.
 %    \begin{macrocode}
-                    \hbox_set:Nn \l_tmpa_box 
-                      { 
+                \hbox_set:Nn \l_tmpa_box 
+                  { 
 %    \end{macrocode}
 % We remind that it is the command |\@@_notes_label_in_tabular:n| that will
-% (most of the time) put the labels in a |\textsuperscript|.
+% put the labels in a |\textsuperscript|.
 %    \begin{macrocode}
-                        \@@_notes_label_in_tabular:n 
-                          { 
-                            \seq_use:Nnnn 
-                              \l_@@_notes_labels_seq { , } { , } { , }
-                          } 
-                      }
+                    \@@_notes_label_in_tabular:n 
+                      { 
+                        \seq_use:Nnnn 
+                          \l_@@_notes_labels_seq { , } { , } { , }
+                      } 
+                  }
 %    \end{macrocode}
-% We use |\refstepcounter| in order to have the (last) tabular note referenceable
-% (with the standard command |\label|) and that's why we have to go back with a
-% decrementation of the counter |tabularnote| first.
+% We want the (last) tabular note referenceable (with the standard command |\label|).
 %    \begin{macrocode}
-                    \addtocounter { tabularnote } { -1 }
-                    \refstepcounter { tabularnote }
-                    \seq_clear:N \l_@@_notes_labels_seq 
-                    \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
+                \int_gsub:Nn \c at tabularnote { 1 }
+                \int_set_eq:NN \l_tmpa_int \c at tabularnote
+                \refstepcounter { tabularnote }
+                \int_compare:nNnT \l_tmpa_int = \c at tabularnote
+                  { \int_gincr:N \c at tabularnote }
+                \seq_clear:N \l_@@_notes_labels_seq 
+                \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
 %    \end{macrocode}
 % If the command |\tabularnote| is used exactly at the end of the cell, the
 % |\unskip| (inserted by \pkg{array}?) will delete the skip we insert now
@@ -7180,9 +7314,56 @@
 % and the label of the footnote will be composed in an overlapping position (by
 % design). 
 %    \begin{macrocode}
-                    \skip_horizontal:n { \box_wd:N \l_tmpa_box }
+                \skip_horizontal:n { \box_wd:N \l_tmpa_box }
+              }
+          }
+%    \end{macrocode}
+%
+% \bigskip
+% Now the version when the command is used in the key |caption|. The main
+% difficulty is that the argument of the command |\caption| is composed several
+% times. In order to know the number of commands |\tabularnote| in the caption,
+% we will consider that there should not be the same tabular note twice in the
+% caption (in the main tabular, it's possible). Once we have found a tabular
+% note which has yet been encoutered, we consider that you are in a new
+% composition of the argument of |\caption|. At that time, we store in
+% |\g_@@_nb_of_notes_int| the number of notes in the |\caption|.
+%    \begin{macrocode}
+        \cs_new_protected:Npn \@@_tabularnote_ii:n #1
+          {
+            \int_gincr:N \c at tabularnote
+            \bool_if:NTF \g_@@_caption_finished_bool
+              {
+                \int_compare:nNnTF 
+                  \c at tabularnote > { \tl_count:N \g_@@_notes_in_caption_seq }
+                  { \int_gset:Nn \c at tabularnote { 1 } }
+                \seq_if_in:NnF \g_@@_notes_in_caption_seq { #1 }
+                  { \@@_fatal:n { Identical~notes~in~caption } }
+              }
+              {
+                \seq_if_in:NnTF \g_@@_notes_in_caption_seq { #1 }
+                  {
+                    \bool_gset_true:N \g_@@_caption_finished_bool
+                    \int_gset:Nn \c at tabularnote { 1 }
                   }
+                  { \seq_gput_right:Nn \g_@@_notes_in_caption_seq { #1 } }
               }
+            \seq_put_right:Nx \l_@@_notes_labels_seq
+              { \@@_notes_format:n { \int_use:N \c at tabularnote } }
+            \peek_meaning:NF \tabularnote
+              {
+                \hbox_set:Nn \l_tmpa_box 
+                  { 
+                    \@@_notes_label_in_tabular:n 
+                      { 
+                        \seq_use:Nnnn 
+                          \l_@@_notes_labels_seq { , } { , } { , }
+                      } 
+                  }
+                \seq_clear:N \l_@@_notes_labels_seq 
+                \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
+                \skip_horizontal:n { \box_wd:N \l_tmpa_box }
+              }
           }
       }
   } 
@@ -7261,6 +7442,24 @@
 % \bigskip 
 % \subsection*{The options}
 % 
+% The following parameter corresponds to the keys |caption|, |short-caption| and
+% |label| of the environment |{NiceTabular}|. 
+%    \begin{macrocode}
+\tl_new:N \l_@@_caption_tl
+\tl_new:N \l_@@_short_caption_tl 
+\tl_new:N \l_@@_label_tl
+%    \end{macrocode}
+%
+% \bigskip
+% The following parameter corresponds to the key |caption-above| of
+% |\NiceMatrixOptions|. When this paremeter is |true|, the captions of the
+% environments |{NiceTabular}|, specified with the key |caption| are put above
+% the tabular (and below elsewhere).
+%    \begin{macrocode}
+\bool_new:N \l_@@_caption_above_bool
+%    \end{macrocode}
+% 
+% \bigskip
 % By default, the commands |\cellcolor| and |\rowcolor| are available for the
 % user in the cells of the tabular (the user may use the commands provided by
 % |\colortbl|). However, if the key |colortbl-like| is used, these
@@ -7679,12 +7878,6 @@
 %    \begin{macrocode}
 \keys_define:nn { NiceMatrix / Env } 
   { 
-%    \end{macrocode}
-% The key |hvlines-except-corners| is now deprecated (use |hvlines| and
-% |corners| instead).
-%    \begin{macrocode}
-    hvlines-except-corners .code:n = \@@_fatal:n { hvlines-except-corners } ,
-    hvlines-except-corners .default:n = { NW , SW , NE , SE } ,
     corners .clist_set:N = \l_@@_corners_clist ,
     corners .default:n = { NW , SW , NE , SE } ,
     code-before .code:n = 
@@ -7847,9 +8040,10 @@
   { 
     width .code:n = \dim_set:Nn \l_@@_width_dim { #1 } ,
     width .value_required:n = true ,
-    last-col .code:n = \tl_if_empty:nF { #1 }
-                         { \@@_error:n { last-col~non~empty~for~NiceMatrixOptions } } 
-                       \int_zero:N \l_@@_last_col_int ,
+    last-col .code:n = 
+      \tl_if_empty:nF { #1 }
+        { \@@_error:n { last-col~non~empty~for~NiceMatrixOptions } } 
+        \int_zero:N \l_@@_last_col_int ,
     small .bool_set:N = \l_@@_small_bool ,
     small .value_forbidden:n = true ,
 %    \end{macrocode}
@@ -7883,7 +8077,7 @@
 %
 % \bigskip
 % Usually, an error is raised when the user tries to give the same name to two
-% distincts environments of \pkg{nicematrix} (theses names are global and not
+% distincts environments of \pkg{nicematrix} (these names are global and not
 % local to the current TeX scope). However, the option |allow-duplicate-names|
 % disables this feature. 
 %    \begin{macrocode}
@@ -7897,6 +8091,8 @@
     matrix / columns-type .code:n = 
       \@@_set_preamble:Nn \l_@@_columns_type_tl { #1 },
     matrix / columns-type .value_required:n = true ,
+    caption-above .bool_set:N = \l_@@_caption_above_bool ,
+    caption-above .default:n = true , 
     unknown .code:n  = \@@_error:n { Unknown~key~for~NiceMatrixOptions } 
   }
 %    \end{macrocode}
@@ -8006,6 +8202,12 @@
     notes / bottomrule .default:n = true ,
     tabularnote .tl_set:N = \l_@@_tabularnote_tl ,
     tabularnote .value_required:n = true ,
+    caption .tl_set:N = \l_@@_caption_tl , 
+    caption .value_required:n = true ,
+    short-caption .tl_set:N = \l_@@_short_caption_tl , 
+    short-caption .value_required:n = true ,
+    label .tl_set:N = \l_@@_label_tl ,
+    label .value_required:n = true ,
     last-col .code:n = \tl_if_empty:nF {#1}
                          { \@@_error:n { last-col~non~empty~for~NiceArray } } 
                        \int_zero:N \l_@@_last_col_int ,
@@ -8027,12 +8229,11 @@
 \cs_new_protected:Npn \@@_cell_begin:w
   { 
 %    \end{macrocode}
-% The token list |\g_@@_post_action_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-action}). 
+% |\g_@@_cell_after_hook_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.
 %    \begin{macrocode}
-    \tl_gclear:N \g_@@_post_action_cell_tl
+    \tl_gclear:N \g_@@_cell_after_hook_tl
 %    \end{macrocode}
 % At the beginning of the cell, we link |\CodeAfter| to a command which do
 % begin with |\\| (whereas the standard version of |\CodeAfter| does
@@ -8203,11 +8404,11 @@
     \@@_math_toggle_token: 
     \hbox_set_end: 
 %    \end{macrocode}
-% The token list |\g_@@_post_action_cell_tl| is (potentially) set during the 
+% The token list |\g_@@_cell_after_hook_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_action_cell_tl
+    \g_@@_cell_after_hook_tl
     \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
     \@@_adjust_size_box:
 %    \end{macrocode}
@@ -8739,6 +8940,23 @@
     \hook_gput_code:nnn { env / tabular / begin } { . }
       { \cs_set_eq:NN \multicolumn \@@_old_multicolumn }
 %    \end{macrocode}
+% If there is one or several commands |\tabularnote| in the caption specified
+% by the key |caption| and if that caption has to be composed above the tabular, 
+% we have now that information because it has been written in the |aux| file at
+% a previous run. We use that information to start couting the tabular notes in
+% the main array at the right value (that remember that the caption will be
+% composed \emph{after} the array!).
+%    \begin{macrocode}
+    \tl_if_exist:NT \l_@@_note_in_caption_tl
+      {
+        \tl_if_empty:NF \l_@@_note_in_caption_tl
+          { 
+            \int_set_eq:NN \l_@@_note_in_caption_int 
+              { \l_@@_note_in_caption_tl }
+            \int_gset:Nn \c at tabularnote { \l_@@_note_in_caption_tl } 
+          }
+      }
+%    \end{macrocode}
 % 
 %
 % The sequence |\g_@@_multicolumn_cells_seq| will contain the list of the cells
@@ -9114,6 +9332,7 @@
   }
 %    \end{macrocode}
 %
+%
 %    \begin{macrocode}
 \NewDocumentCommand \@@_CodeBefore_keys: { O { } }
   { 
@@ -9419,7 +9638,7 @@
     \bool_if:NT \l_@@_width_used_bool
       {
         \int_compare:nNnT \g_@@_total_X_weight_int = 0 
-          { \@@_error:n { width~without~X~columns } }
+          { \@@_error_or_warning:n { width~without~X~columns } }
       }
 %    \end{macrocode}
 %
@@ -9461,7 +9680,7 @@
 % \bigskip
 % It the user has used the key |last-row| with a value, we control that the
 % given value is correct (since we have just constructed the array, we know the
-% real number of rows of the array).
+% actual number of rows of the array).
 %    \begin{macrocode}
     \int_compare:nNnT \l_@@_last_row_int > { -2 }
       {
@@ -9624,13 +9843,7 @@
     \bool_if:NF \l_@@_Matrix_bool
       {    
         \int_compare:nNnT \c at jCol < \g_@@_static_num_of_col_int 
-          { 
-            \@@_error:n { columns~not~used } 
-            \group_begin:
-            \globaldefs = 1
-            \@@_msg_redirect_name:nn { columns~not~used } { none }
-            \group_end:
-          }
+          { \@@_warning_gredirect_none:n  { columns~not~used } }
       }
     \@@_after_array:
 %    \end{macrocode}
@@ -10238,10 +10451,10 @@
 \cs_new_protected:Npn \@@_center_cell_box:
   {
 %    \end{macrocode}
-% By putting instructions in |\g_@@_post_action_cell_tl|, we require a
+% By putting instructions in |\g_@@_cell_after_hook_tl|, we require a
 % post-action of the box |\l_@@_cell_box|.
 %    \begin{macrocode}
-    \tl_gput_right:Nn \g_@@_post_action_cell_tl
+    \tl_gput_right:Nn \g_@@_cell_after_hook_tl
       {
         \int_compare:nNnT 
           { \box_ht:N \l_@@_cell_box } 
@@ -10281,7 +10494,7 @@
     \bool_if:NTF \c_@@_varwidth_loaded_bool
       { \@@_patch_preamble_iv_iv:nn { #2 } { varwidth } }
       { 
-        \@@_error:n { varwidth~not~loaded }
+        \@@_error_or_warning:n { varwidth~not~loaded }
         \@@_patch_preamble_iv_iv:nn { #2 } { minipage } 
       }
   }
@@ -10543,7 +10756,7 @@
     \keys_set:nV { WithArrows / X-column } \l_tmpa_tl
     \int_compare:nNnT \l_@@_weight_int < 0 
       { 
-        \@@_error:nx { negative~weight } { \int_use:N \l_@@_weight_int }
+        \@@_error_or_warning:n { negative~weight } 
         \int_set:Nn \l_@@_weight_int { - \l_@@_weight_int }
       }
     \int_gadd:Nn \g_@@_total_X_weight_int \l_@@_weight_int
@@ -10568,7 +10781,7 @@
 %    \end{macrocode}
 % The following code will nullify the box of the cell.
 %    \begin{macrocode}
-                \tl_gput_right:Nn \g_@@_post_action_cell_tl 
+                \tl_gput_right:Nn \g_@@_cell_after_hook_tl 
                   { \hbox_set:Nn \l_@@_cell_box { } }
 %    \end{macrocode}
 % We put a |{minipage}| to give to the user the ability to put a command such as
@@ -10975,7 +11188,32 @@
 % notes (that means that a |\vtop{\hsize=...}| is not enough).
 %    \begin{macrocode}
     \begin { minipage } [ t ] { \box_wd:N \l_@@_the_array_box } 
+    \bool_if:NT \l_@@_caption_above_bool
+      { 
+        \tl_if_empty:NF \l_@@_caption_tl 
+          { 
 %    \end{macrocode}
+%    \begin{macrocode}
+            \bool_set_false:N \g_@@_caption_finished_bool
+            \int_gzero:N \c at tabularnote
+            \@@_insert_caption:
+%    \end{macrocode}
+% If there is one or several commands |\tabularnote| in the caption, we will
+% write in the |aux| file the number of such tabular notes.
+%    \begin{macrocode}
+            \int_gset:Nn \c at tabularnote 
+              { \seq_count:N \g_@@_notes_in_caption_seq }
+            \int_compare:nNnF \c at tabularnote = 0 
+              {
+                \tl_gput_right:Nx \g_@@_aux_tl
+                  {
+                    \tl_set:Nn \exp_not:N \l_@@_note_in_caption_tl 
+                      { \int_eval:n { \c at tabularnote } }
+                  }
+              }
+          } 
+      }
+%    \end{macrocode}
 % The |\hbox| avoids that the |pgfpicture| inside |\@@_draw_blocks| adds a extra
 % vertical space before the notes.
 %    \begin{macrocode}
@@ -10998,17 +11236,71 @@
 % (because |\ttabbox| de-activate |\stepcounter| because if compiles several
 % twice its tabular).
 %    \begin{macrocode}
-    \bool_lazy_or:nnT
-      { ! \seq_if_empty_p:N \g_@@_tabularnotes_seq }
-      { ! \tl_if_empty_p:V \l_@@_tabularnote_tl }
+    \bool_lazy_any:nT
+      {
+        { ! \seq_if_empty_p:N \g_@@_notes_seq }
+        { ! \seq_if_empty_p:N \g_@@_notes_in_caption_seq }
+        { ! \tl_if_empty_p:V \l_@@_tabularnote_tl }
+      }
       \@@_insert_tabularnotes:
+    \cs_set_eq:NN \tabularnote \@@_tabularnote_error:n
+    \bool_if:NF \l_@@_caption_above_bool \@@_insert_caption:
     \end { minipage }
   }
 %    \end{macrocode}
 %
+% \bigskip
 %    \begin{macrocode}
+\cs_new_protected:Npn \@@_insert_caption:
+  {
+    \tl_if_empty:NF \l_@@_caption_tl 
+      {
+        \cs_if_exist:NTF \@captype
+          { \@@_insert_caption_i: }
+          { \@@_error:n { caption~outside~float } }
+      }
+  }
+%    \end{macrocode}
+% 
+% \bigskip
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_insert_caption_i:
+  {
+    \group_begin:
+%    \end{macrocode}
+% The flag |\l_@@_in_caption_bool| affects only the behaviour of the command
+% |\tabularnote| when used in the caption.
+%    \begin{macrocode}
+    \bool_set_true:N \l_@@_in_caption_bool
+%    \end{macrocode}
+% The package \pkg{floatrow} does a redefinition of |\@makecaption| which will
+% extract the caption from the tabular. However, the old version of
+% |\@makecaption| has been stored by \pkg{floatrow} in |\FR at makecaption|. That's
+% why we restore the old version.
+%    \begin{macrocode}
+    \bool_if:NT \c_@@_floatrow_loaded_bool
+      { \cs_set_eq:NN \@makecaption \FR at makecaption }
+    \tl_if_empty:NTF \l_@@_short_caption_tl 
+      { \caption { \l_@@_caption_tl } }
+      { \caption [ \l_@@_short_caption_tl ] { \l_@@_caption_tl } }
+    \tl_if_empty:NF \l_@@_label_tl { \label { \l_@@_label_tl } }
+    \group_end:
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_tabularnote_error:n #1
+  { 
+    \@@_error_or_warning:n { tabularnote~below~the~tabular } 
+    \@@_gredirect_none:n { tabularnote~below~the~tabular } 
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \cs_new_protected:Npn \@@_insert_tabularnotes:
   {
+    \seq_gconcat:NNN \g_@@_notes_seq \g_@@_notes_in_caption_seq \g_@@_notes_seq  
+    \int_set:Nn \c at tabularnote { \seq_count:N \g_@@_notes_seq }
     \skip_vertical:N 0.65ex 
 %    \end{macrocode}
 % The TeX group is for potential specifications in the
@@ -11027,7 +11319,7 @@
         \bool_if:NTF \l_@@_notes_para_bool
           {
             \begin { tabularnotes* }
-              \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut 
+              \seq_map_inline:Nn \g_@@_notes_seq { \item ##1 } \strut 
             \end { tabularnotes* }
 %    \end{macrocode}
 % The following |\par| is mandatory for the event that the user has put
@@ -11037,7 +11329,7 @@
           }
           {
             \tabularnotes 
-              \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut 
+              \seq_map_inline:Nn \g_@@_notes_seq { \item ##1 } \strut 
             \endtabularnotes
           }
       }
@@ -11058,10 +11350,11 @@
 %    \begin{macrocode}
             { \CT at arc@ \hrule height \heavyrulewidth } 
           }
-          { \@@_error:n { bottomrule~without~booktabs } }
+          { \@@_error_or_warning:n { bottomrule~without~booktabs } }
       }
     \l_@@_notes_code_after_tl
-    \seq_gclear:N \g_@@_tabularnotes_seq
+    \seq_gclear:N \g_@@_notes_seq
+    \seq_gclear:N \g_@@_notes_in_caption_seq
     \int_gzero:N \c at tabularnote
   }
 %    \end{macrocode}
@@ -11928,6 +12221,19 @@
       { \dim_set_eq:NN \l_@@_width_dim \linewidth }
     \str_gset:Nn \g_@@_name_env_str { NiceTabular }
     \keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 }
+    \tl_if_empty:NF \l_@@_short_caption_tl
+      {
+        \tl_if_empty:NT \l_@@_caption_tl
+          { 
+            \@@_error_or_warning:n { short-caption~without~caption } 
+            \tl_set_eq:NN \l_@@_caption_tl \l_@@_short_caption_tl
+          }
+      }
+    \tl_if_empty:NF \l_@@_label_tl
+      {
+        \tl_if_empty:NT \l_@@_caption_tl
+          { \@@_error_or_warning:n { label~without~caption } }
+      }
     \bool_set_true:N \l_@@_NiceTabular_bool 
     \NiceArray { #2 }
   }
@@ -13331,7 +13637,6 @@
 % \end{itemize}
 %
 %
-%
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_draw_line:
   {
@@ -13339,11 +13644,6 @@
     \pgf at relevantforpicturesizefalse
     \bool_lazy_or:nnTF
     { \tl_if_eq_p:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl }
-%    \end{macrocode}
-% The boolean |\l_@@_dotted_bool| is raised for the rules specified by either
-% |\hdottedline| or |:| (or the letter specified by |letter-for-dotted-lines|)
-% in the preamble of the array. 
-%    \begin{macrocode}
     \l_@@_dotted_bool
       \@@_draw_standard_dotted_line:
       \@@_draw_unstandard_dotted_line:
@@ -14212,7 +14512,7 @@
       {
         \tl_gput_right:Nx \g_@@_row_style_tl 
           {
-            \tl_gput_right:Nn \exp_not:N \g_@@_post_action_cell_tl 
+            \tl_gput_right:Nn \exp_not:N \g_@@_cell_after_hook_tl 
               { 
                 \dim_set:Nn \l_@@_cell_space_top_limit_dim 
                   { \dim_use:N \l_tmpa_dim } 
@@ -14226,7 +14526,7 @@
       {
         \tl_gput_right:Nx \g_@@_row_style_tl 
           {
-            \tl_gput_right:Nn \exp_not:N \g_@@_post_action_cell_tl 
+            \tl_gput_right:Nn \exp_not:N \g_@@_cell_after_hook_tl 
               { 
                 \dim_set:Nn \l_@@_cell_space_bottom_limit_dim 
                   { \dim_use:N \l_tmpb_dim } 
@@ -14978,7 +15278,8 @@
     tikz .initial:n = ,
     total-width .dim_set:N = \l_@@_rule_width_dim ,
     total-width .value_required:n = true ,
-    width .meta:n = { total-width = #1 } 
+    width .meta:n = { total-width = #1 } ,
+    unknown .code:n = \@@_error:n { Unknow~key~for~RulesBis }
   }
 %    \end{macrocode}
 % 
@@ -15096,7 +15397,6 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_vline_ii:
   {
-    \bool_set_false:N \l_@@_dotted_bool
     \keys_set:nV { NiceMatrix / RulesBis } \l_@@_other_keys_tl 
     \bool_if:NTF \l_@@_dotted_bool
       \@@_vline_iv: 
@@ -15352,7 +15652,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_hline_ii:
   {
-    \bool_set_false:N \l_@@_dotted_bool
+    % \bool_set_false:N \l_@@_dotted_bool
     \keys_set:nV { NiceMatrix / RulesBis } \l_@@_other_keys_tl 
     \bool_if:NTF \l_@@_dotted_bool
       \@@_hline_iv: 
@@ -15559,9 +15859,10 @@
 %
 %
 % \medskip
-% The command |\@@_Hline:| will be linked to |\Hline| in the environments of \pkg{nicematrix}.
+% The command |\@@_Hline:| will be linked to |\Hline| in the environments of
+% \pkg{nicematrix}. 
 %    \begin{macrocode}
-\cs_set:Npn \@@_Hline: { \noalign { \ifnum 0 = `} \fi \@@_Hline_i:n { 1 } }
+\cs_set:Npn \@@_Hline: { \noalign \bgroup \@@_Hline_i:n { 1 } }
 %    \end{macrocode}
 %
 % \medskip
@@ -15571,11 +15872,11 @@
 \cs_set:Npn \@@_Hline_i:n #1
   { 
     \peek_remove_spaces:n
-       {
-        \peek_meaning:NTF \Hline
-          { \@@_Hline_ii:nn { #1 + 1 } } 
-          { \@@_Hline_iii:n { #1 } }
-       }
+      {
+       \peek_meaning:NTF \Hline
+         { \@@_Hline_ii:nn { #1 + 1 } } 
+         { \@@_Hline_iii:n { #1 } }
+      }
   }
 %    \end{macrocode}
 %
@@ -15584,22 +15885,30 @@
 %    \end{macrocode}
 % 
 %    \begin{macrocode}
-\cs_set:Npn \@@_Hline_iii:n #1 
+\cs_set:Npn \@@_Hline_iii:n #1
   {
-    \skip_vertical:n 
-      {
-        \arrayrulewidth * ( #1 )
-        + \doublerulesep * ( \int_max:nn 0 { #1 - 1 } ) 
-      }
+    \peek_meaning:NTF [
+      { \@@_Hline_iv:nw { #1 } }
+      { \@@_Hline_iv:nw { #1 } [ ] }
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_set:Npn \@@_Hline_iv:nw #1 [ #2 ]
+  {
+    \@@_compute_rule_width:n { multiplicity = #1 , #2 }
+    \skip_vertical:n { \l_@@_rule_width_dim }
     \tl_gput_right:Nx \g_@@_internal_code_after_tl
       { 
         \@@_hline:n 
           { 
+            multiplicity = #1 , 
             position = \int_eval:n { \c at iRow + 1 } ,
-            multiplicity = #1 
-          }
+            total-width = \dim_use:N \l_@@_rule_width_dim ,
+            #2
+          } 
       }
-    \ifnum 0 = `{ \fi } 
+    \egroup 
   }
 %    \end{macrocode}
 % 
@@ -17107,10 +17416,7 @@
           { 
             \msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 } 
             \@@_msg_redirect_name:nn { Block~too~large~2 } { none }
-            \group_begin:
-            \globaldefs = 1
             \@@_msg_redirect_name:nn { columns~not~used } { none }
-            \group_end:
           }
           { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } }
       } 
@@ -17178,8 +17484,19 @@
           { { #1 } { #2 } { #3 } { #4 } { \l_@@_block_name_str } }  
       }
 %    \end{macrocode}
-% 
+%
+% \bigskip
+% We have a problem here: if the final user has used the keys |hlines| and
+% |color| together, the frame of the block is drawn with the color specified by
+% |color| but the key |hlines| is no-op.
 %    \begin{macrocode}
+    \bool_lazy_and:nnT
+      { ! (\tl_if_empty_p:N \l_@@_draw_tl) }
+      { \l_@@_hlines_block_bool || \l_@@_vlines_block_bool }
+      { \@@_error:n { hlines~with~color } }
+%    \end{macrocode}
+% \bigskip
+%    \begin{macrocode}
     \tl_if_empty:NF \l_@@_draw_tl 
       {
         \tl_gput_right:Nx \g_nicematrix_code_after_tl
@@ -17190,7 +17507,7 @@
               { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int } 
           }  
         \seq_gput_right:Nn \g_@@_pos_of_stroken_blocks_seq 
-           { { #1 } { #2 } { #3 } { #4 } }
+          { { #1 } { #2 } { #3 } { #4 } }
       }
 %    \end{macrocode}
 %
@@ -17858,17 +18175,8 @@
 % \bigskip
 % \subsection*{Automatic arrays}
 %
-% 
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_set_size:n #1-#2 \q_stop
-  {
-    \int_set:Nn \l_@@_nb_rows_int { #1 }
-    \int_set:Nn \l_@@_nb_cols_int { #2 }
-  }
-%    \end{macrocode}
 %
 %
-% \bigskip
 % We will extract the potential keys |columns-type|, |l|, |c|, |r| and pass
 % the other keys to the environment |{NiceArrayWithDelims}|.
 %    \begin{macrocode} 
@@ -17883,17 +18191,21 @@
 %    \end{macrocode}
 % 
 %    \begin{macrocode}
-\NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } } 
+\NewDocumentCommand \AutoNiceMatrixWithDelims 
+  { m m O { } > { \SplitArgument { 1 } { - } } m O { } m ! O { } } 
+  { \@@_auto_nice_matrix:nnnnnn { #1 } { #2 } #4 { #6 } { #3 , #5 , #7  } }
+%    \end{macrocode}
+% 
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_auto_nice_matrix:nnnnnn #1 #2 #3 #4 #5 #6
   {
-    \int_zero_new:N \l_@@_nb_rows_int
-    \int_zero_new:N \l_@@_nb_cols_int
-    \@@_set_size:n #4 \q_stop
 %    \end{macrocode}
 % The group is for the protection of the keys.
 %    \begin{macrocode}
     \group_begin:
     \bool_set_true:N \l_@@_Matrix_bool
-    \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl
+    \keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl
 %    \end{macrocode}
 % We nullify the command |\@@_transform_preamble:| because we will provide a
 % preamble which is yet transformed (by using |\l_@@_columns_type_tl| which is
@@ -17904,19 +18216,16 @@
     \use:x 
       {
         \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } 
-          { 
-            * { \int_use:N \l_@@_nb_cols_int } 
-              { \exp_not:V \l_@@_columns_type_tl } 
-          }  
+          { * { #4 } { \exp_not:V \l_@@_columns_type_tl } }  
           [ \exp_not:V \l_tmpa_tl ] 
       }
     \int_compare:nNnT \l_@@_first_row_int = 0
       { 
         \int_compare:nNnT \l_@@_first_col_int = 0 { & } 
-        \prg_replicate:nn { \l_@@_nb_cols_int - 1 } { & } 
+        \prg_replicate:nn { #4 - 1 } { & } 
         \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\ 
       }
-    \prg_replicate:nn \l_@@_nb_rows_int
+    \prg_replicate:nn { #3 }
       { 
         \int_compare:nNnT \l_@@_first_col_int = 0 { & }
 %    \end{macrocode}
@@ -17925,13 +18234,13 @@
 % value of that |iRow| (since |iRow| is incremented in the first cell of the row
 % of the |\halign|).
 %    \begin{macrocode}
-        \prg_replicate:nn { \l_@@_nb_cols_int - 1 } { { } #6 & } #6
+        \prg_replicate:nn { #4 - 1 } { { } #5 & } #5
         \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\  
       }
     \int_compare:nNnT \l_@@_last_row_int > { -2 }
       { 
         \int_compare:nNnT \l_@@_first_col_int = 0 { & }
-        \prg_replicate:nn { \l_@@_nb_cols_int - 1 } { & } 
+        \prg_replicate:nn { #4 - 1 } { & } 
         \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\  
       }
     \end { NiceArrayWithDelims }
@@ -18170,7 +18479,8 @@
 % If this is really the end of the current environment (of \pkg{nicematrix}), we
 % put back the command |\end| and its argument in the TeX flow.
 %    \begin{macrocode}
-    \str_if_eq:eeTF \@currenvir { #1 } { \end { #1 } }
+    \str_if_eq:eeTF \@currenvir { #1 } 
+      { \end { #1 } }
 %    \end{macrocode}
 % If this is not the |\end| we are looking for, we put those tokens in
 % |\g_nicematrix_code_after_tl| and we go on searching for the next command
@@ -19006,7 +19316,7 @@
       { 
         \pgfpoint 
           { ( \l_@@_x_initial_dim + \l_@@_x_final_dim) / 2 }
-          { \pgf at y + \l_@@_brace_yshift_dim }
+          { \pgf at y + \l_@@_brace_yshift_dim - 3 pt}
       } 
     \pgfnode
       { rectangle }
@@ -19020,10 +19330,16 @@
               { 
                 \hfil ## \hfil \crcr 
                 \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr 
-                \noalign { \skip_vertical:n { 4.5 pt } \nointerlineskip } 
-                \hbox_to_wd:nn
-                  { \l_@@_x_final_dim - \l_@@_x_initial_dim }
-                  { \downbracefill } \cr
+                \noalign { \skip_vertical:n { 3 pt } \nointerlineskip } 
+                \c_math_toggle_token
+                \overbrace 
+                  { 
+                    \hbox_to_wd:nn 
+                      { \l_@@_x_final_dim - \l_@@_x_initial_dim } 
+                      { } 
+                  } 
+                \c_math_toggle_token
+              \cr
               }
             \group_end:
           }
@@ -19044,7 +19360,7 @@
       { 
         \pgfpoint 
           { ( \l_@@_x_initial_dim + \l_@@_x_final_dim) / 2 }
-          { \pgf at y  - \l_@@_brace_yshift_dim }
+          { \pgf at y  - \l_@@_brace_yshift_dim + 3 pt }
       } 
     \pgfnode
       { rectangle }
@@ -19057,10 +19373,16 @@
             \halign
               { 
                 \hfil ## \hfil \crcr 
-                \hbox_to_wd:nn
-                  { \l_@@_x_final_dim - \l_@@_x_initial_dim }
-                  { \upbracefill } \cr
-                \noalign { \skip_vertical:n { 4.5 pt } \nointerlineskip } 
+                \c_math_toggle_token
+                \underbrace 
+                  { 
+                    \hbox_to_wd:nn 
+                      { \l_@@_x_final_dim - \l_@@_x_initial_dim } 
+                      { }
+                  } 
+                \c_math_toggle_token
+                \cr
+                \noalign { \skip_vertical:n { 3 pt } \nointerlineskip } 
                 \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr 
               }
           }
@@ -19260,7 +19582,28 @@
 % |\c_@@_footnote_bool| in order to know if we have to insert an environment
 % |{savenotes}|.
 %
+% \bigskip
+% \subsection*{About the package underscore}
 %
+% 
+%    \begin{macrocode}
+\bool_new:N \l_@@_underscore_loaded_bool
+\@ifpackageloaded { underscore }
+  { \bool_set_true:N \l_@@_underscore_loaded_bool }
+  { }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\hook_gput_code:nnn { begindocument } { . }
+  {
+    \bool_if:NF \l_@@_underscore_loaded_bool
+      {
+        \@ifpackageloaded { underscore }
+          { \@@_error:n { underscore~after~nicematrix } }
+      }
+  }
+%    \end{macrocode}
+% 
 % \bigskip
 % \subsection*{Error messages of the package}
 %
@@ -19320,7 +19663,7 @@
   {
     Negative~weight.\\
     The~weight~of~the~'X'~columns~must~be~positive~and~you~have~used~
-    the~value~'#1'.\\
+    the~value~'\int_use:N \l_@@_weight_int'.\\
     The~absolute~value~will~be~used.
   }  
 %    \end{macrocode}
@@ -19377,17 +19720,8 @@
   }
 %    \end{macrocode}
 %
-%    \begin{macrocode}
-\@@_msg_new:nn { hvlines-except-corners } 
-  { 
-    Obsolete~key.\\
-    The~key~'hvlines-except-corners'~is~now~obsolete.~You~should~instead~use~the~ 
-    keys~'hvlines'~and~'corners'.\\
-    This~error~is~fatal.
-  }
-%    \end{macrocode}
+
 % 
-% 
 %    \begin{macrocode}
 \@@_msg_new:nn { columns~not~used }
   {
@@ -19435,7 +19769,25 @@
   }
 %    \end{macrocode}
 %
+%
 %    \begin{macrocode}
+\@@_msg_new:nn { caption~outside~float }
+  {
+    Key~caption~forbidden.\\
+    You~can't~use~the~key~'caption'~because~you~are~not~in~a~floating~
+    environment.~This~key~will~be~ignored.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { short-caption~without~caption }
+  {
+    You~should~not~use~the~key~'short-caption'~without~'caption'.~
+    However,~your~'short-caption'~will~be~used~as~'caption'.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \@@_msg_new:nn { double~closing~delimiter }
   {
     Double~delimiter.\\
@@ -19463,6 +19815,29 @@
 %    \end{macrocode}
 % 
 %    \begin{macrocode}
+\@@_msg_new:nn { Identical~notes~in~caption }
+  {
+    Identical~tabular~notes.\\
+    You~can't~put~several~notes~with~the~same~content~in~
+    \token_to_str:N \caption\ (but~you~can~in~the~main~tabular).\\
+    If~you~go~on,~the~output~will~probably~be~erroneous.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
+\@@_msg_new:nn { tabularnote~below~the~tabular }
+  { 
+    \token_to_str:N \tabularnote\ forbidden\\
+    You~can't~use~\token_to_str:N \tabularnote\ in~the~caption~
+    of~your~tabular~because~the~caption~will~be~composed~below~
+    the~tabular.~If~you~want~the~caption~above~the~tabular~use~the~
+    key~'caption-above'~in~\token_to_str:N \NiceMatrixOptions.\\
+    Your~\token_to_str:N \tabularnote\ will~be~discarded~and~
+    no~similar~error~will~raised~in~this~document.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \@@_msg_new:nn { Unknown~key~for~rules }
   {
     Unknown~key.\\
@@ -19476,11 +19851,12 @@
   {
     Unknown~key.\\
     The~key~'\l_keys_key_str'~is~unknown~in~a~'custom-line'.~
-    It~will~be~ignored. \\
+    It~you~go~on,~you~will~probably~have~other~errors. \\
     \c_@@_available_keys_str
   }
   {
     The~available~keys~are~(in~alphabetic~order):~
+    ccommand,~
     color,~
     command,~
     dotted,~
@@ -19487,19 +19863,26 @@
     letter,~
     multiplicity,~
     sep-color,~
-    tikz,~and~tota-width.
+    tikz,~and~total-width.
   }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\@@_msg_new:nn { Unknown~key~for~xdots } 
+\@@_msg_new:nnn { Unknown~key~for~xdots } 
   {
     Unknown~key.\\
-    As~for~now,~there~is~only~five~keys~available~here:~'color',~'inter',~
-    'line-style',~'radius',~
-    and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~
-    That~key~will~be~ignored.
+    The~key~'\l_keys_key_str'~is~unknown~for~a~command~for~drawing~dotted~rules.\\
+    \c_@@_available_keys_str
   }
+  {
+    The~available~keys~are~(in~alphabetic~order):~
+    'color',~
+    'inter',~
+    'line-style',~
+    'radius',~
+    'shorten',~
+    'shorten-end'~and~'shorten-start'.
+  }
 %    \end{macrocode}
 %
 %
@@ -19513,8 +19896,15 @@
   }
 %    \end{macrocode}
 %
-%
 %    \begin{macrocode}
+\@@_msg_new:nn { label~without~caption }
+  {
+    You~can't~use~the~key~'label'~in~your~'{NiceTabular}'~because~
+    you~have~not~used~the~key~'caption'.~The~key~'label'~will~be~ignored.
+  }
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \@@_msg_new:nn { Construct~too~large }
   {
     Construct~too~large.\\
@@ -19525,6 +19915,17 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+\@@_msg_new:nn { underscore~after~nicematrix }
+  {
+    Problem~with~'underscore'.\\
+    The~package~'underscore'~should~be~loaded~before~'nicematrix'.~
+    You~can~go~on~but~you~won't~be~able~to~write~something~such~as:\\
+    '\token_to_str:N \Cdots\token_to_str:N _{n~\token_to_str:N \text{~times}}'.
+  }
+%    \end{macrocode}
+% 
+%
+%    \begin{macrocode}
 \@@_msg_new:nn { ampersand~in~light-syntax }
   {
     Ampersand~forbidden.\\
@@ -19543,8 +19944,17 @@
     (set~by~the~key~'end-of-row').~This~error~is~fatal.
   }
 %    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { hlines~with~color }
+  {
+    Incompatible~keys.\\
+    You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~
+    '\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\
+    Your~key~will~be~discarded.
+  }
+%    \end{macrocode}
 % 
-% 
 %    \begin{macrocode}
 \@@_msg_new:nn { bad~value~for~baseline }
   {
@@ -19594,8 +20004,7 @@
 %    \begin{macrocode}
 \@@_msg_new:nn { width~without~X~columns }
   {
-    No~X~column.\\
-    You~have~used~the~key~'width'~but~you~have~put~no~'X'~column. \\
+    You~have~used~the~key~'width'~but~you~have~put~no~'X'~column.~
     That~key~will~be~ignored.
   }
 %    \end{macrocode}
@@ -19845,7 +20254,8 @@
     enumitem~not~loaded.\\
     You~can't~use~the~command~\token_to_str:N\tabularnote\ 
     ~because~you~haven't~loaded~'enumitem'.\\
-    This~command~will~be~ignored.
+    All~the~commands~\token_to_str:N\tabularnote\ will~be~
+    ignored~in~the~document.
   }
 %    \end{macrocode}
 %
@@ -19932,6 +20342,24 @@
 %    \end{macrocode}
 % 
 %    \begin{macrocode}
+\@@_msg_new:nnn { Unknow~key~for~RulesBis }
+  {
+    Unkown~key.\\
+    Your~key~'\l_keys_key_str'~is~unknown~for~a~rule.\\
+    \c_@@_available_keys_str
+  }
+  {
+    The~available~keys~are~(in~alphabetic~order):~
+    color,~
+    dotted,~
+    multiplicity,~
+    sep-color,~
+    tikz,~and~total-width.
+  }
+
+%    \end{macrocode}
+% 
+%    \begin{macrocode}
 \@@_msg_new:nnn { Unknown~key~for~Block } 
   {
     Unknown~key.\\
@@ -20072,6 +20500,7 @@
   { 
     The~available~keys~are~(in~alphabetic~order):~
     allow-duplicate-names,~
+    caption-above,~
     cell-space-bottom-limit,~
     cell-space-limits,~
     cell-space-top-limit,~
@@ -20245,6 +20674,7 @@
     b,~
     baseline,~
     c,~
+    caption,~
     cell-space-bottom-limit,~
     cell-space-limits,~
     cell-space-top-limit,~
@@ -20266,6 +20696,7 @@
     first-row,~
     hlines,~
     hvlines,~
+    label,~
     last-col,~
     last-row,~
     left-margin,~
@@ -20278,6 +20709,7 @@
     respect-arraystretch,~
     right-margin,~
     rules~(with~the~subkeys~'color'~and~'width'),~
+    short-caption,~
     t,~
     tabularnote,~
     vlines,~
@@ -20646,7 +21078,7 @@
 % 
 % \subsection*{Changes between versions 4.3 and 4.4}
 % 
-% New key |hvlines-except-corners|.
+% New key |hvlines-except-corners| (now deprecated).
 %
 % \subsection*{Changes between versions 4.4 and 5.0}
 %
@@ -20902,14 +21334,22 @@
 %
 % \subsection*{Changes between version 6.10 and 6.11}
 %
-% New key |matrix/columns-type| to spcecify the type of columns of the matrices.
+% New key |matrix/columns-type| to specify the type of columns of the matrices.
 %
-% New key |ccommand| in |custom-line| and new command |\cdotteline|.
+% New key |ccommand| in |custom-line| and new command |\cdottedline|.
 %
 % \subsection*{Changes between version 6.11 and 6.12}
 %
-% \PrintIndex
+% New keys |caption|, |short-caption| and |label| in the environment
+% |{NiceTabular}|. 
+%
+% In |{NiceTabular}|, a caption specified by the key |caption| is wrapped to the 
+% width of the tabular.
 % 
+% Correction of a bug: it's now possible to use |\OverBrace| and |\UnderBrace|
+% with \pkg{unicode-math} (with XeLaTeX or LuaLaTeX).
+% 
+% \newpage
 % \tableofcontents
 %
 % \endinput

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2022-07-28 20:05:53 UTC (rev 63992)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2022-07-28 20:06:07 UTC (rev 63993)
@@ -18,8 +18,8 @@
 %% and version 1.3 or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\myfileversion{6.11}
-\def\myfiledate{2022/07/16}
+\def\myfileversion{6.12}
+\def\myfiledate{2022/07/28}
 \RequirePackage{pgfcore}
 \usepgfmodule{shapes}
 \RequirePackage{l3keys2e}
@@ -31,6 +31,7 @@
 \RequirePackage { array }
 \RequirePackage { amsmath }
 \cs_new_protected:Npn \__nicematrix_error:n { \msg_error:nn { nicematrix } }
+\cs_new_protected:Npn \__nicematrix_warning:n { \msg_warning:nn { nicematrix } }
 \cs_new_protected:Npn \__nicematrix_error:nn { \msg_error:nnn { nicematrix } }
 \cs_generate_variant:Nn \__nicematrix_error:nn { n x }
 \cs_new_protected:Npn \__nicematrix_error:nnn { \msg_error:nnnn { nicematrix } }
@@ -43,10 +44,29 @@
       { \msg_new:nnn { nicematrix } { #1 } { #2 \\ #3 } }
       { \msg_new:nnnn { nicematrix } { #1 } { #2 } { #3 } }
   }
+\cs_new_protected:Npn \__nicematrix_error_or_warning:n
+  { \bool_if:NTF \c__nicematrix_messages_for_Overleaf_bool \__nicematrix_warning:n \__nicematrix_error:n }
 \str_if_eq:VnT \c_sys_jobname_str { output }
   { \bool_set_true:N \c__nicematrix_messages_for_Overleaf_bool }
 \cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn
   { \msg_redirect_name:nnn { nicematrix } }
+\cs_new_protected:Npn \__nicematrix_gredirect_none:n #1
+  {
+    \group_begin:
+    \globaldefs = 1
+    \__nicematrix_msg_redirect_name:nn { #1 } { none }
+    \group_end:
+  }
+\cs_new_protected:Npn \__nicematrix_err_gredirect_none:n #1
+  {
+    \__nicematrix_error:n { #1 }
+    \__nicematrix_gredirect_none:n { #1 }
+  }
+\cs_new_protected:Npn \__nicematrix_warning_gredirect_none:n #1
+  {
+    \__nicematrix_warning:n { #1 }
+    \__nicematrix_gredirect_none:n { #1 }
+  }
 \tl_new:N \l__nicematrix_argspec_tl
 \cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
 \cs_generate_variant:Nn \keys_define:nn { n x }
@@ -55,9 +75,6 @@
     \@ifpackageloaded { varwidth }
       { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_true_bool } }
       { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_false_bool } }
-    \@ifpackageloaded { arydshln }
-      { \bool_const:Nn \c__nicematrix_arydshln_loaded_bool { \c_true_bool } }
-      { \bool_const:Nn \c__nicematrix_arydshln_loaded_bool { \c_false_bool } }
     \@ifpackageloaded { booktabs }
       { \bool_const:Nn \c__nicematrix_booktabs_loaded_bool { \c_true_bool } }
       { \bool_const:Nn \c__nicematrix_booktabs_loaded_bool { \c_false_bool } }
@@ -67,7 +84,9 @@
     \@ifpackageloaded { tabularx }
       { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_true_bool } }
       { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_false_bool } }
-      { }
+    \@ifpackageloaded { floatrow }
+      { \bool_const:Nn \c__nicematrix_floatrow_loaded_bool { \c_true_bool } }
+      { \bool_const:Nn \c__nicematrix_floatrow_loaded_bool { \c_false_bool } }
     \@ifpackageloaded { tikz }
       {
         \bool_const:Nn \c__nicematrix_tikz_loaded_bool \c_true_bool
@@ -268,6 +287,7 @@
 \cs_new_protected:Npn \__nicematrix_qpoint:n #1
   { \pgfpointanchor { \__nicematrix_env: - #1 } { center } }
 \int_new:N \g__nicematrix_NiceMatrixBlock_int
+\int_new:N \l__nicematrix_note_in_caption_int
 \dim_new:N \l__nicematrix_columns_width_dim
 \dim_new:N \l__nicematrix_col_width_dim
 \dim_set:Nn \l__nicematrix_col_width_dim { -1 cm }
@@ -292,6 +312,7 @@
 \bool_new:N \l__nicematrix_Matrix_bool
 \bool_new:N \g__nicematrix_rotate_bool
 \bool_new:N \l__nicematrix_X_column_bool
+\bool_new:N \g__nicematrix_caption_finished_bool
 \tl_new:N \g__nicematrix_aux_tl
 \tl_new:N \l__nicematrix_columns_type_tl
 \hook_gput_code:nnn { begindocument } { . }
@@ -338,6 +359,7 @@
 \dim_zero_new:N \l__nicematrix_tmpc_dim
 \dim_zero_new:N \l__nicematrix_tmpd_dim
 \bool_new:N \g__nicematrix_empty_cell_bool
+\bool_new:N \g__nicematrix_second_composition_bool
 \dim_new:N \g__nicematrix_width_last_col_dim
 \dim_new:N \g__nicematrix_width_first_col_dim
 \seq_new:N \g__nicematrix_blocks_seq
@@ -379,6 +401,7 @@
 \clist_new:N \l__nicematrix_submatrix_hlines_clist
 \clist_new:N \l__nicematrix_submatrix_vlines_clist
 \bool_new:N \l__nicematrix_dotted_bool
+\bool_new:N \l__nicematrix_in_caption_bool
 \int_new:N \l__nicematrix_first_row_int
 \int_set:Nn \l__nicematrix_first_row_int 1
 \int_new:N \l__nicematrix_first_col_int
@@ -415,7 +438,8 @@
      }
   }
 \newcounter { tabularnote }
-\seq_new:N \g__nicematrix_tabularnotes_seq
+\seq_new:N \g__nicematrix_notes_seq
+\seq_new:N \g__nicematrix_notes_in_caption_seq
 \tl_new:N \l__nicematrix_tabularnote_tl
 \seq_new:N \l__nicematrix_notes_labels_seq
 \newcounter{nicematrix_draft}
@@ -433,7 +457,10 @@
     \bool_if:nTF { ! \c__nicematrix_enumitem_loaded_bool }
       {
         \NewDocumentCommand \tabularnote { m }
-          { \__nicematrix_error:n { enumitem~not~loaded } }
+          {
+            \__nicematrix_error_or_warning:n { enumitem~not~loaded }
+            \__nicematrix_gredirect_none:n { enumitem~not~loaded }
+          }
       }
       {
         \newlist { tabularnotes } { enumerate } { 1 }
@@ -457,45 +484,95 @@
           }
         \NewDocumentCommand \tabularnote { m }
           {
-            \bool_if:nTF { ! \g__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool }
-              { \__nicematrix_error:n { tabularnote~forbidden } }
+            \bool_if:nT { \cs_if_exist_p:N \@captype || \l__nicematrix_in_env_bool }
               {
-                \int_zero:N \l_tmpa_int
-                \bool_if:NT \l__nicematrix_notes_detect_duplicates_bool
+                \bool_if:nTF { ! \g__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool }
+                  { \__nicematrix_error:n { tabularnote~forbidden } }
                   {
-                    \seq_map_indexed_inline:Nn \g__nicematrix_tabularnotes_seq
+                    \bool_if:NTF \l__nicematrix_in_caption_bool
+                      { \__nicematrix_tabularnote_ii:n { #1 } }
+                      { \__nicematrix_tabularnote_i:n { #1 } }
+                  }
+              }
+          }
+        \cs_new_protected:Npn \__nicematrix_tabularnote_i:n #1
+          {
+            \int_zero:N \l_tmpa_int
+            \bool_if:NT \l__nicematrix_notes_detect_duplicates_bool
+              {
+                \seq_map_indexed_inline:Nn \g__nicematrix_notes_seq
+                  {
+                    \tl_if_eq:nnT { #1 } { ##2 }
+                      { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: }
+                  }
+                \int_compare:nNnF \l_tmpa_int = 0
+                  { \int_add:Nn \l_tmpa_int \l__nicematrix_note_in_caption_int }
+              }
+            \int_compare:nNnTF \l_tmpa_int = 0
+              {
+                \int_gincr:N \c at tabularnote
+                \seq_put_right:Nx \l__nicematrix_notes_labels_seq
+                  { \__nicematrix_notes_format:n { \int_use:c { c @ tabularnote } } }
+                \seq_gput_right:Nn \g__nicematrix_notes_seq { #1 }
+              }
+              {
+                \seq_put_right:Nx \l__nicematrix_notes_labels_seq
+                  { \__nicematrix_notes_format:n { \int_use:N \l_tmpa_int } }
+              }
+            \peek_meaning:NF \tabularnote
+              {
+                \hbox_set:Nn \l_tmpa_box
+                  {
+                    \__nicematrix_notes_label_in_tabular:n
                       {
-                        \tl_if_eq:nnT { #1 } { ##2 }
-                          { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: }
+                        \seq_use:Nnnn
+                          \l__nicematrix_notes_labels_seq { , } { , } { , }
                       }
                   }
-                \int_compare:nNnTF \l_tmpa_int = 0
+                \int_gsub:Nn \c at tabularnote { 1 }
+                \int_set_eq:NN \l_tmpa_int \c at tabularnote
+                \refstepcounter { tabularnote }
+                \int_compare:nNnT \l_tmpa_int = \c at tabularnote
+                  { \int_gincr:N \c at tabularnote }
+                \seq_clear:N \l__nicematrix_notes_labels_seq
+                \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
+                \skip_horizontal:n { \box_wd:N \l_tmpa_box }
+              }
+          }
+        \cs_new_protected:Npn \__nicematrix_tabularnote_ii:n #1
+          {
+            \int_gincr:N \c at tabularnote
+            \bool_if:NTF \g__nicematrix_caption_finished_bool
+              {
+                \int_compare:nNnTF
+                  \c at tabularnote > { \tl_count:N \g__nicematrix_notes_in_caption_seq }
+                  { \int_gset:Nn \c at tabularnote { 1 } }
+                \seq_if_in:NnF \g__nicematrix_notes_in_caption_seq { #1 }
+                  { \__nicematrix_fatal:n { Identical~notes~in~caption } }
+              }
+              {
+                \seq_if_in:NnTF \g__nicematrix_notes_in_caption_seq { #1 }
                   {
-                    \stepcounter { tabularnote }
-                    \seq_put_right:Nx \l__nicematrix_notes_labels_seq
-                      { \__nicematrix_notes_format:n { \int_use:c { c @ tabularnote } } }
-                    \seq_gput_right:Nn \g__nicematrix_tabularnotes_seq { #1 }
+                    \bool_gset_true:N \g__nicematrix_caption_finished_bool
+                    \int_gset:Nn \c at tabularnote { 1 }
                   }
+                  { \seq_gput_right:Nn \g__nicematrix_notes_in_caption_seq { #1 } }
+              }
+            \seq_put_right:Nx \l__nicematrix_notes_labels_seq
+              { \__nicematrix_notes_format:n { \int_use:N \c at tabularnote } }
+            \peek_meaning:NF \tabularnote
+              {
+                \hbox_set:Nn \l_tmpa_box
                   {
-                    \seq_put_right:Nx \l__nicematrix_notes_labels_seq
-                      { \__nicematrix_notes_format:n { \int_use:N \l_tmpa_int } }
-                  }
-                \peek_meaning:NF \tabularnote
-                  {
-                    \hbox_set:Nn \l_tmpa_box
+                    \__nicematrix_notes_label_in_tabular:n
                       {
-                        \__nicematrix_notes_label_in_tabular:n
-                          {
-                            \seq_use:Nnnn
-                              \l__nicematrix_notes_labels_seq { , } { , } { , }
-                          }
+                        \seq_use:Nnnn
+                          \l__nicematrix_notes_labels_seq { , } { , } { , }
                       }
-                    \addtocounter { tabularnote } { -1 }
-                    \refstepcounter { tabularnote }
-                    \seq_clear:N \l__nicematrix_notes_labels_seq
-                    \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
-                    \skip_horizontal:n { \box_wd:N \l_tmpa_box }
                   }
+                \seq_clear:N \l__nicematrix_notes_labels_seq
+                \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
+                \skip_horizontal:n { \box_wd:N \l_tmpa_box }
               }
           }
       }
@@ -549,6 +626,10 @@
       { }
     \end { pgfscope }
   }
+\tl_new:N \l__nicematrix_caption_tl
+\tl_new:N \l__nicematrix_short_caption_tl
+\tl_new:N \l__nicematrix_label_tl
+\bool_new:N \l__nicematrix_caption_above_bool
 \bool_new:N \l__nicematrix_colortbl_like_bool
 \bool_new:N \l__nicematrix_standard_cline_bool
 \dim_new:N \l__nicematrix_cell_space_top_limit_dim
@@ -727,8 +808,6 @@
   }
 \keys_define:nn { NiceMatrix / Env }
   {
-    hvlines-except-corners .code:n = \__nicematrix_fatal:n { hvlines-except-corners } ,
-    hvlines-except-corners .default:n = { NW , SW , NE , SE } ,
     corners .clist_set:N = \l__nicematrix_corners_clist ,
     corners .default:n = { NW , SW , NE , SE } ,
     code-before .code:n =
@@ -861,9 +940,10 @@
   {
     width .code:n = \dim_set:Nn \l__nicematrix_width_dim { #1 } ,
     width .value_required:n = true ,
-    last-col .code:n = \tl_if_empty:nF { #1 }
-                         { \__nicematrix_error:n { last-col~non~empty~for~NiceMatrixOptions } }
-                       \int_zero:N \l__nicematrix_last_col_int ,
+    last-col .code:n =
+      \tl_if_empty:nF { #1 }
+        { \__nicematrix_error:n { last-col~non~empty~for~NiceMatrixOptions } }
+        \int_zero:N \l__nicematrix_last_col_int ,
     small .bool_set:N = \l__nicematrix_small_bool ,
     small .value_forbidden:n = true ,
     renew-matrix .code:n = \__nicematrix_renew_matrix: ,
@@ -883,6 +963,8 @@
     matrix / columns-type .code:n =
       \__nicematrix_set_preamble:Nn \l__nicematrix_columns_type_tl { #1 },
     matrix / columns-type .value_required:n = true ,
+    caption-above .bool_set:N = \l__nicematrix_caption_above_bool ,
+    caption-above .default:n = true ,
     unknown .code:n  = \__nicematrix_error:n { Unknown~key~for~NiceMatrixOptions }
   }
 \NewDocumentCommand \NiceMatrixOptions { m }
@@ -944,6 +1026,12 @@
     notes / bottomrule .default:n = true ,
     tabularnote .tl_set:N = \l__nicematrix_tabularnote_tl ,
     tabularnote .value_required:n = true ,
+    caption .tl_set:N = \l__nicematrix_caption_tl ,
+    caption .value_required:n = true ,
+    short-caption .tl_set:N = \l__nicematrix_short_caption_tl ,
+    short-caption .value_required:n = true ,
+    label .tl_set:N = \l__nicematrix_label_tl ,
+    label .value_required:n = true ,
     last-col .code:n = \tl_if_empty:nF {#1}
                          { \__nicematrix_error:n { last-col~non~empty~for~NiceArray } }
                        \int_zero:N \l__nicematrix_last_col_int ,
@@ -953,7 +1041,7 @@
   }
 \cs_new_protected:Npn \__nicematrix_cell_begin:w
   {
-    \tl_gclear:N \g__nicematrix_post_action_cell_tl
+    \tl_gclear:N \g__nicematrix_cell_after_hook_tl
     \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:
     \int_gincr:N \c at jCol
     \int_compare:nNnT \c at jCol = 1
@@ -1057,7 +1145,7 @@
   {
     \__nicematrix_math_toggle_token:
     \hbox_set_end:
-    \g__nicematrix_post_action_cell_tl
+    \g__nicematrix_cell_after_hook_tl
     \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
     \__nicematrix_adjust_size_box:
     \box_set_ht:Nn \l__nicematrix_cell_box
@@ -1324,6 +1412,15 @@
     \cs_set_eq:NN \multicolumn \__nicematrix_multicolumn:nnn
     \hook_gput_code:nnn { env / tabular / begin } { . }
       { \cs_set_eq:NN \multicolumn \__nicematrix_old_multicolumn }
+    \tl_if_exist:NT \l__nicematrix_note_in_caption_tl
+      {
+        \tl_if_empty:NF \l__nicematrix_note_in_caption_tl
+          {
+            \int_set_eq:NN \l__nicematrix_note_in_caption_int
+              { \l__nicematrix_note_in_caption_tl }
+            \int_gset:Nn \c at tabularnote { \l__nicematrix_note_in_caption_tl }
+          }
+      }
     \seq_gclear:N \g__nicematrix_multicolumn_cells_seq
     \seq_gclear:N \g__nicematrix_multicolumn_sizes_seq
     \int_gset:Nn \c at iRow { \l__nicematrix_first_row_int - 1 }
@@ -1636,7 +1733,7 @@
     \bool_if:NT \l__nicematrix_width_used_bool
       {
         \int_compare:nNnT \g__nicematrix_total_X_weight_int = 0
-          { \__nicematrix_error:n { width~without~X~columns } }
+          { \__nicematrix_error_or_warning:n { width~without~X~columns } }
       }
     \int_compare:nNnT \g__nicematrix_total_X_weight_int > 0
       {
@@ -1750,13 +1847,7 @@
     \bool_if:NF \l__nicematrix_Matrix_bool
       {
         \int_compare:nNnT \c at jCol < \g__nicematrix_static_num_of_col_int
-          {
-            \__nicematrix_error:n { columns~not~used }
-            \group_begin:
-            \globaldefs = 1
-            \__nicematrix_msg_redirect_name:nn { columns~not~used } { none }
-            \group_end:
-          }
+          { \__nicematrix_warning_gredirect_none:n  { columns~not~used } }
       }
     \__nicematrix_after_array:
     \egroup
@@ -2051,7 +2142,7 @@
   }
 \cs_new_protected:Npn \__nicematrix_center_cell_box:
   {
-    \tl_gput_right:Nn \g__nicematrix_post_action_cell_tl
+    \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl
       {
         \int_compare:nNnT
           { \box_ht:N \l__nicematrix_cell_box }
@@ -2086,7 +2177,7 @@
     \bool_if:NTF \c__nicematrix_varwidth_loaded_bool
       { \__nicematrix_patch_preamble_iv_iv:nn { #2 } { varwidth } }
       {
-        \__nicematrix_error:n { varwidth~not~loaded }
+        \__nicematrix_error_or_warning:n { varwidth~not~loaded }
         \__nicematrix_patch_preamble_iv_iv:nn { #2 } { minipage }
       }
   }
@@ -2240,7 +2331,7 @@
     \keys_set:nV { WithArrows / X-column } \l_tmpa_tl
     \int_compare:nNnT \l__nicematrix_weight_int < 0
       {
-        \__nicematrix_error:nx { negative~weight } { \int_use:N \l__nicematrix_weight_int }
+        \__nicematrix_error_or_warning:n { negative~weight }
         \int_set:Nn \l__nicematrix_weight_int { - \l__nicematrix_weight_int }
       }
     \int_gadd:Nn \g__nicematrix_total_X_weight_int \l__nicematrix_weight_int
@@ -2256,7 +2347,7 @@
             > {
                 \__nicematrix_cell_begin:w
                 \bool_set_true:N \l__nicematrix_X_column_bool
-                \tl_gput_right:Nn \g__nicematrix_post_action_cell_tl
+                \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl
                   { \hbox_set:Nn \l__nicematrix_cell_box { } }
                 \begin { minipage } { 5 cm } \arraybackslash
               }
@@ -2498,6 +2589,25 @@
           { \box_wd:N \l__nicematrix_the_array_box - \arraycolsep }
       }
     \begin { minipage } [ t ] { \box_wd:N \l__nicematrix_the_array_box }
+    \bool_if:NT \l__nicematrix_caption_above_bool
+      {
+        \tl_if_empty:NF \l__nicematrix_caption_tl
+          {
+            \bool_set_false:N \g__nicematrix_caption_finished_bool
+            \int_gzero:N \c at tabularnote
+            \__nicematrix_insert_caption:
+            \int_gset:Nn \c at tabularnote
+              { \seq_count:N \g__nicematrix_notes_in_caption_seq }
+            \int_compare:nNnF \c at tabularnote = 0
+              {
+                \tl_gput_right:Nx \g__nicematrix_aux_tl
+                  {
+                    \tl_set:Nn \exp_not:N \l__nicematrix_note_in_caption_tl
+                      { \int_eval:n { \c at tabularnote } }
+                  }
+              }
+          }
+      }
     \hbox
       {
         \box_use_drop:N \l__nicematrix_the_array_box
@@ -2504,14 +2614,47 @@
         \__nicematrix_create_extra_nodes:
         \seq_if_empty:NF \g__nicematrix_blocks_seq \__nicematrix_draw_blocks:
       }
-    \bool_lazy_or:nnT
-      { ! \seq_if_empty_p:N \g__nicematrix_tabularnotes_seq }
-      { ! \tl_if_empty_p:V \l__nicematrix_tabularnote_tl }
+    \bool_lazy_any:nT
+      {
+        { ! \seq_if_empty_p:N \g__nicematrix_notes_seq }
+        { ! \seq_if_empty_p:N \g__nicematrix_notes_in_caption_seq }
+        { ! \tl_if_empty_p:V \l__nicematrix_tabularnote_tl }
+      }
       \__nicematrix_insert_tabularnotes:
+    \cs_set_eq:NN \tabularnote \__nicematrix_tabularnote_error:n
+    \bool_if:NF \l__nicematrix_caption_above_bool \__nicematrix_insert_caption:
     \end { minipage }
   }
+\cs_new_protected:Npn \__nicematrix_insert_caption:
+  {
+    \tl_if_empty:NF \l__nicematrix_caption_tl
+      {
+        \cs_if_exist:NTF \@captype
+          { \__nicematrix_insert_caption_i: }
+          { \__nicematrix_error:n { caption~outside~float } }
+      }
+  }
+\cs_new_protected:Npn \__nicematrix_insert_caption_i:
+  {
+    \group_begin:
+    \bool_set_true:N \l__nicematrix_in_caption_bool
+    \bool_if:NT \c__nicematrix_floatrow_loaded_bool
+      { \cs_set_eq:NN \@makecaption \FR at makecaption }
+    \tl_if_empty:NTF \l__nicematrix_short_caption_tl
+      { \caption { \l__nicematrix_caption_tl } }
+      { \caption [ \l__nicematrix_short_caption_tl ] { \l__nicematrix_caption_tl } }
+    \tl_if_empty:NF \l__nicematrix_label_tl { \label { \l__nicematrix_label_tl } }
+    \group_end:
+  }
+\cs_new_protected:Npn \__nicematrix_tabularnote_error:n #1
+  {
+    \__nicematrix_error_or_warning:n { tabularnote~below~the~tabular }
+    \__nicematrix_gredirect_none:n { tabularnote~below~the~tabular }
+  }
 \cs_new_protected:Npn \__nicematrix_insert_tabularnotes:
   {
+    \seq_gconcat:NNN \g__nicematrix_notes_seq \g__nicematrix_notes_in_caption_seq \g__nicematrix_notes_seq
+    \int_set:Nn \c at tabularnote { \seq_count:N \g__nicematrix_notes_seq }
     \skip_vertical:N 0.65ex
     \group_begin:
     \l__nicematrix_notes_code_before_tl
@@ -2521,13 +2664,13 @@
         \bool_if:NTF \l__nicematrix_notes_para_bool
           {
             \begin { tabularnotes* }
-              \seq_map_inline:Nn \g__nicematrix_tabularnotes_seq { \item ##1 } \strut
+              \seq_map_inline:Nn \g__nicematrix_notes_seq { \item ##1 } \strut
             \end { tabularnotes* }
             \par
           }
           {
             \tabularnotes
-              \seq_map_inline:Nn \g__nicematrix_tabularnotes_seq { \item ##1 } \strut
+              \seq_map_inline:Nn \g__nicematrix_notes_seq { \item ##1 } \strut
             \endtabularnotes
           }
       }
@@ -2540,10 +2683,11 @@
             \skip_vertical:N \aboverulesep
             { \CT at arc@ \hrule height \heavyrulewidth }
           }
-          { \__nicematrix_error:n { bottomrule~without~booktabs } }
+          { \__nicematrix_error_or_warning:n { bottomrule~without~booktabs } }
       }
     \l__nicematrix_notes_code_after_tl
-    \seq_gclear:N \g__nicematrix_tabularnotes_seq
+    \seq_gclear:N \g__nicematrix_notes_seq
+    \seq_gclear:N \g__nicematrix_notes_in_caption_seq
     \int_gzero:N \c at tabularnote
   }
 \cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes_b:
@@ -3078,6 +3222,19 @@
       { \dim_set_eq:NN \l__nicematrix_width_dim \linewidth }
     \str_gset:Nn \g__nicematrix_name_env_str { NiceTabular }
     \keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 }
+    \tl_if_empty:NF \l__nicematrix_short_caption_tl
+      {
+        \tl_if_empty:NT \l__nicematrix_caption_tl
+          {
+            \__nicematrix_error_or_warning:n { short-caption~without~caption }
+            \tl_set_eq:NN \l__nicematrix_caption_tl \l__nicematrix_short_caption_tl
+          }
+      }
+    \tl_if_empty:NF \l__nicematrix_label_tl
+      {
+        \tl_if_empty:NT \l__nicematrix_caption_tl
+          { \__nicematrix_error_or_warning:n { label~without~caption } }
+      }
     \bool_set_true:N \l__nicematrix_NiceTabular_bool
     \NiceArray { #2 }
   }
@@ -4486,7 +4643,7 @@
       {
         \tl_gput_right:Nx \g__nicematrix_row_style_tl
           {
-            \tl_gput_right:Nn \exp_not:N \g__nicematrix_post_action_cell_tl
+            \tl_gput_right:Nn \exp_not:N \g__nicematrix_cell_after_hook_tl
               {
                 \dim_set:Nn \l__nicematrix_cell_space_top_limit_dim
                   { \dim_use:N \l_tmpa_dim }
@@ -4497,7 +4654,7 @@
       {
         \tl_gput_right:Nx \g__nicematrix_row_style_tl
           {
-            \tl_gput_right:Nn \exp_not:N \g__nicematrix_post_action_cell_tl
+            \tl_gput_right:Nn \exp_not:N \g__nicematrix_cell_after_hook_tl
               {
                 \dim_set:Nn \l__nicematrix_cell_space_bottom_limit_dim
                   { \dim_use:N \l_tmpb_dim }
@@ -4906,7 +5063,8 @@
     tikz .initial:n = ,
     total-width .dim_set:N = \l__nicematrix_rule_width_dim ,
     total-width .value_required:n = true ,
-    width .meta:n = { total-width = #1 }
+    width .meta:n = { total-width = #1 } ,
+    unknown .code:n = \__nicematrix_error:n { Unknow~key~for~RulesBis }
   }
 \cs_new_protected:Npn \__nicematrix_vline:n #1
   {
@@ -4981,7 +5139,6 @@
    }
 \cs_new_protected:Npn \__nicematrix_vline_ii:
   {
-    \bool_set_false:N \l__nicematrix_dotted_bool
     \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl
     \bool_if:NTF \l__nicematrix_dotted_bool
       \__nicematrix_vline_iv:
@@ -5169,7 +5326,7 @@
    }
 \cs_new_protected:Npn \__nicematrix_hline_ii:
   {
-    \bool_set_false:N \l__nicematrix_dotted_bool
+    % \bool_set_false:N \l__nicematrix_dotted_bool
     \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl
     \bool_if:NTF \l__nicematrix_dotted_bool
       \__nicematrix_hline_iv:
@@ -5299,33 +5456,38 @@
           { \__nicematrix_hline:n { position = ##1 , total-width = \arrayrulewidth } }
       }
   }
-\cs_set:Npn \__nicematrix_Hline: { \noalign { \ifnum 0 = `} \fi \__nicematrix_Hline_i:n { 1 } }
+\cs_set:Npn \__nicematrix_Hline: { \noalign \bgroup \__nicematrix_Hline_i:n { 1 } }
 \cs_set:Npn \__nicematrix_Hline_i:n #1
   {
     \peek_remove_spaces:n
-       {
-        \peek_meaning:NTF \Hline
-          { \__nicematrix_Hline_ii:nn { #1 + 1 } }
-          { \__nicematrix_Hline_iii:n { #1 } }
-       }
+      {
+       \peek_meaning:NTF \Hline
+         { \__nicematrix_Hline_ii:nn { #1 + 1 } }
+         { \__nicematrix_Hline_iii:n { #1 } }
+      }
   }
 \cs_set:Npn \__nicematrix_Hline_ii:nn #1 #2 { \__nicematrix_Hline_i:n { #1 } }
 \cs_set:Npn \__nicematrix_Hline_iii:n #1
   {
-    \skip_vertical:n
-      {
-        \arrayrulewidth * ( #1 )
-        + \doublerulesep * ( \int_max:nn 0 { #1 - 1 } )
-      }
+    \peek_meaning:NTF [
+      { \__nicematrix_Hline_iv:nw { #1 } }
+      { \__nicematrix_Hline_iv:nw { #1 } [ ] }
+  }
+\cs_set:Npn \__nicematrix_Hline_iv:nw #1 [ #2 ]
+  {
+    \__nicematrix_compute_rule_width:n { multiplicity = #1 , #2 }
+    \skip_vertical:n { \l__nicematrix_rule_width_dim }
     \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
       {
         \__nicematrix_hline:n
           {
+            multiplicity = #1 ,
             position = \int_eval:n { \c at iRow + 1 } ,
-            multiplicity = #1
+            total-width = \dim_use:N \l__nicematrix_rule_width_dim ,
+            #2
           }
       }
-    \ifnum 0 = `{ \fi }
+    \egroup
   }
 \keys_define:nn { NiceMatrix / ColumnTypes }  { }
 \cs_new_protected:Npn \__nicematrix_custom_line:n #1
@@ -6235,10 +6397,7 @@
           {
             \msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 }
             \__nicematrix_msg_redirect_name:nn { Block~too~large~2 } { none }
-            \group_begin:
-            \globaldefs = 1
             \__nicematrix_msg_redirect_name:nn { columns~not~used } { none }
-            \group_end:
           }
           { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } }
       }
@@ -6286,6 +6445,10 @@
         \seq_gput_left:Nx \g__nicematrix_pos_of_blocks_seq
           { { #1 } { #2 } { #3 } { #4 } { \l__nicematrix_block_name_str } }
       }
+    \bool_lazy_and:nnT
+      { ! (\tl_if_empty_p:N \l__nicematrix_draw_tl) }
+      { \l__nicematrix_hlines_block_bool || \l__nicematrix_vlines_block_bool }
+      { \__nicematrix_error:n { hlines~with~color } }
     \tl_if_empty:NF \l__nicematrix_draw_tl
       {
         \tl_gput_right:Nx \g_nicematrix_code_after_tl
@@ -6296,7 +6459,7 @@
               { \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
           }
         \seq_gput_right:Nn \g__nicematrix_pos_of_stroken_blocks_seq
-           { { #1 } { #2 } { #3 } { #4 } }
+          { { #1 } { #2 } { #3 } { #4 } }
       }
     \clist_if_empty:NF \l__nicematrix_borders_clist
       {
@@ -6744,11 +6907,6 @@
       { \BNiceMatrix }
       { \endBNiceMatrix }
   }
-\cs_new_protected:Npn \__nicematrix_set_size:n #1-#2 \q_stop
-  {
-    \int_set:Nn \l__nicematrix_nb_rows_int { #1 }
-    \int_set:Nn \l__nicematrix_nb_cols_int { #2 }
-  }
 \keys_define:nn { NiceMatrix / Auto }
   {
     columns-type .code:n = \__nicematrix_set_preamble:Nn \l__nicematrix_columns_type_tl { #1 } ,
@@ -6757,40 +6915,37 @@
     r .meta:n = { columns-type = r } ,
     c .meta:n = { columns-type = c }
   }
-\NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } }
+\NewDocumentCommand \AutoNiceMatrixWithDelims
+  { m m O { } > { \SplitArgument { 1 } { - } } m O { } m ! O { } }
+  { \__nicematrix_auto_nice_matrix:nnnnnn { #1 } { #2 } #4 { #6 } { #3 , #5 , #7  } }
+\cs_new_protected:Npn \__nicematrix_auto_nice_matrix:nnnnnn #1 #2 #3 #4 #5 #6
   {
-    \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
     \group_begin:
     \bool_set_true:N \l__nicematrix_Matrix_bool
-    \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl
+    \keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl
     \cs_set_eq:NN \__nicematrix_transform_preamble: \prg_do_nothing:
     \use:x
       {
         \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
-          {
-            * { \int_use:N \l__nicematrix_nb_cols_int }
-              { \exp_not:V \l__nicematrix_columns_type_tl }
-          }
+          { * { #4 } { \exp_not:V \l__nicematrix_columns_type_tl } }
           [ \exp_not:V \l_tmpa_tl ]
       }
     \int_compare:nNnT \l__nicematrix_first_row_int = 0
       {
         \int_compare:nNnT \l__nicematrix_first_col_int = 0 { & }
-        \prg_replicate:nn { \l__nicematrix_nb_cols_int - 1 } { & }
+        \prg_replicate:nn { #4 - 1 } { & }
         \int_compare:nNnT \l__nicematrix_last_col_int > { -1 } { & } \\
       }
-    \prg_replicate:nn \l__nicematrix_nb_rows_int
+    \prg_replicate:nn { #3 }
       {
         \int_compare:nNnT \l__nicematrix_first_col_int = 0 { & }
-        \prg_replicate:nn { \l__nicematrix_nb_cols_int - 1 } { { } #6 & } #6
+        \prg_replicate:nn { #4 - 1 } { { } #5 & } #5
         \int_compare:nNnT \l__nicematrix_last_col_int > { -1 } { & } \\
       }
     \int_compare:nNnT \l__nicematrix_last_row_int > { -2 }
       {
         \int_compare:nNnT \l__nicematrix_first_col_int = 0 { & }
-        \prg_replicate:nn { \l__nicematrix_nb_cols_int - 1 } { & }
+        \prg_replicate:nn { #4 - 1 } { & }
         \int_compare:nNnT \l__nicematrix_last_col_int > { -1 } { & } \\
       }
     \end { NiceArrayWithDelims }
@@ -6918,7 +7073,8 @@
   }
 \cs_new_protected:Npn \__nicematrix_CodeAfter_iv:n #1
   {
-    \str_if_eq:eeTF \@currenvir { #1 } { \end { #1 } }
+    \str_if_eq:eeTF \@currenvir { #1 }
+      { \end { #1 } }
       {
         \tl_gput_right:Nn \g_nicematrix_code_after_tl { \end { #1 } }
         \__nicematrix_CodeAfter_ii:n
@@ -7466,7 +7622,7 @@
       {
         \pgfpoint
           { ( \l__nicematrix_x_initial_dim + \l__nicematrix_x_final_dim) / 2 }
-          { \pgf at y + \l__nicematrix_brace_yshift_dim }
+          { \pgf at y + \l__nicematrix_brace_yshift_dim - 3 pt}
       }
     \pgfnode
       { rectangle }
@@ -7480,10 +7636,16 @@
               {
                 \hfil ## \hfil \crcr
                 \__nicematrix_math_toggle_token: #1 \__nicematrix_math_toggle_token: \cr
-                \noalign { \skip_vertical:n { 4.5 pt } \nointerlineskip }
-                \hbox_to_wd:nn
-                  { \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim }
-                  { \downbracefill } \cr
+                \noalign { \skip_vertical:n { 3 pt } \nointerlineskip }
+                \c_math_toggle_token
+                \overbrace
+                  {
+                    \hbox_to_wd:nn
+                      { \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim }
+                      { }
+                  }
+                \c_math_toggle_token
+              \cr
               }
             \group_end:
           }
@@ -7498,7 +7660,7 @@
       {
         \pgfpoint
           { ( \l__nicematrix_x_initial_dim + \l__nicematrix_x_final_dim) / 2 }
-          { \pgf at y  - \l__nicematrix_brace_yshift_dim }
+          { \pgf at y  - \l__nicematrix_brace_yshift_dim + 3 pt }
       }
     \pgfnode
       { rectangle }
@@ -7511,10 +7673,16 @@
             \halign
               {
                 \hfil ## \hfil \crcr
-                \hbox_to_wd:nn
-                  { \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim }
-                  { \upbracefill } \cr
-                \noalign { \skip_vertical:n { 4.5 pt } \nointerlineskip }
+                \c_math_toggle_token
+                \underbrace
+                  {
+                    \hbox_to_wd:nn
+                      { \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim }
+                      { }
+                  }
+                \c_math_toggle_token
+                \cr
+                \noalign { \skip_vertical:n { 3 pt } \nointerlineskip }
                 \__nicematrix_math_toggle_token: #1 \__nicematrix_math_toggle_token: \cr
               }
           }
@@ -7645,6 +7813,18 @@
       }
     \bool_set_true:N \c__nicematrix_footnote_bool
   }
+\bool_new:N \l__nicematrix_underscore_loaded_bool
+\@ifpackageloaded { underscore }
+  { \bool_set_true:N \l__nicematrix_underscore_loaded_bool }
+  { }
+\hook_gput_code:nnn { begindocument } { . }
+  {
+    \bool_if:NF \l__nicematrix_underscore_loaded_bool
+      {
+        \@ifpackageloaded { underscore }
+          { \__nicematrix_error:n { underscore~after~nicematrix } }
+      }
+  }
 \bool_if:NTF \c__nicematrix_messages_for_Overleaf_bool
   { \str_const:Nn \c__nicematrix_available_keys_str { } }
   {
@@ -7681,7 +7861,7 @@
   {
     Negative~weight.\\
     The~weight~of~the~'X'~columns~must~be~positive~and~you~have~used~
-    the~value~'#1'.\\
+    the~value~'\int_use:N \l__nicematrix_weight_int'.\\
     The~absolute~value~will~be~used.
   }
 \__nicematrix_msg_new:nn { last~col~not~used }
@@ -7719,13 +7899,7 @@
     ~(plus~the~potential~exterior~ones).~
     This~error~is~fatal.
   }
-\__nicematrix_msg_new:nn { hvlines-except-corners }
-  {
-    Obsolete~key.\\
-    The~key~'hvlines-except-corners'~is~now~obsolete.~You~should~instead~use~the~
-    keys~'hvlines'~and~'corners'.\\
-    This~error~is~fatal.
-  }
+
 \__nicematrix_msg_new:nn { columns~not~used }
   {
     Columns~not~used.\\
@@ -7757,6 +7931,17 @@
     You~can't~use~the~command~#1 in~the~last~row~(exterior)~of~the~array.\\
     That~command~will~be~ignored.
   }
+\__nicematrix_msg_new:nn { caption~outside~float }
+  {
+    Key~caption~forbidden.\\
+    You~can't~use~the~key~'caption'~because~you~are~not~in~a~floating~
+    environment.~This~key~will~be~ignored.
+  }
+\__nicematrix_msg_new:nn { short-caption~without~caption }
+  {
+    You~should~not~use~the~key~'short-caption'~without~'caption'.~
+    However,~your~'short-caption'~will~be~used~as~'caption'.
+  }
 \__nicematrix_msg_new:nn { double~closing~delimiter }
   {
     Double~delimiter.\\
@@ -7775,6 +7960,23 @@
     Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~
     is~'standard'.~That~key~will~be~ignored.
   }
+\__nicematrix_msg_new:nn { Identical~notes~in~caption }
+  {
+    Identical~tabular~notes.\\
+    You~can't~put~several~notes~with~the~same~content~in~
+    \token_to_str:N \caption\ (but~you~can~in~the~main~tabular).\\
+    If~you~go~on,~the~output~will~probably~be~erroneous.
+  }
+\__nicematrix_msg_new:nn { tabularnote~below~the~tabular }
+  {
+    \token_to_str:N \tabularnote\ forbidden\\
+    You~can't~use~\token_to_str:N \tabularnote\ in~the~caption~
+    of~your~tabular~because~the~caption~will~be~composed~below~
+    the~tabular.~If~you~want~the~caption~above~the~tabular~use~the~
+    key~'caption-above'~in~\token_to_str:N \NiceMatrixOptions.\\
+    Your~\token_to_str:N \tabularnote\ will~be~discarded~and~
+    no~similar~error~will~raised~in~this~document.
+  }
 \__nicematrix_msg_new:nn { Unknown~key~for~rules }
   {
     Unknown~key.\\
@@ -7785,11 +7987,12 @@
   {
     Unknown~key.\\
     The~key~'\l_keys_key_str'~is~unknown~in~a~'custom-line'.~
-    It~will~be~ignored. \\
+    It~you~go~on,~you~will~probably~have~other~errors. \\
     \c__nicematrix_available_keys_str
   }
   {
     The~available~keys~are~(in~alphabetic~order):~
+    ccommand,~
     color,~
     command,~
     dotted,~
@@ -7796,16 +7999,23 @@
     letter,~
     multiplicity,~
     sep-color,~
-    tikz,~and~tota-width.
+    tikz,~and~total-width.
   }
-\__nicematrix_msg_new:nn { Unknown~key~for~xdots }
+\__nicematrix_msg_new:nnn { Unknown~key~for~xdots }
   {
     Unknown~key.\\
-    As~for~now,~there~is~only~five~keys~available~here:~'color',~'inter',~
-    'line-style',~'radius',~
-    and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~
-    That~key~will~be~ignored.
+    The~key~'\l_keys_key_str'~is~unknown~for~a~command~for~drawing~dotted~rules.\\
+    \c__nicematrix_available_keys_str
   }
+  {
+    The~available~keys~are~(in~alphabetic~order):~
+    'color',~
+    'inter',~
+    'line-style',~
+    'radius',~
+    'shorten',~
+    'shorten-end'~and~'shorten-start'.
+  }
 \__nicematrix_msg_new:nn { Unknown~key~for~rowcolors }
   {
     Unknown~key.\\
@@ -7813,6 +8023,11 @@
     (and~you~try~to~use~'\l_keys_key_str')\\
     That~key~will~be~ignored.
   }
+\__nicematrix_msg_new:nn { label~without~caption }
+  {
+    You~can't~use~the~key~'label'~in~your~'{NiceTabular}'~because~
+    you~have~not~used~the~key~'caption'.~The~key~'label'~will~be~ignored.
+  }
 \__nicematrix_msg_new:nn { Construct~too~large }
   {
     Construct~too~large.\\
@@ -7820,6 +8035,13 @@
     can't~be~drawn~because~your~matrix~is~too~small.\\
     That~command~will~be~ignored.
   }
+\__nicematrix_msg_new:nn { underscore~after~nicematrix }
+  {
+    Problem~with~'underscore'.\\
+    The~package~'underscore'~should~be~loaded~before~'nicematrix'.~
+    You~can~go~on~but~you~won't~be~able~to~write~something~such~as:\\
+    '\token_to_str:N \Cdots\token_to_str:N _{n~\token_to_str:N \text{~times}}'.
+  }
 \__nicematrix_msg_new:nn { ampersand~in~light-syntax }
   {
     Ampersand~forbidden.\\
@@ -7834,6 +8056,13 @@
     is~in~force.~You~must~use~the~character~'\l__nicematrix_end_of_row_tl'~
     (set~by~the~key~'end-of-row').~This~error~is~fatal.
   }
+\__nicematrix_msg_new:nn { hlines~with~color }
+  {
+    Incompatible~keys.\\
+    You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~
+    '\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\
+    Your~key~will~be~discarded.
+  }
 \__nicematrix_msg_new:nn { bad~value~for~baseline }
   {
     Bad~value~for~baseline.\\
@@ -7870,8 +8099,7 @@
   }
 \__nicematrix_msg_new:nn { width~without~X~columns }
   {
-    No~X~column.\\
-    You~have~used~the~key~'width'~but~you~have~put~no~'X'~column. \\
+    You~have~used~the~key~'width'~but~you~have~put~no~'X'~column.~
     That~key~will~be~ignored.
   }
 \__nicematrix_msg_new:nn { key~multiplicity~with~dotted }
@@ -8048,7 +8276,8 @@
     enumitem~not~loaded.\\
     You~can't~use~the~command~\token_to_str:N\tabularnote\
     ~because~you~haven't~loaded~'enumitem'.\\
-    This~command~will~be~ignored.
+    All~the~commands~\token_to_str:N\tabularnote\ will~be~
+    ignored~in~the~document.
   }
 \__nicematrix_msg_new:nn { tikz~in~custom-line~without~tikz }
   {
@@ -8107,6 +8336,21 @@
     loaded.\\
     Your~column~will~behave~like~'p'.
   }
+\__nicematrix_msg_new:nnn { Unknow~key~for~RulesBis }
+  {
+    Unkown~key.\\
+    Your~key~'\l_keys_key_str'~is~unknown~for~a~rule.\\
+    \c__nicematrix_available_keys_str
+  }
+  {
+    The~available~keys~are~(in~alphabetic~order):~
+    color,~
+    dotted,~
+    multiplicity,~
+    sep-color,~
+    tikz,~and~total-width.
+  }
+
 \__nicematrix_msg_new:nnn { Unknown~key~for~Block }
   {
     Unknown~key.\\
@@ -8225,6 +8469,7 @@
   {
     The~available~keys~are~(in~alphabetic~order):~
     allow-duplicate-names,~
+    caption-above,~
     cell-space-bottom-limit,~
     cell-space-limits,~
     cell-space-top-limit,~
@@ -8385,6 +8630,7 @@
     b,~
     baseline,~
     c,~
+    caption,~
     cell-space-bottom-limit,~
     cell-space-limits,~
     cell-space-top-limit,~
@@ -8406,6 +8652,7 @@
     first-row,~
     hlines,~
     hvlines,~
+    label,~
     last-col,~
     last-row,~
     left-margin,~
@@ -8418,6 +8665,7 @@
     respect-arraystretch,~
     right-margin,~
     rules~(with~the~subkeys~'color'~and~'width'),~
+    short-caption,~
     t,~
     tabularnote,~
     vlines,~



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