texlive[57288] Master/texmf-dist: nicematrix (1jan21)
commits+karl at tug.org
commits+karl at tug.org
Fri Jan 1 22:48:45 CET 2021
Revision: 57288
http://tug.org/svn/texlive?view=revision&revision=57288
Author: karl
Date: 2021-01-01 22:48:45 +0100 (Fri, 01 Jan 2021)
Log Message:
-----------
nicematrix (1jan21)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex 2021-01-01 21:48:29 UTC (rev 57287)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex 2021-01-01 21:48:45 UTC (rev 57288)
@@ -119,7 +119,8 @@
\bigskip
Cette extension peut être utilisée avec |xelatex|, |lualatex| et |pdflatex| mais aussi avec le cheminement
-classique |latex|-|dvips|-|ps2pdf| (ou Adobe Distiller).
+classique |latex|-|dvips|-|ps2pdf| (ou Adobe Distiller). \textsl{Néanmoins, le fichier nicematrix-french.tex de la présente documentation
+ne peut être compilé qu'avec XeLaTeX.}
\bigskip
Cette extension nécessite et charge les extensions \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{amsmath} et
@@ -547,8 +548,7 @@
\subsection{Les blocs mono-colonne}
-\colorbox{yellow!30}{Nouveau 5.4}\enskip Les blocs mono-colonne ont un
-comportement spécial.
+Les blocs mono-colonne ont un comportement spécial.
\begin{itemize}
\item La largeur naturelle du contenu de ces blocs est prise en compte pour la
largeur de la colonne courante.
@@ -1281,40 +1281,72 @@
est disponible quand \pkg{xcolor} est chargé avec l'option |table|.}. Le
\emph{s} rappelle qu'il y a deux couleurs. Elle colorie alternativement les
rangées avec les deux couleurs à partir de la rangée dont le numéro est donné en
-premier argument (obligatoire).
+premier argument (obligatoire), comme le fait la commande |\rowcolors| de
+\pkg{xcolor}.
+\colorbox{yellow!50}{\textbf{Nouveau 5.8}}\enskip
+En fait, le premier argument (obligatoire) peut, plus généralement, contenir
+une liste d'intervalles correspondant à l'ensemble des rangées sur lesquelles
+portera l'effet de |\rowcolors| (un intervalle de la forme $i$ désigne en fait
+l'intervalle constitué de toutes les rangées du tableau à partir de de la rangée~$i$).
+
+
+\bigskip
+La commande |\rowcolors| accepte une liste de paires clé-valeur comme argument
+optionnel en dernière position (l'argument optionel en première position
+correspond à l'espace colorimétrique). Les clés disponibles sont |cols|,
+|restart| et |respect-blocks|.
+\begin{itemize}
+\item \colorbox{yellow!50}{\textbf{Nouveau 5.8}}\enskip
+La clé |cols| décrit un ensemble de colonnes sur lesquelles portera
+l'effet de |\rowcolors|. Cet ensemble de colonnes est une liste d'intervalles de
+la forme $i$|-|$j$.
+
+\item \colorbox{yellow!50}{\textbf{Nouveau 5.8}}\enskip Avec la clé |restart|, chacun
+des intervalles de rangées spécifié par le premier argument de |\rowcolors|
+recommence avec la même couleur.\footnote{Autrement, la couleur d'une rangée ne
+ dépend que de la partié de son number.}
+
+
+\item Avec la clé |respect-blocks|, qui est de type booléen, les ``rangées''
+colorées alternativement peuvent s'étendre sur plusieurs rangées réelles du
+tableau pour englober les blocs (créés par la commande |\Block|).
+\end{itemize}
+
+
\medskip
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[baseline=c,boxwidth=9cm]
-\begin{NiceTabular}{lr}[hlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}@]
-Pierre & 12 \\
-Jacques & 8 \\
-Stéphanie & 18 \\
-Amélie & 20 \\
-Henri & 14 \\
-Estelle & 15
+\begin{NiceTabular}{clr}%
+ [hvlines,code-before = ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@]
+\Block{1-3}{Résultats} \\
+\Block{2-1}{A}& Pierre & 12 \\
+ & Jacques & 8 \\
+\Block{4-1}{B}& Stéphanie & 18 \\
+ & Amélie & 20 \\
+ & Henri & 14 \\
+ & Estelle & 15
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{lr}[hlines,code-before = \rowcolors{1}{blue!10}{},baseline=3]
-Pierre & 12 \\
-Jacques & 8 \\
-Stéphanie & 18 \\
-Amélie & 20 \\
-Henri & 14 \\
-Estelle & 15
+\begin{NiceTabular}{clr}[hvlines,
+ code-before = {\rowcolors{2}{blue!10}{}[cols=2-3,restart]},baseline=2]
+\Block{1-3}{Résultats} \\
+\Block{2-1}{A}& Pierre & 12 \\
+ & Jacques & 8 \\
+\Block{4-1}{B}& Stéphanie & 18 \\
+ & Amélie & 20 \\
+ & Henri & 14 \\
+ & Estelle & 15
\end{NiceTabular}
\end{scope}
-\bigskip
-Il existe une option |respect-blocks| pour la commande |\rowcolors|. Avec cette
-option, les ``rangées'' colorées alternativement peuvent s'étendre sur plusieurs
-rangées réelles du tableau pour englober les blocs.
-\medskip
+\vspace{1cm}
+
\begin{scope}
\hfuzz=10cm
-\begin{BVerbatim}[baseline=c,boxwidth=9cm]
+\begin{BVerbatim}[baseline=c,boxwidth=11cm]
\begin{NiceTabular}{lr}[hvlines,code-before =
~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@]
\Block{2-1}{Pierre} & 12 \\
@@ -2481,8 +2513,7 @@
\item Si la clé |notes/para| est utilisée, les notes sont composées à la fin du
tableau en un seul paragraphe.
-\item \colorbox{yellow!30}{Nouveau 5.4}\enskip
-Il existe une clé |tabularnote| qui permet d'insérer du texte dans la zone
+\item Il existe une clé |tabularnote| qui permet d'insérer du texte dans la zone
des notes avant les notes numérotées.
\item Si l'extension \pkg{booktabs} a été chargée (avant ou après
@@ -3989,10 +4020,10 @@
\NiceMatrixOptions
{nullify-dots,code-for-first-col = \color{blue},code-for-first-col=\color{blue}}
$\begin{pNiceMatrix}[first-row,first-col]
- & & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ columns}} \\
+ & & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ colonnes}} \\
& 1 & 1 & 1 & \Ldots & 1 \\
& 1 & 1 & 1 & & 1 \\
-\Vdots[line-style={solid,<->}]_{n \text{ rows}}
+\Vdots[line-style={solid,<->}]_{n \text{ rangées}}
& 1 & 1 & 1 & & 1 \\
& 1 & 1 & 1 & & 1 \\
& 1 & 1 & 1 & \Ldots & 1
@@ -4004,10 +4035,10 @@
\NiceMatrixOptions
{nullify-dots,code-for-first-col = \color{blue},code-for-first-row=\color{blue}}
\[\begin{pNiceMatrix}[first-row,first-col]
- & & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ columns}} \\
+ & & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ colonnes}} \\
& 1 & 1 & 1 & \Ldots & 1 \\
& 1 & 1 & 1 & & 1 \\
-\Vdots[line-style={solid,<->}]_{n \text{ rows}} & 1 & 1 & 1 & & 1 \\
+\Vdots[line-style={solid,<->}]_{n \text{ rangées}} & 1 & 1 & 1 & & 1 \\
& 1 & 1 & 1 & & 1 \\
& 1 & 1 & 1 & \Ldots & 1
\end{pNiceMatrix}\]
Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx 2021-01-01 21:48:29 UTC (rev 57287)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx 2021-01-01 21:48:45 UTC (rev 57288)
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2018-2020 by F. Pantigny
+% Copyright (C) 2018-2021 by F. Pantigny
% -----------------------------------
%
% This file may be distributed and/or modified under the
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{5.7}
-\def\myfiledate{2020/11/23}
+\def\myfileversion{5.8}
+\def\myfiledate{2021/01/01}
%
%
%<*batchfile>
@@ -26,7 +26,7 @@
\usedir{tex/latex/nicematrix}
\preamble
-Copyright (C) 2018-2020 by F. Pantigny
+Copyright (C) 2018-2021 by F. Pantigny
-----------------------------------
This file may be distributed and/or modified under the
@@ -162,6 +162,8 @@
% \bigskip
% This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by
% the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe Distiller).
+% \textsl{However, the file nicematrix.dtx of the present documentation should
+% be compiled with XeLaTeX.}
%
% \bigskip
% This package requires and \textbf{loads} the packages \pkg{l3keys2e},
@@ -585,8 +587,7 @@
%
% \subsection{The mono-column blocks}
%
-% % \colorbox{yellow!30}{New 5.4}\enskip The mono-column blocks have a
-% special behaviour.
+% The mono-column blocks have a special behaviour.
%
% \begin{itemize}
% \item The natural width of the contents of these blocks is taken into account
@@ -1288,15 +1289,41 @@
% command |\rowcolors| of \pkg{xcolor}\footnote{The command |\rowcolors| of
% \pkg{xcolor} is available when \pkg{xcolor} is loaded with the
% option~|table|.}. The \emph{s} emphasizes the fact that there is \emph{two}
-% colors. This command colors alternately the rows of the tabular, beginning
-% with the row whose number is given in first (mandatory) argument. The two
-% other (mandatory) arguments are the colors.
+% colors. This command colors alternately the rows of the tabular with the
+% tow colors (provided in second and third argument), beginning
+% with the row whose number is given in first (mandatory) argument.
+%
+% \colorbox{yellow!50}{\textbf{New 5.8}}\enskip In fact, the first (mandatory)
+% argument is, more generally, a comma separated list of intervals describing
+% the rows involved in the action of |\rowcolors| (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
+% optional argument in the first position corresponds to the colorimetric
+% space). The available keys are |cols|, |restart| and |respect-blocks|.
+% \begin{itemize}
+% \item \colorbox{yellow!50}{\textbf{New 5.8}}\enskip The key |cols| describes a
+% set of columns. The command |\rowcolors| will color only the cells of these
+% columns. The value is a comma-separated list of intervals of the form $i$-$j$.
+% \item \colorbox{yellow!50}{\textbf{New 5.8}}\enskip With the key |restart|,
+% each interval of rows (specified by the first mandatory argument) begins with
+% the same color.\footnote{Otherwise, the color of a given row relies only upon the
+% parity of its number.}
+% \item With the key |respect-blocks| the ``rows'' alternately colored may extend over
+% several rows if they have to incorporate blocks (created with the command |\Block|).
+% \end{itemize}
+%
% \medskip
% \begin{scope}
% \hfuzz=10cm
-% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% \begin{NiceTabular}{~LetterAt{}lr~LetterAt{}}[hlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}@]
+% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
+% \begin{NiceTabular}{clr}
+% [hvlines,code-before = ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@]
+% \Block{1-3}{Results} \\
% John & 12 \\
% Stephen & 8 \\
% Sarah & 18 \\
@@ -1305,25 +1332,22 @@
% Madison & 15
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{@{}lr@{}}[hlines,code-before = \rowcolors{1}{blue!10}{},baseline=3]
-% John & 12 \\
-% Stephen & 8 \\
-% Sarah & 18 \\
-% Ashley & 20 \\
-% Henry & 14 \\
-% Madison & 15
+% \begin{NiceTabular}{clr}[hvlines,code-before =
+% {\rowcolors{2}{blue!10}{}[cols=2-3,restart]},baseline=2]
+% \Block{1-3}{Results} \\
+% \Block{2-1}{A}& John & 12 \\
+% & Stephen & 8 \\
+% \Block{4-1}{B}& Sarah & 18 \\
+% & Ashley & 20 \\
+% & Henry & 14 \\
+% & Madison & 15
% \end{NiceTabular}
% \end{scope}
%
-% \bigskip
-% There is a key |respect-blocks| for the instruction |\rowcolors|. With that
-% key, the ``rows'' alternately colored may extend over several rows if they
-% have to incorporate blocks.
-%
-% \medskip
+% \vspace{1cm}
% \begin{scope}
% \hfuzz=10cm
-% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
+% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{NiceTabular}{lr}[hvlines,code-before =
% ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@]
% \Block{2-1}{John} & 12 \\
@@ -2431,9 +2455,8 @@
% \item If the key |notes/para| is used, the notes are composed at the end of
% the array in a single paragraph (as with the key |para| of \pkg{threeparttable}).
%
-% \item \colorbox{yellow!30}{New 5.4}\enskip There is a key
-% |tabularnote| which provides a way to insert some text in the zone of the
-% notes before the numbered tabular notes.
+% \item There is a key |tabularnote| which provides a way to insert some text in
+% the zone of the notes before the numbered tabular notes.
%
% \item If the package \pkg{booktabs} has been loaded (before or after
% \pkg{nicematrix}), the key |notes/bottomrule| draws a |\bottomrule| of
@@ -5110,7 +5133,9 @@
% \bigskip
% The following command will be able to reconstruct the full name of the current
% command or environment (despite its name which contains \textsl{env}). This
-% command must \emph{not} be protected since it will be used in error messages.
+% command must \emph{not} be protected since it will be used in error messages
+% and we have to use |\str_if_eq:VnTF| and not |\tl_if_eq:NnTF| because we need
+% to be fully expandable).
% \begin{macrocode}
\cs_new:Npn \@@_full_name_env:
{
@@ -5767,13 +5792,13 @@
% \end{macrocode}
%
% \bigskip
-% The string |\l_@@_baseline_str| may contain one of the three values |t|,
+% The string |\l_@@_baseline_tl| may contain one of the three values |t|,
% |c| or |b| as in the option of the environment |{array}|. However, it may also
% contain an integer (which represents the number of the row to which align the
% array).
% \begin{macrocode}
-\str_new:N \l_@@_baseline_str
-\tl_set:Nn \l_@@_baseline_str c
+\str_new:N \l_@@_baseline_tl
+\tl_set:Nn \l_@@_baseline_tl c
% \end{macrocode}
%
% \bigskip
@@ -6062,10 +6087,10 @@
% The options |c|, |t| and |b| of the environment |{NiceArray}| have the same
% meaning as the option of the classical environment |{array}|.
% \begin{macrocode}
- c .code:n = \tl_set:Nn \l_@@_baseline_str c ,
- t .code:n = \tl_set:Nn \l_@@_baseline_str t ,
- b .code:n = \tl_set:Nn \l_@@_baseline_str b ,
- baseline .tl_set:N = \l_@@_baseline_str ,
+ c .code:n = \tl_set:Nn \l_@@_baseline_tl c ,
+ t .code:n = \tl_set:Nn \l_@@_baseline_tl t ,
+ b .code:n = \tl_set:Nn \l_@@_baseline_tl b ,
+ baseline .tl_set:N = \l_@@_baseline_tl ,
baseline .value_required:n = true ,
columns-width .code:n =
\tl_if_eq:nnTF { #1 } { auto }
@@ -6456,7 +6481,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_begin_of_row:
{
- \refstepcounter { iRow }
+ \int_gincr:N \c at 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 }
\dim_gset:Nn \g_@@_ht_last_row_dim { \box_ht:N \@arstrutbox }
@@ -6734,11 +6759,12 @@
\@tabarray
}
% \end{macrocode}
-% |\l_@@_baseline_str| may have the value |t|, |c| or |b|. However, if the value
+% |\l_@@_baseline_tl| may have the value |t|, |c| or |b|. However, if the value
% is |b|, we compose the |\array| (of \pkg{array}) with the option |t| and the
-% right translation will be done further.
+% right translation will be done further. Remark that |\str_if_eq:VnTF| is
+% fully expandable and you need something fully expandable here.
% \begin{macrocode}
- [ \str_if_eq:VnTF \l_@@_baseline_str c c t ]
+ [ \str_if_eq:VnTF \l_@@_baseline_tl c c t ]
}
% \end{macrocode}
%
@@ -6862,11 +6888,11 @@
% When the key |colortbl-like| is used, the following code will be executed.
% \begin{macrocode}
\cs_new_protected:Npn \@@_colortbl_like:
- {
- \cs_set_eq:NN \cellcolor \@@_cellcolor_tabular
- \cs_set_eq:NN \rowcolor \@@_rowcolor_tabular
- \cs_set_eq:NN \columncolor \@@_columncolor_preamble
- }
+ {
+ \cs_set_eq:NN \cellcolor \@@_cellcolor_tabular
+ \cs_set_eq:NN \rowcolor \@@_rowcolor_tabular
+ \cs_set_eq:NN \columncolor \@@_columncolor_preamble
+ }
% \end{macrocode}
%
% \bigskip
@@ -6936,7 +6962,7 @@
%
% The box |\@arstrutbox| is a box constructed in the beginning of the
% environment |{array}|. The construction of that box takes into account the
-% current values of |\arraystretch|\footnote{The option |small| of
+% current value of |\arraystretch|\footnote{The option |small| of
% \pkg{nicematrix} changes (among other) the value of |\arraystretch|. This is
% done, of course, before the call of |{array}|.} and |\extrarowheight| (of
% \pkg{array}). That box is inserted (via |\@arstrut|) in the beginning of each
@@ -7445,11 +7471,6 @@
\int_compare:nNnT \l_@@_last_col_int > { -1 }
{ \@@_error:n { last~col~not~used } }
}
- \bool_if:NF \l_@@_Matrix_bool
- {
- \int_compare:nNnT \c at jCol < \g_@@_static_num_of_col_int
- { \@@_error:n { columns~not~used } }
- }
% \end{macrocode}
%
% We fix also the value of |\c at iRow| and |\g_@@_row_total_int| with the
@@ -7483,7 +7504,7 @@
% \begin{macrocode}
\bool_if:NTF \l_@@_NiceArray_bool
{
- \str_case:VnF \l_@@_baseline_str
+ \str_case:VnF \l_@@_baseline_tl
{
b \@@_use_arraybox_with_notes_b:
c \@@_use_arraybox_with_notes_c:
@@ -7577,6 +7598,15 @@
\skip_horizontal:N \g_@@_width_last_col_dim
\skip_horizontal:N \col at sep
}
+ \bool_if:NF \l_@@_Matrix_bool
+ {
+ \int_compare:nNnT \c at jCol < \g_@@_static_num_of_col_int
+ { \@@_error:n { columns~not~used } }
+ }
+ \group_begin:
+ \globaldefs = 1
+ \@@_msg_redirect_name:nn { columns~not~used } { error }
+ \group_end:
\@@_after_array:
% \end{macrocode}
% The aim of the following |\egroup| (the corresponding |\bgroup| is, of course,
@@ -7857,6 +7887,7 @@
\@@_Cell:
\begin { minipage } [ #1 ] { #3 }
\mode_leave_vertical:
+ \arraybackslash % added in the version 5.8
\box_use:N \@arstrutbox
}
c
@@ -7970,7 +8001,7 @@
{
\box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim }
\box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim }
- \str_if_eq:VnTF \l_@@_baseline_str { c }
+ \tl_if_eq:NnTF \l_@@_baseline_tl { c }
{ \box_use_drop:N \l_tmpa_box }
\@@_put_box_in_flow_i:
}
@@ -7978,7 +8009,7 @@
%
% \medskip
% The command |\@@_put_box_in_flow_i:| is used when the value of
-% |\l_@@_baseline_str| is different of |c| (which is the initial value and the
+% |\l_@@_baseline_tl| is different of |c| (which is the initial value and the
% most used).
% \begin{macrocode}
\cs_new_protected:Npn \@@_put_box_in_flow_i:
@@ -7993,24 +8024,24 @@
% Now, |\g_tmpa_dim| contains the $y$-value of the center of the array (the
% delimiters are centered in relation with this value).
% \begin{macrocode}
- \str_if_in:NnTF \l_@@_baseline_str { line- }
+ \str_if_in:NnTF \l_@@_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
\str_range:Nnn
- \l_@@_baseline_str
+ \l_@@_baseline_tl
6
- { \str_count:N \l_@@_baseline_str }
+ { \tl_count:V \l_@@_baseline_tl }
}
\@@_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \str_case:VnF \l_@@_baseline_str
+ \str_case:VnF \l_@@_baseline_tl
{
{ t } { \int_set:Nn \l_tmpa_int 1 }
{ b } { \int_set_eq:NN \l_tmpa_int \c at iRow }
}
- { \int_set:Nn \l_tmpa_int \l_@@_baseline_str }
+ { \int_set:Nn \l_tmpa_int \l_@@_baseline_tl }
\bool_lazy_or:nnT
{ \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int }
{ \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int }
@@ -8155,28 +8186,28 @@
% \end{macrocode}
% We convert a value of |t| to a value of |1|.
% \begin{macrocode}
- \str_if_eq:VnT \l_@@_baseline_str { t }
- { \tl_set:Nn \l_@@_baseline_str { 1 } }
+ \tl_if_eq:NnT \l_@@_baseline_tl { t }
+ { \tl_set:Nn \l_@@_baseline_tl { 1 } }
% \end{macrocode}
-% Now, we convert the value of |\l_@@_baseline_str| (which should represent an
+% Now, we convert the value of |\l_@@_baseline_tl| (which should represent an
% integer) to an integer stored in |\l_tmpa_int|.
% \begin{macrocode}
\pgfpicture
\@@_qpoint:n { row - 1 }
\dim_gset_eq:NN \g_tmpa_dim \pgf at y
- \str_if_in:NnTF \l_@@_baseline_str { line- }
+ \str_if_in:NnTF \l_@@_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
\str_range:Nnn
- \l_@@_baseline_str
+ \l_@@_baseline_tl
6
- { \str_count:N \l_@@_baseline_str }
+ { \tl_count:V \l_@@_baseline_tl }
}
\@@_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \int_set:Nn \l_tmpa_int \l_@@_baseline_str
+ \int_set:Nn \l_tmpa_int \l_@@_baseline_tl
\bool_lazy_or:nnT
{ \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int }
{ \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int }
@@ -8452,7 +8483,7 @@
{
\hbox
{
- \skip_horizontal:N 0.5 \arrayrulewidth
+ \skip_horizontal:N 0.5\arrayrulewidth
\pgfsys at markposition { \@@_env: - col - 1 }
\skip_horizontal:N -0.5\arrayrulewidth
}
@@ -9116,7 +9147,7 @@
{
\tl_gset:cn
{ g_@@_code_before_ \int_use:N \g_@@_env_int _ tl }
- { \g_nicematrix_code_before_tl }
+ { \exp_not:V \g_nicematrix_code_before_tl }
}
\iow_now:Nn \@mainaux \ExplSyntaxOff
\bool_set_true:N \l_@@_code_before_bool
@@ -9129,7 +9160,7 @@
\@@_restore_iRow_jCol:
% \end{macrocode}
% The command |\CT at arc@| contains the instruction of color for the rules of the
-% array\footnote{e.g. |\color[rgb]{0.5,0.5,0}|)}. This command is used by
+% array\footnote{e.g. |\color[rgb]{0.5,0.5,0}|}. This command is used by
% |\CT at arc@| but we use it also for compatibility with \pkg{colortbl}. But we
% want also to be able to use color for the rules of the array when
% \pkg{colortbl} is \emph{not} loaded. That's why we do the following
@@ -9154,24 +9185,27 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_adjust_pos_of_blocks_seq:
{
- \seq_gclear:N \g_tmpa_seq
- \seq_map_inline:Nn \g_@@_pos_of_blocks_seq
+ \seq_gset_map_x:NNn \g_@@_pos_of_blocks_seq \g_@@_pos_of_blocks_seq
{ \@@_adjust_pos_of_blocks_seq_i:nnnn ##1 }
- \seq_gset_eq:NN \g_@@_pos_of_blocks_seq \g_tmpa_seq
}
% \end{macrocode}
%
+% The following command must \emph{not} be protected.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_adjust_pos_of_blocks_seq_i:nnnn #1 #2 #3 #4
+\cs_new:Npn \@@_adjust_pos_of_blocks_seq_i:nnnn #1 #2 #3 #4
{
- \int_compare:nNnTF { #3 } > { 99 }
- { \int_set_eq:NN \l_tmpa_int \c at iRow }
- { \int_set:Nn \l_tmpa_int { #3 } }
- \int_compare:nNnTF { #4 } > { 99 }
- { \int_set_eq:NN \l_tmpb_int \c at jCol }
- { \int_set:Nn \l_tmpb_int { #4 } }
- \seq_gput_right:Nx \g_tmpa_seq
- { { #1 } { #2 } { \int_use:N \l_tmpa_int } { \int_use:N \l_tmpb_int } }
+ { #1 }
+ { #2 }
+ {
+ \int_compare:nNnTF { #3 } > { 99 }
+ { \int_use:N \c at iRow }
+ { #3 }
+ }
+ {
+ \int_compare:nNnTF { #4 } > { 99 }
+ { \int_use:N \c at jCol }
+ { #4 }
+ }
}
% \end{macrocode}
%
@@ -10403,7 +10437,7 @@
% deprecated.
% \begin{macrocode}
{
- \exp_args:Ne \str_case:nn { \tl_lower_case:n { #2 } }
+ \exp_args:Ne \str_case:nn { \str_foldcase:n { #2 } }
{
l { > \@@_Cell: l < \@@_end_Cell: }
r { > \@@_Cell: r < \@@_end_Cell: }
@@ -10456,7 +10490,9 @@
% \begin{macrocode}
\cs_new:Npn \@@_Hdotsfor:
{
- \int_compare:nNnTF \c at jCol = 0
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \c at jCol = 0 }
+ { \int_compare_p:nNn \l_@@_first_col_int = 0 }
{
\bool_if:NTF \g_@@_after_col_zero_bool
{
@@ -10807,32 +10843,44 @@
}
% \end{macrocode}
%
-%
% \bigskip
-% Here an example : |\@@_rowcolor {red!15} {1,3,5-7,10-}|
+% The following command uses two implicit arguments : |\l_@@_rows_tl| and
+% |\l_@@_cols_tl| which are specifications for a set of row and a set of
+% columns. The cartesian product is filled with the current color.
% \begin{macrocode}
-\NewDocumentCommand \@@_rowcolor { O { } m m }
+\cs_new_protected:Npn \@@_cartesian_fill:
{
- \tl_if_blank:nF { #2 }
- {
- \pgfpicture
- \pgf at relevantforpicturesizefalse
- \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
% \end{macrocode}
-% |\l_tmpa_dim| is the $x$-value of the right side of the rows.
+% We begin the loop over the columns.
% \begin{macrocode}
- \@@_qpoint:n { col - 1}
- \int_compare:nNnTF \l_@@_first_col_int = 0
+ \clist_map_inline:Nn \l_@@_cols_tl
+ {
+ \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 }
+ \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
+ \tl_if_empty:NT \l_tmpb_tl
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+ \int_compare:nNnT \l_tmpb_tl > \c at jCol
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+ \@@_qpoint:n { col - \l_tmpa_tl }
+ \bool_lazy_and:nnTF
+ { \str_if_eq_p:Vn \l_tmpa_tl 0 }
+ { \int_compare_p:nNn \l_@@_first_col_int > 0 }
+ { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
{ \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- \@@_qpoint:n { col - \@@_succ:n \c at jCol }
+ \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
\dim_set:Nn \l_tmpa_dim { \pgf at x + 0.5 \arrayrulewidth }
- \clist_map_inline:nn { #3 }
+% \end{macrocode}
+% We begin the loop over the rows
+% \begin{macrocode}
+ \clist_map_inline:Nn \l_@@_rows_tl
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \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 }
+ { \@@_cut_on_hyphen:w ####1 \q_stop }
+ { \@@_cut_on_hyphen:w ####1 - ####1 \q_stop }
\tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
\tl_if_empty:NT \l_tmpb_tl
{ \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
@@ -10849,12 +10897,35 @@
{ \pgfpoint \l_tmpc_dim \l_tmpd_dim }
{ \pgfpoint \l_tmpa_dim \l_tmpb_dim }
}
- \pgfusepathqfill
+ }
+ \pgfusepathqfill
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
+% Here is an example : |\@@_rowcolor {red!15} {1,3,5-7,10-}|
+% \begin{macrocode}
+\NewDocumentCommand \@@_rowcolor { O { } m m }
+ {
+ \tl_if_blank:nF { #2 }
+ {
+ \pgfpicture
+ \pgf at relevantforpicturesizefalse
+ \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
+ \tl_set:Nn \l_@@_rows_tl { #3 }
+ \tl_set:Nn \l_@@_cols_tl { - }
+% \end{macrocode}
+% The command |\@@_cartesian_fill:| takes in two implicit arguments:
+% |\l_@@_cols_tl| and |\l_@@_row_tl|.
+% \begin{macrocode}
+ \@@_cartesian_fill:
\endpgfpicture
}
}
% \end{macrocode}
%
+%
% \bigskip
% Here an example : |\@@_columncolor:nn {red!15} {1,3,5-7,10-}|
% \begin{macrocode}
@@ -10865,48 +10936,23 @@
\pgfpicture
\pgf at relevantforpicturesizefalse
\tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \@@_qpoint:n { row - 1 }
+ \tl_set:Nn \l_@@_rows_tl { - }
+ \tl_set:Nn \l_@@_cols_tl { #3 }
% \end{macrocode}
-% |\l_tmpa_dim| is the $y$-value of the top of the columns et |\l_tmpb_dim| is
-% the $y$-value of the bottom.
+% The command |\@@_cartesian_fill:| takes in two implicit arguments:
+% |\l_@@_cols_tl| and |\l_@@_row_tl|.
% \begin{macrocode}
- \dim_set:Nn \l_tmpa_dim {\pgf at y + 0.5 \arrayrulewidth }
- \@@_qpoint:n { row - \@@_succ:n \c at iRow }
- \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
- \clist_map_inline:nn { #3 }
- {
- \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 }
- \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
- \tl_if_empty:NT \l_tmpb_tl
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \int_compare:nNnT \l_tmpb_tl > \c at jCol
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
-% \end{macrocode}
-% Now, the numbers of both columns are in |\l_tmpa_tl| and |\l_tmpb_tl|.
-% \begin{macrocode}
- \@@_qpoint:n { col - \l_tmpa_tl }
- \int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf at x + 0.5 \arrayrulewidth }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpa_dim }
- { \pgfpoint \l_tmpd_dim \l_tmpb_dim }
- }
- \pgfusepathqfill
+ \@@_cartesian_fill:
\endpgfpicture
}
}
% \end{macrocode}
%
+%
% \bigskip
-% Here an example : |\@@_cellcolor[rgb]{0.5,0.5,0}{2-3,3-4,4-5,5-6}|
+% Here is an example : |\@@_rectanglecolor{red!15}{2-3}{5-6}|
% \begin{macrocode}
-\NewDocumentCommand \@@_cellcolor { O { } m m }
+\NewDocumentCommand \@@_rectanglecolor { O { } m m m }
{
\tl_if_blank:nF { #2 }
{
@@ -10913,29 +10959,7 @@
\pgfpicture
\pgf at relevantforpicturesizefalse
\tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \clist_map_inline:nn { #3 }
- {
- \@@_cut_on_hyphen:w ##1 \q_stop
- \@@_qpoint:n { row - \l_tmpa_tl }
- \bool_lazy_and:nnT
- { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
- { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
- {
- \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
- \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl }
- \dim_set:Nn \l_tmpa_dim { \pgf at y + 0.5 \arrayrulewidth }
- \@@_qpoint:n { col - \l_tmpb_tl }
- \int_compare:nNnTF \l_@@_first_col_int = \l_tmpb_tl
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf at x + 0.5 \arrayrulewidth }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
- { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
- }
- }
- \pgfusepathqfill
+ \@@_rectanglecolor_i:nn { #3 } { #4 }
\endpgfpicture
}
}
@@ -10942,138 +10966,185 @@
% \end{macrocode}
%
% \bigskip
-% Here an example : |\@@_rectanglecolor{red!15}{2-3}{5-6}|
% \begin{macrocode}
-\NewDocumentCommand \@@_rectanglecolor { O { } m m m }
+\cs_new_protected:Npn \@@_rectanglecolor_i:nn #1 #2
{
+ \@@_cut_on_hyphen:w #1 \q_stop
+ \tl_clear_new:N \l_tmpc_tl
+ \tl_clear_new:N \l_tmpd_tl
+ \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl
+ \@@_cut_on_hyphen:w #2 \q_stop
+ \tl_set:Nx \l_@@_rows_tl { \l_tmpc_tl - \l_tmpa_tl }
+ \tl_set:Nx \l_@@_cols_tl { \l_tmpd_tl - \l_tmpb_tl }
+% \end{macrocode}
+% The command |\@@_cartesian_fill:| takes in two implicit arguments:
+% |\l_@@_cols_tl| and |\l_@@_row_tl|.
+% \begin{macrocode}
+ \@@_cartesian_fill:
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
+% Here is an example : |\@@_cellcolor[rgb]{0.5,0.5,0}{2-3,3-4,4-5,5-6}|
+% \begin{macrocode}
+\NewDocumentCommand \@@_cellcolor { O { } m m }
+ {
\tl_if_blank:nF { #2 }
{
\pgfpicture
\pgf at relevantforpicturesizefalse
\tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \@@_cut_on_hyphen:w #3 \q_stop
- \bool_lazy_and:nnT
- { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
- { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
- {
- \@@_qpoint:n { row - \l_tmpa_tl }
- \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
- \@@_qpoint:n { col - \l_tmpb_tl }
- \int_compare:nNnTF \l_@@_first_col_int = \l_tmpb_tl
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- \@@_cut_on_hyphen:w #4 \q_stop
- \int_compare:nNnT \l_tmpa_tl > \c at iRow
- { \tl_set:Nx \l_tmpa_tl { \int_use:N \c at iRow } }
- \int_compare:nNnT \l_tmpb_tl > \c at jCol
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl }
- \dim_set:Nn \l_tmpa_dim { \pgf at y + 0.5 \arrayrulewidth }
- \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf at x + 0.5 \arrayrulewidth }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
- { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
- \pgfusepathqfill
- }
+ \clist_map_inline:nn { #3 }
+ { \@@_rectanglecolor_i:nn { ##1 } { ##1 } }
+ \pgfusepathqfill
\endpgfpicture
}
}
% \end{macrocode}
-%
-%
+%
% \bigskip
-% The command |\rowcolors| (accessible in the |code-before|) is inspired by the
-% command |\rowcolors| of the package \pkg{xcolor} (with the option |table|).
-% However, the command |\rowcolors| of \pkg{nicematrix} has \emph{not} the
-% optional argument of the command |\rowcolors| of \pkg{xcolor}. Here is an
-% example: |\rowcolors{1}{blue!10}{}[respect-blocks]|.
-%
-% The last optional argument is for options. As of now, there is only one key
-% available : |respect-blocks|.
-%
% \begin{macrocode}
\keys_define:nn { NiceMatrix / rowcolors }
{
respect-blocks .bool_set:N = \l_@@_respect_blocks_bool ,
respect-blocks .default:n = true ,
+ cols .tl_set:N = \l_@@_cols_tl ,
+ restart .bool_set:N = \l_@@_rowcolors_restart_bool ,
+ restart .default:n = true ,
unknown .code:n = \@@_error:n { Unknown~option~for~rowcolors }
}
% \end{macrocode}
+%
+% \medskip
+% The command |\rowcolors| (accessible in the |code-before|) is inspired by the
+% command |\rowcolors| of the package \pkg{xcolor} (with the option |table|).
+% However, the command |\rowcolors| of \pkg{nicematrix} has \emph{not} the
+% optional argument of the command |\rowcolors| of \pkg{xcolor}. Here is an
+% example: |\rowcolors{1}{blue!10}{}[respect-blocks]|.
%
+% |#1| (optional) is the color space ;
+% |#2| is a list of intervals of rows ;
+% |#3| is the first color ;
+% |#4| is the second color ;
+% |#5| is for the optional list of pairs key-value.
% \begin{macrocode}
\NewDocumentCommand \@@_rowcolors { O { } m m m O { } }
{
+% \end{macrocode}
+% The group is for the options.
+% \begin{macrocode}
+ \group_begin:
+ \tl_clear_new:N \l_@@_cols_tl
+ \tl_set:Nn \l_@@_cols_tl { - }
\keys_set:nn { NiceMatrix / rowcolors } { #5 }
- \bool_lazy_and:nnTF
+% \end{macrocode}
+% The boolean |\l_tmpa_bool| will indicate whereas we are in a row of the first
+% color or of the second color.
+% \begin{macrocode}
+ \bool_set_true:N \l_tmpa_bool
+ \bool_lazy_and:nnT
\l_@@_respect_blocks_bool
- { \cs_if_exist_p:c { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } }
- { \@@_rowcolors_i:nnnn { #1 } { #2 } { #3 } { #4 } }
+ {
+ \cs_if_exist_p:c
+ { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } }
{
- \int_step_inline:nnn { #2 } { \int_use:N \c at iRow }
- {
- \int_if_odd:nTF { ##1 }
- { \@@_rowcolor [ #1 ] { #3 } }
- { \@@_rowcolor [ #1 ] { #4 } }
- { ##1 }
- }
+% \end{macrocode}
+% We don't want to take into account a block which is completely in the ``first
+% column'' of (number $0$) or in the ``last column'' and that's why we filter
+% the sequence of the blocks (in a the sequence |\l_tmpa_seq|).
+% \begin{macrocode}
+ \seq_set_eq:Nc \l_tmpb_seq
+ { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq }
+ \seq_set_filter:NNn \l_tmpa_seq \l_tmpb_seq
+ { \@@_not_in_exterior_p:nnnn ##1 }
}
- }
+ \pgfpicture
+ \pgf at relevantforpicturesizefalse
+ \clist_map_inline:nn { #2 }
+ {
+ \tl_set:Nn \l_tmpa_tl { ##1 }
+ \tl_if_in:NnTF \l_tmpa_tl { - }
+ { \@@_cut_on_hyphen:w ##1 \q_stop }
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
% \end{macrocode}
-%
-%
+% The counter |\l_tmpa_int| will be the index of the loop.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_rowcolors_i:nnnn #1 #2 #3 #4
- {
- \seq_set_eq:Nc \l_tmpb_seq
- { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq }
+ \int_set:Nn \l_tmpa_int \l_tmpa_tl
+ \bool_if:NTF \l_@@_rowcolors_restart_bool
+ { \bool_set_true:N \l_tmpa_bool }
+ { \bool_set:Nn \l_tmpa_bool { \int_if_odd_p:n { \l_tmpa_tl } } }
+ \int_zero_new:N \l_tmpc_int
+ \int_set:Nn \l_tmpc_int \l_tmpb_tl
+ \int_do_until:nNnn \l_tmpa_int > \l_tmpc_int
+ {
% \end{macrocode}
-% We don't want to take into account a block which is completely in the ``first
-% column'' of (number $0$) or in the ``last column''.
+% We will compute in |\l_tmpb_int| the last row of the ``block''.
% \begin{macrocode}
- \seq_set_filter:NNn \l_tmpa_seq \l_tmpb_seq
- { \@@_not_in_exterior_p:nnnn ##1 }
-% \end{macrocode}
-% The counter |\l_tmpa_int| will be the index of the loop.
+ \int_set_eq:NN \l_tmpb_int \l_tmpa_int
+% \end{macrocode}
+% If the key |respect-blocks| is in force, we have to adjust that value (of
+% course).
% \begin{macrocode}
- \int_set:Nn \l_tmpa_int { #2 }
+ \bool_lazy_and:nnT
+ \l_@@_respect_blocks_bool
+ {
+ \cs_if_exist_p:c
+ { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq }
+ }
+ {
+ \seq_set_filter:NNn \l_tmpb_seq \l_tmpa_seq
+ { \@@_intersect_our_row_p:nnnn ####1 }
+ \seq_map_inline:Nn \l_tmpb_seq { \@@_rowcolors_i:nnnn ####1 }
% \end{macrocode}
-% The boolean |\l_tmpa_bool| will indicate whereas we are in a row of the first
-% color or of the second color.
+% Now, the last row of the block is computed in |\l_tmpb_int|.
% \begin{macrocode}
- \bool_set_false:N \l_tmpa_bool
+ }
+ \tl_set:Nx \l_@@_rows_tl
+ { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
+ \bool_if:NTF \l_tmpa_bool
+ {
+ \tl_if_blank:nF { #3 }
+ {
+ \tl_if_empty:nTF { #1 }
+ \color
+ { \color [ #1 ] }
+ { #3 }
% \end{macrocode}
-% We recall that, in the |code-before|, |\c at iRow| is the total number of rows of
-% the array (excepted the potential exterior rows).
+% The command |\@@_cartesian_fill:| takes in two implicit arguments:
+% |\l_@@_cols_tl| and |\l_@@_row_tl|.
% \begin{macrocode}
- \int_do_until:nNnn \l_tmpa_int > \c at iRow
- {
- \seq_set_filter:NNn \l_tmpb_seq \l_tmpa_seq
- { \@@_intersect_our_row_p:nnnn ##1 }
+ \@@_cartesian_fill:
+ }
+ \bool_set_false:N \l_tmpa_bool
+ }
+ {
+ \tl_if_blank:nF { #4 }
+ {
+ \tl_if_empty:nTF { #1 }
+ \color
+ { \color [ #1 ] }
+ { #4 }
% \end{macrocode}
-% We compute in |\l_tmpb_int| the last row covered by a block.
+% The command |\@@_cartesian_fill:| takes in two implicit arguments:
+% |\l_@@_cols_tl| and |\l_@@_row_tl|.
% \begin{macrocode}
- \int_set_eq:NN \l_tmpb_int \l_tmpa_int
- \seq_map_inline:Nn \l_tmpb_seq { \@@_rowcolors_ii:nnnn ##1 }
- \bool_if:NTF \l_tmpa_bool
- {
- \@@_rowcolor [ #1 ] { #4 }
- { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
- \bool_set_false:N \l_tmpa_bool
+ \@@_cartesian_fill:
+ }
+ \bool_set_true:N \l_tmpa_bool
+ }
+ \int_set:Nn \l_tmpa_int { \l_tmpb_int + 1 }
}
- {
- \@@_rowcolor [ #1 ] { #3 }
- { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
- \bool_set_true:N \l_tmpa_bool
- }
- \int_set:Nn \l_tmpa_int { \l_tmpb_int + 1 }
}
+ \endpgfpicture
+ \group_end:
}
% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
-\cs_new_protected:Npn \@@_rowcolors_ii:nnnn #1 #2 #3 #4
+\cs_new_protected:Npn \@@_rowcolors_i:nnnn #1 #2 #3 #4
{
\int_compare:nNnT { #3 } > \l_tmpb_int
{ \int_set:Nn \l_tmpb_int { #3 } }
@@ -11110,6 +11181,7 @@
}
% \end{macrocode}
%
+%
% \bigskip
% \begin{macrocode}
\NewDocumentCommand \@@_chessboardcolors { O { } m m }
@@ -12614,22 +12686,11 @@
}
% \end{macrocode}
% Now, |\l_tmpa_tl| contains an ``object'' corresponding to the position of the
-% block whith four components, each of them surrounded by curly brackets:
+% block with four components, each of them surrounded by curly brackets:
%
% |{|\textsl{imin}|}{|\textsl{jmin}|}{|\textsl{imax}|}{|\textsl{jmax}|}|.
%
-% We store this information in the sequence |\g_@@_pos_of_blocks_seq|.
-% \begin{macrocode}
- \seq_gput_left:NV \g_@@_pos_of_blocks_seq \l_tmpa_tl
-% \end{macrocode}
-% We also store a complete description of the block in the sequence
-% |\g_@@_blocks_seq|. Of course, the sequences |\g_@@_pos_of_blocks_seq| and
-% |\g_@@_blocks_seq| are redundant, but it's for efficiency. In
-% |\g_@@_blocks_seq|, each block is represented by an ``object'' with six
-% components:
%
-% |{|\textsl{imin}|}{|\textsl{jmin}|}{|\textsl{imax}|}{|\textsl{jmax}|}{|\textsl{options}|}{|\textsl{contents}|}|.
-%
% \medskip
% If the block is mono-column or mono-row, we have a special treatment. That's
% why we have two macros: |\@@_Block_iii:nnnnn| and |\@@_Block_iv:nnnnn| (the five
@@ -12771,7 +12832,7 @@
% alignement and that's why we put a key corresponding to the value of
% |\l_@@_pos_of_block_tl|, which is fixed by the type of current column.
% \begin{macrocode}
- { #3 , \l_@@_pos_of_block_tl }
+ { \exp_not:n { #3 } , \l_@@_pos_of_block_tl }
{
\box_use_drop:c
{ g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box }
@@ -12791,7 +12852,7 @@
\seq_gput_right:Nx \g_@@_blocks_seq
{
\l_tmpa_tl
- { #3 }
+ { \exp_not:n { #3 } }
\exp_not:n
{
{
@@ -12886,14 +12947,7 @@
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6
- {
-% \end{macrocode}
-% The group is for the keys.
-% \begin{macrocode}
- \group_begin:
- \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
-% \end{macrocode}
-%
+ {
% The integer |\l_@@_last_row_int| will be the last row of the block and
% |\l_@@_last_col_int| its last column.
% \begin{macrocode}
@@ -12915,9 +12969,44 @@
\int_compare:nNnTF { #4 } > { 99 }
{ \int_set_eq:NN \l_@@_last_col_int \c at jCol }
{ \int_set:Nn \l_@@_last_col_int { #4 } }
+ \bool_lazy_or:nnTF
+ { \int_compare_p:nNn \l_@@_last_row_int > \g_@@_row_total_int }
+ { \int_compare_p:nNn \l_@@_last_col_int > \g_@@_col_total_int }
+ {
+ \int_compare:nTF
+ { \l_@@_last_col_int <= \g_@@_static_num_of_col_int }
+ {
+ \msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 }
+ \@@_msg_redirect_name:nn { Block~too~large~2 } { none }
+ \group_begin:
+ \globaldefs = 1
+ \@@_msg_redirect_name:nn { columns~not~used } { none }
+ \group_end:
+ }
+ { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } }
+ }
+ { \@@_Block_iv:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } }
+ }
% \end{macrocode}
%
% \begin{macrocode}
+\cs_new_protected:Npn \@@_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6
+ {
+% \end{macrocode}
+% The sequence of the positions of the blocks will be used when drawing the rules
+% (in fact, there is also the |\multicolumn| and the |\diagbox| in that sequence).
+% \begin{macrocode}
+ \seq_gput_left:Nn \g_@@_pos_of_blocks_seq { { #1 } { #2 } { #3 } { #4 } }
+% \end{macrocode}
+%
+% The group is for the keys.
+% \begin{macrocode}
+ \group_begin:
+ \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
\bool_lazy_or:nnT
{ ! \tl_if_empty_p:N \l_@@_draw_tl }
{ \dim_compare_p:nNn \l_@@_line_width_dim > \c_zero_dim }
@@ -12925,7 +13014,7 @@
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
\@@_stroke_block:nnn
- { #5 }
+ { \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
}
@@ -12940,7 +13029,7 @@
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
\exp_not:N \rectanglecolor
- { \l_@@_fill_tl }
+ { \exp_not:V \l_@@_fill_tl }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
}
@@ -12965,13 +13054,8 @@
%
% \medskip
% \begin{macrocode}
- \bool_lazy_or:nnTF
- { \int_compare_p:nNn \l_@@_last_row_int > \g_@@_row_total_int }
- { \int_compare_p:nNn \l_@@_last_col_int > \g_@@_col_total_int }
- { \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
- {
- \hbox_set:Nn \l_@@_cell_box { #6 }
- \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
+ \hbox_set:Nn \l_@@_cell_box { #6 }
+ \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
% \end{macrocode}
%
% \bigskip
@@ -13024,17 +13108,17 @@
% \bigskip
% The construction of the node corresponding to the merged cells.
% \begin{macrocode}
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgf at relevantforpicturesizefalse
- \@@_qpoint:n { row - #1 }
- \dim_set_eq:NN \l_tmpa_dim \pgf at y
- \@@_qpoint:n { col - #2 }
- \dim_set_eq:NN \l_tmpb_dim \pgf at x
- \@@_qpoint:n { row - \@@_succ:n { \l_@@_last_row_int } }
- \dim_set_eq:NN \l_tmpc_dim \pgf at y
- \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } }
- \dim_set_eq:NN \l_tmpd_dim \pgf at x
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf at relevantforpicturesizefalse
+ \@@_qpoint:n { row - #1 }
+ \dim_set_eq:NN \l_tmpa_dim \pgf at y
+ \@@_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf at x
+ \@@_qpoint:n { row - \@@_succ:n { \l_@@_last_row_int } }
+ \dim_set_eq:NN \l_tmpc_dim \pgf at y
+ \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf at x
% \end{macrocode}
%
% We construct the node for the block with the name |(#1-#2-block)|.
@@ -13042,66 +13126,66 @@
% The function |\@@_pgf_rect_node:nnnnn| takes in as arguments the name of the node
% and the four coordinates of two opposite corner points of the rectangle.
% \begin{macrocode}
- \begin { pgfscope }
- \@@_pgf_rect_node:nnnnn
- { \@@_env: - #1 - #2 - block }
- \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
- \end { pgfscope }
+ \begin { pgfscope }
+ \@@_pgf_rect_node:nnnnn
+ { \@@_env: - #1 - #2 - block }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
+ \end { pgfscope }
% \end{macrocode}
%
% \medskip
% We construct the |short| node.
% \begin{macrocode}
- \dim_set_eq:NN \l_tmpb_dim \c_max_dim
- \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
- {
+ \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ {
% \end{macrocode}
% We recall that, when a cell is empty, no (normal) node is created in that
% cell. That's why we test the existence of the node before using it.
% \begin{macrocode}
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
+ {
+ \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
{
- \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
- {
- \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
- \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
- }
+ \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
+ \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
}
}
+ }
% \end{macrocode}
% If all the cells of the column were empty, |\l_tmpb_dim| has still the same
% value |\c_max_dim|. In that case, you use for |\l_tmpb_dim| the value of the
% position of the vertical rule.
% \begin{macrocode}
- \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ {
+ \@@_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf at x
+ }
+ \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
{
- \@@_qpoint:n { col - #2 }
- \dim_set_eq:NN \l_tmpb_dim \pgf at x
- }
- \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
- \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
- {
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
+ \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
{
- \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
- {
- \pgfpointanchor
- { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
- { east }
- \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf at x }
- }
+ \pgfpointanchor
+ { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
+ { east }
+ \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf at x }
}
}
- \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
- {
- \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } }
- \dim_set_eq:NN \l_tmpd_dim \pgf at x
- }
- \@@_pgf_rect_node:nnnnn
- { \@@_env: - #1 - #2 - block - short }
- \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
+ }
+ \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
+ {
+ \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf at x
+ }
+ \@@_pgf_rect_node:nnnnn
+ { \@@_env: - #1 - #2 - block - short }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
% \end{macrocode}
%
% \medskip
@@ -13109,37 +13193,37 @@
% node'' for the block. The function |\@@_pgf_rect_node:nnnnn| takes in as
% arguments the name of the node and two \textsc{pgf} points.
% \begin{macrocode}
- \bool_if:NT \l_@@_medium_nodes_bool
- {
- \@@_pgf_rect_node:nnn
- { \@@_env: - #1 - #2 - block - medium }
- { \pgfpointanchor { \@@_env: - #1 - #2 - medium } { north~west } }
- {
- \pgfpointanchor
- { \@@_env:
- - \int_use:N \l_@@_last_row_int
- - \int_use:N \l_@@_last_col_int - medium
- }
- { south~east }
+ \bool_if:NT \l_@@_medium_nodes_bool
+ {
+ \@@_pgf_rect_node:nnn
+ { \@@_env: - #1 - #2 - block - medium }
+ { \pgfpointanchor { \@@_env: - #1 - #2 - medium } { north~west } }
+ {
+ \pgfpointanchor
+ { \@@_env:
+ - \int_use:N \l_@@_last_row_int
+ - \int_use:N \l_@@_last_col_int - medium
}
- }
+ { south~east }
+ }
+ }
% \end{macrocode}
% \medskip
% Now, we will put the label of the block beginning with the case of a |\Block|
% of one row.
% \begin{macrocode}
- \int_compare:nNnTF { #1 } = { #3 }
- {
+ \int_compare:nNnTF { #1 } = { #3 }
+ {
% \end{macrocode}
% We take into account the case of a block of one row in the ``first row'' or
% the ``last row''.
% \begin{macrocode}
- \int_compare:nNnTF { #1 } = 0
- { \l_@@_code_for_first_row_tl }
- {
- \int_compare:nNnT { #1 } = \l_@@_last_row_int
- \l_@@_code_for_last_row_tl
- }
+ \int_compare:nNnTF { #1 } = 0
+ { \l_@@_code_for_first_row_tl }
+ {
+ \int_compare:nNnT { #1 } = \l_@@_last_row_int
+ \l_@@_code_for_last_row_tl
+ }
% \end{macrocode}
% If the block has only one row, we want the label of the block perfectly
% aligned on the baseline of the row. That's why we have constructed a
@@ -13150,33 +13234,33 @@
% \end{macrocode}
% We retrieve (in |\pgf at x|) the $x$-value of the center of the block.
% \begin{macrocode}
- \pgfpointanchor
- { \@@_env: - #1 - #2 - block - short }
+ \pgfpointanchor
+ { \@@_env: - #1 - #2 - block - short }
+ {
+ \str_case:Vn \l_@@_pos_of_block_tl
{
- \str_case:Vn \l_@@_pos_of_block_tl
- {
- c { center }
- l { west }
- r { east }
- }
- }
+ c { center }
+ l { west }
+ r { east }
+ }
+ }
% \end{macrocode}
% We put the label of the block which has been composed in |\l_@@_cell_box|.
% \begin{macrocode}
- \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
+ \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
+ {
+ \str_case:Vn \l_@@_pos_of_block_tl
{
- \str_case:Vn \l_@@_pos_of_block_tl
- {
- c { base }
- l { base~west }
- r { base~east }
- }
+ c { base }
+ l { base~west }
+ r { base~east }
}
- { \box_use_drop:N \l_@@_cell_box } { } { }
- }
+ }
+ { \box_use_drop:N \l_@@_cell_box } { } { }
+ }
% \end{macrocode}
%
% \medskip
@@ -13184,45 +13268,44 @@
% by using the short node (the label of the block has been composed in
% |\l_@@_cell_box|).
% \begin{macrocode}
- {
+ {
% \end{macrocode}
% If we are in the first column, we must put the block as if it was with the key~|r|.
% \begin{macrocode}
- \int_compare:nNnT { #2 } = 0
- { \tl_set:Nn \l_@@_pos_of_block_tl r }
- \bool_if:nT \g_@@_last_col_found_bool
+ \int_compare:nNnT { #2 } = 0
+ { \tl_set:Nn \l_@@_pos_of_block_tl r }
+ \bool_if:nT \g_@@_last_col_found_bool
+ {
+ \int_compare:nNnT { #2 } = \g_@@_col_total_int
+ { \tl_set:Nn \l_@@_pos_of_block_tl l }
+ }
+ \pgftransformshift
+ {
+ \pgfpointanchor
+ { \@@_env: - #1 - #2 - block - short }
{
- \int_compare:nNnT { #2 } = \g_@@_col_total_int
- { \tl_set:Nn \l_@@_pos_of_block_tl l }
- }
- \pgftransformshift
- {
- \pgfpointanchor
- { \@@_env: - #1 - #2 - block - short }
+ \str_case:Vn \l_@@_pos_of_block_tl
{
- \str_case:Vn \l_@@_pos_of_block_tl
- {
- c { center }
- l { west }
- r { east }
- }
- }
- }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- {
- \str_case:Vn \l_@@_pos_of_block_tl
- {
c { center }
l { west }
r { east }
}
}
- { \box_use_drop:N \l_@@_cell_box } { } { }
- }
- \endpgfpicture
- }
+ }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
+ {
+ \str_case:Vn \l_@@_pos_of_block_tl
+ {
+ c { center }
+ l { west }
+ r { east }
+ }
+ }
+ { \box_use_drop:N \l_@@_cell_box } { } { }
+ }
+ \endpgfpicture
\group_end:
}
% \end{macrocode}
@@ -13531,7 +13614,7 @@
%
% \medskip
% However, in each cell of the environment, the command |\CodeAfter| will be
-% linked to the following command |\@@_CodeAfter_i:n| which do \emph{not} begins
+% linked to the following command |\@@_CodeAfter_i:n| which do \emph{not} begin
% with |\omit| (and thus, the user will be able to use |\CodeAfter| without
% error and without the need to prefix by |\omit|.
%
@@ -13603,12 +13686,12 @@
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~package }
{
- The~option~'\l_keys_key_tl'~is~unknown. \\
+ The~key~'\l_keys_key_str'~is~unknown. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~available~options,~type~H~<return>.
+ For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
define-L-C-R,~
footnote,~
footnotehyper,~
@@ -13697,35 +13780,15 @@
% \bigskip
% \subsection*{Error messages of the package}
%
-% The following command converts all the elements of a sequence (which are token
-% lists) into strings.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_convert_to_str_seq:N #1
- {
- \seq_clear:N \l_tmpa_seq
- \seq_map_inline:Nn #1
- {
- \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } }
- }
- \seq_set_eq:NN #1 \l_tmpa_seq
- }
-% \end{macrocode}
-%
-% The following command creates a sequence of strings (|str|) from a |clist|.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_set_seq_of_str_from_clist:Nn #1 #2
- {
- \seq_set_from_clist:Nn #1 { #2 }
- \@@_convert_to_str_seq:N #1
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\@@_set_seq_of_str_from_clist:Nn \c_@@_types_of_matrix_seq
+\seq_new:N \c_@@_types_of_matrix_seq
+\seq_set_from_clist:Nn \c_@@_types_of_matrix_seq
{
NiceMatrix ,
pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix
}
+\seq_set_map_x:NNn \c_@@_types_of_matrix_seq \c_@@_types_of_matrix_seq
+ { \tl_to_str:n { #1 } }
% \end{macrocode}
%
% \bigskip
@@ -13809,9 +13872,8 @@
\@@_msg_new:nn { columns~not~used }
{
The~preamble~of~your~\@@_full_name_env:\ announces~\int_use:N
- \g_@@_static_num_of_col_int\
- columns~but~you~use~only~\int_use:N \c at jCol.\\
- However,~you~can~go~on.
+ \g_@@_static_num_of_col_int\ columns~but~you~use~only~\int_use:N \c at jCol.\\
+ You~can~go~on~but~the~columns~you~did~not~used~won't~be~created.
}
% \end{macrocode}
%
@@ -13853,7 +13915,7 @@
\@@_msg_new:nn { bad~option~for~line-style }
{
Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~
- is~'standard'.~If~you~go~on,~this~option~will~be~ignored.
+ is~'standard'.~If~you~go~on,~this~key~will~be~ignored.
}
% \end{macrocode}
%
@@ -13860,9 +13922,9 @@
% \begin{macrocode}
\@@_msg_new:nn { Unknown~option~for~xdots }
{
- As~for~now~there~is~only~three~options~available~here:~'color',~'line-style'~
- and~'shorten'~(and~you~try~to~use~'\l_keys_key_tl').~If~you~go~on,~
- this~option~will~be~ignored.
+ As~for~now~there~is~only~three~key~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}
%
@@ -13869,9 +13931,9 @@
% \begin{macrocode}
\@@_msg_new:nn { Unknown~option~for~rowcolors }
{
- As~for~now~there~is~only~one~option~available~here:~'respect-blocks'~
- (and~you~try~to~use~'\l_keys_key_tl').~If~you~go~on,~
- this~option~will~be~ignored.
+ As~for~now~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~
+ (and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~
+ this~key~will~be~ignored.
}
% \end{macrocode}
%
@@ -13889,7 +13951,7 @@
\@@_msg_new:nn { ampersand~in~light-syntax }
{
You~can't~use~an~ampersand~(\token_to_str &)~to~separate~columns~because
- ~you~have~used~the~option~'light-syntax'.~This~error~is~fatal.
+ ~you~have~used~the~key~'light-syntax'.~This~error~is~fatal.
}
% \end{macrocode}
%
@@ -13897,8 +13959,8 @@
\@@_msg_new:nn { double-backslash~in~light-syntax }
{
You~can't~use~\token_to_str:N \\~to~separate~rows~because~you~have~used~
- the~option~'light-syntax'.~You~must~use~the~character~'\l_@@_end_of_row_tl'~
- (set~by~the~option~'end-of-row').~This~error~is~fatal.
+ the~key~'light-syntax'.~You~must~use~the~character~'\l_@@_end_of_row_tl'~
+ (set~by~the~key~'end-of-row').~This~error~is~fatal.
}
% \end{macrocode}
%
@@ -13966,7 +14028,7 @@
% \begin{macrocode}
\@@_msg_new:nn { last-col~non~empty~for~NiceArray }
{
- In~the~\@@_full_name_env:,~you~must~use~the~option~
+ In~the~\@@_full_name_env:,~you~must~use~the~key~
'last-col'~without~value.\\
However,~you~can~go~on~for~this~time~
(the~value~'\l_keys_value_tl'~will~be~ignored).
@@ -13977,7 +14039,7 @@
% \begin{macrocode}
\@@_msg_new:nn { last-col~non~empty~for~NiceMatrixOptions }
{
- In~\NiceMatrixoptions,~you~must~use~the~option~
+ In~\NiceMatrixoptions,~you~must~use~the~key~
'last-col'~without~value.\\
However,~you~can~go~on~for~this~time~
(the~value~'\l_keys_value_tl'~will~be~ignored).
@@ -13986,7 +14048,7 @@
%
%
% \begin{macrocode}
-\@@_msg_new:nn { Block~too~large }
+\@@_msg_new:nn { Block~too~large~1 }
{
You~try~to~draw~a~block~in~the~cell~#1-#2~of~your~matrix~but~the~matrix~is~
too~small~for~that~block. \\
@@ -13994,6 +14056,20 @@
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { Block~too~large~2 }
+ {
+ The~preamble~of~your~\@@_full_name_env:\ announces~\int_use:N
+ \g_@@_static_num_of_col_int\
+ columns~but~you~use~only~\int_use:N \c at jCol\ and~that's~why~a~block~
+ specified~in~the~cell~#1-#2~can't~be~drawn.~You~should~add~some~ampersands~
+ (&)~at~the~end~of~the~first~row~of~your~
+ \@@_full_name_env:.\\
+ If~you~go~on,this~block~and~maybe~others~will~be~ignored.
+ }
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
\@@_msg_new:nn { unknown~column~type }
{
The~column~type~'#1'~in~your~\@@_full_name_env:\
@@ -14015,9 +14091,9 @@
% \begin{macrocode}
\@@_msg_new:nn { bottomule~without~booktabs }
{
- You~can't~use~the~option~'tabular/bottomrule'~because~you~haven't~
+ You~can't~use~the~key~'tabular/bottomrule'~because~you~haven't~
loaded~'booktabs'.\\
- If~you~go~on,~this~option~will~be~ignored.
+ If~you~go~on,~this~key~will~be~ignored.
}
% \end{macrocode}
%
@@ -14059,7 +14135,7 @@
% \begin{macrocode}
\@@_msg_new:nn { Bad~value~for~letter~for~dotted~lines }
{
- The~value~of~key~'\l_keys_key_tl'~must~be~of~length~1.\\
+ The~value~of~key~'\l_keys_key_str'~must~be~of~length~1.\\
If~you~go~on,~it~will~be~ignored.
}
% \end{macrocode}
@@ -14068,13 +14144,13 @@
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~Block }
{
- The~key~'\l_keys_key_tl'~is~unknown~for~the~command~\token_to_str:N
+ The~key~'\l_keys_key_str'~is~unknown~for~the~command~\token_to_str:N
\Block.\\ If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~-,~c,~
- color,~l,~and~r.
+ The~available~keys~are~(in~alphabetic~order):~-,~c,~draw,~fill,~l,~
+ line-width~and~r.
}
% \end{macrocode}
%
@@ -14081,12 +14157,12 @@
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~notes }
{
- The~key~'\l_keys_key_tl'~is~unknown.\\
+ The~key~'\l_keys_key_str'~is~unknown.\\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~available~keys~about~notes,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
bottomrule,~
code-after,~
code-before,~
@@ -14102,13 +14178,13 @@
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~NiceMatrixOptions }
{
- The~key~'\l_keys_key_tl'~is~unknown~for~the~command~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~command~
\token_to_str:N \NiceMatrixOptions. \\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
allow-duplicate-names,~
cell-space-bottom-limit,~
cell-space-top-limit,~
@@ -14148,13 +14224,13 @@
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceArray }
{
- The~option~'\l_keys_key_tl'~is~unknown~for~the~environment~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceArray\}. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~*principal*~available~options,~type~H~<return>.
+ For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
b,~
baseline,~
c,~
@@ -14202,17 +14278,17 @@
% \medskip
% This error message is used for the set of keys |NiceMatrix/NiceMatrix| and
% |NiceMatrix/pNiceArray| (but not by |NiceMatrix/NiceArray| because, for this
-% set of keys, there is also the options |t|, |c| and~|b|).
+% set of keys, there is also the keys |t|, |c| and~|b|).
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
{
- The~option~'\l_keys_key_tl'~is~unknown~for~the~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~
\@@_full_name_env:. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~*principal*~available~options,~type~H~<return>.
+ For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
b,~
baseline,~
c,~
@@ -14260,13 +14336,13 @@
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceTabular }
{
- The~option~'\l_keys_key_tl'~is~unknown~for~the~environment~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceTabular\}. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~*principal*~available~options,~type~H~<return>.
+ For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
b,~
baseline,~
c,~
@@ -14317,7 +14393,7 @@
the~same~environment~name~twice.~You~can~go~on,~but,~
maybe,~you~will~have~incorrect~results~especially~
if~you~use~'columns-width=auto'.~If~you~don't~want~to~see~this~
- message~again,~use~the~option~'allow-duplicate-names'~in~
+ message~again,~use~the~key~'allow-duplicate-names'~in~
'\token_to_str:N \NiceMatrixOptions'.\\
For~a~list~of~the~names~already~used,~type~H~<return>. \\
}
@@ -14330,8 +14406,8 @@
% \begin{macrocode}
\@@_msg_new:nn { Option~auto~for~columns-width }
{
- You~can't~give~the~value~'auto'~to~the~option~'columns-width'~here.~
- If~you~go~on,~the~option~will~be~ignored.
+ You~can't~give~the~value~'auto'~to~the~key~'columns-width'~here.~
+ If~you~go~on,~the~key~will~be~ignored.
}
% \end{macrocode}
%
@@ -14590,7 +14666,7 @@
% $i$|-|$j$|-block| and, if the creation of the ``medium nodes'' is required, a
% node $i$|-|$j$|-block-medium| is created.
%
-% If the user try to use more columns than allowed by its environment, an error
+% If the user tries to use more columns than allowed by its environment, an error
% is raised by nicematrix (instead of a low-level error).
%
% The package must be loaded with the option |obsolete-environments| if we want
@@ -14640,7 +14716,7 @@
%
% New environment |{NiceTabular}|
%
-% Commands to color cells, row and columns with a perfect result in the \textsc{pdf}.
+% Commands to color cells, rows and columns with a perfect result in the \textsc{pdf}.
%
% \subsection*{Changes between versions 4.0 and 4.1}
%
@@ -14733,6 +14809,15 @@
%
% Keys |fill|, |draw| and |line-width| for the command |\Block|.
%
+% \subsection*{Changes between versions 5.7 and 5.8}
+%
+% Keys |cols| and |restart| of the command |\rowcolors| in the |code-before|.
+%
+% Modification of the behaviour of |\\| in the columns of type |p|, |m| or |b|
+% (for a behaviour similar to the environments of \pkg{array}).
+%
+% Better error messages for the command |\Block|.
+%
% \PrintIndex
%
% \tableofcontents
Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2021-01-01 21:48:29 UTC (rev 57287)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty 2021-01-01 21:48:45 UTC (rev 57288)
@@ -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.7}
-\def\myfiledate{2020/11/23}
+\def\myfileversion{5.8}
+\def\myfiledate{2021/01/01}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -452,8 +452,8 @@
\tl_const:Nn \c__nicematrix_standard_tl { standard }
\tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl
\bool_new:N \l__nicematrix_light_syntax_bool
-\str_new:N \l__nicematrix_baseline_str
-\tl_set:Nn \l__nicematrix_baseline_str c
+\str_new:N \l__nicematrix_baseline_tl
+\tl_set:Nn \l__nicematrix_baseline_tl c
\bool_new:N \l__nicematrix_exterior_arraycolsep_bool
\bool_new:N \l__nicematrix_parallelize_diags_bool
\bool_set_true:N \l__nicematrix_parallelize_diags_bool
@@ -575,10 +575,10 @@
\bool_set_true:N \l__nicematrix_code_before_bool
}
} ,
- c .code:n = \tl_set:Nn \l__nicematrix_baseline_str c ,
- t .code:n = \tl_set:Nn \l__nicematrix_baseline_str t ,
- b .code:n = \tl_set:Nn \l__nicematrix_baseline_str b ,
- baseline .tl_set:N = \l__nicematrix_baseline_str ,
+ c .code:n = \tl_set:Nn \l__nicematrix_baseline_tl c ,
+ t .code:n = \tl_set:Nn \l__nicematrix_baseline_tl t ,
+ b .code:n = \tl_set:Nn \l__nicematrix_baseline_tl b ,
+ baseline .tl_set:N = \l__nicematrix_baseline_tl ,
baseline .value_required:n = true ,
columns-width .code:n =
\tl_if_eq:nnTF { #1 } { auto }
@@ -814,7 +814,7 @@
}
\cs_new_protected:Npn \__nicematrix_begin_of_row:
{
- \refstepcounter { iRow }
+ \int_gincr:N \c at 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 }
\dim_gset:Nn \g__nicematrix_ht_last_row_dim { \box_ht:N \@arstrutbox }
@@ -964,7 +964,7 @@
{ \cs_set_nopar:Npx \@halignto { to \dim_use:N \l__nicematrix_tabular_width_dim } }
\@tabarray
}
- [ \str_if_eq:VnTF \l__nicematrix_baseline_str c c t ]
+ [ \str_if_eq:VnTF \l__nicematrix_baseline_tl c c t ]
}
\cs_set_eq:NN \__nicematrix_old_ialign: \ialign
\cs_new_protected:Npn \__nicematrix_create_row_node:
@@ -1029,11 +1029,11 @@
\cs_set_eq:NN \hdotsfor \__nicematrix_Hdotsfor:
}
\cs_new_protected:Npn \__nicematrix_colortbl_like:
- {
- \cs_set_eq:NN \cellcolor \__nicematrix_cellcolor_tabular
- \cs_set_eq:NN \rowcolor \__nicematrix_rowcolor_tabular
- \cs_set_eq:NN \columncolor \__nicematrix_columncolor_preamble
- }
+ {
+ \cs_set_eq:NN \cellcolor \__nicematrix_cellcolor_tabular
+ \cs_set_eq:NN \rowcolor \__nicematrix_rowcolor_tabular
+ \cs_set_eq:NN \columncolor \__nicematrix_columncolor_preamble
+ }
\cs_new_protected:Npn \__nicematrix_pre_array:
{
\bool_if:NT \c__nicematrix_booktabs_loaded_bool
@@ -1319,11 +1319,6 @@
\int_compare:nNnT \l__nicematrix_last_col_int > { -1 }
{ \__nicematrix_error:n { last~col~not~used } }
}
- \bool_if:NF \l__nicematrix_Matrix_bool
- {
- \int_compare:nNnT \c at jCol < \g__nicematrix_static_num_of_col_int
- { \__nicematrix_error:n { columns~not~used } }
- }
\int_gset_eq:NN \g__nicematrix_row_total_int \c at iRow
\int_compare:nNnT \l__nicematrix_last_row_int > { -1 } { \int_gdecr:N \c at iRow }
\int_compare:nNnT \l__nicematrix_first_col_int = 0
@@ -1333,7 +1328,7 @@
}
\bool_if:NTF \l__nicematrix_NiceArray_bool
{
- \str_case:VnF \l__nicematrix_baseline_str
+ \str_case:VnF \l__nicematrix_baseline_tl
{
b \__nicematrix_use_arraybox_with_notes_b:
c \__nicematrix_use_arraybox_with_notes_c:
@@ -1388,6 +1383,15 @@
\skip_horizontal:N \g__nicematrix_width_last_col_dim
\skip_horizontal:N \col at sep
}
+ \bool_if:NF \l__nicematrix_Matrix_bool
+ {
+ \int_compare:nNnT \c at jCol < \g__nicematrix_static_num_of_col_int
+ { \__nicematrix_error:n { columns~not~used } }
+ }
+ \group_begin:
+ \globaldefs = 1
+ \__nicematrix_msg_redirect_name:nn { columns~not~used } { error }
+ \group_end:
\__nicematrix_after_array:
\egroup
\bool_if:NT \c__nicematrix_footnote_bool \endsavenotes
@@ -1535,6 +1539,7 @@
\__nicematrix_Cell:
\begin { minipage } [ #1 ] { #3 }
\mode_leave_vertical:
+ \arraybackslash % added in the version 5.8
\box_use:N \@arstrutbox
}
c
@@ -1601,7 +1606,7 @@
{
\box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim }
\box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim }
- \str_if_eq:VnTF \l__nicematrix_baseline_str { c }
+ \tl_if_eq:NnTF \l__nicematrix_baseline_tl { c }
{ \box_use_drop:N \l_tmpa_box }
\__nicematrix_put_box_in_flow_i:
}
@@ -1613,24 +1618,24 @@
\__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c at iRow }
\dim_gadd:Nn \g_tmpa_dim \pgf at y
\dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim }
- \str_if_in:NnTF \l__nicematrix_baseline_str { line- }
+ \str_if_in:NnTF \l__nicematrix_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
\str_range:Nnn
- \l__nicematrix_baseline_str
+ \l__nicematrix_baseline_tl
6
- { \str_count:N \l__nicematrix_baseline_str }
+ { \tl_count:V \l__nicematrix_baseline_tl }
}
\__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \str_case:VnF \l__nicematrix_baseline_str
+ \str_case:VnF \l__nicematrix_baseline_tl
{
{ t } { \int_set:Nn \l_tmpa_int 1 }
{ b } { \int_set_eq:NN \l_tmpa_int \c at iRow }
}
- { \int_set:Nn \l_tmpa_int \l__nicematrix_baseline_str }
+ { \int_set:Nn \l_tmpa_int \l__nicematrix_baseline_tl }
\bool_lazy_or:nnT
{ \int_compare_p:nNn \l_tmpa_int < \l__nicematrix_first_row_int }
{ \int_compare_p:nNn \l_tmpa_int > \g__nicematrix_row_total_int }
@@ -1712,24 +1717,24 @@
}
\cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes:
{
- \str_if_eq:VnT \l__nicematrix_baseline_str { t }
- { \tl_set:Nn \l__nicematrix_baseline_str { 1 } }
+ \tl_if_eq:NnT \l__nicematrix_baseline_tl { t }
+ { \tl_set:Nn \l__nicematrix_baseline_tl { 1 } }
\pgfpicture
\__nicematrix_qpoint:n { row - 1 }
\dim_gset_eq:NN \g_tmpa_dim \pgf at y
- \str_if_in:NnTF \l__nicematrix_baseline_str { line- }
+ \str_if_in:NnTF \l__nicematrix_baseline_tl { line- }
{
\int_set:Nn \l_tmpa_int
{
\str_range:Nnn
- \l__nicematrix_baseline_str
+ \l__nicematrix_baseline_tl
6
- { \str_count:N \l__nicematrix_baseline_str }
+ { \tl_count:V \l__nicematrix_baseline_tl }
}
\__nicematrix_qpoint:n { row - \int_use:N \l_tmpa_int }
}
{
- \int_set:Nn \l_tmpa_int \l__nicematrix_baseline_str
+ \int_set:Nn \l_tmpa_int \l__nicematrix_baseline_tl
\bool_lazy_or:nnT
{ \int_compare_p:nNn \l_tmpa_int < \l__nicematrix_first_row_int }
{ \int_compare_p:nNn \l_tmpa_int > \g__nicematrix_row_total_int }
@@ -1886,7 +1891,7 @@
{
\hbox
{
- \skip_horizontal:N 0.5 \arrayrulewidth
+ \skip_horizontal:N 0.5\arrayrulewidth
\pgfsys at markposition { \__nicematrix_env: - col - 1 }
\skip_horizontal:N -0.5\arrayrulewidth
}
@@ -2278,7 +2283,7 @@
{
\tl_gset:cn
{ g__nicematrix_code_before_ \int_use:N \g__nicematrix_env_int _ tl }
- { \g_nicematrix_code_before_tl }
+ { \exp_not:V \g_nicematrix_code_before_tl }
}
\iow_now:Nn \@mainaux \ExplSyntaxOff
\bool_set_true:N \l__nicematrix_code_before_bool
@@ -2289,21 +2294,23 @@
}
\cs_new_protected:Npn \__nicematrix_adjust_pos_of_blocks_seq:
{
- \seq_gclear:N \g_tmpa_seq
- \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq
+ \seq_gset_map_x:NNn \g__nicematrix_pos_of_blocks_seq \g__nicematrix_pos_of_blocks_seq
{ \__nicematrix_adjust_pos_of_blocks_seq_i:nnnn ##1 }
- \seq_gset_eq:NN \g__nicematrix_pos_of_blocks_seq \g_tmpa_seq
}
-\cs_new_protected:Npn \__nicematrix_adjust_pos_of_blocks_seq_i:nnnn #1 #2 #3 #4
+\cs_new:Npn \__nicematrix_adjust_pos_of_blocks_seq_i:nnnn #1 #2 #3 #4
{
- \int_compare:nNnTF { #3 } > { 99 }
- { \int_set_eq:NN \l_tmpa_int \c at iRow }
- { \int_set:Nn \l_tmpa_int { #3 } }
- \int_compare:nNnTF { #4 } > { 99 }
- { \int_set_eq:NN \l_tmpb_int \c at jCol }
- { \int_set:Nn \l_tmpb_int { #4 } }
- \seq_gput_right:Nx \g_tmpa_seq
- { { #1 } { #2 } { \int_use:N \l_tmpa_int } { \int_use:N \l_tmpb_int } }
+ { #1 }
+ { #2 }
+ {
+ \int_compare:nNnTF { #3 } > { 99 }
+ { \int_use:N \c at iRow }
+ { #3 }
+ }
+ {
+ \int_compare:nNnTF { #4 } > { 99 }
+ { \int_use:N \c at jCol }
+ { #4 }
+ }
}
\AtBeginDocument
{
@@ -3086,7 +3093,7 @@
\__nicematrix_old_multicolumn
{ #1 }
{
- \exp_args:Ne \str_case:nn { \tl_lower_case:n { #2 } }
+ \exp_args:Ne \str_case:nn { \str_foldcase:n { #2 } }
{
l { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: }
r { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: }
@@ -3125,7 +3132,9 @@
}
\cs_new:Npn \__nicematrix_Hdotsfor:
{
- \int_compare:nNnTF \c at jCol = 0
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \c at jCol = 0 }
+ { \int_compare_p:nNn \l__nicematrix_first_col_int = 0 }
{
\bool_if:NTF \g__nicematrix_after_col_zero_bool
{
@@ -3351,25 +3360,33 @@
\tl_set:Nn \l_tmpa_tl { #1 }
\tl_set:Nn \l_tmpb_tl { #2 }
}
-\NewDocumentCommand \__nicematrix_rowcolor { O { } m m }
+\cs_new_protected:Npn \__nicematrix_cartesian_fill:
{
- \tl_if_blank:nF { #2 }
+ \clist_map_inline:Nn \l__nicematrix_cols_tl
{
- \pgfpicture
- \pgf at relevantforpicturesizefalse
- \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \__nicematrix_qpoint:n { col - 1}
- \int_compare:nNnTF \l__nicematrix_first_col_int = 0
+ \tl_set:Nn \l_tmpa_tl { ##1 }
+ \tl_if_in:NnTF \l_tmpa_tl { - }
+ { \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
+ { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
+ \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
+ \tl_if_empty:NT \l_tmpb_tl
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+ \int_compare:nNnT \l_tmpb_tl > \c at jCol
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
+ \__nicematrix_qpoint:n { col - \l_tmpa_tl }
+ \bool_lazy_and:nnTF
+ { \str_if_eq_p:Vn \l_tmpa_tl 0 }
+ { \int_compare_p:nNn \l__nicematrix_first_col_int > 0 }
+ { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
{ \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \c at jCol }
+ \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
\dim_set:Nn \l_tmpa_dim { \pgf at x + 0.5 \arrayrulewidth }
- \clist_map_inline:nn { #3 }
+ \clist_map_inline:Nn \l__nicematrix_rows_tl
{
- \tl_set:Nn \l_tmpa_tl { ##1 }
+ \tl_set:Nn \l_tmpa_tl { ####1 }
\tl_if_in:NnTF \l_tmpa_tl { - }
- { \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
- { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
+ { \__nicematrix_cut_on_hyphen:w ####1 \q_stop }
+ { \__nicematrix_cut_on_hyphen:w ####1 - ####1 \q_stop }
\tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
\tl_if_empty:NT \l_tmpb_tl
{ \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
@@ -3383,7 +3400,19 @@
{ \pgfpoint \l_tmpc_dim \l_tmpd_dim }
{ \pgfpoint \l_tmpa_dim \l_tmpb_dim }
}
- \pgfusepathqfill
+ }
+ \pgfusepathqfill
+ }
+\NewDocumentCommand \__nicematrix_rowcolor { O { } m m }
+ {
+ \tl_if_blank:nF { #2 }
+ {
+ \pgfpicture
+ \pgf at relevantforpicturesizefalse
+ \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
+ \tl_set:Nn \l__nicematrix_rows_tl { #3 }
+ \tl_set:Nn \l__nicematrix_cols_tl { - }
+ \__nicematrix_cartesian_fill:
\endpgfpicture
}
}
@@ -3394,36 +3423,13 @@
\pgfpicture
\pgf at relevantforpicturesizefalse
\tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \__nicematrix_qpoint:n { row - 1 }
- \dim_set:Nn \l_tmpa_dim {\pgf at y + 0.5 \arrayrulewidth }
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c at iRow }
- \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
- \clist_map_inline:nn { #3 }
- {
- \tl_set:Nn \l_tmpa_tl { ##1 }
- \tl_if_in:NnTF \l_tmpa_tl { - }
- { \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
- { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop }
- \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } }
- \tl_if_empty:NT \l_tmpb_tl
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \int_compare:nNnT \l_tmpb_tl > \c at jCol
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \__nicematrix_qpoint:n { col - \l_tmpa_tl }
- \int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpa_tl
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf at x + 0.5 \arrayrulewidth }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpa_dim }
- { \pgfpoint \l_tmpd_dim \l_tmpb_dim }
- }
- \pgfusepathqfill
+ \tl_set:Nn \l__nicematrix_rows_tl { - }
+ \tl_set:Nn \l__nicematrix_cols_tl { #3 }
+ \__nicematrix_cartesian_fill:
\endpgfpicture
}
}
-\NewDocumentCommand \__nicematrix_cellcolor { O { } m m }
+\NewDocumentCommand \__nicematrix_rectanglecolor { O { } m m m }
{
\tl_if_blank:nF { #2 }
{
@@ -3430,64 +3436,32 @@
\pgfpicture
\pgf at relevantforpicturesizefalse
\tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \clist_map_inline:nn { #3 }
- {
- \__nicematrix_cut_on_hyphen:w ##1 \q_stop
- \__nicematrix_qpoint:n { row - \l_tmpa_tl }
- \bool_lazy_and:nnT
- { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
- { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
- {
- \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpa_tl }
- \dim_set:Nn \l_tmpa_dim { \pgf at y + 0.5 \arrayrulewidth }
- \__nicematrix_qpoint:n { col - \l_tmpb_tl }
- \int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpb_tl
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf at x + 0.5 \arrayrulewidth }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
- { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
- }
- }
- \pgfusepathqfill
+ \__nicematrix_rectanglecolor_i:nn { #3 } { #4 }
\endpgfpicture
}
}
-\NewDocumentCommand \__nicematrix_rectanglecolor { O { } m m m }
+\cs_new_protected:Npn \__nicematrix_rectanglecolor_i:nn #1 #2
{
+ \__nicematrix_cut_on_hyphen:w #1 \q_stop
+ \tl_clear_new:N \l_tmpc_tl
+ \tl_clear_new:N \l_tmpd_tl
+ \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl
+ \__nicematrix_cut_on_hyphen:w #2 \q_stop
+ \tl_set:Nx \l__nicematrix_rows_tl { \l_tmpc_tl - \l_tmpa_tl }
+ \tl_set:Nx \l__nicematrix_cols_tl { \l_tmpd_tl - \l_tmpb_tl }
+ \__nicematrix_cartesian_fill:
+ }
+\NewDocumentCommand \__nicematrix_cellcolor { O { } m m }
+ {
\tl_if_blank:nF { #2 }
{
\pgfpicture
\pgf at relevantforpicturesizefalse
\tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 }
- \__nicematrix_cut_on_hyphen:w #3 \q_stop
- \bool_lazy_and:nnT
- { \int_compare_p:n { \l_tmpa_tl <= \c at iRow } }
- { \int_compare_p:n { \l_tmpb_tl <= \c at jCol } }
- {
- \__nicematrix_qpoint:n { row - \l_tmpa_tl }
- \dim_set:Nn \l_tmpb_dim { \pgf at y + 0.5 \arrayrulewidth }
- \__nicematrix_qpoint:n { col - \l_tmpb_tl }
- \int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpb_tl
- { \dim_set:Nn \l_tmpc_dim { \pgf at x - 0.5 \arrayrulewidth } }
- { \dim_set:Nn \l_tmpc_dim { \pgf at x + 0.5 \arrayrulewidth } }
- \__nicematrix_cut_on_hyphen:w #4 \q_stop
- \int_compare:nNnT \l_tmpa_tl > \c at iRow
- { \tl_set:Nx \l_tmpa_tl { \int_use:N \c at iRow } }
- \int_compare:nNnT \l_tmpb_tl > \c at jCol
- { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at jCol } }
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpa_tl }
- \dim_set:Nn \l_tmpa_dim { \pgf at y + 0.5 \arrayrulewidth }
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
- \dim_set:Nn \l_tmpd_dim { \pgf at x + 0.5 \arrayrulewidth }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpc_dim \l_tmpb_dim }
- { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
- \pgfusepathqfill
- }
+ \clist_map_inline:nn { #3 }
+ { \__nicematrix_rectanglecolor_i:nn { ##1 } { ##1 } }
+ \pgfusepathqfill
\endpgfpicture
}
}
@@ -3495,54 +3469,89 @@
{
respect-blocks .bool_set:N = \l__nicematrix_respect_blocks_bool ,
respect-blocks .default:n = true ,
+ cols .tl_set:N = \l__nicematrix_cols_tl ,
+ restart .bool_set:N = \l__nicematrix_rowcolors_restart_bool ,
+ restart .default:n = true ,
unknown .code:n = \__nicematrix_error:n { Unknown~option~for~rowcolors }
}
\NewDocumentCommand \__nicematrix_rowcolors { O { } m m m O { } }
{
+ \group_begin:
+ \tl_clear_new:N \l__nicematrix_cols_tl
+ \tl_set:Nn \l__nicematrix_cols_tl { - }
\keys_set:nn { NiceMatrix / rowcolors } { #5 }
- \bool_lazy_and:nnTF
+ \bool_set_true:N \l_tmpa_bool
+ \bool_lazy_and:nnT
\l__nicematrix_respect_blocks_bool
- { \cs_if_exist_p:c { c__nicematrix_pos_of_blocks_ \int_use:N \g__nicematrix_env_int _ seq } }
- { \__nicematrix_rowcolors_i:nnnn { #1 } { #2 } { #3 } { #4 } }
{
- \int_step_inline:nnn { #2 } { \int_use:N \c at iRow }
- {
- \int_if_odd:nTF { ##1 }
- { \__nicematrix_rowcolor [ #1 ] { #3 } }
- { \__nicematrix_rowcolor [ #1 ] { #4 } }
- { ##1 }
- }
+ \cs_if_exist_p:c
+ { c__nicematrix_pos_of_blocks_ \int_use:N \g__nicematrix_env_int _ seq } }
+ {
+ \seq_set_eq:Nc \l_tmpb_seq
+ { c__nicematrix_pos_of_blocks_ \int_use:N \g__nicematrix_env_int _ seq }
+ \seq_set_filter:NNn \l_tmpa_seq \l_tmpb_seq
+ { \__nicematrix_not_in_exterior_p:nnnn ##1 }
}
- }
-\cs_new_protected:Npn \__nicematrix_rowcolors_i:nnnn #1 #2 #3 #4
- {
- \seq_set_eq:Nc \l_tmpb_seq
- { c__nicematrix_pos_of_blocks_ \int_use:N \g__nicematrix_env_int _ seq }
- \seq_set_filter:NNn \l_tmpa_seq \l_tmpb_seq
- { \__nicematrix_not_in_exterior_p:nnnn ##1 }
- \int_set:Nn \l_tmpa_int { #2 }
- \bool_set_false:N \l_tmpa_bool
- \int_do_until:nNnn \l_tmpa_int > \c at iRow
+ \pgfpicture
+ \pgf at relevantforpicturesizefalse
+ \clist_map_inline:nn { #2 }
{
- \seq_set_filter:NNn \l_tmpb_seq \l_tmpa_seq
- { \__nicematrix_intersect_our_row_p:nnnn ##1 }
- \int_set_eq:NN \l_tmpb_int \l_tmpa_int
- \seq_map_inline:Nn \l_tmpb_seq { \__nicematrix_rowcolors_ii:nnnn ##1 }
- \bool_if:NTF \l_tmpa_bool
+ \tl_set:Nn \l_tmpa_tl { ##1 }
+ \tl_if_in:NnTF \l_tmpa_tl { - }
+ { \__nicematrix_cut_on_hyphen:w ##1 \q_stop }
+ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c at iRow } }
+ \int_set:Nn \l_tmpa_int \l_tmpa_tl
+ \bool_if:NTF \l__nicematrix_rowcolors_restart_bool
+ { \bool_set_true:N \l_tmpa_bool }
+ { \bool_set:Nn \l_tmpa_bool { \int_if_odd_p:n { \l_tmpa_tl } } }
+ \int_zero_new:N \l_tmpc_int
+ \int_set:Nn \l_tmpc_int \l_tmpb_tl
+ \int_do_until:nNnn \l_tmpa_int > \l_tmpc_int
{
- \__nicematrix_rowcolor [ #1 ] { #4 }
+ \int_set_eq:NN \l_tmpb_int \l_tmpa_int
+ \bool_lazy_and:nnT
+ \l__nicematrix_respect_blocks_bool
+ {
+ \cs_if_exist_p:c
+ { c__nicematrix_pos_of_blocks_ \int_use:N \g__nicematrix_env_int _ seq }
+ }
+ {
+ \seq_set_filter:NNn \l_tmpb_seq \l_tmpa_seq
+ { \__nicematrix_intersect_our_row_p:nnnn ####1 }
+ \seq_map_inline:Nn \l_tmpb_seq { \__nicematrix_rowcolors_i:nnnn ####1 }
+ }
+ \tl_set:Nx \l__nicematrix_rows_tl
{ \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
- \bool_set_false:N \l_tmpa_bool
+ \bool_if:NTF \l_tmpa_bool
+ {
+ \tl_if_blank:nF { #3 }
+ {
+ \tl_if_empty:nTF { #1 }
+ \color
+ { \color [ #1 ] }
+ { #3 }
+ \__nicematrix_cartesian_fill:
+ }
+ \bool_set_false:N \l_tmpa_bool
+ }
+ {
+ \tl_if_blank:nF { #4 }
+ {
+ \tl_if_empty:nTF { #1 }
+ \color
+ { \color [ #1 ] }
+ { #4 }
+ \__nicematrix_cartesian_fill:
+ }
+ \bool_set_true:N \l_tmpa_bool
+ }
+ \int_set:Nn \l_tmpa_int { \l_tmpb_int + 1 }
}
- {
- \__nicematrix_rowcolor [ #1 ] { #3 }
- { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int }
- \bool_set_true:N \l_tmpa_bool
- }
- \int_set:Nn \l_tmpa_int { \l_tmpb_int + 1 }
}
+ \endpgfpicture
+ \group_end:
}
-\cs_new_protected:Npn \__nicematrix_rowcolors_ii:nnnn #1 #2 #3 #4
+\cs_new_protected:Npn \__nicematrix_rowcolors_i:nnnn #1 #2 #3 #4
{
\int_compare:nNnT { #3 } > \l_tmpb_int
{ \int_set:Nn \l_tmpb_int { #3 } }
@@ -4383,7 +4392,6 @@
{ \int_eval:n { \c at iRow + \l_tmpa_int - 1 } }
{ \int_eval:n { \c at jCol + \l_tmpb_int - 1 } }
}
- \seq_gput_left:NV \g__nicematrix_pos_of_blocks_seq \l_tmpa_tl
\bool_lazy_or:nnTF
{ \int_compare_p:nNn { \l_tmpa_int } = 1 }
{ \int_compare_p:nNn { \l_tmpb_int } = 1 }
@@ -4479,7 +4487,7 @@
\seq_gput_right:Nx \g__nicematrix_blocks_seq
{
\l_tmpa_tl
- { #3 , \l__nicematrix_pos_of_block_tl }
+ { \exp_not:n { #3 } , \l__nicematrix_pos_of_block_tl }
{
\box_use_drop:c
{ g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box }
@@ -4491,7 +4499,7 @@
\seq_gput_right:Nx \g__nicematrix_blocks_seq
{
\l_tmpa_tl
- { #3 }
+ { \exp_not:n { #3 } }
\exp_not:n
{
{
@@ -4554,8 +4562,6 @@
}
\cs_new_protected:Npn \__nicematrix_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6
{
- \group_begin:
- \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
\int_zero_new:N \l__nicematrix_last_row_int
\int_zero_new:N \l__nicematrix_last_col_int
\int_compare:nNnTF { #3 } > { 99 }
@@ -4564,6 +4570,29 @@
\int_compare:nNnTF { #4 } > { 99 }
{ \int_set_eq:NN \l__nicematrix_last_col_int \c at jCol }
{ \int_set:Nn \l__nicematrix_last_col_int { #4 } }
+ \bool_lazy_or:nnTF
+ { \int_compare_p:nNn \l__nicematrix_last_row_int > \g__nicematrix_row_total_int }
+ { \int_compare_p:nNn \l__nicematrix_last_col_int > \g__nicematrix_col_total_int }
+ {
+ \int_compare:nTF
+ { \l__nicematrix_last_col_int <= \g__nicematrix_static_num_of_col_int }
+ {
+ \msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 }
+ \__nicematrix_msg_redirect_name:nn { Block~too~large~2 } { none }
+ \group_begin:
+ \globaldefs = 1
+ \__nicematrix_msg_redirect_name:nn { columns~not~used } { none }
+ \group_end:
+ }
+ { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } }
+ }
+ { \__nicematrix_Block_iv:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } }
+ }
+\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6
+ {
+ \seq_gput_left:Nn \g__nicematrix_pos_of_blocks_seq { { #1 } { #2 } { #3 } { #4 } }
+ \group_begin:
+ \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
\bool_lazy_or:nnT
{ ! \tl_if_empty_p:N \l__nicematrix_draw_tl }
{ \dim_compare_p:nNn \l__nicematrix_line_width_dim > \c_zero_dim }
@@ -4571,7 +4600,7 @@
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
\__nicematrix_stroke_block:nnn
- { #5 }
+ { \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
@@ -4583,7 +4612,7 @@
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
\exp_not:N \rectanglecolor
- { \l__nicematrix_fill_tl }
+ { \exp_not:V \l__nicematrix_fill_tl }
{ #1 - #2 }
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
@@ -4600,93 +4629,122 @@
{ \exp_not:n { ##1 } } { \exp_not:n { ##2 } }
}
}
- \bool_lazy_or:nnTF
- { \int_compare_p:nNn \l__nicematrix_last_row_int > \g__nicematrix_row_total_int }
- { \int_compare_p:nNn \l__nicematrix_last_col_int > \g__nicematrix_col_total_int }
- { \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
- {
- \hbox_set:Nn \l__nicematrix_cell_box { #6 }
- \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgf at relevantforpicturesizefalse
- \__nicematrix_qpoint:n { row - #1 }
- \dim_set_eq:NN \l_tmpa_dim \pgf at y
- \__nicematrix_qpoint:n { col - #2 }
- \dim_set_eq:NN \l_tmpb_dim \pgf at x
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { \l__nicematrix_last_row_int } }
- \dim_set_eq:NN \l_tmpc_dim \pgf at y
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
- \dim_set_eq:NN \l_tmpd_dim \pgf at x
- \begin { pgfscope }
- \__nicematrix_pgf_rect_node:nnnnn
- { \__nicematrix_env: - #1 - #2 - block }
- \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
- \end { pgfscope }
- \dim_set_eq:NN \l_tmpb_dim \c_max_dim
- \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+ \hbox_set:Nn \l__nicematrix_cell_box { #6 }
+ \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf at relevantforpicturesizefalse
+ \__nicematrix_qpoint:n { row - #1 }
+ \dim_set_eq:NN \l_tmpa_dim \pgf at y
+ \__nicematrix_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf at x
+ \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { \l__nicematrix_last_row_int } }
+ \dim_set_eq:NN \l_tmpc_dim \pgf at y
+ \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf at x
+ \begin { pgfscope }
+ \__nicematrix_pgf_rect_node:nnnnn
+ { \__nicematrix_env: - #1 - #2 - block }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
+ \end { pgfscope }
+ \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+ \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
{
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 }
+ \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
{
- \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
- {
- \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west }
- \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
- }
+ \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west }
+ \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf at x }
}
}
- \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ }
+ \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ {
+ \__nicematrix_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf at x
+ }
+ \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
+ \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
{
- \__nicematrix_qpoint:n { col - #2 }
- \dim_set_eq:NN \l_tmpb_dim \pgf at x
- }
- \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
- \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int
- {
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
+ \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
{
- \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 }
- {
- \pgfpointanchor
- { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
- { east }
- \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf at x }
- }
+ \pgfpointanchor
+ { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int }
+ { east }
+ \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf at x }
}
}
- \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
- {
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
- \dim_set_eq:NN \l_tmpd_dim \pgf at x
- }
- \__nicematrix_pgf_rect_node:nnnnn
- { \__nicematrix_env: - #1 - #2 - block - short }
- \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
- \bool_if:NT \l__nicematrix_medium_nodes_bool
+ }
+ \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
+ {
+ \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf at x
+ }
+ \__nicematrix_pgf_rect_node:nnnnn
+ { \__nicematrix_env: - #1 - #2 - block - short }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
+ \bool_if:NT \l__nicematrix_medium_nodes_bool
+ {
+ \__nicematrix_pgf_rect_node:nnn
+ { \__nicematrix_env: - #1 - #2 - block - medium }
+ { \pgfpointanchor { \__nicematrix_env: - #1 - #2 - medium } { north~west } }
{
- \__nicematrix_pgf_rect_node:nnn
- { \__nicematrix_env: - #1 - #2 - block - medium }
- { \pgfpointanchor { \__nicematrix_env: - #1 - #2 - medium } { north~west } }
+ \pgfpointanchor
+ { \__nicematrix_env:
+ - \int_use:N \l__nicematrix_last_row_int
+ - \int_use:N \l__nicematrix_last_col_int - medium
+ }
+ { south~east }
+ }
+ }
+ \int_compare:nNnTF { #1 } = { #3 }
+ {
+ \int_compare:nNnTF { #1 } = 0
+ { \l__nicematrix_code_for_first_row_tl }
+ {
+ \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int
+ \l__nicematrix_code_for_last_row_tl
+ }
+ \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } }
+ \pgfpointanchor
+ { \__nicematrix_env: - #1 - #2 - block - short }
+ {
+ \str_case:Vn \l__nicematrix_pos_of_block_tl
{
- \pgfpointanchor
- { \__nicematrix_env:
- - \int_use:N \l__nicematrix_last_row_int
- - \int_use:N \l__nicematrix_last_col_int - medium
- }
- { south~east }
+ c { center }
+ l { west }
+ r { east }
}
}
- \int_compare:nNnTF { #1 } = { #3 }
+ \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
{
- \int_compare:nNnTF { #1 } = 0
- { \l__nicematrix_code_for_first_row_tl }
+ \str_case:Vn \l__nicematrix_pos_of_block_tl
{
- \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int
- \l__nicematrix_code_for_last_row_tl
+ c { base }
+ l { base~west }
+ r { base~east }
}
- \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } }
+ }
+ { \box_use_drop:N \l__nicematrix_cell_box } { } { }
+ }
+ {
+ \int_compare:nNnT { #2 } = 0
+ { \tl_set:Nn \l__nicematrix_pos_of_block_tl r }
+ \bool_if:nT \g__nicematrix_last_col_found_bool
+ {
+ \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int
+ { \tl_set:Nn \l__nicematrix_pos_of_block_tl l }
+ }
+ \pgftransformshift
+ {
\pgfpointanchor
{ \__nicematrix_env: - #1 - #2 - block - short }
{
@@ -4697,56 +4755,21 @@
r { east }
}
}
- \pgftransformshift { \pgfpoint \pgf at x \l_tmpa_dim }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- {
- \str_case:Vn \l__nicematrix_pos_of_block_tl
- {
- c { base }
- l { base~west }
- r { base~east }
- }
- }
- { \box_use_drop:N \l__nicematrix_cell_box } { } { }
}
+ \pgfset { inner~sep = \c_zero_dim }
+ \pgfnode
+ { rectangle }
{
- \int_compare:nNnT { #2 } = 0
- { \tl_set:Nn \l__nicematrix_pos_of_block_tl r }
- \bool_if:nT \g__nicematrix_last_col_found_bool
+ \str_case:Vn \l__nicematrix_pos_of_block_tl
{
- \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int
- { \tl_set:Nn \l__nicematrix_pos_of_block_tl l }
+ c { center }
+ l { west }
+ r { east }
}
- \pgftransformshift
- {
- \pgfpointanchor
- { \__nicematrix_env: - #1 - #2 - block - short }
- {
- \str_case:Vn \l__nicematrix_pos_of_block_tl
- {
- c { center }
- l { west }
- r { east }
- }
- }
- }
- \pgfset { inner~sep = \c_zero_dim }
- \pgfnode
- { rectangle }
- {
- \str_case:Vn \l__nicematrix_pos_of_block_tl
- {
- c { center }
- l { west }
- r { east }
- }
- }
- { \box_use_drop:N \l__nicematrix_cell_box } { } { }
}
- \endpgfpicture
+ { \box_use_drop:N \l__nicematrix_cell_box } { } { }
}
+ \endpgfpicture
\group_end:
}
\cs_new_protected:Npn \__nicematrix_stroke_block:nnn #1 #2 #3
@@ -4951,12 +4974,12 @@
\bool_new:N \c__nicematrix_footnote_bool
\__nicematrix_msg_new:nnn { Unknown~option~for~package }
{
- The~option~'\l_keys_key_tl'~is~unknown. \\
+ The~key~'\l_keys_key_str'~is~unknown. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~available~options,~type~H~<return>.
+ For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
define-L-C-R,~
footnote,~
footnotehyper,~
@@ -5018,25 +5041,14 @@
}
\bool_set_true:N \c__nicematrix_footnote_bool
}
-\cs_new_protected:Npn \__nicematrix_convert_to_str_seq:N #1
+\seq_new:N \c__nicematrix_types_of_matrix_seq
+\seq_set_from_clist:Nn \c__nicematrix_types_of_matrix_seq
{
- \seq_clear:N \l_tmpa_seq
- \seq_map_inline:Nn #1
- {
- \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } }
- }
- \seq_set_eq:NN #1 \l_tmpa_seq
- }
-\cs_new_protected:Npn \__nicematrix_set_seq_of_str_from_clist:Nn #1 #2
- {
- \seq_set_from_clist:Nn #1 { #2 }
- \__nicematrix_convert_to_str_seq:N #1
- }
-\__nicematrix_set_seq_of_str_from_clist:Nn \c__nicematrix_types_of_matrix_seq
- {
NiceMatrix ,
pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix
}
+\seq_set_map_x:NNn \c__nicematrix_types_of_matrix_seq \c__nicematrix_types_of_matrix_seq
+ { \tl_to_str:n { #1 } }
\cs_new_protected:Npn \__nicematrix_error_too_much_cols:
{
\seq_if_in:NVTF \c__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str
@@ -5086,9 +5098,8 @@
\__nicematrix_msg_new:nn { columns~not~used }
{
The~preamble~of~your~\__nicematrix_full_name_env:\ announces~\int_use:N
- \g__nicematrix_static_num_of_col_int\
- columns~but~you~use~only~\int_use:N \c at jCol.\\
- However,~you~can~go~on.
+ \g__nicematrix_static_num_of_col_int\ columns~but~you~use~only~\int_use:N \c at jCol.\\
+ You~can~go~on~but~the~columns~you~did~not~used~won't~be~created.
}
\__nicematrix_msg_new:nn { in~first~col }
{
@@ -5113,19 +5124,19 @@
\__nicematrix_msg_new:nn { bad~option~for~line-style }
{
Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~
- is~'standard'.~If~you~go~on,~this~option~will~be~ignored.
+ is~'standard'.~If~you~go~on,~this~key~will~be~ignored.
}
\__nicematrix_msg_new:nn { Unknown~option~for~xdots }
{
- As~for~now~there~is~only~three~options~available~here:~'color',~'line-style'~
- and~'shorten'~(and~you~try~to~use~'\l_keys_key_tl').~If~you~go~on,~
- this~option~will~be~ignored.
+ As~for~now~there~is~only~three~key~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~option~for~rowcolors }
{
- As~for~now~there~is~only~one~option~available~here:~'respect-blocks'~
- (and~you~try~to~use~'\l_keys_key_tl').~If~you~go~on,~
- this~option~will~be~ignored.
+ As~for~now~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~
+ (and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~
+ this~key~will~be~ignored.
}
\__nicematrix_msg_new:nn { Key~color~for~Block }
{
@@ -5137,13 +5148,13 @@
\__nicematrix_msg_new:nn { ampersand~in~light-syntax }
{
You~can't~use~an~ampersand~(\token_to_str &)~to~separate~columns~because
- ~you~have~used~the~option~'light-syntax'.~This~error~is~fatal.
+ ~you~have~used~the~key~'light-syntax'.~This~error~is~fatal.
}
\__nicematrix_msg_new:nn { double-backslash~in~light-syntax }
{
You~can't~use~\token_to_str:N \\~to~separate~rows~because~you~have~used~
- the~option~'light-syntax'.~You~must~use~the~character~'\l__nicematrix_end_of_row_tl'~
- (set~by~the~option~'end-of-row').~This~error~is~fatal.
+ the~key~'light-syntax'.~You~must~use~the~character~'\l__nicematrix_end_of_row_tl'~
+ (set~by~the~key~'end-of-row').~This~error~is~fatal.
}
\__nicematrix_msg_new:nn { standard-cline~in~document }
{
@@ -5186,7 +5197,7 @@
}
\__nicematrix_msg_new:nn { last-col~non~empty~for~NiceArray }
{
- In~the~\__nicematrix_full_name_env:,~you~must~use~the~option~
+ In~the~\__nicematrix_full_name_env:,~you~must~use~the~key~
'last-col'~without~value.\\
However,~you~can~go~on~for~this~time~
(the~value~'\l_keys_value_tl'~will~be~ignored).
@@ -5193,16 +5204,26 @@
}
\__nicematrix_msg_new:nn { last-col~non~empty~for~NiceMatrixOptions }
{
- In~\NiceMatrixoptions,~you~must~use~the~option~
+ In~\NiceMatrixoptions,~you~must~use~the~key~
'last-col'~without~value.\\
However,~you~can~go~on~for~this~time~
(the~value~'\l_keys_value_tl'~will~be~ignored).
}
-\__nicematrix_msg_new:nn { Block~too~large }
+\__nicematrix_msg_new:nn { Block~too~large~1 }
{
You~try~to~draw~a~block~in~the~cell~#1-#2~of~your~matrix~but~the~matrix~is~
too~small~for~that~block. \\
}
+\__nicematrix_msg_new:nn { Block~too~large~2 }
+ {
+ The~preamble~of~your~\__nicematrix_full_name_env:\ announces~\int_use:N
+ \g__nicematrix_static_num_of_col_int\
+ columns~but~you~use~only~\int_use:N \c at jCol\ and~that's~why~a~block~
+ specified~in~the~cell~#1-#2~can't~be~drawn.~You~should~add~some~ampersands~
+ (&)~at~the~end~of~the~first~row~of~your~
+ \__nicematrix_full_name_env:.\\
+ If~you~go~on,this~block~and~maybe~others~will~be~ignored.
+ }
\__nicematrix_msg_new:nn { unknown~column~type }
{
The~column~type~'#1'~in~your~\__nicematrix_full_name_env:\
@@ -5218,9 +5239,9 @@
}
\__nicematrix_msg_new:nn { bottomule~without~booktabs }
{
- You~can't~use~the~option~'tabular/bottomrule'~because~you~haven't~
+ You~can't~use~the~key~'tabular/bottomrule'~because~you~haven't~
loaded~'booktabs'.\\
- If~you~go~on,~this~option~will~be~ignored.
+ If~you~go~on,~this~key~will~be~ignored.
}
\__nicematrix_msg_new:nn { enumitem~not~loaded }
{
@@ -5246,27 +5267,27 @@
}
\__nicematrix_msg_new:nn { Bad~value~for~letter~for~dotted~lines }
{
- The~value~of~key~'\l_keys_key_tl'~must~be~of~length~1.\\
+ The~value~of~key~'\l_keys_key_str'~must~be~of~length~1.\\
If~you~go~on,~it~will~be~ignored.
}
\__nicematrix_msg_new:nnn { Unknown~key~for~Block }
{
- The~key~'\l_keys_key_tl'~is~unknown~for~the~command~\token_to_str:N
+ The~key~'\l_keys_key_str'~is~unknown~for~the~command~\token_to_str:N
\Block.\\ If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~-,~c,~
- color,~l,~and~r.
+ The~available~keys~are~(in~alphabetic~order):~-,~c,~draw,~fill,~l,~
+ line-width~and~r.
}
\__nicematrix_msg_new:nnn { Unknown~key~for~notes }
{
- The~key~'\l_keys_key_tl'~is~unknown.\\
+ The~key~'\l_keys_key_str'~is~unknown.\\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~available~keys~about~notes,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
bottomrule,~
code-after,~
code-before,~
@@ -5279,13 +5300,13 @@
}
\__nicematrix_msg_new:nnn { Unknown~key~for~NiceMatrixOptions }
{
- The~key~'\l_keys_key_tl'~is~unknown~for~the~command~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~command~
\token_to_str:N \NiceMatrixOptions. \\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
allow-duplicate-names,~
cell-space-bottom-limit,~
cell-space-top-limit,~
@@ -5322,13 +5343,13 @@
}
\__nicematrix_msg_new:nnn { Unknown~option~for~NiceArray }
{
- The~option~'\l_keys_key_tl'~is~unknown~for~the~environment~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceArray\}. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~*principal*~available~options,~type~H~<return>.
+ For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
b,~
baseline,~
c,~
@@ -5373,13 +5394,13 @@
}
\__nicematrix_msg_new:nnn { Unknown~option~for~NiceMatrix }
{
- The~option~'\l_keys_key_tl'~is~unknown~for~the~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~
\__nicematrix_full_name_env:. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~*principal*~available~options,~type~H~<return>.
+ For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
b,~
baseline,~
c,~
@@ -5424,13 +5445,13 @@
}
\__nicematrix_msg_new:nnn { Unknown~option~for~NiceTabular }
{
- The~option~'\l_keys_key_tl'~is~unknown~for~the~environment~
+ The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceTabular\}. \\
If~you~go~on,~it~will~be~ignored. \\
- For~a~list~of~the~*principal*~available~options,~type~H~<return>.
+ For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
}
{
- The~available~options~are~(in~alphabetic~order):~
+ The~available~keys~are~(in~alphabetic~order):~
b,~
baseline,~
c,~
@@ -5477,7 +5498,7 @@
the~same~environment~name~twice.~You~can~go~on,~but,~
maybe,~you~will~have~incorrect~results~especially~
if~you~use~'columns-width=auto'.~If~you~don't~want~to~see~this~
- message~again,~use~the~option~'allow-duplicate-names'~in~
+ message~again,~use~the~key~'allow-duplicate-names'~in~
'\token_to_str:N \NiceMatrixOptions'.\\
For~a~list~of~the~names~already~used,~type~H~<return>. \\
}
@@ -5487,8 +5508,8 @@
}
\__nicematrix_msg_new:nn { Option~auto~for~columns-width }
{
- You~can't~give~the~value~'auto'~to~the~option~'columns-width'~here.~
- If~you~go~on,~the~option~will~be~ignored.
+ You~can't~give~the~value~'auto'~to~the~key~'columns-width'~here.~
+ If~you~go~on,~the~key~will~be~ignored.
}
\endinput
More information about the tex-live-commits
mailing list.