diff options
author | Karl Berry <karl@freefriends.org> | 2021-07-16 19:57:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-07-16 19:57:34 +0000 |
commit | 7dae219cffdd41f06364c53711ced32311b69733 (patch) | |
tree | 7f163c4465942e3007af0bbe6e63e1a5965361a3 /Master/texmf-dist/source/latex | |
parent | 189cdddc0579b30df1ea73a5d8583a8c8ce7f66f (diff) |
nicematrix (16jul21)
git-svn-id: svn://tug.org/texlive/trunk@59952 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 345 |
1 files changed, 283 insertions, 62 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index f9ae880666d..fdaa5ac42a6 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{5.17a} -\def\myfiledate{2021/07/04} +\def\myfileversion{5.18} +\def\myfiledate{2021/07/15} % % %<*batchfile> @@ -27,7 +27,6 @@ \preamble - Copyright (C) 2018-2021 by F. Pantigny ----------------------------------- @@ -268,6 +267,8 @@ version 2005/12/01 or later. % % \section{The vertical space between the rows} % +% \label{cell-space} +% % It's well known that some rows of the arrays created by default with LaTeX % are, by default, too close to each other. Here is a classical example. % @@ -572,7 +573,7 @@ version 2005/12/01 or later. % \item the key |color| takes in as value a color and apply that color the % content of the block but draws also the frame of the block with that color; % \item the key |line-width| is the width (thickness) of the frame (this key -% should be used only when the key |draw| is in force); +% should be used only when the key |draw| or the key |hvlines| is in force); % \item the key |rounded-corners| requires rounded corners (for the frame drawn % by |draw| and the shape drawn by |fill|) with a radius equal to the value of % that key (the default value is 4~pt\footnote{This value is the initial value @@ -582,8 +583,7 @@ version 2005/12/01 or later. % by |left|, |right|, |top| and |bottom|; % \item the keys |t| and |b| fix the base line that will be given to the block % when it has a multi-line content (the lines are separated by |\\|); -% \item \colorbox{yellow!50}{\bfseries New 5.15}\enskip the keys |hvlines| draws -% all the vertical and horizontal rules in the block. +% \item the keys |hvlines| draws all the vertical and horizontal rules in the block. % \end{itemize} % % \interitem @@ -1319,9 +1319,8 @@ version 2005/12/01 or later. % colors. % % \medskip -% \colorbox{yellow!50}{\textbf{New 5.15}}\enskip These commands don't color the -% cells which are in the ``corners'' if the key |corners| is used. This key has -% been described p.~\pageref{corners}. +% These commands don't color the cells which are in the ``corners'' if the key +% |corners| is used. This key has been described p.~\pageref{corners}. % % \medskip % \begin{itemize} @@ -1724,6 +1723,38 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % +% \section{The command \textbackslash RowStyle} +% +% \label{RowStyle} +% +% \colorbox{yellow!50}{\bfseries New 5.18}\enskip The command |\RowStyle| takes +% in as argument some formatting intructions that will be applied to each cell +% on the rest of the current row. +% +% \medskip +% That command also takes in as optional argument (between square brackets) +% a list of key-value pairs. The available keys are |cell-space-top-limit|, +% |cell-space-bottom-limit| and |cell-space-limits| with the same meaning that +% the corresponding global keys (cf. p.~\pageref{cell-space}). +% +% \medskip +% \begin{BVerbatim}[boxwidth=11cm,baseline=c] +% \begin{NiceTabular}{cccc}[hlines,colortbl-like] +% ~emphase#\RowStyle[cell-space-limits=3pt]{\rotate}@ +% first & second & third & fourth \\ +% \rowcolor{blue!50}~emphase#\RowStyle{\color{white}\sffamily}@ +% 1 & 2 & 3 & 4 \\ +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{cccc}[hlines,colortbl-like] +% \RowStyle[cell-space-limits=3pt]{\rotate} +% first & second & third & fourth \\ +% \rowcolor{blue!50}\RowStyle{\color{white}\sffamily} +% 1 & 2 & 3 & 4 \\ +% \end{NiceTabular} +% +% \medskip +% The command |\rotate| is described p.~\pageref{rotate}. % % \section{The width of the columns} % \label{width} @@ -2637,6 +2668,33 @@ version 2005/12/01 or later. % \end{NiceArray}$ % % \bigskip +% \colorbox{yellow!50}{\bfseries New 5.18}\enskip In fact, the command +% |\SubMatrix| also takes in two optional arguments specified by the +% traditionnal symbols |^| and |_| for material in superscript and subscript. +% +% \medskip +% \begin{scope} +% \hfuzz=15cm +% \begin{BVerbatim}[boxwidth=11cm,baseline=c] +% $\begin{bNiceMatrix}[right-margin=1em] +% 1 & 1 & 1 \\ +% 1 & a & b \\ +% 1 & c & d +% \CodeAfter +% ~emphase#\SubMatrix[{2-2}{3-3}]^{T}@ +% \end{bNiceMatrix}$ +% \end{BVerbatim} +% $\begin{bNiceMatrix}[right-margin=1em] +% 1 & 1 & 1 \\ +% 1 & a & b \\ +% 1 & c & d +% \CodeAfter +% \SubMatrix[{2-2}{3-3}]^{T} +% \end{bNiceMatrix}$ +% \end{scope} +% +% +% \bigskip % The options of the command |\SubMatrix| are as follows: % \begin{itemize} % \item |left-xshift| and |right-shift| shift horizontally the delimiters (there @@ -2735,7 +2793,6 @@ version 2005/12/01 or later. % % % \bigskip -% \colorbox{yellow!50}{\textbf{New 5.15}}\enskip % It's also possible to specify some delimiters\footnote{Those delimiters are % \verb|(|, \verb|[|, |\{| and the closing ones. Of course, it's also % possible to put \verb+|+ and \verb+||+ in the preamble of the environement.} @@ -3147,11 +3204,15 @@ version 2005/12/01 or later. % % \subsection{The command \textbackslash rotate} % +% \label{rotate} +% % The package \pkg{nicematrix} provides a command |\rotate|. When used in the % beginning of a cell, this command composes the contents of the cell after a % rotation of 90° in the direct sens. % -% In the following command, we use that command in the |code-for-first-row|. +% In the following command, we use that command in the +% |code-for-first-row|.\footnote{It can also be used in \verb|RowStyle| +% (cf.~p.~\pageref{RowStyle}.} % %\bigskip % @@ -3378,6 +3439,9 @@ version 2005/12/01 or later. % 3 & 4 % \end{bNiceMatrix}$ % +% \medskip +% This colour alos applies to the delimiters drawn by the command |\SubMatrix| +% (cf.~p.~\pageref{sub-matrix}). % % \subsection{The environment \{NiceArrayWithDelims\}} % @@ -5147,7 +5211,9 @@ version 2005/12/01 or later. \AtBeginDocument { \@ifpackageloaded { colortbl } - { \bool_set_true:N \c_@@_colortbl_loaded_bool } + { + \bool_set_true:N \c_@@_colortbl_loaded_bool + } { % \end{macrocode} % The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of @@ -5164,7 +5230,6 @@ version 2005/12/01 or later. % \end{macrocode} % Idem for |\CT@drs@|. % \begin{macrocode} - \cs_set_protected:Npn \CT@drsc@ { } \cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } } \cs_set:Npn\CT@drs #1 #2 { @@ -5184,6 +5249,11 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% We need that line for the case where you use \verb+||+ with \pkg{colortbl} loaded. +% \begin{macrocode} +\cs_set_protected:Npn \CT@drsc@ { } +% \end{macrocode} % % \bigskip % We have to redefine |\cline| for several reasons. The command |\@@_cline| will @@ -5717,6 +5787,13 @@ version 2005/12/01 or later. \tl_new:N \l_@@_code_before_tl \bool_new:N \l_@@_code_before_bool % \end{macrocode} +% +% \bigskip +% The following token list will contain ce code inserted in each cell of the +% current row (this token list will be cleared at the beginning of each row). +% \begin{macrocode} +\tl_new:N \g_@@_row_style_tl +% \end{macrocode} % % \bigskip % The following dimensions will be used when drawing the dotted lines. @@ -6962,7 +7039,7 @@ version 2005/12/01 or later. r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r , small .bool_set:N = \l_@@_small_bool , small .value_forbidden:n = true , - unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } + unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrix } } % \end{macrocode} % @@ -6994,7 +7071,7 @@ version 2005/12/01 or later. tabularnote .value_required:n = true , r .code:n = \@@_error:n { r~or~l~with~preamble } , l .code:n = \@@_error:n { r~or~l~with~preamble } , - unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray } + unknown .code:n = \@@_error:n { Unknown~key~for~NiceArray } } % \end{macrocode} % @@ -7012,7 +7089,7 @@ version 2005/12/01 or later. small .value_forbidden:n = true , r .code:n = \@@_error:n { r~or~l~with~preamble } , l .code:n = \@@_error:n { r~or~l~with~preamble } , - unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } + unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrix } } % \end{macrocode} % @@ -7034,7 +7111,7 @@ version 2005/12/01 or later. \int_zero:N \l_@@_last_col_int , r .code:n = \@@_error:n { r~or~l~with~preamble } , l .code:n = \@@_error:n { r~or~l~with~preamble } , - unknown .code:n = \@@_error:n { Unknown~option~for~NiceTabular } + unknown .code:n = \@@_error:n { Unknown~key~for~NiceTabular } } % \end{macrocode} % @@ -7049,6 +7126,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Cell: { + \tl_gclear:N \g_@@_exit_cell_tl % \end{macrocode} % At the beginning of the cell, we link |\CodeAfter| to a command which do % \emph{not} begin with |\omit| (whereas the standard version of |\CodeAfter| @@ -7087,6 +7165,7 @@ version 2005/12/01 or later. % The codes |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the % corners of the matrix. % \begin{macrocode} + \g_@@_row_style_tl \int_compare:nNnTF \c@iRow = 0 { \int_compare:nNnT \c@jCol > 0 @@ -7112,6 +7191,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_begin_of_row: { + \tl_gclear:N \g_@@_row_style_tl \int_gincr:N \c@iRow \dim_gset_eq:NN \g_@@_dp_ante_last_row_dim \g_@@_dp_last_row_dim \dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \@arstrutbox } @@ -7205,6 +7285,7 @@ version 2005/12/01 or later. { \@@_math_toggle_token: \hbox_set_end: + \g_@@_exit_cell_tl \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: \@@_adjust_size_box: % \end{macrocode} @@ -7480,8 +7561,8 @@ version 2005/12/01 or later. \str_if_empty:NF \l_@@_name_str { \pgfnodealias - { \l_@@_name_str - row - \int_use:N \c@iRow } - { \@@_env: - row - \int_use:N \c@iRow } + { \l_@@_name_str - row - \@@_succ:n \c@iRow } + { \@@_env: - row - \@@_succ:n \c@iRow } } \endpgfpicture } @@ -7715,6 +7796,7 @@ version 2005/12/01 or later. \cs_set_eq:NN \CodeAfter \@@_CodeAfter: \cs_set_eq:NN \diagbox \@@_diagbox:nn \cs_set_eq:NN \NotEmpty \@@_NotEmpty: + \cs_set_eq:NN \RowStyle \@@_RowStyle:n \bool_if:NT \l_@@_colortbl_like_bool \@@_colortbl_like: \bool_if:NT \l_@@_renew_dots_bool \@@_renew_dots: % \end{macrocode} @@ -7954,8 +8036,49 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% \begin{macrocode} +\keys_define:nn { NiceMatrix / RowStyle } + { + cell-space-top-limit .code:n = + { + \tl_gput_right:Nn \g_@@_row_style_tl + { + \tl_gput_right:Nn \g_@@_exit_cell_tl + { \dim_set:Nn \l_@@_cell_space_top_limit_dim { #1 } } + } + } , + cell-space-top-limit .value_required:n = true , + cell-space-bottom-limit .code:n = + { + \tl_gput_right:Nn \g_@@_row_style_tl + { + \tl_gput_right:Nn \g_@@_exit_cell_tl + { \dim_set:Nn \l_@@_cell_space_bottom_limit_dim { #1 } } + } + } , + cell-space-bottom-limit .value_required:n = true , + cell-space-limits .meta:n = + { + cell-space-top-limit = #1 , + cell-space-bottom-limit = #1 , + } , + unknown .code:n = \@@_error:n { Unknown~key~for~RowStyle } + } +% \end{macrocode} % % \bigskip +% \begin{macrocode} +\NewDocumentCommand \@@_RowStyle:n { O { } m } + { + \tl_gset:Nn \g_@@_row_style_tl { #2 } + \keys_set:nn { NiceMatrix / RowStyle } { #1 } + #2 + \ignorespaces + } +% \end{macrocode} +% +% \bigskip % \subsection*{The \textbackslash CodeBefore} % % The following command will be executed if the |\CodeBefore| has to be actually executed. @@ -8247,6 +8370,7 @@ version 2005/12/01 or later. \seq_gclear:N \g_@@_pos_of_stroken_blocks_seq \seq_gclear:N \g_@@_pos_of_xdots_seq \tl_gclear_new:N \g_@@_code_before_tl + \tl_gclear:N \g_@@_row_style_tl % \end{macrocode} % % \bigskip @@ -8374,7 +8498,6 @@ version 2005/12/01 or later. % in |{NiceArray}| or |{NiceTabular}|, we have no delimiter to put (but we have % tabular notes to put). We begin with this case. % -% Remark that, in all cases, |@@_use_arraybox_with_notes_c:| is used. % \begin{macrocode} \bool_if:NTF \l_@@_NiceArray_bool { @@ -9415,7 +9538,18 @@ version 2005/12/01 or later. % whether there is tabular notes or not before the composition of the blocks). % \begin{macrocode} \cs_new_protected:Npn \@@_use_arraybox_with_notes_c: - { + { +% \end{macrocode} +% With an environment |{Matrix}|, you want to remove the exterior |\arraycolsep| +% but we don't know the number of columns (since there is no preamble) and +% that's why we can't put |@{}| at the end of the preamble. That's why we remove +% a |\arraycolsep| now. +% \begin{macrocode} + \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool + { + \box_set_wd:Nn \l_@@_the_array_box + { \box_wd:N \l_@@_the_array_box - \arraycolsep } + } % \end{macrocode} % We need a |{minipage}| because we will insert a LaTeX list for the tabular % notes (that means that a |\vtop{\hsize=...}| is not enough). @@ -9888,8 +10022,8 @@ version 2005/12/01 or later. % \begin{macrocode} \int_gset:Nn \g_tmpa_int 1 \bool_if:NTF \g_@@_last_col_found_bool + { \prg_replicate:nn { \g_@@_col_total_int - 3 } } { \prg_replicate:nn { \g_@@_col_total_int - 2 } } - { \prg_replicate:nn { \g_@@_col_total_int - 1 } } { & \omit @@ -9926,17 +10060,58 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% We want to remove the exterior |\arraycolsep| of a environment |{NiceArray}|. % \begin{macrocode} - \bool_lazy_all:nT - { - \l_@@_NiceArray_bool - { \bool_not_p:n \l_@@_NiceTabular_bool } - { \clist_if_empty_p:N \l_@@_vlines_clist } - { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } - { ! \l_@@_bar_at_end_of_pream_bool } - } - { \skip_horizontal:n { - \col@sep } } + & + \omit + \int_gincr:N \g_tmpa_int + \skip_horizontal:N \g_tmpa_skip + \bool_lazy_all:nT + { + \l_@@_NiceArray_bool + { \bool_not_p:n \l_@@_NiceTabular_bool } + { \clist_if_empty_p:N \l_@@_vlines_clist } + { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } + { ! \l_@@_bar_at_end_of_pream_bool } + } + { \skip_horizontal:N -\col@sep } + \bool_if:NT \l_@@_code_before_bool + { + \hbox + { + \skip_horizontal:N -0.5\arrayrulewidth +% \end{macrocode} +% With an environment |{Matrix}|, you want to remove the exterior |\arraycolsep| +% but we don't know the number of columns (since there is no preamble) and +% that's why we can't put |@{}| at the end of the preamble. That's why we remove +% a |\arraycolsep| now. +% \begin{macrocode} + \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool + { \skip_horizontal:N -\arraycolsep } + \pgfsys@markposition { \@@_env: - col - \@@_succ:n \g_tmpa_int } + \skip_horizontal:N 0.5\arrayrulewidth + \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool + { \skip_horizontal:N \arraycolsep } + } + } + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int } + { + \bool_lazy_and:nnTF \l_@@_Matrix_bool \l_@@_NiceArray_bool + { + \pgfpoint + { - 0.5 \arrayrulewidth - \arraycolsep } + \c_zero_dim + } + { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim } + } + \str_if_empty:NF \l_@@_name_str + { + \pgfnodealias + { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int } + { \@@_env: - col - \@@_succ:n \g_tmpa_int } + } + \endpgfpicture % \end{macrocode} % % \bigskip @@ -10708,6 +10883,8 @@ version 2005/12/01 or later. \dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 } \dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 } \pgfnode { @@_diag_node } { center } { } { \@@_env: - ##1 } { } + \str_if_empty:NF \l_@@_name_str + { \pgfnodealias { \l_@@_name_str - ##1 } { \@@_env: - ##1 } } } % \end{macrocode} % Now, the last node. Of course, that is only a |coordinate| because there is @@ -10722,6 +10899,15 @@ version 2005/12/01 or later. \pgfnodealias { \@@_env: - last } { \@@_env: - \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } } + \str_if_empty:NF \l_@@_name_str + { + \pgfnodealias + { \l_@@_name_str - \int_use:N \l_tmpa_int } + { \@@_env: - \int_use:N \l_tmpa_int } + \pgfnodealias + { \l_@@_name_str - last } + { \@@_env: - last } + } \endpgfpicture } % \end{macrocode} @@ -13537,7 +13723,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% \subsubsection*{The key corners} +% \subsection*{The key corners} % % When the key |corners| is raised, the rules are not drawn in the % corners. Of course, we have to compute the corners before we begin to draw the @@ -14563,6 +14749,13 @@ version 2005/12/01 or later. \tl_if_empty:NTF \l_@@_color_tl { \int_compare:nNnT { #2 } = 1 \set@color } { \color { \l_@@_color_tl } } +% \end{macrocode} +% If the block is mono-row, we use |\g_@@_row_style_tl| even it has yet been used +% in the beginning of the cell where the command |\Block| has been issued +% because we want to be able to take into account a potential instruction of +% color of the font in |\g_@@_row_style_tl|. +% \begin{macrocode} + \int_compare:nNnT { #1 } = 1 \g_@@_row_style_tl \group_begin: \cs_set:Npn \arraystretch { 1 } \dim_set_eq:NN \extrarowheight \c_zero_dim @@ -14852,34 +15045,35 @@ version 2005/12/01 or later. \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } % \end{macrocode} % +% % \begin{macrocode} - \tl_if_empty:NF \l_@@_draw_tl + \bool_if:NT \l_@@_hvlines_block_bool { \tl_gput_right:Nx \g_nicematrix_code_after_tl { - \@@_stroke_block:nnn + \@@_hvlines_block:nnn { \exp_not:n { #5 } } { #1 - #2 } { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int } } - \seq_gput_right:Nn \g_@@_pos_of_stroken_blocks_seq - { { #1 } { #2 } { #3 } { #4 } } } % \end{macrocode} -% +% % \begin{macrocode} - \bool_if:NT \l_@@_hvlines_block_bool + \tl_if_empty:NF \l_@@_draw_tl { \tl_gput_right:Nx \g_nicematrix_code_after_tl { - \@@_hvlines_block:nnn + \@@_stroke_block:nnn { \exp_not:n { #5 } } { #1 - #2 } { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int } } + \seq_gput_right:Nn \g_@@_pos_of_stroken_blocks_seq + { { #1 } { #2 } { #3 } { #4 } } } % \end{macrocode} -% +% % \begin{macrocode} \clist_if_empty:NF \l_@@_borders_clist { @@ -15296,7 +15490,7 @@ version 2005/12/01 or later. % \bigskip % The first argument of |\@@_hvlines_block:nnn| is a list of options for the -% rules that wewill draw. The second argument is the upper-left cell of the +% rules that we will draw. The second argument is the upper-left cell of the % block (with, as usual, the syntax $i$|-|$j$) and the third is the last cell of % the block (with the same syntax). % \begin{macrocode} @@ -15501,7 +15695,7 @@ version 2005/12/01 or later. { \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } { * { \int_use:N \l_@@_nb_cols_int } { \l_@@_type_of_col_tl } } - [ \l_tmpa_tl ] + [ \exp_not:V \l_tmpa_tl ] } \int_compare:nNnT \l_@@_first_row_int = 0 { @@ -15952,17 +16146,27 @@ version 2005/12/01 or later. % \item |#2| is the upper-left cell of the matrix with the format $i$-$j$; % \item |#3| is the lower-right cell of the matrix with the format $i$-$j$; % \item |#4| is the right delimiter; -% \item |#5| is the list of options of the command. +% \item |#5| is the list of options of the command; +% \item |#6| is the potential subscript; +% \item |#7| is the potential superscript. % \end{itemize} +% For explanations about the construction with rescanning of the preamble, see +% the documentation for the user command |\Cdots|. % \begin{macrocode} -\NewDocumentCommand \@@_SubMatrix { m m m m O { } } +\AtBeginDocument { - \peek_remove_spaces:n - { \@@_sub_matrix:nnnnn { #1 } { #2 } { #3 } { #4 } { #5 } } - } + \tl_set:Nn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } } + \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl + \exp_args:NNV \NewDocumentCommand \@@_SubMatrix \l_@@_argspec_tl + { + \peek_remove_spaces:n + { \@@_sub_matrix:nnnnnnn + { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } } + } + } % \end{macrocode} % \begin{macrocode} -\cs_new_protected:Npn \@@_sub_matrix:nnnnn #1 #2 #3 #4 #5 +\cs_new_protected:Npn \@@_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7 { \group_begin: % \end{macrocode} @@ -16023,7 +16227,7 @@ version 2005/12/01 or later. { \dim_compare:nNnTF \l_@@_x_final_dim = { - \c_max_dim } { \@@_error:nn { impossible~delimiter } { right } } - { \@@_sub_matrix_i:nn { #1 } { #4 } } + { \@@_sub_matrix_i:nnnn { #1 } { #4 } { #6 } { #7 } } } \endpgfpicture } @@ -16032,9 +16236,10 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% |#1| is the left delimiter dans |#2| is the right one. +% |#1| is the left delimiter, |#2| is the right one, |#3| is the subscript and +% |#4| is the superscript. % \begin{macrocode} -\cs_new_protected:Npn \@@_sub_matrix_i:nn #1 #2 +\cs_new_protected:Npn \@@_sub_matrix_i:nnnn #1 #2 #3 #4 { \@@_qpoint:n { row - \l_@@_first_i_tl - base } \dim_set:Nn \l_@@_y_initial_dim @@ -16217,9 +16422,10 @@ version 2005/12/01 or later. { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 } } \str_if_empty:NTF \l_@@_submatrix_name_str - { \@@_node_right:nn #2 { } } + { \@@_node_right:nnnn #2 { } { #3 } { #4 } } { - \@@_node_right:nn #2 { \@@_env: - \l_@@_submatrix_name_str - right } + \@@_node_right:nnnn #2 + { \@@_env: - \l_@@_submatrix_name_str - right } { #3 } { #4 } } % \end{macrocode} % @@ -16368,8 +16574,9 @@ version 2005/12/01 or later. % The command |\@@_node_right:nn| puts the right delimiter with the correct size. % The argument |#1| is the delimiter to put. The argument |#2| is the name we % will give to this PGF node (if the key |name| has been used in |\SubMatrix|). +% The argument |#3| is the subscript and |#4| is the superscript. % \begin{macrocode} -\cs_new_protected:Npn \@@_node_right:nn #1 #2 +\cs_new_protected:Npn \@@_node_right:nnnn #1 #2 #3 #4 { \pgfnode { rectangle } @@ -16387,7 +16594,9 @@ version 2005/12/01 or later. \@depth \c_zero_dim \@width \c_zero_dim } - \right #1 + \right #1 + \tl_if_empty:nF { #3 } { _ { \smash { #3 } } } + ^ { \smash { #4 } } \c_math_toggle_token } { #2 } @@ -16428,7 +16637,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\@@_msg_new:nnn { Unknown~option~for~package } +\@@_msg_new:nnn { Unknown~key~for~package } { The~key~'\l_keys_key_str'~is~unknown. \\ If~you~go~on,~it~will~be~ignored. \\ @@ -16483,7 +16692,7 @@ version 2005/12/01 or later. transparent .value_forbidden:n = true, footnote .bool_set:N = \c_@@_footnote_bool , footnotehyper .bool_set:N = \c_@@_footnotehyper_bool , - unknown .code:n = \@@_error:n { Unknown~option~for~package } + unknown .code:n = \@@_error:n { Unknown~key~for~package } } \ProcessKeysOptions { NiceMatrix / Package } % \end{macrocode} @@ -16727,13 +16936,22 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Unknown~key~for~xdots } { - As~for~now,~there~is~only~three~key~available~here:~'color',~'line-style'~ + As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~ and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~ this~key~will~be~ignored. } % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { Unknown~key~for~RowStyle } + { + As~for~now,~there~is~only~three~keys~available~here:~'cell-space-top-limit',~ + 'cell-space-bottom-limit~and~'cell-space-limits'~(and~you~try~to~use~ + '\l_keys_key_str').~If~you~go~on,~this~key~will~be~ignored. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Unknown~key~for~rowcolors } { As~for~now,~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~ @@ -17153,7 +17371,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\@@_msg_new:nnn { Unknown~option~for~NiceArray } +\@@_msg_new:nnn { Unknown~key~for~NiceArray } { The~key~'\l_keys_key_str'~is~unknown~for~the~environment~ \{NiceArray\}. \\ @@ -17212,7 +17430,7 @@ version 2005/12/01 or later. % |NiceMatrix/pNiceArray| (but not by |NiceMatrix/NiceArray| because, for this % set of keys, there is also the keys |t|, |c| and~|b|). % \begin{macrocode} -\@@_msg_new:nnn { Unknown~option~for~NiceMatrix } +\@@_msg_new:nnn { Unknown~key~for~NiceMatrix } { The~key~'\l_keys_key_str'~is~unknown~for~the~ \@@_full_name_env:. \\ @@ -17266,7 +17484,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\@@_msg_new:nnn { Unknown~option~for~NiceTabular } +\@@_msg_new:nnn { Unknown~key~for~NiceTabular } { The~key~'\l_keys_key_str'~is~unknown~for~the~environment~ \{NiceTabular\}. \\ @@ -17842,6 +18060,9 @@ version 2005/12/01 or later. % It's now possible to use a key |l|, |r| or |c| with the command % |\pAutoNiceMatrix| (and the similar ones). % +% \subsection*{Changes between versions 5.17 and 5.18} +% +% New command |\RowStyle| % % \PrintIndex % |