texlive[69034] Master/texmf-dist: nicematrix (4dec23)
commits+karl at tug.org
commits+karl at tug.org
Mon Dec 4 23:09:00 CET 2023
Revision: 69034
https://tug.org/svn/texlive?view=revision&revision=69034
Author: karl
Date: 2023-12-04 23:09:00 +0100 (Mon, 04 Dec 2023)
Log Message:
-----------
nicematrix (4dec23)
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 2023-12-04 22:08:27 UTC (rev 69033)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex 2023-12-04 22:09:00 UTC (rev 69034)
@@ -361,7 +361,7 @@
\item un item
\smallskip
\item \renewcommand{\arraystretch}{1.2}
-$\begin{NiceArray}[t]{lcccccc}
+$\begin{NiceArray}~emphase#[t]@{lcccccc}
\hline
n & 0 & 1 & 2 & 3 & 4 & 5 \\
u_n & 1 & 2 & 4 & 8 & 16 & 32
@@ -1400,10 +1400,10 @@
\medskip
\begin{minipage}{9cm}
-Dans l'exemple ci-contre (où B est au centre d'un |\Block| de taille $2\times 2$),
+Dans l'exemple ci-contre (où B est au centre d'un |\Block| de taille $2\times2$),
on a colorié en bleu clair les quatre coins (vides) du tableau.
\end{minipage}\hspace{2cm}%
-\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt]
+\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt,hvlines,rules={color=white,width=0.1pt}]
\CodeBefore
\rectanglecolor{blue!10}{1-1}{4-2}
\rectanglecolor{blue!10}{1-1}{1-4}
@@ -1422,7 +1422,6 @@
& & & A \\
\end{NiceTabular}
-
\medskip
Quand la clé |corners|\footnote{La clé \texttt{corners} dont on parle là
n'a pas de rapport direct avec la clé \texttt{rounded-corners},
@@ -1494,7 +1493,7 @@
p.~\pageref{TikzEveryCell}) tient également compte des coins.
-\subsection{La commande \textbackslash diagbox}
+\subsubsection{La commande \textbackslash diagbox}
\indexcommand{diagbox}
@@ -1525,7 +1524,7 @@
-\subsection{Commandes pour filets personnalisés}
+\subsubsection{Commandes pour filets personnalisés}
\label{custom-line}
\index{command (clé de «custom-line»)}
\index{ccommand (clé de «custom-line»)}
@@ -6037,7 +6036,7 @@
\medskip
\item Pour les colonnes de type |p|, |m|, |b|, |V|\footnote{Les colonnes de type
- |V| sont fournies par l'extension \pkg{varwidth}: cf.~p.~\pageref{varwidth}}
+ |V| sont fournies par l'extension \pkg{varwidth}, qui doit être chargée : cf.~p.~\pageref{varwidth}}
ou |X|\footnote{Pour les colonnes |X|, voir p.~\pageref{colonne-X}}, la case est vide si (et seulement
si) son contenu dans le codage TeX est vide (il n'y a que des espaces entre les
deux esperluettes |&|).
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 2023-12-04 22:08:27 UTC (rev 69033)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex 2023-12-04 22:09:00 UTC (rev 69034)
@@ -1,5 +1,5 @@
% -*- coding: utf-8 ; -*- This file should be compiled with XeLaTeX only
-\documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix)
+\documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by TikZ, loaded by nicematrix)
\usepackage{xltxtra}
\usepackage{geometry}
@@ -168,7 +168,7 @@
\medskip
Most features of \pkg{nicematrix} may be used without explicit use of
-\textsc{pgf} or Tikz (which, in fact, is not loaded by default).
+\textsc{pgf} or TikZ (which, in fact, is not loaded by default).
\medskip
\indexcommand{NiceMatrixOptions}
@@ -552,7 +552,7 @@
the key \Definition{rounded-corners} requires rounded corners (for the
frame drawn by |draw| and the shape drawn by |fill|) with a radius equal to
the value of that key (the default value is 4~pt\footnote{This value is the
-initial value of the \emph{rounded corners} of Tikz.}).
+initial value of the \emph{rounded corners} of TikZ.}).
\end{itemize}
\medskip
@@ -570,15 +570,15 @@
elements covered by |left|, |right|, |top| and |bottom|; it's possible, in
fact, in the list which is the value of the key |borders|, to add an entry of
the form |tikz={|\textsl{list}|}| where \textsl{list} is a list of couples
-\textsl{key=value} of Tikz specifying the graphical characteristics of the
+\textsl{key=value} of TikZ specifying the graphical characteristics of the
lines that will be drawn (for an example, see p.~\pageref{dashed}).
\item \index{tikzz at tikz!key of \texttt{\textbackslash Block}}
-When the key \Definition{tikz} is used, the Tikz path corresponding of
-the rectangle which delimits the block is executed with Tikz\footnote{Tikz
+When the key \Definition{tikz} is used, the TikZ path corresponding of
+the rectangle which delimits the block is executed with TikZ\footnote{TikZ
should be loaded (by default, \pkg{nicematrix} only loads \textsc{pgf}) and,
if it's not, an error will be raised.} by using as options the value of that
-key |tikz| (which must be a list of keys allowed for a Tikz path).
+key |tikz| (which must be a list of keys allowed for a TikZ path).
\colorbox{yellow!50}{\textbf{New 6.24}}\enskip In fact, in the list of the keys
provided by the user as value of |tikz|, it's possible to put a key |offset|.
@@ -597,8 +597,8 @@
\begin{itemize}
\item \index{name!key of \texttt{\textbackslash Block}}
-the key \Definition{name} provides a name to the rectangular Tikz node
-corresponding to the block; it's possible to use that name with Tikz in the
+the key \Definition{name} provides a name to the rectangular TikZ node
+corresponding to the block; it's possible to use that name with TikZ in the
|\CodeAfter| of the environment (cf.~p.~\pageref{code-after});
\item \index{respect-arraystretch (key of \texttt{\textbackslash Block})}
the key \Definition{respect-arraystretch} prevents the setting of
@@ -1358,7 +1358,9 @@
In the example on the right (where B is in the center of a block of size
$2\times2$), we have colored in blue the four (empty) corners of the array.
\end{minipage}\hspace{2cm}%
-\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt]
+\begin{NiceTabular}
+ [cell-space-top-limit=3pt,hvlines,rules={color=white,width=0.1pt}]
+ {*{6}{c}}
\CodeBefore
\rectanglecolor{blue!10}{1-1}{4-2}
\rectanglecolor{blue!10}{1-1}{1-4}
@@ -1446,7 +1448,7 @@
command |\TikzEveryCell| available in the |\CodeBefore| and the |\CodeAfter|
(cf. p.~\pageref{TikzEveryCell}) takes also into account the empty corners.
-\subsection{The command \textbackslash diagbox}
+\subsubsection{The command \textbackslash diagbox}
\indexcommand{diagbox}
@@ -1477,7 +1479,7 @@
-\subsection{Commands for customized rules}
+\subsubsection{Commands for customized rules}
\label{custom-line}
\index{command (key of ``custom-line'')}
@@ -1580,12 +1582,12 @@
\index{tikzz at tikz!key of ``custom-line''}
\index{total-width (key of ``custom-line'')}
-It's possible to use the key |tikz| (if Tikz is loaded). In that case, the
-rule is drawn directly with Tikz by using as parameters the value of the key
+It's possible to use the key |tikz| (if TikZ is loaded). In that case, the
+rule is drawn directly with TikZ by using as parameters the value of the key
|tikz| which must be a list of \textsl{key=value} pairs which may be applied
-to a Tikz path.
+to a TikZ path.
-By default, no space is reserved for the rule that will be drawn with Tikz. It
+By default, no space is reserved for the rule that will be drawn with TikZ. It
is possible to specify a reservation (horizontal for a vertical rule and
vertical for an horizontal one) with the key |total-width|. That value of that
key, is, in some ways, the width of the rule that will be drawn
@@ -1595,7 +1597,7 @@
\bigskip
-Here is an example with the key |dotted| of Tikz.
+Here is an example with the key |dotted| of TikZ.
\begin{BVerbatim}[boxwidth=9cm,baseline=c]
\NiceMatrixOptions
@@ -1638,7 +1640,7 @@
\indexcommand{hdottedline}
\indexcommand{cdottedline}
-As one can see, the dots of a dotted line of Tikz have the shape of a square,
+As one can see, the dots of a dotted line of TikZ have the shape of a square,
and not a circle. That's why the extension \pkg{nicematrix} provides in the
key |custom-line| a key |dotted| which will draw rounded dots. The initial
value of the key |total-width| is, in this case, equal to the diameter of the dots
@@ -1799,7 +1801,7 @@
New commands are available in that |\CodeBefore|: |\cellcolor|,
|\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors|,
|\rowlistcolors|, |\chessboardcolors| and |\arraycolor|.\footnote{Remark that,
-in the |\CodeBefore|, PGF/Tikz nodes of the form ``\verb+(i-|j)+'' are
+in the |\CodeBefore|, PGF/TikZ nodes of the form ``\verb+(i-|j)+'' are
also available to indicate the position to the potential rules:
cf.~p.~\pageref{nodes-i}.}
\label{code-before}
@@ -2571,7 +2573,7 @@
\bigskip
It's possible to give the special value |auto| to the option |columns-width|:
all the columns of the array will have a width equal to the widest cell of the
-array.\footnote{The result is achieved with only one compilation (but PGF/Tikz
+array.\footnote{The result is achieved with only one compilation (but PGF/TikZ
will have written informations in the |aux| file and a message requiring a
second compilation will appear).}\par\nobreak
@@ -2791,7 +2793,7 @@
\bigskip
Concerning \pkg{nicematrix}, one of the
interests of this type of columns is that, for a cell of a column of type~|V|,
-the PGF/Tikz node created by \pkg{nicematrix} for the content of that cell has
+the PGF/TikZ node created by \pkg{nicematrix} for the content of that cell has
a width adjusted to the content of the cell : cf. p.~\pageref{node-V}.
@@ -3452,7 +3454,7 @@
\textbf{The option \Definition{xdots/line-style}}\par\nobreak
\smallskip
-It should be pointed that, by default, the lines drawn by Tikz with the
+It should be pointed that, by default, the lines drawn by TikZ with the
parameter |dotted| are composed of square dots (and not rounded
ones).\footnote{The first reason of this behaviour is that the \textsc{pdf}
format includes a description for dashed lines. The lines specified with this
@@ -3461,7 +3463,7 @@
to create a line composed by square dots whereas a line of rounded dots needs
a specification of each dot in the \textsc{pdf} file. Nevertheless, you can
have a look at the following page to see how to have dotted rules with rounded
-dots in Tikz:\newline \small
+dots in TikZ:\newline \small
\url{https://tex.stackexchange.com/questions/52848/tikz-line-with-large-dots}}
\begin{BVerbatim}[baseline=c,boxwidth=9cm]
@@ -3473,12 +3475,12 @@
In order to provide lines with rounded dots in the style of those provided by
|\ldots| (at least with the \emph{Computer Modern} fonts), the package
\pkg{nicematrix} embeds its own system to draw a dotted line (and this system
-uses \textsc{pgf} and not Tikz). This style is called |standard| and that's
+uses \textsc{pgf} and not TikZ). This style is called |standard| and that's
the initial value of the parameter |xdots/line-style|.
-However (when Tikz is loaded) it's possible to use for |xdots/line-style| any style
-provided by Tikz, that is to say any sequence of options provided by Tikz for
-the Tizk pathes (with the exception of ``|color|'', ``|shorten >|'' and
+However (when TikZ is loaded) it's possible to use for |xdots/line-style| any style
+provided by TikZ, that is to say any sequence of options provided by TikZ for
+the TikZ pathes (with the exception of ``|color|'', ``|shorten >|'' and
``|shorten <|'').
\medskip
@@ -3642,7 +3644,7 @@
\medskip
-The experienced users may, for instance, use the PGF/Tikz nodes created by
+The experienced users may, for instance, use the PGF/TikZ nodes created by
\pkg{nicematrix} in the |\CodeAfter|. These nodes are described further
beginning on p.~\pageref{PGF-nodes}.
@@ -3935,7 +3937,7 @@
\bigskip
There is also a key |name| which gives a name to the submatrix created by
-|\SubMatrix|. That name is used to create PGF/Tikz nodes: cf
+|\SubMatrix|. That name is used to create PGF/TikZ nodes: cf
p.~\pageref{node-sub-matrix}.
@@ -4134,7 +4136,7 @@
\colorbox{yellow!50}{\textbf{New 6.24}}\enskip The command |\TikzEveryCell|
execute with TikZ the rectangular path corresponding to each cell of the tabular
with parameters of TikZ the argument of |\TikzEveryCell|. That argument must be
-a list of \textsl{key=value} pairs which may be applied to a Tikz path. In fact,
+a list of \textsl{key=value} pairs which may be applied to a TikZ path. In fact,
the command applies to each of the tabular, except those in the exterior rows
and columns (cf.~p.~\pageref{exterior}) and those in the empty corners (when the
key |corners| is used: cf.~p.~\pageref{corners}). It applies in fact to each
@@ -5089,19 +5091,19 @@
For an example of utilisation, see \url{tex.stackexchange.com/questions/488566}
-\section{Use of Tikz with nicematrix}
+\section{Use of TikZ with nicematrix}
\label{name}\label{PGF-nodes}
\index{tikza at TikZ (utilisation with \pkg{nicematrix})}
-\index{node@\textbf{Nodes of PGF/Tikz}|(}
+\index{node@\textbf{Nodes of PGF/TikZ|}(}
\subsection{The nodes corresponding to the contents of the cells}
-The package \pkg{nicematrix} creates a PGF/Tikz node\footnote{We recall that Tikz
+The package \pkg{nicematrix} creates a PGF/TikZ node\footnote{We recall that TikZ
is a layer over PGF. The extension \pkg{nicematrix} loads PGF but does not
-load Tikz. We speak of PGF/Tikz nodes to emphase the fact that the PGF nodes
-created by \pkg{nicematrix} may be used with PGF but also with Tikz. The final
-user will probably prefer to use Tikz rather than PGF.} for each (non-empty) cell
+load TikZ. We speak of PGF/TikZ nodes to emphase the fact that the PGF nodes
+created by \pkg{nicematrix} may be used with PGF but also with TikZ. The final
+user will probably prefer to use TikZ rather than PGF.} for each (non-empty) cell
of the considered array. These nodes are used to draw the dotted lines between
the cells of the matrix (inter alia).
@@ -5139,9 +5141,9 @@
nodes are accessible with the name ``\textsl{name}-$i$-$j$'' where \textsl{name}
is the name given to the array and $i$ and $j$ the numbers of row and column.
It's possible to use these nodes with \textsc{pgf} but the final user will
-probably prefer to use Tikz (which is a convenient layer upon \textsc{pgf}).
-However, one should remind that \pkg{nicematrix} doesn't load Tikz by default.
-In the following examples, we assume that Tikz has been loaded.
+probably prefer to use TikZ (which is a convenient layer upon \textsc{pgf}).
+However, one should remind that \pkg{nicematrix} doesn't load TikZ by default.
+In the following examples, we assume that TikZ has been loaded.
\bigskip
\begin{BVerbatim}[baseline=c,boxwidth=11cm]
@@ -5257,7 +5259,7 @@
When the extension \pkg{varwidth} is loaded, the columns of the type |V|
defined by \pkg{varwidth} are supported by \pkg{nicematrix}. It may be
-interessant to notice that, for a cell of a column of type |V|, the PGF/Tikz
+interessant to notice that, for a cell of a column of type |V|, the PGF/TikZ
node created by \pkg{nicematrix} for the content of that cell has a width
adjusted to the content of the cell. This is in contrast to the case of the
columns of type |p|, |m| or |b| for which the nodes have always a width equal
@@ -5562,7 +5564,7 @@
\subsection{The nodes which indicate the position of the rules}
\label{nodes-i}
-The package \pkg{nicematrix} creates a PGF/Tikz node merely called $i$ (with
+The package \pkg{nicematrix} creates a PGF/TikZ node merely called $i$ (with
the classical prefix) at the intersection of the horizontal rule of number~$i$
and the vertical rule of number~$i$ (more specifically the potential position
of those rules because maybe there are not actually drawn). The last node has
@@ -5589,8 +5591,8 @@
\end{center}
\bigskip
-If we use Tikz (we remind that \pkg{nicematrix} does not load Tikz by default,
-by only \textsc{pgf}, which is a sub-layer of Tikz), we can access, in the
+If we use TikZ (we remind that \pkg{nicematrix} does not load TikZ by default,
+by only \textsc{pgf}, which is a sub-layer of TikZ), we can access, in the
|\CodeAfter| but also in the |\CodeBefore|, to the intersection of the
(potential) horizontal rule~$i$ and the (potential) vertical rule~$j$ with the
syntax |(|$i$\verb+-|+$j$|)|.
@@ -5631,7 +5633,7 @@
\bigskip
The nodes of the form $i$|.5| may be used, for example to cross a row of a
-matrix (if Tikz is loaded).
+matrix (if TikZ is loaded).
\smallskip
\begin{BVerbatim}[boxwidth=11cm,baseline=c]
@@ -5665,7 +5667,7 @@
\smallskip
If a command |\SubMatrix| has been used with the key |name| with an expression
-such as |name=|\textsl{\ttfamily MyName} three PGF/Tikz nodes are created
+such as |name=|\textsl{\ttfamily MyName} three PGF/TikZ nodes are created
with the names \textsl{\ttfamily MyName}|-left|, \textsl{\ttfamily MyName} and
\textsl{\ttfamily MyName}|-right|.
@@ -5694,7 +5696,7 @@
\end{tikzpicture}
\end{pNiceMatrix}\]
-\index{node@\textbf{Nodes of PGF/Tikz}|)}
+\index{node@\textbf{Nodes of PGF/TikZ}|)}
\section{API for the developers}
@@ -5726,7 +5728,7 @@
\emph{Example} : We want to write a command |\crossbox| to draw a cross in the
current cell. This command will take in an optional argument between square
brackets for a list of pairs \textsl{key}-\textsl{value} which will be given to
-Tikz before the drawing.
+TikZ before the drawing.
It's possible to program such command |\crossbox| as follows, explicitely
using the public variable |\g_nicematrix_code_before_tl|.
@@ -5913,10 +5915,10 @@
\medskip
\item For the columns of type |p|, |m|, |b|, |V|\footnote{The columns of type
-|V| are provided by \pkg{varwidth}: cf.~p.~\pageref{varwidth}.} and
-|X|\footnote{See p.~\pageref{X-columns}}, the cell is empty if (and only if)
-its content in the TeX code is empty (there is only spaces between the
-ampersands |&|).
+ |V| are provided by \pkg{varwidth}, which must be loaded:
+ cf.~p.~\pageref{varwidth}.} and |X|\footnote{See p.~\pageref{X-columns}}, the
+cell is empty if (and only if) its content in the TeX code is empty (there is
+only spaces between the ampersands |&|).
\medskip
\item For the columns of type |c|, |l|, |r| and |w{...}{...}|, the cell is
@@ -5924,7 +5926,7 @@
\medskip
\item \indexcommand{NotEmpty}
-A cell containing the command |\NotEmpty| is not empty (and a PGF/Tikz
+A cell containing the command |\NotEmpty| is not empty (and a PGF/TikZ
node is created in that cell).
\medskip
@@ -5970,7 +5972,7 @@
\index{Incompatibilities}
The package \pkg{nicematrix} is not compatible with the class \cls{ieeeaccess}
-(because that class is not compatible with PGF/Tikz).\footnote{See
+(because that class is not compatible with PGF/TikZ).\footnote{See
\url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}
\bigskip
@@ -6017,17 +6019,17 @@
\section{Examples}
-\subsection[{Utilisation of the key 'tikz' of the command \textbackslash
-Block}]{Utilisation of the key ``tikz'' of the command \textbackslash Block}
+\subsection[{Utilisation of the key 'TikZ' of the command \textbackslash
+Block}]{Utilisation of the key ``TikZ'' of the command \textbackslash Block}
\label{tikz-key-examples}
\index{tikzz at tikz!key of \texttt{\textbackslash Block}|textit}
-The key |tikz| of the command |\Block| is available only when Tikz is
+The key |TikZ| of the command |\Block| is available only when TikZ is
loaded.\footnote{By default, \pkg{nicematrix} only loads \textsc{pgf}, which is
-a sub-layer of Tikz.}
+a sub-layer of TikZ.}
-For the following example, we also need the Tikz library |patterns|.
+For the following example, we also need the TikZ library |patterns|.
\begin{Verbatim}
\usetikzlibrary{patterns}
@@ -6414,7 +6416,7 @@
\interitem
In fact, it's even possible to draw solid lines with the commands |\Cdots|,
-|\Vdots|, etc.\footnote{In this document, the Tikz library \pkg{arrows.meta}
+|\Vdots|, etc.\footnote{In this document, the TikZ library \pkg{arrows.meta}
has been loaded, which impacts the shape of the arrow tips.}
\begin{Verbatim}
@@ -6483,7 +6485,7 @@
\index{tikzz at tikz!key of ``borders'' de \texttt{\textbackslash Block}|textit}
In the following example, we use the command |\Block| to draw dashed rules.
-For that example, Tikz should be loaded (by |\usepackage{tikz}|).
+For that example, TikZ should be loaded (by |\usepackage{tikz}|).
\begin{Verbatim}
@@ -6895,8 +6897,8 @@
method to highlight a row of the matrix.
\medskip
-That example and the following ones require Tikz (by default, \pkg{nicematrix}
-only loads \textsc{pgf}, which is a sub-layer of Tikz) and the Tikz library
+That example and the following ones require TikZ (by default, \pkg{nicematrix}
+only loads \textsc{pgf}, which is a sub-layer of TikZ) and the TikZ library
|fit|. The following lines in the preamble of your document do the job:
\begin{verbatim}
\usepackage{tikz}
@@ -6904,8 +6906,8 @@
\end{verbatim}
\medskip
-We create a rectangular Tikz node which encompasses the nodes of the second
-row by using the tools of the Tikz library \pkg{fit}. Those nodes are not
+We create a rectangular TikZ node which encompasses the nodes of the second
+row by using the tools of the TikZ library \pkg{fit}. Those nodes are not
available by default in the |\CodeBefore| (for efficiency). We have to require
their creation with the key |create-cell-nodes| of the keyword |\CodeBefore|.
@@ -7259,7 +7261,7 @@
\subsection*{Changes between version 6.16 and 6.17}
-New PGF/Tikz style |nicematrix/cell-node|.
+New PGF/TikZ style |nicematrix/cell-node|.
New key |pgf-node-code|
@@ -7461,7 +7463,7 @@
\subsection*{Changes between versions 5.10 and 5.11}
It's now possible, in the |code-before| and in the |\CodeAfter|, to use the
-syntax \verb+|(i-|j)+ for the Tikz node at the intersection of the (potential)
+syntax \verb+|(i-|j)+ for the TikZ node at the intersection of the (potential)
horizontal rule number~$i$ and the (potential) vertical rule number~$j$.
\subsection*{Changes between versions 5.9 and 5.10}
@@ -7473,7 +7475,7 @@
\subsection*{Changes between versions 5.8 and 5.9}
Correction of a bug: in the previous versions, it was not possible to use the
-key |line-style| for the continuous dotted lines when the Tikz library |babel|
+key |line-style| for the continuous dotted lines when the TikZ library |babel|
was loaded.
New key |cell-space-limits|.
@@ -7615,8 +7617,8 @@
it's possible to use the options |l| (=|L|) or |r| (=|R|) to specify the type
of the columns.
-The code of \pkg{nicematrix} no longer uses Tikz but only \textsc{pgf}. By
-default, Tikz is \emph{not} loaded by \pkg{nicematrix}.
+The code of \pkg{nicematrix} no longer uses TikZ but only \textsc{pgf}. By
+default, TikZ is \emph{not} loaded by \pkg{nicematrix}.
\subsection*{Changes between versions 3.11 and 3.12}
@@ -7626,7 +7628,7 @@
Option |baseline| pour |{NiceArray}| (not for the other environments).
-The name of the Tikz nodes created by the command |\Block| has changed: when
+The name of the TikZ nodes created by the command |\Block| has changed: when
the command has been issued in the cell $i$|-|$j$, the name is
$i$|-|$j$|-block| and, if the creation of the ``medium nodes'' is required, a
node $i$|-|$j$|-block-medium| is created.
@@ -7695,7 +7697,7 @@
Following a discussion on TeX StackExchange\footnote{cf.
|tex.stackexchange.com/questions/510841/nicematrix-and-tikz-external-optimize|},
-optimization of Tikz externalization is disabled in the environments of
+optimization of TikZ externalization is disabled in the environments of
\pkg{nicematrix} when the class \cls{standalone} or the package
\pkg{standalone} is used.
@@ -7792,10 +7794,10 @@
Following a discussion on
TeX StackExchange\footnote{cf.
|tex.stackexchange.com/questions/450841/tikz-externalize-and-nicematrix-package|},
-Tikz externalization is now deactivated in the environments of the
+TikZ externalization is now deactivated in the environments of the
package \pkg{nicematrix}.\footnote{Before this version, there was an error
-when using \pkg{nicematrix} with Tikz externalization. In any case, it's not
-possible to externalize the Tikz elements constructed by \pkg{nicematrix}
+when using \pkg{nicematrix} with TikZ externalization. In any case, it's not
+possible to externalize the TikZ elements constructed by \pkg{nicematrix}
because they use the options |overlay| and |remember picture|.}
\subsection*{Changes between version 2.0 and 2.1}
@@ -7841,7 +7843,7 @@
\subsection*{Changes between versions 1.0 and 1.1}
-The dotted lines are no longer drawn with Tikz nodes but with Tikz circles
+The dotted lines are no longer drawn with TikZ nodes but with TikZ circles
(for efficiency).
Modification of the code which is now twice faster.
Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx 2023-12-04 22:08:27 UTC (rev 69033)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx 2023-12-04 22:09:00 UTC (rev 69034)
@@ -17,8 +17,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.26}
-\def\myfiledate{2023/11/22}
+\def\myfileversion{6.26a}
+\def\myfiledate{2023/12/04}
%
%
%<*batchfile>
@@ -205,8 +205,8 @@
\bool_new:N \g_@@_messages_for_Overleaf_bool
\bool_gset:Nn \g_@@_messages_for_Overleaf_bool
{
- \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs
- || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf
+ \str_if_eq_p:on \c_sys_jobname_str { _region_ } % for Emacs
+ || \str_if_eq_p:on \c_sys_jobname_str { output } % for Overleaf
}
% \end{macrocode}
%
@@ -370,6 +370,27 @@
% \bigskip
% \section{Technical definitions}
%
+%
+% The following constants are defined only for efficiency in the tests.
+% \begin{macrocode}
+\tl_const:Nn \c_@@_b_tl { b }
+\tl_const:Nn \c_@@_c_tl { c }
+\tl_const:Nn \c_@@_l_tl { l }
+\tl_const:Nn \c_@@_r_tl { r }
+\tl_const:Nn \c_@@_all_tl { all }
+\tl_const:Nn \c_@@_dot_tl { . }
+\tl_const:Nn \c_@@_default_tl { default }
+\tl_const:Nn \c_@@_star_tl { * }
+\str_const:Nn \c_@@_r_str { r }
+\str_const:Nn \c_@@_c_str { c }
+\str_const:Nn \c_@@_l_str { l }
+\str_const:Nn \c_@@_R_str { R }
+\str_const:Nn \c_@@_C_str { C }
+\str_const:Nn \c_@@_L_str { L }
+\str_const:Nn \c_@@_j_str { j }
+\str_const:Nn \c_@@_si_str { si }
+% \end{macrocode}
+%
% The following token list will be used for definitions of user commands (with
% |\NewDocumentCommand|) with an embellishment using an \emph{underscore} (there
% may be problems because of the catcode of the underscore).
@@ -474,12 +495,12 @@
\mathinner
{
\tex_mkern:D 1 mu
- \box_move_up:nn { 1 pt } { \hbox:n { . } }
+ \box_move_up:nn { 1 pt } { \hbox { . } }
\tex_mkern:D 2 mu
- \box_move_up:nn { 4 pt } { \hbox:n { . } }
+ \box_move_up:nn { 4 pt } { \hbox { . } }
\tex_mkern:D 2 mu
\box_move_up:nn { 7 pt }
- { \vbox:n { \kern 7 pt \hbox:n { . } } }
+ { \vbox:n { \kern 7 pt \hbox { . } } }
\tex_mkern:D 1 mu
}
}
@@ -536,7 +557,7 @@
\cs_set:Npn \CT at arc #1 #2
{
\dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
- { \cs_gset:Npn \CT at arc@ { \color #1 { #2 } } }
+ { \cs_gset_nopar:Npn \CT at arc@ { \color #1 { #2 } } }
}
% \end{macrocode}
% Idem for |\CT at drs@|.
@@ -570,7 +591,8 @@
\cs_set:Npn \@@_standard_cline:w #1-#2 \q_stop
{
\int_if_zero:nT \l_@@_first_col_int { \omit & }
- \int_compare:nNnT { #1 } > 1 { \multispan { \int_eval:n { #1 - 1 } } & }
+ \int_compare:nNnT { #1 } > \c_one_int
+ { \multispan { \int_eval:n { #1 - 1 } } & }
\multispan { \int_eval:n { #2 - #1 + 1 } }
{
\CT at arc@
@@ -647,10 +669,10 @@
%
%
% \bigskip
-% The following command is a small shortcut.
+% The following command will be nullified in the environment |{NiceTabular}|,
+% |{NiceTabular*}| and |{NiceTabularX}|.
% \begin{macrocode}
-\cs_new:Npn \@@_math_toggle_token:
- { \bool_if:NF \l_@@_tabular_bool \c_math_toggle_token }
+\cs_set_eq:NN \@@_math_toggle: \c_math_toggle_token
% \end{macrocode}
%
% \bigskip
@@ -664,7 +686,7 @@
{ \cs_set:Npn \CT at arc@ { \color { #1 } } }
}
}
-\cs_generate_variant:Nn \@@_set_CT at arc@:n { V }
+\cs_generate_variant:Nn \@@_set_CT at arc@:n { o }
% \end{macrocode}
%
% \bigskip
@@ -675,7 +697,7 @@
{ \cs_set:Npn \CT at drsc@ { \color #1 } }
{ \cs_set:Npn \CT at drsc@ { \color { #1 } } }
}
-\cs_generate_variant:Nn \@@_set_CT at drsc@:n { V }
+\cs_generate_variant:Nn \@@_set_CT at drsc@:n { o }
% \end{macrocode}
%
% \bigskip
@@ -688,7 +710,7 @@
{ #1 #2 }
{ #1 { #2 } }
}
-\cs_generate_variant:Nn \@@_exp_color_arg:Nn { N V }
+\cs_generate_variant:Nn \@@_exp_color_arg:Nn { N o }
% \end{macrocode}
%
% The following command must be protected because of its use of the command |\color|.
@@ -695,7 +717,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_color:n #1
{ \tl_if_blank:nF { #1 } { \@@_exp_color_arg:Nn \color { #1 } } }
-\cs_generate_variant:Nn \@@_color:n { V }
+\cs_generate_variant:Nn \@@_color:n { o }
% \end{macrocode}
%
% \bigskip
@@ -776,10 +798,10 @@
\hook_gput_code:nnn { begindocument } { . }
{
\bool_if:NTF \c_@@_revtex_bool
- { \cs_new_protected:Npn \@@_redefine_mkpream: { } }
+ { \cs_set_eq:NN \@@_redefine_mkpream: \prg_do_nothing: }
{
\IfPackageLoadedTF { arydshln }
- { \cs_new_protected:Npn \@@_redefine_mkpream: { } }
+ { \cs_set_eq:NN \@@_redefine_mkpream: \prg_do_nothing: }
{
\cs_new_protected:Npn \@@_redefine_mkpream:
{ \cs_set_eq:NN \@mkpream \@@_mkpream: }
@@ -954,9 +976,10 @@
% |r|, |l|, |c| and |j|. For example, a column |p[l]{3cm}| will provide the
% value |l| for all the cells of the column.
% \begin{macrocode}
-\str_new:N \l_@@_hpos_cell_str
-\str_set:Nn \l_@@_hpos_cell_str { c }
+\tl_new:N \l_@@_hpos_cell_tl
+\tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_c_tl
% \end{macrocode}
+%
%
% \bigskip
% When there is a mono-column block (created by the command |\Block|), we want
@@ -974,13 +997,6 @@
\dim_new:N \g_@@_blocks_ht_dim
\dim_new:N \g_@@_blocks_dp_dim
% \end{macrocode}
-%
-% \bigskip
-% The following dimension will be used by the command |\Block| for the blocks
-% with a key of vertical position equal to |T| or |B|.
-% \begin{macrocode}
-\dim_new:N \l_@@_block_ysep_dim
-% \end{macrocode}
%
% \bigskip
% The following dimension correspond to the key |width| (which may be fixed in
@@ -1110,7 +1126,7 @@
% |matrix / columns-type| of |\NiceMatrixOptions|.
% \begin{macrocode}
\tl_new:N \l_@@_columns_type_tl
-\tl_set:Nn \l_@@_columns_type_tl { c }
+\str_set:Nn \l_@@_columns_type_tl { c }
% \end{macrocode}
%
% \bigskip
@@ -1201,15 +1217,6 @@
\tl_new:N \l_@@_pgf_node_code_tl
% \end{macrocode}
%
-% \bigskip
-% The following token list has a function similar to
-% |\g_nicematrix_code_after_tl| but it is used internally by \pkg{nicematrix}.
-% In fact, we have to distinguish between |\g_nicematrix_code_after_tl| and
-% |\g_@@_pre_code_after_tl| because we must take care of the order in which
-% instructions stored in that parameters are executed.
-% \begin{macrocode}
-
-% \end{macrocode}
%
% \bigskip
% The so-called |\CodeBefore| is splitted in two parts because we want to control
@@ -1462,8 +1469,17 @@
\int_new:N \l_@@_col_min_int
\int_new:N \l_@@_col_max_int
% \end{macrocode}
-%
% \medskip
+% The following counters will be used when drawing the rules.
+% \begin{macrocode}
+\int_new:N \l_@@_start_int
+\int_set_eq:NN \l_@@_start_int \c_one_int
+\int_new:N \l_@@_end_int
+\int_new:N \l_@@_local_start_int
+\int_new:N \l_@@_local_end_int
+% \end{macrocode}
+%
+% \medskip
% The following sequence will be used when the command |\SubMatrix| is used in
% the |\CodeBefore| (and not in the |\CodeAfter|). It will contain the position of
% all the sub-matrices specified in the |\CodeBefore|. Each sub-matrix is
@@ -1552,8 +1568,8 @@
% \medskip
% For the vertical position, the possible values are |c|, |t| and |b|.
% \begin{macrocode}
-\str_new:N \l_@@_vpos_of_block_str
-\str_set:Nn \l_@@_vpos_of_block_str { c }
+\str_new:N \l_@@_vpos_block_str
+\str_set:Nn \l_@@_vpos_block_str { c }
% \end{macrocode}
%
%
@@ -1640,7 +1656,7 @@
% the value will be~$0$.
% \begin{macrocode}
\int_new:N \l_@@_first_col_int
-\int_set:Nn \l_@@_first_col_int 1
+\int_set_eq:NN \l_@@_first_col_int \c_one_int
% \end{macrocode}
%
% \medskip
@@ -1720,8 +1736,8 @@
% \begin{macrocode}
\cs_set_protected:Npn \@@_cut_on_hyphen:w #1-#2\q_stop
{
- \tl_set:Nn \l_tmpa_tl { #1 }
- \tl_set:Nn \l_tmpb_tl { #2 }
+ \cs_set_nopar:Npn \l_tmpa_tl { #1 }
+ \cs_set_nopar:Npn \l_tmpb_tl { #2 }
}
% \end{macrocode}
%
@@ -1733,7 +1749,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_expand_clist:N #1
{
- \clist_if_in:NnF #1 { all }
+ \clist_if_in:NVF #1 \c_@@_all_tl
{
\clist_clear:N \l_tmpa_clist
\clist_map_inline:Nn #1
@@ -1741,8 +1757,8 @@
\tl_if_in:nnTF { ##1 } { - }
{ \@@_cut_on_hyphen:w ##1 \q_stop }
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
- \tl_set:Nn \l_tmpb_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpb_tl { ##1 }
}
\int_step_inline:nnn { \l_tmpa_tl } { \l_tmpb_tl }
{ \clist_put_right:Nn \l_tmpa_clist { ####1 } }
@@ -1929,14 +1945,15 @@
% \begin{macrocode}
\NewDocumentCommand \tabularnote { o m }
{
- \bool_if:nT { \cs_if_exist_p:N \@captype || \l_@@_in_env_bool }
+ \bool_lazy_or:nnT { \cs_if_exist_p:N \@captype } \l_@@_in_env_bool
{
- \bool_if:nTF { ! \l_@@_tabular_bool && \l_@@_in_env_bool }
+ \bool_lazy_and:nnTF { ! \l_@@_tabular_bool } \l_@@_in_env_bool
{ \@@_error:n { tabularnote~forbidden } }
{
\bool_if:NTF \l_@@_in_caption_bool
- { \@@_tabularnote_caption:nn { #1 } { #2 } }
- { \@@_tabularnote:nn { #1 } { #2 } }
+ \@@_tabularnote_caption:nn
+ \@@_tabularnote:nn
+ { #1 } { #2 }
}
}
}
@@ -2017,7 +2034,7 @@
% 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 an overlapping position if we are at the end of a cell when
-% |\l_@@_hpos_cell_str| is equal to |c| or |r|.
+% |\l_@@_hpos_cell_tl| is equal to |c| or |r|.
% \begin{macrocode}
\hbox_set:Nn \l_tmpa_box
{
@@ -2034,7 +2051,7 @@
% \end{macrocode}
% We want the (last) tabular note referenceable (with the standard command |\label|).
% \begin{macrocode}
- \int_gsub:Nn \c at tabularnote { 1 }
+ \int_gdecr:N \c at tabularnote
\int_set_eq:NN \l_tmpa_int \c at tabularnote
\refstepcounter { tabularnote }
\int_compare:nNnT \l_tmpa_int = \c at tabularnote
@@ -2041,8 +2058,8 @@
{ \int_gincr:N \c at tabularnote }
\seq_clear:N \l_@@_notes_labels_seq
\bool_lazy_or:nnTF
- { \str_if_eq_p:Vn \l_@@_hpos_cell_str { c } }
- { \str_if_eq_p:Vn \l_@@_hpos_cell_str { r } }
+ { \tl_if_eq_p:NN \l_@@_hpos_cell_tl \c_@@_c_tl }
+ { \tl_if_eq_p:NN \l_@@_hpos_cell_tl \c_@@_r_tl }
{
\hbox_overlap_right:n { \box_use:N \l_tmpa_box }
% \end{macrocode}
@@ -2071,8 +2088,7 @@
{
\bool_if:NTF \g_@@_caption_finished_bool
{
- \int_compare:nNnT
- \c at tabularnote = \g_@@_notes_caption_int
+ \int_compare:nNnT \c at tabularnote = \g_@@_notes_caption_int
{ \int_gzero:N \c at tabularnote }
% \end{macrocode}
% Now, we try to detect duplicate notes in the caption.
@@ -2354,10 +2370,10 @@
% \end{macrocode}
%
% \medskip
-% The following flag corresponds to the key |respect-arraystretch| (that key has
-% an effect on the blocks).
+% When the key |respect-arraystretch| is used, the following command will be nullified.
% \begin{macrocode}
-\bool_new:N \l_@@_respect_arraystretch_bool
+\cs_new_protected:Npn \@@_reset_arraystretch:
+ { \cs_set_nopar:Npn \arraystretch { 1 } }
% \end{macrocode}
%
%
@@ -2596,13 +2612,13 @@
hvlines .code:n =
{
\bool_set_true:N \l_@@_hvlines_bool
- \clist_set:Nn \l_@@_vlines_clist { all }
- \clist_set:Nn \l_@@_hlines_clist { all }
+ \tl_set_eq:NN \l_@@_vlines_clist \c_@@_all_tl
+ \tl_set_eq:NN \l_@@_hlines_clist \c_@@_all_tl
} ,
hvlines-except-borders .code:n =
{
- \clist_set:Nn \l_@@_vlines_clist { all }
- \clist_set:Nn \l_@@_hlines_clist { all }
+ \tl_set_eq:NN \l_@@_vlines_clist \c_@@_all_tl
+ \tl_set_eq:NN \l_@@_hlines_clist \c_@@_all_tl
\bool_set_true:N \l_@@_hvlines_bool
\bool_set_true:N \l_@@_except_borders_bool
} ,
@@ -2632,8 +2648,9 @@
extra-margin .meta:n =
{ extra-left-margin = #1 , extra-right-margin = #1 } ,
extra-margin .value_required:n = true ,
- respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool ,
- respect-arraystretch .default:n = true ,
+ respect-arraystretch .code:n =
+ \cs_set_eq:NN \@@_reset_arraystretch: \prg_do_nothing: ,
+ respect-arraystretch .value_forbidden:n = true ,
pgf-node-code .tl_set:N = \l_@@_pgf_node_code_tl ,
pgf-node-code .value_required:n = true
}
@@ -3051,50 +3068,75 @@
% the |\everycr| because some packages, like \pkg{arydshln}, create special rows
% in the |\halign| that we don't want to take into account.
% \begin{macrocode}
- \int_compare:nNnT \c at jCol = 1
- { \int_compare:nNnT \l_@@_first_col_int = 1 \@@_begin_of_row: }
+ \int_compare:nNnT \c at jCol = \c_one_int
+ { \int_compare:nNnT \l_@@_first_col_int = \c_one_int \@@_begin_of_row: }
% \end{macrocode}
% The content of the cell is composed in the box |\l_@@_cell_box|. The
-% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the
-% |\@@_cell_end:| (and the potential |\c_math_toggle_token| also).
+% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| is in the
+% |\@@_cell_end:|.
% \begin{macrocode}
\hbox_set:Nw \l_@@_cell_box
- \bool_if:NF \l_@@_tabular_bool
- {
- \c_math_toggle_token
- \bool_if:NT \l_@@_small_bool \scriptstyle
- }
% \end{macrocode}
+% The following command is nullified in the tabulars.
+% \begin{macrocode}
+ \@@_tuning_not_tabular_begin:
+% \end{macrocode}
%
% \begin{macrocode}
+ \@@_tuning_first_row:
+ \@@_tuning_last_row:
\g_@@_row_style_tl
+ }
% \end{macrocode}
-%
-% We will call \emph{corners} of the matrix the cases which are at the
-% intersection of the exterior rows and exterior columns (of course, the four
-% corners doesn't always exist simultaneously).
%
-% The codes |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the
-% corners of the matrix.
+% The following command will be nullified unless there is a first row.
% \begin{macrocode}
- \int_if_zero:nTF \c at iRow
+\cs_new_protected:Npn \@@_tuning_first_row:
+ {
+ \int_if_zero:nT \c at iRow
{
- \int_compare:nNnT \c at jCol > 0
+ \int_compare:nNnT \c at jCol > \c_zero_int
{
\l_@@_code_for_first_row_tl
\xglobal \colorlet { nicematrix-first-row } { . }
}
}
+ }
+% \end{macrocode}
+%
+% The following command will be nullified unless there is a last row and we
+% know its value (\emph{ie}: |\l_@@_lat_row_int > 0|).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_tuning_last_row:
+ {
+ \int_compare:nNnT \c at iRow = \l_@@_last_row_int
{
- \int_compare:nNnT \c at iRow = \l_@@_last_row_int
- {
- \l_@@_code_for_last_row_tl
- \xglobal \colorlet { nicematrix-last-row } { . }
- }
+ \l_@@_code_for_last_row_tl
+ \xglobal \colorlet { nicematrix-last-row } { . }
}
}
% \end{macrocode}
+%
+% A different value will be provided to the following command when the key
+% |small| is in force.
+% \begin{macrocode}
+\cs_set_eq:NN \@@_tuning_key_small: \prg_do_nothing:
+% \end{macrocode}
%
+% The following commands are nullified in the tabulars.
+% \begin{macrocode}
+\cs_set_nopar:Npn \@@_tuning_not_tabular_begin:
+ {
+ \c_math_toggle_token
+% \end{macrocode}
+% A special value is provided by the following controls sequence when the key
+% |small| is in force.
+% \begin{macrocode}
+ \@@_tuning_key_small:
+ }
+\cs_set_eq:NN \@@_tuning_not_tabular_end: \c_math_toggle_token
+% \end{macrocode}
+%
% \interitem
% The following macro |\@@_begin_of_row| is usually used in the cell
% number~$1$ of the row. However, when the key |first-col| is used,
@@ -3140,7 +3182,7 @@
{ \dim_max:nn \g_@@_ht_row_zero_dim { \box_ht:N \l_@@_cell_box } }
}
{
- \int_compare:nNnT \c at iRow = 1
+ \int_compare:nNnT \c at iRow = \c_one_int
{
\dim_gset:Nn \g_@@_ht_row_one_dim
{ \dim_max:nn \g_@@_ht_row_one_dim { \box_ht:N \l_@@_cell_box } }
@@ -3204,8 +3246,11 @@
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_cell_end:
- {
- \@@_math_toggle_token:
+ {
+% \end{macrocode}
+% The following command is nullified in the tabulars.
+% \begin{macrocode}
+ \@@_tuning_not_tabular_end:
\hbox_set_end:
\@@_cell_end_i:
}
@@ -3273,11 +3318,14 @@
\bool_if:NTF \g_@@_empty_cell_bool
{ \box_use_drop:N \l_@@_cell_box }
{
- \bool_lazy_or:nnTF
+ \bool_if:NTF
\g_@@_not_empty_cell_bool
- { \dim_compare_p:nNn { \box_wd:N \l_@@_cell_box } > \c_zero_dim }
\@@_node_for_cell:
- { \box_use_drop:N \l_@@_cell_box }
+ {
+ \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim
+ \@@_node_for_cell:
+ { \box_use_drop:N \l_@@_cell_box }
+ }
}
\int_gset:Nn \g_@@_col_total_int { \int_max:nn \g_@@_col_total_int \c at jCol }
\bool_gset_false:N \g_@@_empty_cell_bool
@@ -3302,7 +3350,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_cell_end_for_w_s:
{
- \@@_math_toggle_token:
+ \@@_math_toggle:
\hbox_set_end:
\bool_if:NF \g_@@_rotate_bool
{
@@ -3569,7 +3617,7 @@
% \begin{macrocode}
\tl_if_empty:NF \l_@@_hlines_clist
{
- \tl_if_eq:NnF \l_@@_hlines_clist { all }
+ \tl_if_eq:NNF \l_@@_hlines_clist \c_@@_all_tl
{
\exp_args:NNe
\clist_if_in:NnT
@@ -3704,6 +3752,10 @@
% \begin{macrocode}
\cs_set_nopar:Npn \arraystretch { 0.47 }
\dim_set:Nn \arraycolsep { 1.45 pt }
+% \end{macrocode}
+% By default, |\@@_small_scripstyle:| is null.
+% \begin{macrocode}
+ \cs_set_eq:NN \@@_tuning_key_small: \scriptstyle
}
% \end{macrocode}
%
@@ -3799,6 +3851,10 @@
\cs_set_eq:NN \rowcolor \@@_rowcolor_tabular
\cs_set_eq:NN \rowcolors \@@_rowcolors_tabular
\cs_set_eq:NN \rowlistcolors \@@_rowlistcolors_tabular
+ \int_compare:nNnT \l_@@_first_row_int > \c_zero_int
+ { \cs_set_eq:NN \@@_tuning_first_row: \prg_do_nothing: }
+ \int_compare:nNnT \l_@@_last_row_int < \c_zero_int
+ { \cs_set_eq:NN \@@_tuning_last_row: \prg_do_nothing: }
\bool_if:NT \l_@@_renew_dots_bool \@@_renew_dots:
% \end{macrocode}
% We redefine |\multicolumn| and, since we want |\multicolumn| to be available
@@ -4494,7 +4550,7 @@
%
% \bigskip
% \begin{macrocode}
- \@@_set_CT at arc@:V \l_@@_rules_color_tl
+ \@@_set_CT at arc@:o \l_@@_rules_color_tl
% \end{macrocode}
%
% \bigskip
@@ -4540,7 +4596,7 @@
% |X|-column of weight~$n$, the width will be |\l_@@_X_columns_dim| multiplied
% by~$n$.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_total_X_weight_int > 0
+ \int_compare:nNnT \g_@@_total_X_weight_int > \c_zero_int
{
\tl_build_gput_right:Nx \g_@@_aux_tl
{
@@ -4593,7 +4649,7 @@
% has the number~$0$.}
% \begin{macrocode}
\int_gset_eq:NN \c at jCol \g_@@_col_total_int
- \bool_if:nTF \g_@@_last_col_found_bool
+ \bool_if:NTF \g_@@_last_col_found_bool
{ \int_gdecr:N \c at jCol }
{
\int_compare:nNnT \l_@@_last_col_int > { -1 }
@@ -4617,10 +4673,7 @@
% p.~\pageref{overlap-left}).
% \begin{macrocode}
\int_if_zero:nT \l_@@_first_col_int
- {
- % \skip_horizontal:N \col at sep % 05-08-23
- \skip_horizontal:N \g_@@_width_first_col_dim
- }
+ { \skip_horizontal:N \g_@@_width_first_col_dim }
% \end{macrocode}
%
% The construction of the real box is different whether we have delimiters to
@@ -4628,12 +4681,13 @@
% \begin{macrocode}
\bool_if:nTF { ! \g_@@_delims_bool }
{
- \str_case:VnF \l_@@_baseline_tl
- {
- b \@@_use_arraybox_with_notes_b:
- c \@@_use_arraybox_with_notes_c:
+ \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_c_tl
+ \@@_use_arraybox_with_notes_c:
+ {
+ \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_b_tl
+ \@@_use_arraybox_with_notes_b:
+ \@@_use_arraybox_with_notes:
}
- \@@_use_arraybox_with_notes:
}
% \end{macrocode}
%
@@ -4669,7 +4723,7 @@
\hbox_set:Nn \l_tmpa_box
{
\c_math_toggle_token
- \@@_color:V \l_@@_delimiters_color_tl
+ \@@_color:o \l_@@_delimiters_color_tl
\exp_after:wN \left \g_@@_left_delim_tl
\vcenter
{
@@ -4692,14 +4746,9 @@
% We take into account the ``last row'' (we have previously computed its total
% height in |\l_tmpb_dim|).
% \begin{macrocode}
- \skip_vertical:n { -\l_tmpb_dim + \arrayrulewidth }
+ \skip_vertical:N -\l_tmpb_dim
+ \skip_vertical:N \arrayrulewidth
}
-% \end{macrocode}
-% Curiously, we have to put again the following specification of color.
-% Otherwise, with XeLaTeX (and not with the other engines), the closing
-% delimiter is not colored.
-% \begin{macrocode}
- \@@_color:V \l_@@_delimiters_color_tl
\exp_after:wN \right \g_@@_right_delim_tl
\c_math_toggle_token
}
@@ -4713,7 +4762,8 @@
\bool_if:NTF \l_@@_delimiters_max_width_bool
{
\@@_put_box_in_flow_bis:nn
- \g_@@_left_delim_tl \g_@@_right_delim_tl
+ \g_@@_left_delim_tl
+ \g_@@_right_delim_tl
}
\@@_put_box_in_flow:
}
@@ -4724,10 +4774,7 @@
% |\g_@@_width_last_col_dim|: see p.~\pageref{overlap-right}).
% \begin{macrocode}
\bool_if:NT \g_@@_last_col_found_bool
- {
- \skip_horizontal:N \g_@@_width_last_col_dim
- % \skip_horizontal:N \col at sep % 2023-08-05
- }
+ { \skip_horizontal:N \g_@@_width_last_col_dim }
\bool_if:NT \l_@@_preamble_bool
{
\int_compare:nNnT \c at jCol < \g_@@_static_num_of_col_int
@@ -4752,7 +4799,7 @@
\iow_now:Nx \@mainaux
{
\tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl }
- { \exp_not:V \g_@@_aux_tl }
+ { \exp_not:o \g_@@_aux_tl }
}
\iow_now:Nn \@mainaux { \ExplSyntaxOff }
% \end{macrocode}
@@ -4809,7 +4856,7 @@
% \begin{macrocode}
\int_zero:N \l_tmpa_int
\tl_gclear:N \g_@@_array_preamble_tl
- \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+ \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl
{
\tl_gset:Nn \g_@@_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -4869,9 +4916,11 @@
% If there were delimiters at the beginning or at the end of the preamble, the
% environment |{NiceArray}| is transformed into an environment |{xNiceMatrix}|.
% \begin{macrocode}
- \bool_lazy_or:nnT
- { ! \str_if_eq_p:Vn \g_@@_left_delim_tl { . } }
- { ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } }
+ \tl_if_eq:NNTF \g_@@_left_delim_tl \c_@@_dot_tl
+ {
+ \tl_if_eq:NNF \g_@@_right_delim_tl \c_@@_dot_tl
+ { \bool_gset_true:N \g_@@_delims_bool }
+ }
{ \bool_gset_true:N \g_@@_delims_bool }
% \end{macrocode}
%
@@ -4885,28 +4934,34 @@
% We complete the preamble with the potential ``exterior columns'' (on both sides).
% \begin{macrocode}
\int_if_zero:nTF \l_@@_first_col_int
- { \tl_gput_left:NV \g_@@_array_preamble_tl \c_@@_preamble_first_col_tl }
+ { \tl_gput_left:No \g_@@_array_preamble_tl \c_@@_preamble_first_col_tl }
{
- \bool_lazy_all:nT
+ \bool_if:NF \g_@@_delims_bool
{
- { \bool_not_p:n \g_@@_delims_bool }
- { \bool_not_p:n \l_@@_tabular_bool }
- { \tl_if_empty_p:N \l_@@_vlines_clist }
- { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
+ \bool_if:NF \l_@@_tabular_bool
+ {
+ \tl_if_empty:NT \l_@@_vlines_clist
+ {
+ \bool_if:NF \l_@@_exterior_arraycolsep_bool
+ { \tl_gput_left:Nn \g_@@_array_preamble_tl { @ { } } }
+ }
+ }
}
- { \tl_gput_left:Nn \g_@@_array_preamble_tl { @ { } } }
}
\int_compare:nNnTF \l_@@_last_col_int > { -1 }
- { \tl_gput_right:NV \g_@@_array_preamble_tl \c_@@_preamble_last_col_tl }
+ { \tl_gput_right:No \g_@@_array_preamble_tl \c_@@_preamble_last_col_tl }
{
- \bool_lazy_all:nT
+ \bool_if:NF \g_@@_delims_bool
{
- { \bool_not_p:n \g_@@_delims_bool }
- { \bool_not_p:n \l_@@_tabular_bool }
- { \tl_if_empty_p:N \l_@@_vlines_clist }
- { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
+ \bool_if:NF \l_@@_tabular_bool
+ {
+ \tl_if_empty:NT \l_@@_vlines_clist
+ {
+ \bool_if:NF \l_@@_exterior_arraycolsep_bool
+ { \tl_gput_right:Nn \g_@@_array_preamble_tl { @ { } } }
+ }
+ }
}
- { \tl_gput_right:Nn \g_@@_array_preamble_tl { @ { } } }
}
% \end{macrocode}
% We add a last column to raise a good error message when the user puts more
@@ -4926,7 +4981,7 @@
% The preamble provided by the final user will be read by a finite
% automata. The following function |\@@_rec_preamble:n| will read that preamble
% (usually letter by letter) in a recursive way (hence the name of that function).
-% in the preamble and
+% in the preamble.
% \begin{macrocode}
\cs_new_protected:Npn \@@_rec_preamble:n #1
{
@@ -4935,7 +4990,7 @@
% calling directly a function in the main hashtable of TeX (thanks to the
% mechanism |\csname...\endcsname|. Be careful: all these functions take in as
% first argument the letter (or token) itself.\footnote{We do that because it's
-% a easy way to insert the letter at some places in the code that we will add to
+% an easy way to insert the letter at some places in the code that we will add to
% |\g_@@_array_preamble_tl|.}
% \begin{macrocode}
\cs_if_exist:cTF { @@ _ \token_to_str:N #1 }
@@ -4965,23 +5020,47 @@
% \begin{macrocode}
\cs_new:Npn \@@_c #1
{
- \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
\tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_array_preamble_tl
+ { > \@@_cell_begin:w c < \@@_cell_end: }
+% \end{macrocode}
+%
+% We increment the counter of columns and then we test for the presence of a |<|.
+% \begin{macrocode}
+ \int_gincr:N \c at jCol
+ \@@_rec_preamble_after_col:n
+ }
+% \end{macrocode}
+% \begin{macrocode}
+\cs_new:Npn \@@_l #1
+ {
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gclear:N \g_@@_pre_cell_tl
+ \tl_gput_right:Nn \g_@@_array_preamble_tl
{
- > { \@@_cell_begin:w \str_set:Nn \l_@@_hpos_cell_str { #1 } }
- #1
+ > { \@@_cell_begin:w \tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_l_tl }
+ l
< \@@_cell_end:
}
+ \int_gincr:N \c at jCol
+ \@@_rec_preamble_after_col:n
+ }
% \end{macrocode}
-%
-% We increment the counter of columns and then we test for the presence of a |<|.
% \begin{macrocode}
+\cs_new:Npn \@@_r #1
+ {
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gclear:N \g_@@_pre_cell_tl
+ \tl_gput_right:Nn \g_@@_array_preamble_tl
+ {
+ > { \@@_cell_begin:w \tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_r_tl }
+ r
+ < \@@_cell_end:
+ }
\int_gincr:N \c at jCol
\@@_rec_preamble_after_col:n
}
-\cs_set_eq:NN \@@_l \@@_c
-\cs_set_eq:NN \@@_r \@@_c
% \end{macrocode}
%
% \medskip
@@ -5081,37 +5160,37 @@
% \begin{macrocode}
\keys_define:nn { WithArrows / p-column }
{
- r .code:n = \str_set:Nn \l_@@_hpos_col_str { r } ,
+ r .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_r_str ,
r .value_forbidden:n = true ,
- c .code:n = \str_set:Nn \l_@@_hpos_col_str { c } ,
+ c .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_c_str ,
c .value_forbidden:n = true ,
- l .code:n = \str_set:Nn \l_@@_hpos_col_str { l } ,
+ l .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_l_str ,
l .value_forbidden:n = true ,
R .code:n =
\IfPackageLoadedTF { ragged2e }
- { \str_set:Nn \l_@@_hpos_col_str { R } }
+ { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_R_str }
{
\@@_error_or_warning:n { ragged2e~not~loaded }
- \str_set:Nn \l_@@_hpos_col_str { r }
+ \str_set_eq:NN \l_@@_hpos_col_str \c_@@_r_str
} ,
R .value_forbidden:n = true ,
L .code:n =
\IfPackageLoadedTF { ragged2e }
- { \str_set:Nn \l_@@_hpos_col_str { L } }
+ { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_L_stsr }
{
\@@_error_or_warning:n { ragged2e~not~loaded }
- \str_set:Nn \l_@@_hpos_col_str { l }
+ \str_set_eq:NN \l_@@_hpos_col_str \c_@@_l_str
} ,
L .value_forbidden:n = true ,
C .code:n =
\IfPackageLoadedTF { ragged2e }
- { \str_set:Nn \l_@@_hpos_col_str { C } }
+ { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_C_str }
{
\@@_error_or_warning:n { ragged2e~not~loaded }
- \str_set:Nn \l_@@_hpos_col_str { c }
+ \str_set_eq:NN \l_@@_hpos_col_str \c_@@_c_str
} ,
C .value_forbidden:n = true ,
- S .code:n = \str_set:Nn \l_@@_hpos_col_str { si } ,
+ S .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_si_str ,
S .value_forbidden:n = true ,
p .code:n = \str_set:Nn \l_@@_vpos_col_str { p } ,
p .value_forbidden:n = true ,
@@ -5167,9 +5246,9 @@
% the initial value), |l|, |c|, |r|, |L|, |C| and |R| (when the user has used
% the corresponding key in the optional argument of the specifier).
% \begin{macrocode}
- \str_set:Nn \l_@@_hpos_col_str { j }
- \tl_set:Nn \l_tmpa_tl { #1 }
- \@@_keys_p_column:V \l_tmpa_tl
+ \str_set_eq:NN \l_@@_hpos_col_str \c_@@_j_str
+ % \tl_set:Nn \l_tmpa_tl { #1 }
+ \@@_keys_p_column:n { #1 }
\@@_make_preamble_ii_iv:nnn { #2 } { minipage } { }
}
% \end{macrocode}
@@ -5177,7 +5256,6 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_keys_p_column:n #1
{ \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl }
-\cs_generate_variant:Nn \@@_keys_p_column:n { V }
% \end{macrocode}
%
% \medskip
@@ -5190,22 +5268,22 @@
\use:e
{
\@@_make_preamble_ii_v:nnnnnnnn
- { \str_if_eq:VnTF \l_@@_vpos_col_str { p } { t } { b } }
+ { \str_if_eq:onTF \l_@@_vpos_col_str { p } { t } { b } }
{ \dim_eval:n { #1 } }
{
% \end{macrocode}
% The parameter |\l_@@_hpos_col_str| (as |\l_@@_vpos_col_str|) exists only
% during the construction of the preamble. During the composition of the array
-% itself, you will have, in each cell, the parameter |\l_@@_hpos_cell_str| which
+% itself, you will have, in each cell, the parameter |\l_@@_hpos_cell_tl| which
% will provide the horizontal alignment of the column to which belongs the cell.
% \begin{macrocode}
- \str_if_eq:VnTF \l_@@_hpos_col_str j
- { \str_set:Nn \exp_not:N \l_@@_hpos_cell_str { } }
+ \str_if_eq:NNTF \l_@@_hpos_col_str \c_@@_j_str
+ { \tl_clear:N \exp_not:N \l_@@_hpos_cell_tl }
{
- \str_set:Nn \exp_not:N \l_@@_hpos_cell_str
+ \cs_set_nopar:Npn \exp_not:N \l_@@_hpos_cell_tl
{ \str_lowercase:V \l_@@_hpos_col_str }
}
- \str_case:Vn \l_@@_hpos_col_str
+ \str_case:on \l_@@_hpos_col_str
{
c { \exp_not:N \centering }
l { \exp_not:N \raggedright }
@@ -5216,12 +5294,12 @@
}
#3
}
- { \str_if_eq:VnT \l_@@_vpos_col_str { m } \@@_center_cell_box: }
- { \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w }
- { \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_end: }
+ { \str_if_eq:onT \l_@@_vpos_col_str { m } \@@_center_cell_box: }
+ { \str_if_eq:onT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w }
+ { \str_if_eq:onT \l_@@_hpos_col_str { si } \siunitx_cell_end: }
{ #2 }
{
- \str_case:VnF \l_@@_hpos_col_str
+ \str_case:onF \l_@@_hpos_col_str
{
{ j } { c }
{ si } { c }
@@ -5251,7 +5329,7 @@
%
% |#3| is the coding for the horizontal position of the content of the cell
% (|\centering|, |\raggedright|, |\raggedleft| or nothing). It's also possible
-% to put in that |#3| some code to fix the value of |\l_@@_hpos_cell_str| which
+% to put in that |#3| some code to fix the value of |\l_@@_hpos_cell_tl| which
% will be available in each cell of the column.
%
% |#4| is an extra-code which contains |\@@_center_cell_box:| (when the column
@@ -5268,10 +5346,10 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \str_if_eq:VnTF \l_@@_hpos_col_str { si }
+ \tl_if_eq:NNTF \l_@@_hpos_col_str \c_@@_si_str
{ \tl_gput_right:Nn \g_@@_array_preamble_tl { > { \@@_test_if_empty_for_S: } } }
{ \tl_gput_right:Nn \g_@@_array_preamble_tl { > { \@@_test_if_empty: } } }
- \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
\tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_array_preamble_tl
{
@@ -5430,9 +5508,8 @@
\cs_new_protected:Npn \@@_make_preamble_V_ii:nn #1 #2
{
\str_set:Nn \l_@@_vpos_col_str { p }
- \str_set:Nn \l_@@_hpos_col_str { j }
- \tl_set:Nn \l_tmpa_tl { #1 }
- \@@_keys_p_column:V \l_tmpa_tl
+ \str_set_eq:NN \l_@@_hpos_col_str \c_@@_j_str
+ \@@_keys_p_column:n { #1 }
\IfPackageLoadedTF { varwidth }
{ \@@_make_preamble_ii_iv:nnn { #2 } { varwidth } { } }
{
@@ -5476,7 +5553,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_w_i:nnnn #1 #2
{
- \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
\tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_array_preamble_tl
{
@@ -5483,7 +5560,7 @@
> {
\dim_set:Nn \l_@@_col_width_dim { #2 }
\@@_cell_begin:w
- \str_set:Nn \l_@@_hpos_cell_str { c }
+ \tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_c_tl
}
c
< {
@@ -5504,7 +5581,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_w_ii:nnnn #1 #2 #3 #4
{
- \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
\tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_array_preamble_tl
{
@@ -5517,7 +5594,7 @@
\dim_set:Nn \l_@@_col_width_dim { #4 }
\hbox_set:Nw \l_@@_cell_box
\@@_cell_begin:w
- \str_set:Nn \l_@@_hpos_cell_str { #3 }
+ \cs_set_nopar:Npn \l_@@_hpos_cell_tl { #3 }
}
c
< {
@@ -5566,7 +5643,7 @@
{
\IfPackageLoadedTF { siunitx }
{
- \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl
+ \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
\tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_array_preamble_tl
{
@@ -5601,7 +5678,7 @@
% \begin{macrocode}
\int_if_zero:nTF \c at jCol
{
- \str_if_eq:VnTF \g_@@_left_delim_tl { . }
+ \tl_if_eq:NNTF \g_@@_left_delim_tl \c_@@_dot_tl
{
% \end{macrocode}
% In that case, in fact, the first letter of the preamble must be considered as
@@ -5608,7 +5685,7 @@
% the left delimiter of the array.
% \begin{macrocode}
\tl_gset:Nn \g_@@_left_delim_tl { #1 }
- \tl_gset:Nn \g_@@_right_delim_tl { . }
+ \tl_gset_eq:NN \g_@@_right_delim_tl \c_@@_dot_tl
\@@_rec_preamble:n #2
}
{
@@ -5657,7 +5734,7 @@
{
\tl_if_eq:nnTF { \stop } { #2 }
{
- \str_if_eq:VnTF \g_@@_right_delim_tl { . }
+ \tl_if_eq:NNTF \g_@@_right_delim_tl \c_@@_dot_tl
{ \tl_gset:Nn \g_@@_right_delim_tl { #1 } }
{
\tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \enskip } }
@@ -5684,7 +5761,7 @@
{
\tl_if_eq:nnTF { \stop } { #3 }
{
- \str_if_eq:VnTF \g_@@_right_delim_tl { . }
+ \tl_if_eq:NNTF \g_@@_right_delim_tl \c_@@_dot_tl
{
\tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \enskip } }
\tl_gput_right:Nx \g_@@_pre_code_after_tl
@@ -5728,7 +5805,7 @@
\str_if_eq:nnTF { #1 } { @ }
\@@_rec_preamble_after_col_ii:n
{
- \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+ \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl
{
\tl_gput_right:Nn \g_@@_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -5761,7 +5838,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_rec_preamble_after_col_ii:n #1
{
- \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+ \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl
{
\tl_gput_right:Nn \g_@@_array_preamble_tl
{ @ { #1 \skip_horizontal:N \arrayrulewidth } }
@@ -5785,7 +5862,7 @@
{
\tl_clear:N \l_tmpa_tl
\int_step_inline:nn { #2 } { \tl_put_right:Nn \l_tmpa_tl { #3 } }
- \exp_last_unbraced:NV \@@_rec_preamble:n \l_tmpa_tl
+ \exp_last_unbraced:No \@@_rec_preamble:n \l_tmpa_tl
}
% \end{macrocode}
%
@@ -5843,7 +5920,7 @@
% (when the user has used the corresponding key in the optional argument of the
% specifier |X|).
% \begin{macrocode}
- \tl_set:Nn \l_@@_vpos_col_str { p }
+ \str_set:Nn \l_@@_vpos_col_str { p }
% \end{macrocode}
%
% The integer |\l_@@_weight_int| will be the weight of the |X| column (the
@@ -5853,11 +5930,13 @@
% of those columns as in \pkg{tabu} (now obsolete) or \pkg{tabularray}.
% \begin{macrocode}
\int_zero_new:N \l_@@_weight_int
- \int_set:Nn \l_@@_weight_int { 1 }
- \tl_set:Nn \l_tmpa_tl { #1 }
- \@@_keys_p_column:V \l_tmpa_tl
- \keys_set:nV { WithArrows / X-column } \l_tmpa_tl
- \int_compare:nNnT \l_@@_weight_int < 0
+ \int_set_eq:NN \l_@@_weight_int \c_one_int
+ \@@_keys_p_column:n { #1 }
+% \end{macrocode}
+% The unknown keys are put in |\l_tmpa_tl|
+% \begin{macrocode}
+ \keys_set:no { WithArrows / X-column } \l_tmpa_tl
+ \int_compare:nNnT \l_@@_weight_int < \c_zero_int
{
\@@_error_or_warning:n { negative~weight }
\int_set:Nn \l_@@_weight_int { - \l_@@_weight_int }
@@ -5988,7 +6067,7 @@
% The following lines are an adaptation of the definition of |\multicolumn| in
% \pkg{array}.
% \begin{macrocode}
- \exp_args:NV \@mkpream \g_@@_preamble_tl
+ \exp_args:No \@mkpream \g_@@_preamble_tl
\@addtopreamble \@empty
\endgroup
% \end{macrocode}
@@ -5997,7 +6076,7 @@
% Now, we do a treatment specific to \pkg{nicematrix} which has no equivalent
% in the original definition of |\multicolumn|.
% \begin{macrocode}
- \int_compare:nNnT { #1 } > 1
+ \int_compare:nNnT { #1 } > \c_one_int
{
\seq_gput_left:Nx \g_@@_multicolumn_cells_seq
{ \int_use:N \c at iRow - \int_eval:n { \c at jCol + 1 } }
@@ -6067,7 +6146,7 @@
\cs_if_exist:cTF { NC @ find @ #1 }
{
\tl_set_eq:Nc \l_tmpa_tl { NC @ rewrite @ #1 }
- \exp_last_unbraced:NV \@@_make_m_preamble:n \l_tmpa_tl
+ \exp_last_unbraced:No \@@_make_m_preamble:n \l_tmpa_tl
}
{
\tl_if_eq:nnT { #1 } { S }
@@ -6085,7 +6164,7 @@
{
\tl_gput_right:Nn \g_@@_preamble_tl
{
- > { \@@_cell_begin:w \str_set:Nn \l_@@_hpos_cell_str { #1 } }
+ > { \@@_cell_begin:w \cs_set_nopar:Npn \l_@@_hpos_cell_tl { #1 } }
#1
< \@@_cell_end:
}
@@ -6157,7 +6236,7 @@
\dim_set:Nn \l_@@_col_width_dim { #4 }
\hbox_set:Nw \l_@@_cell_box
\@@_cell_begin:w
- \str_set:Nn \l_@@_hpos_cell_str { #3 }
+ \cs_set_nopar:Npn \l_@@_hpos_cell_tl { #3 }
}
c
< {
@@ -6210,12 +6289,14 @@
{
\box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim }
\box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim }
- \tl_if_eq:NnTF \l_@@_baseline_tl { c }
+ \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_c_tl
{ \box_use_drop:N \l_tmpa_box }
\@@_put_box_in_flow_i:
}
% \end{macrocode}
%
+% \bigskip
+%
% \medskip
% The command |\@@_put_box_in_flow_i:| is used when the value of
% |\l_@@_baseline_tl| is different of |c| (which is the initial value and the
@@ -6233,7 +6314,7 @@
% Now, |\g_tmpa_dim| contains the $y$-value of the center of the array (the
% delimiters are centered in relation with this value).
% \begin{macrocode}
- \str_if_in:NnTF \l_@@_baseline_tl { line- }
+ \tl_if_in:NnTF \l_@@_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
@@ -6240,23 +6321,24 @@
\str_range:Nnn
\l_@@_baseline_tl
6
- { \tl_count:V \l_@@_baseline_tl }
+ { \tl_count:o \l_@@_baseline_tl }
}
\@@_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \str_case:VnF \l_@@_baseline_tl
- {
- { t } { \int_set:Nn \l_tmpa_int 1 }
- { b } { \int_set_eq:NN \l_tmpa_int \c at iRow }
+ \tl_if_eq:NnTF \l_@@_baseline_tl { t }
+ { \int_set_eq:NN \l_tmpa_int \c_one_int }
+ {
+ \tl_if_eq:NnTF \l_@@_baseline_tl { b }
+ { \int_set_eq:NN \l_tmpa_int \c at iRow }
+ { \int_set:Nn \l_tmpa_int \l_@@_baseline_tl }
}
- { \int_set:Nn \l_tmpa_int \l_@@_baseline_tl }
\bool_lazy_or:nnT
{ \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int }
{ \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int }
{
\@@_error:n { bad~value~for~baseline }
- \int_set:Nn \l_tmpa_int 1
+ \int_set_eq:NN \l_tmpa_int \c_one_int
}
\@@_qpoint:n { row - \int_use:N \l_tmpa_int - base }
% \end{macrocode}
@@ -6289,7 +6371,7 @@
% \begin{macrocode}
\bool_if:NT \l_@@_NiceMatrix_without_vlines_bool
{
- \int_compare:nNnT \c at jCol > 1 % added 2023-08-13
+ \int_compare:nNnT \c at jCol > \c_one_int
{
\box_set_wd:Nn \l_@@_the_array_box
{ \box_wd:N \l_@@_the_array_box - \arraycolsep }
@@ -6315,7 +6397,7 @@
% tabular notes for which the command |\tabularnote| has been used without its
% optional argument (between square brackets).
% \begin{macrocode}
- \int_compare:nNnT \g_@@_notes_caption_int > 0
+ \int_compare:nNnT \g_@@_notes_caption_int > \c_zero_int
{
\tl_build_gput_right:Nx \g_@@_aux_tl
{
@@ -6353,7 +6435,7 @@
{
{ ! \seq_if_empty_p:N \g_@@_notes_seq }
{ ! \seq_if_empty_p:N \g_@@_notes_in_caption_seq }
- { ! \tl_if_empty_p:V \g_@@_tabularnote_tl }
+ { ! \tl_if_empty_p:o \g_@@_tabularnote_tl }
}
\@@_insert_tabularnotes:
\cs_set_eq:NN \tabularnote \@@_tabularnote_error:n
@@ -6408,7 +6490,7 @@
% caption is composed only once. In that case, we fix the value of
% |\g_@@_caption_finished_bool| now.
% \begin{macrocode}
- \bool_if:NF \g_@@_caption_finished_bool % added 2023/06/30
+ \bool_if:NF \g_@@_caption_finished_bool
{
\bool_gset_true:N \g_@@_caption_finished_bool
\int_gset_eq:NN \g_@@_notes_caption_int \c at tabularnote
@@ -6449,7 +6531,7 @@
% the |\unskip| are designed to give the ability to put a |\bottomrule| at the
% end of the notes with a good vertical space.
% \begin{macrocode}
- \int_compare:nNnT \c at tabularnote > 0
+ \int_compare:nNnT \c at tabularnote > \c_zero_int
{
\bool_if:NTF \l_@@_notes_para_bool
{
@@ -6545,7 +6627,7 @@
% We convert a value of |t| to a value of |1|.
% \begin{macrocode}
\tl_if_eq:NnT \l_@@_baseline_tl { t }
- { \tl_set:Nn \l_@@_baseline_tl { 1 } }
+ { \cs_set_nopar:Npn \l_@@_baseline_tl { 1 } }
% \end{macrocode}
% Now, we convert the value of |\l_@@_baseline_tl| (which should represent an
% integer) to an integer stored in |\l_tmpa_int|.
@@ -6560,7 +6642,7 @@
\str_range:Nnn
\l_@@_baseline_tl
6
- { \tl_count:V \l_@@_baseline_tl }
+ { \tl_count:o \l_@@_baseline_tl }
}
\@@_qpoint:n { row - \int_use:N \l_tmpa_int }
}
@@ -6668,7 +6750,7 @@
% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
% \begin{macrocode}
- \exp_args:NV \@@_array: \g_@@_array_preamble_tl
+ \exp_args:No \@@_array: \g_@@_array_preamble_tl
}
}
}
@@ -6745,7 +6827,7 @@
% \begin{macrocode}
\seq_pop_right:NN \l_@@_rows_seq \l_tmpa_tl
\tl_if_empty:NF \l_tmpa_tl
- { \seq_put_right:NV \l_@@_rows_seq \l_tmpa_tl }
+ { \seq_put_right:No \l_@@_rows_seq \l_tmpa_tl }
% \end{macrocode}
% If the environment uses the option |last-row| without value (i.e. without
% saying the number of the rows), we have now the opportunity to compute that
@@ -6769,7 +6851,7 @@
% First, we treat the first row.
% \begin{macrocode}
\seq_pop_left:NN \l_@@_rows_seq \l_tmpa_tl
- \@@_line_with_light_syntax:V \l_tmpa_tl
+ \@@_line_with_light_syntax:o \l_tmpa_tl
% \end{macrocode}
% Now, the other rows (with the same treatment, excepted that we have to insert
% |\\| between the rows).
@@ -6802,7 +6884,7 @@
% |\@@_array:| because of compatibility with the classes \cls{revtex4-1} and
% \cls{revtex4-2}).
% \begin{macrocode}
- \exp_args:NV \@@_array: \g_@@_array_preamble_tl \l_@@_new_body_tl
+ \exp_args:No \@@_array: \g_@@_array_preamble_tl \l_@@_new_body_tl
}
% \end{macrocode}
%
@@ -6818,11 +6900,11 @@
{ \seq_count:N \l_@@_cells_seq }
}
\seq_pop_left:NN \l_@@_cells_seq \l_tmpa_tl
- \exp_args:NNV \tl_build_put_right:Nn \l_@@_new_body_tl \l_tmpa_tl
+ \exp_args:NNo \tl_build_put_right:Nn \l_@@_new_body_tl \l_tmpa_tl
\seq_map_inline:Nn \l_@@_cells_seq
{ \tl_build_put_right:Nn \l_@@_new_body_tl { & ##1 } }
}
-\cs_generate_variant:Nn \@@_line_with_light_syntax:n { V }
+\cs_generate_variant:Nn \@@_line_with_light_syntax:n { o }
% \end{macrocode}
%
%
@@ -6833,7 +6915,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2
{
- \str_if_eq:VnT \g_@@_name_env_str { #2 }
+ \str_if_eq:onT \g_@@_name_env_str { #2 }
{ \@@_fatal:n { empty~environment } }
% \end{macrocode}
% We reput in the stream the |\end{...}| we have extracted and the user will
@@ -6962,10 +7044,10 @@
% We begin a loop over the columns. The integer |\g_tmpa_int| will be the
% number of the current column. This integer is used for the Tikz nodes.
% \begin{macrocode}
- \int_gset:Nn \g_tmpa_int 1
+ \int_gset_eq:NN \g_tmpa_int \c_one_int
\bool_if:NTF \g_@@_last_col_found_bool
- { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 3 } 0 } }
- { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 2 } 0 } }
+ { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 3 } \c_zero_int } }
+ { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 2 } \c_zero_int } }
{
&
\omit
@@ -7010,17 +7092,17 @@
% The two following lines have been added on 2021-12-15 to solve a bug
% mentionned by Joao Luis Soares by mail.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_col_total_int = 1
+ \int_compare:nNnT \g_@@_col_total_int = \c_one_int
{ \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } }
\skip_horizontal:N \g_tmpa_skip
\int_gincr:N \g_tmpa_int
- \bool_lazy_all:nT
+ \bool_lazy_any:nT
{
- { \bool_not_p:n \g_@@_delims_bool }
- { \bool_not_p:n \l_@@_tabular_bool }
- { \clist_if_empty_p:N \l_@@_vlines_clist }
- { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
- { ! \l_@@_bar_at_end_of_pream_bool }
+ \g_@@_delims_bool
+ \l_@@_tabular_bool
+ { ! \clist_if_empty_p:N \l_@@_vlines_clist }
+ \l_@@_exterior_arraycolsep_bool
+ \l_@@_bar_at_end_of_pream_bool
}
{ \skip_horizontal:N -\col at sep }
\bool_if:NT \l_@@_code_before_bool
@@ -7120,23 +7202,22 @@
% have to compute some dimensions of this box.
% \begin{macrocode}
\hbox_set:Nw \l_@@_cell_box
- \@@_math_toggle_token:
- \bool_if:NT \l_@@_small_bool \scriptstyle
+ \@@_math_toggle:
+ \@@_tuning_key_small:
% \end{macrocode}
% We insert |\l_@@_code_for_first_col_tl|... but we don't insert it in the
% potential ``first row'' and in the potential ``last row''.
% \begin{macrocode}
- \bool_lazy_and:nnT
- { \int_compare_p:nNn \c at iRow > 0 }
+ \int_compare:nNnT \c at iRow > \c_zero_int
{
- \bool_lazy_or_p:nn
- { \int_compare_p:nNn \l_@@_last_row_int < 0 }
+ \bool_lazy_or:nnT
+ { \int_compare_p:nNn \l_@@_last_row_int < \c_zero_int }
{ \int_compare_p:nNn \c at iRow < \l_@@_last_row_int }
+ {
+ \l_@@_code_for_first_col_tl
+ \xglobal \colorlet { nicematrix-first-col } { . }
+ }
}
- {
- \l_@@_code_for_first_col_tl
- \xglobal \colorlet { nicematrix-first-col } { . }
- }
}
% \end{macrocode}
% Be careful: despite this letter |l| the cells of the ``first column'' are
@@ -7145,7 +7226,7 @@
l
<
{
- \@@_math_toggle_token:
+ \@@_math_toggle:
\hbox_set_end:
\bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
\@@_adjust_size_box:
@@ -7202,16 +7283,16 @@
% have to compute some dimensions of this box.
% \begin{macrocode}
\hbox_set:Nw \l_@@_cell_box
- \@@_math_toggle_token:
- \bool_if:NT \l_@@_small_bool \scriptstyle
+ \@@_math_toggle:
+ \@@_tuning_key_small:
% \end{macrocode}
% We insert |\l_@@_code_for_last_col_tl|... but we don't insert it in the
% potential ``first row'' and in the potential ``last row''.
% \begin{macrocode}
- \int_compare:nNnT \c at iRow > 0
+ \int_compare:nNnT \c at iRow > \c_zero_int
{
\bool_lazy_or:nnT
- { \int_compare_p:nNn \l_@@_last_row_int < 0 }
+ { \int_compare_p:nNn \l_@@_last_row_int < \c_zero_int }
{ \int_compare_p:nNn \c at iRow < \l_@@_last_row_int }
{
\l_@@_code_for_last_col_tl
@@ -7222,7 +7303,7 @@
l
<
{
- \@@_math_toggle_token:
+ \@@_math_toggle:
\hbox_set_end:
\bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
\@@_adjust_size_box:
@@ -7330,7 +7411,7 @@
{ #2 }
}
\tl_set:Nn \l_tmpb_tl { \use:c { #1 NiceArray } }
- \exp_args:NV \l_tmpb_tl \l_tmpa_tl
+ \exp_args:No \l_tmpb_tl \l_tmpa_tl
}
% \end{macrocode}
%
@@ -7426,13 +7507,22 @@
}
}
{ }
- \bool_set_true:N \l_@@_tabular_bool
+ \@@_settings_for_tabular:
\NiceArray { #2 }
}
{ \endNiceArray }
% \end{macrocode}
%
-%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_settings_for_tabular:
+ {
+ \bool_set_true:N \l_@@_tabular_bool
+ \cs_set_eq:NN \@@_math_toggle: \prg_do_nothing:
+ \cs_set_eq:NN \@@_tuning_not_tabular_begin: \prg_do_nothing:
+ \cs_set_eq:NN \@@_tuning_not_tabular_end: \prg_do_nothing:
+ }
+% \end{macrocode}
+%
% \bigskip
% \begin{macrocode}
\NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } }
@@ -7441,7 +7531,7 @@
\dim_zero_new:N \l_@@_width_dim
\dim_set:Nn \l_@@_width_dim { #1 }
\keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 }
- \bool_set_true:N \l_@@_tabular_bool
+ \@@_settings_for_tabular:
\NiceArray { #3 }
}
{
@@ -7458,7 +7548,7 @@
\str_gset:Nn \g_@@_name_env_str { NiceTabular* }
\dim_set:Nn \l_@@_tabular_width_dim { #1 }
\keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 }
- \bool_set_true:N \l_@@_tabular_bool
+ \@@_settings_for_tabular:
\NiceArray { #3 }
}
{ \endNiceArray }
@@ -7755,7 +7845,7 @@
% potential ``argument'' with the command |\@@_CodeAfter_keys:|.
% \begin{macrocode}
\bool_set_true:N \l_@@_in_code_after_bool
- \exp_last_unbraced:NV \@@_CodeAfter_keys: \g_nicematrix_code_after_tl
+ \exp_last_unbraced:No \@@_CodeAfter_keys: \g_nicematrix_code_after_tl
\scan_stop:
\tl_gclear:N \g_nicematrix_code_after_tl
\group_end:
@@ -7774,7 +7864,7 @@
\tl_build_gput_right:Nx \g_@@_aux_tl
{
\tl_gset:Nn \exp_not:N \g_@@_pre_code_before_tl
- { \exp_not:V \g_@@_pre_code_before_tl }
+ { \exp_not:o \g_@@_pre_code_before_tl }
}
\tl_gclear:N \g_@@_pre_code_before_tl
}
@@ -7783,7 +7873,7 @@
\tl_build_gput_right:Nx \g_@@_aux_tl
{
\tl_gset:Nn \exp_not:N \g_@@_code_before_tl
- { \exp_not:V \g_nicematrix_code_before_tl }
+ { \exp_not:o \g_nicematrix_code_before_tl }
}
\tl_gclear:N \g_nicematrix_code_before_tl
}
@@ -8042,7 +8132,7 @@
\bool_set_false:N \l_@@_final_open_bool
\int_compare:nNnTF \l_@@_final_i_int > \l_@@_row_max_int
{
- \int_compare:nNnTF { #3 } = 1
+ \int_compare:nNnTF { #3 } = \c_one_int
{ \bool_set_true:N \l_@@_final_open_bool }
{
\int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int
@@ -8058,7 +8148,7 @@
{
\int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int
{
- \int_compare:nNnT { #4 } = 1
+ \int_compare:nNnT { #4 } = \c_one_int
{ \bool_set_true:N \l_@@_final_open_bool }
}
}
@@ -8137,7 +8227,7 @@
\bool_set_false:N \l_@@_initial_open_bool
\int_compare:nNnTF \l_@@_initial_i_int < \l_@@_row_min_int
{
- \int_compare:nNnTF { #3 } = 1
+ \int_compare:nNnTF { #3 } = \c_one_int
{ \bool_set_true:N \l_@@_initial_open_bool }
{
\int_compare:nNnT \l_@@_initial_j_int = { \l_@@_col_min_int - 1 }
@@ -8147,7 +8237,7 @@
{
\int_compare:nNnTF \l_@@_initial_j_int < \l_@@_col_min_int
{
- \int_compare:nNnT { #4 } = 1
+ \int_compare:nNnT { #4 } = \c_one_int
{ \bool_set_true:N \l_@@_initial_open_bool }
}
{
@@ -8265,19 +8355,26 @@
% \begin{macrocode}
\cs_set_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
{
- \bool_if:nT
+ \int_compare:nNnF { #3 } > { #1 }
{
- \int_compare_p:n { #3 <= #1 }
- && \int_compare_p:n { #1 <= #5 }
- && \int_compare_p:n { #4 <= #2 }
- && \int_compare_p:n { #2 <= #6 }
+ \int_compare:nNnF { #1 } > { #5 }
+ {
+ \int_compare:nNnF { #4 } > { #2 }
+ {
+ \int_compare:nNnF { #2 } > { #6 }
+ {
+ \int_set:Nn \l_@@_row_min_int
+ { \int_max:nn \l_@@_row_min_int { #3 } }
+ \int_set:Nn \l_@@_col_min_int
+ { \int_max:nn \l_@@_col_min_int { #4 } }
+ \int_set:Nn \l_@@_row_max_int
+ { \int_min:nn \l_@@_row_max_int { #5 } }
+ \int_set:Nn \l_@@_col_max_int
+ { \int_min:nn \l_@@_col_max_int { #6 } }
+ }
+ }
+ }
}
- {
- \int_set:Nn \l_@@_row_min_int { \int_max:nn \l_@@_row_min_int { #3 } }
- \int_set:Nn \l_@@_col_min_int { \int_max:nn \l_@@_col_min_int { #4 } }
- \int_set:Nn \l_@@_row_max_int { \int_min:nn \l_@@_row_max_int { #5 } }
- \int_set:Nn \l_@@_col_max_int { \int_min:nn \l_@@_col_max_int { #6 } }
- }
}
% \end{macrocode}
%
@@ -8407,7 +8504,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Ldots:
\group_end:
}
@@ -8502,7 +8599,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Cdots:
\group_end:
}
@@ -8566,7 +8663,6 @@
{ \dim_max:nn \l_@@_y_initial_dim \pgf at y }
}
}
- % modified 2023-08-10
\dim_compare:nNnT \l_@@_y_initial_dim = { - \c_max_dim }
{
\@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base }
@@ -8599,7 +8695,6 @@
{ \dim_min:nn \l_@@_y_final_dim \pgf at y }
}
}
- % modified 2023-08-10
\dim_compare:nNnT \l_@@_y_final_dim = \c_max_dim
{
\@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base }
@@ -8632,7 +8727,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l_@@_xdots_color_tl
+ \tl_if_empty:oF \l_@@_xdots_color_tl
{ \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Vdots:
\group_end:
@@ -8677,10 +8772,7 @@
\dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
\dim_sub:Nn \l_@@_x_initial_dim \l_@@_left_margin_dim
\dim_sub:Nn \l_@@_x_initial_dim \l_@@_extra_left_margin_dim
- % \bool_if:NT \g_@@_delims_bool
- % {
- \dim_sub:Nn \l_@@_x_initial_dim \c_@@_shift_exterior_Vdots_dim
- % }
+ \dim_sub:Nn \l_@@_x_initial_dim \c_@@_shift_exterior_Vdots_dim
}
{
\bool_lazy_and:nnTF
@@ -8694,12 +8786,7 @@
\dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
\dim_add:Nn \l_@@_x_initial_dim \l_@@_right_margin_dim
\dim_add:Nn \l_@@_x_initial_dim \l_@@_extra_right_margin_dim
- % \bool_if:NT \g_@@_delims_bool
- % {
- \dim_add:Nn
- \l_@@_x_initial_dim
- \c_@@_shift_exterior_Vdots_dim
- % }
+ \dim_add:Nn \l_@@_x_initial_dim \c_@@_shift_exterior_Vdots_dim
}
% \end{macrocode}
% We have a dotted line open on both sides which is \emph{not} in an exterior column.
@@ -8721,14 +8808,15 @@
% \begin{macrocode}
{
\bool_set_false:N \l_tmpa_bool
- \bool_lazy_and:nnT
- { ! \l_@@_initial_open_bool }
- { ! \l_@@_final_open_bool }
- {
- \@@_set_initial_coords_from_anchor:n { south~west }
- \@@_set_final_coords_from_anchor:n { north~west }
- \bool_set:Nn \l_tmpa_bool
- { \dim_compare_p:nNn \l_@@_x_initial_dim = \l_@@_x_final_dim }
+ \bool_if:NF \l_@@_initial_open_bool
+ {
+ \bool_if:NF \l_@@_final_open_bool
+ {
+ \@@_set_initial_coords_from_anchor:n { south~west }
+ \@@_set_final_coords_from_anchor:n { north~west }
+ \bool_set:Nn \l_tmpa_bool
+ { \dim_compare_p:nNn \l_@@_x_initial_dim = \l_@@_x_final_dim }
+ }
}
% \end{macrocode}
% Now, we try to determine whether the column is of type |c| or may be
@@ -8788,7 +8876,7 @@
\group_begin:
\@@_open_shorten:
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Ddots:
\group_end:
}
@@ -8833,7 +8921,7 @@
% We test if the diagonal line is the first one (the counter |\g_@@_ddots_int|
% is created for this usage).
% \begin{macrocode}
- \int_compare:nNnTF \g_@@_ddots_int = 1
+ \int_compare:nNnTF \g_@@_ddots_int = \c_one_int
% \end{macrocode}
% If the diagonal line is the first one, we have no adjustment of the line to do
% but we store the $\Delta_x$ and the $\Delta_y$ of the line because these
@@ -8883,7 +8971,7 @@
\group_begin:
\@@_open_shorten:
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Iddots:
\group_end:
}
@@ -8919,7 +9007,7 @@
\bool_if:NT \l_@@_parallelize_diags_bool
{
\int_gincr:N \g_@@_iddots_int
- \int_compare:nNnTF \g_@@_iddots_int = 1
+ \int_compare:nNnTF \g_@@_iddots_int = \c_one_int
{
\dim_gset:Nn \g_@@_delta_x_two_dim
{ \l_@@_x_final_dim - \l_@@_x_initial_dim }
@@ -8970,7 +9058,7 @@
% \end{macrocode}
%
% \medskip
-% We have to do a special construction with |\exp_args:NV| to be able to put in
+% We have to do a special construction with |\exp_args:No| to be able to put in
% the list of options in the correct place in the Tikz instruction.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_unstandard_dotted_line:
@@ -8988,7 +9076,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_unstandard_dotted_line:n #1
{
- \@@_draw_unstandard_dotted_line:nVVV
+ \@@_draw_unstandard_dotted_line:nooo
{ #1 }
\l_@@_xdots_up_tl
\l_@@_xdots_down_tl
@@ -9048,53 +9136,31 @@
)
}
}
- \bool_lazy_and:nnT % security
- { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } < \c_@@_max_l_dim }
- { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } > { 1 pt } }
+% \end{macrocode}
+% It seems that, during the first compilations, the value of |\l_@@_l_dim| may
+% be erroneous (equal to zero or very large). We must detect these cases
+% because they would cause errors during the drawing of the dotted line. Maybe
+% we should also write something in the |aux| file to say that one more
+% compilation should be done.
+% \begin{macrocode}
+ \dim_compare:nNnT \l_@@_l_dim < \c_@@_max_l_dim
{
- \dim_set:Nn \l_tmpa_dim
- {
- \l_@@_x_initial_dim
- + ( \l_@@_x_final_dim - \l_@@_x_initial_dim )
- * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim
- }
- \dim_set:Nn \l_tmpb_dim
- {
- \l_@@_y_initial_dim
- + ( \l_@@_y_final_dim - \l_@@_y_initial_dim )
- * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim
- }
- \dim_set:Nn \l_@@_tmpc_dim
- {
- \l_@@_x_final_dim
- - ( \l_@@_x_final_dim - \l_@@_x_initial_dim )
- * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim
- }
- \dim_set:Nn \l_@@_tmpd_dim
- {
- \l_@@_y_final_dim
- - ( \l_@@_y_final_dim - \l_@@_y_initial_dim )
- * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim
- }
- \dim_set_eq:NN \l_@@_x_initial_dim \l_tmpa_dim
- \dim_set_eq:NN \l_@@_y_initial_dim \l_tmpb_dim
- \dim_set_eq:NN \l_@@_x_final_dim \l_@@_tmpc_dim
- \dim_set_eq:NN \l_@@_y_final_dim \l_@@_tmpd_dim
+ \dim_compare:nNnT \l_@@_l_dim > { 1 pt }
+ \@@_draw_unstandard_dotted_line_i:
}
% \end{macrocode}
-%
%
% If the key |xdots/horizontal-labels| has been used.
% \begin{macrocode}
\bool_if:NT \l_@@_xdots_h_labels_bool
- {
- \tikzset
- {
- @@_node_above / .style = { auto = left } ,
- @@_node_below / .style = { auto = right } ,
- @@_node_middle / .style = { inner~sep = \c_@@_innersep_middle_dim }
- }
- }
+ {
+ \tikzset
+ {
+ @@_node_above / .style = { auto = left } ,
+ @@_node_below / .style = { auto = right } ,
+ @@_node_middle / .style = { inner~sep = \c_@@_innersep_middle_dim }
+ }
+ }
\tl_if_empty:nF { #4 }
{ \tikzset { @@_node_middle / .append~style = { fill = white } } }
\draw
@@ -9111,9 +9177,46 @@
( \l_@@_x_final_dim , \l_@@_y_final_dim ) ;
\end { scope }
}
-\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:nnnn { n V V V }
% \end{macrocode}
%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_draw_unstandard_dotted_line_i:
+ {
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \l_@@_x_initial_dim
+ + ( \l_@@_x_final_dim - \l_@@_x_initial_dim )
+ * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim
+ }
+ \dim_set:Nn \l_tmpb_dim
+ {
+ \l_@@_y_initial_dim
+ + ( \l_@@_y_final_dim - \l_@@_y_initial_dim )
+ * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim
+ }
+ \dim_set:Nn \l_@@_tmpc_dim
+ {
+ \l_@@_x_final_dim
+ - ( \l_@@_x_final_dim - \l_@@_x_initial_dim )
+ * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim
+ }
+ \dim_set:Nn \l_@@_tmpd_dim
+ {
+ \l_@@_y_final_dim
+ - ( \l_@@_y_final_dim - \l_@@_y_initial_dim )
+ * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim
+ }
+ \dim_set_eq:NN \l_@@_x_initial_dim \l_tmpa_dim
+ \dim_set_eq:NN \l_@@_y_initial_dim \l_tmpb_dim
+ \dim_set_eq:NN \l_@@_x_final_dim \l_@@_tmpc_dim
+ \dim_set_eq:NN \l_@@_y_final_dim \l_@@_tmpd_dim
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:nnnn { n o o o }
+% \end{macrocode}
+%
% \bigskip
% The command |\@@_draw_standard_dotted_line:| draws the line with our system of dots
% (which gives a dotted line with real rounded dots).
@@ -9145,10 +9248,11 @@
% we should also write something in the |aux| file to say that one more
% compilation should be done.
% \begin{macrocode}
- \bool_lazy_or:nnF
- { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } > \c_@@_max_l_dim }
- { \dim_compare_p:nNn \l_@@_l_dim = \c_zero_dim }
- \@@_draw_standard_dotted_line_i:
+ \dim_compare:nNnT \l_@@_l_dim < \c_@@_max_l_dim
+ {
+ \dim_compare:nNnT \l_@@_l_dim > { 1 pt }
+ \@@_draw_standard_dotted_line_i:
+ }
\group_end:
% \end{macrocode}
% \begin{macrocode}
@@ -9226,7 +9330,7 @@
{ 2 \l_@@_l_dim }
}
\pgf at relevantforpicturesizefalse
- \int_step_inline:nnn 0 \l_tmpa_int
+ \int_step_inline:nnn \c_zero_int \l_tmpa_int
{
\pgfpathcircle
{ \pgfpoint \l_@@_x_initial_dim \l_@@_y_initial_dim }
@@ -9339,11 +9443,11 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l_@@_argspec_tl { m E { _ ^ : } { { } { } { } } }
- \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
+ \cs_set_nopar:Npn \l_@@_argspec_tl { m E { _ ^ : } { { } { } { } } }
+ \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
\cs_new_protected:Npn \@@_Ldots
{ \@@_collect_options:n { \@@_Ldots_i } }
- \exp_args:NNV \NewDocumentCommand \@@_Ldots_i \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Ldots_i \l_@@_argspec_tl
{
\int_if_zero:nTF \c at jCol
{ \@@_error:nn { in~first~col } \Ldots }
@@ -9365,7 +9469,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_Cdots
{ \@@_collect_options:n { \@@_Cdots_i } }
- \exp_args:NNV \NewDocumentCommand \@@_Cdots_i \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Cdots_i \l_@@_argspec_tl
{
\int_if_zero:nTF \c at jCol
{ \@@_error:nn { in~first~col } \Cdots }
@@ -9387,7 +9491,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_Vdots
{ \@@_collect_options:n { \@@_Vdots_i } }
- \exp_args:NNV \NewDocumentCommand \@@_Vdots_i \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Vdots_i \l_@@_argspec_tl
{
\int_if_zero:nTF \c at iRow
{ \@@_error:nn { in~first~row } \Vdots }
@@ -9410,7 +9514,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_Ddots
{ \@@_collect_options:n { \@@_Ddots_i } }
- \exp_args:NNV \NewDocumentCommand \@@_Ddots_i \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Ddots_i \l_@@_argspec_tl
{
\int_case:nnF \c at iRow
{
@@ -9440,7 +9544,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_Iddots
{ \@@_collect_options:n { \@@_Iddots_i } }
- \exp_args:NNV \NewDocumentCommand \@@_Iddots_i \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Iddots_i \l_@@_argspec_tl
{
\int_case:nnF \c at iRow
{
@@ -9536,7 +9640,7 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
+ \cs_set_nopar:Npn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
\tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
% \end{macrocode}
% We don't put |!| before the last optionnal argument for homogeneity with
@@ -9544,7 +9648,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_Hdotsfor_i
{ \@@_collect_options:n { \@@_Hdotsfor_ii } }
- \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_ii \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Hdotsfor_ii \l_@@_argspec_tl
{
\tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl
{
@@ -9563,7 +9667,7 @@
{
&
\multicolumn { 1 } { c } { }
- \cs_set_eq:NN \CodeAfter \@@_CodeAfter_i: % added 2023-08-26
+ \cs_set_eq:NN \CodeAfter \@@_CodeAfter_i:
}
}
}
@@ -9583,9 +9687,9 @@
% \end{macrocode}
% For the column, it's a bit more complicated.
% \begin{macrocode}
- \int_compare:nNnTF { #2 } = 1
+ \int_compare:nNnTF { #2 } = \c_one_int
{
- \int_set:Nn \l_@@_initial_j_int 1
+ \int_set_eq:NN \l_@@_initial_j_int \c_one_int
\bool_set_true:N \l_@@_initial_open_bool
}
{
@@ -9632,7 +9736,7 @@
}
\keys_set:nn { NiceMatrix / xdots } { #4 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Ldots:
\group_end:
% \end{macrocode}
@@ -9652,11 +9756,11 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
+ \cs_set_nopar:Npn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
\tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
\cs_new_protected:Npn \@@_Vdotsfor:
{ \@@_collect_options:n { \@@_Vdotsfor_i } }
- \exp_args:NNV \NewDocumentCommand \@@_Vdotsfor_i \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_Vdotsfor_i \l_@@_argspec_tl
{
\bool_gset_true:N \g_@@_empty_cell_bool
\tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl
@@ -9690,9 +9794,9 @@
% \end{macrocode}
% For the row, it's a bit more complicated.
% \begin{macrocode}
- \int_compare:nNnTF { #1 } = 1
+ \int_compare:nNnTF { #1 } = \c_one_int
{
- \int_set:Nn \l_@@_initial_i_int 1
+ \int_set_eq:NN \l_@@_initial_i_int \c_one_int
\bool_set_true:N \l_@@_initial_open_bool
}
{
@@ -9738,7 +9842,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { NiceMatrix / xdots } { #4 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\@@_actually_draw_Vdots:
\group_end:
% \end{macrocode}
@@ -9819,13 +9923,14 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l_@@_argspec_tl { O { } m m ! O { } E { _ ^ : } { { } { } { } } }
+ \cs_set_nopar:Npn \l_@@_argspec_tl
+ { O { } m m ! O { } E { _ ^ : } { { } { } { } } }
\tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
- \exp_args:NNV \NewDocumentCommand \@@_line \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_line \l_@@_argspec_tl
{
\group_begin:
\keys_set:nn { NiceMatrix / xdots } { #1 , #4 , down = #5 , up = #6 }
- \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
\use:e
{
\@@_line_i:nn
@@ -9842,15 +9947,10 @@
{
\bool_set_false:N \l_@@_initial_open_bool
\bool_set_false:N \l_@@_final_open_bool
- \bool_if:nTF
- {
- \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 }
- ||
- \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 }
- }
- {
- \@@_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 }
- }
+ \bool_lazy_or:nnTF
+ { \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 } }
+ { \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 } }
+ { \@@_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 } }
% \end{macrocode}
% The test of |measuring@| is a security (cf. question 686649 on TeX StackExchange).
% \begin{macrocode}
@@ -9922,7 +10022,7 @@
% |#1| is the first row \emph{after} the scope of the instructions in |#2|
% \begin{macrocode}
\cs_new:Npn \@@_if_row_less_than:nn #1 #2
- { \int_compare:nNnT { \int_use:N \c at iRow } < { #1 } { #2 } }
+ { \int_compare:nNnT \c at iRow < { #1 } { #2 } }
% \end{macrocode}
%
% \bigskip
@@ -9997,9 +10097,9 @@
\tl_gput_right:Nx \g_@@_pre_code_before_tl
{
% \end{macrocode}
-% The command |\@@_exp_color_arg:NV| is \emph{fully expandable}.
+% The command |\@@_exp_color_arg:No| is \emph{fully expandable}.
% \begin{macrocode}
- \@@_exp_color_arg:NV \@@_rectanglecolor \l_tmpa_tl
+ \@@_exp_color_arg:No \@@_rectanglecolor \l_tmpa_tl
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
{ \int_use:N \c at iRow - * }
}
@@ -10006,11 +10106,11 @@
% \end{macrocode}
% Then, the other rows (if there is several rows).
% \begin{macrocode}
- \int_compare:nNnT \l_@@_key_nb_rows_int > 1
+ \int_compare:nNnT \l_@@_key_nb_rows_int > \c_one_int
{
\tl_gput_right:Nx \g_@@_pre_code_before_tl
{
- \@@_exp_color_arg:NV \@@_rowcolor \l_tmpa_tl
+ \@@_exp_color_arg:No \@@_rowcolor \l_tmpa_tl
{
\int_eval:n { \c at iRow + 1 }
- \int_eval:n { \c at iRow + \l_@@_key_nb_rows_int - 1 }
@@ -10241,7 +10341,7 @@
\@@_clip_with_rounded_corners:
\seq_map_indexed_inline:Nn \g_@@_colors_seq
{
- \int_compare:nNnTF { ##1 } = 1
+ \int_compare:nNnTF { ##1 } = \c_one_int
{
\cs_set_eq:NN \@@_cartesian_path:n \@@_cartesian_path_nocolor:n
\use:c { g_@@_color _ 1 _tl }
@@ -10285,7 +10385,7 @@
% \end{macrocode}
% |\l_tmpa_tl| (if not empty) is now the opacity and |\l_tmpb_tl| (if not empty) is now the colorimetric space.
% \begin{macrocode}
- \tl_if_empty:NF \l_tmpa_tl { \exp_args:NV \pgfsetfillopacity \l_tmpa_tl }
+ \tl_if_empty:NF \l_tmpa_tl { \exp_args:No \pgfsetfillopacity \l_tmpa_tl }
\tl_if_empty:NTF \l_tmpb_tl
{ \@declaredcolor }
{ \use:e { \exp_not:N \@undeclaredcolor [ \l_tmpb_tl ] } }
@@ -10306,8 +10406,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_cartesian_color:nn #1 #2
{
- \tl_set:Nn \l_@@_rows_tl { #1 }
- \tl_set:Nn \l_@@_cols_tl { #2 }
+ \cs_set_nopar:Npn \l_@@_rows_tl { #1 }
+ \cs_set_nopar:Npn \l_@@_cols_tl { #2 }
\@@_cartesian_path:
}
% \end{macrocode}
@@ -10349,7 +10449,7 @@
{
\@@_add_to_colors_seq:en
{ \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } }
- { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt } }
+ { \@@_rectanglecolor:nnn { #3 } { #4 } { \c_zero_dim } }
}
}
% \end{macrocode}
@@ -10379,7 +10479,7 @@
\tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl
\@@_cut_on_hyphen:w #2 \q_stop
- \tl_set:Nx \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl }
+ \tl_set:Nx \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl }
\tl_set:Nx \l_@@_cols_tl { \l_@@_tmpd_tl - \l_tmpb_tl }
% \end{macrocode}
% The command |\@@_cartesian_path:n| takes in two implicit arguments:
@@ -10404,9 +10504,9 @@
% \begin{macrocode}
\NewDocumentCommand \@@_chessboardcolors { O { } m m }
{
- \int_step_inline:nn { \int_use:N \c at iRow }
+ \int_step_inline:nn \c at iRow
{
- \int_step_inline:nn { \int_use:N \c at jCol }
+ \int_step_inline:nn \c at jCol
{
\int_if_even:nTF { ####1 + ##1 }
{ \@@_cellcolor [ #1 ] { #2 } }
@@ -10468,7 +10568,7 @@
\seq_clear_new:N \l_@@_colors_seq
\seq_set_split:Nnn \l_@@_colors_seq { , } { #3 }
\tl_clear_new:N \l_@@_cols_tl
- \tl_set:Nn \l_@@_cols_tl { - }
+ \cs_set_nopar:Npn \l_@@_cols_tl { - }
\keys_set:nn { NiceMatrix / rowcolors } { #4 }
% \end{macrocode}
% The counter |\l_@@_color_int| will be the rank of the current color in the list of
@@ -10475,7 +10575,7 @@
% colors (modulo the length of the list).
% \begin{macrocode}
\int_zero_new:N \l_@@_color_int
- \int_set:Nn \l_@@_color_int 1
+ \int_set_eq:NN \l_@@_color_int \c_one_int
\bool_if:NT \l_@@_respect_blocks_bool
{
% \end{macrocode}
@@ -10494,10 +10594,10 @@
% \begin{macrocode}
\clist_map_inline:nn { #2 }
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \@@_cut_on_hyphen:w ##1 \q_stop }
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at iRow } }
% \end{macrocode}
% Now, |l_tmpa_tl| and |l_tmpb_tl| are the first row and the last row of the
% interval of rows that we have to treat. The counter |\l_tmpa_int| will be the
@@ -10527,7 +10627,7 @@
% Now, the last row of the block is computed in |\l_tmpb_int|.
% \begin{macrocode}
}
- \tl_set:Nx \l_@@_rows_tl
+ \tl_set:No \l_@@_rows_tl
{ \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
% \end{macrocode}
% |\l_@@_tmpc_tl| will be the color that we will use.
@@ -10595,11 +10695,13 @@
% \begin{macrocode}
\prg_new_conditional:Nnn \@@_not_in_exterior:nnnnn p
{
- \bool_lazy_or:nnTF
- { \int_if_zero_p:n { #4 } }
- { \int_compare_p:nNn { #2 } = { \int_eval:n { \c at jCol + 1 } } }
+ \int_if_zero:nTF { #4 }
\prg_return_false:
- \prg_return_true:
+ {
+ \int_compare:nNnTF { #2 } > \c at jCol
+ \prg_return_false:
+ \prg_return_true:
+ }
}
% \end{macrocode}
%
@@ -10609,14 +10711,13 @@
% \begin{macrocode}
\prg_new_conditional:Nnn \@@_intersect_our_row:nnnnn p
{
- \bool_if:nTF
- {
- \int_compare_p:n { #1 <= \l_tmpa_int }
- &&
- \int_compare_p:n { \l_tmpa_int <= #3 }
+ \int_compare:nNnTF { #1 } > \l_tmpa_int
+ \prg_return_false:
+ {
+ \int_compare:nNnTF \l_tmpa_int > { #3 }
+ \prg_return_false:
+ \prg_return_true:
}
- \prg_return_true:
- \prg_return_false:
}
% \end{macrocode}
%
@@ -10628,50 +10729,62 @@
% below a command |\@@_cartesian_path:| which corresponds to a value $0$~pt for
% the radius of the corners.
%
-% This command is in particular used in |\@@_rectanglecolor:nnn| (used in
+% This command is, in particular, used in |\@@_rectanglecolor:nnn| (used in
% |\@@_rectanglecolor|, itself used in |\@@_cellcolor|).
% \begin{macrocode}
\cs_new_protected:Npn \@@_cartesian_path_normal:n #1
{
- \bool_lazy_any:nT
+ \dim_compare:nNnTF { #1 } = \c_zero_dim
{
- { ! \seq_if_empty_p:N \l_@@_corners_cells_seq }
- { \dim_compare_p:nNn { #1 } = \c_zero_dim }
- { ! \@@_nocolor_used_bool }
+ \bool_if:NTF
+ \@@_nocolor_used_bool
+ \@@_cartesian_path_normal_ii:
+ {
+ \seq_if_empty:NTF \l_@@_corners_cells_seq
+ { \@@_cartesian_path_normal_i:n { #1 } }
+ \@@_cartesian_path_normal_ii:
+ }
}
- {
- \@@_expand_clist:NN \l_@@_cols_tl \c at jCol
- \@@_expand_clist:NN \l_@@_rows_tl \c at iRow
- }
+ { \@@_cartesian_path_normal_i:n { #1 } }
+ }
% \end{macrocode}
+%
+%
+% \bigskip
+% First, the situation where is a rectangular zone of cells will be colored as a
+% whole (in the instructions of the resulting \textsc{pdf}). The argument is the
+% radius of the corners.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cartesian_path_normal_i:n #1
+ {
+ \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
+% \end{macrocode}
% We begin the loop over the columns.
% \begin{macrocode}
\clist_map_inline:Nn \l_@@_cols_tl
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \@@_cut_on_hyphen:w ##1 \q_stop }
{ \@@_cut_on_hyphen:w ##1 - ##1 \q_stop }
- \bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpa_tl }
- { \str_if_eq_p:Vn \l_tmpa_tl { * } }
- { \tl_set:Nn \l_tmpa_tl { 1 } }
- \bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpb_tl }
- { \str_if_eq_p:Vn \l_tmpb_tl { * } }
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+ \tl_if_empty:NTF \l_tmpa_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ {
+ \tl_if_eq:NNT \l_tmpa_tl \c_@@_star_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ }
+ \tl_if_empty:NTF \l_tmpb_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at jCol } }
+ {
+ \tl_if_eq:NNT \l_tmpb_tl \c_@@_star_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at jCol } }
+ }
\int_compare:nNnT \l_tmpb_tl > \g_@@_col_total_int
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \g_@@_col_total_int } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N \g_@@_col_total_int } }
% \end{macrocode}
% |\l_@@_tmpc_tl| will contain the number of column.
% \begin{macrocode}
\tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl
-% \end{macrocode}
-% If we decide to provide the commands |\cellcolor|, |\rectanglecolor|,
-% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| in the
-% |code-before| of a |\SubMatrix|, we will have to modify the following line, by
-% adding a kind of offset. We will have also some other lines to modify.
-% \begin{macrocode}
\@@_qpoint:n { col - \l_tmpa_tl }
\int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl
{ \dim_set:Nn \l_@@_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
@@ -10683,28 +10796,76 @@
% \begin{macrocode}
\clist_map_inline:Nn \l_@@_rows_tl
{
- \tl_set:Nn \l_tmpa_tl { ####1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ####1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \@@_cut_on_hyphen:w ####1 \q_stop }
{ \@@_cut_on_hyphen:w ####1 - ####1 \q_stop }
- \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
- \tl_if_empty:NT \l_tmpb_tl
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+ \tl_if_empty:NTF \l_tmpa_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ {
+ \tl_if_eq:NNT \l_tmpa_tl \c_@@_star_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ }
+ \tl_if_empty:NTF \l_tmpb_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at iRow } }
+ {
+ \tl_if_eq:NNT \l_tmpb_tl \c_@@_star_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at iRow } }
+ }
\int_compare:nNnT \l_tmpb_tl > \g_@@_row_total_int
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \g_@@_row_total_int } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N \g_@@_row_total_int } }
% \end{macrocode}
% Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|.
% \begin{macrocode}
- \seq_if_in:NxF \l_@@_corners_cells_seq
- { \l_tmpa_tl - \l_@@_tmpc_tl }
+ \cs_if_exist:cF
+ { @@ _ \l_tmpa_tl _ \l_@@_tmpc_tl _ nocolor }
{
\@@_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
\@@_qpoint:n { row - \l_tmpa_tl }
\dim_set:Nn \l_@@_tmpd_dim { \pgf at y + 0.5 \arrayrulewidth }
- \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
+ \pgfpathrectanglecorners
+ { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim }
+ { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+%
+%
+% Now, the case where the cells will be colored cell by cell (it's mandatory for
+% example if the key |corners| is used).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cartesian_path_normal_ii:
+ {
+ \@@_expand_clist:NN \l_@@_cols_tl \c at jCol
+ \@@_expand_clist:NN \l_@@_rows_tl \c at iRow
+% \end{macrocode}
+% We begin the loop over the columns.
+% \begin{macrocode}
+ \clist_map_inline:Nn \l_@@_cols_tl
+ {
+ \@@_qpoint:n { col - ##1 }
+ \int_compare:nNnTF \l_@@_first_col_int = { ##1 }
+ { \dim_set:Nn \l_@@_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
+ { \dim_set:Nn \l_@@_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
+ \@@_qpoint:n { col - \int_eval:n { ##1 + 1 } }
+ \dim_set:Nn \l_tmpa_dim { \pgf at x + 0.5 \arrayrulewidth }
+% \end{macrocode}
+% We begin the loop over the rows.
+% \begin{macrocode}
+ \clist_map_inline:Nn \l_@@_rows_tl
+ {
+ \seq_if_in:NnF \l_@@_corners_cells_seq
+ { ####1 - ##1 }
+ {
+ \@@_qpoint:n { row - \int_eval:n { ####1 + 1 } }
+ \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
+ \@@_qpoint:n { row - ####1 }
+ \dim_set:Nn \l_@@_tmpd_dim { \pgf at y + 0.5 \arrayrulewidth }
\cs_if_exist:cF
- { @@ _ \l_tmpa_tl _ \l_@@_tmpc_tl _ nocolor }
+ { @@ _ ####1 _ ##1 _ nocolor }
{
\pgfpathrectanglecorners
{ \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim }
@@ -10716,12 +10877,14 @@
}
% \end{macrocode}
%
+%
+%
% \bigskip
% The following command corresponds to a radius of the corners equal to $0$~pt.
% This command is used by the commands |\@@_rowcolors|, |\@@_columncolor| and
% |\@@_rowcolor:n| (used in |\@@_rowcolor|).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_cartesian_path: { \@@_cartesian_path:n { 0 pt } }
+\cs_new_protected:Npn \@@_cartesian_path: { \@@_cartesian_path:n \c_zero_dim }
% \end{macrocode}
%
%
@@ -10761,20 +10924,20 @@
\clist_clear:N #1
\clist_map_inline:Nn \l_tmpa_clist
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \@@_cut_on_hyphen:w ##1 \q_stop }
{ \@@_cut_on_hyphen:w ##1 - ##1 \q_stop }
\bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpa_tl }
- { \str_if_eq_p:Vn \l_tmpa_tl { * } }
- { \tl_set:Nn \l_tmpa_tl { 1 } }
+ { \tl_if_blank_p:o \l_tmpa_tl }
+ { \str_if_eq_p:on \l_tmpa_tl { * } }
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
\bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpb_tl }
- { \str_if_eq_p:Vn \l_tmpb_tl { * } }
- { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } }
+ { \tl_if_blank_p:o \l_tmpb_tl }
+ { \str_if_eq_p:on \l_tmpb_tl { * } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N #2 } }
\int_compare:nNnT \l_tmpb_tl > #2
- { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N #2 } }
\int_step_inline:nnn \l_tmpa_tl \l_tmpb_tl
{ \clist_put_right:Nn #1 { ####1 } }
}
@@ -11071,7 +11234,6 @@
position .int_set:N = \l_@@_position_int ,
position .value_required:n = true ,
start .int_set:N = \l_@@_start_int ,
- start .initial:n = 1 ,
end .code:n =
\bool_lazy_or:nnTF
{ \tl_if_empty_p:n { #1 } }
@@ -11140,7 +11302,6 @@
% The group is for the options.
% \begin{macrocode}
\group_begin:
- \int_zero_new:N \l_@@_end_int
\int_set_eq:NN \l_@@_end_int \c at iRow
\keys_set_known:nnN { NiceMatrix / Rules } { #1 } \l_@@_other_keys_tl
% \end{macrocode}
@@ -11157,14 +11318,12 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_vline_i:
{
- \int_zero_new:N \l_@@_local_start_int
- \int_zero_new:N \l_@@_local_end_int
% \end{macrocode}
% |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When
% we have found a row corresponding to a rule to draw, we note its number in
% |\l_@@_tmpc_tl|.
% \begin{macrocode}
- \tl_set:Nx \l_tmpb_tl { \int_eval:n \l_@@_position_int }
+ \tl_set:No \l_tmpb_tl { \int_use:N \l_@@_position_int }
\int_step_variable:nnNn \l_@@_start_int \l_@@_end_int
\l_tmpa_tl
{
@@ -11193,7 +11352,7 @@
{ \int_set:Nn \l_@@_local_start_int \l_tmpa_tl }
}
{
- \int_compare:nNnT \l_@@_local_start_int > 0
+ \int_compare:nNnT \l_@@_local_start_int > \c_zero_int
{
\int_set:Nn \l_@@_local_end_int { \l_tmpa_tl - 1 }
\@@_vline_ii:
@@ -11201,7 +11360,7 @@
}
}
}
- \int_compare:nNnT \l_@@_local_start_int > 0
+ \int_compare:nNnT \l_@@_local_start_int > \c_zero_int
{
\int_set_eq:NN \l_@@_local_end_int \l_@@_end_int
\@@_vline_ii:
@@ -11225,7 +11384,7 @@
\l_@@_corners_cells_seq
{ \l_tmpa_tl - \l_tmpb_tl }
{
- \int_compare:nNnTF \l_tmpb_tl = 1
+ \int_compare:nNnTF \l_tmpb_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
\seq_if_in:NxT
@@ -11278,9 +11437,9 @@
\dim_set_eq:NN \l_@@_tmpc_dim \pgf at y
\bool_lazy_all:nT
{
- { \int_compare_p:nNn \l_@@_multiplicity_int > 1 }
+ { \int_compare_p:nNn \l_@@_multiplicity_int > \c_one_int }
{ \cs_if_exist_p:N \CT at drsc@ }
- { ! \tl_if_blank_p:V \CT at drsc@ }
+ { ! \tl_if_blank_p:o \CT at drsc@ }
}
{
\group_begin:
@@ -11362,7 +11521,7 @@
\dim_set:Nn \l_tmpb_dim { \pgf at x - 0.5 \l_@@_rule_width_dim }
\@@_qpoint:n { row - \int_eval:n { \l_@@_local_end_int + 1 } }
\dim_set_eq:NN \l_@@_tmpc_dim \pgf at y
- \exp_args:NV \tikzset \l_@@_tikz_rule_tl
+ \exp_args:No \tikzset \l_@@_tikz_rule_tl
\use:e { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] }
( \l_tmpb_dim , \l_tmpa_dim ) --
( \l_tmpb_dim , \l_@@_tmpc_dim ) ;
@@ -11379,17 +11538,14 @@
\cs_new_protected:Npn \@@_draw_vlines:
{
\int_step_inline:nnn
+ { \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool 2 1 }
{
- \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool }
- 1 2
- }
- {
- \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool }
+ \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool
+ \c at jCol
{ \int_eval:n { \c at jCol + 1 } }
- \c at jCol
}
{
- \tl_if_eq:NnF \l_@@_vlines_clist { all }
+ \tl_if_eq:NNF \l_@@_vlines_clist \c_@@_all_tl
{ \clist_if_in:NnT \l_@@_vlines_clist { ##1 } }
{ \@@_vline:n { position = ##1 , total-width = \arrayrulewidth } }
}
@@ -11429,7 +11585,7 @@
% we have found a column corresponding to a rule to draw, we note its number in
% |\l_@@_tmpc_tl|.
% \begin{macrocode}
- \tl_set:Nx \l_tmpa_tl { \int_use:N \l_@@_position_int }
+ \tl_set:No \l_tmpa_tl { \int_use:N \l_@@_position_int }
\int_step_variable:nnNn \l_@@_start_int \l_@@_end_int
\l_tmpb_tl
{
@@ -11458,7 +11614,7 @@
{ \int_set:Nn \l_@@_local_start_int \l_tmpb_tl }
}
{
- \int_compare:nNnT \l_@@_local_start_int > 0
+ \int_compare:nNnT \l_@@_local_start_int > \c_zero_int
{
\int_set:Nn \l_@@_local_end_int { \l_tmpb_tl - 1 }
\@@_hline_ii:
@@ -11466,7 +11622,7 @@
}
}
}
- \int_compare:nNnT \l_@@_local_start_int > 0
+ \int_compare:nNnT \l_@@_local_start_int > \c_zero_int
{
\int_set_eq:NN \l_@@_local_end_int \l_@@_end_int
\@@_hline_ii:
@@ -11490,7 +11646,7 @@
\l_@@_corners_cells_seq
{ \l_tmpa_tl - \l_tmpb_tl }
{
- \int_compare:nNnTF \l_tmpa_tl = 1
+ \int_compare:nNnTF \l_tmpa_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
\seq_if_in:NxT
@@ -11542,9 +11698,9 @@
\dim_set_eq:NN \l_@@_tmpc_dim \pgf at x
\bool_lazy_all:nT
{
- { \int_compare_p:nNn \l_@@_multiplicity_int > 1 }
+ { \int_compare_p:nNn \l_@@_multiplicity_int > \c_one_int }
{ \cs_if_exist_p:N \CT at drsc@ }
- { ! \tl_if_blank_p:V \CT at drsc@ }
+ { ! \tl_if_blank_p:o \CT at drsc@ }
}
{
\group_begin:
@@ -11634,7 +11790,7 @@
\dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim
\@@_qpoint:n { col - \int_use:N \l_@@_local_start_int }
\dim_set_eq:NN \l_@@_x_initial_dim \pgf at x
- \int_compare:nNnT \l_@@_local_start_int = 1
+ \int_compare:nNnT \l_@@_local_start_int = \c_one_int
{
\dim_sub:Nn \l_@@_x_initial_dim \l_@@_left_margin_dim
\bool_if:NF \g_@@_delims_bool
@@ -11688,7 +11844,7 @@
\dim_set:Nn \l_tmpb_dim { \pgf at y - 0.5 \l_@@_rule_width_dim }
\@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } }
\dim_set_eq:NN \l_@@_tmpc_dim \pgf at x
- \exp_args:NV \tikzset \l_@@_tikz_rule_tl
+ \exp_args:No \tikzset \l_@@_tikz_rule_tl
\use:e { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] }
( \l_tmpa_dim , \l_tmpb_dim ) --
( \l_@@_tmpc_dim , \l_tmpb_dim ) ;
@@ -11705,17 +11861,14 @@
\cs_new_protected:Npn \@@_draw_hlines:
{
\int_step_inline:nnn
+ { \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool 2 1 }
{
- \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool }
- 1 2
- }
- {
- \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool }
+ \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool
+ \c at iRow
{ \int_eval:n { \c at iRow + 1 } }
- \c at iRow
}
{
- \tl_if_eq:NnF \l_@@_hlines_clist { all }
+ \tl_if_eq:NNF \l_@@_hlines_clist \c_@@_all_tl
{ \clist_if_in:NnT \l_@@_hlines_clist { ##1 } }
{ \@@_hline:n { position = ##1 , total-width = \arrayrulewidth } }
}
@@ -11759,7 +11912,7 @@
\cs_set:Npn \@@_Hline_iv:nn #1 #2
{
\@@_compute_rule_width:n { multiplicity = #1 , #2 }
- \skip_vertical:n { \l_@@_rule_width_dim }
+ \skip_vertical:N \l_@@_rule_width_dim
\tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_hline:n
@@ -11808,7 +11961,7 @@
{ \str_if_empty_p:N \l_@@_ccommand_str }
}
{ \@@_error:n { No~letter~and~no~command } }
- { \exp_args:NV \@@_custom_line_i:n \l_@@_other_keys_tl }
+ { \exp_args:No \@@_custom_line_i:n \l_@@_other_keys_tl }
}
% \end{macrocode}
%
@@ -11847,12 +12000,11 @@
\bool_if:NT \l_@@_color_bool
{ \@@_error:n { color~in~custom-line~with~tikz } }
}
- \bool_if:nT
+ \bool_if:NT \l_@@_dotted_rule_bool
{
- \int_compare_p:nNn \l_@@_multiplicity_int > 1
- && \l_@@_dotted_rule_bool
+ \int_compare:nNnT \l_@@_multiplicity_int > \c_one_int
+ { \@@_error:n { key~multiplicity~with~dotted } }
}
- { \@@_error:n { key~multiplicity~with~dotted } }
\str_if_empty:NF \l_@@_letter_str
{
\int_compare:nTF { \str_count:N \l_@@_letter_str != 1 }
@@ -11953,7 +12105,7 @@
% |\noalign| (which is in |\Hline|).
% \begin{macrocode}
\cs_set:cpn { nicematrix - \l_@@_command_str } { \Hline [ #1 ] }
- \seq_put_left:NV \l_@@_custom_line_commands_seq \l_@@_command_str
+ \seq_put_left:No \l_@@_custom_line_commands_seq \l_@@_command_str
}
% \end{macrocode}
%
@@ -11983,7 +12135,7 @@
{ \@@_c_custom_line_i:nn { #1 , ##1 } { ####1 } }
}
}
- \seq_put_left:NV \l_@@_custom_line_commands_seq \l_@@_ccommand_str
+ \seq_put_left:No \l_@@_custom_line_commands_seq \l_@@_ccommand_str
}
% \end{macrocode}
% The first argument is the list of key-value pairs characteristic of the line.
@@ -12072,14 +12224,17 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_hline_in_block:nnnnn #1 #2 #3 #4 #5
{
- \bool_lazy_all:nT
+ \int_compare:nNnT \l_tmpa_tl > { #1 }
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
+ \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
% \end{macrocode}
%
@@ -12087,14 +12242,17 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_vline_in_block:nnnnn #1 #2 #3 #4 #5
{
- \bool_lazy_all:nT
- {
- { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
+ \int_compare:nNnT \l_tmpa_tl > { #1 - 1 }
+ {
+ \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl > { #2 }
+ {
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
% \end{macrocode}
%
@@ -12101,16 +12259,18 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_hline_in_stroken_block:nnnn #1 #2 #3 #4
{
- \bool_lazy_all:nT
- {
- {
- ( \int_compare_p:nNn \l_tmpa_tl = { #1 } )
- || ( \int_compare_p:nNn \l_tmpa_tl = { #3 + 1 } )
- }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
+ \int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ {
+ \int_compare:nNnTF \l_tmpa_tl = { #1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ {
+ \int_compare:nNnT \l_tmpa_tl = { #3 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
% \end{macrocode}
%
@@ -12117,16 +12277,18 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_vline_in_stroken_block:nnnn #1 #2 #3 #4
{
- \bool_lazy_all:nT
+ \int_compare:nNnT \l_tmpa_tl > { #1 - 1 }
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- {
- ( \int_compare_p:nNn \l_tmpb_tl = { #2 } )
- || ( \int_compare_p:nNn \l_tmpb_tl = { #4 + 1 } )
- }
+ \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
+ {
+ \int_compare:nNnTF \l_tmpb_tl = { #2 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ {
+ \int_compare:nNnT \l_tmpb_tl = { #4 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
% \end{macrocode}
%
@@ -12301,15 +12463,15 @@
%
%
% \begin{macrocode}
-\cs_new_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_set_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
- \int_compare:nNnT { #3 } < { \int_eval:n { #1 + 1 } }
+ \int_compare:nNnF { #3 } > { #1 }
{
- \int_compare:nNnT { #1 } < { \int_eval:n { #5 + 1 } }
+ \int_compare:nNnF { #1 } > { #5 }
{
- \int_compare:nNnT { #4 } < { \int_eval:n { #2 + 1 } }
+ \int_compare:nNnF { #4 } > { #2 }
{
- \int_compare:nNnT { #2 } < { \int_eval:n { #6 + 1 } }
+ \int_compare:nNnF { #2 } > { #6 }
{ \bool_set_true:N \l_tmpb_bool }
}
}
@@ -12565,7 +12727,7 @@
% Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:|
% because this command will also be used for the creation of the ``large nodes''.
% \begin{macrocode}
- \tl_set:Nn \l_@@_suffix_tl { -medium }
+ \cs_set_nopar:Npn \l_@@_suffix_tl { -medium }
\@@_create_nodes:
\endpgfpicture
}
@@ -12588,7 +12750,7 @@
\pgf at relevantforpicturesizefalse
\@@_computations_for_medium_nodes:
\@@_computations_for_large_nodes:
- \tl_set:Nn \l_@@_suffix_tl { - large }
+ \cs_set_nopar:Npn \l_@@_suffix_tl { - large }
\@@_create_nodes:
\endpgfpicture
}
@@ -12605,10 +12767,10 @@
% Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:|
% because this command will also be used for the creation of the ``large nodes''.
% \begin{macrocode}
- \tl_set:Nn \l_@@_suffix_tl { - medium }
+ \cs_set_nopar:Npn \l_@@_suffix_tl { - medium }
\@@_create_nodes:
\@@_computations_for_large_nodes:
- \tl_set:Nn \l_@@_suffix_tl { - large }
+ \cs_set_nopar:Npn \l_@@_suffix_tl { - large }
\@@_create_nodes:
\endpgfpicture
}
@@ -12622,8 +12784,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_computations_for_large_nodes:
{
- \int_set:Nn \l_@@_first_row_int 1
- \int_set:Nn \l_@@_first_col_int 1
+ \int_set_eq:NN \l_@@_first_row_int \c_one_int
+ \int_set_eq:NN \l_@@_first_col_int \c_one_int
% \end{macrocode}
% We have to change the values of all the dimensions
% \texttt{l_@@_row_\textsl{i}_min_dim}, \texttt{l_@@_row_\textsl{i}_max_dim},
@@ -12777,13 +12939,13 @@
R .value_forbidden:n = true ,
C .code:n = \str_set:Nn \l_@@_hpos_block_str c ,
C .value_forbidden:n = true ,
- t .code:n = \str_set:Nn \l_@@_vpos_of_block_str t ,
+ t .code:n = \str_set:Nn \l_@@_vpos_block_str t ,
t .value_forbidden:n = true ,
- T .code:n = \str_set:Nn \l_@@_vpos_of_block_str T ,
+ T .code:n = \str_set:Nn \l_@@_vpos_block_str T ,
T .value_forbidden:n = true ,
- b .code:n = \str_set:Nn \l_@@_vpos_of_block_str b ,
+ b .code:n = \str_set:Nn \l_@@_vpos_block_str b ,
b .value_forbidden:n = true ,
- B .code:n = \str_set:Nn \l_@@_vpos_of_block_str B ,
+ B .code:n = \str_set:Nn \l_@@_vpos_block_str B ,
B .value_forbidden:n = true ,
color .code:n =
\@@_color:n { #1 }
@@ -12792,8 +12954,9 @@
{ \char_set_catcode_other:N ! }
{ #1 } ,
color .value_required:n = true ,
- respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool ,
- respect-arraystretch .default:n = true
+ respect-arraystretch .code:n =
+ \cs_set_eq:NN \@@_reset_arraystretch: \prg_do_nothing: ,
+ respect-arraystretch .value_forbidden:n = true ,
}
% \end{macrocode}
%
@@ -12819,7 +12982,7 @@
\peek_remove_spaces:n
{
\tl_if_blank:nTF { #2 }
- { \@@_Block_i 1-1 \q_stop }
+ { \@@_Block_ii:nnnnn \c_one_int \c_one_int }
{
\int_compare:nNnTF { \char_value_catcode:n { 45 } } = { 13 }
\@@_Block_i_czech \@@_Block_i
@@ -12882,13 +13045,13 @@
% \medskip
% If the block is mono-column.
% \begin{macrocode}
- \int_compare:nNnTF \l_tmpb_int = 1
+ \int_compare:nNnTF \l_tmpb_int = \c_one_int
{
- \str_if_empty:NTF \l_@@_hpos_cell_str
- { \str_set:Nn \l_@@_hpos_block_str c }
- { \str_set_eq:NN \l_@@_hpos_block_str \l_@@_hpos_cell_str }
+ \tl_if_empty:NTF \l_@@_hpos_cell_tl
+ { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_c_str }
+ { \str_set:NV \l_@@_hpos_block_str \l_@@_hpos_cell_tl }
}
- { \str_set:Nn \l_@@_hpos_block_str c }
+ { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_c_str }
% \end{macrocode}
% The value of |\l_@@_hpos_block_str| may be modified by the keys of the
% command |\Block| that we will analyze now.
@@ -12921,9 +13084,9 @@
\bool_if:nTF
{
(
- \int_compare_p:nNn { \l_tmpa_int } = 1
+ \int_compare_p:nNn \l_tmpa_int = \c_one_int
||
- \int_compare_p:nNn { \l_tmpb_int } = 1
+ \int_compare_p:nNn \l_tmpb_int = \c_one_int
)
&& ! \tl_if_empty_p:n { #5 }
% \end{macrocode}
@@ -12994,8 +13157,8 @@
% |\documentclass| with |\RequirePackage{expl3}|).
% \begin{macrocode}
\tl_if_empty:NTF \l_@@_color_tl
- { \int_compare:nNnT { #2 } = 1 \set at color }
- { \@@_color:V \l_@@_color_tl }
+ { \int_compare:nNnT { #2 } = \c_one_int \set at color }
+ { \@@_color:o \l_@@_color_tl }
% \end{macrocode}
% If the block is mono-row, we use |\g_@@_row_style_tl| even if it has yet been
% used in the beginning of the cell where the command |\Block| has been issued
@@ -13002,7 +13165,7 @@
% because we want to be able to take into account a potential instruction of
% color of the font in |\g_@@_row_style_tl|.
% \begin{macrocode}
- \int_compare:nNnT { #1 } = 1
+ \int_compare:nNnT { #1 } = \c_one_int
{
\int_if_zero:nTF \c at iRow
\l_@@_code_for_first_row_tl
@@ -13012,8 +13175,10 @@
}
\g_@@_row_style_tl
}
- \bool_if:NF \l_@@_respect_arraystretch_bool
- { \cs_set:Npn \arraystretch { 1 } }
+% \end{macrocode}
+% The following command will be no-op when |respect-arraystretch| is in force.
+% \begin{macrocode}
+ \@@_reset_arraystretch:
\dim_zero:N \extrarowheight
% \end{macrocode}
% |#4| is the optional argument of the command |\Block|, provided with the
@@ -13039,12 +13204,12 @@
{
\bool_lazy_all:nTF
{
- { \int_compare_p:nNn { #2 } = 1 }
+ { \int_compare_p:nNn { #2 } = \c_one_int }
% \end{macrocode}
% Remind that, when the column has not a fixed width, the dimension
% |\l_@@_col_width_dim| has the conventional value of $-1$~cm.
% \begin{macrocode}
- { \dim_compare_p:n { \l_@@_col_width_dim >= \c_zero_dim } }
+ { ! \dim_compare_p:nNn \l_@@_col_width_dim < \c_zero_dim }
{ ! \g_@@_rotate_bool }
}
% \end{macrocode}
@@ -13055,9 +13220,9 @@
\use:e
{
\exp_not:N \begin { minipage }%
- [ \str_lowercase:V { \l_@@_vpos_of_block_str } ]
+ [ \str_lowercase:V \l_@@_vpos_block_str ]
{ \l_@@_col_width_dim }
- \str_case:Vn \l_@@_hpos_block_str
+ \str_case:on \l_@@_hpos_block_str
{ c \centering r \raggedleft l \raggedright }
}
#5
@@ -13070,7 +13235,7 @@
\use:e
{
\exp_not:N \begin { tabular }%
- [ \str_lowercase:V { \l_@@_vpos_of_block_str } ]
+ [ \str_lowercase:V \l_@@_vpos_block_str ]
{ @ { } \l_@@_hpos_block_str @ { } }
}
#5
@@ -13086,7 +13251,7 @@
\use:e
{
\exp_not:N \begin { array }%
- [ \str_lowercase:V { \l_@@_vpos_of_block_str } ]
+ [ \str_lowercase:V \l_@@_vpos_block_str ]
{ @ { } \l_@@_hpos_block_str @ { } }
}
#5
@@ -13108,7 +13273,7 @@
% If we are in a mono-column block, we take into account the width of that block
% for the width of the column.
% \begin{macrocode}
- \int_compare:nNnT { #2 } = 1
+ \int_compare:nNnT { #2 } = \c_one_int
{
\dim_gset:Nn \g_@@_blocks_wd_dim
{
@@ -13129,9 +13294,9 @@
% |b| or |B|.}, we take into account the height and the depth of that block for the
% height and the depth of the row.
% \begin{macrocode}
- \str_if_eq:VnT \l_@@_vpos_of_block_str { c }
+ \str_if_eq:VnT \l_@@_vpos_block_str { c }
{
- \int_compare:nNnT { #1 } = 1
+ \int_compare:nNnT { #1 } = \c_one_int
{
\dim_gset:Nn \g_@@_blocks_ht_dim
{
@@ -13197,7 +13362,7 @@
\bool_if:NTF \g_@@_rotate_c_bool
{ c }
{
- \str_case:VnF \l_@@_vpos_of_block_str
+ \str_case:onF \l_@@_vpos_block_str
{ b l B l t r T r }
{ \int_compare:nNnTF \c at iRow = \l_@@_last_row_int r l }
}
@@ -13264,8 +13429,10 @@
\bool_if:NTF \l_@@_tabular_bool
{
\group_begin:
- \bool_if:NF \l_@@_respect_arraystretch_bool
- { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+% \end{macrocode}
+% The following command will be no-op when |respect-arraystretch| is in force.
+% \begin{macrocode}
+ \@@_reset_arraystretch:
\exp_not:n
{
\dim_zero:N \extrarowheight
@@ -13278,10 +13445,9 @@
% the tabular is the same as the external alignment of the tabular (that is to
% say the position of the block in its zone of merged cells).
% \begin{macrocode}
- % \@@_adjust_hpos_rotate:
\use:e
{
- \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_str ]
+ \exp_not:N \begin { tabular } [ \l_@@_vpos_block_str ]
{ @ { } \l_@@_hpos_block_str @ { } }
}
#5
@@ -13294,17 +13460,18 @@
% \begin{macrocode}
{
\group_begin:
- \bool_if:NF \l_@@_respect_arraystretch_bool
- { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+% \end{macrocode}
+% The following will be no-op when |respect-arraystretch| is in force.
+% \begin{macrocode}
+ \@@_reset_arraystretch:
\exp_not:n
{
\dim_zero:N \extrarowheight
#4
- % \@@_adjust_hpos_rotate:
- \c_math_toggle_token % :n c
+ \c_math_toggle_token
\use:e
{
- \exp_not:N \begin { array } [ \l_@@_vpos_of_block_str ]
+ \exp_not:N \begin { array } [ \l_@@_vpos_block_str ]
{ @ { } \l_@@_hpos_block_str @ { } }
}
#5
@@ -13376,16 +13543,18 @@
\bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
C .code:n = \str_set:Nn \l_@@_hpos_block_str c
\bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
- t .code:n = \str_set:Nn \l_@@_vpos_of_block_str t ,
- T .code:n = \str_set:Nn \l_@@_vpos_of_block_str T ,
- b .code:n = \str_set:Nn \l_@@_vpos_of_block_str b ,
- B .code:n = \str_set:Nn \l_@@_vpos_of_block_str B ,
- v-center .code:n = \str_set:Nn \l_@@_vpos_of_block_str { c } ,
+ t .code:n = \str_set:Nn \l_@@_vpos_block_str t ,
+ T .code:n = \str_set:Nn \l_@@_vpos_block_str T ,
+ b .code:n = \str_set:Nn \l_@@_vpos_block_str b ,
+ B .code:n = \str_set:Nn \l_@@_vpos_block_str B ,
+ v-center .code:n = \str_set:Nn \l_@@_vpos_block_str { c } ,
v-center .value_forbidden:n = true ,
name .tl_set:N = \l_@@_block_name_str ,
name .value_required:n = true ,
name .initial:n = ,
- respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool ,
+ respect-arraystretch .code:n =
+ \cs_set_eq:NN \@@_reset_arraystretch: \prg_do_nothing: ,
+ respect-arraystretch .value_forbidden:n = true ,
transparent .bool_set:N = \l_@@_transparent_bool ,
transparent .default:n = true ,
transparent .initial:n = false ,
@@ -13435,11 +13604,8 @@
{
\bool_lazy_and:nnTF
\l_@@_preamble_bool
+ { \int_compare_p:nNnF \l_@@_last_col_int > \g_@@_static_num_of_col_int }
{
- \int_compare_p:n
- { \l_@@_last_col_int <= \g_@@_static_num_of_col_int }
- }
- {
\msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 }
\@@_msg_redirect_name:nn { Block~too~large~2 } { none }
\@@_msg_redirect_name:nn { columns~not~used } { none }
@@ -13471,7 +13637,7 @@
% \begin{macrocode}
\group_begin:
\int_compare:nNnT { #1 } = { #3 }
- { \str_set:Nn \l_@@_vpos_of_block_str { t } }
+ { \str_set:Nn \l_@@_vpos_block_str { t } }
\keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
% \end{macrocode}
%
@@ -13496,28 +13662,28 @@
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
}
}
- \bool_if:nF
+ \bool_if:NF \l_@@_transparent_bool
{
- \l_@@_transparent_bool
- || ( \l_@@_vlines_block_bool && \l_@@_hlines_block_bool )
- }
- {
+ \bool_lazy_and:nnF \l_@@_vlines_block_bool \l_@@_hlines_block_bool
+ {
% \end{macrocode}
% The sequence of the positions of the blocks (excepted the blocks with the key
% |hvlines|) will be used when drawing the rules (in fact, there is also the
% |\multicolumn| and the |\diagbox| in that sequence).
% \begin{macrocode}
- \seq_gput_left:Nx \g_@@_pos_of_blocks_seq
- { { #1 } { #2 } { #3 } { #4 } { \l_@@_block_name_str } }
+ \seq_gput_left:Nx \g_@@_pos_of_blocks_seq
+ { { #1 } { #2 } { #3 } { #4 } { \l_@@_block_name_str } }
+ }
}
% \end{macrocode}
%
% \bigskip
% \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 } }
+ \tl_if_empty:NF \l_@@_draw_tl
+ {
+ \bool_lazy_or:nnT \l_@@_hlines_block_bool \l_@@_vlines_block_bool
+ { \@@_error:n { hlines~with~color } }
+ }
% \end{macrocode}
% \bigskip
% \begin{macrocode}
@@ -13558,7 +13724,7 @@
\tl_set:Nx \l_@@_fill_tl
{
[ opacity = \l_@@_opacity_tl ,
- \tl_tail:V \l_@@_fill_tl
+ \tl_tail:o \l_@@_fill_tl
}
}
{
@@ -13569,7 +13735,7 @@
\tl_gput_right:Nx \g_@@_pre_code_before_tl
{
\exp_not:N \roundedrectanglecolor
- \exp_args:NV \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [
+ \exp_args:No \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [
{ \l_@@_fill_tl }
{ { \l_@@_fill_tl } }
{ #1 - #2 }
@@ -13796,9 +13962,9 @@
% \begin{macrocode}
\bool_lazy_any:nTF
{
- { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { c } }
- { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { T } }
- { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { B } }
+ { \str_if_eq_p:on \l_@@_vpos_block_str { c } }
+ { \str_if_eq_p:on \l_@@_vpos_block_str { T } }
+ { \str_if_eq_p:on \l_@@_vpos_block_str { B } }
}
% \end{macrocode}
% \medskip
@@ -13807,7 +13973,7 @@
% \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:Nn \l_@@_hpos_block_str r }
+ \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}
@@ -13814,7 +13980,7 @@
\bool_if:nT \g_@@_last_col_found_bool
{
\int_compare:nNnT { #2 } = \g_@@_col_total_int
- { \str_set:Nn \l_@@_hpos_block_str l }
+ { \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.
@@ -13821,10 +13987,10 @@
% \begin{macrocode}
\tl_set:Nx \l_tmpa_tl
{
- \str_case:Vn \l_@@_vpos_of_block_str
+ \str_case:on \l_@@_vpos_block_str
{
c {
- \str_case:Vn \l_@@_hpos_block_str
+ \str_case:on \l_@@_hpos_block_str
{
c { center }
l { west }
@@ -13833,7 +13999,7 @@
}
T {
- \str_case:Vn \l_@@_hpos_block_str
+ \str_case:on \l_@@_hpos_block_str
{
c { north }
l { north~west }
@@ -13842,7 +14008,7 @@
}
B {
- \str_case:Vn \l_@@_hpos_block_str
+ \str_case:on \l_@@_hpos_block_str
{
c { south}
l { south~west }
@@ -13866,7 +14032,7 @@
\pgfset
{
inner~xsep = \c_zero_dim ,
- inner~ysep = \l_@@_block_ysep_dim
+ inner~ysep = \c_zero_dim
}
\pgfnode
{ rectangle }
@@ -13874,7 +14040,7 @@
{ \box_use_drop:N \l_@@_cell_box } { } { }
}
% \end{macrocode}
-% End of the case when |\l_@@_vpos_of_block_str| is equal to |c|, |T| or |B|.
+% End of the case when |\l_@@_vpos_block_str| is equal to |c|, |T| or |B|.
% Now, the other cases.
% \begin{macrocode}
{
@@ -13885,7 +14051,7 @@
{
\@@_qpoint:n
{
- row - \str_if_eq:VnTF \l_@@_vpos_of_block_str { b } { #3 } { #1 }
+ row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 }
- base
}
}
@@ -13899,7 +14065,7 @@
\bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
}
{
- \str_case:Vn \l_@@_hpos_block_str
+ \str_case:on \l_@@_hpos_block_str
{
c { center }
l { west }
@@ -13914,7 +14080,7 @@
\pgfnode
{ rectangle }
{
- \str_case:Vn \l_@@_hpos_block_str
+ \str_case:on \l_@@_hpos_block_str
{
c { base }
l { base~west }
@@ -13953,9 +14119,9 @@
% If the user has used the key |color| of the command |\Block| without value,
% the color fixed by |\arrayrulecolor| is used.
% \begin{macrocode}
- \str_if_eq:VnTF \l_@@_draw_tl { default }
+ \tl_if_eq:NNTF \l_@@_draw_tl \c_@@_default_tl
{ \CT at arc@ }
- { \@@_color:V \l_@@_draw_tl }
+ { \@@_color:o \l_@@_draw_tl }
}
\pgfsetcornersarced
{
@@ -13964,30 +14130,31 @@
{ \l_@@_rounded_corners_dim }
}
\@@_cut_on_hyphen:w #2 \q_stop
- \bool_lazy_and:nnT
- { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
- { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
- {
- \@@_qpoint:n { row - \l_tmpa_tl }
- \dim_set_eq:NN \l_tmpb_dim \pgf at y
- \@@_qpoint:n { col - \l_tmpb_tl }
- \dim_set_eq:NN \l_@@_tmpc_dim \pgf at x
- \@@_cut_on_hyphen:w #3 \q_stop
- \int_compare:nNnT \l_tmpa_tl > \c at iRow
- { \tl_set:Nx \l_tmpa_tl { \int_use:N \c at iRow } }
- \int_compare:nNnT \l_tmpb_tl > \c at jCol
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \@@_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } }
- \dim_set_eq:NN \l_tmpa_dim \pgf at y
- \@@_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } }
- \dim_set_eq:NN \l_@@_tmpd_dim \pgf at x
- \pgfsetlinewidth { 1.1 \l_@@_line_width_dim }
- \pgfpathrectanglecorners
- { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim }
- { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim }
- \dim_compare:nNnTF \l_@@_rounded_corners_dim = \c_zero_dim
- { \pgfusepathqstroke }
- { \pgfusepath { stroke } }
+ \int_compare:nNnF \l_tmpa_tl > \c at iRow
+ {
+ \int_compare:nNnF \l_tmpb_tl > \c at jCol
+ {
+ \@@_qpoint:n { row - \l_tmpa_tl }
+ \dim_set_eq:NN \l_tmpb_dim \pgf at y
+ \@@_qpoint:n { col - \l_tmpb_tl }
+ \dim_set_eq:NN \l_@@_tmpc_dim \pgf at x
+ \@@_cut_on_hyphen:w #3 \q_stop
+ \int_compare:nNnT \l_tmpa_tl > \c at iRow
+ { \tl_set:No \l_tmpa_tl { \int_use:N \c at iRow } }
+ \int_compare:nNnT \l_tmpb_tl > \c at jCol
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at jCol } }
+ \@@_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } }
+ \dim_set_eq:NN \l_tmpa_dim \pgf at y
+ \@@_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } }
+ \dim_set_eq:NN \l_@@_tmpd_dim \pgf at x
+ \pgfsetlinewidth { 1.1 \l_@@_line_width_dim }
+ \pgfpathrectanglecorners
+ { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim }
+ { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim }
+ \dim_compare:nNnTF \l_@@_rounded_corners_dim = \c_zero_dim
+ { \pgfusepathqstroke }
+ { \pgfusepath { stroke } }
+ }
}
\endpgfpicture
\group_end:
@@ -14311,17 +14478,11 @@
% \begin{macrocode}
\group_begin:
\keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl
-% \end{macrocode}
-% We nullify the command |\@@_transform_preamble_i:| because we will provide a
-% preamble which is yet transformed (by using |\l_@@_columns_type_tl| which is
-% yet nicematrix-ready).
-% \begin{macrocode}
- % \bool_set_false:N \l_@@_preamble_bool
\use:e
{
\exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
- { * { #4 } { \exp_not:V \l_@@_columns_type_tl } }
- [ \exp_not:V \l_tmpa_tl ]
+ { * { #4 } { \exp_not:o \l_@@_columns_type_tl } }
+ [ \exp_not:o \l_tmpa_tl ]
}
\int_if_zero:nT \l_@@_first_row_int
{
@@ -14406,7 +14567,7 @@
% array, and it will extend, since it is no longer in |\l_@@_cell_box|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_dotfill_i:
- { \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim \@@_old_dotfill }
+ { \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim \@@_old_dotfill }
% \end{macrocode}
%
% \bigskip
@@ -14497,7 +14658,7 @@
\pgfnode { rectangle } { south~west }
{
\begin { minipage } { 20 cm }
- \@@_math_toggle_token: #5 \@@_math_toggle_token:
+ \@@_math_toggle: #5 \@@_math_toggle:
\end { minipage }
}
{ }
@@ -14508,7 +14669,7 @@
{
\begin { minipage } { 20 cm }
\raggedleft
- \@@_math_toggle_token: #6 \@@_math_toggle_token:
+ \@@_math_toggle: #6 \@@_math_toggle:
\end { minipage }
}
{ }
@@ -14662,7 +14823,7 @@
% \begin{macrocode}
\nullfont
\c_math_toggle_token
- \@@_color:V \l_@@_delimiters_color_tl
+ \@@_color:o \l_@@_delimiters_color_tl
\bool_if:nTF { #3 } { \left #1 } { \left . }
\vcenter
{
@@ -14820,9 +14981,9 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
+ \cs_set_nopar:Npn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
\tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
- \exp_args:NNV \NewDocumentCommand \@@_SubMatrix \l_@@_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \@@_SubMatrix \l_@@_argspec_tl
{
\peek_remove_spaces:n
{
@@ -14846,10 +15007,10 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_compute_i_j:nnnn #1 #2 #3 #4
{
- \tl_set:Nn \l_@@_first_i_tl { #1 }
- \tl_set:Nn \l_@@_first_j_tl { #2 }
- \tl_set:Nn \l_@@_last_i_tl { #3 }
- \tl_set:Nn \l_@@_last_j_tl { #4 }
+ \cs_set_nopar:Npn \l_@@_first_i_tl { #1 }
+ \cs_set_nopar:Npn \l_@@_first_j_tl { #2 }
+ \cs_set_nopar:Npn \l_@@_last_i_tl { #3 }
+ \cs_set_nopar:Npn \l_@@_last_j_tl { #4 }
\tl_if_eq:NnT \l_@@_first_i_tl { last }
{ \tl_set:NV \l_@@_first_i_tl \c at iRow }
\tl_if_eq:NnT \l_@@_first_j_tl { last }
@@ -14869,9 +15030,8 @@
% The four following token lists correspond to the position of the |\SubMatrix|.
% \begin{macrocode}
\@@_compute_i_j:nn { #2 } { #3 }
- % added 6.19b
\int_compare:nNnT \l_@@_first_i_tl = \l_@@_last_i_tl
- { \cs_set:Npn \arraystretch { 1 } }
+ { \cs_set_nopar:Npn \arraystretch { 1 } }
\bool_lazy_or:nnTF
{ \int_compare_p:nNn \l_@@_last_i_tl > \g_@@_row_total_int }
{ \int_compare_p:nNn \l_@@_last_j_tl > \g_@@_col_total_int }
@@ -14969,7 +15129,7 @@
% \begin{macrocode}
\group_begin:
\pgfsetlinewidth { 1.1 \arrayrulewidth }
- \@@_set_CT at arc@:V \l_@@_rules_color_tl
+ \@@_set_CT at arc@:o \l_@@_rules_color_tl
\CT at arc@
% \end{macrocode}
% Now, we draw the potential vertical rules specified in the preamble of the
@@ -15000,12 +15160,12 @@
% The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given
% by curryfication.
% \begin{macrocode}
- \tl_if_eq:NnTF \l_@@_submatrix_vlines_clist { all }
+ \tl_if_eq:NNTF \l_@@_submatrix_vlines_clist \c_@@_all_tl
{ \int_step_inline:nn { \l_@@_last_j_tl - \l_@@_first_j_tl } }
{ \clist_map_inline:Nn \l_@@_submatrix_vlines_clist }
{
\bool_lazy_and:nnTF
- { \int_compare_p:nNn { ##1 } > 0 }
+ { \int_compare_p:nNn { ##1 } > \c_zero_int }
{
\int_compare_p:nNn
{ ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } }
@@ -15025,12 +15185,12 @@
% The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given
% by curryfication.
% \begin{macrocode}
- \tl_if_eq:NnTF \l_@@_submatrix_hlines_clist { all }
+ \tl_if_eq:NNTF \l_@@_submatrix_hlines_clist \c_@@_all_tl
{ \int_step_inline:nn { \l_@@_last_i_tl - \l_@@_first_i_tl } }
{ \clist_map_inline:Nn \l_@@_submatrix_hlines_clist }
{
\bool_lazy_and:nnTF
- { \int_compare_p:nNn { ##1 } > 0 }
+ { \int_compare_p:nNn { ##1 } > \c_zero_int }
{
\int_compare_p:nNn
{ ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } }
@@ -15243,7 +15403,7 @@
{
\nullfont
\c_math_toggle_token
- \@@_color:V \l_@@_delimiters_color_tl
+ \@@_color:o \l_@@_delimiters_color_tl
\left #1
\vcenter
{
@@ -15274,7 +15434,7 @@
{
\nullfont
\c_math_toggle_token
- \@@_color:V \l_@@_delimiters_color_tl
+ \@@_color:o \l_@@_delimiters_color_tl
\left .
\vcenter
{
@@ -15433,7 +15593,7 @@
{ rectangle }
{ south }
{
- \vbox_top:n
+ \vtop
{
\group_begin:
\everycr { }
@@ -15440,7 +15600,7 @@
\halign
{
\hfil ## \hfil \crcr
- \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr
+ \@@_math_toggle: #1 \@@_math_toggle: \cr
\noalign { \skip_vertical:n { 3 pt } \nointerlineskip }
\c_math_toggle_token
\overbrace
@@ -15479,7 +15639,7 @@
{
\group_begin:
\everycr { }
- \vbox:n
+ \vbox
{
\halign
{
@@ -15494,7 +15654,7 @@
\c_math_toggle_token
\cr
\noalign { \skip_vertical:n { 3 pt } \nointerlineskip }
- \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr
+ \@@_math_toggle: #1 \@@_math_toggle: \cr
}
}
\group_end:
@@ -15958,13 +16118,13 @@
% \bigskip
% If the user uses too much columns, the command |\@@_error_too_much_cols:| is
% triggered. This command raises an error but also tries to give the best
-% information to the user in the error message. The command |\seq_if_in:NVTF| is
+% information to the user in the error message. The command |\seq_if_in:NoTF| is
% not expandable and that's why we can't put it in the error message itself. We
% have to do the test before the |\@@_fatal:n|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_error_too_much_cols:
{
- \seq_if_in:NVTF \g_@@_types_of_matrix_seq \g_@@_name_env_str
+ \seq_if_in:NoTF \g_@@_types_of_matrix_seq \g_@@_name_env_str
{
\int_compare:nNnTF \l_@@_last_col_int = { -2 }
{ \@@_fatal:n { too~much~cols~for~matrix } }
@@ -15986,7 +16146,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_message_hdotsfor:
{
- \tl_if_empty:VF \g_@@_HVdotsfor_lines_tl
+ \tl_if_empty:oF \g_@@_HVdotsfor_lines_tl
{ ~Maybe~your~use~of~\token_to_str:N \Hdotsfor\ is~incorrect.}
}
% \end{macrocode}
Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2023-12-04 22:08:27 UTC (rev 69033)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2023-12-04 22:09:00 UTC (rev 69034)
@@ -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.26}
-\def\myfiledate{2023/11/22}
+\def\myfileversion{6.26a}
+\def\myfiledate{2023/12/04}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -49,8 +49,8 @@
\bool_new:N \g__nicematrix_messages_for_Overleaf_bool
\bool_gset:Nn \g__nicematrix_messages_for_Overleaf_bool
{
- \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs
- || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf
+ \str_if_eq_p:on \c_sys_jobname_str { _region_ } % for Emacs
+ || \str_if_eq_p:on \c_sys_jobname_str { output } % for Overleaf
}
\cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn
{ \msg_redirect_name:nnn { nicematrix } }
@@ -133,6 +133,22 @@
\cs_new_protected:Npn \__nicematrix_collect_options:nnw #1#2[#3]
{ \__nicematrix_collect_options:nn { #1 } { #2 , #3 } }
+\tl_const:Nn \c__nicematrix_b_tl { b }
+\tl_const:Nn \c__nicematrix_c_tl { c }
+\tl_const:Nn \c__nicematrix_l_tl { l }
+\tl_const:Nn \c__nicematrix_r_tl { r }
+\tl_const:Nn \c__nicematrix_all_tl { all }
+\tl_const:Nn \c__nicematrix_dot_tl { . }
+\tl_const:Nn \c__nicematrix_default_tl { default }
+\tl_const:Nn \c__nicematrix_star_tl { * }
+\str_const:Nn \c__nicematrix_r_str { r }
+\str_const:Nn \c__nicematrix_c_str { c }
+\str_const:Nn \c__nicematrix_l_str { l }
+\str_const:Nn \c__nicematrix_R_str { R }
+\str_const:Nn \c__nicematrix_C_str { C }
+\str_const:Nn \c__nicematrix_L_str { L }
+\str_const:Nn \c__nicematrix_j_str { j }
+\str_const:Nn \c__nicematrix_si_str { si }
\tl_new:N \l__nicematrix_argspec_tl
\cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
\cs_generate_variant:Nn \str_lowercase:n { V }
@@ -176,12 +192,12 @@
\mathinner
{
\tex_mkern:D 1 mu
- \box_move_up:nn { 1 pt } { \hbox:n { . } }
+ \box_move_up:nn { 1 pt } { \hbox { . } }
\tex_mkern:D 2 mu
- \box_move_up:nn { 4 pt } { \hbox:n { . } }
+ \box_move_up:nn { 4 pt } { \hbox { . } }
\tex_mkern:D 2 mu
\box_move_up:nn { 7 pt }
- { \vbox:n { \kern 7 pt \hbox:n { . } } }
+ { \vbox:n { \kern 7 pt \hbox { . } } }
\tex_mkern:D 1 mu
}
}
@@ -210,7 +226,7 @@
\cs_set:Npn \CT at arc #1 #2
{
\dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
- { \cs_gset:Npn \CT at arc@ { \color #1 { #2 } } }
+ { \cs_gset_nopar:Npn \CT at arc@ { \color #1 { #2 } } }
}
\cs_set:Npn \doublerulesepcolor #1 # { \CT at drs { #1 } }
\cs_set:Npn \CT at drs #1 #2
@@ -234,7 +250,8 @@
\cs_set:Npn \__nicematrix_standard_cline:w #1-#2 \q_stop
{
\int_if_zero:nT \l__nicematrix_first_col_int { \omit & }
- \int_compare:nNnT { #1 } > 1 { \multispan { \int_eval:n { #1 - 1 } } & }
+ \int_compare:nNnT { #1 } > \c_one_int
+ { \multispan { \int_eval:n { #1 - 1 } } & }
\multispan { \int_eval:n { #2 - #1 + 1 } }
{
\CT at arc@
@@ -271,8 +288,7 @@
{ \everycr { } \cr }
}
\cs_generate_variant:Nn \__nicematrix_cline_i:nn { e n }
-\cs_new:Npn \__nicematrix_math_toggle_token:
- { \bool_if:NF \l__nicematrix_tabular_bool \c_math_toggle_token }
+\cs_set_eq:NN \__nicematrix_math_toggle: \c_math_toggle_token
\cs_new_protected:Npn \__nicematrix_set_CT at arc@:n #1
{
\tl_if_blank:nF { #1 }
@@ -282,7 +298,7 @@
{ \cs_set:Npn \CT at arc@ { \color { #1 } } }
}
}
-\cs_generate_variant:Nn \__nicematrix_set_CT at arc@:n { V }
+\cs_generate_variant:Nn \__nicematrix_set_CT at arc@:n { o }
\cs_new_protected:Npn \__nicematrix_set_CT at drsc@:n #1
{
\tl_if_head_eq_meaning:nNTF { #1 } [
@@ -289,7 +305,7 @@
{ \cs_set:Npn \CT at drsc@ { \color #1 } }
{ \cs_set:Npn \CT at drsc@ { \color { #1 } } }
}
-\cs_generate_variant:Nn \__nicematrix_set_CT at drsc@:n { V }
+\cs_generate_variant:Nn \__nicematrix_set_CT at drsc@:n { o }
\cs_new:Npn \__nicematrix_exp_color_arg:Nn #1 #2
{
\tl_if_head_eq_meaning:nNTF { #2 } [
@@ -296,10 +312,10 @@
{ #1 #2 }
{ #1 { #2 } }
}
-\cs_generate_variant:Nn \__nicematrix_exp_color_arg:Nn { N V }
+\cs_generate_variant:Nn \__nicematrix_exp_color_arg:Nn { N o }
\cs_new_protected:Npn \__nicematrix_color:n #1
{ \tl_if_blank:nF { #1 } { \__nicematrix_exp_color_arg:Nn \color { #1 } } }
-\cs_generate_variant:Nn \__nicematrix_color:n { V }
+\cs_generate_variant:Nn \__nicematrix_color:n { o }
\cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor
\cs_new_protected:Npn \__nicematrix_rescan_for_spanish:N #1
{
@@ -348,10 +364,10 @@
\hook_gput_code:nnn { begindocument } { . }
{
\bool_if:NTF \c__nicematrix_revtex_bool
- { \cs_new_protected:Npn \__nicematrix_redefine_mkpream: { } }
+ { \cs_set_eq:NN \__nicematrix_redefine_mkpream: \prg_do_nothing: }
{
\IfPackageLoadedTF { arydshln }
- { \cs_new_protected:Npn \__nicematrix_redefine_mkpream: { } }
+ { \cs_set_eq:NN \__nicematrix_redefine_mkpream: \prg_do_nothing: }
{
\cs_new_protected:Npn \__nicematrix_redefine_mkpream:
{ \cs_set_eq:NN \@mkpream \__nicematrix_mkpream: }
@@ -397,12 +413,11 @@
\int_new:N \g__nicematrix_col_total_int
\int_new:N \g__nicematrix_last_row_node_int
\int_new:N \l__nicematrix_key_nb_rows_int
-\str_new:N \l__nicematrix_hpos_cell_str
-\str_set:Nn \l__nicematrix_hpos_cell_str { c }
+\tl_new:N \l__nicematrix_hpos_cell_tl
+\tl_set_eq:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_c_tl
\dim_new:N \g__nicematrix_blocks_wd_dim
\dim_new:N \g__nicematrix_blocks_ht_dim
\dim_new:N \g__nicematrix_blocks_dp_dim
-\dim_new:N \l__nicematrix_block_ysep_dim
\dim_new:N \l__nicematrix_width_dim
\seq_new:N \g__nicematrix_names_seq
\bool_new:N \l__nicematrix_in_env_bool
@@ -424,7 +439,7 @@
\tl_new:N \g__nicematrix_array_preamble_tl
\tl_new:N \g__nicematrix_preamble_tl
\tl_new:N \l__nicematrix_columns_type_tl
-\tl_set:Nn \l__nicematrix_columns_type_tl { c }
+\str_set:Nn \l__nicematrix_columns_type_tl { c }
\tl_new:N \l__nicematrix_xdots_down_tl
\tl_new:N \l__nicematrix_xdots_up_tl
\tl_new:N \l__nicematrix_xdots_middle_tl
@@ -449,7 +464,6 @@
}
\tl_new:N \l__nicematrix_code_tl
\tl_new:N \l__nicematrix_pgf_node_code_tl
-
\tl_new:N \g__nicematrix_pre_code_before_tl
\tl_new:N \g_nicematrix_code_before_tl
\tl_new:N \g__nicematrix_pre_code_after_tl
@@ -490,6 +504,11 @@
\int_new:N \l__nicematrix_row_max_int
\int_new:N \l__nicematrix_col_min_int
\int_new:N \l__nicematrix_col_max_int
+\int_new:N \l__nicematrix_start_int
+\int_set_eq:NN \l__nicematrix_start_int \c_one_int
+\int_new:N \l__nicematrix_end_int
+\int_new:N \l__nicematrix_local_start_int
+\int_new:N \l__nicematrix_local_end_int
\seq_new:N \g__nicematrix_submatrix_seq
\int_new:N \g__nicematrix_static_num_of_col_int
\tl_new:N \l__nicematrix_fill_tl
@@ -506,8 +525,8 @@
\str_set:Nn \l__nicematrix_hpos_block_str { c }
\bool_new:N \l__nicematrix_hpos_of_block_cap_bool
\bool_new:N \__nicematrix_nocolor_used_bool
-\str_new:N \l__nicematrix_vpos_of_block_str
-\str_set:Nn \l__nicematrix_vpos_of_block_str { c }
+\str_new:N \l__nicematrix_vpos_block_str
+\str_set:Nn \l__nicematrix_vpos_block_str { c }
\bool_new:N \l__nicematrix_draw_first_bool
\bool_new:N \l__nicematrix_vlines_block_bool
\bool_new:N \l__nicematrix_hlines_block_bool
@@ -525,7 +544,7 @@
\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
-\int_set:Nn \l__nicematrix_first_col_int 1
+\int_set_eq:NN \l__nicematrix_first_col_int \c_one_int
\int_new:N \l__nicematrix_last_row_int
\int_set:Nn \l__nicematrix_last_row_int { -2 }
\bool_new:N \l__nicematrix_last_row_without_value_bool
@@ -536,12 +555,12 @@
\bool_new:N \l__nicematrix_in_last_col_bool
\cs_set_protected:Npn \__nicematrix_cut_on_hyphen:w #1-#2\q_stop
{
- \tl_set:Nn \l_tmpa_tl { #1 }
- \tl_set:Nn \l_tmpb_tl { #2 }
+ \cs_set_nopar:Npn \l_tmpa_tl { #1 }
+ \cs_set_nopar:Npn \l_tmpb_tl { #2 }
}
\cs_new_protected:Npn \__nicematrix_expand_clist:N #1
{
- \clist_if_in:NnF #1 { all }
+ \clist_if_in:NVF #1 \c__nicematrix_all_tl
{
\clist_clear:N \l_tmpa_clist
\clist_map_inline:Nn #1
@@ -549,8 +568,8 @@
\tl_if_in:nnTF { ##1 } { - }
{ \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
- \tl_set:Nn \l_tmpb_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpb_tl { ##1 }
}
\int_step_inline:nnn { \l_tmpa_tl } { \l_tmpb_tl }
{ \clist_put_right:Nn \l_tmpa_clist { ####1 } }
@@ -604,14 +623,15 @@
}
\NewDocumentCommand \tabularnote { o m }
{
- \bool_if:nT { \cs_if_exist_p:N \@captype || \l__nicematrix_in_env_bool }
+ \bool_lazy_or:nnT { \cs_if_exist_p:N \@captype } \l__nicematrix_in_env_bool
{
- \bool_if:nTF { ! \l__nicematrix_tabular_bool && \l__nicematrix_in_env_bool }
+ \bool_lazy_and:nnTF { ! \l__nicematrix_tabular_bool } \l__nicematrix_in_env_bool
{ \__nicematrix_error:n { tabularnote~forbidden } }
{
\bool_if:NTF \l__nicematrix_in_caption_bool
- { \__nicematrix_tabularnote_caption:nn { #1 } { #2 } }
- { \__nicematrix_tabularnote:nn { #1 } { #2 } }
+ \__nicematrix_tabularnote_caption:nn
+ \__nicematrix_tabularnote:nn
+ { #1 } { #2 }
}
}
}
@@ -671,7 +691,7 @@
\l__nicematrix_notes_labels_seq { , } { , } { , }
}
}
- \int_gsub:Nn \c at tabularnote { 1 }
+ \int_gdecr:N \c at tabularnote
\int_set_eq:NN \l_tmpa_int \c at tabularnote
\refstepcounter { tabularnote }
\int_compare:nNnT \l_tmpa_int = \c at tabularnote
@@ -678,8 +698,8 @@
{ \int_gincr:N \c at tabularnote }
\seq_clear:N \l__nicematrix_notes_labels_seq
\bool_lazy_or:nnTF
- { \str_if_eq_p:Vn \l__nicematrix_hpos_cell_str { c } }
- { \str_if_eq_p:Vn \l__nicematrix_hpos_cell_str { r } }
+ { \tl_if_eq_p:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_c_tl }
+ { \tl_if_eq_p:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_r_tl }
{
\hbox_overlap_right:n { \box_use:N \l_tmpa_box }
\skip_horizontal:n { \box_wd:N \l_tmpa_box }
@@ -691,8 +711,7 @@
{
\bool_if:NTF \g__nicematrix_caption_finished_bool
{
- \int_compare:nNnT
- \c at tabularnote = \g__nicematrix_notes_caption_int
+ \int_compare:nNnT \c at tabularnote = \g__nicematrix_notes_caption_int
{ \int_gzero:N \c at tabularnote }
\seq_if_in:NnF \g__nicematrix_notes_in_caption_seq { { #1 } { #2 } }
{ \__nicematrix_error:n { Identical~notes~in~caption } }
@@ -805,7 +824,8 @@
\hook_gput_code:nnn { begindocument } { . }
{ \dim_set:Nn \l__nicematrix_notes_above_space_dim { 1 mm } }
\bool_new:N \l__nicematrix_nullify_dots_bool
-\bool_new:N \l__nicematrix_respect_arraystretch_bool
+\cs_new_protected:Npn \__nicematrix_reset_arraystretch:
+ { \cs_set_nopar:Npn \arraystretch { 1 } }
\bool_new:N \l__nicematrix_auto_columns_width_bool
\bool_new:N \g__nicematrix_recreate_cell_nodes_bool
\str_new:N \l__nicematrix_name_str
@@ -927,13 +947,13 @@
hvlines .code:n =
{
\bool_set_true:N \l__nicematrix_hvlines_bool
- \clist_set:Nn \l__nicematrix_vlines_clist { all }
- \clist_set:Nn \l__nicematrix_hlines_clist { all }
+ \tl_set_eq:NN \l__nicematrix_vlines_clist \c__nicematrix_all_tl
+ \tl_set_eq:NN \l__nicematrix_hlines_clist \c__nicematrix_all_tl
} ,
hvlines-except-borders .code:n =
{
- \clist_set:Nn \l__nicematrix_vlines_clist { all }
- \clist_set:Nn \l__nicematrix_hlines_clist { all }
+ \tl_set_eq:NN \l__nicematrix_vlines_clist \c__nicematrix_all_tl
+ \tl_set_eq:NN \l__nicematrix_hlines_clist \c__nicematrix_all_tl
\bool_set_true:N \l__nicematrix_hvlines_bool
\bool_set_true:N \l__nicematrix_except_borders_bool
} ,
@@ -956,8 +976,9 @@
extra-margin .meta:n =
{ extra-left-margin = #1 , extra-right-margin = #1 } ,
extra-margin .value_required:n = true ,
- respect-arraystretch .bool_set:N = \l__nicematrix_respect_arraystretch_bool ,
- respect-arraystretch .default:n = true ,
+ respect-arraystretch .code:n =
+ \cs_set_eq:NN \__nicematrix_reset_arraystretch: \prg_do_nothing: ,
+ respect-arraystretch .value_forbidden:n = true ,
pgf-node-code .tl_set:N = \l__nicematrix_pgf_node_code_tl ,
pgf-node-code .value_required:n = true
}
@@ -1218,31 +1239,40 @@
\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
- { \int_compare:nNnT \l__nicematrix_first_col_int = 1 \__nicematrix_begin_of_row: }
+ \int_compare:nNnT \c at jCol = \c_one_int
+ { \int_compare:nNnT \l__nicematrix_first_col_int = \c_one_int \__nicematrix_begin_of_row: }
\hbox_set:Nw \l__nicematrix_cell_box
- \bool_if:NF \l__nicematrix_tabular_bool
- {
- \c_math_toggle_token
- \bool_if:NT \l__nicematrix_small_bool \scriptstyle
- }
+ \__nicematrix_tuning_not_tabular_begin:
+ \__nicematrix_tuning_first_row:
+ \__nicematrix_tuning_last_row:
\g__nicematrix_row_style_tl
- \int_if_zero:nTF \c at iRow
+ }
+\cs_new_protected:Npn \__nicematrix_tuning_first_row:
+ {
+ \int_if_zero:nT \c at iRow
{
- \int_compare:nNnT \c at jCol > 0
+ \int_compare:nNnT \c at jCol > \c_zero_int
{
\l__nicematrix_code_for_first_row_tl
\xglobal \colorlet { nicematrix-first-row } { . }
}
}
+ }
+\cs_new_protected:Npn \__nicematrix_tuning_last_row:
+ {
+ \int_compare:nNnT \c at iRow = \l__nicematrix_last_row_int
{
- \int_compare:nNnT \c at iRow = \l__nicematrix_last_row_int
- {
- \l__nicematrix_code_for_last_row_tl
- \xglobal \colorlet { nicematrix-last-row } { . }
- }
+ \l__nicematrix_code_for_last_row_tl
+ \xglobal \colorlet { nicematrix-last-row } { . }
}
}
+\cs_set_eq:NN \__nicematrix_tuning_key_small: \prg_do_nothing:
+\cs_set_nopar:Npn \__nicematrix_tuning_not_tabular_begin:
+ {
+ \c_math_toggle_token
+ \__nicematrix_tuning_key_small:
+ }
+\cs_set_eq:NN \__nicematrix_tuning_not_tabular_end: \c_math_toggle_token
\cs_new_protected:Npn \__nicematrix_begin_of_row:
{
\int_gincr:N \c at iRow
@@ -1272,7 +1302,7 @@
{ \dim_max:nn \g__nicematrix_ht_row_zero_dim { \box_ht:N \l__nicematrix_cell_box } }
}
{
- \int_compare:nNnT \c at iRow = 1
+ \int_compare:nNnT \c at iRow = \c_one_int
{
\dim_gset:Nn \g__nicematrix_ht_row_one_dim
{ \dim_max:nn \g__nicematrix_ht_row_one_dim { \box_ht:N \l__nicematrix_cell_box } }
@@ -1328,7 +1358,7 @@
}
\cs_new_protected:Npn \__nicematrix_cell_end:
{
- \__nicematrix_math_toggle_token:
+ \__nicematrix_tuning_not_tabular_end:
\hbox_set_end:
\__nicematrix_cell_end_i:
}
@@ -1346,11 +1376,14 @@
\bool_if:NTF \g__nicematrix_empty_cell_bool
{ \box_use_drop:N \l__nicematrix_cell_box }
{
- \bool_lazy_or:nnTF
+ \bool_if:NTF
\g__nicematrix_not_empty_cell_bool
- { \dim_compare_p:nNn { \box_wd:N \l__nicematrix_cell_box } > \c_zero_dim }
\__nicematrix_node_for_cell:
- { \box_use_drop:N \l__nicematrix_cell_box }
+ {
+ \dim_compare:nNnTF { \box_wd:N \l__nicematrix_cell_box } > \c_zero_dim
+ \__nicematrix_node_for_cell:
+ { \box_use_drop:N \l__nicematrix_cell_box }
+ }
}
\int_gset:Nn \g__nicematrix_col_total_int { \int_max:nn \g__nicematrix_col_total_int \c at jCol }
\bool_gset_false:N \g__nicematrix_empty_cell_bool
@@ -1363,7 +1396,7 @@
}
\cs_new_protected:Npn \__nicematrix_cell_end_for_w_s:
{
- \__nicematrix_math_toggle_token:
+ \__nicematrix_math_toggle:
\hbox_set_end:
\bool_if:NF \g__nicematrix_rotate_bool
{
@@ -1504,7 +1537,7 @@
\__nicematrix_create_row_node:
\tl_if_empty:NF \l__nicematrix_hlines_clist
{
- \tl_if_eq:NnF \l__nicematrix_hlines_clist { all }
+ \tl_if_eq:NNF \l__nicematrix_hlines_clist \c__nicematrix_all_tl
{
\exp_args:NNe
\clist_if_in:NnT
@@ -1576,6 +1609,7 @@
{
\cs_set_nopar:Npn \arraystretch { 0.47 }
\dim_set:Nn \arraycolsep { 1.45 pt }
+ \cs_set_eq:NN \__nicematrix_tuning_key_small: \scriptstyle
}
\bool_if:NT \g__nicematrix_recreate_cell_nodes_bool
{
@@ -1634,6 +1668,10 @@
\cs_set_eq:NN \rowcolor \__nicematrix_rowcolor_tabular
\cs_set_eq:NN \rowcolors \__nicematrix_rowcolors_tabular
\cs_set_eq:NN \rowlistcolors \__nicematrix_rowlistcolors_tabular
+ \int_compare:nNnT \l__nicematrix_first_row_int > \c_zero_int
+ { \cs_set_eq:NN \__nicematrix_tuning_first_row: \prg_do_nothing: }
+ \int_compare:nNnT \l__nicematrix_last_row_int < \c_zero_int
+ { \cs_set_eq:NN \__nicematrix_tuning_last_row: \prg_do_nothing: }
\bool_if:NT \l__nicematrix_renew_dots_bool \__nicematrix_renew_dots:
\cs_set_eq:NN \multicolumn \__nicematrix_multicolumn:nnn
\hook_gput_code:nnn { env / tabular / begin } { . }
@@ -1959,7 +1997,7 @@
{ \keys_set:nn { NiceMatrix / pNiceArray } }
{ \keys_set:nn { NiceMatrix / NiceArray } }
{ #3 , #5 }
- \__nicematrix_set_CT at arc@:V \l__nicematrix_rules_color_tl
+ \__nicematrix_set_CT at arc@:o \l__nicematrix_rules_color_tl
\IfBooleanTF { #6 } \__nicematrix_CodeBefore_Body:w \__nicematrix_pre_array:
}
{
@@ -1975,7 +2013,7 @@
\int_if_zero:nT \g__nicematrix_total_X_weight_int
{ \__nicematrix_error_or_warning:n { width~without~X~columns } }
}
- \int_compare:nNnT \g__nicematrix_total_X_weight_int > 0
+ \int_compare:nNnT \g__nicematrix_total_X_weight_int > \c_zero_int
{
\tl_build_gput_right:Nx \g__nicematrix_aux_tl
{
@@ -2013,7 +2051,7 @@
}
}
\int_gset_eq:NN \c at jCol \g__nicematrix_col_total_int
- \bool_if:nTF \g__nicematrix_last_col_found_bool
+ \bool_if:NTF \g__nicematrix_last_col_found_bool
{ \int_gdecr:N \c at jCol }
{
\int_compare:nNnT \l__nicematrix_last_col_int > { -1 }
@@ -2022,18 +2060,16 @@
\int_gset_eq:NN \g__nicematrix_row_total_int \c at iRow
\int_compare:nNnT \l__nicematrix_last_row_int > { -1 } { \int_gdecr:N \c at iRow }
\int_if_zero:nT \l__nicematrix_first_col_int
- {
- % \skip_horizontal:N \col at sep % 05-08-23
- \skip_horizontal:N \g__nicematrix_width_first_col_dim
- }
+ { \skip_horizontal:N \g__nicematrix_width_first_col_dim }
\bool_if:nTF { ! \g__nicematrix_delims_bool }
{
- \str_case:VnF \l__nicematrix_baseline_tl
+ \tl_if_eq:NNTF \l__nicematrix_baseline_tl \c__nicematrix_c_tl
+ \__nicematrix_use_arraybox_with_notes_c:
{
- b \__nicematrix_use_arraybox_with_notes_b:
- c \__nicematrix_use_arraybox_with_notes_c:
+ \tl_if_eq:NNTF \l__nicematrix_baseline_tl \c__nicematrix_b_tl
+ \__nicematrix_use_arraybox_with_notes_b:
+ \__nicematrix_use_arraybox_with_notes:
}
- \__nicematrix_use_arraybox_with_notes:
}
{
\int_if_zero:nTF \l__nicematrix_first_row_int
@@ -2051,7 +2087,7 @@
\hbox_set:Nn \l_tmpa_box
{
\c_math_toggle_token
- \__nicematrix_color:V \l__nicematrix_delimiters_color_tl
+ \__nicematrix_color:o \l__nicematrix_delimiters_color_tl
\exp_after:wN \left \g__nicematrix_left_delim_tl
\vcenter
{
@@ -2066,9 +2102,9 @@
{ \skip_horizontal:N -\tabcolsep }
{ \skip_horizontal:N -\arraycolsep }
}
- \skip_vertical:n { -\l_tmpb_dim + \arrayrulewidth }
+ \skip_vertical:N -\l_tmpb_dim
+ \skip_vertical:N \arrayrulewidth
}
- \__nicematrix_color:V \l__nicematrix_delimiters_color_tl
\exp_after:wN \right \g__nicematrix_right_delim_tl
\c_math_toggle_token
}
@@ -2075,15 +2111,13 @@
\bool_if:NTF \l__nicematrix_delimiters_max_width_bool
{
\__nicematrix_put_box_in_flow_bis:nn
- \g__nicematrix_left_delim_tl \g__nicematrix_right_delim_tl
+ \g__nicematrix_left_delim_tl
+ \g__nicematrix_right_delim_tl
}
\__nicematrix_put_box_in_flow:
}
\bool_if:NT \g__nicematrix_last_col_found_bool
- {
- \skip_horizontal:N \g__nicematrix_width_last_col_dim
- % \skip_horizontal:N \col at sep % 2023-08-05
- }
+ { \skip_horizontal:N \g__nicematrix_width_last_col_dim }
\bool_if:NT \l__nicematrix_preamble_bool
{
\int_compare:nNnT \c at jCol < \g__nicematrix_static_num_of_col_int
@@ -2097,7 +2131,7 @@
\iow_now:Nx \@mainaux
{
\tl_gset:cn { c__nicematrix_ \int_use:N \g__nicematrix_env_int _ tl }
- { \exp_not:V \g__nicematrix_aux_tl }
+ { \exp_not:o \g__nicematrix_aux_tl }
}
\iow_now:Nn \@mainaux { \ExplSyntaxOff }
\bool_if:NT \g__nicematrix_footnote_bool \endsavenotes
@@ -2115,7 +2149,7 @@
\tl_gclear_new:N \g__nicematrix_pre_cell_tl
\int_zero:N \l_tmpa_int
\tl_gclear:N \g__nicematrix_array_preamble_tl
- \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all }
+ \tl_if_eq:NNTF \l__nicematrix_vlines_clist \c__nicematrix_all_tl
{
\tl_gset:Nn \g__nicematrix_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -2151,34 +2185,42 @@
}
\cs_new_protected:Npn \__nicematrix_transform_preamble_ii:
{
- \bool_lazy_or:nnT
- { ! \str_if_eq_p:Vn \g__nicematrix_left_delim_tl { . } }
- { ! \str_if_eq_p:Vn \g__nicematrix_right_delim_tl { . } }
+ \tl_if_eq:NNTF \g__nicematrix_left_delim_tl \c__nicematrix_dot_tl
+ {
+ \tl_if_eq:NNF \g__nicematrix_right_delim_tl \c__nicematrix_dot_tl
+ { \bool_gset_true:N \g__nicematrix_delims_bool }
+ }
{ \bool_gset_true:N \g__nicematrix_delims_bool }
\bool_if:NT \g_tmpb_bool { \bool_set_true:N \l__nicematrix_bar_at_end_of_pream_bool }
\int_if_zero:nTF \l__nicematrix_first_col_int
- { \tl_gput_left:NV \g__nicematrix_array_preamble_tl \c__nicematrix_preamble_first_col_tl }
+ { \tl_gput_left:No \g__nicematrix_array_preamble_tl \c__nicematrix_preamble_first_col_tl }
{
- \bool_lazy_all:nT
+ \bool_if:NF \g__nicematrix_delims_bool
{
- { \bool_not_p:n \g__nicematrix_delims_bool }
- { \bool_not_p:n \l__nicematrix_tabular_bool }
- { \tl_if_empty_p:N \l__nicematrix_vlines_clist }
- { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
+ \bool_if:NF \l__nicematrix_tabular_bool
+ {
+ \tl_if_empty:NT \l__nicematrix_vlines_clist
+ {
+ \bool_if:NF \l__nicematrix_exterior_arraycolsep_bool
+ { \tl_gput_left:Nn \g__nicematrix_array_preamble_tl { @ { } } }
+ }
+ }
}
- { \tl_gput_left:Nn \g__nicematrix_array_preamble_tl { @ { } } }
}
\int_compare:nNnTF \l__nicematrix_last_col_int > { -1 }
- { \tl_gput_right:NV \g__nicematrix_array_preamble_tl \c__nicematrix_preamble_last_col_tl }
+ { \tl_gput_right:No \g__nicematrix_array_preamble_tl \c__nicematrix_preamble_last_col_tl }
{
- \bool_lazy_all:nT
+ \bool_if:NF \g__nicematrix_delims_bool
{
- { \bool_not_p:n \g__nicematrix_delims_bool }
- { \bool_not_p:n \l__nicematrix_tabular_bool }
- { \tl_if_empty_p:N \l__nicematrix_vlines_clist }
- { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
+ \bool_if:NF \l__nicematrix_tabular_bool
+ {
+ \tl_if_empty:NT \l__nicematrix_vlines_clist
+ {
+ \bool_if:NF \l__nicematrix_exterior_arraycolsep_bool
+ { \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { @ { } } }
+ }
+ }
}
- { \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { @ { } } }
}
\dim_compare:nNnT \l__nicematrix_tabular_width_dim = \c_zero_dim
{
@@ -2205,19 +2247,39 @@
}
\cs_new:Npn \__nicematrix_c #1
{
- \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
\tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
+ { > \__nicematrix_cell_begin:w c < \__nicematrix_cell_end: }
+ \int_gincr:N \c at jCol
+ \__nicematrix_rec_preamble_after_col:n
+ }
+\cs_new:Npn \__nicematrix_l #1
+ {
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gclear:N \g__nicematrix_pre_cell_tl
+ \tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
- > { \__nicematrix_cell_begin:w \str_set:Nn \l__nicematrix_hpos_cell_str { #1 } }
- #1
+ > { \__nicematrix_cell_begin:w \tl_set_eq:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_l_tl }
+ l
< \__nicematrix_cell_end:
}
\int_gincr:N \c at jCol
\__nicematrix_rec_preamble_after_col:n
}
-\cs_set_eq:NN \__nicematrix_l \__nicematrix_c
-\cs_set_eq:NN \__nicematrix_r \__nicematrix_c
+\cs_new:Npn \__nicematrix_r #1
+ {
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gclear:N \g__nicematrix_pre_cell_tl
+ \tl_gput_right:Nn \g__nicematrix_array_preamble_tl
+ {
+ > { \__nicematrix_cell_begin:w \tl_set_eq:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_r_tl }
+ r
+ < \__nicematrix_cell_end:
+ }
+ \int_gincr:N \c at jCol
+ \__nicematrix_rec_preamble_after_col:n
+ }
\cs_new:cpn { __nicematrix _ \token_to_str:N ! } #1 #2
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl { #1 { #2 } }
@@ -2272,37 +2334,37 @@
\bool_new:N \l__nicematrix_bar_at_end_of_pream_bool
\keys_define:nn { WithArrows / p-column }
{
- r .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { r } ,
+ r .code:n = \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_r_str ,
r .value_forbidden:n = true ,
- c .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { c } ,
+ c .code:n = \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_c_str ,
c .value_forbidden:n = true ,
- l .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { l } ,
+ l .code:n = \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_l_str ,
l .value_forbidden:n = true ,
R .code:n =
\IfPackageLoadedTF { ragged2e }
- { \str_set:Nn \l__nicematrix_hpos_col_str { R } }
+ { \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_R_str }
{
\__nicematrix_error_or_warning:n { ragged2e~not~loaded }
- \str_set:Nn \l__nicematrix_hpos_col_str { r }
+ \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_r_str
} ,
R .value_forbidden:n = true ,
L .code:n =
\IfPackageLoadedTF { ragged2e }
- { \str_set:Nn \l__nicematrix_hpos_col_str { L } }
+ { \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_L_stsr }
{
\__nicematrix_error_or_warning:n { ragged2e~not~loaded }
- \str_set:Nn \l__nicematrix_hpos_col_str { l }
+ \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_l_str
} ,
L .value_forbidden:n = true ,
C .code:n =
\IfPackageLoadedTF { ragged2e }
- { \str_set:Nn \l__nicematrix_hpos_col_str { C } }
+ { \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_C_str }
{
\__nicematrix_error_or_warning:n { ragged2e~not~loaded }
- \str_set:Nn \l__nicematrix_hpos_col_str { c }
+ \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_c_str
} ,
C .value_forbidden:n = true ,
- S .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { si } ,
+ S .code:n = \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_si_str ,
S .value_forbidden:n = true ,
p .code:n = \str_set:Nn \l__nicematrix_vpos_col_str { p } ,
p .value_forbidden:n = true ,
@@ -2329,29 +2391,28 @@
{ \__nicematrix_make_preamble_ii_iii:nn { #1 } }
\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iii:nn #1 #2
{
- \str_set:Nn \l__nicematrix_hpos_col_str { j }
- \tl_set:Nn \l_tmpa_tl { #1 }
- \__nicematrix_keys_p_column:V \l_tmpa_tl
+ \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_j_str
+ % \tl_set:Nn \l_tmpa_tl { #1 }
+ \__nicematrix_keys_p_column:n { #1 }
\__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { }
}
\cs_new_protected:Npn \__nicematrix_keys_p_column:n #1
{ \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl }
-\cs_generate_variant:Nn \__nicematrix_keys_p_column:n { V }
\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iv:nnn #1 #2 #3
{
\use:e
{
\__nicematrix_make_preamble_ii_v:nnnnnnnn
- { \str_if_eq:VnTF \l__nicematrix_vpos_col_str { p } { t } { b } }
+ { \str_if_eq:onTF \l__nicematrix_vpos_col_str { p } { t } { b } }
{ \dim_eval:n { #1 } }
{
- \str_if_eq:VnTF \l__nicematrix_hpos_col_str j
- { \str_set:Nn \exp_not:N \l__nicematrix_hpos_cell_str { } }
+ \str_if_eq:NNTF \l__nicematrix_hpos_col_str \c__nicematrix_j_str
+ { \tl_clear:N \exp_not:N \l__nicematrix_hpos_cell_tl }
{
- \str_set:Nn \exp_not:N \l__nicematrix_hpos_cell_str
+ \cs_set_nopar:Npn \exp_not:N \l__nicematrix_hpos_cell_tl
{ \str_lowercase:V \l__nicematrix_hpos_col_str }
}
- \str_case:Vn \l__nicematrix_hpos_col_str
+ \str_case:on \l__nicematrix_hpos_col_str
{
c { \exp_not:N \centering }
l { \exp_not:N \raggedright }
@@ -2362,12 +2423,12 @@
}
#3
}
- { \str_if_eq:VnT \l__nicematrix_vpos_col_str { m } \__nicematrix_center_cell_box: }
- { \str_if_eq:VnT \l__nicematrix_hpos_col_str { si } \siunitx_cell_begin:w }
- { \str_if_eq:VnT \l__nicematrix_hpos_col_str { si } \siunitx_cell_end: }
+ { \str_if_eq:onT \l__nicematrix_vpos_col_str { m } \__nicematrix_center_cell_box: }
+ { \str_if_eq:onT \l__nicematrix_hpos_col_str { si } \siunitx_cell_begin:w }
+ { \str_if_eq:onT \l__nicematrix_hpos_col_str { si } \siunitx_cell_end: }
{ #2 }
{
- \str_case:VnF \l__nicematrix_hpos_col_str
+ \str_case:onF \l__nicematrix_hpos_col_str
{
{ j } { c }
{ si } { c }
@@ -2380,10 +2441,10 @@
}
\cs_new_protected:Npn \__nicematrix_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \str_if_eq:VnTF \l__nicematrix_hpos_col_str { si }
+ \tl_if_eq:NNTF \l__nicematrix_hpos_col_str \c__nicematrix_si_str
{ \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { > { \__nicematrix_test_if_empty_for_S: } } }
{ \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { > { \__nicematrix_test_if_empty: } } }
- \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
\tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
@@ -2472,9 +2533,8 @@
\cs_new_protected:Npn \__nicematrix_make_preamble_V_ii:nn #1 #2
{
\str_set:Nn \l__nicematrix_vpos_col_str { p }
- \str_set:Nn \l__nicematrix_hpos_col_str { j }
- \tl_set:Nn \l_tmpa_tl { #1 }
- \__nicematrix_keys_p_column:V \l_tmpa_tl
+ \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_j_str
+ \__nicematrix_keys_p_column:n { #1 }
\IfPackageLoadedTF { varwidth }
{ \__nicematrix_make_preamble_ii_iv:nnn { #2 } { varwidth } { } }
{
@@ -2492,7 +2552,7 @@
}
\cs_new_protected:Npn \__nicematrix_make_preamble_w_i:nnnn #1 #2
{
- \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
\tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
@@ -2499,7 +2559,7 @@
> {
\dim_set:Nn \l__nicematrix_col_width_dim { #2 }
\__nicematrix_cell_begin:w
- \str_set:Nn \l__nicematrix_hpos_cell_str { c }
+ \tl_set_eq:NN \l__nicematrix_hpos_cell_tl \c__nicematrix_c_tl
}
c
< {
@@ -2514,7 +2574,7 @@
}
\cs_new_protected:Npn \__nicematrix_make_preamble_w_ii:nnnn #1 #2 #3 #4
{
- \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
\tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
@@ -2522,7 +2582,7 @@
\dim_set:Nn \l__nicematrix_col_width_dim { #4 }
\hbox_set:Nw \l__nicematrix_cell_box
\__nicematrix_cell_begin:w
- \str_set:Nn \l__nicematrix_hpos_cell_str { #3 }
+ \cs_set_nopar:Npn \l__nicematrix_hpos_cell_tl { #3 }
}
c
< {
@@ -2553,7 +2613,7 @@
{
\IfPackageLoadedTF { siunitx }
{
- \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gput_right:No \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl
\tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{
@@ -2575,10 +2635,10 @@
\bool_if:NT \l__nicematrix_small_bool { \__nicematrix_fatal:n { Delimiter~with~small } }
\int_if_zero:nTF \c at jCol
{
- \str_if_eq:VnTF \g__nicematrix_left_delim_tl { . }
+ \tl_if_eq:NNTF \g__nicematrix_left_delim_tl \c__nicematrix_dot_tl
{
\tl_gset:Nn \g__nicematrix_left_delim_tl { #1 }
- \tl_gset:Nn \g__nicematrix_right_delim_tl { . }
+ \tl_gset_eq:NN \g__nicematrix_right_delim_tl \c__nicematrix_dot_tl
\__nicematrix_rec_preamble:n #2
}
{
@@ -2610,7 +2670,7 @@
{
\tl_if_eq:nnTF { \stop } { #2 }
{
- \str_if_eq:VnTF \g__nicematrix_right_delim_tl { . }
+ \tl_if_eq:NNTF \g__nicematrix_right_delim_tl \c__nicematrix_dot_tl
{ \tl_gset:Nn \g__nicematrix_right_delim_tl { #1 } }
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl { ! { \enskip } }
@@ -2634,7 +2694,7 @@
{
\tl_if_eq:nnTF { \stop } { #3 }
{
- \str_if_eq:VnTF \g__nicematrix_right_delim_tl { . }
+ \tl_if_eq:NNTF \g__nicematrix_right_delim_tl \c__nicematrix_dot_tl
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl { ! { \enskip } }
\tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
@@ -2665,7 +2725,7 @@
\str_if_eq:nnTF { #1 } { @ }
\__nicematrix_rec_preamble_after_col_ii:n
{
- \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all }
+ \tl_if_eq:NNTF \l__nicematrix_vlines_clist \c__nicematrix_all_tl
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -2689,7 +2749,7 @@
}
\cs_new_protected:Npn \__nicematrix_rec_preamble_after_col_ii:n #1
{
- \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all }
+ \tl_if_eq:NNTF \l__nicematrix_vlines_clist \c__nicematrix_all_tl
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{ @ { #1 \skip_horizontal:N \arrayrulewidth } }
@@ -2709,7 +2769,7 @@
{
\tl_clear:N \l_tmpa_tl
\int_step_inline:nn { #2 } { \tl_put_right:Nn \l_tmpa_tl { #3 } }
- \exp_last_unbraced:NV \__nicematrix_rec_preamble:n \l_tmpa_tl
+ \exp_last_unbraced:No \__nicematrix_rec_preamble:n \l_tmpa_tl
}
\cs_new:cpn { __nicematrix _ \token_to_str:N \NC at find } #1 { \__nicematrix_rec_preamble:n }
\cs_new:Npn \__nicematrix_X #1 #2
@@ -2725,13 +2785,12 @@
\cs_new_protected:Npn \__nicematrix_make_preamble_X_i:n #1
{
\str_set:Nn \l__nicematrix_hpos_col_str { j }
- \tl_set:Nn \l__nicematrix_vpos_col_str { p }
+ \str_set:Nn \l__nicematrix_vpos_col_str { p }
\int_zero_new:N \l__nicematrix_weight_int
- \int_set:Nn \l__nicematrix_weight_int { 1 }
- \tl_set:Nn \l_tmpa_tl { #1 }
- \__nicematrix_keys_p_column:V \l_tmpa_tl
- \keys_set:nV { WithArrows / X-column } \l_tmpa_tl
- \int_compare:nNnT \l__nicematrix_weight_int < 0
+ \int_set_eq:NN \l__nicematrix_weight_int \c_one_int
+ \__nicematrix_keys_p_column:n { #1 }
+ \keys_set:no { WithArrows / X-column } \l_tmpa_tl
+ \int_compare:nNnT \l__nicematrix_weight_int < \c_zero_int
{
\__nicematrix_error_or_warning:n { negative~weight }
\int_set:Nn \l__nicematrix_weight_int { - \l__nicematrix_weight_int }
@@ -2794,10 +2853,10 @@
{ \legacy_if:nTF { @firstamp } { \@firstampfalse } { \@preamerr 5 } }
\tl_gclear:N \g__nicematrix_preamble_tl
\__nicematrix_make_m_preamble:n #2 \q_stop
- \exp_args:NV \@mkpream \g__nicematrix_preamble_tl
+ \exp_args:No \@mkpream \g__nicematrix_preamble_tl
\@addtopreamble \@empty
\endgroup
- \int_compare:nNnT { #1 } > 1
+ \int_compare:nNnT { #1 } > \c_one_int
{
\seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
{ \int_use:N \c at iRow - \int_eval:n { \c at jCol + 1 } }
@@ -2850,7 +2909,7 @@
\cs_if_exist:cTF { NC @ find @ #1 }
{
\tl_set_eq:Nc \l_tmpa_tl { NC @ rewrite @ #1 }
- \exp_last_unbraced:NV \__nicematrix_make_m_preamble:n \l_tmpa_tl
+ \exp_last_unbraced:No \__nicematrix_make_m_preamble:n \l_tmpa_tl
}
{
\tl_if_eq:nnT { #1 } { S }
@@ -2863,7 +2922,7 @@
{
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{
- > { \__nicematrix_cell_begin:w \str_set:Nn \l__nicematrix_hpos_cell_str { #1 } }
+ > { \__nicematrix_cell_begin:w \cs_set_nopar:Npn \l__nicematrix_hpos_cell_tl { #1 } }
#1
< \__nicematrix_cell_end:
}
@@ -2907,7 +2966,7 @@
\dim_set:Nn \l__nicematrix_col_width_dim { #4 }
\hbox_set:Nw \l__nicematrix_cell_box
\__nicematrix_cell_begin:w
- \str_set:Nn \l__nicematrix_hpos_cell_str { #3 }
+ \cs_set_nopar:Npn \l__nicematrix_hpos_cell_tl { #3 }
}
c
< {
@@ -2936,7 +2995,7 @@
{
\box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim }
\box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim }
- \tl_if_eq:NnTF \l__nicematrix_baseline_tl { c }
+ \tl_if_eq:NNTF \l__nicematrix_baseline_tl \c__nicematrix_c_tl
{ \box_use_drop:N \l_tmpa_box }
\__nicematrix_put_box_in_flow_i:
}
@@ -2948,7 +3007,7 @@
\__nicematrix_qpoint:n { row - \int_eval:n { \c at iRow + 1 } }
\dim_gadd:Nn \g_tmpa_dim \pgf at y
\dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim }
- \str_if_in:NnTF \l__nicematrix_baseline_tl { line- }
+ \tl_if_in:NnTF \l__nicematrix_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
@@ -2955,23 +3014,24 @@
\str_range:Nnn
\l__nicematrix_baseline_tl
6
- { \tl_count:V \l__nicematrix_baseline_tl }
+ { \tl_count:o \l__nicematrix_baseline_tl }
}
\__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \str_case:VnF \l__nicematrix_baseline_tl
+ \tl_if_eq:NnTF \l__nicematrix_baseline_tl { t }
+ { \int_set_eq:NN \l_tmpa_int \c_one_int }
{
- { t } { \int_set:Nn \l_tmpa_int 1 }
- { b } { \int_set_eq:NN \l_tmpa_int \c at iRow }
+ \tl_if_eq:NnTF \l__nicematrix_baseline_tl { b }
+ { \int_set_eq:NN \l_tmpa_int \c at iRow }
+ { \int_set:Nn \l_tmpa_int \l__nicematrix_baseline_tl }
}
- { \int_set:Nn \l_tmpa_int \l__nicematrix_baseline_tl }
\bool_lazy_or:nnT
{ \int_compare_p:nNn \l_tmpa_int < \l__nicematrix_first_row_int }
{ \int_compare_p:nNn \l_tmpa_int > \g__nicematrix_row_total_int }
{
\__nicematrix_error:n { bad~value~for~baseline }
- \int_set:Nn \l_tmpa_int 1
+ \int_set_eq:NN \l_tmpa_int \c_one_int
}
\__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int - base }
\dim_gsub:Nn \g_tmpa_dim { \fontdimen22 \textfont2 }
@@ -2985,7 +3045,7 @@
{
\bool_if:NT \l__nicematrix_NiceMatrix_without_vlines_bool
{
- \int_compare:nNnT \c at jCol > 1 % added 2023-08-13
+ \int_compare:nNnT \c at jCol > \c_one_int
{
\box_set_wd:Nn \l__nicematrix_the_array_box
{ \box_wd:N \l__nicematrix_the_array_box - \arraycolsep }
@@ -2999,7 +3059,7 @@
\bool_set_false:N \g__nicematrix_caption_finished_bool
\int_gzero:N \c at tabularnote
\__nicematrix_insert_caption:
- \int_compare:nNnT \g__nicematrix_notes_caption_int > 0
+ \int_compare:nNnT \g__nicematrix_notes_caption_int > \c_zero_int
{
\tl_build_gput_right:Nx \g__nicematrix_aux_tl
{
@@ -3020,7 +3080,7 @@
{
{ ! \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 \g__nicematrix_tabularnote_tl }
+ { ! \tl_if_empty_p:o \g__nicematrix_tabularnote_tl }
}
\__nicematrix_insert_tabularnotes:
\cs_set_eq:NN \tabularnote \__nicematrix_tabularnote_error:n
@@ -3047,7 +3107,7 @@
{ \caption }
{ \caption [ \l__nicematrix_short_caption_tl ] }
{ \l__nicematrix_caption_tl }
- \bool_if:NF \g__nicematrix_caption_finished_bool % added 2023/06/30
+ \bool_if:NF \g__nicematrix_caption_finished_bool
{
\bool_gset_true:N \g__nicematrix_caption_finished_bool
\int_gset_eq:NN \g__nicematrix_notes_caption_int \c at tabularnote
@@ -3073,7 +3133,7 @@
\g__nicematrix_tabularnote_tl \par
\tl_gclear:N \g__nicematrix_tabularnote_tl
}
- \int_compare:nNnT \c at tabularnote > 0
+ \int_compare:nNnT \c at tabularnote > \c_zero_int
{
\bool_if:NTF \l__nicematrix_notes_para_bool
{
@@ -3133,7 +3193,7 @@
\cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes:
{
\tl_if_eq:NnT \l__nicematrix_baseline_tl { t }
- { \tl_set:Nn \l__nicematrix_baseline_tl { 1 } }
+ { \cs_set_nopar:Npn \l__nicematrix_baseline_tl { 1 } }
\pgfpicture
\__nicematrix_qpoint:n { row - 1 }
\dim_gset_eq:NN \g_tmpa_dim \pgf at y
@@ -3144,7 +3204,7 @@
\str_range:Nnn
\l__nicematrix_baseline_tl
6
- { \tl_count:V \l__nicematrix_baseline_tl }
+ { \tl_count:o \l__nicematrix_baseline_tl }
}
\__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int }
}
@@ -3214,7 +3274,7 @@
\__nicematrix_analyze_end:Nn
{
\__nicematrix_transform_preamble:
- \exp_args:NV \__nicematrix_array: \g__nicematrix_array_preamble_tl
+ \exp_args:No \__nicematrix_array: \g__nicematrix_array_preamble_tl
}
}
}
@@ -3246,13 +3306,13 @@
\seq_set_split:NVn \l__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 }
\seq_pop_right:NN \l__nicematrix_rows_seq \l_tmpa_tl
\tl_if_empty:NF \l_tmpa_tl
- { \seq_put_right:NV \l__nicematrix_rows_seq \l_tmpa_tl }
+ { \seq_put_right:No \l__nicematrix_rows_seq \l_tmpa_tl }
\int_compare:nNnT \l__nicematrix_last_row_int = { -1 }
{ \int_set:Nn \l__nicematrix_last_row_int { \seq_count:N \l__nicematrix_rows_seq } }
\tl_build_begin:N \l__nicematrix_new_body_tl
\int_zero_new:N \l__nicematrix_nb_cols_int
\seq_pop_left:NN \l__nicematrix_rows_seq \l_tmpa_tl
- \__nicematrix_line_with_light_syntax:V \l_tmpa_tl
+ \__nicematrix_line_with_light_syntax:o \l_tmpa_tl
\seq_map_inline:Nn \l__nicematrix_rows_seq
{
\tl_build_put_right:Nn \l__nicematrix_new_body_tl { \\ }
@@ -3265,7 +3325,7 @@
{ \l__nicematrix_nb_cols_int - 1 + \l__nicematrix_first_col_int }
}
\__nicematrix_transform_preamble:
- \exp_args:NV \__nicematrix_array: \g__nicematrix_array_preamble_tl \l__nicematrix_new_body_tl
+ \exp_args:No \__nicematrix_array: \g__nicematrix_array_preamble_tl \l__nicematrix_new_body_tl
}
\cs_new_protected:Npn \__nicematrix_line_with_light_syntax:n #1
{
@@ -3278,14 +3338,14 @@
{ \seq_count:N \l__nicematrix_cells_seq }
}
\seq_pop_left:NN \l__nicematrix_cells_seq \l_tmpa_tl
- \exp_args:NNV \tl_build_put_right:Nn \l__nicematrix_new_body_tl \l_tmpa_tl
+ \exp_args:NNo \tl_build_put_right:Nn \l__nicematrix_new_body_tl \l_tmpa_tl
\seq_map_inline:Nn \l__nicematrix_cells_seq
{ \tl_build_put_right:Nn \l__nicematrix_new_body_tl { & ##1 } }
}
-\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax:n { V }
+\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax:n { o }
\cs_new_protected:Npn \__nicematrix_analyze_end:Nn #1 #2
{
- \str_if_eq:VnT \g__nicematrix_name_env_str { #2 }
+ \str_if_eq:onT \g__nicematrix_name_env_str { #2 }
{ \__nicematrix_fatal:n { empty~environment } }
\end { #2 }
}
@@ -3380,10 +3440,10 @@
{ \pgfnodealias { \l__nicematrix_name_str - col - 2 } { \__nicematrix_env: - col - 2 } }
\endpgfpicture
}
- \int_gset:Nn \g_tmpa_int 1
+ \int_gset_eq:NN \g_tmpa_int \c_one_int
\bool_if:NTF \g__nicematrix_last_col_found_bool
- { \prg_replicate:nn { \int_max:nn { \g__nicematrix_col_total_int - 3 } 0 } }
- { \prg_replicate:nn { \int_max:nn { \g__nicematrix_col_total_int - 2 } 0 } }
+ { \prg_replicate:nn { \int_max:nn { \g__nicematrix_col_total_int - 3 } \c_zero_int } }
+ { \prg_replicate:nn { \int_max:nn { \g__nicematrix_col_total_int - 2 } \c_zero_int } }
{
&
\omit
@@ -3413,17 +3473,17 @@
}
&
\omit
- \int_compare:nNnT \g__nicematrix_col_total_int = 1
+ \int_compare:nNnT \g__nicematrix_col_total_int = \c_one_int
{ \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } }
\skip_horizontal:N \g_tmpa_skip
\int_gincr:N \g_tmpa_int
- \bool_lazy_all:nT
+ \bool_lazy_any:nT
{
- { \bool_not_p:n \g__nicematrix_delims_bool }
- { \bool_not_p:n \l__nicematrix_tabular_bool }
- { \clist_if_empty_p:N \l__nicematrix_vlines_clist }
- { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
- { ! \l__nicematrix_bar_at_end_of_pream_bool }
+ \g__nicematrix_delims_bool
+ \l__nicematrix_tabular_bool
+ { ! \clist_if_empty_p:N \l__nicematrix_vlines_clist }
+ \l__nicematrix_exterior_arraycolsep_bool
+ \l__nicematrix_bar_at_end_of_pream_bool
}
{ \skip_horizontal:N -\col at sep }
\bool_if:NT \l__nicematrix_code_before_bool
@@ -3497,24 +3557,23 @@
\bool_gset_true:N \g__nicematrix_after_col_zero_bool
\__nicematrix_begin_of_row:
\hbox_set:Nw \l__nicematrix_cell_box
- \__nicematrix_math_toggle_token:
- \bool_if:NT \l__nicematrix_small_bool \scriptstyle
- \bool_lazy_and:nnT
- { \int_compare_p:nNn \c at iRow > 0 }
+ \__nicematrix_math_toggle:
+ \__nicematrix_tuning_key_small:
+ \int_compare:nNnT \c at iRow > \c_zero_int
{
- \bool_lazy_or_p:nn
- { \int_compare_p:nNn \l__nicematrix_last_row_int < 0 }
+ \bool_lazy_or:nnT
+ { \int_compare_p:nNn \l__nicematrix_last_row_int < \c_zero_int }
{ \int_compare_p:nNn \c at iRow < \l__nicematrix_last_row_int }
+ {
+ \l__nicematrix_code_for_first_col_tl
+ \xglobal \colorlet { nicematrix-first-col } { . }
+ }
}
- {
- \l__nicematrix_code_for_first_col_tl
- \xglobal \colorlet { nicematrix-first-col } { . }
- }
}
l
<
{
- \__nicematrix_math_toggle_token:
+ \__nicematrix_math_toggle:
\hbox_set_end:
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
\__nicematrix_adjust_size_box:
@@ -3544,12 +3603,12 @@
\int_gincr:N \c at jCol
\int_gset_eq:NN \g__nicematrix_col_total_int \c at jCol
\hbox_set:Nw \l__nicematrix_cell_box
- \__nicematrix_math_toggle_token:
- \bool_if:NT \l__nicematrix_small_bool \scriptstyle
- \int_compare:nNnT \c at iRow > 0
+ \__nicematrix_math_toggle:
+ \__nicematrix_tuning_key_small:
+ \int_compare:nNnT \c at iRow > \c_zero_int
{
\bool_lazy_or:nnT
- { \int_compare_p:nNn \l__nicematrix_last_row_int < 0 }
+ { \int_compare_p:nNn \l__nicematrix_last_row_int < \c_zero_int }
{ \int_compare_p:nNn \c at iRow < \l__nicematrix_last_row_int }
{
\l__nicematrix_code_for_last_col_tl
@@ -3560,7 +3619,7 @@
l
<
{
- \__nicematrix_math_toggle_token:
+ \__nicematrix_math_toggle:
\hbox_set_end:
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
\__nicematrix_adjust_size_box:
@@ -3626,7 +3685,7 @@
{ #2 }
}
\tl_set:Nn \l_tmpb_tl { \use:c { #1 NiceArray } }
- \exp_args:NV \l_tmpb_tl \l_tmpa_tl
+ \exp_args:No \l_tmpb_tl \l_tmpa_tl
}
\cs_generate_variant:Nn \__nicematrix_begin_of_NiceMatrix:nn { n V }
\clist_map_inline:nn { p , b , B , v , V }
@@ -3695,10 +3754,17 @@
}
}
{ }
- \bool_set_true:N \l__nicematrix_tabular_bool
+ \__nicematrix_settings_for_tabular:
\NiceArray { #2 }
}
{ \endNiceArray }
+\cs_new_protected:Npn \__nicematrix_settings_for_tabular:
+ {
+ \bool_set_true:N \l__nicematrix_tabular_bool
+ \cs_set_eq:NN \__nicematrix_math_toggle: \prg_do_nothing:
+ \cs_set_eq:NN \__nicematrix_tuning_not_tabular_begin: \prg_do_nothing:
+ \cs_set_eq:NN \__nicematrix_tuning_not_tabular_end: \prg_do_nothing:
+ }
\NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } }
{
\str_gset:Nn \g__nicematrix_name_env_str { NiceTabularX }
@@ -3705,7 +3771,7 @@
\dim_zero_new:N \l__nicematrix_width_dim
\dim_set:Nn \l__nicematrix_width_dim { #1 }
\keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 }
- \bool_set_true:N \l__nicematrix_tabular_bool
+ \__nicematrix_settings_for_tabular:
\NiceArray { #3 }
}
{
@@ -3718,7 +3784,7 @@
\str_gset:Nn \g__nicematrix_name_env_str { NiceTabular* }
\dim_set:Nn \l__nicematrix_tabular_width_dim { #1 }
\keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 }
- \bool_set_true:N \l__nicematrix_tabular_bool
+ \__nicematrix_settings_for_tabular:
\NiceArray { #3 }
}
{ \endNiceArray }
@@ -3873,7 +3939,7 @@
\int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
{ \__nicematrix_rescan_for_spanish:N \g_nicematrix_code_after_tl }
\bool_set_true:N \l__nicematrix_in_code_after_bool
- \exp_last_unbraced:NV \__nicematrix_CodeAfter_keys: \g_nicematrix_code_after_tl
+ \exp_last_unbraced:No \__nicematrix_CodeAfter_keys: \g_nicematrix_code_after_tl
\scan_stop:
\tl_gclear:N \g_nicematrix_code_after_tl
\group_end:
@@ -3883,7 +3949,7 @@
\tl_build_gput_right:Nx \g__nicematrix_aux_tl
{
\tl_gset:Nn \exp_not:N \g__nicematrix_pre_code_before_tl
- { \exp_not:V \g__nicematrix_pre_code_before_tl }
+ { \exp_not:o \g__nicematrix_pre_code_before_tl }
}
\tl_gclear:N \g__nicematrix_pre_code_before_tl
}
@@ -3892,7 +3958,7 @@
\tl_build_gput_right:Nx \g__nicematrix_aux_tl
{
\tl_gset:Nn \exp_not:N \g__nicematrix_code_before_tl
- { \exp_not:V \g_nicematrix_code_before_tl }
+ { \exp_not:o \g_nicematrix_code_before_tl }
}
\tl_gclear:N \g_nicematrix_code_before_tl
}
@@ -4014,7 +4080,7 @@
\bool_set_false:N \l__nicematrix_final_open_bool
\int_compare:nNnTF \l__nicematrix_final_i_int > \l__nicematrix_row_max_int
{
- \int_compare:nNnTF { #3 } = 1
+ \int_compare:nNnTF { #3 } = \c_one_int
{ \bool_set_true:N \l__nicematrix_final_open_bool }
{
\int_compare:nNnT \l__nicematrix_final_j_int > \l__nicematrix_col_max_int
@@ -4030,7 +4096,7 @@
{
\int_compare:nNnT \l__nicematrix_final_j_int > \l__nicematrix_col_max_int
{
- \int_compare:nNnT { #4 } = 1
+ \int_compare:nNnT { #4 } = \c_one_int
{ \bool_set_true:N \l__nicematrix_final_open_bool }
}
}
@@ -4082,7 +4148,7 @@
\bool_set_false:N \l__nicematrix_initial_open_bool
\int_compare:nNnTF \l__nicematrix_initial_i_int < \l__nicematrix_row_min_int
{
- \int_compare:nNnTF { #3 } = 1
+ \int_compare:nNnTF { #3 } = \c_one_int
{ \bool_set_true:N \l__nicematrix_initial_open_bool }
{
\int_compare:nNnT \l__nicematrix_initial_j_int = { \l__nicematrix_col_min_int - 1 }
@@ -4092,7 +4158,7 @@
{
\int_compare:nNnTF \l__nicematrix_initial_j_int < \l__nicematrix_col_min_int
{
- \int_compare:nNnT { #4 } = 1
+ \int_compare:nNnT { #4 } = \c_one_int
{ \bool_set_true:N \l__nicematrix_initial_open_bool }
}
{
@@ -4169,19 +4235,26 @@
}
\cs_set_protected:Npn \__nicematrix_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
{
- \bool_if:nT
+ \int_compare:nNnF { #3 } > { #1 }
{
- \int_compare_p:n { #3 <= #1 }
- && \int_compare_p:n { #1 <= #5 }
- && \int_compare_p:n { #4 <= #2 }
- && \int_compare_p:n { #2 <= #6 }
+ \int_compare:nNnF { #1 } > { #5 }
+ {
+ \int_compare:nNnF { #4 } > { #2 }
+ {
+ \int_compare:nNnF { #2 } > { #6 }
+ {
+ \int_set:Nn \l__nicematrix_row_min_int
+ { \int_max:nn \l__nicematrix_row_min_int { #3 } }
+ \int_set:Nn \l__nicematrix_col_min_int
+ { \int_max:nn \l__nicematrix_col_min_int { #4 } }
+ \int_set:Nn \l__nicematrix_row_max_int
+ { \int_min:nn \l__nicematrix_row_max_int { #5 } }
+ \int_set:Nn \l__nicematrix_col_max_int
+ { \int_min:nn \l__nicematrix_col_max_int { #6 } }
+ }
+ }
+ }
}
- {
- \int_set:Nn \l__nicematrix_row_min_int { \int_max:nn \l__nicematrix_row_min_int { #3 } }
- \int_set:Nn \l__nicematrix_col_min_int { \int_max:nn \l__nicematrix_col_min_int { #4 } }
- \int_set:Nn \l__nicematrix_row_max_int { \int_min:nn \l__nicematrix_row_max_int { #5 } }
- \int_set:Nn \l__nicematrix_col_max_int { \int_min:nn \l__nicematrix_col_max_int { #6 } }
- }
}
\cs_new_protected:Npn \__nicematrix_set_initial_coords:
{
@@ -4274,7 +4347,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Ldots:
\group_end:
}
@@ -4326,7 +4399,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Cdots:
\group_end:
}
@@ -4372,7 +4445,6 @@
{ \dim_max:nn \l__nicematrix_y_initial_dim \pgf at y }
}
}
- % modified 2023-08-10
\dim_compare:nNnT \l__nicematrix_y_initial_dim = { - \c_max_dim }
{
\__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int - base }
@@ -4401,7 +4473,6 @@
{ \dim_min:nn \l__nicematrix_y_final_dim \pgf at y }
}
}
- % modified 2023-08-10
\dim_compare:nNnT \l__nicematrix_y_final_dim = \c_max_dim
{
\__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_final_i_int - base }
@@ -4424,7 +4495,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl
{ \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Vdots:
\group_end:
@@ -4442,10 +4513,7 @@
\dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
\dim_sub:Nn \l__nicematrix_x_initial_dim \l__nicematrix_left_margin_dim
\dim_sub:Nn \l__nicematrix_x_initial_dim \l__nicematrix_extra_left_margin_dim
- % \bool_if:NT \g__nicematrix_delims_bool
- % {
- \dim_sub:Nn \l__nicematrix_x_initial_dim \c__nicematrix_shift_exterior_Vdots_dim
- % }
+ \dim_sub:Nn \l__nicematrix_x_initial_dim \c__nicematrix_shift_exterior_Vdots_dim
}
{
\bool_lazy_and:nnTF
@@ -4456,12 +4524,7 @@
\dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
\dim_add:Nn \l__nicematrix_x_initial_dim \l__nicematrix_right_margin_dim
\dim_add:Nn \l__nicematrix_x_initial_dim \l__nicematrix_extra_right_margin_dim
- % \bool_if:NT \g__nicematrix_delims_bool
- % {
- \dim_add:Nn
- \l__nicematrix_x_initial_dim
- \c__nicematrix_shift_exterior_Vdots_dim
- % }
+ \dim_add:Nn \l__nicematrix_x_initial_dim \c__nicematrix_shift_exterior_Vdots_dim
}
{
\__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_initial_j_int }
@@ -4473,14 +4536,15 @@
}
{
\bool_set_false:N \l_tmpa_bool
- \bool_lazy_and:nnT
- { ! \l__nicematrix_initial_open_bool }
- { ! \l__nicematrix_final_open_bool }
+ \bool_if:NF \l__nicematrix_initial_open_bool
{
- \__nicematrix_set_initial_coords_from_anchor:n { south~west }
- \__nicematrix_set_final_coords_from_anchor:n { north~west }
- \bool_set:Nn \l_tmpa_bool
- { \dim_compare_p:nNn \l__nicematrix_x_initial_dim = \l__nicematrix_x_final_dim }
+ \bool_if:NF \l__nicematrix_final_open_bool
+ {
+ \__nicematrix_set_initial_coords_from_anchor:n { south~west }
+ \__nicematrix_set_final_coords_from_anchor:n { north~west }
+ \bool_set:Nn \l_tmpa_bool
+ { \dim_compare_p:nNn \l__nicematrix_x_initial_dim = \l__nicematrix_x_final_dim }
+ }
}
\bool_if:NTF \l__nicematrix_initial_open_bool
{
@@ -4517,7 +4581,7 @@
\group_begin:
\__nicematrix_open_shorten:
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Ddots:
\group_end:
}
@@ -4539,7 +4603,7 @@
\bool_if:NT \l__nicematrix_parallelize_diags_bool
{
\int_gincr:N \g__nicematrix_ddots_int
- \int_compare:nNnTF \g__nicematrix_ddots_int = 1
+ \int_compare:nNnTF \g__nicematrix_ddots_int = \c_one_int
{
\dim_gset:Nn \g__nicematrix_delta_x_one_dim
{ \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim }
@@ -4566,7 +4630,7 @@
\group_begin:
\__nicematrix_open_shorten:
\keys_set:nn { NiceMatrix / xdots } { #3 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Iddots:
\group_end:
}
@@ -4588,7 +4652,7 @@
\bool_if:NT \l__nicematrix_parallelize_diags_bool
{
\int_gincr:N \g__nicematrix_iddots_int
- \int_compare:nNnTF \g__nicematrix_iddots_int = 1
+ \int_compare:nNnTF \g__nicematrix_iddots_int = \c_one_int
{
\dim_gset:Nn \g__nicematrix_delta_x_two_dim
{ \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim }
@@ -4624,7 +4688,7 @@
}
\cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:n #1
{
- \__nicematrix_draw_unstandard_dotted_line:nVVV
+ \__nicematrix_draw_unstandard_dotted_line:nooo
{ #1 }
\l__nicematrix_xdots_up_tl
\l__nicematrix_xdots_down_tl
@@ -4663,48 +4727,20 @@
)
}
}
- \bool_lazy_and:nnT % security
- { \dim_compare_p:nNn { \dim_abs:n \l__nicematrix_l_dim } < \c__nicematrix_max_l_dim }
- { \dim_compare_p:nNn { \dim_abs:n \l__nicematrix_l_dim } > { 1 pt } }
+ \dim_compare:nNnT \l__nicematrix_l_dim < \c__nicematrix_max_l_dim
{
- \dim_set:Nn \l_tmpa_dim
+ \dim_compare:nNnT \l__nicematrix_l_dim > { 1 pt }
+ \__nicematrix_draw_unstandard_dotted_line_i:
+ }
+ \bool_if:NT \l__nicematrix_xdots_h_labels_bool
+ {
+ \tikzset
{
- \l__nicematrix_x_initial_dim
- + ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim )
- * \dim_ratio:nn \l__nicematrix_xdots_shorten_start_dim \l__nicematrix_l_dim
+ __nicematrix_node_above / .style = { auto = left } ,
+ __nicematrix_node_below / .style = { auto = right } ,
+ __nicematrix_node_middle / .style = { inner~sep = \c__nicematrix_innersep_middle_dim }
}
- \dim_set:Nn \l_tmpb_dim
- {
- \l__nicematrix_y_initial_dim
- + ( \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim )
- * \dim_ratio:nn \l__nicematrix_xdots_shorten_start_dim \l__nicematrix_l_dim
- }
- \dim_set:Nn \l__nicematrix_tmpc_dim
- {
- \l__nicematrix_x_final_dim
- - ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim )
- * \dim_ratio:nn \l__nicematrix_xdots_shorten_end_dim \l__nicematrix_l_dim
- }
- \dim_set:Nn \l__nicematrix_tmpd_dim
- {
- \l__nicematrix_y_final_dim
- - ( \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim )
- * \dim_ratio:nn \l__nicematrix_xdots_shorten_end_dim \l__nicematrix_l_dim
- }
- \dim_set_eq:NN \l__nicematrix_x_initial_dim \l_tmpa_dim
- \dim_set_eq:NN \l__nicematrix_y_initial_dim \l_tmpb_dim
- \dim_set_eq:NN \l__nicematrix_x_final_dim \l__nicematrix_tmpc_dim
- \dim_set_eq:NN \l__nicematrix_y_final_dim \l__nicematrix_tmpd_dim
}
- \bool_if:NT \l__nicematrix_xdots_h_labels_bool
- {
- \tikzset
- {
- __nicematrix_node_above / .style = { auto = left } ,
- __nicematrix_node_below / .style = { auto = right } ,
- __nicematrix_node_middle / .style = { inner~sep = \c__nicematrix_innersep_middle_dim }
- }
- }
\tl_if_empty:nF { #4 }
{ \tikzset { __nicematrix_node_middle / .append~style = { fill = white } } }
\draw
@@ -4716,7 +4752,38 @@
( \l__nicematrix_x_final_dim , \l__nicematrix_y_final_dim ) ;
\end { scope }
}
-\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:nnnn { n V V V }
+\cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line_i:
+ {
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \l__nicematrix_x_initial_dim
+ + ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim )
+ * \dim_ratio:nn \l__nicematrix_xdots_shorten_start_dim \l__nicematrix_l_dim
+ }
+ \dim_set:Nn \l_tmpb_dim
+ {
+ \l__nicematrix_y_initial_dim
+ + ( \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim )
+ * \dim_ratio:nn \l__nicematrix_xdots_shorten_start_dim \l__nicematrix_l_dim
+ }
+ \dim_set:Nn \l__nicematrix_tmpc_dim
+ {
+ \l__nicematrix_x_final_dim
+ - ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim )
+ * \dim_ratio:nn \l__nicematrix_xdots_shorten_end_dim \l__nicematrix_l_dim
+ }
+ \dim_set:Nn \l__nicematrix_tmpd_dim
+ {
+ \l__nicematrix_y_final_dim
+ - ( \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim )
+ * \dim_ratio:nn \l__nicematrix_xdots_shorten_end_dim \l__nicematrix_l_dim
+ }
+ \dim_set_eq:NN \l__nicematrix_x_initial_dim \l_tmpa_dim
+ \dim_set_eq:NN \l__nicematrix_y_initial_dim \l_tmpb_dim
+ \dim_set_eq:NN \l__nicematrix_x_final_dim \l__nicematrix_tmpc_dim
+ \dim_set_eq:NN \l__nicematrix_y_final_dim \l__nicematrix_tmpd_dim
+ }
+\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:nnnn { n o o o }
\cs_new_protected:Npn \__nicematrix_draw_standard_dotted_line:
{
\group_begin:
@@ -4733,10 +4800,11 @@
)
}
}
- \bool_lazy_or:nnF
- { \dim_compare_p:nNn { \dim_abs:n \l__nicematrix_l_dim } > \c__nicematrix_max_l_dim }
- { \dim_compare_p:nNn \l__nicematrix_l_dim = \c_zero_dim }
- \__nicematrix_draw_standard_dotted_line_i:
+ \dim_compare:nNnT \l__nicematrix_l_dim < \c__nicematrix_max_l_dim
+ {
+ \dim_compare:nNnT \l__nicematrix_l_dim > { 1 pt }
+ \__nicematrix_draw_standard_dotted_line_i:
+ }
\group_end:
\bool_lazy_all:nF
{
@@ -4790,7 +4858,7 @@
{ 2 \l__nicematrix_l_dim }
}
\pgf at relevantforpicturesizefalse
- \int_step_inline:nnn 0 \l_tmpa_int
+ \int_step_inline:nnn \c_zero_int \l_tmpa_int
{
\pgfpathcircle
{ \pgfpoint \l__nicematrix_x_initial_dim \l__nicematrix_y_initial_dim }
@@ -4877,11 +4945,11 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l__nicematrix_argspec_tl { m E { _ ^ : } { { } { } { } } }
- \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
+ \cs_set_nopar:Npn \l__nicematrix_argspec_tl { m E { _ ^ : } { { } { } { } } }
+ \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
\cs_new_protected:Npn \__nicematrix_Ldots
{ \__nicematrix_collect_options:n { \__nicematrix_Ldots_i } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Ldots_i \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Ldots_i \l__nicematrix_argspec_tl
{
\int_if_zero:nTF \c at jCol
{ \__nicematrix_error:nn { in~first~col } \Ldots }
@@ -4899,7 +4967,7 @@
}
\cs_new_protected:Npn \__nicematrix_Cdots
{ \__nicematrix_collect_options:n { \__nicematrix_Cdots_i } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Cdots_i \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Cdots_i \l__nicematrix_argspec_tl
{
\int_if_zero:nTF \c at jCol
{ \__nicematrix_error:nn { in~first~col } \Cdots }
@@ -4917,7 +4985,7 @@
}
\cs_new_protected:Npn \__nicematrix_Vdots
{ \__nicematrix_collect_options:n { \__nicematrix_Vdots_i } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Vdots_i \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Vdots_i \l__nicematrix_argspec_tl
{
\int_if_zero:nTF \c at iRow
{ \__nicematrix_error:nn { in~first~row } \Vdots }
@@ -4935,7 +5003,7 @@
}
\cs_new_protected:Npn \__nicematrix_Ddots
{ \__nicematrix_collect_options:n { \__nicematrix_Ddots_i } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Ddots_i \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Ddots_i \l__nicematrix_argspec_tl
{
\int_case:nnF \c at iRow
{
@@ -4961,7 +5029,7 @@
}
\cs_new_protected:Npn \__nicematrix_Iddots
{ \__nicematrix_collect_options:n { \__nicematrix_Iddots_i } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Iddots_i \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Iddots_i \l__nicematrix_argspec_tl
{
\int_case:nnF \c at iRow
{
@@ -5017,11 +5085,11 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l__nicematrix_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
+ \cs_set_nopar:Npn \l__nicematrix_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
\tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
\cs_new_protected:Npn \__nicematrix_Hdotsfor_i
{ \__nicematrix_collect_options:n { \__nicematrix_Hdotsfor_ii } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Hdotsfor_ii \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Hdotsfor_ii \l__nicematrix_argspec_tl
{
\tl_gput_right:Nx \g__nicematrix_HVdotsfor_lines_tl
{
@@ -5040,7 +5108,7 @@
{
&
\multicolumn { 1 } { c } { }
- \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i: % added 2023-08-26
+ \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:
}
}
}
@@ -5050,9 +5118,9 @@
\bool_set_false:N \l__nicematrix_final_open_bool
\int_set:Nn \l__nicematrix_initial_i_int { #1 }
\int_set_eq:NN \l__nicematrix_final_i_int \l__nicematrix_initial_i_int
- \int_compare:nNnTF { #2 } = 1
+ \int_compare:nNnTF { #2 } = \c_one_int
{
- \int_set:Nn \l__nicematrix_initial_j_int 1
+ \int_set_eq:NN \l__nicematrix_initial_j_int \c_one_int
\bool_set_true:N \l__nicematrix_initial_open_bool
}
{
@@ -5096,7 +5164,7 @@
}
\keys_set:nn { NiceMatrix / xdots } { #4 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Ldots:
\group_end:
\int_step_inline:nnn { #2 } { #2 + #3 - 1 }
@@ -5104,11 +5172,11 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l__nicematrix_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
+ \cs_set_nopar:Npn \l__nicematrix_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } }
\tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
\cs_new_protected:Npn \__nicematrix_Vdotsfor:
{ \__nicematrix_collect_options:n { \__nicematrix_Vdotsfor_i } }
- \exp_args:NNV \NewDocumentCommand \__nicematrix_Vdotsfor_i \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_Vdotsfor_i \l__nicematrix_argspec_tl
{
\bool_gset_true:N \g__nicematrix_empty_cell_bool
\tl_gput_right:Nx \g__nicematrix_HVdotsfor_lines_tl
@@ -5132,9 +5200,9 @@
\bool_set_false:N \l__nicematrix_final_open_bool
\int_set:Nn \l__nicematrix_initial_j_int { #2 }
\int_set_eq:NN \l__nicematrix_final_j_int \l__nicematrix_initial_j_int
- \int_compare:nNnTF { #1 } = 1
+ \int_compare:nNnTF { #1 } = \c_one_int
{
- \int_set:Nn \l__nicematrix_initial_i_int 1
+ \int_set_eq:NN \l__nicematrix_initial_i_int \c_one_int
\bool_set_true:N \l__nicematrix_initial_open_bool
}
{
@@ -5177,7 +5245,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { NiceMatrix / xdots } { #4 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\__nicematrix_actually_draw_Vdots:
\group_end:
\int_step_inline:nnn { #1 } { #1 + #3 - 1 }
@@ -5207,13 +5275,14 @@
{ \int_eval:n { #1 } - \int_eval:n { #2 } }
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l__nicematrix_argspec_tl { O { } m m ! O { } E { _ ^ : } { { } { } { } } }
+ \cs_set_nopar:Npn \l__nicematrix_argspec_tl
+ { O { } m m ! O { } E { _ ^ : } { { } { } { } } }
\tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
- \exp_args:NNV \NewDocumentCommand \__nicematrix_line \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_line \l__nicematrix_argspec_tl
{
\group_begin:
\keys_set:nn { NiceMatrix / xdots } { #1 , #4 , down = #5 , up = #6 }
- \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
\use:e
{
\__nicematrix_line_i:nn
@@ -5227,15 +5296,10 @@
{
\bool_set_false:N \l__nicematrix_initial_open_bool
\bool_set_false:N \l__nicematrix_final_open_bool
- \bool_if:nTF
- {
- \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #1 }
- ||
- \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #2 }
- }
- {
- \__nicematrix_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 }
- }
+ \bool_lazy_or:nnTF
+ { \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #1 } }
+ { \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #2 } }
+ { \__nicematrix_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 } }
{ \legacy_if:nF { measuring@ } { \__nicematrix_draw_line_ii:nn { #1 } { #2 } } }
}
\hook_gput_code:nnn { begindocument } { . }
@@ -5259,7 +5323,7 @@
\__nicematrix_draw_line:
}
\cs_new:Npn \__nicematrix_if_row_less_than:nn #1 #2
- { \int_compare:nNnT { \int_use:N \c at iRow } < { #1 } { #2 } }
+ { \int_compare:nNnT \c at iRow < { #1 } { #2 } }
\cs_set_protected:Npn \__nicematrix_put_in_row_style:n #1
{
\tl_gput_right:Nx \g__nicematrix_row_style_tl
@@ -5310,15 +5374,15 @@
{
\tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
- \__nicematrix_exp_color_arg:NV \__nicematrix_rectanglecolor \l_tmpa_tl
+ \__nicematrix_exp_color_arg:No \__nicematrix_rectanglecolor \l_tmpa_tl
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
{ \int_use:N \c at iRow - * }
}
- \int_compare:nNnT \l__nicematrix_key_nb_rows_int > 1
+ \int_compare:nNnT \l__nicematrix_key_nb_rows_int > \c_one_int
{
\tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
- \__nicematrix_exp_color_arg:NV \__nicematrix_rowcolor \l_tmpa_tl
+ \__nicematrix_exp_color_arg:No \__nicematrix_rowcolor \l_tmpa_tl
{
\int_eval:n { \c at iRow + 1 }
- \int_eval:n { \c at iRow + \l__nicematrix_key_nb_rows_int - 1 }
@@ -5451,7 +5515,7 @@
\__nicematrix_clip_with_rounded_corners:
\seq_map_indexed_inline:Nn \g__nicematrix_colors_seq
{
- \int_compare:nNnTF { ##1 } = 1
+ \int_compare:nNnTF { ##1 } = \c_one_int
{
\cs_set_eq:NN \__nicematrix_cartesian_path:n \__nicematrix_cartesian_path_nocolor:n
\use:c { g__nicematrix_color _ 1 _tl }
@@ -5478,7 +5542,7 @@
{
\tl_clear:N \l_tmpa_tl
\keys_set_known:nnN { nicematrix / color-opacity } { #1 } \l_tmpb_tl
- \tl_if_empty:NF \l_tmpa_tl { \exp_args:NV \pgfsetfillopacity \l_tmpa_tl }
+ \tl_if_empty:NF \l_tmpa_tl { \exp_args:No \pgfsetfillopacity \l_tmpa_tl }
\tl_if_empty:NTF \l_tmpb_tl
{ \@declaredcolor }
{ \use:e { \exp_not:N \@undeclaredcolor [ \l_tmpb_tl ] } }
@@ -5490,8 +5554,8 @@
}
\cs_new_protected:Npn \__nicematrix_cartesian_color:nn #1 #2
{
- \tl_set:Nn \l__nicematrix_rows_tl { #1 }
- \tl_set:Nn \l__nicematrix_cols_tl { #2 }
+ \cs_set_nopar:Npn \l__nicematrix_rows_tl { #1 }
+ \cs_set_nopar:Npn \l__nicematrix_cols_tl { #2 }
\__nicematrix_cartesian_path:
}
\NewDocumentCommand \__nicematrix_rowcolor { O { } m m }
@@ -5518,7 +5582,7 @@
{
\__nicematrix_add_to_colors_seq:en
{ \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } }
- { \__nicematrix_rectanglecolor:nnn { #3 } { #4 } { 0 pt } }
+ { \__nicematrix_rectanglecolor:nnn { #3 } { #4 } { \c_zero_dim } }
}
}
\NewDocumentCommand \__nicematrix_roundedrectanglecolor { O { } m m m m }
@@ -5549,9 +5613,9 @@
}
\NewDocumentCommand \__nicematrix_chessboardcolors { O { } m m }
{
- \int_step_inline:nn { \int_use:N \c at iRow }
+ \int_step_inline:nn \c at iRow
{
- \int_step_inline:nn { \int_use:N \c at jCol }
+ \int_step_inline:nn \c at jCol
{
\int_if_even:nTF { ####1 + ##1 }
{ \__nicematrix_cellcolor [ #1 ] { #2 } }
@@ -5581,10 +5645,10 @@
\seq_clear_new:N \l__nicematrix_colors_seq
\seq_set_split:Nnn \l__nicematrix_colors_seq { , } { #3 }
\tl_clear_new:N \l__nicematrix_cols_tl
- \tl_set:Nn \l__nicematrix_cols_tl { - }
+ \cs_set_nopar:Npn \l__nicematrix_cols_tl { - }
\keys_set:nn { NiceMatrix / rowcolors } { #4 }
\int_zero_new:N \l__nicematrix_color_int
- \int_set:Nn \l__nicematrix_color_int 1
+ \int_set_eq:NN \l__nicematrix_color_int \c_one_int
\bool_if:NT \l__nicematrix_respect_blocks_bool
{
\seq_set_eq:NN \l_tmpb_seq \g__nicematrix_pos_of_blocks_seq
@@ -5595,10 +5659,10 @@
\pgf at relevantforpicturesizefalse
\clist_map_inline:nn { #2 }
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at iRow } }
\int_set:Nn \l_tmpa_int \l_tmpa_tl
\int_set:Nn \l__nicematrix_color_int
{ \bool_if:NTF \l__nicematrix_rowcolors_restart_bool 1 \l_tmpa_tl }
@@ -5613,7 +5677,7 @@
{ \__nicematrix_intersect_our_row_p:nnnnn ####1 }
\seq_map_inline:Nn \l_tmpb_seq { \__nicematrix_rowcolors_i:nnnnn ####1 }
}
- \tl_set:Nx \l__nicematrix_rows_tl
+ \tl_set:No \l__nicematrix_rows_tl
{ \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
\tl_clear_new:N \l__nicematrix_color_tl
\tl_set:Nx \l__nicematrix_color_tl
@@ -5654,51 +5718,62 @@
}
\prg_new_conditional:Nnn \__nicematrix_not_in_exterior:nnnnn p
{
- \bool_lazy_or:nnTF
- { \int_if_zero_p:n { #4 } }
- { \int_compare_p:nNn { #2 } = { \int_eval:n { \c at jCol + 1 } } }
+ \int_if_zero:nTF { #4 }
\prg_return_false:
- \prg_return_true:
+ {
+ \int_compare:nNnTF { #2 } > \c at jCol
+ \prg_return_false:
+ \prg_return_true:
+ }
}
\prg_new_conditional:Nnn \__nicematrix_intersect_our_row:nnnnn p
{
- \bool_if:nTF
+ \int_compare:nNnTF { #1 } > \l_tmpa_int
+ \prg_return_false:
{
- \int_compare_p:n { #1 <= \l_tmpa_int }
- &&
- \int_compare_p:n { \l_tmpa_int <= #3 }
+ \int_compare:nNnTF \l_tmpa_int > { #3 }
+ \prg_return_false:
+ \prg_return_true:
}
- \prg_return_true:
- \prg_return_false:
}
\cs_new_protected:Npn \__nicematrix_cartesian_path_normal:n #1
{
- \bool_lazy_any:nT
+ \dim_compare:nNnTF { #1 } = \c_zero_dim
{
- { ! \seq_if_empty_p:N \l__nicematrix_corners_cells_seq }
- { \dim_compare_p:nNn { #1 } = \c_zero_dim }
- { ! \__nicematrix_nocolor_used_bool }
+ \bool_if:NTF
+ \__nicematrix_nocolor_used_bool
+ \__nicematrix_cartesian_path_normal_ii:
+ {
+ \seq_if_empty:NTF \l__nicematrix_corners_cells_seq
+ { \__nicematrix_cartesian_path_normal_i:n { #1 } }
+ \__nicematrix_cartesian_path_normal_ii:
+ }
}
- {
- \__nicematrix_expand_clist:NN \l__nicematrix_cols_tl \c at jCol
- \__nicematrix_expand_clist:NN \l__nicematrix_rows_tl \c at iRow
- }
+ { \__nicematrix_cartesian_path_normal_i:n { #1 } }
+ }
+\cs_new_protected:Npn \__nicematrix_cartesian_path_normal_i:n #1
+ {
+ \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
\clist_map_inline:Nn \l__nicematrix_cols_tl
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
{ \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
- \bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpa_tl }
- { \str_if_eq_p:Vn \l_tmpa_tl { * } }
- { \tl_set:Nn \l_tmpa_tl { 1 } }
- \bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpb_tl }
- { \str_if_eq_p:Vn \l_tmpb_tl { * } }
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+ \tl_if_empty:NTF \l_tmpa_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ {
+ \tl_if_eq:NNT \l_tmpa_tl \c__nicematrix_star_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ }
+ \tl_if_empty:NTF \l_tmpb_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at jCol } }
+ {
+ \tl_if_eq:NNT \l_tmpb_tl \c__nicematrix_star_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at jCol } }
+ }
\int_compare:nNnT \l_tmpb_tl > \g__nicematrix_col_total_int
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \g__nicematrix_col_total_int } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N \g__nicematrix_col_total_int } }
\tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl
\__nicematrix_qpoint:n { col - \l_tmpa_tl }
\int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpa_tl
@@ -5708,25 +5783,61 @@
\dim_set:Nn \l_tmpa_dim { \pgf at x + 0.5 \arrayrulewidth }
\clist_map_inline:Nn \l__nicematrix_rows_tl
{
- \tl_set:Nn \l_tmpa_tl { ####1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ####1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \__nicematrix_cut_on_hyphen:w ####1 \q_stop }
{ \__nicematrix_cut_on_hyphen:w ####1 - ####1 \q_stop }
- \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
- \tl_if_empty:NT \l_tmpb_tl
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+ \tl_if_empty:NTF \l_tmpa_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ {
+ \tl_if_eq:NNT \l_tmpa_tl \c__nicematrix_star_tl
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
+ }
+ \tl_if_empty:NTF \l_tmpb_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at iRow } }
+ {
+ \tl_if_eq:NNT \l_tmpb_tl \c__nicematrix_star_tl
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at iRow } }
+ }
\int_compare:nNnT \l_tmpb_tl > \g__nicematrix_row_total_int
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \g__nicematrix_row_total_int } }
- \seq_if_in:NxF \l__nicematrix_corners_cells_seq
- { \l_tmpa_tl - \l__nicematrix_tmpc_tl }
+ { \tl_set:No \l_tmpb_tl { \int_use:N \g__nicematrix_row_total_int } }
+ \cs_if_exist:cF
+ { __nicematrix _ \l_tmpa_tl _ \l__nicematrix_tmpc_tl _ nocolor }
{
\__nicematrix_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
\__nicematrix_qpoint:n { row - \l_tmpa_tl }
\dim_set:Nn \l__nicematrix_tmpd_dim { \pgf at y + 0.5 \arrayrulewidth }
- \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
+ \pgfpathrectanglecorners
+ { \pgfpoint \l__nicematrix_tmpc_dim \l__nicematrix_tmpd_dim }
+ { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
+ }
+ }
+ }
+ }
+\cs_new_protected:Npn \__nicematrix_cartesian_path_normal_ii:
+ {
+ \__nicematrix_expand_clist:NN \l__nicematrix_cols_tl \c at jCol
+ \__nicematrix_expand_clist:NN \l__nicematrix_rows_tl \c at iRow
+ \clist_map_inline:Nn \l__nicematrix_cols_tl
+ {
+ \__nicematrix_qpoint:n { col - ##1 }
+ \int_compare:nNnTF \l__nicematrix_first_col_int = { ##1 }
+ { \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
+ { \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
+ \__nicematrix_qpoint:n { col - \int_eval:n { ##1 + 1 } }
+ \dim_set:Nn \l_tmpa_dim { \pgf at x + 0.5 \arrayrulewidth }
+ \clist_map_inline:Nn \l__nicematrix_rows_tl
+ {
+ \seq_if_in:NnF \l__nicematrix_corners_cells_seq
+ { ####1 - ##1 }
+ {
+ \__nicematrix_qpoint:n { row - \int_eval:n { ####1 + 1 } }
+ \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
+ \__nicematrix_qpoint:n { row - ####1 }
+ \dim_set:Nn \l__nicematrix_tmpd_dim { \pgf at y + 0.5 \arrayrulewidth }
\cs_if_exist:cF
- { __nicematrix _ \l_tmpa_tl _ \l__nicematrix_tmpc_tl _ nocolor }
+ { __nicematrix _ ####1 _ ##1 _ nocolor }
{
\pgfpathrectanglecorners
{ \pgfpoint \l__nicematrix_tmpc_dim \l__nicematrix_tmpd_dim }
@@ -5736,7 +5847,7 @@
}
}
}
-\cs_new_protected:Npn \__nicematrix_cartesian_path: { \__nicematrix_cartesian_path:n { 0 pt } }
+\cs_new_protected:Npn \__nicematrix_cartesian_path: { \__nicematrix_cartesian_path:n \c_zero_dim }
\cs_new_protected:Npn \__nicematrix_cartesian_path_nocolor:n #1
{
\bool_set_true:N \__nicematrix_nocolor_used_bool
@@ -5754,20 +5865,20 @@
\clist_clear:N #1
\clist_map_inline:Nn \l_tmpa_clist
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
{ \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
{ \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
\bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpa_tl }
- { \str_if_eq_p:Vn \l_tmpa_tl { * } }
- { \tl_set:Nn \l_tmpa_tl { 1 } }
+ { \tl_if_blank_p:o \l_tmpa_tl }
+ { \str_if_eq_p:on \l_tmpa_tl { * } }
+ { \cs_set_nopar:Npn \l_tmpa_tl { 1 } }
\bool_lazy_or:nnT
- { \tl_if_blank_p:V \l_tmpb_tl }
- { \str_if_eq_p:Vn \l_tmpb_tl { * } }
- { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } }
+ { \tl_if_blank_p:o \l_tmpb_tl }
+ { \str_if_eq_p:on \l_tmpb_tl { * } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N #2 } }
\int_compare:nNnT \l_tmpb_tl > #2
- { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } }
+ { \tl_set:No \l_tmpb_tl { \int_use:N #2 } }
\int_step_inline:nnn \l_tmpa_tl \l_tmpb_tl
{ \clist_put_right:Nn #1 { ####1 } }
}
@@ -5899,7 +6010,6 @@
position .int_set:N = \l__nicematrix_position_int ,
position .value_required:n = true ,
start .int_set:N = \l__nicematrix_start_int ,
- start .initial:n = 1 ,
end .code:n =
\bool_lazy_or:nnTF
{ \tl_if_empty_p:n { #1 } }
@@ -5933,7 +6043,6 @@
\cs_new_protected:Npn \__nicematrix_vline:n #1
{
\group_begin:
- \int_zero_new:N \l__nicematrix_end_int
\int_set_eq:NN \l__nicematrix_end_int \c at iRow
\keys_set_known:nnN { NiceMatrix / Rules } { #1 } \l__nicematrix_other_keys_tl
\int_compare:nNnT \l__nicematrix_position_int < { \c at jCol + 2 }
@@ -5942,9 +6051,7 @@
}
\cs_new_protected:Npn \__nicematrix_vline_i:
{
- \int_zero_new:N \l__nicematrix_local_start_int
- \int_zero_new:N \l__nicematrix_local_end_int
- \tl_set:Nx \l_tmpb_tl { \int_eval:n \l__nicematrix_position_int }
+ \tl_set:No \l_tmpb_tl { \int_use:N \l__nicematrix_position_int }
\int_step_variable:nnNn \l__nicematrix_start_int \l__nicematrix_end_int
\l_tmpa_tl
{
@@ -5962,7 +6069,7 @@
{ \int_set:Nn \l__nicematrix_local_start_int \l_tmpa_tl }
}
{
- \int_compare:nNnT \l__nicematrix_local_start_int > 0
+ \int_compare:nNnT \l__nicematrix_local_start_int > \c_zero_int
{
\int_set:Nn \l__nicematrix_local_end_int { \l_tmpa_tl - 1 }
\__nicematrix_vline_ii:
@@ -5970,7 +6077,7 @@
}
}
}
- \int_compare:nNnT \l__nicematrix_local_start_int > 0
+ \int_compare:nNnT \l__nicematrix_local_start_int > \c_zero_int
{
\int_set_eq:NN \l__nicematrix_local_end_int \l__nicematrix_end_int
\__nicematrix_vline_ii:
@@ -5990,7 +6097,7 @@
\l__nicematrix_corners_cells_seq
{ \l_tmpa_tl - \l_tmpb_tl }
{
- \int_compare:nNnTF \l_tmpb_tl = 1
+ \int_compare:nNnTF \l_tmpb_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
\seq_if_in:NxT
@@ -6033,9 +6140,9 @@
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at y
\bool_lazy_all:nT
{
- { \int_compare_p:nNn \l__nicematrix_multiplicity_int > 1 }
+ { \int_compare_p:nNn \l__nicematrix_multiplicity_int > \c_one_int }
{ \cs_if_exist_p:N \CT at drsc@ }
- { ! \tl_if_blank_p:V \CT at drsc@ }
+ { ! \tl_if_blank_p:o \CT at drsc@ }
}
{
\group_begin:
@@ -6099,7 +6206,7 @@
\dim_set:Nn \l_tmpb_dim { \pgf at x - 0.5 \l__nicematrix_rule_width_dim }
\__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_local_end_int + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at y
- \exp_args:NV \tikzset \l__nicematrix_tikz_rule_tl
+ \exp_args:No \tikzset \l__nicematrix_tikz_rule_tl
\use:e { \exp_not:N \draw [ \l__nicematrix_tikz_rule_tl ] }
( \l_tmpb_dim , \l_tmpa_dim ) --
( \l_tmpb_dim , \l__nicematrix_tmpc_dim ) ;
@@ -6108,17 +6215,14 @@
\cs_new_protected:Npn \__nicematrix_draw_vlines:
{
\int_step_inline:nnn
+ { \bool_lazy_or:nnTF \g__nicematrix_delims_bool \l__nicematrix_except_borders_bool 2 1 }
{
- \bool_if:nTF { ! \g__nicematrix_delims_bool && ! \l__nicematrix_except_borders_bool }
- 1 2
- }
- {
- \bool_if:nTF { ! \g__nicematrix_delims_bool && ! \l__nicematrix_except_borders_bool }
+ \bool_lazy_or:nnTF \g__nicematrix_delims_bool \l__nicematrix_except_borders_bool
+ \c at jCol
{ \int_eval:n { \c at jCol + 1 } }
- \c at jCol
}
{
- \tl_if_eq:NnF \l__nicematrix_vlines_clist { all }
+ \tl_if_eq:NNF \l__nicematrix_vlines_clist \c__nicematrix_all_tl
{ \clist_if_in:NnT \l__nicematrix_vlines_clist { ##1 } }
{ \__nicematrix_vline:n { position = ##1 , total-width = \arrayrulewidth } }
}
@@ -6136,7 +6240,7 @@
{
\int_zero_new:N \l__nicematrix_local_start_int
\int_zero_new:N \l__nicematrix_local_end_int
- \tl_set:Nx \l_tmpa_tl { \int_use:N \l__nicematrix_position_int }
+ \tl_set:No \l_tmpa_tl { \int_use:N \l__nicematrix_position_int }
\int_step_variable:nnNn \l__nicematrix_start_int \l__nicematrix_end_int
\l_tmpb_tl
{
@@ -6154,7 +6258,7 @@
{ \int_set:Nn \l__nicematrix_local_start_int \l_tmpb_tl }
}
{
- \int_compare:nNnT \l__nicematrix_local_start_int > 0
+ \int_compare:nNnT \l__nicematrix_local_start_int > \c_zero_int
{
\int_set:Nn \l__nicematrix_local_end_int { \l_tmpb_tl - 1 }
\__nicematrix_hline_ii:
@@ -6162,7 +6266,7 @@
}
}
}
- \int_compare:nNnT \l__nicematrix_local_start_int > 0
+ \int_compare:nNnT \l__nicematrix_local_start_int > \c_zero_int
{
\int_set_eq:NN \l__nicematrix_local_end_int \l__nicematrix_end_int
\__nicematrix_hline_ii:
@@ -6182,7 +6286,7 @@
\l__nicematrix_corners_cells_seq
{ \l_tmpa_tl - \l_tmpb_tl }
{
- \int_compare:nNnTF \l_tmpa_tl = 1
+ \int_compare:nNnTF \l_tmpa_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
\seq_if_in:NxT
@@ -6225,9 +6329,9 @@
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at x
\bool_lazy_all:nT
{
- { \int_compare_p:nNn \l__nicematrix_multiplicity_int > 1 }
+ { \int_compare_p:nNn \l__nicematrix_multiplicity_int > \c_one_int }
{ \cs_if_exist_p:N \CT at drsc@ }
- { ! \tl_if_blank_p:V \CT at drsc@ }
+ { ! \tl_if_blank_p:o \CT at drsc@ }
}
{
\group_begin:
@@ -6268,7 +6372,7 @@
\dim_set_eq:NN \l__nicematrix_y_final_dim \l__nicematrix_y_initial_dim
\__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_local_start_int }
\dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
- \int_compare:nNnT \l__nicematrix_local_start_int = 1
+ \int_compare:nNnT \l__nicematrix_local_start_int = \c_one_int
{
\dim_sub:Nn \l__nicematrix_x_initial_dim \l__nicematrix_left_margin_dim
\bool_if:NF \g__nicematrix_delims_bool
@@ -6305,7 +6409,7 @@
\dim_set:Nn \l_tmpb_dim { \pgf at y - 0.5 \l__nicematrix_rule_width_dim }
\__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_local_end_int + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at x
- \exp_args:NV \tikzset \l__nicematrix_tikz_rule_tl
+ \exp_args:No \tikzset \l__nicematrix_tikz_rule_tl
\use:e { \exp_not:N \draw [ \l__nicematrix_tikz_rule_tl ] }
( \l_tmpa_dim , \l_tmpb_dim ) --
( \l__nicematrix_tmpc_dim , \l_tmpb_dim ) ;
@@ -6314,17 +6418,14 @@
\cs_new_protected:Npn \__nicematrix_draw_hlines:
{
\int_step_inline:nnn
+ { \bool_lazy_or:nnTF \g__nicematrix_delims_bool \l__nicematrix_except_borders_bool 2 1 }
{
- \bool_if:nTF { ! \g__nicematrix_delims_bool && ! \l__nicematrix_except_borders_bool }
- 1 2
- }
- {
- \bool_if:nTF { ! \g__nicematrix_delims_bool && ! \l__nicematrix_except_borders_bool }
+ \bool_lazy_or:nnTF \g__nicematrix_delims_bool \l__nicematrix_except_borders_bool
+ \c at iRow
{ \int_eval:n { \c at iRow + 1 } }
- \c at iRow
}
{
- \tl_if_eq:NnF \l__nicematrix_hlines_clist { all }
+ \tl_if_eq:NNF \l__nicematrix_hlines_clist \c__nicematrix_all_tl
{ \clist_if_in:NnT \l__nicematrix_hlines_clist { ##1 } }
{ \__nicematrix_hline:n { position = ##1 , total-width = \arrayrulewidth } }
}
@@ -6345,7 +6446,7 @@
\cs_set:Npn \__nicematrix_Hline_iv:nn #1 #2
{
\__nicematrix_compute_rule_width:n { multiplicity = #1 , #2 }
- \skip_vertical:n { \l__nicematrix_rule_width_dim }
+ \skip_vertical:N \l__nicematrix_rule_width_dim
\tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_hline:n
@@ -6372,7 +6473,7 @@
{ \str_if_empty_p:N \l__nicematrix_ccommand_str }
}
{ \__nicematrix_error:n { No~letter~and~no~command } }
- { \exp_args:NV \__nicematrix_custom_line_i:n \l__nicematrix_other_keys_tl }
+ { \exp_args:No \__nicematrix_custom_line_i:n \l__nicematrix_other_keys_tl }
}
\keys_define:nn { NiceMatrix / custom-line }
{
@@ -6397,12 +6498,11 @@
\bool_if:NT \l__nicematrix_color_bool
{ \__nicematrix_error:n { color~in~custom-line~with~tikz } }
}
- \bool_if:nT
+ \bool_if:NT \l__nicematrix_dotted_rule_bool
{
- \int_compare_p:nNn \l__nicematrix_multiplicity_int > 1
- && \l__nicematrix_dotted_rule_bool
+ \int_compare:nNnT \l__nicematrix_multiplicity_int > \c_one_int
+ { \__nicematrix_error:n { key~multiplicity~with~dotted } }
}
- { \__nicematrix_error:n { key~multiplicity~with~dotted } }
\str_if_empty:NF \l__nicematrix_letter_str
{
\int_compare:nTF { \str_count:N \l__nicematrix_letter_str != 1 }
@@ -6459,7 +6559,7 @@
\cs_new_protected:Npn \__nicematrix_h_custom_line:n #1
{
\cs_set:cpn { nicematrix - \l__nicematrix_command_str } { \Hline [ #1 ] }
- \seq_put_left:NV \l__nicematrix_custom_line_commands_seq \l__nicematrix_command_str
+ \seq_put_left:No \l__nicematrix_custom_line_commands_seq \l__nicematrix_command_str
}
\cs_new_protected:Npn \__nicematrix_c_custom_line:n #1
{
@@ -6476,7 +6576,7 @@
{ \__nicematrix_c_custom_line_i:nn { #1 , ##1 } { ####1 } }
}
}
- \seq_put_left:NV \l__nicematrix_custom_line_commands_seq \l__nicematrix_ccommand_str
+ \seq_put_left:No \l__nicematrix_custom_line_commands_seq \l__nicematrix_ccommand_str
}
\cs_new_protected:Npn \__nicematrix_c_custom_line_i:nn #1 #2
{
@@ -6537,51 +6637,61 @@
{ letter = : , command = hdottedline , ccommand = cdottedline, dotted }
\cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnnn #1 #2 #3 #4 #5
{
- \bool_lazy_all:nT
+ \int_compare:nNnT \l_tmpa_tl > { #1 }
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
+ \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
\cs_new_protected:Npn \__nicematrix_test_vline_in_block:nnnnn #1 #2 #3 #4 #5
{
- \bool_lazy_all:nT
+ \int_compare:nNnT \l_tmpa_tl > { #1 - 1 }
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
+ \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
+ {
+ \int_compare:nNnT \l_tmpb_tl > { #2 }
+ {
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
\cs_new_protected:Npn \__nicematrix_test_hline_in_stroken_block:nnnn #1 #2 #3 #4
{
- \bool_lazy_all:nT
+ \int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
{
- {
- ( \int_compare_p:nNn \l_tmpa_tl = { #1 } )
- || ( \int_compare_p:nNn \l_tmpa_tl = { #3 + 1 } )
- }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
+ \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
+ {
+ \int_compare:nNnTF \l_tmpa_tl = { #1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ {
+ \int_compare:nNnT \l_tmpa_tl = { #3 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
\cs_new_protected:Npn \__nicematrix_test_vline_in_stroken_block:nnnn #1 #2 #3 #4
{
- \bool_lazy_all:nT
+ \int_compare:nNnT \l_tmpa_tl > { #1 - 1 }
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- {
- ( \int_compare_p:nNn \l_tmpb_tl = { #2 } )
- || ( \int_compare_p:nNn \l_tmpb_tl = { #4 + 1 } )
- }
+ \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
+ {
+ \int_compare:nNnTF \l_tmpb_tl = { #2 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ {
+ \int_compare:nNnT \l_tmpb_tl = { #4 + 1 }
+ { \bool_gset_false:N \g_tmpa_bool }
+ }
+ }
}
- { \bool_gset_false:N \g_tmpa_bool }
}
\cs_new_protected:Npn \__nicematrix_compute_corners:
{
@@ -6681,15 +6791,15 @@
\seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq
{ \__nicematrix_test_if_cell_in_block:nnnnnnn \l_tmpa_int \l_tmpb_int ##1 }
}
-\cs_new_protected:Npn \__nicematrix_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_set_protected:Npn \__nicematrix_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
- \int_compare:nNnT { #3 } < { \int_eval:n { #1 + 1 } }
+ \int_compare:nNnF { #3 } > { #1 }
{
- \int_compare:nNnT { #1 } < { \int_eval:n { #5 + 1 } }
+ \int_compare:nNnF { #1 } > { #5 }
{
- \int_compare:nNnT { #4 } < { \int_eval:n { #2 + 1 } }
+ \int_compare:nNnF { #4 } > { #2 }
{
- \int_compare:nNnT { #2 } < { \int_eval:n { #6 + 1 } }
+ \int_compare:nNnF { #2 } > { #6 }
{ \bool_set_true:N \l_tmpb_bool }
}
}
@@ -6824,7 +6934,7 @@
\pgfrememberpicturepositiononpagetrue
\pgf at relevantforpicturesizefalse
\__nicematrix_computations_for_medium_nodes:
- \tl_set:Nn \l__nicematrix_suffix_tl { -medium }
+ \cs_set_nopar:Npn \l__nicematrix_suffix_tl { -medium }
\__nicematrix_create_nodes:
\endpgfpicture
}
@@ -6835,7 +6945,7 @@
\pgf at relevantforpicturesizefalse
\__nicematrix_computations_for_medium_nodes:
\__nicematrix_computations_for_large_nodes:
- \tl_set:Nn \l__nicematrix_suffix_tl { - large }
+ \cs_set_nopar:Npn \l__nicematrix_suffix_tl { - large }
\__nicematrix_create_nodes:
\endpgfpicture
}
@@ -6845,17 +6955,17 @@
\pgfrememberpicturepositiononpagetrue
\pgf at relevantforpicturesizefalse
\__nicematrix_computations_for_medium_nodes:
- \tl_set:Nn \l__nicematrix_suffix_tl { - medium }
+ \cs_set_nopar:Npn \l__nicematrix_suffix_tl { - medium }
\__nicematrix_create_nodes:
\__nicematrix_computations_for_large_nodes:
- \tl_set:Nn \l__nicematrix_suffix_tl { - large }
+ \cs_set_nopar:Npn \l__nicematrix_suffix_tl { - large }
\__nicematrix_create_nodes:
\endpgfpicture
}
\cs_new_protected:Npn \__nicematrix_computations_for_large_nodes:
{
- \int_set:Nn \l__nicematrix_first_row_int 1
- \int_set:Nn \l__nicematrix_first_col_int 1
+ \int_set_eq:NN \l__nicematrix_first_row_int \c_one_int
+ \int_set_eq:NN \l__nicematrix_first_col_int \c_one_int
\int_step_variable:nNn { \c at iRow - 1 } \__nicematrix_i:
{
\dim_set:cn { l__nicematrix_row _ \__nicematrix_i: _ min _ dim }
@@ -6950,13 +7060,13 @@
R .value_forbidden:n = true ,
C .code:n = \str_set:Nn \l__nicematrix_hpos_block_str c ,
C .value_forbidden:n = true ,
- t .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str t ,
+ t .code:n = \str_set:Nn \l__nicematrix_vpos_block_str t ,
t .value_forbidden:n = true ,
- T .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str T ,
+ T .code:n = \str_set:Nn \l__nicematrix_vpos_block_str T ,
T .value_forbidden:n = true ,
- b .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str b ,
+ b .code:n = \str_set:Nn \l__nicematrix_vpos_block_str b ,
b .value_forbidden:n = true ,
- B .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str B ,
+ B .code:n = \str_set:Nn \l__nicematrix_vpos_block_str B ,
B .value_forbidden:n = true ,
color .code:n =
\__nicematrix_color:n { #1 }
@@ -6965,8 +7075,9 @@
{ \char_set_catcode_other:N ! }
{ #1 } ,
color .value_required:n = true ,
- respect-arraystretch .bool_set:N = \l__nicematrix_respect_arraystretch_bool ,
- respect-arraystretch .default:n = true
+ respect-arraystretch .code:n =
+ \cs_set_eq:NN \__nicematrix_reset_arraystretch: \prg_do_nothing: ,
+ respect-arraystretch .value_forbidden:n = true ,
}
\cs_new_protected:Npn \__nicematrix_Block: { \__nicematrix_collect_options:n { \__nicematrix_Block_i: } }
\NewExpandableDocumentCommand \__nicematrix_Block_i: { m m D < > { } +m }
@@ -6974,7 +7085,7 @@
\peek_remove_spaces:n
{
\tl_if_blank:nTF { #2 }
- { \__nicematrix_Block_i 1-1 \q_stop }
+ { \__nicematrix_Block_ii:nnnnn \c_one_int \c_one_int }
{
\int_compare:nNnTF { \char_value_catcode:n { 45 } } = { 13 }
\__nicematrix_Block_i_czech \__nicematrix_Block_i
@@ -7000,13 +7111,13 @@
{ \str_if_eq_p:nn { #2 } { * } }
{ \int_set:Nn \l_tmpb_int { 100 } }
{ \int_set:Nn \l_tmpb_int { #2 } }
- \int_compare:nNnTF \l_tmpb_int = 1
+ \int_compare:nNnTF \l_tmpb_int = \c_one_int
{
- \str_if_empty:NTF \l__nicematrix_hpos_cell_str
- { \str_set:Nn \l__nicematrix_hpos_block_str c }
- { \str_set_eq:NN \l__nicematrix_hpos_block_str \l__nicematrix_hpos_cell_str }
+ \tl_if_empty:NTF \l__nicematrix_hpos_cell_tl
+ { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_c_str }
+ { \str_set:NV \l__nicematrix_hpos_block_str \l__nicematrix_hpos_cell_tl }
}
- { \str_set:Nn \l__nicematrix_hpos_block_str c }
+ { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_c_str }
\keys_set_known:nn { NiceMatrix / Block / FirstPass } { #3 }
\tl_set:Nx \l_tmpa_tl
{
@@ -7018,9 +7129,9 @@
\bool_if:nTF
{
(
- \int_compare_p:nNn { \l_tmpa_int } = 1
+ \int_compare_p:nNn \l_tmpa_int = \c_one_int
||
- \int_compare_p:nNn { \l_tmpb_int } = 1
+ \int_compare_p:nNn \l_tmpb_int = \c_one_int
)
&& ! \tl_if_empty_p:n { #5 }
&& ! \l__nicematrix_X_bool
@@ -7051,9 +7162,9 @@
{ g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
{
\tl_if_empty:NTF \l__nicematrix_color_tl
- { \int_compare:nNnT { #2 } = 1 \set at color }
- { \__nicematrix_color:V \l__nicematrix_color_tl }
- \int_compare:nNnT { #1 } = 1
+ { \int_compare:nNnT { #2 } = \c_one_int \set at color }
+ { \__nicematrix_color:o \l__nicematrix_color_tl }
+ \int_compare:nNnT { #1 } = \c_one_int
{
\int_if_zero:nTF \c at iRow
\l__nicematrix_code_for_first_row_tl
@@ -7063,8 +7174,7 @@
}
\g__nicematrix_row_style_tl
}
- \bool_if:NF \l__nicematrix_respect_arraystretch_bool
- { \cs_set:Npn \arraystretch { 1 } }
+ \__nicematrix_reset_arraystretch:
\dim_zero:N \extrarowheight
#4
\__nicematrix_adjust_hpos_rotate:
@@ -7072,8 +7182,8 @@
{
\bool_lazy_all:nTF
{
- { \int_compare_p:nNn { #2 } = 1 }
- { \dim_compare_p:n { \l__nicematrix_col_width_dim >= \c_zero_dim } }
+ { \int_compare_p:nNn { #2 } = \c_one_int }
+ { ! \dim_compare_p:nNn \l__nicematrix_col_width_dim < \c_zero_dim }
{ ! \g__nicematrix_rotate_bool }
}
{
@@ -7080,9 +7190,9 @@
\use:e
{
\exp_not:N \begin { minipage }%
- [ \str_lowercase:V { \l__nicematrix_vpos_of_block_str } ]
+ [ \str_lowercase:V \l__nicematrix_vpos_block_str ]
{ \l__nicematrix_col_width_dim }
- \str_case:Vn \l__nicematrix_hpos_block_str
+ \str_case:on \l__nicematrix_hpos_block_str
{ c \centering r \raggedleft l \raggedright }
}
#5
@@ -7092,7 +7202,7 @@
\use:e
{
\exp_not:N \begin { tabular }%
- [ \str_lowercase:V { \l__nicematrix_vpos_of_block_str } ]
+ [ \str_lowercase:V \l__nicematrix_vpos_block_str ]
{ @ { } \l__nicematrix_hpos_block_str @ { } }
}
#5
@@ -7104,7 +7214,7 @@
\use:e
{
\exp_not:N \begin { array }%
- [ \str_lowercase:V { \l__nicematrix_vpos_of_block_str } ]
+ [ \str_lowercase:V \l__nicematrix_vpos_block_str ]
{ @ { } \l__nicematrix_hpos_block_str @ { } }
}
#5
@@ -7113,7 +7223,7 @@
}
}
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_box_of_block:
- \int_compare:nNnT { #2 } = 1
+ \int_compare:nNnT { #2 } = \c_one_int
{
\dim_gset:Nn \g__nicematrix_blocks_wd_dim
{
@@ -7125,9 +7235,9 @@
}
}
}
- \str_if_eq:VnT \l__nicematrix_vpos_of_block_str { c }
+ \str_if_eq:VnT \l__nicematrix_vpos_block_str { c }
{
- \int_compare:nNnT { #1 } = 1
+ \int_compare:nNnT { #1 } = \c_one_int
{
\dim_gset:Nn \g__nicematrix_blocks_ht_dim
{
@@ -7179,7 +7289,7 @@
\bool_if:NTF \g__nicematrix_rotate_c_bool
{ c }
{
- \str_case:VnF \l__nicematrix_vpos_of_block_str
+ \str_case:onF \l__nicematrix_vpos_block_str
{ b l B l t r T r }
{ \int_compare:nNnTF \c at iRow = \l__nicematrix_last_row_int r l }
}
@@ -7226,16 +7336,14 @@
\bool_if:NTF \l__nicematrix_tabular_bool
{
\group_begin:
- \bool_if:NF \l__nicematrix_respect_arraystretch_bool
- { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+ \__nicematrix_reset_arraystretch:
\exp_not:n
{
\dim_zero:N \extrarowheight
#4
- % \__nicematrix_adjust_hpos_rotate:
\use:e
{
- \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_of_block_str ]
+ \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_block_str ]
{ @ { } \l__nicematrix_hpos_block_str @ { } }
}
#5
@@ -7245,17 +7353,15 @@
}
{
\group_begin:
- \bool_if:NF \l__nicematrix_respect_arraystretch_bool
- { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+ \__nicematrix_reset_arraystretch:
\exp_not:n
{
\dim_zero:N \extrarowheight
#4
- % \__nicematrix_adjust_hpos_rotate:
- \c_math_toggle_token % :n c
+ \c_math_toggle_token
\use:e
{
- \exp_not:N \begin { array } [ \l__nicematrix_vpos_of_block_str ]
+ \exp_not:N \begin { array } [ \l__nicematrix_vpos_block_str ]
{ @ { } \l__nicematrix_hpos_block_str @ { } }
}
#5
@@ -7314,16 +7420,18 @@
\bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool ,
C .code:n = \str_set:Nn \l__nicematrix_hpos_block_str c
\bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool ,
- t .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str t ,
- T .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str T ,
- b .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str b ,
- B .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str B ,
- v-center .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str { c } ,
+ t .code:n = \str_set:Nn \l__nicematrix_vpos_block_str t ,
+ T .code:n = \str_set:Nn \l__nicematrix_vpos_block_str T ,
+ b .code:n = \str_set:Nn \l__nicematrix_vpos_block_str b ,
+ B .code:n = \str_set:Nn \l__nicematrix_vpos_block_str B ,
+ v-center .code:n = \str_set:Nn \l__nicematrix_vpos_block_str { c } ,
v-center .value_forbidden:n = true ,
name .tl_set:N = \l__nicematrix_block_name_str ,
name .value_required:n = true ,
name .initial:n = ,
- respect-arraystretch .bool_set:N = \l__nicematrix_respect_arraystretch_bool ,
+ respect-arraystretch .code:n =
+ \cs_set_eq:NN \__nicematrix_reset_arraystretch: \prg_do_nothing: ,
+ respect-arraystretch .value_forbidden:n = true ,
transparent .bool_set:N = \l__nicematrix_transparent_bool ,
transparent .default:n = true ,
transparent .initial:n = false ,
@@ -7348,11 +7456,8 @@
{
\bool_lazy_and:nnTF
\l__nicematrix_preamble_bool
+ { \int_compare_p:nNnF \l__nicematrix_last_col_int > \g__nicematrix_static_num_of_col_int }
{
- \int_compare_p:n
- { \l__nicematrix_last_col_int <= \g__nicematrix_static_num_of_col_int }
- }
- {
\msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 }
\__nicematrix_msg_redirect_name:nn { Block~too~large~2 } { none }
\__nicematrix_msg_redirect_name:nn { columns~not~used } { none }
@@ -7369,7 +7474,7 @@
{
\group_begin:
\int_compare:nNnT { #1 } = { #3 }
- { \str_set:Nn \l__nicematrix_vpos_of_block_str { t } }
+ { \str_set:Nn \l__nicematrix_vpos_block_str { t } }
\keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
\bool_if:NT \l__nicematrix_vlines_block_bool
{
@@ -7391,19 +7496,19 @@
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
}
- \bool_if:nF
+ \bool_if:NF \l__nicematrix_transparent_bool
{
- \l__nicematrix_transparent_bool
- || ( \l__nicematrix_vlines_block_bool && \l__nicematrix_hlines_block_bool )
+ \bool_lazy_and:nnF \l__nicematrix_vlines_block_bool \l__nicematrix_hlines_block_bool
+ {
+ \seq_gput_left:Nx \g__nicematrix_pos_of_blocks_seq
+ { { #1 } { #2 } { #3 } { #4 } { \l__nicematrix_block_name_str } }
+ }
}
+ \tl_if_empty:NF \l__nicematrix_draw_tl
{
- \seq_gput_left:Nx \g__nicematrix_pos_of_blocks_seq
- { { #1 } { #2 } { #3 } { #4 } { \l__nicematrix_block_name_str } }
+ \bool_lazy_or:nnT \l__nicematrix_hlines_block_bool \l__nicematrix_vlines_block_bool
+ { \__nicematrix_error:n { hlines~with~color } }
}
- \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
@@ -7435,7 +7540,7 @@
\tl_set:Nx \l__nicematrix_fill_tl
{
[ opacity = \l__nicematrix_opacity_tl ,
- \tl_tail:V \l__nicematrix_fill_tl
+ \tl_tail:o \l__nicematrix_fill_tl
}
}
{
@@ -7446,7 +7551,7 @@
\tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
\exp_not:N \roundedrectanglecolor
- \exp_args:NV \tl_if_head_eq_meaning:nNTF \l__nicematrix_fill_tl [
+ \exp_args:No \tl_if_head_eq_meaning:nNTF \l__nicematrix_fill_tl [
{ \l__nicematrix_fill_tl }
{ { \l__nicematrix_fill_tl } }
{ #1 - #2 }
@@ -7566,23 +7671,23 @@
}
\bool_lazy_any:nTF
{
- { \str_if_eq_p:Vn \l__nicematrix_vpos_of_block_str { c } }
- { \str_if_eq_p:Vn \l__nicematrix_vpos_of_block_str { T } }
- { \str_if_eq_p:Vn \l__nicematrix_vpos_of_block_str { B } }
+ { \str_if_eq_p:on \l__nicematrix_vpos_block_str { c } }
+ { \str_if_eq_p:on \l__nicematrix_vpos_block_str { T } }
+ { \str_if_eq_p:on \l__nicematrix_vpos_block_str { B } }
}
{
- \int_if_zero:nT { #2 } { \str_set:Nn \l__nicematrix_hpos_block_str r }
+ \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:Nn \l__nicematrix_hpos_block_str l }
+ { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_l_str }
}
\tl_set:Nx \l_tmpa_tl
{
- \str_case:Vn \l__nicematrix_vpos_of_block_str
+ \str_case:on \l__nicematrix_vpos_block_str
{
c {
- \str_case:Vn \l__nicematrix_hpos_block_str
+ \str_case:on \l__nicematrix_hpos_block_str
{
c { center }
l { west }
@@ -7591,7 +7696,7 @@
}
T {
- \str_case:Vn \l__nicematrix_hpos_block_str
+ \str_case:on \l__nicematrix_hpos_block_str
{
c { north }
l { north~west }
@@ -7600,7 +7705,7 @@
}
B {
- \str_case:Vn \l__nicematrix_hpos_block_str
+ \str_case:on \l__nicematrix_hpos_block_str
{
c { south}
l { south~west }
@@ -7622,7 +7727,7 @@
\pgfset
{
inner~xsep = \c_zero_dim ,
- inner~ysep = \l__nicematrix_block_ysep_dim
+ inner~ysep = \c_zero_dim
}
\pgfnode
{ rectangle }
@@ -7634,7 +7739,7 @@
{
\__nicematrix_qpoint:n
{
- row - \str_if_eq:VnTF \l__nicematrix_vpos_of_block_str { b } { #3 } { #1 }
+ row - \str_if_eq:onTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
- base
}
}
@@ -7645,7 +7750,7 @@
\bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short }
}
{
- \str_case:Vn \l__nicematrix_hpos_block_str
+ \str_case:on \l__nicematrix_hpos_block_str
{
c { center }
l { west }
@@ -7657,7 +7762,7 @@
\pgfnode
{ rectangle }
{
- \str_case:Vn \l__nicematrix_hpos_block_str
+ \str_case:on \l__nicematrix_hpos_block_str
{
c { base }
l { base~west }
@@ -7680,9 +7785,9 @@
\pgf at relevantforpicturesizefalse
\tl_if_empty:NF \l__nicematrix_draw_tl
{
- \str_if_eq:VnTF \l__nicematrix_draw_tl { default }
+ \tl_if_eq:NNTF \l__nicematrix_draw_tl \c__nicematrix_default_tl
{ \CT at arc@ }
- { \__nicematrix_color:V \l__nicematrix_draw_tl }
+ { \__nicematrix_color:o \l__nicematrix_draw_tl }
}
\pgfsetcornersarced
{
@@ -7691,30 +7796,31 @@
{ \l__nicematrix_rounded_corners_dim }
}
\__nicematrix_cut_on_hyphen:w #2 \q_stop
- \bool_lazy_and:nnT
- { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
- { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
+ \int_compare:nNnF \l_tmpa_tl > \c at iRow
{
- \__nicematrix_qpoint:n { row - \l_tmpa_tl }
- \dim_set_eq:NN \l_tmpb_dim \pgf at y
- \__nicematrix_qpoint:n { col - \l_tmpb_tl }
- \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at x
- \__nicematrix_cut_on_hyphen:w #3 \q_stop
- \int_compare:nNnT \l_tmpa_tl > \c at iRow
- { \tl_set:Nx \l_tmpa_tl { \int_use:N \c at iRow } }
- \int_compare:nNnT \l_tmpb_tl > \c at jCol
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \__nicematrix_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } }
- \dim_set_eq:NN \l_tmpa_dim \pgf at y
- \__nicematrix_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } }
- \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at x
- \pgfsetlinewidth { 1.1 \l__nicematrix_line_width_dim }
- \pgfpathrectanglecorners
- { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim }
- { \pgfpoint \l__nicematrix_tmpd_dim \l_tmpa_dim }
- \dim_compare:nNnTF \l__nicematrix_rounded_corners_dim = \c_zero_dim
- { \pgfusepathqstroke }
- { \pgfusepath { stroke } }
+ \int_compare:nNnF \l_tmpb_tl > \c at jCol
+ {
+ \__nicematrix_qpoint:n { row - \l_tmpa_tl }
+ \dim_set_eq:NN \l_tmpb_dim \pgf at y
+ \__nicematrix_qpoint:n { col - \l_tmpb_tl }
+ \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf at x
+ \__nicematrix_cut_on_hyphen:w #3 \q_stop
+ \int_compare:nNnT \l_tmpa_tl > \c at iRow
+ { \tl_set:No \l_tmpa_tl { \int_use:N \c at iRow } }
+ \int_compare:nNnT \l_tmpb_tl > \c at jCol
+ { \tl_set:No \l_tmpb_tl { \int_use:N \c at jCol } }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } }
+ \dim_set_eq:NN \l_tmpa_dim \pgf at y
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } }
+ \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf at x
+ \pgfsetlinewidth { 1.1 \l__nicematrix_line_width_dim }
+ \pgfpathrectanglecorners
+ { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim }
+ { \pgfpoint \l__nicematrix_tmpd_dim \l_tmpa_dim }
+ \dim_compare:nNnTF \l__nicematrix_rounded_corners_dim = \c_zero_dim
+ { \pgfusepathqstroke }
+ { \pgfusepath { stroke } }
+ }
}
\endpgfpicture
\group_end:
@@ -7949,12 +8055,11 @@
{
\group_begin:
\keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl
- % \bool_set_false:N \l__nicematrix_preamble_bool
\use:e
{
\exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
- { * { #4 } { \exp_not:V \l__nicematrix_columns_type_tl } }
- [ \exp_not:V \l_tmpa_tl ]
+ { * { #4 } { \exp_not:o \l__nicematrix_columns_type_tl } }
+ [ \exp_not:o \l_tmpa_tl ]
}
\int_if_zero:nT \l__nicematrix_first_row_int
{
@@ -8005,7 +8110,7 @@
\tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl \__nicematrix_dotfill_i:
}
\cs_new_protected:Npn \__nicematrix_dotfill_i:
- { \dim_compare:nNnT { \box_wd:N \l__nicematrix_cell_box } = \c_zero_dim \__nicematrix_old_dotfill }
+ { \dim_compare:nNnT { \box_wd:N \l__nicematrix_cell_box } = \c_zero_dim \__nicematrix_old_dotfill }
\cs_new_protected:Npn \__nicematrix_diagbox:nn #1 #2
{
\tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
@@ -8053,7 +8158,7 @@
\pgfnode { rectangle } { south~west }
{
\begin { minipage } { 20 cm }
- \__nicematrix_math_toggle_token: #5 \__nicematrix_math_toggle_token:
+ \__nicematrix_math_toggle: #5 \__nicematrix_math_toggle:
\end { minipage }
}
{ }
@@ -8064,7 +8169,7 @@
{
\begin { minipage } { 20 cm }
\raggedleft
- \__nicematrix_math_toggle_token: #6 \__nicematrix_math_toggle_token:
+ \__nicematrix_math_toggle: #6 \__nicematrix_math_toggle:
\end { minipage }
}
{ }
@@ -8125,7 +8230,7 @@
{
\nullfont
\c_math_toggle_token
- \__nicematrix_color:V \l__nicematrix_delimiters_color_tl
+ \__nicematrix_color:o \l__nicematrix_delimiters_color_tl
\bool_if:nTF { #3 } { \left #1 } { \left . }
\vcenter
{
@@ -8238,9 +8343,9 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \tl_set:Nn \l__nicematrix_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
+ \cs_set_nopar:Npn \l__nicematrix_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
\tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
- \exp_args:NNV \NewDocumentCommand \__nicematrix_SubMatrix \l__nicematrix_argspec_tl
+ \exp_args:NNo \NewDocumentCommand \__nicematrix_SubMatrix \l__nicematrix_argspec_tl
{
\peek_remove_spaces:n
{
@@ -8254,10 +8359,10 @@
{ \__nicematrix_compute_i_j:nnnn #1 #2 }
\cs_new_protected:Npn \__nicematrix_compute_i_j:nnnn #1 #2 #3 #4
{
- \tl_set:Nn \l__nicematrix_first_i_tl { #1 }
- \tl_set:Nn \l__nicematrix_first_j_tl { #2 }
- \tl_set:Nn \l__nicematrix_last_i_tl { #3 }
- \tl_set:Nn \l__nicematrix_last_j_tl { #4 }
+ \cs_set_nopar:Npn \l__nicematrix_first_i_tl { #1 }
+ \cs_set_nopar:Npn \l__nicematrix_first_j_tl { #2 }
+ \cs_set_nopar:Npn \l__nicematrix_last_i_tl { #3 }
+ \cs_set_nopar:Npn \l__nicematrix_last_j_tl { #4 }
\tl_if_eq:NnT \l__nicematrix_first_i_tl { last }
{ \tl_set:NV \l__nicematrix_first_i_tl \c at iRow }
\tl_if_eq:NnT \l__nicematrix_first_j_tl { last }
@@ -8271,9 +8376,8 @@
{
\group_begin:
\__nicematrix_compute_i_j:nn { #2 } { #3 }
- % added 6.19b
\int_compare:nNnT \l__nicematrix_first_i_tl = \l__nicematrix_last_i_tl
- { \cs_set:Npn \arraystretch { 1 } }
+ { \cs_set_nopar:Npn \arraystretch { 1 } }
\bool_lazy_or:nnTF
{ \int_compare_p:nNn \l__nicematrix_last_i_tl > \g__nicematrix_row_total_int }
{ \int_compare_p:nNn \l__nicematrix_last_j_tl > \g__nicematrix_col_total_int }
@@ -8357,7 +8461,7 @@
\dim_zero:N \nulldelimiterspace
\group_begin:
\pgfsetlinewidth { 1.1 \arrayrulewidth }
- \__nicematrix_set_CT at arc@:V \l__nicematrix_rules_color_tl
+ \__nicematrix_set_CT at arc@:o \l__nicematrix_rules_color_tl
\CT at arc@
\seq_map_inline:Nn \g__nicematrix_cols_vlism_seq
{
@@ -8373,12 +8477,12 @@
}
}
}
- \tl_if_eq:NnTF \l__nicematrix_submatrix_vlines_clist { all }
+ \tl_if_eq:NNTF \l__nicematrix_submatrix_vlines_clist \c__nicematrix_all_tl
{ \int_step_inline:nn { \l__nicematrix_last_j_tl - \l__nicematrix_first_j_tl } }
{ \clist_map_inline:Nn \l__nicematrix_submatrix_vlines_clist }
{
\bool_lazy_and:nnTF
- { \int_compare_p:nNn { ##1 } > 0 }
+ { \int_compare_p:nNn { ##1 } > \c_zero_int }
{
\int_compare_p:nNn
{ ##1 } < { \l__nicematrix_last_j_tl - \l__nicematrix_first_j_tl + 1 } }
@@ -8390,12 +8494,12 @@
}
{ \__nicematrix_error:nnn { Wrong~line~in~SubMatrix } { vertical } { ##1 } }
}
- \tl_if_eq:NnTF \l__nicematrix_submatrix_hlines_clist { all }
+ \tl_if_eq:NNTF \l__nicematrix_submatrix_hlines_clist \c__nicematrix_all_tl
{ \int_step_inline:nn { \l__nicematrix_last_i_tl - \l__nicematrix_first_i_tl } }
{ \clist_map_inline:Nn \l__nicematrix_submatrix_hlines_clist }
{
\bool_lazy_and:nnTF
- { \int_compare_p:nNn { ##1 } > 0 }
+ { \int_compare_p:nNn { ##1 } > \c_zero_int }
{
\int_compare_p:nNn
{ ##1 } < { \l__nicematrix_last_i_tl - \l__nicematrix_first_i_tl + 1 } }
@@ -8509,7 +8613,7 @@
{
\nullfont
\c_math_toggle_token
- \__nicematrix_color:V \l__nicematrix_delimiters_color_tl
+ \__nicematrix_color:o \l__nicematrix_delimiters_color_tl
\left #1
\vcenter
{
@@ -8532,7 +8636,7 @@
{
\nullfont
\c_math_toggle_token
- \__nicematrix_color:V \l__nicematrix_delimiters_color_tl
+ \__nicematrix_color:o \l__nicematrix_delimiters_color_tl
\left .
\vcenter
{
@@ -8655,7 +8759,7 @@
{ rectangle }
{ south }
{
- \vbox_top:n
+ \vtop
{
\group_begin:
\everycr { }
@@ -8662,7 +8766,7 @@
\halign
{
\hfil ## \hfil \crcr
- \__nicematrix_math_toggle_token: #1 \__nicematrix_math_toggle_token: \cr
+ \__nicematrix_math_toggle: #1 \__nicematrix_math_toggle: \cr
\noalign { \skip_vertical:n { 3 pt } \nointerlineskip }
\c_math_toggle_token
\overbrace
@@ -8695,7 +8799,7 @@
{
\group_begin:
\everycr { }
- \vbox:n
+ \vbox
{
\halign
{
@@ -8710,7 +8814,7 @@
\c_math_toggle_token
\cr
\noalign { \skip_vertical:n { 3 pt } \nointerlineskip }
- \__nicematrix_math_toggle_token: #1 \__nicematrix_math_toggle_token: \cr
+ \__nicematrix_math_toggle: #1 \__nicematrix_math_toggle: \cr
}
}
\group_end:
@@ -9068,7 +9172,7 @@
{ \tl_to_str:n { #1 } }
\cs_new_protected:Npn \__nicematrix_error_too_much_cols:
{
- \seq_if_in:NVTF \g__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str
+ \seq_if_in:NoTF \g__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str
{
\int_compare:nNnTF \l__nicematrix_last_col_int = { -2 }
{ \__nicematrix_fatal:n { too~much~cols~for~matrix } }
@@ -9085,7 +9189,7 @@
}
\cs_new:Npn \__nicematrix_message_hdotsfor:
{
- \tl_if_empty:VF \g__nicematrix_HVdotsfor_lines_tl
+ \tl_if_empty:oF \g__nicematrix_HVdotsfor_lines_tl
{ ~Maybe~your~use~of~\token_to_str:N \Hdotsfor\ is~incorrect.}
}
\__nicematrix_msg_new:nn { hvlines,~rounded-corners~and~corners }
More information about the tex-live-commits
mailing list.