summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-04-20 03:01:20 +0000
committerNorbert Preining <norbert@preining.info>2023-04-20 03:01:20 +0000
commit4753a39245d0925a73cb20409999377eb9d2fd66 (patch)
tree2e19e9f381b805bc9ab96da2f6c3e733d7689e09 /macros/latex/contrib/nicematrix
parent10bb4d468226c290e5e87e3fa367dc6fd2dcb84b (diff)
CTAN sync 202304200301
Diffstat (limited to 'macros/latex/contrib/nicematrix')
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin551953 -> 553017 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex292
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx581
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1364573 -> 1380299 bytes
4 files changed, 609 insertions, 264 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index a054c4fadf..efad4b58ef 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex
index 4ec05bce2c..920c184433 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.tex
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex
@@ -20,7 +20,7 @@
% 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
+% en gris
\usepackage{shortvrb}
\MakeShortVerb{\|}
@@ -63,6 +63,12 @@
\setlength{\parindent}{0pt}
\skip \footins = 2 \bigskipamount
+
+\NewDocumentCommand{\Definition}{m}
+ {{\setlength{\fboxsep}{1pt}\colorbox{gray!20}{\ttfamily \vphantom{gl}#1}}}
+
+
+
\begin{document}
\VerbatimFootnotes
@@ -488,9 +494,6 @@ $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin]
0 & \Cdots& 0 & 0
\end{bNiceArray}$
-\NewDocumentCommand{\Definition}{m}
- {{\setlength{\fboxsep}{1pt}\colorbox{gray!20}{\ttfamily \vphantom{gl}#1}}}
-
\interitem
La commande |\Block| accepte en premier argument optionnel (entre crochets) une
@@ -809,7 +812,6 @@ Rang & \Block[C]{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\
\subsection{Positionnement vertical du contenu des blocs}
-\colorbox{yellow!50}{\textbf{Nouveau 6.14}}
Concernant le positionnement vertical, la commande |\Block| admet les clés
|v-center|\footnote{Cette clé ne peut être nommée \texttt{c} car la clé
@@ -827,11 +829,13 @@ ligne de base de la première rangée concernée par le bloc.
|\\|) est alignée avec la ligne de base de la dernière des rangées du tableau
impliquées dans le bloc.
-\item Avec la clé |T|, le contenu du bloc est calé vers le haut (avec une marge
-égale au paramètre |inner ysep| de PGF/Tikz --- que l'on peut régler avec |\pgfset|).
+\item Avec la clé |T|, le contenu du bloc est calé vers le haut.
+
+\colorbox{yellow!50}{Modification 6.18}\enskip Il n'y a plus de marge verticale.
+Néanmoins, le contenu du bloc est (toujours) composé en interne dans une |{minipage}|, un
+|{tabular}| ou un |{array}|, ce qui fait qu'il y souvent déjà une marge.
-\item Avec la clé |B|, le contenu du bloc est calé vers le bas (avec une marge
-égale au paramètre |inner ysep| de PGF/Tikz).
+\item Avec la clé |B|, le contenu du bloc est calé vers le bas.
\end{itemize}
Quand aucune clé n'est donnée, c'est la clé |v-center| qui s'applique (sauf pour
@@ -850,19 +854,19 @@ les blocs mono-rangée).
\begin{BVerbatim}[baseline=c,boxwidth=10cm]
\begin{NiceTabular}{ccc}
\Block[fill=red!10,~emphase#t@,l]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
\end{BVerbatim}
\begin{NiceTabular}{ccc}
\Block[fill=red!10,t,l]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
@@ -871,19 +875,19 @@ text & text \\
\begin{BVerbatim}[baseline=c,boxwidth=10cm]
\begin{NiceTabular}{ccc}
\Block[fill=red!10,~emphase#b@,r]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
\end{BVerbatim}
\begin{NiceTabular}{ccc}
\Block[fill=red!10,b,r]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
@@ -891,19 +895,19 @@ text & text \\
\begin{BVerbatim}[baseline=c,boxwidth=10cm]
\begin{NiceTabular}{ccc}
\Block[fill=red!10,~emphase#T@,l]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
\end{BVerbatim}
\begin{NiceTabular}{ccc}
\Block[fill=red!10,T,l]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
@@ -912,19 +916,19 @@ text & text \\
\begin{BVerbatim}[baseline=c,boxwidth=10cm]
\begin{NiceTabular}{ccc}
\Block[fill=red!10,~emphase#B@,r]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
\end{BVerbatim}
\begin{NiceTabular}{ccc}
\Block[fill=red!10,B,r]{4-2}{two\\lines}
- & & \Huge first\\
- & & second \\
- & & third \\
- & & fourth \\
+ & & \Huge Un\\
+ & & deux \\
+ & & trois \\
+ & & \Huge quatre \\
text & text \\
\end{NiceTabular}
@@ -1207,6 +1211,12 @@ arum & iris & jacinthe & muguet
\end{NiceTabular}
\end{center}
+\medskip
+On remarquera que quand la clé |rounded-corners| est utilisée pour
+l'environnement |{NiceTabular}|, la clé |hvlines| trace des coins
+arrondis pour le tableau : cf. partie~\ref{tabular-rounded-corners},
+p.~\pageref{tabular-rounded-corners}.
+
\medskip
La clé |hvlines-except-borders| est similaire à la clé |hvlines| mais ne trace
@@ -1260,9 +1270,12 @@ A & A & A & A & A & A \\
\medskip
-Quand la clé |corners| est utilisée, \pkg{nicematrix} calcule les coins vides et
-ces coins sont alors pris en compte par les outils de tracés de filets (les
-filets ne seront pas tracés dans ces coins vides).
+Quand la clé |corners|\footnote{La clé \texttt{corners} dont on parle là
+ n'a pas de rapport direct avec la clé \texttt{rounded-corners},
+ décrite dans la partie \ref{tabular-rounded-corners},
+ p.~\pageref{tabular-rounded-corners}.} est utilisée, \pkg{nicematrix} calcule
+les coins vides et ces coins sont alors pris en compte par les outils de tracés
+de filets (les filets ne seront pas tracés dans ces coins vides).
\medskip
\begin{BVerbatim}[boxwidth=11cm,baseline=c]
@@ -1319,7 +1332,7 @@ doivent être séparés par des virgules).
\end{NiceTabular}
-\medskip
+\bigskip
$\triangleright$ Les coins sont également pris en compte par les outils de
coloriage dans le |\CodeBefore|. Ces outils ne colorient pas les cases qui sont
dans les coins (cf.~p.~\pageref{color-in-code-before}).
@@ -1664,21 +1677,37 @@ De nouvelles commandes sont disponibles dans ce |\CodeBefore|: |\cellcolor|,
p.~\pageref{nodes-i}.}
\label{code-before}
-\medskip
-Toutes ces commandes acceptent un argument optionnel (entre crochets et en
-première position) qui est le modèle colorimétrique pour la spécification des
-couleurs.
\medskip
Ces commandes ne colorient pas les cases qui se trouvent dans les «coins» si la
clé |corners| a été utilisée. La description de cette clé a été faite
p.~\pageref{corners}.
+\medskip
+Ces commandes respectent les coins arrondis si la clé |rounded-corners| (décrite
+à la partie \ref{tabular-rounded-corners}, p.~\pageref{tabular-rounded-corners})
+a été utilisée.
+
+\medskip
+Toutes ces commandes acceptent un argument optionnel, entre crochets et en
+première position. Cet argument optionel peut contenir deux éléments (séparés
+par une virgule) :
+\begin{itemize}
+\item le modèle colorimétrique (|RGB|, |rgb|, |HTML|, etc.) comme spécifié par
+l'extension \pkg{xcolor} ;
+\item \colorbox{yellow!50}{\textbf{Nouveau 6.18}}
+
+une spécification d'opacité selon la forme \texttt{opacity = \textsl{valeur}}.
+\end{itemize}
+
+
+\medskip
+On détaille maintenant ces différentes commandes.
\medskip
\begin{itemize}
-\item La commande |\cellcolor| tient son nom de la commande |\cellcolor| de
-\pkg{colortbl}.
+\item La commande \Definition{\textbackslash cellcolor} tient son nom de la
+commande |\cellcolor| de \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. Malgré
@@ -1710,9 +1739,9 @@ h & i & j \\
\medskip
-\item La commande |\rectanglecolor| prend trois arguments obligatoires. Le
-premier est la couleur, les deux suivants fournissent la case en haut à gauche
-et la case en bas à droite du rectangle.
+\item La commande \Definition{\textbackslash rectanglecolor} prend trois
+arguments obligatoires. Le premier est la couleur, les deux suivants fournissent
+la case en haut à gauche et la case en bas à droite du rectangle.
\medskip
\begin{scope}
@@ -1739,15 +1768,16 @@ h & i & j \\
\medskip
-\item La commande |\arraycolor| prend en argument obligatoire une couleur et
-colorie tout le tableau (sauf les éventuelles rangées et colonnes extérieures:
-cf.~p.~\pageref{exterior}) avec cette couleur. Ce n'est qu'un cas particulier de
-la commande |\rectanglecolor|.
+\item La commande \Definition{\textbackslash arraycolor} prend en argument
+obligatoire une couleur et colorie tout le tableau (sauf les éventuelles rangées
+et colonnes extérieures: cf.~p.~\pageref{exterior}) avec cette couleur. Ce n'est
+qu'un cas particulier de la commande |\rectanglecolor|.
\medskip
\item \label{chessboardcolors}%
-La commande |\chessboardcolors| prend en arguments obligatoires deux
-couleurs et colorie les cases en quinconces avec les deux couleurs.
+La commande \Definition{\textbackslash chessboardcolors} prend en arguments
+obligatoires deux couleurs et colorie les cases en quinconces avec les deux
+couleurs.
\medskip
\begin{scope}
@@ -1778,11 +1808,11 @@ droite (cf. p.~\pageref{columns-type}).
\medskip
-\item La commande |\rowcolor| doit son nom à la commande |\rowcolor| de
-\pkg{colortbl}. Son premier argument obligatoire est la couleur et le deuxième
-est une liste de numéros de rangées ou bien d'intervalles de rangées sous la
-forme $a$-$b$ (un intervalle de la forme $a$- représente toutes les rangées à
-partir de la rangée~$a$).
+\item La commande \Definition{\textbackslash rowcolor} doit son nom à la
+commande |\rowcolor| de \pkg{colortbl}. Son premier argument obligatoire est la
+couleur et le deuxième est une liste de numéros de rangées ou bien d'intervalles
+de rangées sous la forme $a$-$b$ (un intervalle de la forme $a$- représente
+toutes les rangées à partir de la rangée~$a$).
\medskip
@@ -1826,13 +1856,14 @@ a_{10} & b_{10} & c_{10} \\
\medskip
-\item La commande |\columncolor| doit son nom à la commande |\columncolor| de
-\pkg{colortbl}. Sa syntaxe est similaire à celle de |\rowcolor|.
+\item La commande \Definition{\textbackslash columncolor} doit son nom à la
+commande |\columncolor| de \pkg{colortbl}. Sa syntaxe est similaire à celle de
+|\rowcolor|.
\medskip
-\item La commande |\rowcolors| (avec un \emph{s}) doit son nom à la commande
-|\rowcolors| de \pkg{colortbl}. Le \emph{s} rappelle
-qu'il y a deux couleurs. Elle colorie alternativement les rangées avec les deux
+\item La commande \Definition{\textbackslash rowcolors} (avec un \emph{s}) doit
+son nom à la commande |\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}.
@@ -1843,10 +1874,10 @@ l'intervalle constitué de toutes les rangées du tableau à partir de la rangé
\medskip
-La commande |\rowcolors| accepte une liste de couples \textsl{clé=valeur} comme
-argument optionnel en dernière position (l'argument optionnel en première
-position correspond à l'espace colorimétrique). Les clés disponibles sont
-|cols|, |restart| et |respect-blocks|.
+La commande |\rowcolors| accepte une liste de couples
+\textsl{clé=valeur} comme argument optionnel en dernière position (l'argument
+optionnel en première position correspond à l'espace colorimétrique). Les clés
+disponibles sont |cols|, |restart| et |respect-blocks|.
\begin{itemize}
\item La clé |cols| décrit un ensemble de colonnes sur lesquelles portera
l'effet de |\rowcolors|. Cet ensemble de colonnes est une liste d'intervalles de
@@ -1940,11 +1971,11 @@ Henri & 14 \\
\medskip
-\item L'extension \pkg{nicematrix} propose aussi une commande |\rowlistcolors|.
-Cette commande généralise la commande |\rowcolors|: au lieu de prendre deux
-arguments successifs pour les couleurs, elle prend un seul argument qui est une
-liste de couleurs séparées par des virgules. Dans cette liste, le symbole |=|
-représente une couleur identique à la précédente.
+\item L'extension \pkg{nicematrix} propose aussi une commande \Definition{\textbackslash
+ rowlistcolors}. Cette commande généralise la commande |\rowcolors|: au lieu de
+prendre deux arguments successifs pour les couleurs, elle prend un seul argument
+qui est une liste de couleurs séparées par des virgules. Dans cette liste, le
+symbole |=| représente une couleur identique à la précédente.
\smallskip
\begin{BVerbatim}[boxwidth=10cm,baseline=c]
@@ -2189,7 +2220,7 @@ de même nom (cf. p.~\pageref{cell-space}).
\item La clé |rowcolor| fixe la couleur de fond et la clé |color| fixe la
couleur du texte.\footnote{La clé |color| utilise la commande |\color| mais
insère aussi une instruction |\leavevmode| devant. Cela évite un espace
- vertical parasite dans les cellules qui correspondent à des colonnes de type
+ vertical parasite dans les cases qui correspondent à des colonnes de type
|p|, |b|, |m|, |X| et |V| (qui débutent en mode vertical).}
\item La clé |bold| impose des caractères gras aux éléments de la rangée, qu'ils
@@ -2493,7 +2524,7 @@ 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ée
-au contenu de la cellule en question : cf. p.~\pageref{node-V}.
+au contenu de la case en question : cf. p.~\pageref{node-V}.
\medskip
@@ -3655,7 +3686,7 @@ Comme on le voit, le tracé effectué par la commande |\MyDraw| est \emph{relati
Les commandes |\OverBrace| and |\UnderBrace| permettent de placer des accolades
horizontales sur une partie du tableau. Ces commandes prennent trois arguments :
\begin{itemize}
-\item le premier argument est le coin supérieur gauche du rectangle de cellules
+\item le premier argument est le coin supérieur gauche du rectangle de cases
impliquées dans l'accolade avec la syntaxe habituelle $i$|-|$j$ où $i$ est le
numéro de rangée et $j$ le numéro de colonne ;
@@ -4116,6 +4147,55 @@ utile l'utilisation de \pkg{threeparttable} en conjonction avec \pkg{nicematrix}
\section{Autres fonctionnalités}
+\subsection{La clé rounded-corners de \{NiceTabular\}}
+
+\label{tabular-rounded-corners}
+
+\colorbox{yellow!50}{\textbf{Nouveau 6.18}}\par\nobreak
+
+\smallskip
+La clé |rounded-corners| que l'on décrit maintenant n'a pas de lien direct avec
+la clé |corners| (qui sert à spécifier les «coins vides») décrite à la
+partie~\ref{corners}, p.~\pageref{corners}.
+
+\smallskip
+L'environnement |{NiceTabular}| propose une clé |rounded-corners| qui spécifie
+que le tableau devra avoir des coins arrondis avec le rayon égal à la valeur
+de cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur est la valeur
+ par défaut des «\texttt{rounded corners}» de PGF/Tikz.}). Plus précisément,
+cette clé a deux effets que l'on décrit maintenant.
+\begin{itemize}
+\item Toutes les commandes de coloriage de cases, colonnes et rangées (que ce
+soit dans le |\CodeBefore| ou bien directement dans le tableau (quand la clé
+|colortbl-like| est utilisée) respectent ces coins arrondis pour le tableau.
+
+\item Quand la clé |hvlines| est utilisée, les filets extérieurs sont tracés
+avec des coins arrondis.
+\end{itemize}
+
+\bigskip
+\begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
+\begin{NiceTabular}{ccc}[hvlines,~emphase#rounded-corners@]
+\CodeBefore
+ \rowcolor{red!15}{1}
+\Body
+ Nom & Prénom & Profession \\
+ Arvy & Jacques & Dentiste \\
+ Jalon & Amandine & Dentiste \\
+\end{NiceTabular}
+\end{BVerbatim}
+\begin{NiceTabular}{ccc}[hvlines,rounded-corners]
+\CodeBefore
+ \rowcolor{red!15}{1}
+\Body
+ Nom & Prénom & Profession \\
+ Arvy & Jacques & Dentiste \\
+ Jalon & Amandine & Dentiste \\
+ Sept & Huit & Neuf
+\end{NiceTabular}
+
+
+
\subsection{Commande \textbackslash ShowCellNames}
@@ -4168,7 +4248,7 @@ $\begin{pNiceArray}{ScW{c}{1cm}c}[nullify-dots,first-row]
\end{pNiceArray}$
\medskip
-En revanche, les colonnes |d| de l'extension \pkg{dcolumn} ne sont pas prises en
+En revanche, les colonnes |d| de l'extension \pkg{dcolumn} ne sont \emph{pas} prises en
charge par \pkg{nicematrix}.
@@ -4656,9 +4736,9 @@ contenir au moins une instruction comme |\pgfusepath|, |\pgfusepathqstroke|,
\label{node-V}
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
-a une largeur ajustée au contenu de cette cellule. Cela est en contraste avec le
+intéressant de préciser que, pour une case située dans une colonne de type
+|V|, le nœud PGF-TikZ créé par \pkg{nicematrix} pour le contenu de cette case
+a une largeur ajustée au contenu de cette case. 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
commande |\lipsum| est fournie par l'extension éponyme.
@@ -4920,7 +5000,7 @@ Voici un exemple d'utilisation de ces nœuds dans le |\CodeAfter|.
\hline
u_n &-& u_0 &=& nr \\
\CodeAfter
- \tikz[very thick, red, opacity=0.4,name suffix = -medium]
+ \tikz[very thick, red, opacity=0.4, name suffix = -medium]
\draw (1-1.north west) -- (2-3.south east)
(2-1.north west) -- (3-3.south east)
(3-1.north west) -- (4-3.south east)
@@ -5112,7 +5192,7 @@ compilation supplémentaire (car les instructions sont écrites dans le fichier
\medskip
\emph{Exemple} : On souhaite écrire une commande |\crossbox| qui barre en croix
-la cellule courante. Cette commande prendra en argument optionnel une liste de
+la case courante. Cette commande prendra en argument optionnel une liste de
couples \textsl{clé}-\textsl{valeur} qui sera passée à TikZ avant que la croix
ne soit tracée.
@@ -5559,32 +5639,6 @@ tous les filets sauf ceux sur les bords (qui sont, bien entendu, ajoutés par
\end{center}
-\vspace{1cm}
-Cet exemple montre l'utilisation de \pkg{nicematrix} en conjonction avec
-\pkg{tcolorbox}. Si on souhaite seulement faire un tableau avec un cadre
-extérieur aux coins arrondis, il n'est pas nécessaire d'utiliser \pkg{tcolorbox} :
-on peut tracer un |\Block| avec la commande |rounded-corners|.
-
-\medskip
-\begin{BVerbatim}[baseline=c,boxwidth=10.5cm]
-\begin{NiceTabular}{rcl}[hvlines-except-borders]
-\Block[draw,transparent,~emphase#rounded-corners@]{*-*}{}
- One & Two & Three \\
- Men & Mice & Lions \\
- Upper & Middle & Lower
-\end{NiceTabular}
-\end{BVerbatim}
-\begin{NiceTabular}{rcl}[hvlines-except-borders]
-\Block[draw,transparent,rounded-corners]{*-*}{}
- One & Two & Three \\
- Men & Mice & Lions \\
- Upper & Middle & Lower
-\end{NiceTabular}
-
-\medskip
-On a utilisé la clé |transparent| de manière à avoir les filets spécifiés par
-|hvlines-except-borders| tracés dans le bloc (par défaut, les filets ne sont
-pas tracés dans les blocs).
\subsection{Notes dans les tableaux}
@@ -6291,7 +6345,7 @@ On considère maintenant la matrice suivante. Si on veut surligner chaque rangé
de la matrice, on peut utiliser la technique précédente trois fois.
\begin{Verbatim}
-\[\begin{pNiceArray}{ccc}[last-col]
+\[\begin{pNiceArray}{ccc}[last-col, margin = 2pt]
\CodeBefore [create-cell-nodes]
\begin{tikzpicture}
~emphase# \node [highlight = (1-1) (1-3)] {} ;@
@@ -6305,7 +6359,7 @@ a & a & a & L_3
\end{pNiceArray}\]
\end{Verbatim}
-\[\begin{pNiceArray}{ccc}[last-col]
+\[\begin{pNiceArray}{ccc}[last-col, margin = 2pt]
\CodeBefore [create-cell-nodes]
\begin{tikzpicture}
\node [highlight = (1-1) (1-3)] {} ;
@@ -6323,7 +6377,7 @@ Le résultat peut paraître décevant. On peut l'améliorer en utilisant les «n
moyens» au lieu des «nœuds normaux».
\begin{Verbatim}
-\[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes]
+\[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes]
\CodeBefore [create-cell-nodes]
\begin{tikzpicture} ~emphase#[name suffix = -medium]@
\node [highlight = (1-1) (1-3)] {} ;
@@ -6338,7 +6392,7 @@ a & a & a & L_3
\end{Verbatim}
-\[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes]
+\[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes]
\CodeBefore [create-cell-nodes]
\begin{tikzpicture} [name suffix = -medium]
\node [highlight = (1-1) (1-3)] {} ;
@@ -6441,7 +6495,7 @@ de parenthèses ont été rajoutées avec |\SubMatrix| dans le |\CodeBefore|.
\label{triangular}
Dans l'exemple suivant, on utilise le style PGF/Tikz |nicematrix/cell-node| pour faire
-tourner le contenu des cellules (rotation que l'on compense ensuite en faisant
+tourner le contenu des cases (rotation que l'on compense ensuite en faisant
tourner tout le tableau avec la commande |\adjustbox| de l'extension éponyme,
qui doit donc être chargée préalablement).
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 3620cc0f4b..c22ed30da1 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -17,8 +17,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.17}
-\def\myfiledate{2023/03/31}
+\def\myfileversion{6.18}
+\def\myfiledate{2023/04/19}
%
%
%<*batchfile>
@@ -850,7 +850,6 @@ version 2005/12/01 or later.
%
% \subsection{Vertical position of the content of the block}
%
-% \colorbox{yellow!50}{\textbf{New 6.14}}
%
% For the vertical position, the command |\Blocks| accepts the keys
% |v-center|\footnote{That key could not have been named |c| since the key |c|
@@ -866,11 +865,14 @@ version 2005/12/01 or later.
% block (we recall that the content of a block may contains several lines
% separated by |\\|) is aligned with the baseline of the last of the rows of the
% array involved in the block.
-% \item With the key |T|, the content of the block is set upwards with only a
-% margin equal to the PGF/Tikz parameter |inner ysep| (use |\pgfset| to change
-% the value of that parameter).
-% \item With the key |B|, the content of the block is set downwards with only a
-% margin equal to the PGF/Tikz parameter |inner ysep|.
+% \item With the key |T|, the content of the block is set upwards.
+%
+% \colorbox{yellow!50}{\textbf{Modification 6.18}}\enskip No vertical margin is
+% added. However, the contents of the block is (always) composed by
+% \pkg{nicematrix} in a |{minipage}|, a |{tabular}| or an |{array}| and, hence,
+% there will still remain a margin (in most cases).
+%
+% \item With the key |B|, the content of the block is set downwards.
% \end{itemize}
%
% When no key is given, the key |v-center| applies (excepted in the mono-row blocks).
@@ -890,19 +892,19 @@ version 2005/12/01 or later.
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,~emphase#t@,l]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,t,l]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
%
@@ -911,19 +913,19 @@ version 2005/12/01 or later.
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,~emphase#b@,r]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,b,r]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
%
@@ -931,19 +933,19 @@ version 2005/12/01 or later.
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,~emphase#T@,l]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,T,l]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
%
@@ -952,22 +954,23 @@ version 2005/12/01 or later.
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,~emphase#B@,r]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{NiceTabular}{ccc}
% \Block[fill=red!10,B,r]{4-2}{two\\lines}
-% & & \Huge first\\
-% & & second \\
-% & & third \\
-% & & fourth \\
+% & & \Huge Un\\
+% & & deux \\
+% & & trois \\
+% & & \Huge quatre \\
% text & text \\
% \end{NiceTabular}
%
+%
% \end{scope}
%
%
@@ -1235,9 +1238,15 @@ version 2005/12/01 or later.
% \end{center}
%
% \bigskip
+% It's worth noting that, when the key |rounded-corners| is used for the
+% environment |{NiceTabular}|, the key |hvlines| draws rounded corners for the
+% exterior frame of the tabular: cf. part~\ref{tabular-rounded-corners},
+% p.~\pageref{tabular-rounded-corners}.
+%
+% \bigskip
% The key |hvlines-except-borders| is similar to the key |hvlines| but does not
% draw the rules on the horizontal and vertical borders of the array. For an
-% example of use of that key, see the part ``Use with tcolorbox`,
+% example of use of that key, see the part ``Use with tcolorbox'',
% p.~\pageref{tcolorbox}.
%
% \subsubsection{The (empty) corners}
@@ -1255,7 +1264,7 @@ version 2005/12/01 or later.
% natural. The precise definition of a ``non-empty cell'' is given below (cf.
% p.~\pageref{empty-cells}).}
%
-% However, it's possible, for a cell without content, to require \pkg{nicemarix}
+% However, it's possible, for a cell without content, to require \pkg{nicematrix}
% to consider that cell as not empty with the key |\NotEmpty|.
%
%\bigskip
@@ -1283,9 +1292,12 @@ version 2005/12/01 or later.
% \end{NiceTabular}
%
% \bigskip
-% When the key |corners| is used, \pkg{nicematrix} computes the (empty) corners
-% and these corners will be taken into account by the tools for drawing the
-% rules (the rules won't be drawn in the corners).
+% When the key |corners|\footnote{The key \texttt{corners} that we describe now
+% has no direct link with the key \texttt{rounded-corners} described in the part
+% \ref{tabular-rounded-corners}, p.~\pageref{tabular-rounded-corners}} is used,
+% \pkg{nicematrix} computes the (empty) corners and these corners will be taken
+% into account by the tools for drawing the rules (the rules won't be drawn in
+% the corners).
%
% \bigskip
% \begin{BVerbatim}[boxwidth=11cm,baseline=c]
@@ -1675,18 +1687,33 @@ version 2005/12/01 or later.
% \label{code-before}
%
% \medskip
-% All these commands accept an optional argument (between square brackets and
-% in first position) which is the color model for the specification of the
-% colors.
+% These commands don't color the cells which are in the ``corners'' if the key
+% |corners| is used. That key has been described p.~\pageref{corners}.
%
% \medskip
-% These commands don't color the cells which are in the ``corners'' if the key
-% |corners| is used. This key has been described p.~\pageref{corners}.
+% These commands respect the rounded corners if the key |rounded-corners|
+% (described in the part \ref{tabular-rounded-corners} at the
+% page~\pageref{tabular-rounded-corners}) has been used.
+%
+% \medskip
+% All these commands accept an optional argument, between square brackets and
+% in first position. That optional argument may contain two elements (separated
+% by a comma)
+% \begin{itemize}
+% \item the colorimetric space (|RGB|, |rgb|, |HTML|, etc) as specified by the
+% the extension \pkg{xcolor};
+% \item \colorbox{yellow!50}{\textbf{New 6.18}}\par\nobreak
+% a specification of opacity f the form \texttt{opacity = \textsl{value}}.
+% \end{itemize}
%
+% \bigskip
+%
+% We describe now in detail those commands.
+%
% \medskip
% \begin{itemize}
-% \item The command |\cellcolor| takes its name from the command |\cellcolor| of
-% \pkg{colortbl}.
+% \item The command \Definition{\textbackslash cellcolor} takes its name from
+% the command |\cellcolor| of \pkg{colortbl}.
%
% 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
@@ -1718,9 +1745,9 @@ version 2005/12/01 or later.
% \end{scope}
%
% \bigskip
-% \item The command |\rectanglecolor| takes three mandatory arguments. The first
-% is the color. The second is the upper-left cell of the rectangle and the third
-% is the lower-right cell of the rectangle.
+% \item The command \Definition{\textbackslash rectanglecolor} takes three
+% mandatory arguments. The first is the color. The second is the upper-left cell
+% of the rectangle and the third is the lower-right cell of the rectangle.
%
% \medskip
% \begin{scope}
@@ -1746,15 +1773,16 @@ version 2005/12/01 or later.
% \end{scope}
%
% \bigskip
-% \item The command |\arraycolor| takes in as mandatory argument a color and
-% color the whole tabular with that color (excepted the potential exterior rows
-% and columns: cf.~p.~\pageref{exterior}). It's only a particular case of
-% |\rectanglecolor|.
+% \item The command \Definition{\textbackslash arraycolor} takes in as mandatory
+% argument a color and color the whole tabular with that color (excepted the
+% potential exterior rows and columns: cf.~p.~\pageref{exterior}). It's only a
+% particular case of |\rectanglecolor|.
%
%
% \bigskip
-% \item The command |\chessboardcolors| takes in as mandatory arguments two colors
-% and it colors the cells of the tabular in quincunx with these colors.
+% \item The command \Definition{\textbackslash chessboardcolors} takes in as
+% mandatory arguments two colors and it colors the cells of the tabular in
+% quincunx with these colors.
%
% \medskip
% \begin{scope}
@@ -1785,10 +1813,11 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% \item The command |\rowcolor| takes its name from the command |\rowcolor| of
-% \pkg{colortbl}. Its first mandatory argument is the color and the second is a
-% comma-separated list of rows or interval of rows with the form $a$-$b$ (an
-% interval of the form $a$- represent all the rows from the row $a$ until the end).
+% \item The command \Definition{\textbackslash rowcolor} takes its name from the
+% command |\rowcolor| of \pkg{colortbl}. Its first mandatory argument is the
+% color and the second is a comma-separated list of rows or interval of rows
+% with the form $a$-$b$ (an interval of the form $a$- represent all the rows
+% from the row $a$ until the end).
%
% \medskip
% \begin{scope}
@@ -1829,17 +1858,17 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% \item The command |\columncolor| takes its name from the command
-% |\columncolor| of \pkg{colortbl}. Its syntax is similar to the syntax of
-% |\rowcolor|.
+% \item The command \Definition{\textbackslash columncolor} takes its name from
+% the command |\columncolor| of \pkg{colortbl}. Its syntax is similar to the
+% syntax of |\rowcolor|.
%
% \bigskip
-% \item The command |\rowcolors| (with a \emph{s}) takes its name from the
-% 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 two colors (provided in second and third
-% argument), beginning with the row whose number is given in first (mandatory)
-% argument.
+% \item The command \Definition{\textbackslash rowcolors} (with a \emph{s})
+% takes its name from the 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 two colors (provided in second
+% and third argument), beginning with the row whose number is given in first
+% (mandatory) argument.
%
% In fact, the first (mandatory) argument is, more generally, a comma separated
% list of intervals describing the rows involved in the action of |\rowcolors|
@@ -1936,11 +1965,11 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% \item The extension \pkg{nicematrix} provides also a command |\rowlistcolors|.
-% This command generalises the command |\rowcolors|: instead of two successive
-% arguments for the colors, this command takes in an argument which is a
-% (comma-separated) list of colors. In that list, the symbol |=| represent a
-% color identical to the previous one.
+% \item The extension \pkg{nicematrix} provides also a command
+% \Definition{\textbackslash rowlistcolors}. This command generalises the
+% command |\rowcolors|: instead of two successive arguments for the colors, this
+% command takes in an argument which is a (comma-separated) list of colors. In
+% that list, the symbol |=| represent a color identical to the previous one.
%
% \smallskip
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
@@ -4068,15 +4097,63 @@ version 2005/12/01 or later.
%
% \section{Other features}
%
+% \subsection{The key rounded-corners of \{NiceTabular\}}
+%
+% \label{tabular-rounded-corners}
+% \colorbox{yellow!50}{\textbf{New 6.18}}\par\nobreak
+%
+% \smallskip
+% The key |rounded-corners| that we will descrite now has no direct link with
+% the key |corners| (which is used to specify ``empty corners'') described in
+% the part~\ref{corners}, p.~\pageref{corners}.
+%
+% \smallskip
+% The environment |{NiceTabular}| provides also a key |rounded-corners| which
+% specify that the tabular should have rounded corners with a radius equal to
+% the value of that key (the default value is 4~pt\footnote{This value is the
+% initial value of the \emph{rounded corners} of Tikz.}). More precisely, that
+% key has two effects that we describe now.
+% \begin{itemize}
+% \item All the commands for coloring the cells, columns and rows (in the
+% |\CodeBefore| but also directly in the array if the key |colortbl-like| is
+% used) will respect those rounded corners.
+%
+% \item When the key |hvlines| is used, the exterior rules will be drawn with
+% rounded corners.
+% \end{itemize}
+% \bigskip
+% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% \begin{NiceTabular}
+% [hvlines,~emphase#rounded-corners@]
+% {ccc}
+% \CodeBefore
+% \rowcolor{red!15}{1}
+% \Body
+% Last name & First name & Profession \\
+% Arvy & Jacques & Physicist \\
+% Jalon & Amandine & Physicist
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \begin{NiceTabular}{ccc}[hvlines,rounded-corners]
+% \CodeBefore
+% \rowcolor{red!15}{1}
+% \Body
+% Last name & First name & Profession \\
+% Arvy & Jacques & Physicist \\
+% Jalon & Amandine & Physicist
+% \end{NiceTabular}
+%
+%
% \subsection{Command \textbackslash ShowCellNames}
%
% 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
+% the |\CodeAfter| displays the name (with the form $i$-$j$) of each cell. When
% used in the |\CodeAfter|, that command applies a semi-transparent white
% rectangle to fade the array (caution: some \textsc{pdf} readers don't support
% transparency).
%
+% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
% \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
% \Block{2-2}{} & & test \\
@@ -4858,7 +4935,7 @@ version 2005/12/01 or later.
% \hline
% u_n &-& u_0 &=& nr \\
% \CodeAfter
-% \tikz[very thick, red, opacity=0.4,name suffix = -medium]
+% \tikz[very thick, red, opacity=0.4, name suffix = -medium]
% \draw (1-1.north west) -- (2-3.south east)
% (2-1.north west) -- (3-3.south east)
% (3-1.north west) -- (4-3.south east)
@@ -4878,7 +4955,7 @@ version 2005/12/01 or later.
% \hline
% u_n &-& u_0 &=& nr \\
% \CodeAfter
-% \tikz[very thick, red, opacity=0.4,name suffix = -medium]
+% \tikz[very thick, red, opacity=0.4, name suffix = -medium]
% \draw (1-1.north west) -- (2-3.south east)
% (2-1.north west) --(3-3.south east)
% (3-1.north west) -- (4-3.south east)
@@ -6200,7 +6277,7 @@ version 2005/12/01 or later.
% this matrix, we can use the previous technique three times.
%
% \begin{Verbatim}
-% \[\begin{pNiceArray}{ccc}[last-col]
+% \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt]
% \CodeBefore [create-cell-nodes]
% \begin{tikzpicture}
% ~emphase# \node [highlight = (1-1) (1-3)] {} ;@
@@ -6215,7 +6292,7 @@ version 2005/12/01 or later.
% \end{Verbatim}
%
%
-% \[\begin{pNiceArray}{ccc}[last-col]
+% \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt]
% \CodeBefore [create-cell-nodes]
% \begin{tikzpicture}
% \node [highlight = (1-1) (1-3)] {} ;
@@ -6233,7 +6310,7 @@ version 2005/12/01 or later.
% nodes'' instead of the ``normal nodes''.
%
% \begin{Verbatim}
-% \[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes]
+% \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes]
% \CodeBefore [create-cell-nodes]
% \begin{tikzpicture} ~emphase#[name suffix = -medium]@
% \node [highlight = (1-1) (1-3)] {} ;
@@ -6248,7 +6325,7 @@ version 2005/12/01 or later.
% \end{Verbatim}
%
%
-%\[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes]
+%\[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes]
% \CodeBefore [create-cell-nodes]
% \begin{tikzpicture} [name suffix = -medium]
% \node [highlight = (1-1) (1-3)] {} ;
@@ -6597,27 +6674,25 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% Here, the box |\l_tmpa_box| will be used as sandbox to take our security test.
+% Here, the box |\l_tmpa_box| will be used as sandbox to take our security test.
+% This code has benne modified in version 6.18 (see question 682891 on TeX
+% StackExchange).
% \begin{macrocode}
-\hook_gput_code:nnn { begindocument } { . }
+\hook_gput_code:nnn { begindocument / after } { . }
{
\@ifpackageloaded { mdwtab }
{ \@@_fatal:n { mdwtab~loaded } }
{
- \@ifpackageloaded { fontspec }
- { }
+ \bool_if:NF \c_@@_no_test_for_array_bool
{
- \bool_if:NF \c_@@_no_test_for_array_bool
- {
- \group_begin:
- \hbox_set:Nn \l_tmpa_box
- {
- \begin { tabular } { c > { \@@_security_test:n } c c }
- text & & text
- \end { tabular }
- }
- \group_end:
- }
+ \group_begin:
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \begin { tabular } { c > { \@@_security_test:n } c c }
+ text & & text
+ \end { tabular }
+ }
+ \group_end:
}
}
}
@@ -7174,6 +7249,13 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% The following dimension will be used by the command |\Block| for the blocks
+% with a key of vertical position equal to |T| or |B|.
+% \begin{macrocode}
+\dim_new:N \l_@@_block_ysep_dim
+% \end{macrocode}
+%
+% \bigskip
% The following dimension correspond to the key |width| (which may be fixed in
% |\NiceMatrixOptions| but also in an environment |{NiceTabular}|).
% \begin{macrocode}
@@ -7377,6 +7459,9 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% The value of the key |code-before| will be added to the left of
+% |\g_@@_pre_code_before_tl|. Idem for the code between |\CodeBefore| and
+% |\Body|.
% \begin{macrocode}
\tl_new:N \g_nicematrix_code_before_tl
\tl_new:N \g_@@_pre_code_before_tl
@@ -7586,7 +7671,7 @@ version 2005/12/01 or later.
%
% \medskip
% The following flag will be raised if the key |width| is used in an environment
-% |{NiceTabular}| (not in a comamnd |\NiceMatrixOptions|). You use it to raise
+% |{NiceTabular}| (not in a command |\NiceMatrixOptions|). You use it to raise
% an error when this key is used while no column |X| is used.
% \begin{macrocode}
\bool_new:N \l_@@_width_used_bool
@@ -7648,6 +7733,15 @@ version 2005/12/01 or later.
% |corners| is used).
%
% \medskip
+% The following dimension corresponds to the key |rounded-corners| available in
+% an individual environment |{NiceTabular}|. When that key is used, a clipping
+% is applied in the |\CodeBefore| of the environment in order to have rounded
+% corners for the potential colored panels.
+% \begin{macrocode}
+\dim_new:N \l_@@_tab_rounded_corners_dim
+% \end{macrocode}
+%
+% \medskip
% The following token list correspond to the key |color| of the command |\Block|
% and also the key |color| of the command |\RowStyle|.
% \begin{macrocode}
@@ -7712,11 +7806,20 @@ version 2005/12/01 or later.
\dim_new:N \l_@@_submatrix_left_xshift_dim
\dim_new:N \l_@@_submatrix_right_xshift_dim
\clist_new:N \l_@@_hlines_clist
-\clist_new:N \l_@@_vlines_clist
+\clist_new:N \l_@@_vlines_clist
\clist_new:N \l_@@_submatrix_hlines_clist
\clist_new:N \l_@@_submatrix_vlines_clist
% \end{macrocode}
%
+% \medskip
+% The following key is set when the keys |hvlines| and |hvlines-except-borders|
+% are used. It's used only to change slightly the clipping path set by the key
+% |rounded-corners| (for a |{tabular}|).
+% \begin{macrocode}
+\bool_new:N \l_@@_hvlines_bool
+% \end{macrocode}
+%
+%
%
% \bigskip
% The following flag will be used by (for instance) |\@@_vline_ii:|.
@@ -8475,6 +8578,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_new:N \l_@@_delimiters_color_tl
% \end{macrocode}
+%
%
% \bigskip
% Sometimes, we want to have several arrays vertically juxtaposed in order to
@@ -8619,6 +8723,7 @@ version 2005/12/01 or later.
vlines-in-sub-matrix .value_required:n = true ,
hvlines .code:n =
{
+ \bool_set_true:N \l_@@_hvlines_bool
\clist_set:Nn \l_@@_vlines_clist { all }
\clist_set:Nn \l_@@_hlines_clist { all }
} ,
@@ -8626,6 +8731,7 @@ version 2005/12/01 or later.
{
\clist_set:Nn \l_@@_vlines_clist { all }
\clist_set:Nn \l_@@_hlines_clist { all }
+ \bool_set_true:N \l_@@_hvlines_bool
\bool_set_true:N \l_@@_except_borders_bool
} ,
parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
@@ -8996,6 +9102,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 ,
+ rounded-corners .dim_set:N = \l_@@_tab_rounded_corners_dim ,
+ rounded-corners .default:n = 4 pt ,
notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } ,
tabularnote .tl_gset:N = \g_@@_tabularnote_tl ,
tabularnote .value_required:n = true ,
@@ -9745,7 +9853,7 @@ version 2005/12/01 or later.
\cs_set_eq:NN \Block \@@_Block:
\cs_set_eq:NN \rotate \@@_rotate:
\cs_set_eq:NN \OnlyMainNiceMatrix \@@_OnlyMainNiceMatrix:n
- \cs_set_eq:NN \dotfill \@@_old_dotfill:
+ \cs_set_eq:NN \dotfill \@@_dotfill:
\cs_set_eq:NN \CodeAfter \@@_CodeAfter:
\cs_set_eq:NN \diagbox \@@_diagbox:nn
\cs_set_eq:NN \NotEmpty \@@_NotEmpty:
@@ -10989,7 +11097,11 @@ version 2005/12/01 or later.
\keys_set:nn { NiceMatrix / ColumnTypes } { #1 }
\@@_patch_preamble:n
}
- { \@@_fatal:nn { unknown~column~type } { #1 } }
+ {
+ \tl_if_eq:nnT { #1 } { S }
+ { \@@_fatal:n { unknown~column~type~S } }
+ { \@@_fatal:nn { unknown~column~type } { #1 } }
+ }
}
}
}
@@ -12027,7 +12139,11 @@ version 2005/12/01 or later.
\@@_W: { \@@_patch_m_preamble_v:nnnn { \@@_special_W: } #1 }
\q_stop { }
}
- { \@@_fatal:nn { unknown~column~type } { #1 } }
+ {
+ \tl_if_eq:nnT { #1 } { S }
+ { \@@_fatal:n { unknown~column~type~S } }
+ { \@@_fatal:nn { unknown~column~type } { #1 } }
+ }
}
% \end{macrocode}
%
@@ -13294,6 +13410,36 @@ version 2005/12/01 or later.
{ \dim_set_eq:NN \l_@@_width_dim \linewidth }
\str_gset:Nn \g_@@_name_env_str { NiceTabular }
\keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 }
+ \int_compare:nNnT \l_@@_tab_rounded_corners_dim > \c_zero_dim
+ {
+ \bool_if:NT \l_@@_hvlines_bool
+ {
+ \bool_set_true:N \l_@@_except_borders_bool
+ % we should try to be more efficient in the number of lines of code here
+ \tl_if_empty:NTF \l_@@_rules_color_tl
+ {
+ \tl_gput_right:Nn \g_@@_pre_code_after_tl
+ {
+ \@@_stroke_block:nnn
+ { rounded-corners = \dim_use:N \l_@@_tab_rounded_corners_dim }
+ { 1-1 }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ }
+ }
+ {
+ \tl_gput_right:Nn \g_@@_pre_code_after_tl
+ {
+ \@@_stroke_block:nnn
+ {
+ rounded-corners = \dim_use:N \l_@@_tab_rounded_corners_dim ,
+ draw = \l_@@_rules_color_tl
+ }
+ { 1-1 }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ }
+ }
+ }
+ }
\tl_if_empty:NF \l_@@_short_caption_tl
{
\tl_if_empty:NT \l_@@_caption_tl
@@ -15748,18 +15894,114 @@ version 2005/12/01 or later.
{
\pgfpicture
\pgf@relevantforpicturesizefalse
+% \end{macrocode}
+% If the final user has used the key |rounded-corners| for the environment
+% |{NiceTabular}|, we will clip to a rectangle with rounded corners before
+% filling the rectangles.
+% \begin{macrocode}
+ \dim_compare:nNnT \l_@@_tab_rounded_corners_dim > \c_zero_dim
+ {
+ \pgfsetcornersarced
+ {
+ \pgfpoint
+ { \l_@@_tab_rounded_corners_dim }
+ { \l_@@_tab_rounded_corners_dim }
+ }
+% \end{macrococde}
+% Because we want \pkg{nicematrix} compatible with arrays constructed by
+% \pkg{array}, the nodes for the rows and columns (that is to say the nodes
+% |row-|\textsl{i} and |col-|\textsl{j}) have not always the expected position,
+% that is to say, there is sometimes a slight shifting of something such as
+% |\arrayrulewidth|. Now, for the clipping, we have to change slightly the
+% position of that clipping whether a rounded rectangle around the array is
+% required. That's the point which is tested in the following line.
+% \begin{macrocode}
+ \bool_if:NTF \l_@@_hvlines_bool
+ {
+ \pgfpathrectanglecorners
+ {
+ \pgfpointadd
+ { \@@_qpoint:n { row-1 } }
+ { \pgfpoint { 0.5 \arrayrulewidth } { \c_zero_dim } }
+ }
+ {
+ \pgfpointadd
+ {
+ \@@_qpoint:n
+ { \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } }
+ }
+ { \pgfpoint \c_zero_dim { 0.5 \arrayrulewidth } }
+ }
+ }
+ {
+ \pgfpathrectanglecorners
+ { \@@_qpoint:n { row-1 } }
+ {
+ \pgfpointadd
+ {
+ \@@_qpoint:n
+ { \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } }
+ }
+ { \pgfpoint \c_zero_dim \arrayrulewidth }
+ }
+ }
+ \pgfusepath { clip }
+ }
\seq_map_indexed_inline:Nn \g_@@_colors_seq
{
- \color ##2
- \use:c { g_@@_color _ ##1 _tl }
- \tl_gclear:c { g_@@_color _ ##1 _tl }
- \pgfusepath { fill }
+ \begin { pgfscope }
+ \@@_color_opacity ##2
+ \use:c { g_@@_color _ ##1 _tl }
+ \tl_gclear:c { g_@@_color _ ##1 _tl }
+ \pgfusepath { fill }
+ \end { pgfscope }
}
\endpgfpicture
}
% \end{macrocode}
-%
%
+% \bigskip
+% The following command will extract the potential key |opacity| in its optional
+% argument (between square brackets) and (of course) then apply the command |\color|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_color_opacity
+ {
+ \peek_meaning:NTF [
+ { \@@_color_opacity:w }
+ { \@@_color_opacity:w [ ] }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The command |\@@_color_opacity:w| takes in as argument only the optional
+% argument. One may consider that the second argument (the actual definition of
+% the color) is provided by currification.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_color_opacity:w [ #1 ]
+ {
+ \tl_clear:N \l_tmpa_tl
+ \keys_set_known:nnN { nicematrix / color-opacity } { #1 } \l_tmpb_tl
+% \end{macrocode}
+% |\l_tmpa_tl| (if not empty) is now the opacity and |\l_tmpb_tl| (if not empty) is now the colorimetric space.
+% \begin{macrocode}
+ \tl_if_empty:NF \l_tmpa_tl { \exp_args:NV \pgfsetfillopacity \l_tmpa_tl }
+ \tl_if_empty:NTF \l_tmpb_tl
+ { \@declaredcolor }
+ { \use:x { \exp_not:N \@undeclaredcolor [ \l_tmpb_tl ] } }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The following set of keys is used by the command |\@@_color_opacity:wn|.
+% \begin{macrocode}
+\keys_define:nn { nicematrix / color-opacity }
+ {
+ opacity .tl_set:N = \l_tmpa_tl ,
+ opacity .value_required:n = true
+ }
+% \end{macrocode}
+%
+% \bigskip
% \begin{macrocode}
\cs_new_protected:Npn \@@_cartesian_color:nn #1 #2
{
@@ -18237,7 +18479,16 @@ version 2005/12/01 or later.
% because we want to be able to take into account a potential instruction of
% color of the font in |\g_@@_row_style_tl|.
% \begin{macrocode}
- \int_compare:nNnT { #1 } = 1 \g_@@_row_style_tl
+ \int_compare:nNnT { #1 } = 1
+ {
+ \int_compare:nNnTF \c@iRow = 0
+ \l_@@_code_for_first_row_tl
+ {
+ \int_compare:nNnT \c@iRow = \l_@@_last_row_int
+ \l_@@_code_for_last_row_tl
+ }
+ \g_@@_row_style_tl
+ }
\group_begin:
\bool_if:NF \l_@@_respect_arraystretch_bool
{ \cs_set:Npn \arraystretch { 1 } }
@@ -18897,20 +19148,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% We take into account the case of a block of one row in the ``first row'' or
-% the ``last row''.
-% \begin{macrocode}
- \int_compare:nNnT { #1 } = 0
- {
- \int_compare:nNnT { #3 } = 0
- { \l_@@_code_for_first_row_tl }
- }
- \int_compare:nNnT { #1 } = \l_@@_last_row_int
- {
- \int_compare:nNnT { #3 } = \l_@@_last_row_int
- { \l_@@_code_for_last_row_tl }
- }
-% \end{macrocode}
%
% \medskip
% Now, we will put the label of the block.
@@ -18980,7 +19217,11 @@ version 2005/12/01 or later.
}
{ \l_tmpa_tl }
}
- \pgfset { inner~xsep = \c_zero_dim }
+ \pgfset
+ {
+ inner~xsep = \c_zero_dim ,
+ inner~ysep = \l_@@_block_ysep_dim
+ }
\pgfnode
{ rectangle }
{ \l_tmpa_tl }
@@ -19484,19 +19725,15 @@ version 2005/12/01 or later.
% case of use of |\dotfill| ``internally'' in the cell (e.g. |\hbox to 1cm {\dotfill}|).
% \begin{macrocode}
\@@_old_dotfill
- \bool_if:NT \l_@@_NiceTabular_bool
- { \group_insert_after:N \@@_dotfill_ii: }
- { \group_insert_after:N \@@_dotfill_i: }
+ \tl_gput_right:Nn \g_@@_cell_after_hook_tl \@@_dotfill_i:
}
-\cs_new_protected:Npn \@@_dotfill_i: { \group_insert_after:N \@@_dotfill_ii: }
-\cs_new_protected:Npn \@@_dotfill_ii: { \group_insert_after:N \@@_dotfill_iii: }
% \end{macrocode}
% Now, if the box if not empty (unfornately, we can't actually test whether the
% box is empty and that's why we only consider it's width), we insert
% |\@@_dotfill| (which is the saved version of |\dotfill|) in the cell of the
% array, and it will extend, since it is no longer in |\l_@@_cell_box|.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_dotfill_iii:
+\cs_new_protected:Npn \@@_dotfill_i:
{ \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim \@@_old_dotfill }
% \end{macrocode}
%
@@ -20946,19 +21183,38 @@ version 2005/12/01 or later.
\seq_if_in:NVTF \g_@@_types_of_matrix_seq \g_@@_name_env_str
{
\int_compare:nNnTF \l_@@_last_col_int = { -2 }
- { \@@_fatal:n { too~much~cols~for~matrix } }
- {
- \int_compare:nNnTF \l_@@_last_col_int = { -1 }
- { \@@_fatal:n { too~much~cols~for~matrix } }
- {
- \bool_if:NF \l_@@_last_col_without_value_bool
- { \@@_fatal:n { too~much~cols~for~matrix~with~last~col } }
- }
- }
+ { \@@_fatal:n { too~much~cols~for~matrix } }
+ {
+ \int_compare:nNnTF \l_@@_last_col_int = { -1 }
+ { \@@_fatal:n { too~much~cols~for~matrix } }
+ {
+ \bool_if:NF \l_@@_last_col_without_value_bool
+ { \@@_fatal:n { too~much~cols~for~matrix~with~last~col } }
+ }
+ }
+ }
+ {
+ \bool_lazy_and:nnTF
+ { \bool_if_p:n \c_@@_tabularx_loaded_bool }
+ { ! \str_if_eq_p:Vn \g_@@_name_env_str { NiceTabularX } }
+ {
+ \int_compare:nNnTF \c@iRow = \c_zero_int
+ { \@@_fatal:n { X~columns~with~tabularx } }
+ {
+ \@@_fatal:nn { too~much~cols~for~array }
+ {
+ However,~this~message~may~be~erroneous:~
+ maybe~you~have~used~X~columns~while~'tabularx'~is~loaded,~
+ ~which~is~forbidden~(however,~it's~still~possible~to~use~
+ X~columns~in~{NiceTabularX}).
+ }
+ }
+ }
+ { \@@_fatal:nn { too~much~cols~for~array } { } }
}
- { \@@_fatal:n { too~much~cols~for~array } }
}
% \end{macrocode}
+%
%
% The following command must \emph{not} be protected since it's used in an error message.
% \begin{macrocode}
@@ -21025,12 +21281,22 @@ version 2005/12/01 or later.
~you~try~to~use~more~columns~than~allowed~by~your~
\@@_full_name_env:.\@@_message_hdotsfor:\ The~maximal~number~of~columns~is~
\int_use:N \g_@@_static_num_of_col_int\
- ~(plus~the~potential~exterior~ones).~
+ ~(plus~the~potential~exterior~ones).~#1
This~error~is~fatal.
}
% \end{macrocode}
%
-
+% \medskip
+% \begin{macrocode}
+\@@_msg_new:nn { X~columns~with~tabularx }
+ {
+ There~is~a~problem.\\
+ You~have~probably~used~X~columns~in~your~environment~{\g_@@_name_env_str}.~
+ That's~not~allowed~because~'tabularx'~is~loaded~(however,~you~can~use~X~columns~
+ in~an~environment~{NiceTabularX}).\\
+ This~error~is~fatal.
+ }
+% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { columns~not~used }
@@ -21538,6 +21804,17 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { unknown~column~type~S }
+ {
+ Bad~column~type.\\
+ The~column~type~'S'~in~your~\@@_full_name_env:\ is~unknown. \\
+ If~you~want~to~use~the~column~type~'S'~of~siunitx,~you~should~
+ load~that~package. \\
+ This~error~is~fatal.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { tabularnote~forbidden }
{
Forbidden~command.\\
@@ -22061,6 +22338,7 @@ version 2005/12/01 or later.
renew-dots,~
respect-arraystretch,~
right-margin,~
+ rounded-corners,~
rules~(with~the~subkeys~'color'~and~'width'),~
short-caption,~
t,~
@@ -22116,6 +22394,19 @@ version 2005/12/01 or later.
% \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
% }
%
+% \subsection*{Changes between version 6.17 and 6.18}
+%
+% New key |opacity| in the commands to color cells, rows and columns.
+%
+% New key |rounded-corners| for a whole tabular.
+%
+%
+% \subsection*{Changes between version 6.16 and 6.17}
+%
+% New PGF/Tikz style |nicematrix/cell-node|.
+%
+% New key |pgf-node-code|
+%
% \subsection*{Changes between version 6.15 and 6.16}
%
% It's now possible to put any LaTeX extensible delimiter (|\lgroup|, |\langle|,
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index 3e990cb257..7b447a8a11 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ