summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-03-08 03:03:20 +0000
committerNorbert Preining <norbert@preining.info>2023-03-08 03:03:20 +0000
commita0867c71356c67c442bdebc0de39b7996f847bf7 (patch)
tree744a3932d78fb03b904b3355ea7b59abd0678055 /macros/latex/contrib/nicematrix
parent4f55c9271affed648c1a939790a73083043752f5 (diff)
CTAN sync 202303080303
Diffstat (limited to 'macros/latex/contrib/nicematrix')
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin533310 -> 545421 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex420
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx549
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1341260 -> 1356332 bytes
4 files changed, 761 insertions, 208 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index 3ce4049f78..85ec3103b5 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 6340ef2e45..e9700dd86c 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.tex
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex
@@ -39,6 +39,7 @@
\usepackage{footnote}
\usepackage{booktabs}
\usepackage{varwidth}
+\usepackage{tcolorbox}
\usepackage[auto-lang=false]{lipsum}
\usepackage[hyperfootnotes = false]{hyperref}
@@ -486,52 +487,60 @@ $\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
liste de couples \textsl{clé=valeur}. Les clés sont les suivantes :
\begin{itemize}
-\item la clé |fill| prend en argument une couleur et remplit le bloc avec cette
-couleur ;
-\item la clé |draw| prend en argument une couleur et trace le cadre avec cette
-couleur (la valeur par défaut de cette clé est la couleur courante des filets du
-tableau) ;
-\item la clé |color| prend en argument une couleur et l'applique au contenu et
-trace également le cadre avec cette couleur ;
-\item les clés |hlines|, |vlines| et |hvlines| tracent les filets correspondants
-dans le bloc\footnote{Néanmoins, les filets ne sont pas tracés dans les
- sous-blocs du bloc, conformément à l'esprit de \pkg{nicematrix}: les filets ne
-sont pas tracés dans les blocs (cf. section~\ref{rules} p.~\pageref{rules}).} ;
-\item la clé |line-width| fixe la largeur utilisée pour tracer les filets (n'a
-d'intérêt que si |draw|, |hvlines|, |hlines| ou |vlines| est utilisée) ;
-\item la clé |rounded-corners| impose des coins arrondis (pour le cadre dessiné
-par |draw| et le fond dessiné par |fill|) avec un rayon égal à la valeur de
-cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur par défaut est la
- valeur initiale des \emph{rounded corners} de TikZ.}) ;
-\item quand la clé |tikz| est utilisée, le chemin TikZ correspondant au
-rectangle délimitant le bloc est exécuté avec TikZ\footnote{TikZ doit être
+\item la clé \Definition{fill} prend en argument une couleur et remplit le bloc
+avec cette couleur ;
+\item la clé \Definition{draw} prend en argument une couleur et trace le cadre
+avec cette couleur (la valeur par défaut de cette clé est la couleur courante
+des filets du tableau) ;
+\item la clé \Definition{color} prend en argument une couleur et l'applique au
+contenu et trace également le cadre avec cette couleur ;
+\item les clés \Definition{hlines}, \Definition{vlines} et \Definition{hvlines}
+tracent les filets correspondants dans le bloc\footnote{Néanmoins, les filets ne
+ sont pas tracés dans les sous-blocs du bloc, conformément à l'esprit de
+ \pkg{nicematrix}: les filets ne sont pas tracés dans les blocs (cf.
+ section~\ref{rules} p.~\pageref{rules}).} ;
+\item la clé \Definition{line-width} fixe la largeur utilisée pour tracer les
+filets (n'a d'intérêt que si |draw|, |hvlines|,
+|hlines| ou |vlines| est utilisée) ;
+\item la clé \Definition{rounded-corners} impose des coins arrondis (pour le
+cadre dessiné par |draw| et le fond dessiné par |fill|)
+avec un rayon égal à la valeur de cette clé (la valeur par défaut est
+4~pt\footnote{Cette valeur par défaut est la valeur initiale des \emph{rounded
+ corners} de TikZ.}) ;
+\item quand la clé \Definition{tikz} est utilisée, le chemin TikZ correspondant
+au rectangle délimitant le bloc est exécuté avec TikZ\footnote{TikZ doit être
chargé préalablement (par défaut, \pkg{nicematrix} ne charge que
\textsc{pgf}), faute de quoi, une erreur sera levée.} en utilisant comme
options la valeur de cette clé |tikz| (qui doit donc être une liste de clés TikZ
applicables à un chemin de TikZ). Pour des exemples d'utilisation de cette clé
|tikz|, voir p.~\pageref{tikz-key-examples} ;
-\item la clé |name| donne un nom au nœud TikZ rectangulaire correspondant au
-bloc ; on peut utiliser ce nom avec TikZ dans le |\CodeAfter| (cf.~p.~\pageref{code-after});
-\item la clé |respect-arraystretch| évite la remise à $1$ de |\arraystretch| en
-début de bloc (qui a lieu par défaut) ;
-\item la clé |borders| permet de ne tracer que certaines des bordures du bloc :
-cette clé prend comme valeur une liste d'éléments parmi les suivants : |left|,
-|right|, |top| et |bottom| ; on peut en fait, dans la liste qui est la valeur de
-la clé |borders| mettre une entrée de la forme |tikz={|\textsl{liste}|}| où
-\textsl{liste} est une liste de couples \textsl{clé=valeur} de TikZ spécifiant
-les caractéristiques graphiques des traits qui seront dessinés (pour un exemple,
-voir p.~\pageref{tiretes}).
-
-\item \colorbox{yellow!50}{\textbf{Nouveau 6.15}}\par\nobreak
-Par défaut, les filets ne sont pas tracés dans les blocs (voir à ce sujet la
-partie sur les filets, section~\ref{rules} p.~\pageref{rules}). Néanmoins, si la
-clé |transparent| est utilisée, les filets seront tracés. Pour un example, voir
-la section~\ref{tikz-key-examples}, page~\pageref{tikz-key-examples}.
+\item la clé \Definition{name} donne un nom au nœud TikZ rectangulaire
+correspondant au bloc ; on peut utiliser ce nom avec TikZ dans le |\CodeAfter|
+(cf.~p.~\pageref{code-after});
+\item la clé \Definition{respect-arraystretch} évite la remise à $1$ de
+|\arraystretch| en début de bloc (qui a lieu par défaut) ;
+\item la clé \Definition{borders} permet de ne tracer que certaines des bordures
+du bloc : cette clé prend comme valeur une liste d'éléments parmi les suivants :
+|left|, |right|, |top| et |bottom| ; on peut en fait, dans la liste qui est la
+valeur de la clé |borders| mettre une entrée de la forme
+|tikz={|\textsl{liste}|}| où \textsl{liste} est une liste de couples
+\textsl{clé=valeur} de TikZ spécifiant les caractéristiques graphiques des
+traits qui seront dessinés (pour un exemple, voir p.~\pageref{tiretes}).
+
+\item \colorbox{yellow!50}{\textbf{Nouveau 6.15}}\par\nobreak Par défaut, les
+filets ne sont pas tracés dans les blocs (voir à ce sujet la partie sur les
+filets, section~\ref{rules} p.~\pageref{rules}). Néanmoins, si la clé
+\Definition{transparent} est utilisée, les filets seront tracés. Pour un
+example, voir la section~\ref{tikz-key-examples},
+page~\pageref{tikz-key-examples}.
\end{itemize}
@@ -1080,7 +1089,7 @@ Avec \pkg{nicematrix}, il est possible de spécifier une couleur même si
nommée également |\arrayrulecolor|. Les environnements de \pkg{nicematrix}
proposent également une clé |rules/color| qui permet de fixer cette couleur pour
l'environnement en question. Cette clé fixe localement la couleur des filets
-(alors que la commande |\arrayrulecolor| agit globalement).
+(alors que la commande |\arrayrulecolor| agit globalement !).
\medskip
\begin{scope}
@@ -1200,7 +1209,9 @@ arum & iris & jacinthe & muguet
\medskip
La clé |hvlines-except-borders| est similaire à la clé |hvlines| mais ne trace
-pas les filets sur les bords horizontaux et verticaux du tableau.
+pas les filets sur les bords horizontaux et verticaux du tableau. Pour un
+exemple d'utilisation de cette clé, voir la partie «Exemple d'utilisation avec
+tcolorbox» p.~\pageref{tcolorbox}.
\medskip
\subsubsection{Les coins (vides)}
@@ -1630,7 +1641,7 @@ peut placer le contenu de ce |code-before| entre les mots-clés |\CodeBefore| et
\begin{Verbatim}
\begin{pNiceArray}{~textsl#preamble@}
-~emphase#\CodeBefore@
+~emphase#\CodeBefore [~textsl#options@]@
~textsl#instructions du code-before@
~emphase#\Body@
~textsl#contenu de l'environnement@
@@ -1638,6 +1649,12 @@ peut placer le contenu de ce |code-before| entre les mots-clés |\CodeBefore| et
\end{Verbatim}
\smallskip
+L'argument optionnel entre crochets est une liste de couples \textsl{clé=valeur}
+qui seront présentées au fur et à mesure. \footnote{Les clés disponibles sont
+ \texttt{create-cell-nodes}, \texttt{sub-matrix} (et ses sous-clés) et
+ \texttt{delimiters-color}.}
+
+\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
@@ -3160,6 +3177,79 @@ $\begin{bNiceMatrix}[margin,hvlines]
0 & \Cdots& 0 & 0
\end{bNiceMatrix}$
+\section{Délimiteurs dans le préambule de l'environnement}
+
+\colorbox{yellow!50}{\textbf{Modifié 6.16}}\enskip Pour les environnements à
+préambule (|{NiceArray}|, |{pNiceArray}|, etc.), il est possible de placer des
+délimiteurs verticaux directement dans le préambule.\footnote{Cette syntaxe est
+ inspirée de l'extension \pkg{blkarray}.}
+\label{delimiters-in-preamble}%
+
+\smallskip
+Les délimiteurs ouvrants doivent être précédés du mot-clé |\left| et les
+délimiteurs fermants du mot-clé |\right|. Les mots-clés |\left| et |\right| n'ont
+pas d'obligation à être utilisés par paires.
+
+\smallskip
+Tous les délimiteurs extensibles de LaTeX peuvent être utilisés.
+
+\medskip
+Voici un exemple qui utilise |\lgroup| et |\rgroup|.
+
+\medskip
+\begin{BVerbatim}
+$\begin{NiceArray}{~emphase#\left\lgroup@ ccc~emphase#\right\rgroup@ l}
+1 & 2 & 3 &
+4 & 1 & 6 &
+7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2
+\end{NiceArray}$
+\end{BVerbatim}
+
+\[\begin{NiceArray}{\left\lgroup ccc\right\rgroup l}
+1 & 2 & 3 & \\
+4 & 1 & 6 & \\
+7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2
+\end{NiceArray}\]
+
+\medskip
+Pour cet exemple, on aurait aussi pu utiliser |{NiceArrayWithDelims}|
+(cf. la partie \ref{NiceArrayWithDelims}, p.~\pageref{NiceArrayWithDelims})
+et la clé |last-col| (cf. p.~\pageref{exterior}).
+
+\bigskip
+Il y a un cas particulier : pour les délimiteurs |(|, |[| et |\{| (et les
+délimiteurs fermants correspondants), les préfixes |\left| et |\right| sont
+facultatifs.\footnote{Pour les délimiteurs \texttt{[} et \texttt{]},
+ les préfixes restent obligatoires en cas de conflit de notation avec des
+ crochets d'options de certains descripteurs de colonnes.}
+
+\bigskip
+Dans le cas de deux délimiteurs successifs (nécessairement un fermant suivi d'un
+ouvrant pour une autre sous-matrice) un espace égal à |\enskip| est inséré
+automatiquement.
+
+\medskip
+\begin{BVerbatim}
+$\begin{pNiceArray}{~emphase#(c)(c)(c)@}
+a_{11} & a_{12} & a_{13} \\
+a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
+a_{31} & a_{32} & a_{33}
+\end{pNiceArray}$
+\end{BVerbatim}
+
+\[\begin{pNiceArray}{(c)(c)(c)}
+a_{11} & a_{12} & a_{13} \\
+a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
+a_{31} & a_{32} & a_{33}
+\end{pNiceArray}\]
+
+
+\bigskip
+Pour des constructions plus complexes, avec en particulier des délimiteurs ne
+couvrant pas toutes les rangées, on aura intérêt à considérer la commande
+|\SubMatrix| disponible dans le |\CodeAfter|: voir la partie~\ref{sub-matrix},
+p.~\pageref{sub-matrix}.
+
\section{Le \textbackslash CodeAfter}
@@ -3255,7 +3345,8 @@ autres lignes diagonales (par défaut, les lignes tracées par |\Ddots| sont
\end{bNiceMatrix}\]
-\subsection{La commande \textbackslash SubMatrix dans le \textbackslash CodeAfter}
+\subsection{La commande \textbackslash SubMatrix dans le \textbackslash
+ CodeAfter (et aussi le \textbackslash CodeBefore)}
\label{sub-matrix}
@@ -3279,7 +3370,7 @@ crochet est alors le délimiteur gauche de la sous-matrice (ex. :
|\SubMatrix[{2-2}{4-7}]|).}
\end{itemize}
-On remarquera que la commande |\SubMatrix| trace les délimiteurs après la
+On remarquera que la commande |\SubMatrix| trace les délimiteurs \emph{après} la
construction de la matrice : aucun espace n'est inséré par la commande
|\SubMatrix|. C'est pourquoi, dans l'exemple suivant, on a utilisé la clé
|margin| et on a inséré à la main de l'espace entre la troisième et la quatrième
@@ -3310,6 +3401,31 @@ $\begin{NiceArray}{ccc@{\hspace{1.5em}}c}[cell-space-limits=2pt,margin]
\end{NiceArray}$
\medskip
+En fait, dans cet exemple, il aurait sans doute été plus simple de mettre des
+délimiteurs directement dans le préambule de l'environnement |{NiceArray}| (voir
+la section~\ref{delimiters-in-preamble}, p.~\pageref{delimiters-in-preamble})
+avec la construction suivante.
+
+\medskip
+\begin{scope}
+\hfuzz=15cm
+\begin{BVerbatim}[boxwidth=11cm,baseline=c]
+$\begin{NiceArray}{~emphase#(ccc)(c)@}[cell-space-limits=2pt]
+ 1 & 1 & 1 & x \\
+\dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
+ 1 & 2 & 3 & z
+\end{NiceArray}$
+\end{BVerbatim}
+\end{scope}
+$\begin{NiceArray}{(ccc)(c)}[cell-space-limits=2pt]
+ 1 & 1 & 1 & x \\
+\dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
+ 1 & 2 & 3 & z
+\end{NiceArray}$
+
+
+
+\bigskip
La commande |\SubMatrix| accepte en fait également deux arguments optionnels
spécifiés par les symboles traditionnels |^| et |_| pour des éléments en
exposant et en indice.
@@ -3336,7 +3452,7 @@ $\begin{bNiceMatrix}[right-margin=1em]
\end{scope}
-\medskip
+\bigskip
Les clés disponibles pour la commande |\SubMatrix| sont les suivantes :
%
\begin{itemize}
@@ -3356,9 +3472,12 @@ contenu des cases des colonnes mises en jeu (voir exemple ci-dessous) ;
la sous-matrice (si cette clé est utilisée sans valeur, tous les filets
verticaux sont tracés) ;
\item |hlines| est similaire à |vlines| mais pour les filets horizontaux ;
-\item |hvlines|, qui s'utilise sans valeur, trace tous les filets dans la sous-matrice.
+\item |hvlines|, qui s'utilise sans valeur, trace tous les filets dans la
+sous-matrice ;
+\item |code| permet d'insérer du code, en particulier du code TikZ, après la
+construction de la matrice. Cette clé est décrite en détail plus loin.
\end{itemize}
-On remarquera que tous ces filets sont dessinés après la construction du tableau
+On remarquera que tous les filets sont dessinés après la construction du tableau
principal : les colonnes et les rangées ne sont pas écartées.
\medskip
@@ -3433,32 +3552,6 @@ 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}.
-\medskip
-Il est également possible de spécifier des délimiteurs\footnote{Les délimiteurs
- en question sont |(|, |[| et |\{| et les fermants correspondants.
- On peut bien sûr aussi mettre des \verb+|+ et des \verb+||+ dans le
- préambule.} en les plaçant dans le préambule de l'environnement (pour les
-environnements à préambule : |{NiceArray}|, |{pNiceArray}|, etc.). Cette syntaxe
-est inspirée de l'extension \pkg{blkarray}.
-
-Dans le cas de deux délimiteurs successifs (nécessairement un fermant suivi d'un
-ouvrant pour une autre sous-matrice) un espace égal à |\enskip| est inséré
-automatiquement.
-
-\medskip
-\begin{BVerbatim}
-$\begin{pNiceArray}{~emphase#(c)(c)(c)@}
-a_{11} & a_{12} & a_{13} \\
-a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
-a_{31} & a_{32} & a_{33}
-\end{pNiceArray}$
-\end{BVerbatim}
-
-\[\begin{pNiceArray}{(c)(c)(c)}
-a_{11} & a_{12} & a_{13} \\
-a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
-a_{31} & a_{32} & a_{33}
-\end{pNiceArray}\]
\bigskip
La commande |\SubMatrix| est en fait aussi disponible dans le |\CodeBefore|.
@@ -3471,10 +3564,11 @@ Pour un exemple, voir \ref{submatrix-in-codebefore}
p.~\pageref{submatrix-in-codebefore}.
\bigskip
-En dépit de son nom, la commande |\SubMatrix| peut être utilisée également dans
+En dépit de son nom, la commande |\SubMatrix| peut également être utilisée dans
|{NiceTabular}| comme dans l'exemple suivant (qui utilise |\bottomrule| et
-|\toprule| de \pkg{booktabs}).
+|\toprule| de l'extension \pkg{booktabs}).
+\smallskip
\begin{BVerbatim}[baseline=c]
\begin{NiceTabular}{~@{}ll~@{}}
\toprule
@@ -3498,7 +3592,52 @@ Part A & the first part \\
\end{NiceTabular}
+\vspace{1cm}
+\colorbox{yellow!50}{\textbf{Nouveau 6.16}}\enskip La clé |code| de la commande
+|\SubMatrix| permet d'insérer du code après la création de la matrice. Elle a
+surtout pour vocation d'être utilisée pour insérer des instructions TikZ,
+sachant que, dans les instructions TikZ insérées dans cette clé, les nœuds de la
+forme |i-j| et \verb+i-|j+ sont interprétés avec |i| et |j| étant des numéros de
+ligne et colonne \emph{relatifs à la sous-matrice}.
+\medskip
+\begin{scope}
+\fvset{commandchars=\~\#\!}%
+\begin{Verbatim}
+$\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc}
+ & & && -1 & 1 & 2 \\
+ & & && 0 & 3 & 4 \\
+ & & && 0 & 0 & 5 \\
+ 1 & 2 & 3 && -1 & 7 & 25 \\
+ 0 & 4 & 5 && 0 & 12 & 41 \\
+ 0 & 0 & 6 && 0 & 0 & 30
+\CodeAfter
+ ~emphase#\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}!
+ \SubMatrix({1-5}{3-7})[~emphase#code = \MyDraw!]
+ \SubMatrix({4-1}{6-3})[~emphase#code = \MyDraw!]
+ \SubMatrix({4-5}{6-7})[~emphase#code = \MyDraw!]
+\end{NiceArray}$
+\end{Verbatim}
+\end{scope}
+
+
+\[\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc}
+ & & && -1 & 1 & 2 \\
+ & & && 0 & 3 & 4 \\
+ & & && 0 & 0 & 5 \\
+ 1 & 2 & 3 && -1 & 7 & 25 \\
+ 0 & 4 & 5 && 0 & 12 & 41 \\
+ 0 & 0 & 6 && 0 & 0 & 30
+\CodeAfter
+ \NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}
+ \SubMatrix({1-5}{3-7})[code = \MyDraw ]
+ \SubMatrix({4-1}{6-3})[code = \MyDraw ]
+ \SubMatrix({4-5}{6-7})[code = \MyDraw ]
+\end{NiceArray}\]
+
+\medskip
+Comme on le voit, le tracé effectué par la commande |\MyDraw| est \emph{relatif}
+à la sous-matrice à laquelle elle s'applique.
\subsection{Les commandes \textbackslash OverBrace et \textbackslash
UnderBrace dans le \textbackslash CodeAfter}
@@ -3961,6 +4100,8 @@ suivant (avec une version de LaTeX postérieure à 2020/10/01).
\makeatother
\end{Verbatim}
+Néanmoins, les fonctionnalités proposées par \pkg{nicematrix} rendent peu
+utile l'utilisation de \pkg{threeparttable} en conjonction avec \pkg{nicematrix}.
\section{Autres fonctionnalités}
@@ -4160,6 +4301,13 @@ En fait, l'option |small| correspond aux réglages suivants :
\item les caractéristiques des lignes en pointillés sont également modifiées.
\end{itemize}
+\medskip
+Quand la clé |small| est active, certaines fonctionnalités de \pkg{nicematrix}
+ne sont plus disponibles: par exemple, il n'est plus possible de mettre des
+délimiteurs directement dans le préambule d'un environnement avec préambule (cf.
+partie \ref{delimiters-in-preamble}, p.~\pageref{delimiters-in-preamble}).
+
+
\subsection{Les compteurs iRow et jCol}
\label{iRow}
@@ -4299,6 +4447,8 @@ Cette couleur s'applique aussi aux délimiteurs tracés par |\SubMatrix|
\subsection{L'environnement \{NiceArrayWithDelims\}}
+\label{NiceArrayWithDelims}
+
En fait, l'environnement |{pNiceArray}| et ses variantes sont fondés sur un
environnement plus général, appelé |{NiceArrayWithDelims}|. Les deux premiers
arguments obligatoires de cet environnement sont les délimiteurs gauche et droit
@@ -5168,8 +5318,9 @@ L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess
\url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}
\medskip
-Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{aastex631}, on doit
-ajouter dans le préambule du fichier les lignes suivantes :
+Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{aastex631} (de
+l'\emph{American Astronomical Society}, on doit ajouter dans le préambule du
+fichier les lignes suivantes :
\begin{Verbatim}
\BeforeBegin{NiceTabular}{\let\begin\BeginEnvironment\let\end\EndEnvironment}
@@ -5178,8 +5329,9 @@ ajouter dans le préambule du fichier les lignes suivantes :
\end{Verbatim}
\medskip
-Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{sn-jnl}, \pkg{pgf}
-doit être chargé avant le |\documentclass|:
+Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{sn-jnl} (de
+\emph{Springer Nature}), \pkg{pgf} doit être chargé avant le |\documentclass|
+avec |\RequirePackage|:
\begin{Verbatim}
\RequirePackage{pgf}
@@ -5196,7 +5348,7 @@ L'extension \pkg{nicematrix} n'est pas parfaitement compatible avec l'extension
\pkg{arydshln} (parce que cette extension redéfinit de nombreuses commandes
internes de \pkg{array}). De toutes manières, dans le cadre de \pkg{nicematrix},
il est conseillé de tracer les filets en tiretés avec les commandes de
-\pkg{nicematrix} en créant un style de ligne personnalisée avec |custom-line| :
+\pkg{nicematrix} en créant un style de ligne personnalisé avec |custom-line| :
cf.~p.~\pageref{custom-line}.
\medskip
@@ -5256,7 +5408,7 @@ Pour l'exemple suivant, la bibliothèque \pkg{patterns} de TikZ doit aussi être
\bigskip
Dans l'exemple suivant, on utilise la clé |tikz| pour hachurer une ligne du
tableau. On remarquera que l'on utilise la clé |transparent| de la commande
-|\Block| pour que les filets sont tracés dans le bloc.\footnote{Par défaut, les filets ne sont pas tracés dans les blocs créés avec la commande
+|\Block| pour que les filets soient tracés dans le bloc.\footnote{Par défaut, les filets ne sont pas tracés dans les blocs créés avec la commande
\texttt{\textbackslash Block} : cf.~section~\ref{rules} p.~\pageref{rules}}
\begin{Verbatim}
@@ -5282,6 +5434,116 @@ sept & huit & neuf
\end{NiceTabular}
\end{center}
+\subsection{Utilisation avec tcolorbox}
+
+\label{tcolorbox}
+
+Voici un exemple d'utilisation de |{NiceTabular}| dans une commande |\tcbox| de
+\pkg{tcolorbox}. On a utilisé la clé |hvlines-except-borders| pour faire afficher
+tous les filets sauf ceux sur les bords (qui sont, bien entendu, ajoutés par
+\pkg{tcolorbox}).
+
+\medskip
+\begin{BVerbatim}
+\tcbset
+ {
+ colframe = blue!50!black ,
+ colback = white ,
+ colupper = red!50!black ,
+ fonttitle = \bfseries ,
+ nobeforeafter ,
+ center title
+ }
+
+\tcbox
+ [
+ left = 0mm ,
+ right = 0mm ,
+ top = 0mm ,
+ bottom = 0mm ,
+ boxsep = 0mm ,
+ toptitle = 0.5mm ,
+ bottomtitle = 0.5mm ,
+ title = My table
+ ]
+ {
+ \renewcommand{\arraystretch}{1.2}% <-- the % is mandatory here
+ \begin{NiceTabular}{rcl}[~emphase#hvlines-except-borders@,rules/color=blue!50!black]
+ \CodeBefore
+ \rowcolor{red!15}{1}
+ \Body
+ One & Two & Three \\
+ Men & Mice & Lions \\
+ Upper & Middle & Lower
+ \end{NiceTabular}
+ }
+\end{BVerbatim}
+
+\medskip
+\begin{center}
+\tcbset
+ {
+ colframe = blue!50!black ,
+ colback = white ,
+ colupper = red!50!black ,
+ fonttitle = \bfseries ,
+ nobeforeafter ,
+ center title
+ }
+
+\tcbox
+ [
+ left = 0mm ,
+ right = 0mm ,
+ top = 0mm ,
+ bottom = 0mm ,
+ boxsep = 0mm ,
+ toptitle = 0.5mm ,
+ bottomtitle = 0.5mm ,
+ title = My table
+ ]
+ {
+ \renewcommand{\arraystretch}{1.2}%
+ \begin{NiceTabular}{rcl}[hvlines-except-borders,rules/color=blue!50!black]
+ \CodeBefore
+ \rowcolor{red!15}{1}
+ \Body
+ One & Two & Three \\
+ Men & Mice & Lions \\
+ Upper & Middle & Lower
+ \end{NiceTabular}
+ }
+\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}
\label{ex:notes}
@@ -5356,7 +5618,7 @@ Nom & Prénom & Date de naissance \\
\midrule
Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}!
& Jacques & 5 juin 1962 \\
-Lefèbvre~emphase#\tabularnote{Le patronyme Lefèbvre est une altération de Lefébure.}!
+Lefèbvre~emphase#\tabularnote{Le patronyme Lefebvre est une altération de Lefébure.}!
& Mathilde & 23 mai 1988 \\
Vanesse & Stéphanie & 30 octobre 1994 \\
Dupont & Chantal & 15 janvier 1998 \\
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 3083528029..6ef8d2a7f7 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -17,8 +17,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.15}
-\def\myfiledate{2023/02/25}
+\def\myfileversion{6.16}
+\def\myfiledate{2023/03/06}
%
%
%<*batchfile>
@@ -60,6 +60,7 @@ version 2005/12/01 or later.
\usepackage{siunitx}
\usepackage{caption}
\usepackage{varwidth}
+\usepackage{tcolorbox}
\usepackage[auto-lang=false]{lipsum}
\NewDocumentEnvironment {scope} {} {} {}
@@ -533,54 +534,58 @@ version 2005/12/01 or later.
% \end{bNiceArray}$
% \end{scope}
%
+% \NewDocumentCommand{\Definition}{m}
+% {{\setlength{\fboxsep}{1pt}\colorbox{gray!20}{\ttfamily \vphantom{gl}#1}}}
+%
%
% \interitem
% In fact, the command |\Block| accepts as first optional argument (between
% square brackets) a list of couples \textsl{key=value}. The available keys are as
% follows:
% \begin{itemize}
-% \item the keys |l|, |c| and |r| are used to fix the horizontal position of the
-% content of the block, as explained previously;
-% \item the key |fill| takes in as value a color and fills the block with that
+% \item the key \Definition{fill} takes in as value a color and fills the block
+% with that color;
+% \item the key \Definition{draw} takes in as value a color and strokes the
+% frame of the block with that color (the default value of that key is the
+% current color of the rules of the array);
+% \item the key \Definition{color} takes in as value a color and apply that
+% color the content of the block but draws also the frame of the block with that
% color;
-% \item the key |draw| takes in as value a color and strokes the frame of the
-% block with that color (the default value of that key is the current color of
-% the rules of the array);
-% \item the key |color| takes in as value a color and apply that color the
-% content of the block but draws also the frame of the block with that color;
-% \item the keys |hlines|, |vlines| and |hvlines| draw all the corresponding
-% rules in the block;\footnote{However, the rules are not drawn in the
-% sub-blocks of the block, as always with \pkg{nicematrix}: the rules are not
-% drawn in the blocks (cf. section~\ref{rules} p.~\pageref{rules}).}
-% \item the key |line-width| is the width of the rules (this key
+% \item the keys \Definition{hlines}, \Definition{vlines} and
+% \Definition{hvlines} draw all the corresponding rules in the
+% block;\footnote{However, the rules are not drawn in the sub-blocks of the
+% block, as always with \pkg{nicematrix}: the rules are not drawn in the blocks
+% (cf. section~\ref{rules} p.~\pageref{rules}).}
+% \item the key \Definition{line-width} is the width of the rules (this key
% is meaningful only when one of the keys |draw|, |hvlines|, |vlines| and
% |hlines| is used);
-% \item the key |rounded-corners| requires rounded corners (for the frame drawn
-% by |draw| and the shape drawn by |fill|) with a radius equal to the value of
-% that key (the default value is 4~pt\footnote{This value is the initial value
-% of the \emph{rounded corners} of Tikz.});
-% \item when the key |tikz| is used, the Tikz path corresponding of the
-% rectangle which delimits the block is executed with Tikz\footnote{Tikz should
-% be loaded (by default, \pkg{nicematrix} only loads \textsc{pgf}) and, if it's
-% not, an error will be raised.} by using as options the value of that key
-% |tikz| (which must be a list of keys allowed for a Tikz path). For examples,
-% cf. p.~\pageref{tikz-key-examples};
-% \item the key |name| provides a name to the rectangular Tikz node
+% \item the key \Definition{rounded-corners} requires rounded corners (for the
+% frame drawn by |draw| and the shape drawn by |fill|) with a radius equal to
+% the value of that key (the default value is 4~pt\footnote{This value is the
+% initial value of the \emph{rounded corners} of Tikz.});
+% \item when the key \Definition{tikz} is used, the Tikz path corresponding of
+% the rectangle which delimits the block is executed with Tikz\footnote{Tikz
+% should be loaded (by default, \pkg{nicematrix} only loads \textsc{pgf}) and,
+% if it's not, an error will be raised.} by using as options the value of that
+% key |tikz| (which must be a list of keys allowed for a Tikz path). For
+% examples, cf. p.~\pageref{tikz-key-examples};
+% \item the key \Definition{name} provides a name to the rectangular Tikz node
% corresponding to the block; it's possible to use that name with Tikz in the
% |\CodeAfter| of the environment (cf.~p.~\pageref{code-after});
-% \item the key |respect-arraystretch| prevents the setting of |\arraystretch|
-% to $1$ at the beginning of the block (which is the behaviour by default) ;
-% \item the key |borders| provides the ability to draw only some borders of the
-% blocks; the value of that key is a (comma-separated) list of elements covered
-% by |left|, |right|, |top| and |bottom|; it's possible, in fact, in the list
-% which is the value of the key |borders|, to add an entry of the form
-% |tikz={|\textsl{list}|}| where \textsl{list} is a list of couples
+% \item the key \Definition{respect-arraystretch} prevents the setting of
+% |\arraystretch| to $1$ at the beginning of the block (which is the behaviour
+% by default) ;
+% \item the key \Definition{borders} provides the ability to draw only some
+% borders of the blocks; the value of that key is a (comma-separated) list of
+% elements covered by |left|, |right|, |top| and |bottom|; it's possible, in
+% fact, in the list which is the value of the key |borders|, to add an entry of
+% the form |tikz={|\textsl{list}|}| where \textsl{list} is a list of couples
% \textsl{key=value} of Tikz specifying the graphical characteristics of the
-% lines that will be drawn (for an example, see p.~\pageref{dashed}).
+% lines that will be drawn (for an example, see p.~\pageref{dashed}).
% \item \colorbox{yellow!50}{\textbf{Nouveau 6.15}}\par\nobreak
% By default, the rules are not drawn in the blocks (see the section about the
% rules: section~\ref{rules} p.~\pageref{rules}). However, if the key
-% |transparent| is used, the rules are drawn. For an example, see
+% \Definition{transparent} is used, the rules are drawn. For an example, see
% section~\ref{tikz-key-examples} on page~\pageref{tikz-key-examples}.
% \end{itemize}
%
@@ -1115,7 +1120,7 @@ version 2005/12/01 or later.
% also named |\arrayrulecolor|. The environments of \pkg{nicematrix} also
% provide a key |rules/color| to fix the color of the rules in the current
% environment. This key sets the value locally (whereas |\arrayrulecolor| acts
-% globally).
+% globally!).
%
% \medskip
% \begin{scope}
@@ -1231,7 +1236,9 @@ version 2005/12/01 or later.
%
% \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.
+% draw the rules on the horizontal and vertical borders of the array. For an
+% example of use of that key, see the part ``Use with tcolorbox`,
+% p.~\pageref{tcolorbox}.
%
% \subsubsection{The (empty) corners}
%
@@ -1645,13 +1652,20 @@ version 2005/12/01 or later.
%
% \begin{Verbatim}
% \begin{pNiceArray}{~textsl#preamble@}
-% ~emphase#\CodeBefore@
+% ~emphase#\CodeBefore [~textsl#options@]@
% ~textsl#instructions of the code-before@
% ~emphase#\Body@
% ~textsl#contents of the environment@
% \end{pNiceArray}
% \end{Verbatim}
%
+% \smallskip
+% The optional argument between square brackets is a list of \textsl{key=value}
+% pairs which will be presented progressively in this
+% documentation.\footnote{The available keys are |create-cell-nodes|,
+% |sub-matrix| (and its subkeys) and \texttt{delimiters-color}.}
+%
+% \medskip
% New commands are available in that |\CodeBefore|: |\cellcolor|,
% |\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors|,
% |\rowlistcolors|, |\chessboardcolors| and |\arraycolor|.\footnote{Remark that,
@@ -2689,7 +2703,7 @@ version 2005/12/01 or later.
% \end{bNiceMatrix}$
%
% \bigskip
-% In the first column of this exemple, there are two instructions |\Vdots| but,
+% In the first column of this example, there are two instructions |\Vdots| but,
% of course, only one dotted line is drawn.
%
% \bigskip
@@ -3129,6 +3143,81 @@ version 2005/12/01 or later.
% \end{bNiceMatrix}$
%
%
+% \section{Delimiters in the preamble of the environnment}
+%
+% \label{delimiters-in-preamble}
+%
+% \colorbox{yellow!50}{\textbf{New 6.16}\enskip}
+% In the environments with preamble (|{NiceArray}|, |{pNiceArray}|, etc.), it's
+% possible to put vertical delimiters directly in the preamble of the
+% environnment.\footnote{This syntax is inspired by the extension \pkg{blkarray}.}
+%
+% \smallskip
+% The opening delimiters should be prefixed by the keyword |\left| and the
+% closing delimiters by the keyword |\right|. It's not mandatory to use
+% |\left| and |\right| pair-wise.
+%
+% \smallskip
+% All the vertical extensible delimiters of LaTeX are allowed.
+%
+% \medskip
+% Here is a example which uses the delimiters |\lgroup| and |\rgroup|.
+%
+% \smallskip
+% \begin{BVerbatim}
+% $\begin{NiceArray}{~emphase#\left\lgroup@ ccc~emphase#\right\rgroup@ l}
+% 1 & 2 & 3 &
+% 4 & 1 & 6 &
+% 7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2
+% \end{NiceArray}$
+% \end{BVerbatim}
+%
+% \[\begin{NiceArray}{\left\lgroup ccc\right\rgroup l}
+% 1 & 2 & 3 & \\
+% 4 & 1 & 6 & \\
+% 7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2
+% \end{NiceArray}\]
+%
+% \medskip
+% For this example, it would also have been possible to use the environnment
+% |{NiceArrayWithDelims}| (cf. the section \ref{NiceArrayWithDelims},
+% p.~\pageref{NiceArrayWithDelims}) and the key |last-col| (cf. p.~\pageref{exterior}).
+%
+% \bigskip
+% There is a particular case: for the delimiters |(|, |[| and |\{| (and the
+% corresponding closing delimiters), the prefixes |\left| et |\right| are
+% optional.\footnote{For the delimiters |[| and |]|, the prefixes remain mandatory
+% when there is a conflict of notation with the square brackets for the options
+% of some descriptors of columns.}
+%
+%
+%
+% \bigskip
+% When there are two successive delimiters (necessarily a closing one following by
+% an opening one for another submatrix), a space equal to |\enskip| is
+% automatically inserted.
+%
+% \medskip
+% \begin{BVerbatim}
+% $\begin{pNiceArray}{~emphase#(c)(c)(c)@}
+% a_{11} & a_{12} & a_{13} \\
+% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
+% a_{31} & a_{32} & a_{33}
+% \end{pNiceArray}$
+% \end{BVerbatim}
+%
+% \[\begin{pNiceArray}{(c)(c)(c)}
+% a_{11} & a_{12} & a_{13} \\
+% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
+% a_{31} & a_{32} & a_{33}
+% \end{pNiceArray}\]
+%
+%
+% \bigskip
+% For more complex constructions, in particular with delimiters spanning only a
+% \emph{subset} of the rows of the array, one should consider the command
+% |\SubMatrix| available in the |\CodeAfter|. See the section~\ref{sub-matrix},
+% p.~\pageref{sub-matrix}.
%
% \section{The \textbackslash CodeAfter}
%
@@ -3222,34 +3311,9 @@ version 2005/12/01 or later.
%
%
%
-% \bigskip
-% Despite its name, the command |\SubMatrix| may also be used within a
-% |{NiceTabular}|. Here is an example (which uses |\bottomrule| and
-% |\toprule| of \pkg{booktabs}).
-%
-% \begin{BVerbatim}[baseline=c]
-% \begin{NiceTabular}{~@{}ll~@{}}
-% \toprule
-% Part A & the first part \\
-% \Block{2-1}{Part B} & a first sub-part \\
-% & a second sub-part \\
-% \bottomrule
-% \CodeAfter
-% ~emphase#\SubMatrix{\{}{2-2}{3-2}{.}@
-% \end{NiceTabular}
-% \end{BVerbatim}
-% \hspace{2cm}
-% \begin{NiceTabular}{@{}ll@{}}
-% \toprule
-% Part A & the first part \\
-% \Block{2-1}{Part B} & a first sub-part \\
-% & a second sub-part \\
-% \bottomrule
-% \CodeAfter
-% \SubMatrix{\{}{2-2}{3-2}{.}
-% \end{NiceTabular}
%
-% \subsection{The command \textbackslash SubMatrix in the \textbackslash CodeAfter}
+% \subsection{The command \textbackslash SubMatrix in the \textbackslash
+% CodeAfter (and also the \textbackslash CodeBefore)}
%
% \label{sub-matrix}
%
@@ -3272,7 +3336,7 @@ version 2005/12/01 or later.
% |\SubMatrix[{2-2}{4-7}]|).}
% \end{itemize}
%
-% One should remark that the command |\SubMatrix| draws the delimiters after the
+% One should remark that the command |\SubMatrix| draws the delimiters \emph{after} the
% construction of the array: no space is inserted by the command |\SubMatrix|
% itself. That's why, in the following example, we have used the key |margin|
% and you have added by hand some space between the third and fourth column with
@@ -3302,6 +3366,29 @@ version 2005/12/01 or later.
% \SubMatrix({1-4}{3-4})
% \end{NiceArray}$
%
+% \medskip
+% Eventually, in this example, it would probably have been easier to put the
+% delimiters directly in the preamble of |{NiceArray}| (see
+% section~\ref{delimiters-in-preamble}, p.~\pageref{delimiters-in-preamble})
+% with the following construction.
+%
+% \medskip
+% \begin{scope}
+% \hfuzz=15cm
+% \begin{BVerbatim}[boxwidth=11cm,baseline=c]
+% $\begin{NiceArray}{~emphase#(ccc)(c)@}[cell-space-limits=2pt]
+% 1 & 1 & 1 & x \\
+% \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
+% 1 & 2 & 3 & z
+% \end{NiceArray}$
+% \end{BVerbatim}
+% \end{scope}
+% $\begin{NiceArray}{(ccc)(c)}[cell-space-limits=2pt]
+% 1 & 1 & 1 & x \\
+% \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
+% 1 & 2 & 3 & z
+% \end{NiceArray}$
+%
% \bigskip
% In fact, the command |\SubMatrix| also takes in two optional arguments
% specified by the traditional symbols |^| and |_| for material in superscript
@@ -3349,9 +3436,11 @@ version 2005/12/01 or later.
% the sub-matrix are drawn);
% \item |hlines| is similar to |vlines| but for the horizontal rules;
% \item |hvlines|, which must be used without value, draws all the vertical and
-% horizontal rules.
+% horizontal rules;
+% \item |code| insert code, especially TikZ code, after the construcion of the
+% submatrix. That key is detailed below.
% \end{itemize}
-% One should remark that these keys add their rules after the construction of
+% One should remark that the keys add their rules after the construction of
% the main matrix: no space is added between the rows and the columns of the
% array for theses rules.
%
@@ -3428,32 +3517,32 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% It's also possible to specify some delimiters\footnote{Those delimiters are
-% |(|, |[|, |\{| and the closing ones. Of course, it's also
-% possible to put \verb+|+ and \verb+||+ in the preamble of the environement.}
-% by placing them in the preamble of the environment (for the environments with
-% a preamble: |{NiceArray}|, |{pNiceArray}|, etc.). This syntax is inspired by
-% the extension \pkg{blkarray}.
-%
-% When there are two successive delimiters (necessarily a closing one following by
-% an opening one for another submatrix), a space equal to |\enskip| is
-% automatically inserted.
+% Despite its name, the command |\SubMatrix| may also be used within a
+% |{NiceTabular}|. Here is an example (which uses |\bottomrule| and
+% |\toprule| of \pkg{booktabs}).
%
% \medskip
-% \begin{BVerbatim}
-% $\begin{pNiceArray}{~emphase#(c)(c)(c)@}
-% a_{11} & a_{12} & a_{13} \\
-% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
-% a_{31} & a_{32} & a_{33}
-% \end{pNiceArray}$
+% \begin{BVerbatim}[baseline=c]
+% \begin{NiceTabular}{~@{}ll~@{}}
+% \toprule
+% Part A & the first part \\
+% \Block{2-1}{Part B} & a first sub-part \\
+% & a second sub-part \\
+% \bottomrule
+% \CodeAfter
+% ~emphase#\SubMatrix{\{}{2-2}{3-2}{.}@
+% \end{NiceTabular}
% \end{BVerbatim}
-%
-% \[\begin{pNiceArray}{(c)(c)(c)}
-% a_{11} & a_{12} & a_{13} \\
-% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\
-% a_{31} & a_{32} & a_{33}
-% \end{pNiceArray}\]
-%
+% \hspace{2cm}
+% \begin{NiceTabular}{@{}ll@{}}
+% \toprule
+% Part A & the first part \\
+% \Block{2-1}{Part B} & a first sub-part \\
+% & a second sub-part \\
+% \bottomrule
+% \CodeAfter
+% \SubMatrix{\{}{2-2}{3-2}{.}
+% \end{NiceTabular}
%
% \bigskip
% The command |\SubMatrix| is, in fact, also available in the |\CodeBefore|. By
@@ -3464,6 +3553,55 @@ version 2005/12/01 or later.
% For an example, see voir \ref{submatrix-in-codebefore}
% p.~\pageref{submatrix-in-codebefore}.
%
+%
+%
+% \vspace{1cm}
+% \colorbox{yellow!50}{\textbf{New 6.16}}\enskip The key |code| of the command
+% |\SubMatrix| allows the insertion of code after the construction of the
+% submatrix. It's meant to be used to insert TikZ instructions because, in the
+% TikZ instructions inserted by that code, the nodes of the form |i-j| and
+% \verb+i-|j+ are interpreted with |i| and |j| as numbers of row and columns
+% \emph{relative to the submatrix}.
+%
+% \medskip
+% \begin{scope}
+% \fvset{commandchars=\~\#\!}%
+% \begin{Verbatim}
+% $\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc}
+% & & && -1 & 1 & 2 \\
+% & & && 0 & 3 & 4 \\
+% & & && 0 & 0 & 5 \\
+% 1 & 2 & 3 && -1 & 7 & 25 \\
+% 0 & 4 & 5 && 0 & 12 & 41 \\
+% 0 & 0 & 6 && 0 & 0 & 30
+% \CodeAfter
+% ~emphase#\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}!
+% \SubMatrix({1-5}{3-7})[~emphase#code = \MyDraw!]
+% \SubMatrix({4-1}{6-3})[~emphase#code = \MyDraw!]
+% \SubMatrix({4-5}{6-7})[~emphase#code = \MyDraw!]
+% \end{NiceArray}$
+% \end{Verbatim}
+% \end{scope}
+%
+%
+% \[\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc}
+% & & && -1 & 1 & 2 \\
+% & & && 0 & 3 & 4 \\
+% & & && 0 & 0 & 5 \\
+% 1 & 2 & 3 && -1 & 7 & 25 \\
+% 0 & 4 & 5 && 0 & 12 & 41 \\
+% 0 & 0 & 6 && 0 & 0 & 30
+% \CodeAfter
+% \NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}
+% \SubMatrix({1-5}{3-7})[code = \MyDraw ]
+% \SubMatrix({4-1}{6-3})[code = \MyDraw ]
+% \SubMatrix({4-5}{6-7})[code = \MyDraw ]
+% \end{NiceArray}\]
+%
+% \medskip
+% As we see, the drawing done by our command |\MyDraw| is \emph{relative} to the
+% submatrix to which it is applied.
+%
% \subsection{The commands \textbackslash OverBrace and \textbackslash
% UnderBrace in the \textbackslash CodeAfter}
%
@@ -3915,12 +4053,14 @@ version 2005/12/01 or later.
% \makeatother
% \end{Verbatim}
%
+% Nevertheless, the use of \pkg{threeparttable} in conjonction with
+% \pkg{nicematrix} seems rather point-less because of the functionalities
+% provided by \pkg{nicematrix}.
%
%
% \section{Other features}
%
-% \section{Autres fonctionnalités}
-%
+
% \subsection{Command \textbackslash ShowCellNames}
%
% The command |\ShowCellNames|, which may be used in the |\CodeBefore| and in
@@ -4102,7 +4242,6 @@ version 2005/12/01 or later.
% \end{bNiceArray}\]
%
%
-%
% \bigskip
% One should note that the environment |{NiceMatrix}| with the option |small| is
% not composed \emph{exactly} as the environment |{smallmatrix}|. Indeed, all
@@ -4119,6 +4258,13 @@ version 2005/12/01 or later.
% \item the characteristics of the dotted lines are also modified.
% \end{itemize}
%
+% \medskip
+% When the key |small| is in force, some functionalities of \pkg{nicematrix} are
+% no longer available: for example, it's no longer possible to put vertical
+% delimiters directly in the preamble of an environment with preamble (cf.
+% section \ref{delimiters-in-preamble}, p.~\pageref{delimiters-in-preamble}).
+%
+%
% \subsection{The counters iRow and jCol}
%
% \label{iRow}
@@ -4249,6 +4395,8 @@ version 2005/12/01 or later.
%
% \subsection{The environment \{NiceArrayWithDelims\}}
%
+% \label{NiceArrayWithDelims}
+%
% In fact, the environment |{pNiceArray}| and its variants are based upon a
% more general environment, called |{NiceArrayWithDelims}|. The first two
% mandatory arguments of this environment are the left and right delimiters used
@@ -5096,7 +5244,8 @@ version 2005/12/01 or later.
% \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}}
%
% \bigskip
-% In order to use \pkg{nicematrix} with the class \cls{aastex631}, you have to
+% In order to use \pkg{nicematrix} with the class \cls{aastex631}
+% (of the \emph{American Astronomical Society}), you have to
% add the following lines in the preamble of your document :
%
% \begin{Verbatim}
@@ -5106,8 +5255,9 @@ version 2005/12/01 or later.
% \end{Verbatim}
%
% \bigskip
-% In order to use \pkg{nicematrix} with the class \cls{sn-jnln}, \pkg{pgf} must
-% be loaded before the |\documentclass|:
+% In order to use \pkg{nicematrix} with the class \cls{sn-jnl} (of
+% \emph{Springer Nature}), \pkg{pgf} must
+% be loaded before the |\documentclass| with |\RequirePackage|:
%
% \begin{Verbatim}
% \RequirePackage{pgf}
@@ -5210,6 +5360,113 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{center}
%
+% \subsection{Use with tcolorbox}
+%
+% \label{tcolorbox}
+%
+% Here is an example of use of |{NiceTabular}| within a command |\tcbox| of
+% \pkg{tcolorbox}. We have used the key |hvlines-except-borders| in order all
+% the rules excepted on the borders (which are, of course, added by \pkg{tcolorbox})
+%
+% \medskip
+% \begin{BVerbatim}
+% \tcbset
+% {
+% colframe = blue!50!black ,
+% colback = white ,
+% colupper = red!50!black ,
+% fonttitle = \bfseries ,
+% nobeforeafter ,
+% center title
+% }
+%
+% \tcbox
+% [
+% left = 0mm ,
+% right = 0mm ,
+% top = 0mm ,
+% bottom = 0mm ,
+% boxsep = 0mm ,
+% toptitle = 0.5mm ,
+% bottomtitle = 0.5mm ,
+% title = My table
+% ]
+% {
+% \renewcommand{\arraystretch}{1.2}% <-- the % is mandatory here
+% \begin{NiceTabular}{rcl}[~emphase#hvlines-except-borders@,rules/color=blue!50!black]
+% \CodeBefore
+% \rowcolor{red!15}{1}
+% \Body
+% One & Two & Three \\
+% Men & Mice & Lions \\
+% Upper & Middle & Lower
+% \end{NiceTabular}
+% }
+% \end{BVerbatim}
+%
+% \medskip
+% \begin{center}
+% \tcbset
+% {
+% colframe = blue!50!black ,
+% colback = white ,
+% colupper = red!50!black ,
+% fonttitle = \bfseries ,
+% nobeforeafter ,
+% center title
+% }
+%
+% \tcbox
+% [
+% left = 0mm ,
+% right = 0mm ,
+% top = 0mm ,
+% bottom = 0mm ,
+% boxsep = 0mm ,
+% toptitle = 0.5mm ,
+% bottomtitle = 0.5mm ,
+% title = My table
+% ]
+% {
+% \renewcommand{\arraystretch}{1.2}\begin{NiceTabular}{rcl}[hvlines-except-borders,rules/color=blue!50!black]
+% \CodeBefore
+% \rowcolor{red!15}{1}
+% \Body
+% One & Two & Three \\
+% Men & Mice & Lions \\
+% Upper & Middle & Lower
+% \end{NiceTabular}
+% }
+% \end{center}
+%
+%
+%
+% \vspace{1cm}
+% That example shows the use of \pkg{nicematrix} in conjunction with
+% \pkg{tcolorbox}. If one wishes a tabular with an exterior frame with rounded
+% corners, it's not necessary to use \pkg{tcolorbox}: it's possible to use the
+% command |\Block| with the key |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
+% We have used the key |transparent| to have the rules specified by
+% |hvlines-except-borders| drawn in the blocks (by default, the rules are not
+% drawn in the blocks).
%
% \subsection{Notes in the tabulars}
%
@@ -6785,7 +7042,7 @@ version 2005/12/01 or later.
% \bigskip
% The following token list will contain the type of horizontal alignment of the
% current cell as provided by the corresponding column. The possible values are
-% |r|, |l|, |c|. For exemple, a column |p[l]{3cm}| will provide the value |l|
+% |r|, |l|, |c|. For example, a column |p[l]{3cm}| will provide the value |l|
% for all the cells of the column.
% \begin{macrocode}
\str_new:N \l_@@_hpos_cell_str
@@ -7056,6 +7313,11 @@ version 2005/12/01 or later.
\dim_new:N \l_@@_X_columns_dim
% \end{macrocode}
%
+% \medskip
+% \begin{macrocode}
+\bool_new:N \l_@@_X_V_bool
+% \end{macrocode}
+%
% \bigskip
% This boolean will be used only to detect in an expandable way whether we are
% at the beginning of the (potential) column zero, in order to raise an error if
@@ -10524,34 +10786,36 @@ version 2005/12/01 or later.
{
\str_case:nnF { #1 }
{
- c { \@@_patch_preamble_i:n #1 }
- l { \@@_patch_preamble_i:n #1 }
- r { \@@_patch_preamble_i:n #1 }
- > { \@@_patch_preamble_xiv:n }
- ! { \@@_patch_preamble_ii:nn #1 }
- @ { \@@_patch_preamble_ii:nn #1 }
- | { \@@_patch_preamble_iii:n #1 }
- p { \@@_patch_preamble_iv:n #1 }
- b { \@@_patch_preamble_iv:n #1 }
- m { \@@_patch_preamble_iv:n #1 }
+ c { \@@_patch_preamble_i:n #1 }
+ l { \@@_patch_preamble_i:n #1 }
+ r { \@@_patch_preamble_i:n #1 }
+ > { \@@_patch_preamble_xiv:n }
+ ! { \@@_patch_preamble_ii:nn #1 }
+ @ { \@@_patch_preamble_ii:nn #1 }
+ | { \@@_patch_preamble_iii:n #1 }
+ p { \@@_patch_preamble_iv:n #1 }
+ b { \@@_patch_preamble_iv:n #1 }
+ 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 { \@@_special_W: } #1 }
- \@@_S: { \@@_patch_preamble_vii:n }
- ( { \@@_patch_preamble_viii:nn #1 }
- [ { \@@_patch_preamble_viii:nn #1 }
- \{ { \@@_patch_preamble_viii:nn #1 }
- ) { \@@_patch_preamble_ix:nn #1 }
- ] { \@@_patch_preamble_ix:nn #1 }
- \} { \@@_patch_preamble_ix:nn #1 }
- X { \@@_patch_preamble_x:n }
+ V { \@@_patch_preamble_v:n }
+ \@@_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 }
+ \{ { \@@_patch_preamble_viii:nn #1 }
+ \left { \@@_patch_preamble_viii:nn }
+ ) { \@@_patch_preamble_ix:nn #1 }
+ ] { \@@_patch_preamble_ix:nn #1 }
+ \} { \@@_patch_preamble_ix:nn #1 }
+ \right { \@@_patch_preamble_ix:nn }
+ X { \@@_patch_preamble_x:n }
% \end{macrocode}
% When \pkg{tabularx} is loaded, a local redefinition of the specifier |X| is
% done to replace |X| by |\@@_X|. Thus, our column type |X| will be used in the
% |{NiceTabularX}|.
% \begin{macrocode}
- \@@_X { \@@_patch_preamble_x:n }
+ \@@_X { \@@_patch_preamble_x:n }
\q_stop { }
}
{
@@ -11173,7 +11437,7 @@ version 2005/12/01 or later.
{
\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 }
+ \tl_if_in:nnTF { ( [ \{ ) ] \} \left \right } { #2 }
{
\@@_error:nn { delimiter~after~opening } { #2 }
\@@_patch_preamble:n
@@ -11183,7 +11447,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% For |)|, |]| and |\}|. We have two arguments for the following command because
+% For the closing delimiters. We have two arguments for the following command because
% we directly read the following letter in the preamble (we have to see whether
% we have a opening delimiter following and we also have to see whether we are
% at the end of the preamble because, in that case, our letter must be
@@ -11208,7 +11472,7 @@ version 2005/12/01 or later.
}
}
{
- \tl_if_in:nnT { ( [ \{ } { #2 }
+ \tl_if_in:nnT { ( [ \{ \left } { #2 }
{ \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } }
\tl_gput_right:Nx \g_@@_pre_code_after_tl
{ \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
@@ -11273,7 +11537,10 @@ version 2005/12/01 or later.
% of keys will be used to retrieve that value (in the counter |\l_@@_weight_int|).
% \begin{macrocode}
\keys_define:nn { WithArrows / X-column }
- { unknown .code:n = \int_set:Nn \l_@@_weight_int { \l_keys_key_str } }
+ {
+ v .bool_set:N = \l_@@_X_V_bool ,
+ unknown .code:n = \int_set:Nn \l_@@_weight_int { \l_keys_key_str }
+ }
% \end{macrocode}
%
%
@@ -11300,14 +11567,14 @@ version 2005/12/01 or later.
% initial value is $1$). The user may specify a different value (such as $2$,
% $3$, etc.) by putting that value in the optional argument of the specifier.
% The weights of the |X| columns are used in the computation of the actual width
-% of those columns as in \pkg{tabu} of \pkg{tabularray}.
+% of those columns as in \pkg{tabu} (now obsolete) or \pkg{tabularray}.
% \begin{macrocode}
\int_zero_new:N \l_@@_weight_int
\int_set:Nn \l_@@_weight_int { 1 }
\tl_set:Nn \l_tmpa_tl { #1 }
\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_p_column:V \l_tmpa_tl
+ \bool_set_false:N \l_@@_X_V_bool
\keys_set:nV { WithArrows / X-column } \l_tmpa_tl
\int_compare:nNnT \l_@@_weight_int < 0
{
@@ -11323,9 +11590,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\bool_if:NTF \l_@@_X_columns_aux_bool
{
+ \exp_args:Nnx
\@@_patch_preamble_iv_iv:nn
{ \l_@@_weight_int \l_@@_X_columns_dim }
- { minipage }
+ {
+ \bool_if:NTF \l_@@_X_V_bool
+ { varwidth }
+ { minipage }
+ }
}
{
\tl_gput_right:Nn \g_@@_preamble_tl
@@ -11334,6 +11606,14 @@ version 2005/12/01 or later.
\@@_cell_begin:w
\bool_set_true:N \l_@@_X_column_bool
% \end{macrocode}
+% You encounter a problem on 2023-03-04: for an environment with |X| columns,
+% during the first compilations (which are not the definitive one), sometimes,
+% some cells are declared empty even if they should not. That's a problem
+% because user's instructions may use these nodes. That's why we have added the
+% following |\NotEmpty|.
+% \begin{macrocode}
+ \NotEmpty
+% \end{macrocode}
% The following code will nullify the box of the cell.
% \begin{macrocode}
\tl_gput_right:Nn \g_@@_cell_after_hook_tl
@@ -21400,6 +21680,7 @@ version 2005/12/01 or later.
first-row,~
hlines,~
hvlines,~
+ hvlines-except-borders,~
last-col,~
last-row,~
left-margin,~
@@ -21455,6 +21736,7 @@ version 2005/12/01 or later.
first-row,~
hlines,~
hvlines,~
+ hvlines-except-borders,~
last-col,~
last-row,~
left-margin,~
@@ -21516,6 +21798,7 @@ version 2005/12/01 or later.
first-row,~
hlines,~
hvlines,~
+ hvlines-except-borders,~
l,~
last-col,~
last-row,~
@@ -21575,6 +21858,7 @@ version 2005/12/01 or later.
first-row,~
hlines,~
hvlines,~
+ hvlines-except-borders,~
label,~
last-col,~
last-row,~
@@ -21641,6 +21925,13 @@ 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.15 and 6.16}
+%
+% It's now possible to put any LaTeX extensible delimiter (|\lgroup|, |\langle|,
+% etc.) in the preamble of an environment with pramble (such as |{NiceArray}|)
+% by prefixing them by |\left| and |\right|.
+%
+% New key |code| for the command |\SubMatrix| in the |\CodeAfter|.
%
% \subsection*{Changes between version 6.14 and 6.15}
%
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index 0f91df0b72..f9c9e28bb7 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ