summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-16 19:57:34 +0000
committerKarl Berry <karl@freefriends.org>2021-07-16 19:57:34 +0000
commit7dae219cffdd41f06364c53711ced32311b69733 (patch)
tree7f163c4465942e3007af0bbe6e63e1a5965361a3 /Master/texmf-dist
parent189cdddc0579b30df1ea73a5d8583a8c8ce7f66f (diff)
nicematrix (16jul21)
git-svn-id: svn://tug.org/texlive/trunk@59952 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdfbin463618 -> 463891 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex86
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdfbin1331253 -> 1339461 bytes
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx345
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty197
5 files changed, 513 insertions, 115 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
index e630974f2f1..8f455bfe5d9 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
index cfa537184b6..4db0a583f18 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
@@ -218,6 +218,8 @@ lettres |L|, |C| et |R|, \pkg{nicematrix} doit être chargé avec l'option
\section{L'espace vertical entre les rangées}
+\label{cell-space}
+
Il est bien connu que certaines rangées des tableaux créés par défaut avec
LaTeX sont trop proches l'une de l'autre. On en donne ci-dessous un exemple
classique.
@@ -524,7 +526,7 @@ tableau) ;
\item la clé |color| prend en argument une couleur et l'applique au contenu et
trace également le cadre avec cette couleur.
\item la clé |line-width| fixe la largeur des filets servant pour le cadre (n'a
-d'intérêt que si |draw| est utilisée) ;
+d'intérêt que si |draw| ou |hvlines| est utilisée) ;
\item la clé |rounded-corners| impose des coins arrondis (pour le cadre dessiné
par |draw| et le fond dessiné par |fill|) avec un rayon égal à la valeur de
cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur par défaut est la
@@ -534,8 +536,7 @@ cette clé prend comme valeur une liste d'éléments parmi les suivants : |left|
|right|, |top| et |bottom| ;
\item 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 |\\|) ;
-\item \colorbox{yellow!50}{\bfseries Nouveau 5.15}\enskip la clé |hvlines| trace
-tous les filets horizontaux et verticaux dans le bloc.
+\item la clé |hvlines| trace tous les filets horizontaux et verticaux dans le bloc.
\end{itemize}
@@ -1312,9 +1313,9 @@ 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}.
+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
@@ -1732,6 +1733,38 @@ Dupont & Chantal & 15 janvier 1998 \\
\end{NiceTabular}
\end{center}
+\section{La commande \textbackslash RowStyle}
+
+\label{RowStyle}
+
+\colorbox{yellow!50}{\bfseries Nouveau 5.18}\enskip La commande |\RowStyle|
+prend en argument des instructions de mise en forme qui seront appliquées à
+chacune des cellules restantes sur la rangée en cours.
+
+\medskip
+Elle prend aussi en premier argument optionnel, entre crochets, une liste de
+couples clé-valeur. Les clés disponibles sont |cell-space-top-limit|,
+|cell-space-bottom-limit| et |cell-space-limits| avec le même effet que les clés
+globales de même nom (cf. p.~\pageref{cell-space}).
+
+\medskip
+\begin{BVerbatim}[boxwidth=11cm,baseline=c]
+\begin{NiceTabular}{cccc}[hlines,colortbl-like]
+~emphase#\RowStyle[cell-space-limits=3pt]{\rotate}@
+premier & deuxième & troisième & quatrième \\
+\rowcolor{blue!50}~emphase#\RowStyle{\color{white}\sffamily}@
+1 & 2 & 3 & 4 \\
+\end{NiceTabular}
+\end{BVerbatim}
+\begin{NiceTabular}{cccc}[hlines,colortbl-like]
+\RowStyle[cell-space-limits=3pt]{\rotate}
+premier & deuxième & troisième & quatrième \\
+\rowcolor{blue!50}\RowStyle{\color{white}\sffamily}
+1 & 2 & 3 & 4 \\
+\end{NiceTabular}
+
+\medskip
+La commande |\rotate| est présentée p.~\pageref{rotate}.
\section{La largeur des colonnes}
@@ -2590,7 +2623,7 @@ I & 0 & \Cdots &0 \\
\bigskip
Elle peut aussi être utilisée pour tracer une ligne diagonale non parallèle aux
autres lignes diagonales (par défaut, les lignes tracées par |\Ddots| sont
-«parallélisées» : cf~p.~\pageref{parallelization}).
+«parallélisées» : cf.~p.~\pageref{parallelization}).
\medskip
\begin{BVerbatim}
@@ -2666,7 +2699,34 @@ $\begin{NiceArray}{ccc@{\hspace{1.5em}}c}[cell-space-limits=2pt,margin]
\end{NiceArray}$
\bigskip
-Les options de la commande |\SubMatrix| sont les suivantes :
+\colorbox{yellow!50}{\bfseries Nouveau 5.18}\enskip La commande |\SubMatrix|
+accepte en fait également deux arguments optionnels spécifiés par les symboles
+traditionnels |^| et |_| pour des élements en exposant et en indice.
+
+\medskip
+\begin{scope}
+\hfuzz=15cm
+\begin{BVerbatim}[boxwidth=11cm,baseline=c]
+$\begin{bNiceMatrix}[right-margin=1em]
+1 & 1 & 1 \\
+1 & a & b \\
+1 & c & d
+\CodeAfter
+ ~emphase#\SubMatrix[{2-2}{3-3}]^{T}@
+\end{bNiceMatrix}$
+\end{BVerbatim}
+$\begin{bNiceMatrix}[right-margin=1em]
+1 & 1 & 1 \\
+1 & a & b \\
+1 & c & d
+\CodeAfter
+ \SubMatrix[{2-2}{3-3}]^{T}
+\end{bNiceMatrix}$
+\end{scope}
+
+
+\bigskip
+Les clés disponibles pour la commande |\SubMatrix| sont les suivantes :
%
\begin{itemize}
\item |left-xshift| et |right-xshift| déplacent horizontalement les délimiteurs
@@ -2763,7 +2823,6 @@ créée par une commande |\SubMatrix|. Ce nom est utilisé pour créer des nœud
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
@@ -3188,10 +3247,13 @@ $\begin{bNiceMatrix}[r]
\subsection{La commande \textbackslash rotate}
+\label{rotate}
+
Utilisée au début d'une case, la commande |\rotate| (fournie par \pkg{nicematrix}) compose le contenu après une
rotation de 90° dans le sens direct.
-Dans l'exemple suivant, on l'utilise dans le |code-for-first-row|.
+Dans l'exemple suivant, on l'utilise dans le |code-for-first-row|.\footnote{On
+ peut aussi l'utiliser dans |\RowStyle| (cf. p.~\pageref{RowStyle}).}
\bigskip
@@ -3419,6 +3481,10 @@ $\begin{bNiceMatrix}[delimiters/color=red]
3 & 4
\end{bNiceMatrix}$
+\medskip
+Cette couleur s'applique aussi aux délimiteurs tracés par |\SubMatrix|
+(cf.~p.~\pageref{sub-matrix}).
+
\subsection{L'environnement \{NiceArrayWithDelims\}}
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
index ca40e46907f..18b8189cdfe 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index f9ae880666d..fdaa5ac42a6 100644
--- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
+++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{5.17a}
-\def\myfiledate{2021/07/04}
+\def\myfileversion{5.18}
+\def\myfiledate{2021/07/15}
%
%
%<*batchfile>
@@ -27,7 +27,6 @@
\preamble
-
Copyright (C) 2018-2021 by F. Pantigny
-----------------------------------
@@ -268,6 +267,8 @@ version 2005/12/01 or later.
%
% \section{The vertical space between the rows}
%
+% \label{cell-space}
+%
% It's well known that some rows of the arrays created by default with LaTeX
% are, by default, too close to each other. Here is a classical example.
%
@@ -572,7 +573,7 @@ version 2005/12/01 or later.
% \item the key |color| takes in as value a color and apply that color the
% content of the block but draws also the frame of the block with that color;
% \item the key |line-width| is the width (thickness) of the frame (this key
-% should be used only when the key |draw| is in force);
+% should be used only when the key |draw| or the key |hvlines| is in force);
% \item the key |rounded-corners| requires rounded corners (for the frame drawn
% by |draw| and the shape drawn by |fill|) with a radius equal to the value of
% that key (the default value is 4~pt\footnote{This value is the initial value
@@ -582,8 +583,7 @@ version 2005/12/01 or later.
% by |left|, |right|, |top| and |bottom|;
% \item 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 |\\|);
-% \item \colorbox{yellow!50}{\bfseries New 5.15}\enskip the keys |hvlines| draws
-% all the vertical and horizontal rules in the block.
+% \item the keys |hvlines| draws all the vertical and horizontal rules in the block.
% \end{itemize}
%
% \interitem
@@ -1319,9 +1319,8 @@ version 2005/12/01 or later.
% 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}.
+% 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}
@@ -1724,6 +1723,38 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{center}
%
+% \section{The command \textbackslash RowStyle}
+%
+% \label{RowStyle}
+%
+% \colorbox{yellow!50}{\bfseries New 5.18}\enskip The command |\RowStyle| takes
+% in as argument some formatting intructions that will be applied to each cell
+% on the rest of the current row.
+%
+% \medskip
+% That command also takes in as optional argument (between square brackets)
+% a list of key-value pairs. The available keys are |cell-space-top-limit|,
+% |cell-space-bottom-limit| and |cell-space-limits| with the same meaning that
+% the corresponding global keys (cf. p.~\pageref{cell-space}).
+%
+% \medskip
+% \begin{BVerbatim}[boxwidth=11cm,baseline=c]
+% \begin{NiceTabular}{cccc}[hlines,colortbl-like]
+% ~emphase#\RowStyle[cell-space-limits=3pt]{\rotate}@
+% first & second & third & fourth \\
+% \rowcolor{blue!50}~emphase#\RowStyle{\color{white}\sffamily}@
+% 1 & 2 & 3 & 4 \\
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \begin{NiceTabular}{cccc}[hlines,colortbl-like]
+% \RowStyle[cell-space-limits=3pt]{\rotate}
+% first & second & third & fourth \\
+% \rowcolor{blue!50}\RowStyle{\color{white}\sffamily}
+% 1 & 2 & 3 & 4 \\
+% \end{NiceTabular}
+%
+% \medskip
+% The command |\rotate| is described p.~\pageref{rotate}.
%
% \section{The width of the columns}
% \label{width}
@@ -2637,6 +2668,33 @@ version 2005/12/01 or later.
% \end{NiceArray}$
%
% \bigskip
+% \colorbox{yellow!50}{\bfseries New 5.18}\enskip In fact, the command
+% |\SubMatrix| also takes in two optional arguments specified by the
+% traditionnal symbols |^| and |_| for material in superscript and subscript.
+%
+% \medskip
+% \begin{scope}
+% \hfuzz=15cm
+% \begin{BVerbatim}[boxwidth=11cm,baseline=c]
+% $\begin{bNiceMatrix}[right-margin=1em]
+% 1 & 1 & 1 \\
+% 1 & a & b \\
+% 1 & c & d
+% \CodeAfter
+% ~emphase#\SubMatrix[{2-2}{3-3}]^{T}@
+% \end{bNiceMatrix}$
+% \end{BVerbatim}
+% $\begin{bNiceMatrix}[right-margin=1em]
+% 1 & 1 & 1 \\
+% 1 & a & b \\
+% 1 & c & d
+% \CodeAfter
+% \SubMatrix[{2-2}{3-3}]^{T}
+% \end{bNiceMatrix}$
+% \end{scope}
+%
+%
+% \bigskip
% The options of the command |\SubMatrix| are as follows:
% \begin{itemize}
% \item |left-xshift| and |right-shift| shift horizontally the delimiters (there
@@ -2735,7 +2793,6 @@ version 2005/12/01 or later.
%
%
% \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.}
@@ -3147,11 +3204,15 @@ version 2005/12/01 or later.
%
% \subsection{The command \textbackslash rotate}
%
+% \label{rotate}
+%
% The package \pkg{nicematrix} provides a command |\rotate|. When used in the
% beginning of a cell, this command composes the contents of the cell after a
% rotation of 90° in the direct sens.
%
-% In the following command, we use that command in the |code-for-first-row|.
+% In the following command, we use that command in the
+% |code-for-first-row|.\footnote{It can also be used in \verb|RowStyle|
+% (cf.~p.~\pageref{RowStyle}.}
%
%\bigskip
%
@@ -3378,6 +3439,9 @@ version 2005/12/01 or later.
% 3 & 4
% \end{bNiceMatrix}$
%
+% \medskip
+% This colour alos applies to the delimiters drawn by the command |\SubMatrix|
+% (cf.~p.~\pageref{sub-matrix}).
%
% \subsection{The environment \{NiceArrayWithDelims\}}
%
@@ -5147,7 +5211,9 @@ version 2005/12/01 or later.
\AtBeginDocument
{
\@ifpackageloaded { colortbl }
- { \bool_set_true:N \c_@@_colortbl_loaded_bool }
+ {
+ \bool_set_true:N \c_@@_colortbl_loaded_bool
+ }
{
% \end{macrocode}
% The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of
@@ -5164,7 +5230,6 @@ version 2005/12/01 or later.
% \end{macrocode}
% Idem for |\CT@drs@|.
% \begin{macrocode}
- \cs_set_protected:Npn \CT@drsc@ { }
\cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } }
\cs_set:Npn\CT@drs #1 #2
{
@@ -5184,6 +5249,11 @@ version 2005/12/01 or later.
}
}
% \end{macrocode}
+%
+% We need that line for the case where you use \verb+||+ with \pkg{colortbl} loaded.
+% \begin{macrocode}
+\cs_set_protected:Npn \CT@drsc@ { }
+% \end{macrocode}
%
% \bigskip
% We have to redefine |\cline| for several reasons. The command |\@@_cline| will
@@ -5717,6 +5787,13 @@ version 2005/12/01 or later.
\tl_new:N \l_@@_code_before_tl
\bool_new:N \l_@@_code_before_bool
% \end{macrocode}
+%
+% \bigskip
+% The following token list will contain ce code inserted in each cell of the
+% current row (this token list will be cleared at the beginning of each row).
+% \begin{macrocode}
+\tl_new:N \g_@@_row_style_tl
+% \end{macrocode}
%
% \bigskip
% The following dimensions will be used when drawing the dotted lines.
@@ -6962,7 +7039,7 @@ version 2005/12/01 or later.
r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
small .bool_set:N = \l_@@_small_bool ,
small .value_forbidden:n = true ,
- unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix }
+ unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrix }
}
% \end{macrocode}
%
@@ -6994,7 +7071,7 @@ version 2005/12/01 or later.
tabularnote .value_required:n = true ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
l .code:n = \@@_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray }
+ unknown .code:n = \@@_error:n { Unknown~key~for~NiceArray }
}
% \end{macrocode}
%
@@ -7012,7 +7089,7 @@ version 2005/12/01 or later.
small .value_forbidden:n = true ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
l .code:n = \@@_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix }
+ unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrix }
}
% \end{macrocode}
%
@@ -7034,7 +7111,7 @@ version 2005/12/01 or later.
\int_zero:N \l_@@_last_col_int ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
l .code:n = \@@_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \@@_error:n { Unknown~option~for~NiceTabular }
+ unknown .code:n = \@@_error:n { Unknown~key~for~NiceTabular }
}
% \end{macrocode}
%
@@ -7049,6 +7126,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_Cell:
{
+ \tl_gclear:N \g_@@_exit_cell_tl
% \end{macrocode}
% At the beginning of the cell, we link |\CodeAfter| to a command which do
% \emph{not} begin with |\omit| (whereas the standard version of |\CodeAfter|
@@ -7087,6 +7165,7 @@ version 2005/12/01 or later.
% The codes |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the
% corners of the matrix.
% \begin{macrocode}
+ \g_@@_row_style_tl
\int_compare:nNnTF \c@iRow = 0
{
\int_compare:nNnT \c@jCol > 0
@@ -7112,6 +7191,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_begin_of_row:
{
+ \tl_gclear:N \g_@@_row_style_tl
\int_gincr:N \c@iRow
\dim_gset_eq:NN \g_@@_dp_ante_last_row_dim \g_@@_dp_last_row_dim
\dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \@arstrutbox }
@@ -7205,6 +7285,7 @@ version 2005/12/01 or later.
{
\@@_math_toggle_token:
\hbox_set_end:
+ \g_@@_exit_cell_tl
\bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
\@@_adjust_size_box:
% \end{macrocode}
@@ -7480,8 +7561,8 @@ version 2005/12/01 or later.
\str_if_empty:NF \l_@@_name_str
{
\pgfnodealias
- { \l_@@_name_str - row - \int_use:N \c@iRow }
- { \@@_env: - row - \int_use:N \c@iRow }
+ { \l_@@_name_str - row - \@@_succ:n \c@iRow }
+ { \@@_env: - row - \@@_succ:n \c@iRow }
}
\endpgfpicture
}
@@ -7715,6 +7796,7 @@ version 2005/12/01 or later.
\cs_set_eq:NN \CodeAfter \@@_CodeAfter:
\cs_set_eq:NN \diagbox \@@_diagbox:nn
\cs_set_eq:NN \NotEmpty \@@_NotEmpty:
+ \cs_set_eq:NN \RowStyle \@@_RowStyle:n
\bool_if:NT \l_@@_colortbl_like_bool \@@_colortbl_like:
\bool_if:NT \l_@@_renew_dots_bool \@@_renew_dots:
% \end{macrocode}
@@ -7954,8 +8036,49 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \bigskip
+% \begin{macrocode}
+\keys_define:nn { NiceMatrix / RowStyle }
+ {
+ cell-space-top-limit .code:n =
+ {
+ \tl_gput_right:Nn \g_@@_row_style_tl
+ {
+ \tl_gput_right:Nn \g_@@_exit_cell_tl
+ { \dim_set:Nn \l_@@_cell_space_top_limit_dim { #1 } }
+ }
+ } ,
+ cell-space-top-limit .value_required:n = true ,
+ cell-space-bottom-limit .code:n =
+ {
+ \tl_gput_right:Nn \g_@@_row_style_tl
+ {
+ \tl_gput_right:Nn \g_@@_exit_cell_tl
+ { \dim_set:Nn \l_@@_cell_space_bottom_limit_dim { #1 } }
+ }
+ } ,
+ cell-space-bottom-limit .value_required:n = true ,
+ cell-space-limits .meta:n =
+ {
+ cell-space-top-limit = #1 ,
+ cell-space-bottom-limit = #1 ,
+ } ,
+ unknown .code:n = \@@_error:n { Unknown~key~for~RowStyle }
+ }
+% \end{macrocode}
%
% \bigskip
+% \begin{macrocode}
+\NewDocumentCommand \@@_RowStyle:n { O { } m }
+ {
+ \tl_gset:Nn \g_@@_row_style_tl { #2 }
+ \keys_set:nn { NiceMatrix / RowStyle } { #1 }
+ #2
+ \ignorespaces
+ }
+% \end{macrocode}
+%
+% \bigskip
% \subsection*{The \textbackslash CodeBefore}
%
% The following command will be executed if the |\CodeBefore| has to be actually executed.
@@ -8247,6 +8370,7 @@ version 2005/12/01 or later.
\seq_gclear:N \g_@@_pos_of_stroken_blocks_seq
\seq_gclear:N \g_@@_pos_of_xdots_seq
\tl_gclear_new:N \g_@@_code_before_tl
+ \tl_gclear:N \g_@@_row_style_tl
% \end{macrocode}
%
% \bigskip
@@ -8374,7 +8498,6 @@ version 2005/12/01 or later.
% 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
{
@@ -9415,7 +9538,18 @@ version 2005/12/01 or later.
% whether there is tabular notes or not before the composition of the blocks).
% \begin{macrocode}
\cs_new_protected:Npn \@@_use_arraybox_with_notes_c:
- {
+ {
+% \end{macrocode}
+% With an environment |{Matrix}|, you want to remove the exterior |\arraycolsep|
+% but we don't know the number of columns (since there is no preamble) and
+% that's why we can't put |@{}| at the end of the preamble. That's why we remove
+% a |\arraycolsep| now.
+% \begin{macrocode}
+ \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ {
+ \box_set_wd:Nn \l_@@_the_array_box
+ { \box_wd:N \l_@@_the_array_box - \arraycolsep }
+ }
% \end{macrocode}
% We need a |{minipage}| because we will insert a LaTeX list for the tabular
% notes (that means that a |\vtop{\hsize=...}| is not enough).
@@ -9888,8 +10022,8 @@ version 2005/12/01 or later.
% \begin{macrocode}
\int_gset:Nn \g_tmpa_int 1
\bool_if:NTF \g_@@_last_col_found_bool
+ { \prg_replicate:nn { \g_@@_col_total_int - 3 } }
{ \prg_replicate:nn { \g_@@_col_total_int - 2 } }
- { \prg_replicate:nn { \g_@@_col_total_int - 1 } }
{
&
\omit
@@ -9926,17 +10060,58 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% We want to remove the exterior |\arraycolsep| of a environment |{NiceArray}|.
% \begin{macrocode}
- \bool_lazy_all:nT
- {
- \l_@@_NiceArray_bool
- { \bool_not_p:n \l_@@_NiceTabular_bool }
- { \clist_if_empty_p:N \l_@@_vlines_clist }
- { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
- { ! \l_@@_bar_at_end_of_pream_bool }
- }
- { \skip_horizontal:n { - \col@sep } }
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_skip
+ \bool_lazy_all:nT
+ {
+ \l_@@_NiceArray_bool
+ { \bool_not_p:n \l_@@_NiceTabular_bool }
+ { \clist_if_empty_p:N \l_@@_vlines_clist }
+ { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
+ { ! \l_@@_bar_at_end_of_pream_bool }
+ }
+ { \skip_horizontal:N -\col@sep }
+ \bool_if:NT \l_@@_code_before_bool
+ {
+ \hbox
+ {
+ \skip_horizontal:N -0.5\arrayrulewidth
+% \end{macrocode}
+% With an environment |{Matrix}|, you want to remove the exterior |\arraycolsep|
+% but we don't know the number of columns (since there is no preamble) and
+% that's why we can't put |@{}| at the end of the preamble. That's why we remove
+% a |\arraycolsep| now.
+% \begin{macrocode}
+ \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ { \skip_horizontal:N -\arraycolsep }
+ \pgfsys@markposition { \@@_env: - col - \@@_succ:n \g_tmpa_int }
+ \skip_horizontal:N 0.5\arrayrulewidth
+ \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ { \skip_horizontal:N \arraycolsep }
+ }
+ }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int }
+ {
+ \bool_lazy_and:nnTF \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ {
+ \pgfpoint
+ { - 0.5 \arrayrulewidth - \arraycolsep }
+ \c_zero_dim
+ }
+ { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim }
+ }
+ \str_if_empty:NF \l_@@_name_str
+ {
+ \pgfnodealias
+ { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int }
+ { \@@_env: - col - \@@_succ:n \g_tmpa_int }
+ }
+ \endpgfpicture
% \end{macrocode}
%
% \bigskip
@@ -10708,6 +10883,8 @@ version 2005/12/01 or later.
\dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 }
\dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 }
\pgfnode { @@_diag_node } { center } { } { \@@_env: - ##1 } { }
+ \str_if_empty:NF \l_@@_name_str
+ { \pgfnodealias { \l_@@_name_str - ##1 } { \@@_env: - ##1 } }
}
% \end{macrocode}
% Now, the last node. Of course, that is only a |coordinate| because there is
@@ -10722,6 +10899,15 @@ version 2005/12/01 or later.
\pgfnodealias
{ \@@_env: - last }
{ \@@_env: - \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } }
+ \str_if_empty:NF \l_@@_name_str
+ {
+ \pgfnodealias
+ { \l_@@_name_str - \int_use:N \l_tmpa_int }
+ { \@@_env: - \int_use:N \l_tmpa_int }
+ \pgfnodealias
+ { \l_@@_name_str - last }
+ { \@@_env: - last }
+ }
\endpgfpicture
}
% \end{macrocode}
@@ -13537,7 +13723,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% \subsubsection*{The key corners}
+% \subsection*{The key corners}
%
% When the key |corners| is raised, the rules are not drawn in the
% corners. Of course, we have to compute the corners before we begin to draw the
@@ -14563,6 +14749,13 @@ version 2005/12/01 or later.
\tl_if_empty:NTF \l_@@_color_tl
{ \int_compare:nNnT { #2 } = 1 \set@color }
{ \color { \l_@@_color_tl } }
+% \end{macrocode}
+% If the block is mono-row, we use |\g_@@_row_style_tl| even it has yet been used
+% in the beginning of the cell where the command |\Block| has been issued
+% because we want to be able to take into account a potential instruction of
+% color of the font in |\g_@@_row_style_tl|.
+% \begin{macrocode}
+ \int_compare:nNnT { #1 } = 1 \g_@@_row_style_tl
\group_begin:
\cs_set:Npn \arraystretch { 1 }
\dim_set_eq:NN \extrarowheight \c_zero_dim
@@ -14852,34 +15045,35 @@ version 2005/12/01 or later.
\keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
% \end{macrocode}
%
+%
% \begin{macrocode}
- \tl_if_empty:NF \l_@@_draw_tl
+ \bool_if:NT \l_@@_hvlines_block_bool
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
- \@@_stroke_block:nnn
+ \@@_hvlines_block:nnn
{ \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
}
- \seq_gput_right:Nn \g_@@_pos_of_stroken_blocks_seq
- { { #1 } { #2 } { #3 } { #4 } }
}
% \end{macrocode}
-%
+%
% \begin{macrocode}
- \bool_if:NT \l_@@_hvlines_block_bool
+ \tl_if_empty:NF \l_@@_draw_tl
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
- \@@_hvlines_block:nnn
+ \@@_stroke_block:nnn
{ \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
}
+ \seq_gput_right:Nn \g_@@_pos_of_stroken_blocks_seq
+ { { #1 } { #2 } { #3 } { #4 } }
}
% \end{macrocode}
-%
+%
% \begin{macrocode}
\clist_if_empty:NF \l_@@_borders_clist
{
@@ -15296,7 +15490,7 @@ version 2005/12/01 or later.
% \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
+% rules that we will 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}
@@ -15501,7 +15695,7 @@ version 2005/12/01 or later.
{
\exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
{ * { \int_use:N \l_@@_nb_cols_int } { \l_@@_type_of_col_tl } }
- [ \l_tmpa_tl ]
+ [ \exp_not:V \l_tmpa_tl ]
}
\int_compare:nNnT \l_@@_first_row_int = 0
{
@@ -15952,17 +16146,27 @@ version 2005/12/01 or later.
% \item |#2| is the upper-left cell of the matrix with the format $i$-$j$;
% \item |#3| is the lower-right cell of the matrix with the format $i$-$j$;
% \item |#4| is the right delimiter;
-% \item |#5| is the list of options of the command.
+% \item |#5| is the list of options of the command;
+% \item |#6| is the potential subscript;
+% \item |#7| is the potential superscript.
% \end{itemize}
+% For explanations about the construction with rescanning of the preamble, see
+% the documentation for the user command |\Cdots|.
% \begin{macrocode}
-\NewDocumentCommand \@@_SubMatrix { m m m m O { } }
+\AtBeginDocument
{
- \peek_remove_spaces:n
- { \@@_sub_matrix:nnnnn { #1 } { #2 } { #3 } { #4 } { #5 } }
- }
+ \tl_set:Nn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
+ \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
+ \exp_args:NNV \NewDocumentCommand \@@_SubMatrix \l_@@_argspec_tl
+ {
+ \peek_remove_spaces:n
+ { \@@_sub_matrix:nnnnnnn
+ { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } }
+ }
+ }
% \end{macrocode}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_sub_matrix:nnnnn #1 #2 #3 #4 #5
+\cs_new_protected:Npn \@@_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\group_begin:
% \end{macrocode}
@@ -16023,7 +16227,7 @@ version 2005/12/01 or later.
{
\dim_compare:nNnTF \l_@@_x_final_dim = { - \c_max_dim }
{ \@@_error:nn { impossible~delimiter } { right } }
- { \@@_sub_matrix_i:nn { #1 } { #4 } }
+ { \@@_sub_matrix_i:nnnn { #1 } { #4 } { #6 } { #7 } }
}
\endpgfpicture
}
@@ -16032,9 +16236,10 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% |#1| is the left delimiter dans |#2| is the right one.
+% |#1| is the left delimiter, |#2| is the right one, |#3| is the subscript and
+% |#4| is the superscript.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_sub_matrix_i:nn #1 #2
+\cs_new_protected:Npn \@@_sub_matrix_i:nnnn #1 #2 #3 #4
{
\@@_qpoint:n { row - \l_@@_first_i_tl - base }
\dim_set:Nn \l_@@_y_initial_dim
@@ -16217,9 +16422,10 @@ version 2005/12/01 or later.
{ ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 }
}
\str_if_empty:NTF \l_@@_submatrix_name_str
- { \@@_node_right:nn #2 { } }
+ { \@@_node_right:nnnn #2 { } { #3 } { #4 } }
{
- \@@_node_right:nn #2 { \@@_env: - \l_@@_submatrix_name_str - right }
+ \@@_node_right:nnnn #2
+ { \@@_env: - \l_@@_submatrix_name_str - right } { #3 } { #4 }
}
% \end{macrocode}
%
@@ -16368,8 +16574,9 @@ version 2005/12/01 or later.
% The command |\@@_node_right:nn| puts the right delimiter with the correct size.
% The argument |#1| is the delimiter to put. The argument |#2| is the name we
% will give to this PGF node (if the key |name| has been used in |\SubMatrix|).
+% The argument |#3| is the subscript and |#4| is the superscript.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_node_right:nn #1 #2
+\cs_new_protected:Npn \@@_node_right:nnnn #1 #2 #3 #4
{
\pgfnode
{ rectangle }
@@ -16387,7 +16594,9 @@ version 2005/12/01 or later.
\@depth \c_zero_dim
\@width \c_zero_dim
}
- \right #1
+ \right #1
+ \tl_if_empty:nF { #3 } { _ { \smash { #3 } } }
+ ^ { \smash { #4 } }
\c_math_toggle_token
}
{ #2 }
@@ -16428,7 +16637,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\@@_msg_new:nnn { Unknown~option~for~package }
+\@@_msg_new:nnn { Unknown~key~for~package }
{
The~key~'\l_keys_key_str'~is~unknown. \\
If~you~go~on,~it~will~be~ignored. \\
@@ -16483,7 +16692,7 @@ version 2005/12/01 or later.
transparent .value_forbidden:n = true,
footnote .bool_set:N = \c_@@_footnote_bool ,
footnotehyper .bool_set:N = \c_@@_footnotehyper_bool ,
- unknown .code:n = \@@_error:n { Unknown~option~for~package }
+ unknown .code:n = \@@_error:n { Unknown~key~for~package }
}
\ProcessKeysOptions { NiceMatrix / Package }
% \end{macrocode}
@@ -16727,13 +16936,22 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_msg_new:nn { Unknown~key~for~xdots }
{
- As~for~now,~there~is~only~three~key~available~here:~'color',~'line-style'~
+ As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~
and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~
this~key~will~be~ignored.
}
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { Unknown~key~for~RowStyle }
+ {
+ As~for~now,~there~is~only~three~keys~available~here:~'cell-space-top-limit',~
+ 'cell-space-bottom-limit~and~'cell-space-limits'~(and~you~try~to~use~
+ '\l_keys_key_str').~If~you~go~on,~this~key~will~be~ignored.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { Unknown~key~for~rowcolors }
{
As~for~now,~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~
@@ -17153,7 +17371,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\@@_msg_new:nnn { Unknown~option~for~NiceArray }
+\@@_msg_new:nnn { Unknown~key~for~NiceArray }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceArray\}. \\
@@ -17212,7 +17430,7 @@ version 2005/12/01 or later.
% |NiceMatrix/pNiceArray| (but not by |NiceMatrix/NiceArray| because, for this
% set of keys, there is also the keys |t|, |c| and~|b|).
% \begin{macrocode}
-\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
+\@@_msg_new:nnn { Unknown~key~for~NiceMatrix }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~
\@@_full_name_env:. \\
@@ -17266,7 +17484,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\@@_msg_new:nnn { Unknown~option~for~NiceTabular }
+\@@_msg_new:nnn { Unknown~key~for~NiceTabular }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceTabular\}. \\
@@ -17842,6 +18060,9 @@ version 2005/12/01 or later.
% It's now possible to use a key |l|, |r| or |c| with the command
% |\pAutoNiceMatrix| (and the similar ones).
%
+% \subsection*{Changes between versions 5.17 and 5.18}
+%
+% New command |\RowStyle|
%
% \PrintIndex
%
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index 81f4976f7a4..bbd810f13e4 100644
--- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
+++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
@@ -18,8 +18,8 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{5.17a}
-\def\myfiledate{2021/07/04}
+\def\myfileversion{5.18}
+\def\myfiledate{2021/07/15}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -123,7 +123,9 @@
\AtBeginDocument
{
\@ifpackageloaded { colortbl }
- { \bool_set_true:N \c__nicematrix_colortbl_loaded_bool }
+ {
+ \bool_set_true:N \c__nicematrix_colortbl_loaded_bool
+ }
{
\cs_set_protected:Npn \CT@arc@ { }
\cs_set:Npn \arrayrulecolor #1 # { \CT@arc { #1 } }
@@ -132,7 +134,6 @@
\dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
{ \cs_gset:Npn \CT@arc@ { \color #1 { #2 } } }
}
- \cs_set_protected:Npn \CT@drsc@ { }
\cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } }
\cs_set:Npn\CT@drs #1 #2
{
@@ -151,6 +152,7 @@
}
}
}
+\cs_set_protected:Npn \CT@drsc@ { }
\cs_set:Npn \__nicematrix_standard_cline #1 { \__nicematrix_standard_cline:w #1 \q_stop }
\cs_set:Npn \__nicematrix_standard_cline:w #1-#2 \q_stop
{
@@ -329,6 +331,7 @@
\bool_new:N \g__nicematrix_not_empty_cell_bool
\tl_new:N \l__nicematrix_code_before_tl
\bool_new:N \l__nicematrix_code_before_bool
+\tl_new:N \g__nicematrix_row_style_tl
\dim_new:N \l__nicematrix_x_initial_dim
\dim_new:N \l__nicematrix_y_initial_dim
\dim_new:N \l__nicematrix_x_final_dim
@@ -848,7 +851,7 @@
r .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl r ,
small .bool_set:N = \l__nicematrix_small_bool ,
small .value_forbidden:n = true ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix }
}
\keys_define:nn { NiceMatrix / NiceArray }
{
@@ -865,7 +868,7 @@
tabularnote .value_required:n = true ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceArray }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceArray }
}
\keys_define:nn { NiceMatrix / pNiceArray }
{
@@ -878,7 +881,7 @@
small .value_forbidden:n = true ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix }
}
\keys_define:nn { NiceMatrix / NiceTabular }
{
@@ -893,10 +896,11 @@
\int_zero:N \l__nicematrix_last_col_int ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceTabular }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceTabular }
}
\cs_new_protected:Npn \__nicematrix_Cell:
{
+ \tl_gclear:N \g__nicematrix_exit_cell_tl
\cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:n
\int_gincr:N \c@jCol
\int_compare:nNnT \c@jCol = 1
@@ -907,6 +911,7 @@
\c_math_toggle_token
\bool_if:NT \l__nicematrix_small_bool \scriptstyle
}
+ \g__nicematrix_row_style_tl
\int_compare:nNnTF \c@iRow = 0
{
\int_compare:nNnT \c@jCol > 0
@@ -925,6 +930,7 @@
}
\cs_new_protected:Npn \__nicematrix_begin_of_row:
{
+ \tl_gclear:N \g__nicematrix_row_style_tl
\int_gincr:N \c@iRow
\dim_gset_eq:NN \g__nicematrix_dp_ante_last_row_dim \g__nicematrix_dp_last_row_dim
\dim_gset:Nn \g__nicematrix_dp_last_row_dim { \box_dp:N \@arstrutbox }
@@ -998,6 +1004,7 @@
{
\__nicematrix_math_toggle_token:
\hbox_set_end:
+ \g__nicematrix_exit_cell_tl
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
\__nicematrix_adjust_size_box:
\box_set_ht:Nn \l__nicematrix_cell_box
@@ -1129,8 +1136,8 @@
\str_if_empty:NF \l__nicematrix_name_str
{
\pgfnodealias
- { \l__nicematrix_name_str - row - \int_use:N \c@iRow }
- { \__nicematrix_env: - row - \int_use:N \c@iRow }
+ { \l__nicematrix_name_str - row - \__nicematrix_succ:n \c@iRow }
+ { \__nicematrix_env: - row - \__nicematrix_succ:n \c@iRow }
}
\endpgfpicture
}
@@ -1256,6 +1263,7 @@
\cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter:
\cs_set_eq:NN \diagbox \__nicematrix_diagbox:nn
\cs_set_eq:NN \NotEmpty \__nicematrix_NotEmpty:
+ \cs_set_eq:NN \RowStyle \__nicematrix_RowStyle:n
\bool_if:NT \l__nicematrix_colortbl_like_bool \__nicematrix_colortbl_like:
\bool_if:NT \l__nicematrix_renew_dots_bool \__nicematrix_renew_dots:
\seq_gclear:N \g__nicematrix_multicolumn_cells_seq
@@ -1337,6 +1345,40 @@
\bool_set_true:N \l__nicematrix_code_before_bool
\__nicematrix_pre_array:
}
+\keys_define:nn { NiceMatrix / RowStyle }
+ {
+ cell-space-top-limit .code:n =
+ {
+ \tl_gput_right:Nn \g__nicematrix_row_style_tl
+ {
+ \tl_gput_right:Nn \g__nicematrix_exit_cell_tl
+ { \dim_set:Nn \l__nicematrix_cell_space_top_limit_dim { #1 } }
+ }
+ } ,
+ cell-space-top-limit .value_required:n = true ,
+ cell-space-bottom-limit .code:n =
+ {
+ \tl_gput_right:Nn \g__nicematrix_row_style_tl
+ {
+ \tl_gput_right:Nn \g__nicematrix_exit_cell_tl
+ { \dim_set:Nn \l__nicematrix_cell_space_bottom_limit_dim { #1 } }
+ }
+ } ,
+ cell-space-bottom-limit .value_required:n = true ,
+ cell-space-limits .meta:n =
+ {
+ cell-space-top-limit = #1 ,
+ cell-space-bottom-limit = #1 ,
+ } ,
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~RowStyle }
+ }
+\NewDocumentCommand \__nicematrix_RowStyle:n { O { } m }
+ {
+ \tl_gset:Nn \g__nicematrix_row_style_tl { #2 }
+ \keys_set:nn { NiceMatrix / RowStyle } { #1 }
+ #2
+ \ignorespaces
+ }
\cs_new_protected:Npn \__nicematrix_pre_code_before:
{
\int_set:Nn \c@iRow { \seq_item:Nn \c__nicematrix_size_seq 2 }
@@ -1479,6 +1521,7 @@
\seq_gclear:N \g__nicematrix_pos_of_stroken_blocks_seq
\seq_gclear:N \g__nicematrix_pos_of_xdots_seq
\tl_gclear_new:N \g__nicematrix_code_before_tl
+ \tl_gclear:N \g__nicematrix_row_style_tl
\bool_gset_false:N \g__nicematrix_aux_found_bool
\tl_if_exist:cT { c__nicematrix _ \int_use:N \g__nicematrix_env_int _ tl }
{
@@ -2152,6 +2195,11 @@
}
\cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes_c:
{
+ \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ {
+ \box_set_wd:Nn \l__nicematrix_the_array_box
+ { \box_wd:N \l__nicematrix_the_array_box - \arraycolsep }
+ }
\begin { minipage } [ t ] { \box_wd:N \l__nicematrix_the_array_box }
\box_use_drop:N \l__nicematrix_the_array_box
\__nicematrix_create_extra_nodes:
@@ -2436,8 +2484,8 @@
}
\int_gset:Nn \g_tmpa_int 1
\bool_if:NTF \g__nicematrix_last_col_found_bool
+ { \prg_replicate:nn { \g__nicematrix_col_total_int - 3 } }
{ \prg_replicate:nn { \g__nicematrix_col_total_int - 2 } }
- { \prg_replicate:nn { \g__nicematrix_col_total_int - 1 } }
{
&
\omit
@@ -2464,15 +2512,51 @@
}
\endpgfpicture
}
- \bool_lazy_all:nT
- {
- \l__nicematrix_NiceArray_bool
- { \bool_not_p:n \l__nicematrix_NiceTabular_bool }
- { \clist_if_empty_p:N \l__nicematrix_vlines_clist }
- { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
- { ! \l__nicematrix_bar_at_end_of_pream_bool }
- }
- { \skip_horizontal:n { - \col@sep } }
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_skip
+ \bool_lazy_all:nT
+ {
+ \l__nicematrix_NiceArray_bool
+ { \bool_not_p:n \l__nicematrix_NiceTabular_bool }
+ { \clist_if_empty_p:N \l__nicematrix_vlines_clist }
+ { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool }
+ { ! \l__nicematrix_bar_at_end_of_pream_bool }
+ }
+ { \skip_horizontal:N -\col@sep }
+ \bool_if:NT \l__nicematrix_code_before_bool
+ {
+ \hbox
+ {
+ \skip_horizontal:N -0.5\arrayrulewidth
+ \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ { \skip_horizontal:N -\arraycolsep }
+ \pgfsys@markposition { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ \skip_horizontal:N 0.5\arrayrulewidth
+ \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ { \skip_horizontal:N \arraycolsep }
+ }
+ }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ {
+ \bool_lazy_and:nnTF \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ {
+ \pgfpoint
+ { - 0.5 \arrayrulewidth - \arraycolsep }
+ \c_zero_dim
+ }
+ { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim }
+ }
+ \str_if_empty:NF \l__nicematrix_name_str
+ {
+ \pgfnodealias
+ { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g_tmpa_int }
+ { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ }
+ \endpgfpicture
\bool_if:NT \g__nicematrix_last_col_found_bool
{
\hbox_overlap_right:n
@@ -2896,6 +2980,8 @@
\dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 }
\dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 }
\pgfnode { __nicematrix_diag_node } { center } { } { \__nicematrix_env: - ##1 } { }
+ \str_if_empty:NF \l__nicematrix_name_str
+ { \pgfnodealias { \l__nicematrix_name_str - ##1 } { \__nicematrix_env: - ##1 } }
}
\int_set:Nn \l_tmpa_int { \int_max:nn \c@iRow \c@jCol + 1 }
\__nicematrix_qpoint:n { row - \int_min:nn { \l_tmpa_int } { \c@iRow + 1 } }
@@ -2906,6 +2992,15 @@
\pgfnodealias
{ \__nicematrix_env: - last }
{ \__nicematrix_env: - \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } }
+ \str_if_empty:NF \l__nicematrix_name_str
+ {
+ \pgfnodealias
+ { \l__nicematrix_name_str - \int_use:N \l_tmpa_int }
+ { \__nicematrix_env: - \int_use:N \l_tmpa_int }
+ \pgfnodealias
+ { \l__nicematrix_name_str - last }
+ { \__nicematrix_env: - last }
+ }
\endpgfpicture
}
\cs_new_protected:Npn \__nicematrix_find_extremities_of_line:nnnn #1 #2 #3 #4
@@ -5173,6 +5268,7 @@
\tl_if_empty:NTF \l__nicematrix_color_tl
{ \int_compare:nNnT { #2 } = 1 \set@color }
{ \color { \l__nicematrix_color_tl } }
+ \int_compare:nNnT { #1 } = 1 \g__nicematrix_row_style_tl
\group_begin:
\cs_set:Npn \arraystretch { 1 }
\dim_set_eq:NN \extrarowheight \c_zero_dim
@@ -5376,27 +5472,27 @@
\seq_gput_left:Nn \g__nicematrix_pos_of_blocks_seq { { #1 } { #2 } { #3 } { #4 } }
\group_begin:
\keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
- \tl_if_empty:NF \l__nicematrix_draw_tl
+ \bool_if:NT \l__nicematrix_hvlines_block_bool
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
- \__nicematrix_stroke_block:nnn
+ \__nicematrix_hvlines_block:nnn
{ \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
- \seq_gput_right:Nn \g__nicematrix_pos_of_stroken_blocks_seq
- { { #1 } { #2 } { #3 } { #4 } }
}
- \bool_if:NT \l__nicematrix_hvlines_block_bool
+ \tl_if_empty:NF \l__nicematrix_draw_tl
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
- \__nicematrix_hvlines_block:nnn
+ \__nicematrix_stroke_block:nnn
{ \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
+ \seq_gput_right:Nn \g__nicematrix_pos_of_stroken_blocks_seq
+ { { #1 } { #2 } { #3 } { #4 } }
}
\clist_if_empty:NF \l__nicematrix_borders_clist
{
@@ -5795,7 +5891,7 @@
{
\exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
{ * { \int_use:N \l__nicematrix_nb_cols_int } { \l__nicematrix_type_of_col_tl } }
- [ \l_tmpa_tl ]
+ [ \exp_not:V \l_tmpa_tl ]
}
\int_compare:nNnT \l__nicematrix_first_row_int = 0
{
@@ -6062,12 +6158,18 @@
{ \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] }
}
}
-\NewDocumentCommand \__nicematrix_SubMatrix { m m m m O { } }
+\AtBeginDocument
{
- \peek_remove_spaces:n
- { \__nicematrix_sub_matrix:nnnnn { #1 } { #2 } { #3 } { #4 } { #5 } }
- }
-\cs_new_protected:Npn \__nicematrix_sub_matrix:nnnnn #1 #2 #3 #4 #5
+ \tl_set:Nn \l__nicematrix_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
+ \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
+ \exp_args:NNV \NewDocumentCommand \__nicematrix_SubMatrix \l__nicematrix_argspec_tl
+ {
+ \peek_remove_spaces:n
+ { \__nicematrix_sub_matrix:nnnnnnn
+ { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } }
+ }
+ }
+\cs_new_protected:Npn \__nicematrix_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\group_begin:
\tl_clear_new:N \l__nicematrix_first_i_tl
@@ -6117,13 +6219,13 @@
{
\dim_compare:nNnTF \l__nicematrix_x_final_dim = { - \c_max_dim }
{ \__nicematrix_error:nn { impossible~delimiter } { right } }
- { \__nicematrix_sub_matrix_i:nn { #1 } { #4 } }
+ { \__nicematrix_sub_matrix_i:nnnn { #1 } { #4 } { #6 } { #7 } }
}
\endpgfpicture
}
\group_end:
}
-\cs_new_protected:Npn \__nicematrix_sub_matrix_i:nn #1 #2
+\cs_new_protected:Npn \__nicematrix_sub_matrix_i:nnnn #1 #2 #3 #4
{
\__nicematrix_qpoint:n { row - \l__nicematrix_first_i_tl - base }
\dim_set:Nn \l__nicematrix_y_initial_dim
@@ -6250,9 +6352,10 @@
{ ( \l__nicematrix_y_initial_dim + \l__nicematrix_y_final_dim ) / 2 }
}
\str_if_empty:NTF \l__nicematrix_submatrix_name_str
- { \__nicematrix_node_right:nn #2 { } }
+ { \__nicematrix_node_right:nnnn #2 { } { #3 } { #4 } }
{
- \__nicematrix_node_right:nn #2 { \__nicematrix_env: - \l__nicematrix_submatrix_name_str - right }
+ \__nicematrix_node_right:nnnn #2
+ { \__nicematrix_env: - \l__nicematrix_submatrix_name_str - right } { #3 } { #4 }
}
\cs_set_eq:NN \pgfpointanchor \__nicematrix_pgfpointanchor:n
\flag_clear_new:n { nicematrix }
@@ -6324,7 +6427,7 @@
{ #2 }
{ }
}
-\cs_new_protected:Npn \__nicematrix_node_right:nn #1 #2
+\cs_new_protected:Npn \__nicematrix_node_right:nnnn #1 #2 #3 #4
{
\pgfnode
{ rectangle }
@@ -6343,6 +6446,8 @@
\@width \c_zero_dim
}
\right #1
+ \tl_if_empty:nF { #3 } { _ { \smash { #3 } } }
+ ^ { \smash { #4 } }
\c_math_toggle_token
}
{ #2 }
@@ -6350,7 +6455,7 @@
}
\bool_new:N \c__nicematrix_footnotehyper_bool
\bool_new:N \c__nicematrix_footnote_bool
-\__nicematrix_msg_new:nnn { Unknown~option~for~package }
+\__nicematrix_msg_new:nnn { Unknown~key~for~package }
{
The~key~'\l_keys_key_str'~is~unknown. \\
If~you~go~on,~it~will~be~ignored. \\
@@ -6394,7 +6499,7 @@
transparent .value_forbidden:n = true,
footnote .bool_set:N = \c__nicematrix_footnote_bool ,
footnotehyper .bool_set:N = \c__nicematrix_footnotehyper_bool ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~package }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~package }
}
\ProcessKeysOptions { NiceMatrix / Package }
\__nicematrix_msg_new:nn { footnote~with~footnotehyper~package }
@@ -6540,10 +6645,16 @@
}
\__nicematrix_msg_new:nn { Unknown~key~for~xdots }
{
- As~for~now,~there~is~only~three~key~available~here:~'color',~'line-style'~
+ As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~
and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~
this~key~will~be~ignored.
}
+\__nicematrix_msg_new:nn { Unknown~key~for~RowStyle }
+ {
+ As~for~now,~there~is~only~three~keys~available~here:~'cell-space-top-limit',~
+ 'cell-space-bottom-limit~and~'cell-space-limits'~(and~you~try~to~use~
+ '\l_keys_key_str').~If~you~go~on,~this~key~will~be~ignored.
+ }
\__nicematrix_msg_new:nn { Unknown~key~for~rowcolors }
{
As~for~now,~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~
@@ -6848,7 +6959,7 @@
vlines,~
xdots~(several~subkeys).
}
-\__nicematrix_msg_new:nnn { Unknown~option~for~NiceArray }
+\__nicematrix_msg_new:nnn { Unknown~key~for~NiceArray }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceArray\}. \\
@@ -6900,7 +7011,7 @@
xdots/shorten~and~
xdots/line-style.
}
-\__nicematrix_msg_new:nnn { Unknown~option~for~NiceMatrix }
+\__nicematrix_msg_new:nnn { Unknown~key~for~NiceMatrix }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~
\__nicematrix_full_name_env:. \\
@@ -6951,7 +7062,7 @@
xdots/shorten~and~
xdots/line-style.
}
-\__nicematrix_msg_new:nnn { Unknown~option~for~NiceTabular }
+\__nicematrix_msg_new:nnn { Unknown~key~for~NiceTabular }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceTabular\}. \\