summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-04-26 03:00:32 +0000
committerNorbert Preining <norbert@preining.info>2021-04-26 03:00:32 +0000
commit03117c94362b2fed2fd4aabe50f3106fbf1e0a70 (patch)
treee9c379ff69ea790a0059725aebd5048e8d773e45 /macros/latex/contrib/nicematrix
parent31672400f6cb00d38c0e707da2640589b6d5c523 (diff)
CTAN sync 202104260300
Diffstat (limited to 'macros/latex/contrib/nicematrix')
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin455133 -> 462451 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex202
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx1201
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1212783 -> 1235344 bytes
4 files changed, 904 insertions, 499 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index 98af2c5843..f5af6a6a75 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 d92e274140..9d33132192 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.tex
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex
@@ -114,7 +114,7 @@ spécial & 12 & 12 & 0.5 & 70 \\
L'extension \pkg{nicematrix} est entièrement contenue dans le fichier |nicematrix.sty|. Ce fichier peut être placé
dans le répertoire courant ou dans une arborescence |texmf|. Le mieux reste néanmoins d'installer \pkg{nicematrix}
-avec une distribution TeX comme MiKTeX ou TeXlive.
+avec une distribution TeX comme MiKTeX, TeXlive ou MacTeX.
\bigskip
\emph{Remarque} : Si vous utilisez un service LaTeX via Internet (ex. :
@@ -413,7 +413,8 @@ $A=\begin{pNiceArray}{cc|cc}[baseline=line-3]
Dans les environnements de \pkg{nicematrix}, on peut utiliser la commande
-|\Block| pour placer un élément au centre d'un rectangle de cases fusionnées.
+|\Block| pour placer un élément au centre d'un rectangle de cases
+fusionnées.\footnote{Les espaces situés après une commande \verb|\Block| sont supprimés.}
La commande |\Block| doit être utilisée dans la case supérieure gauche du bloc
avec deux arguments obligatoires.
@@ -530,6 +531,8 @@ cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur par défaut est
\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| ;
+\item \colorbox{yellow!50}{\bfseries Nouveau 5.15}\enskip la clé |hvlines| trace
+tous les filets horizontaux et verticaux dans le bloc ;
\item \colorbox{yellow!50}{\bfseries Nouveau 5.14}\enskip les clés |t| et |b|
réglent la ligne de base qui sera donnée au bloc quand celui-ci est constitué de
plusieurs lignes (séparées par la commande |\\|).
@@ -551,7 +554,8 @@ construction |wc{...}| de \pkg{array}).
\begin{NiceTabular}{cwc{2cm}wc{3cm}c}
rose & tulipe & marguerite & dahlia \\
violette
-& ~emphase#\Block[draw=red,fill=red!15,rounded-corners]{2-2}{\LARGE De très jolies fleurs}@
+& ~emphase#\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}@
+ ~emphase#{\LARGE De très jolies fleurs}@
& & souci \\
pervenche & & & lys \\
arum & iris & jacinthe & muguet
@@ -563,7 +567,7 @@ arum & iris & jacinthe & muguet
\begin{center}
\begin{NiceTabular}{cwc{2cm}wc{3cm}c}
rose & tulipe & marguerite & dahlia \\
-violette & \Block[draw=red,fill=red!15,rounded-corners]{2-2}
+violette & \Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}
{\LARGE De très jolies fleurs} & & souci \\
pervenche & & & lys \\
arum & iris & jacinthe & muguet
@@ -871,8 +875,9 @@ A&B&C&D \\
\subsection{L'épaisseur et la couleur des filets}
Les environnements de \pkg{nicematrix} proposent une clé |rules/width| pour
-fixer la largeur (en fait l'épaisseur) des filets dans l'environnement. En fait,
-cette clé ne fait que fixer la valeur du paramètre dimensionnel |\arrayrulewidth|.
+fixer la largeur (on devrait plutôt dire l'épaisseur) des filets dans
+l'environnement. En fait, cette clé ne fait que fixer la valeur du paramètre
+dimensionnel |\arrayrulewidth|.
\smallskip
On sait que \pkg{colortbl} propose la commande |\arrayrulecolor| pour spécifier
@@ -883,7 +888,8 @@ Avec \pkg{nicematrix}, il est possible de spécifier une couleur même si
\pkg{colortbl} n'est pas chargé. Par souci de compatibilité, la commande est
nommée également |\arrayrulecolor|. Les environnements de \pkg{nicematrix}
proposent également une clé |rules/color| qui permet de fixer cette couleur pour
-l'environnement en question.
+l'environnement en question. Cette clé fixe localement la couleur des filets
+(alors que la commande |\arrayrulecolor| agit globalement).
\medskip
\begin{scope}
@@ -1105,10 +1111,11 @@ doivent être séparés par des virgules).
& & & & &1
\end{NiceTabular}
+
\bigskip
-$\triangleright$ Le concept de coins est aussi utilisé par la commande
-|\arraycolor| dans le |\CodeBefore| qui accepte en option une clé
-|except-corners|: cf.~p.~\pageref{arraycolor}.
+$\triangleright$ Les coins sont également pris en compte par les outils de
+coloriage dans le |\CodeBefore|. Ces outils ne colorient pas les cases qui sont
+dans les coins (cf.~p.~\pageref{color-in-code-before}).
\subsection{La commande \textbackslash diagbox}
@@ -1252,12 +1259,16 @@ inconvénients.
\subsection{Les outils de nicematrix dans le \textbackslash CodeBefore}
+\label{color-in-code-before}
+
L'extension \pkg{nicematrix} propose des outils (indépendants de \pkg{colortbl})
pour tracer d'abord les rectangles colorés, puis le contenu des cases et les
filets. Cette manière de faire est plus dans l'esprit du «modèle du peintre» des
formats PostScript et \textsc{pdf} et convient donc mieux aux lecteurs de
\textsc{pdf}. L'inconvénient est qu'elle nécessite plusieurs compilations
-successives.
+successives.\footnote{Si vous utilisez Overleaf, Overleaf effectue
+ automatiquement le nombre de
+ compilations nécessaire.}
\medskip
L'extension \pkg{nicematrix} fournit une clé |code-before| pour du code qui sera
@@ -1291,6 +1302,12 @@ première position) qui est le modèle colorimétrique pour la spécification de
couleurs.
\medskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.15}}\enskip Ces commandes ne colorient
+pas les cases qui se trouvent dans les «coins» si la clé |corners| a été
+utilisée. La description de cette clé a été faite p.~\pageref{corners}.
+
+
+\medskip
\begin{itemize}
\item La commande |\cellcolor| tient son nom de la commande |\cellcolor| de
\pkg{colortbl}.
@@ -1355,6 +1372,44 @@ h & i & j \\ \hline
\end{scope}
+\bigskip
+\item La commande |\arraycolor| prend en argument obligatoire une couleur et
+colorie tout le tableau (sauf les éventuelles rangées et colonnes extérieures:
+cf.~p.~\pageref{exterior}) avec cette couleur. Ce n'est qu'un cas particulier de
+la commande |\rectanglecolor|.
+
+\bigskip
+\item \label{chessboardcolors}%
+La commande |\chessboardcolors| prend en arguments obligatoires deux
+couleurs et colorie les cases en quinconces avec les deux couleurs.
+
+\medskip
+\begin{scope}
+\hfuzz=10cm
+\begin{BVerbatim}[baseline=c,boxwidth=9cm]
+$\begin{pNiceMatrix}[r,margin]
+\CodeBefore
+ ~emphase#\chessboardcolors{red!15}{blue!15}@
+\Body
+1 & -1 & 1 \\
+-1 & 1 & -1 \\
+1 & -1 & 1
+\end{pNiceMatrix}$
+\end{BVerbatim}
+$\begin{pNiceMatrix}[baseline=1, r, margin]
+\CodeBefore
+ \chessboardcolors{red!15}{blue!15}
+\Body
+1 & -1 & 1 \\
+-1 & 1 & -1 \\
+1 & -1 & 1
+\end{pNiceMatrix}$
+\end{scope}
+
+\medskip
+On a utilisé la clé |r| qui impose que toutes les colonnes soient alignées à
+droite (cf. p.~\pageref{key-R}).
+
\bigskip
\item La commande |\rowcolor| doit son nom à la commande |\rowcolor| de
@@ -1451,7 +1506,7 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page
\begin{BVerbatim}[baseline=c,boxwidth=9cm]
\begin{NiceTabular}{clr}[hvlines]
\CodeBefore
- ~emphase#\rowcolors{2}{blue!10}{}[cols=2-3,restart]@
+ ~emphase#\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]@
\Body
\Block{1-*}{Résultats} \\
\Block{2-1}{A}& Pierre & 12 \\
@@ -1464,7 +1519,7 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page
\end{BVerbatim}
\begin{NiceTabular}{clr}[hvlines,baseline=2]
\CodeBefore
- \rowcolors{2}{blue!10}{}[cols=2-3,restart]
+ \rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]
\Body
\Block{1-*}{Résultats} \\
\Block{2-1}{A}& Pierre & 12 \\
@@ -1519,77 +1574,50 @@ Henri & 14 \\
\bigskip
-\item \label{chessboardcolors}%
-La commande |\chessboardcolors| prend en arguments obligatoires deux
-couleurs et colorie les cases en quinconces avec les deux couleurs.
+On rappelle que toutes les commandes de coloriage que l'on vient de décrire ne
+colorient pas les cases qui sont dans les «coins». Dans l'exemple suivant, on
+utilise la clé |corners| pour demander de considérer le coin \emph{north east} (NE).
\medskip
\begin{scope}
-\hfuzz=10cm
-\begin{BVerbatim}[baseline=c,boxwidth=9cm]
-$\begin{pNiceMatrix}[r,margin]
-\CodeBefore
- ~emphase#\chessboardcolors{red!15}{blue!15}@
-\Body
-1 & -1 & 1 \\
--1 & 1 & -1 \\
-1 & -1 & 1
-\end{pNiceMatrix}$
-\end{BVerbatim}
-$\begin{pNiceMatrix}[baseline=1, r, margin]
-\CodeBefore
- \chessboardcolors{red!15}{blue!15}
-\Body
-1 & -1 & 1 \\
--1 & 1 & -1 \\
-1 & -1 & 1
-\end{pNiceMatrix}$
-\end{scope}
-
-\medskip
-On a utilisé la clé |r| qui impose que toutes les colonnes soient alignées à
-droite (cf. p.~\pageref{key-R}).
-
-\item La commande |\arraycolor| prend en argument obligatoire une couleur et
-colorie tout le tableau (sauf les éventuelles rangées et colonnes extérieures:
-cf.~p.~\pageref{exterior}) avec cette couleur. Elle est surtout intéressante du
-fait de la clé |except-corners| qu'elle accepte entre crochets en troisième
-argument (optionnel). La définition des coins a été donnée p.~\pageref{corners}
-quand on a présenté la clé~|corners|.
-
-\label{arraycolor}
-
-\medskip
-\begin{BVerbatim}[boxwidth=10cm,baseline=c]
-\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt]
+\hfuzz=11cm
+\begin{BVerbatim}[boxwidth=9cm,baseline=c]
+\begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col]
\CodeBefore
- ~emphase#\arraycolor{blue!10}[except-corners=NE]@
+ ~emphase#\rowcolors{1}{blue!15}{}@
\Body
-1\\
-1&1\\
-1&2&1\\
-1&3&3&1\\
-1&4&6&4&1\\
-1&5&10&10&5&1
+ & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\
+0 & 1 \\
+1 & 1 & 1 \\
+2 & 1 & 2 & 1 \\
+3 & 1 & 3 & 3 & 1 \\
+4 & 1 & 4 & 6 & 4 & 1 \\
+5 & 1 & 5 & 10 & 10 & 5 & 1 \\
+6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt]
+\begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col]
\CodeBefore
- \arraycolor{blue!10}[except-corners=NE]
+ \rowcolors{1}{blue!15}{}
\Body
-1\\
-1&1\\
-1&2&1\\
-1&3&3&1\\
-1&4&6&4&1\\
-1&5&10&10&5&1
+ & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\
+0 & 1 \\
+1 & 1 & 1 \\
+2 & 1 & 2 & 1 \\
+3 & 1 & 3 & 3 & 1 \\
+4 & 1 & 4 & 6 & 4 & 1 \\
+5 & 1 & 5 & 10 & 10 & 5 & 1 \\
+6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\
\end{NiceTabular}
+\end{scope}
+
\end{itemize}
+
\bigskip
On remarquera que ces commandes sont compatibles avec les commandes de
\pkg{booktabs} (|\toprule|, |\midrule|, |\bottomrule|, etc). Néanmoins,
-l'extension \pkg{booktabs} n'est pas chargée par \pkg{nicematrix}.
+l'extension \pkg{booktabs} n'est \emph{pas} chargée par \pkg{nicematrix}.
\medskip
\begin{scope}
@@ -2346,7 +2374,7 @@ mathématique avec |\scriptstyle|.
\begin{BVerbatim}[baseline=c,boxwidth=10cm]
$\begin{bNiceMatrix}
1 & \hspace*{1cm} & 0 \\[8mm]
- & ~emphase#\Ddots^{n \text{ fois}}@ & \\
+ & ~emphase#\Ddots^{n \text{ fois}}@ & \\
0 & & 1
\end{bNiceMatrix}$
\end{BVerbatim}
@@ -2724,6 +2752,35 @@ 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}.
+\bigskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.15}}\enskip
+Il est également possible de spécifier des délimiteurs\footnote{Les délimiteurs
+ en question sont \verb|(|, \verb|[| et \verb|\{| 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}\]
+
+
\section{Les notes dans les tableaux}
@@ -4480,7 +4537,7 @@ $\begin{pNiceArray}{rrrr|r}
12 -8 7 5 3 ;
0 64 -41 1 19 ;
0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
-\end{pNiceArray}$
+\end{pNiceArray}$\par\nobreak
\smallskip
\quad $\begin{pNiceArray}{rrrr|r}
@@ -4918,9 +4975,10 @@ source commenté et un historique des versions.
Les versions successives du fichier |nicematrix.sty| fournies par
TeXLive sont disponibles sur le serveur \textsc{svn} de TeXLive :
+\smallskip
{
\small
-\url{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
+\nolinkurl{www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
}
\end{document}
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index fb4ebed732..1b475cebad 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{5.14}
-\def\myfiledate{2021/04/08}
+\def\myfileversion{5.15}
+\def\myfiledate{2021/04/25}
%
%
%<*batchfile>
@@ -159,7 +159,7 @@ version 2005/12/01 or later.
% The package \pkg{nicematrix} is entirely contained in the file
% |nicematrix.sty|. This file may be put in the current directory or in a
% |texmf| tree. However, the best is to install \pkg{nicematrix} with a TeX
-% distribution as MiKTeX or TeXlive.
+% distribution as MiKTeX, TeXlive or MacTeX.
%
% \bigskip
% \emph{Remark}: If you use LaTeX via Internet with, for example, Overleaf, you
@@ -457,7 +457,7 @@ version 2005/12/01 or later.
%
% In the environments of \pkg{nicematrix}, it's possible to use the command
% |\Block| in order to place an element in the center of a rectangle of merged
-% cells of the array.
+% cells of the array.\footnote{The spaces after a command \verb|\Block| are deleted.}
%
% The command |\Block| must be used in the upper leftmost cell of the array with
% two arguments.
@@ -575,6 +575,8 @@ version 2005/12/01 or later.
% \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|;
+% \item \colorbox{yellow!50}{\bfseries New 5.15}\enskip the keys |hvlines| draws
+% all the vertical and horizontal rules in the block;
% \item \colorbox{yellow!50}{\bfseries New 5.14}\enskip the keys |t| and |b| fix
% the base line that will be given to the block when it has a multi-line content
% (the lines are separated by |\\|).
@@ -594,7 +596,8 @@ version 2005/12/01 or later.
% \begin{NiceTabular}{cwc{2cm}wc{3cm}c}
% rose & tulipe & marguerite & dahlia \\
% violette
-% & ~emphase#\Block[draw=red,fill=red!15,rounded-corners]{2-2}{\LARGE De très jolies fleurs}@
+% & ~emphase#\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}@
+% ~emphase#{\LARGE De très jolies fleurs}@
% & & souci \\
% pervenche & & & lys \\
% arum & iris & jacinthe & muguet
@@ -605,7 +608,7 @@ version 2005/12/01 or later.
% \begin{center}
% \begin{NiceTabular}{cwc{2cm}wc{3cm}c}
% rose & tulipe & marguerite & dahlia \\
-% violette & \Block[draw=red,fill=red!15,rounded-corners]{2-2}
+% violette & \Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}
% {\LARGE De très jolies fleurs} & & souci \\
% pervenche & & & lys \\
% arum & iris & jacinthe & muguet
@@ -907,7 +910,8 @@ version 2005/12/01 or later.
% when \pkg{colortbl} is not loaded. For sake of compatibility, the command is
% 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.
+% environment. This key sets the value locally (whereas |\arrayrulecolor| acts
+% globally).
%
% \medskip
% \begin{scope}
@@ -1120,10 +1124,11 @@ version 2005/12/01 or later.
% & & & & &1
% \end{NiceTabular}
%
-% \bigskip
-% $\triangleright$ The concept of corner is also used by the command
-% |\arraycolor| in the |\CodeBefore| which takes in as option a key
-% |except-corners|: cf.~p.~\pageref{arraycolor}.
+%
+% \medskip
+% $\triangleright$ The corners are also taken into account by the tools provided
+% by \pkg{nicematrix} to color cells, rows and columns. These tools don't color
+% the cells which are in the corners (cf.~p.~\pageref{color-in-code-before}).
%
% \subsection{The command \textbackslash diagbox}
%
@@ -1258,11 +1263,15 @@ version 2005/12/01 or later.
%
% \subsection{The tools of nicematrix in the \textbackslash CodeBefore}
%
+% \label{color-in-code-before}
+%
% The package \pkg{nicematrix} provides some tools (independent of
-% \pkg{colortbl}) to draw the colored panels first, and, then, the content
-% of the cells and the rules. This strategy is more conform to the ``painting
+% \pkg{colortbl}) to draw the colored panels first, and, then, the content of
+% the cells and the rules. This strategy is more conform to the ``painting
% model'' of the formats PostScript and \textsc{pdf} and is more suitable for
-% the \textsc{pdf} viewers. However, it requires several compilations.
+% the \textsc{pdf} viewers. However, it requires several
+% compilations.\footnote{If you use Overleaf, Overleaf will do automatically the
+% right number of compilations.}
%
% \medskip
% The extension \pkg{nicematrix} provides a key |code-before| for some code that
@@ -1292,7 +1301,13 @@ version 2005/12/01 or later.
%
% \medskip
% All these commands accept an optional argument (between square brackets and
-% in first position) which is the color model for the specification of the colors.
+% in first position) which is the color model for the specification of the
+% colors.
+%
+% \medskip
+% \colorbox{yellow!50}{\textbf{New 5.15}}\enskip These commands don't color the
+% cells which are in the ``corners'' if the key |corners| is used. This key has
+% been described p.~\pageref{corners}.
%
% \medskip
% \begin{itemize}
@@ -1359,6 +1374,43 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{scope}
%
+% \bigskip
+% \item The command |\arraycolor| takes in as mandatory argument a color and
+% color the whole tabular with that color (excepted the potential exterior rows
+% and columns: cf.~p.~\pageref{exterior}). It's only a particular case of
+% |\rectanglecolor|.
+%
+%
+% \bigskip
+% \item The command |\chessboardcolors| takes in as mandatory arguments two colors
+% and it colors the cells of the tabular in quincunx with these colors.
+%
+% \medskip
+% \begin{scope}
+% \hfuzz=10cm
+% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% $\begin{pNiceMatrix}[r,margin]
+% \CodeBefore
+% ~emphase#\chessboardcolors{red!15}{blue!15}@
+% \Body
+% 1 & -1 & 1 \\
+% -1 & 1 & -1 \\
+% 1 & -1 & 1
+% \end{pNiceMatrix}$
+% \end{BVerbatim}
+% $\begin{pNiceMatrix}[r,baseline=1, margin]
+% \CodeBefore
+% \chessboardcolors{red!15}{blue!15}
+% \Body
+% 1 & -1 & 1 \\
+% -1 & 1 & -1 \\
+% 1 & -1 & 1
+% \end{pNiceMatrix}$
+% \end{scope}
+%
+% \medskip
+% We have used the key |r| which aligns all the columns rightwards (cf.
+% p.~\pageref{key-R}).
%
%
% \bigskip
@@ -1425,7 +1477,6 @@ version 2005/12/01 or later.
% (an interval of the form $i$|-| describes in fact the interval of all the rows
% of the tabular, beginning with the row~$i$).
%
-%
%
% \bigskip
% The last argument of |\rowcolors| is an optional list of pairs key-value (the
@@ -1449,7 +1500,7 @@ version 2005/12/01 or later.
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{NiceTabular}{clr}[hvlines]
% \CodeBefore
-% ~emphase#\rowcolors{2}{blue!10}{}[cols=2-3,restart]@
+% ~emphase#\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]@
% \Body
% \Block{1-*}{Results} \\
% John & 12 \\
@@ -1462,7 +1513,7 @@ version 2005/12/01 or later.
% \end{BVerbatim}
% \begin{NiceTabular}{clr}[hvlines,baseline=2]
% \CodeBefore
-% \rowcolors{2}{blue!10}{}[cols=2-3,restart]
+% \rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]
% \Body
% \Block{1-*}{Results} \\
% \Block{2-1}{A}& John & 12 \\
@@ -1511,82 +1562,53 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{scope}
%
-%
-% \bigskip
-% \item The command |\chessboardcolors| takes in as mandatory arguments two colors
-% and it colors the cells of the tabular in quincunx with these colors.
%
% \medskip
-% \begin{scope}
-% \hfuzz=10cm
-% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% $\begin{pNiceMatrix}[r,margin]
-% \CodeBefore
-% ~emphase#\chessboardcolors{red!15}{blue!15}@
-% \Body
-% 1 & -1 & 1 \\
-% -1 & 1 & -1 \\
-% 1 & -1 & 1
-% \end{pNiceMatrix}$
-% \end{BVerbatim}
-% $\begin{pNiceMatrix}[r,baseline=1, margin]
-% \CodeBefore
-% \chessboardcolors{red!15}{blue!15}
-% \Body
-% 1 & -1 & 1 \\
-% -1 & 1 & -1 \\
-% 1 & -1 & 1
-% \end{pNiceMatrix}$
-% \end{scope}
-%
-% \medskip
-% We have used the key |r| which aligns all the columns rightwards (cf.
-% p.~\pageref{key-R}).
+% We recall that all the color commands we have described don't color the cells
+% which are in the ``corners''. In the following example, we use the key
+% |corners| to require the determination of the corner \emph{north east} (NE).
%
%
-% \item The command |\arraycolor| takes in as mandatory argument a color and
-% color the whole tabular with that color (excepted the potential exterior rows
-% and columns: cf.~p.~\pageref{exterior}). This command is useful thanks to its
-% key |except-corners| (in the third argument, which is a optional argument
-% between square brackets). The definition of these ``corners'' has been given
-% p.~\pageref{corners} when we have presented the key |corners|.
-%
-% \label{arraycolor}
-%
-%
-% \medskip
-% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt]
+%\medskip
+% \begin{scope}
+% \hfuzz=11cm
+% \begin{BVerbatim}[boxwidth=9cm,baseline=c]
+% \begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col]
% \CodeBefore
-% ~emphase#\arraycolor{blue!10}[except-corners=NE]@
+% ~emphase#\rowcolors{1}{blue!15}{}@
% \Body
-% 1\\
-% 1&1\\
-% 1&2&1\\
-% 1&3&3&1\\
-% 1&4&6&4&1\\
-% 1&5&10&10&5&1
+% & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\
+% 0 & 1 \\
+% 1 & 1 & 1 \\
+% 2 & 1 & 2 & 1 \\
+% 3 & 1 & 3 & 3 & 1 \\
+% 4 & 1 & 4 & 6 & 4 & 1 \\
+% 5 & 1 & 5 & 10 & 10 & 5 & 1 \\
+% 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt]
+% \begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col]
% \CodeBefore
-% \arraycolor{blue!10}[except-corners=NE]
+% \rowcolors{1}{blue!15}{}
% \Body
-% 1\\
-% 1&1\\
-% 1&2&1\\
-% 1&3&3&1\\
-% 1&4&6&4&1\\
-% 1&5&10&10&5&1
+% & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\
+% 0 & 1 \\
+% 1 & 1 & 1 \\
+% 2 & 1 & 2 & 1 \\
+% 3 & 1 & 3 & 3 & 1 \\
+% 4 & 1 & 4 & 6 & 4 & 1 \\
+% 5 & 1 & 5 & 10 & 10 & 5 & 1 \\
+% 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\
% \end{NiceTabular}
-% \end{itemize}
+% \end{scope}
%
+% \end{itemize}
%
%
% \bigskip
-% One should remark that these commands are compatible with the commands of
-% \pkg{booktabs} (|\toprule|, |\midrule|, |\bottomrule|, etc). However,
-% \pkg{booktabs} is not loaded by \pkg{nicematrix}.
+% One should remark that all the previous commands are compatible with the
+% commands of \pkg{booktabs} (|\toprule|, |\midrule|, |\bottomrule|, etc).
+% However, \pkg{booktabs} is not loaded by \pkg{nicematrix}.
%
% \medskip
% \begin{scope}
@@ -2697,6 +2719,35 @@ version 2005/12/01 or later.
% |\SubMatrix|. That name is used to create PGF/Tikz nodes: cf
% p.~\pageref{node-sub-matrix}.
%
+%
+% \bigskip
+% \colorbox{yellow!50}{\textbf{New 5.15}}\enskip
+% It's also possible to specify some delimiters\footnote{Those delimiters are
+% \verb|(|, \verb|[|, |\{| 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.
+%
+% \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}\]
+%
% \section{The notes in the tabulars}
%
% \label{s:notes}
@@ -3299,8 +3350,7 @@ version 2005/12/01 or later.
%
% For the environements with delimiters (|{pNiceArray}|, |{pNiceMatrix}|, etc.),
% it's possible to change the color of the delimiters with the key
-% |delimiters/color|.\footnote{\verb|delimiters-color| is a synonymous
-% (deprecated) for |delimiters/color|.}
+% |delimiters/color|.
%
% \medskip
% \begin{BVerbatim}[boxwidth=12cm,baseline=c]
@@ -4410,7 +4460,7 @@ version 2005/12/01 or later.
% 12 -8 7 5 3 ;
% 0 64 -41 1 19 ;
% 0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
-% \end{pNiceArray}$
+% \end{pNiceArray}$\par\nobreak
%
% \smallskip
% \quad $\begin{pNiceArray}{rrrr|r}
@@ -4420,8 +4470,8 @@ version 2005/12/01 or later.
% \end{NiceMatrixBlock}
%
% \bigskip
-% However, one can see that the last matrix is not perfectly aligned with the
-% other. That's why, in LaTeX, the parenthesis have not exactly the same width
+% However, one can see that the last matrix is not perfectly aligned with
+% others. That's why, in LaTeX, the parenthesis have not exactly the same width
% (smaller parenthesis are a bit slimer).
%
% \medskip
@@ -4480,7 +4530,7 @@ version 2005/12/01 or later.
% 12 -8 7 5 3 ;
% 0 64 -41 1 19 ;
% 0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
-% \end{pNiceArray}$
+% \end{pNiceArray}$\par\nobreak
%
% \smallskip
% \quad $\begin{pNiceArray}{rrrr|r}
@@ -5469,10 +5519,12 @@ version 2005/12/01 or later.
%
% \bigskip
% If the user uses |{NiceArray}| or |{NiceTabular}| the flag
-% |\l_@@_NiceArray_bool| will be raised.
+% |\g_@@_NiceArray_bool| will be raised.
% \begin{macrocode}
-\bool_new:N \l_@@_NiceArray_bool
+\bool_new:N \g_@@_NiceArray_bool
% \end{macrocode}
+% In fact, if there is delimiters in the preamble of |{NiceArray}| (eg:
+% |[cccc]|), this boolean will be set to false.
%
% \bigskip
% If the user uses |{NiceTabular}| or |{NiceTabular*}|, we will raise the
@@ -5731,7 +5783,14 @@ version 2005/12/01 or later.
\seq_new:N \g_@@_pos_of_stroken_blocks_seq
% \end{macrocode}
%
-%
+% \medskip
+% If the user has used the key |corners| (or the key |hvlines-except-corners|),
+% all the cells which are in an (empty) corner will be stored in the following
+% sequence.
+% \begin{macrocode}
+\seq_new:N \l_@@_corners_cells_seq
+% \end{macrocode}
+%
% \medskip
% The list of the names of the potential |\SubMatrix| in the |\CodeAfter| of an
% environment. Unfortunately, that list has to be global (we have to use it
@@ -5779,6 +5838,9 @@ version 2005/12/01 or later.
\clist_new:N \l_@@_borders_clist
\dim_new:N \l_@@_rounded_corners_dim
% \end{macrocode}
+% The last parameter has no direct link with the [empty] corners of the array
+% (which are computed and taken into account by \pkg{nicematrix} when the key
+% |corners| is used).
%
% \medskip
% The following token list correspond to the key |color| of the command
@@ -5816,6 +5878,14 @@ version 2005/12/01 or later.
\bool_new:N \l_@@_draw_first_bool
% \end{macrocode}
%
+%
+% \medskip
+% The following flag corresponds to the key |hvlines| of the command |\Block|.
+% \begin{macrocode}
+\bool_new:N \l_@@_hvlines_block_bool
+% \end{macrocode}
+%
+%
% \medskip
% The blocks which use the key |-| will store their content in a box. These
% boxes are numbered with the following counter.
@@ -6051,7 +6121,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \tabularnote { m }
{
- \bool_if:nTF { ! \l_@@_NiceArray_bool && \l_@@_in_env_bool }
+ \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool }
{ \@@_error:n { tabularnote~forbidden } }
{
% \end{macrocode}
@@ -6295,13 +6365,14 @@ version 2005/12/01 or later.
\bool_set_true:N \l_@@_parallelize_diags_bool
% \end{macrocode}
%
-%
% \bigskip
-% The following parameter correspond to the key |corners|.
+% The following parameter correspond to the key |corners|. The elements of that
+% |clist| must be in |NW|, |SW|, |NE| and |SE|.
% \begin{macrocode}
\clist_new:N \l_@@_corners_clist
% \end{macrocode}
%
+% \bigskip
% \begin{macrocode}
\dim_new:N \l_@@_notes_above_space_dim
\AtBeginDocument { \dim_set:Nn \l_@@_notes_above_space_dim { 1 mm } }
@@ -6713,7 +6784,9 @@ version 2005/12/01 or later.
delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
- delimiters-color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters-color .code:n =
+ \tl_set:Nn \l_@@_delimiters_color_tl { #1 }
+ \@@_error:n { delimiters-color deleted } ,
delimiters-color .value_required:n = true ,
last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceMatrixOptions } }
@@ -6829,7 +6902,9 @@ version 2005/12/01 or later.
small .value_forbidden:n = true ,
delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
- delimiters-color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters-color .code:n =
+ \tl_set:Nn \l_@@_delimiters_color_tl { #1 }
+ \@@_error:n { delimiters-color deleted } ,
delimiters-color .value_required:n = true ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix }
}
@@ -6861,8 +6936,9 @@ version 2005/12/01 or later.
notes / bottomrule .default:n = true ,
tabularnote .tl_set:N = \l_@@_tabularnote_tl ,
tabularnote .value_required:n = true ,
- delimiters-color .tl_set:N = \l_@@_delimiters_color_tl ,
- delimiters-color .value_required:n = true ,
+ delimiters-color .code:n =
+ \tl_set:Nn \l_@@_delimiters_color_tl { #1 }
+ \@@_error:n { delimiters-color deleted } ,
delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
@@ -7615,6 +7691,21 @@ version 2005/12/01 or later.
\seq_gclear:N \g_@@_submatrix_seq
\bool_if:NT \l_@@_code_before_bool
{
+% \end{macrocode}
+% The list of the cells which are in the (empty) corners is stored in the |aux|
+% file because we have to know it before the execution of the |\CodeBefore| (the
+% commands which color the cells, row and columns won't color the cells which
+% are in the corners).
+% \begin{macrocode}
+ \seq_if_exist:cT
+ { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
+ {
+ \seq_set_eq:Nc \l_@@_corners_cells_seq
+ { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
+ }
+% \end{macrocode}
+% Now, we have to reconstruct the |row| nodes and the |col| nodes.
+% \begin{macrocode}
\seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq }
{
% \end{macrocode}
@@ -7795,26 +7886,6 @@ version 2005/12/01 or later.
\@@_pre_array_ii:
% \end{macrocode}
%
-% \medskip
-% We compute the width of both delimiters.
-% \begin{macrocode}
- \dim_zero_new:N \l_@@_left_delim_dim
- \dim_zero_new:N \l_@@_right_delim_dim
- \bool_if:NTF \l_@@_NiceArray_bool
- {
- \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep }
- \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep }
- }
- {
-% \end{macrocode}
-% The command |\bBigg@| is a command of \pkg{amsmath}.
-% \begin{macrocode}
- \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \l_@@_left_delim_tl $ }
- \dim_set:Nn \l_@@_left_delim_dim { \box_wd:N \l_tmpa_box }
- \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \l_@@_right_delim_tl $ }
- \dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box }
- }
-% \end{macrocode}
%
% \medskip
% The array will be composed in a box (named |\l_@@_the_array_box|) because we
@@ -7840,6 +7911,29 @@ version 2005/12/01 or later.
%
% Now, the preamble is constructed in |\g_@@_preamble_tl|
%
+% \medskip
+% We compute the width of both delimiters. We remember that, when the
+% environment |{NiceArray}| is used, it's possible to specify the delimiters in
+% the preamble (eg |[ccc]|).
+% \begin{macrocode}
+ \dim_zero_new:N \l_@@_left_delim_dim
+ \dim_zero_new:N \l_@@_right_delim_dim
+ \bool_if:NTF \g_@@_NiceArray_bool
+ {
+ \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep }
+ \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep }
+ }
+ {
+% \end{macrocode}
+% The command |\bBigg@| is a command of \pkg{amsmath}.
+% \begin{macrocode}
+ \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \g_@@_left_delim_tl $ }
+ \dim_set:Nn \l_@@_left_delim_dim { \box_wd:N \l_tmpa_box }
+ \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \g_@@_right_delim_tl $ }
+ \dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box }
+ }
+% \end{macrocode}
+%
%
%
% \bigskip
@@ -7898,8 +7992,8 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{macrocode}
- \tl_set:Nn \l_@@_left_delim_tl { #1 }
- \tl_set:Nn \l_@@_right_delim_tl { #2 }
+ \tl_gset:Nn \g_@@_left_delim_tl { #1 }
+ \tl_gset:Nn \g_@@_right_delim_tl { #2 }
\tl_gset:Nn \g_@@_preamble_tl { #4 }
% \end{macrocode}
%
@@ -7982,7 +8076,7 @@ version 2005/12/01 or later.
% of |{NiceArray}| (|{pNiceArray}|, |{bNiceArray}|, etc.) because, for
% |{NiceArray}|, we have the options |t|, |c|, |b| and |baseline|.
% \begin{macrocode}
- \bool_if:NTF \l_@@_NiceArray_bool
+ \bool_if:NTF \g_@@_NiceArray_bool
{ \keys_set:nn { NiceMatrix / NiceArray } }
{ \keys_set:nn { NiceMatrix / pNiceArray } }
{ #3 , #5 }
@@ -8073,14 +8167,14 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% The construction of the real box is different when |\l_@@_NiceArray_bool| is
+% The construction of the real box is different when |\g_@@_NiceArray_bool| is
% true (|{NiceArray}| or |{NiceTabular}|) and in the other environments because,
% in |{NiceArray}| or |{NiceTabular}|, we have no delimiter to put (but we have
% tabular notes to put). We begin with this case.
%
% Remark that, in all cases, |@@_use_arraybox_with_notes_c:| is used.
% \begin{macrocode}
- \bool_if:NTF \l_@@_NiceArray_bool
+ \bool_if:NTF \g_@@_NiceArray_bool
{
\str_case:VnF \l_@@_baseline_tl
{
@@ -8125,7 +8219,7 @@ version 2005/12/01 or later.
\c_math_toggle_token
\tl_if_empty:NF \l_@@_delimiters_color_tl
{ \color { \l_@@_delimiters_color_tl } }
- \exp_after:wN \left \l_@@_left_delim_tl
+ \exp_after:wN \left \g_@@_left_delim_tl
\vcenter
{
% \end{macrocode}
@@ -8156,7 +8250,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_if_empty:NF \l_@@_delimiters_color_tl
{ \color { \l_@@_delimiters_color_tl } }
- \exp_after:wN \right \l_@@_right_delim_tl
+ \exp_after:wN \right \g_@@_right_delim_tl
\c_math_toggle_token
}
% \end{macrocode}
@@ -8167,7 +8261,10 @@ version 2005/12/01 or later.
% when the option |delimiters/max-width| is used.
% \begin{macrocode}
\bool_if:NTF \l_@@_delimiters_max_width_bool
- { \@@_put_box_in_flow_bis:nn { #1 } { #2 } }
+ {
+ \@@_put_box_in_flow_bis:nn
+ \g_@@_left_delim_tl \g_@@_right_delim_tl
+ }
\@@_put_box_in_flow:
}
% \end{macrocode}
@@ -8208,7 +8305,7 @@ version 2005/12/01 or later.
% The transformation of the preamble is an operation in several steps.
%
% \bigskip
-% The preamble given by the final use is in |\g_@@_preamble_tl| and the modified
+% The preamble given by the final user is in |\g_@@_preamble_tl| and the modified
% version will be stored in |\g_@@_preamble_tl| also.
%
% \begin{macrocode}
@@ -8297,10 +8394,18 @@ version 2005/12/01 or later.
% \begin{macrocode}
\int_zero:N \l_tmpa_int
% \end{macrocode}
+% We will raise |\l_tmpa_bool| if we are in |{NiceArray}| and that the first
+% letter of the preamble is a opening delimiter (|[|, |(| of |\{|). In that
+% case, the environment |{NiceArray}| will be transformed to an environment of
+% the form |{xNiceArray}| after the construction of the preamble.
+% \begin{macrocode}
+ \bool_set_false:N \l_tmpa_bool
+% \end{macrocode}
% Now, we actually patch the preamble (and it is constructed in
% |\g_@@_preamble_tl|).
% \begin{macrocode}
\exp_after:wN \@@_patch_preamble:n \the \@temptokena \q_stop
+ \bool_if:NT \l_tmpa_bool { \bool_gset_false:N \g_@@_NiceArray_bool }
\int_gset_eq:NN \g_@@_static_num_of_col_int \c@jCol
}
% \end{macrocode}
@@ -8325,7 +8430,7 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- \l_@@_NiceArray_bool
+ \g_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -8337,7 +8442,7 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- \l_@@_NiceArray_bool
+ \g_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -8386,9 +8491,9 @@ version 2005/12/01 or later.
( { \@@_patch_preamble_vii:n #1 }
[ { \@@_patch_preamble_vii:n #1 }
\{ { \@@_patch_preamble_vii:n #1 }
- ) { \@@_patch_preamble_viii:n #1 }
- ] { \@@_patch_preamble_viii:n #1 }
- \} { \@@_patch_preamble_viii:n #1 }
+ ) { \@@_patch_preamble_viii:nn #1 }
+ ] { \@@_patch_preamble_viii:nn #1 }
+ \} { \@@_patch_preamble_viii:nn #1 }
C { \@@_error:nn { old~column~type } #1 }
L { \@@_error:nn { old~column~type } #1 }
R { \@@_error:nn { old~column~type } #1 }
@@ -8503,14 +8608,14 @@ version 2005/12/01 or later.
{
> {
\@@_Cell:
- \begin { minipage } [ #1 ] { #3 }
+ \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
\mode_leave_vertical:
\arraybackslash
- \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt % v. 5.11
+ \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt
}
c
< {
- \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt % v. 5.11
+ \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt
\end { minipage }
\@@_end_Cell:
}
@@ -8568,54 +8673,104 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
% \medskip
% For |(|, |[| and |\{|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_vii:n #1
{
- \bool_if:NT \l_@@_small_bool
- { \@@_fatal:n { Delimiter~with~small } }
+ \bool_if:NT \l_@@_small_bool
+ { \@@_fatal:n { Delimiter~with~small } }
% \end{macrocode}
-% If we are before the column 1, we reserve space for the left delimiter.
+% If we are before the column 1 and not in |{NiceArray}|, we reserve space for
+% the left delimiter.
% \begin{macrocode}
- \int_compare:nNnT \c@jCol = \c_zero_int
- { \tl_gput_right:Nx \g_@@_preamble_tl { ! { \enskip } } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
- { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
- \@@_patch_preamble:n
- }
+ \int_compare:nNnTF \c@jCol = \c_zero_int
+ {
+ \bool_if:NTF \g_@@_NiceArray_bool
+ {
% \end{macrocode}
-%
-% \bigskip
-% For |)|, |]| and |\}|.
+% In that case, in fact, the firt letter of the preamble must be considered as
+% the left delimiter of the array.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_patch_preamble_viii:n #1
- {
- \bool_if:NT \l_@@_small_bool
- { \@@_fatal:n { Delimiter~with~small } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
- { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \tl_gset:Nn \g_@@_left_delim_tl { #1 }
+ \tl_gset:Nn \g_@@_right_delim_tl { . }
% \end{macrocode}
-% After this closing delimiter, we have to test whether there is a opening
-% delimiter (we consider that there can't be a second closing delimiter) in
-% order to add an horizontal space (equal to 0.5 em).
+% We raise the boolean |\l_tmpa_bool|, which means that the environment
+% |{NiceArray}| will be transformed to |{xNiceArray}|.
% \begin{macrocode}
- \@@_patch_preamble_viii_i:n
+ \bool_set_true:N \l_tmpa_bool
+ \@@_patch_preamble:n
+ }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
+ \@@_patch_preamble_vii_i:n
+ }
+ }
+ {
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
+ \@@_patch_preamble_vii_i:n
+ }
}
% \end{macrocode}
%
+% \bigskip
% \begin{macrocode}
-\cs_new_protected:Npn \@@_patch_preamble_viii_i:n #1
+\cs_new_protected:Npn \@@_patch_preamble_vii_i:n #1
{
- \bool_lazy_any:nT
+ \tl_if_in:nnTF { ( [ \{ ) ] \} } { #1 }
{
- { \str_if_eq_p:nn { #1 } ( }
- { \str_if_eq_p:nn { #1 } [ }
- { \str_if_eq_p:nn { #1 } \{ }
- { \str_if_eq_p:nn { #1 } \q_stop }
+ \@@_error:nn { delimiter~after~opening } { #1 }
+ \@@_patch_preamble:n
+ }
+ { \@@_patch_preamble:n #1 }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% For |)|, |]| and |\}|. 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
+% considered as the right delimiter of the environment).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_preamble_viii:nn #1 #2
+ {
+ \bool_if:NT \l_@@_small_bool
+ { \@@_fatal:n { Delimiter~with~small } }
+ \tl_if_in:nnTF { ) ] \} } { #2 }
+ {
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \@@_error:nn { double~closing~delimiter } { #2 }
+ \@@_patch_preamble:n
+ }
+ {
+ \tl_if_eq:nnTF { \q_stop } { #2 }
+ {
+ \bool_if:NTF \g_@@_NiceArray_bool
+ {
+ \tl_gset:Nn \g_@@_right_delim_tl { #1 }
+ \bool_set_true:N \l_tmpa_bool
+ }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \@@_patch_preamble:n #2
+ }
+ }
+ {
+ \tl_if_in:nnT { ( [ \{ } { #2 }
+ { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } }
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \@@_patch_preamble:n #2
+ }
}
- { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } }
- \@@_patch_preamble:n #1
}
% \end{macrocode}
%
@@ -9447,19 +9602,19 @@ version 2005/12/01 or later.
%
% \interitem
% The environment |{NiceArray}| is constructed upon the environment
-% |{NiceArrayWithDelims}| but, in fact, there is a flag |\l_@@_NiceArray_bool|.
+% |{NiceArrayWithDelims}| but, in fact, there is a flag |\g_@@_NiceArray_bool|.
% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is
% raised.
% \begin{macrocode}
\NewDocumentEnvironment { NiceArray } { }
{
- \bool_set_true:N \l_@@_NiceArray_bool
+ \bool_gset_true:N \g_@@_NiceArray_bool
\str_if_empty:NT \g_@@_name_env_str
{ \str_gset:Nn \g_@@_name_env_str { NiceArray } }
% \end{macrocode}
% We put . and . for the delimiters but, in fact, that doesn't matter because
% these arguments won't be used in |{NiceArrayWithDelims}| (because the flag
-% |\l_@@_NiceArray_bool| is raised).
+% |\g_@@_NiceArray_bool| is raised).
% \begin{macrocode}
\NiceArrayWithDelims . .
}
@@ -9676,14 +9831,13 @@ version 2005/12/01 or later.
}
% \end{macrocode}
% We write also the potential content of |\g_@@_pos_of_blocks_seq| (it will be
-% useful if the commands |\rowcolors| is used with the key |respect-blocks|.
+% useful if the command |\rowcolors| is used with the key |respect-blocks|).
% \begin{macrocode}
\seq_gset_from_clist:cn
{ c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq }
{ \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , }
- }
- \iow_now:Nn \@mainaux \ExplSyntaxOff
- }
+ }
+ }
% \end{macrocode}
%
% \medskip
@@ -9755,16 +9909,16 @@ version 2005/12/01 or later.
%
% \bigskip
% The following computes the ``corners'' (made up of empty cells) but if there
-% is no corner to compute, it will do nothing. The corners are computed
-% in |\l_@@_empty_corner_cells_seq| which will contain all the empty cells (and
-% not in a block) considered in the corners of the array.
+% is no corner to compute, it won't do anything. The corners are computed
+% in |\l_@@_corners_cells_seq| which will contain all the cells which are empty
+% (and not in a block) considered in the corners of the array.
% \begin{macrocode}
\@@_compute_corners:
% \end{macrocode}
%
% \bigskip
% The sequence |\g_@@_pos_of_blocks_seq| must be ``adjusted'' (for the case
-% where the user have written something like |\Block{1-}|).
+% where the user have written something like |\Block{1-*}|).
% \begin{macrocode}
\@@_adjust_pos_of_blocks_seq:
% \end{macrocode}
@@ -9781,7 +9935,7 @@ version 2005/12/01 or later.
{
{ \seq_if_empty_p:N \g_@@_pos_of_blocks_seq }
{ \seq_if_empty_p:N \g_@@_pos_of_xdots_seq }
- { \seq_if_empty_p:N \l_@@_empty_corner_cells_seq }
+ { \seq_if_empty_p:N \l_@@_corners_cells_seq }
}
{
\cs_set_eq:NN \@@_vline_i:nn \@@_vline_i_complete:nn
@@ -9868,6 +10022,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{macrocode}
+ \bool_gset_false:N \g_@@_NiceArray_bool
\str_gclear:N \g_@@_name_env_str
\@@_restore_iRow_jCol:
% \end{macrocode}
@@ -11478,7 +11633,7 @@ version 2005/12/01 or later.
% \end{macrocode}
% For the column, it's a bit more complicated.
% \begin{macrocode}
- \int_compare:nNnTF #2 = 1
+ \int_compare:nNnTF { #2 } = 1
{
\int_set:Nn \l_@@_initial_j_int 1
\bool_set_true:N \l_@@_initial_open_bool
@@ -11909,7 +12064,7 @@ version 2005/12/01 or later.
{
\@@_add_to_colors_seq:xn
{ \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } }
- { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt }}
+ { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt } }
}
}
% \end{macrocode}
@@ -11980,10 +12135,7 @@ version 2005/12/01 or later.
% \bigskip
% \begin{macrocode}
\keys_define:nn { NiceMatrix / arraycolor }
- {
- except-corners .clist_set:N = \l_tmpa_clist ,
- except-corners .default:n = { NW , SW , NE , SE }
- }
+ { except-corners .code:n = \@@_error:n { key except-corners } }
% \end{macrocode}
%
% \bigskip
@@ -11996,69 +12148,13 @@ version 2005/12/01 or later.
\NewDocumentCommand \@@_arraycolor { O { } m O { } }
{
\keys_set:nn { NiceMatrix / arraycolor } { #3 }
-% \end{macrocode}
-% If the key |except-corners| is not used, it's easy: we only have a rectangle
-% fo fill.
-% \begin{macrocode}
- \clist_if_empty:NTF \l_tmpa_clist
- {
- \@@_rectanglecolor [ #1 ] { #2 }
- { 1 - 1 } { \int_use:N \c@iRow - \int_use:N \c@jCol }
- }
-% \end{macrocode}
-% The interesting case is when the key |except-corners| is used. In that case,
-% we can't fill now the tabular because we don't know the list of the cells
-% of the corners. That's why we postpone the treatment in the |\CodeAfter|.
-% \begin{macrocode}
- {
- \tl_gput_left:Nx \g_@@_internal_code_after_tl
- {
- \@@_arraycolor_code_after:nnn
- { #1 }
- { \exp_not:n { #2 } }
- { \l_tmpa_clist }
- }
- }
+ \@@_rectanglecolor [ #1 ] { #2 }
+ { 1 - 1 }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
}
% \end{macrocode}
%
% \bigskip
-% The following command will be used in the |\CodeAfter|. |#1| is the color
-% model, |#2| the color and |#3| the value of the key |except-corners| (a
-% sublist of |{NW,NE,SW,SE}|).
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_arraycolor_code_after:nnn #1 #2 #3
- {
- \group_begin:
-% \end{macrocode}
-% First, we compute the corners.
-% \begin{macrocode}
- \clist_set:Nn \l_@@_corners_clist { #3 }
- \@@_compute_corners:
-% \end{macrocode}
-% Now, for each cell of the array (excepted the potential exterior rows and
-% columns) we check whether we have to fill that cell. When we have to fill the
-% cell, we do the job by writing an instruction in the |\CodeBefore| (in fact,
-% the ``|\CodeBefore|'' which will be written on the |aux| file for the next
-% run).
-% \begin{macrocode}
- \int_step_inline:nn \c@iRow
- {
- \int_step_inline:nn \c@jCol
- {
- \seq_if_in:NnF \l_@@_empty_corner_cells_seq { ##1 - ####1 }
- {
- \tl_gput_left:Nx \g_nicematrix_code_before_tl
- { \@@_cellcolor [ #1 ] { \exp_not:n { #2 } } { ##1 - ####1 } }
- }
- }
- }
- \group_end:
- }
-% \end{macrocode}
-%
-%
-% \bigskip
% \begin{macrocode}
\keys_define:nn { NiceMatrix / rowcolors }
{
@@ -12237,19 +12333,26 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
-% \begin{macrocode}
-\cs_new:Npn \@@_cartesian_path: { \@@_cartesian_path:n { 0 pt } }
-% \end{macrocode}
-%
% \bigskip
-% The following command uses two implicit arguments : |\l_@@_rows_tl| and
+% The following command uses two implicit arguments: |\l_@@_rows_tl| and
% |\l_@@_cols_tl| which are specifications for a set of rows and a set of
% columns. It creates a path but does \emph{not} fill it. It must be filled by
-% another command after. The argument is the radius of the corners.
+% another command after. The argument is the radius of the corners. We define
+% below a command |\@@_cartesian_path:| which corresponds to a value $0$~pt for
+% the radius of the corners.
+%
+% This command is in particular used in |\@@_rectanglecolor:nnn| (used in
+% |\@@_rectanglecolor|, itself used in |\@@_cellcolor|).
% \begin{macrocode}
\cs_new_protected:Npn \@@_cartesian_path:n #1
{
+ \bool_lazy_and:nnT
+ { ! \seq_if_empty_p:N \l_@@_corners_cells_seq }
+ { \dim_compare_p:nNn { #1 } = \c_zero_dim }
+ {
+ \@@_expand_clist:NN \l_@@_cols_tl \c@jCol
+ \@@_expand_clist:NN \l_@@_rows_tl \c@iRow
+ }
% \end{macrocode}
% We begin the loop over the columns.
% \begin{macrocode}
@@ -12270,11 +12373,14 @@ version 2005/12/01 or later.
\int_compare:nNnT \l_tmpb_tl > \c@jCol
{ \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } }
% \end{macrocode}
+% |\l_tmpc_tl| will contain the number of column.
+% \begin{macrocode}
+ \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl
+% \end{macrocode}
% If we decide to provide the commands |\cellcolor|, |\rectanglecolor|,
-% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| available in
-% the |code-before| of a |\SubMatrix|, we will have to modify the following
-% line, by adding a kind of offset. We will have also some other rows below in
-% the same command |\@@_cartesian_path:|.
+% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| in the
+% |code-before| of a |\SubMatrix|, we will have to modify the following line, by
+% adding a kind of offset. We will have also some other lines to modify.
% \begin{macrocode}
\@@_qpoint:n { col - \l_tmpa_tl }
\int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl
@@ -12299,36 +12405,83 @@ version 2005/12/01 or later.
% \end{macrocode}
% Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|.
% \begin{macrocode}
- \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth }
- \@@_qpoint:n { row - \l_tmpa_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth }
- \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpd_dim }
- { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
+ \seq_if_in:NxF \l_@@_corners_cells_seq
+ { \l_tmpa_tl - \l_tmpc_tl }
+ {
+ \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl }
+ \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth }
+ \@@_qpoint:n { row - \l_tmpa_tl }
+ \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth }
+ \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
+ \pgfpathrectanglecorners
+ { \pgfpoint \l_tmpc_dim \l_tmpd_dim }
+ { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
+ }
}
}
}
% \end{macrocode}
%
+% \bigskip
+% The following command corresponds to a radius of the corners equal to $0$~pt.
+% This command is used by the commands |\@@_rowcolors|, |\@@_columncolor| and
+% |\@@_rowcolor:n| (used in |\@@_rowcolor|).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cartesian_path: { \@@_cartesian_path:n { 0 pt } }
+% \end{macrocode}
+%
%
% \bigskip
+% The following command will be used only with |\l_@@_cols_tl| and |\c@jCol| (first
+% case) or with |\l_@@_rows_tl| and |\c@iRow| (second case). For instance, with
+% |\l_@@_cols_tl| equal to |2,4-6,8-*| and |\c@jCol| equal to |10|, the clist
+% |\l_@@_cols_tl| will be replaced by |2,4,5,6,8,9,10|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_expand_clist:NN #1 #2
+ {
+ \clist_set_eq:NN \l_tmpa_clist #1
+ \clist_clear:N #1
+ \clist_map_inline:Nn \l_tmpa_clist
+ {
+ \tl_set:Nn \l_tmpa_tl { ##1 }
+ \tl_if_in:NnTF \l_tmpa_tl { - }
+ { \@@_cut_on_hyphen:w ##1 \q_stop }
+ { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop }
+ \bool_lazy_or:nnT
+ { \tl_if_blank_p:V \l_tmpa_tl }
+ { \str_if_eq_p:Vn \l_tmpa_tl { * } }
+ { \tl_set:Nn \l_tmpa_tl { 1 } }
+ \bool_lazy_or:nnT
+ { \tl_if_blank_p:V \l_tmpb_tl }
+ { \str_if_eq_p:Vn \l_tmpb_tl { * } }
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } }
+ \int_compare:nNnT \l_tmpb_tl > #2
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } }
+ \int_step_inline:nnn \l_tmpa_tl \l_tmpb_tl
+ { \clist_put_right:Nn #1 { ####1 } }
+ }
+ }
+% \end{macrocode}
+%
+% \bigskip
% When the user uses the key |colortbl-like|, the following command will
% be linked to |\cellcolor| in the tabular.
% \begin{macrocode}
\NewDocumentCommand \@@_cellcolor_tabular { O { } m }
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
- {
+ \peek_remove_spaces:n
+ {
+ \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ {
% \end{macrocode}
% We must not expand the color (|#2|) because the color may contain the token
% |!| which may be activated by some packages (ex.: \pkg{babel} with the option
% |french| on latex and pdflatex).
% \begin{macrocode}
- \cellcolor [ #1 ] { \exp_not:n { #2 } }
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- }
+ \cellcolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ }
+ }
}
% \end{macrocode}
%
@@ -12338,11 +12491,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \@@_rowcolor_tabular { O { } m }
{
- \tl_gput_right:Nx \g_nicematrix_code_before_tl
- {
- \exp_not:N \rectanglecolor [ #1 ] { \exp_not:n { #2 } }
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- { \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
+ \peek_remove_spaces:n
+ {
+ \tl_gput_right:Nx \g_nicematrix_code_before_tl
+ {
+ \exp_not:N \rectanglecolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ { \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
+ }
}
}
% \end{macrocode}
@@ -12522,20 +12678,20 @@ version 2005/12/01 or later.
\int_compare:nNnTF \l_tmpb_tl = { \@@_succ:n \c@jCol }
{
\seq_if_in:NxT
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ \l_tmpa_tl - \@@_pred:n \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
{
\seq_if_in:NxT
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ \l_tmpa_tl - \l_tmpb_tl }
{
\int_compare:nNnTF \l_tmpb_tl = 1
{ \bool_set_false:N \g_tmpa_bool }
{
\seq_if_in:NxT
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ \l_tmpa_tl - \@@_pred:n \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
@@ -12609,8 +12765,8 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_draw_vlines:
{
\int_step_inline:nnn
- { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
- { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol }
+ { \bool_if:NTF \g_@@_NiceArray_bool 1 2 }
+ { \bool_if:NTF \g_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol }
{
\tl_if_eq:NnF \l_@@_vlines_clist { all }
{ \clist_if_in:NnT \l_@@_vlines_clist { ##1 } }
@@ -12702,20 +12858,20 @@ version 2005/12/01 or later.
\int_compare:nNnTF \l_tmpa_tl = { \@@_succ:n \c@iRow }
{
\seq_if_in:NxT
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ \@@_pred:n \l_tmpa_tl - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
{
\seq_if_in:NxT
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ \l_tmpa_tl - \l_tmpb_tl }
{
\int_compare:nNnTF \l_tmpa_tl = 1
{ \bool_set_false:N \g_tmpa_bool }
{
\seq_if_in:NxT
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ \@@_pred:n \l_tmpa_tl - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
@@ -12783,8 +12939,8 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_draw_hlines:
{
\int_step_inline:nnn
- { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
- { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow }
+ { \bool_if:NTF \g_@@_NiceArray_bool 1 2 }
+ { \bool_if:NTF \g_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow }
{
\tl_if_eq:NnF \l_@@_hlines_clist { all }
{ \clist_if_in:NnT \l_@@_hlines_clist { ##1 } }
@@ -12906,10 +13062,10 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_compute_corners:
{
% \end{macrocode}
-% The sequence |\l_@@_empty_corner_cells_seq| will be the sequence of all the
+% The sequence |\l_@@_corners_cells_seq| will be the sequence of all the
% empty cells (and not in a block) considered in the corners of the array.
% \begin{macrocode}
- \seq_clear_new:N \l_@@_empty_corner_cells_seq
+ \seq_clear_new:N \l_@@_corners_cells_seq
\clist_map_inline:Nn \l_@@_corners_clist
{
\str_case:nnF { ##1 }
@@ -12925,6 +13081,27 @@ version 2005/12/01 or later.
}
{ \@@_error:nn { bad~corner } { ##1 } }
}
+% \end{macrocode}
+% Even if the user has used the key |corners| (or the key
+% |hvlines-except-corners|), the list of cells in the corners may be empty.
+% \begin{macrocode}
+ \seq_if_empty:NF \l_@@_corners_cells_seq
+ {
+% \end{macrocode}
+% You write on the |aux| file the list of the cells which are in the (empty)
+% corners because you need that information in the |\CodeBefore| since the
+% commands which color the |rows|, |columns| and |cells| must not color the
+% cells in the corners.
+% \begin{macrocode}
+ \iow_now:Nn \@mainaux \ExplSyntaxOn
+ \iow_now:Nx \@mainaux
+ {
+ \seq_gset_from_clist:cn
+ { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
+ { \seq_use:Nnnn \l_@@_corners_cells_seq , , , }
+ }
+ \iow_now:Nn \@mainaux \ExplSyntaxOff
+ }
}
% \end{macrocode}
%
@@ -12932,7 +13109,7 @@ version 2005/12/01 or later.
% \bigskip
% ``Computing a corner'' is determining all the empty cells (which are not in a
% block) that belong to that corner. These cells will be added to the sequence
-% |\l_@@_empty_corner_cells_seq|.
+% |\l_@@_corners_cells_seq|.
%
% \medskip
% The six arguments of |\@@_compute_a_corner:nnnnnn| are as follow:
@@ -13020,7 +13197,7 @@ version 2005/12/01 or later.
{
\int_set:Nn \l_@@_last_empty_column_int { ####1 }
\seq_put_right:Nn
- \l_@@_empty_corner_cells_seq
+ \l_@@_corners_cells_seq
{ ##1 - ####1 }
}
}
@@ -13200,14 +13377,14 @@ version 2005/12/01 or later.
% We do a reduction by |\arraycolsep| for the environments with delimiters (and
% not for the other).
% \begin{macrocode}
- \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep
+ \bool_if:NTF \g_@@_NiceArray_bool \c_zero_dim \arraycolsep
- \l_@@_left_margin_dim
}
\@@_qpoint:n { col - \@@_succ:n \c@jCol }
\dim_set:Nn \l_@@_x_final_dim
{
\pgf@x -
- \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep
+ \bool_if:NTF \g_@@_NiceArray_bool \c_zero_dim \arraycolsep
+ \l_@@_right_margin_dim
}
% \end{macrocode}
@@ -13215,9 +13392,9 @@ version 2005/12/01 or later.
% bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a
% better result.
% \begin{macrocode}
- \tl_if_eq:NnF \l_@@_left_delim_tl (
+ \tl_if_eq:NnF \g_@@_left_delim_tl (
{ \dim_gadd:Nn \l_@@_x_initial_dim { 0.5 \l_@@_inter_dots_dim } }
- \tl_if_eq:NnF \l_@@_right_delim_tl )
+ \tl_if_eq:NnF \g_@@_right_delim_tl )
{ \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_inter_dots_dim } }
% \end{macrocode}
%
@@ -13763,8 +13940,13 @@ version 2005/12/01 or later.
% with the syntax $i$|-|$j$) has not be provided by the user, you use |1-1|
% (that is to say a block of only one cell).
% \begin{macrocode}
- \tl_if_blank:nTF { #2 } { \@@_Block_i 1-1 \q_stop } { \@@_Block_i #2 \q_stop }
- { #1 } { #3 } { #4 }
+ \peek_remove_spaces:n
+ {
+ \tl_if_blank:nTF { #2 }
+ { \@@_Block_i 1-1 \q_stop }
+ { \@@_Block_i #2 \q_stop }
+ { #1 } { #3 } { #4 }
+ }
}
% \end{macrocode}
%
@@ -14078,6 +14260,8 @@ version 2005/12/01 or later.
color .value_required:n = true ,
borders .clist_set:N = \l_@@_borders_clist ,
borders .value_required:n = true ,
+ hvlines .bool_set:N = \l_@@_hvlines_block_bool ,
+ hvlines .default:n = true ,
line-width .dim_set:N = \l_@@_line_width_dim ,
line-width .value_required:n = true ,
l .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl l ,
@@ -14186,6 +14370,19 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
+ \bool_if:NT \l_@@_hvlines_block_bool
+ {
+ \tl_gput_right:Nx \g_nicematrix_code_after_tl
+ {
+ \@@_hvlines_block:nnn
+ { \exp_not:n { #5 } }
+ { #1 - #2 }
+ { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
+ }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\clist_if_empty:NF \l_@@_borders_clist
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
@@ -14201,10 +14398,17 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_if_empty:NF \l_@@_fill_tl
{
+% \end{macrocode}
+% The command |\@@_extract_brackets| will extract the potential specification of
+% color space at the beginning of |\l_@@_fill_tl| and store it in |\l_tmpa_tl|
+% and store the color itself in |\l_tmpb_tl|.
+% \begin{macrocode}
+ \exp_last_unbraced:NV \@@_extract_brackets \l_@@_fill_tl \q_stop
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
\exp_not:N \roundedrectanglecolor
- { \exp_not:V \l_@@_fill_tl }
+ [ \l_tmpa_tl ]
+ { \exp_not:V \l_tmpb_tl }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
{ \dim_use:N \l_@@_rounded_corners_dim }
@@ -14486,7 +14690,17 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+% \bigskip
+% \begin{macrocode}
+\NewDocumentCommand \@@_extract_brackets { O { } }
+ {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \@@_store_in_tmpb_tl
+ }
+\cs_new_protected:Npn \@@_store_in_tmpb_tl #1 \q_stop
+ { \tl_set:Nn \l_tmpb_tl { #1 } }
+% \end{macrocode}
+%
% % \bigskip
% The first argument of |\@@_stroke_block:nnn| is a list of options for the
% rectangle that you will stroke. The second argument is the upper-left cell of
@@ -14563,6 +14777,60 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+
+% \bigskip
+% The first argument of |\@@_hvlines_block:nnn| is a list of options for the
+% rules that wewill draw. The second argument is the upper-left cell of the
+% block (with, as usual, the syntax $i$|-|$j$) and the third is the last cell of
+% the block (with the same syntax).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_hvlines_block:nnn #1 #2 #3
+ {
+ \dim_set_eq:NN \l_@@_line_width_dim \arrayrulewidth
+ \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 }
+ \@@_cut_on_hyphen:w #2 \q_stop
+ \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl
+ \@@_cut_on_hyphen:w #3 \q_stop
+ \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
+ \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \CT@arc@
+ \pgfsetlinewidth { 1.1 \l_@@_line_width_dim }
+% \end{macrocode}
+% First, the vertical rules.
+% \begin{macrocode}
+ \@@_qpoint:n { row - \l_tmpa_tl }
+ \dim_set_eq:NN \l_tmpa_dim \pgf@y
+ \@@_qpoint:n { row - \l_tmpc_tl }
+ \dim_set_eq:NN \l_tmpb_dim \pgf@y
+ \int_step_inline:nnn \l_tmpd_tl \l_tmpb_tl
+ {
+ \@@_qpoint:n { col - ##1 }
+ \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpa_dim }
+ \pgfpathlineto { \pgfpoint \pgf@x \l_tmpb_dim }
+ \pgfusepathqstroke
+ }
+% \end{macrocode}
+% Now, the horizontal rules.
+% \begin{macrocode}
+ \@@_qpoint:n { col - \l_tmpb_tl }
+ \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth }
+ \@@_qpoint:n { col - \l_tmpd_tl }
+ \dim_set:Nn \l_tmpb_dim { \pgf@x - 0.5 \arrayrulewidth }
+ \int_step_inline:nnn \l_tmpc_tl \l_tmpa_tl
+ {
+ \@@_qpoint:n { row - ##1 }
+ \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y }
+ \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y }
+ \pgfusepathqstroke
+ }
+ \endpgfpicture
+ }
+% \end{macrocode}
+%
% \bigskip
% The first argument of |\@@_stroke_borders_block:nnn| is a list of options for
% the borders that you will stroke. The second argument is the upper-left cell
@@ -14749,10 +15017,9 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } }
{
- \group_begin:
- \bool_set_true:N \l_@@_NiceArray_bool
- \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ]
- \group_end:
+ \bool_gset_true:N \g_@@_NiceArray_bool
+ \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ]
+ \bool_gset_false: \g_@@_NiceArray_bool
}
% \end{macrocode}
%
@@ -14957,10 +15224,10 @@ version 2005/12/01 or later.
% A delimiter in the preamble of the array will write an instruction
% |\@@_delimiter:nnn| in the |\g_@@_internal_code_after_tl| (and also
% potentially add instructions in the preamble provided to |\array| in order to
-% add spaces between columns).
+% add space between columns).
%
% \smallskip
-% The first argument is the type of delimiter (|(|, |[|, |\{|, |)|, |]| ou
+% The first argument is the type of delimiter (|(|, |[|, |\{|, |)|, |]| or
% |\}|). The second argument is the number of colummn. The third argument is a
% boolean equal to |\c_true_bool| (resp. |\c_false_true|) when the delimiter
% must be put on the left (resp. right) side.
@@ -15183,7 +15450,7 @@ version 2005/12/01 or later.
% The last value of |\int_step_inline:nnn| is provided by currifycation.
% \begin{macrocode}
\bool_if:NTF \l_@@_submatrix_slim_bool
- { \int_step_inline:nnn \l_@@_first_i_tl \l_@@_last_i_tl }
+ { \int_step_inline:nnn \l_@@_first_i_tl \l_@@_last_i_tl }
{ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int }
{
\cs_if_exist:cT
@@ -15201,67 +15468,85 @@ version 2005/12/01 or later.
{ \dim_max:nn \l_@@_x_final_dim \pgf@x }
}
}
- \@@_qpoint:n { row - \l_@@_first_i_tl - base }
- \dim_set:Nn \l_@@_y_initial_dim
- { \pgf@y + ( \box_ht:N \strutbox + \extrarowheight ) * \arraystretch }
- \@@_qpoint:n { row - \l_@@_last_i_tl - base }
- \dim_set:Nn \l_@@_y_final_dim
- { \pgf@y - ( \box_dp:N \strutbox ) * \arraystretch }
- \int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int
+ \dim_compare:nNnTF \l_@@_x_initial_dim = \c_max_dim
+ { \@@_error:nn { impossible~delimiter } { left } }
{
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - \l_@@_first_i_tl - ##1 }
- {
- \pgfpointanchor { \@@_env: - \l_@@_first_i_tl - ##1 } { north }
- \dim_set:Nn \l_@@_y_initial_dim
- { \dim_max:nn \l_@@_y_initial_dim \pgf@y }
- }
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - \l_@@_last_i_tl - ##1 }
- {
- \pgfpointanchor { \@@_env: - \l_@@_last_i_tl - ##1 } { south }
- \dim_set:Nn \l_@@_y_final_dim
- { \dim_min:nn \l_@@_y_final_dim \pgf@y }
- }
+ \dim_compare:nNnTF \l_@@_x_final_dim = { - \c_max_dim }
+ { \@@_error:nn { impossible~delimiter } { right } }
+ { \@@_sub_matrix_i:nn { #1 } { #4 } }
}
- \dim_set:Nn \l_tmpa_dim
- {
- \l_@@_y_initial_dim - \l_@@_y_final_dim +
- \l_@@_submatrix_extra_height_dim - \arrayrulewidth
+ \endpgfpicture
+ }
+ \group_end:
+ }
+% \end{macrocode}
+%
+% \bigskip
+% |#1| is the left delimiter dans |#2| is the right one.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_sub_matrix_i:nn #1 #2
+ {
+ \@@_qpoint:n { row - \l_@@_first_i_tl - base }
+ \dim_set:Nn \l_@@_y_initial_dim
+ { \pgf@y + ( \box_ht:N \strutbox + \extrarowheight ) * \arraystretch }
+ \@@_qpoint:n { row - \l_@@_last_i_tl - base }
+ \dim_set:Nn \l_@@_y_final_dim
+ { \pgf@y - ( \box_dp:N \strutbox ) * \arraystretch }
+ \int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - \l_@@_first_i_tl - ##1 }
+ {
+ \pgfpointanchor { \@@_env: - \l_@@_first_i_tl - ##1 } { north }
+ \dim_set:Nn \l_@@_y_initial_dim
+ { \dim_max:nn \l_@@_y_initial_dim \pgf@y }
+ }
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - \l_@@_last_i_tl - ##1 }
+ {
+ \pgfpointanchor { \@@_env: - \l_@@_last_i_tl - ##1 } { south }
+ \dim_set:Nn \l_@@_y_final_dim
+ { \dim_min:nn \l_@@_y_final_dim \pgf@y }
}
- \dim_set_eq:NN \nulldelimiterspace \c_zero_dim
+ }
+ \dim_set:Nn \l_tmpa_dim
+ {
+ \l_@@_y_initial_dim - \l_@@_y_final_dim +
+ \l_@@_submatrix_extra_height_dim - \arrayrulewidth
+ }
+ \dim_set_eq:NN \nulldelimiterspace \c_zero_dim
% \end{macrocode}
%
% \bigskip
% We will draw the rules in the |\SubMatrix|.
% \begin{macrocode}
- \group_begin:
- \pgfsetlinewidth { 1.1 \arrayrulewidth }
- \tl_if_empty:NF \l_@@_rules_color_tl
- { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
- \CT@arc@
+ \group_begin:
+ \pgfsetlinewidth { 1.1 \arrayrulewidth }
+ \tl_if_empty:NF \l_@@_rules_color_tl
+ { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
+ \CT@arc@
% \end{macrocode}
% Now, we draw the potential vertical rules specified in the preamble of the
% environments with the letter fixed with the key |vlines-in-sub-matrix|. The
% list of the columns where there is such rule to draw is in |\g_@@_cols_vlism_seq|.
% \begin{macrocode}
- \seq_map_inline:Nn \g_@@_cols_vlism_seq
- {
- \int_compare:nNnT \l_@@_first_j_tl < { ##1 }
- {
- \int_compare:nNnT
- { ##1 } < { \int_eval:n { \l_@@_last_j_tl + 1 } }
- {
+ \seq_map_inline:Nn \g_@@_cols_vlism_seq
+ {
+ \int_compare:nNnT \l_@@_first_j_tl < { ##1 }
+ {
+ \int_compare:nNnT
+ { ##1 } < { \int_eval:n { \l_@@_last_j_tl + 1 } }
+ {
% \end{macrocode}
% First, we extract the value of the abscissa of the rule we have to draw.
% \begin{macrocode}
- \@@_qpoint:n { col - ##1 }
- \pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim }
- \pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim }
- \pgfusepathqstroke
- }
+ \@@_qpoint:n { col - ##1 }
+ \pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim }
+ \pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim }
+ \pgfusepathqstroke
}
}
+ }
% \end{macrocode}
%
% \medskip
@@ -15269,23 +15554,23 @@ version 2005/12/01 or later.
% The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given
% by curryfication.
% \begin{macrocode}
- \tl_if_eq:NnTF \l_@@_submatrix_vlines_clist { all }
- { \int_step_inline:nn { \l_@@_last_j_tl - \l_@@_first_j_tl } }
- { \clist_map_inline:Nn \l_@@_submatrix_vlines_clist }
+ \tl_if_eq:NnTF \l_@@_submatrix_vlines_clist { all }
+ { \int_step_inline:nn { \l_@@_last_j_tl - \l_@@_first_j_tl } }
+ { \clist_map_inline:Nn \l_@@_submatrix_vlines_clist }
+ {
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn { ##1 } > 0 }
+ {
+ \int_compare_p:nNn
+ { ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } }
{
- \bool_lazy_and:nnTF
- { \int_compare_p:nNn { ##1 } > 0 }
- {
- \int_compare_p:nNn
- { ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } }
- {
- \@@_qpoint:n { col - \int_eval:n { ##1 + \l_@@_first_j_tl } }
- \pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim }
- \pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim }
- \pgfusepathqstroke
- }
- { \@@_error:nnn { Wrong~line~in~SubMatrix } { vertical } { ##1 } }
+ \@@_qpoint:n { col - \int_eval:n { ##1 + \l_@@_first_j_tl } }
+ \pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim }
+ \pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim }
+ \pgfusepathqstroke
}
+ { \@@_error:nnn { Wrong~line~in~SubMatrix } { vertical } { ##1 } }
+ }
% \end{macrocode}
%
% \medskip
@@ -15294,50 +15579,50 @@ version 2005/12/01 or later.
% The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given
% by curryfication.
% \begin{macrocode}
- \tl_if_eq:NnTF \l_@@_submatrix_hlines_clist { all }
- { \int_step_inline:nn { \l_@@_last_i_tl - \l_@@_first_i_tl } }
- { \clist_map_inline:Nn \l_@@_submatrix_hlines_clist }
+ \tl_if_eq:NnTF \l_@@_submatrix_hlines_clist { all }
+ { \int_step_inline:nn { \l_@@_last_i_tl - \l_@@_first_i_tl } }
+ { \clist_map_inline:Nn \l_@@_submatrix_hlines_clist }
+ {
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn { ##1 } > 0 }
+ {
+ \int_compare_p:nNn
+ { ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } }
{
- \bool_lazy_and:nnTF
- { \int_compare_p:nNn { ##1 } > 0 }
- {
- \int_compare_p:nNn
- { ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } }
- {
- \@@_qpoint:n { row - \int_eval:n { ##1 + \l_@@_first_i_tl } }
+ \@@_qpoint:n { row - \int_eval:n { ##1 + \l_@@_first_i_tl } }
% \end{macrocode}
% We use a group to protect |\l_tmpa_dim| and |\l_tmpb_dim|.
% \begin{macrocode}
- \group_begin:
+ \group_begin:
% \end{macrocode}
% We compute in |\l_tmpa_dim| the $x$-value of the left end of the rule.
% \begin{macrocode}
- \dim_set:Nn \l_tmpa_dim
- { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim }
- \str_case:nn { #1 }
- {
- ( { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } }
- [ { \dim_sub:Nn \l_tmpa_dim { 0.2 mm } }
- \{ { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } }
- }
- \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y }
+ \dim_set:Nn \l_tmpa_dim
+ { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim }
+ \str_case:nn { #1 }
+ {
+ ( { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } }
+ [ { \dim_sub:Nn \l_tmpa_dim { 0.2 mm } }
+ \{ { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } }
+ }
+ \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y }
% \end{macrocode}
% We compute in |\l_tmpb_dim| the $x$-value of the right end of the rule.
% \begin{macrocode}
- \dim_set:Nn \l_tmpb_dim
- { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim }
- \str_case:nn { #4 }
- {
- ) { \dim_add:Nn \l_tmpb_dim { 0.9 mm } }
- ] { \dim_add:Nn \l_tmpb_dim { 0.2 mm } }
- \} { \dim_add:Nn \l_tmpb_dim { 0.9 mm } }
- }
- \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y }
- \pgfusepathqstroke
- \group_end:
+ \dim_set:Nn \l_tmpb_dim
+ { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim }
+ \str_case:nn { #2 }
+ {
+ ) { \dim_add:Nn \l_tmpb_dim { 0.9 mm } }
+ ] { \dim_add:Nn \l_tmpb_dim { 0.2 mm } }
+ \} { \dim_add:Nn \l_tmpb_dim { 0.9 mm } }
}
- { \@@_error:nnn { Wrong~line~in~SubMatrix } { horizontal } { ##1 } }
+ \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y }
+ \pgfusepathqstroke
+ \group_end:
}
+ { \@@_error:nnn { Wrong~line~in~SubMatrix } { horizontal } { ##1 } }
+ }
% \end{macrocode}
%
% \medskip
@@ -15345,13 +15630,13 @@ version 2005/12/01 or later.
% node with that name for the submatrix (this node does not encompass the
% delimiters that we will put after).
% \begin{macrocode}
- \str_if_empty:NF \l_@@_submatrix_name_str
- {
- \@@_pgf_rect_node:nnnnn \l_@@_submatrix_name_str
- \l_@@_x_initial_dim \l_@@_y_initial_dim
- \l_@@_x_final_dim \l_@@_y_final_dim
- }
- \group_end:
+ \str_if_empty:NF \l_@@_submatrix_name_str
+ {
+ \@@_pgf_rect_node:nnnnn \l_@@_submatrix_name_str
+ \l_@@_x_initial_dim \l_@@_y_initial_dim
+ \l_@@_x_final_dim \l_@@_y_final_dim
+ }
+ \group_end:
% \end{macrocode}
% The group was for |\CT@arc@| (the color of the rules).
%
@@ -15359,45 +15644,41 @@ version 2005/12/01 or later.
% Now, we deal with the left delimiter. Of course, the environment
% |{pgfscope}| is for the |\pgftransformshift|.
% \begin{macrocode}
- \begin { pgfscope }
- \pgftransformshift
- {
- \pgfpoint
- { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim }
- { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 }
- }
- \str_if_empty:NTF \l_@@_submatrix_name_str
- { \@@_node_left:nn #1 { } }
- { \@@_node_left:nn #1 { \@@_env: - \l_@@_submatrix_name_str - left } }
- \end { pgfscope }
+ \begin { pgfscope }
+ \pgftransformshift
+ {
+ \pgfpoint
+ { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim }
+ { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 }
+ }
+ \str_if_empty:NTF \l_@@_submatrix_name_str
+ { \@@_node_left:nn #1 { } }
+ { \@@_node_left:nn #1 { \@@_env: - \l_@@_submatrix_name_str - left } }
+ \end { pgfscope }
% \end{macrocode}
%
% \medskip
% Now, we deal with the right delimiter.
% \begin{macrocode}
- \pgftransformshift
- {
- \pgfpoint
- { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim }
- { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 }
- }
- \str_if_empty:NTF \l_@@_submatrix_name_str
- { \@@_node_right:nn #4 { } }
- {
- \@@_node_right:nn #4 { \@@_env: - \l_@@_submatrix_name_str - right }
- }
- \endpgfpicture
+ \pgftransformshift
+ {
+ \pgfpoint
+ { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim }
+ { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 }
+ }
+ \str_if_empty:NTF \l_@@_submatrix_name_str
+ { \@@_node_right:nn #2 { } }
+ {
+ \@@_node_right:nn #2 { \@@_env: - \l_@@_submatrix_name_str - right }
+ }
% \end{macrocode}
%
% \begin{macrocode}
- \cs_set_eq:NN \pgfpointanchor \@@_pgfpointanchor:n
- \flag_clear_new:n { nicematrix }
- \l_@@_code_tl
- }
- \group_end:
+ \cs_set_eq:NN \pgfpointanchor \@@_pgfpointanchor:n
+ \flag_clear_new:n { nicematrix }
+ \l_@@_code_tl
}
% \end{macrocode}
-% The group was a group for the whole |\SubMatrix|.
%
% \bigskip
% In the key |code| of the command |\SubMatrix| there may be Tikz instructions.
@@ -15613,6 +15894,8 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \medskip
+% Maybe we will completely delete the key 'transparent' in a future version.
% \begin{macrocode}
\@@_msg_new:nn { Key~transparent }
{
@@ -15713,6 +15996,31 @@ version 2005/12/01 or later.
% \bigskip
% \subsection*{Error messages of the package}
%
+%
+% The following message will be deleted when we will delete the key
+% |except-corners| for the command |\arraycolor|.
+% \begin{macrocode}
+\@@_msg_new:nn { key except-corners }
+ {
+ The~key~'except-corners'~has~been~deleted~for~the~command~\token_to_str:N
+ \arraycolor\ in~the~\token_to_str:N \CodeBefore.~You~should~instead~use~
+ the~key~'corners'~in~your~\@@_full_name_env:.\\
+ If~you~go~on,~this~key~will~be~ignored.
+ }
+% \end{macrocode}
+%
+%
+% \medskip
+% The following message will be deleted when we will delete the key
+% |delimiters-color| (and keep only the key |delimiters/color|).
+% \begin{macrocode}
+\@@_msg_new:nn { delimiters-color deleted }
+ {
+ The~key~'delimiters-color'~has~been~renamed~'delimiters/color'.\\
+ ~However,~you~can~go~on~for~this~time.
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\seq_new:N \c_@@_types_of_matrix_seq
\seq_set_from_clist:Nn \c_@@_types_of_matrix_seq
@@ -15843,6 +16151,21 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \begin{macrocode}
+\@@_msg_new:nn { double~closing~delimiter }
+ {
+ You~can't~put~a~second~closing~delimiter~"#1"~just~after~a~first~closing~
+ delimiter.~This~delimiter~will~be~ignored.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { delimiter~after~opening }
+ {
+ You~can't~put~a~second~delimiter~"#1"~just~after~a~first~opening~
+ delimiter.~This~delimiter~will~be~ignored.
+ }
+% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { bad~option~for~line-style }
@@ -15943,6 +16266,18 @@ version 2005/12/01 or later.
number~is~not~valid.~If~you~go~on,~it~will~be~ignored.
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { impossible~delimiter }
+ {
+ It's~impossible~to~draw~the~#1~delimiter~of~your~
+ \token_to_str:N \SubMatrix\ because~all~the~cells~are~empty~
+ in~that~column.
+ \bool_if:NT \l_@@_submatrix_slim_bool
+ { ~Maybe~you~should~try~without~the~key~'slim'. } \\
+ If~you~go~on,~this~\token_to_str:N \SubMatrix\ will~be~ignored.
+ }
+% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { empty~environment }
@@ -16154,8 +16489,8 @@ version 2005/12/01 or later.
For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~keys~are~(in~alphabetic~order):~borders,~c,~draw,~fill,~l,~
- line-width,~rounded-corners~and~r.
+ The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~
+ hvlines,~l,~line-width,~rounded-corners,~r~and~t.
}
% \end{macrocode}
%
@@ -16468,9 +16803,10 @@ version 2005/12/01 or later.
% The successive versions of the file |nicematrix.sty| provided by TeXLive are available on the
% \textsc{svn} server of TeXLive:
%
+% \smallskip
% {
% \small
-% \url{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
+% \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty}
% }
%
%
@@ -16918,12 +17254,23 @@ version 2005/12/01 or later.
%
% \subsection*{Changes between versions 5.13 and 5.14}
%
-% Nodes of the forme |(1.5)|, |(2.5)|, |(3.5)|, etc.
+% Nodes of the form |(1.5)|, |(2.5)|, |(3.5)|, etc.
%
% Keys |t| and |b| for the command |\Block|.
%
% Key |corners|.
%
+% \subsection*{Changes between versions 5.14 and 5.15}
+%
+% Key |hvlines| for the command |\Block|.
+%
+% The commands provided by \pkg{nicematrix} to color cells, rows and columns
+% don't color the cells which are in the ``corners'' (when the key |corner| is
+% used).
+%
+% It's now possible to specify delimiters for submatrices in the preamble of an
+% environment.
+%
% \PrintIndex
%
% \tableofcontents
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index c228e67e67..b710425395 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ