summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix/nicematrix.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-07-17 03:03:44 +0000
committerNorbert Preining <norbert@preining.info>2022-07-17 03:03:44 +0000
commite7c2b4be636c9df8dea1790bc3eb442059d734f2 (patch)
tree06c67731ca919ea8eaf1b7b12156a38fd84d82cc /macros/latex/contrib/nicematrix/nicematrix.dtx
parent24ae0c3844b308d81bc4684e57817d43c0b29a13 (diff)
CTAN sync 202207170303
Diffstat (limited to 'macros/latex/contrib/nicematrix/nicematrix.dtx')
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx838
1 files changed, 538 insertions, 300 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index e7db4b0a3f..70db98bb3e 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.10a}
-\def\myfiledate{2022/06/26}
+\def\myfileversion{6.11}
+\def\myfiledate{2022/07/16}
%
%
%<*batchfile>
@@ -267,13 +267,13 @@ version 2005/12/01 or later.
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% $\begin{pmatrix}
-% \frac12 & -\frac12 \\
-% \frac13 & \frac14 \\
+% \frac{1}{2} & -\frac{1}{2} \\
+% \frac{1}{3} & \frac{1}{4} \\
% \end{pmatrix}$
% \end{BVerbatim}
% $\begin{pmatrix}
-% \frac12 & -\frac12 \\
-% \frac13 & \frac14 \\
+% \frac{1}{2} & -\frac{1}{2} \\
+% \frac{1}{3} & \frac{1}{4} \\
% \end{pmatrix}$
%
% \bigskip
@@ -565,7 +565,9 @@ version 2005/12/01 or later.
% \item the key |color| takes in as value a color and apply that color the
% content of the block but draws also the frame of the block with that color;
% \item the keys |hlines|, |vlines| and |hvlines| draw all the corresponding
-% rules in the block;
+% rules in the block;\footnote{However, the rules are not drawn in the
+% sub-blocks of the block, as always with \pkg{nicematrix}: the rules are not
+% drawn in the blocks (cf. section~\ref{rules} p.~\pageref{rules}).}
% \item the key |line-width| is the width of the rules (this key
% is meaningful only when one of the keys |draw|, |hvlines|, |vlines| and
% |hlines| is used);
@@ -789,6 +791,8 @@ version 2005/12/01 or later.
%
%
% \section{The rules}
+%
+% \label{rules}
%
% The usual techniques for the rules may be used in the environments of
% \pkg{nicematrix} (excepted |\vline|). However, there is some small differences
@@ -1153,9 +1157,7 @@ version 2005/12/01 or later.
% \subsection{The command \textbackslash diagbox}
%
% The command |\diagbox| (inspired by the package \pkg{diagbox}), allows, when
-% it is used in a cell, to slash that cell diagonally downwards.\footnote{The
-% author of this document considers that type of construction as graphically
-% poor.}.
+% it is used in a cell, to slash that cell diagonally downwards.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
@@ -1191,10 +1193,19 @@ version 2005/12/01 or later.
% will be used to use that new type of rule.
%
% \begin{itemize}
-% \item the key |command| is the name (without the backslahs) of a command that
+% \item the key |command| is the name (without the backslash) of a command that
% will be created by \pkg{nicematrix} and that will be available for the final
% user in order to draw horizontal rules (similarly to |\hline|);
%
+% \item \colorbox{yellow!50}{\textbf{New 6.11}}\enskip the key |cccommand| is
+% the name (without the backslash) of a command that will be created by
+% \pkg{nicematrix} and that will be available for the final user to order to
+% draw partial horizontal rules (similarly to |\cline|, hence the name
+% |ccommand|): the argument of that command is a list of intervals of columns
+% specified by the syntax~$i$ or $i$-$j$.\footnote{It's recommended to use such
+% commands only once in a row because each use will create space between the
+% rows corresponding to the total width of the rule.}
+%
% \item the key |letter| takes in as argument a letter\footnote{The following
% letters are forbidden: \verb+lcrpmbVX|()[]!@<>+} that the user will use in
% the preamble of an environment with preamble (such as |{NiceTabular}| in order
@@ -1319,27 +1330,28 @@ version 2005/12/01 or later.
% dotted rules are also used by \pkg{nicematrix} to draw continuous dotted rules
% between cells of the matrix with |\Cdots|, |\Vdots|, etc. (cf. p.~\pageref{Cdots}).
%
-% In fact, \pkg{nicematrix} defines by default the command |\hdottedline| and the
-% letter ``|:|'' for those dotted rules.\footnote{However, it's possible to
-% overwrite those definitions with a |custom-line| (in order, for example, to
-% switch to dashed lines).}
+% In fact, \pkg{nicematrix} defines by default the commands |\hdottedline| and
+% |\cdottedline |and the letter ``|:|'' for those dotted
+% rules.\footnote{However, it's possible to overwrite those definitions with a
+% |custom-line| (in order, for example, to switch to dashed lines).}
%
%\smallskip
%\begin{BVerbatim}
%
-% \NiceMatrixOptions % ~textsl#présent dans nicematrix.sty@
+% \NiceMatrixOptions % ~textsl#present in nicematrix.sty@
% {
% custom-line =
% {
% letter = : ,
% command = hdottedline ,
+% ccommand = cdottedline ,
% ~emphase#dotted@
% }
% }
% \end{BVerbatim}
%
-% Thus, it's possible to use the command |\hdottedline| to draw a horizontal
-% dotted rule.
+% Thus, it's possible to use the commands |\hdottedline| and |\cdottedline |to
+% draw horizontal dotted rules.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
@@ -1347,6 +1359,7 @@ version 2005/12/01 or later.
% 1 & 2 & 3 & 4 & 5 \\
% ~emphase#\hdottedline@
% 6 & 7 & 8 & 9 & 10 \\
+% emphase#\cdottedline{1,4-5}@
% 11 & 12 & 13 & 14 & 15
% \end{pNiceMatrix}
% \end{BVerbatim}
@@ -1354,6 +1367,7 @@ version 2005/12/01 or later.
% 1 & 2 & 3 & 4 & 5 \\
% \hdottedline
% 6 & 7 & 8 & 9 & 10 \\
+% \cdottedline{1,4-5}
% 11 & 12 & 13 & 14 & 15
% \end{pNiceMatrix}$
%
@@ -2198,7 +2212,8 @@ version 2005/12/01 or later.
% columns |X| (this point comes from a conflict in the definitions of the
% specifier |X|).}
%
-% As with the packages \pkg{tabu} and \pkg{tabularray}, the specifier |X| takes
+% As with the packages \pkg{tabu}\footnote{The extension \pkg{tabu} is now
+% considered as deprecated.} and \pkg{tabularray}, the specifier |X| takes
% in an optional argument (between square brackets) which is a list of keys.
% \begin{itemize}
% \item It's possible to give a weight for the column by providing a positive
@@ -2288,7 +2303,7 @@ version 2005/12/01 or later.
% \pkg{nicematrix} has, in any case, to load the whole body of the environment
% (and that's why it's not possible to put verbatim material in the array with
% the option |light-syntax|). The analysis of this whole body gives the number
-% of rows (but not the number of columns).
+% of rows and the number of columns.
%
% \item In the other cases, \pkg{nicematrix} compute the number of rows and
% columns during the first compilation and write the result in the |aux| file
@@ -2820,7 +2835,10 @@ version 2005/12/01 or later.
% descriptor are displayed very efficiently by the \textsc{pdf} readers. It's
% easy, starting from these dashed lines,
% to create a line composed by square dots whereas a line of rounded dots needs
-% a specification of each dot in the \textsc{pdf} file.}
+% a specification of each dot in the \textsc{pdf} file. Nevertheless, you can
+% have a look at the following page to see how to have dotted rules with rounded
+% dots in Tikz:\newline \small
+% \url{https://tex.stackexchange.com/questions/52848/tikz-line-with-large-dots}}
%
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% \tikz \draw [dotted] (0,0) -- (5,0) ;
@@ -3669,13 +3687,17 @@ version 2005/12/01 or later.
% supported by \pkg{nicematrix}.
%
%
-% \subsection{Alignment option in \{NiceMatrix\}}
+% \subsection{Default column type in \{NiceMatrix\}}
%
% \label{key-R}
%
-% The environments without preamble (|{NiceMatrix}|, |{pNiceMatrix}|,
-% |{bNiceMatrix}|, etc.) provide two options |l| and |r| which generate all the
-% columns aligned leftwards (or rightwards).
+% \colorbox{yellow!50}{\textbf{New 6.11}}\enskip The environments without
+% preamble (|{NiceMatrix}|, |{pNiceMatrix}|, |{bNiceMatrix}|, etc.) and the
+% commande |\pAutoNiceMatrix| (and its variants) provide an option
+% |columns-type| to specify the type of column which will be used (the initial
+% value is, of course, |c|).
+%
+% The keys |l| and |r| are shortcuts for |columns-type=l| and |columns-type=r|.
%
%
% \medskip
@@ -3690,6 +3712,10 @@ version 2005/12/01 or later.
% \sin x & \cos x
% \end{bNiceMatrix}$
%
+% \medskip
+% The key |columnts-type| is available in |\NiceMatrixOptions| but with the
+% prefix |matrix|, which means that its name is, within |\NiceMatrixOptions| :
+% |matrix/columns-type|.
%
% \subsection{The command \textbackslash rotate}
%
@@ -3867,7 +3893,7 @@ version 2005/12/01 or later.
% \[C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}\]
%
%
-% \subsection{The option light-syntax}
+% \subsection{The key light-syntax}
%
% \label{light-syntax}
% The option |light-syntax| (inpired by the package \pkg{spalign}) allows the
@@ -3907,11 +3933,11 @@ version 2005/12/01 or later.
% the whole content of the environment is loaded as a TeX argument to be
% analyzed. The environment doesn't behave in that case as a standard
% environment of LaTeX which only put TeX commands before and after the content.}
-%
+%
%
% \subsection{Color of the delimiters}
%
-% For the environements with delimiters (|{pNiceArray}|, |{pNiceMatrix}|, etc.),
+% For the environments with delimiters (|{pNiceArray}|, |{pNiceMatrix}|, etc.),
% it's possible to change the color of the delimiters with the key
% |delimiters/color|.
%
@@ -5617,9 +5643,9 @@ version 2005/12/01 or later.
% fit=#1}}%
% \[\begin{NiceArray}{*{6}{c}@{\hspace{6mm}}*{5}{c}}[nullify-dots]
% \CodeBefore [create-cell-nodes]
-% \SubMatrix({2-7}{6-11})
-% \SubMatrix({7-2}{11-6})
-% \SubMatrix({7-7}{11-11})
+% \SubMatrix({2-7}{6-last})
+% \SubMatrix({7-2}{last-6})
+% \SubMatrix({7-7}{last-last})
% \begin{tikzpicture}
% \node [highlight = (9-2) (9-6)] { } ;
% \node [highlight = (2-9) (6-9)] { } ;
@@ -5654,9 +5680,9 @@ version 2005/12/01 or later.
% \begin{Verbatim}[formatcom = \small\color{gray}]
% \[\begin{NiceArray}{*{6}{c}~LetterAt{\hspace{6mm}}*{5}{c}}[nullify-dots]
% \CodeBefore [create-cell-nodes]
-% \SubMatrix({2-7}{6-11})
-% \SubMatrix({7-2}{11-6})
-% \SubMatrix({7-7}{11-11})
+% \SubMatrix({2-7}{6-last})
+% \SubMatrix({7-2}{last-6})
+% \SubMatrix({7-7}{last-last})
% \begin{tikzpicture}
% \node [highlight = (9-2) (9-6)] { } ;
% \node [highlight = (2-9) (6-9)] { } ;
@@ -5767,9 +5793,17 @@ version 2005/12/01 or later.
{ \msg_new:nnn { nicematrix } { #1 } { #2 \\ #3 } }
{ \msg_new:nnnn { nicematrix } { #1 } { #2 } { #3 } }
}
-
+% \end{macrocode}
+%
+% We try to detect whether the compilation is done on Overleaf. We use
+% |\c_sys_jobname_str| because, with Overleaf, the value of |\c_sys_jobname_str|
+% is always ``|output|''.
+% \begin{macrocode}
+\str_if_eq:VnT \c_sys_jobname_str { output }
+ { \bool_set_true:N \c_@@_messages_for_Overleaf_bool }
% \end{macrocode}
%
+% \bigskip
% \begin{macrocode}
\cs_new_protected:Npn \@@_msg_redirect_name:nn
{ \msg_redirect_name:nnn { nicematrix } }
@@ -5784,7 +5818,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\cs_generate_variant:Nn \seq_gset_split:Nnn { N V n }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N V n }
\cs_generate_variant:Nn \keys_define:nn { n x }
% \end{macrocode}
%
@@ -5973,7 +6007,7 @@ version 2005/12/01 or later.
% Idem for |\CT@drs@|.
% \begin{macrocode}
\cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } }
- \cs_set:Npn\CT@drs #1 #2
+ \cs_set:Npn \CT@drs #1 #2
{
\dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
{ \cs_gset:Npn \CT@drsc@ { \color #1 { #2 } } }
@@ -6086,24 +6120,51 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{macrocode}
-\cs_new_protected:Npn \@@_set_CT@arc@:
- { \peek_meaning:NTF [ \@@_set_CT@arc@_i: \@@_set_CT@arc@_ii: }
-\cs_new_protected:Npn \@@_set_CT@arc@_i: [ #1 ] #2 \q_stop
- { \cs_set:Npn \CT@arc@ { \color [ #1 ] { #2 } } }
-\cs_new_protected:Npn \@@_set_CT@arc@_ii: #1 \q_stop
- { \cs_set:Npn \CT@arc@ { \color { #1 } } }
+\cs_new_protected:Npn \@@_set_CT@arc@:n #1
+ {
+ \tl_if_blank:nF { #1 }
+ {
+ \tl_if_head_eq_meaning:nNTF { #1 } [
+ { \cs_set:Npn \CT@arc@ { \color #1 } }
+ { \cs_set:Npn \CT@arc@ { \color { #1 } } }
+ }
+ }
+\cs_generate_variant:Nn \@@_set_CT@arc@:n { V }
% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
-\cs_new_protected:Npn \@@_set_CT@drsc@:
- { \peek_meaning:NTF [ \@@_set_CT@drsc@_i: \@@_set_CT@drsc@_ii: }
-\cs_new_protected:Npn \@@_set_CT@drsc@_i: [ #1 ] #2 \q_stop
- { \cs_set:Npn \CT@drsc@ { \color [ #1 ] { #2 } } }
-\cs_new_protected:Npn \@@_set_CT@drsc@_ii: #1 \q_stop
- { \cs_set:Npn \CT@drsc@ { \color { #1 } } }
+\cs_new_protected:Npn \@@_set_CT@drsc@:n #1
+ {
+ \tl_if_head_eq_meaning:nNTF { #1 } [
+ { \cs_set:Npn \CT@drsc@ { \color #1 } }
+ { \cs_set:Npn \CT@drsc@ { \color { #1 } } }
+ }
+\cs_generate_variant:Nn \@@_set_CT@drsc@:n { V }
% \end{macrocode}
%
+% \bigskip
+% The following command must \emph{not} be protected since it will be used to
+% write instructions in the (internal) |\CodeBefore|.
+% \begin{macrocode}
+\cs_new:Npn \@@_exp_color_arg:Nn #1 #2
+ {
+ \tl_if_head_eq_meaning:nNTF { #2 } [
+ { #1 #2 }
+ { #1 { #2 } }
+ }
+\cs_generate_variant:Nn \@@_exp_color_arg:Nn { N V }
+% \end{macrocode}
+%
+% The following command must be protected because of its use of the command |\color|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_color:n #1
+ {
+ \tl_if_blank:nF { #1 }
+ { \@@_exp_color_arg:Nn \color { #1 } }
+ }
+\cs_generate_variant:Nn \@@_color:n { V }
+% \end{macrocode}
%
% \bigskip
% \begin{macrocode}
@@ -6266,7 +6327,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% Idem pour the mono-row blocks.
+% Idem for the mono-row blocks.
% \begin{macrocode}
\dim_new:N \g_@@_blocks_ht_dim
\dim_new:N \g_@@_blocks_dp_dim
@@ -6304,9 +6365,9 @@ version 2005/12/01 or later.
%
% \bigskip
% If the user uses |{NiceArray}| or |{NiceTabular}| the flag
-% |\l_@@_NiceArray_bool| will be raised.
+% |\g_@@_NiceArray_bool| will be raised.
% \begin{macrocode}
-\bool_new:N \l_@@_NiceArray_bool
+\bool_new:N \g_@@_NiceArray_bool
% \end{macrocode}
% In fact, if there is delimiters in the preamble of |{NiceArray}| (eg:
% |[cccc]|), this boolean will be set to false.
@@ -6362,7 +6423,20 @@ version 2005/12/01 or later.
\tl_new:N \g_@@_aux_tl
% \end{macrocode}
%
-%
+% \bigskip
+% The following parameter corresponds to the key |columns-type| of the
+% environments |{NiceMatrix}|, |{pNiceMatrix}|, etc. and also the key
+% |matrix / columns-type| of |\NiceMatrixOptions|. However, it does \emph{not}
+% contain the value provided by the final user. Indeed, a transformation is done
+% in order to have a preamble (for the package \pkg{array}) which is
+% nicematrix-aware. That transformation is done with the command
+% |\@@_set_preamble:Nn|.
+% \begin{macrocode}
+\tl_new:N \l_@@_columns_type_tl
+\hook_gput_code:nnn { begindocument } { . }
+ { \@@_set_preamble:Nn \l_@@_columns_type_tl { c } }
+% \end{macrocode}
+%
% \bigskip
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_math_mode:
@@ -6513,6 +6587,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\bool_new:N \g_@@_row_of_col_done_bool
% \end{macrocode}
+%
%
% \bigskip
% It's possible to use the command |\NotEmpty| to specify explicitely that a
@@ -6707,7 +6782,8 @@ version 2005/12/01 or later.
% |corners| is used).
%
% \medskip
-% The following token list correspond to the key |color| of the command |\Block|.
+% The following token list correspond to the key |color| of the command |\Block|
+% and also the key |color| of the command |\RowStyle|.
% \begin{macrocode}
\tl_new:N \l_@@_color_tl
% \end{macrocode}
@@ -7034,15 +7110,10 @@ version 2005/12/01 or later.
% |\g_@@_tabularnotes_seq| will be cleared at the end of the environment of
% \pkg{nicematrix} (and not at the beginning).
%
-% Unfortunately, if the package \pkg{caption} is loaded, the command |\caption|
-% evaluates its argument twice and since it is not aware (of course) of
-% |\tabularnote|, the command |\tabularnote| is, in fact, not usable in
-% |\caption| when \pkg{caption} is loaded.\footnote{We should try to find a
-% solution to that problem.}
% \begin{macrocode}
\NewDocumentCommand \tabularnote { m }
{
- \bool_if:nTF { ! \l_@@_NiceArray_bool && \l_@@_in_env_bool }
+ \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool }
{ \@@_error:n { tabularnote~forbidden } }
{
% \end{macrocode}
@@ -7502,7 +7573,8 @@ version 2005/12/01 or later.
color .tl_set:N = \l_@@_rules_color_tl ,
color .value_required:n = true ,
width .dim_set:N = \arrayrulewidth ,
- width .value_required:n = true
+ width .value_required:n = true ,
+ unknown .code:n = \@@_error:n { Unknown~key~for~rules }
}
% \end{macrocode}
%
@@ -7820,9 +7892,11 @@ version 2005/12/01 or later.
allow-duplicate-names .value_forbidden:n = true ,
notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } ,
notes .value_required:n = true ,
- sub-matrix .code:n =
- \keys_set:nn { NiceMatrix / sub-matrix } { #1 } ,
+ sub-matrix .code:n = \keys_set:nn { NiceMatrix / sub-matrix } { #1 } ,
sub-matrix .value_required:n = true ,
+ matrix / columns-type .code:n =
+ \@@_set_preamble:Nn \l_@@_columns_type_tl { #1 },
+ matrix / columns-type .value_required:n = true ,
unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrixOptions }
}
% \end{macrocode}
@@ -7852,8 +7926,10 @@ version 2005/12/01 or later.
\int_set:Nn \l_@@_last_col_int { -1 }
}
{ \int_set:Nn \l_@@_last_col_int { #1 } } ,
- l .code:n = \tl_set:Nn \l_@@_type_of_col_tl l ,
- r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
+ columns-type .code:n = \@@_set_preamble:Nn \l_@@_columns_type_tl { #1 } ,
+ columns-type .value_required:n = true ,
+ l .meta:n = { columns-type = l } ,
+ r .meta:n = { columns-type = r } ,
small .bool_set:N = \l_@@_small_bool ,
small .value_forbidden:n = true ,
unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrix }
@@ -8329,7 +8405,7 @@ version 2005/12/01 or later.
%
%
% \begin{macrocode}
-\cs_new_protected:Npn \@@_array:
+\cs_new_protected:Npn \@@_array:n
{
\bool_if:NTF \l_@@_NiceTabular_bool
{ \dim_set_eq:NN \col@sep \tabcolsep }
@@ -8350,6 +8426,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
[ \str_if_eq:VnTF \l_@@_baseline_tl c c t ]
}
+\cs_generate_variant:Nn \@@_array:n { V }
% \end{macrocode}
%
% \medskip
@@ -8768,7 +8845,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% If there is a exterior row, we patch a command used in |\@@_cell_begin:w| in order to
+% If there is an exterior row, we patch a command used in |\@@_cell_begin:w| in order to
% keep track of some dimensions needed to the construction of that ``last row''.
% \begin{macrocode}
\int_compare:nNnT \l_@@_last_row_int > { -2 }
@@ -8834,21 +8911,14 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
-% \bigskip
-% The preamble will be constructed in |\g_@@_preamble_tl|.
-% \begin{macrocode}
- \@@_construct_preamble:
-% \end{macrocode}
-% Now, the preamble is constructed in |\g_@@_preamble_tl|
-%
% \medskip
-% We compute the width of both delimiters. We remember that, when the
+% We compute the width of both delimiters. We remind that, when the
% environment |{NiceArray}| is used, it's possible to specify the delimiters in
% the preamble (eg |[ccc]|).
% \begin{macrocode}
\dim_zero_new:N \l_@@_left_delim_dim
\dim_zero_new:N \l_@@_right_delim_dim
- \bool_if:NTF \l_@@_NiceArray_bool
+ \bool_if:NTF \g_@@_NiceArray_bool
{
\dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep }
\dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep }
@@ -9306,7 +9376,7 @@ version 2005/12/01 or later.
% of |{NiceArray}| (|{pNiceArray}|, |{bNiceArray}|, etc.) because, for
% |{NiceArray}|, we have the options |t|, |c|, |b| and |baseline|.
% \begin{macrocode}
- \bool_if:NTF \l_@@_NiceArray_bool
+ \bool_if:NTF \g_@@_NiceArray_bool
{ \keys_set:nn { NiceMatrix / NiceArray } }
{ \keys_set:nn { NiceMatrix / pNiceArray } }
{ #3 , #5 }
@@ -9314,8 +9384,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{macrocode}
- \tl_if_empty:NF \l_@@_rules_color_tl
- { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
+ \@@_set_CT@arc@:V \l_@@_rules_color_tl
% \end{macrocode}
%
% \bigskip
@@ -9331,8 +9400,9 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% Now, the second part of the environment |{NiceArrayWithDelims}|.
% \begin{macrocode}
- {
+ {
\bool_if:NTF \l_@@_light_syntax_bool
{ \use:c { end @@-light-syntax } }
{ \use:c { end @@-normal-syntax } }
@@ -9357,7 +9427,7 @@ version 2005/12/01 or later.
% Now, if there is at least one |X|-column in the environment, we compute the
% width that those columns will have (in the next compilation). In fact,
% |l_@@_X_columns_dim| will be the width of a column of weight $1$. For a
-% |X|-column of weight~$n$, the width will be |l_@@_X_columns_dim| multiplied
+% |X|-column of weight~$n$, the width will be |\l_@@_X_columns_dim| multiplied
% by~$n$.
% \begin{macrocode}
\int_compare:nNnT \g_@@_total_X_weight_int > 0
@@ -9443,13 +9513,13 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% The construction of the real box is different when |\l_@@_NiceArray_bool| is
+% The construction of the real box is different when |\g_@@_NiceArray_bool| is
% true (|{NiceArray}| or |{NiceTabular}|) and in the other environments because,
% in |{NiceArray}| or |{NiceTabular}|, we have no delimiter to put (but we have
% tabular notes to put). We begin with this case.
%
% \begin{macrocode}
- \bool_if:NTF \l_@@_NiceArray_bool
+ \bool_if:NTF \g_@@_NiceArray_bool
{
\str_case:VnF \l_@@_baseline_tl
{
@@ -9492,15 +9562,13 @@ version 2005/12/01 or later.
\hbox_set:Nn \l_tmpa_box
{
\c_math_toggle_token
- \tl_if_empty:NF \l_@@_delimiters_color_tl
- { \color { \l_@@_delimiters_color_tl } }
+ \@@_color:V \l_@@_delimiters_color_tl
\exp_after:wN \left \g_@@_left_delim_tl
\vcenter
{
% \end{macrocode}
% We take into account the ``first row'' (we have previously computed its total
-% height in |\l_tmpa_dim|). The |\hbox:n| (or |\hbox|) is necessary here. There
-% was a bug in the following line (corrected the 2021/11/23).
+% height in |\l_tmpa_dim|). The |\hbox:n| (or |\hbox|) is necessary here.
% \begin{macrocode}
\skip_vertical:n { -\l_tmpa_dim - \arrayrulewidth }
\hbox
@@ -9515,8 +9583,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
% We take into account the ``last row'' (we have previously computed its total
-% height in |\l_tmpb_dim|). There was a bug in the following line (corrected the
-% 2021/11/23).
+% height in |\l_tmpb_dim|).
% \begin{macrocode}
\skip_vertical:n { -\l_tmpb_dim + \arrayrulewidth }
}
@@ -9525,8 +9592,7 @@ version 2005/12/01 or later.
% Otherwise, with XeLaTeX (and not with the other engines), the closing
% delimiter is not colored.
% \begin{macrocode}
- \tl_if_empty:NF \l_@@_delimiters_color_tl
- { \color { \l_@@_delimiters_color_tl } }
+ \@@_color:V \l_@@_delimiters_color_tl
\exp_after:wN \right \g_@@_right_delim_tl
\c_math_toggle_token
}
@@ -9558,12 +9624,14 @@ version 2005/12/01 or later.
\bool_if:NF \l_@@_Matrix_bool
{
\int_compare:nNnT \c@jCol < \g_@@_static_num_of_col_int
- { \@@_error:n { columns~not~used } }
+ {
+ \@@_error:n { columns~not~used }
+ \group_begin:
+ \globaldefs = 1
+ \@@_msg_redirect_name:nn { columns~not~used } { none }
+ \group_end:
+ }
}
- \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,
@@ -9597,14 +9665,19 @@ version 2005/12/01 or later.
% \vspace{1cm}
% \subsection*{We construct the preamble of the array}
%
-% The transformation of the preamble is an operation in several steps.
+% \bigskip
+% The transformation of the preamble is an operation in several
+% steps.\footnote{Be careful: the transformation of the preamble may also have
+% by-side effects, for example, the boolean |\g_@@_NiceArray_bool| will be set
+% to |false| if we detect in the preamble a delimiter at the beginning or at the
+% end.}
%
% \bigskip
% The preamble given by the final user is in |\g_@@_preamble_tl| and the modified
% version will be stored in |\g_@@_preamble_tl| also.
%
% \begin{macrocode}
-\cs_new_protected:Npn \@@_construct_preamble:
+\cs_new_protected:Npn \@@_transform_preamble:
{
% \end{macrocode}
% First, we will do an ``expansion'' of the preamble with the tools of the
@@ -9633,31 +9706,31 @@ version 2005/12/01 or later.
% the end).
% \begin{macrocode}
\bool_if:NF \l_@@_Matrix_bool
- {
- \@@_newcolumntype w [ 2 ] { \@@_w: { ##1 } { ##2 } }
- \@@_newcolumntype W [ 2 ] { \@@_W: { ##1 } { ##2 } }
+ {
+ \@@_newcolumntype w [ 2 ] { \@@_w: { ##1 } { ##2 } }
+ \@@_newcolumntype W [ 2 ] { \@@_W: { ##1 } { ##2 } }
% \end{macrocode}
%
% \bigskip
% If the package \pkg{varwidth} has defined the column type |V|, we protect from
% expansion by redefining it to |\@@_V:| (which will be catched by our system).
% \begin{macrocode}
- \cs_if_exist:NT \NC@find@V { \@@_newcolumntype V { \@@_V: } }
+ \cs_if_exist:NT \NC@find@V { \@@_newcolumntype V { \@@_V: } }
% \end{macrocode}
%
% First, we have to store our preamble in the token register |\@temptokena|
% (those ``token registers'' are \emph{not} supported by the L3 programming layer).
% \begin{macrocode}
- \exp_args:NV \@temptokena \g_@@_preamble_tl
+ \exp_args:NV \@temptokena \g_@@_preamble_tl
% \end{macrocode}
% Initialisation of a flag used by \pkg{array} to detect the end of the expansion.
% \begin{macrocode}
- \@tempswatrue
+ \@tempswatrue
% \end{macrocode}
% The following line actually does the expansion (it's has been copied from
% |array.sty|). The expanded version is still in |\@temptokena|.
% \begin{macrocode}
- \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
+ \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
% \end{macrocode}
%
%
@@ -9670,24 +9743,24 @@ version 2005/12/01 or later.
% |\@@_patch_preamble:n|. In the same time, we will count the columns with the
% counter |\c@jCol|.
% \begin{macrocode}
- \int_gzero:N \c@jCol
- \tl_gclear:N \g_@@_preamble_tl
+ \int_gzero:N \c@jCol
+ \tl_gclear:N \g_@@_preamble_tl
% \end{macrocode}
% |\g_tmpb_bool| will be raised if you have a \verb+|+ at the end of the preamble.
% \begin{macrocode}
- \bool_gset_false:N \g_tmpb_bool
- \tl_if_eq:NnTF \l_@@_vlines_clist { all }
- {
- \tl_gset:Nn \g_@@_preamble_tl
- { ! { \skip_horizontal:N \arrayrulewidth } }
- }
- {
- \clist_if_in:NnT \l_@@_vlines_clist 1
- {
- \tl_gset:Nn \g_@@_preamble_tl
- { ! { \skip_horizontal:N \arrayrulewidth } }
- }
- }
+ \bool_gset_false:N \g_tmpb_bool
+ \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+ {
+ \tl_gset:Nn \g_@@_preamble_tl
+ { ! { \skip_horizontal:N \arrayrulewidth } }
+ }
+ {
+ \clist_if_in:NnT \l_@@_vlines_clist 1
+ {
+ \tl_gset:Nn \g_@@_preamble_tl
+ { ! { \skip_horizontal:N \arrayrulewidth } }
+ }
+ }
% \end{macrocode}
% The sequence |\g_@@_cols_vlsim_seq| will contain the numbers of the columns
% where you will to have to draw vertical lines in the potential sub-matrices
@@ -9732,9 +9805,9 @@ version 2005/12/01 or later.
% environment |{NiceArray}| is transformed into an environment |{xNiceMatrix}|.
% \begin{macrocode}
\bool_lazy_or:nnT
- { ! \str_if_eq_p:Vn \g_@@_left_delim_tl { . } }
- { ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } }
- { \bool_set_false:N \l_@@_NiceArray_bool }
+ { ! \str_if_eq_p:Vn \g_@@_left_delim_tl { . } }
+ { ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } }
+ { \bool_gset_false:N \g_@@_NiceArray_bool }
% \end{macrocode}
%
% \medskip
@@ -9751,7 +9824,7 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- \l_@@_NiceArray_bool
+ \g_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -9763,7 +9836,7 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- \l_@@_NiceArray_bool
+ \g_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -10273,7 +10346,7 @@ version 2005/12/01 or later.
{
% \end{macrocode}
% We test whether the version of \pkg{nicematrix} is at least 3.0. We will
-% change de programmation of the test further with something like |\@ifpackagelater|.
+% change the programmation of the test further with something like |\@ifpackagelater|.
%
% \begin{macrocode}
\cs_if_exist:NTF \siunitx_cell_begin:w
@@ -10552,6 +10625,18 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_preamble:Nn #1 #2
+ {
+ \@temptokena { #2 }
+ \@tempswatrue
+ \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
+ \tl_gclear:N \g_@@_preamble_tl
+ \exp_after:wN \@@_patch_m_preamble:n \the \@temptokena \q_stop
+ \tl_set_eq:NN #1 \g_@@_preamble_tl
+ }
+% \end{macrocode}
%
% \bigskip
% \subsection*{The redefinition of \textbackslash multicolumn}
@@ -10771,29 +10856,13 @@ version 2005/12/01 or later.
%
%
% After a specifier of column, we have to test whether there is one or several
-% |<{..}| because, after those potential |<{...}|, we have to insert
-% |!{\skip_horizontal:N ...}| when the key |vlines| is used.
+% |<{..}|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_m_preamble_x:n #1
{
\str_if_eq:nnTF { #1 } { < }
\@@_patch_m_preamble_ix:n
- {
- \tl_if_eq:NnTF \l_@@_vlines_clist { all }
- {
- \tl_gput_right:Nn \g_@@_preamble_tl
- { ! { \skip_horizontal:N \arrayrulewidth } }
- }
- {
- \exp_args:NNx
- \clist_if_in:NnT \l_@@_vlines_clist { \int_eval:n { \c@jCol + 1 } }
- {
- \tl_gput_right:Nn \g_@@_preamble_tl
- { ! { \skip_horizontal:N \arrayrulewidth } }
- }
- }
- \@@_patch_m_preamble:n { #1 }
- }
+ { \@@_patch_m_preamble:n { #1 } }
}
% \end{macrocode}
%
@@ -10896,7 +10965,7 @@ version 2005/12/01 or later.
% that's why we can't put |@{}| at the end of the preamble. That's why we remove
% a |\arraycolsep| now.
% \begin{macrocode}
- \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ \bool_lazy_and:nnT \l_@@_Matrix_bool \g_@@_NiceArray_bool
{
\box_set_wd:Nn \l_@@_the_array_box
{ \box_wd:N \l_@@_the_array_box - \arraycolsep }
@@ -11146,11 +11215,14 @@ version 2005/12/01 or later.
{
\peek_meaning:NTF \end
\@@_analyze_end:Nn
+ {
+ \@@_transform_preamble:
% \end{macrocode}
-% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
+% Here is the call to |\array| (we have a dedicated macro |\@@_array:n| because
% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
% \begin{macrocode}
- { \exp_args:NV \@@_array: \g_@@_preamble_tl }
+ \@@_array:V \g_@@_preamble_tl
+ }
}
}
{
@@ -11162,7 +11234,7 @@ version 2005/12/01 or later.
%
% \bigskip
% When the key |light-syntax| is in force, we use an environment which takes its
-% whole body as an argument (with the specifier |b| of \pkg{xparse}).
+% whole body as an argument (with the specifier |b|).
% % \label{code-light-syntax}
% \begin{macrocode}
\NewDocumentEnvironment { @@-light-syntax } { b }
@@ -11189,75 +11261,127 @@ version 2005/12/01 or later.
% be set to \textsl{no-op} before the execution of
% |\g_nicematrix_code_after_tl|.
% \begin{macrocode}
- \@@_light_syntax_i #1 \CodeAfter \q_stop
+ \@@_light_syntax_i:w #1 \CodeAfter \q_stop
+% \end{macrocode}
+% The command |\array| is hidden somewhere in |\@@_light_syntax_i:w|.
+% \begin{macrocode}
}
% \end{macrocode}
-% Now, the second part of the environment. It is empty. That's not surprising
-% because we have caught the whole body of the environment with the specifier
-% |b| provided by \pkg{xparse}.
+% Now, the second part of the environment. We must leave these lines in the
+% second part (and not put them in the first part even though we caught the
+% whole body of the environment with an argument of type |b|) in order to have
+% the columns |S| of \pkg{siunitx} working fine.
% \begin{macrocode}
- { }
+ {
+ \@@_create_col_nodes:
+ \endarray
+ }
% \end{macrocode}
%
%
% \begin{macrocode}
-\cs_new_protected:Npn \@@_light_syntax_i #1\CodeAfter #2\q_stop
+\cs_new_protected:Npn \@@_light_syntax_i:w #1\CodeAfter #2\q_stop
{
\tl_gput_right:Nn \g_nicematrix_code_after_tl { #2 }
% \end{macrocode}
% The body of the array, which is stored in the argument |#1|, is now
% splitted into items (and \emph{not} tokens).
% \begin{macrocode}
- \seq_gclear_new:N \g_@@_rows_seq
+ \seq_clear_new:N \l_@@_rows_seq
+% \end{macrocode}
+% We rescan the character of end of line in order to have the correct catcode.
+% \begin{macrocode}
\tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl
- \seq_gset_split:NVn \g_@@_rows_seq \l_@@_end_of_row_tl { #1 }
+ \seq_set_split:NVn \l_@@_rows_seq \l_@@_end_of_row_tl { #1 }
+% \end{macrocode}
+% We delete the last row if it is empty.
+% \begin{macrocode}
+ \seq_pop_right:NN \l_@@_rows_seq \l_tmpa_tl
+ \tl_if_empty:NF \l_tmpa_tl
+ { \seq_put_right:NV \l_@@_rows_seq \l_tmpa_tl }
% \end{macrocode}
% If the environment uses the option |last-row| without value (i.e. without
-% saying the number of the rows), we have now the opportunity to know that
+% saying the number of the rows), we have now the opportunity to compute that
% value. We do it, and so, if the token list |\l_@@_code_for_last_row_tl| is not
% empty, we will use directly where it should be.
% \begin{macrocode}
\int_compare:nNnT \l_@@_last_row_int = { -1 }
- { \int_set:Nn \l_@@_last_row_int { \seq_count:N \g_@@_rows_seq } }
+ { \int_set:Nn \l_@@_last_row_int { \seq_count:N \l_@@_rows_seq } }
% \end{macrocode}
-% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
-% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
+%
+%
+% \bigskip
+% The new value of the body (that is to say after replacement of the separators
+% of rows and columns by |\\| and |&|) of the environment will be stored in
+% |\l_@@_new_body_tl| (that part of the implementation has been changed in the
+% version 6.11 of \pkg{nicematrix} in order to allow the use of commands such as
+% |\hline| or |\hdottedline| with the key |light-syntax|).
% \begin{macrocode}
- \exp_args:NV \@@_array: \g_@@_preamble_tl
+ \tl_clear_new:N \l_@@_new_body_tl
+ \int_zero_new:N \l_@@_nb_cols_int
% \end{macrocode}
-% We need a global affectation because, when executing |\l_tmpa_tl|, we will
-% exit the first cell of the array.
+% First, we treat the first row.
% \begin{macrocode}
- \seq_gpop_left:NN \g_@@_rows_seq \l_tmpa_tl
- \@@_line_with_light_syntax_i:V \l_tmpa_tl
- \seq_map_function:NN \g_@@_rows_seq \@@_line_with_light_syntax:n
- \@@_create_col_nodes:
- \endarray
- }
+ \seq_pop_left:NN \l_@@_rows_seq \l_tmpa_tl
+ \@@_line_with_light_syntax:V \l_tmpa_tl
% \end{macrocode}
-%
+% Now, the other rows (with the same treatment, excepted that we have to insert
+% |\\| between the rows).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
- { \tl_if_empty:nF { #1 } { \\ \@@_line_with_light_syntax_i:n { #1 } } }
+ \seq_map_inline:Nn \l_@@_rows_seq
+ {
+ \tl_put_right:Nn \l_@@_new_body_tl { \\ }
+ \@@_line_with_light_syntax:n { ##1 }
+ }
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new_protected:Npn \@@_line_with_light_syntax_i:n #1
+ \int_compare:nNnT \l_@@_last_col_int = { -1 }
+ {
+ \int_set:Nn \l_@@_last_col_int
+ { \l_@@_nb_cols_int - 1 + \l_@@_first_col_int }
+ }
+% \end{macrocode}
+%
+% Now, we can construct the preamble: if the user has used the key |last-col|,
+% we have the correct number of columns even though the user has used |last-col|
+% without value.
+% \begin{macrocode}
+ \@@_transform_preamble:
+% \end{macrocode}
+%
+% The call to |\array| is in the following command (we have a dedicated macro
+% |\@@_array:n| because of compatibility with the classes \cls{revtex4-1} and
+% \cls{revtex4-2}).
+% \begin{macrocode}
+ \@@_array:V \g_@@_preamble_tl \l_@@_new_body_tl
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
{
- \seq_gclear_new:N \g_@@_cells_seq
- \seq_gset_split:Nnn \g_@@_cells_seq { ~ } { #1 }
- \seq_gpop_left:NN \g_@@_cells_seq \l_tmpa_tl
- \l_tmpa_tl
- \seq_map_inline:Nn \g_@@_cells_seq { & ##1 }
+ \seq_clear_new:N \l_@@_cells_seq
+ \seq_set_split:Nnn \l_@@_cells_seq { ~ } { #1 }
+ \int_set:Nn \l_@@_nb_cols_int
+ {
+ \int_max:nn
+ \l_@@_nb_cols_int
+ { \seq_count:N \l_@@_cells_seq }
+ }
+ \seq_pop_left:NN \l_@@_cells_seq \l_tmpa_tl
+ \tl_put_right:NV \l_@@_new_body_tl \l_tmpa_tl
+ \seq_map_inline:Nn \l_@@_cells_seq
+ { \tl_put_right:Nn \l_@@_new_body_tl { & ##1 } }
}
-\cs_generate_variant:Nn \@@_line_with_light_syntax_i:n { V }
+\cs_generate_variant:Nn \@@_line_with_light_syntax:n { V }
% \end{macrocode}
%
%
% \bigskip
% The following command is used by the code which detects whether the
% environment is empty (we raise a fatal error in this case: it's only a
-% security).
+% security). When this command is used, |#1| is, in fact, always |\end|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2
{
@@ -11444,7 +11568,7 @@ version 2005/12/01 or later.
\int_gincr:N \g_tmpa_int
\bool_lazy_all:nT
{
- \l_@@_NiceArray_bool
+ \g_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \clist_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -11462,13 +11586,13 @@ version 2005/12/01 or later.
% that's why we can't put |@{}| at the end of the preamble. That's why we remove
% a |\arraycolsep| now.
% \begin{macrocode}
- \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ \bool_lazy_and:nnT \l_@@_Matrix_bool \g_@@_NiceArray_bool
{ \skip_horizontal:N -\arraycolsep }
\pgfsys@markposition
{ \@@_env: - col - \int_eval:n {
\g_tmpa_int + 1 } }
\skip_horizontal:N 0.5\arrayrulewidth
- \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ \bool_lazy_and:nnT \l_@@_Matrix_bool \g_@@_NiceArray_bool
{ \skip_horizontal:N \arraycolsep }
}
}
@@ -11476,7 +11600,7 @@ version 2005/12/01 or later.
\pgfrememberpicturepositiononpagetrue
\pgfcoordinate { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } }
{
- \bool_lazy_and:nnTF \l_@@_Matrix_bool \l_@@_NiceArray_bool
+ \bool_lazy_and:nnTF \l_@@_Matrix_bool \g_@@_NiceArray_bool
{
\pgfpoint
{ - 0.5 \arrayrulewidth - \arraycolsep }
@@ -11683,19 +11807,19 @@ version 2005/12/01 or later.
%
% \interitem
% The environment |{NiceArray}| is constructed upon the environment
-% |{NiceArrayWithDelims}| but, in fact, there is a flag |\l_@@_NiceArray_bool|.
+% |{NiceArrayWithDelims}| but, in fact, there is a flag |\g_@@_NiceArray_bool|.
% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is
% raised.
% \begin{macrocode}
\NewDocumentEnvironment { NiceArray } { }
{
- \bool_set_true:N \l_@@_NiceArray_bool
+ \bool_gset_true:N \g_@@_NiceArray_bool
\str_if_empty:NT \g_@@_name_env_str
{ \str_gset:Nn \g_@@_name_env_str { NiceArray } }
% \end{macrocode}
% We put . and . for the delimiters but, in fact, that doesn't matter because
% these arguments won't be used in |{NiceArrayWithDelims}| (because the flag
-% |\l_@@_NiceArray_bool| is raised).
+% |\g_@@_NiceArray_bool| is raised).
% \begin{macrocode}
\NiceArrayWithDelims . .
}
@@ -11711,6 +11835,7 @@ version 2005/12/01 or later.
{
\NewDocumentEnvironment { #1 NiceArray } { }
{
+ \bool_gset_false:N \g_@@_NiceArray_bool
\str_if_empty:NT \g_@@_name_env_str
{ \str_gset:Nn \g_@@_name_env_str { #1 NiceArray } }
\@@_test_if_math_mode:
@@ -11732,7 +11857,7 @@ version 2005/12/01 or later.
% \bigskip
% \subsection*{The environment \{NiceMatrix\} and its variants}
%
-%
+%
% \begin{macrocode}
\cs_new_protected:Npn \@@_begin_of_NiceMatrix:nn #1 #2
{
@@ -11745,27 +11870,43 @@ version 2005/12/01 or later.
\c@MaxMatrixCols
{ \int_eval:n { \l_@@_last_col_int - 1 } }
}
- { > \@@_cell_begin:w #2 < \@@_cell_end: }
+ { #2 }
}
}
-\cs_generate_variant:Nn \@@_begin_of_NiceMatrix:nn { n e }
% \end{macrocode}
%
% \begin{macrocode}
-\clist_map_inline:nn { { } , p , b , B , v , V }
+\cs_generate_variant:Nn \@@_begin_of_NiceMatrix:nn { n V }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\clist_map_inline:nn { p , b , B , v , V }
{
\NewDocumentEnvironment { #1 NiceMatrix } { ! O { } }
{
+ \bool_gset_false:N \g_@@_NiceArray_bool
\str_gset:Nn \g_@@_name_env_str { #1 NiceMatrix }
- \tl_set:Nn \l_@@_type_of_col_tl c
\keys_set:nn { NiceMatrix / NiceMatrix } { ##1 }
- \@@_begin_of_NiceMatrix:ne { #1 } \l_@@_type_of_col_tl
+ \@@_begin_of_NiceMatrix:nV { #1 } \l_@@_columns_type_tl
}
{ \use:c { end #1 NiceArray } }
}
% \end{macrocode}
%
% \bigskip
+% We define also an environment |{NiceMatrix}|
+% \begin{macrocode}
+\NewDocumentEnvironment { NiceMatrix } { ! O { } }
+ {
+ \bool_gset_false:N \g_@@_NiceArray_bool
+ \str_gset:Nn \g_@@_name_env_str { NiceMatrix }
+ \keys_set:nn { NiceMatrix / NiceMatrix } { #1 }
+ \@@_begin_of_NiceMatrix:nV { } \l_@@_columns_type_tl
+ }
+ { \endNiceArray }
+% \end{macrocode}
+%
+% \bigskip
% The following command will be linked to |\NotEmpty| in the environments of
% \pkg{nicematrix}.
% \begin{macrocode}
@@ -12569,7 +12710,7 @@ version 2005/12/01 or later.
% \medskip
% |#1| and |#2| are the numbers of row and columns of the cell where the command
% of dotted line (ex.: |\Vdots|) has been issued. |#3|, |#4|, |#5| and |#6| are
-% the specification (in $i$ and $j$) of the submatrix where are analysing.
+% the specification (in $i$ and $j$) of the submatrix we are analyzing.
% \begin{macrocode}
\cs_set_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
{
@@ -14002,17 +14143,17 @@ version 2005/12/01 or later.
cell-space-top-limit = #1 ,
cell-space-bottom-limit = #1 ,
} ,
- color .tl_set:N = \l_tmpa_tl ,
+ color .tl_set:N = \l_@@_color_tl ,
color .value_required:n = true ,
bold .bool_set:N = \l_tmpa_bool ,
bold .default:n = true ,
bold .initial:n = false ,
nb-rows .code:n =
\str_if_eq:nnTF { #1 } { * }
- { \int_set_eq:NN \l_@@_key_nb_rows_int 500 }
+ { \int_set:Nn \l_@@_key_nb_rows_int { 500 } }
{ \int_set:Nn \l_@@_key_nb_rows_int { #1 } } ,
nb-rows .value_required:n = true ,
- rowcolor .tl_set:N = \l_@@_tmpc_tl ,
+ rowcolor .tl_set:N = \l_tmpa_tl ,
rowcolor .value_required:n = true ,
rowcolor .initial:n = ,
unknown .code:n = \@@_error:n { Unknown~key~for~RowStyle }
@@ -14023,22 +14164,25 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \@@_RowStyle:n { O { } m }
{
- \tl_clear:N \l_tmpa_tl
+ \group_begin:
+ \tl_clear:N \l_@@_color_tl
\int_set:Nn \l_@@_key_nb_rows_int 1
\keys_set:nn { NiceMatrix / RowStyle } { #1 }
% \end{macrocode}
% If the key |rowcolor| has been used.
% \begin{macrocode}
- \tl_if_empty:NF \l_@@_tmpc_tl
- {
+ \tl_if_empty:NF \l_tmpa_tl
+ {
% \end{macrocode}
% First, the end of the current row (we remind that |\RowStyle| applies to the
-% \emph{end} of the current row).
+% \emph{end} of the current row).
% \begin{macrocode}
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
- \@@_rectanglecolor
- { \l_@@_tmpc_tl }
+% \end{macrocode}
+% The command |\@@_exp_color_arg:NV| is \emph{fully expandable}.
+% \begin{macrocode}
+ \@@_exp_color_arg:NV \@@_rectanglecolor \l_tmpa_tl
{ \int_use:N \c@iRow - \int_use:N \c@jCol }
{ \int_use:N \c@iRow - * }
}
@@ -14049,8 +14193,7 @@ version 2005/12/01 or later.
{
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
- \@@_rowcolor
- { \l_@@_tmpc_tl }
+ \@@_exp_color_arg:NV \@@_rowcolor \l_tmpa_tl
{
\int_eval:n { \c@iRow + 1 }
- \int_eval:n { \c@iRow + \l_@@_key_nb_rows_int - 1 }
@@ -14091,12 +14234,15 @@ version 2005/12/01 or later.
}
}
% \end{macrocode}
-% |\l_tmpa_tl| is the value of the key |color| of |\RowStyle|.
+% |\l_@@_color_tl| is the value of the key |color| of |\RowStyle|.
% \begin{macrocode}
- \tl_if_empty:NF \l_tmpa_tl
+ \tl_if_empty:NF \l_@@_color_tl
{
\tl_gput_right:Nx \g_@@_row_style_tl
- { \mode_leave_vertical: \exp_not:N \color { \l_tmpa_tl } }
+ {
+ \mode_leave_vertical:
+ \@@_color:n { \l_@@_color_tl }
+ }
}
% \end{macrocode}
% |\l_tmpa_bool| is the value of the key |bold|.
@@ -14115,6 +14261,7 @@ version 2005/12/01 or later.
}
}
\tl_gput_right:Nn \g_@@_row_style_tl { \fi }
+ \group_end:
\g_@@_row_style_tl
\ignorespaces
}
@@ -14792,7 +14939,12 @@ version 2005/12/01 or later.
position .value_required:n = true ,
start .int_set:N = \l_@@_start_int ,
start .initial:n = 1 ,
- end .int_set:N = \l_@@_end_int ,
+ end .code:n =
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n { #1 } }
+ { \str_if_eq_p:nn { #1 } { last } }
+ { \int_set_eq:NN \l_@@_end_int \c@jCol }
+ { \int_set:Nn \l_@@_end_int { #1 } }
}
% \end{macrocode}
%
@@ -14812,9 +14964,9 @@ version 2005/12/01 or later.
dotted .bool_set:N = \l_@@_dotted_bool ,
dotted .initial:n = false ,
dotted .default:n = true ,
- color .code:n = \@@_set_CT@arc@: #1 \q_stop ,
+ color .code:n = \@@_set_CT@arc@:n { #1 } ,
color .value_required:n = true ,
- sep-color .code:n = \@@_set_CT@drsc@: #1 \q_stop ,
+ sep-color .code:n = \@@_set_CT@drsc@:n { #1 } ,
sep-color .value_required:n = true ,
% \end{macrocode}
% If the user uses the key |tikz|, the rule (or more precisely: the different
@@ -15073,11 +15225,11 @@ version 2005/12/01 or later.
{
\int_step_inline:nnn
{
- \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
1 2
}
{
- \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
{ \int_eval:n { \c@jCol + 1 } }
\c@jCol
}
@@ -15330,7 +15482,7 @@ version 2005/12/01 or later.
\int_compare:nNnT \l_@@_local_start_int = 1
{
\dim_sub:Nn \l_@@_x_initial_dim \l_@@_left_margin_dim
- \bool_if:NT \l_@@_NiceArray_bool
+ \bool_if:NT \g_@@_NiceArray_bool
{ \dim_sub:Nn \l_@@_x_initial_dim \arraycolsep }
% \end{macrocode}
% For reasons purely aesthetic, we do an adjustment in the case of a rounded
@@ -15345,7 +15497,7 @@ version 2005/12/01 or later.
\int_compare:nNnT \l_@@_local_end_int = \c@jCol
{
\dim_add:Nn \l_@@_x_final_dim \l_@@_right_margin_dim
- \bool_if:NT \l_@@_NiceArray_bool
+ \bool_if:NT \g_@@_NiceArray_bool
{ \dim_add:Nn \l_@@_x_final_dim \arraycolsep }
\tl_if_eq:NnF \g_@@_right_delim_tl )
{ \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_xdots_inter_dim } }
@@ -15389,11 +15541,11 @@ version 2005/12/01 or later.
{
\int_step_inline:nnn
{
- \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
1 2
}
{
- \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
{ \int_eval:n { \c@iRow + 1 } }
\c@iRow
}
@@ -15480,6 +15632,7 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_custom_line:n #1
{
\str_clear_new:N \l_@@_command_str
+ \str_clear_new:N \l_@@_ccommand_str
\str_clear_new:N \l_@@_letter_str
\keys_set_known:nnN { NiceMatrix / custom-line } { #1 } \l_@@_other_keys_tl
% \end{macrocode}
@@ -15490,25 +15643,28 @@ version 2005/12/01 or later.
% course, a definition of custom lines with no letter and no command would be point-less.
%
% \begin{macrocode}
- \bool_lazy_and:nnTF
- { \str_if_empty_p:N \l_@@_letter_str }
- { \str_if_empty_p:N \l_@@_command_str }
+ \bool_lazy_all:nTF
+ {
+ { \str_if_empty_p:N \l_@@_letter_str }
+ { \str_if_empty_p:N \l_@@_command_str }
+ { \str_if_empty_p:N \l_@@_ccommand_str }
+ }
{ \@@_error:n { No~letter~and~no~command } }
{ \exp_args:NV \@@_custom_line_i:n \l_@@_other_keys_tl }
}
% \end{macrocode}
%
%
-%
% \begin{macrocode}
\keys_define:nn { NiceMatrix / custom-line }
{
% here, we will use change in the future to use .str_set:N
letter .code:n = \str_set:Nn \l_@@_letter_str { #1 } ,
letter .value_required:n = true ,
- % here, we will use change in the future to use .str_set:N
command .code:n = \str_set:Nn \l_@@_command_str { #1 } ,
command .value_required:n = true ,
+ ccommand .code:n = \str_set:Nn \l_@@_ccommand_str { #1 } ,
+ ccommand .value_required:n = true ,
}
% \end{macrocode}
%
@@ -15566,6 +15722,7 @@ version 2005/12/01 or later.
}
}
\str_if_empty:NF \l_@@_command_str { \@@_h_custom_line:n { #1 } }
+ \str_if_empty:NF \l_@@_ccommand_str { \@@_c_custom_line:n { #1 } }
}
% \end{macrocode}
%
@@ -15632,8 +15789,9 @@ version 2005/12/01 or later.
%
% \bigskip
% The following command will create the command that the final user will use in
-% its array to draw an horizontal rule (hence the `|h|` in the name). |#1| is the
-% whole set of keys to pass to |\@@_line:n|.
+% its array to draw an horizontal rule (hence the `|h|` in the name) with the
+% full width of the array. |#1| is the whole set of keys to pass to the command
+% |\@@_hline:n| (which is in the internal |\CodeAfter|).
% \begin{macrocode}
\cs_new_protected:Npn \@@_h_custom_line:n #1
{
@@ -15662,6 +15820,59 @@ version 2005/12/01 or later.
}
\cs_generate_variant:Nn \@@_h_custom_line:nn { n V }
% \end{macrocode}
+%
+% \bigskip
+% \bigskip
+% The following command will create the command that the final user will use in
+% its array to draw an horizontal rule on only some of the columns of the array
+% (hence the letter |c| as in |\cline|). |#1| is the whole set of keys to pass
+% to the command |\@@_hline:n| (which is in the internal |\CodeAfter|).
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_c_custom_line:n #1
+ {
+% \end{macrocode}
+% Here, we need an expandable command since it begins with an |\noalign|.
+% \begin{macrocode}
+ \exp_args:Nc \NewExpandableDocumentCommand
+ { nicematrix - \l_@@_ccommand_str }
+ { O { } m }
+ {
+ \noalign
+ {
+ \@@_compute_rule_width:n { #1 , ##1 }
+ \skip_vertical:n { \l_@@_rule_width_dim }
+ \clist_map_inline:nn
+ { ##2 }
+ { \@@_c_custom_line_i:nn { #1 , ##1 } { ####1 } }
+ }
+ }
+ \seq_put_left:NV \l_@@_custom_line_commands_seq \l_@@_ccommand_str
+ }
+% \end{macrocode}
+% The first argument is the list of key-value pairs characteristic of the line.
+% The second argument is the specification of columns for the |\cline| with the
+% syntax $a$-$b$.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_c_custom_line_i:nn #1 #2
+ {
+ \str_if_in:nnTF { #2 } { - }
+ { \@@_cut_on_hyphen:w #2 \q_stop }
+ { \@@_cut_on_hyphen:w #2 - #2 \q_stop }
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ {
+ \@@_hline:n
+ {
+ #1 ,
+ start = \l_tmpa_tl ,
+ end = \l_tmpb_tl ,
+ position = \int_eval:n { \c@iRow + 1 } ,
+ total-width = \dim_use:N \l_@@_rule_width_dim
+ }
+ }
+ }
+\cs_generate_variant:Nn \@@_c_custom_line:nn { n V }
+% \end{macrocode}
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_compute_rule_width:n #1
@@ -15711,7 +15922,8 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
-\@@_custom_line:n { letter = : , command = hdottedline , dotted }
+\@@_custom_line:n
+ { letter = : , command = hdottedline , ccommand = cdottedline, dotted }
% \end{macrocode}
%
% \subsubsection*{The key hvlines}
@@ -16585,7 +16797,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_if_empty:NTF \l_@@_color_tl
{ \int_compare:nNnT { #2 } = 1 \set@color }
- { \color { \l_@@_color_tl } }
+ { \@@_color:V \l_@@_color_tl }
% \end{macrocode}
% If the block is mono-row, we use |\g_@@_row_style_tl| even if it has yet been
% used in the beginning of the cell where the command |\Block| has been issued
@@ -16806,7 +17018,9 @@ version 2005/12/01 or later.
draw .default:n = default ,
rounded-corners .dim_set:N = \l_@@_rounded_corners_dim ,
rounded-corners .default:n = 4 pt ,
- color .code:n = \color { #1 } \tl_set:Nn \l_@@_draw_tl { #1 } ,
+ color .code:n =
+ \@@_color:n { #1 }
+ \tl_set:Nn \l_@@_draw_tl { #1 } ,
color .value_required:n = true ,
borders .clist_set:N = \l_@@_borders_clist ,
borders .value_required:n = true ,
@@ -16996,17 +17210,12 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_if_empty:NF \l_@@_fill_tl
{
-% \end{macrocode}
-% The command |\@@_extract_brackets| will extract the potential specification of
-% color space at the beginning of |\l_@@_fill_tl| and store it in |\l_tmpa_tl|
-% and store the color itself in |\l_tmpb_tl|.
-% \begin{macrocode}
- \exp_last_unbraced:NV \@@_extract_brackets \l_@@_fill_tl \q_stop
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
\exp_not:N \roundedrectanglecolor
- [ \l_tmpa_tl ]
- { \exp_not:V \l_tmpb_tl }
+ \exp_args:NV \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [
+ { \l_@@_fill_tl }
+ { { \l_@@_fill_tl } }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
{ \dim_use:N \l_@@_rounded_corners_dim }
@@ -17332,16 +17541,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \bigskip
-% \begin{macrocode}
-\NewDocumentCommand \@@_extract_brackets { O { } }
- {
- \tl_set:Nn \l_tmpa_tl { #1 }
- \@@_store_in_tmpb_tl
- }
-\cs_new_protected:Npn \@@_store_in_tmpb_tl #1 \q_stop
- { \tl_set:Nn \l_tmpb_tl { #1 } }
-% \end{macrocode}
%
% % \bigskip
% The first argument of |\@@_stroke_block:nnn| is a list of options for the
@@ -17366,7 +17565,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\str_if_eq:VnTF \l_@@_draw_tl { default }
{ \CT@arc@ }
- { \exp_args:NV \pgfsetstrokecolor \l_@@_draw_tl }
+ { \@@_color:V \l_@@_draw_tl }
}
\pgfsetcornersarced
{
@@ -17670,14 +17869,16 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% We will extract the potential keys |l|, |r| and |c| and pass the other keys to
-% the environment |{NiceArrayWithDelims}|.
+% We will extract the potential keys |columns-type|, |l|, |c|, |r| and pass
+% the other keys to the environment |{NiceArrayWithDelims}|.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Auto }
{
- l .code:n = \tl_set:Nn \l_@@_type_of_col_tl l ,
- r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
- c .code:n = \tl_set:Nn \l_@@_type_of_col_tl c
+ columns-type .code:n = \@@_set_preamble:Nn \l_@@_columns_type_tl { #1 } ,
+ columns-type .value_required:n = true ,
+ l .meta:n = { columns-type = l } ,
+ r .meta:n = { columns-type = r } ,
+ c .meta:n = { columns-type = c }
}
% \end{macrocode}
%
@@ -17688,15 +17889,25 @@ version 2005/12/01 or later.
\int_zero_new:N \l_@@_nb_cols_int
\@@_set_size:n #4 \q_stop
% \end{macrocode}
-% The group is for the protection of |\l_@@_type_of_col_tl|.
+% The group is for the protection of the keys.
% \begin{macrocode}
\group_begin:
- \tl_set:Nn \l_@@_type_of_col_tl c
+ \bool_set_true:N \l_@@_Matrix_bool
\keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl
+% \end{macrocode}
+% We nullify the command |\@@_transform_preamble:| because we will provide a
+% preamble which is yet transformed (by using |\l_@@_columns_type_tl| which is
+% yet nicematrix-ready).
+%
+% \begin{macrocode}
+ \cs_set_eq:NN \@@_transform_preamble: \prg_do_nothing:
\use:x
{
\exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
- { * { \int_use:N \l_@@_nb_cols_int } { \l_@@_type_of_col_tl } }
+ {
+ * { \int_use:N \l_@@_nb_cols_int }
+ { \exp_not:V \l_@@_columns_type_tl }
+ }
[ \exp_not:V \l_tmpa_tl ]
}
\int_compare:nNnT \l_@@_first_row_int = 0
@@ -17733,6 +17944,7 @@ version 2005/12/01 or later.
{
\cs_set_protected:cpn { #1 AutoNiceMatrix }
{
+ \bool_gset_false:N \g_@@_NiceArray_bool
\str_gset:Nx \g_@@_name_env_str { #1 AutoNiceMatrix }
\AutoNiceMatrixWithDelims { #2 } { #3 }
}
@@ -17753,7 +17965,7 @@ version 2005/12/01 or later.
\NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } }
{
\group_begin:
- \bool_set_true:N \l_@@_NiceArray_bool
+ \bool_gset_true:N \g_@@_NiceArray_bool
\AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ]
\group_end:
}
@@ -18051,8 +18263,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\nullfont
\c_math_toggle_token
- \tl_if_empty:NF \l_@@_delimiters_color_tl
- { \color { \l_@@_delimiters_color_tl } }
+ \@@_color:V \l_@@_delimiters_color_tl
\bool_if:nTF { #3 } { \left #1 } { \left . }
\vcenter
{
@@ -18150,20 +18361,36 @@ version 2005/12/01 or later.
\NewDocumentCommand \@@_SubMatrix_in_code_before { m m m m ! O { } }
{
\peek_remove_spaces:n
- {
- \@@_cut_on_hyphen:w #3 \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
- \seq_gput_right:Nx \g_@@_submatrix_seq
- { { \l_tmpa_tl } { \l_tmpb_tl } { \l_@@_tmpc_tl } { \l_@@_tmpd_tl } }
+ {
\tl_gput_right:Nn \g_@@_internal_code_after_tl
{ \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] }
+ \@@_SubMatrix_in_code_before_i { #2 } { #3 }
}
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\NewDocumentCommand \@@_SubMatrix_in_code_before_i
+ { > { \SplitArgument { 1 } { - } } m > { \SplitArgument { 1 } { - } } m }
+ { \@@_SubMatrix_in_code_before_i:nnnn #1 #2 }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_SubMatrix_in_code_before_i:nnnn #1 #2 #3 #4
+ {
+ \seq_gput_right:Nx \g_@@_submatrix_seq
+ {
+% \end{macrocode}
+% We use |\str_if_eq:nnTF| because it is fully expandable.
+% \begin{macrocode}
+ { \str_if_eq:nnTF { #1 } { last } { \int_use:N \c@iRow } { #1 } }
+ { \str_if_eq:nnTF { #2 } { last } { \int_use:N \c@jCol } { #2 } }
+ { \str_if_eq:nnTF { #3 } { last } { \int_use:N \c@iRow } { #3 } }
+ { \str_if_eq:nnTF { #4 } { last } { \int_use:N \c@jCol } { #4 } }
+ }
+ }
+% \end{macrocode}
+%
%
% \bigskip
% In the internal |code-after| and in the |\CodeAfter| the following command
@@ -18189,7 +18416,7 @@ version 2005/12/01 or later.
\peek_remove_spaces:n
{
\@@_sub_matrix:nnnnnnn
- { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
+ { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
}
}
}
@@ -18200,26 +18427,26 @@ version 2005/12/01 or later.
% |\l_@@_last_i_tl| and |\l_@@_last_j_tl| from the arguments of the command as
% provided by the user (for example |2-3| and |5-last|).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_compute_i_j:nn #1 #2
+\NewDocumentCommand \@@_compute_i_j:nn
+ { > { \SplitArgument { 1 } { - } } m > { \SplitArgument { 1 } { - } } m }
+ { \@@_compute_i_j:nnnn #1 #2 }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_compute_i_j:nnnn #1 #2 #3 #4
{
- \tl_clear_new:N \l_@@_first_i_tl
- \tl_clear_new:N \l_@@_first_j_tl
- \tl_clear_new:N \l_@@_last_i_tl
- \tl_clear_new:N \l_@@_last_j_tl
- \@@_cut_on_hyphen:w #1 \q_stop
- \tl_if_eq:NnTF \l_tmpa_tl { last }
+ \tl_set:Nn \l_@@_first_i_tl { #1 }
+ \tl_set:Nn \l_@@_first_j_tl { #2 }
+ \tl_set:Nn \l_@@_last_i_tl { #3 }
+ \tl_set:Nn \l_@@_last_j_tl { #4 }
+ \tl_if_eq:NnT \l_@@_first_i_tl { last }
{ \tl_set:NV \l_@@_first_i_tl \c@iRow }
- { \tl_set_eq:NN \l_@@_first_i_tl \l_tmpa_tl }
- \tl_if_eq:NnTF \l_tmpb_tl { last }
+ \tl_if_eq:NnT \l_@@_first_j_tl { last }
{ \tl_set:NV \l_@@_first_j_tl \c@jCol }
- { \tl_set_eq:NN \l_@@_first_j_tl \l_tmpb_tl }
- \@@_cut_on_hyphen:w #2 \q_stop
- \tl_if_eq:NnTF \l_tmpa_tl { last }
+ \tl_if_eq:NnT \l_@@_last_i_tl { last }
{ \tl_set:NV \l_@@_last_i_tl \c@iRow }
- { \tl_set_eq:NN \l_@@_last_i_tl \l_tmpa_tl }
- \tl_if_eq:NnTF \l_tmpb_tl { last }
+ \tl_if_eq:NnT \l_@@_last_j_tl { last }
{ \tl_set:NV \l_@@_last_j_tl \c@jCol }
- { \tl_set_eq:NN \l_@@_last_j_tl \l_tmpb_tl }
}
% \end{macrocode}
%
@@ -18321,8 +18548,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\group_begin:
\pgfsetlinewidth { 1.1 \arrayrulewidth }
- \tl_if_empty:NF \l_@@_rules_color_tl
- { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
+ \@@_set_CT@arc@:V \l_@@_rules_color_tl
\CT@arc@
% \end{macrocode}
% Now, we draw the potential vertical rules specified in the preamble of the
@@ -18596,8 +18822,7 @@ version 2005/12/01 or later.
{
\nullfont
\c_math_toggle_token
- \tl_if_empty:NF \l_@@_delimiters_color_tl
- { \color { \l_@@_delimiters_color_tl } }
+ \@@_color:V \l_@@_delimiters_color_tl
\left #1
\vcenter
{
@@ -18628,8 +18853,7 @@ version 2005/12/01 or later.
{
\nullfont
\c_math_toggle_token
- \tl_if_empty:NF \l_@@_delimiters_color_tl
- { \color { \l_@@_delimiters_color_tl } }
+ \@@_color:V \l_@@_delimiters_color_tl
\left .
\vcenter
{
@@ -18923,12 +19147,6 @@ version 2005/12/01 or later.
% Of course, the command |\NiceMatrix| must be defined before such an
% instruction is executed.
%
-% \medskip
-% The boolean |\c_@@_messages_for_Overleaf_bool| corresponds to the key
-% |messages-for-Overleaf|.
-% \begin{macrocode}
-\bool_new:N \c_@@_messages_for_Overleaf_bool
-% \end{macrocode}
%
% \medskip
% The boolean |\g_@@_footnotehyper_bool| will indicate if the option
@@ -19137,7 +19355,7 @@ version 2005/12/01 or later.
you~try~to~use~more~columns~than~allowed~by~your~
\@@_full_name_env:.\@@_message_hdotsfor:\ Recall~that~the~maximal~
number~of~columns~for~a~matrix~is~fixed~by~the~LaTeX~counter~
- 'MaxMatrixCols'.~Its~actual~value~is~\int_use:N \c@MaxMatrixCols.~
+ 'MaxMatrixCols'.~Its~current~value~is~\int_use:N \c@MaxMatrixCols.~
This~error~is~fatal.
}
% \end{macrocode}
@@ -19176,7 +19394,8 @@ version 2005/12/01 or later.
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@jCol.\\
- The~columns~you~did~not~used~won't~be~created.
+ The~columns~you~did~not~used~won't~be~created.\\
+ We~won't~have~similar~error~till~the~end~of~the~document.
}
% \end{macrocode}
%
@@ -19242,7 +19461,16 @@ version 2005/12/01 or later.
is~'standard'.~That~key~will~be~ignored.
}
% \end{macrocode}
-%
+%
+% \begin{macrocode}
+\@@_msg_new:nn { Unknown~key~for~rules }
+ {
+ Unknown~key.\\
+ There~is~only~two~keys~available~here:~width~and~color.\\
+ You~key~'\l_keys_key_str'~will~be~ignored.
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~custom-line }
{
@@ -19404,8 +19632,8 @@ version 2005/12/01 or later.
{
Erroneous~use.\\
Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~
- key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~key~'command'~
- (to~draw~horizontal~rules).\\
+ key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~keys~'command'~or~
+ ~'ccommand'~(to~draw~horizontal~rules).\\
However,~you~can~go~on.
}
% \end{macrocode}
@@ -19723,7 +19951,8 @@ version 2005/12/01 or later.
{
siunitx~too~old.\\
You~can't~use~'S'~columns~because~your~version~of~'siunitx'~
- is~too~old.~You~need~at~least~v~3.0.\\
+ is~too~old.~You~need~at~least~v~3.0~and~your~log~file~says:~"siunitx,~
+ \use:c { ver @ siunitx.sty }". \\
This~error~is~fatal.
}
% \end{macrocode}
@@ -19865,6 +20094,7 @@ version 2005/12/01 or later.
last-row,~
left-margin,~
light-syntax,~
+ matrix/columns-type,~
notes~(several~subkeys),~
nullify-dots,~
renew-dots,~
@@ -19965,6 +20195,7 @@ version 2005/12/01 or later.
code-for-last-col,~
code-for-last-row,~
colortbl-like,~
+ columns-type,~
columns-width,~
corners,~
create-extra-nodes,~
@@ -20669,6 +20900,13 @@ version 2005/12/01 or later.
% It's possible to use |\line| in the |\CodeAfter| between two blocks (and not
% only two cells).
%
+% \subsection*{Changes between version 6.10 and 6.11}
+%
+% New key |matrix/columns-type| to spcecify the type of columns of the matrices.
+%
+% New key |ccommand| in |custom-line| and new command |\cdotteline|.
+%
+% \subsection*{Changes between version 6.11 and 6.12}
%
% \PrintIndex
%