texlive[75979] Master/texmf-dist: nicematrix (5aug25)
commits+karl at tug.org
commits+karl at tug.org
Tue Aug 5 22:35:52 CEST 2025
Revision: 75979
https://tug.org/svn/texlive?view=revision&revision=75979
Author: karl
Date: 2025-08-05 22:35:52 +0200 (Tue, 05 Aug 2025)
Log Message:
-----------
nicematrix (5aug25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex
trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx
trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf
===================================================================
(Binary files differ)
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 2025-08-05 20:35:39 UTC (rev 75978)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex 2025-08-05 20:35:52 UTC (rev 75979)
@@ -1846,7 +1846,8 @@
d'intervalles de colonnes spécifiés par la syntaxe $i$ ou $i$-$j$ ;\footnote{Il
est recommandé de n'utiliser ces commandes qu'une seule fois par rangée car
chaque utilisation crée un espace vertical entre les rangées correspondant à
- la largeur totale du trait qui sera tracé.}
+ la largeur totale du trait qui sera tracé. De toutes manières, on peut tracer plusieurs
+ filets avec une unique utilisation de la commande.}
\item la clé \Definition{letter} prend en argument une lettre\footnote{Les lettres
suivantes ne sont pas autorisées : \verb+lcrpmbVX|()[]!@<>+} qui pourra être
@@ -1966,7 +1967,7 @@
\bigskip
-\item \emph{Deuxième possibilité}\par
+\item \emph{Deuxième possibilité}
\index{tikzz at tikz!clé de «custom-line»}
\index{total-width (clé de «custom-line»)}
@@ -2025,6 +2026,7 @@
\medskip
\item \emph{Troisième possibilité} : la clé \Definition{dotted}
+
\label{dotted}
\index{dotted (clé de «custom-line»)}
\indexcommand{hdottedline}
@@ -2108,6 +2110,40 @@
\end{itemize}
+\bigskip
+\index{start (clé pour les filets)}
+\index{end (clé pour les filets)}
+
+\colorbox{yellow!50}{\textbf{Nouveau 7.2}}
+
+\nobreak
+Comme on l'a dit, les clés précédentes peuvent être utilisés dans l'argument
+optionnel d'une commande |\Hline| individuelle ou dans l'argument optionnel d'un
+spécificateur «\verb+|+» dans un préambule d'environnement (par exemple pour
+|{NiceTabular}|).
+
+Mais dans ces cas-là, il est aussi possible d'utiliser deux clés supplémentaires,
+\Definition{start} et \Definition{end}, qui indiquent les numéros de rangées ou de
+colonnes des extrémités du filet.
+
+\medskip
+\begin{Code}[width=9.5cm]
+\begin{NiceTabular}{cc\emph{|[color=blue,start=2]}ccc}
+un & deux & trois & quatre
+\emph{\Hline[start=2,end=3]}
+cinq & six & sept & huit \\
+neuf & dix & onze & douze
+\end{NiceTabular}
+\end{Code}
+\begin{NiceTabular}{cc|[color=blue,start=2]cc}
+un & deux & trois & quatre \\
+\Hline[start=2,end=3]
+cinq & six & sept & huit \\
+neuf & dix & onze & douze
+\end{NiceTabular}
+
+
+
\index{custom-line|)}
\index{Filets@\textbf{Filets dans les tableaux}|)}
@@ -3008,7 +3044,8 @@
Dans les environnements avec un préambule explicite (comme |{NiceTabular}|,
|{NiceArray}|, etc.), il est possible de fixer la largeur d'une colonne avec les
-lettres classiques |w|, |W|, |p|, |b| et |m| de l'extension \pkg{array}.
+lettres classiques |w|, |W|, |p|, |b| et |m| de l'extension \pkg{array} (qui est
+chargée par \pkg{nicematrix}).
\medskip
\begin{Code}[width=9cm]
@@ -3143,65 +3180,6 @@
\end{array}$
\end{NiceMatrixBlock}
-
-\subsection{Les colonnes X}
-
-\label{colonne-X}
-\index{tabularx@\pkg{tabularx} (extension)}
-\index{NiceTabularX@\texttt{\{NiceTabularX\}}}
-\index{X (les colonnes X)}
-\index{width!clé de \texttt{\{NiceTabular\}}}
-
-L'environnement |{NiceTabular}| propose aussi des colonnes |X| similaires à
-celles proposées par l'environnement |{tabularx}| de l'extension éponyme.
-
-La valeur requise par la largeur du tableau peut être passée en argument de la
-clé \Definition{width} (dans |{NiceTabular}| ou dans |\NiceMatrixOptions|). La
-valeur initiale de ce paramètre est |\linewidth| (et non |\textwidth|).
-
-Pour se rapprocher davantage de l'environnement |{tabularx}|, \pkg{nicematrix}
-propose aussi un environnement \Definition{\{NiceTabularX\}} avec une syntaxe
-similaire à celle de |{tabularx}|, c'est-à-dire que la largeur voulue pour le
-tableau est spécifiée en premier argument (obligatoire).
-
-
-Comme avec les extensions \pkg{tabu}\footnote{L'extension \pkg{tabu} est
- maintenant considérée comme obsolète.} et \pkg{tabularray}, le spécificateur |X|
-accepte entre crochets un argument optionnel qui est une liste de clés.
-\begin{itemize}[beginpenalty=10000]
-\item On peut spécifier un poids pour la colonne en mettant directement un
-nombre positif comme argument du spécificateur |X|. Par exemple, une colonne
-|X[2]| aura une largeur double de celle d'une colonne |X| (qui a un poids de
-1).\footnote{Les valeurs négatives pour les poids, comme proposées par
- \pkg{tabu} (maintenant obsolète), ne sont \emph{pas} prises en charge par
- \pkg{nicematrix}. Si une telle valeur est utilisée, une erreur sera levée.}
-\item On peut spécifier l'alignement horizontal avec une des lettres |l|, |c| et
-|r| (qui insèrent respectivement |\raggedright|, |\centering| et |\raggedleft|
-suivi de |\arraybackslash|).\footnote{En fait, quand \pkg{ragged2e} est chargée,
-ce sont les commandes |\RaggedRight|, |\Centering| et |\RaggedLeft| de
-\pkg{ragged2e} qui sont utilisées, pour un meilleur résultat.}
-\item On peut spécifier l'alignement vertical avec l'une des lettres |t| (alias
-|p|), |m| et |b| (qui construisent respectivement des colonnes de types |p|, |m|
-et |b|). La valeur initiale est |t|.
-\end{itemize}
-
-\begin{Code}
-\begin{NiceTabular}\emph{[width=9cm]{X[c,m]X[0.5,c,m]}}[hvlines]
-Un texte relativement long qui tient sur plusieurs lignes. &
-Un texte relativement long qui tient sur plusieurs lignes. \\
-Un texte plus court. & Un texte plus court.
-\end{NiceTabular}
-\end{Code}
-
-
-\begin{center}
-\begin{NiceTabular}[width=9cm]{X[c,m]X[0.5,c,m]}[hvlines]
-Un texte relativement long qui tient sur plusieurs lignes. &
-Un texte relativement long qui tient sur plusieurs lignes. \\
-Un texte plus court. & Un texte plus court.
-\end{NiceTabular}
-\end{center}
-
\subsection{Les colonnes V de varwidth}
\label{varwidth}
@@ -3297,6 +3275,74 @@
version 0.92). Par exemple, avec LuaLaTeX, elle ne fonctionne pas si le contenu
commence par une instruction |\color|.
+
+\subsection{Les colonnes X}
+
+\label{colonne-X}
+\index{tabularx@\pkg{tabularx} (extension)}
+\index{NiceTabularX@\texttt{\{NiceTabularX\}}}
+\index{X (les colonnes X)}
+\index{width!clé de \texttt{\{NiceTabular\}}}
+
+L'environnement |{NiceTabular}| propose aussi des colonnes |X| similaires à
+celles proposées par l'environnement |{tabularx}| de l'extension éponyme.
+
+La valeur requise par la largeur du tableau peut être passée en argument de la
+clé \Definition{width} (dans |{NiceTabular}| ou dans |\NiceMatrixOptions|). La
+valeur initiale de ce paramètre est |\linewidth| (et non |\textwidth|).
+
+Pour se rapprocher davantage de l'environnement |{tabularx}|, \pkg{nicematrix}
+propose aussi un environnement \Definition{\{NiceTabularX\}} avec une syntaxe
+similaire à celle de |{tabularx}|, c'est-à-dire que la largeur voulue pour le
+tableau est spécifiée en premier argument (obligatoire).
+
+
+Comme avec les extensions \pkg{tabu}\footnote{L'extension \pkg{tabu} est
+ maintenant considérée comme obsolète.} et \pkg{tabularray}, le spécificateur |X|
+accepte entre crochets un argument optionnel qui est une liste de clés.
+\begin{itemize}[beginpenalty=10000]
+\item On peut spécifier un poids pour la colonne en mettant directement un
+nombre positif comme argument du spécificateur |X|. Par exemple, une colonne
+|X[2]| aura une largeur double de celle d'une colonne |X| (qui a un poids de
+1).\footnote{Les valeurs négatives pour les poids, comme proposées par
+ \pkg{tabu} (maintenant obsolète), ne sont \emph{pas} prises en charge par
+ \pkg{nicematrix}. Si une telle valeur est utilisée, une erreur sera levée.}
+\item On peut spécifier l'alignement horizontal avec une des lettres |l|, |c| et
+|r| (qui insèrent respectivement |\raggedright|, |\centering| et |\raggedleft|
+suivi de |\arraybackslash|).\footnote{En fait, quand \pkg{ragged2e} est chargée,
+ce sont les commandes |\RaggedRight|, |\Centering| et |\RaggedLeft| de
+\pkg{ragged2e} qui sont utilisées, pour un meilleur résultat.}
+\item On peut spécifier l'alignement vertical avec l'une des lettres |t| (alias
+|p|), |m| et |b| (qui construisent respectivement des colonnes de types |p|, |m|
+et |b|). La valeur initiale est |t|.
+
+\item \colorbox{yellow!50}{\textbf{Nouveau 7.2}}
+
+\nobreak
+Il est possible d'utiliser la clé |V| dans une colonne de type |X|. Quand cette clé
+est utilisée, la colonne~|X| se comporte en fait comme une colonne~|V| de l'extension
+\pkg{varwidth} (que l'utilisateur doit avoir chargée), ce qui fait que la largeur de la
+colonne calculée par le processus |X| devient la largeur \emph{maximale} de la colonne.
+\end{itemize}
+
+\begin{Code}
+\begin{NiceTabular}\emph{[width=9cm]{X[c,m]X[0.5,c,m]}}[hvlines]
+Un texte relativement long qui tient sur plusieurs lignes. &
+Un texte relativement long qui tient sur plusieurs lignes. \\
+Un texte plus court. & Un texte plus court.
+\end{NiceTabular}
+\end{Code}
+
+
+\begin{center}
+\begin{NiceTabular}[width=9cm]{X[c,m]X[0.5,c,m]}[hvlines]
+Un texte relativement long qui tient sur plusieurs lignes. &
+Un texte relativement long qui tient sur plusieurs lignes. \\
+Un texte plus court. & Un texte plus court.
+\end{NiceTabular}
+\end{center}
+
+
\index{Largeur@\textbf{Largeur des colonnes}|)}
Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex 2025-08-05 20:35:39 UTC (rev 75978)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex 2025-08-05 20:35:52 UTC (rev 75979)
@@ -1778,7 +1778,8 @@
hence the name |ccommand|): the argument of that command is a list of intervals
of columns specified by the syntax~$i$ or $i$-$j$.\footnote{It's recommended to
use such commands only once in a row because each use will create space
- between the rows corresponding to the total width of the rule.}
+ between the rows corresponding to the total width of the rule. Likewise, it's
+ possible to draw several rules with only one use of the command.}
\item the key \Definition{letter} takes in as argument a letter\footnote{The following
letters are forbidden: \verb+lcrpmbVX|()[]!@<>+} that the user will use in
@@ -1793,7 +1794,7 @@
environment.
\bigskip
-There is three possibilities.
+There are three possibilities.
\begin{itemize}
\item \emph{First possibility}
@@ -2032,6 +2033,38 @@
\end{itemize}
+\bigskip
+\index{start (key for the rules)}
+\index{end (key for the rules)}
+
+\colorbox{yellow!50}{\textbf{New 7.2}}
+
+\nobreak
+\smallskip
+As previously said, the previous keys may be used in the optional argument
+of an individual command |\Hline| and in the optional argument of a specifier
+``\verb+|+'' in the preamble of an environment (for instance |{NiceTabular}|).
+
+However, in that case, it's also possible to use two other keys, \Definition{start}
+and \Definition{end}, which specify the extremities of the rule.
+\begin{Code}[width=9.5cm]
+\begin{NiceTabular}{cc\emph{|[color=blue,start=2]}ccc}
+one & two & three & four
+\emph{\Hline[start=2,end=3]}
+five & six & seven & eight \\
+nine & ten & eleven & twelve
+\end{NiceTabular}
+\end{Code}
+\begin{NiceTabular}{cc|[color=blue,start=2]cc}
+one & two & three & four \\
+\Hline[start=2,end=3]
+five & six & seven & eight \\
+nine & ten & eleven & twelve
+\end{NiceTabular}
+
+
+
+
\index{custom-line|)}
\index{Rules@\textbf{Rules in the tabulars}|)}
@@ -2898,7 +2931,8 @@
In the environments with an explicit preamble (like |{NiceTabular}|,
|{NiceArray}|, etc.), it's possible to fix the width of a given column with
-the standard letters |w|, |W|, |p|, |b| and |m| of the package \pkg{array}.
+the standard letters |w|, |W|, |p|, |b| and |m| of the package \pkg{array}
+(which is loaded by \pkg{nicematrix}).
\medskip
\begin{Code}[width=9cm]
@@ -3029,64 +3063,6 @@
\end{array}$
\end{NiceMatrixBlock}
-\subsection{The columns X}
-
-\label{X-columns}
-\index{tabularx@\pkg{tabularx} (package)}
-\index{NiceTabularX@\texttt{\{NiceTabularX\}}}
-\index{X (the columns X)}
-\index{width!key of \texttt{\{NiceTabular\}}}
-
-The environment |{NiceTabular}| provides |X| columns similar to those provided
-by the environment |{tabularx}| of the eponymous package.
-
-The required width of the tabular may be specified with the key
-\Definition{width} (in |{NiceTabular}| or in |\NiceMatrixOptions|). The initial
-value of this parameter is |\linewidth| (and not |\textwidth|).
-
-For sake of similarity with the environment |{tabularx}|, \pkg{nicematrix} also
-provides an environment \Definition{\{NiceTabularX\}} with a syntax similar to
-the syntax of |{tabularx}|, that is to say with a first mandatory argument which
-is the width of the tabular.
-
-As with the packages \pkg{tabu}\footnote{The extension \pkg{tabu} is now
-considered as deprecated.} and \pkg{tabularray}, the specifier |X| takes
-in an optional argument (between square brackets) which is a list of keys.
-\begin{itemize}
-\item It's possible to give a weight for the column by providing a positive
-number directly as argument of the specifier |X|. For example, a column
-|X[2]| will have a width double of the width of a column~|X| (which has a
-weight equal to $1$).\footnote{The negative values of the weight, as provided
-by \pkg{tabu} (which is now obsolete), are \emph{not} supported by \pkg{nicematrix}.
-If such a value is used, an error will be raised.}
-\item It's possible to specify an horizontal alignment with one of the
-letters |l|, |c| and |r| (which insert respectively |\raggedright|,
-|\centering| and |\raggedleft| followed by |\arraybackslash|).\footnote{In fact,
-when \pkg{ragged2e} is loaded, \pkg{nicematrix} uses the commands
-|\RaggedRight|, |\Centering| and |\RaggedLeft| of \pkg{ragged2e} instead of the
-commands |\raggedright|, |\centering| and |\raggedleft|. That ensures a better output.}
-\item It's possible to specify a vertical alignment with one of the keys
-|t| (alias |p|), |m| and |b| (which construct respectively columns of type
-|p|, |m| and |b|). The initial value is |t|.
-\end{itemize}
-
-\begin{Code}
-\emph{\begin{NiceTabular}\emph{[width=9cm]{X[c,m]X[0.5,c,m]}}[hvlines]}
-a rather long text which fits on several lines
-& a rather long text which fits on several lines \\
-a shorter text & a shorter text
-\end{NiceTabular}
-\end{Code}
-
-\begin{center}
-\begin{NiceTabular}[width=9cm]{X[c,m]X[0.5,c,m]}[hvlines]
-a rather long text which fits on several lines
-& a rather long text which fits on several lines \\
-a shorter text & a shorter text
-\end{NiceTabular}
-\end{center}
-
-
\subsection{The columns V of varwidth}
\label{varwidth}
@@ -3183,6 +3159,74 @@
0.92) has some problems: for instance, with LuaLaTeX, it does not work when
the content begins with |\color|.
+
+\subsection{The columns X}
+
+\label{X-columns}
+\index{tabularx@\pkg{tabularx} (package)}
+\index{NiceTabularX@\texttt{\{NiceTabularX\}}}
+\index{X (the columns X)}
+\index{width!key of \texttt{\{NiceTabular\}}}
+
+The environment |{NiceTabular}| provides |X| columns similar to those provided
+by the environment |{tabularx}| of the eponymous package.
+
+The required width of the tabular may be specified with the key
+\Definition{width} (in |{NiceTabular}| or in |\NiceMatrixOptions|). The initial
+value of this parameter is |\linewidth| (and not |\textwidth|).
+
+For sake of similarity with the environment |{tabularx}|, \pkg{nicematrix} also
+provides an environment \Definition{\{NiceTabularX\}} with a syntax similar to
+the syntax of |{tabularx}|, that is to say with a first mandatory argument which
+is the width of the tabular.
+
+As with the packages \pkg{tabu}\footnote{The extension \pkg{tabu} is now
+considered as deprecated.} and \pkg{tabularray}, the specifier |X| takes
+in an optional argument (between square brackets) which is a list of keys.
+\begin{itemize}
+\item It's possible to give a weight for the column by providing a positive
+number directly as argument of the specifier |X|. For example, a column
+|X[2]| will have a width double of the width of a column~|X| (which has a
+weight equal to $1$).\footnote{The negative values of the weight, as provided
+by \pkg{tabu} (which is now obsolete), are \emph{not} supported by \pkg{nicematrix}.
+If such a value is used, an error will be raised.}
+\item It's possible to specify an horizontal alignment with one of the
+letters |l|, |c| and |r| (which insert respectively |\raggedright|,
+|\centering| and |\raggedleft| followed by |\arraybackslash|).\footnote{In fact,
+when \pkg{ragged2e} is loaded, \pkg{nicematrix} uses the commands
+|\RaggedRight|, |\Centering| and |\RaggedLeft| of \pkg{ragged2e} instead of the
+commands |\raggedright|, |\centering| and |\raggedleft|. That ensures a better output.}
+\item It's possible to specify a vertical alignment with one of the keys
+|t| (alias |p|), |m| and |b| (which construct respectively columns of type
+|p|, |m| and |b|). The initial value is |t|.
+
+\item \colorbox{yellow!50}{\textbf{New 7.2}}
+
+\nobreak
+It's possible to use the key |V| in a column of type |X|. When that key is used,
+the column~|X| behaves in fact like a column~|V| of the extension \pkg{varwidth}
+(which must have been loaded by the user). Henece, the widht of the columns, as
+computed by the |X|~process, is in fact the \emph{maximal} widht of the column.
+\end{itemize}
+
+\begin{Code}
+\emph{\begin{NiceTabular}\emph{[width=9cm]{X[c,m]X[0.5,c,m]}}[hvlines]}
+a rather long text which fits on several lines
+& a rather long text which fits on several lines \\
+a shorter text & a shorter text
+\end{NiceTabular}
+\end{Code}
+
+\begin{center}
+\begin{NiceTabular}[width=9cm]{X[c,m]X[0.5,c,m]}[hvlines]
+a rather long text which fits on several lines
+& a rather long text which fits on several lines \\
+a shorter text & a shorter text
+\end{NiceTabular}
+\end{center}
+
+
+
\index{width@\textbf{Width of the columns}|)}
@@ -8032,15 +8076,17 @@
\section{History}
The development of the package \pkg{nicematrix} is done in the following GitHub
-depot:\par\nobreak
+depot:
+\nobreak
\nolinkurl{https://github.com/fpantigny/nicematrix}
\medskip
The successive versions of the file |nicematrix.sty| provided by TeXLive are
also available on the
-\textsc{svn} server of TeXLive:\par\nobreak
+\textsc{svn} server of TeXLive:
+\nobreak
\smallskip
{
\small
@@ -8047,7 +8093,10 @@
\nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
}
+\subsection*{Changes between version 7.1 and 7.2}
+A new key |V| is available in the columns of type |X|.
+
\subsection*{Changes between version 7.0 and 7.1}
New commands |\Hbrace| and |\Vbrace|.
Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx 2025-08-05 20:35:39 UTC (rev 75978)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx 2025-08-05 20:35:52 UTC (rev 75979)
@@ -17,8 +17,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{7.1e}
-\def\myfiledate{2025/07/18}
+\def\myfileversion{7.2}
+\def\myfiledate{2025/08/05}
%
%
%<*batchfile>
@@ -69,7 +69,7 @@
\usepackage{titlesec}
\titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
\titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex}
-\parindent 0pt
+\parindent = 0pt
\skip \footins = 2 \bigskipamount
@@ -199,11 +199,11 @@
\cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { nicematrix } }
% \end{macrocode}
%
-% With Overleaf, by default, a document is compiled in non-stop mode. When there
-% is an error, there is no way to the user to use the key H in order to have
-% more information. That's why we decide to put that piece of information (for
-% the messages with such information) in the main part of the message when the
-% key |messages-for-Overleaf| is used (at load-time).
+% With Overleaf (and also in TeXPage), by default, a document is compiled in
+% non-stop mode. When there is an error, there is no way to the user to use the
+% key H in order to have more information. That's why we decide to put that
+% piece of information (for the messages with such information) in the main part
+% of the message when the key |messages-for-Overleaf| is used (at load-time).
% \begin{macrocode}
\cs_new_protected:Npn \@@_msg_new:nnn #1 #2 #3
{
@@ -505,7 +505,7 @@
% preamble because, otherwise, \pkg{colortbl} will catch them and the colored
% panels won't be drawn by \pkg{nicematrix} but by \pkg{colortbl} (with an
% output which is not perfect).
-
+%
% \begin{macrocode}
\cs_new_protected:Npn \@@_replace_columncolor:
{
@@ -969,8 +969,23 @@
% type |X| thanks to that flag (the |X| columns of \pkg{nicematrix} are inspired
% by those of \pkg{tabularx}). You will use that flag for the blocks.
% \begin{macrocode}
-\bool_new:N \l_@@_X_bool
+\bool_new:N \l_@@_X_bool
% \end{macrocode}
+%
+% \bigskip
+% |\l_@@_V_of_X_bool| during the construction of the preamble when a column of
+% type |X| uses the key |V| (whose name is inspired by the columns~|V| of the
+% extension \pkg{varwidth}).
+% \begin{macrocode}
+\bool_new:N \l_@@_V_of_X_bool
+% \end{macrocode}
+%
+% \bigskip
+% The flag |g_@@_V_of_X_bool| will be raised when there is at least in the tabular
+% a column of type |X| using the key |V|.
+% \begin{macrocode}
+\bool_new:N \g_@@_V_of_X_bool
+% \end{macrocode}
%
% \begin{macrocode}
\bool_new:N \g_@@_caption_finished_bool
@@ -1895,11 +1910,11 @@
\newlist { tabularnotes } { enumerate } { 1 }
\setlist [ tabularnotes ]
{
- topsep = 0pt ,
+ topsep = \c_zero_dim ,
noitemsep ,
leftmargin = * ,
align = left ,
- labelsep = 0pt ,
+ labelsep = \c_zero_dim ,
label =
\@@_notes_label_in_list:n { \@@_notes_style:n { tabularnotesi } } ,
}
@@ -2549,7 +2564,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_err_key_color_inside:
{
- \@@_warning:n { key~color-inside }
+ \@@_error_or_warning:n { key~color-inside }
\cs_gset:Npn \@@_err_key_color_inside: { }
}
% \end{macrocode}
@@ -3584,7 +3599,6 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_array:n
{
-% \begin{macrocode}
\dim_set:Nn \col at sep
{ \bool_if:NTF \l_@@_tabular_bool { \tabcolsep } { \arraycolsep } }
\dim_compare:nNnTF { \l_@@_tabular_width_dim } = { \c_zero_dim }
@@ -3797,6 +3811,7 @@
% The total weight of the letters |X| in the preamble of the array.
% \begin{macrocode}
\fp_gzero:N \g_@@_total_X_weight_fp
+ \bool_gset_false:N \g_@@_V_of_X_bool
% \end{macrocode}
%
% \begin{macrocode}
@@ -3846,15 +3861,16 @@
% several reasons. In particular, |\ar at ialign| sets |\everycr| to |{ }| and we
% \emph{need} to change the value of |\everycr|.
% \begin{macrocode}
- \bool_if:nTF
- { \c_@@_recent_array_bool && ! \c_@@_revtex_bool }
+ \bool_if:NT \c_@@_recent_array_bool
{
- \def \ar at ialign
- {
- \bool_if:NT \c_@@_testphase_table_bool
- \tbl_init_cell_data_for_table:
- \@@_some_initialization:
- \dim_zero:N \tabskip
+ \bool_if:NF \c_@@_revtex_bool
+ {
+ \def \ar at ialign
+ {
+ \bool_if:NT \c_@@_testphase_table_bool
+ \tbl_init_cell_data_for_table:
+ \@@_some_initialization:
+ \dim_zero:N \tabskip
% \end{macrocode}
%
% After its first use, the definition of |\ar at ialign| will revert
@@ -3863,8 +3879,9 @@
% |\cs_set_eq:Nc| instead of |\cs_set_eq:NN| in order to avoid a message when
% |explcheck| is used on |nicematrix.sty|.
% \begin{macrocode}
- \cs_set_eq:Nc \ar at ialign { @@_old_ar at ialign: }
- \halign
+ \cs_set_eq:Nc \ar at ialign { @@_old_ar at ialign: }
+ \halign
+ }
}
}
% \end{macrocode}
@@ -4682,7 +4699,7 @@
%
% \bigskip
% \begin{macrocode}
- \@@_set_CTarc:o \l_@@_rules_color_tl
+ \@@_set_CTarc:o \l_@@_rules_color_tl % noqa: w302
% \end{macrocode}
%
% \bigskip
@@ -4752,7 +4769,7 @@
}
% \end{macrocode}
%
-% Now, the definition of |\c at jCol| and |\g_@@_col_total_int| change: |\c at jCol|
+% Now, the definition of |\c at jCol| and |\g_@@_col_total_int| changes: |\c at jCol|
% will be the number of columns without the ``last column'';
% |\g_@@_col_total_int| will be the number of columns with this ``last
% column''.\footnote{We remind that the potential ``first column'' (exterior)
@@ -4940,32 +4957,46 @@
% by~$x$.
% \begin{macrocode}
\cs_new_protected:Npn \@@_compute_width_X:
- {
+ {
\tl_gput_right:Ne \g_@@_aux_tl
{
\bool_set_true:N \l_@@_X_columns_aux_bool
\dim_set:Nn \l_@@_X_columns_dim
{
- \dim_compare:nNnTF
- {
- \dim_abs:n
- { \l_@@_width_dim - \box_wd:N \l_@@_the_array_box }
- }
- <
- { 0.001 pt }
+% \end{macrocode}
+% The flag |g_@@_V_of_X_bool| is raised when there is at least in the tabular
+% a column of type |X| using the key |V|. In that case, the width of the |X| column may
+% be considered as correct even though the tabular has not (of course) a width equal
+% to |\l_@@_width_dim|
+% \begin{macrocode}
+ \bool_lazy_and:nnTF
+ { \g_@@_V_of_X_bool }
+ { \l_@@_X_columns_aux_bool }
{ \dim_use:N \l_@@_X_columns_dim }
{
- \dim_eval:n
+ \dim_compare:nNnTF
+ {
+ \dim_abs:n
+ { \l_@@_width_dim - \box_wd:N \l_@@_the_array_box }
+ }
+ <
+ { 0.001 pt }
+ { \dim_use:N \l_@@_X_columns_dim }
{
- \fp_to_dim:n
- {
- (
- \dim_eval:n
- { \l_@@_width_dim - \box_wd:N \l_@@_the_array_box }
- )
- / \fp_use:N \g_@@_total_X_weight_fp
+ \dim_eval:n
+ {
+ \l_@@_X_columns_dim
+ +
+ \fp_to_dim:n
+ {
+ (
+ \dim_eval:n
+ { \l_@@_width_dim - \box_wd:N \l_@@_the_array_box }
+ )
+ / \fp_use:N \g_@@_total_X_weight_fp
+ }
+
}
- + \l_@@_X_columns_dim
}
}
}
@@ -5240,6 +5271,9 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_i_i:n #1
{
+% \end{macrocode}
+% Here, we can't use |\str_if_eq:eeTF|.
+% \begin{macrocode}
\str_if_eq:nnTF { #1 } { | }
{ \use:c { @@ _ | : } | }
{ \@@_make_preamble_i_ii:nn { } #1 }
@@ -5373,7 +5407,15 @@
% \begin{macrocode}
\str_set:Nn \l_@@_hpos_col_str { j }
\@@_keys_p_column:n { #1 }
- \@@_make_preamble_ii_iv:nnn { #2 } { minipage } { }
+% \end{macrocode}
+% We apply |setlength| in order to allow a width of column of the
+% form |\widthof{Some words}|. |\widthof| is a command of the package \pkg{calc}
+% (not loaded by \pkg{nicematrix}) which redefines the command |\setlength|.
+% Of course, even if \pkg{calc} is not loaded, the following code will work with
+% the standard version of |\setlength|.
+% \begin{macrocode}
+ \setlength { \l_tmpa_dim } { #2 }
+ \@@_make_preamble_ii_iv:nnn { \l_tmpa_dim } { minipage } { }
}
% \end{macrocode}
%
@@ -5383,17 +5425,21 @@
% \end{macrocode}
%
% \medskip
+%
+%
+% \bigskip
% The first argument is the width of the column. The second is the type of
% environment: |minipage| or |varwidth|. The third is some code added at the
% beginning of the cell.
+%
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_ii_iv:nnn #1 #2 #3
{
\use:e
{
- \@@_make_preamble_ii_v:nnnnnnnn
+ \@@_make_preamble_ii_vi:nnnnnnnn
{ \str_if_eq:eeTF \l_@@_vpos_col_str { p } { t } { b } }
- { \dim_eval:n { #1 } }
+ { #1 }
{
% \end{macrocode}
% The parameter |\l_@@_hpos_col_str| (as |\l_@@_vpos_col_str|) exists only
@@ -5403,7 +5449,7 @@
% \begin{macrocode}
\str_if_eq:eeTF \l_@@_hpos_col_str { j }
{ \tl_clear:N \exp_not:N \l_@@_hpos_cell_tl }
- {
+ {
% \end{macrocode}
% Here, we use |\def| instead of |\tl_set:Nn| for efficiency only.
% \begin{macrocode}
@@ -5456,8 +5502,10 @@
\@@_rec_preamble_after_col:n
}
% \end{macrocode}
+%
+%
%
-% \medskip
+% \bigskip
% |#1| is the optional argument of |{minipage}| (or |{varwidth}|): |t| or |b|.
% Indeed, for the columns of type |m|, we use the value |b| here because there
% is a special post-action in order to center vertically the box (see |#4|).
@@ -5482,7 +5530,7 @@
% |#8| is the letter |c| or |r| or |l| which is the basic specifier of column
% which is used \emph{in fine}.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \@@_make_preamble_ii_vi:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
\str_if_eq:eeTF \l_@@_hpos_col_str { si }
{
@@ -5660,11 +5708,19 @@
\str_set:Nn \l_@@_vpos_col_str { p }
\str_set:Nn \l_@@_hpos_col_str { j }
\@@_keys_p_column:n { #1 }
+% \end{macrocode}
+% We apply |setlength| in order to allow a width of column of the
+% form |\widthof{Some words}|. |\widthof| is a command of the package \pkg{calc}
+% (not loaded by \pkg{nicematrix}) which redefines the command |\setlength|.
+% Of course, even if \pkg{calc} is not loaded, the following code will work with
+% the standard version of |\setlength|.
+% \begin{macrocode}
+ \setlength { \l_tmpa_dim } { #2 }
\IfPackageLoadedTF { varwidth }
- { \@@_make_preamble_ii_iv:nnn { #2 } { varwidth } { } }
+ { \@@_make_preamble_ii_iv:nnn { \l_tmpa_dim } { varwidth } { } }
{
\@@_error_or_warning:n { varwidth~not~loaded }
- \@@_make_preamble_ii_iv:nnn { #2 } { minipage } { }
+ \@@_make_preamble_ii_iv:nnn { \l_tmpa_dim } { minipage } { }
}
}
% \end{macrocode}
@@ -5708,7 +5764,11 @@
\tl_gput_right:Nn \g_@@_array_preamble_tl
{
> {
- \dim_set:Nn \l_@@_col_width_dim { #2 }
+% We use |\setlength| in order to allow |\widthof| which is a command of \pkg{calc}
+% (when loaded \pkg{calc} redefines |\setlength|).
+% Of course, even if \pkg{calc} is not loaded, the following code will work with
+% the standard version of |\setlength|.
+ \setlength { \l_@@_col_width_dim } { #2 }
\@@_cell_begin:
\tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_c_tl
}
@@ -5740,8 +5800,13 @@
% The parameter |\l_@@_col_width_dim|, which is the width of the current column,
% will be available in each cell of the column. It will be used by the
% mono-column blocks.
+%
+% We use |\setlength| in order to allow |\widthof| which is a command of \pkg{calc}
+% (when loaded \pkg{calc} redefines |\setlength|).
+% Of course, even if \pkg{calc} is not loaded, the following code will work with
+% the standard version of |\setlength|.
% \begin{macrocode}
- \dim_set:Nn \l_@@_col_width_dim { #4 }
+ \setlength { \l_@@_col_width_dim } { #4 }
\hbox_set:Nw \l_@@_cell_box
\@@_cell_begin:
\tl_set:Nn \l_@@_hpos_cell_tl { #3 }
@@ -6071,16 +6136,23 @@
% \medskip
% The following set of keys is for the specifier |X| in the preamble of the
% array. Such specifier may have as keys all the keys of
-% |{ nicematrix / % p-column }| but also a key which corresponds to a positive
-% number (1, 2, 0.5, etc.) which is the \emph{weight} of the columns. The
+% |{ nicematrix / p-column }| but also a key |V| and also a key which corresponds
+% to a positive number (1, 2, 0.5, etc.) which is the \emph{weight} of the columns. The
% following set of keys will be used to retrieve that value and store it in |\l_tmpa_fp|.
% \begin{macrocode}
\keys_define:nn { nicematrix / X-column }
- {
+ {
+ V .code:n =
+ \IfPackageLoadedTF { varwidth }
+ {
+ \bool_set_true:N \l_@@_V_of_X_bool
+ \bool_gset_true:N \g_@@_V_of_X_bool
+ }
+ { \@@_error_or_warning:n { varwidth~not~loaded~in~X } } ,
unknown .code:n =
- \regex_match:nVTF { \A[0-9]*\.?[0-9]*\Z } \l_keys_key_str
- { \fp_set:Nn \l_tmpa_fp { \l_keys_key_str } }
- { \@@_error_or_warning:n { invalid~weight } }
+ \regex_match:nVTF { \A[0-9]*\.?[0-9]*\Z } \l_keys_key_str
+ { \fp_set:Nn \l_tmpa_fp { \l_keys_key_str } }
+ { \@@_error_or_warning:n { invalid~weight } }
}
% \end{macrocode}
%
@@ -6118,6 +6190,7 @@
% retrieve the potential weight explicitely provided by the final user.
%
% \begin{macrocode}
+ \bool_set_false:N \l_@@_V_of_X_bool
\keys_set:no { nicematrix / X-column } \l_tmpa_tl
% \end{macrocode}
% Now, the weight of the column is stored in |\l_tmpa_tl|.
@@ -6130,13 +6203,13 @@
% computed and written in the |aux| file).
% \begin{macrocode}
\bool_if:NTF \l_@@_X_columns_aux_bool
- {
+ {
\@@_make_preamble_ii_iv:nnn
% \end{macrocode}
-% Of course, the weight of a column depend of its weight (in |\l_tmpa_fp|).
+% Of course, the weight of a column depends of its weight (in |\l_tmpa_fp|).
% \begin{macrocode}
- { \fp_use:N \l_tmpa_fp \l_@@_X_columns_dim }
- { minipage }
+ { \fp_use:N \l_tmpa_fp \l_@@_X_columns_dim }
+ { \bool_if:NTF \l_@@_V_of_X_bool { varwidth } { minipage } }
{ \@@_no_update_width: }
}
% \end{macrocode}
@@ -6226,6 +6299,8 @@
\cs_set_eq:cc { @@ _ \token_to_str:N \RowStyle : }
{ @@ _ \token_to_str:N \hline : }
\cs_set_eq:cc { @@ _ \token_to_str:N \diagbox : }
+ { @@ _ \token_to_str:N \hline : }
+\cs_set_eq:cc { @@ _ \token_to_str:N & : }
{ @@ _ \token_to_str:N \hline : }
% \end{macrocode}
%
@@ -6307,7 +6382,7 @@
% We want |\cellcolor| to be available in |\multicolumn| because |\cellcolor| of
% \pkg{colortbl} is available in |\multicolumn|.
% \begin{macrocode}
- \RenewDocumentCommand \cellcolor { O { } m }
+ \RenewDocumentCommand { \cellcolor } { O { } m }
{
\tl_gput_right:Ne \g_@@_pre_code_before_tl
{
@@ -6315,7 +6390,7 @@
{ \exp_not:n { ##2 } }
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
{ \int_use:N \c at iRow - \int_eval:n { \c at jCol + #1 } }
- }
+ }
\ignorespaces
}
% \end{macrocode}
@@ -6339,6 +6414,7 @@
}
% \end{macrocode}
%
+%
% \bigskip
% The following commands will patch the (small) preamble of the |\multicolumn|.
% All those commands have a |m| in their name to recall that they deal with the
@@ -6373,8 +6449,8 @@
%
% \begin{macrocode}
\str_if_eq:nnTF { #1 } { S }
- { \@@_fatal:n { unknown~column~type~S } }
- { \@@_fatal:nn { unknown~column~type } { #1 } }
+ { \@@_fatal:n { unknown~column~type~S~multicolumn } }
+ { \@@_fatal:nn { unknown~column~type~multicolumn } { #1 } }
}
}
}
@@ -6428,15 +6504,23 @@
\tl_gput_right:Nn \g_@@_preamble_tl
{
> {
- \@@_cell_begin:
- \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
+ \@@_cell_begin:
+% \end{macrocode}
+% We use |\setlenght| instead of |\dim_set:N| in order to allow a specifier
+% of column like |p{\widthof{Some words}}|. |widthof| is a command provided by
+% \pkg{calc}.
+% Of course, even if \pkg{calc} is not loaded, the following code will work with
+% the standard version of |\setlength|.
+% \begin{macrocode}
+ \setlength { \l_tmpa_dim } { #3 }
+ \begin { minipage } [ #1 ] { \l_tmpa_dim }
\mode_leave_vertical:
\arraybackslash
- \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt
+ \vrule height \box_ht:N \@arstrutbox depth \c_zero_dim width \c_zero_dim
}
c
< {
- \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt
+ \vrule height \c_zero_dim depth \box_dp:N \@arstrutbox width \c_zero_dim
\end { minipage }
\@@_cell_end:
}
@@ -6636,7 +6720,7 @@
% \begin{macrocode}
\hbox
{
- \box_use_drop:N \l_@@_the_array_box
+ \box_use_drop:N \l_@@_the_array_box
% \end{macrocode}
% We have to draw the blocks right now because there may be tabular notes in
% some blocks (which are not mono-column: the blocks which are mono-column
@@ -9050,7 +9134,7 @@
\@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
\dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
\dim_add:Nn \l_@@_x_initial_dim
- { \@@_colsep: + \l_@@_right_margin_dim + \l_@@_extra_right_margin_dim }
+ { \@@_colsep: + \l_@@_right_margin_dim + \l_@@_extra_right_margin_dim }
}
% \end{macrocode}
% We have a dotted line open on both sides which is \emph{not} in an exterior column.
@@ -10803,7 +10887,7 @@
% \end{macrocode}
%
% \bigskip
-% Here an example : |\@@_columncolor:nn {red!15} {1,3,5-7,10-}|
+% Here an example: |\@@_columncolor:nn {red!15} {1,3,5-7,10-}|
% \begin{macrocode}
\NewDocumentCommand \@@_columncolor { O { } m m }
{
@@ -10817,7 +10901,7 @@
% \end{macrocode}
%
% \bigskip
-% Here is an example : |\@@_rectanglecolor{red!15}{2-3}{5-6}|
+% Here is an example: |\@@_rectanglecolor{red!15}{2-3}{5-6}|
% \begin{macrocode}
\NewDocumentCommand \@@_rectanglecolor { O { } m m m }
{
@@ -10865,7 +10949,7 @@
%
%
% \bigskip
-% Here is an example : |\@@_cellcolor[rgb]{0.5,0.5,0}{2-3,3-4,4-5,5-6}|
+% Here is an example: |\@@_cellcolor[rgb]{0.5,0.5,0}{2-3,3-4,4-5,5-6}|
% \begin{macrocode}
\NewDocumentCommand \@@_cellcolor { O { } m m }
{
@@ -11969,8 +12053,7 @@
\pgfpathlineto { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim }
\prg_replicate:nn { \l_@@_multiplicity_int - 1 }
{
- \dim_sub:Nn \l_tmpb_dim \arrayrulewidth
- \dim_sub:Nn \l_tmpb_dim \doublerulesep
+ \dim_sub:Nn \l_tmpb_dim { \arrayrulewidth + \doublerulesep }
\pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
\pgfpathlineto { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim }
}
@@ -12233,8 +12316,7 @@
\pgfpathlineto { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim }
\prg_replicate:nn { \l_@@_multiplicity_int - 1 }
{
- \dim_sub:Nn \l_tmpb_dim \arrayrulewidth
- \dim_sub:Nn \l_tmpb_dim \doublerulesep
+ \dim_sub:Nn \l_tmpb_dim { \arrayrulewidth + \doublerulesep }
\pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
\pgfpathlineto { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim }
}
@@ -13837,7 +13919,7 @@
{
\c_math_toggle_token
\use:e
- {
+ {
\exp_not:N \begin { array }
[ \str_lowercase:f \l_@@_vpos_block_str ]
{ @ { } \l_@@_hpos_block_str @ { } }
@@ -13876,35 +13958,20 @@
% \end{macrocode}
% If we are in a mono-row block we take into account the height and the depth of
% that block for the height and the depth of the row, excepted when the block
-% uses explicitely an option of vertical position.
+% uses explicitely an option of vertical position |T| or |B|.
+% Remind that if the user has not used a key for the vertical position of the block,
+% then |\l_@@_vpos_block_str| remains empty.
% \begin{macrocode}
- \bool_lazy_and:nnT
- { \int_compare_p:nNn { #1 } = { \c_one_int } }
-% \end{macrocode}
-% If the user has not used a key for the vertical position of the block, then
-% |\l_@@_vpos_block_str| remains empty.
-% \begin{macrocode}
- { \str_if_empty_p:N \l_@@_vpos_block_str }
- {
- \dim_gset:Nn \g_@@_blocks_ht_dim
- {
- \dim_max:nn
- { \g_@@_blocks_ht_dim }
- {
- \box_ht:c
- { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box }
- }
- }
- \dim_gset:Nn \g_@@_blocks_dp_dim
- {
- \dim_max:nn
- { \g_@@_blocks_dp_dim }
- {
- \box_dp:c
- { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box }
- }
- }
- }
+ \int_compare:nNnT { #1 } = { \c_one_int }
+ {
+ \bool_lazy_any:nT
+ {
+ { \str_if_empty_p:N \l_@@_vpos_block_str }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { t } }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { b } }
+ }
+ { \@@_adjust_blocks_ht_dp: }
+ }
\seq_gput_right:Ne \g_@@_blocks_seq
{
\l_tmpa_tl
@@ -13941,7 +14008,30 @@
% \end{macrocode}
%
%
-%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_adjust_blocks_ht_dp:
+ {
+ \dim_gset:Nn \g_@@_blocks_ht_dim
+ {
+ \dim_max:nn
+ { \g_@@_blocks_ht_dim }
+ {
+ \box_ht:c
+ { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box }
+ }
+ }
+ \dim_gset:Nn \g_@@_blocks_dp_dim
+ {
+ \dim_max:nn
+ { \g_@@_blocks_dp_dim }
+ {
+ \box_dp:c
+ { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box }
+ }
+ }
+ }
+% \end{macrocode}
+%
% \bigskip
% \begin{macrocode}
\cs_new:Npn \@@_adjust_hpos_rotate:
@@ -14215,11 +14305,11 @@
% be composed now.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_blocks:
- {
- \bool_if:NTF \c_@@_recent_array_bool
+ {
+ \bool_if:nTF { \c_@@_recent_array_bool && ! \c_@@_revtex_bool }
{ \cs_set_eq:NN \ar at ialign \@@_old_ar at ialign: }
{ \cs_set_eq:NN \ialign \@@_old_ialign: }
- \seq_map_inline:Nn \g_@@_blocks_seq { \@@_Block_iv:nnnnnn ##1 }
+ \seq_map_inline:Nn \g_@@_blocks_seq { \@@_Block_iv:nnnnnn ##1 }
}
% \end{macrocode}
%
@@ -14610,6 +14700,7 @@
}
}
\endpgfpicture
+
% \end{macrocode}
%
% \bigskip
@@ -14698,7 +14789,7 @@
% \begin{macrocode}
{
\bool_if:NTF \l_@@_p_block_bool
- {
+ {
% \end{macrocode}
% When the final user has used the key~|p|, we have to compute the width.
% \begin{macrocode}
@@ -14727,9 +14818,9 @@
#6
\end { minipage }
}
- }
- { \hbox_set:Nn \l_@@_cell_box { \set at color #6 } }
- \bool_if:NT \g_@@_rotate_bool { \@@_rotate_cell_box: }
+ }
+ { \hbox_set:Nn \l_@@_cell_box { \set at color #6 } }
+ \bool_if:NT \g_@@_rotate_bool { \@@_rotate_cell_box: }
% \end{macrocode}
%
% \bigskip
@@ -14736,53 +14827,44 @@
% Now, we will put the label of the block. We recall that |\l_@@_vpos_block_str|
% is empty when the user has not used a key for the vertical position of the block.
% \begin{macrocode}
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgf at relevantforpicturesizefalse
- \bool_lazy_any:nTF
- {
- { \str_if_empty_p:N \l_@@_vpos_block_str }
- { \str_if_eq_p:ee \l_@@_vpos_block_str { c } }
- { \str_if_eq_p:ee \l_@@_vpos_block_str { T } }
- { \str_if_eq_p:ee \l_@@_vpos_block_str { B } }
- }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf at relevantforpicturesizefalse
+ \bool_lazy_any:nTF
+ {
+ { \str_if_empty_p:N \l_@@_vpos_block_str }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { c } }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { T } }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { B } }
+ }
% \end{macrocode}
% \medskip
% \begin{macrocode}
- {
+ {
% \end{macrocode}
% If we are in the first column, we must put the block as if it was with the key~|r|.
% \begin{macrocode}
- \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str }
+ \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str }
% \end{macrocode}
% If we are in the last column, we must put the block as if it was with the key~|l|.
% \begin{macrocode}
- \bool_if:nT \g_@@_last_col_found_bool
- {
- \int_compare:nNnT { #2 } = { \g_@@_col_total_int }
- { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str }
- }
+ \bool_if:nT \g_@@_last_col_found_bool
+ {
+ \int_compare:nNnT { #2 } = { \g_@@_col_total_int }
+ { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str }
+ }
% \end{macrocode}
% |\l_tmpa_tl| will contain the anchor of the \textsc{pgf} node which will be used.
% \begin{macrocode}
- \tl_set:Ne \l_tmpa_tl
- {
- \str_case:on \l_@@_vpos_block_str
- {
+ \tl_set:Ne \l_tmpa_tl
+ {
+ \str_case:on \l_@@_vpos_block_str
+ {
% \end{macrocode}
% We recall that |\l_@@_vpos_block_str| is empty when the user has not used a key
% for the vertical position of the block.
% \begin{macrocode}
- { } {
- \str_case:on \l_@@_hpos_block_str
- {
- c { center }
- l { west }
- r { east }
- j { center }
- }
- }
- c {
+ { } {
\str_case:on \l_@@_hpos_block_str
{
c { center }
@@ -14790,99 +14872,108 @@
r { east }
j { center }
}
-
}
- T {
- \str_case:on \l_@@_hpos_block_str
- {
- c { north }
- l { north~west }
- r { north~east }
- j { north }
- }
+ c {
+ \str_case:on \l_@@_hpos_block_str
+ {
+ c { center }
+ l { west }
+ r { east }
+ j { center }
+ }
- }
- B {
- \str_case:on \l_@@_hpos_block_str
- {
- c { south }
- l { south~west }
- r { south~east }
- j { south }
- }
+ }
+ T {
+ \str_case:on \l_@@_hpos_block_str
+ {
+ c { north }
+ l { north~west }
+ r { north~east }
+ j { north }
+ }
- }
- }
- }
+ }
+ B {
+ \str_case:on \l_@@_hpos_block_str
+ {
+ c { south }
+ l { south~west }
+ r { south~east }
+ j { south }
+ }
+
+ }
+ }
+ }
% \end{macrocode}
% \begin{macrocode}
- \pgftransformshift
- {
- \pgfpointanchor
- {
- \@@_env: - #1 - #2 - block
- \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
- }
- { \l_tmpa_tl }
- }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- { \l_tmpa_tl }
- { \box_use_drop:N \l_@@_cell_box } { } { }
- }
+ \pgftransformshift
+ {
+ \pgfpointanchor
+ {
+ \@@_env: - #1 - #2 - block
+ \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+ }
+ { \l_tmpa_tl }
+ }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
+ { \l_tmpa_tl }
+ { \box_use_drop:N \l_@@_cell_box } { } { }
+ }
% \end{macrocode}
% End of the case when |\l_@@_vpos_block_str| is equal to |c|, |T| or |B|.
% Now, the other cases.
% \begin{macrocode}
- {
+ {
% \end{macrocode}
%
% \begin{macrocode}
- \pgfextracty \l_tmpa_dim
- {
- \@@_qpoint:n
- {
- row - \str_if_eq:eeTF \l_@@_vpos_block_str { b } { #3 } { #1 }
- - base
- }
- }
- \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
+ \pgfextracty \l_tmpa_dim
+ {
+ \@@_qpoint:n
+ {
+ row - \str_if_eq:eeTF \l_@@_vpos_block_str { b } { #3 } { #1 }
+ - base
+ }
+ }
+ \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
% \end{macrocode}
% We retrieve (in |\pgf at x|) the $x$-value of the center of the block.
% \begin{macrocode}
- \pgfpointanchor
- {
- \@@_env: - #1 - #2 - block
- \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
- }
- {
- \str_case:on \l_@@_hpos_block_str
- {
- c { center }
- l { west }
- r { east }
- j { center }
- }
- }
+ \pgfpointanchor
+ {
+ \@@_env: - #1 - #2 - block
+ \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+ }
+ {
+ \str_case:on \l_@@_hpos_block_str
+ {
+ c { center }
+ l { west }
+ r { east }
+ j { center }
+ }
+ }
% \end{macrocode}
% We put the label of the block which has been composed in |\l_@@_cell_box|.
% \begin{macrocode}
- \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- {
- \str_case:on \l_@@_hpos_block_str
- {
- c { base }
- l { base~west }
- r { base~east }
- j { base }
- }
- }
- { \box_use_drop:N \l_@@_cell_box } { } { }
- }
+ \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
+ {
+ \str_case:on \l_@@_hpos_block_str
+ {
+ c { base }
+ l { base~west }
+ r { base~east }
+ j { base }
+ }
+ }
+ { \box_use_drop:N \l_@@_cell_box } { } { }
+ }
% \end{macrocode}
%
% \begin{macrocode}
@@ -16661,7 +16752,7 @@
shorten .code:n = ,
shorten-start .code:n = ,
shorten-end .code:n = ,
- unknown .code:n = \@@_error:n { Unknown~key~for~Hbrace }
+ unknown .code:n = \@@_fatal:n { Unknown~key~for~Hbrace }
}
% \end{macrocode}
%
@@ -16681,7 +16772,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_hbrace:nnn #1 #2 #3
{
- \int_compare:nNnTF { \c at iRow } < { \c_one_int }
+ \int_compare:nNnTF { \c at iRow } < { 2 }
{
% \end{macrocode}
% We recall that |\str_if_eq:nnTF| is ``fully expandable''.
@@ -16751,7 +16842,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_vbrace:nnn #1 #2 #3
{
- \int_if_zero:nTF { \c at jCol }
+ \int_compare:nNnTF { \c at jCol } < { 2 }
{
\str_if_eq:nnTF { #2 } { * }
{
@@ -17211,7 +17302,8 @@
\cs_new:Npn \@@_message_hdotsfor:
{
\tl_if_empty:oF \g_@@_HVdotsfor_lines_tl
- { ~Maybe~your~use~of~ \token_to_str:N \Hdotsfor \ is~incorrect. }
+ { ~Maybe~your~use~of~ \token_to_str:N \Hdotsfor \ or~
+ \token_to_str:N \Hbrace \ is~incorrect. }
}
% \end{macrocode}
%
@@ -17481,7 +17573,8 @@
keys~allowed~for~the~commands~ \token_to_str:N \Hbrace \
and~ \token_to_str:N \Vbrace \ are:~'color',~
'horizontal-label(s)',~'shorten'~'shorten-end'~
- and~'shorten-start'.
+ and~'shorten-start'.\\
+ That~error~is~fatal.
}
% \end{macrocode}
%
@@ -17946,6 +18039,17 @@
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { unknown~column~type~multicolumn }
+ {
+ Bad~column~type. \\
+ The~column~type~'#1'~in~the~command~\token_to_str:N \multicolumn \
+ ~of~your~ \@@_full_name_env: \
+ is~unknown. \\
+ This~error~is~fatal.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { unknown~column~type~S }
{
Bad~column~type. \\
@@ -17955,6 +18059,18 @@
This~error~is~fatal.
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { unknown~column~type~S~multicolumn }
+ {
+ Bad~column~type. \\
+ The~column~type~'S'~in~the~command~\token_to_str:N \multicolumn \
+ of~your~ \@@_full_name_env: \ is~unknown. \\
+ If~you~want~to~use~the~column~type~'S'~of~siunitx,~you~should~
+ load~that~package. \\
+ This~error~is~fatal.
+ }
+% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { tabularnote~forbidden }
@@ -18102,6 +18218,17 @@
Your~column~will~behave~like~'p'.
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { varwidth~not~loaded~in~X }
+ {
+ varwidth~not~loaded.\\
+ You~can't~use~the~key~'V'~in~your~column~'X'~
+ because~'varwidth'~is~not~loaded.\\
+ It~will~be~ignored. \\
+ }
+% \end{macrocode}
+%
%
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~RulesBis }
Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2025-08-05 20:35:39 UTC (rev 75978)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2025-08-05 20:35:52 UTC (rev 75979)
@@ -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{7.1e}
-\def\myfiledate{2025/07/18}
+\def\myfileversion{7.2}
+\def\myfiledate{2025/08/05}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\ProvidesExplPackage
@@ -198,7 +198,6 @@
\cs_set_eq:NN \rowcolor \__nicematrix_old_rowcolor:
}
}
-
\cs_new_protected:Npn \__nicematrix_replace_columncolor:
{
\tl_replace_all:Nnn \g__nicematrix_array_preamble_tl
@@ -362,6 +361,8 @@
\bool_new:N \g__nicematrix_rotate_bool
\bool_new:N \g__nicematrix_rotate_c_bool
\bool_new:N \l__nicematrix_X_bool
+\bool_new:N \l__nicematrix_V_of_X_bool
+\bool_new:N \g__nicematrix_V_of_X_bool
\bool_new:N \g__nicematrix_caption_finished_bool
\bool_new:N \l__nicematrix_no_cell_nodes_bool
\tl_new:N \g__nicematrix_aux_tl
@@ -558,11 +559,11 @@
\newlist { tabularnotes } { enumerate } { 1 }
\setlist [ tabularnotes ]
{
- topsep = 0pt ,
+ topsep = \c_zero_dim ,
noitemsep ,
leftmargin = * ,
align = left ,
- labelsep = 0pt ,
+ labelsep = \c_zero_dim ,
label =
\__nicematrix_notes_label_in_list:n { \__nicematrix_notes_style:n { tabularnotesi } } ,
}
@@ -857,7 +858,7 @@
}
\cs_new_protected:Npn \__nicematrix_err_key_color_inside:
{
- \__nicematrix_warning:n { key~color-inside }
+ \__nicematrix_error_or_warning:n { key~color-inside }
\cs_gset:Npn \__nicematrix_err_key_color_inside: { }
}
\keys_define:nn { nicematrix / Global }
@@ -1579,6 +1580,7 @@
\cs_new_protected:Npn \__nicematrix_pre_array_ii:
{
\fp_gzero:N \g__nicematrix_total_X_weight_fp
+ \bool_gset_false:N \g__nicematrix_V_of_X_bool
\__nicematrix_expand_clist:N \l__nicematrix_hlines_clist
\__nicematrix_expand_clist:N \l__nicematrix_vlines_clist
\__nicematrix_patch_booktabs:
@@ -1599,17 +1601,19 @@
}
\socket_assign_plug:nn { nicematrix / create-cell-nodes } { active }
}
- \bool_if:nTF
- { \c__nicematrix_recent_array_bool && ! \c__nicematrix_revtex_bool }
+ \bool_if:NT \c__nicematrix_recent_array_bool
{
- \def \ar at ialign
+ \bool_if:NF \c__nicematrix_revtex_bool
{
- \bool_if:NT \c__nicematrix_testphase_table_bool
- \tbl_init_cell_data_for_table:
- \__nicematrix_some_initialization:
- \dim_zero:N \tabskip
- \cs_set_eq:Nc \ar at ialign { __nicematrix_old_ar at ialign: }
- \halign
+ \def \ar at ialign
+ {
+ \bool_if:NT \c__nicematrix_testphase_table_bool
+ \tbl_init_cell_data_for_table:
+ \__nicematrix_some_initialization:
+ \dim_zero:N \tabskip
+ \cs_set_eq:Nc \ar at ialign { __nicematrix_old_ar at ialign: }
+ \halign
+ }
}
}
{
@@ -2012,7 +2016,7 @@
{ \keys_set:nn { nicematrix / pNiceArray } }
{ \keys_set:nn { nicematrix / NiceArray } }
{ #3 , #5 }
- \__nicematrix_set_CTarc:o \l__nicematrix_rules_color_tl
+ \__nicematrix_set_CTarc:o \l__nicematrix_rules_color_tl % noqa: w302
\bool_if:nTF { #6 } { \__nicematrix_CodeBefore_Body:w } { \__nicematrix_pre_array: }
}
{
@@ -2142,26 +2146,34 @@
\bool_set_true:N \l__nicematrix_X_columns_aux_bool
\dim_set:Nn \l__nicematrix_X_columns_dim
{
- \dim_compare:nNnTF
- {
- \dim_abs:n
- { \l__nicematrix_width_dim - \box_wd:N \l__nicematrix_the_array_box }
- }
- <
- { 0.001 pt }
+ \bool_lazy_and:nnTF
+ { \g__nicematrix_V_of_X_bool }
+ { \l__nicematrix_X_columns_aux_bool }
{ \dim_use:N \l__nicematrix_X_columns_dim }
{
- \dim_eval:n
+ \dim_compare:nNnTF
{
- \fp_to_dim:n
+ \dim_abs:n
+ { \l__nicematrix_width_dim - \box_wd:N \l__nicematrix_the_array_box }
+ }
+ <
+ { 0.001 pt }
+ { \dim_use:N \l__nicematrix_X_columns_dim }
+ {
+ \dim_eval:n
{
- (
- \dim_eval:n
- { \l__nicematrix_width_dim - \box_wd:N \l__nicematrix_the_array_box }
- )
- / \fp_use:N \g__nicematrix_total_X_weight_fp
+ \l__nicematrix_X_columns_dim
+ +
+ \fp_to_dim:n
+ {
+ (
+ \dim_eval:n
+ { \l__nicematrix_width_dim - \box_wd:N \l__nicematrix_the_array_box }
+ )
+ / \fp_use:N \g__nicematrix_total_X_weight_fp
+ }
+
}
- + \l__nicematrix_X_columns_dim
}
}
}
@@ -2385,7 +2397,8 @@
{
\str_set:Nn \l__nicematrix_hpos_col_str { j }
\__nicematrix_keys_p_column:n { #1 }
- \__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { }
+ \setlength { \l_tmpa_dim } { #2 }
+ \__nicematrix_make_preamble_ii_iv:nnn { \l_tmpa_dim } { minipage } { }
}
\cs_new_protected:Npn \__nicematrix_keys_p_column:n #1
{ \keys_set_known:nnN { nicematrix / p-column } { #1 } \l_tmpa_tl }
@@ -2393,9 +2406,9 @@
{
\use:e
{
- \__nicematrix_make_preamble_ii_v:nnnnnnnn
+ \__nicematrix_make_preamble_ii_vi:nnnnnnnn
{ \str_if_eq:eeTF \l__nicematrix_vpos_col_str { p } { t } { b } }
- { \dim_eval:n { #1 } }
+ { #1 }
{
\str_if_eq:eeTF \l__nicematrix_hpos_col_str { j }
{ \tl_clear:N \exp_not:N \l__nicematrix_hpos_cell_tl }
@@ -2438,7 +2451,7 @@
\int_gincr:N \c at jCol
\__nicematrix_rec_preamble_after_col:n
}
-\cs_new_protected:Npn \__nicematrix_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__nicematrix_make_preamble_ii_vi:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
\str_if_eq:eeTF \l__nicematrix_hpos_col_str { si }
{
@@ -2541,11 +2554,12 @@
\str_set:Nn \l__nicematrix_vpos_col_str { p }
\str_set:Nn \l__nicematrix_hpos_col_str { j }
\__nicematrix_keys_p_column:n { #1 }
+ \setlength { \l_tmpa_dim } { #2 }
\IfPackageLoadedTF { varwidth }
- { \__nicematrix_make_preamble_ii_iv:nnn { #2 } { varwidth } { } }
+ { \__nicematrix_make_preamble_ii_iv:nnn { \l_tmpa_dim } { varwidth } { } }
{
\__nicematrix_error_or_warning:n { varwidth~not~loaded }
- \__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { }
+ \__nicematrix_make_preamble_ii_iv:nnn { \l_tmpa_dim } { minipage } { }
}
}
\cs_new_protected:Npn \__nicematrix_w: { \__nicematrix_make_preamble_w:nnnn { } }
@@ -2563,7 +2577,7 @@
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
> {
- \dim_set:Nn \l__nicematrix_col_width_dim { #2 }
+ \setlength { \l__nicematrix_col_width_dim } { #2 }
\__nicematrix_cell_begin:
\tl_set_eq:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_c_tl
}
@@ -2585,7 +2599,7 @@
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
> {
- \dim_set:Nn \l__nicematrix_col_width_dim { #4 }
+ \setlength { \l__nicematrix_col_width_dim } { #4 }
\hbox_set:Nw \l__nicematrix_cell_box
\__nicematrix_cell_begin:
\tl_set:Nn \l__nicematrix_hpos_cell_tl { #3 }
@@ -2798,10 +2812,17 @@
{ \__nicematrix_make_preamble_X_i:n { #1 } }
\keys_define:nn { nicematrix / X-column }
{
+ V .code:n =
+ \IfPackageLoadedTF { varwidth }
+ {
+ \bool_set_true:N \l__nicematrix_V_of_X_bool
+ \bool_gset_true:N \g__nicematrix_V_of_X_bool
+ }
+ { \__nicematrix_error_or_warning:n { varwidth~not~loaded~in~X } } ,
unknown .code:n =
- \regex_match:nVTF { \A[0-9]*\.?[0-9]*\Z } \l_keys_key_str
- { \fp_set:Nn \l_tmpa_fp { \l_keys_key_str } }
- { \__nicematrix_error_or_warning:n { invalid~weight } }
+ \regex_match:nVTF { \A[0-9]*\.?[0-9]*\Z } \l_keys_key_str
+ { \fp_set:Nn \l_tmpa_fp { \l_keys_key_str } }
+ { \__nicematrix_error_or_warning:n { invalid~weight } }
}
\cs_new_protected:Npn \__nicematrix_make_preamble_X_i:n #1
{
@@ -2809,6 +2830,7 @@
\str_set:Nn \l__nicematrix_vpos_col_str { p }
\fp_set:Nn \l_tmpa_fp { 1.0 }
\__nicematrix_keys_p_column:n { #1 }
+ \bool_set_false:N \l__nicematrix_V_of_X_bool
\keys_set:no { nicematrix / X-column } \l_tmpa_tl
\fp_gadd:Nn \g__nicematrix_total_X_weight_fp \l_tmpa_fp
\bool_if:NTF \l__nicematrix_X_columns_aux_bool
@@ -2815,7 +2837,7 @@
{
\__nicematrix_make_preamble_ii_iv:nnn
{ \fp_use:N \l_tmpa_fp \l__nicematrix_X_columns_dim }
- { minipage }
+ { \bool_if:NTF \l__nicematrix_V_of_X_bool { varwidth } { minipage } }
{ \__nicematrix_no_update_width: }
}
{
@@ -2865,6 +2887,8 @@
{ __nicematrix _ \token_to_str:N \hline : }
\cs_set_eq:cc { __nicematrix _ \token_to_str:N \diagbox : }
{ __nicematrix _ \token_to_str:N \hline : }
+\cs_set_eq:cc { __nicematrix _ \token_to_str:N & : }
+ { __nicematrix _ \token_to_str:N \hline : }
\cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3
{
\multispan { #1 }
@@ -2903,7 +2927,7 @@
{ }
}
}
- \RenewDocumentCommand \cellcolor { O { } m }
+ \RenewDocumentCommand { \cellcolor } { O { } m }
{
\tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
@@ -2949,8 +2973,8 @@
}
{
\str_if_eq:nnTF { #1 } { S }
- { \__nicematrix_fatal:n { unknown~column~type~S } }
- { \__nicematrix_fatal:nn { unknown~column~type } { #1 } }
+ { \__nicematrix_fatal:n { unknown~column~type~S~multicolumn } }
+ { \__nicematrix_fatal:nn { unknown~column~type~multicolumn } { #1 } }
}
}
}
@@ -2980,14 +3004,15 @@
{
> {
\__nicematrix_cell_begin:
- \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
+ \setlength { \l_tmpa_dim } { #3 }
+ \begin { minipage } [ #1 ] { \l_tmpa_dim }
\mode_leave_vertical:
\arraybackslash
- \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt
+ \vrule height \box_ht:N \@arstrutbox depth \c_zero_dim width \c_zero_dim
}
c
< {
- \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt
+ \vrule height \c_zero_dim depth \box_dp:N \@arstrutbox width \c_zero_dim
\end { minipage }
\__nicematrix_cell_end:
}
@@ -6304,8 +6329,7 @@
\pgfpathlineto { \pgfpoint \l_tmpb_dim \l__nicematrix_tmpc_dim }
\prg_replicate:nn { \l__nicematrix_multiplicity_int - 1 }
{
- \dim_sub:Nn \l_tmpb_dim \arrayrulewidth
- \dim_sub:Nn \l_tmpb_dim \doublerulesep
+ \dim_sub:Nn \l_tmpb_dim { \arrayrulewidth + \doublerulesep }
\pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
\pgfpathlineto { \pgfpoint \l_tmpb_dim \l__nicematrix_tmpc_dim }
}
@@ -6488,8 +6512,7 @@
\pgfpathlineto { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim }
\prg_replicate:nn { \l__nicematrix_multiplicity_int - 1 }
{
- \dim_sub:Nn \l_tmpb_dim \arrayrulewidth
- \dim_sub:Nn \l_tmpb_dim \doublerulesep
+ \dim_sub:Nn \l_tmpb_dim { \arrayrulewidth + \doublerulesep }
\pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
\pgfpathlineto { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim }
}
@@ -7405,29 +7428,16 @@
}
}
}
- \bool_lazy_and:nnT
- { \int_compare_p:nNn { #1 } = { \c_one_int } }
- { \str_if_empty_p:N \l__nicematrix_vpos_block_str }
- {
- \dim_gset:Nn \g__nicematrix_blocks_ht_dim
- {
- \dim_max:nn
- { \g__nicematrix_blocks_ht_dim }
- {
- \box_ht:c
- { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
- }
- }
- \dim_gset:Nn \g__nicematrix_blocks_dp_dim
- {
- \dim_max:nn
- { \g__nicematrix_blocks_dp_dim }
- {
- \box_dp:c
- { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
- }
- }
- }
+ \int_compare:nNnT { #1 } = { \c_one_int }
+ {
+ \bool_lazy_any:nT
+ {
+ { \str_if_empty_p:N \l__nicematrix_vpos_block_str }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { t } }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { b } }
+ }
+ { \__nicematrix_adjust_blocks_ht_dp: }
+ }
\seq_gput_right:Ne \g__nicematrix_blocks_seq
{
\l_tmpa_tl
@@ -7451,6 +7461,27 @@
}
\bool_set_false:N \g__nicematrix_rotate_c_bool
}
+\cs_new_protected:Npn \__nicematrix_adjust_blocks_ht_dp:
+ {
+ \dim_gset:Nn \g__nicematrix_blocks_ht_dim
+ {
+ \dim_max:nn
+ { \g__nicematrix_blocks_ht_dim }
+ {
+ \box_ht:c
+ { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
+ }
+ }
+ \dim_gset:Nn \g__nicematrix_blocks_dp_dim
+ {
+ \dim_max:nn
+ { \g__nicematrix_blocks_dp_dim }
+ {
+ \box_dp:c
+ { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
+ }
+ }
+ }
\cs_new:Npn \__nicematrix_adjust_hpos_rotate:
{
\bool_if:NT \g__nicematrix_rotate_bool
@@ -7646,7 +7677,7 @@
}
\cs_new_protected:Npn \__nicematrix_draw_blocks:
{
- \bool_if:NTF \c__nicematrix_recent_array_bool
+ \bool_if:nTF { \c__nicematrix_recent_array_bool && ! \c__nicematrix_revtex_bool }
{ \cs_set_eq:NN \ar at ialign \__nicematrix_old_ar at ialign: }
{ \cs_set_eq:NN \ialign \__nicematrix_old_ialign: }
\seq_map_inline:Nn \g__nicematrix_blocks_seq { \__nicematrix_Block_iv:nnnnnn ##1 }
@@ -7873,6 +7904,7 @@
}
}
\endpgfpicture
+
\bool_if:NTF \l__nicematrix_ampersand_bool
{
\seq_set_split:Nnn \l_tmpa_seq { & } { #6 }
@@ -7980,40 +8012,31 @@
#6
\end { minipage }
}
- }
- { \hbox_set:Nn \l__nicematrix_cell_box { \set at color #6 } }
- \bool_if:NT \g__nicematrix_rotate_bool { \__nicematrix_rotate_cell_box: }
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgf at relevantforpicturesizefalse
- \bool_lazy_any:nTF
- {
- { \str_if_empty_p:N \l__nicematrix_vpos_block_str }
- { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { c } }
- { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { T } }
- { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { B } }
- }
- {
- \int_if_zero:nT { #2 } { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_r_str }
- \bool_if:nT \g__nicematrix_last_col_found_bool
- {
- \int_compare:nNnT { #2 } = { \g__nicematrix_col_total_int }
- { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_l_str }
- }
- \tl_set:Ne \l_tmpa_tl
- {
- \str_case:on \l__nicematrix_vpos_block_str
- {
- { } {
- \str_case:on \l__nicematrix_hpos_block_str
- {
- c { center }
- l { west }
- r { east }
- j { center }
- }
- }
- c {
+ }
+ { \hbox_set:Nn \l__nicematrix_cell_box { \set at color #6 } }
+ \bool_if:NT \g__nicematrix_rotate_bool { \__nicematrix_rotate_cell_box: }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf at relevantforpicturesizefalse
+ \bool_lazy_any:nTF
+ {
+ { \str_if_empty_p:N \l__nicematrix_vpos_block_str }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { c } }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { T } }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { B } }
+ }
+ {
+ \int_if_zero:nT { #2 } { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_r_str }
+ \bool_if:nT \g__nicematrix_last_col_found_bool
+ {
+ \int_compare:nNnT { #2 } = { \g__nicematrix_col_total_int }
+ { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_l_str }
+ }
+ \tl_set:Ne \l_tmpa_tl
+ {
+ \str_case:on \l__nicematrix_vpos_block_str
+ {
+ { } {
\str_case:on \l__nicematrix_hpos_block_str
{
c { center }
@@ -8021,84 +8044,93 @@
r { east }
j { center }
}
-
}
- T {
- \str_case:on \l__nicematrix_hpos_block_str
- {
- c { north }
- l { north~west }
- r { north~east }
- j { north }
- }
+ c {
+ \str_case:on \l__nicematrix_hpos_block_str
+ {
+ c { center }
+ l { west }
+ r { east }
+ j { center }
+ }
- }
- B {
- \str_case:on \l__nicematrix_hpos_block_str
- {
- c { south }
- l { south~west }
- r { south~east }
- j { south }
- }
+ }
+ T {
+ \str_case:on \l__nicematrix_hpos_block_str
+ {
+ c { north }
+ l { north~west }
+ r { north~east }
+ j { north }
+ }
- }
- }
- }
- \pgftransformshift
- {
- \pgfpointanchor
- {
- \__nicematrix_env: - #1 - #2 - block
- \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
- }
- { \l_tmpa_tl }
- }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- { \l_tmpa_tl }
- { \box_use_drop:N \l__nicematrix_cell_box } { } { }
- }
- {
- \pgfextracty \l_tmpa_dim
- {
- \__nicematrix_qpoint:n
- {
- row - \str_if_eq:eeTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
- - base
- }
- }
- \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
- \pgfpointanchor
- {
- \__nicematrix_env: - #1 - #2 - block
- \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
- }
- {
- \str_case:on \l__nicematrix_hpos_block_str
- {
- c { center }
- l { west }
- r { east }
- j { center }
- }
- }
- \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- {
- \str_case:on \l__nicematrix_hpos_block_str
- {
- c { base }
- l { base~west }
- r { base~east }
- j { base }
- }
- }
- { \box_use_drop:N \l__nicematrix_cell_box } { } { }
- }
+ }
+ B {
+ \str_case:on \l__nicematrix_hpos_block_str
+ {
+ c { south }
+ l { south~west }
+ r { south~east }
+ j { south }
+ }
+
+ }
+ }
+ }
+ \pgftransformshift
+ {
+ \pgfpointanchor
+ {
+ \__nicematrix_env: - #1 - #2 - block
+ \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
+ }
+ { \l_tmpa_tl }
+ }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
+ { \l_tmpa_tl }
+ { \box_use_drop:N \l__nicematrix_cell_box } { } { }
+ }
+ {
+ \pgfextracty \l_tmpa_dim
+ {
+ \__nicematrix_qpoint:n
+ {
+ row - \str_if_eq:eeTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
+ - base
+ }
+ }
+ \dim_sub:Nn \l_tmpa_dim { 0.5 \arrayrulewidth }
+ \pgfpointanchor
+ {
+ \__nicematrix_env: - #1 - #2 - block
+ \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
+ }
+ {
+ \str_case:on \l__nicematrix_hpos_block_str
+ {
+ c { center }
+ l { west }
+ r { east }
+ j { center }
+ }
+ }
+ \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
+ {
+ \str_case:on \l__nicematrix_hpos_block_str
+ {
+ c { base }
+ l { base~west }
+ r { base~east }
+ j { base }
+ }
+ }
+ { \box_use_drop:N \l__nicematrix_cell_box } { } { }
+ }
\endpgfpicture
}
\group_end:
@@ -9238,7 +9270,7 @@
shorten .code:n = ,
shorten-start .code:n = ,
shorten-end .code:n = ,
- unknown .code:n = \__nicematrix_error:n { Unknown~key~for~Hbrace }
+ unknown .code:n = \__nicematrix_fatal:n { Unknown~key~for~Hbrace }
}
\NewExpandableDocumentCommand { \__nicematrix_Hbrace } { O { } m m }
{
@@ -9248,7 +9280,7 @@
}
\cs_new:Npn \__nicematrix_hbrace:nnn #1 #2 #3
{
- \int_compare:nNnTF { \c at iRow } < { \c_one_int }
+ \int_compare:nNnTF { \c at iRow } < { 2 }
{
\str_if_eq:nnTF { #2 } { * }
{
@@ -9305,7 +9337,7 @@
}
\cs_new:Npn \__nicematrix_vbrace:nnn #1 #2 #3
{
- \int_if_zero:nTF { \c at jCol }
+ \int_compare:nNnTF { \c at jCol } < { 2 }
{
\str_if_eq:nnTF { #2 } { * }
{
@@ -9649,7 +9681,8 @@
\cs_new:Npn \__nicematrix_message_hdotsfor:
{
\tl_if_empty:oF \g__nicematrix_HVdotsfor_lines_tl
- { ~Maybe~your~use~of~ \token_to_str:N \Hdotsfor \ is~incorrect. }
+ { ~Maybe~your~use~of~ \token_to_str:N \Hdotsfor \ or~
+ \token_to_str:N \Hbrace \ is~incorrect. }
}
\__nicematrix_msg_new:nn { hvlines,~rounded-corners~and~corners }
{
@@ -9836,7 +9869,8 @@
keys~allowed~for~the~commands~ \token_to_str:N \Hbrace \
and~ \token_to_str:N \Vbrace \ are:~'color',~
'horizontal-label(s)',~'shorten'~'shorten-end'~
- and~'shorten-start'.
+ and~'shorten-start'.\\
+ That~error~is~fatal.
}
\__nicematrix_msg_new:nn { Unknown~key~for~TikzEveryCell }
{
@@ -10170,6 +10204,14 @@
is~unknown. \\
This~error~is~fatal.
}
+\__nicematrix_msg_new:nn { unknown~column~type~multicolumn }
+ {
+ Bad~column~type. \\
+ The~column~type~'#1'~in~the~command~\token_to_str:N \multicolumn \
+ ~of~your~ \__nicematrix_full_name_env: \
+ is~unknown. \\
+ This~error~is~fatal.
+ }
\__nicematrix_msg_new:nn { unknown~column~type~S }
{
Bad~column~type. \\
@@ -10178,6 +10220,15 @@
load~that~package. \\
This~error~is~fatal.
}
+\__nicematrix_msg_new:nn { unknown~column~type~S~multicolumn }
+ {
+ Bad~column~type. \\
+ The~column~type~'S'~in~the~command~\token_to_str:N \multicolumn \
+ of~your~ \__nicematrix_full_name_env: \ is~unknown. \\
+ If~you~want~to~use~the~column~type~'S'~of~siunitx,~you~should~
+ load~that~package. \\
+ This~error~is~fatal.
+ }
\__nicematrix_msg_new:nn { tabularnote~forbidden }
{
Forbidden~command. \\
@@ -10282,6 +10333,13 @@
loaded.\\
Your~column~will~behave~like~'p'.
}
+\__nicematrix_msg_new:nn { varwidth~not~loaded~in~X }
+ {
+ varwidth~not~loaded.\\
+ You~can't~use~the~key~'V'~in~your~column~'X'~
+ because~'varwidth'~is~not~loaded.\\
+ It~will~be~ignored. \\
+ }
\__nicematrix_msg_new:nnn { Unknown~key~for~RulesBis }
{
Unknown~key.\\
More information about the tex-live-commits
mailing list.