summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-11-24 03:01:53 +0000
committerNorbert Preining <norbert@preining.info>2021-11-24 03:01:53 +0000
commitc7fc5283ac51bef06ce935c59e2c247fd5a4c1ba (patch)
tree712c7924d8d98c996c72aeb9dcb575631f19a747 /macros/latex/contrib/nicematrix
parent0b34c573a443a0ea2ce617f1466aef7ea2c38a98 (diff)
CTAN sync 202111240301
Diffstat (limited to 'macros/latex/contrib/nicematrix')
-rw-r--r--macros/latex/contrib/nicematrix/README.md2
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin487802 -> 490739 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex182
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx690
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1419125 -> 1434511 bytes
5 files changed, 632 insertions, 242 deletions
diff --git a/macros/latex/contrib/nicematrix/README.md b/macros/latex/contrib/nicematrix/README.md
index d55ad61352..5822e17e0e 100644
--- a/macros/latex/contrib/nicematrix/README.md
+++ b/macros/latex/contrib/nicematrix/README.md
@@ -20,7 +20,7 @@ The package `nicematrix` is present in the distributions MiKTeX, TeXLive and Mac
For a manual installation:
* put the files `nicematrix.ins` and `nicematrix.dtx` in the same directory;
-* run `latex nicematrix.ins`.
+* run `latex nicematrix.ins` in that directory.
The file `nicematrix.sty` will be generated.
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index e95df7bfc3..ff9d46251c 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 86c4f74da8..3690d37880 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.tex
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex
@@ -10,7 +10,7 @@
\usepackage{nicematrix}
\usepackage{tikz}
-\usetikzlibrary{fit,patterns}
+\usetikzlibrary{fit,patterns,arrows.meta}
\usepackage{enumitem}
\usepackage{siunitx}
@@ -543,7 +543,8 @@ options la valeur de cette clé |tikz| (qui doit donc être une liste de clés T
applicables à un chemin de Tikz). Pour des exemple d'utilisation de cette clé
|tikz|, voir p.~\pageref{tikz-key-examples} ;
\item \colorbox{yellow!50}{\textbf{Nouveau 6.3}}\enskip la clé |name| donne un
-nom au nœud Tikz rectangulaire correspondant au bloc.
+nom au nœud Tikz rectangulaire correspondant au bloc ; on peut utiliser ce nom
+avec Tikz dans le |\CodeAfter| (cf p.~\pageref{code-after}).
\end{itemize}
@@ -590,9 +591,9 @@ Les blocs mono-colonne ont un comportement spécial.
\item La largeur naturelle du contenu de ces blocs est prise en compte pour la
largeur de la colonne courante.
-\colorbox{yellow!50}{\textbf{Nouveau 6.0}}\enskip Dans les colonnes à largeur
-fixée (colonnes |w{...}{...}|, |p{...}|, |b{...}|, |m{...}| et |X|), le contenu
-du bloc est mis en forme comme un paragraphe de cette largeur.
+Dans les colonnes à largeur fixée (colonnes |w{...}{...}|, |p{...}|, |b{...}|,
+|m{...}| et |X|), le contenu du bloc est mis en forme comme un paragraphe de
+cette largeur.
\item La spécification d'alignement horizontal donnée par le type de
colonne (|c|, |r| ou |l|) est prise en compte pour le bloc (mais le bloc peut
@@ -1045,7 +1046,8 @@ Pour chacun de ces coins, on appellera \emph{coin vide} (ou tout simplement
rectangle entièrement constitué de cases vides partant de ce coin.\footnote{Pour
être complet, on doit préciser que toute case située dans un bloc (même si
elle est vide) n'est pas prise en compte pour la détermination des coins. Ce
- comportement est naturel.}
+ comportement est naturel. La définition précise de ce qui est considéré comme
+ une «case vide» est donnée plus loin (cf. p.~\pageref{empty-cells}).}
\smallskip
On peut néanmoins imposer à une case sans contenu d'être considérée
@@ -1602,12 +1604,11 @@ Henri & 14 \\
\medskip
-\item \colorbox{yellow!50}{\textbf{Nouveau 6.0}}\enskip 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 |\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]
@@ -1979,13 +1980,15 @@ $\begin{array}{c}
\subsection{Les colonnes V de varwidth}
+\label{varwidth}
+
\colorbox{yellow!50}{\textbf{Nouveau 6.3}}
\smallskip
Rappelons d'abord le fonctionnement d'un environnement |{varwidth}| de
l'extension éponyme \pkg{varwidth}. Un tel environnement est similaire à
l'environnement classique |{minipage}| mais la largeur indiquée (en argument)
-n'est que la largeur \emph{maximale} de la boîte créée. Dans la cas général, la
+n'est que la largeur \emph{maximale} de la boîte créée. Dans le cas général, la
largeur d'une boîte |{varwidth}| est la largeur naturelle de son contenu.
\smallskip
@@ -2035,18 +2038,37 @@ réglages supplémentaires).
Lorsque l'extension \pkg{varwidth} est chargée, ces colonnes |V| de
\pkg{varwidth} sont prises en charge par \pkg{nicematrix}. Dans le cadre de
\pkg{nicematrix}, l'un des intérêts des colonnes de type |V| par rapport aux
-colonnes de type |p|, |m| ou |b| est que, pour les cellules d'une telle colonne,
-le nœud PGF/Tikz créé pour le contenu d'une telle cellule a une largeur ajusté
-au contenu de la cellule en question : cf. p.~\pageref{node-V}.
+colonnes de type |p|, |m| ou |b| est que, pour les cases d'une telle colonne,
+le nœud PGF/Tikz créé pour le contenu d'une telle case a une largeur ajusté
+au contenu de la cellule en question : cf. p.~\pageref{node-V}. Si le contenu
+est vide, la cellule sera considérée comme vide par \pkg{nicematrix} pour le
+tracé des lignes pointillés et la détermination des «coins vides» (ce n'est pas
+le cas avec une case d'une colonne |p|, |m| ou |b|).
+
+\medskip
+\begin{Verbatim}
+\begin{NiceTabular}[corners=NW,hvlines]{~emphase#V{3cm}V{3cm}V{3cm}@}
+& un très très très très long texte & un très très très très long texte \\
+un très très très très long texte \\
+un très très très très long texte
+\end{NiceTabular}
+\end{Verbatim}
+
+\medskip
+\begin{center}
+\begin{NiceTabular}[corners=NW,hvlines]{V{3cm}V{3cm}V{3cm}}
+& un très très très très long texte & un très très très très long texte \\
+un très très très très long texte \\
+un très très très très long texte
+\end{NiceTabular}
+\end{center}
\subsection{Les colonnes X}
-\label{colonne-X}
-\colorbox{yellow!50}{\textbf{Nouveau 6.0}}
+\label{colonne-X}
-\smallskip
L'environnement |{NiceTabular}| propose aussi des colonnes |X| similaires à
celles proposées par l'environnement |{tabularx}| de l'extension éponyme.
@@ -2058,7 +2080,7 @@ Pour se rapprocher davantage de l'environnement |{tabularx}|, \pkg{nicematrix}
propose aussi un environnement |{NiceTabularX}| qui prend en premier argument
(obligatoire) la largeur voulue pour le tableau.\footnote{Si \pkg{tabularx} est
chargé, on doit obligatoirement utiliser |{NiceTabularX}| pour utiliser les
- colonnes |X| (ceci est dû à un problème de conflit de définition des
+ colonnes |X| (cela est dû à un problème de conflit de définition des
spécificateurs de colonne |X|).}
@@ -2069,7 +2091,7 @@ accepte entre crochets un argument optionnel qui est une liste de clés.
entier positif comme argument du spécificateur |X|. Par exemple, une colonne
|X[2]| aura une largeur double de celle d'une colonne |X| (qui a un poids de
1).\footnote{Les valeurs négatives pour les poids, comme proposées par
- \pkg{tabu} (maintenant obsolète), ne sont pas prises en charge par
+ \pkg{tabu} (maintenant obsolète), ne sont \emph{pas} prises en charge par
\pkg{nicematrix}. Si une telle valeur est utilisée, une erreur sera levée.}
\item On peut spécifier l'alignement horizontal avec une des lettres |l|, |c| et
|r| (qui insèrent respectivement |\raggedright|, |\centering| et |\raggedleft|
@@ -2626,9 +2648,9 @@ $\begin{bNiceMatrix}
\label{customization}
Les lignes pointillées tracées par |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|,
-|\Iddots| et |\Hdotsfor| (ainsi que par la commande |\line| dans le |\CodeAfter|
-décrite p.~\pageref{line-in-code-after}) peuvent être paramétrées par trois
-options (que l'on met entre crochets après la commande) :
+|\Iddots|, |\Hdotsfor| et |\Vdotsfor| (ainsi que par la commande |\line| dans le
+|\CodeAfter| décrite p.~\pageref{line-in-code-after}) peuvent être paramétrées
+par trois options (que l'on met entre crochets après la commande) :
%
\begin{itemize}
\item |color| ;
@@ -2774,8 +2796,9 @@ PGF/Tikz créés par \pkg{nicematrix} dans le |\CodeAfter|. Ces nœuds sont déc
à partir de la page \pageref{PGF-nodes}.
\medskip
-Par ailleurs, deux commandes spéciales sont disponibles dans le |\CodeAfter| :
-|\line| et |\SubMatrix|. On va maintenant détailler ces deux commandes.
+Par ailleurs, plusieurs commandes spéciales sont disponibles dans le |\CodeAfter| :
+|\line|, |\SubMatrix|, |\OverBrace| et |\UnderBrace|. On va maintenant détailler
+ces commandes.
\subsection{La commande \textbackslash line dans le \textbackslash CodeAfter}
@@ -3045,6 +3068,78 @@ a_{31} & a_{32} & a_{33}
+\subsection{Les commandes \textbackslash OverBrace et le \textbackslash
+ UnderBrace dans le \textbackslash CodeAfter}
+
+\colorbox{yellow!50}{\textbf{Nouveau 6.4}}
+
+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
+impliquées dans l'accolade avec la syntaxe habituelle $i$|-|$j$ où $i$ est le
+numéro de rangée et $hj$ le numéro de colonne ;
+
+\item le deuxième argument est le coin inférieur droit avec la même syntaxe ;
+
+\item le troisième argument est le «label» de l'accolade qui sera placé par
+\pkg{nicematrix} (avec \textsc{pgf}) au-dessus de l'accolade (pour la commande
+|\OverBrace|) ou au-dessous (pour |\UnderBrace|).
+\end{itemize}
+
+\bigskip
+\begin{BVerbatim}[baseline=c,boxwidth=9cm]
+\begin{pNiceMatrix}
+1 & 2 & 3 & 4 & 5 & 6 \\
+11 & 12 & 13 & 14 & 15 & 16 \\
+\CodeAfter
+ ~emphase#\OverBrace{1-1}{2-3}{A}@
+ ~emphase#\OverBrace{1-4}{2-6}{B}@
+\end{pNiceMatrix}
+\end{BVerbatim}
+$\begin{pNiceMatrix}
+1 & 2 & 3 & 4 & 5 & 6 \\
+11 & 12 & 13 & 14 & 15 & 16 \\
+\CodeAfter
+ \OverBrace{1-1}{2-3}{A}
+ \OverBrace{1-4}{2-6}{B}
+\end{pNiceMatrix}$
+
+\bigskip
+Les commandes |\OverBrace| et |\UnderBrace| acceptent en fait un premier
+argument optionnel (entre crochets) pour une liste de couples clé-valeur. Les
+clés disponibles sont les suivantes :
+\begin{itemize}
+\item |left-shorten| et |right-shorten| qui ne prennent pas de valeur ; quand
+|left-shorten| est utilisée, l'abscisse de l'extrémité de gauche de l'accolade
+est calculée à partir du contenu du sous-tableau concerné alors que, sinon,
+c'est la position du filet vertical éventuel qui est utilisée (de même pour
+|right-shorten|) ;
+
+\item |shorten|, qui est la conjonction des clés |left-shorten| et |right-shorten| ;
+
+\item |yshift|, qui déplace verticalement l'accolade (et son label).
+\end{itemize}
+
+\bigskip
+\begin{BVerbatim}[baseline=c,boxwidth=9cm]
+\begin{pNiceMatrix}
+1 & 2 & 3 & 4 & 5 & 6 \\
+11 & 12 & 13 & 14 & 15 & 16 \\
+\CodeAfter
+ \OverBrace~emphase#[shorten,yshift=3pt]@{1-1}{2-3}{A}
+ \OverBrace~emphase#[shorten,yshift=3pt]@{1-4}{2-6}{B}
+\end{pNiceMatrix}
+\end{BVerbatim}
+$\begin{pNiceMatrix}
+1 & 2 & 3 & 4 & 5 & 6 \\
+11 & 12 & 13 & 14 & 15 & 16 \\
+\CodeAfter
+ \OverBrace[shorten,yshift=3pt]{1-1}{2-3}{A}
+ \OverBrace[shorten,yshift=3pt]{1-4}{2-6}{B}
+\end{pNiceMatrix}$
+
+
\section{Les notes dans les tableaux}
\label{s:notes}
@@ -3843,23 +3938,24 @@ 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
cas des colonnes de type |p|, |m| ou |b| dans lesquelles les nœuds ont toujours
-une largeur égale à la largeur de la colonne.
+une largeur égale à la largeur de la colonne. Dans l'exemple suivant, la
+commande |\lipsum| est fournie par l'extension éponyme.
\begin{Verbatim}
-\begin{NiceTabular}{V{8cm}}
+\begin{NiceTabular}{V{10cm}}
\bfseries \large
Titre \\
-\lipsum[1]
+\lipsum[1][1-4]
\CodeAfter
\tikz \draw [rounded corners] (1-1) -| (last-|2) -- (last-|1) |- (1-1) ;
\end{NiceTabular}
\end{Verbatim}
\begin{center}
-\begin{NiceTabular}{V{8cm}}
+\begin{NiceTabular}{V{10cm}}
\bfseries \large
Titre \\
-\lipsum[1]
+\lipsum[1][1-4]
\CodeAfter
\tikz \draw [rounded corners] (1-1) -| (last-|2) -- (last-|1) |- (1-1) ;
\end{NiceTabular}
@@ -4463,10 +4559,11 @@ clé |draw-first| : |\Ddots[draw-first]|\rlap{.}
\label{empty-cells}
Une instruction comme |\Ldots|, |\Cdots|, etc. essaye de déterminer la première
-case vide de part et d'autre de la case considérée. Néanmoins, une case «vide»
-n'est pas nécessairement sans contenu dans le codage TeX (c'est-à-dire sans
-aucun token entre les deux esperluettes~|&|). Les règles précises sont les
-suivantes :
+case vide de part et d'autre de la case considérée. Quand la clé |corners|
+(cf.~p.~\pageref{corners}) est utilisée, les coins qui sont déterminés sont
+composés de cases vides. Néanmoins, une case «vide» n'est pas nécessairement
+sans contenu dans le codage TeX (c'est-à-dire sans aucun token entre les deux
+esperluettes~|&|). Les règles précises sont les suivantes :
\begin{itemize}
\item Une case implicite est vide. Par exemple, dans la matrice suivante
@@ -4496,8 +4593,11 @@ fixer la largeur des colonnes sans interférer avec le tracé des lignes en
pointillés par \pkg{nicematrix}.
\medskip
-\item Une case d'une colonne de type |p|, |m| ou |t| est toujours non vide.
-\emph{Attention} : Ne pas se fier à ce point car il est susceptible de changer.
+\item Une case d'une colonne de type |p|, |m| ou |t| est toujours non vide
+(\emph{attention} : ne pas se fier à ce point car il est susceptible de
+changer). En revanche, une case d'une colonne de type |V| de \pkg{varwidth} (cf.
+p.~\pageref{varwidth}) est vide quand son contenu TeX est de largeur nulle.
+
\end{itemize}
@@ -4576,7 +4676,7 @@ La clé |tikz| de la commande |\Block| n'est disponible que lorsque Tikz est
chargé.\footnote{Par défaut, \pkg{nicematrix} ne charge que \textsc{pgf}, qui
est une sous-couche de Tikz.}
-Pour l'exemple suivant, la bibliothèque \tikz{patterns} de Tikz doit aussi être chargée.
+Pour l'exemple suivant, la bibliothèque \pkg{patterns} de Tikz doit aussi être chargée.
\begin{Verbatim}
\usetikzlibrary{patterns}
@@ -4831,11 +4931,13 @@ pointillées.
\interitem
-On peut même tracer des lignes continues.
+On peut même tracer des lignes continues.\footnote{Dans ce document, la
+ bibliothèque \pkg{arrows.meta} de Tikz a été chargée, ce qui a une incidence
+ sur la forme des pointes de flèches.}
\begin{Verbatim}
\NiceMatrixOptions
- {nullify-dots,code-for-first-col = \color{blue},code-for-first-col=\color{blue}}
+ {nullify-dots,code-for-first-col = \color{blue},code-for-first-row=\color{blue}}
$\begin{pNiceMatrix}[first-row,first-col]
& & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ colonnes}} \\
& 1 & 1 & 1 & \Ldots & 1 \\
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 8da12f0a1c..5a6e2d1b85 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.3}
-\def\myfiledate{2021/10/18}
+\def\myfileversion{6.4}
+\def\myfiledate{2021/11/23}
%
%
%<*batchfile>
@@ -53,7 +53,7 @@ version 2005/12/01 or later.
\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
\usepackage{tikz}
-\usetikzlibrary{fit,patterns}
+\usetikzlibrary{fit,patterns,arrows.meta}
\usepackage{nicematrix}
\usepackage{siunitx}
\usepackage{varwidth}
@@ -585,7 +585,9 @@ version 2005/12/01 or later.
% |tikz| (which must be a list of keys allowed for a Tikz path). For examples,
% cf. p.~\pageref{tikz-key-examples};
% \item \colorbox{yellow!50}{\textbf{New 6.3}}\enskip the key |name| provides a
-% name to the rectangular Tikz node corresponding to the block.
+% 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}).
% \end{itemize}
%
% \interitem
@@ -629,9 +631,9 @@ version 2005/12/01 or later.
% \item The natural width of the contents of these blocks is taken into account
% for the width of the current column.
%
-% \colorbox{yellow!50}{\textbf{New 6.0}}\enskip In the columns with a fixed
-% width (columns |w{...}{...}|, |p{...}|, |b{...}|, |m{...}| and |X|), the
-% content of the block is formatted as a paragraph of that width.
+% In the columns with a fixed width (columns |w{...}{...}|, |p{...}|, |b{...}|,
+% |m{...}| and |X|), the content of the block is formatted as a paragraph of
+% that width.
%
% \item The specification of the horizontal position provided by the type of
% column (|c|, |r| or |l|) is taken into account for the blocks.
@@ -1061,7 +1063,9 @@ version 2005/12/01 or later.
% \emph{corner}) the reunion of all the empty rectangles starting from the cell
% actually in the corner of the array.\footnote{For sake of completeness, we
% should also say that a cell contained in a block (even an empty cell) is not
-% taken into account for the determination of the corners. That behaviour is natural.}
+% taken into account for the determination of the corners. That behaviour is
+% 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}
% to consider that cell as not empty with the key |\NotEmpty|.
@@ -1591,12 +1595,11 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% \item \colorbox{yellow!50}{\textbf{New 6.0}}\enskip 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 |\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.
% \end{itemize}
%
% \smallskip
@@ -1815,7 +1818,7 @@ version 2005/12/01 or later.
% \hline
% \RowStyle[cell-space-limits=3pt]{\rotate}
% first & second & third & fourth \\
-% \RowStyle[nb-rows=2,color=white]{\sffamily}
+% \RowStyle[nb-rows=2,rowcolor=blue!50,color=white]{\sffamily}
% 1 & 2 & 3 & 4 \\
% I & II & III & IV \\
% \end{NiceTabular}
@@ -1958,6 +1961,8 @@ version 2005/12/01 or later.
%
% \subsection{The columns V of varwidth}
%
+% \label{varwidth}
+%
% \colorbox{yellow!50}{\textbf{New 6.3}}
%
% \smallskip
@@ -2016,15 +2021,35 @@ version 2005/12/01 or later.
% are supported by \pkg{nicematrix}. Concerning \pkg{nicematrix}, one of the
% interests of this type of columns is that, for a cell of a column of type~|V|,
% the PGF/Tikz node created by \pkg{nicematrix} for the content of that cell has
-% a width adjusted to the content of the cell : cf. p.~\pageref{node-V}.
+% a width adjusted to the content of the cell : cf. p.~\pageref{node-V}. If the
+% content of the cell is empty, the cell will be considered as empty by
+% \pkg{nicematrix} in the construction of the dotted lines and the «empty
+% corners» (that's not the case with a cell of a column |p|, |m| or |b|).
+%
+% \medskip
+% \begin{Verbatim}
+% \begin{NiceTabular}[corners=NW,hvlines]{~emphase#V{3cm}V{3cm}V{3cm}@}
+% & some very very very long text & some very very very long text \\
+% some very very very long text \\
+% some very very very long text
+% \end{NiceTabular}
+% \end{Verbatim}
+%
+% \medskip
+% \begin{center}
+% \begin{NiceTabular}[corners=NW,hvlines]{V{3cm}V{3cm}V{3cm}}
+% & some very very very long text & some very very very long text \\
+% some very very very long text \\
+% some very very very long text
+% \end{NiceTabular}
+% \end{center}
+%
%
%
% \subsection{The columns X}
%
% \label{X-columns}
-% \colorbox{yellow!50}{\textbf{New 6.0}}
%
-% \smallskip
% The environment |{NiceTabular}| provides |X| columns similar to those provided
% by the environment |{tabularx}| of the eponymous package.
%
@@ -2044,9 +2069,9 @@ version 2005/12/01 or later.
% \begin{itemize}
% \item It's possible to give a weight for the column by providing a positive
% integer directly as argument of the specifier |X|. For example, a column
-% |X[2]| will have a width double of the width of a column |X| (which has a
+% |X[2]| will have a width double of the width of a column~|X| (which has a
% weight equal to $1$).\footnote{The negative values of the weight, as provided
-% by \pkg{tabu} (which is now obsolete), are not supported by \pkg{nicematrix}.
+% by \pkg{tabu} (which is now obsolete), are \emph{not} supported by \pkg{nicematrix}.
% If such a value is used, an error will be raised.}
% \item It's possible to specify an horizontal alignment with one of the
% letters |l|, |c| and |r| (which insert respectively |\raggedright|,
@@ -2592,10 +2617,10 @@ version 2005/12/01 or later.
% \subsection{Customisation of the dotted lines}
%
% \label{customisation}
-% The dotted lines drawn by |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, |\Iddots|
-% and |\Hdotsfor| (and by the command |\line| in the |\CodeAfter| which is described
-% p.~\pageref{line-in-code-after}) may be customized by three options (specified
-% between square brackets after the command):
+% The dotted lines drawn by |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, |\Iddots|,
+% |\Hdotsfor| and |\Vdotsfor| (and by the command |\line| in the |\CodeAfter|
+% which is described p.~\pageref{line-in-code-after}) may be customized by three
+% options (specified between square brackets after the command):
% \begin{itemize}
% \item |color|;
% \item |shorten|;
@@ -2738,8 +2763,8 @@ version 2005/12/01 or later.
% beginning on p.~\pageref{PGF-nodes}.
%
% \medskip
-% Moreover, two special commands are available in the |\CodeAfter|: |line| and
-% |\SubMatrix|. We will now present these commands.
+% Moreover, several special commands are available in the |\CodeAfter|: |line|,
+% |\SubMatrix|, |\OverBrace| and |\UnderBrace|. We will now present these commands.
%
% \subsection{The command \textbackslash line in the \textbackslash CodeAfter}
%
@@ -3006,6 +3031,79 @@ version 2005/12/01 or later.
% a_{31} & a_{32} & a_{33}
% \end{pNiceArray}\]
%
+%
+% \subsection{The commands \textbackslash OverBrace and \textbackslash
+% UnderBrace in the \textbackslash CodeAfter}
+%
+% \colorbox{yellow!50}{\textbf{New 6.4}}
+%
+% The commands |\OverBrace| and |\UnderBrace| provide a way to put
+% horizontal braces on a part of the array. These commands take in three
+% arguments:
+% \begin{itemize}
+% \item the first argument is the upper-left corner of the submatrix with the
+% syntax $i$|-|$j$ where $i$ the number of row and $j$ the number of column;
+% \item the second argument is the lower-right corner with the same syntax;
+% \item the third argument is the label of the brace that will be put by
+% \pkg{nicematrix} (with \textsc{pgf}) above the brace (for the command
+% |\OverBrace|) or under the brace (for |\UnderBrace|).
+% \end{itemize}
+%
+% \bigskip
+% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% \begin{pNiceMatrix}
+% 1 & 2 & 3 & 4 & 5 & 6 \\
+% 11 & 12 & 13 & 14 & 15 & 16 \\
+% \CodeAfter
+% ~emphase#\OverBrace{1-1}{2-3}{A}@
+% ~emphase#\OverBrace{1-4}{2-6}{B}@
+% \end{pNiceMatrix}
+% \end{BVerbatim}
+% $\begin{pNiceMatrix}
+% 1 & 2 & 3 & 4 & 5 & 6 \\
+% 11 & 12 & 13 & 14 & 15 & 16 \\
+% \CodeAfter
+% \OverBrace{1-1}{2-3}{A}
+% \OverBrace{1-4}{2-6}{B}
+% \end{pNiceMatrix}$
+%
+% \bigskip
+% In fact, the commands |\OverBrace| and |\UnderBrace| take in an optional
+% argument (in first position and between square brackets) for a list of
+% key-value pairs. The available keys are:
+% \begin{itemize}
+% \item |left-shorten| and |right-shorten| which do not take in value; when the
+% key |left-shorten| is used, the abscissa of the left extremity of the brace is
+% computed with the contents of the cells of the involved sub-array, otherwise,
+% the position of the potential vertical rule is used (idem for
+% |right-shorten|).
+%
+% \item |shorten|, which is the conjunction of the keys |left-shorten| and
+% |right-shorten|;
+%
+% \item |yshift|, which shifts vertically the brace (and its label).
+% \end{itemize}
+%
+% \bigskip
+% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% \begin{pNiceMatrix}
+% 1 & 2 & 3 & 4 & 5 & 6 \\
+% 11 & 12 & 13 & 14 & 15 & 16 \\
+% \CodeAfter
+% \OverBrace~emphase#[shorten,yshift=3pt]@{1-1}{2-3}{A}
+% \OverBrace~emphase#[shorten,yshift=3pt]@{1-4}{2-6}{B}
+% \end{pNiceMatrix}
+% \end{BVerbatim}
+% $\begin{pNiceMatrix}
+% 1 & 2 & 3 & 4 & 5 & 6 \\
+% 11 & 12 & 13 & 14 & 15 & 16 \\
+% \CodeAfter
+% \OverBrace[shorten,yshift=3pt]{1-1}{2-3}{A}
+% \OverBrace[shorten,yshift=3pt]{1-4}{2-6}{B}
+% \end{pNiceMatrix}$
+%
+%
+%
% \section{The notes in the tabulars}
%
% \label{s:notes}
@@ -3778,7 +3876,7 @@ version 2005/12/01 or later.
% indicated by $i$-|last|. Similarly, the nodes of the last row may be indicated
% by |last|-$j$.
%
-% \subsubsection{Les colonnes V de varwidth}
+% \subsubsection{The columns V of varwidth}
%
% \label{node-V}
% When the extension \pkg{varwidth} is loaded, the columns of the type |V|
@@ -3787,13 +3885,14 @@ version 2005/12/01 or later.
% node created by \pkg{nicematrix} for the content of that cell has a width
% adjusted to the content of the cell. This is in contrast to the case of the
% columns of type |p|, |m| or |b| for which the nodes have always a width equal
-% to the width of the column.
+% to the width of the column. In the following example, the command |\lipsum| is
+% provided by the eponymous package.
%
% \begin{Verbatim}
-% \begin{NiceTabular}{V{8cm}}
+% \begin{NiceTabular}{V{10cm}}
% \bfseries \large
% Titre \\
-% \lipsum[1]
+% \lipsum[1][1-4]
% \CodeAfter
% \tikz \draw [rounded corners] (1-1) -| (last-|2) -- (last-|1) |- (1-1) ;
% \end{NiceTabular}
@@ -3801,10 +3900,10 @@ version 2005/12/01 or later.
%
%
% \begin{center}
-% \begin{NiceTabular}{V{8cm}}
+% \begin{NiceTabular}{V{10cm}}
% \bfseries \large
% Titre \\
-% \lipsum[1]
+% \lipsum[1][1-4]
% \CodeAfter
% \tikz \draw [rounded corners] (1-1) -| (last-|2) -- (last-|1) |- (1-1) ;
% \end{NiceTabular}
@@ -3814,7 +3913,7 @@ version 2005/12/01 or later.
% which are described below (cf. p.~\pageref{nodes-i}).
%
%
-% \subsection{The ``medium nodes'' and the ``large nodes''}
+% \subsection[The medium nodes and the large nodes]{The ``medium nodes'' and the ``large nodes''}
%
% In fact, the package \pkg{nicematrix} can create ``extra nodes'': the ``medium
% nodes'' and the ``large nodes''. The first ones
@@ -4384,13 +4483,15 @@ version 2005/12/01 or later.
% (and which will be used to draw the other diagonal dotted lines when the
% parallelization is in force) with the key |draw-first|: |\Ddots[draw-first]|.
%
-% \subsection{The ``empty'' cells}
+% \subsection[The empty cells]{The ``empty'' cells}
%
% \label{empty-cells}
% An instruction like |\Ldots|, |\Cdots|, etc. tries to determine the first
-% non-empty cell on both sides. However, an ``empty cell'' is not necessarily a
-% cell with no TeX content (that is to say a cell with no token between the two
-% ampersands~|&|). The precise rules are as follow.
+% non-empty cell on both sides. When the key |corners| is used
+% (cf.~p.~\pageref{corners}), \pkg{nicematrix} computes corners consisting of
+% empty cells. However, an ``empty cell'' is not necessarily a cell with no TeX
+% content (that is to say a cell with no token between the two ampersands~|&|).
+% The precise rules are as follow.
%
% \begin{itemize}
% \item An implicit cell is empty. For example, in the following matrix:
@@ -4420,8 +4521,10 @@ version 2005/12/01 or later.
%
% \medskip
% \item A cell of a column of type |p|, |m| or |t| is always considered as not
-% emtpy. \emph{Caution} : One should not rely upon that point because it may
-% change in a future version of \pkg{nicematrix}.
+% empty. \emph{Caution} : One should not rely upon that point because it may
+% change in a future version of \pkg{nicematrix}. On the other side, a cell of a
+% column of type |V| of \pkg{varwidth} (cf.~p.~\pageref{varwidth}) is empty when
+% its TeX content has a width equal to zero.
% % \end{itemize}
%
%
@@ -4491,7 +4594,8 @@ version 2005/12/01 or later.
%
% \section{Examples}
%
-% \subsection{Utilisation of the key ``tikz'' of the command \textbackslash Block}
+% \subsection[{Utilisation of the key 'tikz' of the command \textbackslash
+% Block}]{Utilisation of the key ``tikz'' of the command \textbackslash Block}
%\label{tikz-key-examples}
%
%
@@ -4752,11 +4856,12 @@ version 2005/12/01 or later.
%
% \interitem
% In fact, it's even possible to draw solid lines with the commands |\Cdots|,
-% |\Vdots|, etc.
+% |\Vdots|, etc.\footnote{In this document, the Tikz library \pkg{arrows.meta}
+% has been loaded, which impacts the shape of the arrow tips.}
%
% \begin{Verbatim}
% \NiceMatrixOptions
-% {nullify-dots,code-for-first-col = \color{blue},code-for-first-col=\color{blue}}
+% {nullify-dots,code-for-first-col = \color{blue},code-for-first-row=\color{blue}}
% $\begin{pNiceMatrix}[first-row,first-col]
% & & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ columns}} \\
% & 1 & 1 & 1 & \Ldots & 1 \\
@@ -5140,17 +5245,7 @@ version 2005/12/01 or later.
%
% \bigskip
% However, it's not possible to do a fine tuning. That's why we describe now a
-% method to highlight a row of the matrix. We create a rectangular Tikz node
-% which encompasses the nodes of the second row with the Tikz library \pkg{fit}.
-% This Tikz node is filled after the construction of the matrix. In order to see
-% the text \emph{under} this node, we have to use transparency with the
-% |blend mode| equal to |multiply|.
-%
-% \medskip
-% \textbf{Caution} : Some \textsc{pdf} readers are not able to show
-% transparency.\footnote{In Overleaf, the ``built-in'' \textsc{pdf} viewer does
-% not show transparency. You can switch to the ``native'' viewer in that case.}
-%
+% method to highlight a row of the matrix.
%
% \medskip
% That example and the following ones require Tikz (by default, \pkg{nicematrix}
@@ -5403,7 +5498,9 @@ version 2005/12/01 or later.
% this package for technical reasons.
%
% \bigskip
-% We load some packages. The package \pkg{xparse} is still loaded for use on Overleaf.
+% We load some packages. The package \pkg{xparse} is still loaded for use on
+% Overleaf. However, since oct. 2021, Overleaf uses TeXLive 2021 and we will be
+% able to delete that row.
% \begin{macrocode}
\RequirePackage { xparse }
\RequirePackage { array }
@@ -5642,17 +5739,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \bigskip
-% We will use |\AtBeginEnvironment|. For version of LaTeX posterior to
-% 2020-10-01, the command is available in the LaTeX kernel (\pkg{l3hooks}). For
-% older versions, we load \pkg{etoolbox}.
-% \begin{macrocode}
-\cs_if_exist:NF \AtBeginEnvironment { \RequirePackage { etoolbox } }
-% \end{macrocode}
-% The command |\AtBeginDocument| will be used to patch |{tabular}| in order to
-% come back to the original versions of |\multicolumn| in the |{tabular}| nested
-% in the environments of \pkg{nicematrix}.
-%
% \bigskip
% We have to redefine |\cline| for several reasons. The command |\@@_cline| will
% be linked to |\cline| in the beginning of |{NiceArrayWithDelims}|. The
@@ -5811,37 +5897,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \medskip
-% The following code is used to define |\c_@@_table_collect_begin_tl| and
-% |\c_@@_table_print_tl| when the version of \pkg{siunitx} is prior to 3.0. The
-% command |\@@_adapt_S_column| is used in the environment |{NiceArrayWithDelims}|.
-% \begin{macrocode}
-\AtBeginDocument
- {
- \cs_set_eq:NN \@@_adapt_S_column: \prg_do_nothing:
- \bool_lazy_and:nnT
- { \c_@@_siunitx_loaded_bool }
- { ! \cs_if_exist_p:N \siunitx_cell_begin:w }
- {
- \cs_set_protected:Npn \@@_adapt_S_column:
- {
- \group_begin:
- \@temptokena = { }
- \cs_set_eq:NN \NC@find \prg_do_nothing:
- \NC@rewrite@S { }
- \tl_gset:NV \g_tmpa_tl \@temptokena
- \group_end:
- \tl_new:N \c_@@_table_collect_begin_tl
- \tl_set:Nx \l_tmpa_tl { \tl_item:Nn \g_tmpa_tl 2 }
- \tl_gset:Nx \c_@@_table_collect_begin_tl { \tl_item:Nn \l_tmpa_tl 1 }
- \tl_new:N \c_@@_table_print_tl
- \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } }
- \cs_gset_eq:NN \@@_adapt_S_column: \prg_do_nothing:
- }
- }
- }
-% \end{macrocode}
-%
%
%
% \bigskip
@@ -8144,10 +8199,10 @@ version 2005/12/01 or later.
% exists as a standalone macro only for legibility.
% \label{prearray}
%
-% \begin{macrocode}
+% \begin{macrocode}
\cs_new_protected:Npn \@@_pre_array_ii:
{
-% \end{macrocode}
+% \end{macrocode}
% For unexplained reason, with XeTeX (and not with the other engines), the
% environments of \pkg{nicematrix} were all composed in black and do not take
% into account the color of the encompassing text. As a workaround, you peek the
@@ -8851,11 +8906,6 @@ version 2005/12/01 or later.
\bool_gset_false:N \g_@@_row_of_col_done_bool
\str_if_empty:NT \g_@@_name_env_str
{ \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } }
-% \end{macrocode}
-% The following line will be deleted when we will consider that only versions of
-% \pkg{siunitx} after v3.0 are compatible with \pkg{nicematrix}.
-% \begin{macrocode}
- \@@_adapt_S_column:
\bool_if:NTF \l_@@_NiceTabular_bool
\mode_leave_vertical:
\@@_test_if_math_mode:
@@ -9135,9 +9185,10 @@ version 2005/12/01 or later.
{
% \end{macrocode}
% We take into account the ``first row'' (we have previously computed its total
-% height in |\l_tmpa_dim|). The |\hbox:n| (or |\hbox|) is necessary here.
+% height in |\l_tmpa_dim|). The |\hbox:n| (or |\hbox|) is necessary here. There
+% was a bug in the following line (corrected the 2021/11/23).
% \begin{macrocode}
- \skip_vertical:N -\l_tmpa_dim
+ \skip_vertical:n { -\l_tmpa_dim - \arrayrulewidth }
\hbox
{
\bool_if:NTF \l_@@_NiceTabular_bool
@@ -9150,9 +9201,10 @@ version 2005/12/01 or later.
}
% \end{macrocode}
% We take into account the ``last row'' (we have previously computed its total
-% height in |\l_tmpb_dim|).
+% height in |\l_tmpb_dim|). There was a bug in the following line (corrected the
+% 2021/11/23).
% \begin{macrocode}
- \skip_vertical:N -\l_tmpb_dim
+ \skip_vertical:n { -\l_tmpb_dim + \arrayrulewidth }
}
% \end{macrocode}
% Curiously, we have to put again the following specification of color.
@@ -9642,7 +9694,7 @@ version 2005/12/01 or later.
{
\use:x
{
- \@@_patch_preamble_iv_v:nnnnnnn
+ \@@_patch_preamble_iv_v:nnnnnnnn
{ \str_if_eq:VnTF \l_@@_vpos_col_str { p } { t } { b } }
{ \dim_eval:n { #1 } }
{
@@ -9669,6 +9721,14 @@ version 2005/12/01 or later.
{ \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w }
{ \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_end: }
{ #2 }
+ {
+ \str_case:VnF \l_@@_hpos_col_str
+ {
+ { j } { c }
+ { si } { c }
+ }
+ { \l_@@_hpos_col_str }
+ }
}
% \end{macrocode}
%
@@ -9680,12 +9740,12 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% |#1| is the optional argument of |{minipage}|: |t| of |b|. Indeed, for the
-% columns of type |m|, we use the value |b| here because there is a special
-% post-action in order to center vertically the box (see |#4|).
+% |#1| is the optional argument of |{minipage}| (or |{varwidth}|): |t| of |b|.
+% Indeed, for the columns of type |m|, we use the value |b| here because there
+% is a special post-action in order to center vertically the box (see |#4|).
%
-% |#2| is the width of the |{minipage}|, that is to say also the width of the
-% column.
+% |#2| is the width of the |{minipage}| (or |{varwidth}|), that is to say also
+% the width of the column.
%
% |#3| is the coding for the horizontal position of the content of the cell
% (|\centering|, |\raggedright|, |\raggedleft| or nothing). It's also possible
@@ -9695,13 +9755,16 @@ version 2005/12/01 or later.
% |#4| is an extra-code which contains |\@@_center_cell_box:| (when the column
% is a |m| column) or nothing (in the other cases).
%
-% |#5| is a code put just before the |c|.
+% |#5| is a code put just before the |c| (or |r| or |l|: see |#8|).
%
-% |#6| is a code put just after the |c|.
+% |#6| is a code put just after the |c| (or |r| or |l|: see |#8|).
%
% |#7| is the type of environment: |minipage| or |varwidth|.
+%
+% |#8| is the lettre |c| or |r| or |l| which is the basic specificier of column
+% which is used \emph{in fine}.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_patch_preamble_iv_v:nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \@@_patch_preamble_iv_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
\tl_gput_right:Nn \g_@@_preamble_tl
{
@@ -9734,7 +9797,7 @@ version 2005/12/01 or later.
\arraybackslash
#5
}
- c
+ #8
< {
#6
% \end{macrocode}
@@ -9744,7 +9807,7 @@ version 2005/12/01 or later.
% \bool_if:NT \g_@@_rotate_bool { \raggedright \hsize = 3 cm }
\end { #7 }
% \end{macrocode}
-% If the letter in the preamble is |m|, |#3| will be equal to
+% If the letter in the preamble is |m|, |#4| will be equal to
% |\@@_center_cell_box:| (see just below).
% \begin{macrocode}
#4
@@ -9868,48 +9931,33 @@ version 2005/12/01 or later.
{ \@@_patch_preamble_vii_ii:n { #1 } }
% \end{macrocode}
%
-% For version of \pkg{siunitx} at least equal to 3.0, the adaptation is different
-% from previous ones. We test the version of \pkg{siunitx} by the existence of the
-% control sequence |\siunitx_cell_begin:w|. When we will decide that only the
-% previous posterior to 3.0 are supported by \pkg{nicematrix}, we will delete
-% the second definition of |\@@_patch_preamble_vi_ii:n|.
% \begin{macrocode}
-\AtBeginDocument
- {
+\cs_new_protected:Npn \@@_patch_preamble_vii_ii:n #1
+ {
+% \end{macrocode}
+% We test whether the version of \pkg{nicematrix} is at least 3.0. We will
+% change de programmation of the test further with something like |\VersionAtLeast|.
+%
+% \begin{macrocode}
\cs_if_exist:NTF \siunitx_cell_begin:w
- {
- \cs_new_protected:Npn \@@_patch_preamble_vii_ii:n #1
- {
- \tl_gput_right:Nn \g_@@_preamble_tl
- {
- > {
- \@@_cell_begin:w
- \keys_set:nn { siunitx } { #1 }
- \siunitx_cell_begin:w
- }
- c
- < { \siunitx_cell_end: \@@_cell_end: }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl
+ {
+ > {
+ \@@_cell_begin:w
+ \keys_set:nn { siunitx } { #1 }
+ \siunitx_cell_begin:w
}
+ c
+ < { \siunitx_cell_end: \@@_cell_end: }
+ }
% \end{macrocode}
% We increment the counter of columns and then we test for the presence of a |<|.
% \begin{macrocode}
- \int_gincr:N \c@jCol
- \@@_patch_preamble_xi:n
- }
+ \int_gincr:N \c@jCol
+ \@@_patch_preamble_xi:n
}
- {
- \cs_new_protected:Npn \@@_patch_preamble_vii_ii:n #1
- {
- \tl_gput_right:Nn \g_@@_preamble_tl
- {
- > { \@@_cell_begin:w \c_@@_table_collect_begin_tl S { #1 } }
- c
- < { \c_@@_table_print_tl \@@_cell_end: }
- }
- \int_gincr:N \c@jCol
- \@@_patch_preamble_xi:n
- }
- }
+ { \@@_fatal:n { Version~of~siunitx~too~old } }
}
% \end{macrocode}
%
@@ -10710,11 +10758,7 @@ version 2005/12/01 or later.
\vcenter
{
\vbox_to_ht:nn
-% \end{macrocode}
-% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available
-% on Overleaf.
-% \begin{macrocode}
- { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
+ { \box_ht_plus_dp:N \l_tmpa_box }
{ }
}
\right .
@@ -10727,11 +10771,7 @@ version 2005/12/01 or later.
\c_math_toggle_token
\left .
\vbox_to_ht:nn
-% \end{macrocode}
-% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available
-% on Overleaf.
-% \begin{macrocode}
- { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
+ { \box_ht_plus_dp:N \l_tmpa_box }
{ }
\right #2
\c_math_toggle_token
@@ -11644,10 +11684,6 @@ version 2005/12/01 or later.
\tl_if_empty:NF \l_@@_vlines_clist \@@_draw_vlines:
% \end{macrocode}
%
-% \begin{macrocode}
- \cs_set_eq:NN \SubMatrix \@@_SubMatrix
-% \end{macrocode}
-%
% \bigskip
% Now, the internal |code-after| and then, the |\CodeAfter|.
% \begin{macrocode}
@@ -11663,6 +11699,10 @@ version 2005/12/01 or later.
}
}
}
+ \cs_set_eq:NN \ialign \@@_old_ialign:
+ \cs_set_eq:NN \SubMatrix \@@_SubMatrix
+ \cs_set_eq:NN \UnderBrace \@@_UnderBrace
+ \cs_set_eq:NN \OverBrace \@@_OverBrace
\cs_set_eq:NN \line \@@_line
\g_@@_internal_code_after_tl
\tl_gclear:N \g_@@_internal_code_after_tl
@@ -11680,19 +11720,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\seq_gclear:N \g_@@_submatrix_names_seq
% \end{macrocode}
+%
% \medskip
-% We compose the |code-after| in math mode in order to nullify the spaces put
-% by the user between instructions in the |code-after|.
-% \begin{macrocode}
- % \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
-% \end{macrocode}
% And here's the |\CodeAfter|. Since the |\CodeAfter| may begin with an
% ``argument'' between square brackets of the options, we extract and treat that
% potential ``argument'' with the command |\@@_CodeAfter_keys:|.
% \begin{macrocode}
\exp_last_unbraced:NV \@@_CodeAfter_keys: \g_nicematrix_code_after_tl
\scan_stop:
- % \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
\tl_gclear:N \g_nicematrix_code_after_tl
\group_end:
% \end{macrocode}
@@ -12803,7 +12838,14 @@ version 2005/12/01 or later.
{
\pgfrememberpicturepositiononpagetrue
\pgf@relevantforpicturesizefalse
- \tl_if_eq:NNTF \l_@@_xdots_line_style_tl \c_@@_standard_tl
+ \bool_lazy_or:nnTF
+ { \tl_if_eq_p:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl }
+% \end{macrocode}
+% The boolean |\l_@@_dotted_bool| is raised for the rules specified by either
+% |\hdottedline| or |:| (or the letter specified by |letter-for-dotted-lines|)
+% in the preamble of the array.
+% \begin{macrocode}
+ \l_@@_dotted_bool
\@@_draw_standard_dotted_line:
\@@_draw_unstandard_dotted_line:
}
@@ -14604,7 +14646,7 @@ version 2005/12/01 or later.
% \subsection*{The horizontal rules}
%
% \bigskip
-% The following command will be executed in the |internal-code-after|. The rule
+% The following command will be executed in the internal |\CodeAfter|. The rule
% will be drawn \emph{before} the row |#1|. |#2| is the number of consecutive
% occurrences of |\Hline|. |#3| and |#4| are numbers of columns that define the
% delimitation of the horizontal rule that we have to draw. If |#4| is empty,
@@ -14620,7 +14662,7 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_hline_i:nnnn #1 #2 #3 #4
- {
+ {
% \end{macrocode}
% |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When
% we have found a column corresponding to a rule to draw, we note its number in
@@ -15190,9 +15232,9 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_hdottedline_i:
{
% \end{macrocode}
-% We write in the code-after the instruction that will actually draw the
-% dotted line. It's not possible to draw this dotted line now because we don't
-% know the length of the line (we don't even know the number of columns).
+% We write in the internal |\CodeAfter| the instruction that will actually draw
+% the dotted line. It's not possible to draw this dotted line now because we
+% don't know the length of the line (we don't even know the number of columns).
% \begin{macrocode}
\tl_gput_right:Nx \g_@@_internal_code_after_tl
{ \@@_hdottedline:n { \int_use:N \c@iRow } }
@@ -15201,9 +15243,9 @@ version 2005/12/01 or later.
%
%
% \medskip
-% The command |\@@_hdottedline:n| is the command written in the |\CodeAfter|
-% that will actually draw the dotted line. Its argument is the number of the row
-% \emph{before} which we will draw the row.
+% The command |\@@_hdottedline:n| is the command written in the internal
+% |\CodeAfter| that will actually draw the dotted line. Its argument is the
+% number of the row \emph{before} which we will draw the row.
% \begin{macrocode}
\cs_new_protected:Npn \@@_hdottedline:n #1
{
@@ -17338,32 +17380,47 @@ version 2005/12/01 or later.
}
}
% \end{macrocode}
+%
+% \medskip
+% The following macro will compute |\l_@@_first_i_tl|, |\l_@@_first_j_tl|,
+% |\l_@@_last_i_tl| and |\l_@@_last_j_tl| from the arguments of the command as
+% provided by the user (for example |2-3| and |5-last|).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \@@_compute_i_j:nn #1 #2
{
- \group_begin:
-% \end{macrocode}
-% The four following token lists correspond to the position of the |\SubMatrix|.
-% \begin{macrocode}
\tl_clear_new:N \l_@@_first_i_tl
\tl_clear_new:N \l_@@_first_j_tl
\tl_clear_new:N \l_@@_last_i_tl
\tl_clear_new:N \l_@@_last_j_tl
+ \@@_cut_on_hyphen:w #1 \q_stop
+ \tl_if_eq:NnTF \l_tmpa_tl { last }
+ { \tl_set:NV \l_@@_first_i_tl \c@iRow }
+ { \tl_set_eq:NN \l_@@_first_i_tl \l_tmpa_tl }
+ \tl_if_eq:NnTF \l_tmpb_tl { last }
+ { \tl_set:NV \l_@@_first_j_tl \c@jCol }
+ { \tl_set_eq:NN \l_@@_first_j_tl \l_tmpb_tl }
+ \@@_cut_on_hyphen:w #2 \q_stop
+ \tl_if_eq:NnTF \l_tmpa_tl { last }
+ { \tl_set:NV \l_@@_last_i_tl \c@iRow }
+ { \tl_set_eq:NN \l_@@_last_i_tl \l_tmpa_tl }
+ \tl_if_eq:NnTF \l_tmpb_tl { last }
+ { \tl_set:NV \l_@@_last_j_tl \c@jCol }
+ { \tl_set_eq:NN \l_@@_last_j_tl \l_tmpb_tl }
+ }
% \end{macrocode}
-% The command |\@@_cut_on_hyphen:w| cuts on the hyphen an argument of the form
-% $i$-$j$. The value of $i$ is stored in |\l_tmpa_tl| and the value of $j$ is
-% stored in |\l_tmpb_tl|.
+%
% \begin{macrocode}
- \@@_cut_on_hyphen:w #2 \q_stop
- \tl_set_eq:NN \l_@@_first_i_tl \l_tmpa_tl
- \tl_set_eq:NN \l_@@_first_j_tl \l_tmpb_tl
- \@@_cut_on_hyphen:w #3 \q_stop
- \tl_set_eq:NN \l_@@_last_i_tl \l_tmpa_tl
- \tl_set_eq:NN \l_@@_last_j_tl \l_tmpb_tl
+\cs_new_protected:Npn \@@_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7
+ {
+ \group_begin:
+% \end{macrocode}
+% The four following token lists correspond to the position of the |\SubMatrix|.
+% \begin{macrocode}
+ \@@_compute_i_j:nn { #2 } { #3 }
\bool_lazy_or:nnTF
{ \int_compare_p:nNn \l_@@_last_i_tl > \g_@@_row_total_int }
{ \int_compare_p:nNn \l_@@_last_j_tl > \g_@@_col_total_int }
- { \@@_error:n { SubMatrix~too~large } }
+ { \@@_error:nn { Construct~too~large } { \SubMatrix } }
{
\str_clear_new:N \l_@@_submatrix_name_str
\keys_set:nn { NiceMatrix / SubMatrix } { #5 }
@@ -17669,7 +17726,7 @@ version 2005/12/01 or later.
% from a specification of node of the form $i$\verb+-|+$j$. In that case, the
% $i$ of the number of row arrives first (and alone) in a |\pgfpointanchor| and,
% the, the $j$ arrives (alone) in the following |\pgfpointanchor|. In order to
-% know whether we have a number of row of a number of column, we keep track of
+% know whether we have a number of row or a number of column, we keep track of
% the number of such treatments by the expandable flag called |nicematrix|.
% \begin{macrocode}
\tl_if_empty:nTF { #2 }
@@ -17778,7 +17835,201 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
+% \bigskip
+% \subsection*{Les commandes \textbackslash UnderBrace et \textbackslash
+% OverBrace}
+%
+% The following commands will be linked to |\UnderBrace| and |\OverBrace| in the
+% |\CodeAfter|.
%
+% \begin{macrocode}
+\NewDocumentCommand \@@_UnderBrace { O { } m m m O { } }
+ {
+ \peek_remove_spaces:n
+ { \@@_brace:nnnnn { #2 } { #3 } { #4 } { #1 , #5 } { under } }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\NewDocumentCommand \@@_OverBrace { O { } m m m O { } }
+ {
+ \peek_remove_spaces:n
+ { \@@_brace:nnnnn { #2 } { #3 } { #4 } { #1 , #5 } { over } }
+ }
+% \end{macrocode}
+%
+% \medskip
+% \begin{macrocode}
+\keys_define:nn { NiceMatrix / Brace }
+ {
+ left-shorten .bool_set:N = \l_@@_brace_left_shorten_bool ,
+ left-shorten .default:n = true ,
+ right-shorten .bool_set:N = \l_@@_brace_right_shorten_bool ,
+ shorten .meta:n = { left-shorten , right-shorten } ,
+ right-shorten .default:n = true ,
+ yshift .dim_set:N = \l_@@_brace_yshift_dim ,
+ yshift .value_required:n = true ,
+ yshift .initial:n = \c_zero_dim ,
+ unknown .code:n = \@@_error:n { Unknown~key~for~Brace }
+ }
+% \end{macrocode}
+%
+% \medskip
+% |#1| is the first cell of the rectangle (with the syntax $i$\verb+-|+$j$;
+% |#2| is the last cell of the rectangle;
+% |#3| is the label of the text;
+% |#4| is the optional argument (a list of \textsl{key}-\textsl{value} pairs);
+% |#5| is equal to |under| or |over|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_brace:nnnnn #1 #2 #3 #4 #5
+ {
+ \group_begin:
+% \end{macrocode}
+% The four following token lists correspond to the position of the sub-matrix to
+% which an brace will be attached.
+% \begin{macrocode}
+ \@@_compute_i_j:nn { #1 } { #2 }
+ \bool_lazy_or:nnTF
+ { \int_compare_p:nNn \l_@@_last_i_tl > \g_@@_row_total_int }
+ { \int_compare_p:nNn \l_@@_last_j_tl > \g_@@_col_total_int }
+ {
+ \str_if_eq:nnTF { #5 } { under }
+ { \@@_error:nn { Construct~too~large } { \UnderBrace } }
+ { \@@_error:nn { Construct~too~large } { \OverBrace } }
+ }
+ {
+ \keys_set:nn { NiceMatrix / Brace } { #4 }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \bool_if:NT \l_@@_brace_left_shorten_bool
+ {
+ \dim_set_eq:NN \l_@@_x_initial_dim \c_max_dim
+ \int_step_inline:nnn \l_@@_first_i_tl \l_@@_last_i_tl
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_first_j_tl }
+ {
+ \pgfpointanchor { \@@_env: - ##1 - \l_@@_first_j_tl } { west }
+ \dim_set:Nn \l_@@_x_initial_dim
+ { \dim_min:nn \l_@@_x_initial_dim \pgf@x }
+ }
+ }
+ }
+ \bool_lazy_or:nnT
+ { \bool_not_p:n \l_@@_brace_left_shorten_bool }
+ { \dim_compare_p:nNn \l_@@_x_initial_dim = \c_max_dim }
+ {
+ \@@_qpoint:n { col - \l_@@_first_j_tl }
+ \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
+ }
+ \bool_if:NT \l_@@_brace_right_shorten_bool
+ {
+ \dim_set:Nn \l_@@_x_final_dim { - \c_max_dim }
+ \int_step_inline:nnn \l_@@_first_i_tl \l_@@_last_i_tl
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_last_j_tl }
+ {
+ \pgfpointanchor { \@@_env: - ##1 - \l_@@_last_j_tl } { east }
+ \dim_set:Nn \l_@@_x_final_dim
+ { \dim_max:nn \l_@@_x_final_dim \pgf@x }
+ }
+ }
+ }
+ \bool_lazy_or:nnT
+ { \bool_not_p:n \l_@@_brace_right_shorten_bool }
+ { \dim_compare_p:nNn \l_@@_x_final_dim = { - \c_max_dim } }
+ {
+ \@@_qpoint:n { col - \int_eval:n { \l_@@_last_j_tl + 1 } }
+ \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
+ }
+ \pgfset { inner~sep = \c_zero_dim }
+ \str_if_eq:nnTF { #5 } { under }
+ { \@@_underbrace_i:n { #3 } }
+ { \@@_overbrace_i:n { #3 } }
+ \endpgfpicture
+ }
+ \group_end:
+ }
+% \end{macrocode}
+%
+% \medskip
+% The argument is the text to put above the brace.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_overbrace_i:n #1
+ {
+ \@@_qpoint:n { row - \l_@@_first_i_tl }
+ \pgftransformshift
+ {
+ \pgfpoint
+ { ( \l_@@_x_initial_dim + \l_@@_x_final_dim) / 2 }
+ { \pgf@y + \l_@@_brace_yshift_dim }
+ }
+ \pgfnode
+ { rectangle }
+ { south }
+ {
+ \vbox_top:n
+ {
+ \group_begin:
+ \everycr { }
+ \halign
+ {
+ \hfil ## \hfil \crcr
+ \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr
+ \noalign { \skip_vertical:n { 4.5 pt } \nointerlineskip }
+ \hbox_to_wd:nn
+ { \l_@@_x_final_dim - \l_@@_x_initial_dim }
+ { \downbracefill } \cr
+ }
+ \group_end:
+ }
+ }
+ { }
+ { }
+ }
+% \end{macrocode}
+%
+%
+% \medskip
+% The argument is the text to put under the brace.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_underbrace_i:n #1
+ {
+ \@@_qpoint:n { row - \int_eval:n { \l_@@_last_i_tl + 1 } }
+ \pgftransformshift
+ {
+ \pgfpoint
+ { ( \l_@@_x_initial_dim + \l_@@_x_final_dim) / 2 }
+ { \pgf@y - \l_@@_brace_yshift_dim }
+ }
+ \pgfnode
+ { rectangle }
+ { north }
+ {
+ \group_begin:
+ \everycr { }
+ \vbox:n
+ {
+ \halign
+ {
+ \hfil ## \hfil \crcr
+ \hbox_to_wd:nn
+ { \l_@@_x_final_dim - \l_@@_x_initial_dim }
+ { \upbracefill } \cr
+ \noalign { \skip_vertical:n { 4.5 pt } \nointerlineskip }
+ \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr
+ }
+ }
+ \group_end:
+ }
+ { }
+ { }
+ }
+% \end{macrocode}
+%
+%
%
% \bigskip
% \subsection*{We process the options at package loading}
@@ -18129,14 +18380,15 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\@@_msg_new:nn { SubMatrix~too~large }
+\@@_msg_new:nn { Construct~too~large }
{
- Your~command~\token_to_str:N \SubMatrix\
+ Your~command~\token_to_str:N #1
can't~be~drawn~because~your~matrix~is~too~small.\\
If~you~go~on,~this~command~will~be~ignored.
}
% \end{macrocode}
%
+%
% \begin{macrocode}
\@@_msg_new:nn { double-backslash~in~light-syntax }
{
@@ -18437,6 +18689,31 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { Version~of~siunitx~too~old }
+ {
+ You~can't~use~'S'~columns~because~your~version~of~'siunitx'~
+ is~too~old.~You~need~at~least~v~3.0.\\
+ This~error~is~fatal.
+ }
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\@@_msg_new:nnn { Unknown~key~for~Brace }
+ {
+ The~key~'\l_keys_key_str'~is~unknown~for~the~commands~\token_to_str:N
+ \UnderBrace\ and~\token_to_str:N \OverBrace.\\
+ If~you~go~on,~it~will~be~ignored. \\
+ For~a~list~of~the~available~keys,~type~H~<return>.
+ }
+ {
+ The~available~keys~are~(in~alphabetic~order):~left-shorten,~
+ right-shorten,~shorten~(which~fixes~both~left-shorten~and~
+ right-shorten)~and~yshift.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~CodeAfter }
{
The~key~'\l_keys_key_str'~is~unknown.\\
@@ -18763,7 +19040,7 @@ version 2005/12/01 or later.
% \section{History}
%
% The successive versions of the file |nicematrix.sty| provided by TeXLive are available on the
-% \textsc{svn} server of TeXLive:
+% \textsc{svn} server of TeXLive:\par\nobreak
%
% \smallskip
% {
@@ -19296,6 +19573,17 @@ version 2005/12/01 or later.
%
% Support for the columns |V| of \pkg{varwidth}.
%
+% \subsection*{Changes between versions 6.3 and 6.4}
+%
+% New commands |\UnderBrace| and |\OverBrace| in the |\CodeAfter|.
+%
+% Correction of a bug of the key |baseline| (cf. question 623258 on TeX StackExchange).
+%
+% Correction of a bug with the columns |V| of \pkg{varwidth}.
+%
+% Correction of a bug: the use of |\hdottedline| and |:| in the preamble of the
+% array (of another letter specified by |letter-for-dotted-lines|) was
+% incompatible with the key |xdots/line-style|.
%
% \PrintIndex
%
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index 392d727897..d6c12ea75e 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ