summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdfbin511876 -> 511972 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex220
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdfbin1296290 -> 1320819 bytes
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx980
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty623
5 files changed, 1266 insertions, 557 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
index 00d091b5854..aef19a755cf 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
index c9c6eebe4d2..6244fda93e2 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
@@ -1,4 +1,5 @@
% -*- coding: utf-8 ; -*-
+% Ce fichier doit être compilé avec xelatex uniquement.
\documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix)
\usepackage{xltxtra}
\usepackage[french]{babel}
@@ -17,8 +18,9 @@
\usepackage{verbatim}
\usepackage{caption}
-% We use \MakeShortVerb of shortvrb and not \DefineShortVerb of fancyvrb
-% because we don't want the contents of short verbatim colored in gray
+% On utilise \MakeShortVerb de shortvrb et pas \DefineShortVerb de fancyvrb
+% car on ne veut pas que le contenu des petits éléments en verbatim soit colorié
+% en grise
\usepackage{shortvrb}
\MakeShortVerb{\|}
@@ -708,8 +710,6 @@ blanc, alors le bloc est mono-case\footnote{On peut considérer que la valeur pa
défaut de ce premier argument obligatoire est |1-1|.}.
-
-
\subsection{Positionnement horizontal du contenu des blocs}
Par défaut, le positionnement horizontal des contenus des blocs est calculé sur
@@ -794,7 +794,9 @@ Marie & Pauline \\ \hline
\medskip
En revanche, les filets verticaux ne sont pas tracés à l'intérieur des blocs
(créés par |\Block|: cf.~p.~\pageref{Block}) ni dans les coins (dont la création
-est demandée par la clé |corners|: cf.~p.~\pageref{corners}).
+est demandée par la clé |corners|: cf.~p.~\pageref{corners}), ni dans les
+éventuelles rangées extérieures (créées par les clés |row-first| et |last-row|:
+cf.~p.~\pageref{exterior}).
\medskip
@@ -951,7 +953,8 @@ préambule) ;
\medskip
\textbf{Ces outils ont en commun de ne pas tracer les filets dans les blocs ni
- dans les coins vides (quand la clé |corners| est utilisée).}
+ dans les coins vides (quand la clé |corners| est utilisée), ni dans les
+ rangées et colonnes extérieures.}
\begin{itemize}
\item Les blocs en question sont :
\begin{itemize}
@@ -964,11 +967,17 @@ par |\Cdots|, |\Vdots|, etc. : cf.~p.~\pageref{Cdots}.
\end{itemize}
\item Les coins sont créés par la clé |corners| détaillée un peu plus loin : cf.
p.~\pageref{corners}.
+\item Pour les rangées et colonnes extérieures, cf.~\pageref{exterior}.
\end{itemize}
En particulier, cette remarque explique la différence entre la commande standard
|\hline| et la commande |\Hline| proposée par \pkg{nicematrix}.
+\colorbox{yellow!50}{\textbf{Nouveau 6.13}}\enskip La command |\Hline| admet
+entre crochets un argument optionnel qui est une liste de couples
+\textsl{clé=valeur} qui décrivent un filet. Pour la description de ces clés,
+voir |custom-line| p.~\pageref{custom-line}.
+
\medskip
\subsubsection{Les clés hlines et vlines}
@@ -1148,7 +1157,7 @@ descendante.
\medskip
\begin{BVerbatim}[baseline=c,boxwidth=10cm]
$\begin{NiceArray}{*{5}{c}}[hvlines]
-~emphase#\diagbox{x}{y}@ & e & a & b & c \\
+~emphase#\diagbox{x}{y}@ & e & a & b & c \\
e & e & a & b & c \\
a & a & e & c & b \\
b & b & c & e & a \\
@@ -1156,7 +1165,7 @@ c & c & b & a & e
\end{NiceArray}$
\end{BVerbatim}
$\begin{NiceArray}{*{5}{c}}[hvlines]
-\diagbox{x}{y} & e & a & b & c \\
+\diagbox{x}{y} & e & a & b & c \\
e & e & a & b & c \\
a & a & e & c & b \\
b & b & c & e & a \\
@@ -1199,7 +1208,11 @@ utilisée par l'utilisateur dans le préambule d'un environnement à préambule
\end{itemize}
\bigskip
-Pour la description du filet elle-même, il y a trois possibilités.
+On traite maintenant de la description du filet elle-même. Les options qui
+suivent peuvent aussi s'utiliser dans l'argument optionnel d'une |\Hline|
+individuelle.
+
+Il y a trois possibilités.
\begin{itemize}
@@ -1254,7 +1267,7 @@ Produit C & 5 & 4 & 1 \\
\end{center}
-\item \emph{Deuxième possibilité}
+\item \emph{Deuxième possibilité}\par\nobreak
On peut utiliser la clé |tikz| (si Tikz est chargé, \pkg{nicematrix} ne
chargeant par défaut que \textsc{pgf}). Dans ce cas-là, le filet est tracé
@@ -1461,11 +1474,12 @@ peut placer le contenu de ce |code-before| entre les mots-clés |\CodeBefore| et
\end{Verbatim}
\smallskip
-De nouvelles commandes sont disponibles dans ce |\CodeBefore|:
-|\cellcolor|, |\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors|,
-|\rowlistcolors|, |\chessboardcolors| et |\arraycolor|.\footnote{On pourra remarquer que, dans le
- |\CodeBefore|, des nœuds PGF/Tikz de la forme \verb+(i-|j)+ correspondant
- à la position des filets éventuels sont également accessibles : cf. p.~\pageref{nodes-i}.}
+De nouvelles commandes sont disponibles dans ce |\CodeBefore|: |\cellcolor|,
+|\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors|, |\rowlistcolors|,
+|\chessboardcolors| et |\arraycolor|.\footnote{On pourra remarquer que, dans le
+ |\CodeBefore|, des nœuds PGF-Tikz de la forme \verb+(i-|j)+ correspondant à la
+ position des filets éventuels sont également accessibles : cf.
+ p.~\pageref{nodes-i}.}
\label{code-before}
\medskip
@@ -1485,30 +1499,30 @@ p.~\pageref{corners}.
\pkg{colortbl}.
Elle prend en arguments obligatoires une couleur et une liste de cases sous le
-format $i$-$j$ où $i$ est le numéro de ligne et $j$ le numéro de colonne.
+format $i$-$j$ où $i$ est le numéro de ligne et $j$ le numéro de colonne. Malgré
+son nom, elle peut aussi colorier une ligne avec la syntaxe $i$- ou bien une
+colonne avec la syntaxe~-$j$.
\medskip
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[boxwidth=10cm,baseline=c]
-\begin{NiceTabular}{|c|c|c|}
+\begin{NiceTabular}{ccc}[hvlines]
\CodeBefore
- ~emphase#\cellcolor[HTML]{FFFF88}{3-1,2-2,1-3}@
+ ~emphase#\cellcolor[HTML]{FFFF88}{3-1,2-2,-3}@
\Body
-\hline
-a & b & c \\ \hline
-e & f & g \\ \hline
-h & i & j \\ \hline
+a & b & c \\
+e & f & g \\
+h & i & j \\
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{|c|c|c|}
+\begin{NiceTabular}{ccc}[hvlines]
\CodeBefore
- \cellcolor[HTML]{FFFF88}{3-1,2-2,1-3}
+ \cellcolor[HTML]{FFFF88}{3-1,2-2,-3}
\Body
-\hline
-a & b & c \\ \hline
-e & f & g \\ \hline
-h & i & j \\ \hline
+a & b & c \\
+e & f & g \\
+h & i & j \\
\end{NiceTabular}
\end{scope}
@@ -1522,24 +1536,22 @@ et la case en bas à droite du rectangle.
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[boxwidth=10cm,baseline=c]
-\begin{NiceTabular}{|c|c|c|}
+\begin{NiceTabular}{ccc}[hvlines]
\CodeBefore
~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@
\Body
-\hline
-a & b & c \\ \hline
-e & f & g \\ \hline
-h & i & j \\ \hline
+a & b & c \\
+e & f & g \\
+h & i & j \\
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{|c|c|c|}
+\begin{NiceTabular}{ccc}[hvlines]
\CodeBefore
\rectanglecolor{blue!15}{2-2}{3-3}
\Body
-\hline
-a & b & c \\ \hline
-e & f & g \\ \hline
-h & i & j \\ \hline
+a & b & c \\
+e & f & g \\
+h & i & j \\
\end{NiceTabular}
\end{scope}
@@ -1580,7 +1592,7 @@ $\begin{pNiceMatrix}[baseline=1, r, margin]
\medskip
On a utilisé la clé |r| qui impose que toutes les colonnes soient alignées à
-droite (cf. p.~\pageref{key-R}).
+droite (cf. p.~\pageref{columns-type}).
\medskip
@@ -1637,9 +1649,7 @@ a_{10} & b_{10} & c_{10} \\
\medskip
\item La commande |\rowcolors| (avec un \emph{s}) doit son nom à la commande
-|\rowcolors| de \pkg{xcolor}\footnote{La commande |\rowcolors| de \pkg{xcolor}
- est disponible quand \pkg{xcolor} est chargé avec l'option |table|. Cett
- option charge également l'extension \pkg{colortbl}.}. Le \emph{s} rappelle
+|\rowcolors| de \pkg{colortbl}. Le \emph{s} rappelle
qu'il y a deux couleurs. Elle colorie alternativement les rangées avec les deux
couleurs à partir de la rangée dont le numéro est donné en premier argument
(obligatoire), comme le fait la commande |\rowcolors| de \pkg{xcolor}.
@@ -2040,7 +2050,7 @@ supprimé (il est évidemment possible de le supprimer en mettant |\tabcolsep| o
Il est possible de donner la valeur spéciale |auto| à l'option |columns-width|:
toutes les colonnes du tableau auront alors une largeur égale à la largeur de la
case la plus large du tableau.\footnote{Le résultat est atteint dès la première
- compilation (mais PGF/Tikz écrivant des informations dans le fichier |aux|,
+ compilation (mais PGF-Tikz écrivant des informations dans le fichier |aux|,
un message demandant une deuxième compilation apparaîtra).}\par\nobreak
\medskip
@@ -2126,7 +2136,6 @@ $\begin{array}{c}
\label{varwidth}
-
Rappelons d'abord le fonctionnement d'un environnement |{varwidth}| de
l'extension éponyme \pkg{varwidth}. Un tel environnement est similaire à
l'environnement classique |{minipage}| mais la largeur indiquée (en argument)
@@ -2181,11 +2190,8 @@ Lorsque l'extension \pkg{varwidth} est chargée, ces colonnes |V| de
\pkg{varwidth} sont prises en charge par \pkg{nicematrix}. Dans le cadre de
\pkg{nicematrix}, l'un des intérêts des colonnes de type |V| par rapport aux
colonnes de type |p|, |m| ou |b| est que, pour les cases d'une telle colonne,
-le nœud PGF/Tikz créé pour le contenu d'une telle case a une largeur ajusté
-au contenu de la cellule en question : cf. p.~\pageref{node-V}. Si le contenu
-est vide, la cellule sera considérée comme vide par \pkg{nicematrix} pour le
-tracé des lignes pointillés et la détermination des «coins vides» (ce n'est pas
-le cas avec une case d'une colonne |p|, |m| ou |b|).
+le nœud PGF-Tikz créé pour le contenu d'une telle case a une largeur ajustée
+au contenu de la cellule en question : cf. p.~\pageref{node-V}.
\medskip
\begin{Verbatim}
@@ -2207,7 +2213,7 @@ un très très très très long texte
Remarquons que l'extension \pkg{varwidth} a quelques problèmes (au moins dans sa
-version 0.92). Par exemple, avec LuaLaTeX, elle en fonctionne pas si le contenu
+version 0.92). Par exemple, avec LuaLaTeX, elle ne fonctionne pas si le contenu
commence par une instruction |\color|.
\subsection{Les colonnes X}
@@ -2450,8 +2456,6 @@ a_1 & a_2 & & & a_n
\end{bNiceMatrix}$
-
-
\interitem Pour représenter la matrice nulle, on peut choisir d'utiliser le
codage suivant :\par\nobreak
@@ -2805,10 +2809,10 @@ par les options suivantes (que l'on met entre crochets après la commande) :
\item |line-style|.
\end{itemize}
-Ces options peuvent aussi être fixées avec |\NiceMatrixOptions|, comme options
-de |\CodeAfter|, ou bien au niveau d'un environnement mais elles doivent alors
-être préfixées par |xdots| (\textsl{xdots} pour rappeler que cela s'applique à
-|\Cdots|, |\Ldots|, |\Vdots|, etc.), ce qui fait que leurs noms deviennent :
+Ces options peuvent aussi être fixées avec |\NiceMatrixOptions| ou bien au
+niveau d'un environnement mais elles doivent alors être préfixées par |xdots|
+(\textsl{xdots} pour rappeler que cela s'applique à |\Cdots|, |\Ldots|,
+|\Vdots|, etc.), ce qui fait que leurs noms deviennent :
%
\begin{itemize}
\item |xdots/color| ;
@@ -2830,7 +2834,7 @@ extérieures (décrites plus loin) bénéficient d'un régime spécial : cf.
p.~\pageref{exterior}.
\medskip
-\colorbox{yellow!50}{\textbf{Nouveau 6.9}}\enskip \textbf{L'option xdots/radius}\par\nobreak
+\textbf{L'option xdots/radius}\par\nobreak
\smallskip
L'option |radius| correspond au rayon des points circulaires qui sont tracés. La
@@ -2852,7 +2856,7 @@ unité de mesure dépendante de la fonte courante).
version~6.10. Les versions précédentes ne proposaient que |xdots/shorten|.
\medskip
-\colorbox{yellow!50}{\textbf{Nouveau 6.9}}\enskip \textbf{L'option xdots/inter}\par\nobreak
+\textbf{L'option xdots/inter}\par\nobreak
\smallskip
L'option |xdots/inter| indique la distance entre deux points. La valeur
@@ -2958,14 +2962,16 @@ sera exécuté \emph{après} la construction du tableau.
\medskip
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). Les clés autorisées
-dans cet argument optionnel forment un sous-ensemble des clés acceptées par
-|\NiceMatrixOptions|.
+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 ainsi que |sub-matrix| (en lien avec la commande
+ |\SubMatrix|) et ses sous-clés.}
+
\medskip
Les utilisateurs expérimentés peuvent, en particulier, utiliser les nœuds
-PGF/Tikz créés par \pkg{nicematrix} dans le |\CodeAfter|. Ces nœuds sont décrits
+PGF-Tikz créés par \pkg{nicematrix} dans le |\CodeAfter|. Ces nœuds sont décrits
à partir de la page \pageref{PGF-nodes}.
\medskip
@@ -3216,7 +3222,7 @@ c & d & \frac12c+\frac14d \\
\medskip
Il existe aussi une clé |name| qui permet de donner un nom à une sous-matrice
créée par une commande |\SubMatrix|. Ce nom est utilisé pour créer des nœuds
-PGF/Tikz : voir p.~\pageref{node-sub-matrix}.
+PGF-Tikz : voir p.~\pageref{node-sub-matrix}.
\medskip
Il est également possible de spécifier des délimiteurs\footnote{Les délimiteurs
@@ -3332,12 +3338,13 @@ utiliser lorsque le tableau est inséré dans un environnment flottant
\smallskip
L'intérêt d'utiliser cette clé |caption| plutôt que la commande classique
-|\caption| est que la légende, si elle longue, est justifiée à la largeur du
-tableau (sans avoir à utiliser l'extension \pkg{threeparttable} ou l'extension
-\pkg{floatrow}).
+|\caption| est que la légende, si elle est longue, est justifiée à la largeur du
+tableau (hors éventuelles colonnes extérieures spécifiées par |first-col| et
+|last-col|). Il n'y a pas besoin d'avoir recours à l'extension
+\pkg{threeparttable} ou l'extension \pkg{floatrow}.
\smallskip
-Par défaut, la légende est placée au-dessous du tableau. Pour avoir la légence
+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
|\NiceMatrixOptions|.
@@ -3386,8 +3393,8 @@ 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|). Sans surprise, cette
-commande n'est disponible que dans les environnements sans délimiteurs,
-c'est-à-dire |{NiceTabular}|, |{NiceArray}| et |{NiceMatrix}|.
+commande n'est disponible que dans |{NiceTabular}|, |{NiceTabular*}| and
+|{NiceTabularX}|.
En fait, cette commande n'est disponible que si l'extension \pkg{enumitem} a été
chargée (avant ou après \pkg{nicematrix}). Les notes sont en effet composées en
@@ -3453,6 +3460,10 @@ tableau en un seul paragraphe.
\item Il existe une clé |tabularnote| qui permet d'insérer du texte dans la zone
des notes avant les notes numérotées.
+\colorbox{yellow!50}{\textbf{Nouveau 6.13} }\enskip Une syntaxe alternative est
+proposée : il est possible d'utiliser l'environnement |{TabularNote}| à la fin de
+l'environnement |{NiceTabular}| (mais \emph{avant} l'eventuel |\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.
@@ -3572,9 +3583,6 @@ paires \textsl{clé=valeur} où le nom des clés n'a plus à être préfixé par
\end{center}
-
-
-
\medskip
On détaille maintenant ces clés.
@@ -3713,29 +3721,28 @@ suivant (avec une version de LaTeX postérieure à 2020/10/01).
\subsection{Commande \textbackslash ShowCellNames}
-\colorbox{yellow!50}{\textbf{Nouveau 6.9}} La commande |\ShowCellNames|,
-utilisable dans le |\CodeBefore| et le |\CodeAfter| affiche le nom (sous la
-forme $i$-$j$) de chaque case.
+
+La commande |\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).
\medskip
\begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
\begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
-\CodeBefore
- \ShowCellNames
-\Body
\Block{2-2}{} & & test \\
& & blabla \\
& some text & nothing
+~emphase#\CodeAfter \ShowCellNames@
\end{NiceTabular}
\end{BVerbatim}
\begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
-\CodeBefore
- \ShowCellNames
-\Body
\Block{2-2}{} & & test \\
& & blabla \\
& some text & nothing
+\CodeAfter \ShowCellNames
\end{NiceTabular}
@@ -3771,7 +3778,7 @@ charge par \pkg{nicematrix}.
\subsection{Colonne par défaut dans \{NiceMatrix\}}
-\label{key-R}
+\label{columns-type}
\colorbox{yellow!50}{\textbf{Nouveau 6.11}}\enskip Les environnements sans
préambule (|{NiceMatrix}|, |{pNiceMatrix}|, etc.) ainsi que la commande
@@ -4097,7 +4104,7 @@ lignes en pointillés entre les cases du tableau.
\smallskip
Néanmoins, on peut forcer la création d'un nœud avec la commande |\NotEmpty|.\footnote{Il faut toutefois remarquer qu'avec cette commande, la
case est considérée comme non vide, ce qui a des conséquences sur le tracé des
-lignes pointillées (cf.~p.~\pageref{Cdots}) et la déterminations des «coins»
+lignes pointillées (cf.~p.~\pageref{Cdots}) et la détermination des «coins»
(cf. p.~\pageref{corners}).}
\medskip
@@ -4210,7 +4217,7 @@ de la dernière ligne peuvent être désignés par |last|-$j$.
Quand l'extension \pkg{varwidth} est chargée, les colonnes de type |V| définies
par \pkg{varwidth} sont prises en charge par \pkg{nicematrix}. Il peut être
intéressant de préciser que, pour une cellule située dans une colonne de type
-|V|, le nœud PGF/Tikz créé par \pkg{nicematrix} pour le contenu de cette cellule
+|V|, le nœud PGF-Tikz créé par \pkg{nicematrix} pour le contenu de cette cellule
a une largeur ajustée au contenu de cette cellule. Cela est en contraste avec le
cas des colonnes de type |p|, |m| ou |b| dans lesquelles les nœuds ont toujours
une largeur égale à la largeur de la colonne. Dans l'exemple suivant, la
@@ -4606,7 +4613,7 @@ p.~\pageref{sub-matrix}.
\smallskip
Si une commande |\SubMatrix| est utilisée avec la clé |name| sous la forme
-|name=|\textsl{\ttfamily MonNom}, trois nœuds PGF/Tikz sont créés avec les noms
+|name=|\textsl{\ttfamily MonNom}, trois nœuds PGF-Tikz sont créés avec les noms
\textsl{\ttfamily MonNom}|-left|, \textsl{\ttfamily MonNom} et \textsl{\ttfamily
MonNom}|-right|.
@@ -4727,12 +4734,18 @@ Voici un exemple d'utilisation :
\medskip
\begin{BVerbatim}[baseline=c,boxwidth=9cm]
\begin{NiceTabular}{ccc}[hvlines]
+\CodeBefore
+ \arraycolor{gray!10}
+\Body
merlan & requin & cabillaud \\
baleine & ~emphase#\crossbox[red]@ & morue \\
mante & raie & poule
\end{NiceTabular}
\end{BVerbatim}
\begin{NiceTabular}{ccc}[hvlines]
+\CodeBefore
+ \arraycolor{gray!10}
+\Body
merlan & requin & cabillaud \\
baleine & \crossbox[red] & morue \\
mante & raie & poule
@@ -4833,8 +4846,7 @@ Une instruction comme |\Ldots|, |\Cdots|, etc. essaye de déterminer la premièr
case 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 (c'est-à-dire sans aucun token entre les deux
-esperluettes~|&|). Les règles précises sont les suivantes :
+sans contenu dans le codage TeX. Les règles précises sont les suivantes :
\begin{itemize}
\item Une case implicite est vide. Par exemple, dans la matrice suivante
@@ -4849,27 +4861,27 @@ c
la dernière case (deuxième rangée et deuxième colonne) est vide.
\medskip
-\item Chaque case avec un rendu par TeX de largeur nulle est vide.
+\item Pour les colonnes de type |p|, |m|, |b|, |V|\footnote{Les colonnes de type
+ |V| sont fournies par l'extension \pkg{varwidth}: cf.~p.~\pageref{varwidth}}
+ou |X|\footnote{Voir p.~\pageref{colonne-X}}, la case est vide si (et seulement
+si) son contenu dans le codage TeX est vide (il n'y a que des espaces entre les
+deux esperluettes |&|).
\medskip
-\item Une case qui contient la commande |\NotEmpty| est non vide (et un nœud
-PGF/Tikz est créé pour cette case).
+\item Pour les colonnes de typte |c|, |l|, |r| ou |w{...}{...}|, la case est
+vide si (et seulement si) son rendu TeX est de largeur nulle.
\medskip
-\item Une case avec une commande |\Hspace| (ou |\Hspace*|) est vide. Cette
-commande |\Hspace| est une commande définie par l'extension \pkg{nicematrix}
-avec la même signification que |\hspace| excepté que la case où cette commande
-est utilisée est considérée comme vide. Cette commande peut être utilisée pour
-fixer la largeur des colonnes sans interférer avec le tracé des lignes en
-pointillés par \pkg{nicematrix}.
+\item Une case qui contient la commande |\NotEmpty| est non vide (et un nœud
+PGF-Tikz est créé pour cette case).
\medskip
-\item Une case d'une colonne de type |p|, |m| ou |t| est toujours non vide
-(\emph{attention} : ne pas se fier à ce point car il est susceptible de
-changer). En revanche, une case d'une colonne de type |V| de \pkg{varwidth} (cf.
-p.~\pageref{varwidth}) est vide quand son contenu TeX est de largeur nulle.
-
-
+\item Une case avec seulement une commande |\Hspace| (ou |\Hspace*|) est vide.
+Cette commande |\Hspace| est une commande définie par l'extension
+\pkg{nicematrix} avec la même signification que |\hspace| excepté que la case où
+cette commande est utilisée est considérée comme vide. Cette commande peut être
+utilisée pour fixer la largeur des colonnes sans interférer avec le tracé des
+lignes en pointillés par \pkg{nicematrix}.
\end{itemize}
@@ -4905,7 +4917,7 @@ environnements de l'extension \pkg{nicematrix} ne sont pas affectés).
\medskip
L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess}
-(car cette classe n'est pas compatible avec PGF/Tikz).\footnote{Voir
+(car cette classe n'est pas compatible avec PGF-Tikz).\footnote{Voir
\url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}
\medskip
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
index 88d123b0692..cd44a1841fe 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index 1f39dbe880a..1884212f428 100644
--- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
+++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
@@ -1,5 +1,7 @@
% \iffalse meta-comment
%
+% This file should be compiled with $xelatex$.
+%
% Copyright (C) 2018-2022 by F. Pantigny
% -----------------------------------
%
@@ -15,8 +17,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.12}
-\def\myfiledate{2022/07/28}
+\def\myfileversion{6.13}
+\def\myfiledate{2022/08/24}
%
%
%<*batchfile>
@@ -827,7 +829,8 @@ version 2005/12/01 or later.
% \bigskip
% However, the vertical rules are not drawn in the blocks (created by |\Block|:
% cf.~p.~\pageref{Block}) nor in the corners (created by the key |corner|:
-% cf.~p.~\pageref{corners}).
+% cf.~p.~\pageref{corners}) nor in the potential exterior rows (created by the
+% keys |first-row| and |last-row|: cf.~p.~\pageref{exterior}).
%
% \bigskip
% If you use \pkg{booktabs} (which provides |\toprule|, |\midrule|,
@@ -974,7 +977,8 @@ version 2005/12/01 or later.
%
% \medskip
% \textbf{All these tools don't draw the rules in the blocks nor in the
-% empty corners (when the key |corners| is used).}
+% empty corners (when the key |corners| is used), nor in the exterior rows and
+% columns.}
% \begin{itemize}
% \item These blocks are:
% \begin{itemize}
@@ -985,12 +989,18 @@ version 2005/12/01 or later.
% \item the blocks implicitely delimited by the continuous dotted lines created
% by |\Cdots|, |\Vdots|, etc. (cf.~p.~\pageref{Cdots}).
% \end{itemize}
-% \item The corners are created by the key |corners| explained below (see p.~\pageref{corners}).
+% \item The corners are created by the key |corners| explained below (see
+% p.~\pageref{corners}).
+% \item For the exterior rows and columns, see~p.~\pageref{exterior}.
% \end{itemize}
%
% In particular, this remark explains the difference between the standard
% command |\hline| and the command |\Hline| provided by \pkg{nicematrix}.
%
+% \colorbox{yellow!50}{\textbf{New 6.13}}\enskip The key |\Hline| takes in an
+% optional argument (between square brackets) which is a list of
+% \textsl{key=value} pairs. For the description of those keys, see |custom-line|
+% on p.~\pageref{custom-line}.
%
% \subsubsection{The keys hlines and vlines}
%
@@ -1214,7 +1224,10 @@ version 2005/12/01 or later.
% \end{itemize}
%
% \bigskip
-% For the description of the rule itself, there is three possibilities.
+% We will now speak of the keys which describe the rule itself. Those keys may
+% also be used in the (optional) argument of an individual command |\Hline|.
+%
+% There is three possibilities.
%
% \begin{itemize}
% \item \emph{First possibility}\par\nobreak
@@ -1468,7 +1481,7 @@ version 2005/12/01 or later.
%
% New commands are available in that |\CodeBefore|: |\cellcolor|,
% |\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors|,
-% |\rowlistcolors|, |\chessboardcolors| and |arraycolor|.\footnote{Remark that,
+% |\rowlistcolors|, |\chessboardcolors| and |\arraycolor|.\footnote{Remark that,
% in the |\CodeBefore|, PGF/Tikz nodes of the form ``\verb+(i-|j)+'' are
% also available to indicate the position to the potential rules:
% cf.~p.~\pageref{nodes-i}.}
@@ -1490,31 +1503,30 @@ version 2005/12/01 or later.
%
% This command takes in as mandatory arguments a color and a list of cells, each
% of which with the format $i$-$j$ where $i$ is the number of the row and $j$ the
-% number of the colummn of the cell.
-%
+% number of the colummn of the cell. In fact, despite its name, this command may
+% be used to color a whole row (with the syntax $i$-) or a whole column (with the
+% syntax -$j$).
%
% \medskip
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{|c|c|c|}
+% \begin{NiceTabular}{ccc}[hvlines]
% \CodeBefore
-% ~emphase#\cellcolor[HTML]{FFFF88}{3-1,2-2,1-3}@
+% ~emphase#\cellcolor[HTML]{FFFF88}{3-1,2-2,-3}@
% \Body
-% \hline
-% a & b & c \\ \hline
-% e & f & g \\ \hline
-% h & i & j \\ \hline
+% a & b & c \\
+% e & f & g \\
+% h & i & j \\
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|c|c|c|}
+% \begin{NiceTabular}{ccc}[hvlines]
% \CodeBefore
-% \cellcolor[HTML]{FFFF88}{3-1,2-2,1-3}
+% \cellcolor[HTML]{FFFF88}{3-1,2-2,-3}
% \Body
-% \hline
-% a & b & c \\ \hline
-% e & f & g \\ \hline
-% h & i & j \\ \hline
+% a & b & c \\
+% e & f & g \\
+% h & i & j \\
% \end{NiceTabular}
% \end{scope}
%
@@ -1527,24 +1539,22 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{|c|c|c|}
+% \begin{NiceTabular}{ccc}[hvlines]
% \CodeBefore
% ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@
% \Body
-% \hline
-% a & b & c \\ \hline
-% e & f & g \\ \hline
-% h & i & j \\ \hline
+% a & b & c \\
+% e & f & g \\
+% h & i & j \\
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|c|c|c|}
+% \begin{NiceTabular}{ccc}[hvlines]
% \CodeBefore
% \rectanglecolor{blue!15}{2-2}{3-3}
% \Body
-% \hline
-% a & b & c \\ \hline
-% e & f & g \\ \hline
-% h & i & j \\ \hline
+% a & b & c \\
+% e & f & g \\
+% h & i & j \\
% \end{NiceTabular}
% \end{scope}
%
@@ -1584,7 +1594,7 @@ version 2005/12/01 or later.
%
% \medskip
% We have used the key |r| which aligns all the columns rightwards (cf.
-% p.~\pageref{key-R}).
+% p.~\pageref{columns-width}).
%
%
% \bigskip
@@ -1638,9 +1648,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \item The command |\rowcolors| (with a \emph{s}) takes its name from the
-% command |\rowcolors| of \pkg{xcolor}\footnote{The command |\rowcolors| of
-% \pkg{xcolor} is available when \pkg{xcolor} is loaded with the option~|table|.
-% That option also loads the package \pkg{colortbl}.}. The \emph{s} emphasizes
+% command |\rowcolors| of \pkg{colortbl}. The \emph{s} emphasizes
% the fact that there is \emph{two} colors. This command colors alternately the
% rows of the tabular with the tow colors (provided in second and third
% argument), beginning with the row whose number is given in first (mandatory)
@@ -2166,10 +2174,7 @@ version 2005/12/01 or later.
% are supported by \pkg{nicematrix}. Concerning \pkg{nicematrix}, one of the
% interests of this type of columns is that, for a cell of a column of type~|V|,
% the PGF/Tikz node created by \pkg{nicematrix} for the content of that cell has
-% a width adjusted to the content of the cell : cf. p.~\pageref{node-V}. If the
-% content of the cell is empty, the cell will be considered as empty by
-% \pkg{nicematrix} in the construction of the dotted lines and the «empty
-% corners» (that's not the case with a cell of a column |p|, |m| or |b|).
+% a width adjusted to the content of the cell : cf. p.~\pageref{node-V}.
%
% \medskip
% \begin{Verbatim}
@@ -2797,7 +2802,6 @@ version 2005/12/01 or later.
% special treatment: cf. p.~\pageref{exterior}.
%
% \bigskip
-% \colorbox{yellow!50}{\textbf{New 6.9}}\enskip
% \textbf{The option xdots/radius}\par\nobreak
%
% The option |radius| fixes the radius of the dots. The initial value is 0.53~pt.
@@ -2817,7 +2821,6 @@ version 2005/12/01 or later.
% versions, there was only |xdots/shorten|.
%
% \bigskip
-% \colorbox{yellow!50}{\textbf{New 6.9}}\enskip
% \textbf{The option xdots/inter}\par\nobreak
%
% \smallskip
@@ -2926,9 +2929,10 @@ version 2005/12/01 or later.
% 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). The keys
-% accepted in that optional ragument form a subset of the keys of the command
-% |\WithArrowsOptions|.
+% 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 and |sub-matrix| (linked to the
+% command |\SubMatrix|) and its sub-keys.}
%
%
% \medskip
@@ -3298,8 +3302,9 @@ version 2005/12/01 or later.
%
% \smallskip
% With the key |caption|, the caption, when it is long, is wrapped at the width
-% of the tabular (without the use of the package \pkg{threeparttable} or the
-% package \pkg{floatrow}).
+% of the tabular (excepted the potential exterior columns specified by
+% |first-col| and |last-col|), without the use of the package
+% \pkg{threeparttable} or the package \pkg{floatrow}.
%
% \smallskip
% By default, the caption is composed below the tabular. With the key
@@ -3348,8 +3353,8 @@ version 2005/12/01 or later.
% 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 (excepted the
% potential exterior columns specified by |first-col| and |last-col|). With no
-% surprise, that command is available only in the environments without
-% delimiters, that is to say |{NiceTabular}|, |{NiceArray}| and |{NiceMatrix}|.
+% 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} has
% been loaded (before or after \pkg{nicematrix}). Indeed, the notes are composed
@@ -3408,6 +3413,11 @@ version 2005/12/01 or later.
% \item There is a key |tabularnote| which provides a way to insert some text in
% the zone of the notes before the numbered tabular notes.
%
+% \colorbox{yellow!50}{\textbf{New 6.13}}\enskip An alternative syntaxe is
+% available with the environment |{TabularNote}|. That environment should be
+% used at the end of the environment |{NiceTabular}| (but \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.
@@ -3667,27 +3677,25 @@ version 2005/12/01 or later.
%
% \subsection{Command \textbackslash ShowCellNames}
%
-% \colorbox{yellow!50}{\textbf{New 6.9}} The command |\ShowCellNames|,
-% which may be used in the |\CodeBefore| and in the |\CodeAfter| display the name (with the
-% form $i$-$j$) of each cell.
+% The command |\ShowCellNames|, which may be used in the |\CodeBefore| and in
+% the |\CodeAfter| display 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).
%
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
% \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
-% \CodeBefore
-% \ShowCellNames
-% \Body
% \Block{2-2}{} & & test \\
% & & blabla \\
% & some text & nothing
+% ~emphase#\CodeAfter \ShowCellNames@
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
-% \CodeBefore
-% \ShowCellNames
-% \Body
% \Block{2-2}{} & & test \\
% & & blabla \\
% & some text & nothing
+% \CodeAfter \ShowCellNames
% \end{NiceTabular}
%
%
@@ -3700,8 +3708,8 @@ version 2005/12/01 or later.
%
%
% \medskip
-% \begin{BVerbatim}[baseline = c, boxwidth = 10.5cm]
-% $\begin{pNiceArray}{~emphase#S@cWc{1cm}c}[nullify-dots,first-row]
+% \begin{BVerbatim}[baseline = c, boxwidth = 11cm]
+% $\begin{pNiceArray}{~emphase#S@cW{c}{1cm}c}[nullify-dots,first-row]
% {C_1} & \Cdots & & C_n \\
% 2.3 & 0 & \Cdots & 0 \\
% 12.4 & \Vdots & & \Vdots \\
@@ -3709,7 +3717,7 @@ version 2005/12/01 or later.
% 7.2 & 0 & \Cdots & 0
% \end{pNiceArray}$
% \end{BVerbatim}
-% $\begin{pNiceArray}{ScWc{1cm}c}[nullify-dots,first-row]
+% $\begin{pNiceArray}{ScW{c}{1cm}c}[nullify-dots,first-row]
% {C_1} & \Cdots & & C_n \\
% 2.3 & 0 & \Cdots & 0 \\
% 12.4 & \Vdots & & \Vdots \\
@@ -3724,7 +3732,7 @@ version 2005/12/01 or later.
%
% \subsection{Default column type in \{NiceMatrix\}}
%
-% \label{key-R}
+% \label{columns-width}
%
% \colorbox{yellow!50}{\textbf{New 6.11}}\enskip The environments without
% preamble (|{NiceMatrix}|, |{pNiceMatrix}|, |{bNiceMatrix}|, etc.) and the
@@ -3748,7 +3756,7 @@ version 2005/12/01 or later.
% \end{bNiceMatrix}$
%
% \medskip
-% The key |columnts-type| is available in |\NiceMatrixOptions| but with the
+% The key |columns-type| is available in |\NiceMatrixOptions| but with the
% prefix |matrix|, which means that its name is, within |\NiceMatrixOptions| :
% |matrix/columns-type|.
%
@@ -4662,12 +4670,18 @@ version 2005/12/01 or later.
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% \begin{NiceTabular}{ccc}[hvlines]
+% \CodeBefore
+% \arraycolor{gray!10}
+% \Body
% merlan & requin & cabillaud \\
% baleine & ~emphase#\crossbox[red]@ & morue \\
% mante & raie & poule
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{NiceTabular}{ccc}[hvlines]
+% \CodeBefore
+% \arraycolor{gray!10}
+% \Body
% merlan & requin & cabillaud \\
% baleine & \crossbox[red] & morue \\
% mante & raie & poule
@@ -4777,26 +4791,27 @@ version 2005/12/01 or later.
% the last cell (second row and second column) is empty.
%
% \medskip
-% \item Each cell whose TeX ouput has a width equal to zero is empty.
+% \item For the columns of type |p|, |m|, |b|, |V|\footnote{The columns of type
+% |V| are provided by \pkg{varwidth}: cf.~p.~\pageref{varwidth}.} and
+% |X|\footnote{See p.~\pageref{X-columns}}, the cell is empty if (and only if)
+% its content in the TeX code is empty (there is only spaces between the
+% ampersands |&|).
%
% \medskip
-% \item A cell containing the command |\NotEmpty| is not empty (and a PGF/Tikz
-% node) is created in that cell.
+% \item For the columns of type |c|, |l|, |r| and |w{...}{...}|, the cell is
+% empty if (and only if) its TeX output has a width equal to zero.
%
% \medskip
-% \item A cell with a command |\Hspace| (or |\Hspace*|) is empty. This command
-% |\Hspace| is a command defined by the package \pkg{nicematrix} with the same
-% meaning as |\hspace| except that the cell where it is used is considered as
-% empty. This command can be used to fix the width of some columns of the matrix
-% without interfering with \pkg{nicematrix}.
+% \item A cell containing the command |\NotEmpty| is not empty (and a PGF/Tikz
+% node is created in that cell).
%
% \medskip
-% \item A cell of a column of type |p|, |m| or |t| is always considered as not
-% empty. \emph{Caution} : One should not rely upon that point because it may
-% change in a future version of \pkg{nicematrix}. On the other side, a cell of a
-% column of type |V| of \pkg{varwidth} (cf.~p.~\pageref{varwidth}) is empty when
-% its TeX content has a width equal to zero.
-% % \end{itemize}
+% \item A cell with only a command |\Hspace| (or |\Hspace*|) is empty. This
+% command |\Hspace| is a command defined by the package \pkg{nicematrix} with
+% the same meaning as |\hspace| except that the cell where it is used is
+% considered as empty. This command can be used to fix the width of some columns
+% of the matrix without interfering with \pkg{nicematrix}.
+% \end{itemize}
%
%
% \subsection{The option exterior-arraycolsep}
@@ -5843,8 +5858,11 @@ version 2005/12/01 or later.
% |\c_sys_jobname_str| because, with Overleaf, the value of |\c_sys_jobname_str|
% is always ``|output|''.
% \begin{macrocode}
-\str_if_eq:VnT \c_sys_jobname_str { output }
- { \bool_set_true:N \c_@@_messages_for_Overleaf_bool }
+\bool_set:Nn \c_@@_messages_for_Overleaf_bool
+ {
+ \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs
+ || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf
+ }
% \end{macrocode}
%
% \bigskip
@@ -5881,6 +5899,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
\cs_generate_variant:Nn \keys_define:nn { n x }
+\cs_generate_variant:Nn \str_lowercase:n { V }
% \end{macrocode}
%
% \medskip
@@ -6265,8 +6284,15 @@ version 2005/12/01 or later.
% \end{macrocode}
% |\@temptokena| is a toks (not supported by the L3 programming layer).
% \begin{macrocode}
- \@temptokena \exp_after:wN
- { \tex_the:D \@temptokena \@@_S: [ ##1 ] }
+ \tl_if_empty:nTF { ##1 }
+ {
+ \@temptokena \exp_after:wN
+ { \tex_the:D \@temptokena \@@_S: }
+ }
+ {
+ \@temptokena \exp_after:wN
+ { \tex_the:D \@temptokena \@@_S: [ ##1 ] }
+ }
\NC@find
}
}
@@ -6274,7 +6300,19 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_rescan_for_spanish:N #1
+ {
+ \tl_set_rescan:Nno
+ #1
+ {
+ \char_set_catcode_other:N >
+ \char_set_catcode_other:N <
+ }
+ #1
+ }
+% \end{macrocode}
%
% \bigskip
% \subsection*{Parameters}
@@ -6441,8 +6479,8 @@ version 2005/12/01 or later.
% |[cccc]|), this boolean will be set to false.
%
% \bigskip
-% If the user uses |{NiceTabular}| or |{NiceTabular*}|, we will raise the
-% following flag.
+% If the user uses |{NiceTabular}|, |{NiceTabular*}| or |{NiceTabularX}|, we
+% will raise the following flag.
% \begin{macrocode}
\bool_new:N \l_@@_NiceTabular_bool
% \end{macrocode}
@@ -6577,6 +6615,7 @@ version 2005/12/01 or later.
% That parameter is \emph{public}.
% \begin{macrocode}
\tl_new:N \g_nicematrix_code_after_tl
+\bool_new:N \l_@@_in_code_after_bool
% \end{macrocode}
%
% \bigskip
@@ -6590,10 +6629,16 @@ version 2005/12/01 or later.
% The following token list has a function similar to
% |\g_nicematrix_code_after_tl| but it is used internally by \pkg{nicematrix}.
% In fact, we have to distinguish between |\g_nicematrix_code_after_tl| and
-% |\g_@@_internal_code_after_tl| because we must take care of the order in which
+% |\g_@@_pre_code_after_tl| because we must take care of the order in which
% instructions stored in that parameters are executed.
% \begin{macrocode}
-\tl_new:N \g_@@_internal_code_after_tl
+\tl_new:N \g_@@_pre_code_after_tl
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+\tl_new:N \g_nicematrix_code_before_tl
+\tl_new:N \g_@@_pre_code_before_tl
% \end{macrocode}
%
% \bigskip
@@ -6609,8 +6654,8 @@ version 2005/12/01 or later.
%
% \bigskip
% The following sequence will contain the names (without backslash) of the
-% commands created by |custom-line| (commands used by the final user in order to
-% draw horizontal rules).
+% commands created by |custom-line| by the key |command| or |ccommand| (commands
+% used by the final user in order to draw horizontal rules).
% \begin{macrocode}
\seq_new:N \l_@@_custom_line_commands_seq
% \end{macrocode}
@@ -6624,8 +6669,8 @@ version 2005/12/01 or later.
%
% \bigskip
% The sum of the weights of all the |X|-columns in the preamble. The weight of a
-% |X|-column is given as optional argument between square brackets. The default
-% value, of course, is $1$.
+% |X|-column is given as an optional argument between square brackets. The
+% default value, of course, is $1$.
% \begin{macrocode}
\int_new:N \g_@@_total_X_weight_int
% \end{macrocode}
@@ -6686,6 +6731,7 @@ version 2005/12/01 or later.
\bool_new:N \l_@@_code_before_bool
% \end{macrocode}
%
+%
% \bigskip
% The following token list will contain the code inserted in each cell of the
% current row (this token list will be cleared at the beginning of each row).
@@ -7070,7 +7116,7 @@ version 2005/12/01 or later.
{ \clist_put_right:Nn \l_tmpa_clist { ####1 } }
}
\tl_set_eq:NN #1 \l_tmpa_clist
- }
+ }
}
% \end{macrocode}
%
@@ -7129,7 +7175,7 @@ version 2005/12/01 or later.
% specified by the key |tabularnote| of the environment. The token list
% |\l_@@_tabularnote_tl| corresponds to the value of that key.
% \begin{macrocode}
-\tl_new:N \l_@@_tabularnote_tl
+\tl_new:N \g_@@_tabularnote_tl
% \end{macrocode}
%
% \bigskip
@@ -7231,7 +7277,7 @@ version 2005/12/01 or later.
{
\bool_if:nT { \cs_if_exist_p:N \@captype || \l_@@_in_env_bool }
{
- \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool }
+ \bool_if:nTF { ! \l_@@_NiceTabular_bool && \l_@@_in_env_bool }
{ \@@_error:n { tabularnote~forbidden } }
{
\bool_if:NTF \l_@@_in_caption_bool
@@ -7786,8 +7832,6 @@ version 2005/12/01 or later.
\keys_define:nn { NiceMatrix / Global }
{
custom-line .code:n = \@@_custom_line:n { #1 } ,
- delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
- delimiters .value_required:n = true ,
rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } ,
rules .value_required:n = true ,
standard-cline .bool_set:N = \l_@@_standard_cline_bool ,
@@ -7881,13 +7925,14 @@ version 2005/12/01 or later.
corners .clist_set:N = \l_@@_corners_clist ,
corners .default:n = { NW , SW , NE , SE } ,
code-before .code:n =
- {
- \tl_if_empty:nF { #1 }
- {
- \tl_put_right:Nn \l_@@_code_before_tl { #1 }
- \bool_set_true:N \l_@@_code_before_bool
- }
- } ,
+ {
+ \tl_if_empty:nF { #1 }
+ {
+ \tl_gput_left:Nn \g_@@_pre_code_before_tl { #1 }
+ \bool_set_true:N \l_@@_code_before_bool
+ }
+ } ,
+ code-before .value_required:n = true ,
% \end{macrocode}
% \bigskip
% The options |c|, |t| and |b| of the environment |{NiceArray}| have the same
@@ -7991,10 +8036,10 @@ version 2005/12/01 or later.
NiceMatrixOptions / xdots .inherit:n = NiceMatrix / xdots ,
NiceMatrixOptions / rules .inherit:n = NiceMatrix / rules ,
NiceMatrixOptions / notes .inherit:n = NiceMatrix / notes ,
- NiceMatrixOptions / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceMatrixOptions / sub-matrix .inherit:n = NiceMatrix / sub-matrix ,
SubMatrix / rules .inherit:n = NiceMatrix / rules ,
CodeAfter / xdots .inherit:n = NiceMatrix / xdots ,
+ CodeBefore / sub-matrix .inherit:n = NiceMatrix / sub-matrix ,
NiceMatrix .inherit:n =
{
NiceMatrix / Global ,
@@ -8002,7 +8047,6 @@ version 2005/12/01 or later.
} ,
NiceMatrix / xdots .inherit:n = NiceMatrix / xdots ,
NiceMatrix / rules .inherit:n = NiceMatrix / rules ,
- NiceMatrix / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceTabular .inherit:n =
{
NiceMatrix / Global ,
@@ -8010,7 +8054,7 @@ version 2005/12/01 or later.
} ,
NiceTabular / xdots .inherit:n = NiceMatrix / xdots ,
NiceTabular / rules .inherit:n = NiceMatrix / rules ,
- NiceTabular / delimiters .inherit:n = NiceMatrix / delimiters ,
+ NiceTabular / notes .inherit:n = NiceMatrix / notes ,
NiceArray .inherit:n =
{
NiceMatrix / Global ,
@@ -8018,7 +8062,6 @@ version 2005/12/01 or later.
} ,
NiceArray / xdots .inherit:n = NiceMatrix / xdots ,
NiceArray / rules .inherit:n = NiceMatrix / rules ,
- NiceArray / delimiters .inherit:n = NiceMatrix / delimiters ,
pNiceArray .inherit:n =
{
NiceMatrix / Global ,
@@ -8026,7 +8069,6 @@ version 2005/12/01 or later.
} ,
pNiceArray / xdots .inherit:n = NiceMatrix / xdots ,
pNiceArray / rules .inherit:n = NiceMatrix / rules ,
- pNiceArray / delimiters .inherit:n = NiceMatrix / delimiters ,
}
% \end{macrocode}
%
@@ -8038,6 +8080,12 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrixOptions }
{
+ delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
width .code:n = \dim_set:Nn \l_@@_width_dim { #1 } ,
width .value_required:n = true ,
last-col .code:n =
@@ -8110,8 +8158,9 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% We finalise the definition of the set of keys
-% ``|NiceMatrix / NiceMatrix|'' with the options specific to |{NiceMatrix}|.
+% We finalise the definition of the set of keys ``|NiceMatrix / NiceMatrix|''.
+% That set of keys will be used by |{NiceMatrix}|, |{pNiceMatrix}|,
+% |{bNiceMatrix}|, etc.
%
% \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrix }
@@ -8126,6 +8175,12 @@ version 2005/12/01 or later.
columns-type .value_required:n = true ,
l .meta:n = { columns-type = l } ,
r .meta:n = { columns-type = r } ,
+ delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
small .bool_set:N = \l_@@_small_bool ,
small .value_forbidden:n = true ,
unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrix }
@@ -8152,12 +8207,6 @@ version 2005/12/01 or later.
last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
- notes / para .bool_set:N = \l_@@_notes_para_bool ,
- notes / para .default:n = true ,
- notes / bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool ,
- notes / bottomrule .default:n = true ,
- tabularnote .tl_set:N = \l_@@_tabularnote_tl ,
- tabularnote .value_required:n = true ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
l .code:n = \@@_error:n { r~or~l~with~preamble } ,
unknown .code:n = \@@_error:n { Unknown~key~for~NiceArray }
@@ -8174,6 +8223,12 @@ version 2005/12/01 or later.
{ \@@_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 ,
+ delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
small .bool_set:N = \l_@@_small_bool ,
small .value_forbidden:n = true ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
@@ -8196,11 +8251,8 @@ version 2005/12/01 or later.
width .code:n = \dim_set:Nn \l_@@_width_dim { #1 }
\bool_set_true:N \l_@@_width_used_bool ,
width .value_required:n = true ,
- notes / para .bool_set:N = \l_@@_notes_para_bool ,
- notes / para .default:n = true ,
- notes / bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool ,
- notes / bottomrule .default:n = true ,
- tabularnote .tl_set:N = \l_@@_tabularnote_tl ,
+ notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } ,
+ tabularnote .tl_gset:N = \g_@@_tabularnote_tl ,
tabularnote .value_required:n = true ,
caption .tl_set:N = \l_@@_caption_tl ,
caption .value_required:n = true ,
@@ -8444,10 +8496,13 @@ version 2005/12/01 or later.
% However, it's very difficult to determine whether a cell is empty. Up to now
% we use the following technic:
% \begin{itemize}
+% \item for the columns of type |p|, |m|, |b|, |V| (of \pkg{varwidth}) or |X|,
+% we test whether the cell is syntacticly empty with |\@@_test_if_empty:| and
+% |\@@_test_if_empty_for_S:|
% \item if the width of the box |\l_@@_cell_box| (created with the content of
% the cell) is equal to zero, we consider the cell as empty (however,
-% this is not perfect since the user may have used a |\rlap|, a |\llap| or a
-% |\mathclap| of \pkg{mathtools}.
+% this is not perfect since the user may have used a |\rlap|, |\llap|, |\clap|
+% or a |\mathclap| of \pkg{mathtools}).
% \item the cells with a command |\Ldots| or |\Cdots|, |\Vdots|, etc.,
% should also be considered as empty; if |nullify-dots| is in force, there would
% be nothing to do (in this case the previous commands only write an instruction
@@ -8790,7 +8845,7 @@ version 2005/12/01 or later.
% For unexplained reason, with XeTeX (and not with the other engines), the
% environments of \pkg{nicematrix} were all composed in black and do not take
% into account the color of the encompassing text. As a workaround, you peek the
-% color in force at the beginning of the environment and we will it in each cell.
+% color in force at the beginning of the environment and we will use it in each cell.
% \begin{macrocode}
\xglobal \colorlet { nicematrix } { . }
% \end{macrocode}
@@ -9019,7 +9074,8 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{macrocode}
- \tl_gclear_new:N \g_nicematrix_code_before_tl
+ \tl_gclear:N \g_nicematrix_code_before_tl
+ \tl_gclear:N \g_@@_pre_code_before_tl
}
% \end{macrocode}
% This is the end of |\@@_pre_array_ii:|.
@@ -9112,8 +9168,10 @@ version 2005/12/01 or later.
% or, maybe, errors). That's why the command |\@@_create_row_node:| will use the
% following counter to avoid such construction.
% \begin{macrocode}
- \int_gset:Nn \g_@@_last_row_node_int { -1 }
+ \int_gset:Nn \g_@@_last_row_node_int { -2 }
% \end{macrocode}
+% The value $-2$ is important.
+%
%
% \interitem
% The code in |\@@_pre_array_ii:| is used only here.
@@ -9176,7 +9234,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_CodeBefore_Body:w #1 \Body
{
- \tl_put_right:Nn \l_@@_code_before_tl { #1 }
+ \tl_gput_left:Nn \g_@@_pre_code_before_tl { #1 }
\bool_set_true:N \l_@@_code_before_bool
% \end{macrocode}
% We go on with |\@@_pre_array:| which will (among other) execute the
@@ -9296,21 +9354,37 @@ version 2005/12/01 or later.
\bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
% \end{macrocode}
%
+% \bigskip
+% The following code is a security for the case the user has used \pkg{babel}
+% with the option \pkg{spanish}: in that case, the characters |<| (de code
+% \textsc{ascci} 60) and |>| are 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_@@_pre_code_before_tl
+ \@@_rescan_for_spanish:N \l_@@_code_before_tl
+ }
+% \end{macrocode}
+%
% Here is the |\CodeBefore|. The construction is a bit complicated because
-% |\l_@@_code_before_tl| may begin with keys between square brackets. Moreover,
+% |\g_@@_pre_code_before_tl| may begin with keys between square brackets. Moreover,
% after the analyze of those keys, we sometimes have to decide to do \emph{not}
-% execute the rest of |\l_@@_code_before_tl| (when it is asked for the creation
-% of cell nodes in the |\CodeBefore|). That's why we begin with a |\q_stop|: it
-% will be used to discard the rest of |\l_@@_code_before_tl|.
+% execute the rest of |\g_@@_pre_code_before_tl| (when it is asked for the creation
+% 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: \l_@@_code_before_tl \q_stop
+ \exp_last_unbraced:NV \@@_CodeBefore_keys:
+ \g_@@_pre_code_before_tl
% \end{macrocode}
% Now, all the cells which are specified to be colored by instructions in the
% |\CodeBefore| will actually be colored. It's a two-stages mechanism because we
% want to draw all the cells with the same color at the same time to absolutely
% avoid thin white lines in some \textsc{pdf} viewers.
% \begin{macrocode}
- \@@_actually_color:
+ \@@_actually_color:
+ \l_@@_code_before_tl
+ \q_stop
\bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
\group_end:
\bool_if:NT \g_@@_recreate_cell_nodes_bool
@@ -9328,7 +9402,7 @@ version 2005/12/01 or later.
sub-matrix .value_required:n = true ,
delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
- unknown .code:n = \@@_error:n { Unknown~key~for~CodeAfter }
+ unknown .code:n = \@@_error:n { Unknown~key~for~CodeBefore }
}
% \end{macrocode}
%
@@ -9470,6 +9544,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
% \bigskip
% \subsection*{The environment \{NiceArrayWithDelims\}}
%
@@ -9523,7 +9598,7 @@ version 2005/12/01 or later.
% the beginning of arrays done by \pkg{colortbl}. Of course, we restore the
% value of |\CT@arc@| at the end of our environment.
% \begin{macrocode}
- \cs_gset_eq:NN \@@_old_CT@arc@ \CT@arc@
+ \cs_gset_eq:NN \@@_old_CT@arc@ \CT@arc@
% \end{macrocode}
%
% We deactivate Tikz externalization because we will use \textsc{pgf} pictures
@@ -9580,7 +9655,7 @@ version 2005/12/01 or later.
% Now, we prepare the token list for the instructions that we will have to write
% on the |aux| file at the end of the environment.
% \begin{macrocode}
- \tl_gclear:N \g_@@_aux_tl
+ \tl_gclear:N \g_@@_aux_tl
% \end{macrocode}
%
% \begin{macrocode}
@@ -9589,6 +9664,8 @@ version 2005/12/01 or later.
\bool_set_true:N \l_@@_code_before_bool
\tl_put_right:NV \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 }
% \end{macrocode}
%
% The set of keys is not exactly the same for |{NiceArray}| and for the variants
@@ -9895,7 +9972,7 @@ version 2005/12/01 or later.
% \end{macrocode}
% First, we will do an ``expansion'' of the preamble with the tools of the
% package \pkg{array} itself. This ``expansion'' will expand all the constructions
-% with |*| and with all column types (defined by the user or by various packages
+% with |*| and all column types (defined by the user or by various packages
% using |\newcolumntype|).
%
% Since we use the tools of \pkg{array} to do this expansion, we will have a
@@ -9981,6 +10058,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\seq_clear:N \g_@@_cols_vlism_seq
% \end{macrocode}
+%
+% \bigskip
+% The following sequence will store the arguments of the successive |>| in the
+% preamble.
+% \begin{macrocode}
+ \tl_gclear_new:N \g_@@_pre_cell_tl
+% \end{macrocode}
+%
% The counter |\l_tmpa_int| will count the number of consecutive occurrences
% of the symbol \verb+|+.
% \begin{macrocode}
@@ -10080,7 +10165,7 @@ version 2005/12/01 or later.
c { \@@_patch_preamble_i:n #1 }
l { \@@_patch_preamble_i:n #1 }
r { \@@_patch_preamble_i:n #1 }
- > { \@@_patch_preamble_ii:nn #1 }
+ > { \@@_patch_preamble_xiv:n }
! { \@@_patch_preamble_ii:nn #1 }
@ { \@@_patch_preamble_ii:nn #1 }
| { \@@_patch_preamble_iii:n #1 }
@@ -10089,8 +10174,8 @@ version 2005/12/01 or later.
m { \@@_patch_preamble_iv:n #1 }
\@@_V: { \@@_patch_preamble_v:n }
V { \@@_patch_preamble_v:n }
- \@@_w: { \@@_patch_preamble_vi:nnnn { } #1 }
- \@@_W: { \@@_patch_preamble_vi:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
+ \@@_w: { \@@_patch_preamble_vi:nnnn { } #1 }
+ \@@_W: { \@@_patch_preamble_vi:nnnn { \@@_special_W: } #1 }
\@@_S: { \@@_patch_preamble_vii:n }
( { \@@_patch_preamble_viii:nn #1 }
[ { \@@_patch_preamble_viii:nn #1 }
@@ -10149,6 +10234,8 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_i:n #1
{
+ \tl_gput_right:NV \g_@@_preamble_tl \g_@@_pre_cell_tl
+ \tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_preamble_tl
{
> { \@@_cell_begin:w \str_set:Nn \l_@@_hpos_cell_str { #1 } }
@@ -10194,29 +10281,25 @@ version 2005/12/01 or later.
\str_if_eq:nnTF { #1 } |
{ \@@_patch_preamble_iii:n | }
{
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \arrayrulewidth * \l_tmpa_int
+ + \doublerulesep * ( \l_tmpa_int - 1)
+ }
\tl_gput_right:Nx \g_@@_preamble_tl
{
- \exp_not:N !
- {
- \skip_horizontal:n
- {
% \end{macrocode}
% Here, the command |\dim_eval:n| is mandatory.
% \begin{macrocode}
- \dim_eval:n
- {
- \arrayrulewidth * \l_tmpa_int
- + \doublerulesep * ( \l_tmpa_int - 1)
- }
- }
- }
+ \exp_not:N ! { \skip_horizontal:n { \dim_eval:n { \l_tmpa_dim } } }
}
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_vline:n
{
position = \int_eval:n { \c@jCol + 1 } ,
multiplicity = \int_use:N \l_tmpa_int ,
+ total-width = \dim_use:N \l_tmpa_dim % added 2022-08-06
}
% \end{macrocode}
% We don't have provided value for |start| nor for |end|, which means that the
@@ -10230,16 +10313,23 @@ version 2005/12/01 or later.
}
}
% \end{macrocode}
-%
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_preamble_xiv:n #1
+ {
+ \tl_gput_right:Nn \g_@@_pre_cell_tl { > { #1 } }
+ \@@_patch_preamble:n
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\bool_new:N \l_@@_bar_at_end_of_pream_bool
% \end{macrocode}
%
-% \bigskip
-% The specifier |p| (and also the specifiers |m| and |b|) have an optional
-% argument between square brackets for a list of \emph{key}-\emph{value} pairs.
-% Here are the corresponding keys. This set of keys will also be used by the |X|
-% columns.
+% \bigskip
+% The specifier |p| (and also the specifiers |m|, |b|, |V| and |X|) have an
+% optional argument between square brackets for a list of
+% \emph{key}-\emph{value} pairs. Here are the corresponding keys.
% \begin{macrocode}
\keys_define:nn { WithArrows / p-column }
{
@@ -10249,8 +10339,32 @@ version 2005/12/01 or later.
c .value_forbidden:n = true ,
l .code:n = \str_set:Nn \l_@@_hpos_col_str { l } ,
l .value_forbidden:n = true ,
- si .code:n = \str_set:Nn \l_@@_hpos_col_str { si } ,
- si .value_forbidden:n = true ,
+ R .code:n =
+ \IfPackageLoadedTF { ragged2e }
+ { \str_set:Nn \l_@@_hpos_col_str { R } }
+ {
+ \@@_error_or_warning:n { ragged2e~not~loaded }
+ \str_set:Nn \l_@@_hpos_col_str { r }
+ } ,
+ R .value_forbidden:n = true ,
+ L .code:n =
+ \IfPackageLoadedTF { ragged2e }
+ { \str_set:Nn \l_@@_hpos_col_str { L } }
+ {
+ \@@_error_or_warning:n { ragged2e~not~loaded }
+ \str_set:Nn \l_@@_hpos_col_str { l }
+ } ,
+ L .value_forbidden:n = true ,
+ C .code:n =
+ \IfPackageLoadedTF { ragged2e }
+ { \str_set:Nn \l_@@_hpos_col_str { C } }
+ {
+ \@@_error_or_warning:n { ragged2e~not~loaded }
+ \str_set:Nn \l_@@_hpos_col_str { c }
+ } ,
+ C .value_forbidden:n = true ,
+ 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 ,
t .meta:n = p ,
@@ -10300,14 +10414,22 @@ version 2005/12/01 or later.
{
% \end{macrocode}
% The possible values of |\l_@@_hpos_col_str| are |j| (for \emph{justified} which is
-% the initial value), |l|, |c| and |r| (when the user has used the corresponding
-% key in the optional argument of the specifier).
+% the initial value), |l|, |c|, |r|, |L|, |C| and |R| (when the user has used
+% the corresponding key in the optional argument of the specifier).
% \begin{macrocode}
\str_set:Nn \l_@@_hpos_col_str { j }
- \keys_set:nn { WithArrows / p-column } { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_replace_all:Nnn \l_tmpa_tl { \@@_S: } { S }
+ \@@_keys_p_column:V \l_tmpa_tl
\@@_patch_preamble_iv_iv:nn { #2 } { minipage }
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_keys_p_column:n #1
+ { \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl }
+\cs_generate_variant:Nn \@@_keys_p_column:n { V }
+% \end{macrocode}
%
% \medskip
% The first argument is the width of the column. The second is the type of
@@ -10331,13 +10453,16 @@ version 2005/12/01 or later.
{ \str_set:Nn \exp_not:N \l_@@_hpos_cell_str { c } }
{
\str_set:Nn \exp_not:N \l_@@_hpos_cell_str
- { \l_@@_hpos_col_str }
+ { \str_lowercase:V \l_@@_hpos_col_str }
}
\str_case:Vn \l_@@_hpos_col_str
{
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_if_eq:VnT \l_@@_vpos_col_str { m } \@@_center_cell_box: }
@@ -10350,7 +10475,10 @@ version 2005/12/01 or later.
{ j } { c }
{ si } { c }
}
- { \l_@@_hpos_col_str }
+% \end{macrocode}
+% We use |\str_lowercase:n| to convert |R| to |r|, etc.
+% \begin{macrocode}
+ { \str_lowercase:V \l_@@_hpos_col_str }
}
}
% \end{macrocode}
@@ -10384,11 +10512,16 @@ version 2005/12/01 or later.
%
% |#7| is the type of environment: |minipage| or |varwidth|.
%
-% |#8| is the lettre |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 specificier of column
% which is used \emph{in fine}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_iv_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
+ \str_if_eq:VnTF \l_@@_hpos_col_str { si }
+ { \tl_gput_right:Nn \g_@@_preamble_tl { > { \@@_test_if_empty_for_S: } } }
+ { \tl_gput_right:Nn \g_@@_preamble_tl { > { \@@_test_if_empty: } } }
+ \tl_gput_right:NV \g_@@_preamble_tl \g_@@_pre_cell_tl
+ \tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_preamble_tl
{
> {
@@ -10410,7 +10543,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
% Now, the potential code for the horizontal position of the content of the cell
-% (|\centering|, |\raggedright|, |\raggedleft| or nothing).
+% (|\centering|, |\raggedright|, |\RaggedRight|, etc.).
% \begin{macrocode}
#3
% \end{macrocode}
@@ -10441,6 +10574,33 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_test_if_empty: \ignorespaces #1
+ {
+ \peek_meaning:NT \unskip
+ {
+ \tl_gput_right:Nn \g_@@_cell_after_hook_tl
+ { \box_set_wd:Nn \l_@@_cell_box \c_zero_dim }
+ }
+ #1
+ }
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_test_if_empty_for_S: #1
+ {
+ \peek_meaning:NT \__siunitx_table_skip:n
+ {
+ \tl_gput_right:Nn \g_@@_cell_after_hook_tl
+ { \box_set_wd:Nn \l_@@_cell_box \c_zero_dim }
+ }
+ #1
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
% The following command will be used in |m|-columns in order to center
% vertically the box. In fact, despite its name, the command does not always
% center the cell. Indeed, if there is only one row in the cell, it should not
@@ -10490,7 +10650,9 @@ version 2005/12/01 or later.
{
\str_set:Nn \l_@@_vpos_col_str { p }
\str_set:Nn \l_@@_hpos_col_str { j }
- \keys_set:nn { WithArrows / p-column } { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_replace_all:Nnn \l_tmpa_tl { \@@_S: } { S }
+ \@@_keys_p_column:V \l_tmpa_tl
\bool_if:NTF \c_@@_varwidth_loaded_bool
{ \@@_patch_preamble_iv_iv:nn { #2 } { varwidth } }
{
@@ -10505,6 +10667,8 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_vi:nnnn #1 #2 #3 #4
{
+ \tl_gput_right:NV \g_@@_preamble_tl \g_@@_pre_cell_tl
+ \tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_preamble_tl
{
> {
@@ -10521,9 +10685,9 @@ version 2005/12/01 or later.
c
< {
\@@_cell_end:
- #1
\hbox_set_end:
\bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
+ #1
\@@_adjust_size_box:
\makebox [ #4 ] [ #3 ] { \box_use_drop:N \l_@@_cell_box }
}
@@ -10535,7 +10699,19 @@ version 2005/12/01 or later.
\@@_patch_preamble_xi:n
}
% \end{macrocode}
-%
+%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_special_W:
+ {
+ \dim_compare:nNnT
+ { \box_wd:N \l_@@_cell_box }
+ >
+ \l_@@_col_width_dim
+ { \@@_warning:n { W~warning } }
+ }
+% \end{macrocode}
+%
% \medskip
% For |\@@_S:|. If the user has used |S[...]|, |S| has been replaced by |\@@_S:|
% during the first expansion of the preamble (done with the tools of standard
@@ -10564,6 +10740,8 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_if_exist:NTF \siunitx_cell_begin:w
{
+ \tl_gput_right:NV \g_@@_preamble_tl \g_@@_pre_cell_tl
+ \tl_gclear:N \g_@@_pre_cell_tl
\tl_gput_right:Nn \g_@@_preamble_tl
{
> {
@@ -10619,7 +10797,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_viii_i:nn #1 #2
{
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_eval:n { \c@jCol + 1 } } \c_true_bool }
\tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
{
@@ -10650,7 +10828,7 @@ version 2005/12/01 or later.
{ \tl_gset:Nn \g_@@_right_delim_tl { #1 } }
{
\tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\@@_patch_preamble:n #2
}
@@ -10658,7 +10836,7 @@ version 2005/12/01 or later.
{
\tl_if_in:nnT { ( [ \{ } { #2 }
{ \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\@@_patch_preamble:n #2
}
@@ -10674,19 +10852,19 @@ version 2005/12/01 or later.
\str_if_eq:VnTF \g_@@_right_delim_tl { . }
{
\tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\tl_gset:Nn \g_@@_right_delim_tl { #2 }
}
{
\tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\@@_error:nn { double~closing~delimiter } { #2 }
}
}
{
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\@@_error:nn { double~closing~delimiter } { #2 }
\@@_patch_preamble:n #3
@@ -10752,7 +10930,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\int_zero_new:N \l_@@_weight_int
\int_set:Nn \l_@@_weight_int { 1 }
- \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_replace_all:Nnn \l_tmpa_tl { \@@_S: } { S }
+ \@@_keys_p_column:V \l_tmpa_tl
+ % \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl
\keys_set:nV { WithArrows / X-column } \l_tmpa_tl
\int_compare:nNnT \l_@@_weight_int < 0
{
@@ -10842,12 +11023,16 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_preamble:Nn #1 #2
{
+ \group_begin:
+ \@@_newcolumntype w [ 2 ] { \@@_w: { ##1 } { ##2 } }
+ \@@_newcolumntype W [ 2 ] { \@@_W: { ##1 } { ##2 } }
\@temptokena { #2 }
\@tempswatrue
\@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
\tl_gclear:N \g_@@_preamble_tl
\exp_after:wN \@@_patch_m_preamble:n \the \@temptokena \q_stop
- \tl_set_eq:NN #1 \g_@@_preamble_tl
+ \tl_gset_eq:NN #1 \g_@@_preamble_tl
+ \group_end:
}
% \end{macrocode}
%
@@ -10871,6 +11056,11 @@ version 2005/12/01 or later.
\cs_set:Npn \@addamp { \if@firstamp \@firstampfalse \else \@preamerr 5 \fi }
% \end{macrocode}
%
+% \begin{macrocode}
+ \@@_newcolumntype w [ 2 ] { \@@_w: { ##1 } { ##2 } }
+ \@@_newcolumntype W [ 2 ] { \@@_W: { ##1 } { ##2 } }
+% \end{macrocode}
+%
% \medskip
% You do the expansion of the (small) preamble with the tools of \pkg{array}.
% \begin{macrocode}
@@ -10962,8 +11152,8 @@ version 2005/12/01 or later.
p { \@@_patch_m_preamble_iv:nnn t #1 }
m { \@@_patch_m_preamble_iv:nnn c #1 }
b { \@@_patch_m_preamble_iv:nnn b #1 }
- \@@_w: { \@@_patch_m_preamble_v:nnnn { } #1 }
- \@@_W: { \@@_patch_m_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
+ \@@_w: { \@@_patch_m_preamble_v:nnnn { } #1 }
+ \@@_W: { \@@_patch_m_preamble_v:nnnn { \@@_special_W: } #1 }
\q_stop { }
}
{ \@@_fatal:nn { unknown~column~type } { #1 } }
@@ -11046,6 +11236,7 @@ version 2005/12/01 or later.
\tl_gput_right:Nn \g_@@_preamble_tl
{
> {
+ \dim_set:Nn \l_@@_col_width_dim { #4 }
\hbox_set:Nw \l_@@_cell_box
\@@_cell_begin:w
\str_set:Nn \l_@@_hpos_cell_str { #3 }
@@ -11053,9 +11244,9 @@ version 2005/12/01 or later.
c
< {
\@@_cell_end:
- #1
\hbox_set_end:
\bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
+ #1
\@@_adjust_size_box:
\makebox [ #4 ] [ #3 ] { \box_use_drop:N \l_@@_cell_box }
}
@@ -11240,7 +11431,7 @@ version 2005/12/01 or later.
{
{ ! \seq_if_empty_p:N \g_@@_notes_seq }
{ ! \seq_if_empty_p:N \g_@@_notes_in_caption_seq }
- { ! \tl_if_empty_p:V \l_@@_tabularnote_tl }
+ { ! \tl_if_empty_p:V \g_@@_tabularnote_tl }
}
\@@_insert_tabularnotes:
\cs_set_eq:NN \tabularnote \@@_tabularnote_error:n
@@ -11308,7 +11499,11 @@ version 2005/12/01 or later.
% \begin{macrocode}
\group_begin:
\l_@@_notes_code_before_tl
- \tl_if_empty:NF \l_@@_tabularnote_tl { \l_@@_tabularnote_tl \par }
+ \tl_if_empty:NF \g_@@_tabularnote_tl
+ {
+ \g_@@_tabularnote_tl \par
+ \tl_gclear:N \g_@@_tabularnote_tl
+ }
% \end{macrocode}
% We compose the tabular notes with a list of \pkg{enumitem}. The |\strut| and
% the |\unskip| are designed to give the ability to put a |\bottomrule| at the
@@ -12234,6 +12429,17 @@ version 2005/12/01 or later.
\tl_if_empty:NT \l_@@_caption_tl
{ \@@_error_or_warning:n { label~without~caption } }
}
+ \NewDocumentEnvironment { TabularNote } { b }
+ {
+ \bool_if:NTF \l_@@_in_code_after_bool
+ { \@@_error_or_warning:n { TabularNote~in~CodeAfter } }
+ {
+ \tl_if_empty:NF \g_@@_taublarnote_tl
+ { \tl_gput_right:Nn \g_@@_tabularnote_tl { \par } }
+ \tl_gput_right:Nn \g_@@_tabularnote_tl { ##1 }
+ }
+ }
+ { }
\bool_set_true:N \l_@@_NiceTabular_bool
\NiceArray { #2 }
}
@@ -12489,7 +12695,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% Now, the internal |code-after| and then, the |\CodeAfter|.
+% Now, the pre-code-after and then, the |\CodeAfter|.
% \begin{macrocode}
\bool_if:NT \c_@@_tikz_loaded_bool
{
@@ -12509,8 +12715,8 @@ version 2005/12/01 or later.
\cs_set_eq:NN \OverBrace \@@_OverBrace
\cs_set_eq:NN \ShowCellNames \@@_ShowCellNames
\cs_set_eq:NN \line \@@_line
- \g_@@_internal_code_after_tl
- \tl_gclear:N \g_@@_internal_code_after_tl
+ \g_@@_pre_code_after_tl
+ \tl_gclear:N \g_@@_pre_code_after_tl
% \end{macrocode}
% When |light-syntax| is used, we insert systematically a |\CodeAfter| in the
% flow. Thus, it's possible to have two instructions |\CodeAfter| and the second
@@ -12527,10 +12733,20 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
+% The following code is a security for the case the user has used \pkg{babel}
+% with the option \pkg{spanish}: in that case, the characters |>| and |<| are
+% 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 }
+% \end{macrocode}
+% \medskip
% And here's the |\CodeAfter|. Since the |\CodeAfter| may begin with an
% ``argument'' between square brackets of the options, we extract and treat that
% potential ``argument'' with the command |\@@_CodeAfter_keys:|.
% \begin{macrocode}
+ \bool_set_true:N \l_@@_in_code_after_bool
\exp_last_unbraced:NV \@@_CodeAfter_keys: \g_nicematrix_code_after_tl
\scan_stop:
\tl_gclear:N \g_nicematrix_code_after_tl
@@ -12539,27 +12755,28 @@ version 2005/12/01 or later.
%
%
% \medskip
-% |\g_nicematrix_code_before_tl| is for instructions in the cells of the array such as
+% |\g_@@_pre_code_before_tl| is for instructions in the cells of the array such as
% |\rowcolor| and |\cellcolor| (when the key |colortbl-like| is in
% force). These instructions will be written on the |aux| file to be added to
% the |code-before| in the next run.
% \begin{macrocode}
+ \tl_if_empty:NF \g_@@_pre_code_before_tl
+ {
+ \tl_gput_right:Nx \g_@@_aux_tl
+ {
+ \tl_gset:Nn \exp_not:N \g_@@_pre_code_before_tl
+ { \exp_not:V \g_@@_pre_code_before_tl }
+ }
+ \tl_gclear:N \g_@@_pre_code_before_tl
+ }
\tl_if_empty:NF \g_nicematrix_code_before_tl
{
-% \end{macrocode}
-% The command |\rowcolor| in tabular will in fact use |\rectanglecolor| in order
-% to follow the behaviour of |\rowcolor| of \pkg{colortbl}. That's why there may
-% be a command |\rectanglecolor| in |\g_nicematrix_code_before_tl|. In order to avoid an
-% error during the expansion, we define a protected version of |\rectanglecolor|.
-% \begin{macrocode}
- \cs_set_protected:Npn \rectanglecolor { }
- \cs_set_protected:Npn \columncolor { }
\tl_gput_right:Nx \g_@@_aux_tl
{
\tl_gset:Nn \exp_not:N \g_@@_code_before_tl
{ \exp_not:V \g_nicematrix_code_before_tl }
}
- \bool_set_true:N \l_@@_code_before_bool
+ \tl_gclear:N \g_nicematrix_code_before_tl
}
% \end{macrocode}
%
@@ -14465,6 +14682,7 @@ version 2005/12/01 or later.
\NewDocumentCommand \@@_RowStyle:n { O { } m }
{
\group_begin:
+ \tl_clear:N \l_tmpa_tl % value of \rowcolor
\tl_clear:N \l_@@_color_tl
\int_set:Nn \l_@@_key_nb_rows_int 1
\keys_set:nn { NiceMatrix / RowStyle } { #1 }
@@ -14477,7 +14695,7 @@ version 2005/12/01 or later.
% 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_nicematrix_code_before_tl
+ \tl_gput_right:Nx \g_@@_pre_code_before_tl
{
% \end{macrocode}
% The command |\@@_exp_color_arg:NV| is \emph{fully expandable}.
@@ -14491,7 +14709,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\int_compare:nNnT \l_@@_key_nb_rows_int > 1
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Nx \g_@@_pre_code_before_tl
{
\@@_exp_color_arg:NV \@@_rowcolor \l_tmpa_tl
{
@@ -14607,8 +14825,15 @@ version 2005/12/01 or later.
% |\l_tmpa_int| will remain equal to $0$.
% \begin{macrocode}
\int_zero:N \l_tmpa_int
- \seq_map_indexed_inline:Nn \g_@@_colors_seq
- { \tl_if_eq:nnT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } }
+% \end{macrocode}
+% We don't take into account the colors like |myserie!!+| because those colors
+% are special color from a |\definecolorseries| of \pkg{xcolor}.
+% \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 } } }
+ }
\int_compare:nNnTF \l_tmpa_int = \c_zero_int
% \end{macrocode}
% First, the case where the color is a \emph{new} color (not in the sequence).
@@ -15099,19 +15324,17 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \@@_cellcolor_tabular { O { } m }
{
- \peek_remove_spaces:n
- {
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
- {
+ \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ {
% \end{macrocode}
% We must not expand the color (|#2|) because the color may contain the token
% |!| which may be activated by some packages (ex.: \pkg{babel} with the option
% |french| on latex and pdflatex).
% \begin{macrocode}
- \@@_cellcolor [ #1 ] { \exp_not:n { #2 } }
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- }
- }
+ \@@_cellcolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ }
+ \ignorespaces
}
% \end{macrocode}
%
@@ -15121,15 +15344,13 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \@@_rowcolor_tabular { O { } m }
{
- \peek_remove_spaces:n
- {
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
- {
- \@@_rectanglecolor [ #1 ] { \exp_not:n { #2 } }
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- { \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
- }
- }
+ \tl_gput_right:Nx \g_@@_pre_code_before_tl
+ {
+ \@@_rectanglecolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ { \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
+ }
+ \ignorespaces
}
% \end{macrocode}
%
@@ -15151,7 +15372,7 @@ version 2005/12/01 or later.
% instructions in the |\CodeBefore| in order to fill color by color (to avoid
% the thin white lines).
% \begin{macrocode}
- \tl_gput_left:Nx \g_nicematrix_code_before_tl
+ \tl_gput_left:Nx \g_@@_pre_code_before_tl
{
\exp_not:N \columncolor [ #1 ]
{ \exp_not:n { #2 } } { \int_use:N \c@jCol }
@@ -15898,7 +16119,7 @@ version 2005/12/01 or later.
{
\@@_compute_rule_width:n { multiplicity = #1 , #2 }
\skip_vertical:n { \l_@@_rule_width_dim }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_hline:n
{
@@ -16114,7 +16335,7 @@ version 2005/12/01 or later.
{
\@@_compute_rule_width:n { #1 }
\skip_vertical:n { \l_@@_rule_width_dim }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_hline:n
{
@@ -16168,7 +16389,7 @@ version 2005/12/01 or later.
\str_if_in:nnTF { #2 } { - }
{ \@@_cut_on_hyphen:w #2 \q_stop }
{ \@@_cut_on_hyphen:w #2 - #2 \q_stop }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_hline:n
{
@@ -16218,7 +16439,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_gput_right:Nx \g_@@_preamble_tl
{ \exp_not:N ! { \skip_horizontal:n { \dim_use:N \l_@@_rule_width_dim } } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_vline:n
{
@@ -16276,8 +16497,10 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 2 } }
+ {
+ ( \int_compare_p:nNn \l_tmpa_tl = { #1 } )
+ || ( \int_compare_p:nNn \l_tmpa_tl = { #3 + 1 } )
+ }
{ \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
{ \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
}
@@ -16292,8 +16515,10 @@ version 2005/12/01 or later.
{
{ \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
{ \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 2 } }
+ {
+ ( \int_compare_p:nNn \l_tmpb_tl = { #2 } )
+ || ( \int_compare_p:nNn \l_tmpb_tl = { #4 + 1 } )
+ }
}
{ \bool_gset_false:N \g_tmpa_bool }
}
@@ -17082,7 +17307,7 @@ version 2005/12/01 or later.
\int_gincr:N \g_@@_block_box_int
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_actually_diagbox:nnnnnn
{ \int_use:N \c@iRow }
@@ -17253,16 +17478,16 @@ version 2005/12/01 or later.
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
- \exp_not:n
- {
- {
- \bool_if:NTF \l_@@_NiceTabular_bool
- {
- \group_begin:
- \bool_if:NF \l_@@_respect_arraystretch_bool
- { \cs_set:Npn \arraystretch { 1 } }
+ {
+ \bool_if:NTF \l_@@_NiceTabular_bool
+ {
+ \group_begin:
+ \bool_if:NF \l_@@_respect_arraystretch_bool
+ { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+ \exp_not:n
+ {
\dim_zero:N \extrarowheight
- #4
+ #4
% \end{macrocode}
% If the box is rotated (the key |\rotate| may be in the previous |#4|), the
% tabular used for the content of the cell will be constructed with a format
@@ -17271,21 +17496,24 @@ version 2005/12/01 or later.
% the tabular is the same as the external alignment of the tabular (that is to
% say the position of the block in its zone of merged cells).
% \begin{macrocode}
- \bool_if:NT \g_@@_rotate_bool
- { \str_set:Nn \l_@@_hpos_block_str c }
- \use:x
- {
- \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_tl ]
- { @ { } \l_@@_hpos_block_str @ { } }
- }
- #5
- \end { tabular }
- \group_end:
- }
- {
- \group_begin:
- \bool_if:NF \l_@@_respect_arraystretch_bool
- { \cs_set:Npn \arraystretch { 1 } }
+ \bool_if:NT \g_@@_rotate_bool
+ { \str_set:Nn \l_@@_hpos_block_str c }
+ \use:x
+ {
+ \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_tl ]
+ { @ { } \l_@@_hpos_block_str @ { } }
+ }
+ #5
+ \end { tabular }
+ }
+ \group_end:
+ }
+ {
+ \group_begin:
+ \bool_if:NF \l_@@_respect_arraystretch_bool
+ { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+ \exp_not:n
+ {
\dim_zero:N \extrarowheight
#4
\bool_if:NT \g_@@_rotate_bool
@@ -17299,10 +17527,10 @@ version 2005/12/01 or later.
#5
\end { array }
\c_math_toggle_token
- \group_end:
}
+ \group_end:
}
- }
+ }
}
}
% \end{macrocode}
@@ -17367,6 +17595,9 @@ version 2005/12/01 or later.
v-center .bool_set:N = \l_@@_v_center_bool ,
v-center .default:n = true ,
v-center .initial:n = false ,
+ transparent .bool_set:N = \l_@@_transparent_bool ,
+ transparent .default:n = true ,
+ transparent .initial:n = false ,
unknown .code:n = \@@_error:n { Unknown~key~for~Block }
}
% \end{macrocode}
@@ -17472,8 +17703,11 @@ version 2005/12/01 or later.
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
}
}
- \bool_if:nT
- { ! \l_@@_vlines_block_bool && ! \l_@@_hlines_block_bool }
+ \bool_if:nF
+ {
+ \l_@@_transparent_bool
+ || ( \l_@@_vlines_block_bool && \l_@@_hlines_block_bool )
+ }
{
% \end{macrocode}
% The sequence of the positions of the blocks (excepted the blocks with the key
@@ -17486,9 +17720,6 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% We have a problem here: if the final user has used the keys |hlines| and
-% |color| together, the frame of the block is drawn with the color specified by
-% |color| but the key |hlines| is no-op.
% \begin{macrocode}
\bool_lazy_and:nnT
{ ! (\tl_if_empty_p:N \l_@@_draw_tl) }
@@ -17527,7 +17758,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_if_empty:NF \l_@@_fill_tl
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Nx \g_@@_pre_code_before_tl
{
\exp_not:N \roundedrectanglecolor
\exp_args:NV \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [
@@ -17559,7 +17790,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_actually_diagbox:nnnnnn
{ #1 }
@@ -17628,7 +17859,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\pgfpicture
\pgfrememberpicturepositiononpagetrue
- \pgf@relevantforpicturesizefalse
+ \pgf@relevantforpicturesizefalse
\@@_qpoint:n { row - #1 }
\dim_set_eq:NN \l_tmpa_dim \pgf@y
\@@_qpoint:n { col - #2 }
@@ -17912,10 +18143,9 @@ version 2005/12/01 or later.
{ \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim }
{ \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim }
\pgfsetlinewidth { 1.1 \l_@@_line_width_dim }
-% \end{macrocode}
-% We can't use |\pgfusepathqstroke| because of the key |rounded-corners|.
-% \begin{macrocode}
- \pgfusepath { stroke }
+ \dim_compare:nNnTF \l_@@_rounded_corners_dim = \c_zero_dim
+ { \pgfusepathqstroke }
+ { \pgfusepath { stroke } }
}
\endpgfpicture
\group_end:
@@ -17960,7 +18190,8 @@ version 2005/12/01 or later.
{
position = ##1 ,
start = \l_@@_tmpc_tl ,
- end = \int_eval:n { \l_tmpa_tl - 1 }
+ end = \int_eval:n { \l_tmpa_tl - 1 } ,
+ total-width = \dim_use:N \l_@@_line_width_dim % added 2022-08-06
}
}
}
@@ -17984,7 +18215,7 @@ version 2005/12/01 or later.
position = ##1 ,
start = \l_@@_tmpd_tl ,
end = \int_eval:n { \l_tmpb_tl - 1 } ,
- total-width = \arrayrulewidth
+ total-width = \dim_use:N \l_@@_line_width_dim % added 2022-08-06
}
}
}
@@ -18186,7 +18417,13 @@ version 2005/12/01 or later.
columns-type .value_required:n = true ,
l .meta:n = { columns-type = l } ,
r .meta:n = { columns-type = r } ,
- c .meta:n = { columns-type = c }
+ c .meta:n = { columns-type = c } ,
+ delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
}
% \end{macrocode}
%
@@ -18319,7 +18556,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_diagbox:nn #1 #2
{
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
{
\@@_actually_diagbox:nnnnnn
{ \int_use:N \c@iRow }
@@ -18503,7 +18740,7 @@ version 2005/12/01 or later.
% (and |{pNiceArray}|, |{pNiceMatrix}|, etc.).
%
% A delimiter in the preamble of the array will write an instruction
-% |\@@_delimiter:nnn| in the |\g_@@_internal_code_after_tl| (and also
+% |\@@_delimiter:nnn| in the |\g_@@_pre_code_after_tl| (and also
% potentially add instructions in the preamble provided to |\array| in order to
% add space between columns).
%
@@ -18657,11 +18894,11 @@ version 2005/12/01 or later.
}
{ \@@_error:n { Invalid~name } }
} ,
+ name .value_required:n = true ,
rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } ,
rules .value_required:n = true ,
code .tl_set:N = \l_@@_code_tl ,
code .value_required:n = true ,
- name .value_required:n = true ,
unknown .code:n = \@@_error:n { Unknown~key~for~SubMatrix }
}
% \end{macrocode}
@@ -18672,8 +18909,20 @@ version 2005/12/01 or later.
{
\peek_remove_spaces:n
{
- \tl_gput_right:Nn \g_@@_internal_code_after_tl
- { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] }
+ \tl_gput_right:Nx \g_@@_pre_code_after_tl
+ {
+ \SubMatrix { #1 } { #2 } { #3 } { #4 }
+ [
+ delimiters / color = \l_@@_delimiters_color_tl ,
+ hlines = \l_@@_submatrix_hlines_clist ,
+ vlines = \l_@@_submatrix_vlines_clist ,
+ extra-height = \dim_use:N \l_@@_submatrix_extra_height_dim ,
+ left-xshift = \dim_use:N \l_@@_submatrix_left_xshift_dim ,
+ right-xshift = \dim_use:N \l_@@_submatrix_right_xshift_dim ,
+ slim = \bool_to_str:N \l_@@_submatrix_slim_bool ,
+ #5
+ ]
+ }
\@@_SubMatrix_in_code_before_i { #2 } { #3 }
}
}
@@ -18703,7 +18952,7 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% In the internal |code-after| and in the |\CodeAfter| the following command
+% In the pre-code-after and in the |\CodeAfter| the following command
% |\@@_SubMatrix| will be linked to |\SubMatrix|.
% \begin{itemize}
% \item |#1| is the left delimiter;
@@ -19248,9 +19497,9 @@ version 2005/12/01 or later.
{ \@@_error:nn { Construct~too~large } { \OverBrace } }
}
{
- \tl_clear:N \l_tmpa_tl % added the 2022-02-25
+ \tl_clear:N \l_tmpa_tl
\keys_set:nn { NiceMatrix / Brace } { #4 }
- \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } } % added the 2022-02-25
+ \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } }
\pgfpicture
\pgfrememberpicturepositiononpagetrue
\pgf@relevantforpicturesizefalse
@@ -19397,7 +19646,7 @@ version 2005/12/01 or later.
% \subsection*{The command \textbackslash ShowCellNames}
%
% \begin{macrocode}
-\NewDocumentCommand \@@_ShowCellNames { }
+\NewDocumentCommand \@@_ShowCellNames_CodeBefore { }
{
\dim_zero_new:N \g_@@_tmpc_dim
\dim_zero_new:N \g_@@_tmpd_dim
@@ -19410,6 +19659,7 @@ version 2005/12/01 or later.
\@@_qpoint:n { row - \int_eval:n { ##1 + 1 } }
\dim_gset:Nn \g_tmpa_dim { ( \l_tmpa_dim + \pgf@y ) / 2 }
\dim_gset:Nn \g_tmpb_dim { \l_tmpa_dim - \pgf@y }
+ \bool_if:NTF \l_@@_in_code_after_bool
\end { pgfpicture }
\int_step_inline:nn \c@jCol
{
@@ -19421,7 +19671,8 @@ version 2005/12/01 or later.
\@@_qpoint:n { col - \int_eval:n { ####1 + 1 } }
\dim_gset:Nn \g_@@_tmpd_dim { \pgf@x - \g_@@_tmpc_dim }
\dim_gset_eq:NN \g_@@_tmpe_dim \pgf@x
- \end { pgfpicture }
+ \endpgfpicture
+ \end { pgfpicture }
\fp_set:Nn \l_tmpa_fp
{
\fp_min:nn
@@ -19454,6 +19705,98 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \begin{macrocode}
+\NewDocumentCommand \@@_ShowCellNames { }
+ {
+ \bool_if:NT \l_@@_in_code_after_bool
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \pgfpathrectanglecorners
+ { \@@_qpoint:n { 1 } }
+ { \@@_qpoint:n { \int_eval:n { \c@iRow + 1 } } }
+ \pgfsetfillopacity { 0.75 }
+ \pgfsetfillcolor { white }
+ \pgfusepathqfill
+ \endpgfpicture
+ }
+ \dim_zero_new:N \g_@@_tmpc_dim
+ \dim_zero_new:N \g_@@_tmpd_dim
+ \dim_zero_new:N \g_@@_tmpe_dim
+ \int_step_inline:nn \c@iRow
+ {
+ \bool_if:NTF \l_@@_in_code_after_bool
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ }
+ { \begin { pgfpicture } }
+ \@@_qpoint:n { row - ##1 }
+ \dim_set_eq:NN \l_tmpa_dim \pgf@y
+ \@@_qpoint:n { row - \int_eval:n { ##1 + 1 } }
+ \dim_gset:Nn \g_tmpa_dim { ( \l_tmpa_dim + \pgf@y ) / 2 }
+ \dim_gset:Nn \g_tmpb_dim { \l_tmpa_dim - \pgf@y }
+ \bool_if:NTF \l_@@_in_code_after_bool
+ { \endpgfpicture }
+ { \end { pgfpicture } }
+ \int_step_inline:nn \c@jCol
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \normalfont \Large \sffamily \bfseries
+ \bool_if:NTF \l_@@_in_code_after_bool
+ { \color { red } }
+ { \color { red ! 50 } }
+ ##1 - ####1
+ }
+ \bool_if:NTF \l_@@_in_code_after_bool
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ }
+ { \begin { pgfpicture } }
+ \@@_qpoint:n { col - ####1 }
+ \dim_gset_eq:NN \g_@@_tmpc_dim \pgf@x
+ \@@_qpoint:n { col - \int_eval:n { ####1 + 1 } }
+ \dim_gset:Nn \g_@@_tmpd_dim { \pgf@x - \g_@@_tmpc_dim }
+ \dim_gset_eq:NN \g_@@_tmpe_dim \pgf@x
+ \bool_if:NTF \l_@@_in_code_after_bool
+ { \endpgfpicture }
+ { \end { pgfpicture } }
+ \fp_set:Nn \l_tmpa_fp
+ {
+ \fp_min:nn
+ {
+ \fp_min:nn
+ { \dim_ratio:nn { \g_@@_tmpd_dim } { \box_wd:N \l_tmpa_box } }
+ { \dim_ratio:nn { \g_tmpb_dim } { \box_ht_plus_dp:N \l_tmpa_box } }
+ }
+ { 1.0 }
+ }
+ \box_scale:Nnn \l_tmpa_box { \fp_use:N \l_tmpa_fp } { \fp_use:N \l_tmpa_fp }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \pgftransformshift
+ {
+ \pgfpoint
+ { 0.5 * ( \g_@@_tmpc_dim + \g_@@_tmpe_dim ) }
+ { \dim_use:N \g_tmpa_dim }
+ }
+ \pgfnode
+ { rectangle }
+ { center }
+ { \box_use:N \l_tmpa_box }
+ { }
+ { }
+ \endpgfpicture
+ }
+ }
+ }
+% \end{macrocode}
%
% \bigskip
% \subsection*{We process the options at package loading}
@@ -19681,7 +20024,7 @@ version 2005/12/01 or later.
\@@_msg_new:nn { too~much~cols~for~matrix~with~last~col }
{
Too~much~columns.\\
- In~the~row~\int_eval:n { \c@jCol - 1 },~
+ In~the~row~\int_eval:n { \c@iRow - 1 },~
you~try~to~use~more~columns~
than~allowed~by~your~\@@_full_name_env:.\@@_message_hdotsfor:\
The~maximal~number~of~columns~is~\int_eval:n { \l_@@_last_col_int - 1 }~
@@ -19904,6 +20247,15 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
+% \begin{macrocode}
+\@@_msg_new:nn { W~warning }
+ {
+ Line~\msg_line_number:.~The~cell~is~too~wide~for~your~column~'W'~
+ (row~\int_use:N \c@iRow).
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\@@_msg_new:nn { Construct~too~large }
{
@@ -19951,6 +20303,7 @@ version 2005/12/01 or later.
Incompatible~keys.\\
You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~
'\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\
+ Maybe~it~will~possible~in~future~version.\\
Your~key~will~be~discarded.
}
% \end{macrocode}
@@ -19967,7 +20320,16 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \begin{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:V
+ \l_keys_key_str'~will~be~used~instead.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { Invalid~name }
{
Invalid~name.\\
@@ -20153,7 +20515,7 @@ version 2005/12/01 or later.
{
Tikz~not~loaded.\\
You~can't~use~the~key~'tikz'~for~the~command~'\token_to_str:N
- \Block'~because~you~have~not~loaded~Tikz.~
+ \Block'~because~you~have~not~loaded~tikz.~
This~key~will~be~ignored.
}
% \end{macrocode}
@@ -20221,8 +20583,10 @@ version 2005/12/01 or later.
{
Forbidden~command.\\
You~can't~use~the~command~\token_to_str:N\tabularnote\
- ~in~a~\@@_full_name_env:.~This~command~is~available~only~in~
- \{NiceTabular\},~\{NiceArray\}~and~\{NiceMatrix\}. \\
+ ~here.~This~command~is~available~only~in~
+ \{NiceTabular\},~\{NiceTabular*\}~and~\{NiceTabularX\}~or~in~
+ the~argument~of~a~command~\token_to_str:N \caption\ included~
+ in~an~environment~{table}. \\
This~command~will~be~ignored.
}
% \end{macrocode}
@@ -20264,7 +20628,7 @@ version 2005/12/01 or later.
{
Tikz~not~loaded.\\
You~have~used~the~key~'tikz'~in~the~definition~of~a~
- customized~line~(with~'custom-line')~but~Tikz~is~not~loaded.~
+ customized~line~(with~'custom-line')~but~tikz~is~not~loaded.~
You~can~go~on~but~you~will~have~another~error~if~you~actually~
use~that~custom~line.
}
@@ -20275,7 +20639,7 @@ version 2005/12/01 or later.
{
Tikz~not~loaded.\\
You~have~used~the~key~'tikz'~in~a~key~'borders'~(of~a~
- command~'\token_to_str:N\Block')~but~Tikz~is~not~loaded.~
+ command~'\token_to_str:N\Block')~but~tikz~is~not~loaded.~
That~key~will~be~ignored.
}
% \end{macrocode}
@@ -20332,6 +20696,16 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { TabularNote~in~CodeAfter }
+ {
+ Environment~{TabularNote}~forbidden.\\
+ You~must~use~{TabularNote}~at~the~end~of~your~{NiceTabular}~
+ but~*before*~the~\token_to_str:N \CodeAfter.\\
+ This~environment~{TabularNote}~will~be~ignored.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { varwidth~not~loaded }
{
varwidth~not~loaded.\\
@@ -20370,7 +20744,7 @@ version 2005/12/01 or later.
{
The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~
hlines,~hvlines,~l,~line-width,~name,~rounded-corners,~r,~respect-arraystretch,
- ~t,~tikz~and~vlines.
+ ~t,~tikz,~transparent~and~vlines.
}
% \end{macrocode}
%
@@ -20419,6 +20793,22 @@ version 2005/12/01 or later.
The~latter~is~for~the~command~\token_to_str:N \line.
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nnn { Unknown~key~for~CodeBefore }
+ {
+ Unknown~key.\\
+ The~key~'\l_keys_key_str'~is~unknown.\\
+ It~will~be~ignored. \\
+ \c_@@_available_keys_str
+ }
+ {
+ The~available~keys~are~(in~alphabetic~order):~
+ create-cell-nodes,~
+ delimiters/color~and~
+ sub-matrix~(several~subkeys).
+ }
+% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~SubMatrix }
@@ -20532,12 +20922,14 @@ version 2005/12/01 or later.
right-margin,~
rules~(with~the~subkeys~'color'~and~'width'),~
small,~
- sub-matrix~(several~subkeys),
+ sub-matrix~(several~subkeys),~
vlines,~
xdots~(several~subkeys).
}
% \end{macrocode}
%
+% For `|{NiceArray}|`, the set of keys is the same as for |{NiceMatrix}|
+% excepted that there is no |l| and |r|.
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~NiceArray }
{
@@ -20566,7 +20958,6 @@ version 2005/12/01 or later.
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
- delimiters/color,~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -20578,8 +20969,6 @@ version 2005/12/01 or later.
left-margin,~
light-syntax,~
name,~
- notes/bottomrule,~
- notes/para,~
nullify-dots,~
renew-dots,~
respect-arraystretch,~
@@ -20600,7 +20989,7 @@ version 2005/12/01 or later.
% \medskip
% This error message is used for the set of keys |NiceMatrix/NiceMatrix| and
% |NiceMatrix/pNiceArray| (but not by |NiceMatrix/NiceArray| because, for this
-% set of keys, there is also the keys |t|, |c| and~|b|).
+% set of keys, there is no |l| and |r|).
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~NiceMatrix }
{
@@ -20630,7 +21019,6 @@ version 2005/12/01 or later.
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
- delimiters~(several~subkeys),~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -20702,8 +21090,7 @@ version 2005/12/01 or later.
left-margin,~
light-syntax,~
name,~
- notes/bottomrule,~
- notes/para,~
+ notes~(several~subkeys),~
nullify-dots,~
renew-dots,~
respect-arraystretch,~
@@ -21349,6 +21736,14 @@ version 2005/12/01 or later.
% Correction of a bug: it's now possible to use |\OverBrace| and |\UnderBrace|
% with \pkg{unicode-math} (with XeLaTeX or LuaLaTeX).
%
+% \subsection*{Changes between version 6.12 and 6.13}
+%
+% New environment |{TabularNote}| in |{NiceTabular}| with the same semantic as
+% the key |tabularnote| (for legibility).
+%
+% The command |\Hline| nows accepts options (between square brackets).
+%
+%
% \newpage
% \tableofcontents
%
@@ -21356,7 +21751,6 @@ version 2005/12/01 or later.
% Local Variables:
% TeX-fold-mode: t
% TeX-fold-preserve-comments: nil
-% flyspell-mode: nil
% fill-column: 80
% End:
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index 1e58c04393c..97bf94e1892 100644
--- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
+++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
@@ -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.12}
-\def\myfiledate{2022/07/28}
+\def\myfileversion{6.13}
+\def\myfiledate{2022/08/24}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -46,8 +46,11 @@
}
\cs_new_protected:Npn \__nicematrix_error_or_warning:n
{ \bool_if:NTF \c__nicematrix_messages_for_Overleaf_bool \__nicematrix_warning:n \__nicematrix_error:n }
-\str_if_eq:VnT \c_sys_jobname_str { output }
- { \bool_set_true:N \c__nicematrix_messages_for_Overleaf_bool }
+\bool_set:Nn \c__nicematrix_messages_for_Overleaf_bool
+ {
+ \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs
+ || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf
+ }
\cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn
{ \msg_redirect_name:nnn { nicematrix } }
\cs_new_protected:Npn \__nicematrix_gredirect_none:n #1
@@ -70,6 +73,7 @@
\tl_new:N \l__nicematrix_argspec_tl
\cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
\cs_generate_variant:Nn \keys_define:nn { n x }
+\cs_generate_variant:Nn \str_lowercase:n { V }
\hook_gput_code:nnn { begindocument } { . }
{
\@ifpackageloaded { varwidth }
@@ -273,13 +277,30 @@
{
\renewcommand*{\NC@rewrite@S}[1][]
{
- \@temptokena \exp_after:wN
- { \tex_the:D \@temptokena \__nicematrix_S: [ ##1 ] }
+ \tl_if_empty:nTF { ##1 }
+ {
+ \@temptokena \exp_after:wN
+ { \tex_the:D \@temptokena \__nicematrix_S: }
+ }
+ {
+ \@temptokena \exp_after:wN
+ { \tex_the:D \@temptokena \__nicematrix_S: [ ##1 ] }
+ }
\NC@find
}
}
}
}
+\cs_new_protected:Npn \__nicematrix_rescan_for_spanish:N #1
+ {
+ \tl_set_rescan:Nno
+ #1
+ {
+ \char_set_catcode_other:N >
+ \char_set_catcode_other:N <
+ }
+ #1
+ }
\int_new:N \g__nicematrix_env_int
\cs_new:Npn \__nicematrix_env: { nm - \int_use:N \g__nicematrix_env_int }
\NewExpandableDocumentCommand \NiceMatrixLastEnv { }
@@ -337,8 +358,11 @@
{ environment \space \{ \g__nicematrix_name_env_str \} }
}
\tl_new:N \g_nicematrix_code_after_tl
+\bool_new:N \l__nicematrix_in_code_after_bool
\tl_new:N \l__nicematrix_code_tl
-\tl_new:N \g__nicematrix_internal_code_after_tl
+\tl_new:N \g__nicematrix_pre_code_after_tl
+\tl_new:N \g_nicematrix_code_before_tl
+\tl_new:N \g__nicematrix_pre_code_before_tl
\int_new:N \l__nicematrix_old_iRow_int
\int_new:N \l__nicematrix_old_jCol_int
\seq_new:N \l__nicematrix_custom_line_commands_seq
@@ -435,12 +459,12 @@
{ \clist_put_right:Nn \l_tmpa_clist { ####1 } }
}
\tl_set_eq:NN #1 \l_tmpa_clist
- }
+ }
}
\newcounter { tabularnote }
\seq_new:N \g__nicematrix_notes_seq
\seq_new:N \g__nicematrix_notes_in_caption_seq
-\tl_new:N \l__nicematrix_tabularnote_tl
+\tl_new:N \g__nicematrix_tabularnote_tl
\seq_new:N \l__nicematrix_notes_labels_seq
\newcounter{nicematrix_draft}
\cs_new_protected:Npn \__nicematrix_notes_format:n #1
@@ -486,7 +510,7 @@
{
\bool_if:nT { \cs_if_exist_p:N \@captype || \l__nicematrix_in_env_bool }
{
- \bool_if:nTF { ! \g__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool }
+ \bool_if:nTF { ! \l__nicematrix_NiceTabular_bool && \l__nicematrix_in_env_bool }
{ \__nicematrix_error:n { tabularnote~forbidden } }
{
\bool_if:NTF \l__nicematrix_in_caption_bool
@@ -729,8 +753,6 @@
\keys_define:nn { NiceMatrix / Global }
{
custom-line .code:n = \__nicematrix_custom_line:n { #1 } ,
- delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
- delimiters .value_required:n = true ,
rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } ,
rules .value_required:n = true ,
standard-cline .bool_set:N = \l__nicematrix_standard_cline_bool ,
@@ -811,13 +833,14 @@
corners .clist_set:N = \l__nicematrix_corners_clist ,
corners .default:n = { NW , SW , NE , SE } ,
code-before .code:n =
- {
- \tl_if_empty:nF { #1 }
- {
- \tl_put_right:Nn \l__nicematrix_code_before_tl { #1 }
- \bool_set_true:N \l__nicematrix_code_before_bool
- }
- } ,
+ {
+ \tl_if_empty:nF { #1 }
+ {
+ \tl_gput_left:Nn \g__nicematrix_pre_code_before_tl { #1 }
+ \bool_set_true:N \l__nicematrix_code_before_bool
+ }
+ } ,
+ code-before .value_required:n = true ,
c .code:n = \tl_set:Nn \l__nicematrix_baseline_tl c ,
t .code:n = \tl_set:Nn \l__nicematrix_baseline_tl t ,
b .code:n = \tl_set:Nn \l__nicematrix_baseline_tl b ,
@@ -899,10 +922,10 @@
NiceMatrixOptions / xdots .inherit:n = NiceMatrix / xdots ,
NiceMatrixOptions / rules .inherit:n = NiceMatrix / rules ,
NiceMatrixOptions / notes .inherit:n = NiceMatrix / notes ,
- NiceMatrixOptions / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceMatrixOptions / sub-matrix .inherit:n = NiceMatrix / sub-matrix ,
SubMatrix / rules .inherit:n = NiceMatrix / rules ,
CodeAfter / xdots .inherit:n = NiceMatrix / xdots ,
+ CodeBefore / sub-matrix .inherit:n = NiceMatrix / sub-matrix ,
NiceMatrix .inherit:n =
{
NiceMatrix / Global ,
@@ -910,7 +933,6 @@
} ,
NiceMatrix / xdots .inherit:n = NiceMatrix / xdots ,
NiceMatrix / rules .inherit:n = NiceMatrix / rules ,
- NiceMatrix / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceTabular .inherit:n =
{
NiceMatrix / Global ,
@@ -918,7 +940,7 @@
} ,
NiceTabular / xdots .inherit:n = NiceMatrix / xdots ,
NiceTabular / rules .inherit:n = NiceMatrix / rules ,
- NiceTabular / delimiters .inherit:n = NiceMatrix / delimiters ,
+ NiceTabular / notes .inherit:n = NiceMatrix / notes ,
NiceArray .inherit:n =
{
NiceMatrix / Global ,
@@ -926,7 +948,6 @@
} ,
NiceArray / xdots .inherit:n = NiceMatrix / xdots ,
NiceArray / rules .inherit:n = NiceMatrix / rules ,
- NiceArray / delimiters .inherit:n = NiceMatrix / delimiters ,
pNiceArray .inherit:n =
{
NiceMatrix / Global ,
@@ -934,10 +955,15 @@
} ,
pNiceArray / xdots .inherit:n = NiceMatrix / xdots ,
pNiceArray / rules .inherit:n = NiceMatrix / rules ,
- pNiceArray / delimiters .inherit:n = NiceMatrix / delimiters ,
}
\keys_define:nn { NiceMatrix / NiceMatrixOptions }
{
+ delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
width .code:n = \dim_set:Nn \l__nicematrix_width_dim { #1 } ,
width .value_required:n = true ,
last-col .code:n =
@@ -981,6 +1007,12 @@
columns-type .value_required:n = true ,
l .meta:n = { columns-type = l } ,
r .meta:n = { columns-type = r } ,
+ delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
small .bool_set:N = \l__nicematrix_small_bool ,
small .value_forbidden:n = true ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix }
@@ -992,12 +1024,6 @@
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 ,
- notes / para .bool_set:N = \l__nicematrix_notes_para_bool ,
- notes / para .default:n = true ,
- notes / bottomrule .bool_set:N = \l__nicematrix_notes_bottomrule_bool ,
- notes / bottomrule .default:n = true ,
- tabularnote .tl_set:N = \l__nicematrix_tabularnote_tl ,
- tabularnote .value_required:n = true ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceArray }
@@ -1009,6 +1035,12 @@
{ \__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 ,
+ delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
small .bool_set:N = \l__nicematrix_small_bool ,
small .value_forbidden:n = true ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
@@ -1020,11 +1052,8 @@
width .code:n = \dim_set:Nn \l__nicematrix_width_dim { #1 }
\bool_set_true:N \l__nicematrix_width_used_bool ,
width .value_required:n = true ,
- notes / para .bool_set:N = \l__nicematrix_notes_para_bool ,
- notes / para .default:n = true ,
- notes / bottomrule .bool_set:N = \l__nicematrix_notes_bottomrule_bool ,
- notes / bottomrule .default:n = true ,
- tabularnote .tl_set:N = \l__nicematrix_tabularnote_tl ,
+ notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } ,
+ tabularnote .tl_gset:N = \g__nicematrix_tabularnote_tl ,
tabularnote .value_required:n = true ,
caption .tl_set:N = \l__nicematrix_caption_tl ,
caption .value_required:n = true ,
@@ -1435,7 +1464,8 @@
\tl_gclear_new:N \g__nicematrix_Ddots_lines_tl
\tl_gclear_new:N \g__nicematrix_Iddots_lines_tl
\tl_gclear_new:N \g__nicematrix_HVdotsfor_lines_tl
- \tl_gclear_new:N \g_nicematrix_code_before_tl
+ \tl_gclear:N \g_nicematrix_code_before_tl
+ \tl_gclear:N \g__nicematrix_pre_code_before_tl
}
\cs_new_protected:Npn \__nicematrix_pre_array:
{
@@ -1470,7 +1500,7 @@
\seq_gclear:N \g__nicematrix_pos_of_blocks_seq
\seq_gclear_new:N \g__nicematrix_multicolumn_cells_seq
\seq_gclear_new:N \g__nicematrix_multicolumn_sizes_seq
- \int_gset:Nn \g__nicematrix_last_row_node_int { -1 }
+ \int_gset:Nn \g__nicematrix_last_row_node_int { -2 }
\__nicematrix_pre_array_ii:
\box_clear_new:N \l__nicematrix_the_array_box
\dim_zero_new:N \l__nicematrix_left_delim_dim
@@ -1496,7 +1526,7 @@
}
\cs_new_protected_nopar:Npn \__nicematrix_CodeBefore_Body:w #1 \Body
{
- \tl_put_right:Nn \l__nicematrix_code_before_tl { #1 }
+ \tl_gput_left:Nn \g__nicematrix_pre_code_before_tl { #1 }
\bool_set_true:N \l__nicematrix_code_before_bool
\__nicematrix_pre_array:
}
@@ -1552,8 +1582,16 @@
\bool_gset_false:N \g__nicematrix_recreate_cell_nodes_bool
\group_begin:
\bool_if:NT \l__nicematrix_NiceTabular_bool \c_math_toggle_token
- \exp_last_unbraced:NV \__nicematrix_CodeBefore_keys: \l__nicematrix_code_before_tl \q_stop
- \__nicematrix_actually_color:
+ \int_compare:nNnT { \char_value_catcode:n { 60 } } = { 13 }
+ {
+ \__nicematrix_rescan_for_spanish:N \g__nicematrix_pre_code_before_tl
+ \__nicematrix_rescan_for_spanish:N \l__nicematrix_code_before_tl
+ }
+ \exp_last_unbraced:NV \__nicematrix_CodeBefore_keys:
+ \g__nicematrix_pre_code_before_tl
+ \__nicematrix_actually_color:
+ \l__nicematrix_code_before_tl
+ \q_stop
\bool_if:NT \l__nicematrix_NiceTabular_bool \c_math_toggle_token
\group_end:
\bool_if:NT \g__nicematrix_recreate_cell_nodes_bool
@@ -1567,7 +1605,7 @@
sub-matrix .value_required:n = true ,
delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
- unknown .code:n = \__nicematrix_error:n { Unknown~key~for~CodeAfter }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~CodeBefore }
}
\NewDocumentCommand \__nicematrix_CodeBefore_keys: { O { } }
{
@@ -1687,7 +1725,7 @@
\__nicematrix_test_if_math_mode:
\bool_if:NT \l__nicematrix_in_env_bool { \__nicematrix_fatal:n { Yet~in~env } }
\bool_set_true:N \l__nicematrix_in_env_bool
- \cs_gset_eq:NN \__nicematrix_old_CT@arc@ \CT@arc@
+ \cs_gset_eq:NN \__nicematrix_old_CT@arc@ \CT@arc@
\cs_if_exist:NT \tikz@library@external@loaded
{
\tikzexternaldisable
@@ -1709,12 +1747,14 @@
\bool_gset_true:N \g__nicematrix_aux_found_bool
\use:c { c__nicematrix _ \int_use:N \g__nicematrix_env_int _ tl }
}
- \tl_gclear:N \g__nicematrix_aux_tl
+ \tl_gclear:N \g__nicematrix_aux_tl
\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_if_empty:NF \g__nicematrix_pre_code_before_tl
+ { \bool_set_true:N \l__nicematrix_code_before_bool }
\bool_if:NTF \g__nicematrix_NiceArray_bool
{ \keys_set:nn { NiceMatrix / NiceArray } }
{ \keys_set:nn { NiceMatrix / pNiceArray } }
@@ -1888,6 +1928,7 @@
}
}
\seq_clear:N \g__nicematrix_cols_vlism_seq
+ \tl_gclear_new:N \g__nicematrix_pre_cell_tl
\int_zero:N \l_tmpa_int
\exp_after:wN \__nicematrix_patch_preamble:n \the \@temptokena \q_stop
\int_gset_eq:NN \g__nicematrix_static_num_of_col_int \c@jCol
@@ -1942,7 +1983,7 @@
c { \__nicematrix_patch_preamble_i:n #1 }
l { \__nicematrix_patch_preamble_i:n #1 }
r { \__nicematrix_patch_preamble_i:n #1 }
- > { \__nicematrix_patch_preamble_ii:nn #1 }
+ > { \__nicematrix_patch_preamble_xiv:n }
! { \__nicematrix_patch_preamble_ii:nn #1 }
@ { \__nicematrix_patch_preamble_ii:nn #1 }
| { \__nicematrix_patch_preamble_iii:n #1 }
@@ -1951,8 +1992,8 @@
m { \__nicematrix_patch_preamble_iv:n #1 }
\__nicematrix_V: { \__nicematrix_patch_preamble_v:n }
V { \__nicematrix_patch_preamble_v:n }
- \__nicematrix_w: { \__nicematrix_patch_preamble_vi:nnnn { } #1 }
- \__nicematrix_W: { \__nicematrix_patch_preamble_vi:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
+ \__nicematrix_w: { \__nicematrix_patch_preamble_vi:nnnn { } #1 }
+ \__nicematrix_W: { \__nicematrix_patch_preamble_vi:nnnn { \__nicematrix_special_W: } #1 }
\__nicematrix_S: { \__nicematrix_patch_preamble_vii:n }
( { \__nicematrix_patch_preamble_viii:nn #1 }
[ { \__nicematrix_patch_preamble_viii:nn #1 }
@@ -1985,6 +2026,8 @@
}
\cs_new_protected:Npn \__nicematrix_patch_preamble_i:n #1
{
+ \tl_gput_right:NV \g__nicematrix_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{
> { \__nicematrix_cell_begin:w \str_set:Nn \l__nicematrix_hpos_cell_str { #1 } }
@@ -2009,26 +2052,22 @@
\str_if_eq:nnTF { #1 } |
{ \__nicematrix_patch_preamble_iii:n | }
{
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \arrayrulewidth * \l_tmpa_int
+ + \doublerulesep * ( \l_tmpa_int - 1)
+ }
\tl_gput_right:Nx \g__nicematrix_preamble_tl
{
- \exp_not:N !
- {
- \skip_horizontal:n
- {
- \dim_eval:n
- {
- \arrayrulewidth * \l_tmpa_int
- + \doublerulesep * ( \l_tmpa_int - 1)
- }
- }
- }
+ \exp_not:N ! { \skip_horizontal:n { \dim_eval:n { \l_tmpa_dim } } }
}
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_vline:n
{
position = \int_eval:n { \c@jCol + 1 } ,
multiplicity = \int_use:N \l_tmpa_int ,
+ total-width = \dim_use:N \l_tmpa_dim % added 2022-08-06
}
}
\int_zero:N \l_tmpa_int
@@ -2036,6 +2075,11 @@
\__nicematrix_patch_preamble:n #1
}
}
+\cs_new_protected:Npn \__nicematrix_patch_preamble_xiv:n #1
+ {
+ \tl_gput_right:Nn \g__nicematrix_pre_cell_tl { > { #1 } }
+ \__nicematrix_patch_preamble:n
+ }
\bool_new:N \l__nicematrix_bar_at_end_of_pream_bool
\keys_define:nn { WithArrows / p-column }
{
@@ -2045,8 +2089,32 @@
c .value_forbidden:n = true ,
l .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { l } ,
l .value_forbidden:n = true ,
- si .code:n = \str_set:Nn \l__nicematrix_hpos_col_str { si } ,
- si .value_forbidden:n = true ,
+ R .code:n =
+ \IfPackageLoadedTF { ragged2e }
+ { \str_set:Nn \l__nicematrix_hpos_col_str { R } }
+ {
+ \__nicematrix_error_or_warning:n { ragged2e~not~loaded }
+ \str_set:Nn \l__nicematrix_hpos_col_str { r }
+ } ,
+ R .value_forbidden:n = true ,
+ L .code:n =
+ \IfPackageLoadedTF { ragged2e }
+ { \str_set:Nn \l__nicematrix_hpos_col_str { L } }
+ {
+ \__nicematrix_error_or_warning:n { ragged2e~not~loaded }
+ \str_set:Nn \l__nicematrix_hpos_col_str { l }
+ } ,
+ L .value_forbidden:n = true ,
+ C .code:n =
+ \IfPackageLoadedTF { ragged2e }
+ { \str_set:Nn \l__nicematrix_hpos_col_str { C } }
+ {
+ \__nicematrix_error_or_warning:n { ragged2e~not~loaded }
+ \str_set:Nn \l__nicematrix_hpos_col_str { c }
+ } ,
+ C .value_forbidden:n = true ,
+ 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 ,
t .meta:n = p ,
@@ -2071,9 +2139,14 @@
\cs_new_protected:Npn \__nicematrix_patch_preamble_iv_iii:nn #1 #2
{
\str_set:Nn \l__nicematrix_hpos_col_str { j }
- \keys_set:nn { WithArrows / p-column } { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_replace_all:Nnn \l_tmpa_tl { \__nicematrix_S: } { S }
+ \__nicematrix_keys_p_column:V \l_tmpa_tl
\__nicematrix_patch_preamble_iv_iv:nn { #2 } { minipage }
}
+\cs_new_protected:Npn \__nicematrix_keys_p_column:n #1
+ { \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl }
+\cs_generate_variant:Nn \__nicematrix_keys_p_column:n { V }
\cs_new_protected:Npn \__nicematrix_patch_preamble_iv_iv:nn #1 #2
{
\use:x
@@ -2086,13 +2159,16 @@
{ \str_set:Nn \exp_not:N \l__nicematrix_hpos_cell_str { c } }
{
\str_set:Nn \exp_not:N \l__nicematrix_hpos_cell_str
- { \l__nicematrix_hpos_col_str }
+ { \str_lowercase:V \l__nicematrix_hpos_col_str }
}
\str_case:Vn \l__nicematrix_hpos_col_str
{
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_if_eq:VnT \l__nicematrix_vpos_col_str { m } \__nicematrix_center_cell_box: }
@@ -2105,7 +2181,7 @@
{ j } { c }
{ si } { c }
}
- { \l__nicematrix_hpos_col_str }
+ { \str_lowercase:V \l__nicematrix_hpos_col_str }
}
}
\int_gincr:N \c@jCol
@@ -2113,6 +2189,11 @@
}
\cs_new_protected:Npn \__nicematrix_patch_preamble_iv_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
+ \str_if_eq:VnTF \l__nicematrix_hpos_col_str { si }
+ { \tl_gput_right:Nn \g__nicematrix_preamble_tl { > { \__nicematrix_test_if_empty_for_S: } } }
+ { \tl_gput_right:Nn \g__nicematrix_preamble_tl { > { \__nicematrix_test_if_empty: } } }
+ \tl_gput_right:NV \g__nicematrix_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{
> {
@@ -2140,6 +2221,24 @@
}
}
}
+\cs_new_protected:Npn \__nicematrix_test_if_empty: \ignorespaces #1
+ {
+ \peek_meaning:NT \unskip
+ {
+ \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl
+ { \box_set_wd:Nn \l__nicematrix_cell_box \c_zero_dim }
+ }
+ #1
+ }
+\cs_new_protected:Npn \__nicematrix_test_if_empty_for_S: #1
+ {
+ \peek_meaning:NT \__siunitx_table_skip:n
+ {
+ \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl
+ { \box_set_wd:Nn \l__nicematrix_cell_box \c_zero_dim }
+ }
+ #1
+ }
\cs_new_protected:Npn \__nicematrix_center_cell_box:
{
\tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl
@@ -2173,7 +2272,9 @@
{
\str_set:Nn \l__nicematrix_vpos_col_str { p }
\str_set:Nn \l__nicematrix_hpos_col_str { j }
- \keys_set:nn { WithArrows / p-column } { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_replace_all:Nnn \l_tmpa_tl { \__nicematrix_S: } { S }
+ \__nicematrix_keys_p_column:V \l_tmpa_tl
\bool_if:NTF \c__nicematrix_varwidth_loaded_bool
{ \__nicematrix_patch_preamble_iv_iv:nn { #2 } { varwidth } }
{
@@ -2183,6 +2284,8 @@
}
\cs_new_protected:Npn \__nicematrix_patch_preamble_vi:nnnn #1 #2 #3 #4
{
+ \tl_gput_right:NV \g__nicematrix_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{
> {
@@ -2194,9 +2297,9 @@
c
< {
\__nicematrix_cell_end:
- #1
\hbox_set_end:
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
+ #1
\__nicematrix_adjust_size_box:
\makebox [ #4 ] [ #3 ] { \box_use_drop:N \l__nicematrix_cell_box }
}
@@ -2204,6 +2307,14 @@
\int_gincr:N \c@jCol
\__nicematrix_patch_preamble_xi:n
}
+\cs_new_protected:Npn \__nicematrix_special_W:
+ {
+ \dim_compare:nNnT
+ { \box_wd:N \l__nicematrix_cell_box }
+ >
+ \l__nicematrix_col_width_dim
+ { \__nicematrix_warning:n { W~warning } }
+ }
\cs_new_protected:Npn \__nicematrix_patch_preamble_vii:n #1
{
\str_if_eq:nnTF { #1 } { [ }
@@ -2216,6 +2327,8 @@
{
\cs_if_exist:NTF \siunitx_cell_begin:w
{
+ \tl_gput_right:NV \g__nicematrix_preamble_tl \g__nicematrix_pre_cell_tl
+ \tl_gclear:N \g__nicematrix_pre_cell_tl
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{
> {
@@ -2251,7 +2364,7 @@
}
\cs_new_protected:Npn \__nicematrix_patch_preamble_viii_i:nn #1 #2
{
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_eval:n { \c@jCol + 1 } } \c_true_bool }
\tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
{
@@ -2272,7 +2385,7 @@
{ \tl_gset:Nn \g__nicematrix_right_delim_tl { #1 } }
{
\tl_gput_right:Nn \g__nicematrix_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\__nicematrix_patch_preamble:n #2
}
@@ -2280,7 +2393,7 @@
{
\tl_if_in:nnT { ( [ \{ } { #2 }
{ \tl_gput_right:Nn \g__nicematrix_preamble_tl { ! { \enskip } } }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\__nicematrix_patch_preamble:n #2
}
@@ -2293,19 +2406,19 @@
\str_if_eq:VnTF \g__nicematrix_right_delim_tl { . }
{
\tl_gput_right:Nn \g__nicematrix_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\tl_gset:Nn \g__nicematrix_right_delim_tl { #2 }
}
{
\tl_gput_right:Nn \g__nicematrix_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\__nicematrix_error:nn { double~closing~delimiter } { #2 }
}
}
{
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{ \__nicematrix_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
\__nicematrix_error:nn { double~closing~delimiter } { #2 }
\__nicematrix_patch_preamble:n #3
@@ -2327,7 +2440,10 @@
\tl_set:Nn \l__nicematrix_vpos_col_str { p }
\int_zero_new:N \l__nicematrix_weight_int
\int_set:Nn \l__nicematrix_weight_int { 1 }
- \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_replace_all:Nnn \l_tmpa_tl { \__nicematrix_S: } { S }
+ \__nicematrix_keys_p_column:V \l_tmpa_tl
+ % \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl
\keys_set:nV { WithArrows / X-column } \l_tmpa_tl
\int_compare:nNnT \l__nicematrix_weight_int < 0
{
@@ -2389,18 +2505,24 @@
}
\cs_new_protected:Npn \__nicematrix_set_preamble:Nn #1 #2
{
+ \group_begin:
+ \__nicematrix_newcolumntype w [ 2 ] { \__nicematrix_w: { ##1 } { ##2 } }
+ \__nicematrix_newcolumntype W [ 2 ] { \__nicematrix_W: { ##1 } { ##2 } }
\@temptokena { #2 }
\@tempswatrue
\@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
\tl_gclear:N \g__nicematrix_preamble_tl
\exp_after:wN \__nicematrix_patch_m_preamble:n \the \@temptokena \q_stop
- \tl_set_eq:NN #1 \g__nicematrix_preamble_tl
+ \tl_gset_eq:NN #1 \g__nicematrix_preamble_tl
+ \group_end:
}
\cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3
{
\multispan { #1 }
\begingroup
\cs_set:Npn \@addamp { \if@firstamp \@firstampfalse \else \@preamerr 5 \fi }
+ \__nicematrix_newcolumntype w [ 2 ] { \__nicematrix_w: { ##1 } { ##2 } }
+ \__nicematrix_newcolumntype W [ 2 ] { \__nicematrix_W: { ##1 } { ##2 } }
\@temptokena = { #2 }
\@tempswatrue
\@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
@@ -2454,8 +2576,8 @@
p { \__nicematrix_patch_m_preamble_iv:nnn t #1 }
m { \__nicematrix_patch_m_preamble_iv:nnn c #1 }
b { \__nicematrix_patch_m_preamble_iv:nnn b #1 }
- \__nicematrix_w: { \__nicematrix_patch_m_preamble_v:nnnn { } #1 }
- \__nicematrix_W: { \__nicematrix_patch_m_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
+ \__nicematrix_w: { \__nicematrix_patch_m_preamble_v:nnnn { } #1 }
+ \__nicematrix_W: { \__nicematrix_patch_m_preamble_v:nnnn { \__nicematrix_special_W: } #1 }
\q_stop { }
}
{ \__nicematrix_fatal:nn { unknown~column~type } { #1 } }
@@ -2505,6 +2627,7 @@
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{
> {
+ \dim_set:Nn \l__nicematrix_col_width_dim { #4 }
\hbox_set:Nw \l__nicematrix_cell_box
\__nicematrix_cell_begin:w
\str_set:Nn \l__nicematrix_hpos_cell_str { #3 }
@@ -2512,9 +2635,9 @@
c
< {
\__nicematrix_cell_end:
- #1
\hbox_set_end:
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
+ #1
\__nicematrix_adjust_size_box:
\makebox [ #4 ] [ #3 ] { \box_use_drop:N \l__nicematrix_cell_box }
}
@@ -2618,7 +2741,7 @@
{
{ ! \seq_if_empty_p:N \g__nicematrix_notes_seq }
{ ! \seq_if_empty_p:N \g__nicematrix_notes_in_caption_seq }
- { ! \tl_if_empty_p:V \l__nicematrix_tabularnote_tl }
+ { ! \tl_if_empty_p:V \g__nicematrix_tabularnote_tl }
}
\__nicematrix_insert_tabularnotes:
\cs_set_eq:NN \tabularnote \__nicematrix_tabularnote_error:n
@@ -2658,7 +2781,11 @@
\skip_vertical:N 0.65ex
\group_begin:
\l__nicematrix_notes_code_before_tl
- \tl_if_empty:NF \l__nicematrix_tabularnote_tl { \l__nicematrix_tabularnote_tl \par }
+ \tl_if_empty:NF \g__nicematrix_tabularnote_tl
+ {
+ \g__nicematrix_tabularnote_tl \par
+ \tl_gclear:N \g__nicematrix_tabularnote_tl
+ }
\int_compare:nNnT \c@tabularnote > 0
{
\bool_if:NTF \l__nicematrix_notes_para_bool
@@ -3235,6 +3362,17 @@
\tl_if_empty:NT \l__nicematrix_caption_tl
{ \__nicematrix_error_or_warning:n { label~without~caption } }
}
+ \NewDocumentEnvironment { TabularNote } { b }
+ {
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
+ { \__nicematrix_error_or_warning:n { TabularNote~in~CodeAfter } }
+ {
+ \tl_if_empty:NF \g__nicematrix_taublarnote_tl
+ { \tl_gput_right:Nn \g__nicematrix_tabularnote_tl { \par } }
+ \tl_gput_right:Nn \g__nicematrix_tabularnote_tl { ##1 }
+ }
+ }
+ { }
\bool_set_true:N \l__nicematrix_NiceTabular_bool
\NiceArray { #2 }
}
@@ -3384,24 +3522,34 @@
\cs_set_eq:NN \OverBrace \__nicematrix_OverBrace
\cs_set_eq:NN \ShowCellNames \__nicematrix_ShowCellNames
\cs_set_eq:NN \line \__nicematrix_line
- \g__nicematrix_internal_code_after_tl
- \tl_gclear:N \g__nicematrix_internal_code_after_tl
+ \g__nicematrix_pre_code_after_tl
+ \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 }
+ \bool_set_true:N \l__nicematrix_in_code_after_bool
\exp_last_unbraced:NV \__nicematrix_CodeAfter_keys: \g_nicematrix_code_after_tl
\scan_stop:
\tl_gclear:N \g_nicematrix_code_after_tl
\group_end:
+ \tl_if_empty:NF \g__nicematrix_pre_code_before_tl
+ {
+ \tl_gput_right:Nx \g__nicematrix_aux_tl
+ {
+ \tl_gset:Nn \exp_not:N \g__nicematrix_pre_code_before_tl
+ { \exp_not:V \g__nicematrix_pre_code_before_tl }
+ }
+ \tl_gclear:N \g__nicematrix_pre_code_before_tl
+ }
\tl_if_empty:NF \g_nicematrix_code_before_tl
{
- \cs_set_protected:Npn \rectanglecolor { }
- \cs_set_protected:Npn \columncolor { }
\tl_gput_right:Nx \g__nicematrix_aux_tl
{
\tl_gset:Nn \exp_not:N \g__nicematrix_code_before_tl
{ \exp_not:V \g_nicematrix_code_before_tl }
}
- \bool_set_true:N \l__nicematrix_code_before_bool
+ \tl_gclear:N \g_nicematrix_code_before_tl
}
\str_gclear:N \g__nicematrix_name_env_str
\__nicematrix_restore_iRow_jCol:
@@ -4612,12 +4760,13 @@
\NewDocumentCommand \__nicematrix_RowStyle:n { O { } m }
{
\group_begin:
+ \tl_clear:N \l_tmpa_tl % value of \rowcolor
\tl_clear:N \l__nicematrix_color_tl
\int_set:Nn \l__nicematrix_key_nb_rows_int 1
\keys_set:nn { NiceMatrix / RowStyle } { #1 }
\tl_if_empty:NF \l_tmpa_tl
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
\__nicematrix_exp_color_arg:NV \__nicematrix_rectanglecolor \l_tmpa_tl
{ \int_use:N \c@iRow - \int_use:N \c@jCol }
@@ -4625,7 +4774,7 @@
}
\int_compare:nNnT \l__nicematrix_key_nb_rows_int > 1
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
\__nicematrix_exp_color_arg:NV \__nicematrix_rowcolor \l_tmpa_tl
{
@@ -4690,8 +4839,11 @@
\cs_new_protected:Npn \__nicematrix_add_to_colors_seq:nn #1 #2
{
\int_zero:N \l_tmpa_int
- \seq_map_indexed_inline:Nn \g__nicematrix_colors_seq
- { \tl_if_eq:nnT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } }
+ \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 } } }
+ }
\int_compare:nNnTF \l_tmpa_int = \c_zero_int
{
\seq_gput_right:Nn \g__nicematrix_colors_seq { #1 }
@@ -4983,32 +5135,28 @@
}
\NewDocumentCommand \__nicematrix_cellcolor_tabular { O { } m }
{
- \peek_remove_spaces:n
+ \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
- {
- \__nicematrix_cellcolor [ #1 ] { \exp_not:n { #2 } }
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- }
+ \__nicematrix_cellcolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
}
+ \ignorespaces
}
\NewDocumentCommand \__nicematrix_rowcolor_tabular { O { } m }
{
- \peek_remove_spaces:n
+ \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
- {
- \__nicematrix_rectanglecolor [ #1 ] { \exp_not:n { #2 } }
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- { \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
- }
+ \__nicematrix_rectanglecolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ { \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
}
+ \ignorespaces
}
\NewDocumentCommand \__nicematrix_columncolor_preamble { O { } m }
{
\int_compare:nNnT \c@jCol > \g__nicematrix_col_total_int
{
- \tl_gput_left:Nx \g_nicematrix_code_before_tl
+ \tl_gput_left:Nx \g__nicematrix_pre_code_before_tl
{
\exp_not:N \columncolor [ #1 ]
{ \exp_not:n { #2 } } { \int_use:N \c@jCol }
@@ -5477,7 +5625,7 @@
{
\__nicematrix_compute_rule_width:n { multiplicity = #1 , #2 }
\skip_vertical:n { \l__nicematrix_rule_width_dim }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_hline:n
{
@@ -5597,7 +5745,7 @@
{
\__nicematrix_compute_rule_width:n { #1 }
\skip_vertical:n { \l__nicematrix_rule_width_dim }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_hline:n
{
@@ -5633,7 +5781,7 @@
\str_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_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_hline:n
{
@@ -5673,7 +5821,7 @@
\__nicematrix_compute_rule_width:n { #1 }
\tl_gput_right:Nx \g__nicematrix_preamble_tl
{ \exp_not:N ! { \skip_horizontal:n { \dim_use:N \l__nicematrix_rule_width_dim } } }
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_vline:n
{
@@ -5711,8 +5859,10 @@
{
\bool_lazy_all:nT
{
- { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
- { \int_compare_p:nNn \l_tmpa_tl < { #3 + 2 } }
+ {
+ ( \int_compare_p:nNn \l_tmpa_tl = { #1 } )
+ || ( \int_compare_p:nNn \l_tmpa_tl = { #3 + 1 } )
+ }
{ \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
{ \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
}
@@ -5724,8 +5874,10 @@
{
{ \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
{ \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
- { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
- { \int_compare_p:nNn \l_tmpb_tl < { #4 + 2 } }
+ {
+ ( \int_compare_p:nNn \l_tmpb_tl = { #2 } )
+ || ( \int_compare_p:nNn \l_tmpb_tl = { #4 + 1 } )
+ }
}
{ \bool_gset_false:N \g_tmpa_bool }
}
@@ -6152,7 +6304,7 @@
\int_gincr:N \g__nicematrix_block_box_int
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_actually_diagbox:nnnnnn
{ \int_use:N \c@iRow }
@@ -6276,31 +6428,34 @@
{
\l_tmpa_tl
{ \exp_not:n { #3 } }
- \exp_not:n
- {
+ {
+ \bool_if:NTF \l__nicematrix_NiceTabular_bool
{
- \bool_if:NTF \l__nicematrix_NiceTabular_bool
+ \group_begin:
+ \bool_if:NF \l__nicematrix_respect_arraystretch_bool
+ { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+ \exp_not:n
{
- \group_begin:
- \bool_if:NF \l__nicematrix_respect_arraystretch_bool
- { \cs_set:Npn \arraystretch { 1 } }
\dim_zero:N \extrarowheight
#4
- \bool_if:NT \g__nicematrix_rotate_bool
- { \str_set:Nn \l__nicematrix_hpos_block_str c }
- \use:x
- {
- \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_of_block_tl ]
- { @ { } \l__nicematrix_hpos_block_str @ { } }
- }
- #5
- \end { tabular }
- \group_end:
+ \bool_if:NT \g__nicematrix_rotate_bool
+ { \str_set:Nn \l__nicematrix_hpos_block_str c }
+ \use:x
+ {
+ \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_of_block_tl ]
+ { @ { } \l__nicematrix_hpos_block_str @ { } }
+ }
+ #5
+ \end { tabular }
}
+ \group_end:
+ }
+ {
+ \group_begin:
+ \bool_if:NF \l__nicematrix_respect_arraystretch_bool
+ { \cs_set:Npn \exp_not:N \arraystretch { 1 } }
+ \exp_not:n
{
- \group_begin:
- \bool_if:NF \l__nicematrix_respect_arraystretch_bool
- { \cs_set:Npn \arraystretch { 1 } }
\dim_zero:N \extrarowheight
#4
\bool_if:NT \g__nicematrix_rotate_bool
@@ -6314,10 +6469,10 @@
#5
\end { array }
\c_math_toggle_token
- \group_end:
}
+ \group_end:
}
- }
+ }
}
}
\keys_define:nn { NiceMatrix / Block / SecondPass }
@@ -6373,6 +6528,9 @@
v-center .bool_set:N = \l__nicematrix_v_center_bool ,
v-center .default:n = true ,
v-center .initial:n = false ,
+ transparent .bool_set:N = \l__nicematrix_transparent_bool ,
+ transparent .default:n = true ,
+ transparent .initial:n = false ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~Block }
}
\cs_new_protected:Npn \__nicematrix_draw_blocks:
@@ -6439,8 +6597,11 @@
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
}
- \bool_if:nT
- { ! \l__nicematrix_vlines_block_bool && ! \l__nicematrix_hlines_block_bool }
+ \bool_if:nF
+ {
+ \l__nicematrix_transparent_bool
+ || ( \l__nicematrix_vlines_block_bool && \l__nicematrix_hlines_block_bool )
+ }
{
\seq_gput_left:Nx \g__nicematrix_pos_of_blocks_seq
{ { #1 } { #2 } { #3 } { #4 } { \l__nicematrix_block_name_str } }
@@ -6473,7 +6634,7 @@
}
\tl_if_empty:NF \l__nicematrix_fill_tl
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl
{
\exp_not:N \roundedrectanglecolor
\exp_args:NV \tl_if_head_eq_meaning:nNTF \l__nicematrix_fill_tl [
@@ -6498,7 +6659,7 @@
}
\cs_set_protected_nopar:Npn \diagbox ##1 ##2
{
- \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_actually_diagbox:nnnnnn
{ #1 }
@@ -6714,7 +6875,9 @@
{ \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim }
{ \pgfpoint \l__nicematrix_tmpd_dim \l_tmpa_dim }
\pgfsetlinewidth { 1.1 \l__nicematrix_line_width_dim }
- \pgfusepath { stroke }
+ \dim_compare:nNnTF \l__nicematrix_rounded_corners_dim = \c_zero_dim
+ { \pgfusepathqstroke }
+ { \pgfusepath { stroke } }
}
\endpgfpicture
\group_end:
@@ -6746,7 +6909,8 @@
{
position = ##1 ,
start = \l__nicematrix_tmpc_tl ,
- end = \int_eval:n { \l_tmpa_tl - 1 }
+ end = \int_eval:n { \l_tmpa_tl - 1 } ,
+ total-width = \dim_use:N \l__nicematrix_line_width_dim % added 2022-08-06
}
}
}
@@ -6770,7 +6934,7 @@
position = ##1 ,
start = \l__nicematrix_tmpd_tl ,
end = \int_eval:n { \l_tmpb_tl - 1 } ,
- total-width = \arrayrulewidth
+ total-width = \dim_use:N \l__nicematrix_line_width_dim % added 2022-08-06
}
}
}
@@ -6913,7 +7077,13 @@
columns-type .value_required:n = true ,
l .meta:n = { columns-type = l } ,
r .meta:n = { columns-type = r } ,
- c .meta:n = { columns-type = c }
+ c .meta:n = { columns-type = c } ,
+ delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool ,
+ delimiters / max-width .default:n = true ,
+ delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
}
\NewDocumentCommand \AutoNiceMatrixWithDelims
{ m m O { } > { \SplitArgument { 1 } { - } } m O { } m ! O { } }
@@ -6986,7 +7156,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_internal_code_after_tl
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
{
\__nicematrix_actually_diagbox:nnnnnn
{ \int_use:N \c@iRow }
@@ -7190,19 +7360,31 @@
}
{ \__nicematrix_error:n { Invalid~name } }
} ,
+ name .value_required:n = true ,
rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } ,
rules .value_required:n = true ,
code .tl_set:N = \l__nicematrix_code_tl ,
code .value_required:n = true ,
- name .value_required:n = true ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~SubMatrix }
}
\NewDocumentCommand \__nicematrix_SubMatrix_in_code_before { m m m m ! O { } }
{
\peek_remove_spaces:n
{
- \tl_gput_right:Nn \g__nicematrix_internal_code_after_tl
- { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] }
+ \tl_gput_right:Nx \g__nicematrix_pre_code_after_tl
+ {
+ \SubMatrix { #1 } { #2 } { #3 } { #4 }
+ [
+ delimiters / color = \l__nicematrix_delimiters_color_tl ,
+ hlines = \l__nicematrix_submatrix_hlines_clist ,
+ vlines = \l__nicematrix_submatrix_vlines_clist ,
+ extra-height = \dim_use:N \l__nicematrix_submatrix_extra_height_dim ,
+ left-xshift = \dim_use:N \l__nicematrix_submatrix_left_xshift_dim ,
+ right-xshift = \dim_use:N \l__nicematrix_submatrix_right_xshift_dim ,
+ slim = \bool_to_str:N \l__nicematrix_submatrix_slim_bool ,
+ #5
+ ]
+ }
\__nicematrix_SubMatrix_in_code_before_i { #2 } { #3 }
}
}
@@ -7559,9 +7741,9 @@
{ \__nicematrix_error:nn { Construct~too~large } { \OverBrace } }
}
{
- \tl_clear:N \l_tmpa_tl % added the 2022-02-25
+ \tl_clear:N \l_tmpa_tl
\keys_set:nn { NiceMatrix / Brace } { #4 }
- \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } } % added the 2022-02-25
+ \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } }
\pgfpicture
\pgfrememberpicturepositiononpagetrue
\pgf@relevantforpicturesizefalse
@@ -7691,7 +7873,7 @@
{ }
{ }
}
-\NewDocumentCommand \__nicematrix_ShowCellNames { }
+\NewDocumentCommand \__nicematrix_ShowCellNames_CodeBefore { }
{
\dim_zero_new:N \g__nicematrix_tmpc_dim
\dim_zero_new:N \g__nicematrix_tmpd_dim
@@ -7704,6 +7886,7 @@
\__nicematrix_qpoint:n { row - \int_eval:n { ##1 + 1 } }
\dim_gset:Nn \g_tmpa_dim { ( \l_tmpa_dim + \pgf@y ) / 2 }
\dim_gset:Nn \g_tmpb_dim { \l_tmpa_dim - \pgf@y }
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
\end { pgfpicture }
\int_step_inline:nn \c@jCol
{
@@ -7715,6 +7898,7 @@
\__nicematrix_qpoint:n { col - \int_eval:n { ####1 + 1 } }
\dim_gset:Nn \g__nicematrix_tmpd_dim { \pgf@x - \g__nicematrix_tmpc_dim }
\dim_gset_eq:NN \g__nicematrix_tmpe_dim \pgf@x
+ \endpgfpicture
\end { pgfpicture }
\fp_set:Nn \l_tmpa_fp
{
@@ -7746,6 +7930,96 @@
}
}
}
+\NewDocumentCommand \__nicematrix_ShowCellNames { }
+ {
+ \bool_if:NT \l__nicematrix_in_code_after_bool
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \pgfpathrectanglecorners
+ { \__nicematrix_qpoint:n { 1 } }
+ { \__nicematrix_qpoint:n { \int_eval:n { \c@iRow + 1 } } }
+ \pgfsetfillopacity { 0.75 }
+ \pgfsetfillcolor { white }
+ \pgfusepathqfill
+ \endpgfpicture
+ }
+ \dim_zero_new:N \g__nicematrix_tmpc_dim
+ \dim_zero_new:N \g__nicematrix_tmpd_dim
+ \dim_zero_new:N \g__nicematrix_tmpe_dim
+ \int_step_inline:nn \c@iRow
+ {
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ }
+ { \begin { pgfpicture } }
+ \__nicematrix_qpoint:n { row - ##1 }
+ \dim_set_eq:NN \l_tmpa_dim \pgf@y
+ \__nicematrix_qpoint:n { row - \int_eval:n { ##1 + 1 } }
+ \dim_gset:Nn \g_tmpa_dim { ( \l_tmpa_dim + \pgf@y ) / 2 }
+ \dim_gset:Nn \g_tmpb_dim { \l_tmpa_dim - \pgf@y }
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
+ { \endpgfpicture }
+ { \end { pgfpicture } }
+ \int_step_inline:nn \c@jCol
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \normalfont \Large \sffamily \bfseries
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
+ { \color { red } }
+ { \color { red ! 50 } }
+ ##1 - ####1
+ }
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ }
+ { \begin { pgfpicture } }
+ \__nicematrix_qpoint:n { col - ####1 }
+ \dim_gset_eq:NN \g__nicematrix_tmpc_dim \pgf@x
+ \__nicematrix_qpoint:n { col - \int_eval:n { ####1 + 1 } }
+ \dim_gset:Nn \g__nicematrix_tmpd_dim { \pgf@x - \g__nicematrix_tmpc_dim }
+ \dim_gset_eq:NN \g__nicematrix_tmpe_dim \pgf@x
+ \bool_if:NTF \l__nicematrix_in_code_after_bool
+ { \endpgfpicture }
+ { \end { pgfpicture } }
+ \fp_set:Nn \l_tmpa_fp
+ {
+ \fp_min:nn
+ {
+ \fp_min:nn
+ { \dim_ratio:nn { \g__nicematrix_tmpd_dim } { \box_wd:N \l_tmpa_box } }
+ { \dim_ratio:nn { \g_tmpb_dim } { \box_ht_plus_dp:N \l_tmpa_box } }
+ }
+ { 1.0 }
+ }
+ \box_scale:Nnn \l_tmpa_box { \fp_use:N \l_tmpa_fp } { \fp_use:N \l_tmpa_fp }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \pgftransformshift
+ {
+ \pgfpoint
+ { 0.5 * ( \g__nicematrix_tmpc_dim + \g__nicematrix_tmpe_dim ) }
+ { \dim_use:N \g_tmpa_dim }
+ }
+ \pgfnode
+ { rectangle }
+ { center }
+ { \box_use:N \l_tmpa_box }
+ { }
+ { }
+ \endpgfpicture
+ }
+ }
+ }
\bool_new:N \c__nicematrix_footnotehyper_bool
\bool_new:N \c__nicematrix_footnote_bool
\msg_new:nnnn { nicematrix } { Unknown~key~for~package }
@@ -7873,7 +8147,7 @@
\__nicematrix_msg_new:nn { too~much~cols~for~matrix~with~last~col }
{
Too~much~columns.\\
- In~the~row~\int_eval:n { \c@jCol - 1 },~
+ In~the~row~\int_eval:n { \c@iRow - 1 },~
you~try~to~use~more~columns~
than~allowed~by~your~\__nicematrix_full_name_env:.\__nicematrix_message_hdotsfor:\
The~maximal~number~of~columns~is~\int_eval:n { \l__nicematrix_last_col_int - 1 }~
@@ -8028,6 +8302,11 @@
You~can't~use~the~key~'label'~in~your~'{NiceTabular}'~because~
you~have~not~used~the~key~'caption'.~The~key~'label'~will~be~ignored.
}
+\__nicematrix_msg_new:nn { W~warning }
+ {
+ Line~\msg_line_number:.~The~cell~is~too~wide~for~your~column~'W'~
+ (row~\int_use:N \c@iRow).
+ }
\__nicematrix_msg_new:nn { Construct~too~large }
{
Construct~too~large.\\
@@ -8061,6 +8340,7 @@
Incompatible~keys.\\
You~can't~use~the~keys~'hlines',~'vlines'~or~'hvlines'~for~a~
'\token_to_str:N \Block'~when~the~key~'color'~or~'draw'~is~used.\\
+ Maybe~it~will~possible~in~future~version.\\
Your~key~will~be~discarded.
}
\__nicematrix_msg_new:nn { bad~value~for~baseline }
@@ -8072,6 +8352,12 @@
the~form~'line-i'.\\
A~value~of~1~will~be~used.
}
+\__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:V
+ \l_keys_key_str'~will~be~used~instead.
+ }
\__nicematrix_msg_new:nn { Invalid~name }
{
Invalid~name.\\
@@ -8205,7 +8491,7 @@
{
Tikz~not~loaded.\\
You~can't~use~the~key~'tikz'~for~the~command~'\token_to_str:N
- \Block'~because~you~have~not~loaded~Tikz.~
+ \Block'~because~you~have~not~loaded~tikz.~
This~key~will~be~ignored.
}
\__nicematrix_msg_new:nn { last-col~non~empty~for~NiceArray }
@@ -8252,8 +8538,10 @@
{
Forbidden~command.\\
You~can't~use~the~command~\token_to_str:N\tabularnote\
- ~in~a~\__nicematrix_full_name_env:.~This~command~is~available~only~in~
- \{NiceTabular\},~\{NiceArray\}~and~\{NiceMatrix\}. \\
+ ~here.~This~command~is~available~only~in~
+ \{NiceTabular\},~\{NiceTabular*\}~and~\{NiceTabularX\}~or~in~
+ the~argument~of~a~command~\token_to_str:N \caption\ included~
+ in~an~environment~{table}. \\
This~command~will~be~ignored.
}
\__nicematrix_msg_new:nn { borders~forbidden }
@@ -8283,7 +8571,7 @@
{
Tikz~not~loaded.\\
You~have~used~the~key~'tikz'~in~the~definition~of~a~
- customized~line~(with~'custom-line')~but~Tikz~is~not~loaded.~
+ customized~line~(with~'custom-line')~but~tikz~is~not~loaded.~
You~can~go~on~but~you~will~have~another~error~if~you~actually~
use~that~custom~line.
}
@@ -8291,7 +8579,7 @@
{
Tikz~not~loaded.\\
You~have~used~the~key~'tikz'~in~a~key~'borders'~(of~a~
- command~'\token_to_str:N\Block')~but~Tikz~is~not~loaded.~
+ command~'\token_to_str:N\Block')~but~tikz~is~not~loaded.~
That~key~will~be~ignored.
}
\__nicematrix_msg_new:nn { color~in~custom-line~with~tikz }
@@ -8329,6 +8617,13 @@
The~value~of~key~'\l_keys_key_str'~must~be~of~length~1.\\
It~will~be~ignored.
}
+\__nicematrix_msg_new:nn { TabularNote~in~CodeAfter }
+ {
+ Environment~{TabularNote}~forbidden.\\
+ You~must~use~{TabularNote}~at~the~end~of~your~{NiceTabular}~
+ but~*before*~the~\token_to_str:N \CodeAfter.\\
+ This~environment~{TabularNote}~will~be~ignored.
+ }
\__nicematrix_msg_new:nn { varwidth~not~loaded }
{
varwidth~not~loaded.\\
@@ -8361,7 +8656,7 @@
{
The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~
hlines,~hvlines,~l,~line-width,~name,~rounded-corners,~r,~respect-arraystretch,
- ~t,~tikz~and~vlines.
+ ~t,~tikz,~transparent~and~vlines.
}
\__nicematrix_msg_new:nn { Version~of~siunitx~too~old }
{
@@ -8399,6 +8694,19 @@
and~xdots~(several~subkeys).~
The~latter~is~for~the~command~\token_to_str:N \line.
}
+\__nicematrix_msg_new:nnn { Unknown~key~for~CodeBefore }
+ {
+ Unknown~key.\\
+ The~key~'\l_keys_key_str'~is~unknown.\\
+ It~will~be~ignored. \\
+ \c__nicematrix_available_keys_str
+ }
+ {
+ The~available~keys~are~(in~alphabetic~order):~
+ create-cell-nodes,~
+ delimiters/color~and~
+ sub-matrix~(several~subkeys).
+ }
\__nicematrix_msg_new:nnn { Unknown~key~for~SubMatrix }
{
Unknown~key.\\
@@ -8501,7 +8809,7 @@
right-margin,~
rules~(with~the~subkeys~'color'~and~'width'),~
small,~
- sub-matrix~(several~subkeys),
+ sub-matrix~(several~subkeys),~
vlines,~
xdots~(several~subkeys).
}
@@ -8532,7 +8840,6 @@
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
- delimiters/color,~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -8544,8 +8851,6 @@
left-margin,~
light-syntax,~
name,~
- notes/bottomrule,~
- notes/para,~
nullify-dots,~
renew-dots,~
respect-arraystretch,~
@@ -8589,7 +8894,6 @@
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
- delimiters~(several~subkeys),~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -8658,8 +8962,7 @@
left-margin,~
light-syntax,~
name,~
- notes/bottomrule,~
- notes/para,~
+ notes~(several~subkeys),~
nullify-dots,~
renew-dots,~
respect-arraystretch,~