texlive[72644] Master/texmf-dist: nicematrix (24oct24)
commits+karl at tug.org
commits+karl at tug.org
Thu Oct 24 22:02:52 CEST 2024
Revision: 72644
https://tug.org/svn/texlive?view=revision&revision=72644
Author: karl
Date: 2024-10-24 22:02:52 +0200 (Thu, 24 Oct 2024)
Log Message:
-----------
nicematrix (24oct24)
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 2024-10-24 20:02:39 UTC (rev 72643)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex 2024-10-24 20:02:52 UTC (rev 72644)
@@ -1,5 +1,5 @@
% -*- coding: utf-8 ; -*-
-% Ce fichier doit être compilé avec lualatex uniquement.
+% Ce fichier doit être compilé avec LuaLaTeX uniquement.
\documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by TikZ, loaded by nicematrix)
\usepackage[french]{babel}
\frenchsetup{og = « , fg = »}
@@ -65,7 +65,7 @@
\def\emphase{\bgroup\color{RoyalPurple}\let\next=}
\usepackage{piton}
-\PitonOptions{language = minimal, detected-commands = {emph,textsl}, splittable = 4}
+\PitonOptions{language = verbatim, detected-commands = {emph,textsl}, splittable = 4}
\SetPitonStyle{ Number = , Comment = }
\ExplSyntaxOn
@@ -92,7 +92,6 @@
{ \end{minipage} }
}
-
\ExplSyntaxOff
@@ -203,7 +202,7 @@
pour être utilisées à la compilation suivante. C'est pourquoi l'utilisation de
\pkg{nicematrix} nécessite \textbf{plusieurs compilations
successives}\footnote{Si vous utilisez Overleaf, Overleaf effectue
- automatiquement un nombre de compilations suffisant.}. L'utilisateur ne doit
+ automatiquement un nombre de compilations suffisant (en utilisant |latexmk|).}. L'utilisateur ne doit
pas utiliser la commande |\nofiles| (qui bloque l'écriture du fichier |aux|).
\medskip
@@ -316,12 +315,12 @@
\medskip
En s'inspirant de l'extension \pkg{cellspace} qui traite de ce problème,
-l'extension \pkg{nicematrix} propose deux clés |cell-space-top-limit| et
-|cell-space-bottom-limit| qui sont similaires aux deux paramètres
+l'extension \pkg{nicematrix} propose deux clés \Definition{cell-space-top-limit}
+et \Definition{cell-space-bottom-limit} qui sont similaires aux deux paramètres
|\cellspacetoplimit| et |\cellspacebottomlimit| proposés par \pkg{cellspace}.\index{cellspace@\pkg{cellspace} (extension)}
-Il existe aussi une clé |cell-space-limits| pour régler simultanément les deux
-paramètres.
+Il existe aussi une clé \Definition{cell-space-limits} pour régler simultanément
+les deux paramètres.
La valeur initiale de ces paramètres est $0$~pt pour que les environnements de
\pkg{nicematrix} aient par défaut le même comportement que ceux de \pkg{array}
@@ -362,10 +361,10 @@
\index{baseline (clé pour un environnement)}
-L'extension \pkg{nicematrix} propose une option |baseline| pour la position
-verticale des tableaux. Cette option |baseline| prend comme valeur un entier qui
-indique le numéro de rangée dont la ligne de base servira de ligne de base pour
-le tableau.
+L'extension \pkg{nicematrix} propose une option \Definition{baseline} pour la
+position verticale des tableaux. Cette option |baseline| prend comme valeur un
+entier qui indique le numéro de rangée dont la ligne de base servira de ligne de
+base pour le tableau.
\medskip
\begin{Code}[width=9cm]
@@ -505,7 +504,7 @@
Dans les environnements de \pkg{nicematrix}, on peut utiliser la commande
-|\Block| pour placer un élément au centre d'un rectangle de cases
+\DefinitionCommande{Block} pour placer un élément au centre d'un rectangle de cases
fusionnées.\footnote{Les espaces situés après une commande |\Block| sont supprimés.}
La commande |\Block| doit être utilisée dans la case supérieure gauche du bloc
@@ -946,12 +945,14 @@
\colorbox{yellow!50}{\bfseries Nouveau 6.28}\par\nobreak
\smallskip
-La commande |\Block| accepte aussi la clé |p|. Avec cette clé, le contenu du
-bloc est composé comme un paragraphe (de manière similaire à une colonne
-standard de type |p|). Cette clé peut s'utiliser en conjonction avec les clés
-|l|, |c| ou |r| et, alors, le paragraphe est composé avec |\raggedright|,
-|\centering| ou |\raggedleft|. Avec la clé |j|, le paragraphe est composé de
-manière justifiée.
+La commande |\Block| accepte aussi les clés |p| et |j|. Avec la clé
+\Definition{p}, le contenu du bloc est composé comme un paragraphe (de manière
+similaire à une colonne standard de type |p|). Cette clé peut s'utiliser en
+conjonction avec les clés |l|, |c| ou |r| et, alors, le paragraphe est composé
+avec |\raggedright|, |\centering| ou |\raggedleft| (et les commandes
+|\RaggedRight|, |\Centering| et |\RaggedLeft| dans le cas où l'extension
+\pkg{ragged2e} est chargée). Avec la clé \Definition{j},
+le paragraphe est composé de manière justifiée.
\subsection{Positionnement vertical du contenu des blocs}
@@ -965,7 +966,8 @@
\begin{itemize}
\item \index{v-center (clé de \texttt{\textbackslash Block)})}
-Avec la clé \Definition{m}\footnote{Cette clé a un alias : |v-center|.}, le contenu du bloc est centré verticalement.
+Avec la clé \Definition{m}\footnote{Cette clé a un alias : |v-center|.}, le
+contenu du bloc est centré verticalement.
\item Avec la clé \Definition{t}, la ligne de base du contenu du bloc est alignée avec la
ligne de base de la première rangée concernée par le bloc.
@@ -1100,7 +1102,7 @@
\item Pour |\\|, il n'y a pas d'autres restrictions. On peut utiliser
|\\| dans un bloc pour composer du texte sur plusieurs lignes.
-\item Pour pouvoir utiliser |&|, la clé |ampersand-in-blocks| (alias:
+\item Pour pouvoir utiliser |&|, la clé \Definition{ampersand-in-blocks} (alias:
|&-in-blocks|) doit avoir été activée\footnote{Si ce n'est pas le cas,
l'utilisation de |&| dans l'argument principal de la commande |\Block|
provoquera une erreur : |! Extra alignment tab has been changed to \cr| de
@@ -1119,11 +1121,11 @@
\medskip
\begin{Code}[width=85mm]
\begin{NiceTabular}{ll}%
- [hvlines,ampersand-in-blocks]
+ [hvlines,\emph{ampersand-in-blocks}]
& les cinq premiers entiers naturels \\
-3 & \Block{un&deux&trois} \\
-4 & \Block{un&deux&trois& quatre} \\
-5 & \Block{un&deux&trois&quatre&cinq} \\
+3 & \Block{}{un&deux&trois} \\
+4 & \Block{}{un&deux&trois& quatre} \\
+5 & \Block{}{un&deux&trois&quatre&cinq} \\
\end{NiceTabular}
\end{Code}
%
@@ -1143,7 +1145,7 @@
\medskip
\begin{Code}[width=85mm]
\begin{NiceTabular}{lccccc}%
- [hvlines,ampersand-in-blocks]
+ [hvlines,\emph{ampersand-in-blocks}]
& \Block{1-5}{les cinq premiers
entiers naturels} \\
3 & \Block{1-5}{un & deux & trois} \\
@@ -1286,7 +1288,7 @@
\index{standard-cline}
Dans les environnements de \pkg{nicematrix}, cette situation est corrigée (il
est néanmoins possible de revenir au comportement par défaut de |\cline| avec la
-clé |standard-cline|).
+clé \Definition{standard-cline}).
\medskip
\begin{Code}[width=10cm]
@@ -1320,10 +1322,10 @@
\index{width!sous-clé de «rules»}
\index{rules (clé pour un environnement)}
-Les environnements de \pkg{nicematrix} proposent une clé |rules/width| pour
-fixer la largeur (on devrait plutôt dire l'épaisseur) des filets dans
-l'environnement. En fait, cette clé ne fait que fixer la valeur du paramètre
-dimensionnel de LaTeX |\arrayrulewidth|.
+Les environnements de \pkg{nicematrix} proposent une clé
+\Definition{rules/width} pour fixer la largeur (on devrait plutôt dire
+l'épaisseur) des filets dans l'environnement. En fait, cette clé ne fait que
+fixer la valeur du paramètre dimensionnel de LaTeX |\arrayrulewidth|.
\smallskip
On sait que \pkg{colortbl} propose la commande |\arrayrulecolor| pour spécifier
@@ -1334,7 +1336,7 @@
Avec \pkg{nicematrix}, il est possible de spécifier une couleur même si
\pkg{colortbl} n'est pas chargé. Par souci de compatibilité, la commande est
nommée également |\arrayrulecolor|. Néanmoins, \pkg{nicematrix} propose aussi
-une clé |rules/color|, disponible dans |\NiceMatrixOptions| ou dans un
+une clé \Definition{rules/color}, disponible dans |\NiceMatrixOptions| ou dans un
environnement individuel, pour fixer la couleur des filets. Cette clé fixe
localement la couleur des filets (alors que la commande |\arrayrulecolor| agit
globalement !). Elle est à privilégier.
@@ -1444,10 +1446,11 @@
\index{vlines!clé pour un environnement}
\medskip
-Les clés |hlines| et |vlines| (qui, bien sûr, tracent des filets horizontaux et
-verticaux) prennent comme valeur une liste de numéros qui sont les numéros des
-filets\footnote{Il est également possible de mettre dans la liste des
- intervalles de numéros de la forme $i$|-|$j$.} à tracer. Si aucune valeur n'est donnée, tous les filets sont tracés.
+Les clés \Definition{hlines} et \Definition{vlines} (qui, bien sûr, tracent des
+filets horizontaux et verticaux) prennent comme valeur une liste de numéros qui
+sont les numéros des filets\footnote{Il est également possible de mettre dans la
+ liste des intervalles de numéros de la forme $i$|-|$j$.} à tracer. Si aucune
+valeur n'est donnée, tous les filets sont tracés.
En fait, pour les environnements avec délimiteurs (comme |{pNiceMatrix}| ou
|{bNiceArray}|), la clé |vlines| ne trace pas les filets extérieurs (ce qui est
@@ -1497,8 +1500,8 @@
\index{hvlines!clé pour un environnement}
\index{hvlines-except-borders}
-La clé |hvlines|, qui ne prend pas de valeur, est la conjonction des clés
-|hlines| et |vlines|.
+La clé \Definition{hvlines}, qui ne prend pas de valeur, est la conjonction des
+clés |hlines| et |vlines|.
\smallskip
\begin{Code}
@@ -1527,10 +1530,10 @@
\medskip
-La clé |hvlines-except-borders| est similaire à la clé |hvlines| mais ne trace
-pas les filets sur les bords horizontaux et verticaux du tableau. Pour un
-exemple d'utilisation de cette clé, voir la partie «Exemple d'utilisation avec
-\pkg{tcolorbox}» p.~\pageref{tcolorbox}.
+La clé \Definition{hvlines-except-borders} est similaire à la clé |hvlines| mais
+ne trace pas les filets sur les bords horizontaux et verticaux du tableau. Pour
+un exemple d'utilisation de cette clé, voir la partie «Exemple d'utilisation
+avec \pkg{tcolorbox}» p.~\pageref{tcolorbox}.
\medskip
@@ -1540,8 +1543,8 @@
\index{Coins (les --- vides)}
\index{corners (clé d'un environnement)}
-Les quatre coins d'un tableau seront notés |NW|, |SW|, |NE| et |SE| (\emph{north west}, \emph{south west}, \emph{north
- east} et \emph{south east} en anglais).
+Les quatre coins d'un tableau seront notés |NW|, |SW|, |NE| et |SE| (\emph{north
+ west}, \emph{south west}, \emph{north east} et \emph{south east} en anglais).
\smallskip
Pour chacun de ces coins, on appellera \emph{coin vide} (ou tout simplement
@@ -1582,12 +1585,12 @@
\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},
- décrite dans la partie \ref{tabular-rounded-corners},
+Quand la clé \Definition{corners}\footnote{La clé \texttt{corners} dont on parle
+ là n'a pas de rapport direct avec la clé \texttt{rounded-corners}, décrite
+ dans la partie \ref{tabular-rounded-corners},
p.~\pageref{tabular-rounded-corners}.} est utilisée, \pkg{nicematrix} calcule
les coins vides et ces coins sont alors pris en compte par les outils de tracés
-de filets (les filets ne seront pas tracés dans ces coins vides).
+de filets (les filets ne seront pas tracés dans ces coins vides).
\medskip
\begin{Code}[width=11cm]
@@ -1656,9 +1659,9 @@
\indexcommand{diagbox}
-La commande |\diagbox| (inspirée par l'extension \pkg{diagbox}) permet, quand
-elle est utilisée dans une case, de couper cette case selon une diagonale
-descendante.
+La commande \DefinitionCommande{diagbox} (inspirée par l'extension
+\pkg{diagbox}) permet, quand elle est utilisée dans une case, de couper cette
+case selon une diagonale descendante.
\medskip
\begin{Code}[width=10cm]
@@ -1682,7 +1685,53 @@
Cette commande |\diagbox| peut aussi être utilisée dans un |\Block|.
+\medskip
+\begin{Code}[width=10cm]
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\emph{\Block{2-2}{\diagbox{x}{y}}} & & a & b & c \\
+ & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+\end{Code}
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\Block{2-2}{\diagbox{x}{y}} & & a & b & c \\
+ & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+
+\medskip
+Mais on peut aussi utiliser |\diagbox| uniquement pour le trait diagonal et
+placer les labels comme habituellement.
+
+\medskip
+\begin{Code}[width=10cm]
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\emph{\Block{2-2}{\diagbox{}{}}} & y & a & b & c \\
+x & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+\end{Code}
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\Block{2-2}{\diagbox{}{}} & y & a & b & c \\
+x & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+
+
+\medskip
+Il est de toutes manières toujours possible de tracer tous les traits souhaités
+avec TikZ dans le |\CodeAfter| (ou le |\CodeBefore|) en utilisant les nœuds
+PGF/TikZ créés par \pkg{nicematrix} : cf. p.~\pageref{PGF-nodes}.
+
\subsubsection{Commandes pour filets personnalisés}
\label{custom-line}
\index{command (clé de «custom-line»)}
@@ -1691,11 +1740,11 @@
\index{custom-line|(}
-Il est possible de définir des commandes et des lettres pour des filets
-personnalisés avec la clé |custom-line|, utilisable dans |\NiceMatrixOptions| ou
-bien dans un environnement. Cette clé prend en argument une liste de paires de
-la forme \textsl{clé=valeur}. Il y a d'abord trois clés pour spécifier les outils
-qui permettront d'utiliser ce nouveau type de filet.
+Il est en fait possible de définir des commandes et des lettres pour des filets
+personnalisés avec la clé \Definition{custom-line}, utilisable dans
+|\NiceMatrixOptions| ou bien dans un environnement. Cette clé prend en argument
+une liste de paires de la forme \textsl{clé=valeur}. Il y a d'abord trois clés
+pour spécifier les outils qui permettront d'utiliser ce nouveau type de filet.
\begin{itemize}
\item la clé \Definition{command} indique le nom (sans la contre-oblique) d'une commande
@@ -1841,9 +1890,10 @@
Par défaut, aucune réservation de place n'est faite pour le filet qui sera tracé
avec TikZ. On peut demander une réservation (horizontale pour un filet vertical
-et verticale pour un filet horizontal) avec la clé |total-width| qui est donc en
-quelque sorte la largeur du filet qui sera tracé (cette largeur n'est \emph{pas}
-calculée à partir des caractéristiques fournies par la clé |tikz|).
+et verticale pour un filet horizontal) avec la clé \Definition{total-width} qui
+est donc en quelque sorte la largeur du filet qui sera tracé (cette largeur
+n'est \emph{pas} calculée à partir des caractéristiques fournies par la clé
+|tikz|).
\bigskip
Voici ce que l'on obtient avec la clé |dotted| de TikZ.
@@ -1901,8 +1951,8 @@
p.~\pageref{Cdots}).
\medskip
-L'extension \pkg{nicematrix} prédéfinit en fait les commandes \Definition{hdottedline} et
-\Definition{cdottedline} et la lettre «|:|» pour ces filets en pointillés.\footnote{Néanmoins, l'utilisateur peut écraser ces définitions de
+L'extension \pkg{nicematrix} prédéfinit en fait les commandes \DefinitionCommande{hdottedline} et
+\DefinitionCommande{cdottedline} et la lettre «|:|» pour ces filets en pointillés.\footnote{Néanmoins, l'utilisateur peut écraser ces définitions de
|\hdottedline|, |\cdottedline| et de «|:|» avec |custom-line| s'il le souhaite
(par exemple pour les remplacer par des lignes en tiretés).}
@@ -1965,9 +2015,6 @@
\end{itemize}
-
-
-
\index{custom-line|)}
\index{Filets@\textbf{Filets dans les tableaux}|)}
@@ -2028,7 +2075,7 @@
formats PostScript et \textsc{pdf} et convient donc mieux aux lecteurs de
\textsc{pdf}. L'inconvénient est qu'elle nécessite plusieurs compilations
successives.\footnote{Si vous utilisez Overleaf, Overleaf effectue
- automatiquement un nombre de compilations suffisant.}
+ automatiquement un nombre de compilations suffisant (en utilisant |latexmk|).}
\medskip
L'extension \pkg{nicematrix} fournit une clé |code-before| pour du code qui sera
@@ -2613,10 +2660,10 @@
On peut accéder aux outils de coloriage précédents avec une syntaxe proche de
celle proposée par \pkg{colortbl} (même si \pkg{colortbl} n'est pas chargé). On
-doit pour cela utiliser la clé |color-inside|\footnote{Il existe un alias pour
- cette clé : \texttt{colortbl-like}.} dans l'environnement
+doit pour cela utiliser la clé \Definition{color-inside}\footnote{Il existe un
+ alias pour cette clé : \texttt{colortbl-like}.} dans l'environnement
concerné.\footnote{Pour le moment, cette clé n'est \emph{pas} disponible dans
- |\NiceMatrixOptions|.}o
+ |\NiceMatrixOptions|.}
On a alors accès aux commandes suivantes (les trois premières sont inspirées par
\pkg{colortbl} mais sont indépendantes de \pkg{colortbl}) :
@@ -2739,8 +2786,9 @@
\index{cell-space-limits}
-La commande |\RowStyle| prend en argument des instructions de mise en forme qui
-seront appliquées à chacune des cases restantes sur la rangée en cours.
+La commande \DefinitionCommande{RowStyle} prend en argument des instructions de
+mise en forme qui seront appliquées à chacune des cases restantes sur la rangée
+en cours.
\medskip
Elle prend aussi en premier argument optionnel, entre crochets, une liste de
@@ -2823,7 +2871,7 @@
Dans les environnements de \pkg{nicematrix}, il est aussi possible de fixer la
largeur \emph{minimale} de toutes les colonnes (à l'exception des éventuelles
colonnes extérieures: cf. p.~\pageref{exterior}) directement avec l'option
-|columns-width|.
+\Definition{columns-width}.
\medskip
\begin{Code}[width=10cm]
@@ -2946,8 +2994,8 @@
celles proposées par l'environnement |{tabularx}| de l'extension éponyme.
La valeur requise par la largeur du tableau peut être passée en argument de la
-clé |width| (dans |{NiceTabular}| ou dans |\NiceMatrixOptions|). La valeur
-initiale de ce paramètre est |\linewidth| (et non |\textwidth|).
+clé \Definition{width} (dans |{NiceTabular}| ou dans |\NiceMatrixOptions|). La
+valeur initiale de ce paramètre est |\linewidth| (et non |\textwidth|).
Pour se rapprocher davantage de l'environnement |{tabularx}|, \pkg{nicematrix}
propose aussi un environnement |{NiceTabularX}| avec une syntaxe similaire à
@@ -2967,7 +3015,9 @@
\pkg{nicematrix}. Si une telle valeur est utilisée, une erreur sera levée.}
\item On peut spécifier l'alignement horizontal avec une des lettres |l|, |c| et
|r| (qui insèrent respectivement |\raggedright|, |\centering| et |\raggedleft|
-suivi de |\arraybackslash|).
+suivi de |\arraybackslash|).\footnote{En fait, quand \pkg{ragged2e} est chargée,
+ce sont les commandes |\RaggedRight|, |\Centering| et |\RaggedLeft| de
+\pkg{ragged2e} qui sont utilisées, pour un meilleur résultat.}
\item On peut spécifier l'alignement vertical avec l'une des lettres |t| (alias
|p|), |m| et |b| (qui construisent respectivement des colonnes de types |p|, |m|
et |b|). La valeur par défaut est |t|.
@@ -3096,8 +3146,9 @@
\index{last-col}
Les environnements de \pkg{nicematrix} permettent de composer des rangées et des
-colonnes «extérieures» grâce aux options |first-row|, |last-row|, |first-col| et
-|last-col|. C'est particulièrement intéressant pour les matrices (mathématiques).
+colonnes «extérieures» grâce aux options \Definition{first-row},
+\Definition{last-row}, \Definition{first-col} et \Definition{last-col}. C'est
+particulièrement intéressant pour les matrices (mathématiques).
\label{exterior}
Si elle est présente, la «première rangée» (extérieure) est numérotée par $0$
@@ -3172,10 +3223,12 @@
\index{code-for-first-col}
\index{code-for-last-row}
\index{code-for-last-col}
+
On peut contrôler l'apparence de ces rangées et colonnes avec les options
-|code-for-first-row|, |code-for-last-row|, |code-for-first-col| et
-|code-for-last-col|. Ces options sont des listes de tokens qui seront insérées
-au début de chaque case de la rangée ou de la colonne considérée.
+\Definition{code-for-first-row}, \Definition{code-for-last-row},
+\Definition{code-for-first-col} et \Definition{code-for-last-col}. Ces options
+sont des listes de tokens qui seront insérées au début de chaque case de la
+rangée ou de la colonne considérée.
\begin{Code}
\NiceMatrixOptions{\emph{code-for-first-row} = \color{red},
@@ -3251,7 +3304,9 @@
\index{xdots (et ses sous-clés)}
À l'intérieur des environnements de l'extension \pkg{nicematrix}, de nouvelles
-commandes sont définies : |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots| et |\Iddots|.
+commandes sont définies : \DefinitionCommande{Ldots},
+\DefinitionCommande{Cdots}, \DefinitionCommande{Vdots},
+\DefinitionCommande{Ddots} et \DefinitionCommande{Iddots}.
Ces commandes sont conçues pour être utilisées à la place de |\dots|, |\cdots|,
|\vdots|, |\ddots| et |\iddots|.\footnote{La commande |\iddots|, définie par
\pkg{nicematrix}, est une variante de |\ddots| avec les points allant vers le
@@ -3440,8 +3495,8 @@
\medskip
On pourrait toutefois préférer la géométrie de la première matrice $A$ et
vouloir avoir la même géométrie avec une ligne en pointillés continue dans la
-seconde rangée. C'est possible en utilisant l'option |nullify-dots| (et une
-seule instruction |\Ldots| suffit).\par\nobreak
+seconde rangée. C'est possible en utilisant l'option \Definition{nullify-dots}
+(et une seule instruction |\Ldots| suffit).\par\nobreak
\medskip
\begin{Code}[width=10cm]
@@ -3472,8 +3527,8 @@
Certaines personnes utilisent habituellement la commande |\hdotsfor| de
l'extension \pkg{amsmath} pour tracer des lignes en pointillés horizontales dans
une matrice. Dans les environnements de \pkg{nicematrix}, il convient d'utiliser
-|\Hdotsfor| à la place pour avoir les lignes en pointillés similaires à toutes
-celles tracées par l'extension \pkg{nicematrix}.
+\DefinitionCommande{Hdotsfor} à la place pour avoir les lignes en pointillés
+similaires à toutes celles tracées par l'extension \pkg{nicematrix}.
Comme avec les autres commandes de \pkg{nicematrix} (comme |\Cdots|, |\Ldots|,
|\Vdots|, etc.), la ligne en pointillés tracée par |\Hdotsfor| s'étend jusqu'au
@@ -3526,8 +3581,9 @@
les outils de nicematrix pour le coloriage des tableaux.
\medskip
-L'extension \pkg{nicematrix} propose aussi une commande |\Vdotsfor| similaire à
-|\Hdotsfor| mais traçant des lignes verticales.
+L'extension \pkg{nicematrix} propose aussi une commande
+\DefinitionCommande{Vdotsfor} similaire à |\Hdotsfor| mais traçant des lignes
+verticales.
\medskip
L'exemple suivant utilise à la fois |\Hdotsfor| et |\Vdotsfor|:
@@ -3584,7 +3640,7 @@
\smallskip
\begin{itemize}
-\item L'option |renew-dots|\par\nobreak
+\item L'option \Definition{renew-dots}\par\nobreak
Avec cette option, les commandes |\ldots|, |\cdots|, |\vdots|, |\ddots|,
|\iddots|\footnotemark[\thefniddots] et |\hdotsfor| sont redéfinies dans les
@@ -3593,7 +3649,7 @@
suspension «automatiques» de |amsmath|) est aussi redéfinie et se comporte comme
|\Ldots|.
-\item L'option |renew-matrix|\par\nobreak
+\item L'option \Definition{renew-matrix}\par\nobreak
Avec cette option, l'environnement |{matrix}| est redéfini et se comporte comme
|{NiceMatrix}| et il en est de même pour les cinq variantes.
@@ -3656,7 +3712,8 @@
\bigskip
-Avec la clé |xdots/horizontal-labels|, les labels restent horizontaux.\par\nobreak
+Avec la clé \Definition{xdots/horizontal-labels}, les labels restent
+horizontaux.\par\nobreak
\smallskip
\begin{Code}[width=10cm]
@@ -3723,9 +3780,10 @@
\medskip
L'option \Definition{xdots/color} indique bien entendu la couleur de la ligne
-tracée. On remarquera néanmoins que les lignes tracées dans les rangées et
-colonnes extérieures (décrites plus loin) bénéficient d'un régime spécial : cf.
-p.~\pageref{exterior}.
+tracée. On peut définir une couleur «à la volée»
+(ex. : |xdots/color = { [RGB]{204,204,255} }|). On remarquera que les
+lignes tracées dans les rangées et colonnes extérieures (décrites plus loin)
+bénéficient d'un régime spécial : cf. p.~\pageref{exterior}.
\medskip
L'option \Definition{radius} correspond au rayon des points circulaires qui sont
@@ -3760,7 +3818,7 @@
ligne de points ronds doit être construite explicitement point par point. Voir
néanmoins à l'adresse suivante pour un moyen d'avoir un style de pointillés
ronds avec TikZ :\newline \small
-\url{https://tex.stackexchange.com/questions/52848/tikz-line-with-large-dots}}
+\url{https://tex.stackexchange.com/questions/52848}}
\begin{Code}[width=9cm]
@@ -3949,19 +4007,20 @@
\label{code-after}
On a présenté p.~\pageref{code-before} la clé |code-before|. Il existe en fait
-une clé similaire |code-after| qui peut être utilisée pour indiquer du code qui
-sera exécuté \emph{après} la construction du tableau.
+une clé similaire \Definition{code-after} qui peut être utilisée pour indiquer
+du code qui sera exécuté \emph{après} la construction du tableau.
\medskip
\index{sub-matrix (clé de \texttt{\textbackslash CodeAfter}, avec sous-clés)}
Pour améliorer la lisibilité du code, une syntaxe alternative est proposée : on
peut spécifier les instructions du |code-after| à la fin de l'environnement,
-après le mot-clé |\CodeAfter|. Bien que ce soit un mot-clé, |\CodeAfter| accepte
-quand même un argument optionnel (entre crochets).\footnote{Les clés autorisées
- dans cet argument optionnel sont les suivantes : |delimiters/color|, |rules|
- et ses sous-clés, |sub-matrix| (en lien avec la commande
- |\SubMatrix|) et ses sous-clés et |xdots| (pour la commande |\line|) et ses
- sous-clés.}
+après le mot-clé \DefinitionCommande{CodeAfter} (la clé |code-after| reste bien
+sûr obligatoire dans |\AutoNiceMatrix| et les commandes similaires). Bien que ce
+soit un mot-clé, |\CodeAfter| accepte quand même un argument optionnel (entre
+crochets).\footnote{Les clés autorisées dans cet argument optionnel sont les
+ suivantes : |delimiters/color|, |rules| et ses sous-clés, |sub-matrix| (en
+ lien avec la commande |\SubMatrix|) et ses sous-clés et |xdots| (pour la
+ commande |\line|) et ses sous-clés.}
\medskip
@@ -3974,14 +4033,17 @@
|\CodeAfter| : |\line|, |\SubMatrix|, |\OverBrace|, |\UnderBrace| et
|\TikzEveryCell|. On va maintenant détailler ces commandes.
+\medskip
+On veillera à éviter les espaces parasites dans ce |\CodeAfter|.\footnote{Voir
+ \url{https://tex.stackexchange.com/questions/52848}}
\subsection{La commande \textbackslash line dans le \textbackslash CodeAfter}
\label{line-in-code-after}
\index{line@\texttt{\textbackslash line} (commande du \texttt{\textbackslash CodeAfter})}
-La commande |\line| permet de tracer directement des lignes en pointillés entre
-les cases. Elle prend deux arguments correspondant aux cases ou blocs à relier.
-Chacun de ces deux arguments peut être :
+La commande \DefinitionCommande{line} permet de tracer directement des lignes en
+pointillés entre les cases. Elle prend deux arguments correspondant aux cases ou
+blocs à relier. Chacun de ces deux arguments peut être :
\begin{itemize}
\item une spécification de case de la forme $i$-$j$ où $i$ est le numéro de
ligne et $j$ est le numéro de colonne ;
@@ -4050,9 +4112,9 @@
\texttt{\textbackslash CodeAfter}\newline et du
\texttt{\textbackslash CodeBefore})|textbf}
-La commande |\SubMatrix| permet de positionner des délimiteurs sur une partie du
-tableau, partie qui est considérée comme une sous-matrice. La commande
-|\SubMatrix| prend cinq arguments :
+La commande \DefinitionCommande{SubMatrix} permet de positionner des délimiteurs
+sur une partie du tableau, partie qui est considérée comme une sous-matrice. La
+commande |\SubMatrix| prend cinq arguments :
\begin{itemize}
\item le premier argument est le délimiteur gauche qui peut être n'importe
quel délimiteur extensible de LaTeX : |(|, |[|, |\{|, |\langle|, |\lgroup|,
@@ -4297,10 +4359,10 @@
\emph{Attention} : La fonctionnalité suivante est fragile et ne fonctionne pas
avec |latex|--|dvips|--|ps2pdf|.\par\nobreak
-La clé |code| de la commande |\SubMatrix| permet d'insérer du code après la
-création de la matrice. Elle a surtout pour vocation d'être utilisée pour
-insérer des instructions TikZ, sachant que, dans les instructions TikZ insérées
-dans cette clé, les nœuds de la forme \verb+i-|j+ sont interprétés avec
+La clé \Definition{code} de la commande |\SubMatrix| permet d'insérer du code
+après la création de la matrice. Elle a surtout pour vocation d'être utilisée
+pour insérer des instructions TikZ, sachant que, dans les instructions TikZ
+insérées dans cette clé, les nœuds de la forme \verb+i-|j+ sont interprétés avec
|i| et |j| étant des numéros de ligne et colonne \emph{relatifs à la
sous-matrice}.\footnote{Attention : la syntaxe \texttt{j\string|-i} n'est
\emph{pas} autorisée.}
@@ -4353,8 +4415,9 @@
\texttt{\textbackslash CodeBefore})}
-Les commandes |\OverBrace| and |\UnderBrace| permettent de placer des accolades
-horizontales sur une partie du tableau. Ces commandes prennent trois arguments :
+Les commandes \DefinitionCommande{OverBrace} and \DefinitionCommande{UnderBrace}
+permettent de placer des accolades horizontales sur une partie du tableau. Ces
+commandes prennent trois arguments :
\begin{itemize}
\item le premier argument est le coin supérieur gauche du rectangle de cases
impliquées dans l'accolade avec la syntaxe habituelle $i$|-|$j$ où $i$ est le
@@ -4365,6 +4428,9 @@
\item le troisième argument est le «label» de l'accolade qui sera placé par
\pkg{nicematrix} (avec \textsc{pgf}) au-dessus de l'accolade (pour la commande
|\OverBrace|) ou au-dessous (pour |\UnderBrace|).
+
+\colorbox{yellow!50}{\textbf{Nouveau 2.9}}\enskip Il est possible de mettre des
+commandes |\\| dans ce dernier argument pour fomater le label sur plusieurs lignes.
\end{itemize}
\bigskip
@@ -4443,9 +4509,9 @@
\index{empty (clé de \texttt{\textbackslash TikzEveryCell})}
\index{non empty (clé de \texttt{\textbackslash TikzEveryCell})}
-La commande |\TikzEveryCell| exécute avec TikZ le chemin rectangulaire qui
-correspond à chaque case du tableau, avec comme paramètres TikZ l'argument de
-|\TikzEveryCell|. Cet argument doit être une liste de couples
+La commande \DefinitionCommande{TikzEveryCell} exécute avec TikZ le chemin
+rectangulaire qui correspond à chaque case du tableau, avec comme paramètres
+TikZ l'argument de |\TikzEveryCell|. Cet argument doit être une liste de couples
\textsl{clé=valeur} applicables à un chemin TikZ. En fait, cette commande
s'applique à chaque case du tableau, exceptées celles situées dans les rangées
et colonnes extérieures (cf.~p.~\pageref{exterior}) et celles situées dans les
@@ -4456,11 +4522,11 @@
\medskip
En fait, dans la liste des clés passée en argument on peut mettre une clé
-|offset|. Cette clé n'est pas fournie par TikZ mais par \pkg{nicematrix}. Elle
-réduit le rectangle correspondant au bloc par une marge (horizontalement et
-verticalement) égale à la valeur (passée à |offset|). C'est ce rectangle réduit
-qui sera le chemin exécuté par TikZ avec comme options les autres clés de
-l'argument de |\TikzEveryCell|.
+\Definition{offset}. Cette clé n'est pas fournie par TikZ mais par
+\pkg{nicematrix}. Elle réduit le rectangle correspondant au bloc par une marge
+(horizontalement et verticalement) égale à la valeur (passée à |offset|). C'est
+ce rectangle réduit qui sera le chemin exécuté par TikZ avec comme options les
+autres clés de l'argument de |\TikzEveryCell|.
\medskip
@@ -4495,7 +4561,8 @@
optionnel, entre crochets.
\begin{itemize}
\item avec la clé \Definition{empty}, la commande ne s'applique qu'aux cases
-vides ;
+vides (les cases considérées comme vides sont décrites à la
+partie~\ref{empty-cells}, p.~\pageref{empty-cells}) ;
\item avec la clé \Definition{non-empty}, la commande ne s'applique qu'aux
cases non vides.
\end{itemize}
@@ -4554,9 +4621,10 @@
\index{Legende@\textbf{Légende des tableaux}}
-L'environnement |{NiceTabular}| propose des clés |caption|, |short-caption| et
-|label| à utiliser lorsque le tableau est inséré dans un environnment flottant
-(typiquement un environnement |{table}|).
+L'environnement |{NiceTabular}| propose des clés \Definition{caption},
+\Definition{short-caption} et \Definition{label} à utiliser lorsque le tableau
+est inséré dans un environnment flottant (typiquement un environnement
+|{table}|).
\smallskip
L'intérêt d'utiliser cette clé |caption| plutôt que la commande classique
@@ -4568,7 +4636,7 @@
\smallskip
Par défaut, la légende est placée au-dessous du tableau. Pour avoir la légende
-placée au-dessus, il convient d'utiliser la clé |caption-above| dans
+placée au-dessus, il convient d'utiliser la clé \Definition{caption-above} dans
|\NiceMatrixOptions|.
\smallskip
@@ -4621,12 +4689,13 @@
\label{tabularnote}
\index{tabularnote@\texttt{\textbackslash tabularnote}}
-L'extension \pkg{nicematrix} propose aussi une commande |\tabularnote| qui
-permet de spécifier des notes qui seront composées à la fin du tableau avec une
-longueur de ligne égale à la largeur du tableau (hors éventuelles colonnes
-extérieures spécifiées par |first-col| et |last-col|: cf.~\ref{exterior},
-p.~\pageref{exterior}). Sans surprise, cette commande n'est disponible que dans
-|{NiceTabular}|, |{NiceTabular*}| et |{NiceTabularX}|.
+L'extension \pkg{nicematrix} propose aussi une commande
+\DefinitionCommande{tabularnote} qui permet de spécifier des notes qui seront
+composées à la fin du tableau avec une longueur de ligne égale à la largeur du
+tableau (hors éventuelles colonnes extérieures spécifiées par |first-col| et
+|last-col|: cf.~\ref{exterior}, p.~\pageref{exterior}). Sans surprise, cette
+commande n'est disponible que dans |{NiceTabular}|, |{NiceTabular*}| et
+|{NiceTabularX}|.
\index{enumitem@\pkg{enumitem} (extension requise pour utiliser\newline \texttt{\textbackslash tabularnote})}
@@ -4686,12 +4755,12 @@
ou~|r|, l'appel de note est composé en débordement vers la droite (cela peut
permettre de mieux conserver l'alignement des contenus d'une colonne).
-\item Si la clé |notes/para| est utilisée, les notes sont composées à la fin du
-tableau en un seul paragraphe.
+\item Si la clé \Definition{notes/para} est utilisée, les notes sont composées à
+la fin du tableau en un seul paragraphe.
\item \index{tabularnote (clé de \texttt{\{NiceTabular\}})}
-Il existe une clé |tabularnote| qui permet d'insérer du texte dans la zone
-des notes avant les notes numérotées.
+Il existe une clé \Definition{tabularnote} qui permet d'insérer du texte dans la
+zone des notes avant les notes numérotées.
\index{tabularnote-env@\texttt{\{TabularNote\}}}
\index{notes (clé pour paramétrer les notes de\newline tableau)}
@@ -4701,8 +4770,8 @@
(mais \emph{avant} l'éventuel |\CodeAfter|).
\item Si l'extension \pkg{booktabs} a été chargée (avant ou après
-\pkg{nicematrix}), la clé |notes/bottomrule| permet de faire tracer un
-|\bottomrule| de \pkg{booktabs} \emph{après} les notes.
+\pkg{nicematrix}), la clé \Definition{notes/bottomrule} permet de faire tracer
+un |\bottomrule| de \pkg{booktabs} \emph{après} les notes.
\item Lorsque plusieurs commandes |\tabularnote| sont utilisées avec le même
argument, une seule note est insérée en fin de tableau (mais tous les labels
@@ -4709,7 +4778,7 @@
sont marqués). Il est possible de désactiver cette fonctionnalité avec la clé
|notes/detect-duplicates|.\footnote{Pour des raisons techniques, il n'est pas
autorisé de mettre plusieurs |\tabularnote| avec exactement le même argument
- dans la légende.}
+ dans la légende. Ce n'est pas vraiment contraignant.}
\item Il est possible de référencer une note de tableau (avec la commande
|\label| placée après le |\tabularnote|).
@@ -4840,14 +4909,14 @@
On détaille maintenant ces clés.
\begin{itemize}[itemsep=\medskipamount]
-\item La clé |notes/para| demande la composition des notes en fin de tableau en un seul
-paragraphe.
+\item La clé \Definition{notes/para} demande la composition des notes en fin de
+tableau en un seul paragraphe.
Valeur initiale : |false|
Cette clé est également accessible dans un environnement individuel.
-\item La clé |notes/bottomrule| permet de faire tracer un |\bottomrule| de \pkg{booktabs}
+\item La clé \Definition{notes/bottomrule} permet de faire tracer un |\bottomrule| de \pkg{booktabs}
\emph{après} les notes. Ce trait n'est tracé que s'il y a effectivement des
notes dans le tableau. L'extension \pkg{booktabs} doit avoir été chargée (avant
ou après l'extension \pkg{nicematrix}). Dans le cas contraire, une erreur est générée.
@@ -4856,22 +4925,22 @@
Cette clé est également accessible dans un environnement individuel.
-\item La clé |notes/style| est une commande dont l'argument est spécifié par
-|#1| et qui indique le style de numérotation des notes. C'est ce style qui est
-utilisé par |\ref| pour faire référence à une note de tableau pour laquelle on a
-utilisé un |\label|. Ce sont les labels mis en forme avec ce style qui sont
-séparés par des virgules quand on utilise plusieurs commandes |\tabularnote|
-successivement. Le marqueur |#1| est censé correspondre à un nom de compteur
-LaTeX.
+\item La clé \Definition{notes/style} est une commande dont l'argument est
+spécifié par |#1| et qui indique le style de numérotation des notes. C'est ce
+style qui est utilisé par |\ref| pour faire référence à une note de tableau pour
+laquelle on a utilisé un |\label|. Ce sont les labels mis en forme avec ce style
+qui sont séparés par des virgules quand on utilise plusieurs commandes
+|\tabularnote| successivement. Le marqueur |#1| est censé correspondre à un nom
+de compteur LaTeX.
Valeur initiale : |\textit{\alph{#1}}|
Une autre valeur possible pourrait être tout simplement |\arabic{#1}|
-\item La clé |notes/label-in-tabular| est une commande dont l'argument est
-spécifié par |#1| et qui sert au formatage de l'appel de note dans le tableau.
-En interne, le numéro de note a déjà été formaté par |notes/style| avant d'être
-passé en argument à cette commande.
+\item La clé \Definition{notes/label-in-tabular} est une commande dont
+l'argument est spécifié par |#1| et qui sert au formatage de l'appel de note
+dans le tableau. En interne, le numéro de note a déjà été formaté par
+|notes/style| avant d'être passé en argument à cette commande.
Valeur initiale : |\textsuperscript{#1}|
@@ -4883,7 +4952,7 @@
\end{Code}
-\item La clé |notes/label-in-list| est une commande dont l'argument est
+\item La clé \Definition{notes/label-in-list} est une commande dont l'argument est
spécifié par |#1| et qui sert au formatage du numéro de note dans la liste des
notes en fin de tableau. En interne, le numéro de note a déjà été formaté par
|notes/style| avant d'être passé en argument à cette commande.
@@ -4914,13 +4983,13 @@
tableaux dans l'esprit de \pkg{booktabs} (voir par exemple la table~\ref{t:tabularnote}, p.~\pageref{t:tabularnote}).
\medskip
-La clé |notes/enumitem-keys| fournie par \pkg{nicematrix} permet de modifier ce
-type de liste de \pkg{enumitem} (en utilisant en interne la commande |\setlist*|
-de \pkg{enumitem}).
+La clé \Definition{notes/enumitem-keys} fournie par \pkg{nicematrix} permet de
+modifier ce type de liste de \pkg{enumitem} (en utilisant en interne la commande
+|\setlist*| de \pkg{enumitem}).
-\item La clé |notes/enumitem-keys-para| est similaire à la précédente mais elle
-est utilisée pour le type de liste qui sera utilisé quand l'option |para| est
+\item La clé \Definition{notes/enumitem-keys-para} est similaire à la précédente
+mais elle est utilisée pour le type de liste qui sera utilisé quand l'option |para| est
choisie. Bien entendu, quand cette option |para| est active, c'est une liste de
type |inline| (suivant le vocabulaire de \pkg{enumitem}) qui est utilisée et les
paires \textsl{clé=valeur} doivent donc correspondre à une telle liste de type
@@ -4931,8 +5000,8 @@
|afterlabel = \nobreak, itemjoin = \quad|
-\item La clé |notes/code-before| est une liste de tokens qui seront insérés
-avant la composition de la liste de notes.
+\item La clé \Definition{notes/code-before} est une liste de tokens qui seront
+insérés avant la composition de la liste de notes.
Valeur initiale : \textsl{vide}
@@ -4944,7 +5013,7 @@
On peut aussi mettre dans cette clé |\raggedright| ou |\RaggedRight| (cette
dernière est une commande de \pkg{ragged2e}).
-\item La clé |notes/detect-duplicates| active la détection des
+\item La clé \Definition{notes/detect-duplicates} active la détection des
commandes |\tabularnote| avec le même argument.
Valeur initiale : |true|
@@ -4991,7 +5060,7 @@
partie~\ref{corners}, p.~\pageref{corners}.
\smallskip
-La clé |rounded-corners| spécifie que le tableau ou la matrice devra avoir des
+La clé \Definition{rounded-corners} spécifie que le tableau ou la matrice devra avoir des
coins arrondis avec un rayon égal à la valeur de cette clé (la valeur par défaut est
4~pt\footnote{Cette valeur est la valeur par défaut des «\texttt{rounded
corners}» de PGF/Tikz.}). Plus précisément, cette clé a deux effets que l'on
@@ -5040,8 +5109,8 @@
\texttt{\textbackslash CodeAfter}\newline et du
\texttt{\textbackslash CodeBefore})}
-La commande |\ShowCellNames|, utilisable dans le |\CodeBefore| et le
-|\CodeAfter| affiche le nom (sous la forme $i$-$j$) de chaque case. Quand elle
+La commande \DefinitionCommande{ShowCellNames}, utilisable dans le |\CodeBefore|
+et le |\CodeAfter| affiche le nom (sous la forme $i$-$j$) de chaque case. Quand elle
est utilisée dans le |\CodeAfter|, cette commande applique un rectangle blanc
semi-transparent pour estomper le tableau (attention : certains lecteurs de
\textsc{pdf} ne prennent pas en charge la transparence).
@@ -5106,10 +5175,11 @@
Les environnements sans préambule (|{NiceMatrix}|, |{pNiceMatrix}|, etc.) ainsi
que la commande |\pAutoNiceMatrix| et ses variantes, acceptent la clé
-|columns-type| qui indique le type de colonne qui sera utilisé.
+\Definition{columns-type} qui indique le type de colonne qui sera utilisé.
\medskip
-Les clés |l| et |r| sont des raccourcis pour |columns-type=l| et |columns-type=r|.
+Les clés \Definition{l} et \Definition{l} sont des raccourcis pour
+|columns-type=l| et |columns-type=r|.
\medskip
\begin{Code}[width=10cm]
@@ -5134,8 +5204,8 @@
\label{rotate}
\index{rotate@\texttt{\textbackslash rotate}}
-Utilisée au début d'une case, la commande |\rotate| (fournie par
-\pkg{nicematrix}) compose le contenu après une rotation de 90° dans le sens
+Utilisée au début d'une case, la commande \DefinitionCommande{rotate} (fournie
+par \pkg{nicematrix}) compose le contenu après une rotation de 90° dans le sens
direct.
Dans l'exemple suivant, on l'utilise dans le |code-for-first-row|.\footnote{On
@@ -5221,10 +5291,10 @@
\index{smallmatrix@\texttt{\{smallmatrix\}} (environnement de \pkg{amsmath})}
-Avec l'option |small|, les environnements de l'extension \pkg{nicematrix} sont
-composés d'une manière proche de ce que propose l'environnement |{smallmatrix}|
-de l'\pkg{amsmath} (et les environnements |{psmallmatrix}|, |{bsmallmatrix}|,
-etc. de \pkg{mathtools}).
+Avec l'option \Definition{small}, les environnements de l'extension
+\pkg{nicematrix} sont composés d'une manière proche de ce que propose
+l'environnement |{smallmatrix}| de l'\pkg{amsmath} (et les environnements
+|{psmallmatrix}|, |{bsmallmatrix}|, etc. de \pkg{mathtools}).
\medskip
\begin{Code}
@@ -5328,8 +5398,10 @@
\indexcommand{BAutoNiceMatrix}
L'extension \pkg{nicematrix} propose aussi des commandes pour composer
automatiquement des matrices à partir d'un motif général. Ces commandes sont
-nommées |\AutoNiceMatrix|, |\pAutoNiceMatrix|, |\bAutoNiceMatrix|,
-|\vAutoNiceMatrix|, |\VAutoNiceMatrix| et |\BAutoNiceMatrix|.
+nommées \DefinitionCommande{AutoNiceMatrix},
+\DefinitionCommande{pAutoNiceMatrix}, \DefinitionCommande{bAutoNiceMatrix},
+\DefinitionCommande{vAutoNiceMatrix}, \DefinitionCommande{VAutoNiceMatrix} et
+\DefinitionCommande{BAutoNiceMatrix}.
Chacune de ces commandes prend deux arguments obligatoires : le premier est la
taille de la matrice, sous la forme $n$-$p$, où $n$ est le nombre de rangées et
@@ -5344,18 +5416,21 @@
\[C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}\]
+Il existe aussi \DefinitionCommande{AutoNiceArrayWithDelims} similaire à
+|{NiceArrayWithDelims}|.
+
\subsection{L'option light-syntax}
\label{light-syntax}
\index{light-syntax}
-L'option |light-syntax| (inspirée de l'extension \pkg{spalign}) permet d'alléger
-la saisie des matrices, ainsi que leur lisibilité dans le source TeX. Lorsque
-cette option est activée, on doit utiliser le point-virgule comme marqueur de
-fin de rangée et séparer les colonnes par des espaces ou des tabulations. On
-remarquera toutefois que, comme souvent dans le monde TeX, les espaces après les
-séquences de contrôle ne sont pas comptées et que les éléments entre accolades
-sont considérés comme un tout.
+L'option \Definition{light-syntax} (inspirée de l'extension \pkg{spalign})
+permet d'alléger la saisie des matrices, ainsi que leur lisibilité dans le
+source TeX. Lorsque cette option est activée, on doit utiliser le point-virgule
+comme marqueur de fin de rangée et séparer les colonnes par des espaces ou des
+tabulations. On remarquera toutefois que, comme souvent dans le monde TeX, les
+espaces après les séquences de contrôle ne sont pas comptées et que les éléments
+entre accolades sont considérés comme un tout.
\medskip
@@ -5408,7 +5483,7 @@
Pour les environnements avec délimiteurs (|{pNiceArray}|, |{pNiceMatrix}|,
etc.), il est possible de changer la couleur des délimiteurs avec la clé
-|delimiters/color|.
+\Definition{delimiters/color}.
\medskip
\begin{Code}[width=12cm]
@@ -5462,10 +5537,10 @@
\indexcommand{OnlyMainNiceMatrix}
-La commande |\OnlyMainNiceMatrix| n'exécute son argument que si on se trouve
-dans le tableau principal, c'est-à-dire que l'on est ni dans les rangées
-extérieures, ni dans les colonnes extérieures. Si elle est utilisée hors d'un
-environnement de \pkg{nicematrix}, elle est sans effet.
+La commande \DefinitionCommande{OnlyMainNiceMatrix} n'exécute son argument que
+si on se trouve dans le tableau principal, c'est-à-dire que l'on est ni dans les
+rangées extérieures, ni dans les colonnes extérieures. Si elle est utilisée hors
+d'un environnement de \pkg{nicematrix}, elle est sans effet.
Pour un exemple d'utilisation, voir \url{tex.stackexchange.com/questions/488566}
@@ -5501,8 +5576,8 @@
\medskip
Comme la création de ces nœuds requiert du temps et de la mémoire, il est
-possible de la désactiver ponctuellement avec la clé |no-cell-nodes| pour
-accélerer les compilations.
+possible de la désactiver ponctuellement avec la clé \Definition{no-cell-nodes}
+pour accélerer les compilations.
\medskip
Tous les nœuds du document doivent avoir des noms deux à deux distincts et le
@@ -5516,13 +5591,13 @@
\smallskip
\indexcommand{NiceMatrixLastEnv}
-La commande |\NiceMatrixLastEnv| donne le numéro du dernier de ces
-environnements (pour LaTeX, il s'agit d'une commande — complètement développable
-— et non d'un compteur).
+La commande \DefinitionCommande{NiceMatrixLastEnv} donne le numéro du dernier de
+ces environnements (pour LaTeX, il s'agit d'une commande — complètement
+développable — et non d'un compteur).
\smallskip
\index{name!clé pour un environnement}
-Il est néanmoins recommandé de passer plutôt par la clé |name|\footnote{La
+Il est néanmoins recommandé de passer plutôt par la clé \Definition{name}\footnote{La
valeur passée à la clé |name| est \emph{développée}, au sens de TeX.}.
Celle-ci permet de donner un nom à l'environnement. Une fois l'environnement
nommé, les nœuds sont accessibles à travers les noms «\textsl{nom}-$i$-$j$» où
@@ -5632,13 +5707,13 @@
\subsubsection{La clé pgf-node-code}
-\index{pgf-node-code}
+\index{pgf-node-code}
\textbf{Pour les utilisateurs expérimentés}, \pkg{nicematrix} fournit la clé
-|pgf-node-code| qui correspond à du code PGF qui sera exécuté à la création, par
-PGF, des nœuds correspondants aux cases du tableau. Plus précisément, la valeur
-fournie à la clé |pgf-node-code| sera passée en cinquième argument de la
-commande |\pgfnode|. Cette valeur doit contenir au moins une instruction comme
-|\pgfusepath|, |\pgfusepathqstroke|, |\pgfusepathqfill|, etc.
+\Definition{pgf-node-code} qui correspond à du code PGF qui sera exécuté à la
+création, par PGF, des nœuds correspondants aux cases du tableau. Plus
+précisément, la valeur fournie à la clé |pgf-node-code| sera passée en cinquième
+argument de la commande |\pgfnode|. Cette valeur doit contenir au moins une
+instruction comme |\pgfusepath|, |\pgfusepathqstroke|, |\pgfusepathqfill|, etc.
\subsubsection{Les colonnes V de varwidth}
@@ -5689,9 +5764,9 @@
En fait, l'extension \pkg{nicematrix} peut créer deux séries de nœuds
supplémentaires (\emph{extra nodes} en anglais) : les «nœuds moyens»
(\emph{medium nodes} en anglais) et les «nœuds larges» (\emph{large nodes} en
-anglais). Les premiers sont créés avec l'option |create-medium-nodes| et les
-seconds avec l'option |create-large-nodes|.\footnote{Il existe aussi l'option
- |create-extra-nodes| qui est un alias pour la conjonction de
+anglais). Les premiers sont créés avec l'option \Definition{create-medium-nodes}
+et les seconds avec l'option \Definition{create-large-nodes}.\footnote{Il existe
+ aussi l'option |create-extra-nodes| qui est un alias pour la conjonction de
|create-medium-nodes| et |create-large-nodes|.}
\medskip
@@ -5759,14 +5834,15 @@
\index{right-margin}
Les «nœuds larges» de la première colonne et de la dernière colonne peuvent
apparaître trop petits pour certains usages. C'est pourquoi il est possible
-d'utiliser les options |left-margin| et |right-margin| pour ajouter de l'espace
-des deux côtés du tableau et aussi de l'espace dans les «nœuds larges» de la
-première colonne et de la dernière colonne. Dans l'exemple suivant, nous avons
-utilisé les options |left-margin| et |right-margin|.\footnote{Les options
- |left-margin| et |right-margin| prennent des dimensions comme valeurs mais, si
- aucune valeur n'est donnée, c'est la valeur par défaut qui est utilisée et
- elle est égale à |\arraycolsep| (valeur initiale : 5~pt). Il existe aussi une
- option |margin| pour fixer à la fois |left-margin| et |right-margin|.}
+d'utiliser les options \Definition{left-margin} et \Definition{right-margin}
+pour ajouter de l'espace des deux côtés du tableau et aussi de l'espace dans les
+«nœuds larges» de la première colonne et de la dernière colonne. Dans l'exemple
+suivant, nous avons utilisé les options |left-margin| et
+|right-margin|.\footnote{Les options |left-margin| et |right-margin| prennent
+ des dimensions comme valeurs mais, si aucune valeur n'est donnée, c'est la
+ valeur par défaut qui est utilisée et elle est égale à |\arraycolsep| (valeur
+ initiale : 5~pt). Il existe aussi une option |margin| pour fixer à la fois
+ |left-margin| et |right-margin|.}
\[\begin{pNiceMatrix}[create-large-nodes,left-margin,right-margin]
\CodeBefore [create-cell-nodes]
\begin{tikzpicture}
@@ -5792,9 +5868,9 @@
\index{extra-left-margin}
\index{extra-right-margin}
Il est aussi possible d'ajouter de l'espace sur les côtés du tableau avec les
-options |extra-left-margin| et |extra-right-margin|. Ces marges ne sont pas
-incorporées dans les «nœuds larges». Dans l'exemple suivant, nous avons utilisé
-|extra-left-margin| et |extra-right-margin| avec la valeur $3$~pt.
+clés \Definition{extra-left-margin} et \Definition{extra-right-margin}. Ces
+marges ne sont pas incorporées dans les «nœuds larges». Dans l'exemple suivant,
+nous avons utilisé |extra-left-margin| et |extra-right-margin| avec la valeur $3$~pt.
\[\begin{pNiceMatrix}%
[create-large-nodes,left-margin,right-margin,extra-right-margin=3pt,extra-left-margin=3pt]
\CodeBefore [create-cell-nodes]
@@ -5900,9 +5976,9 @@
\index{create-cell-nodes (clé de \texttt{\textbackslash CodeBefore})}
On peut rendre ces nœuds accessibles dans le |\CodeBefore| en utilisant la clé
-|create-cell-nodes| du mot-clé |\CodeBefore| (dans ce cas-là, les nœuds sont
-créés une première fois avant la construction du tableau en utilisant des
-informations écrites dans le fichier |aux| puis recréés lors de la composition
+\Definition{create-cell-nodes} du mot-clé |\CodeBefore| (dans ce cas-là, les
+nœuds sont créés une première fois avant la construction du tableau en utilisant
+des informations écrites dans le fichier |aux| puis recréés lors de la composition
du tableau proprement dit).
\bigskip
@@ -5961,8 +6037,9 @@
\smallskip
\colorbox{yellow!50}{\textbf{Modification 6.28}}\enskip Il existe aussi des nœuds nommés
-$i$|.1|, $i$|.2|, ... , $i$|.9| intermédiaires entre le nœud~$i$ et le
-nœud~$i+1$ (avant la version 6.28, seul le nœud $i$|.5| existait).
+$i$|.1|, $i$|.2|, $i$|.25|, $i$|.3|, $i$|.4|, $i$|.5|, $i$|.6|, $i$|.7|,
+$i$|.75|, $i$|.8| et $i$|.9| intermédiaires entre le nœud~$i$ et le
+nœud~$i+1$.
\smallskip
Ces nœuds sont accessibles dans le
@@ -6277,7 +6354,7 @@
\medskip
Il est possible de désactiver la parallélisation avec l'option
-|parallelize-diags| mise à |false|: \par\nobreak
+\Definition{parallelize-diags} mise à |false|: \par\nobreak
\medskip
\NiceMatrixOptions{parallelize-diags=false}%
@@ -6298,17 +6375,20 @@
\texttt{\textbackslash Iddots})}
On peut choisir l'instruction |\Ddots| qui sera tracée en premier (et qui
servira pour tracer les suivantes quand la parallélisation est activée) avec la
-clé |draw-first| : |\Ddots[draw-first]|\rlap{.}
+clé \Definition{draw-first} : |\Ddots[draw-first]|\rlap{.}
\subsection{Les cases «vides»}
\label{empty-cells}
-Une instruction comme |\Ldots|, |\Cdots|, etc. essaye de déterminer la première
-case non vide de part et d'autre de la case considérée. Quand la clé |corners|
-(cf.~p.~\pageref{corners}) est utilisée, les coins qui sont déterminés sont
-composés de cases vides. Néanmoins, une case «vide» n'est pas nécessairement
-sans contenu dans le codage TeX. Les règles précises sont les suivantes :
+L'extension \pkg{nicematrix} utilise en plusieurs occassions le concept de «case
+vide». Par exemple, une instruction comme |\Ldots|, |\Cdots|, etc. essaye de
+déterminer la première case non vide de part et d'autre de la case considérée.
+De même, quand la clé |corners| (cf.~p.~\pageref{corners}) est utilisée, les
+coins qui sont déterminés sont composés de cases vides.
+
+La définition précise de «case vide» est la suivante.
+
\begin{itemize}
\item Une case implicite est vide. Par exemple, dans la matrice suivante
@@ -6354,23 +6434,24 @@
avant et après chaque colonne. En particulier, il y a un espace égal à
|\arraycolsep| avant et après le tableau. Cette caractéristique de
l'environnement |{array}| n'était probablement pas une bonne idée\footnote{Dans
- la documentation de l'\pkg{amsmath}, on peut lire : {\itshape The extra space of
- |\arraycolsep| that \pkg{array} adds on each side is a waste so we remove it
- [in |{matrix}|] (perhaps we should instead remove it from array in general,
- but that's a harder task).}}. L'environnement |{matrix}| et ses variantes
-(|{pmatrix}|, |{vmatrix}|, etc.) de \pkg{amsmath} préfèrent supprimer ces
-espaces avec des instructions explicites |\hskip -\arraycolsep|\footnote{Et non
- en insérant |@{}| de part et d'autre du préambule, ce qui fait que la longueur
- des |\hline| n'est pas modifiée et elle peut paraître trop longue, surtout
- avec des crochets.}. L'extension \pkg{nicematrix} fait de même dans
+ la documentation de l'\pkg{amsmath}, on peut lire : {\itshape The extra space
+ of |\arraycolsep| that \pkg{array} adds on each side is a waste so we remove
+ it [in |{matrix}|] (perhaps we should instead remove it from array in
+ general, but that's a harder task).}}. L'environnement |{matrix}| et ses
+variantes (|{pmatrix}|, |{vmatrix}|, etc.) de \pkg{amsmath} préfèrent supprimer
+ces espaces avec des instructions explicites |\hskip -\arraycolsep|\footnote{Et
+ non en insérant |@{}| de part et d'autre du préambule, ce qui fait que la
+ longueur des |\hline| n'est pas modifiée et elle peut paraître trop longue,
+ surtout avec des crochets.}. L'extension \pkg{nicematrix} fait de même dans
\emph{tous} ses environnements y compris l'environnement |{NiceArray}|.
Néanmoins, si l'utilisateur souhaite que l'environnement |{NiceArray}| se
comporte par défaut comme l'environnement |{array}| de \pkg{array} (par exemple
pour faciliter l'adaptation d'un document existant), il peut contrôler ce
-comportement avec l'option |exterior-arraycolsep| accessible via la commande
-|\NiceMatrixOptions|. Avec cette option, des espaces extérieurs de longueur
-|\arraycolsep| seront insérés dans les environnements |{NiceArray}| (les autres
-environnements de l'extension \pkg{nicematrix} ne sont pas affectés).
+comportement avec l'option \Definition{exterior-arraycolsep} accessible via la
+commande |\NiceMatrixOptions|. Avec cette option, des espaces extérieurs de
+longueur |\arraycolsep| seront insérés dans les environnements |{NiceArray}|
+(les autres environnements de l'extension \pkg{nicematrix} ne sont pas
+affectés).
@@ -6383,7 +6464,7 @@
L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess}
car cette classe n'est pas compatible avec PGF-TikZ. Il existe néanmoins une
parade simple qui consiste à écrire:\footnote{Voir
- \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}\par\nobreak
+ \url{https://tex.stackexchange.com/questions/528975}}\par\nobreak
\begin{Code}
\let\TeXyear\year
@@ -7063,7 +7144,8 @@
\index{max-width (sous-clé de «delimiters»)}
\index{delimiters!---/max-width}
Pour résoudre ce problème, on peut demander que les délimiteurs soient composés
-avec leur largeur maximale grâce à la clé booléenne |delimiters/max-width|.
+avec leur largeur maximale grâce à la clé booléenne
+\Definition{delimiters/max-width}.
\medskip
@@ -7204,9 +7286,9 @@
\medskip
\index{vlines-in-sub-matrix}
-En fait, on peut avec la clé |vlines-in-sub-matrix| choisir un spécificateur
-dans le préambule du tableau pour indiquer des filets verticaux qui seront
-tracés dans les |\SubMatrix| uniquement (en espaçant les colonnes).
+En fait, on peut avec la clé \Definition{vlines-in-sub-matrix} choisir un
+spécificateur dans le préambule du tableau pour indiquer des filets verticaux
+qui seront tracés dans les |\SubMatrix| uniquement (en espaçant les colonnes).
\medskip
\begin{Code}
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 2024-10-24 20:02:39 UTC (rev 72643)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex 2024-10-24 20:02:52 UTC (rev 72644)
@@ -1,4 +1,4 @@
-% -*- coding: utf-8 ; -*- This file should be compiled with XeLaTeX only
+% -*- coding: utf-8 ; -*- This file should be compiled with LuaLaTeX only
\documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by TikZ,
% loaded by nicematrix)
@@ -62,7 +62,7 @@
\usepackage{piton}
-\PitonOptions{language = minimal, detected-commands = {emph,textsl}, splittable = 4}
+\PitonOptions{language = verbatim, detected-commands = {emph,textsl}, splittable = 4}
\SetPitonStyle{ Number = , Comment = }
\ExplSyntaxOn
@@ -116,8 +116,9 @@
\VerbatimFootnotes
-\title{The package \pkg{nicematrix}\thanks{This document corresponds to the version~\myfileversion\space of \pkg{nicematrix},
-at the date of~\myfiledate.}} \author{F. Pantigny \\ \texttt{fpantigny at wanadoo.fr}}
+\title{The package \pkg{nicematrix}\thanks{This document corresponds to the
+ version~\myfileversion\space of \pkg{nicematrix}, at the date of~\myfiledate.}}
+\author{F. Pantigny \\ \texttt{fpantigny at wanadoo.fr}}
\maketitle
@@ -180,7 +181,7 @@
This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by
the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe Distiller).
\textsl{However, the file nicematrix.dtx of the present documentation should
-be compiled with XeLaTeX.}
+be compiled with LuaLaTeX.}
\medskip
This package requires and \textbf{loads} the packages \pkg{l3keys2e},
@@ -288,12 +289,13 @@
\bigskip
Inspired by the package \pkg{cellspace} which deals with that problem, the
-package \pkg{nicematrix} provides two keys |cell-space-top-limit| and
-|cell-space-bottom-limit| similar to the parameters of \pkg{cellspace} called
-|\cellspacetoplimit| and
+package \pkg{nicematrix} provides two keys \Definition{cell-space-top-limit} and
+\Definition{cell-space-bottom-limit} similar to the parameters of
+\pkg{cellspace} called |\cellspacetoplimit| and
|\cellspacebottomlimit|.\index{cellspace@\pkg{cellspace} (package)}
-There is also a key |cell-space-limits| to set both parameters at once.
+There is also a key \Definition{cell-space-limits} to set both parameters at
+once.
The initial value of these parameters is $0$~pt in order to have for the
environments of \pkg{nicematrix} the same behaviour as those of \pkg{array}
@@ -333,9 +335,9 @@
\index{baseline (key for an environment)}
-The package \pkg{nicematrix} provides a option |baseline| for the vertical
-position of the arrays. This option takes in as value an integer which is the
-number of the row on which the array will be aligned.
+The package \pkg{nicematrix} provides a option \Definition{baseline} for the
+vertical position of the arrays. This option takes in as value an integer which
+is the number of the row on which the array will be aligned.
\medskip
\begin{Code}[width=9cm]
@@ -473,8 +475,8 @@
\subsection{General case}
In the environments of \pkg{nicematrix}, it's possible to use the command
-|\Block| in order to place an element in the center of a rectangle of merged
-cells of the array.\footnote{The spaces after a command |\Block| are deleted.}
+\DefinitionCommand{Block} in order to place an element in the center of a
+rectangle of merged cells of the array.\footnote{The spaces after a command |\Block| are deleted.}
The command |\Block| must be used in the upper leftmost cell of the cells of the
block with two mandatory arguments.
@@ -911,11 +913,13 @@
\colorbox{yellow!50}{\bfseries New 6.28}\par\nobreak
\smallskip
-The command |\Block| supports also a key |p|. With that key, the content of the
-block is formatted like a paragraph (as in a column of type |p|). That key may
-be used in conjunction with the key |l|, |c| or |r|, and, in that case, the
-paragraph is formatted with |\raggedright|, |\centering| or |\raggedleft|. With
-the key |j|, the paragraph is justified.
+The command |\Block| supports also the keys |p| and |j|. With the key
+\Definition{p}, the content of the block is formatted like a paragraph (as in a
+column of type |p|). That key may be used in conjunction with the key: |l|, |c|
+or |r|, and, in that case, the paragraph is formatted with |\raggedright|,
+|\centering| or |\raggedleft| (or |\RaggedRight|, |\Centering| and |\RaggedLeft|
+when \pkg{ragged2e}) est chargée. With the key \Definition{j}, the paragraph is
+justified.
\subsection{Vertical position of the content of the block}
@@ -1058,7 +1062,7 @@
\item For |\\|, there is no other restriction. It's possible to use |\\| in a
block to format a text on several rows.
-\item In order to use |&|, the key |ampersand-in-blocks| (alias: |&-in-blocks|)
+\item In order to use |&|, the key \Definition{ampersand-in-blocks} (alias: |&-in-blocks|)
must been activated\footnote{Otherwise, the use of~|&| in the command |\Block|
will raise a TeX error :\\
|! Extra alignment tab has been changed to \cr.|}. Then, the block is divided in sub-blocks as illustrated
@@ -1078,11 +1082,11 @@
\medskip
\begin{Code}[width=85mm]
\begin{NiceTabular}{ll}%
- [hvlines,ampersand-in-blocks]
+ [hvlines,\emph{ampersand-in-blocks}]
& les cinq premiers entiers naturels \\
-3 & \Block{un&deux&trois} \\
-4 & \Block{un&deux&trois& quatre} \\
-5 & \Block{un&deux&trois&quatre&cinq} \\
+3 & \Block{}{un&deux&trois} \\
+4 & \Block{}{un&deux&trois& quatre} \\
+5 & \Block{}{un&deux&trois&quatre&cinq} \\
\end{NiceTabular}
\end{Code}
%
@@ -1103,7 +1107,7 @@
\medskip
\begin{Code}[width=85mm]
\begin{NiceTabular}{lccccc}%
- [hvlines,ampersand-in-blocks]
+ [hvlines,\emph{ampersand-in-blocks}]
& \Block{1-5}{the five first
natural numbers} \\
3 & \Block{1-5}{one & two & three} \\
@@ -1239,7 +1243,8 @@
\medskip
\index{standard-cline}
In the environments of \pkg{nicematrix}, this situation is corrected (it's
-still possible to go to the standard behaviour of |\cline| with the key |standard-cline|).
+still possible to go to the standard behaviour of |\cline| with the key
+\Definition{standard-cline}).
\medskip
\begin{Code}[width=10cm]
@@ -1270,10 +1275,10 @@
\index{width!subkey of ``rules''}
\index{rules (key for an environment)}
-The environments of \pkg{nicematrix} provide a key |rules/width| to set the
-width (in fact the thickness) of the rules in the current environment. In
-fact, this key merely sets the value of the standard LaTeX length
-|\arrayrulewidth|.
+The environments of \pkg{nicematrix} provide a key \Definition{rules/width} to
+set the width (in fact the thickness) of the rules in the current environment.
+In fact, this key merely sets the value of the standard LaTeX length
+|\arrayrulewidth|.
\smallskip
It's well known that \pkg{colortbl} provides the command |\arrayrulecolor| in
@@ -1284,7 +1289,7 @@
With \pkg{nicematrix}, it's possible to specify the color of the rules even when
\pkg{colortbl} is not loaded. For sake of compatibility, the command is also
named |\arrayrulecolor|. However, \pkg{nicematrix} also provides a key
-|rules/color|, available in |\NiceMatrixOptions| or in an individual
+\Definition{rules/color}, available in |\NiceMatrixOptions| or in an individual
environment, to fix the color of the rules. This key sets the value locally
(whereas |\arrayrulecolor| acts globally!) and should be prefered.
@@ -1388,10 +1393,10 @@
\index{vlines|see{Rules}}
\index{vlines!key for an environment}
-The keys |hlines| and |vlines| (which draw, of course, horizontal and vertical
-rules) take in as value a list of numbers which are the numbers of the rules
-to draw.\footnote{It's possible to put in that list some intervals of integers
-with the syntax $i$|-|$j$.}
+The keys \Definition{hlines} and \Definition{vlines} (which draw, of course,
+horizontal and vertical rules) take in as value a list of numbers which are the
+numbers of the rules to draw.\footnote{It's possible to put in that list some
+ intervals of integers with the syntax $i$|-|$j$.}
In fact, for the environments with delimiters (such as |{pNiceMatrix}| or
|{bNiceArray}|), the key |vlines| don't draw the exterior rules (this is
@@ -1444,7 +1449,8 @@
\index{hvlines-except-borders}
-The key |hvlines| (no value) is the conjonction of the keys |hlines| and |vlines|.
+The key \Definition{hvlines} (no value) is the conjonction of the keys |hlines|
+and |vlines|.
\smallskip
\begin{Code}
@@ -1474,10 +1480,10 @@
p.~\pageref{tabular-rounded-corners}.
\bigskip
-The key |hvlines-except-borders| is similar to the key |hvlines| but does not
-draw the rules on the horizontal and vertical borders of the array. For an
-example of use of that key, see the part ``Use with tcolorbox'',
-p.~\pageref{tcolorbox}.
+The key \Definition{hvlines-except-borders} is similar to the key |hvlines| but
+does not draw the rules on the horizontal and vertical borders of the array. For
+an example of use of that key, see the part ``Use with tcolorbox'',
+p.~\pageref{tcolorbox}.
\subsubsection{The (empty) corners}
@@ -1497,7 +1503,7 @@
p.~\pageref{empty-cells}).}
However, it's possible, for a cell without content, to require \pkg{nicematrix}
-to consider that cell as not empty with the key |\NotEmpty|.
+to consider that cell as not empty with the command |\NotEmpty|.
\bigskip
\begin{minipage}{9cm}
@@ -1526,7 +1532,7 @@
\end{NiceTabular}
\bigskip
-When the key |corners|\footnote{The key |corners| that we describe now
+When the key \Definition{corners}\footnote{The key |corners| that we describe now
has no direct link with the key |rounded-corners| described in the part
\ref{tabular-rounded-corners}, p.~\pageref{tabular-rounded-corners}} is used,
\pkg{nicematrix} computes the (empty) corners and these corners will be taken
@@ -1598,8 +1604,8 @@
\indexcommand{diagbox}
-The command |\diagbox| (inspired by the package \pkg{diagbox}), allows, when
-it is used in a cell, to slash that cell diagonally downwards.
+The command \DefinitionCommand{diagbox} (inspired by the package \pkg{diagbox}),
+allows, when it is used in a cell, to slash that cell diagonally downwards.
\medskip
\begin{Code}[width=10cm]
@@ -1622,9 +1628,52 @@
\medskip
It's possible to use the command |\diagbox| in a |\Block|.
+\medskip
+\begin{Code}[width=10cm]
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\emph{\Block{2-2}{\diagbox{x}{y}}} & & a & b & c \\
+ & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+\end{Code}
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\Block{2-2}{\diagbox{x}{y}} & & a & b & c \\
+ & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+\medskip
+But it's also possible to use |\diagbox| for the diagonal rule only (and the
+labels are put but the usual way, that is to say in cells of the tabular).
+\medskip
+\begin{Code}[width=10cm]
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\emph{\Block{2-2}{\diagbox{}{}}} & y & a & b & c \\
+x & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+\end{Code}
+$\begin{NiceArray}{*{5}{c}}[hvlines]
+\Block{2-2}{\diagbox{}{}} & y & a & b & c \\
+x & & a & b & c \\
+a & a & e & c & b \\
+b & b & c & e & a \\
+c & c & b & a & e
+\end{NiceArray}$
+\medskip
+Nevertheless, it's always possible to draw whatever rule we wish with TikZ in
+the |\CodeAfter| (or the |\CodeBefore|) by using the PGF/TikZ nodes created by
+\pkg{nicematrix}: cf. p.~\pageref{PGF-nodes}.
+
+
\subsubsection{Commands for customized rules}
\label{custom-line}
@@ -1634,9 +1683,9 @@
\index{custom-line|(}
-It's also possible to define commands and letters for customized rules with
-the key |custom-line| available in |\NiceMatrixOptions| and in the options of
-individual environments. That key takes in as argument a list of
+It's also possible to define commands and letters for customized rules with the
+key \Definition{custom-line} available in |\NiceMatrixOptions| and in the
+options of individual environments. That key takes in as argument a list of
\textsl{key=value} pairs. First, there is three keys to define the tools which
will be used to use that new type of rule.
@@ -1781,8 +1830,8 @@
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
+vertical for an horizontal one) with the key \Definition{total-width}. That
+value of that key, is, in some ways, the width of the rule that will be drawn
(\pkg{nicematrix} does not compute that width from the characteristics of the
rule specified in |tikz|).
@@ -1841,7 +1890,7 @@
between cells of the matrix with |\Cdots|, |\Vdots|, etc. (cf. p.~\pageref{Cdots}).
In fact, \pkg{nicematrix} defines by default the commands
-\Definition{hdottedline} and \Definition{cdottedline} and the letter ``|:|'' for
+\DefinitionCommand{hdottedline} and \DefinitionCommand{cdottedline} and the letter ``|:|'' for
those dotted rules.\footnote{However, it's possible to overwrite those
definitions with a |custom-line| (in order, for example, to switch to dashed
lines).}
@@ -2534,7 +2583,7 @@
It's possible to access the preceding tools with a syntax close to the syntax
-of \pkg{colortbl}. For that, one must use the key |color-inside|\footnote{There
+of \pkg{colortbl}. For that, one must use the key \Definition{color-inside}\footnote{There
is an alias for that key : \texttt{colortbl-like}.} in the
current environment.\footnote{Up to now, this key is \emph{not} available in |\NiceMatrixOptions|.}
@@ -2542,10 +2591,10 @@
\pkg{colortbl} but are \emph{independent} of \pkg{colortbl}):
\begin{itemize}
\item \DefinitionCommand{cellcolor} which colorizes a cell;\footnote{That
- command cellcolor will delete the following spaces, which does not the
- command cellcolor of \pkg{colortbl}. Moreover, if one wishes to define a
- command above that command |rowcolor|, it must be protected in the TeX sens
- (whereas, if it were the command |\rowcolor| of \pkg{colortbl}, one should
+ command |\cellcolor| will delete the following spaces, which does not the
+ command |\cellcolor| of \pkg{colortbl}. Moreover, if one wishes to define a
+ command above that command |\cellcolor|, it must be protected in the TeX sens
+ (whereas, if it were the command |\cellcolor| of \pkg{colortbl}, one should
write a \emph{fully expandable} command).}
\item \DefinitionCommand{rowcolor} which must be used in a cell and which
colorizes the end of the row;\footnote{If you want a commande to color the
@@ -2658,8 +2707,8 @@
\index{cell-space-limits}
-The command |\RowStyle| takes in as argument some formatting intructions that
-will be applied to each cell on the rest of the current row.
+The command \DefinitionCommand{RowStyle} takes in as argument some formatting
+intructions that will be applied to each cell on the rest of the current row.
\medskip
That command also takes in as optional argument (between square brackets)
@@ -2738,7 +2787,7 @@
\index{columns-width}
In the environments of \pkg{nicematrix}, it's also possible to fix the \emph{minimal}
width of all the columns (except the potential exterior columns: cf. p.~\pageref{exterior}) directly
-with the key |columns-width|.
+with the key \Definition{columns-width}.
\medskip
\begin{Code}[width=10cm]
@@ -2857,9 +2906,9 @@
The environment |{NiceTabular}| provides |X| columns similar to those provided
by the environment |{tabularx}| of the eponymous package.
-The required width of the tabular may be specified with the key |width| (in
-|{NiceTabular}| or in |\NiceMatrixOptions|). The initial value of this
-parameter is |\linewidth| (and not |\textwidth|).
+The required width of the tabular may be specified with the key
+\Definition{width} (in |{NiceTabular}| or in |\NiceMatrixOptions|). The initial
+value of this parameter is |\linewidth| (and not |\textwidth|).
For sake of similarity with the environment |{tabularx}|, \pkg{nicematrix}
also provides an environment |{NiceTabularX}| with a syntax similar to the
@@ -2878,7 +2927,10 @@
If such a value is used, an error will be raised.}
\item It's possible to specify an horizontal alignment with one of the
letters |l|, |c| and |r| (which insert respectively |\raggedright|,
-|\centering| and |\raggedleft| followed by |\arraybackslash|).
+|\centering| and |\raggedleft| followed by |\arraybackslash|).\footnote{In fact,
+when \pkg{ragged2e} is loaded, \pkg{nicematrix} uses the commands
+|\RaggedRight|, |\Centering| and |\RaggedLeft| of \pkg{ragged2e} instead of the
+commands |\raggedright|, |\centering| and |\raggedleft|. That ensures a better output.}
\item It's possible to specify a vertical alignment with one of the keys
|t| (alias |p|), |m| and |b| (which construct respectively columns of type
|p|, |m| and |b|). The default value is |t|.
@@ -3008,10 +3060,10 @@
\index{first-col}
\index{last-col}
-The options |first-row|, |last-row|, |first-col| and |last-col| allow the
-composition of exterior rows and columns in the environments of
-\pkg{nicematrix}. It's particularly interesting for the (mathematical)
-matrices.
+The options \Definition{first-row}, \Definition{last-row},
+\Definition{first-col} and \Definition{last-col} allow the composition of
+exterior rows and columns in the environments of \pkg{nicematrix}. It's
+particularly interesting for the (mathematical) matrices.
\label{exterior}
A potential ``first row'' (exterior) has the number $0$ (and not $1$). Idem
@@ -3081,9 +3133,10 @@
\index{code-for-last-row}
\index{code-for-last-col}
It's possible to control the appearance of these rows and columns with options
-|code-for-first-row|, |code-for-last-row|, |code-for-first-col| and
-|code-for-last-col|. These options specify tokens that will be inserted before
-each cell of the corresponding row or column.
+\Definition{code-for-first-row}, \Definition{code-for-last-row},
+\Definition{code-for-first-col} and \Definition{code-for-last-col}. These
+options specify tokens that will be inserted before each cell of the
+corresponding row or column.
\begin{Code}
@@ -3161,9 +3214,10 @@
\index{xdots (and its subkeys)}
Inside the environments of the package \pkg{nicematrix}, new commands are
-defined: |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, and |\Iddots|. These commands
-are intended to be used in place of |\dots|, |\cdots|, |\vdots|, |\ddots| and
-|\iddots|.\footnote{The command |\iddots|, defined in \pkg{nicematrix}, is a
+defined: \DefinitionCommand{Ldots}, \DefinitionCommand{Cdots},
+\DefinitionCommand{Vdots}, \DefinitionCommand{Ddots} and
+\DefinitionCommand{Iddots}. These commands are intended to be used in place of
+|\dots|, |\cdots|, |\vdots|, |\ddots| and |\iddots|.\footnote{The command |\iddots|, defined in \pkg{nicematrix}, is a
variant of |\ddots| with dots going forward. If |mathdots| is loaded, the
version of |mathdots| is used. It corresponds to the command |\adots| of
\pkg{unicode-math}.}
@@ -3349,7 +3403,7 @@
\bigskip
However, one may prefer the geometry of the first matrix $A$ and would like to
have such a geometry with a dotted line in the second row. It's possible by
-using the option |nullify-dots| (and only one instruction |\Ldots| is
+using the option \Definition{nullify-dots} (and only one instruction |\Ldots| is
necessary).\par\nobreak
\medskip
@@ -3381,8 +3435,9 @@
Some people commonly use the command |\hdotsfor| of \pkg{amsmath} in order to
draw horizontal dotted lines in a matrix. In the environments of
-\pkg{nicematrix}, one should use instead |\Hdotsfor| in order to draw dotted
-lines similar to the other dotted lines drawn by the package \pkg{nicematrix}.
+\pkg{nicematrix}, one should use instead \DefinitionCommand{Hdotsfor} in order
+to draw dotted lines similar to the other dotted lines drawn by the package
+\pkg{nicematrix}.
As with the other commands of \pkg{nicematrix} (like |\Cdots|, |\Ldots|,
|\Vdots|, etc.), the dotted line drawn with |\Hdotsfor| extends until the
@@ -3434,8 +3489,9 @@
\pkg{nicematrix} instead of \pkg{colortbl}.
\bigskip
-The package \pkg{nicematrix} also provides a command |\Vdotsfor| similar to
-|\Hdotsfor| but for the vertical dotted lines.
+The package \pkg{nicematrix} also provides a command
+\DefinitionCommand{Vdotsfor} similar to |\Hdotsfor| but for the vertical dotted
+lines.
\bigskip
The following example uses both |\Hdotsfor| and |\Vdotsfor|:
@@ -3490,7 +3546,7 @@
\smallskip
\begin{itemize}
-\item The option |renew-dots|\par\nobreak
+\item The option \Definition{renew-dots}\par\nobreak
With this option, the commands |\ldots|, |\cdots|, |\vdots|, |\ddots|,
|\iddots|\footnotemark[\thefniddots] and |\hdotsfor| are redefined within the
@@ -3498,7 +3554,7 @@
|\Vdots|, |\Ddots|, |\Iddots| and |\Hdotsfor|; the command |\dots|
(``automatic dots'' of |amsmath|) is also redefined to behave like |\Ldots|.
-\item The option |renew-matrix|\par\nobreak
+\item The option \Definition{renew-matrix}\par\nobreak
With this option, the environment |{matrix}| is redefined and behave like
|{NiceMatrix}|, and so on for the five variants.
@@ -3557,7 +3613,8 @@
\bigskip
-With the key |xdots/horizontal-labels|, the labels stay horizontal.\par\nobreak
+With the key \Definition{xdots/horizontal-labels}, the labels stay
+horizontal.\par\nobreak
%
\medskip
\begin{Code}[width=10cm]
@@ -3620,9 +3677,11 @@
|^| and~|:|) stay horizontal.
\bigskip
-The option \Definition{xdots/color} fixes the color or the dotted line. However,
-one should remark that the dotted lines drawn in the exterior rows and columns
-have a special treatment: cf. p.~\pageref{exterior}.
+The option \Definition{xdots/color} fixes the color or the dotted line. It's
+possible to use a color definied ``on the fly''
+(e.g.: |xdots/color = { [RGB]{204,204,255} }|). One should remark that
+the dotted lines drawn in the exterior rows and columns have a special
+treatment: cf. p.~\pageref{exterior}.
\bigskip
The option \Definition{radius} fixes the radius of the dots. The initial value
@@ -3847,17 +3906,18 @@
\index{code-after}
\label{code-after}
-The option |code-after| may be used to give some code that will be executed
-\emph{after} the construction of the matrix.\footnote{There is also a key
-|code-before| described p.~\pageref{code-before}.}
+The option \Definition{code-after} may be used to give some code that will be
+executed \emph{after} the construction of the matrix.\footnote{There is also a
+key |code-before| described p.~\pageref{code-before}.}
\medskip
\index{sub-matrix (key of \texttt{\textbackslash CodeAfter}, with subkeys)}
For the legibility of the code, an alternative syntax is provided: it's
possible to give the instructions of the |code-after| at the end of the
-environment, after the keyword |\CodeAfter|. Although |\CodeAfter| is a
-keyword, it takes in an optional argument (between square
-brackets).\footnote{Here are the keys accepted in that argument:
+environment, after the keyword \DefinitionCommand{CodeAfter} (the key
+|code-after| is of course mandatory in the |\AutoNiceMatrix| and the
+similar commands). Although |\CodeAfter| is a keyword, it takes in an optional
+argument (between square brackets).\footnote{Here are the keys accepted in that argument:
|delimiters/color|, |rules| and its sub-keys, |sub-matrix| (linked to the
command |\SubMatrix|) and its sub-keys and |xdots| (for the command |\line|) and
its sub-keys.}
@@ -3873,12 +3933,18 @@
|\SubMatrix|, |\OverBrace|, |\UnderBrace| and |\TikzEveryCell|. We will now
present these commands.
+\medskip
+One should avoid spurious spaces in that |\CodeAfter|.\footnote{See:
+ \url{https://tex.stackexchange.com/questions/689336}}
+
+
\subsection{The command \textbackslash line in the \textbackslash CodeAfter}
\label{line-in-code-after}
\index{line@\texttt{\textbackslash line} (command of \texttt{\textbackslash CodeAfter})}
-The command |\line| draws directly dotted lines between cells or blocks. It takes in two
-arguments for the cells or blocks to link. Both argument may be:
+The command \DefinitionCommand{line} draws directly dotted lines between cells
+or blocks. It takes in two arguments for the cells or blocks to link. Both
+argument may be:
\begin{itemize}
\item a specification of cell of the form $i$-$j$ where is the
number of the row and $j$ is the number of the column;
@@ -3950,7 +4016,7 @@
\texttt{\textbackslash CodeBefore})|textbf}
-The command |\SubMatrix| provides a way to put delimiters on a portion
+The command \DefinitionCommand{SubMatrix} provides a way to put delimiters on a portion
of the array considered as a submatrix. The command |\SubMatrix| takes in five
arguments:
\begin{itemize}
@@ -4195,8 +4261,8 @@
\emph{Caution} : The following functionnality is fragile and does not work with
|latex|--|dvips|--|ps2pdf|.\par\nobreak
-The key |code| of the command |\SubMatrix| allows the insertion of code after
-the construction of the submatrix. It's meant to be used to insert TikZ
+The key \Definition{code} of the command |\SubMatrix| allows the insertion of
+code after the construction of the submatrix. It's meant to be used to insert TikZ
instructions because, in the TikZ instructions inserted by that code, the
nodes of the form \verb+i-|j+ are interpreted with |i| and |j| as
numbers of row and columns \emph{relative to the submatrix}.\footnote{Be
@@ -4250,9 +4316,9 @@
\texttt{\textbackslash CodeAfter}\newline and
\texttt{\textbackslash CodeBefore})}
-The commands |\OverBrace| and |\UnderBrace| provide a way to put
-horizontal braces on a part of the array. These commands take in three
-arguments:
+The commands \DefinitionCommand{OverBrace} and \DefinitionCommand{UnderBrace}
+provide a way to put horizontal braces on a part of the array. These commands
+take in three arguments:
\begin{itemize}
\item the first argument is the upper-left corner of the submatrix with the
syntax $i$|-|$j$ where $i$ the number of row and $j$ the number of column;
@@ -4260,6 +4326,9 @@
\item the third argument is the label of the brace that will be put by
\pkg{nicematrix} (with \textsc{pgf}) above the brace (for the command
|\OverBrace|) or under the brace (for |\UnderBrace|).
+
+\colorbox{yellow!50}{\bfseries{New 6.29}}\enskip It's possible to use the
+command |\\| in this third argument in order to format the label on several lignes.
\end{itemize}
\bigskip
@@ -4281,7 +4350,7 @@
\end{pNiceMatrix}$
\bigskip
-Caution : There is no vertical space reserved for those braces and their labels.\footnote{See:
+Caution: There is no vertical space reserved for those braces and their labels.\footnote{See:
\url{https://tex.stackexchange.com/questions/685755}}
@@ -4343,19 +4412,19 @@
\index{empty (key of \texttt{\textbackslash TikzEveryCell})}
\index{non empty (key of \texttt{\textbackslash TikzEveryCell})}
-The command |\TikzEveryCell|
-executes 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,
-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
-block (excepted those with the key |transparent|) and does not apply to the
-individual cells located within these blocks.
+The command \DefinitionCommand{TikzEveryCell} executes 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, 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 block
+(excepted those with the key |transparent|) and does not apply to the individual
+cells located within these blocks.
\medskip
In fact, in the list of keys provided as argument of |\TikzEveryCell|, it's
-possible to put a key |offset|. That key is not provided by TikZ but by
+possible to put a key \Definition{offset}. That key is not provided by TikZ but by
\pkg{nicematrix}. It will narrow the rectangular frame corresponding to the
block by a margin (horizontally and vertically) equal to the value (of that key
|offset|). That new frame, a bit narrower, will be executed by TikZ with options
@@ -4389,7 +4458,9 @@
\bigskip
The command |\TikzEveryCell| has two optional keys, available between square brackets.
\begin{itemize}
-\item with the key \Definition{empty}, the command only acts on the empty cells;
+\item with the key \Definition{empty}, the command only acts on the empty cells
+(the exact definition of an ``empty cell'' is given in part~\ref{empty-cells},
+p.~\pageref{empty-cells});
\item with key \Definition{non-empty}, the command only acts on the non-empty cells.
\end{itemize}
@@ -4444,9 +4515,9 @@
\index{caption@\textbf{Captions of the tabulars}}
\smallskip
-The environment |{NiceTabular}| provides the keys |caption|, |short-caption|
-and |label| which may be used when the tabular is inserted in a floating
-environment (typically the environment |{table}|).
+The environment |{NiceTabular}| provides the keys \Definition{caption},
+\Definition{short-caption} and \Definition{label} which may be used when the
+tabular is inserted in a floating environment (typically the environment |{table}|).
\smallskip
With the key |caption|, the caption, when it is long, is wrapped at the width of
@@ -4456,8 +4527,8 @@
\smallskip
By default, the caption is composed below the tabular. With the key
-|caption-above|, available in |\NiceMatrixOptions|, the caption will be
-composed above the tabular.
+\Definition{caption-above}, available in |\NiceMatrixOptions|, the caption will
+be composed above the tabular.
\smallskip
The key |short-caption| corresponds to the optional argument of the clasical
@@ -4509,12 +4580,13 @@
\index{tabularnote@\texttt{\textbackslash tabularnote}}
-The package \pkg{nicematrix} also provides a command |\tabularnote| which gives
-the ability to specify notes that will be composed at the end of the array with
-a width of line equal to the width of the array (except the potential exterior
-columns specified by |first-col| and |last-col|: cf.~\ref{exterior},
-p.~\pageref{exterior}). With no surprise, that command is available only in the
-environments |{NiceTabular}|, |{NiceTabular*}| and |{NiceTabularX}|.
+The package \pkg{nicematrix} also provides a command
+\DefinitionCommand{tabularnote} which gives the ability to specify notes that
+will be composed at the end of the array with a width of line equal to the width
+of the array (except the potential exterior columns specified by |first-col| and
+|last-col|: cf.~\ref{exterior}, p.~\pageref{exterior}). With no surprise, that
+command is available only in the environments |{NiceTabular}|, |{NiceTabular*}|
+and |{NiceTabularX}|.
In fact, this command is available only if the extension \pkg{enumitem}
\index{enumitem@\pkg{enumitem} (package required to use\newline \texttt{\textbackslash tabularnote})} has
@@ -4568,12 +4640,13 @@
label of the note is composed in an overlapping position (towards the right).
This structure may provide a better alignment of the cells of a given column.
-\item If the key |notes/para| is used, the notes are composed at the end of
-the array in a single paragraph (as with the key |para| of \pkg{threeparttable}).
+\item If the key \Definition{notes/para} is used, the notes are composed at the
+end of the array in a single paragraph (as with the key |para| of
+\pkg{threeparttable}).
\item \index{tabularnote (key of \texttt{\{NiceTabular\}})}
-There is a key |tabularnote| which provides a way to insert some text in
-the zone of the notes before the numbered tabular notes.
+There is a key \Definition{tabularnote} which provides a way to insert some text
+in the zone of the notes before the numbered tabular notes.
\index{tabularnote@\texttt{\{TabularNote\}}}
An alternative syntax is available with the environment |{TabularNote}|. That
@@ -4581,8 +4654,8 @@
\emph{before} a potential instruction |\CodeAfter|).
\item If the package \pkg{booktabs} has been loaded (before or after
-\pkg{nicematrix}), the key |notes/bottomrule| draws a |\bottomrule| of
-\pkg{booktabs} \emph{after} the notes.
+\pkg{nicematrix}), the key \Definition{notes/bottomrule} draws a |\bottomrule|
+of \pkg{booktabs} \emph{after} the notes.
\item The command |\tabularnote| may be used \emph{before}
the environment of \pkg{nicematrix}. Thus, it's possible to use it on the
@@ -4596,10 +4669,10 @@
labels are composed, of course). It's possible to control that feature with
the key |notes/detect-duplicates|.\footnote{For technical reasons, the final
user is not allowed to put several commands |\tabularnote| with exactly the
-same argument in the caption of the tabular.}
+same argument in the caption of the tabular. It's not a real restriction...}
-\item It's possible to create a reference to a tabular note created by |\tabularnote|
-(with the usual command |\label| used after the |\tabularnote|).
+\item It's possible to create a reference to a tabular note created by
+|\tabularnote| (with the usual command |\label| used after the |\tabularnote|).
\item The command |\tabularnote| has an optional argument (between square
brackets) to change the symbol of the reference of the note.
@@ -4620,7 +4693,8 @@
\begin{NiceTabular}{@{}llc@{}
[
caption = A tabular whose caption has been specified by the key
- \texttt{caption}\emph{\tabularnote[$\star$]{It's possible to put a tabular note in the caption.}} ,
+ \texttt{caption}\emph{\tabularnote[$\star$]{It's possible to put a tabular
+ note in the caption.}} ,
label = t:tabularnote ,
tabularnote = Some text before the notes. ,
notes/bottomrule
@@ -4647,7 +4721,8 @@
\NiceMatrixOptions{caption-above}
\begin{NiceTabular}{@{}llc@{}}[
caption = A tabular whose caption has been specified by the key
- \texttt{caption}\tabularnote[$\star$]{It's possible to put a tabular note in the caption} ,
+ \texttt{caption}\tabularnote[$\star$]{It's possible to put a tabular
+ note in the caption} ,
label = t:tabularnote ,
tabularnote = Some text before the notes. ,
notes/bottomrule
@@ -4721,14 +4796,14 @@
We detail these keys.
\begin{itemize}[itemsep=\medskipamount]
-\item The key |notes/para| requires the composition of the notes (at the end of
-the tabular) in a single paragraph.
+\item The key \Definition{notes/para} requires the composition of the notes (at
+the end of the tabular) in a single paragraph.
Initial value: |false|
That key is also available within a given environment.
-\item The key |notes/bottomrule| adds a |\bottomrule| of \pkg{booktabs}
+\item The key \Definition{notes/bottomrule} adds a |\bottomrule| of \pkg{booktabs}
\emph{after} the notes. Of course, that rule is drawn only if there is really
notes in the tabular. The package \pkg{booktabs} must have been loaded (before
or after the package \pkg{nicematrix}). If it is not, an error is raised.
@@ -4737,9 +4812,9 @@
That key is also available within a given environment.
-\item The key |notes/style| is a command whose argument is specified by |#1|
-and which gives the style of numerotation of the notes. That style will be
-used by |\ref| when referencing a tabular note marked with a command |\label|.
+\item The key \Definition{notes/style} is a command whose argument is specified
+by |#1| and which gives the style of numerotation of the notes. That style will
+be used by |\ref| when referencing a tabular note marked with a command |\label|.
The labels formatted by that style are used, separated by commas, when the user
puts several consecutive commands |\tabularnote|. The marker |#1| is meant to
be the name of a LaTeX counter.
@@ -4748,7 +4823,7 @@
Another possible value should be a mere |\arabic{#1}|
-\item The key |notes/label-in-tabular| is a command whose argument is
+\item The key \Definition{notes/label-in-tabular} is a command whose argument is
specified by |#1| which is used when formatting the label of a note in the
tabular. Internally, this number of note has already been formatted by
|notes/style| before sent to that command.
@@ -4763,10 +4838,10 @@
\end{Verbatim}
-\item The key |notes/label-in-list| is a command whose argument is specified
-by |#1| which is used when formatting the label in the list of notes at the
-end of the tabular. Internally, this number of note has already been formatted by
-|notes/style| before sent to that command.
+\item The key \Definition{notes/label-in-list} is a command whose argument is
+specified by |#1| which is used when formatting the label in the list of notes
+at the end of the tabular. Internally, this number of note has already been
+formatted by |notes/style| before sent to that command.
Initial value: |\textsuperscript{#1}|
@@ -4791,15 +4866,15 @@
table \ref{t:tabularnote}, p.~\pageref{t:tabularnote}).
\medskip
-The key |notes/enumitem-keys| specifies a list of pairs
+The key \Definition{notes/enumitem-keys} specifies a list of pairs
\textsl{key=value} (following the specifications of \pkg{enumitem}) to
customize that style of list (it uses internally the command |\setlist*| of
\pkg{enumitem}).
-\item The key |notes/enumitem-keys-para| is similar to the previous one but
-corresponds to the type of list used when the option |para| is in force. Of
-course, when the option |para| is used, a list of type |inline| (as called by
+\item The key \Definition{notes/enumitem-keys-para} is similar to the previous
+one but corresponds to the type of list used when the option |para| is in force.
+Of course, when the option |para| is used, a list of type |inline| (as called by
\pkg{enumitem}) is used and the pairs \textsl{key=value} should correspond to
such a list of type |inline|.
@@ -4807,8 +4882,8 @@
|afterlabel = \nobreak, itemjoin = \quad|
-\item The key |notes/code-before| is a token list inserted by \pkg{nicematrix}
-just before the composition of the notes at the end of the tabular.
+\item The key \Definition{notes/code-before} is a token list inserted by
+\pkg{nicematrix} just before the composition of the notes at the end of the tabular.
Initial value: \textsl{empty}
@@ -4820,8 +4895,8 @@
It's also possible to add |\raggedright| or |\RaggedRight| in that key (|\RaggedRight|
is a command of \pkg{ragged2e}).
-\item The key |notes/detect-duplicates| activates the detection of the commands
-|\tabularnotes| with the same argument.
+\item The key \Definition{notes/detect-duplicates} activates the detection of
+the commands |\tabularnotes| with the same argument.
Initial value : |true|
\end{itemize}
@@ -4866,8 +4941,8 @@
the part~\ref{corners}, p.~\pageref{corners}.
\smallskip
-The key |rounded-corners| specifies that the tabular should have rounded corners
-with a radius equal to the value of that key (the default value is
+The key \Definition{rounded-corners} specifies that the tabular should have
+rounded corners 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.}). More precisely, that key has two effects that we describe now.
\begin{itemize}
@@ -4916,11 +4991,11 @@
\texttt{\textbackslash CodeBefore})}
-The command |\ShowCellNames|, which may be used in the |\CodeBefore| and in
-the |\CodeAfter| displays the name (with the form $i$-$j$) of each cell. When
-used in the |\CodeAfter|, that command applies a semi-transparent white
-rectangle to fade the array (caution: some \textsc{pdf} readers don't support
-transparency).
+The command \DefinitionCommand{ShowCellNames}, which may be used in the
+|\CodeBefore| and in the |\CodeAfter| displays the name (with the form $i$-$j$)
+of each cell. When used in the |\CodeAfter|, that command applies a
+semi-transparent white rectangle to fade the array (caution: some \textsc{pdf}
+readers don't support transparency).
\medskip
\begin{Code}[width=10.6cm]
@@ -4980,10 +5055,11 @@
The environments without preamble (|{NiceMatrix}|, |{pNiceMatrix}|,
|{bNiceMatrix}|, etc.) and the commande |\pAutoNiceMatrix| (and its variants)
-provide an option |columns-type| to specify the type of column which will be
-used (the initial value is, of course, |c|).
+provide an option \Definition{columns-type} to specify the type of column which
+will be used (the initial value is, of course, |c|).
-The keys |l| and |r| are shortcuts for |columns-type=l| and |columns-type=r|.
+The keys \Definition{l} and \Definition{r} are shortcuts for |columns-type=l|
+and |columns-type=r|.
\medskip
@@ -5008,9 +5084,9 @@
\label{rotate}
\index{rotate@\texttt{\textbackslash rotate}}
-The package \pkg{nicematrix} provides a command |\rotate|. When used in the
-beginning of a cell, this command composes the contents of the cell after a
-rotation of 90° in the direct sens.
+The package \pkg{nicematrix} provides a command \DefinitionCommand{rotate}. When
+used in the beginning of a cell, this command composes the contents of the cell
+after a rotation of 90° in the direct sens.
In the following command, we use that command in the
|code-for-first-row|.\footnote{It can also be used in |\RowStyle|
@@ -5093,10 +5169,10 @@
\index{smallmatrix@\texttt{\{smallmatrix\}} (environment of \pkg{amsmath})}
-With the option |small|, the environments of the package \pkg{nicematrix}
-are composed in a way similar to the environment |{smallmatrix}| of the
-package \pkg{amsmath} (and the environments |{psmallmatrix}|,
-|{bsmallmatrix}|, etc. of the package \pkg{mathtools}).
+With the option \Definition{small}, the environments of the package
+\pkg{nicematrix} are composed in a way similar to the environment
+|{smallmatrix}| of the package \pkg{amsmath} (and the environments
+|{psmallmatrix}|, |{bsmallmatrix}|, etc. of the package \pkg{mathtools}).
\bigskip
\begin{Code}
@@ -5199,8 +5275,9 @@
\indexcommand{BAutoNiceMatrix}
The package \pkg{nicematrix} also provides commands in order to compose
automatically matrices from a general pattern. These commands are
-|\AutoNiceMatrix|, |\pAutoNiceMatrix|, |\bAutoNiceMatrix|, |\vAutoNiceMatrix|,
-|\VAutoNiceMatrix| and |\BAutoNiceMatrix|.
+\DefinitionCommand{AutoNiceMatrix}, \DefinitionCommand{pAutoNiceMatrix},
+\DefinitionCommand{bAutoNiceMatrix}, \DefinitionCommand{vAutoNiceMatrix},
+\DefinitionCommand{VAutoNiceMatrix} et \DefinitionCommand{BAutoNiceMatrix}.
These commands take in two mandatory arguments. The first is the format of the
matrix, with the syntax $n$-$p$ where $n$ is the number of rows and $p$ the
@@ -5215,15 +5292,18 @@
\[C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}\]
+There exists also \DefinitionCommand{AutoNiceArrayWithDelims} similar to
+|{NiceArrayWithDelims}|.
+
\subsection{The key light-syntax}
\label{light-syntax}
\index{light-syntax}
-The option |light-syntax| (inpired by the package \pkg{spalign}) allows the
-user to compose the arrays with a lighter syntax, which gives a better
-legibility of the TeX source.
+The option \Definition{light-syntax} (inpired by the package \pkg{spalign})
+allows the user to compose the arrays with a lighter syntax, which gives a
+better legibility of the TeX source.
When this option is used, one should use the semicolon for the end of a row
and spaces or tabulations to separate the columns. However, as usual in the
@@ -5276,7 +5356,7 @@
For the environments with delimiters (|{pNiceArray}|, |{pNiceMatrix}|, etc.),
it's possible to change the color of the delimiters with the key
-|delimiters/color|.
+\Definition{delimiters/color}.
\medskip
\begin{Code}[width=12cm]
@@ -5329,10 +5409,10 @@
\indexcommand{OnlyMainNiceMatrix}
-The command |\OnlyMainNiceMatrix| executes its argument only when it is in the
-main part of the array, that is to say when it is not in one of the exterior
-rows or one of the exterior columns. If it is used outside an environment of
-\pkg{nicematrix}, that command is no-op.
+The command \DefinitionCommand{OnlyMainNiceMatrix} executes its argument only
+when it is in the main part of the array, that is to say when it is not in one
+of the exterior rows or one of the exterior columns. If it is used outside an
+environment of \pkg{nicematrix}, that command is no-op.
For an example of utilisation, see \url{tex.stackexchange.com/questions/488566}
@@ -5368,8 +5448,8 @@
\medskip
The creation of those nodes needs time and memory. It's possible to desactive
-ponctually the creation of those nodes with the key |no-cell-nodes| in order to
-speed up the compilations.
+ponctually the creation of those nodes with the key \Definition{no-cell-nodes}
+in order to speed up the compilations.
\medskip
The nodes of a document must have distinct names. That's why the names of the
@@ -5382,13 +5462,13 @@
column~$j$ has for name |nm-|$n$|-|$i$|-|$j$.
\smallskip
-The command |\NiceMatrixLastEnv| provides the number of the last environment
-of \pkg{nicematrix} (for LaTeX, it's a ``fully expandable'' command and not a
-counter).
+The command \DefinitionCommand{NiceMatrixLastEnv} provides the number of the
+last environment of \pkg{nicematrix} (for LaTeX, it's a ``fully expandable''
+command and not a counter).
\smallskip
\index{name!key for an environment}
-However, it's advisable to use instead the key |name|\footnote{The value of the
+However, it's advisable to use instead the key \Definition{name}\footnote{The value of the
key |name| is \emph{expanded} (in the TeX sens).}. This key
gives a name to the current environment. When the environment has a name, the
nodes are accessible with the name ``\textsl{name}-$i$-$j$'' where \textsl{name}
@@ -5497,11 +5577,11 @@
\index{pgf-node-code}
\textbf{For the experienced users}, \pkg{nicematrix} provides the key
-|pgf-node-code| which corresponds to some PGF node that will be executed at the
-creation, by PGF, of the nodes corresponding to the cells of the array. More
-pricisely, the value given to the key |pgf-node-code| will be passed in the
-fifth argument of the command |\pgfnode|. That value should contain at least an
-instruction such as |\pgfusepath|, |\pgfusepathqstroke|, |\pgfusepathqfill|,
+\Definition{pgf-node-code} which corresponds to some PGF node that will be
+executed at the creation, by PGF, of the nodes corresponding to the cells of the
+array. More pricisely, the value given to the key |pgf-node-code| will be passed
+in the fifth argument of the command |\pgfnode|. That value should contain at
+least an instruction such as |\pgfusepath|, |\pgfusepathqstroke|, |\pgfusepathqfill|,
etc.
\subsubsection{The columns V of varwidth}
@@ -5552,8 +5632,8 @@
In fact, the package \pkg{nicematrix} can create ``extra nodes'': the ``medium
nodes'' and the ``large nodes''. The first ones
-are created with the option |create-medium-nodes| and the second ones with the
-option |create-large-nodes|.\footnote{There is also an option
+are created with the option \Definition{create-medium-nodes} and the second ones with the
+option \Definition{create-large-nodes}.\footnote{There is also an option
|create-extra-nodes| which is an alias for the conjonction of
|create-medium-nodes| and |create-large-nodes|.}
@@ -5623,8 +5703,8 @@
\index{extra-left-margin}
\index{extra-right-margin}
The ``large nodes'' of the first column and last column may appear too small
-for some usage. That's why it's possible to use the options |left-margin| and
-|right-margin| to add space on both sides of the array and also space in the
+for some usage. That's why it's possible to use the options \Definition{left-margin} and
+\Definition{right-margin} to add space on both sides of the array and also space in the
``large nodes'' of the first column and last column. In the following example,
we have used the options |left-margin| and |right-margin|.\footnote{The
options |left-margin| and |right-margin| take dimensions as values but, if no
@@ -5655,10 +5735,10 @@
\medskip
It's also possible to add more space on both side of the array with the
-options |extra-left-margin| and |extra-right-margin|. These margins are not
-incorporated in the ``large nodes''. It's possible to fix both values with the
-option |extra-margin| and, in the following example, we use |extra-margin|
-with the value $3$~pt.
+options \Definition{extra-left-margin} and \Definition{extra-right-margin}.
+These margins are not incorporated in the ``large nodes''. It's possible to fix
+both values with the option \Definition{extra-margin} and, in the following
+example, we use |extra-margin| with the value $3$~pt.
\[\begin{pNiceMatrix}[create-large-nodes,left-margin,right-margin,extra-right-margin=3pt,extra-left-margin=3pt]
\CodeBefore [create-cell-nodes]
\begin{tikzpicture}
@@ -5763,10 +5843,10 @@
\index{create-cell-nodes (key of \texttt{\textbackslash CodeBefore})}
It's possible to have these nodes available in the |\CodeBefore| by using the
-key |create-cell-nodes| of the keyword |\CodeBefore| (in that case, the nodes
-are created first before the construction of the array by using informations
-written on the |aux| file and created a second time during the contruction of
-the array itself).
+key \Definition{create-cell-nodes} of the keyword |\CodeBefore| (in that case,
+the nodes are created first before the construction of the array by using
+informations written on the |aux| file and created a second time during the
+contruction of the array itself).
\bigskip
Here is an example which uses these nodes in the |\CodeAfter|.
@@ -5824,8 +5904,8 @@
\smallskip
\colorbox{yellow!50}{\bfseries Modification 6.28}\enskip There are also nodes
-called $i$|.1|, $i$|.2|, … , $i$|.9| between the node~$i$ and the node~$i+1$
-(before the version 6.28, there was only the node $i$|.5|).
+called $i$|.1|, $i$|.2|, $i$|.25|, $i$|.3|, $i$|.4|, $i$|.5|, $i$|.6|, $i$|.7|,
+$i$|.75|, $i$|.8| and $i$|.9| between the node~$i$ and the node~$i+1$.
\smallskip
These nodes are available in the |\CodeBefore| and the |\CodeAfter|.
@@ -6129,7 +6209,7 @@
\bigskip
It's possible to turn off the parallelization with the option
-|parallelize-diags| set to |false|: \par\nobreak
+\Definition{parallelize-diags} set to |false|: \par\nobreak
\medskip
\NiceMatrixOptions{parallelize-diags=false}%
@@ -6147,15 +6227,19 @@
It's possible to specify the instruction |\Ddots| which will be drawn first
(and which will be used to draw the other diagonal dotted lines when the
-parallelization is in force) with the key |draw-first|: |\Ddots[draw-first]|.
+parallelization is in force) with the key \Definition{draw-first}:
+|\Ddots[draw-first]|.
\subsection[The empty cells]{The ``empty'' cells}
\label{empty-cells}
-An instruction like |\Ldots|, |\Cdots|, etc. tries to determine the first
-non-empty cell on both sides. When the key |corners| is used
-(cf.~p.~\pageref{corners}), \pkg{nicematrix} computes corners consisting of
-empty cells. However, an ``empty cell'' is not necessarily a cell with no TeX
+The package \pkg{nicematrix} uses, in several circunstancies, the concept of
+``empty cell'. For example, an instruction like |\Ldots|, |\Cdots|, etc. (cf.
+p.~\pageref{Cdots}) tries to determine the first non-empty cell on both sides.
+In the same way, when the key |corners| is used (cf.~p.~\pageref{corners}),
+\pkg{nicematrix} computes corners consisting of empty cells.
+
+However, an ``empty cell'' is not necessarily a cell with no TeX
content (that is to say a cell with no token between the two ampersands~|&|).
The precise rules are as follow.
@@ -6184,8 +6268,8 @@
\medskip
\item \indexcommand{NotEmpty}
-A cell containing the command |\NotEmpty| is not empty (and a PGF/TikZ
-node is created in that cell).
+A cell containing the command |\NotEmpty| is not empty (and a
+PGF/TikZ node is created in that cell).
\medskip
\item A cell with only a command |\Hspace| (or |\Hspace*|) is empty. This
@@ -6217,8 +6301,8 @@
|{NiceArray}| included. However, if the user wants the environment
|{NiceArray}| behaving by default like the environment |{array}| of
\pkg{array} (for example, when adapting an existing document) it's possible to
-control this behaviour with the option |exterior-arraycolsep|, set by the
-command |\NiceMatrixOptions|. With this option, exterior spaces of length
+control this behaviour with the option \Definition{exterior-arraycolsep}, set by
+the command |\NiceMatrixOptions|. With this option, exterior spaces of length
|\arraycolsep| will be inserted in the environments |{NiceArray}| (the other
environments of \pkg{nicematrix} are not affected).
@@ -6232,7 +6316,7 @@
The package \pkg{nicematrix} is not compatible with the class \cls{ieeeaccess}
because that class is not compatible with PGF/TikZ. However, there is a simple
workaround by writing:\footnote{See
- \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}\par\nobreak
+ \url{https://tex.stackexchange.com/questions/528975}}\par\nobreak
\begin{Code}
\let\TeXyear\year
@@ -6894,7 +6978,7 @@
\index{delimiters!---/max-width}
In order the solve that problem, it's possible to require the delimiters to be
composed with the maximal width, thanks to the boolean key
-|delimiters/max-width|.
+\Definition{delimiters/max-width}.
\begin{small}
\begin{Code}
@@ -7031,9 +7115,9 @@
\bigskip
-In fact, it's possible, with the key |vlines-in-sub-matrix|, to choice a
-letter in the preamble of the array to specify vertical rules which will be
-drawn in the |\SubMatrix| only (by adding space between the columns).
+In fact, it's possible, with the key \Definition{vlines-in-sub-matrix}, to
+choice a letter in the preamble of the array to specify vertical rules which
+will be drawn in the |\SubMatrix| only (by adding space between the columns).
\index{vlines-in-sub-matrix}
\medskip
@@ -7468,6 +7552,11 @@
\nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
}
+\subsection*{Changes between version 6.28 and 6.29}
+
+Modification in order to be compatible with the next version of \pkg{array}
+(v. 2.6g).
+
\subsection*{Changes between version 6.27 and 6.28}
Sub-blocks with the character |&| (when the key |ampersand-in-block| is in
Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx 2024-10-24 20:02:39 UTC (rev 72643)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx 2024-10-24 20:02:52 UTC (rev 72644)
@@ -1,4 +1,4 @@
-% \iffalse meta-comment
+% \iffalse meta-comment
%
% This file should be compiled with $lualatex$.
%
@@ -17,8 +17,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.28c}
-\def\myfiledate{2024/08/22}
+\def\myfileversion{6.29}
+\def\myfiledate{2024/10/24}
%
%
%<*batchfile>
@@ -137,8 +137,15 @@
{\myfileversion}
{Enhanced arrays with the help of PGF/TikZ}
% \end{macrocode}
-%
%
+% \begin{macrocode}
+\ProvideDocumentCommand{\IfPackageLoadedT}{mm}
+ {\IfPackageLoadedTF{#1}{#2}{}}
+
+\ProvideDocumentCommand{\IfPackageLoadedF}{mm}
+ {\IfPackageLoadedTF{#1}{}{#2}}
+% \end{macrocode}
+%
% \bigskip
% The command for the treatment of the options of |\usepackage| is at the end of
% this package for technical reasons.
@@ -205,7 +212,7 @@
\bool_gset:Nn \g_@@_messages_for_Overleaf_bool
{
\str_if_eq_p:on \c_sys_jobname_str { _region_ } % for Emacs
- || \str_if_eq_p:on \c_sys_jobname_str { output } % for Overleaf
+ || \str_if_eq_p:ee \c_sys_jobname_str { output } % for Overleaf
}
% \end{macrocode}
%
@@ -240,34 +247,6 @@
% \end{macrocode}
%
% \bigskip
-% \section{Security test}
-%
-% Within the package \pkg{nicematrix}, we will have to test whether a cell of a
-% |{NiceTabular}| is empty. For the cells of the columns of type |p|, |b|, |m|,
-% |X| and |V|, we will test whether the cell is syntactically empty (that is to
-% say that there is only spaces between the ampersands |&|). That test will be
-% done with the command |\@@_test_if_empty:| by testing if the two first tokens
-% in the cells are (during the TeX process) are |\ignorespaces| and |\unskip|.
-%
-% However, if, one day, there is a changement in the implementation of
-% \pkg{array}, maybe that this test will be broken (and \pkg{nicematrix} also).
-%
-% That's why, by security, we will take a test in a small |{tabular}| composed
-% in the box |\l_tmpa_box| used as sandbox.
-%
-% \begin{macrocode}
-\@@_msg_new:nn { Internal~error }
- {
- Potential~problem~when~using~nicematrix.\\
- The~package~nicematrix~have~detected~a~modification~of~the~
- standard~environment~{array}~(of~the~package~array).~Maybe~you~will~encounter~
- some~slight~problems~when~using~nicematrix.~If~you~don't~want~to~see~
- this~message~again,~load~nicematrix~with:~\token_to_str:N
- \usepackage[no-test-for-array]{nicematrix}.
- }
-% \end{macrocode}
-%
-% \bigskip
% \begin{macrocode}
\@@_msg_new:nn { mdwtab~loaded }
{
@@ -275,58 +254,11 @@
This~error~is~fatal.
}
% \end{macrocode}
-%
-% \bigskip
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_security_test:n #1
- {
- \peek_meaning:NTF \ignorespaces
- { \@@_security_test_i:w }
- { \@@_error:n { Internal~error } }
- #1
- }
-% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
-\bool_if:NTF \c_@@_tagging_array_bool
- {
- \cs_new_protected:Npn \@@_security_test_i:w \ignorespaces #1
- {
- \peek_meaning:NF \textonly at unskip { \@@_error:n { Internal~error } }
- #1
- }
- }
- {
- \cs_new_protected:Npn \@@_security_test_i:w \ignorespaces #1
- {
- \peek_meaning:NF \unskip { \@@_error:n { Internal~error } }
- #1
- }
- }
-% \end{macrocode}
-%
-% \bigskip
-% Here, the box |\l_tmpa_box| will be used as sandbox to take our security test.
-% \begin{macrocode}
\hook_gput_code:nnn { begindocument / end } { . }
- {
- \IfPackageLoadedTF { mdwtab }
- { \@@_fatal:n { mdwtab~loaded } }
- {
- \bool_if:NF \g_@@_no_test_for_array_bool
- {
- \group_begin:
- \hbox_set:Nn \l_tmpa_box
- {
- \begin { tabular } { c > { \@@_security_test:n } c c }
- text & & text
- \end { tabular }
- }
- \group_end:
- }
- }
- }
+ { \IfPackageLoadedT { mdwtab } { \@@_fatal:n { mdwtab~loaded } } }
% \end{macrocode}
%
% \bigskip
@@ -399,13 +331,11 @@
\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}
+%
+%
%
+% \bigskip
% 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).
@@ -414,8 +344,15 @@
% \end{macrocode}
%
% \begin{macrocode}
-\cs_generate_variant:Nn \seq_set_split:Nnn { N o n }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N o }
\cs_generate_variant:Nn \str_lowercase:n { o }
+\cs_generate_variant:Nn \str_set:Nn { N o }
+\cs_generate_variant:Nn \tl_build_put_right:Nn { N o }
+\prg_generate_conditional_variant:Nnn \clist_if_in:Nn { N e } { T , F, TF }
+\prg_generate_conditional_variant:Nnn \tl_if_empty:n { e } { T }
+\prg_generate_conditional_variant:Nnn \tl_if_head_eq_meaning:nN { o N } { TF }
+\cs_generate_variant:Nn \dim_min:nn { v }
+\cs_generate_variant:Nn \dim_max:nn { v }
% \end{macrocode}
%
% \medskip
@@ -529,9 +466,8 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { booktabs }
+ \IfPackageLoadedT { booktabs }
{ \iow_now:Nn \@mainaux \nicematrix at redefine@check at rerun }
- { }
}
\cs_set_protected:Npn \nicematrix at redefine@check at rerun
{
@@ -543,6 +479,9 @@
% \begin{macrocode}
\cs_set_protected:Npn \pgfutil at check@rerun ##1 ##2
{
+% \end{macrocode}
+% |\str_if_eq:ee(TF)| is faster than |\str_if_eq:nn(TF)|.
+% \begin{macrocode}
\str_if_eq:eeF { nm- } { \tl_range:nnn { ##1 } 1 3 }
{ \@@_old_pgfutil at check@rerun { ##1 } { ##2 } }
}
@@ -555,8 +494,7 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { colortbl }
- { }
+ \IfPackageLoadedF { colortbl }
{
% \end{macrocode}
% The command |\CT at arc@| is a command of \pkg{colortbl} which sets the color of
@@ -645,6 +583,7 @@
% \textsl{i}.
% \begin{macrocode}
\cs_set:Npn \@@_cline_i:nn #1 #2 { \@@_cline_i:w #1|#2- \q_stop }
+\cs_generate_variant:Nn \@@_cline_i:nn { e }
\cs_set:Npn \@@_cline_i:w #1|#2-#3 \q_stop
{
\tl_if_empty:nTF { #3 }
@@ -675,7 +614,6 @@
{ & \@@_cline_i:en { \int_eval:n { #3 + 1 } } }
{ \everycr { } \cr }
}
-\cs_generate_variant:Nn \@@_cline_i:nn { e n }
% \end{macrocode}
%
%
@@ -688,6 +626,7 @@
%
% \bigskip
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_set_CT at arc@:n { o }
\cs_new_protected:Npn \@@_set_CT at arc@:n #1
{
\tl_if_blank:nF { #1 }
@@ -697,11 +636,11 @@
{ \cs_set_nopar:Npn \CT at arc@ { \color { #1 } } }
}
}
-\cs_generate_variant:Nn \@@_set_CT at arc@:n { o }
% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_set_CT at drsc@:n { o }
\cs_new_protected:Npn \@@_set_CT at drsc@:n #1
{
\tl_if_head_eq_meaning:nNTF { #1 } [
@@ -708,7 +647,6 @@
{ \cs_set_nopar:Npn \CT at drsc@ { \color #1 } }
{ \cs_set_nopar:Npn \CT at drsc@ { \color { #1 } } }
}
-\cs_generate_variant:Nn \@@_set_CT at drsc@:n { o }
% \end{macrocode}
%
% \bigskip
@@ -715,6 +653,7 @@
% The following command must \emph{not} be protected since it will be used to
% write instructions in the (internal) |\CodeBefore|.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_exp_color_arg:Nn { N o }
\cs_new:Npn \@@_exp_color_arg:Nn #1 #2
{
\tl_if_head_eq_meaning:nNTF { #2 } [
@@ -721,14 +660,13 @@
{ #1 #2 }
{ #1 { #2 } }
}
-\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|.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_color:n { o }
\cs_new_protected:Npn \@@_color:n #1
{ \tl_if_blank:nF { #1 } { \@@_exp_color_arg:Nn \color { #1 } } }
-\cs_generate_variant:Nn \@@_color:n { o }
% \end{macrocode}
%
%
@@ -1106,12 +1044,12 @@
% The following command will be able to reconstruct the full name of the current
% command or environment (despite its name which contains \textsl{env}). This
% command must \emph{not} be protected since it will be used in error messages
-% and we have to use |\str_if_eq:onTF| and not |\tl_if_eq:NnTF| because we need
-% to be fully expandable).
+% and we have to use |\str_if_eq:eeTF| and not |\tl_if_eq:eeTF| because we need
+% to be fully expandable). |\str_if_eq:ee(TF)| is faster than |\str_if_eq:nn(TF)|.
% \begin{macrocode}
\cs_new:Npn \@@_full_name_env:
{
- \str_if_eq:onTF \g_@@_com_or_env_str { command }
+ \str_if_eq:eeTF \g_@@_com_or_env_str { command }
{ command \space \c_backslash_str \g_@@_name_env_str }
{ environment \space \{ \g_@@_name_env_str \} }
}
@@ -1360,9 +1298,11 @@
%
% \medskip
% If the user has used the key |corners|, all the cells which are in an (empty)
-% corner will be stored in the following sequence.
+% corner will be stored in the following list. We use a |clist| instead of a
+% |seq| because we will frequently search in that list (and searching in a
+% |clist| is faster than searching in a |seq|).
% \begin{macrocode}
-\seq_new:N \l_@@_corners_cells_seq
+\clist_new:N \l_@@_corners_cells_clist
% \end{macrocode}
%
% \medskip
@@ -1671,6 +1611,9 @@
% \begin{macrocode}
\cs_set_protected:Npn \@@_cut_on_hyphen:w #1-#2\q_stop
{
+% \end{macrocode}
+% Here, we use |\cs_set_nopar:Npn| instead of |\tl_set:Nn| for efficiency only.
+% \begin{macrocode}
\cs_set_nopar:Npn \l_tmpa_tl { #1 }
\cs_set_nopar:Npn \l_tmpb_tl { #2 }
}
@@ -1684,14 +1627,20 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_expand_clist:N #1
{
- \clist_if_in:NVF #1 \c_@@_all_tl
+ \clist_if_in:NnF #1 { all }
{
\clist_clear:N \l_tmpa_clist
\clist_map_inline:Nn #1
{
+% \end{macrocode}
+% We recall thant |\tl_if_in:nnTF| is slightly faster than |\str_if_in:nnTF|.
+% \begin{macrocode}
\tl_if_in:nnTF { ##1 } { - }
{ \@@_cut_on_hyphen:w ##1 \q_stop }
{
+% \end{macrocode}
+% Here, we use |\cs_set_nopar:Npn| instead of |\tl_set:Nn| for efficiency only.
+% \begin{macrocode}
\cs_set_nopar:Npn \l_tmpa_tl { ##1 }
\cs_set_nopar:Npn \l_tmpb_tl { ##1 }
}
@@ -1967,7 +1916,7 @@
\seq_gput_right:Nn \g_@@_notes_seq { { #1 } { #2 } }
\tl_if_novalue:nT { #1 } { \int_gincr:N \c at tabularnote }
}
- \seq_put_right:Nx \l_@@_notes_labels_seq
+ \seq_put_right:Ne \l_@@_notes_labels_seq
{
\tl_if_novalue:nTF { #1 }
{
@@ -2020,8 +1969,8 @@
{ \int_gincr:N \c at tabularnote }
\seq_clear:N \l_@@_notes_labels_seq
\bool_lazy_or:nnTF
- { \tl_if_eq_p:NN \l_@@_hpos_cell_tl \c_@@_c_tl }
- { \tl_if_eq_p:NN \l_@@_hpos_cell_tl \c_@@_r_tl }
+ { \str_if_eq_p:ee \l_@@_hpos_cell_tl { c } }
+ { \str_if_eq_p:ee \l_@@_hpos_cell_tl { r } }
{
\hbox_overlap_right:n { \box_use:N \l_tmpa_box }
% \end{macrocode}
@@ -2083,7 +2032,7 @@
% are not in the first composition, we have to compose that label!
% \begin{macrocode}
\tl_if_novalue:nT { #1 } { \int_gincr:N \c at tabularnote }
- \seq_put_right:Nx \l_@@_notes_labels_seq
+ \seq_put_right:Ne \l_@@_notes_labels_seq
{
\tl_if_novalue:nTF { #1 }
{ \@@_notes_format:n { \int_use:N \c at tabularnote } }
@@ -2668,7 +2617,11 @@
baseline .tl_set:N = \l_@@_baseline_tl ,
baseline .value_required:n = true ,
columns-width .code:n =
- \tl_if_eq:nnTF { #1 } { auto }
+% \end{macrocode}
+% We use |\str_if_eq:nnTF| which is slightly faster than |\tl_if_eq:nnTF| (and
+% is expandable). |\str_if_eq:ee(TF)| is faster than |\str_if_eq:nn(TF)|.
+% \begin{macrocode}
+ \str_if_eq:eeTF { #1 } { auto }
{ \bool_set_true:N \l_@@_auto_columns_width_bool }
{ \dim_set:Nn \l_@@_columns_width_dim { #1 } } ,
columns-width .value_required:n = true ,
@@ -2680,10 +2633,10 @@
% \begin{macrocode}
\legacy_if:nF { measuring@ }
{
- \str_set:Nx \l_tmpa_str { #1 }
- \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str
+ \str_set:Ne \l_tmpa_str { #1 }
+ \seq_if_in:NoTF \g_@@_names_seq \l_tmpa_str
{ \@@_error:nn { Duplicate~name } { #1 } }
- { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str }
+ { \seq_gput_left:No \g_@@_names_seq \l_tmpa_str }
\str_set_eq:NN \l_@@_name_str \l_tmpa_str
} ,
name .value_required:n = true ,
@@ -2718,9 +2671,8 @@
{
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { enumitem }
+ \IfPackageLoadedT { enumitem }
{ \setlist* [ tabularnotes ] { #1 } }
- { }
}
} ,
enumitem-keys .value_required:n = true ,
@@ -2728,9 +2680,8 @@
{
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { enumitem }
+ \IfPackageLoadedT { enumitem }
{ \setlist* [ tabularnotes* ] { #1 } }
- { }
}
} ,
enumitem-keys-para .value_required:n = true ,
@@ -2844,7 +2795,11 @@
% In |\NiceMatrixOptions|, the special value |auto| is not available.
% \begin{macrocode}
columns-width .code:n =
- \tl_if_eq:nnTF { #1 } { auto }
+% \end{macrocode}
+% We use |\str_if_eq:nnTF| which is slightly faster than |\tl_if_eq:nnTF|.
+% |\str_if_eq:ee(TF)| is faster than |\str_if_eq:nn(TF)|.
+% \begin{macrocode}
+ \str_if_eq:eeTF { #1 } { auto }
{ \@@_error:n { Option~auto~for~columns-width } }
{ \dim_set:Nn \l_@@_columns_width_dim { #1 } } ,
% \end{macrocode}
@@ -2944,7 +2899,7 @@
\keys_define:nn { nicematrix / pNiceArray }
{
first-col .code:n = \int_zero:N \l_@@_first_col_int ,
- last-col .code:n = \tl_if_empty:nF {#1}
+ last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
first-row .code:n = \int_zero:N \l_@@_first_row_int ,
@@ -2985,7 +2940,7 @@
short-caption .value_required:n = true ,
label .tl_set:N = \l_@@_label_tl ,
label .value_required:n = true ,
- last-col .code:n = \tl_if_empty:nF {#1}
+ last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
@@ -3074,30 +3029,57 @@
% \end{macrocode}
%
% The following command will be nullified unless there is a first row.
+%
+% Here is a version with the standard syntax of L3.
+% \begin{Verbatim}
+% \cs_new_protected:Npn \@@_tuning_first_row:
+% {
+% \int_if_zero:nT \c at iRow
+% {
+% \int_compare:nNnT \c at jCol > 0
+% {
+% \l_@@_code_for_first_row_tl
+% \xglobal \colorlet { nicematrix-first-row } { . }
+% }
+% }
+% }
+% \end{Verbatim}
+%
+% We will use a version a little more efficient.
% \begin{macrocode}
\cs_new_protected:Npn \@@_tuning_first_row:
{
- \int_if_zero:nT \c at iRow
- {
- \int_compare:nNnT \c at jCol > \c_zero_int
- {
- \l_@@_code_for_first_row_tl
- \xglobal \colorlet { nicematrix-first-row } { . }
- }
- }
+ \if_int_compare:w \c at iRow = \c_zero_int
+ \if_int_compare:w \c at jCol > \c_zero_int
+ \l_@@_code_for_first_row_tl
+ \xglobal \colorlet { nicematrix-first-row } { . }
+ \fi:
+ \fi:
}
% \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{Verbatim}
+% \cs_new_protected:Npn \@@_tuning_last_row:
+% {
+% \int_compare:nNnT \c at iRow = \l_@@_last_row_int
+% {
+% \l_@@_code_for_last_row_tl
+% \xglobal \colorlet { nicematrix-last-row } { . }
+% }
+% }
+% \end{Verbatim}
+%
+% We will use a version a little more efficient.
% \begin{macrocode}
\cs_new_protected:Npn \@@_tuning_last_row:
{
- \int_compare:nNnT \c at iRow = \l_@@_last_row_int
- {
- \l_@@_code_for_last_row_tl
- \xglobal \colorlet { nicematrix-last-row } { . }
- }
+ \if_int_compare:w \c at iRow = \l_@@_last_row_int
+ \l_@@_code_for_last_row_tl
+ \xglobal \colorlet { nicematrix-last-row } { . }
+ \fi:
}
% \end{macrocode}
%
@@ -3160,16 +3142,16 @@
{
\int_if_zero:nTF \c at iRow
{
- \dim_gset:Nn \g_@@_dp_row_zero_dim
- { \dim_max:nn \g_@@_dp_row_zero_dim { \box_dp:N \l_@@_cell_box } }
- \dim_gset:Nn \g_@@_ht_row_zero_dim
- { \dim_max:nn \g_@@_ht_row_zero_dim { \box_ht:N \l_@@_cell_box } }
+ \dim_compare:nNnT { \box_dp:N \l_@@_cell_box } > \g_@@_dp_row_zero_dim
+ { \dim_gset:Nn \g_@@_dp_row_zero_dim { \box_dp:N \l_@@_cell_box } }
+ \dim_compare:nNnT { \box_ht:N \l_@@_cell_box } > \g_@@_ht_row_zero_dim
+ { \dim_gset:Nn \g_@@_ht_row_zero_dim { \box_ht:N \l_@@_cell_box } }
}
{
\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 } }
+ \dim_compare:nNnT { \box_ht:N \l_@@_cell_box } > \g_@@_ht_row_zero_dim
+ { \dim_gset:Nn \g_@@_ht_row_zero_dim { \box_ht:N \l_@@_cell_box } }
}
}
}
@@ -3310,7 +3292,8 @@
{ \box_use_drop:N \l_@@_cell_box }
}
}
- \int_gset:Nn \g_@@_col_total_int { \int_max:nn \g_@@_col_total_int \c at jCol }
+ \int_compare:nNnT \c at jCol > \g_@@_col_total_int
+ { \int_gset_eq:NN \g_@@_col_total_int \c at jCol }
\bool_gset_false:N \g_@@_empty_cell_bool
\bool_gset_false:N \g_@@_not_empty_cell_bool
}
@@ -3484,7 +3467,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_instruction_of_type:nnn #1 #2 #3
{
- \bool_if:nTF { #1 } \tl_gput_left:cx \tl_gput_right:cx
+ \bool_if:nTF { #1 } \tl_gput_left:ce \tl_gput_right:ce
{ g_@@_ #2 _ lines _ tl }
{
\use:c { @@ _ draw _ #2 : nnn }
@@ -3497,7 +3480,8 @@
%
% \bigskip
% \begin{macrocode}
-\cs_new_protected:Npn \@@_array:
+\cs_generate_variant:Nn \@@_array:n { o }
+\cs_new_protected:Npn \@@_array:n
{
% \begin{macrocode}
\dim_set:Nn \col at sep
@@ -3504,7 +3488,7 @@
{ \bool_if:NTF \l_@@_tabular_bool \tabcolsep \arraycolsep }
\dim_compare:nNnTF \l_@@_tabular_width_dim = \c_zero_dim
{ \cs_set_nopar:Npn \@halignto { } }
- { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l_@@_tabular_width_dim } }
+ { \cs_set_nopar:Npe \@halignto { to \dim_use:N \l_@@_tabular_width_dim } }
% \end{macrocode}
% It \pkg{colortbl} is loaded, |\@tabarray| has been redefined to incorporate
% |\CT at start|.
@@ -3513,10 +3497,11 @@
% \end{macrocode}
% |\l_@@_baseline_tl| may have the value |t|, |c| or |b|. However, if the value
% is |b|, we compose the |\array| (of \pkg{array}) with the option |t| and the
-% right translation will be done further. Remark that |\str_if_eq:onTF| is
+% right translation will be done further. Remark that |\str_if_eq:eeTF| is
% fully expandable and we need something fully expandable here.
+% |\str_if_eq:ee(TF)| is faster than |\str_if_eq:nn(TF)|.
% \begin{macrocode}
- [ \str_if_eq:onTF \l_@@_baseline_tl c c t ]
+ [ \str_if_eq:eeTF \l_@@_baseline_tl c c t ]
}
% \end{macrocode}
%
@@ -3606,12 +3591,11 @@
% We don't draw now the rules of the key |hlines| (or |hvlines|) but we reserve the
% vertical space for theses rules (the rules will be drawn by \textsc{pgf}).
% \begin{macrocode}
- \tl_if_empty:NF \l_@@_hlines_clist
+ \clist_if_empty:NF \l_@@_hlines_clist
{
- \tl_if_eq:NNF \l_@@_hlines_clist \c_@@_all_tl
+ \str_if_eq:eeF \l_@@_hlines_clist { all }
{
- \exp_args:NNe
- \clist_if_in:NnT
+ \clist_if_in:NeT
\l_@@_hlines_clist
{ \int_eval:n { \c at iRow + 1 } }
}
@@ -3670,22 +3654,22 @@
%
% \bigskip
% \begin{macrocode}
-\cs_new_protected:Npn \@@_redefine_everycr: { \everycr { \@@_everycr: } }
- \hook_gput_code:nnn { begindocument } { . }
- {
- \IfPackageLoadedTF { colortbl }
- {
- \cs_set_protected:Npn \@@_redefine_everycr:
- {
- \CT at everycr
- {
- \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
- \@@_everycr:
- }
- }
- }
- { }
- }
+\cs_new_protected:Npn \@@_redefine_everycr:
+ { \everycr { \@@_everycr: } }
+\hook_gput_code:nnn { begindocument } { . }
+ {
+ \IfPackageLoadedT { colortbl }
+ {
+ \cs_set_protected:Npn \@@_redefine_everycr:
+ {
+ \CT at everycr
+ {
+ \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
+ \@@_everycr:
+ }
+ }
+ }
+ }
% \end{macrocode}
%
% If \pkg{booktabs} is loaded, we have to patch the macro |\@BTnormal| which is
@@ -3732,7 +3716,38 @@
}
% \end{macrocode}
%
+% \bigskip
+% |#1468| on GitHub (latex2e) exhibits a bug when a command with a last argument
+% which is optional is used in |>{...}| of \pkg{array}.
%
+% In order to solve that problem, a modification is done to the command
+% |\inser at column| in the version 2.6g (2024/10/12) of \pkg{array}. However, with
+% that modification, our command |\@@_test_if_empty:| leads to a bug when the
+% first column of an array is of type |p{...}| and when the first cell of that
+% first column is empty.
+%
+% As a workaround, we will use a slight different version of |\insert at column|.
+%
+%
+% \begin{macrocode}
+\bool_if:NT \c_@@_tagging_array_bool
+ {
+ \cs_new:Npn \@@_insert at column
+ {
+ \UseTaggingSocket{tbl/cell/begin}
+ \the at toks \the \@tempcnta \ignorespaces
+ \@sharp \textonly at unskip
+ \the at toks \the \count@ \relax
+ \UseTaggingSocket{tbl/cell/end}
+ }
+ }
+% \end{macrocode}
+% In the version 2.6g of \pkg{array}, a command |\@protected at firstofone| is
+% added:
+%
+% |\@protected at firstofone { \the at toks \the \@tempcnta \ignorespaces }|
+%
+%
% \bigskip
% The following code |\@@_pre_array_ii:| is used in |{NiceArrayWithDelims}|. It
% exists as a standalone macro only for legibility.
@@ -3741,7 +3756,11 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_pre_array_ii:
{
+ \bool_if:NT \c_@@_tagging_array_bool
+ { \cs_set_eq:NN \insert at column \@@_insert at column }
% \end{macrocode}
+%
+% \bigskip
% The number of letters |X| in the preamble of the array.
% \begin{macrocode}
\int_gzero:N \g_@@_total_X_weight_int
@@ -4002,10 +4021,10 @@
{
\tl_put_right:Nn \@@_update_for_first_and_last_row:
{
- \dim_gset:Nn \g_@@_ht_last_row_dim
- { \dim_max:nn \g_@@_ht_last_row_dim { \box_ht:N \l_@@_cell_box } }
- \dim_gset:Nn \g_@@_dp_last_row_dim
- { \dim_max:nn \g_@@_dp_last_row_dim { \box_dp:N \l_@@_cell_box } }
+ \dim_compare:nNnT \g_@@_ht_last_row_dim < { \box_ht:N \l_@@_cell_box }
+ { \dim_gset:Nn \g_@@_ht_last_row_dim { \box_ht:N \l_@@_cell_box } }
+ \dim_compare:nNnT \g_@@_dp_last_row_dim < { \box_dp:N \l_@@_cell_box }
+ { \dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \l_@@_cell_box } }
}
}
% \end{macrocode}
@@ -4115,7 +4134,7 @@
\tl_set:Nn \l_tmpa_tl { #1 }
\int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
{ \@@_rescan_for_spanish:N \l_tmpa_tl }
- \tl_gput_left:NV \g_@@_pre_code_before_tl \l_tmpa_tl
+ \tl_gput_left:No \g_@@_pre_code_before_tl \l_tmpa_tl
\bool_set_true:N \l_@@_code_before_bool
% \end{macrocode}
% We go on with |\@@_pre_array:| which will (among other) execute the
@@ -4200,7 +4219,7 @@
% \end{macrocode}
%
% \begin{macrocode}
- \IfPackageLoadedTF { tikz }
+ \IfPackageLoadedT { tikz }
{
\tikzset
{
@@ -4208,7 +4227,6 @@
{ overlay , name~prefix = \@@_env: - }
}
}
- { }
\cs_set_eq:NN \cellcolor \@@_cellcolor
\cs_set_eq:NN \rectanglecolor \@@_rectanglecolor
\cs_set_eq:NN \roundedrectanglecolor \@@_roundedrectanglecolor
@@ -4228,6 +4246,16 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_exec_code_before:
{
+% \end{macrocode}
+% We mark the cells which are in the (empty) corners because those cells must
+% not be colored. We should try to find a way to detected whether we actually
+% have coloring instructions to execute...
+% \begin{macrocode}
+ \clist_map_inline:Nn \l_@@_corners_cells_clist
+ { \cs_set_nopar:cpn { @@ _ corner _ ##1 } { } }
+% \end{macrocode}
+%
+% \begin{macrocode}
\seq_gclear_new:N \g_@@_colors_seq
% \end{macrocode}
% The sequence |\g_@@_colors_seq| will always contain as first element the
@@ -4262,7 +4290,7 @@
% of cell nodes in the |\CodeBefore|). That's why we use a |\q_stop|: it
% will be used to discard the rest of |\g_@@_pre_code_before_tl|.
% \begin{macrocode}
- \exp_last_unbraced:NV \@@_CodeBefore_keys:
+ \exp_last_unbraced:No \@@_CodeBefore_keys:
\g_@@_pre_code_before_tl
% \end{macrocode}
% Now, all the cells which are specified to be colored by instructions in the
@@ -4548,7 +4576,7 @@
\tl_if_empty:NF \g_@@_code_before_tl
{
\bool_set_true:N \l_@@_code_before_bool
- \tl_put_right:NV \l_@@_code_before_tl \g_@@_code_before_tl
+ \tl_put_right:No \l_@@_code_before_tl \g_@@_code_before_tl
}
\tl_if_empty:NF \g_@@_pre_code_before_tl
{ \bool_set_true:N \l_@@_code_before_bool }
@@ -4626,7 +4654,7 @@
% \begin{macrocode}
\int_compare:nNnT \g_@@_total_X_weight_int > \c_zero_int
{
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\bool_set_true:N \l_@@_X_columns_aux_bool
\dim_set:Nn \l_@@_X_columns_dim
@@ -4709,10 +4737,10 @@
% \begin{macrocode}
\bool_if:nTF { ! \g_@@_delims_bool }
{
- \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_c_tl
+ \str_if_eq:eeTF \l_@@_baseline_tl { c }
\@@_use_arraybox_with_notes_c:
{
- \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_b_tl
+ \str_if_eq:eeTF \l_@@_baseline_tl { b }
\@@_use_arraybox_with_notes_b:
\@@_use_arraybox_with_notes:
}
@@ -4823,7 +4851,7 @@
% \begin{macrocode}
\iow_now:Nn \@mainaux { \ExplSyntaxOn }
\iow_now:Nn \@mainaux { \char_set_catcode_space:n { 32 } }
- \iow_now:Nx \@mainaux
+ \iow_now:Ne \@mainaux
{
\tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl }
{ \exp_not:o \g_@@_aux_tl }
@@ -4901,7 +4929,7 @@
% Now, we actually make the preamble (which will be given to |{array}|). It will
% be stored in |\g_@@_array_preamble_tl|.
% \begin{macrocode}
- \exp_last_unbraced:NV \@@_rec_preamble:n \g_@@_user_preamble_tl \stop
+ \exp_last_unbraced:No \@@_rec_preamble:n \g_@@_user_preamble_tl \@@_stop:
\int_gset_eq:NN \g_@@_static_num_of_col_int \c at jCol
% \end{macrocode}
%
@@ -4973,7 +5001,7 @@
{
\bool_if:NF \l_@@_tabular_bool
{
- \tl_if_empty:NT \l_@@_vlines_clist
+ \clist_if_empty:NT \l_@@_vlines_clist
{
\bool_if:NF \l_@@_exterior_arraycolsep_bool
{ \tl_gput_left:Nn \g_@@_array_preamble_tl { @ { } } }
@@ -4988,7 +5016,7 @@
{
\bool_if:NF \l_@@_tabular_bool
{
- \tl_if_empty:NT \l_@@_vlines_clist
+ \clist_if_empty:NT \l_@@_vlines_clist
{
\bool_if:NF \l_@@_exterior_arraycolsep_bool
{ \tl_gput_right:Nn \g_@@_array_preamble_tl { @ { } } }
@@ -5035,10 +5063,13 @@
\cs_if_exist:cTF { NC @ find @ #1 }
{
\tl_set_eq:Nc \l_tmpb_tl { NC @ rewrite @ #1 }
- \exp_last_unbraced:NV \@@_rec_preamble:n \l_tmpb_tl
+ \exp_last_unbraced:No \@@_rec_preamble:n \l_tmpb_tl
}
{
- \tl_if_eq:nnT { #1 } { S }
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \str_if_eq:nnTF { #1 } { S }
{ \@@_fatal:n { unknown~column~type~S } }
{ \@@_fatal:nn { unknown~column~type } { #1 } }
}
@@ -5124,7 +5155,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_i_i:n #1
{
- \str_if_eq:nnTF { #1 } |
+ \str_if_eq:nnTF { #1 } { | }
{ \use:c { @@ _ | } | }
{ \@@_make_preamble_i_ii:nn { } #1 }
}
@@ -5133,7 +5164,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_i_ii:nn #1 #2
{
- \str_if_eq:nnTF { #2 } [
+ \str_if_eq:nnTF { #2 } { [ }
{ \@@_make_preamble_i_ii:nw { #1 } [ }
{ \@@_make_preamble_i_iii:nn { #2 } { #1 } }
}
@@ -5145,7 +5176,7 @@
\cs_new_protected:Npn \@@_make_preamble_i_iii:nn #1 #2
{
\@@_compute_rule_width:n { multiplicity = \l_tmpa_int , #2 }
- \tl_gput_right:Nx \g_@@_array_preamble_tl
+ \tl_gput_right:Ne \g_@@_array_preamble_tl
{
% \end{macrocode}
% Here, the command |\dim_eval:n| is mandatory.
@@ -5152,7 +5183,7 @@
% \begin{macrocode}
\exp_not:N ! { \skip_horizontal:n { \dim_eval:n { \l_@@_rule_width_dim } } }
}
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_vline:n
{
@@ -5168,7 +5199,7 @@
% \begin{macrocode}
}
\int_zero:N \l_tmpa_int
- \str_if_eq:nnT { #1 } { \stop } { \bool_gset_true:N \g_tmpb_bool }
+ \str_if_eq:nnT { #1 } { \@@_stop: } { \bool_gset_true:N \g_tmpb_bool }
\@@_rec_preamble:n #1
}
% \end{macrocode}
@@ -5199,31 +5230,7 @@
c .value_forbidden:n = true ,
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_eq:NN \l_@@_hpos_col_str \c_@@_R_str }
- {
- \@@_error_or_warning:n { ragged2e~not~loaded }
- \str_set_eq:NN \l_@@_hpos_col_str \c_@@_r_str
- } ,
- R .value_forbidden:n = true ,
- L .code:n =
- \IfPackageLoadedTF { ragged2e }
- { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_L_stsr }
- {
- \@@_error_or_warning:n { ragged2e~not~loaded }
- \str_set_eq:NN \l_@@_hpos_col_str \c_@@_l_str
- } ,
- L .value_forbidden:n = true ,
- C .code:n =
- \IfPackageLoadedTF { ragged2e }
- { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_C_str }
- {
- \@@_error_or_warning:n { ragged2e~not~loaded }
- \str_set_eq:NN \l_@@_hpos_col_str \c_@@_c_str
- } ,
- C .value_forbidden:n = true ,
- S .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_si_str ,
+ S .code:n = \str_set:Nn \l_@@_hpos_col_str { si } ,
S .value_forbidden:n = true ,
p .code:n = \str_set:Nn \l_@@_vpos_col_str { p } ,
p .value_forbidden:n = true ,
@@ -5231,7 +5238,7 @@
m .code:n = \str_set:Nn \l_@@_vpos_col_str { m } ,
m .value_forbidden:n = true ,
b .code:n = \str_set:Nn \l_@@_vpos_col_str { b } ,
- b .value_forbidden:n = true ,
+ b .value_forbidden:n = true
}
% \end{macrocode}
%
@@ -5279,7 +5286,7 @@
% 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_eq:NN \l_@@_hpos_col_str \c_@@_j_str
+ \str_set:Nn \l_@@_hpos_col_str { j }
\@@_keys_p_column:n { #1 }
\@@_make_preamble_ii_iv:nnn { #2 } { minipage } { }
}
@@ -5300,7 +5307,7 @@
\use:e
{
\@@_make_preamble_ii_v:nnnnnnnn
- { \str_if_eq:onTF \l_@@_vpos_col_str { p } { t } { b } }
+ { \str_if_eq:nnTF \l_@@_vpos_col_str { p } { t } { b } }
{ \dim_eval:n { #1 } }
{
% \end{macrocode}
@@ -5309,26 +5316,37 @@
% 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:NNTF \l_@@_hpos_col_str \c_@@_j_str
+ \str_if_eq:nnTF \l_@@_hpos_col_str { j }
{ \tl_clear:N \exp_not:N \l_@@_hpos_cell_tl }
{
+% \end{macrocode}
+% Here, we use |\cs_set_nopar:Npn| instead of |\tl_set:Nn| for efficiency only.
+% \begin{macrocode}
\cs_set_nopar:Npn \exp_not:N \l_@@_hpos_cell_tl
{ \str_lowercase:o \l_@@_hpos_col_str }
- }
- \str_case:on \l_@@_hpos_col_str
+ }
+ \IfPackageLoadedTF { ragged2e }
{
- c { \exp_not:N \centering }
- l { \exp_not:N \raggedright }
- r { \exp_not:N \raggedleft }
- C { \exp_not:N \Centering }
- L { \exp_not:N \RaggedRight }
- R { \exp_not:N \RaggedLeft }
+ \str_case:on \l_@@_hpos_col_str
+ {
+ c { \exp_not:N \Centering }
+ l { \exp_not:N \RaggedRight }
+ r { \exp_not:N \RaggedLeft }
+ }
}
+ {
+ \str_case:on \l_@@_hpos_col_str
+ {
+ c { \exp_not:N \centering }
+ l { \exp_not:N \raggedright }
+ r { \exp_not:N \raggedleft }
+ }
+ }
#3
}
- { \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: }
+ { \str_if_eq:nnT \l_@@_vpos_col_str { m } \@@_center_cell_box: }
+ { \str_if_eq:nnT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w }
+ { \str_if_eq:nnT \l_@@_hpos_col_str { si } \siunitx_cell_end: }
{ #2 }
{
\str_case:onF \l_@@_hpos_col_str
@@ -5373,14 +5391,20 @@
%
% |#7| is the type of environment: |minipage| or |varwidth|.
%
-% |#8| is the letter |c| or |r| or |l| which is the basic specificier of column
+% |#8| is the letter |c| or |r| or |l| which is the basic specifier of column
% which is used \emph{in fine}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \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: } } }
+ \str_if_eq:eeTF \l_@@_hpos_col_str { si }
+ {
+ \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:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl
\tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_array_preamble_tl
@@ -5443,39 +5467,23 @@
%
% \bigskip
% \begin{macrocode}
-\str_new:N \c_@@_ignorespaces_str
-\str_set:Nx \c_@@_ignorespaces_str { \ignorespaces }
-\str_remove_all:Nn \c_@@_ignorespaces_str { ~ }
\cs_new_protected:Npn \@@_test_if_empty:
- { \peek_after:Nw \@@_test_if_empty_i: }
+ { \peek_after:Nw \@@_test_if_empty_i: }
+
\cs_new_protected:Npn \@@_test_if_empty_i:
- {
- \str_set:Nx \l_tmpa_str { \token_to_meaning:N \l_peek_token }
- \str_if_eq:NNT \l_tmpa_str \c_@@_ignorespaces_str
- { \@@_test_if_empty:w }
- }
-\cs_new_protected:Npn \@@_test_if_empty:w \ignorespaces
- { \peek_after:Nw \@@_test_if_empty_ii: }
+ { \peek_meaning_remove:NT \ignorespaces { \@@_test_if_empty_ii: } }
+
+\cs_new_protected:Npn \@@_test_if_empty_ii:
+ { \peek_after:Nw \@@_test_if_empty_iii: }
% \end{macrocode}
%
-% \bigskip
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_nullify_cell:
- {
- \tl_gput_right:Nn \g_@@_cell_after_hook_tl
- {
- \box_set_wd:Nn \l_@@_cell_box \c_zero_dim
- \skip_horizontal:N \l_@@_col_width_dim
- }
- }
-% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
\bool_if:NTF \c_@@_tagging_array_bool
{
- \cs_new_protected:Npn \@@_test_if_empty_ii:
- { \peek_meaning:NT \textonly at unskip \@@_nullify_cell: }
+ \cs_new_protected:Npn \@@_test_if_empty_iii:
+ { \peek_meaning:NTF \textonly at unskip \@@_nullify_cell: \ignorespaces }
}
% \end{macrocode}
% In the old version of \pkg{array}, we test whether it begins by
@@ -5485,11 +5493,23 @@
% First, we test if the next token is |\ignorespaces| and it's not very easy...
% \begin{macrocode}
{
- \cs_new_protected:Npn \@@_test_if_empty_ii:
- { \peek_meaning:NT \unskip \@@_nullify_cell: }
+ \cs_new_protected:Npn \@@_test_if_empty_iii:
+ { \peek_meaning:NTF \unskip \@@_nullify_cell: \ignorespaces }
}
% \end{macrocode}
%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_nullify_cell:
+ {
+ \tl_gput_right:Nn \g_@@_cell_after_hook_tl
+ {
+ \box_set_wd:Nn \l_@@_cell_box \c_zero_dim
+ \skip_horizontal:N \l_@@_col_width_dim
+ }
+ }
+% \end{macrocode}
+%
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_empty_for_S:
@@ -5534,7 +5554,7 @@
\box_move_down:nn
{
( \box_ht:N \l_@@_cell_box - \box_ht:N \@arstrutbox
- + \baselineskip ) / 2
+ + \baselineskip ) / 2
}
{ \box_use:N \l_@@_cell_box }
}
@@ -5548,7 +5568,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_V #1 #2
{
- \str_if_eq:nnTF { #2 } { [ }
+ \str_if_eq:nnTF { #1 } { [ }
{ \@@_make_preamble_V_i:w [ }
{ \@@_make_preamble_V_i:w [ ] { #2 } }
}
@@ -5557,7 +5577,7 @@
\cs_new_protected:Npn \@@_make_preamble_V_ii:nn #1 #2
{
\str_set:Nn \l_@@_vpos_col_str { p }
- \str_set_eq:NN \l_@@_hpos_col_str \c_@@_j_str
+ \str_set:Nn \l_@@_hpos_col_str { j }
\@@_keys_p_column:n { #1 }
\IfPackageLoadedTF { varwidth }
{ \@@_make_preamble_ii_iv:nnn { #2 } { varwidth } { } }
@@ -5676,7 +5696,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_S #1 #2
{
- \str_if_eq:nnTF { #2 } { [ }
+ \str_if_eq:nnTF { #1 } { [ }
{ \@@_make_preamble_S:w [ }
{ \@@_make_preamble_S:w [ ] { #2 } }
}
@@ -5690,27 +5710,24 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_S_i:n #1
{
- \IfPackageLoadedTF { siunitx }
+ \IfPackageLoadedF { siunitx } { \@@_fatal:n { siunitx~not~loaded } }
+ \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
{
- \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
- \keys_set:nn { siunitx } { #1 }
- \siunitx_cell_begin:w
- }
- c
- < { \siunitx_cell_end: \@@_cell_end: }
+ > {
+ \@@_cell_begin:w
+ \keys_set:nn { siunitx } { #1 }
+ \siunitx_cell_begin:w
}
+ c
+ < { \siunitx_cell_end: \@@_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
- }
- { \@@_fatal:n { siunitx~not~loaded } }
+ \int_gincr:N \c at jCol
+ \@@_rec_preamble_after_col:n
}
% \end{macrocode}
%
@@ -5751,7 +5768,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_iv:nn #1 #2
{
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_eval:n { \c at jCol + 1 } } \c_true_bool }
\tl_if_in:nnTF { ( [ \{ ) ] \} \left \right } { #2 }
{
@@ -5781,13 +5798,13 @@
\tl_if_in:nnTF { ) ] \} } { #2 }
{ \@@_make_preamble_v:nnn #1 #2 }
{
- \tl_if_eq:nnTF { \stop } { #2 }
+ \str_if_eq:nnTF { \@@_stop: } { #2 }
{
\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 } }
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\@@_rec_preamble:n #2
}
@@ -5795,7 +5812,7 @@
{
\tl_if_in:nnT { ( [ \{ \left } { #2 }
{ \tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \enskip } } }
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\@@_rec_preamble:n #2
}
@@ -5808,24 +5825,24 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_v:nnn #1 #2 #3
{
- \tl_if_eq:nnTF { \stop } { #3 }
+ \str_if_eq:nnTF { \@@_stop: } { #3 }
{
\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
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\tl_gset:Nn \g_@@_right_delim_tl { #2 }
}
{
\tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\@@_error:nn { double~closing~delimiter } { #2 }
}
}
{
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\@@_error:nn { double~closing~delimiter } { #2 }
\@@_rec_preamble:n #3
@@ -5836,7 +5853,7 @@
% \medskip
% \begin{macrocode}
\cs_new:cpn { @@ _ \token_to_str:N \right } #1
- { \use:c { @@ _ \token_to_str:N ) } }
+ { \use:c { @@ _ \token_to_str:N ) } }
% \end{macrocode}
%
%
@@ -5847,7 +5864,7 @@
% also to test whether there is, after the |<{...}|, a |@{...}|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_rec_preamble_after_col:n #1
- {
+ {
\str_if_eq:nnTF { #1 } { < }
\@@_rec_preamble_after_col_i:n
{
@@ -5854,19 +5871,19 @@
\str_if_eq:nnTF { #1 } { @ }
\@@_rec_preamble_after_col_ii:n
{
- \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl
+ \str_if_eq:nnTF \l_@@_vlines_clist { all }
{
\tl_gput_right:Nn \g_@@_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
}
{
- \exp_args:NNe
- \clist_if_in:NnT \l_@@_vlines_clist { \int_eval:n { \c at jCol + 1 } }
+ \clist_if_in:NeT \l_@@_vlines_clist
+ { \int_eval:n { \c at jCol + 1 } }
{
\tl_gput_right:Nn \g_@@_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
}
- }
+ }
\@@_rec_preamble:n { #1 }
}
}
@@ -5893,8 +5910,7 @@
{ @ { #1 \skip_horizontal:N \arrayrulewidth } }
}
{
- \exp_args:NNe
- \clist_if_in:NnTF \l_@@_vlines_clist { \int_eval:n { \c at jCol + 1 } }
+ \clist_if_in:NeTF \l_@@_vlines_clist { \int_eval:n { \c at jCol + 1 } }
{
\tl_gput_right:Nn \g_@@_array_preamble_tl
{ @ { #1 \skip_horizontal:N \arrayrulewidth } }
@@ -5999,7 +6015,6 @@
% \begin{macrocode}
\bool_if:NTF \l_@@_X_columns_aux_bool
{
- \exp_args:Nne
\@@_make_preamble_ii_iv:nnn
{ \l_@@_weight_int \l_@@_X_columns_dim }
{ minipage }
@@ -6056,9 +6071,9 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_preamble_vlism:n #1
{
- \seq_gput_right:Nx \g_@@_cols_vlism_seq
+ \seq_gput_right:Ne \g_@@_cols_vlism_seq
{ \int_eval:n { \c at jCol + 1 } }
- \tl_gput_right:Nx \g_@@_array_preamble_tl
+ \tl_gput_right:Ne \g_@@_array_preamble_tl
{ \exp_not:N ! { \skip_horizontal:N \arrayrulewidth } }
\@@_rec_preamble:n
}
@@ -6065,10 +6080,10 @@
% \end{macrocode}
%
% \medskip
-% The token |\stop| is a marker that we have inserted to mark the end of the
+% The token |\@@_stop:| is a marker that we have inserted to mark the end of the
% preamble (as provided by the final user) that we have inserted in the TeX flow.
% \begin{macrocode}
-\cs_set_eq:cN { @@ _ \token_to_str:N \stop } \use_none:n
+\cs_set_eq:cN { @@ _ \token_to_str:N \@@_stop: } \use_none:n
% \end{macrocode}
%
% \medskip
@@ -6131,10 +6146,10 @@
% \begin{macrocode}
\int_compare:nNnT { #1 } > \c_one_int
{
- \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
+ \seq_gput_left:Ne \g_@@_multicolumn_cells_seq
{ \int_use:N \c at iRow - \int_eval:n { \c at jCol + 1 } }
\seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 }
- \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
+ \seq_gput_right:Ne \g_@@_pos_of_blocks_seq
{
{
\int_if_zero:nTF \c at jCol
@@ -6160,7 +6175,7 @@
\RenewDocumentCommand \cellcolor { O { } m }
{
\@@_test_color_inside:
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
\@@_rectanglecolor [ ##1 ]
{ \exp_not:n { ##2 } }
@@ -6220,7 +6235,10 @@
\exp_last_unbraced:No \@@_make_m_preamble:n \l_tmpa_tl
}
{
- \tl_if_eq:nnT { #1 } { S }
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \str_if_eq:nnTF { #1 } { S }
{ \@@_fatal:n { unknown~column~type~S } }
{ \@@_fatal:nn { unknown~column~type } { #1 } }
}
@@ -6332,7 +6350,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_make_m_preamble_x:n #1
{
- \str_if_eq:nnTF { #1 } { < }
+ \str_if_eq:nnTF { #1 } { < }
\@@_make_m_preamble_ix:n
{ \@@_make_m_preamble:n { #1 } }
}
@@ -6360,7 +6378,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_@@_baseline_tl \c_@@_c_tl
+ \str_if_eq:eeTF \l_@@_baseline_tl { c }
{ \box_use_drop:N \l_tmpa_box }
\@@_put_box_in_flow_i:
}
@@ -6397,10 +6415,10 @@
\@@_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \tl_if_eq:NnTF \l_@@_baseline_tl { t }
+ \str_if_eq:onTF \l_@@_baseline_tl { t }
{ \int_set_eq:NN \l_tmpa_int \c_one_int }
{
- \tl_if_eq:NnTF \l_@@_baseline_tl { b }
+ \str_if_eq:onTF \l_@@_baseline_tl { b }
{ \int_set_eq:NN \l_tmpa_int \c at iRow }
{ \int_set:Nn \l_tmpa_int \l_@@_baseline_tl }
}
@@ -6470,7 +6488,7 @@
% \begin{macrocode}
\int_compare:nNnT \g_@@_notes_caption_int > \c_zero_int
{
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\tl_set:Nn \exp_not:N \l_@@_note_in_caption_tl
{ \int_use:N \g_@@_notes_caption_int }
@@ -6545,9 +6563,8 @@
% |\@makecaption| has been stored by \pkg{floatrow} in |\FR at makecaption|. That's
% why we restore the old version.
% \begin{macrocode}
- \IfPackageLoadedTF { floatrow }
+ \IfPackageLoadedT { floatrow }
{ \cs_set_eq:NN \@makecaption \FR at makecaption }
- { }
\tl_if_empty:NTF \l_@@_short_caption_tl
{ \caption }
{ \caption [ \l_@@_short_caption_tl ] }
@@ -6706,7 +6723,7 @@
\pgfpicture
\@@_qpoint:n { row - 1 }
\dim_gset_eq:NN \g_tmpa_dim \pgf at y
- \str_if_in:NnTF \l_@@_baseline_tl { line- }
+ \tl_if_in:NnTF \l_@@_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
@@ -6821,7 +6838,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:No \@@_array: \g_@@_array_preamble_tl
+ \@@_array:o \g_@@_array_preamble_tl
}
}
}
@@ -6844,14 +6861,12 @@
% course, this test is more easy than the similar test for the ``normal syntax''
% because we have the whole body of the environment in |#1|.
% \begin{macrocode}
- \tl_if_empty:nT { #1 } { \@@_fatal:n { empty~environment } }
- \tl_map_inline:nn { #1 }
- {
- \str_if_eq:nnT { ##1 } { & }
- { \@@_fatal:n { ampersand~in~light-syntax } }
- \str_if_eq:nnT { ##1 } { \\ }
- { \@@_fatal:n { double-backslash~in~light-syntax } }
- }
+ \tl_if_empty:nT { #1 }
+ { \@@_fatal:n { empty~environment } }
+ \tl_if_in:nnT { #1 } { & }
+ { \@@_fatal:n { ampersand~in~light-syntax } }
+ \tl_if_in:nnT { #1 } { \\ }
+ { \@@_fatal:n { double-backslash~in~light-syntax } }
% \end{macrocode}
% Now, you extract the |\CodeAfter| of the body of the environment. Maybe, there
% is no command |\CodeAfter| in the body. That's why you put a marker
@@ -6958,11 +6973,12 @@
% |\@@_array:| because of compatibility with the classes \cls{revtex4-1} and
% \cls{revtex4-2}).
% \begin{macrocode}
- \exp_args:No \@@_array: \g_@@_array_preamble_tl \l_@@_new_body_tl
+ \@@_array:o \g_@@_array_preamble_tl \l_@@_new_body_tl
}
% \end{macrocode}
%
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_line_with_light_syntax:n { o }
\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
{
\seq_clear_new:N \l_@@_cells_seq
@@ -6974,11 +6990,10 @@
{ \seq_count:N \l_@@_cells_seq }
}
\seq_pop_left:NN \l_@@_cells_seq \l_tmpa_tl
- \exp_args:NNo \tl_build_put_right:Nn \l_@@_new_body_tl \l_tmpa_tl
+ \tl_build_put_right:No \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 { o }
% \end{macrocode}
%
%
@@ -6989,7 +7004,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2
{
- \str_if_eq:onT \g_@@_name_env_str { #2 }
+ \str_if_eq:eeT \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
@@ -7461,6 +7476,7 @@
%
%
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_begin_of_NiceMatrix:nn { n o }
\cs_new_protected:Npn \@@_begin_of_NiceMatrix:nn #1 #2
{
\bool_set_false:N \l_@@_preamble_bool
@@ -7489,9 +7505,6 @@
}
% \end{macrocode}
%
-% \begin{macrocode}
-\cs_generate_variant:Nn \@@_begin_of_NiceMatrix:nn { n V }
-% \end{macrocode}
%
% \begin{macrocode}
\clist_map_inline:nn { p , b , B , v , V }
@@ -7506,7 +7519,7 @@
\int_set:Nn \l_@@_last_col_int { -1 }
}
\keys_set:nn { nicematrix / NiceMatrix } { ##1 }
- \@@_begin_of_NiceMatrix:nV { #1 } \l_@@_columns_type_tl
+ \@@_begin_of_NiceMatrix:no { #1 } \l_@@_columns_type_tl
}
{ \use:c { end #1 NiceArray } }
}
@@ -7528,7 +7541,7 @@
{ \clist_if_empty_p:N \l_@@_vlines_clist }
{ \l_@@_except_borders_bool }
{ \bool_set_true:N \l_@@_NiceMatrix_without_vlines_bool }
- \@@_begin_of_NiceMatrix:nV { } \l_@@_columns_type_tl
+ \@@_begin_of_NiceMatrix:no { } \l_@@_columns_type_tl
}
{ \endNiceArray }
% \end{macrocode}
@@ -7710,7 +7723,7 @@
%
% \medskip
% \begin{macrocode}
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\seq_gset_from_clist:Nn \exp_not:N \g_@@_size_seq
{
@@ -7729,7 +7742,7 @@
% \begin{macrocode}
\seq_if_empty:NF \g_@@_pos_of_blocks_seq
{
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\seq_gset_from_clist:Nn \exp_not:N \g_@@_pos_of_blocks_seq
{ \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , }
@@ -7737,7 +7750,7 @@
}
\seq_if_empty:NF \g_@@_multicolumn_cells_seq
{
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_cells_seq
{ \seq_use:Nnnn \g_@@_multicolumn_cells_seq , , , }
@@ -7851,14 +7864,15 @@
% \begin{macrocode}
\@@_draw_dotted_lines:
% \end{macrocode}
+%
%
% \bigskip
% The following computes the ``corners'' (made up of empty cells) but if there
% is no corner to compute, it won't do anything. The corners are computed
-% in |\l_@@_corners_cells_seq| which will contain all the cells which are empty
+% in |\l_@@_corners_cells_clist| which will contain all the cells which are empty
% (and not in a block) considered in the corners of the array.
% \begin{macrocode}
- \@@_compute_corners:
+ \clist_if_empty:NF \l_@@_corners_clist \@@_compute_corners:
% \end{macrocode}
%
% \bigskip
@@ -7870,14 +7884,14 @@
%
% \begin{macrocode}
\@@_deal_with_rounded_corners:
- \tl_if_empty:NF \l_@@_hlines_clist \@@_draw_hlines:
- \tl_if_empty:NF \l_@@_vlines_clist \@@_draw_vlines:
+ \clist_if_empty:NF \l_@@_hlines_clist \@@_draw_hlines:
+ \clist_if_empty:NF \l_@@_vlines_clist \@@_draw_vlines:
% \end{macrocode}
%
% \bigskip
% Now, the pre-code-after and then, the |\CodeAfter|.
% \begin{macrocode}
- \IfPackageLoadedTF { tikz }
+ \IfPackageLoadedT { tikz }
{
\tikzset
{
@@ -7889,7 +7903,6 @@
}
}
}
- { }
\bool_if:NT \c_@@_tagging_array_bool
{ \cs_set_eq:NN \ar at ialign \@@_old_ar at ialign: }
\cs_set_eq:NN \SubMatrix \@@_SubMatrix
@@ -7921,8 +7934,8 @@
% activated and Tikz is not able to solve the problem (even with the Tikz
% library \pkg{babel}).
% \begin{macrocode}
- % \int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
- % { \@@_rescan_for_spanish:N \g_nicematrix_code_after_tl }
+ \int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
+ { \@@_rescan_for_spanish:N \g_nicematrix_code_after_tl }
% \end{macrocode}
% \medskip
% And here's the |\CodeAfter|. Since the |\CodeAfter| may begin with an
@@ -7946,7 +7959,7 @@
\seq_if_empty:NF \g_@@_rowlistcolors_seq { \@@_clear_rowlistcolors_seq: }
\tl_if_empty:NF \g_@@_pre_code_before_tl
{
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\tl_gset:Nn \exp_not:N \g_@@_pre_code_before_tl
{ \exp_not:o \g_@@_pre_code_before_tl }
@@ -7955,7 +7968,7 @@
}
\tl_if_empty:NF \g_nicematrix_code_before_tl
{
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
\tl_gset:Nn \exp_not:N \g_@@_code_before_tl
{ \exp_not:o \g_nicematrix_code_before_tl }
@@ -8006,7 +8019,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_adjust_pos_of_blocks_seq:
{
- \seq_gset_map_x:NNn \g_@@_pos_of_blocks_seq \g_@@_pos_of_blocks_seq
+ \seq_gset_map_e:NNn \g_@@_pos_of_blocks_seq \g_@@_pos_of_blocks_seq
{ \@@_adjust_pos_of_blocks_seq_i:nnnnn ##1 }
}
% \end{macrocode}
@@ -8040,7 +8053,7 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \cs_new_protected:Npx \@@_draw_dotted_lines:
+ \cs_new_protected:Npe \@@_draw_dotted_lines:
{
\c_@@_pgfortikzpicture_tl
\@@_draw_dotted_lines_i:
@@ -8087,14 +8100,16 @@
}
\anchor { 5 } { \five }
\anchor { center } { \pgfpointorigin }
- \anchor { 1 } { \five \pgf at x = 0.2 \pgf at x \pgf at y = 0.2 \pgf at y }
- \anchor { 2 } { \five \pgf at x = 0.4 \pgf at x \pgf at y = 0.4 \pgf at y }
- \anchor { 3 } { \five \pgf at x = 0.6 \pgf at x \pgf at y = 0.6 \pgf at y }
- \anchor { 4 } { \five \pgf at x = 0.8 \pgf at x \pgf at y = 0.8 \pgf at y }
- \anchor { 6 } { \five \pgf at x = 1.2 \pgf at x \pgf at y = 1.2 \pgf at y }
- \anchor { 7 } { \five \pgf at x = 1.4 \pgf at x \pgf at y = 1.4 \pgf at y }
- \anchor { 8 } { \five \pgf at x = 1.6 \pgf at x \pgf at y = 1.6 \pgf at y }
- \anchor { 9 } { \five \pgf at x = 1.8 \pgf at x \pgf at y = 1.8 \pgf at y }
+ \anchor { 1 } { \five \pgf at x = 0.2 \pgf at x \pgf at y = 0.2 \pgf at y }
+ \anchor { 2 } { \five \pgf at x = 0.4 \pgf at x \pgf at y = 0.4 \pgf at y }
+ \anchor { 25 } { \five \pgf at x = 0.5 \pgf at x \pgf at y = 0.5 \pgf at y }
+ \anchor { 3 } { \five \pgf at x = 0.6 \pgf at x \pgf at y = 0.6 \pgf at y }
+ \anchor { 4 } { \five \pgf at x = 0.8 \pgf at x \pgf at y = 0.8 \pgf at y }
+ \anchor { 6 } { \five \pgf at x = 1.2 \pgf at x \pgf at y = 1.2 \pgf at y }
+ \anchor { 7 } { \five \pgf at x = 1.4 \pgf at x \pgf at y = 1.4 \pgf at y }
+ \anchor { 75 } { \five \pgf at x = 1.5 \pgf at x \pgf at y = 1.5 \pgf at y }
+ \anchor { 8 } { \five \pgf at x = 1.6 \pgf at x \pgf at y = 1.6 \pgf at y }
+ \anchor { 9 } { \five \pgf at x = 1.8 \pgf at x \pgf at y = 1.8 \pgf at y }
}
% \end{macrocode}
%
@@ -8200,7 +8215,7 @@
% First, we declare the current cell as ``dotted'' because we forbide
% intersections of dotted lines.
% \begin{macrocode}
- \cs_set:cpn { @@ _ dotted _ #1 - #2 } { }
+ \cs_set_nopar:cpn { @@ _ dotted _ #1 - #2 } { }
% \end{macrocode}
% Initialization of variables.
% \begin{macrocode}
@@ -8219,33 +8234,36 @@
{
\int_add:Nn \l_@@_final_i_int { #3 }
\int_add:Nn \l_@@_final_j_int { #4 }
+ \bool_set_false:N \l_@@_final_open_bool
% \end{macrocode}
-% We test if we are still in the matrix.
+%
+% We test if we are still in the matrix. Since this is the core of the loop, we
+% \textbf{optimize} the code by using a TeX-style of conditionals.
% \begin{macrocode}
- \bool_set_false:N \l_@@_final_open_bool
- \int_compare:nNnTF \l_@@_final_i_int > \l_@@_row_max_int
- {
- \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
- { \bool_set_true:N \l_@@_final_open_bool }
- }
- }
- {
- \int_compare:nNnTF \l_@@_final_j_int < \l_@@_col_min_int
- {
- \int_compare:nNnT { #4 } = { -1 }
- { \bool_set_true:N \l_@@_final_open_bool }
- }
- {
- \int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int
- {
- \int_compare:nNnT { #4 } = \c_one_int
- { \bool_set_true:N \l_@@_final_open_bool }
- }
- }
- }
+ \if_int_compare:w \l_@@_final_i_int > \l_@@_row_max_int
+ \if_int_compare:w #3 = \c_one_int
+ \bool_set_true:N \l_@@_final_open_bool
+ \else:
+ \if_int_compare:w \l_@@_final_j_int > \l_@@_col_max_int
+ \bool_set_true:N \l_@@_final_open_bool
+ \fi:
+ \fi:
+ \else:
+ \if_int_compare:w \l_@@_final_j_int < \l_@@_col_min_int
+ \if_int_compare:w #4 = -1
+ \bool_set_true:N \l_@@_final_open_bool
+ \fi:
+ \else:
+ \if_int_compare:w \l_@@_final_j_int > \l_@@_col_max_int
+ \if_int_compare:w #4 = \c_one_int
+ \bool_set_true:N \l_@@_final_open_bool
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+% \end{macrocode}
+%
+% \begin{macrocode}
\bool_if:NTF \l_@@_final_open_bool
% \end{macrocode}
% If we are outside the matrix, we have found the extremity of the dotted line
@@ -8295,7 +8313,7 @@
% drawn in a TeX group that we will open for the options of the line.
% \begin{macrocode}
{
- \cs_set:cpn
+ \cs_set_nopar:cpn
{
@@ _ dotted _
\int_use:N \l_@@_final_i_int -
@@ -8313,34 +8331,49 @@
% similar to the previous one.
% \begin{macrocode}
\bool_set_false:N \l_@@_stop_loop_bool
+% \end{macrocode}
+% The following line of code is only for efficiency in the following loop.
+% \begin{macrocode}
+ \int_set:Nn \l_tmpa_int { \l_@@_col_min_int - 1 }
+% \end{macrocode}
+% \begin{macrocode}
\bool_do_until:Nn \l_@@_stop_loop_bool
{
\int_sub:Nn \l_@@_initial_i_int { #3 }
\int_sub:Nn \l_@@_initial_j_int { #4 }
\bool_set_false:N \l_@@_initial_open_bool
- \int_compare:nNnTF \l_@@_initial_i_int < \l_@@_row_min_int
- {
- \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 }
- { \bool_set_true:N \l_@@_initial_open_bool }
- }
- }
- {
- \int_compare:nNnTF \l_@@_initial_j_int < \l_@@_col_min_int
- {
- \int_compare:nNnT { #4 } = \c_one_int
- { \bool_set_true:N \l_@@_initial_open_bool }
- }
- {
- \int_compare:nNnT \l_@@_initial_j_int > \l_@@_col_max_int
- {
- \int_compare:nNnT { #4 } = { -1 }
- { \bool_set_true:N \l_@@_initial_open_bool }
- }
- }
- }
+% \end{macrocode}
+%
+% We test if we are still in the matrix. Since this is the core of the loop, we
+% \textbf{optimize} the code by using a TeX-style of conditionals.
+% \begin{macrocode}
+ \if_int_compare:w \l_@@_initial_i_int < \l_@@_row_min_int
+ \if_int_compare:w #3 = \c_one_int
+ \bool_set_true:N \l_@@_initial_open_bool
+ \else:
+% \end{macrocode}
+% |\l_tmpa_int| contains |\l_@@_col_min_int - 1| (only for efficiency).
+% \begin{macrocode}
+ \if_int_compare:w \l_@@_initial_j_int = \l_tmpa_int
+ \bool_set_true:N \l_@@_initial_open_bool
+ \fi:
+ \fi:
+ \else:
+ \if_int_compare:w \l_@@_initial_j_int < \l_@@_col_min_int
+ \if_int_compare:w #4 = \c_one_int
+ \bool_set_true:N \l_@@_initial_open_bool
+ \fi:
+ \else:
+ \if_int_compare:w \l_@@_initial_j_int > \l_@@_col_max_int
+ \if_int_compare:w #4 = -1
+ \bool_set_true:N \l_@@_initial_open_bool
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+% \end{macrocode}
+%
+% \begin{macrocode}
\bool_if:NTF \l_@@_initial_open_bool
{
\int_add:Nn \l_@@_initial_i_int { #3 }
@@ -8369,7 +8402,7 @@
}
{ \bool_set_true:N \l_@@_stop_loop_bool }
{
- \cs_set:cpn
+ \cs_set_nopar:cpn
{
@@ _ dotted _
\int_use:N \l_@@_initial_i_int -
@@ -8385,7 +8418,7 @@
% the corresponding virtual ``block'' when drawing the horizontal and vertical
% rules.
% \begin{macrocode}
- \seq_gput_right:Nx \g_@@_pos_of_xdots_seq
+ \seq_gput_right:Ne \g_@@_pos_of_xdots_seq
{
{ \int_use:N \l_@@_initial_i_int }
% \end{macrocode}
@@ -8413,9 +8446,9 @@
\cs_new_protected:Npn \@@_open_shorten:
{
\bool_if:NT \l_@@_initial_open_bool
- { \dim_zero:N \l_@@_xdots_shorten_start_dim }
+ { \dim_zero:N \l_@@_xdots_shorten_start_dim }
\bool_if:NT \l_@@_final_open_bool
- { \dim_zero:N \l_@@_xdots_shorten_end_dim }
+ { \dim_zero:N \l_@@_xdots_shorten_end_dim }
}
% \end{macrocode}
%
@@ -8428,8 +8461,8 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_adjust_to_submatrix:nn #1 #2
{
- \int_set:Nn \l_@@_row_min_int 1
- \int_set:Nn \l_@@_col_min_int 1
+ \int_set_eq:NN \l_@@_row_min_int \c_one_int
+ \int_set_eq:NN \l_@@_col_min_int \c_one_int
\int_set_eq:NN \l_@@_row_max_int \c at iRow
\int_set_eq:NN \l_@@_col_max_int \c at jCol
% \end{macrocode}
@@ -8436,8 +8469,11 @@
% We do a loop over all the submatrices specified in the |code-before|. We have
% stored the position of all those submatrices in |\g_@@_submatrix_seq|.
% \begin{macrocode}
- \seq_map_inline:Nn \g_@@_submatrix_seq
- { \@@_adjust_to_submatrix:nnnnnn { #1 } { #2 } ##1 }
+ \seq_if_empty:NF \g_@@_submatrix_seq
+ {
+ \seq_map_inline:Nn \g_@@_submatrix_seq
+ { \@@_adjust_to_submatrix:nnnnnn { #1 } { #2 } ##1 }
+ }
}
% \end{macrocode}
%
@@ -8445,29 +8481,48 @@
% |#1| and |#2| are the numbers of row and columns of the cell where the command
% of dotted line (ex.: |\Vdots|) has been issued. |#3|, |#4|, |#5| and |#6| are
% the specification (in $i$ and $j$) of the submatrix we are analyzing.
-% \begin{macrocode}
-\cs_set_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
+%
+%
+% Here is the programmation of that command with the the standard syntax of L3.
+% \begin{Verbatim}
+% \cs_new_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
+% {
+% \bool_if:nT
+% {
+% \int_compare_p:n { #3 <= #1 <= #5 }
+% &&
+% \int_compare_p:n { #4 <= #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 } }
+% }
+% }
+% \end{Verbatim}
+%
+% \medskip
+% However, for efficiency, we will use the following version.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
{
- \int_compare:nNnF { #3 } > { #1 }
- {
- \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 } }
- }
- }
- }
- }
+ \if_int_compare:w #3 > #1
+ \else:
+ \if_int_compare:w #1 > #5
+ \else:
+ \if_int_compare:w #4 > #2
+ \else:
+ \if_int_compare:w #2 > #6
+ \else:
+ \if_int_compare:w \l_@@_row_min_int < #3 \l_@@_row_min_int = #3 \fi:
+ \if_int_compare:w \l_@@_col_min_int < #4 \l_@@_col_min_int = #4 \fi:
+ \if_int_compare:w \l_@@_row_max_int < #5 \l_@@_row_max_int = #5 \fi:
+ \if_int_compare:w \l_@@_col_max_int < #6 \l_@@_col_max_int = #6 \fi:
+ \fi:
+ \fi:
+ \fi:
+ \fi:
}
% \end{macrocode}
%
@@ -8549,8 +8604,8 @@
\pgfpointanchor
{ \@@_env: - ##1 - \int_use:N \l_@@_final_j_int }
{ east }
- \dim_set:Nn \l_@@_x_final_dim
- { \dim_max:nn \l_@@_x_final_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x > \l_@@_x_final_dim
+ { \dim_set_eq:NN \l_@@_x_final_dim \pgf at x }
}
}
% \end{macrocode}
@@ -8597,7 +8652,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Ldots:
\group_end:
}
@@ -8692,7 +8747,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Cdots:
\group_end:
}
@@ -8752,8 +8807,8 @@
\pgfpointanchor
{ \@@_env: - \int_use:N \l_@@_initial_i_int - ##1 }
{ north }
- \dim_set:Nn \l_@@_y_initial_dim
- { \dim_max:nn \l_@@_y_initial_dim \pgf at y }
+ \dim_compare:nNnT \pgf at y > \l_@@_y_initial_dim
+ { \dim_set_eq:NN \l_@@_y_initial_dim \pgf at y }
}
}
\dim_compare:nNnT \l_@@_y_initial_dim = { - \c_max_dim }
@@ -8784,8 +8839,8 @@
\pgfpointanchor
{ \@@_env: - \int_use:N \l_@@_final_i_int - ##1 }
{ south }
- \dim_set:Nn \l_@@_y_final_dim
- { \dim_min:nn \l_@@_y_final_dim \pgf at y }
+ \dim_compare:nNnT \pgf at y < \l_@@_y_final_dim
+ { \dim_set_eq:NN \l_@@_y_final_dim \pgf at y }
}
}
\dim_compare:nNnT \l_@@_y_final_dim = \c_max_dim
@@ -8820,8 +8875,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l_@@_xdots_color_tl
- { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Vdots:
\group_end:
}
@@ -8969,7 +9023,7 @@
\group_begin:
\@@_open_shorten:
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Ddots:
\group_end:
}
@@ -9058,7 +9112,7 @@
\@@_adjust_to_submatrix:nn { #1 } { #2 }
\cs_if_free:cT { @@ _ dotted _ #1 - #2 }
{
- \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 { -1 }
+ \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 { -1 }
% \end{macrocode}
% The previous command may have changed the current environment by marking some
% cells as ``dotted'', but, fortunately, it is outside the group for the options
@@ -9067,7 +9121,7 @@
\group_begin:
\@@_open_shorten:
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Iddots:
\group_end:
}
@@ -9173,6 +9227,7 @@
% \smallskip
% The argument of |\@@_draw_unstandard_dotted_line:n| is, in fact, the list of options.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:n { o }
\cs_new_protected:Npn \@@_draw_unstandard_dotted_line:n #1
{
\@@_draw_unstandard_dotted_line:nooo
@@ -9181,7 +9236,6 @@
\l_@@_xdots_down_tl
\l_@@_xdots_middle_tl
}
-\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:n { o }
% \end{macrocode}
%
%
@@ -9191,7 +9245,7 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { tikz }
+ \IfPackageLoadedT { tikz }
{
\tikzset
{
@@ -9204,12 +9258,12 @@
}
}
}
- { }
}
% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:nnnn { n o o o }
\cs_new_protected:Npn \@@_draw_unstandard_dotted_line:nnnn #1 #2 #3 #4
{
% \end{macrocode}
@@ -9312,9 +9366,6 @@
}
% \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
@@ -9749,7 +9800,7 @@
{ \@@_collect_options:n { \@@_Hdotsfor_ii } }
\exp_args:NNo \NewDocumentCommand \@@_Hdotsfor_ii \l_@@_argspec_tl
{
- \tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl
+ \tl_gput_right:Ne \g_@@_HVdotsfor_lines_tl
{
\@@_Hdotsfor:nnnn
{ \int_use:N \c at iRow }
@@ -9835,7 +9886,7 @@
}
\keys_set:nn { nicematrix / xdots } { #4 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Ldots:
\group_end:
% \end{macrocode}
@@ -9847,7 +9898,7 @@
% special control sequence (to nil).
% \begin{macrocode}
\int_step_inline:nnn { #2 } { #2 + #3 - 1 }
- { \cs_set:cpn { @@ _ dotted _ #1 - ##1 } { } }
+ { \cs_set_nopar:cpn { @@ _ dotted _ #1 - ##1 } { } }
}
% \end{macrocode}
%
@@ -9862,7 +9913,7 @@
\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
+ \tl_gput_right:Ne \g_@@_HVdotsfor_lines_tl
{
\@@_Vdotsfor:nnnn
{ \int_use:N \c at iRow }
@@ -9941,7 +9992,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { nicematrix / xdots } { #4 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
+ \@@_color:o \l_@@_xdots_color_tl
\@@_actually_draw_Vdots:
\group_end:
% \end{macrocode}
@@ -9953,7 +10004,7 @@
% special control sequence (to nil).
% \begin{macrocode}
\int_step_inline:nnn { #1 } { #1 + #3 - 1 }
- { \cs_set:cpn { @@ _ dotted _ ##1 - #2 } { } }
+ { \cs_set_nopar:cpn { @@ _ dotted _ ##1 - #2 } { } }
}
% \end{macrocode}
%
@@ -10029,13 +10080,13 @@
{
\group_begin:
\keys_set:nn { nicematrix / xdots } { #1 , #4 , down = #5 , up = #6 }
- \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
- \use:e
- {
- \@@_line_i:nn
- { \@@_double_int_eval:n #2 - \q_stop }
- { \@@_double_int_eval:n #3 - \q_stop }
- }
+ \@@_color:o \l_@@_xdots_color_tl
+ \use:e
+ {
+ \@@_line_i:nn
+ { \@@_double_int_eval:n #2 - \q_stop }
+ { \@@_double_int_eval:n #3 - \q_stop }
+ }
\group_end:
}
}
@@ -10060,7 +10111,7 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \cs_new_protected:Npx \@@_draw_line_ii:nn #1 #2
+ \cs_new_protected:Npe \@@_draw_line_ii:nn #1 #2
{
% \end{macrocode}
% We recall that, when externalization is used, |\tikzpicture| and
@@ -10127,9 +10178,10 @@
% \bigskip
% |\@@_put_in_row_style| will be used several times by |\RowStyle|.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_put_in_row_style:n { e }
\cs_set_protected:Npn \@@_put_in_row_style:n #1
{
- \tl_gput_right:Nx \g_@@_row_style_tl
+ \tl_gput_right:Ne \g_@@_row_style_tl
{
% \end{macrocode}
% Be careful, |\exp_not:N \@@_if_row_less_than:nn| can't be replaced by a
@@ -10145,7 +10197,6 @@
{ \exp_not:n { #1 } \scan_stop: }
}
}
-\cs_generate_variant:Nn \@@_put_in_row_style:n { e }
% \end{macrocode}
% \medskip
% \begin{macrocode}
@@ -10165,7 +10216,7 @@
bold .bool_set:N = \l_@@_bold_row_style_bool ,
bold .default:n = true ,
nb-rows .code:n =
- \str_if_eq:nnTF { #1 } { * }
+ \str_if_eq:eeTF { #1 } { * }
{ \int_set:Nn \l_@@_key_nb_rows_int { 500 } }
{ \int_set:Nn \l_@@_key_nb_rows_int { #1 } } ,
nb-rows .value_required:n = true ,
@@ -10196,7 +10247,7 @@
% First, the end of the current row (we remind that |\RowStyle| applies to the
% \emph{end} of the current row).
% \begin{macrocode}
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
% \end{macrocode}
% The command |\@@_exp_color_arg:No| is \emph{fully expandable}.
@@ -10210,7 +10261,7 @@
% \begin{macrocode}
\int_compare:nNnT \l_@@_key_nb_rows_int > \c_one_int
{
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
\@@_exp_color_arg:No \@@_rowcolor \l_tmpa_tl
{
@@ -10226,7 +10277,7 @@
% \begin{macrocode}
\dim_compare:nNnT \l_tmpa_dim > \c_zero_dim
{
- \exp_args:Nx \@@_put_in_row_style:n
+ \@@_put_in_row_style:e
{
\tl_gput_right:Nn \exp_not:N \g_@@_cell_after_hook_tl
{
@@ -10244,7 +10295,7 @@
% \begin{macrocode}
\dim_compare:nNnT \l_tmpb_dim > \c_zero_dim
{
- \exp_args:Nx \@@_put_in_row_style:n
+ \@@_put_in_row_style:e
{
\tl_gput_right:Nn \exp_not:N \g_@@_cell_after_hook_tl
{
@@ -10322,6 +10373,8 @@
% |\CodeBefore| (and we recall that a loop of \pkg{pgffor} is encapsulated in a
% group).
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_add_to_colors_seq:nn { e }
+\cs_generate_variant:Nn \@@_add_to_colors_seq:nn { e e }
\cs_new_protected:Npn \@@_add_to_colors_seq:nn #1 #2
{
% \end{macrocode}
@@ -10333,11 +10386,15 @@
% \end{macrocode}
% We don't take into account the colors like |myserie!!+| because those colors
% are special color from a |\definecolorseries| of \pkg{xcolor}.
+% |\str_if_in:nnF| is mandatory: don't use |\tl_if_in:nnF|.
% \begin{macrocode}
\str_if_in:nnF { #1 } { !! }
{
\seq_map_indexed_inline:Nn \g_@@_colors_seq
- { \tl_if_eq:nnT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } }
+% \end{macrocode}
+% We use |\str_if_eq:eeTF| which is slightly faster than |\tl_if_eq:nnTF|.
+% \begin{macrocode}
+ { \str_if_eq:eeT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } }
}
\int_if_zero:nTF \l_tmpa_int
% \end{macrocode}
@@ -10345,20 +10402,16 @@
% \begin{macrocode}
{
\seq_gput_right:Nn \g_@@_colors_seq { #1 }
- \tl_gset:cx { g_@@_color _ \seq_count:N \g_@@_colors_seq _ tl } { #2 }
+ \tl_gset:ce { g_@@_color _ \seq_count:N \g_@@_colors_seq _ tl } { #2 }
}
% \end{macrocode}
% Now, the case where the color is \emph{not} a new color (the color is in the
% sequence at the position |\l_tmpa_int|).
% \begin{macrocode}
- { \tl_gput_right:cx { g_@@_color _ \int_use:N \l_tmpa_int _tl } { #2 } }
+ { \tl_gput_right:ce { g_@@_color _ \int_use:N \l_tmpa_int _tl } { #2 } }
}
% \end{macrocode}
%
-% \begin{macrocode}
-\cs_generate_variant:Nn \@@_add_to_colors_seq:nn { e n }
-\cs_generate_variant:Nn \@@_add_to_colors_seq:nn { e e }
-% \end{macrocode}
%
% \bigskip
% The following command must be used within a |\pgfpicture|.
@@ -10579,8 +10632,8 @@
\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_@@_cols_tl { \l_@@_tmpd_tl - \l_tmpb_tl }
+ \tl_set:Ne \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl }
+ \tl_set:Ne \l_@@_cols_tl { \l_@@_tmpd_tl - \l_tmpb_tl }
% \end{macrocode}
% The command |\@@_cartesian_path:n| takes in two implicit arguments:
% |\l_@@_cols_tl| and |\l_@@_rows_tl|.
@@ -10681,7 +10734,7 @@
% \end{macrocode}
% We don't want to take into account a block which is completely in the ``first
% column'' (number~$0$) or in the ``last column'' and that's why we filter
-% the sequence of the blocks (in a the sequence |\l_tmpa_seq|).
+% the sequence of the blocks (in the sequence |\l_tmpa_seq|).
% \begin{macrocode}
\seq_set_eq:NN \l_tmpb_seq \g_@@_pos_of_blocks_seq
\seq_set_filter:NNn \l_tmpa_seq \l_tmpb_seq
@@ -10733,7 +10786,7 @@
% |\l_@@_tmpc_tl| will be the color that we will use.
% \begin{macrocode}
\tl_clear_new:N \l_@@_color_tl
- \tl_set:Nx \l_@@_color_tl
+ \tl_set:Ne \l_@@_color_tl
{
\@@_color_index:n
{
@@ -10765,6 +10818,9 @@
% \begin{macrocode}
\cs_new:Npn \@@_color_index:n #1
{
+% \end{macrocode}
+% Be careful: this command |\@@_color_index:n| must be ``\emph{fully expandable}''.
+% \begin{macrocode}
\str_if_eq:eeTF { \seq_item:Nn \l_@@_colors_seq { #1 } } { = }
{ \@@_color_index:n { #1 - 1 } }
{ \seq_item:Nn \l_@@_colors_seq { #1 } }
@@ -10840,7 +10896,7 @@
\l_@@_nocolor_used_bool
\@@_cartesian_path_normal_ii:
{
- \seq_if_empty:NTF \l_@@_corners_cells_seq
+ \clist_if_empty:NTF \l_@@_corners_cells_clist
{ \@@_cartesian_path_normal_i:n { #1 } }
\@@_cartesian_path_normal_ii:
}
@@ -10918,7 +10974,7 @@
% Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|.
% \begin{macrocode}
\cs_if_exist:cF
- { @@ _ \l_tmpa_tl _ \l_@@_tmpc_tl _ nocolor }
+ { @@ _ nocolor _ \l_tmpa_tl - \l_@@_tmpc_tl }
{
\@@_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
@@ -10957,14 +11013,13 @@
% \begin{macrocode}
\clist_map_inline:Nn \l_@@_rows_tl
{
- \seq_if_in:NnF \l_@@_corners_cells_seq
- { ####1 - ##1 }
+ \@@_if_in_corner:nF { ####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 { @@ _ ####1 _ ##1 _ nocolor }
+ \cs_if_exist:cF { @@ _ nocolor _ ####1 - ##1 }
{
\pgfpathrectanglecorners
{ \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim }
@@ -11005,7 +11060,7 @@
\clist_map_inline:Nn \l_@@_rows_tl
{
\clist_map_inline:Nn \l_@@_cols_tl
- { \cs_set:cpn { @@ _ ##1 _ ####1 _ nocolor } { } }
+ { \cs_set_nopar:cpn { @@ _ nocolor _ ##1 - ####1 } { } }
}
}
% \end{macrocode}
@@ -11028,12 +11083,12 @@
{ \@@_cut_on_hyphen:w ##1 \q_stop }
{ \@@_cut_on_hyphen:w ##1 - ##1 \q_stop }
\bool_lazy_or:nnT
+ { \str_if_eq_p:ee \l_tmpa_tl { * } }
{ \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
+ { \str_if_eq_p:ee \l_tmpb_tl { * } }
{ \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:No \l_tmpb_tl { \int_use:N #2 } }
@@ -11050,7 +11105,7 @@
\NewDocumentCommand \@@_cellcolor_tabular { O { } m }
{
\@@_test_color_inside:
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
% \end{macrocode}
% We must not expand the color (|#2|) because the color may contain the token
@@ -11071,7 +11126,7 @@
\NewDocumentCommand \@@_rowcolor_tabular { O { } m }
{
\@@_test_color_inside:
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
\@@_rectanglecolor [ #1 ] { \exp_not:n { #2 } }
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
@@ -11127,7 +11182,7 @@
% the commands |\rowlistcolors| which are in force) the current instruction
% |\rowlistcolors|.
% \begin{macrocode}
- \seq_gput_right:Nx \g_@@_rowlistcolors_seq
+ \seq_gput_right:Ne \g_@@_rowlistcolors_seq
{
{ \int_use:N \c at iRow }
{ \exp_not:n { #1 } }
@@ -11164,7 +11219,7 @@
% \begin{macrocode}
{ \seq_gput_right:Nn \g_tmpa_seq { { #1 } { #2 } { #3 } { #4 } } }
{
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
\@@_rowlistcolors
[ \exp_not:n { #2 } ]
@@ -11220,7 +11275,7 @@
% instructions in the |\CodeBefore| in order to fill color by color (to avoid
% the thin white lines).
% \begin{macrocode}
- \tl_gput_left:Nx \g_@@_pre_code_before_tl
+ \tl_gput_left:Ne \g_@@_pre_code_before_tl
{
\exp_not:N \columncolor [ #1 ]
{ \exp_not:n { #2 } } { \int_use:N \c at jCol }
@@ -11336,7 +11391,7 @@
end .code:n =
\bool_lazy_or:nnTF
{ \tl_if_empty_p:n { #1 } }
- { \str_if_eq_p:nn { #1 } { last } }
+ { \str_if_eq_p:ee { #1 } { last } }
{ \int_set_eq:NN \l_@@_end_int \c at jCol }
{ \int_set:Nn \l_@@_end_int { #1 } }
}
@@ -11434,6 +11489,9 @@
% be drawn.
% \begin{macrocode}
\bool_gset_true:N \g_tmpa_bool
+% \end{macrocode}
+%
+% \begin{macrocode}
\seq_map_inline:Nn \g_@@_pos_of_blocks_seq
{ \@@_test_vline_in_block:nnnnn ##1 }
\seq_map_inline:Nn \g_@@_pos_of_xdots_seq
@@ -11471,23 +11529,18 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_in_corner_v:
{
- \int_compare:nNnTF \l_tmpb_tl = { \int_eval:n { \c at jCol + 1 } }
+ \int_compare:nNnTF \l_tmpb_tl = { \c at jCol + 1 }
{
- \seq_if_in:NxT
- \l_@@_corners_cells_seq
- { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
+ \@@_if_in_corner:nT { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
{ \bool_set_false:N \g_tmpa_bool }
}
{
- \seq_if_in:NxT
- \l_@@_corners_cells_seq
- { \l_tmpa_tl - \l_tmpb_tl }
+ \@@_if_in_corner:nT { \l_tmpa_tl - \l_tmpb_tl }
{
\int_compare:nNnTF \l_tmpb_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
- \seq_if_in:NxT
- \l_@@_corners_cells_seq
+ \@@_if_in_corner:nT
{ \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
{ \bool_set_false:N \g_tmpa_bool }
}
@@ -11501,7 +11554,7 @@
\cs_new_protected:Npn \@@_vline_ii:
{
\tl_clear:N \l_@@_tikz_rule_tl
- \keys_set:nV { nicematrix / RulesBis } \l_@@_other_keys_tl
+ \keys_set:no { nicematrix / RulesBis } \l_@@_other_keys_tl
\bool_if:NTF \l_@@_dotted_bool
\@@_vline_iv:
{
@@ -11610,7 +11663,7 @@
% \begin{macrocode}
\CT at arc@
\tl_if_empty:NF \l_@@_rule_color_tl
- { \tl_put_right:Nx \l_@@_tikz_rule_tl { , color = \l_@@_rule_color_tl } }
+ { \tl_put_right:Ne \l_@@_tikz_rule_tl { , color = \l_@@_rule_color_tl } }
\pgfrememberpicturepositiononpagetrue
\pgf at relevantforpicturesizefalse
\@@_qpoint:n { row - \int_use:N \l_@@_local_start_int }
@@ -11695,8 +11748,15 @@
% be drawn.
% \begin{macrocode}
\bool_gset_true:N \g_tmpa_bool
- \seq_map_inline:Nn \g_@@_pos_of_blocks_seq
- { \@@_test_hline_in_block:nnnnn ##1 }
+% \end{macrocode}
+%
+% We test whether we are in a block.
+% \begin{macrocode}
+ \seq_map_inline:Nn \g_@@_pos_of_blocks_seq
+ { \@@_test_hline_in_block:nnnnn ##1 }
+% \end{macrocode}
+%
+% \begin{macrocode}
\seq_map_inline:Nn \g_@@_pos_of_xdots_seq
{ \@@_test_hline_in_block:nnnnn ##1 }
\seq_map_inline:Nn \g_@@_pos_of_stroken_blocks_seq
@@ -11732,23 +11792,18 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_in_corner_h:
{
- \int_compare:nNnTF \l_tmpa_tl = { \int_eval:n { \c at iRow + 1 } }
+ \int_compare:nNnTF \l_tmpa_tl = { \c at iRow + 1 }
{
- \seq_if_in:NxT
- \l_@@_corners_cells_seq
- { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
+ \@@_if_in_corner:nT { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
{
- \seq_if_in:NxT
- \l_@@_corners_cells_seq
- { \l_tmpa_tl - \l_tmpb_tl }
+ \@@_if_in_corner:nT { \l_tmpa_tl - \l_tmpb_tl }
{
\int_compare:nNnTF \l_tmpa_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
- \seq_if_in:NxT
- \l_@@_corners_cells_seq
+ \@@_if_in_corner:nT
{ \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
@@ -11757,12 +11812,13 @@
}
% \end{macrocode}
%
+%
% \bigskip
% \begin{macrocode}
\cs_new_protected:Npn \@@_hline_ii:
{
\tl_clear:N \l_@@_tikz_rule_tl
- \keys_set:nV { nicematrix / RulesBis } \l_@@_other_keys_tl
+ \keys_set:no { nicematrix / RulesBis } \l_@@_other_keys_tl
\bool_if:NTF \l_@@_dotted_bool
\@@_hline_iv:
{
@@ -11932,7 +11988,7 @@
% \begin{macrocode}
\CT at arc@
\tl_if_empty:NF \l_@@_rule_color_tl
- { \tl_put_right:Nx \l_@@_tikz_rule_tl { , color = \l_@@_rule_color_tl } }
+ { \tl_put_right:Ne \l_@@_tikz_rule_tl { , color = \l_@@_rule_color_tl } }
\pgfrememberpicturepositiononpagetrue
\pgf at relevantforpicturesizefalse
\@@_qpoint:n { col - \int_use:N \l_@@_local_start_int }
@@ -12010,7 +12066,7 @@
{
\@@_compute_rule_width:n { multiplicity = #1 , #2 }
\skip_vertical:N \l_@@_rule_width_dim
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_hline:n
{
@@ -12058,7 +12114,7 @@
{ \str_if_empty_p:N \l_@@_ccommand_str }
}
{ \@@_error:n { No~letter~and~no~command } }
- { \exp_args:No \@@_custom_line_i:n \l_@@_other_keys_tl }
+ { \@@_custom_line_i:o \l_@@_other_keys_tl }
}
% \end{macrocode}
%
@@ -12077,6 +12133,7 @@
%
% \bigskip
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_custom_line_i:n { o }
\cs_new_protected:Npn \@@_custom_line_i:n #1
{
% \end{macrocode}
@@ -12091,8 +12148,7 @@
\keys_set:nn { nicematrix / custom-line-bis } { #1 }
\bool_if:NT \l_@@_tikz_rule_bool
{
- \IfPackageLoadedTF { tikz }
- { }
+ \IfPackageLoadedF { tikz }
{ \@@_error:n { tikz~in~custom-line~without~tikz } }
\bool_if:NT \l_@@_color_bool
{ \@@_error:n { color~in~custom-line~with~tikz } }
@@ -12107,8 +12163,9 @@
\int_compare:nTF { \str_count:N \l_@@_letter_str != 1 }
{ \@@_error:n { Several~letters } }
{
- \exp_args:NnV \tl_if_in:NnTF
- \c_@@_forbidden_letters_str \l_@@_letter_str
+ \tl_if_in:NoTF
+ \c_@@_forbidden_letters_str
+ \l_@@_letter_str
{ \@@_error:ne { Forbidden~letter } \l_@@_letter_str }
{
% \end{macrocode}
@@ -12116,7 +12173,7 @@
% for the letter corresponding at the custom line, will directly use the
% following command that you define in the main hash table of TeX.
% \begin{macrocode}
- \cs_set:cpn { @@ _ \l_@@_letter_str } ##1
+ \cs_set_nopar:cpn { @@ _ \l_@@_letter_str } ##1
{ \@@_v_custom_line:n { #1 } }
}
}
@@ -12201,7 +12258,7 @@
% Moreover, the command must \emph{not} be protected since it begins with
% |\noalign| (which is in |\Hline|).
% \begin{macrocode}
- \cs_set:cpn { nicematrix - \l_@@_command_str } { \Hline [ #1 ] }
+ \cs_set_nopar:cpn { nicematrix - \l_@@_command_str } { \Hline [ #1 ] }
\seq_put_left:No \l_@@_custom_line_commands_seq \l_@@_command_str
}
% \end{macrocode}
@@ -12241,10 +12298,10 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_c_custom_line_i:nn #1 #2
{
- \str_if_in:nnTF { #2 } { - }
+ \tl_if_in:nnTF { #2 } { - }
{ \@@_cut_on_hyphen:w #2 \q_stop }
{ \@@_cut_on_hyphen:w #2 - #2 \q_stop }
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_hline:n
{
@@ -12291,9 +12348,9 @@
% \end{macrocode}
% In the following line, the |\dim_use:N| is mandatory since we do an expansion.
% \begin{macrocode}
- \tl_gput_right:Nx \g_@@_array_preamble_tl
+ \tl_gput_right:Ne \g_@@_array_preamble_tl
{ \exp_not:N ! { \skip_horizontal:n { \dim_use:N \l_@@_rule_width_dim } } }
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_vline:n
{
@@ -12399,11 +12456,15 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_compute_corners:
{
+ \seq_map_inline:Nn \g_@@_pos_of_blocks_seq
+ { \@@_mark_cells_of_block:nnnnn ##1 }
% \end{macrocode}
-% The sequence |\l_@@_corners_cells_seq| will be the sequence of all the
-% empty cells (and not in a block) considered in the corners of the array.
+% The list |\l_@@_corners_cells_clist| will be the list of all the
+% empty cells (and not in a block) considered in the corners of the array. We
+% use a |clist| instead of a |seq| because we will frequently search in that
+% list (and searching in a |clist| is faster than searching in a |seq|).
% \begin{macrocode}
- \seq_clear_new:N \l_@@_corners_cells_seq
+ \clist_clear:N \l_@@_corners_cells_clist
\clist_map_inline:Nn \l_@@_corners_clist
{
\str_case:nnF { ##1 }
@@ -12423,28 +12484,50 @@
% Even if the user has used the key |corners| the list of cells in the corners
% may be empty.
% \begin{macrocode}
- \seq_if_empty:NF \l_@@_corners_cells_seq
+ \clist_if_empty:NF \l_@@_corners_cells_clist
{
% \end{macrocode}
% You write on the |aux| file the list of the cells which are in the (empty)
% corners because you need that information in the |\CodeBefore| since the
-% commands which color the |rows|, |columns| and |cells| must not color the
+% commands which colors the |rows|, |columns| and |cells| must not color the
% cells in the corners.
% \begin{macrocode}
- \tl_gput_right:Nx \g_@@_aux_tl
+ \tl_gput_right:Ne \g_@@_aux_tl
{
- \seq_set_from_clist:Nn \exp_not:N \l_@@_corners_cells_seq
- { \seq_use:Nnnn \l_@@_corners_cells_seq , , , }
+ \cs_set_nopar:Npn \exp_not:N \l_@@_corners_cells_clist
+ { \l_@@_corners_cells_clist }
}
}
}
% \end{macrocode}
%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_mark_cells_of_block:nnnnn #1 #2 #3 #4 #5
+ {
+ \int_step_inline:nnn { #1 } { #3 }
+ {
+ \int_step_inline:nnn { #2 } { #4 }
+ { \cs_set_nopar:cpn { @@ _ block _ ##1 - ####1 } { } }
+ }
+ }
+% \end{macrocode}
%
% \bigskip
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_if_in_block:nn #1 #2 { p }
+ {
+ \cs_if_exist:cTF
+ { @@ _ block _ \int_eval:n { #1 } - \int_eval:n { #2 } }
+ \prg_return_true:
+ \prg_return_false:
+ }
+% \end{macrocode}
+%
+% \bigskip
% ``Computing a corner'' is determining all the empty cells (which are not in a
% block) that belong to that corner. These cells will be added to the sequence
-% |\l_@@_corners_cells_seq|.
+% |\l_@@_corners_cells_clist|.
%
% \medskip
% The six arguments of |\@@_compute_a_corner:nnnnnn| are as follow:
@@ -12474,13 +12557,12 @@
\int_set:Nn \l_@@_last_empty_row_int { #1 }
\int_step_inline:nnnn { #1 } { #3 } { #5 }
{
- \@@_test_if_cell_in_a_block:nn { ##1 } { \int_eval:n { #2 } }
\bool_lazy_or:nnTF
{
\cs_if_exist_p:c
{ pgf @ sh @ ns @ \@@_env: - ##1 - \int_eval:n { #2 } }
}
- \l_tmpb_bool
+ { \@@_if_in_block_p:nn { ##1 } { #2 } }
{ \bool_set_true:N \l_tmpa_bool }
{
\bool_if:NF \l_tmpa_bool
@@ -12495,18 +12577,17 @@
\int_set:Nn \l_@@_last_empty_column_int { #2 }
\int_step_inline:nnnn { #2 } { #4 } { #6 }
{
- \@@_test_if_cell_in_a_block:nn { \int_eval:n { #1 } } { ##1 }
- \bool_lazy_or:nnTF
- \l_tmpb_bool
+ \bool_lazy_or:nnTF
{
\cs_if_exist_p:c
{ pgf @ sh @ ns @ \@@_env: - \int_eval:n { #1 } - ##1 }
}
+ { \@@_if_in_block_p:nn { #1 } { ##1 } }
{ \bool_set_true:N \l_tmpa_bool }
{
\bool_if:NF \l_tmpa_bool
{ \int_set:Nn \l_@@_last_empty_column_int { ##1 } }
- }
+ }
}
% \end{macrocode}
% Now, we loop over the rows.
@@ -12519,21 +12600,18 @@
\bool_set_false:N \l_tmpa_bool
\int_step_inline:nnnn { #2 } { #4 } \l_@@_last_empty_column_int
{
- \@@_test_if_cell_in_a_block:nn { ##1 } { ####1 }
\bool_lazy_or:nnTF
- \l_tmpb_bool
- {
- \cs_if_exist_p:c
- { pgf @ sh @ ns @ \@@_env: - ##1 - ####1 }
- }
+ { \cs_if_exist_p:c { pgf @ sh @ ns @ \@@_env: - ##1 - ####1 } }
+ { \@@_if_in_block_p:nn { ##1 } { ####1 } }
{ \bool_set_true:N \l_tmpa_bool }
{
\bool_if:NF \l_tmpa_bool
{
\int_set:Nn \l_@@_last_empty_column_int { ####1 }
- \seq_put_right:Nn
- \l_@@_corners_cells_seq
+ \clist_put_right:Nn
+ \l_@@_corners_cells_clist
{ ##1 - ####1 }
+ \cs_set_nopar:cpn { @@ _ corner _ ##1 - ####1 } { }
}
}
}
@@ -12541,42 +12619,20 @@
}
% \end{macrocode}
%
-% \bigskip
-% The following macro tests whether a cell is in (at least) one of
-% the blocks of the array (or in a cell with a |\diagbox|).
%
-% The flag |\l_tmpb_bool| will be raised if the cell |#1|-|#2| is in a block (or
-% in a cell with a |\diagbox|).
+% \bigskip
+% Of course, instead of the following lines, we could have use
+% |\prg_new_conditional:Npnn|.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_test_if_cell_in_a_block:nn #1 #2
- {
- \int_set:Nn \l_tmpa_int { #1 }
- \int_set:Nn \l_tmpb_int { #2 }
- \bool_set_false:N \l_tmpb_bool
- \seq_map_inline:Nn \g_@@_pos_of_blocks_seq
- { \@@_test_if_cell_in_block:nnnnnnn \l_tmpa_int \l_tmpb_int ##1 }
- }
+\cs_new:Npn \@@_if_in_corner:nT #1 { \cs_if_exist:cT { @@ _ corner _ #1 } }
+\cs_new:Npn \@@_if_in_corner:nF #1 { \cs_if_exist:cF { @@ _ corner _ #1 } }
% \end{macrocode}
+%
+% Instead of the previous lines, we could have used |\l_@@_corners_cells_clist|
+% but it's less efficient:
%
-%
-% \begin{macrocode}
-\cs_set_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
- {
- \int_compare:nNnF { #3 } > { #1 }
- {
- \int_compare:nNnF { #1 } > { #5 }
- {
- \int_compare:nNnF { #4 } > { #2 }
- {
- \int_compare:nNnF { #2 } > { #6 }
- { \bool_set_true:N \l_tmpb_bool }
- }
- }
- }
- }
-% \end{macrocode}
+% \verb|\clist_if_in:NeT \l_@@_corners_cells_clist { #1 } ...|
%
-%
% \bigskip
% \section{The environment \{NiceMatrixBlock\}}
%
@@ -12613,8 +12669,7 @@
\cs_if_exist:cT
{ @@_max_cell_width_ \int_use:N \g_@@_NiceMatrixBlock_int }
{
- % is \exp_args:NNe mandatory?
- \exp_args:NNe \dim_set:Nn \l_@@_columns_width_dim
+ \dim_set:Nn \l_@@_columns_width_dim
{
\use:c
{ @@_max_cell_width _ \int_use:N \g_@@_NiceMatrixBlock_int }
@@ -12642,7 +12697,7 @@
\bool_if:NT \l_@@_block_auto_columns_width_bool
{
\iow_shipout:Nn \@mainaux \ExplSyntaxOn
- \iow_shipout:Nx \@mainaux
+ \iow_shipout:Ne \@mainaux
{
\cs_gset:cpn
{ @@ _ max _ cell _ width _ \int_use:N \g_@@_NiceMatrixBlock_int }
@@ -12663,11 +12718,6 @@
%
% \section{The extra nodes}
%
-% First, two variants of the functions |\dim_min:nn| and |\dim_max:nn|.
-% \begin{macrocode}
-\cs_generate_variant:Nn \dim_min:nn { v n }
-\cs_generate_variant:Nn \dim_max:nn { v n }
-% \end{macrocode}
%
%
% \bigskip
@@ -12761,7 +12811,7 @@
\pgfpointanchor { \@@_env: - \@@_i: - \@@_j: } { south~west }
\dim_set:cn { l_@@_row_\@@_i: _min_dim}
{ \dim_min:vn { l_@@_row _ \@@_i: _min_dim } \pgf at y }
- \seq_if_in:NxF \g_@@_multicolumn_cells_seq { \@@_i: - \@@_j: }
+ \seq_if_in:NeF \g_@@_multicolumn_cells_seq { \@@_i: - \@@_j: }
{
\dim_set:cn { l_@@_column _ \@@_j: _min_dim}
{ \dim_min:vn { l_@@_column _ \@@_j: _min_dim } \pgf at x }
@@ -12773,7 +12823,7 @@
\pgfpointanchor { \@@_env: - \@@_i: - \@@_j: } { north~east }
\dim_set:cn { l_@@_row _ \@@_i: _ max_dim }
{ \dim_max:vn { l_@@_row _ \@@_i: _ max_dim } \pgf at y }
- \seq_if_in:NxF \g_@@_multicolumn_cells_seq { \@@_i: - \@@_j: }
+ \seq_if_in:NeF \g_@@_multicolumn_cells_seq { \@@_i: - \@@_j: }
{
\dim_set:cn { l_@@_column _ \@@_j: _ max_dim }
{ \dim_max:vn { l_@@_column _ \@@_j: _max_dim } \pgf at x }
@@ -13138,12 +13188,12 @@
% \begin{macrocode}
\bool_lazy_or:nnTF
{ \tl_if_blank_p:n { #1 } }
- { \str_if_eq_p:Vn \c_@@_star_str { #1 } }
+ { \str_if_eq_p:ee { * } { #1 } }
{ \int_set:Nn \l_tmpa_int { 100 } }
{ \int_set:Nn \l_tmpa_int { #1 } }
\bool_lazy_or:nnTF
{ \tl_if_blank_p:n { #2 } }
- { \str_if_eq_p:Vn \c_@@_star_str { #2 } }
+ { \str_if_eq_p:ee { * } { #2 } }
{ \int_set:Nn \l_tmpb_int { 100 } }
{ \int_set:Nn \l_tmpb_int { #2 } }
% \end{macrocode}
@@ -13155,7 +13205,7 @@
{
\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:No \l_@@_hpos_block_str \l_@@_hpos_cell_tl }
}
{ \str_set_eq:NN \l_@@_hpos_block_str \c_@@_c_str }
% \end{macrocode}
@@ -13168,7 +13218,7 @@
% \end{macrocode}
%
% \begin{macrocode}
- \tl_set:Nx \l_tmpa_tl
+ \tl_set:Ne \l_tmpa_tl
{
{ \int_use:N \c at iRow }
{ \int_use:N \c at jCol }
@@ -13190,11 +13240,14 @@
% \begin{macrocode}
\bool_set_false:N \l_tmpa_bool
\bool_if:NT \l_@@_amp_in_blocks_bool
+% \end{macrocode}
+% |\tl_if_in:nnT| is faster than |\str_if_in:nnT|.
+% \begin{macrocode}
{ \tl_if_in:nnT { #5 } { & } { \bool_set_true:N \l_tmpa_bool } }
\bool_case:nF
{
- \l_tmpa_bool { \exp_args:Nee \@@_Block_vii:nnnnn }
- \l_@@_p_block_bool { \exp_args:Nee \@@_Block_vi:nnnnn }
+ \l_tmpa_bool { \@@_Block_vii:eennn }
+ \l_@@_p_block_bool { \@@_Block_vi:eennn }
% \end{macrocode}
% For the blocks mono-column, we will compose right now in a box in order to
% compute its width and take that width into account for the width of the
@@ -13204,14 +13257,12 @@
% column, it's imperative. Otherwise, the process for the determination of the
% widths of the columns will be wrong.
% \begin{macrocode}
- \l_@@_X_bool { \exp_args:Nee \@@_Block_v:nnnnn }
- { \tl_if_empty_p:n { #5 } } { \exp_args:Nee \@@_Block_v:nnnnn }
- { \int_compare_p:nNn \l_tmpa_int = \c_one_int }
- { \exp_args:Nee \@@_Block_iv:nnnnn }
- { \int_compare_p:nNn \l_tmpb_int = \c_one_int }
- { \exp_args:Nee \@@_Block_iv:nnnnn }
+ \l_@@_X_bool { \@@_Block_v:eennn }
+ { \tl_if_empty_p:n { #5 } } { \@@_Block_v:eennn }
+ { \int_compare_p:nNn \l_tmpa_int = \c_one_int } { \@@_Block_iv:eennn }
+ { \int_compare_p:nNn \l_tmpb_int = \c_one_int } { \@@_Block_iv:eennn }
}
- { \exp_args:Nee \@@_Block_v:nnnnn }
+ { \@@_Block_v:eennn }
{ \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 }
}
% \end{macrocode}
@@ -13232,12 +13283,13 @@
% the tokens to put before the potential math mode and before the composition of
% the block and |#5| is the label (=content) of the block.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_Block_iv:nnnnn { e e }
\cs_new_protected:Npn \@@_Block_iv:nnnnn #1 #2 #3 #4 #5
{
\int_gincr:N \g_@@_block_box_int
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_actually_diagbox:nnnnnn
{ \int_use:N \c at iRow }
@@ -13362,7 +13414,10 @@
{
\use:e
{
- \exp_not:N \begin { minipage }%
+% \end{macrocode}
+% The |\exp_not:N| is mandatory before |\begin|.
+% \begin{macrocode}
+ \exp_not:N \begin { minipage }%
[ \str_lowercase:o \l_@@_vpos_block_str ]
{ \l_@@_col_width_dim }
\str_case:on \l_@@_hpos_block_str
@@ -13460,7 +13515,7 @@
}
}
}
- \seq_gput_right:Nx \g_@@_blocks_seq
+ \seq_gput_right:Ne \g_@@_blocks_seq
{
\l_tmpa_tl
% \end{macrocode}
@@ -13500,7 +13555,7 @@
{
\bool_if:NT \g_@@_rotate_bool
{
- \str_set:Nx \l_@@_hpos_block_str
+ \str_set:Ne \l_@@_hpos_block_str
{
\bool_if:NTF \g_@@_rotate_c_bool
{ c }
@@ -13562,9 +13617,10 @@
% the tokens to put before the math mode and before the composition of the block
% and |#5| is the label (=content) of the block.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_Block_v:nnnnn { e e }
\cs_new_protected:Npn \@@_Block_v:nnnnn #1 #2 #3 #4 #5
{
- \seq_gput_right:Nx \g_@@_blocks_seq
+ \seq_gput_right:Ne \g_@@_blocks_seq
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
@@ -13633,9 +13689,10 @@
% \bigskip
% The following macro is for the case of a |\Block| which uses the key~|p|.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_Block_vi:nnnnn { e e }
\cs_new_protected:Npn \@@_Block_vi:nnnnn #1 #2 #3 #4 #5
{
- \seq_gput_right:Nx \g_@@_blocks_seq
+ \seq_gput_right:Ne \g_@@_blocks_seq
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
@@ -13652,9 +13709,10 @@
% \bigskip
% The following macro is for the case of a |\Block| which uses the key~|p|.
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_Block_vii:nnnnn { e e }
\cs_new_protected:Npn \@@_Block_vii:nnnnn #1 #2 #3 #4 #5
{
- \seq_gput_right:Nx \g_@@_blocks_seq
+ \seq_gput_right:Ne \g_@@_blocks_seq
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
@@ -13676,6 +13734,10 @@
ampersand-in-blocks .bool_set:N = \l_@@_amp_in_blocks_bool ,
ampersand-in-blocks .default:n = true ,
&-in-blocks .meta:n = ampersand-in-blocks ,
+% \end{macrocode}
+% The sequence |\l_@@_tikz_seq| will contain a sequence of comma-separated lists
+% of keys.
+% \begin{macrocode}
tikz .code:n =
\IfPackageLoadedTF { tikz }
{ \seq_put_right:Nn \l_@@_tikz_seq { { #1 } } }
@@ -13765,6 +13827,7 @@
% \end{macrocode}
%
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_Block_v:nnnnnn { n n e e }
\cs_new_protected:Npn \@@_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6
{
% \end{macrocode}
@@ -13808,11 +13871,11 @@
\int_compare:nNnTF \l_@@_last_row_int > \g_@@_row_total_int
{ \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } }
{
- \@@_Block_v:nnVVnn
+ \@@_Block_v:nneenn
{ #1 }
{ #2 }
- \l_@@_last_row_int
- \l_@@_last_col_int
+ { \int_use:N \l_@@_last_row_int }
+ { \int_use:N \l_@@_last_col_int }
{ #5 }
{ #6 }
}
@@ -13820,10 +13883,6 @@
}
% \end{macrocode}
%
-% \begin{macrocode}
-\cs_generate_variant:Nn \@@_Block_v:nnnnnn { n n V V n n }
-% \end{macrocode}
-%
%
% \medskip
% The following command |\@@_Block_v:nnnnnn| will actually draw the block.
@@ -13847,7 +13906,8 @@
%
%
% If the content of the block contains |&|, we will have a special treatement
-% (since the cell must be divided in several sub-cells).
+% (since the cell must be divided in several sub-cells). Remark that
+% |\tl_if_in:nnT| is faster then |\str_if_in:nnT|.
% \begin{macrocode}
\tl_if_in:nnT { #6 } { & } { \bool_set_true:N \l_@@_ampersand_bool }
% \end{macrocode}
@@ -13857,7 +13917,7 @@
\l_@@_vlines_block_bool
{ ! \l_@@_ampersand_bool }
{
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\@@_vlines_block:nnn
{ \exp_not:n { #5 } }
@@ -13867,7 +13927,7 @@
}
\bool_if:NT \l_@@_hlines_block_bool
{
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\@@_hlines_block:nnn
{ \exp_not:n { #5 } }
@@ -13884,7 +13944,7 @@
% |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
+ \seq_gput_left:Ne \g_@@_pos_of_blocks_seq
{ { #1 } { #2 } { #3 } { #4 } { \l_@@_block_name_str } }
}
}
@@ -13896,7 +13956,7 @@
{
\bool_lazy_or:nnT \l_@@_hlines_block_bool \l_@@_vlines_block_bool
{ \@@_error:n { hlines~with~color } }
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\@@_stroke_block:nnn
% \end{macrocode}
@@ -13914,7 +13974,7 @@
% \begin{macrocode}
\clist_if_empty:NF \l_@@_borders_clist
{
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\@@_stroke_borders_block:nnn
{ \exp_not:n { #5 } }
@@ -13929,9 +13989,9 @@
{
\tl_if_empty:NF \l_@@_opacity_tl
{
- \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [
+ \tl_if_head_eq_meaning:oNTF \l_@@_fill_tl [
{
- \tl_set:Nx \l_@@_fill_tl
+ \tl_set:Ne \l_@@_fill_tl
{
[ opacity = \l_@@_opacity_tl ,
\tl_tail:o \l_@@_fill_tl
@@ -13938,14 +13998,14 @@
}
}
{
- \tl_set:Nx \l_@@_fill_tl
- { [ opacity = \l_@@_opacity_tl ] { \l_@@_fill_tl } }
+ \tl_set:Ne \l_@@_fill_tl
+ { [ opacity = \l_@@_opacity_tl ] { \exp_not:o \l_@@_fill_tl } }
}
}
- \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ \tl_gput_right:Ne \g_@@_pre_code_before_tl
{
\exp_not:N \roundedrectanglecolor
- \exp_args:No \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [
+ \tl_if_head_eq_meaning:oNTF \l_@@_fill_tl [
{ \l_@@_fill_tl }
{ { \l_@@_fill_tl } }
{ #1 - #2 }
@@ -13958,14 +14018,17 @@
% \begin{macrocode}
\seq_if_empty:NF \l_@@_tikz_seq
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Ne \g_nicematrix_code_before_tl
{
\@@_block_tikz:nnnnn
+ { \seq_use:Nn \l_@@_tikz_seq { , } }
{ #1 }
{ #2 }
{ \int_use:N \l_@@_last_row_int }
{ \int_use:N \l_@@_last_col_int }
- { \seq_use:Nn \l_@@_tikz_seq { , } }
+% \end{macrocode}
+% We will have in that last field a list of list of Tikz keys.
+% \begin{macrocode}
}
}
% \end{macrocode}
@@ -13974,7 +14037,7 @@
% \begin{macrocode}
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_actually_diagbox:nnnnnn
{ #1 }
@@ -13981,7 +14044,8 @@
{ #2 }
{ \int_use:N \l_@@_last_row_int }
{ \int_use:N \l_@@_last_col_int }
- { \exp_not:n { ##1 } } { \exp_not:n { ##2 } }
+ { \exp_not:n { ##1 } }
+ { \exp_not:n { ##2 } }
}
}
% \end{macrocode}
@@ -14296,9 +14360,9 @@
\bool_lazy_any:nTF
{
{ \str_if_empty_p:N \l_@@_vpos_block_str } % added 2024/06/29
- { \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 } }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { c } }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { T } }
+ { \str_if_eq_p:ee \l_@@_vpos_block_str { B } }
}
% \end{macrocode}
% \medskip
@@ -14319,7 +14383,7 @@
% \end{macrocode}
% |\l_tmpa_tl| will contain the anchor of the \textsc{pgf} node which will be used.
% \begin{macrocode}
- \tl_set:Nx \l_tmpa_tl
+ \tl_set:Ne \l_tmpa_tl
{
\str_case:on \l_@@_vpos_block_str
{
@@ -14401,7 +14465,7 @@
{
\@@_qpoint:n
{
- row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 }
+ row - \str_if_eq:eeTF \l_@@_vpos_block_str { b } { #3 } { #1 }
- base
}
}
@@ -14521,7 +14585,7 @@
{
color .tl_set:N = \l_@@_draw_tl ,
draw .code:n =
- \exp_args:Ne \tl_if_empty:nF { #1 } { \tl_set:Nn \l_@@_draw_tl { #1 } } ,
+ \tl_if_empty:eF { #1 } { \tl_set:Nn \l_@@_draw_tl { #1 } } ,
draw .default:n = default ,
line-width .dim_set:N = \l_@@_line_width_dim ,
rounded-corners .dim_set:N = \l_@@_rounded_corners_dim ,
@@ -14544,8 +14608,8 @@
\tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl
\@@_cut_on_hyphen:w #3 \q_stop
- \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
- \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \tl_set:Ne \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Ne \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
\int_step_inline:nnn \l_@@_tmpd_tl \l_tmpb_tl
{
\use:e
@@ -14568,8 +14632,8 @@
\tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl
\@@_cut_on_hyphen:w #3 \q_stop
- \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
- \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \tl_set:Ne \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Ne \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
\int_step_inline:nnn \l_@@_tmpc_tl \l_tmpa_tl
{
\use:e
@@ -14600,7 +14664,7 @@
{ \@@_error:n { borders~forbidden } }
{
\tl_clear_new:N \l_@@_borders_tikz_tl
- \keys_set:nV
+ \keys_set:no
{ nicematrix / OnlyForTikzInBorders }
\l_@@_borders_clist
\@@_cut_on_hyphen:w #2 \q_stop
@@ -14607,8 +14671,8 @@
\tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl
\@@_cut_on_hyphen:w #3 \q_stop
- \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
- \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \tl_set:Ne \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Ne \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
\@@_stroke_borders_block_i:
}
}
@@ -14617,7 +14681,7 @@
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
{
- \cs_new_protected:Npx \@@_stroke_borders_block_i:
+ \cs_new_protected:Npe \@@_stroke_borders_block_i:
{
\c_@@_pgfortikzpicture_tl
\@@_stroke_borders_block_ii:
@@ -14725,19 +14789,34 @@
%
% \bigskip
% The following command will be used if the key |tikz| has been used for the
-% command |\Block|. The arguments |#1| and |#2| are the coordinates of the first
-% cell and |#3| and |#4| the coordinates of the last cell of the block. |#5| is
-% a comma-separated list of the Tikz keys used with the path. However, among
-% those keys, you have added in \pkg{nicematrix} a special key |offset| (an
-% offset for the rectangle of the block). That's why we have to extract that key
-% first.
+% command |\Block|.
+
+% |#1| is a \emph{list of lists} of Tikz keys used with the path.
+%
+% \emph{Example}: |{{offset=1pt,draw,red},{offset=2pt,draw,blue}}|
+%
+% which arises from a command such as :
+%
+% |\Block[tikz={offset=1pt,draw,red},tikz={offset=2pt,draw,blue}]{2-2}{}|
+%
+% The arguments |#2| and |#3| are the coordinates of the first
+% cell and |#4| and |#5| the coordinates of the last cell of the block.
+%
% \begin{macrocode}
+\cs_generate_variant:Nn \@@_block_tikz:nnnnn { o }
\cs_new_protected:Npn \@@_block_tikz:nnnnn #1 #2 #3 #4 #5
{
\begin { tikzpicture }
\@@_clip_with_rounded_corners:
- \clist_map_inline:nn { #5 }
+% \end{macrocode}
+% We use |clist_map_inline:nn| because |#5| is a list of lists.
+% \begin{macrocode}
+ \clist_map_inline:nn { #1 }
{
+% \end{macrocode}
+% We extract the key |offset| which is \emph{not} a key of TikZ but a key added
+% by \pkg{nicematrix}.
+% \begin{macrocode}
\keys_set_known:nnN { nicematrix / SpecialOffset } { ##1 } \l_tmpa_tl
\use:e { \exp_not:N \path [ \l_tmpa_tl ] }
(
@@ -14745,7 +14824,7 @@
xshift = \dim_use:N \l_@@_offset_dim ,
yshift = - \dim_use:N \l_@@_offset_dim
]
- #1 -| #2
+ #2 -| #3
)
rectangle
(
@@ -14753,12 +14832,11 @@
xshift = - \dim_use:N \l_@@_offset_dim ,
yshift = \dim_use:N \l_@@_offset_dim
]
- \int_eval:n { #3 + 1 } -| \int_eval:n { #4 + 1 }
+ \int_eval:n { #4 + 1 } -| \int_eval:n { #5 + 1 }
) ;
}
\end { tikzpicture }
}
-\cs_generate_variant:Nn \@@_block_tikz:nnnnn { n n n n V }
% \end{macrocode}
%
% \medskip
@@ -14885,7 +14963,7 @@
\cs_set_protected:cpn { #1 AutoNiceMatrix }
{
\bool_gset_true:N \g_@@_delims_bool
- \str_gset:Nx \g_@@_name_env_str { #1 AutoNiceMatrix }
+ \str_gset:Ne \g_@@_name_env_str { #1 AutoNiceMatrix }
\AutoNiceMatrixWithDelims { #2 } { #3 }
}
}
@@ -14946,7 +15024,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_diagbox:nn #1 #2
{
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\@@_actually_diagbox:nnnnnn
{ \int_use:N \c at iRow }
@@ -14970,7 +15048,7 @@
% because a cell with |\diagbox| must be considered as non empty by the key
% |corners|.
% \begin{macrocode}
- \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
+ \seq_gput_right:Ne \g_@@_pos_of_blocks_seq
{
{ \int_use:N \c at iRow }
{ \int_use:N \c at jCol }
@@ -15024,7 +15102,10 @@
\pgfnode { rectangle } { south~west }
{
\begin { minipage } { 20 cm }
- \@@_math_toggle: #5 \@@_math_toggle:
+% \end{macrocode}
+% The |\scan_stop:| avoids an error in math mode when the argument |#5| is empty.
+% \begin{macrocode}
+ \@@_math_toggle: \scan_stop: #5 \@@_math_toggle:
\end { minipage }
}
{ }
@@ -15035,7 +15116,7 @@
{
\begin { minipage } { 20 cm }
\raggedleft
- \@@_math_toggle: #6 \@@_math_toggle:
+ \@@_math_toggle: \scan_stop: #6 \@@_math_toggle:
\end { minipage }
}
{ }
@@ -15288,7 +15369,7 @@
{
\peek_remove_spaces:n
{
- \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ \tl_gput_right:Ne \g_@@_pre_code_after_tl
{
\SubMatrix { #1 } { #2 } { #3 } { #4 }
[
@@ -15316,15 +15397,16 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_SubMatrix_in_code_before_i:nnnn #1 #2 #3 #4
{
- \seq_gput_right:Nx \g_@@_submatrix_seq
+ \seq_gput_right:Ne \g_@@_submatrix_seq
{
% \end{macrocode}
-% We use |\str_if_eq:nnTF| because it is fully expandable.
+% We use |\str_if_eq:eeTF| because it is fully expandable (and slightly faster
+% than |\tl_if_eq:nnTF|).
% \begin{macrocode}
- { \str_if_eq:nnTF { #1 } { last } { \int_use:N \c at iRow } { #1 } }
- { \str_if_eq:nnTF { #2 } { last } { \int_use:N \c at jCol } { #2 } }
- { \str_if_eq:nnTF { #3 } { last } { \int_use:N \c at iRow } { #3 } }
- { \str_if_eq:nnTF { #4 } { last } { \int_use:N \c at jCol } { #4 } }
+ { \str_if_eq:eeTF { #1 } { last } { \int_use:N \c at iRow } { #1 } }
+ { \str_if_eq:eeTF { #2 } { last } { \int_use:N \c at jCol } { #2 } }
+ { \str_if_eq:eeTF { #3 } { last } { \int_use:N \c at iRow } { #3 } }
+ { \str_if_eq:eeTF { #4 } { last } { \int_use:N \c at jCol } { #4 } }
}
}
% \end{macrocode}
@@ -15422,15 +15504,15 @@
{ pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_first_j_tl }
{
\pgfpointanchor { \@@_env: - ##1 - \l_@@_first_j_tl } { west }
- \dim_set:Nn \l_@@_x_initial_dim
- { \dim_min:nn \l_@@_x_initial_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x < \l_@@_x_initial_dim
+ { \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x }
}
\cs_if_exist:cT
{ pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_last_j_tl }
{
\pgfpointanchor { \@@_env: - ##1 - \l_@@_last_j_tl } { east }
- \dim_set:Nn \l_@@_x_final_dim
- { \dim_max:nn \l_@@_x_final_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x > \l_@@_x_final_dim
+ { \dim_set_eq:NN \l_@@_x_final_dim \pgf at x }
}
}
\dim_compare:nNnTF \l_@@_x_initial_dim = \c_max_dim
@@ -15477,8 +15559,8 @@
{ pgf @ sh @ ns @ \@@_env: - \l_@@_last_i_tl - ##1 }
{
\pgfpointanchor { \@@_env: - \l_@@_last_i_tl - ##1 } { south }
- \dim_set:Nn \l_@@_y_final_dim
- { \dim_min:nn \l_@@_y_final_dim \pgf at y }
+ \dim_compare:nNnT \pgf at y < \l_@@_y_final_dim
+ { \dim_set_eq:NN \l_@@_y_final_dim \pgf at y }
}
}
\dim_set:Nn \l_tmpa_dim
@@ -15647,7 +15729,7 @@
%
% \begin{macrocode}
\cs_set_eq:NN \pgfpointanchor \@@_pgfpointanchor:n
- \flag_clear_new:n { nicematrix }
+ \flag_clear_new:N \l_@@_code_flag
\l_@@_code_tl
}
% \end{macrocode}
@@ -15719,8 +15801,8 @@
{
\str_case:nVTF { #1 } \c_@@_integers_alist_tl
{
- \flag_raise:n { nicematrix }
- \int_if_even:nTF { \flag_height:n { nicematrix } }
+ \flag_raise:N \l_@@_code_flag
+ \int_if_even:nTF { \flag_height:N \l_@@_code_flag }
{ \int_eval:n { #1 + \l_@@_first_i_tl - 1 } }
{ \int_eval:n { #1 + \l_@@_first_j_tl - 1 } }
}
@@ -15883,7 +15965,7 @@
{ \int_compare_p:nNn \l_@@_last_i_tl > \g_@@_row_total_int }
{ \int_compare_p:nNn \l_@@_last_j_tl > \g_@@_col_total_int }
{
- \str_if_eq:nnTF { #5 } { under }
+ \str_if_eq:eeTF { #5 } { under }
{ \@@_error:nn { Construct~too~large } { \UnderBrace } }
{ \@@_error:nn { Construct~too~large } { \OverBrace } }
}
@@ -15903,8 +15985,9 @@
{ pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_first_j_tl }
{
\pgfpointanchor { \@@_env: - ##1 - \l_@@_first_j_tl } { west }
- \dim_set:Nn \l_@@_x_initial_dim
- { \dim_min:nn \l_@@_x_initial_dim \pgf at x }
+
+ \dim_compare:nNnT \pgf at x < \l_@@_x_initial_dim
+ { \dim_set_eq:NN \l_@@_x_initial_dim \pgf at x }
}
}
}
@@ -15924,8 +16007,8 @@
{ pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_last_j_tl }
{
\pgfpointanchor { \@@_env: - ##1 - \l_@@_last_j_tl } { east }
- \dim_set:Nn \l_@@_x_final_dim
- { \dim_max:nn \l_@@_x_final_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x > \l_@@_x_final_dim
+ { \dim_set_eq:NN \l_@@_x_final_dim \pgf at x }
}
}
}
@@ -15937,7 +16020,7 @@
\dim_set_eq:NN \l_@@_x_final_dim \pgf at x
}
\pgfset { inner~sep = \c_zero_dim }
- \str_if_eq:nnTF { #5 } { under }
+ \str_if_eq:eeTF { #5 } { under }
{ \@@_underbrace_i:n { #3 } }
{ \@@_overbrace_i:n { #3 } }
\endpgfpicture
@@ -16082,15 +16165,16 @@
\tl_new:N \@@_i_tl
\tl_new:N \@@_j_tl
+
\cs_new_protected:Nn \@@_all_the_cells:
{
- \int_step_variable:nNn { \int_use:c { c at iRow } } \@@_i_tl
+ \int_step_variable:nNn \c at iRow \@@_i_tl
{
- \int_step_variable:nNn { \int_use:c { c at jCol } } \@@_j_tl
+ \int_step_variable:nNn \c at jCol \@@_j_tl
{
\cs_if_exist:cF { cell - \@@_i_tl - \@@_j_tl }
{
- \exp_args:NNe \seq_if_in:NnF \l_@@_corners_cells_seq
+ \clist_if_in:NeF \l_@@_corners_cells_clist
{ \@@_i_tl - \@@_j_tl }
{
\bool_set_false:N \l_tmpa_bool
@@ -16106,8 +16190,8 @@
}
\bool_if:NT \l_tmpa_bool
{
- \@@_block_tikz:nnnnV
- \@@_i_tl \@@_j_tl \@@_i_tl \@@_j_tl \l_tmpa_tl
+ \@@_block_tikz:onnnn
+ \l_tmpa_tl \@@_i_tl \@@_j_tl \@@_i_tl \@@_j_tl
}
}
}
@@ -16119,8 +16203,8 @@
{
\bool_if:NF \l_@@_empty_bool
{
- \@@_block_tikz:nnnnV
- { #1 } { #2 } { #3 } { #4 } \l_tmpa_tl
+ \@@_block_tikz:onnnn
+ \l_tmpa_tl { #1 } { #2 } { #3 } { #4 }
}
\@@_mark_cells_of_block:nnnn { #1 } { #2 } { #3 } { #4 }
}
@@ -16130,7 +16214,7 @@
\int_step_inline:nnn { #1 } { #3 }
{
\int_step_inline:nnn { #2 } { #4 }
- { \cs_set:cpn { cell - ##1 - ####1 } { } }
+ { \cs_set_nopar:cpn { cell - ##1 - ####1 } { } }
}
}
% \end{macrocode}
@@ -16347,7 +16431,6 @@
footnote,~
footnotehyper,~
messages-for-Overleaf,~
- no-test-for-array,~
renew-dots,~and~
renew-matrix.
}
@@ -16364,8 +16447,11 @@
messages-for-Overleaf .bool_set:N = \g_@@_messages_for_Overleaf_bool ,
footnote .bool_set:N = \g_@@_footnote_bool ,
footnotehyper .bool_set:N = \g_@@_footnotehyper_bool ,
- no-test-for-array .bool_set:N = \g_@@_no_test_for_array_bool ,
- no-test-for-array .default:n = true ,
+% \end{macrocode}
+% The test for a potential modification of \pkg{array} has been deleted. You
+% keep the following key only for compatibility but maybe we will delete it.
+% \begin{macrocode}
+ no-test-for-array .code:n = \prg_do_nothing: ,
unknown .code:n = \@@_error:n { Unknown~key~for~package }
}
\ProcessKeysOptions { nicematrix / Package }
@@ -16444,9 +16530,8 @@
%
% \begin{macrocode}
\bool_new:N \l_@@_underscore_loaded_bool
-\IfPackageLoadedTF { underscore }
+\IfPackageLoadedT { underscore }
{ \bool_set_true:N \l_@@_underscore_loaded_bool }
- { }
% \end{macrocode}
%
% \begin{macrocode}
@@ -16454,9 +16539,8 @@
{
\bool_if:NF \l_@@_underscore_loaded_bool
{
- \IfPackageLoadedTF { underscore }
+ \IfPackageLoadedT { underscore }
{ \@@_error:n { underscore~after~nicematrix } }
- { }
}
}
% \end{macrocode}
@@ -16480,7 +16564,7 @@
NiceMatrix ,
pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix
}
-\seq_gset_map_x:NNn \g_@@_types_of_matrix_seq \g_@@_types_of_matrix_seq
+\seq_gset_map_e:NNn \g_@@_types_of_matrix_seq \g_@@_types_of_matrix_seq
{ \tl_to_str:n { #1 } }
% \end{macrocode}
%
@@ -16487,26 +16571,20 @@
% \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:NoTF| is
+% information to the user in the error message. The command |\seq_if_in:NoF| 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: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 } }
- {
- \int_compare:nNnTF \l_@@_last_col_int = { -1 }
- { \@@_fatal:n { too~much~cols~for~matrix } }
- {
- \bool_if:NF \l_@@_last_col_without_value_bool
- { \@@_fatal:n { too~much~cols~for~matrix~with~last~col } }
- }
- }
- }
+ \seq_if_in:NoF \g_@@_types_of_matrix_seq \g_@@_name_env_str
{ \@@_fatal:nn { too~much~cols~for~array } }
+ \int_compare:nNnT \l_@@_last_col_int = { -2 }
+ { \@@_fatal:n { too~much~cols~for~matrix } }
+ \int_compare:nNnT \l_@@_last_col_int = { -1 }
+ { \@@_fatal:n { too~much~cols~for~matrix } }
+ \bool_if:NF \l_@@_last_col_without_value_bool
+ { \@@_fatal:n { too~much~cols~for~matrix~with~last~col } }
}
% \end{macrocode}
%
@@ -16896,15 +16974,6 @@
% \end{macrocode}
%
% \begin{macrocode}
-\@@_msg_new:nn { ragged2e~not~loaded }
- {
- You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~
- your~column~'\l_@@_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:o
- \l_keys_key_str'~will~be~used~instead.
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\@@_msg_new:nn { Invalid~name }
{
Invalid~name.\\
@@ -17078,8 +17147,7 @@
(in~the~key~'borders'~of~the~command~\token_to_str:N \Block).~
The~available~values~are:~left,~right,~top~and~bottom~(and~you~can~
also~use~the~key~'tikz'
- \IfPackageLoadedTF { tikz }
- { }
+ \IfPackageLoadedF { tikz }
{~if~you~load~the~LaTeX~package~'tikz'}).\\
This~specification~of~border~will~be~ignored.
}
Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2024-10-24 20:02:39 UTC (rev 72643)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2024-10-24 20:02:52 UTC (rev 72644)
@@ -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.28c}
-\def\myfiledate{2024/08/22}
+\def\myfileversion{6.29}
+\def\myfiledate{2024/10/24}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -28,6 +28,11 @@
{\myfiledate}
{\myfileversion}
{Enhanced arrays with the help of PGF/TikZ}
+\ProvideDocumentCommand{\IfPackageLoadedT}{mm}
+ {\IfPackageLoadedTF{#1}{#2}{}}
+
+\ProvideDocumentCommand{\IfPackageLoadedF}{mm}
+ {\IfPackageLoadedTF{#1}{}{#2}}
\RequirePackage { amsmath }
\RequirePackage { array }
\bool_const:Nn \c__nicematrix_tagging_array_bool
@@ -55,7 +60,7 @@
\bool_gset:Nn \g__nicematrix_messages_for_Overleaf_bool
{
\str_if_eq_p:on \c_sys_jobname_str { _region_ } % for Emacs
- || \str_if_eq_p:on \c_sys_jobname_str { output } % for Overleaf
+ || \str_if_eq_p:ee \c_sys_jobname_str { output } % for Overleaf
}
\cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn
{ \msg_redirect_name:nnn { nicematrix } }
@@ -78,60 +83,13 @@
}
\cs_set:Npn \int_if_zero:NT #1 { \int_compare:nNnT #1 = \c_zero_int }
\cs_set:Npn \int_if_zero:NTF #1 { \int_compare:nNnTF #1 = \c_zero_int }
-\__nicematrix_msg_new:nn { Internal~error }
- {
- Potential~problem~when~using~nicematrix.\\
- The~package~nicematrix~have~detected~a~modification~of~the~
- standard~environment~{array}~(of~the~package~array).~Maybe~you~will~encounter~
- some~slight~problems~when~using~nicematrix.~If~you~don't~want~to~see~
- this~message~again,~load~nicematrix~with:~\token_to_str:N
- \usepackage[no-test-for-array]{nicematrix}.
- }
\__nicematrix_msg_new:nn { mdwtab~loaded }
{
The~packages~'mdwtab'~and~'nicematrix'~are~incompatible.~
This~error~is~fatal.
}
-\cs_new_protected:Npn \__nicematrix_security_test:n #1
- {
- \peek_meaning:NTF \ignorespaces
- { \__nicematrix_security_test_i:w }
- { \__nicematrix_error:n { Internal~error } }
- #1
- }
-\bool_if:NTF \c__nicematrix_tagging_array_bool
- {
- \cs_new_protected:Npn \__nicematrix_security_test_i:w \ignorespaces #1
- {
- \peek_meaning:NF \textonly at unskip { \__nicematrix_error:n { Internal~error } }
- #1
- }
- }
- {
- \cs_new_protected:Npn \__nicematrix_security_test_i:w \ignorespaces #1
- {
- \peek_meaning:NF \unskip { \__nicematrix_error:n { Internal~error } }
- #1
- }
- }
\hook_gput_code:nnn { begindocument / end } { . }
- {
- \IfPackageLoadedTF { mdwtab }
- { \__nicematrix_fatal:n { mdwtab~loaded } }
- {
- \bool_if:NF \g__nicematrix_no_test_for_array_bool
- {
- \group_begin:
- \hbox_set:Nn \l_tmpa_box
- {
- \begin { tabular } { c > { \__nicematrix_security_test:n } c c }
- text & & text
- \end { tabular }
- }
- \group_end:
- }
- }
- }
+ { \IfPackageLoadedT { mdwtab } { \__nicematrix_fatal:n { mdwtab~loaded } } }
\cs_new_protected:Npn \__nicematrix_collect_options:n #1
{
\peek_meaning:NTF [
@@ -162,14 +120,16 @@
\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 o n }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N o }
\cs_generate_variant:Nn \str_lowercase:n { o }
+\cs_generate_variant:Nn \str_set:Nn { N o }
+\cs_generate_variant:Nn \tl_build_put_right:Nn { N o }
+\prg_generate_conditional_variant:Nnn \clist_if_in:Nn { N e } { T , F, TF }
+\prg_generate_conditional_variant:Nnn \tl_if_empty:n { e } { T }
+\prg_generate_conditional_variant:Nnn \tl_if_head_eq_meaning:nN { o N } { TF }
+\cs_generate_variant:Nn \dim_min:nn { v }
+\cs_generate_variant:Nn \dim_max:nn { v }
\hook_gput_code:nnn { begindocument } { . }
{
\IfPackageLoadedTF { tikz }
@@ -220,9 +180,8 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { booktabs }
+ \IfPackageLoadedT { booktabs }
{ \iow_now:Nn \@mainaux \nicematrix at redefine@check at rerun }
- { }
}
\cs_set_protected:Npn \nicematrix at redefine@check at rerun
{
@@ -235,8 +194,7 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { colortbl }
- { }
+ \IfPackageLoadedF { colortbl }
{
\cs_set_protected:Npn \CT at arc@ { }
\cs_set_nopar:Npn \arrayrulecolor #1 # { \CT at arc { #1 } }
@@ -282,6 +240,7 @@
\cs_set:Npn \__nicematrix_cline
{ \__nicematrix_cline_i:en \l__nicematrix_first_col_int }
\cs_set:Npn \__nicematrix_cline_i:nn #1 #2 { \__nicematrix_cline_i:w #1|#2- \q_stop }
+\cs_generate_variant:Nn \__nicematrix_cline_i:nn { e }
\cs_set:Npn \__nicematrix_cline_i:w #1|#2-#3 \q_stop
{
\tl_if_empty:nTF { #3 }
@@ -304,8 +263,8 @@
{ & \__nicematrix_cline_i:en { \int_eval:n { #3 + 1 } } }
{ \everycr { } \cr }
}
-\cs_generate_variant:Nn \__nicematrix_cline_i:nn { e n }
\cs_set_eq:NN \__nicematrix_math_toggle: \c_math_toggle_token
+\cs_generate_variant:Nn \__nicematrix_set_CT at arc@:n { o }
\cs_new_protected:Npn \__nicematrix_set_CT at arc@:n #1
{
\tl_if_blank:nF { #1 }
@@ -315,7 +274,7 @@
{ \cs_set_nopar:Npn \CT at arc@ { \color { #1 } } }
}
}
-\cs_generate_variant:Nn \__nicematrix_set_CT at arc@:n { o }
+\cs_generate_variant:Nn \__nicematrix_set_CT at drsc@:n { o }
\cs_new_protected:Npn \__nicematrix_set_CT at drsc@:n #1
{
\tl_if_head_eq_meaning:nNTF { #1 } [
@@ -322,7 +281,7 @@
{ \cs_set_nopar:Npn \CT at drsc@ { \color #1 } }
{ \cs_set_nopar:Npn \CT at drsc@ { \color { #1 } } }
}
-\cs_generate_variant:Nn \__nicematrix_set_CT at drsc@:n { o }
+\cs_generate_variant:Nn \__nicematrix_exp_color_arg:Nn { N o }
\cs_new:Npn \__nicematrix_exp_color_arg:Nn #1 #2
{
\tl_if_head_eq_meaning:nNTF { #2 } [
@@ -329,10 +288,9 @@
{ #1 #2 }
{ #1 { #2 } }
}
-\cs_generate_variant:Nn \__nicematrix_exp_color_arg:Nn { N o }
+\cs_generate_variant:Nn \__nicematrix_color: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 { o }
\cs_new_protected:Npn \__nicematrix_rescan_for_spanish:N #1
{
\tl_set_rescan:Nno
@@ -410,7 +368,7 @@
\bool_new:N \l__nicematrix_bold_row_style_bool
\cs_new:Npn \__nicematrix_full_name_env:
{
- \str_if_eq:onTF \g__nicematrix_com_or_env_str { command }
+ \str_if_eq:eeTF \g__nicematrix_com_or_env_str { command }
{ command \space \c_backslash_str \g__nicematrix_name_env_str }
{ environment \space \{ \g__nicematrix_name_env_str \} }
}
@@ -454,7 +412,7 @@
\seq_new:N \g__nicematrix_pos_of_blocks_seq
\seq_new:N \g__nicematrix_pos_of_xdots_seq
\seq_new:N \g__nicematrix_pos_of_stroken_blocks_seq
-\seq_new:N \l__nicematrix_corners_cells_seq
+\clist_new:N \l__nicematrix_corners_cells_clist
\seq_new:N \g__nicematrix_submatrix_names_seq
\bool_new:N \l__nicematrix_width_used_bool
\seq_new:N \g__nicematrix_multicolumn_cells_seq
@@ -519,7 +477,7 @@
}
\cs_new_protected:Npn \__nicematrix_expand_clist:N #1
{
- \clist_if_in:NVF #1 \c__nicematrix_all_tl
+ \clist_if_in:NnF #1 { all }
{
\clist_clear:N \l_tmpa_clist
\clist_map_inline:Nn #1
@@ -632,7 +590,7 @@
\seq_gput_right:Nn \g__nicematrix_notes_seq { { #1 } { #2 } }
\tl_if_novalue:nT { #1 } { \int_gincr:N \c at tabularnote }
}
- \seq_put_right:Nx \l__nicematrix_notes_labels_seq
+ \seq_put_right:Ne \l__nicematrix_notes_labels_seq
{
\tl_if_novalue:nTF { #1 }
{
@@ -666,8 +624,8 @@
{ \int_gincr:N \c at tabularnote }
\seq_clear:N \l__nicematrix_notes_labels_seq
\bool_lazy_or:nnTF
- { \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 }
+ { \str_if_eq_p:ee \l__nicematrix_hpos_cell_tl { c } }
+ { \str_if_eq_p:ee \l__nicematrix_hpos_cell_tl { r } }
{
\hbox_overlap_right:n { \box_use:N \l_tmpa_box }
\skip_horizontal:n { \box_wd:N \l_tmpa_box }
@@ -694,7 +652,7 @@
{ \seq_gput_right:Nn \g__nicematrix_notes_in_caption_seq { { #1 } { #2 } } }
}
\tl_if_novalue:nT { #1 } { \int_gincr:N \c at tabularnote }
- \seq_put_right:Nx \l__nicematrix_notes_labels_seq
+ \seq_put_right:Ne \l__nicematrix_notes_labels_seq
{
\tl_if_novalue:nTF { #1 }
{ \__nicematrix_notes_format:n { \int_use:N \c at tabularnote } }
@@ -984,7 +942,7 @@
baseline .tl_set:N = \l__nicematrix_baseline_tl ,
baseline .value_required:n = true ,
columns-width .code:n =
- \tl_if_eq:nnTF { #1 } { auto }
+ \str_if_eq:eeTF { #1 } { auto }
{ \bool_set_true:N \l__nicematrix_auto_columns_width_bool }
{ \dim_set:Nn \l__nicematrix_columns_width_dim { #1 } } ,
columns-width .value_required:n = true ,
@@ -991,10 +949,10 @@
name .code:n =
\legacy_if:nF { measuring@ }
{
- \str_set:Nx \l_tmpa_str { #1 }
- \seq_if_in:NVTF \g__nicematrix_names_seq \l_tmpa_str
+ \str_set:Ne \l_tmpa_str { #1 }
+ \seq_if_in:NoTF \g__nicematrix_names_seq \l_tmpa_str
{ \__nicematrix_error:nn { Duplicate~name } { #1 } }
- { \seq_gput_left:NV \g__nicematrix_names_seq \l_tmpa_str }
+ { \seq_gput_left:No \g__nicematrix_names_seq \l_tmpa_str }
\str_set_eq:NN \l__nicematrix_name_str \l_tmpa_str
} ,
name .value_required:n = true ,
@@ -1026,9 +984,8 @@
{
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { enumitem }
+ \IfPackageLoadedT { enumitem }
{ \setlist* [ tabularnotes ] { #1 } }
- { }
}
} ,
enumitem-keys .value_required:n = true ,
@@ -1036,9 +993,8 @@
{
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { enumitem }
+ \IfPackageLoadedT { enumitem }
{ \setlist* [ tabularnotes* ] { #1 } }
- { }
}
} ,
enumitem-keys-para .value_required:n = true ,
@@ -1115,7 +1071,7 @@
renew-matrix .value_forbidden:n = true ,
exterior-arraycolsep .bool_set:N = \l__nicematrix_exterior_arraycolsep_bool ,
columns-width .code:n =
- \tl_if_eq:nnTF { #1 } { auto }
+ \str_if_eq:eeTF { #1 } { auto }
{ \__nicematrix_error:n { Option~auto~for~columns-width } }
{ \dim_set:Nn \l__nicematrix_columns_width_dim { #1 } } ,
allow-duplicate-names .code:n =
@@ -1169,7 +1125,7 @@
\keys_define:nn { nicematrix / pNiceArray }
{
first-col .code:n = \int_zero:N \l__nicematrix_first_col_int ,
- last-col .code:n = \tl_if_empty:nF {#1}
+ last-col .code:n = \tl_if_empty:nF { #1 }
{ \__nicematrix_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l__nicematrix_last_col_int ,
first-row .code:n = \int_zero:N \l__nicematrix_first_row_int ,
@@ -1199,7 +1155,7 @@
short-caption .value_required:n = true ,
label .tl_set:N = \l__nicematrix_label_tl ,
label .value_required:n = true ,
- last-col .code:n = \tl_if_empty:nF {#1}
+ last-col .code:n = \tl_if_empty:nF { #1 }
{ \__nicematrix_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l__nicematrix_last_col_int ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
@@ -1232,22 +1188,19 @@
}
\cs_new_protected:Npn \__nicematrix_tuning_first_row:
{
- \int_if_zero:nT \c at iRow
- {
- \int_compare:nNnT \c at jCol > \c_zero_int
- {
- \l__nicematrix_code_for_first_row_tl
- \xglobal \colorlet { nicematrix-first-row } { . }
- }
- }
+ \if_int_compare:w \c at iRow = \c_zero_int
+ \if_int_compare:w \c at jCol > \c_zero_int
+ \l__nicematrix_code_for_first_row_tl
+ \xglobal \colorlet { nicematrix-first-row } { . }
+ \fi:
+ \fi:
}
\cs_new_protected:Npn \__nicematrix_tuning_last_row:
{
- \int_compare:nNnT \c at iRow = \l__nicematrix_last_row_int
- {
- \l__nicematrix_code_for_last_row_tl
- \xglobal \colorlet { nicematrix-last-row } { . }
- }
+ \if_int_compare:w \c at iRow = \l__nicematrix_last_row_int
+ \l__nicematrix_code_for_last_row_tl
+ \xglobal \colorlet { nicematrix-last-row } { . }
+ \fi:
}
\cs_set_eq:NN \__nicematrix_tuning_key_small: \prg_do_nothing:
\cs_set_nopar:Npn \__nicematrix_tuning_not_tabular_begin:
@@ -1279,16 +1232,16 @@
{
\int_if_zero:nTF \c at iRow
{
- \dim_gset:Nn \g__nicematrix_dp_row_zero_dim
- { \dim_max:nn \g__nicematrix_dp_row_zero_dim { \box_dp:N \l__nicematrix_cell_box } }
- \dim_gset:Nn \g__nicematrix_ht_row_zero_dim
- { \dim_max:nn \g__nicematrix_ht_row_zero_dim { \box_ht:N \l__nicematrix_cell_box } }
+ \dim_compare:nNnT { \box_dp:N \l__nicematrix_cell_box } > \g__nicematrix_dp_row_zero_dim
+ { \dim_gset:Nn \g__nicematrix_dp_row_zero_dim { \box_dp:N \l__nicematrix_cell_box } }
+ \dim_compare:nNnT { \box_ht:N \l__nicematrix_cell_box } > \g__nicematrix_ht_row_zero_dim
+ { \dim_gset:Nn \g__nicematrix_ht_row_zero_dim { \box_ht:N \l__nicematrix_cell_box } }
}
{
\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 } }
+ \dim_compare:nNnT { \box_ht:N \l__nicematrix_cell_box } > \g__nicematrix_ht_row_zero_dim
+ { \dim_gset:Nn \g__nicematrix_ht_row_zero_dim { \box_ht:N \l__nicematrix_cell_box } }
}
}
}
@@ -1367,7 +1320,8 @@
{ \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 }
+ \int_compare:nNnT \c at jCol > \g__nicematrix_col_total_int
+ { \int_gset_eq:NN \g__nicematrix_col_total_int \c at jCol }
\bool_gset_false:N \g__nicematrix_empty_cell_bool
\bool_gset_false:N \g__nicematrix_not_empty_cell_bool
}
@@ -1453,7 +1407,7 @@
{ \__nicematrix_patch_node_for_cell:n { } }
\cs_new_protected:Npn \__nicematrix_instruction_of_type:nnn #1 #2 #3
{
- \bool_if:nTF { #1 } \tl_gput_left:cx \tl_gput_right:cx
+ \bool_if:nTF { #1 } \tl_gput_left:ce \tl_gput_right:ce
{ g__nicematrix_ #2 _ lines _ tl }
{
\use:c { __nicematrix _ draw _ #2 : nnn }
@@ -1462,15 +1416,16 @@
{ \exp_not:n { #3 } }
}
}
-\cs_new_protected:Npn \__nicematrix_array:
+\cs_generate_variant:Nn \__nicematrix_array:n { o }
+\cs_new_protected:Npn \__nicematrix_array:n
{
\dim_set:Nn \col at sep
{ \bool_if:NTF \l__nicematrix_tabular_bool \tabcolsep \arraycolsep }
\dim_compare:nNnTF \l__nicematrix_tabular_width_dim = \c_zero_dim
{ \cs_set_nopar:Npn \@halignto { } }
- { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l__nicematrix_tabular_width_dim } }
+ { \cs_set_nopar:Npe \@halignto { to \dim_use:N \l__nicematrix_tabular_width_dim } }
\@tabarray
- [ \str_if_eq:onTF \l__nicematrix_baseline_tl c c t ]
+ [ \str_if_eq:eeTF \l__nicematrix_baseline_tl c c t ]
}
\bool_if:NTF \c__nicematrix_tagging_array_bool
{ \cs_set_eq:NN \__nicematrix_old_ar at ialign: \ar at ialign }
@@ -1523,12 +1478,11 @@
\bool_if:NF \g__nicematrix_row_of_col_done_bool
{
\__nicematrix_create_row_node:
- \tl_if_empty:NF \l__nicematrix_hlines_clist
+ \clist_if_empty:NF \l__nicematrix_hlines_clist
{
- \tl_if_eq:NNF \l__nicematrix_hlines_clist \c__nicematrix_all_tl
+ \str_if_eq:eeF \l__nicematrix_hlines_clist { all }
{
- \exp_args:NNe
- \clist_if_in:NnT
+ \clist_if_in:NeT
\l__nicematrix_hlines_clist
{ \int_eval:n { \c at iRow + 1 } }
}
@@ -1560,24 +1514,24 @@
{ \__nicematrix_error:n { without~color-inside } }
}
}
-\cs_new_protected:Npn \__nicematrix_redefine_everycr: { \everycr { \__nicematrix_everycr: } }
- \hook_gput_code:nnn { begindocument } { . }
- {
- \IfPackageLoadedTF { colortbl }
- {
- \cs_set_protected:Npn \__nicematrix_redefine_everycr:
- {
- \CT at everycr
- {
- \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
- \__nicematrix_everycr:
- }
- }
- }
- { }
- }
+\cs_new_protected:Npn \__nicematrix_redefine_everycr:
+ { \everycr { \__nicematrix_everycr: } }
\hook_gput_code:nnn { begindocument } { . }
{
+ \IfPackageLoadedT { colortbl }
+ {
+ \cs_set_protected:Npn \__nicematrix_redefine_everycr:
+ {
+ \CT at everycr
+ {
+ \noalign { \cs_gset_eq:NN \CT at row@color \prg_do_nothing: }
+ \__nicematrix_everycr:
+ }
+ }
+ }
+ }
+\hook_gput_code:nnn { begindocument } { . }
+ {
\IfPackageLoadedTF { booktabs }
{
\cs_new_protected:Npn \__nicematrix_patch_booktabs:
@@ -1594,8 +1548,21 @@
\dim_gset:Nn \g__nicematrix_ht_last_row_dim { \box_ht:N \@arstrutbox }
\dim_gset:Nn \g__nicematrix_dp_last_row_dim { \box_dp:N \@arstrutbox }
}
+\bool_if:NT \c__nicematrix_tagging_array_bool
+ {
+ \cs_new:Npn \__nicematrix_insert at column
+ {
+ \UseTaggingSocket{tbl/cell/begin}
+ \the at toks \the \@tempcnta \ignorespaces
+ \@sharp \textonly at unskip
+ \the at toks \the \count@ \relax
+ \UseTaggingSocket{tbl/cell/end}
+ }
+ }
\cs_new_protected:Npn \__nicematrix_pre_array_ii:
{
+ \bool_if:NT \c__nicematrix_tagging_array_bool
+ { \cs_set_eq:NN \insert at column \__nicematrix_insert at column }
\int_gzero:N \g__nicematrix_total_X_weight_int
\__nicematrix_expand_clist:N \l__nicematrix_hlines_clist
\__nicematrix_expand_clist:N \l__nicematrix_vlines_clist
@@ -1724,10 +1691,10 @@
{
\tl_put_right:Nn \__nicematrix_update_for_first_and_last_row:
{
- \dim_gset:Nn \g__nicematrix_ht_last_row_dim
- { \dim_max:nn \g__nicematrix_ht_last_row_dim { \box_ht:N \l__nicematrix_cell_box } }
- \dim_gset:Nn \g__nicematrix_dp_last_row_dim
- { \dim_max:nn \g__nicematrix_dp_last_row_dim { \box_dp:N \l__nicematrix_cell_box } }
+ \dim_compare:nNnT \g__nicematrix_ht_last_row_dim < { \box_ht:N \l__nicematrix_cell_box }
+ { \dim_gset:Nn \g__nicematrix_ht_last_row_dim { \box_ht:N \l__nicematrix_cell_box } }
+ \dim_compare:nNnT \g__nicematrix_dp_last_row_dim < { \box_dp:N \l__nicematrix_cell_box }
+ { \dim_gset:Nn \g__nicematrix_dp_last_row_dim { \box_dp:N \l__nicematrix_cell_box } }
}
}
\seq_gclear:N \g__nicematrix_cols_vlism_seq
@@ -1768,7 +1735,7 @@
\tl_set:Nn \l_tmpa_tl { #1 }
\int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
{ \__nicematrix_rescan_for_spanish:N \l_tmpa_tl }
- \tl_gput_left:NV \g__nicematrix_pre_code_before_tl \l_tmpa_tl
+ \tl_gput_left:No \g__nicematrix_pre_code_before_tl \l_tmpa_tl
\bool_set_true:N \l__nicematrix_code_before_bool
\__nicematrix_pre_array:
}
@@ -1798,7 +1765,7 @@
\bool_if:NT \g__nicematrix_recreate_cell_nodes_bool \__nicematrix_recreate_cell_nodes:
\endpgfpicture
\__nicematrix_create_blocks_nodes:
- \IfPackageLoadedTF { tikz }
+ \IfPackageLoadedT { tikz }
{
\tikzset
{
@@ -1806,7 +1773,6 @@
{ overlay , name~prefix = \__nicematrix_env: - }
}
}
- { }
\cs_set_eq:NN \cellcolor \__nicematrix_cellcolor
\cs_set_eq:NN \rectanglecolor \__nicematrix_rectanglecolor
\cs_set_eq:NN \roundedrectanglecolor \__nicematrix_roundedrectanglecolor
@@ -1822,6 +1788,8 @@
}
\cs_new_protected:Npn \__nicematrix_exec_code_before:
{
+ \clist_map_inline:Nn \l__nicematrix_corners_cells_clist
+ { \cs_set_nopar:cpn { __nicematrix _ corner _ ##1 } { } }
\seq_gclear_new:N \g__nicematrix_colors_seq
\__nicematrix_add_to_colors_seq:nn { { nocolor } } { }
\bool_gset_false:N \g__nicematrix_recreate_cell_nodes_bool
@@ -1829,7 +1797,7 @@
\bool_if:NT \l__nicematrix_tabular_bool \c_math_toggle_token
\int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
{ \__nicematrix_rescan_for_spanish:N \l__nicematrix_code_before_tl }
- \exp_last_unbraced:NV \__nicematrix_CodeBefore_keys:
+ \exp_last_unbraced:No \__nicematrix_CodeBefore_keys:
\g__nicematrix_pre_code_before_tl
\__nicematrix_actually_color:
\l__nicematrix_code_before_tl
@@ -1994,7 +1962,7 @@
\tl_if_empty:NF \g__nicematrix_code_before_tl
{
\bool_set_true:N \l__nicematrix_code_before_bool
- \tl_put_right:NV \l__nicematrix_code_before_tl \g__nicematrix_code_before_tl
+ \tl_put_right:No \l__nicematrix_code_before_tl \g__nicematrix_code_before_tl
}
\tl_if_empty:NF \g__nicematrix_pre_code_before_tl
{ \bool_set_true:N \l__nicematrix_code_before_bool }
@@ -2032,7 +2000,7 @@
}
\int_compare:nNnT \g__nicematrix_total_X_weight_int > \c_zero_int
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\bool_set_true:N \l__nicematrix_X_columns_aux_bool
\dim_set:Nn \l__nicematrix_X_columns_dim
@@ -2080,10 +2048,10 @@
{ \skip_horizontal:N \g__nicematrix_width_first_col_dim }
\bool_if:nTF { ! \g__nicematrix_delims_bool }
{
- \tl_if_eq:NNTF \l__nicematrix_baseline_tl \c__nicematrix_c_tl
+ \str_if_eq:eeTF \l__nicematrix_baseline_tl { c }
\__nicematrix_use_arraybox_with_notes_c:
{
- \tl_if_eq:NNTF \l__nicematrix_baseline_tl \c__nicematrix_b_tl
+ \str_if_eq:eeTF \l__nicematrix_baseline_tl { b }
\__nicematrix_use_arraybox_with_notes_b:
\__nicematrix_use_arraybox_with_notes:
}
@@ -2144,7 +2112,7 @@
\egroup
\iow_now:Nn \@mainaux { \ExplSyntaxOn }
\iow_now:Nn \@mainaux { \char_set_catcode_space:n { 32 } }
- \iow_now:Nx \@mainaux
+ \iow_now:Ne \@mainaux
{
\tl_gset:cn { c__nicematrix_ \int_use:N \g__nicematrix_env_int _ tl }
{ \exp_not:o \g__nicematrix_aux_tl }
@@ -2177,7 +2145,7 @@
{ ! { \skip_horizontal:N \arrayrulewidth } }
}
}
- \exp_last_unbraced:NV \__nicematrix_rec_preamble:n \g__nicematrix_user_preamble_tl \stop
+ \exp_last_unbraced:No \__nicematrix_rec_preamble:n \g__nicematrix_user_preamble_tl \__nicematrix_stop:
\int_gset_eq:NN \g__nicematrix_static_num_of_col_int \c at jCol
\__nicematrix_replace_columncolor:
}
@@ -2215,7 +2183,7 @@
{
\bool_if:NF \l__nicematrix_tabular_bool
{
- \tl_if_empty:NT \l__nicematrix_vlines_clist
+ \clist_if_empty:NT \l__nicematrix_vlines_clist
{
\bool_if:NF \l__nicematrix_exterior_arraycolsep_bool
{ \tl_gput_left:Nn \g__nicematrix_array_preamble_tl { @ { } } }
@@ -2230,7 +2198,7 @@
{
\bool_if:NF \l__nicematrix_tabular_bool
{
- \tl_if_empty:NT \l__nicematrix_vlines_clist
+ \clist_if_empty:NT \l__nicematrix_vlines_clist
{
\bool_if:NF \l__nicematrix_exterior_arraycolsep_bool
{ \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { @ { } } }
@@ -2252,10 +2220,10 @@
\cs_if_exist:cTF { NC @ find @ #1 }
{
\tl_set_eq:Nc \l_tmpb_tl { NC @ rewrite @ #1 }
- \exp_last_unbraced:NV \__nicematrix_rec_preamble:n \l_tmpb_tl
+ \exp_last_unbraced:No \__nicematrix_rec_preamble:n \l_tmpb_tl
}
{
- \tl_if_eq:nnT { #1 } { S }
+ \str_if_eq:nnTF { #1 } { S }
{ \__nicematrix_fatal:n { unknown~column~type~S } }
{ \__nicematrix_fatal:nn { unknown~column~type } { #1 } }
}
@@ -2309,13 +2277,13 @@
}
\cs_new_protected:Npn \__nicematrix_make_preamble_i_i:n #1
{
- \str_if_eq:nnTF { #1 } |
+ \str_if_eq:nnTF { #1 } { | }
{ \use:c { __nicematrix _ | } | }
{ \__nicematrix_make_preamble_i_ii:nn { } #1 }
}
\cs_new_protected:Npn \__nicematrix_make_preamble_i_ii:nn #1 #2
{
- \str_if_eq:nnTF { #2 } [
+ \str_if_eq:nnTF { #2 } { [ }
{ \__nicematrix_make_preamble_i_ii:nw { #1 } [ }
{ \__nicematrix_make_preamble_i_iii:nn { #2 } { #1 } }
}
@@ -2324,11 +2292,11 @@
\cs_new_protected:Npn \__nicematrix_make_preamble_i_iii:nn #1 #2
{
\__nicematrix_compute_rule_width:n { multiplicity = \l_tmpa_int , #2 }
- \tl_gput_right:Nx \g__nicematrix_array_preamble_tl
+ \tl_gput_right:Ne \g__nicematrix_array_preamble_tl
{
\exp_not:N ! { \skip_horizontal:n { \dim_eval:n { \l__nicematrix_rule_width_dim } } }
}
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_vline:n
{
@@ -2339,7 +2307,7 @@
}
}
\int_zero:N \l_tmpa_int
- \str_if_eq:nnT { #1 } { \stop } { \bool_gset_true:N \g_tmpb_bool }
+ \str_if_eq:nnT { #1 } { \__nicematrix_stop: } { \bool_gset_true:N \g_tmpb_bool }
\__nicematrix_rec_preamble:n #1
}
\cs_new:cpn { __nicematrix _ > } #1 #2
@@ -2356,31 +2324,7 @@
c .value_forbidden:n = true ,
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_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_R_str }
- {
- \__nicematrix_error_or_warning:n { ragged2e~not~loaded }
- \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_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_L_stsr }
- {
- \__nicematrix_error_or_warning:n { ragged2e~not~loaded }
- \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_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_C_str }
- {
- \__nicematrix_error_or_warning:n { ragged2e~not~loaded }
- \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_c_str
- } ,
- C .value_forbidden:n = true ,
- S .code:n = \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_si_str ,
+ S .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { si } ,
S .value_forbidden:n = true ,
p .code:n = \str_set:Nn \l__nicematrix_vpos_col_str { p } ,
p .value_forbidden:n = true ,
@@ -2388,7 +2332,7 @@
m .code:n = \str_set:Nn \l__nicematrix_vpos_col_str { m } ,
m .value_forbidden:n = true ,
b .code:n = \str_set:Nn \l__nicematrix_vpos_col_str { b } ,
- b .value_forbidden:n = true ,
+ b .value_forbidden:n = true
}
\cs_new:Npn \__nicematrix_p #1
{
@@ -2407,7 +2351,7 @@
{ \__nicematrix_make_preamble_ii_iii:nn { #1 } }
\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iii:nn #1 #2
{
- \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_j_str
+ \str_set:Nn \l__nicematrix_hpos_col_str { j }
\__nicematrix_keys_p_column:n { #1 }
\__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { }
}
@@ -2418,29 +2362,37 @@
\use:e
{
\__nicematrix_make_preamble_ii_v:nnnnnnnn
- { \str_if_eq:onTF \l__nicematrix_vpos_col_str { p } { t } { b } }
+ { \str_if_eq:nnTF \l__nicematrix_vpos_col_str { p } { t } { b } }
{ \dim_eval:n { #1 } }
{
- \str_if_eq:NNTF \l__nicematrix_hpos_col_str \c__nicematrix_j_str
+ \str_if_eq:nnTF \l__nicematrix_hpos_col_str { j }
{ \tl_clear:N \exp_not:N \l__nicematrix_hpos_cell_tl }
{
\cs_set_nopar:Npn \exp_not:N \l__nicematrix_hpos_cell_tl
{ \str_lowercase:o \l__nicematrix_hpos_col_str }
}
- \str_case:on \l__nicematrix_hpos_col_str
+ \IfPackageLoadedTF { ragged2e }
{
- c { \exp_not:N \centering }
- l { \exp_not:N \raggedright }
- r { \exp_not:N \raggedleft }
- C { \exp_not:N \Centering }
- L { \exp_not:N \RaggedRight }
- R { \exp_not:N \RaggedLeft }
+ \str_case:on \l__nicematrix_hpos_col_str
+ {
+ c { \exp_not:N \Centering }
+ l { \exp_not:N \RaggedRight }
+ r { \exp_not:N \RaggedLeft }
+ }
}
+ {
+ \str_case:on \l__nicematrix_hpos_col_str
+ {
+ c { \exp_not:N \centering }
+ l { \exp_not:N \raggedright }
+ r { \exp_not:N \raggedleft }
+ }
+ }
#3
}
- { \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: }
+ { \str_if_eq:nnT \l__nicematrix_vpos_col_str { m } \__nicematrix_center_cell_box: }
+ { \str_if_eq:nnT \l__nicematrix_hpos_col_str { si } \siunitx_cell_begin:w }
+ { \str_if_eq:nnT \l__nicematrix_hpos_col_str { si } \siunitx_cell_end: }
{ #2 }
{
\str_case:onF \l__nicematrix_hpos_col_str
@@ -2456,9 +2408,15 @@
}
\cs_new_protected:Npn \__nicematrix_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \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: } } }
+ \str_if_eq:eeTF \l__nicematrix_hpos_col_str { si }
+ {
+ \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: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
@@ -2491,19 +2449,23 @@
}
}
}
-\str_new:N \c__nicematrix_ignorespaces_str
-\str_set:Nx \c__nicematrix_ignorespaces_str { \ignorespaces }
-\str_remove_all:Nn \c__nicematrix_ignorespaces_str { ~ }
\cs_new_protected:Npn \__nicematrix_test_if_empty:
{ \peek_after:Nw \__nicematrix_test_if_empty_i: }
+
\cs_new_protected:Npn \__nicematrix_test_if_empty_i:
+ { \peek_meaning_remove:NT \ignorespaces { \__nicematrix_test_if_empty_ii: } }
+
+\cs_new_protected:Npn \__nicematrix_test_if_empty_ii:
+ { \peek_after:Nw \__nicematrix_test_if_empty_iii: }
+\bool_if:NTF \c__nicematrix_tagging_array_bool
{
- \str_set:Nx \l_tmpa_str { \token_to_meaning:N \l_peek_token }
- \str_if_eq:NNT \l_tmpa_str \c__nicematrix_ignorespaces_str
- { \__nicematrix_test_if_empty:w }
+ \cs_new_protected:Npn \__nicematrix_test_if_empty_iii:
+ { \peek_meaning:NTF \textonly at unskip \__nicematrix_nullify_cell: \ignorespaces }
}
-\cs_new_protected:Npn \__nicematrix_test_if_empty:w \ignorespaces
- { \peek_after:Nw \__nicematrix_test_if_empty_ii: }
+ {
+ \cs_new_protected:Npn \__nicematrix_test_if_empty_iii:
+ { \peek_meaning:NTF \unskip \__nicematrix_nullify_cell: \ignorespaces }
+ }
\cs_new_protected:Npn \__nicematrix_nullify_cell:
{
\tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl
@@ -2512,15 +2474,6 @@
\skip_horizontal:N \l__nicematrix_col_width_dim
}
}
-\bool_if:NTF \c__nicematrix_tagging_array_bool
- {
- \cs_new_protected:Npn \__nicematrix_test_if_empty_ii:
- { \peek_meaning:NT \textonly at unskip \__nicematrix_nullify_cell: }
- }
- {
- \cs_new_protected:Npn \__nicematrix_test_if_empty_ii:
- { \peek_meaning:NT \unskip \__nicematrix_nullify_cell: }
- }
\cs_new_protected:Npn \__nicematrix_test_if_empty_for_S:
{
\peek_meaning:NT \__siunitx_table_skip:n
@@ -2543,7 +2496,7 @@
\box_move_down:nn
{
( \box_ht:N \l__nicematrix_cell_box - \box_ht:N \@arstrutbox
- + \baselineskip ) / 2
+ + \baselineskip ) / 2
}
{ \box_use:N \l__nicematrix_cell_box }
}
@@ -2552,7 +2505,7 @@
}
\cs_new:Npn \__nicematrix_V #1 #2
{
- \str_if_eq:nnTF { #2 } { [ }
+ \str_if_eq:nnTF { #1 } { [ }
{ \__nicematrix_make_preamble_V_i:w [ }
{ \__nicematrix_make_preamble_V_i:w [ ] { #2 } }
}
@@ -2561,7 +2514,7 @@
\cs_new_protected:Npn \__nicematrix_make_preamble_V_ii:nn #1 #2
{
\str_set:Nn \l__nicematrix_vpos_col_str { p }
- \str_set_eq:NN \l__nicematrix_hpos_col_str \c__nicematrix_j_str
+ \str_set:Nn \l__nicematrix_hpos_col_str { j }
\__nicematrix_keys_p_column:n { #1 }
\IfPackageLoadedTF { varwidth }
{ \__nicematrix_make_preamble_ii_iv:nnn { #2 } { varwidth } { } }
@@ -2631,7 +2584,7 @@
}
\cs_new:Npn \__nicematrix_S #1 #2
{
- \str_if_eq:nnTF { #2 } { [ }
+ \str_if_eq:nnTF { #1 } { [ }
{ \__nicematrix_make_preamble_S:w [ }
{ \__nicematrix_make_preamble_S:w [ ] { #2 } }
}
@@ -2639,24 +2592,21 @@
{ \__nicematrix_make_preamble_S_i:n { #1 } }
\cs_new_protected:Npn \__nicematrix_make_preamble_S_i:n #1
{
- \IfPackageLoadedTF { siunitx }
+ \IfPackageLoadedF { siunitx } { \__nicematrix_fatal:n { siunitx~not~loaded } }
+ \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
{
- \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
- \keys_set:nn { siunitx } { #1 }
- \siunitx_cell_begin:w
- }
- c
- < { \siunitx_cell_end: \__nicematrix_cell_end: }
+ > {
+ \__nicematrix_cell_begin:w
+ \keys_set:nn { siunitx } { #1 }
+ \siunitx_cell_begin:w
}
- \int_gincr:N \c at jCol
- \__nicematrix_rec_preamble_after_col:n
+ c
+ < { \siunitx_cell_end: \__nicematrix_cell_end: }
}
- { \__nicematrix_fatal:n { siunitx~not~loaded } }
+ \int_gincr:N \c at jCol
+ \__nicematrix_rec_preamble_after_col:n
}
\cs_new:cpn { __nicematrix _ \token_to_str:N ( } #1 #2
{
@@ -2680,7 +2630,7 @@
\cs_set_eq:cc { __nicematrix _ \token_to_str:N \{ } { __nicematrix _ \token_to_str:N ( }
\cs_new_protected:Npn \__nicematrix_make_preamble_iv:nn #1 #2
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_eval:n { \c at jCol + 1 } } \c_true_bool }
\tl_if_in:nnTF { ( [ \{ ) ] \} \left \right } { #2 }
{
@@ -2696,13 +2646,13 @@
\tl_if_in:nnTF { ) ] \} } { #2 }
{ \__nicematrix_make_preamble_v:nnn #1 #2 }
{
- \tl_if_eq:nnTF { \stop } { #2 }
+ \str_if_eq:nnTF { \__nicematrix_stop: } { #2 }
{
\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 } }
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\__nicematrix_rec_preamble:n #2
}
@@ -2710,7 +2660,7 @@
{
\tl_if_in:nnT { ( [ \{ \left } { #2 }
{ \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { ! { \enskip } } }
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\__nicematrix_rec_preamble:n #2
}
@@ -2720,24 +2670,24 @@
\cs_set_eq:cc { __nicematrix _ \token_to_str:N \} } { __nicematrix _ \token_to_str:N ) }
\cs_new_protected:Npn \__nicematrix_make_preamble_v:nnn #1 #2 #3
{
- \tl_if_eq:nnTF { \stop } { #3 }
+ \str_if_eq:nnTF { \__nicematrix_stop: } { #3 }
{
\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
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\tl_gset:Nn \g__nicematrix_right_delim_tl { #2 }
}
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\__nicematrix_error:nn { double~closing~delimiter } { #2 }
}
}
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c at jCol } \c_false_bool }
\__nicematrix_error:nn { double~closing~delimiter } { #2 }
\__nicematrix_rec_preamble:n #3
@@ -2744,7 +2694,7 @@
}
}
\cs_new:cpn { __nicematrix _ \token_to_str:N \right } #1
- { \use:c { __nicematrix _ \token_to_str:N ) } }
+ { \use:c { __nicematrix _ \token_to_str:N ) } }
\cs_new_protected:Npn \__nicematrix_rec_preamble_after_col:n #1
{
\str_if_eq:nnTF { #1 } { < }
@@ -2753,14 +2703,14 @@
\str_if_eq:nnTF { #1 } { @ }
\__nicematrix_rec_preamble_after_col_ii:n
{
- \tl_if_eq:NNTF \l__nicematrix_vlines_clist \c__nicematrix_all_tl
+ \str_if_eq:nnTF \l__nicematrix_vlines_clist { all }
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
}
{
- \exp_args:NNe
- \clist_if_in:NnT \l__nicematrix_vlines_clist { \int_eval:n { \c at jCol + 1 } }
+ \clist_if_in:NeT \l__nicematrix_vlines_clist
+ { \int_eval:n { \c at jCol + 1 } }
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -2783,8 +2733,7 @@
{ @ { #1 \skip_horizontal:N \arrayrulewidth } }
}
{
- \exp_args:NNe
- \clist_if_in:NnTF \l__nicematrix_vlines_clist { \int_eval:n { \c at jCol + 1 } }
+ \clist_if_in:NeTF \l__nicematrix_vlines_clist { \int_eval:n { \c at jCol + 1 } }
{
\tl_gput_right:Nn \g__nicematrix_array_preamble_tl
{ @ { #1 \skip_horizontal:N \arrayrulewidth } }
@@ -2826,7 +2775,6 @@
\int_gadd:Nn \g__nicematrix_total_X_weight_int \l__nicematrix_weight_int
\bool_if:NTF \l__nicematrix_X_columns_aux_bool
{
- \exp_args:Nne
\__nicematrix_make_preamble_ii_iv:nnn
{ \l__nicematrix_weight_int \l__nicematrix_X_columns_dim }
{ minipage }
@@ -2860,13 +2808,13 @@
}
\cs_new_protected:Npn \__nicematrix_make_preamble_vlism:n #1
{
- \seq_gput_right:Nx \g__nicematrix_cols_vlism_seq
+ \seq_gput_right:Ne \g__nicematrix_cols_vlism_seq
{ \int_eval:n { \c at jCol + 1 } }
- \tl_gput_right:Nx \g__nicematrix_array_preamble_tl
+ \tl_gput_right:Ne \g__nicematrix_array_preamble_tl
{ \exp_not:N ! { \skip_horizontal:N \arrayrulewidth } }
\__nicematrix_rec_preamble:n
}
-\cs_set_eq:cN { __nicematrix _ \token_to_str:N \stop } \use_none:n
+\cs_set_eq:cN { __nicematrix _ \token_to_str:N \__nicematrix_stop: } \use_none:n
\cs_new_protected:cpn { __nicematrix _ \token_to_str:N \hline }
{ \__nicematrix_fatal:n { Preamble~forgotten } }
\cs_set_eq:cc { __nicematrix _ \token_to_str:N \Hline } { __nicematrix _ \token_to_str:N \hline }
@@ -2890,10 +2838,10 @@
{ \UseTaggingSocket { tbl / colspan } { #1 } }
\int_compare:nNnT { #1 } > \c_one_int
{
- \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
+ \seq_gput_left:Ne \g__nicematrix_multicolumn_cells_seq
{ \int_use:N \c at iRow - \int_eval:n { \c at jCol + 1 } }
\seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 }
- \seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq
+ \seq_gput_right:Ne \g__nicematrix_pos_of_blocks_seq
{
{
\int_if_zero:nTF \c at jCol
@@ -2913,7 +2861,7 @@
\RenewDocumentCommand \cellcolor { O { } m }
{
\__nicematrix_test_color_inside:
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\__nicematrix_rectanglecolor [ ##1 ]
{ \exp_not:n { ##2 } }
@@ -2956,7 +2904,7 @@
\exp_last_unbraced:No \__nicematrix_make_m_preamble:n \l_tmpa_tl
}
{
- \tl_if_eq:nnT { #1 } { S }
+ \str_if_eq:nnTF { #1 } { S }
{ \__nicematrix_fatal:n { unknown~column~type~S } }
{ \__nicematrix_fatal:nn { unknown~column~type } { #1 } }
}
@@ -3039,7 +2987,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__nicematrix_c_tl
+ \str_if_eq:eeTF \l__nicematrix_baseline_tl { c }
{ \box_use_drop:N \l_tmpa_box }
\__nicematrix_put_box_in_flow_i:
}
@@ -3063,10 +3011,10 @@
\__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \tl_if_eq:NnTF \l__nicematrix_baseline_tl { t }
+ \str_if_eq:onTF \l__nicematrix_baseline_tl { t }
{ \int_set_eq:NN \l_tmpa_int \c_one_int }
{
- \tl_if_eq:NnTF \l__nicematrix_baseline_tl { b }
+ \str_if_eq:onTF \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 }
}
@@ -3105,7 +3053,7 @@
\__nicematrix_insert_caption:
\int_compare:nNnT \g__nicematrix_notes_caption_int > \c_zero_int
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\tl_set:Nn \exp_not:N \l__nicematrix_note_in_caption_tl
{ \int_use:N \g__nicematrix_notes_caption_int }
@@ -3144,9 +3092,8 @@
{
\group_begin:
\bool_set_true:N \l__nicematrix_in_caption_bool
- \IfPackageLoadedTF { floatrow }
+ \IfPackageLoadedT { floatrow }
{ \cs_set_eq:NN \@makecaption \FR at makecaption }
- { }
\tl_if_empty:NTF \l__nicematrix_short_caption_tl
{ \caption }
{ \caption [ \l__nicematrix_short_caption_tl ] }
@@ -3241,7 +3188,7 @@
\pgfpicture
\__nicematrix_qpoint:n { row - 1 }
\dim_gset_eq:NN \g_tmpa_dim \pgf at y
- \str_if_in:NnTF \l__nicematrix_baseline_tl { line- }
+ \tl_if_in:NnTF \l__nicematrix_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
@@ -3318,7 +3265,7 @@
\__nicematrix_analyze_end:Nn
{
\__nicematrix_transform_preamble:
- \exp_args:No \__nicematrix_array: \g__nicematrix_array_preamble_tl
+ \__nicematrix_array:o \g__nicematrix_array_preamble_tl
}
}
}
@@ -3328,14 +3275,12 @@
}
\NewDocumentEnvironment { __nicematrix-light-syntax } { b }
{
- \tl_if_empty:nT { #1 } { \__nicematrix_fatal:n { empty~environment } }
- \tl_map_inline:nn { #1 }
- {
- \str_if_eq:nnT { ##1 } { & }
- { \__nicematrix_fatal:n { ampersand~in~light-syntax } }
- \str_if_eq:nnT { ##1 } { \\ }
- { \__nicematrix_fatal:n { double-backslash~in~light-syntax } }
- }
+ \tl_if_empty:nT { #1 }
+ { \__nicematrix_fatal:n { empty~environment } }
+ \tl_if_in:nnT { #1 } { & }
+ { \__nicematrix_fatal:n { ampersand~in~light-syntax } }
+ \tl_if_in:nnT { #1 } { \\ }
+ { \__nicematrix_fatal:n { double-backslash~in~light-syntax } }
\__nicematrix_light_syntax_i:w #1 \CodeAfter \q_stop
}
{
@@ -3372,8 +3317,9 @@
{ \l__nicematrix_nb_cols_int - 1 + \l__nicematrix_first_col_int }
}
\__nicematrix_transform_preamble:
- \exp_args:No \__nicematrix_array: \g__nicematrix_array_preamble_tl \l__nicematrix_new_body_tl
+ \__nicematrix_array:o \g__nicematrix_array_preamble_tl \l__nicematrix_new_body_tl
}
+\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax:n { o }
\cs_new_protected:Npn \__nicematrix_line_with_light_syntax:n #1
{
\seq_clear_new:N \l__nicematrix_cells_seq
@@ -3385,14 +3331,13 @@
{ \seq_count:N \l__nicematrix_cells_seq }
}
\seq_pop_left:NN \l__nicematrix_cells_seq \l_tmpa_tl
- \exp_args:NNo \tl_build_put_right:Nn \l__nicematrix_new_body_tl \l_tmpa_tl
+ \tl_build_put_right:No \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 { o }
\cs_new_protected:Npn \__nicematrix_analyze_end:Nn #1 #2
{
- \str_if_eq:onT \g__nicematrix_name_env_str { #2 }
+ \str_if_eq:eeT \g__nicematrix_name_env_str { #2 }
{ \__nicematrix_fatal:n { empty~environment } }
\end { #2 }
}
@@ -3712,6 +3657,7 @@
\__nicematrix_def_env:nnn B \{ \}
\__nicematrix_def_env:nnn v | |
\__nicematrix_def_env:nnn V \| \|
+\cs_generate_variant:Nn \__nicematrix_begin_of_NiceMatrix:nn { n o }
\cs_new_protected:Npn \__nicematrix_begin_of_NiceMatrix:nn #1 #2
{
\bool_set_false:N \l__nicematrix_preamble_bool
@@ -3734,7 +3680,6 @@
\tl_set:Nn \l_tmpb_tl { \use:c { #1 NiceArray } }
\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 }
{
\NewDocumentEnvironment { #1 NiceMatrix } { ! O { } }
@@ -3747,7 +3692,7 @@
\int_set:Nn \l__nicematrix_last_col_int { -1 }
}
\keys_set:nn { nicematrix / NiceMatrix } { ##1 }
- \__nicematrix_begin_of_NiceMatrix:nV { #1 } \l__nicematrix_columns_type_tl
+ \__nicematrix_begin_of_NiceMatrix:no { #1 } \l__nicematrix_columns_type_tl
}
{ \use:c { end #1 NiceArray } }
}
@@ -3764,7 +3709,7 @@
{ \clist_if_empty_p:N \l__nicematrix_vlines_clist }
{ \l__nicematrix_except_borders_bool }
{ \bool_set_true:N \l__nicematrix_NiceMatrix_without_vlines_bool }
- \__nicematrix_begin_of_NiceMatrix:nV { } \l__nicematrix_columns_type_tl
+ \__nicematrix_begin_of_NiceMatrix:no { } \l__nicematrix_columns_type_tl
}
{ \endNiceArray }
\cs_new_protected:Npn \__nicematrix_NotEmpty:
@@ -3872,7 +3817,7 @@
{ \int_set_eq:NN \l__nicematrix_last_col_int \g__nicematrix_col_total_int }
\bool_if:NT \l__nicematrix_last_row_without_value_bool
{ \int_set_eq:NN \l__nicematrix_last_row_int \g__nicematrix_row_total_int }
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_size_seq
{
@@ -3886,7 +3831,7 @@
}
\seq_if_empty:NF \g__nicematrix_pos_of_blocks_seq
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_pos_of_blocks_seq
{ \seq_use:Nnnn \g__nicematrix_pos_of_blocks_seq , , , }
@@ -3894,7 +3839,7 @@
}
\seq_if_empty:NF \g__nicematrix_multicolumn_cells_seq
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_multicolumn_cells_seq
{ \seq_use:Nnnn \g__nicematrix_multicolumn_cells_seq , , , }
@@ -3957,12 +3902,12 @@
{ 0.6 \l__nicematrix_xdots_shorten_end_dim }
}
\__nicematrix_draw_dotted_lines:
- \__nicematrix_compute_corners:
+ \clist_if_empty:NF \l__nicematrix_corners_clist \__nicematrix_compute_corners:
\__nicematrix_adjust_pos_of_blocks_seq:
\__nicematrix_deal_with_rounded_corners:
- \tl_if_empty:NF \l__nicematrix_hlines_clist \__nicematrix_draw_hlines:
- \tl_if_empty:NF \l__nicematrix_vlines_clist \__nicematrix_draw_vlines:
- \IfPackageLoadedTF { tikz }
+ \clist_if_empty:NF \l__nicematrix_hlines_clist \__nicematrix_draw_hlines:
+ \clist_if_empty:NF \l__nicematrix_vlines_clist \__nicematrix_draw_vlines:
+ \IfPackageLoadedT { tikz }
{
\tikzset
{
@@ -3974,7 +3919,6 @@
}
}
}
- { }
\bool_if:NT \c__nicematrix_tagging_array_bool
{ \cs_set_eq:NN \ar at ialign \__nicematrix_old_ar at ialign: }
\cs_set_eq:NN \SubMatrix \__nicematrix_SubMatrix
@@ -3987,8 +3931,8 @@
\tl_gclear:N \g__nicematrix_pre_code_after_tl
\cs_set_eq:NN \CodeAfter \prg_do_nothing:
\seq_gclear:N \g__nicematrix_submatrix_names_seq
- % \int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
- % { \__nicematrix_rescan_for_spanish:N \g_nicematrix_code_after_tl }
+ \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:No \__nicematrix_CodeAfter_keys: \g_nicematrix_code_after_tl
\scan_stop:
@@ -3997,7 +3941,7 @@
\seq_if_empty:NF \g__nicematrix_rowlistcolors_seq { \__nicematrix_clear_rowlistcolors_seq: }
\tl_if_empty:NF \g__nicematrix_pre_code_before_tl
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\tl_gset:Nn \exp_not:N \g__nicematrix_pre_code_before_tl
{ \exp_not:o \g__nicematrix_pre_code_before_tl }
@@ -4006,7 +3950,7 @@
}
\tl_if_empty:NF \g_nicematrix_code_before_tl
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
\tl_gset:Nn \exp_not:N \g__nicematrix_code_before_tl
{ \exp_not:o \g_nicematrix_code_before_tl }
@@ -4021,7 +3965,7 @@
{ \keys_set:nn { nicematrix / CodeAfter } { #1 } }
\cs_new_protected:Npn \__nicematrix_adjust_pos_of_blocks_seq:
{
- \seq_gset_map_x:NNn \g__nicematrix_pos_of_blocks_seq \g__nicematrix_pos_of_blocks_seq
+ \seq_gset_map_e:NNn \g__nicematrix_pos_of_blocks_seq \g__nicematrix_pos_of_blocks_seq
{ \__nicematrix_adjust_pos_of_blocks_seq_i:nnnnn ##1 }
}
\cs_new:Npn \__nicematrix_adjust_pos_of_blocks_seq_i:nnnnn #1 #2 #3 #4 #5
@@ -4042,7 +3986,7 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \cs_new_protected:Npx \__nicematrix_draw_dotted_lines:
+ \cs_new_protected:Npe \__nicematrix_draw_dotted_lines:
{
\c__nicematrix_pgfortikzpicture_tl
\__nicematrix_draw_dotted_lines_i:
@@ -4074,14 +4018,16 @@
}
\anchor { 5 } { \five }
\anchor { center } { \pgfpointorigin }
- \anchor { 1 } { \five \pgf at x = 0.2 \pgf at x \pgf at y = 0.2 \pgf at y }
- \anchor { 2 } { \five \pgf at x = 0.4 \pgf at x \pgf at y = 0.4 \pgf at y }
- \anchor { 3 } { \five \pgf at x = 0.6 \pgf at x \pgf at y = 0.6 \pgf at y }
- \anchor { 4 } { \five \pgf at x = 0.8 \pgf at x \pgf at y = 0.8 \pgf at y }
- \anchor { 6 } { \five \pgf at x = 1.2 \pgf at x \pgf at y = 1.2 \pgf at y }
- \anchor { 7 } { \five \pgf at x = 1.4 \pgf at x \pgf at y = 1.4 \pgf at y }
- \anchor { 8 } { \five \pgf at x = 1.6 \pgf at x \pgf at y = 1.6 \pgf at y }
- \anchor { 9 } { \five \pgf at x = 1.8 \pgf at x \pgf at y = 1.8 \pgf at y }
+ \anchor { 1 } { \five \pgf at x = 0.2 \pgf at x \pgf at y = 0.2 \pgf at y }
+ \anchor { 2 } { \five \pgf at x = 0.4 \pgf at x \pgf at y = 0.4 \pgf at y }
+ \anchor { 25 } { \five \pgf at x = 0.5 \pgf at x \pgf at y = 0.5 \pgf at y }
+ \anchor { 3 } { \five \pgf at x = 0.6 \pgf at x \pgf at y = 0.6 \pgf at y }
+ \anchor { 4 } { \five \pgf at x = 0.8 \pgf at x \pgf at y = 0.8 \pgf at y }
+ \anchor { 6 } { \five \pgf at x = 1.2 \pgf at x \pgf at y = 1.2 \pgf at y }
+ \anchor { 7 } { \five \pgf at x = 1.4 \pgf at x \pgf at y = 1.4 \pgf at y }
+ \anchor { 75 } { \five \pgf at x = 1.5 \pgf at x \pgf at y = 1.5 \pgf at y }
+ \anchor { 8 } { \five \pgf at x = 1.6 \pgf at x \pgf at y = 1.6 \pgf at y }
+ \anchor { 9 } { \five \pgf at x = 1.8 \pgf at x \pgf at y = 1.8 \pgf at y }
}
\cs_new_protected:Npn \__nicematrix_create_diag_nodes:
{
@@ -4126,7 +4072,7 @@
}
\cs_new_protected:Npn \__nicematrix_find_extremities_of_line:nnnn #1 #2 #3 #4
{
- \cs_set:cpn { __nicematrix _ dotted _ #1 - #2 } { }
+ \cs_set_nopar:cpn { __nicematrix _ dotted _ #1 - #2 } { }
\int_set:Nn \l__nicematrix_initial_i_int { #1 }
\int_set:Nn \l__nicematrix_initial_j_int { #2 }
\int_set:Nn \l__nicematrix_final_i_int { #1 }
@@ -4137,29 +4083,27 @@
\int_add:Nn \l__nicematrix_final_i_int { #3 }
\int_add:Nn \l__nicematrix_final_j_int { #4 }
\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 } = \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
- { \bool_set_true:N \l__nicematrix_final_open_bool }
- }
- }
- {
- \int_compare:nNnTF \l__nicematrix_final_j_int < \l__nicematrix_col_min_int
- {
- \int_compare:nNnT { #4 } = { -1 }
- { \bool_set_true:N \l__nicematrix_final_open_bool }
- }
- {
- \int_compare:nNnT \l__nicematrix_final_j_int > \l__nicematrix_col_max_int
- {
- \int_compare:nNnT { #4 } = \c_one_int
- { \bool_set_true:N \l__nicematrix_final_open_bool }
- }
- }
- }
+ \if_int_compare:w \l__nicematrix_final_i_int > \l__nicematrix_row_max_int
+ \if_int_compare:w #3 = \c_one_int
+ \bool_set_true:N \l__nicematrix_final_open_bool
+ \else:
+ \if_int_compare:w \l__nicematrix_final_j_int > \l__nicematrix_col_max_int
+ \bool_set_true:N \l__nicematrix_final_open_bool
+ \fi:
+ \fi:
+ \else:
+ \if_int_compare:w \l__nicematrix_final_j_int < \l__nicematrix_col_min_int
+ \if_int_compare:w #4 = -1
+ \bool_set_true:N \l__nicematrix_final_open_bool
+ \fi:
+ \else:
+ \if_int_compare:w \l__nicematrix_final_j_int > \l__nicematrix_col_max_int
+ \if_int_compare:w #4 = \c_one_int
+ \bool_set_true:N \l__nicematrix_final_open_bool
+ \fi:
+ \fi:
+ \fi:
+ \fi:
\bool_if:NTF \l__nicematrix_final_open_bool
{
\int_sub:Nn \l__nicematrix_final_i_int { #3 }
@@ -4188,7 +4132,7 @@
}
{ \bool_set_true:N \l__nicematrix_stop_loop_bool }
{
- \cs_set:cpn
+ \cs_set_nopar:cpn
{
__nicematrix _ dotted _
\int_use:N \l__nicematrix_final_i_int -
@@ -4200,34 +4144,33 @@
}
}
\bool_set_false:N \l__nicematrix_stop_loop_bool
+ \int_set:Nn \l_tmpa_int { \l__nicematrix_col_min_int - 1 }
\bool_do_until:Nn \l__nicematrix_stop_loop_bool
{
\int_sub:Nn \l__nicematrix_initial_i_int { #3 }
\int_sub:Nn \l__nicematrix_initial_j_int { #4 }
\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 } = \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 }
- { \bool_set_true:N \l__nicematrix_initial_open_bool }
- }
- }
- {
- \int_compare:nNnTF \l__nicematrix_initial_j_int < \l__nicematrix_col_min_int
- {
- \int_compare:nNnT { #4 } = \c_one_int
- { \bool_set_true:N \l__nicematrix_initial_open_bool }
- }
- {
- \int_compare:nNnT \l__nicematrix_initial_j_int > \l__nicematrix_col_max_int
- {
- \int_compare:nNnT { #4 } = { -1 }
- { \bool_set_true:N \l__nicematrix_initial_open_bool }
- }
- }
- }
+ \if_int_compare:w \l__nicematrix_initial_i_int < \l__nicematrix_row_min_int
+ \if_int_compare:w #3 = \c_one_int
+ \bool_set_true:N \l__nicematrix_initial_open_bool
+ \else:
+ \if_int_compare:w \l__nicematrix_initial_j_int = \l_tmpa_int
+ \bool_set_true:N \l__nicematrix_initial_open_bool
+ \fi:
+ \fi:
+ \else:
+ \if_int_compare:w \l__nicematrix_initial_j_int < \l__nicematrix_col_min_int
+ \if_int_compare:w #4 = \c_one_int
+ \bool_set_true:N \l__nicematrix_initial_open_bool
+ \fi:
+ \else:
+ \if_int_compare:w \l__nicematrix_initial_j_int > \l__nicematrix_col_max_int
+ \if_int_compare:w #4 = -1
+ \bool_set_true:N \l__nicematrix_initial_open_bool
+ \fi:
+ \fi:
+ \fi:
+ \fi:
\bool_if:NTF \l__nicematrix_initial_open_bool
{
\int_add:Nn \l__nicematrix_initial_i_int { #3 }
@@ -4256,7 +4199,7 @@
}
{ \bool_set_true:N \l__nicematrix_stop_loop_bool }
{
- \cs_set:cpn
+ \cs_set_nopar:cpn
{
__nicematrix _ dotted _
\int_use:N \l__nicematrix_initial_i_int -
@@ -4267,7 +4210,7 @@
}
}
}
- \seq_gput_right:Nx \g__nicematrix_pos_of_xdots_seq
+ \seq_gput_right:Ne \g__nicematrix_pos_of_xdots_seq
{
{ \int_use:N \l__nicematrix_initial_i_int }
{ \int_min:nn \l__nicematrix_initial_j_int \l__nicematrix_final_j_int }
@@ -4279,42 +4222,41 @@
\cs_new_protected:Npn \__nicematrix_open_shorten:
{
\bool_if:NT \l__nicematrix_initial_open_bool
- { \dim_zero:N \l__nicematrix_xdots_shorten_start_dim }
+ { \dim_zero:N \l__nicematrix_xdots_shorten_start_dim }
\bool_if:NT \l__nicematrix_final_open_bool
- { \dim_zero:N \l__nicematrix_xdots_shorten_end_dim }
+ { \dim_zero:N \l__nicematrix_xdots_shorten_end_dim }
}
\cs_new_protected:Npn \__nicematrix_adjust_to_submatrix:nn #1 #2
{
- \int_set:Nn \l__nicematrix_row_min_int 1
- \int_set:Nn \l__nicematrix_col_min_int 1
+ \int_set_eq:NN \l__nicematrix_row_min_int \c_one_int
+ \int_set_eq:NN \l__nicematrix_col_min_int \c_one_int
\int_set_eq:NN \l__nicematrix_row_max_int \c at iRow
\int_set_eq:NN \l__nicematrix_col_max_int \c at jCol
- \seq_map_inline:Nn \g__nicematrix_submatrix_seq
- { \__nicematrix_adjust_to_submatrix:nnnnnn { #1 } { #2 } ##1 }
- }
-\cs_set_protected:Npn \__nicematrix_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
- {
- \int_compare:nNnF { #3 } > { #1 }
+ \seq_if_empty:NF \g__nicematrix_submatrix_seq
{
- \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 } }
- }
- }
- }
+ \seq_map_inline:Nn \g__nicematrix_submatrix_seq
+ { \__nicematrix_adjust_to_submatrix:nnnnnn { #1 } { #2 } ##1 }
}
}
+\cs_new_protected:Npn \__nicematrix_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
+ {
+ \if_int_compare:w #3 > #1
+ \else:
+ \if_int_compare:w #1 > #5
+ \else:
+ \if_int_compare:w #4 > #2
+ \else:
+ \if_int_compare:w #2 > #6
+ \else:
+ \if_int_compare:w \l__nicematrix_row_min_int < #3 \l__nicematrix_row_min_int = #3 \fi:
+ \if_int_compare:w \l__nicematrix_col_min_int < #4 \l__nicematrix_col_min_int = #4 \fi:
+ \if_int_compare:w \l__nicematrix_row_max_int < #5 \l__nicematrix_row_max_int = #5 \fi:
+ \if_int_compare:w \l__nicematrix_col_max_int < #6 \l__nicematrix_col_max_int = #6 \fi:
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+ }
\cs_new_protected:Npn \__nicematrix_set_initial_coords:
{
\dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x
@@ -4380,8 +4322,8 @@
\pgfpointanchor
{ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_final_j_int }
{ east }
- \dim_set:Nn \l__nicematrix_x_final_dim
- { \dim_max:nn \l__nicematrix_x_final_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x > \l__nicematrix_x_final_dim
+ { \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x }
}
}
\dim_compare:nNnT \l__nicematrix_x_final_dim = { - \c_max_dim }
@@ -4406,7 +4348,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Ldots:
\group_end:
}
@@ -4458,7 +4400,7 @@
{ \color { nicematrix-last-row } }
}
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Cdots:
\group_end:
}
@@ -4500,8 +4442,8 @@
\pgfpointanchor
{ \__nicematrix_env: - \int_use:N \l__nicematrix_initial_i_int - ##1 }
{ north }
- \dim_set:Nn \l__nicematrix_y_initial_dim
- { \dim_max:nn \l__nicematrix_y_initial_dim \pgf at y }
+ \dim_compare:nNnT \pgf at y > \l__nicematrix_y_initial_dim
+ { \dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf at y }
}
}
\dim_compare:nNnT \l__nicematrix_y_initial_dim = { - \c_max_dim }
@@ -4528,8 +4470,8 @@
\pgfpointanchor
{ \__nicematrix_env: - \int_use:N \l__nicematrix_final_i_int - ##1 }
{ south }
- \dim_set:Nn \l__nicematrix_y_final_dim
- { \dim_min:nn \l__nicematrix_y_final_dim \pgf at y }
+ \dim_compare:nNnT \pgf at y < \l__nicematrix_y_final_dim
+ { \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y }
}
}
\dim_compare:nNnT \l__nicematrix_y_final_dim = \c_max_dim
@@ -4554,8 +4496,7 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl
- { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Vdots:
\group_end:
}
@@ -4640,7 +4581,7 @@
\group_begin:
\__nicematrix_open_shorten:
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Ddots:
\group_end:
}
@@ -4692,7 +4633,7 @@
\group_begin:
\__nicematrix_open_shorten:
\keys_set:nn { nicematrix / xdots } { #3 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Iddots:
\group_end:
}
@@ -4751,6 +4692,7 @@
\__nicematrix_draw_unstandard_dotted_line:o
{ \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl }
}
+\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:n { o }
\cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:n #1
{
\__nicematrix_draw_unstandard_dotted_line:nooo
@@ -4759,10 +4701,9 @@
\l__nicematrix_xdots_down_tl
\l__nicematrix_xdots_middle_tl
}
-\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:n { o }
\hook_gput_code:nnn { begindocument } { . }
{
- \IfPackageLoadedTF { tikz }
+ \IfPackageLoadedT { tikz }
{
\tikzset
{
@@ -4775,8 +4716,8 @@
}
}
}
- { }
}
+\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:nnnn { n o o o }
\cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:nnnn #1 #2 #3 #4
{
\dim_zero_new:N \l__nicematrix_l_dim
@@ -4848,7 +4789,6 @@
\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:
@@ -5156,7 +5096,7 @@
{ \__nicematrix_collect_options:n { \__nicematrix_Hdotsfor_ii } }
\exp_args:NNo \NewDocumentCommand \__nicematrix_Hdotsfor_ii \l__nicematrix_argspec_tl
{
- \tl_gput_right:Nx \g__nicematrix_HVdotsfor_lines_tl
+ \tl_gput_right:Ne \g__nicematrix_HVdotsfor_lines_tl
{
\__nicematrix_Hdotsfor:nnnn
{ \int_use:N \c at iRow }
@@ -5229,11 +5169,11 @@
}
\keys_set:nn { nicematrix / xdots } { #4 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Ldots:
\group_end:
\int_step_inline:nnn { #2 } { #2 + #3 - 1 }
- { \cs_set:cpn { __nicematrix _ dotted _ #1 - ##1 } { } }
+ { \cs_set_nopar:cpn { __nicematrix _ dotted _ #1 - ##1 } { } }
}
\hook_gput_code:nnn { begindocument } { . }
{
@@ -5244,7 +5184,7 @@
\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
+ \tl_gput_right:Ne \g__nicematrix_HVdotsfor_lines_tl
{
\__nicematrix_Vdotsfor:nnnn
{ \int_use:N \c at iRow }
@@ -5310,11 +5250,11 @@
{ \color { nicematrix-last-col } }
}
\keys_set:nn { nicematrix / xdots } { #4 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
\__nicematrix_actually_draw_Vdots:
\group_end:
\int_step_inline:nnn { #1 } { #1 + #3 - 1 }
- { \cs_set:cpn { __nicematrix _ dotted _ ##1 - #2 } { } }
+ { \cs_set_nopar:cpn { __nicematrix _ dotted _ ##1 - #2 } { } }
}
\NewDocumentCommand \__nicematrix_rotate: { O { } }
{
@@ -5347,13 +5287,13 @@
{
\group_begin:
\keys_set:nn { nicematrix / xdots } { #1 , #4 , down = #5 , up = #6 }
- \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } }
- \use:e
- {
- \__nicematrix_line_i:nn
- { \__nicematrix_double_int_eval:n #2 - \q_stop }
- { \__nicematrix_double_int_eval:n #3 - \q_stop }
- }
+ \__nicematrix_color:o \l__nicematrix_xdots_color_tl
+ \use:e
+ {
+ \__nicematrix_line_i:nn
+ { \__nicematrix_double_int_eval:n #2 - \q_stop }
+ { \__nicematrix_double_int_eval:n #3 - \q_stop }
+ }
\group_end:
}
}
@@ -5369,7 +5309,7 @@
}
\hook_gput_code:nnn { begindocument } { . }
{
- \cs_new_protected:Npx \__nicematrix_draw_line_ii:nn #1 #2
+ \cs_new_protected:Npe \__nicematrix_draw_line_ii:nn #1 #2
{
\c__nicematrix_pgfortikzpicture_tl
\__nicematrix_draw_line_iii:nn { #1 } { #2 }
@@ -5389,9 +5329,10 @@
}
\cs_new:Npn \__nicematrix_if_row_less_than:nn #1 #2
{ \int_compare:nNnT { \c at iRow } < { #1 } { #2 } }
+\cs_generate_variant:Nn \__nicematrix_put_in_row_style:n { e }
\cs_set_protected:Npn \__nicematrix_put_in_row_style:n #1
{
- \tl_gput_right:Nx \g__nicematrix_row_style_tl
+ \tl_gput_right:Ne \g__nicematrix_row_style_tl
{
\exp_not:N
\__nicematrix_if_row_less_than:nn
@@ -5399,7 +5340,6 @@
{ \exp_not:n { #1 } \scan_stop: }
}
}
-\cs_generate_variant:Nn \__nicematrix_put_in_row_style:n { e }
\keys_define:nn { nicematrix / RowStyle }
{
cell-space-top-limit .dim_set:N = \l_tmpa_dim ,
@@ -5416,7 +5356,7 @@
bold .bool_set:N = \l__nicematrix_bold_row_style_bool ,
bold .default:n = true ,
nb-rows .code:n =
- \str_if_eq:nnTF { #1 } { * }
+ \str_if_eq:eeTF { #1 } { * }
{ \int_set:Nn \l__nicematrix_key_nb_rows_int { 500 } }
{ \int_set:Nn \l__nicematrix_key_nb_rows_int { #1 } } ,
nb-rows .value_required:n = true ,
@@ -5435,7 +5375,7 @@
\keys_set:nn { nicematrix / RowStyle } { #1 }
\tl_if_empty:NF \l_tmpa_tl
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\__nicematrix_exp_color_arg:No \__nicematrix_rectanglecolor \l_tmpa_tl
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
@@ -5443,7 +5383,7 @@
}
\int_compare:nNnT \l__nicematrix_key_nb_rows_int > \c_one_int
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\__nicematrix_exp_color_arg:No \__nicematrix_rowcolor \l_tmpa_tl
{
@@ -5456,7 +5396,7 @@
\__nicematrix_put_in_row_style:n { \exp_not:n { #2 } }
\dim_compare:nNnT \l_tmpa_dim > \c_zero_dim
{
- \exp_args:Nx \__nicematrix_put_in_row_style:n
+ \__nicematrix_put_in_row_style:e
{
\tl_gput_right:Nn \exp_not:N \g__nicematrix_cell_after_hook_tl
{
@@ -5467,7 +5407,7 @@
}
\dim_compare:nNnT \l_tmpb_dim > \c_zero_dim
{
- \exp_args:Nx \__nicematrix_put_in_row_style:n
+ \__nicematrix_put_in_row_style:e
{
\tl_gput_right:Nn \exp_not:N \g__nicematrix_cell_after_hook_tl
{
@@ -5504,6 +5444,8 @@
\g__nicematrix_row_style_tl
\ignorespaces
}
+\cs_generate_variant:Nn \__nicematrix_add_to_colors_seq:nn { e }
+\cs_generate_variant:Nn \__nicematrix_add_to_colors_seq:nn { e e }
\cs_new_protected:Npn \__nicematrix_add_to_colors_seq:nn #1 #2
{
\int_zero:N \l_tmpa_int
@@ -5510,17 +5452,15 @@
\str_if_in:nnF { #1 } { !! }
{
\seq_map_indexed_inline:Nn \g__nicematrix_colors_seq
- { \tl_if_eq:nnT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } }
+ { \str_if_eq:eeT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } }
}
\int_if_zero:nTF \l_tmpa_int
{
\seq_gput_right:Nn \g__nicematrix_colors_seq { #1 }
- \tl_gset:cx { g__nicematrix_color _ \seq_count:N \g__nicematrix_colors_seq _ tl } { #2 }
+ \tl_gset:ce { g__nicematrix_color _ \seq_count:N \g__nicematrix_colors_seq _ tl } { #2 }
}
- { \tl_gput_right:cx { g__nicematrix_color _ \int_use:N \l_tmpa_int _tl } { #2 } }
+ { \tl_gput_right:ce { g__nicematrix_color _ \int_use:N \l_tmpa_int _tl } { #2 } }
}
-\cs_generate_variant:Nn \__nicematrix_add_to_colors_seq:nn { e n }
-\cs_generate_variant:Nn \__nicematrix_add_to_colors_seq:nn { e e }
\cs_new_protected:Npn \__nicematrix_clip_with_rounded_corners:
{
\dim_compare:nNnT \l__nicematrix_tab_rounded_corners_dim > \c_zero_dim
@@ -5659,8 +5599,8 @@
\tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl
\__nicematrix_cut_on_hyphen:w #2 \q_stop
- \tl_set:Nx \l__nicematrix_rows_tl { \l__nicematrix_tmpc_tl - \l_tmpa_tl }
- \tl_set:Nx \l__nicematrix_cols_tl { \l__nicematrix_tmpd_tl - \l_tmpb_tl }
+ \tl_set:Ne \l__nicematrix_rows_tl { \l__nicematrix_tmpc_tl - \l_tmpa_tl }
+ \tl_set:Ne \l__nicematrix_cols_tl { \l__nicematrix_tmpd_tl - \l_tmpb_tl }
\__nicematrix_cartesian_path:n { #3 }
}
\NewDocumentCommand \__nicematrix_cellcolor { O { } m m }
@@ -5737,7 +5677,7 @@
\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
+ \tl_set:Ne \l__nicematrix_color_tl
{
\__nicematrix_color_index:n
{
@@ -5801,7 +5741,7 @@
\l__nicematrix_nocolor_used_bool
\__nicematrix_cartesian_path_normal_ii:
{
- \seq_if_empty:NTF \l__nicematrix_corners_cells_seq
+ \clist_if_empty:NTF \l__nicematrix_corners_cells_clist
{ \__nicematrix_cartesian_path_normal_i:n { #1 } }
\__nicematrix_cartesian_path_normal_ii:
}
@@ -5859,7 +5799,7 @@
\int_compare:nNnT \l_tmpb_tl > \g__nicematrix_row_total_int
{ \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 _ nocolor _ \l_tmpa_tl - \l__nicematrix_tmpc_tl }
{
\__nicematrix_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
@@ -5886,14 +5826,13 @@
\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_if_in_corner:nF { ####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 _ ####1 _ ##1 _ nocolor }
+ \cs_if_exist:cF { __nicematrix _ nocolor _ ####1 - ##1 }
{
\pgfpathrectanglecorners
{ \pgfpoint \l__nicematrix_tmpc_dim \l__nicematrix_tmpd_dim }
@@ -5912,7 +5851,7 @@
\clist_map_inline:Nn \l__nicematrix_rows_tl
{
\clist_map_inline:Nn \l__nicematrix_cols_tl
- { \cs_set:cpn { __nicematrix _ ##1 _ ####1 _ nocolor } { } }
+ { \cs_set_nopar:cpn { __nicematrix _ nocolor _ ##1 - ####1 } { } }
}
}
\cs_new_protected:Npn \__nicematrix_expand_clist:NN #1 #2
@@ -5926,12 +5865,12 @@
{ \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
{ \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
\bool_lazy_or:nnT
+ { \str_if_eq_p:ee \l_tmpa_tl { * } }
{ \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
+ { \str_if_eq_p:ee \l_tmpb_tl { * } }
{ \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:No \l_tmpb_tl { \int_use:N #2 } }
@@ -5942,7 +5881,7 @@
\NewDocumentCommand \__nicematrix_cellcolor_tabular { O { } m }
{
\__nicematrix_test_color_inside:
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\__nicematrix_cellcolor [ #1 ] { \exp_not:n { #2 } }
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
@@ -5952,7 +5891,7 @@
\NewDocumentCommand \__nicematrix_rowcolor_tabular { O { } m }
{
\__nicematrix_test_color_inside:
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\__nicematrix_rectanglecolor [ #1 ] { \exp_not:n { #2 } }
{ \int_use:N \c at iRow - \int_use:N \c at jCol }
@@ -5974,7 +5913,7 @@
\seq_map_inline:Nn \g__nicematrix_rowlistcolors_seq
{ \__nicematrix_rowlistcolors_tabular_i:nnnn ##1 }
\seq_gset_eq:NN \g__nicematrix_rowlistcolors_seq \g_tmpa_seq
- \seq_gput_right:Nx \g__nicematrix_rowlistcolors_seq
+ \seq_gput_right:Ne \g__nicematrix_rowlistcolors_seq
{
{ \int_use:N \c at iRow }
{ \exp_not:n { #1 } }
@@ -5987,7 +5926,7 @@
\int_compare:nNnTF { #1 } = \c at iRow
{ \seq_gput_right:Nn \g_tmpa_seq { { #1 } { #2 } { #3 } { #4 } } }
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\__nicematrix_rowlistcolors
[ \exp_not:n { #2 } ]
@@ -6012,7 +5951,7 @@
{
\int_compare:nNnT \c at jCol > \g__nicematrix_col_total_int
{
- \tl_gput_left:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_left:Ne \g__nicematrix_pre_code_before_tl
{
\exp_not:N \columncolor [ #1 ]
{ \exp_not:n { #2 } } { \int_use:N \c at jCol }
@@ -6069,7 +6008,7 @@
end .code:n =
\bool_lazy_or:nnTF
{ \tl_if_empty_p:n { #1 } }
- { \str_if_eq_p:nn { #1 } { last } }
+ { \str_if_eq_p:ee { #1 } { last } }
{ \int_set_eq:NN \l__nicematrix_end_int \c at jCol }
{ \int_set:Nn \l__nicematrix_end_int { #1 } }
}
@@ -6141,23 +6080,18 @@
}
\cs_new_protected:Npn \__nicematrix_test_in_corner_v:
{
- \int_compare:nNnTF \l_tmpb_tl = { \int_eval:n { \c at jCol + 1 } }
+ \int_compare:nNnTF \l_tmpb_tl = { \c at jCol + 1 }
{
- \seq_if_in:NxT
- \l__nicematrix_corners_cells_seq
- { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
+ \__nicematrix_if_in_corner:nT { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
{ \bool_set_false:N \g_tmpa_bool }
}
{
- \seq_if_in:NxT
- \l__nicematrix_corners_cells_seq
- { \l_tmpa_tl - \l_tmpb_tl }
+ \__nicematrix_if_in_corner:nT { \l_tmpa_tl - \l_tmpb_tl }
{
\int_compare:nNnTF \l_tmpb_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
- \seq_if_in:NxT
- \l__nicematrix_corners_cells_seq
+ \__nicematrix_if_in_corner:nT
{ \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
{ \bool_set_false:N \g_tmpa_bool }
}
@@ -6167,7 +6101,7 @@
\cs_new_protected:Npn \__nicematrix_vline_ii:
{
\tl_clear:N \l__nicematrix_tikz_rule_tl
- \keys_set:nV { nicematrix / RulesBis } \l__nicematrix_other_keys_tl
+ \keys_set:no { nicematrix / RulesBis } \l__nicematrix_other_keys_tl
\bool_if:NTF \l__nicematrix_dotted_bool
\__nicematrix_vline_iv:
{
@@ -6252,7 +6186,7 @@
\begin {tikzpicture }
\CT at arc@
\tl_if_empty:NF \l__nicematrix_rule_color_tl
- { \tl_put_right:Nx \l__nicematrix_tikz_rule_tl { , color = \l__nicematrix_rule_color_tl } }
+ { \tl_put_right:Ne \l__nicematrix_tikz_rule_tl { , color = \l__nicematrix_rule_color_tl } }
\pgfrememberpicturepositiononpagetrue
\pgf at relevantforpicturesizefalse
\__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_local_start_int }
@@ -6300,8 +6234,8 @@
\l_tmpb_tl
{
\bool_gset_true:N \g_tmpa_bool
- \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq
- { \__nicematrix_test_hline_in_block:nnnnn ##1 }
+ \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq
+ { \__nicematrix_test_hline_in_block:nnnnn ##1 }
\seq_map_inline:Nn \g__nicematrix_pos_of_xdots_seq
{ \__nicematrix_test_hline_in_block:nnnnn ##1 }
\seq_map_inline:Nn \g__nicematrix_pos_of_stroken_blocks_seq
@@ -6329,23 +6263,18 @@
}
\cs_new_protected:Npn \__nicematrix_test_in_corner_h:
{
- \int_compare:nNnTF \l_tmpa_tl = { \int_eval:n { \c at iRow + 1 } }
+ \int_compare:nNnTF \l_tmpa_tl = { \c at iRow + 1 }
{
- \seq_if_in:NxT
- \l__nicematrix_corners_cells_seq
- { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
+ \__nicematrix_if_in_corner:nT { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
{
- \seq_if_in:NxT
- \l__nicematrix_corners_cells_seq
- { \l_tmpa_tl - \l_tmpb_tl }
+ \__nicematrix_if_in_corner:nT { \l_tmpa_tl - \l_tmpb_tl }
{
\int_compare:nNnTF \l_tmpa_tl = \c_one_int
{ \bool_set_false:N \g_tmpa_bool }
{
- \seq_if_in:NxT
- \l__nicematrix_corners_cells_seq
+ \__nicematrix_if_in_corner:nT
{ \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
@@ -6355,7 +6284,7 @@
\cs_new_protected:Npn \__nicematrix_hline_ii:
{
\tl_clear:N \l__nicematrix_tikz_rule_tl
- \keys_set:nV { nicematrix / RulesBis } \l__nicematrix_other_keys_tl
+ \keys_set:no { nicematrix / RulesBis } \l__nicematrix_other_keys_tl
\bool_if:NTF \l__nicematrix_dotted_bool
\__nicematrix_hline_iv:
{
@@ -6454,7 +6383,7 @@
\begin { tikzpicture }
\CT at arc@
\tl_if_empty:NF \l__nicematrix_rule_color_tl
- { \tl_put_right:Nx \l__nicematrix_tikz_rule_tl { , color = \l__nicematrix_rule_color_tl } }
+ { \tl_put_right:Ne \l__nicematrix_tikz_rule_tl { , color = \l__nicematrix_rule_color_tl } }
\pgfrememberpicturepositiononpagetrue
\pgf at relevantforpicturesizefalse
\__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_local_start_int }
@@ -6501,7 +6430,7 @@
{
\__nicematrix_compute_rule_width:n { multiplicity = #1 , #2 }
\skip_vertical:N \l__nicematrix_rule_width_dim
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_hline:n
{
@@ -6527,7 +6456,7 @@
{ \str_if_empty_p:N \l__nicematrix_ccommand_str }
}
{ \__nicematrix_error:n { No~letter~and~no~command } }
- { \exp_args:No \__nicematrix_custom_line_i:n \l__nicematrix_other_keys_tl }
+ { \__nicematrix_custom_line_i:o \l__nicematrix_other_keys_tl }
}
\keys_define:nn { nicematrix / custom-line }
{
@@ -6538,6 +6467,7 @@
ccommand .str_set:N = \l__nicematrix_ccommand_str ,
ccommand .value_required:n = true ,
}
+\cs_generate_variant:Nn \__nicematrix_custom_line_i:n { o }
\cs_new_protected:Npn \__nicematrix_custom_line_i:n #1
{
\bool_set_false:N \l__nicematrix_tikz_rule_bool
@@ -6546,8 +6476,7 @@
\keys_set:nn { nicematrix / custom-line-bis } { #1 }
\bool_if:NT \l__nicematrix_tikz_rule_bool
{
- \IfPackageLoadedTF { tikz }
- { }
+ \IfPackageLoadedF { tikz }
{ \__nicematrix_error:n { tikz~in~custom-line~without~tikz } }
\bool_if:NT \l__nicematrix_color_bool
{ \__nicematrix_error:n { color~in~custom-line~with~tikz } }
@@ -6562,11 +6491,12 @@
\int_compare:nTF { \str_count:N \l__nicematrix_letter_str != 1 }
{ \__nicematrix_error:n { Several~letters } }
{
- \exp_args:NnV \tl_if_in:NnTF
- \c__nicematrix_forbidden_letters_str \l__nicematrix_letter_str
+ \tl_if_in:NoTF
+ \c__nicematrix_forbidden_letters_str
+ \l__nicematrix_letter_str
{ \__nicematrix_error:ne { Forbidden~letter } \l__nicematrix_letter_str }
{
- \cs_set:cpn { __nicematrix _ \l__nicematrix_letter_str } ##1
+ \cs_set_nopar:cpn { __nicematrix _ \l__nicematrix_letter_str } ##1
{ \__nicematrix_v_custom_line:n { #1 } }
}
}
@@ -6612,7 +6542,7 @@
}
\cs_new_protected:Npn \__nicematrix_h_custom_line:n #1
{
- \cs_set:cpn { nicematrix - \l__nicematrix_command_str } { \Hline [ #1 ] }
+ \cs_set_nopar:cpn { nicematrix - \l__nicematrix_command_str } { \Hline [ #1 ] }
\seq_put_left:No \l__nicematrix_custom_line_commands_seq \l__nicematrix_command_str
}
\cs_new_protected:Npn \__nicematrix_c_custom_line:n #1
@@ -6634,10 +6564,10 @@
}
\cs_new_protected:Npn \__nicematrix_c_custom_line_i:nn #1 #2
{
- \str_if_in:nnTF { #2 } { - }
+ \tl_if_in:nnTF { #2 } { - }
{ \__nicematrix_cut_on_hyphen:w #2 \q_stop }
{ \__nicematrix_cut_on_hyphen:w #2 - #2 \q_stop }
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_hline:n
{
@@ -6674,9 +6604,9 @@
\cs_new_protected:Npn \__nicematrix_v_custom_line:n #1
{
\__nicematrix_compute_rule_width:n { #1 }
- \tl_gput_right:Nx \g__nicematrix_array_preamble_tl
+ \tl_gput_right:Ne \g__nicematrix_array_preamble_tl
{ \exp_not:N ! { \skip_horizontal:n { \dim_use:N \l__nicematrix_rule_width_dim } } }
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_vline:n
{
@@ -6749,7 +6679,9 @@
}
\cs_new_protected:Npn \__nicematrix_compute_corners:
{
- \seq_clear_new:N \l__nicematrix_corners_cells_seq
+ \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq
+ { \__nicematrix_mark_cells_of_block:nnnnn ##1 }
+ \clist_clear:N \l__nicematrix_corners_cells_clist
\clist_map_inline:Nn \l__nicematrix_corners_clist
{
\str_case:nnF { ##1 }
@@ -6765,15 +6697,30 @@
}
{ \__nicematrix_error:nn { bad~corner } { ##1 } }
}
- \seq_if_empty:NF \l__nicematrix_corners_cells_seq
+ \clist_if_empty:NF \l__nicematrix_corners_cells_clist
{
- \tl_gput_right:Nx \g__nicematrix_aux_tl
+ \tl_gput_right:Ne \g__nicematrix_aux_tl
{
- \seq_set_from_clist:Nn \exp_not:N \l__nicematrix_corners_cells_seq
- { \seq_use:Nnnn \l__nicematrix_corners_cells_seq , , , }
+ \cs_set_nopar:Npn \exp_not:N \l__nicematrix_corners_cells_clist
+ { \l__nicematrix_corners_cells_clist }
}
}
}
+\cs_new_protected:Npn \__nicematrix_mark_cells_of_block:nnnnn #1 #2 #3 #4 #5
+ {
+ \int_step_inline:nnn { #1 } { #3 }
+ {
+ \int_step_inline:nnn { #2 } { #4 }
+ { \cs_set_nopar:cpn { __nicematrix _ block _ ##1 - ####1 } { } }
+ }
+ }
+\prg_new_conditional:Npnn \__nicematrix_if_in_block:nn #1 #2 { p }
+ {
+ \cs_if_exist:cTF
+ { __nicematrix _ block _ \int_eval:n { #1 } - \int_eval:n { #2 } }
+ \prg_return_true:
+ \prg_return_false:
+ }
\cs_new_protected:Npn \__nicematrix_compute_a_corner:nnnnnn #1 #2 #3 #4 #5 #6
{
\bool_set_false:N \l_tmpa_bool
@@ -6781,13 +6728,12 @@
\int_set:Nn \l__nicematrix_last_empty_row_int { #1 }
\int_step_inline:nnnn { #1 } { #3 } { #5 }
{
- \__nicematrix_test_if_cell_in_a_block:nn { ##1 } { \int_eval:n { #2 } }
\bool_lazy_or:nnTF
{
\cs_if_exist_p:c
{ pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_eval:n { #2 } }
}
- \l_tmpb_bool
+ { \__nicematrix_if_in_block_p:nn { ##1 } { #2 } }
{ \bool_set_true:N \l_tmpa_bool }
{
\bool_if:NF \l_tmpa_bool
@@ -6799,13 +6745,12 @@
\int_set:Nn \l__nicematrix_last_empty_column_int { #2 }
\int_step_inline:nnnn { #2 } { #4 } { #6 }
{
- \__nicematrix_test_if_cell_in_a_block:nn { \int_eval:n { #1 } } { ##1 }
\bool_lazy_or:nnTF
- \l_tmpb_bool
{
\cs_if_exist_p:c
{ pgf @ sh @ ns @ \__nicematrix_env: - \int_eval:n { #1 } - ##1 }
}
+ { \__nicematrix_if_in_block_p:nn { #1 } { ##1 } }
{ \bool_set_true:N \l_tmpa_bool }
{
\bool_if:NF \l_tmpa_bool
@@ -6817,48 +6762,25 @@
\bool_set_false:N \l_tmpa_bool
\int_step_inline:nnnn { #2 } { #4 } \l__nicematrix_last_empty_column_int
{
- \__nicematrix_test_if_cell_in_a_block:nn { ##1 } { ####1 }
\bool_lazy_or:nnTF
- \l_tmpb_bool
- {
- \cs_if_exist_p:c
- { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - ####1 }
- }
+ { \cs_if_exist_p:c { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - ####1 } }
+ { \__nicematrix_if_in_block_p:nn { ##1 } { ####1 } }
{ \bool_set_true:N \l_tmpa_bool }
{
\bool_if:NF \l_tmpa_bool
{
\int_set:Nn \l__nicematrix_last_empty_column_int { ####1 }
- \seq_put_right:Nn
- \l__nicematrix_corners_cells_seq
+ \clist_put_right:Nn
+ \l__nicematrix_corners_cells_clist
{ ##1 - ####1 }
+ \cs_set_nopar:cpn { __nicematrix _ corner _ ##1 - ####1 } { }
}
}
}
}
}
-\cs_new_protected:Npn \__nicematrix_test_if_cell_in_a_block:nn #1 #2
- {
- \int_set:Nn \l_tmpa_int { #1 }
- \int_set:Nn \l_tmpb_int { #2 }
- \bool_set_false:N \l_tmpb_bool
- \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_set_protected:Npn \__nicematrix_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
- {
- \int_compare:nNnF { #3 } > { #1 }
- {
- \int_compare:nNnF { #1 } > { #5 }
- {
- \int_compare:nNnF { #4 } > { #2 }
- {
- \int_compare:nNnF { #2 } > { #6 }
- { \bool_set_true:N \l_tmpb_bool }
- }
- }
- }
- }
+\cs_new:Npn \__nicematrix_if_in_corner:nT #1 { \cs_if_exist:cT { __nicematrix _ corner _ #1 } }
+\cs_new:Npn \__nicematrix_if_in_corner:nF #1 { \cs_if_exist:cF { __nicematrix _ corner _ #1 } }
\bool_new:N \l__nicematrix_block_auto_columns_width_bool
\keys_define:nn { nicematrix / NiceMatrixBlock }
{
@@ -6879,8 +6801,7 @@
\cs_if_exist:cT
{ __nicematrix_max_cell_width_ \int_use:N \g__nicematrix_NiceMatrixBlock_int }
{
- % is \exp_args:NNe mandatory?
- \exp_args:NNe \dim_set:Nn \l__nicematrix_columns_width_dim
+ \dim_set:Nn \l__nicematrix_columns_width_dim
{
\use:c
{ __nicematrix_max_cell_width _ \int_use:N \g__nicematrix_NiceMatrixBlock_int }
@@ -6895,7 +6816,7 @@
\bool_if:NT \l__nicematrix_block_auto_columns_width_bool
{
\iow_shipout:Nn \@mainaux \ExplSyntaxOn
- \iow_shipout:Nx \@mainaux
+ \iow_shipout:Ne \@mainaux
{
\cs_gset:cpn
{ __nicematrix _ max _ cell _ width _ \int_use:N \g__nicematrix_NiceMatrixBlock_int }
@@ -6906,8 +6827,6 @@
}
\ignorespacesafterend
}
-\cs_generate_variant:Nn \dim_min:nn { v n }
-\cs_generate_variant:Nn \dim_max:nn { v n }
\cs_new_protected:Npn \__nicematrix_create_extra_nodes:
{
\bool_if:nTF \l__nicematrix_medium_nodes_bool
@@ -6945,7 +6864,7 @@
\pgfpointanchor { \__nicematrix_env: - \__nicematrix_i: - \__nicematrix_j: } { south~west }
\dim_set:cn { l__nicematrix_row_\__nicematrix_i: _min_dim}
{ \dim_min:vn { l__nicematrix_row _ \__nicematrix_i: _min_dim } \pgf at y }
- \seq_if_in:NxF \g__nicematrix_multicolumn_cells_seq { \__nicematrix_i: - \__nicematrix_j: }
+ \seq_if_in:NeF \g__nicematrix_multicolumn_cells_seq { \__nicematrix_i: - \__nicematrix_j: }
{
\dim_set:cn { l__nicematrix_column _ \__nicematrix_j: _min_dim}
{ \dim_min:vn { l__nicematrix_column _ \__nicematrix_j: _min_dim } \pgf at x }
@@ -6953,7 +6872,7 @@
\pgfpointanchor { \__nicematrix_env: - \__nicematrix_i: - \__nicematrix_j: } { north~east }
\dim_set:cn { l__nicematrix_row _ \__nicematrix_i: _ max_dim }
{ \dim_max:vn { l__nicematrix_row _ \__nicematrix_i: _ max_dim } \pgf at y }
- \seq_if_in:NxF \g__nicematrix_multicolumn_cells_seq { \__nicematrix_i: - \__nicematrix_j: }
+ \seq_if_in:NeF \g__nicematrix_multicolumn_cells_seq { \__nicematrix_i: - \__nicematrix_j: }
{
\dim_set:cn { l__nicematrix_column _ \__nicematrix_j: _ max_dim }
{ \dim_max:vn { l__nicematrix_column _ \__nicematrix_j: _max_dim } \pgf at x }
@@ -7165,12 +7084,12 @@
{
\bool_lazy_or:nnTF
{ \tl_if_blank_p:n { #1 } }
- { \str_if_eq_p:Vn \c__nicematrix_star_str { #1 } }
+ { \str_if_eq_p:ee { * } { #1 } }
{ \int_set:Nn \l_tmpa_int { 100 } }
{ \int_set:Nn \l_tmpa_int { #1 } }
\bool_lazy_or:nnTF
{ \tl_if_blank_p:n { #2 } }
- { \str_if_eq_p:Vn \c__nicematrix_star_str { #2 } }
+ { \str_if_eq_p:ee { * } { #2 } }
{ \int_set:Nn \l_tmpb_int { 100 } }
{ \int_set:Nn \l_tmpb_int { #2 } }
\int_compare:nNnTF \l_tmpb_int = \c_one_int
@@ -7177,11 +7096,11 @@
{
\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:No \l__nicematrix_hpos_block_str \l__nicematrix_hpos_cell_tl }
}
{ \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
+ \tl_set:Ne \l_tmpa_tl
{
{ \int_use:N \c at iRow }
{ \int_use:N \c at jCol }
@@ -7193,24 +7112,23 @@
{ \tl_if_in:nnT { #5 } { & } { \bool_set_true:N \l_tmpa_bool } }
\bool_case:nF
{
- \l_tmpa_bool { \exp_args:Nee \__nicematrix_Block_vii:nnnnn }
- \l__nicematrix_p_block_bool { \exp_args:Nee \__nicematrix_Block_vi:nnnnn }
- \l__nicematrix_X_bool { \exp_args:Nee \__nicematrix_Block_v:nnnnn }
- { \tl_if_empty_p:n { #5 } } { \exp_args:Nee \__nicematrix_Block_v:nnnnn }
- { \int_compare_p:nNn \l_tmpa_int = \c_one_int }
- { \exp_args:Nee \__nicematrix_Block_iv:nnnnn }
- { \int_compare_p:nNn \l_tmpb_int = \c_one_int }
- { \exp_args:Nee \__nicematrix_Block_iv:nnnnn }
+ \l_tmpa_bool { \__nicematrix_Block_vii:eennn }
+ \l__nicematrix_p_block_bool { \__nicematrix_Block_vi:eennn }
+ \l__nicematrix_X_bool { \__nicematrix_Block_v:eennn }
+ { \tl_if_empty_p:n { #5 } } { \__nicematrix_Block_v:eennn }
+ { \int_compare_p:nNn \l_tmpa_int = \c_one_int } { \__nicematrix_Block_iv:eennn }
+ { \int_compare_p:nNn \l_tmpb_int = \c_one_int } { \__nicematrix_Block_iv:eennn }
}
- { \exp_args:Nee \__nicematrix_Block_v:nnnnn }
+ { \__nicematrix_Block_v:eennn }
{ \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 }
}
+\cs_generate_variant:Nn \__nicematrix_Block_iv:nnnnn { e e }
\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnn #1 #2 #3 #4 #5
{
\int_gincr:N \g__nicematrix_block_box_int
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_actually_diagbox:nnnnnn
{ \int_use:N \c at iRow }
@@ -7329,7 +7247,7 @@
}
}
}
- \seq_gput_right:Nx \g__nicematrix_blocks_seq
+ \seq_gput_right:Ne \g__nicematrix_blocks_seq
{
\l_tmpa_tl
{
@@ -7353,7 +7271,7 @@
{
\bool_if:NT \g__nicematrix_rotate_bool
{
- \str_set:Nx \l__nicematrix_hpos_block_str
+ \str_set:Ne \l__nicematrix_hpos_block_str
{
\bool_if:NTF \g__nicematrix_rotate_c_bool
{ c }
@@ -7395,9 +7313,10 @@
}
}
}
+\cs_generate_variant:Nn \__nicematrix_Block_v:nnnnn { e e }
\cs_new_protected:Npn \__nicematrix_Block_v:nnnnn #1 #2 #3 #4 #5
{
- \seq_gput_right:Nx \g__nicematrix_blocks_seq
+ \seq_gput_right:Ne \g__nicematrix_blocks_seq
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
@@ -7444,9 +7363,10 @@
}
}
}
+\cs_generate_variant:Nn \__nicematrix_Block_vi:nnnnn { e e }
\cs_new_protected:Npn \__nicematrix_Block_vi:nnnnn #1 #2 #3 #4 #5
{
- \seq_gput_right:Nx \g__nicematrix_blocks_seq
+ \seq_gput_right:Ne \g__nicematrix_blocks_seq
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
@@ -7457,9 +7377,10 @@
}
}
}
+\cs_generate_variant:Nn \__nicematrix_Block_vii:nnnnn { e e }
\cs_new_protected:Npn \__nicematrix_Block_vii:nnnnn #1 #2 #3 #4 #5
{
- \seq_gput_right:Nx \g__nicematrix_blocks_seq
+ \seq_gput_right:Ne \g__nicematrix_blocks_seq
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
@@ -7545,6 +7466,7 @@
{ \cs_set_eq:NN \ialign \__nicematrix_old_ialign: }
\seq_map_inline:Nn \g__nicematrix_blocks_seq { \__nicematrix_Block_iv:nnnnnn ##1 }
}
+\cs_generate_variant:Nn \__nicematrix_Block_v:nnnnnn { n n e e }
\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6
{
\int_zero_new:N \l__nicematrix_last_row_int
@@ -7574,17 +7496,16 @@
\int_compare:nNnTF \l__nicematrix_last_row_int > \g__nicematrix_row_total_int
{ \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } }
{
- \__nicematrix_Block_v:nnVVnn
+ \__nicematrix_Block_v:nneenn
{ #1 }
{ #2 }
- \l__nicematrix_last_row_int
- \l__nicematrix_last_col_int
+ { \int_use:N \l__nicematrix_last_row_int }
+ { \int_use:N \l__nicematrix_last_col_int }
{ #5 }
{ #6 }
}
}
}
-\cs_generate_variant:Nn \__nicematrix_Block_v:nnnnnn { n n V V n n }
\cs_new_protected:Npn \__nicematrix_Block_v:nnnnnn #1 #2 #3 #4 #5 #6
{
\group_begin:
@@ -7596,7 +7517,7 @@
\l__nicematrix_vlines_block_bool
{ ! \l__nicematrix_ampersand_bool }
{
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\__nicematrix_vlines_block:nnn
{ \exp_not:n { #5 } }
@@ -7606,7 +7527,7 @@
}
\bool_if:NT \l__nicematrix_hlines_block_bool
{
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\__nicematrix_hlines_block:nnn
{ \exp_not:n { #5 } }
@@ -7618,7 +7539,7 @@
{
\bool_lazy_and:nnF \l__nicematrix_vlines_block_bool \l__nicematrix_hlines_block_bool
{
- \seq_gput_left:Nx \g__nicematrix_pos_of_blocks_seq
+ \seq_gput_left:Ne \g__nicematrix_pos_of_blocks_seq
{ { #1 } { #2 } { #3 } { #4 } { \l__nicematrix_block_name_str } }
}
}
@@ -7626,7 +7547,7 @@
{
\bool_lazy_or:nnT \l__nicematrix_hlines_block_bool \l__nicematrix_vlines_block_bool
{ \__nicematrix_error:n { hlines~with~color } }
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\__nicematrix_stroke_block:nnn
{ \exp_not:n { #5 } }
@@ -7638,7 +7559,7 @@
}
\clist_if_empty:NF \l__nicematrix_borders_clist
{
- \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ \tl_gput_right:Ne \g_nicematrix_code_after_tl
{
\__nicematrix_stroke_borders_block:nnn
{ \exp_not:n { #5 } }
@@ -7650,9 +7571,9 @@
{
\tl_if_empty:NF \l__nicematrix_opacity_tl
{
- \tl_if_head_eq_meaning:nNTF \l__nicematrix_fill_tl [
+ \tl_if_head_eq_meaning:oNTF \l__nicematrix_fill_tl [
{
- \tl_set:Nx \l__nicematrix_fill_tl
+ \tl_set:Ne \l__nicematrix_fill_tl
{
[ opacity = \l__nicematrix_opacity_tl ,
\tl_tail:o \l__nicematrix_fill_tl
@@ -7659,14 +7580,14 @@
}
}
{
- \tl_set:Nx \l__nicematrix_fill_tl
- { [ opacity = \l__nicematrix_opacity_tl ] { \l__nicematrix_fill_tl } }
+ \tl_set:Ne \l__nicematrix_fill_tl
+ { [ opacity = \l__nicematrix_opacity_tl ] { \exp_not:o \l__nicematrix_fill_tl } }
}
}
- \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_before_tl
{
\exp_not:N \roundedrectanglecolor
- \exp_args:No \tl_if_head_eq_meaning:nNTF \l__nicematrix_fill_tl [
+ \tl_if_head_eq_meaning:oNTF \l__nicematrix_fill_tl [
{ \l__nicematrix_fill_tl }
{ { \l__nicematrix_fill_tl } }
{ #1 - #2 }
@@ -7676,19 +7597,19 @@
}
\seq_if_empty:NF \l__nicematrix_tikz_seq
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Ne \g_nicematrix_code_before_tl
{
\__nicematrix_block_tikz:nnnnn
+ { \seq_use:Nn \l__nicematrix_tikz_seq { , } }
{ #1 }
{ #2 }
{ \int_use:N \l__nicematrix_last_row_int }
{ \int_use:N \l__nicematrix_last_col_int }
- { \seq_use:Nn \l__nicematrix_tikz_seq { , } }
}
}
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_actually_diagbox:nnnnnn
{ #1 }
@@ -7695,7 +7616,8 @@
{ #2 }
{ \int_use:N \l__nicematrix_last_row_int }
{ \int_use:N \l__nicematrix_last_col_int }
- { \exp_not:n { ##1 } } { \exp_not:n { ##2 } }
+ { \exp_not:n { ##1 } }
+ { \exp_not:n { ##2 } }
}
}
\pgfpicture
@@ -7901,9 +7823,9 @@
\bool_lazy_any:nTF
{
{ \str_if_empty_p:N \l__nicematrix_vpos_block_str } % added 2024/06/29
- { \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 } }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { c } }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { T } }
+ { \str_if_eq_p:ee \l__nicematrix_vpos_block_str { B } }
}
{
\int_if_zero:nT { #2 } { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_r_str }
@@ -7912,7 +7834,7 @@
\int_compare:nNnT { #2 } = \g__nicematrix_col_total_int
{ \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_l_str }
}
- \tl_set:Nx \l_tmpa_tl
+ \tl_set:Ne \l_tmpa_tl
{
\str_case:on \l__nicematrix_vpos_block_str
{
@@ -7981,7 +7903,7 @@
{
\__nicematrix_qpoint:n
{
- row - \str_if_eq:onTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
+ row - \str_if_eq:eeTF \l__nicematrix_vpos_block_str { b } { #3 } { #1 }
- base
}
}
@@ -8074,7 +7996,7 @@
{
color .tl_set:N = \l__nicematrix_draw_tl ,
draw .code:n =
- \exp_args:Ne \tl_if_empty:nF { #1 } { \tl_set:Nn \l__nicematrix_draw_tl { #1 } } ,
+ \tl_if_empty:eF { #1 } { \tl_set:Nn \l__nicematrix_draw_tl { #1 } } ,
draw .default:n = default ,
line-width .dim_set:N = \l__nicematrix_line_width_dim ,
rounded-corners .dim_set:N = \l__nicematrix_rounded_corners_dim ,
@@ -8088,8 +8010,8 @@
\tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl
\__nicematrix_cut_on_hyphen:w #3 \q_stop
- \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
- \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \tl_set:Ne \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Ne \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
\int_step_inline:nnn \l__nicematrix_tmpd_tl \l_tmpb_tl
{
\use:e
@@ -8112,8 +8034,8 @@
\tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl
\__nicematrix_cut_on_hyphen:w #3 \q_stop
- \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
- \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \tl_set:Ne \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Ne \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
\int_step_inline:nnn \l__nicematrix_tmpc_tl \l_tmpa_tl
{
\use:e
@@ -8136,7 +8058,7 @@
{ \__nicematrix_error:n { borders~forbidden } }
{
\tl_clear_new:N \l__nicematrix_borders_tikz_tl
- \keys_set:nV
+ \keys_set:no
{ nicematrix / OnlyForTikzInBorders }
\l__nicematrix_borders_clist
\__nicematrix_cut_on_hyphen:w #2 \q_stop
@@ -8143,14 +8065,14 @@
\tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl
\__nicematrix_cut_on_hyphen:w #3 \q_stop
- \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
- \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \tl_set:Ne \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Ne \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
\__nicematrix_stroke_borders_block_i:
}
}
\hook_gput_code:nnn { begindocument } { . }
{
- \cs_new_protected:Npx \__nicematrix_stroke_borders_block_i:
+ \cs_new_protected:Npe \__nicematrix_stroke_borders_block_i:
{
\c__nicematrix_pgfortikzpicture_tl
\__nicematrix_stroke_borders_block_ii:
@@ -8230,11 +8152,13 @@
rounded-corners .default:n = 4 pt ,
line-width .dim_set:N = \l__nicematrix_line_width_dim
}
+
+\cs_generate_variant:Nn \__nicematrix_block_tikz:nnnnn { o }
\cs_new_protected:Npn \__nicematrix_block_tikz:nnnnn #1 #2 #3 #4 #5
{
\begin { tikzpicture }
\__nicematrix_clip_with_rounded_corners:
- \clist_map_inline:nn { #5 }
+ \clist_map_inline:nn { #1 }
{
\keys_set_known:nnN { nicematrix / SpecialOffset } { ##1 } \l_tmpa_tl
\use:e { \exp_not:N \path [ \l_tmpa_tl ] }
@@ -8243,7 +8167,7 @@
xshift = \dim_use:N \l__nicematrix_offset_dim ,
yshift = - \dim_use:N \l__nicematrix_offset_dim
]
- #1 -| #2
+ #2 -| #3
)
rectangle
(
@@ -8251,12 +8175,11 @@
xshift = - \dim_use:N \l__nicematrix_offset_dim ,
yshift = \dim_use:N \l__nicematrix_offset_dim
]
- \int_eval:n { #3 + 1 } -| \int_eval:n { #4 + 1 }
+ \int_eval:n { #4 + 1 } -| \int_eval:n { #5 + 1 }
) ;
}
\end { tikzpicture }
}
-\cs_generate_variant:Nn \__nicematrix_block_tikz:nnnnn { n n n n V }
\keys_define:nn { nicematrix / SpecialOffset }
{ offset .dim_set:N = \l__nicematrix_offset_dim }
\cs_new_protected:Npn \__nicematrix_NullBlock:
@@ -8336,7 +8259,7 @@
\cs_set_protected:cpn { #1 AutoNiceMatrix }
{
\bool_gset_true:N \g__nicematrix_delims_bool
- \str_gset:Nx \g__nicematrix_name_env_str { #1 AutoNiceMatrix }
+ \str_gset:Ne \g__nicematrix_name_env_str { #1 AutoNiceMatrix }
\AutoNiceMatrixWithDelims { #2 } { #3 }
}
}
@@ -8362,7 +8285,7 @@
{ \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
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\__nicematrix_actually_diagbox:nnnnnn
{ \int_use:N \c at iRow }
@@ -8372,7 +8295,7 @@
{ \g__nicematrix_row_style_tl \exp_not:n { #1 } }
{ \g__nicematrix_row_style_tl \exp_not:n { #2 } }
}
- \seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq
+ \seq_gput_right:Ne \g__nicematrix_pos_of_blocks_seq
{
{ \int_use:N \c at iRow }
{ \int_use:N \c at jCol }
@@ -8407,7 +8330,7 @@
\pgfnode { rectangle } { south~west }
{
\begin { minipage } { 20 cm }
- \__nicematrix_math_toggle: #5 \__nicematrix_math_toggle:
+ \__nicematrix_math_toggle: \scan_stop: #5 \__nicematrix_math_toggle:
\end { minipage }
}
{ }
@@ -8418,7 +8341,7 @@
{
\begin { minipage } { 20 cm }
\raggedleft
- \__nicematrix_math_toggle: #6 \__nicematrix_math_toggle:
+ \__nicematrix_math_toggle: \scan_stop: #6 \__nicematrix_math_toggle:
\end { minipage }
}
{ }
@@ -8560,7 +8483,7 @@
{
\peek_remove_spaces:n
{
- \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ \tl_gput_right:Ne \g__nicematrix_pre_code_after_tl
{
\SubMatrix { #1 } { #2 } { #3 } { #4 }
[
@@ -8582,12 +8505,12 @@
{ \__nicematrix_SubMatrix_in_code_before_i:nnnn #1 #2 }
\cs_new_protected:Npn \__nicematrix_SubMatrix_in_code_before_i:nnnn #1 #2 #3 #4
{
- \seq_gput_right:Nx \g__nicematrix_submatrix_seq
+ \seq_gput_right:Ne \g__nicematrix_submatrix_seq
{
- { \str_if_eq:nnTF { #1 } { last } { \int_use:N \c at iRow } { #1 } }
- { \str_if_eq:nnTF { #2 } { last } { \int_use:N \c at jCol } { #2 } }
- { \str_if_eq:nnTF { #3 } { last } { \int_use:N \c at iRow } { #3 } }
- { \str_if_eq:nnTF { #4 } { last } { \int_use:N \c at jCol } { #4 } }
+ { \str_if_eq:eeTF { #1 } { last } { \int_use:N \c at iRow } { #1 } }
+ { \str_if_eq:eeTF { #2 } { last } { \int_use:N \c at jCol } { #2 } }
+ { \str_if_eq:eeTF { #3 } { last } { \int_use:N \c at iRow } { #3 } }
+ { \str_if_eq:eeTF { #4 } { last } { \int_use:N \c at jCol } { #4 } }
}
}
\hook_gput_code:nnn { begindocument } { . }
@@ -8648,15 +8571,15 @@
{ pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \l__nicematrix_first_j_tl }
{
\pgfpointanchor { \__nicematrix_env: - ##1 - \l__nicematrix_first_j_tl } { west }
- \dim_set:Nn \l__nicematrix_x_initial_dim
- { \dim_min:nn \l__nicematrix_x_initial_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x < \l__nicematrix_x_initial_dim
+ { \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x }
}
\cs_if_exist:cT
{ pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \l__nicematrix_last_j_tl }
{
\pgfpointanchor { \__nicematrix_env: - ##1 - \l__nicematrix_last_j_tl } { east }
- \dim_set:Nn \l__nicematrix_x_final_dim
- { \dim_max:nn \l__nicematrix_x_final_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x > \l__nicematrix_x_final_dim
+ { \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x }
}
}
\dim_compare:nNnTF \l__nicematrix_x_initial_dim = \c_max_dim
@@ -8697,8 +8620,8 @@
{ pgf @ sh @ ns @ \__nicematrix_env: - \l__nicematrix_last_i_tl - ##1 }
{
\pgfpointanchor { \__nicematrix_env: - \l__nicematrix_last_i_tl - ##1 } { south }
- \dim_set:Nn \l__nicematrix_y_final_dim
- { \dim_min:nn \l__nicematrix_y_final_dim \pgf at y }
+ \dim_compare:nNnT \pgf at y < \l__nicematrix_y_final_dim
+ { \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf at y }
}
}
\dim_set:Nn \l_tmpa_dim
@@ -8808,7 +8731,7 @@
{ \__nicematrix_env: - \l__nicematrix_submatrix_name_str - right } { #3 } { #4 }
}
\cs_set_eq:NN \pgfpointanchor \__nicematrix_pgfpointanchor:n
- \flag_clear_new:n { nicematrix }
+ \flag_clear_new:N \l__nicematrix_code_flag
\l__nicematrix_code_tl
}
\cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor
@@ -8832,8 +8755,8 @@
{
\str_case:nVTF { #1 } \c__nicematrix_integers_alist_tl
{
- \flag_raise:n { nicematrix }
- \int_if_even:nTF { \flag_height:n { nicematrix } }
+ \flag_raise:N \l__nicematrix_code_flag
+ \int_if_even:nTF { \flag_height:N \l__nicematrix_code_flag }
{ \int_eval:n { #1 + \l__nicematrix_first_i_tl - 1 } }
{ \int_eval:n { #1 + \l__nicematrix_first_j_tl - 1 } }
}
@@ -8937,7 +8860,7 @@
{ \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 }
{
- \str_if_eq:nnTF { #5 } { under }
+ \str_if_eq:eeTF { #5 } { under }
{ \__nicematrix_error:nn { Construct~too~large } { \UnderBrace } }
{ \__nicematrix_error:nn { Construct~too~large } { \OverBrace } }
}
@@ -8957,8 +8880,9 @@
{ pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \l__nicematrix_first_j_tl }
{
\pgfpointanchor { \__nicematrix_env: - ##1 - \l__nicematrix_first_j_tl } { west }
- \dim_set:Nn \l__nicematrix_x_initial_dim
- { \dim_min:nn \l__nicematrix_x_initial_dim \pgf at x }
+
+ \dim_compare:nNnT \pgf at x < \l__nicematrix_x_initial_dim
+ { \dim_set_eq:NN \l__nicematrix_x_initial_dim \pgf at x }
}
}
}
@@ -8978,8 +8902,8 @@
{ pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \l__nicematrix_last_j_tl }
{
\pgfpointanchor { \__nicematrix_env: - ##1 - \l__nicematrix_last_j_tl } { east }
- \dim_set:Nn \l__nicematrix_x_final_dim
- { \dim_max:nn \l__nicematrix_x_final_dim \pgf at x }
+ \dim_compare:nNnT \pgf at x > \l__nicematrix_x_final_dim
+ { \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x }
}
}
}
@@ -8991,7 +8915,7 @@
\dim_set_eq:NN \l__nicematrix_x_final_dim \pgf at x
}
\pgfset { inner~sep = \c_zero_dim }
- \str_if_eq:nnTF { #5 } { under }
+ \str_if_eq:eeTF { #5 } { under }
{ \__nicematrix_underbrace_i:n { #3 } }
{ \__nicematrix_overbrace_i:n { #3 } }
\endpgfpicture
@@ -9116,13 +9040,13 @@
\cs_new_protected:Nn \__nicematrix_all_the_cells:
{
- \int_step_variable:nNn { \int_use:c { c at iRow } } \__nicematrix_i_tl
+ \int_step_variable:nNn \c at iRow \__nicematrix_i_tl
{
- \int_step_variable:nNn { \int_use:c { c at jCol } } \__nicematrix_j_tl
+ \int_step_variable:nNn \c at jCol \__nicematrix_j_tl
{
\cs_if_exist:cF { cell - \__nicematrix_i_tl - \__nicematrix_j_tl }
{
- \exp_args:NNe \seq_if_in:NnF \l__nicematrix_corners_cells_seq
+ \clist_if_in:NeF \l__nicematrix_corners_cells_clist
{ \__nicematrix_i_tl - \__nicematrix_j_tl }
{
\bool_set_false:N \l_tmpa_bool
@@ -9138,8 +9062,8 @@
}
\bool_if:NT \l_tmpa_bool
{
- \__nicematrix_block_tikz:nnnnV
- \__nicematrix_i_tl \__nicematrix_j_tl \__nicematrix_i_tl \__nicematrix_j_tl \l_tmpa_tl
+ \__nicematrix_block_tikz:onnnn
+ \l_tmpa_tl \__nicematrix_i_tl \__nicematrix_j_tl \__nicematrix_i_tl \__nicematrix_j_tl
}
}
}
@@ -9151,8 +9075,8 @@
{
\bool_if:NF \l__nicematrix_empty_bool
{
- \__nicematrix_block_tikz:nnnnV
- { #1 } { #2 } { #3 } { #4 } \l_tmpa_tl
+ \__nicematrix_block_tikz:onnnn
+ \l_tmpa_tl { #1 } { #2 } { #3 } { #4 }
}
\__nicematrix_mark_cells_of_block:nnnn { #1 } { #2 } { #3 } { #4 }
}
@@ -9162,7 +9086,7 @@
\int_step_inline:nnn { #1 } { #3 }
{
\int_step_inline:nnn { #2 } { #4 }
- { \cs_set:cpn { cell - ##1 - ####1 } { } }
+ { \cs_set_nopar:cpn { cell - ##1 - ####1 } { } }
}
}
\NewDocumentCommand \__nicematrix_ShowCellNames_CodeBefore { }
@@ -9338,7 +9262,6 @@
footnote,~
footnotehyper,~
messages-for-Overleaf,~
- no-test-for-array,~
renew-dots,~and~
renew-matrix.
}
@@ -9351,8 +9274,7 @@
messages-for-Overleaf .bool_set:N = \g__nicematrix_messages_for_Overleaf_bool ,
footnote .bool_set:N = \g__nicematrix_footnote_bool ,
footnotehyper .bool_set:N = \g__nicematrix_footnotehyper_bool ,
- no-test-for-array .bool_set:N = \g__nicematrix_no_test_for_array_bool ,
- no-test-for-array .default:n = true ,
+ no-test-for-array .code:n = \prg_do_nothing: ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~package }
}
\ProcessKeysOptions { nicematrix / Package }
@@ -9396,16 +9318,14 @@
\bool_set_true:N \g__nicematrix_footnote_bool
}
\bool_new:N \l__nicematrix_underscore_loaded_bool
-\IfPackageLoadedTF { underscore }
+\IfPackageLoadedT { underscore }
{ \bool_set_true:N \l__nicematrix_underscore_loaded_bool }
- { }
\hook_gput_code:nnn { begindocument } { . }
{
\bool_if:NF \l__nicematrix_underscore_loaded_bool
{
- \IfPackageLoadedTF { underscore }
+ \IfPackageLoadedT { underscore }
{ \__nicematrix_error:n { underscore~after~nicematrix } }
- { }
}
}
\bool_if:NTF \g__nicematrix_messages_for_Overleaf_bool
@@ -9420,24 +9340,18 @@
NiceMatrix ,
pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix
}
-\seq_gset_map_x:NNn \g__nicematrix_types_of_matrix_seq \g__nicematrix_types_of_matrix_seq
+\seq_gset_map_e:NNn \g__nicematrix_types_of_matrix_seq \g__nicematrix_types_of_matrix_seq
{ \tl_to_str:n { #1 } }
\cs_new_protected:Npn \__nicematrix_error_too_much_cols:
{
- \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 } }
- {
- \int_compare:nNnTF \l__nicematrix_last_col_int = { -1 }
- { \__nicematrix_fatal:n { too~much~cols~for~matrix } }
- {
- \bool_if:NF \l__nicematrix_last_col_without_value_bool
- { \__nicematrix_fatal:n { too~much~cols~for~matrix~with~last~col } }
- }
- }
- }
+ \seq_if_in:NoF \g__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str
{ \__nicematrix_fatal:nn { too~much~cols~for~array } }
+ \int_compare:nNnT \l__nicematrix_last_col_int = { -2 }
+ { \__nicematrix_fatal:n { too~much~cols~for~matrix } }
+ \int_compare:nNnT \l__nicematrix_last_col_int = { -1 }
+ { \__nicematrix_fatal:n { too~much~cols~for~matrix } }
+ \bool_if:NF \l__nicematrix_last_col_without_value_bool
+ { \__nicematrix_fatal:n { too~much~cols~for~matrix~with~last~col } }
}
\cs_new:Npn \__nicematrix_message_hdotsfor:
{
@@ -9706,12 +9620,6 @@
You~can't~use~the~columns~'S'~because~'siunitx'~is~not~loaded.\\
That~error~is~fatal.
}
-\__nicematrix_msg_new:nn { ragged2e~not~loaded }
- {
- You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~
- your~column~'\l__nicematrix_vpos_col_str'~(or~'X').~The~key~'\str_lowercase:o
- \l_keys_key_str'~will~be~used~instead.
- }
\__nicematrix_msg_new:nn { Invalid~name }
{
Invalid~name.\\
@@ -9838,8 +9746,7 @@
(in~the~key~'borders'~of~the~command~\token_to_str:N \Block).~
The~available~values~are:~left,~right,~top~and~bottom~(and~you~can~
also~use~the~key~'tikz'
- \IfPackageLoadedTF { tikz }
- { }
+ \IfPackageLoadedF { tikz }
{~if~you~load~the~LaTeX~package~'tikz'}).\\
This~specification~of~border~will~be~ignored.
}
More information about the tex-live-commits
mailing list.