From f506889527fff6570e2878d55abbacf7227f2b3e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 15 Jul 2023 03:00:53 +0000 Subject: CTAN sync 202307150300 --- .../latex/contrib/nicematrix/nicematrix-code.dtx | 614 +++++++++++++-------- .../latex/contrib/nicematrix/nicematrix-french.pdf | Bin 581086 -> 580350 bytes .../latex/contrib/nicematrix/nicematrix-french.tex | 83 +-- macros/latex/contrib/nicematrix/nicematrix.ins | 2 +- macros/latex/contrib/nicematrix/nicematrix.pdf | Bin 596800 -> 598482 bytes macros/latex/contrib/nicematrix/nicematrix.tex | 83 ++- 6 files changed, 484 insertions(+), 298 deletions(-) (limited to 'macros/latex/contrib/nicematrix') diff --git a/macros/latex/contrib/nicematrix/nicematrix-code.dtx b/macros/latex/contrib/nicematrix/nicematrix-code.dtx index 86e54a5643..cd4e1fd25b 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-code.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix-code.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.20a} -\def\myfiledate{2023/06/30} +\def\myfileversion{6.21} +\def\myfiledate{2023/07/14} % % %<*batchfile> @@ -384,7 +384,7 @@ version 2005/12/01 or later. % % \bigskip % The following regex will be used to modify the preamble of the array when the -% key |colortbl-like| is used. +% key |color-inside| is used. % \begin{macrocode} \regex_const:Nn \c_@@_columncolor_regex { \c { columncolor } } % \end{macrocode} @@ -598,7 +598,7 @@ version 2005/12/01 or later. % The following command is a small shortcut. % \begin{macrocode} \cs_new:Npn \@@_math_toggle_token: - { \bool_if:NF \l_@@_NiceTabular_bool \c_math_toggle_token } + { \bool_if:NF \l_@@_tabular_bool \c_math_toggle_token } % \end{macrocode} % % \bigskip @@ -737,7 +737,40 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_qpoint:n #1 { \pgfpointanchor { \@@_env: - #1 } { center } } % \end{macrocode} -% +% +% \bigskip +% If the user uses |{NiceTabular}|, |{NiceTabular*}| or |{NiceTabularX}|, we +% will raise the following flag. +% \begin{macrocode} +\bool_new:N \l_@@_tabular_bool +% \end{macrocode} +% +% \bigskip +% |\g_@@_delims_bool| will be true for the environments with delimiters (ex. : +% |{pNiceMatrix}|, |{pNiceArray}|, |\pAutoNiceMatrix|, etc.). +% \begin{macrocode} +\bool_new:N \g_@@_delims_bool +\bool_gset_true:N \g_@@_delims_bool +% \end{macrocode} +% In fact, if there is delimiters in the preamble of |{NiceArray}| (eg: +% |[cccc]|), this boolean will be set to false. +% +% \medskip +% The following boolean will be equal to |true| in the environments which have +% an environment (provided by the final user): |{NiceTabular}|, |{NiceArray}|, +% |{pNiceArray}|, etc. +% \begin{macrocode} +\bool_new:N \l_@@_preamble_bool +\bool_set_true:N \l_@@_preamble_bool +% \end{macrocode} +% +% \medskip +% We need a special treatment for |{NiceMatrix}| when |vlines| is not used, in +% order to retrieve |\arraycolsep| on both sides. +% \begin{macrocode} +\bool_new:N \l_@@_NiceMatrix_without_vlines_bool +% \end{macrocode} +% % \bigskip % The following counter will count the environments |{NiceMatrixBlock}|. % \begin{macrocode} @@ -861,22 +894,6 @@ version 2005/12/01 or later. \bool_new:N \l_@@_notes_detect_duplicates_bool \bool_set_true:N \l_@@_notes_detect_duplicates_bool % \end{macrocode} -% -% \bigskip -% If the user uses |{NiceArray}| or |{NiceTabular}| the flag -% |\g_@@_NiceArray_bool| will be raised. -% \begin{macrocode} -\bool_new:N \g_@@_NiceArray_bool -% \end{macrocode} -% In fact, if there is delimiters in the preamble of |{NiceArray}| (eg: -% |[cccc]|), this boolean will be set to false. -% -% \bigskip -% If the user uses |{NiceTabular}|, |{NiceTabular*}| or |{NiceTabularX}|, we -% will raise the following flag. -% \begin{macrocode} -\bool_new:N \l_@@_NiceTabular_bool -% \end{macrocode} % % \bigskip % If the user uses |{NiceTabular*}|, the width of the tabular (in the first @@ -894,19 +911,19 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% If the user uses an environment without preamble, we will raise the following -% flag. -% \begin{macrocode} -\bool_new:N \l_@@_Matrix_bool -% \end{macrocode} -% -% \bigskip % The following boolean will be raised when the command |\rotate| is used. % \begin{macrocode} \bool_new:N \g_@@_rotate_bool % \end{macrocode} % % \bigskip +% The following boolean will be raise then the command |\rotate| is used with +% the key |c|. +% \begin{macrocode} +\bool_new:N \g_@@_rotate_c_bool +% \end{macrocode} +% +% \bigskip % In a cell, it will be possible to know whether we are in a cell of a column of % type |X| thanks to that flag. % \begin{macrocode} @@ -1002,14 +1019,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \bigskip -% The following token list corresponds to the option |code-after| (it's also -% possible to set the value of that parameter with the keyword |\CodeAfter|). -% That parameter is \emph{public}. -% \begin{macrocode} -\tl_new:N \g_nicematrix_code_after_tl -\bool_new:N \l_@@_in_code_after_bool -% \end{macrocode} % % \bigskip % For the key |code| of the command |\SubMatrix| (itself in the main @@ -1032,16 +1041,33 @@ version 2005/12/01 or later. % |\g_@@_pre_code_after_tl| because we must take care of the order in which % instructions stored in that parameters are executed. % \begin{macrocode} -\tl_new:N \g_@@_pre_code_after_tl + % \end{macrocode} % % \bigskip +% The so-called `\CodeBefore` is splitted in two parts because we want to control +% the order of execution of some instructions. +% \begin{macrocode} +\tl_new:N \g_@@_pre_code_before_tl +\tl_new:N \g_nicematrix_code_before_tl +% \end{macrocode} % The value of the key |code-before| will be added to the left of % |\g_@@_pre_code_before_tl|. Idem for the code between |\CodeBefore| and % |\Body|. -% \begin{macrocode} -\tl_new:N \g_nicematrix_code_before_tl -\tl_new:N \g_@@_pre_code_before_tl +% +% \bigskip +% The so-called `\CodeAfter` is splitted in two parts because we want to control +% the order of execution of some instructions. +% \begin{macrocode} +\tl_new:N \g_@@_pre_code_after_tl +\tl_new:N \g_nicematrix_code_after_tl +% \end{macrocode} +% The `\CodeAfter` provided by the final user (with the key |code-after| or the +% keyword |\CodeAfter|) will be stored in the second token list. +% +% \bigskip +% \begin{macrocode} +\bool_new:N \l_@@_in_code_after_bool % \end{macrocode} % % \bigskip @@ -1353,7 +1379,6 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_new:N \l_@@_draw_first_bool % \end{macrocode} -% % % \medskip % The following flag corresponds to the keys |vlines| and |hlines| of the @@ -1496,6 +1521,13 @@ version 2005/12/01 or later. \bool_new:N \g_@@_last_col_found_bool % \end{macrocode} % This boolean is set to |false| at the end of |\@@_pre_array_ii:|. +% +% \medskip +% In the last column, we will raise the following flag (it will be used by +% |\OnlyMainNiceMatrix|). +% \begin{macrocode} +\bool_new:N \l_@@_in_last_col_bool +% \end{macrocode} % \end{itemize} % % \bigskip @@ -1536,7 +1568,8 @@ version 2005/12/01 or later. } } % \end{macrocode} -% +% +% % \bigskip % \section{The command \textbackslash tabularnote} % @@ -1694,7 +1727,7 @@ version 2005/12/01 or later. { \bool_if:nT { \cs_if_exist_p:N \@captype || \l_@@_in_env_bool } { - \bool_if:nTF { ! \l_@@_NiceTabular_bool && \l_@@_in_env_bool } + \bool_if:nTF { ! \l_@@_tabular_bool && \l_@@_in_env_bool } { \@@_error:n { tabularnote~forbidden } } { \bool_if:NTF \l_@@_in_caption_bool @@ -1981,10 +2014,10 @@ version 2005/12/01 or later. % \bigskip % By default, the commands |\cellcolor| and |\rowcolor| are available for the % user in the cells of the tabular (the user may use the commands provided by -% |\colortbl|). However, if the key |colortbl-like| is used, these +% |\colortbl|). However, if the key |color-inside| is used, these % commands are available. % \begin{macrocode} -\bool_new:N \l_@@_colortbl_like_bool +\bool_new:N \l_@@_color_inside_bool % \end{macrocode} % % \bigskip @@ -2308,6 +2341,8 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { NiceMatrix / Global } { + rounded-corners .dim_set:N = \l_@@_tab_rounded_corners_dim , + rounded-corners .default:n = 4 pt , custom-line .code:n = \@@_custom_line:n { #1 } , rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , rules .value_required:n = true , @@ -2446,10 +2481,11 @@ version 2005/12/01 or later. name .value_required:n = true , code-after .tl_gset:N = \g_nicematrix_code_after_tl , code-after .value_required:n = true , - colortbl-like .code:n = - \bool_set_true:N \l_@@_colortbl_like_bool + color-inside .code:n = + \bool_set_true:N \l_@@_color_inside_bool \bool_set_true:N \l_@@_code_before_bool , - colortbl-like .value_forbidden:n = true + color-inside .value_forbidden:n = true , + colortbl-like .meta:n = color-inside } % \end{macrocode} % @@ -2734,8 +2770,6 @@ version 2005/12/01 or later. width .code:n = \dim_set:Nn \l_@@_width_dim { #1 } \bool_set_true:N \l_@@_width_used_bool , width .value_required:n = true , - rounded-corners .dim_set:N = \l_@@_tab_rounded_corners_dim , - rounded-corners .default:n = 4 pt , notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } , tabularnote .tl_gset:N = \g_@@_tabularnote_tl , tabularnote .value_required:n = true , @@ -2794,7 +2828,7 @@ version 2005/12/01 or later. % |\@@_cell_end:| (and the potential |\c_math_toggle_token| also). % \begin{macrocode} \hbox_set:Nw \l_@@_cell_box - \bool_if:NF \l_@@_NiceTabular_bool + \bool_if:NF \l_@@_tabular_bool { \c_math_toggle_token \bool_if:NT \l_@@_small_bool \scriptstyle @@ -2888,16 +2922,28 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_rotate_cell_box: { \box_rotate:Nn \l_@@_cell_box { 90 } - \int_compare:nNnT \c@iRow = \l_@@_last_row_int - { - \vbox_set_top:Nn \l_@@_cell_box + \bool_if:NTF \g_@@_rotate_c_bool + { + \hbox_set:Nn \l_@@_cell_box { - \vbox_to_zero:n { } - \skip_vertical:n { - \box_ht:N \@arstrutbox + 0.8 ex } - \box_use:N \l_@@_cell_box + \c_math_toggle_token + \vcenter { \box_use:N \l_@@_cell_box } + \c_math_toggle_token } - } + } + { + \int_compare:nNnT \c@iRow = \l_@@_last_row_int + { + \vbox_set_top:Nn \l_@@_cell_box + { + \vbox_to_zero:n { } + \skip_vertical:n { - \box_ht:N \@arstrutbox + 0.8 ex } + \box_use:N \l_@@_cell_box + } + } + } \bool_gset_false:N \g_@@_rotate_bool + \bool_gset_false:N \g_@@_rotate_c_bool } % \end{macrocode} % @@ -3179,7 +3225,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_array:n { - \bool_if:NTF \l_@@_NiceTabular_bool + \bool_if:NTF \l_@@_tabular_bool { \dim_set_eq:NN \col@sep \tabcolsep } { \dim_set_eq:NN \col@sep \arraycolsep } \dim_compare:nNnTF \l_@@_tabular_width_dim = \c_zero_dim @@ -3339,13 +3385,15 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% When the key |colortbl-like| is used, the following code will be executed. +% When the key |color-inside| 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 \rowcolors \@@_rowcolors_tabular + \cs_set_eq:NN \rowlistcolors \@@_rowlistcolors_tabular } % \end{macrocode} % @@ -3494,7 +3542,7 @@ version 2005/12/01 or later. \cs_set_eq:NN \RowStyle \@@_RowStyle:n \seq_map_inline:Nn \l_@@_custom_line_commands_seq { \cs_set_eq:cc { ##1 } { nicematrix - ##1 } } - \bool_if:NT \l_@@_colortbl_like_bool \@@_colortbl_like: + \bool_if:NT \l_@@_color_inside_bool \@@_colortbl_like: \bool_if:NT \l_@@_renew_dots_bool \@@_renew_dots: % \end{macrocode} % We redefine |\multicolumn| and, since we want |\multicolumn| to be available @@ -3596,9 +3644,6 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_pre_array: { -% \end{macrocode} -% -% \begin{macrocode} \cs_if_exist:NT \theiRow { \int_set_eq:NN \l_@@_old_iRow_int \c@iRow } \int_gzero_new:N \c@iRow \cs_if_exist:NT \thejCol { \int_set_eq:NN \l_@@_old_jCol_int \c@jCol } @@ -3703,11 +3748,7 @@ version 2005/12/01 or later. % \begin{macrocode} \dim_zero_new:N \l_@@_left_delim_dim \dim_zero_new:N \l_@@_right_delim_dim - \bool_if:NTF \g_@@_NiceArray_bool - { - \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep } - \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep } - } + \bool_if:NTF \g_@@_delims_bool { % \end{macrocode} % The command |\bBigg@| is a command of \pkg{amsmath}. @@ -3717,6 +3758,10 @@ version 2005/12/01 or later. \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \g_@@_right_delim_tl $ } \dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box } } + { + \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep } + \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep } + } % \end{macrocode} % % \bigskip @@ -3759,7 +3804,8 @@ version 2005/12/01 or later. % \bigskip % \section{The \textbackslash CodeBefore} % -% The following command will be executed if the |\CodeBefore| has to be actually executed. +% The following command will be executed if the |\CodeBefore| has to be actually +% executed (that commmand will be used only once and is present only for legibility). % \begin{macrocode} \cs_new_protected:Npn \@@_pre_code_before: { @@ -3861,7 +3907,7 @@ version 2005/12/01 or later. % We compose the |\CodeBefore| in math mode in order to nullify the spaces put % by the user between instructions in the |\CodeBefore|. % \begin{macrocode} - \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token + \bool_if:NT \l_@@_tabular_bool \c_math_toggle_token % \end{macrocode} % % \bigskip @@ -3895,7 +3941,7 @@ version 2005/12/01 or later. \@@_actually_color: \l_@@_code_before_tl \q_stop - \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token + \bool_if:NT \l_@@_tabular_bool \c_math_toggle_token \group_end: \bool_if:NT \g_@@_recreate_cell_nodes_bool { \tl_put_left:Nn \@@_node_for_cell: \@@_patch_node_for_cell: } @@ -3927,7 +3973,7 @@ version 2005/12/01 or later. % % We have extracted the options of the keyword |\CodeBefore| in order to see % whether the key |create-cell-nodes| has been used. Now, you can execute the -% rest of the |\CodeAfter|, excepted, of course, if we are in the first +% rest of the |\CodeBefore|, excepted, of course, if we are in the first % compilation. % \begin{macrocode} \cs_new_protected:Npn \@@_CodeBefore:w #1 \q_stop @@ -3940,8 +3986,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \bigskip -% % % \bigskip % By default, if the user uses the |\CodeBefore|, only the |col| nodes, |row| @@ -4094,7 +4138,7 @@ version 2005/12/01 or later. \bool_gset_false:N \g_@@_row_of_col_done_bool \str_if_empty:NT \g_@@_name_env_str { \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } } - \bool_if:NTF \l_@@_NiceTabular_bool + \bool_if:NTF \l_@@_tabular_bool \mode_leave_vertical: \@@_test_if_math_mode: \bool_if:NT \l_@@_in_env_bool { \@@_fatal:n { Yet~in~env } } @@ -4182,9 +4226,9 @@ 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 \g_@@_NiceArray_bool - { \keys_set:nn { NiceMatrix / NiceArray } } + \bool_if:NTF \g_@@_delims_bool { \keys_set:nn { NiceMatrix / pNiceArray } } + { \keys_set:nn { NiceMatrix / NiceArray } } { #3 , #5 } % \end{macrocode} % @@ -4319,13 +4363,10 @@ version 2005/12/01 or later. } % \end{macrocode} % -% 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. -% +% The construction of the real box is different whether we have delimiters to +% put. % \begin{macrocode} - \bool_if:NTF \g_@@_NiceArray_bool + \bool_if:nTF { ! \g_@@_delims_bool } { \str_case:VnF \l_@@_baseline_tl { @@ -4336,9 +4377,9 @@ version 2005/12/01 or later. } % \end{macrocode} % -% Now, in the case of an environment |{pNiceArray}|, |{bNiceArray}|, etc. We -% compute |\l_tmpa_dim| which is the total height of the ``first row'' above the -% array (when the key |first-row| is used). +% Now, in the case of an environment with delimiters. We compute |\l_tmpa_dim| +% which is the total height of the ``first row'' above the array (when the key +% |first-row| is used). % \begin{macrocode} { \int_compare:nNnTF \l_@@_first_row_int = 0 @@ -4379,11 +4420,11 @@ version 2005/12/01 or later. \skip_vertical:n { -\l_tmpa_dim - \arrayrulewidth } \hbox { - \bool_if:NTF \l_@@_NiceTabular_bool + \bool_if:NTF \l_@@_tabular_bool { \skip_horizontal:N -\tabcolsep } { \skip_horizontal:N -\arraycolsep } \@@_use_arraybox_with_notes_c: - \bool_if:NTF \l_@@_NiceTabular_bool + \bool_if:NTF \l_@@_tabular_bool { \skip_horizontal:N -\tabcolsep } { \skip_horizontal:N -\arraycolsep } } @@ -4427,8 +4468,8 @@ version 2005/12/01 or later. \skip_horizontal:N \g_@@_width_last_col_dim \skip_horizontal:N \col@sep } - \bool_if:NF \l_@@_Matrix_bool - { + \bool_if:NT \l_@@_preamble_bool + { \int_compare:nNnT \c@jCol < \g_@@_static_num_of_col_int { \@@_warning_gredirect_none:n { columns~not~used } } } @@ -4468,16 +4509,23 @@ version 2005/12/01 or later. % \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 +% by-side effects, for example, the boolean |\g_@@_delims_bool| will be set +% to |true| 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 \@@_transform_preamble: + { + \bool_if:NT \l_@@_preamble_bool \@@_transform_preamble_i: + \@@_transform_preamble_ii: + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_transform_preamble_i: { % \end{macrocode} % First, we will do an ``expansion'' of the preamble with the tools of the @@ -4499,100 +4547,82 @@ version 2005/12/01 or later. % That's why we do those redefinitions in a TeX group. % \begin{macrocode} \group_begin: -% \end{macrocode} -% -% If we are in an environment without explicit preamble, we have nothing to do -% (excepted the treatment on both sides of the preamble which will be done at -% 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 } -% \end{macrocode} -% -% -% \bigskip -% Now, we have to ``patch'' that preamble by transforming some columns. -% We will insert in the TeX flow the preamble in its actual form (that is to say -% after the ``expansion'') following by a marker |\q_stop| and we will consume -% these tokens constructing the (new form of the) preamble in -% |\g_@@_preamble_tl|. This is done recursively with the command -% |\@@_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 + \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list } + \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 } + \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 } } } - { - \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 % (hence the name |vlism|). % \begin{macrocode} - \seq_clear:N \g_@@_cols_vlism_seq + \seq_clear:N \g_@@_cols_vlism_seq % \end{macrocode} % % \bigskip % The following sequence will store the arguments of the successive |>| in the % preamble. % \begin{macrocode} - \tl_gclear_new:N \g_@@_pre_cell_tl + \tl_gclear_new:N \g_@@_pre_cell_tl % \end{macrocode} % % The counter |\l_tmpa_int| will count the number of consecutive occurrences % of the symbol \verb+|+. % \begin{macrocode} - \int_zero:N \l_tmpa_int + \int_zero:N \l_tmpa_int % \end{macrocode} % Now, we actually patch the preamble (and it is constructed in % |\g_@@_preamble_tl|). % \begin{macrocode} - \exp_after:wN \@@_patch_preamble:n \the \@temptokena \q_stop - \int_gset_eq:NN \g_@@_static_num_of_col_int \c@jCol - } + \exp_after:wN \@@_patch_preamble:n \the \@temptokena \q_stop + \int_gset_eq:NN \g_@@_static_num_of_col_int \c@jCol % \end{macrocode} +% Remark that |\g_@@_static_num_of_col_int| will stay equel to zero in the +% environments without preamble since we are in a code that is executed only +% in the environments \emph{with} preamble. % % \medskip % Now, we replace |\columncolor| by |\@@_columncolor_preamble|. % \begin{macrocode} - \bool_if:NT \l_@@_colortbl_like_bool + \bool_if:NT \l_@@_color_inside_bool { \regex_replace_all:NnN \c_@@_columncolor_regex @@ -4606,7 +4636,22 @@ version 2005/12/01 or later. % the columns of type |w| and~|W|. % \begin{macrocode} \group_end: + } % \end{macrocode} +% +% +% +% \bigskip +% Now, we have to ``patch'' that preamble by transforming some columns. +% We will insert in the TeX flow the preamble in its actual form (that is to say +% after the ``expansion'') following by a marker |\q_stop| and we will consume +% these tokens constructing the (new form of the) preamble in +% |\g_@@_preamble_tl|. This is done recursively with the command +% |\@@_patch_preamble:n|. In the same time, we will count the columns with the +% counter |\c@jCol|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_transform_preamble_ii: + { % % \medskip % If there was delimiters at the beginning or at the end of the preamble, the @@ -4615,7 +4660,7 @@ version 2005/12/01 or later. \bool_lazy_or:nnT { ! \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 } + { \bool_gset_true:N \g_@@_delims_bool } % \end{macrocode} % % \medskip @@ -4632,8 +4677,8 @@ version 2005/12/01 or later. { \bool_lazy_all:nT { - \g_@@_NiceArray_bool - { \bool_not_p:n \l_@@_NiceTabular_bool } + { \bool_not_p:n \g_@@_delims_bool } + { \bool_not_p:n \l_@@_tabular_bool } { \tl_if_empty_p:N \l_@@_vlines_clist } { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } } @@ -4644,8 +4689,8 @@ version 2005/12/01 or later. { \bool_lazy_all:nT { - \g_@@_NiceArray_bool - { \bool_not_p:n \l_@@_NiceTabular_bool } + { \bool_not_p:n \g_@@_delims_bool } + { \bool_not_p:n \l_@@_tabular_bool } { \tl_if_empty_p:N \l_@@_vlines_clist } { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } } @@ -5268,8 +5313,6 @@ version 2005/12/01 or later. < { \@@_cell_end: \hbox_set_end: - % The following line is probably pointless - % \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: #1 \@@_adjust_size_box: \makebox [ #4 ] [ #3 ] { \box_use_drop:N \l_@@_cell_box } @@ -5985,7 +6028,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 \g_@@_NiceArray_bool + \bool_if:NT \l_@@_NiceMatrix_without_vlines_bool { \box_set_wd:Nn \l_@@_the_array_box { \box_wd:N \l_@@_the_array_box - \arraycolsep } @@ -6492,6 +6535,8 @@ version 2005/12/01 or later. \@@_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}). @@ -6710,8 +6755,8 @@ version 2005/12/01 or later. \int_gincr:N \g_tmpa_int \bool_lazy_all:nT { - \g_@@_NiceArray_bool - { \bool_not_p:n \l_@@_NiceTabular_bool } + { \bool_not_p:n \g_@@_delims_bool } + { \bool_not_p:n \l_@@_tabular_bool } { \clist_if_empty_p:N \l_@@_vlines_clist } { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } { ! \l_@@_bar_at_end_of_pream_bool } @@ -6728,13 +6773,12 @@ 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 \g_@@_NiceArray_bool + \bool_if:NT \l_@@_NiceMatrix_without_vlines_bool { \skip_horizontal:N -\arraycolsep } \pgfsys@markposition - { \@@_env: - col - \int_eval:n { - \g_tmpa_int + 1 } } + { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } } \skip_horizontal:N 0.5\arrayrulewidth - \bool_lazy_and:nnT \l_@@_Matrix_bool \g_@@_NiceArray_bool + \bool_if:NT \l_@@_NiceMatrix_without_vlines_bool { \skip_horizontal:N \arraycolsep } } } @@ -6742,7 +6786,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 \g_@@_NiceArray_bool + \bool_if:NT \l_@@_NiceMatrix_without_vlines_bool { \pgfpoint { - 0.5 \arrayrulewidth - \arraycolsep } @@ -6877,6 +6921,7 @@ version 2005/12/01 or later. { > { + \bool_set_true:N \l_@@_in_last_col_bool % \end{macrocode} % At the beginning of the cell, we link |\CodeAfter| to a command which % begins with |\\| (whereas the standard version of |\CodeAfter| begins does @@ -6949,19 +6994,17 @@ version 2005/12/01 or later. % % \interitem % The environment |{NiceArray}| is constructed upon the environment -% |{NiceArrayWithDelims}| but, in fact, there is a flag |\g_@@_NiceArray_bool|. -% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is -% raised. +% |{NiceArrayWithDelims}|. % \begin{macrocode} \NewDocumentEnvironment { NiceArray } { } { - \bool_gset_true:N \g_@@_NiceArray_bool + \bool_gset_false:N \g_@@_delims_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 -% |\g_@@_NiceArray_bool| is raised). +% |\g_@@_delims_bool| is set to false). % \begin{macrocode} \NiceArrayWithDelims . . } @@ -6977,7 +7020,7 @@ version 2005/12/01 or later. { \NewDocumentEnvironment { #1 NiceArray } { } { - \bool_gset_false:N \g_@@_NiceArray_bool + \bool_gset_true:N \g_@@_delims_bool \str_if_empty:NT \g_@@_name_env_str { \str_gset:Nn \g_@@_name_env_str { #1 NiceArray } } \@@_test_if_math_mode: @@ -7003,9 +7046,12 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_begin_of_NiceMatrix:nn #1 #2 { - \bool_set_true:N \l_@@_Matrix_bool - \use:c { #1 NiceArray } - { + \bool_set_false:N \l_@@_preamble_bool + \tl_clear:N \l_tmpa_tl + \bool_if:NT \l_@@_NiceMatrix_without_vlines_bool + { \tl_set:Nn \l_tmpa_tl { @ { } } } + \tl_put_right:Nn \l_tmpa_tl + { * { \int_case:nnF \l_@@_last_col_int @@ -7021,6 +7067,8 @@ version 2005/12/01 or later. } { #2 } } + \tl_set:Nn \l_tmpb_tl { \use:c { #1 NiceArray } } + \exp_args:NV \l_tmpb_tl \l_tmpa_tl } % \end{macrocode} % @@ -7033,7 +7081,7 @@ version 2005/12/01 or later. { \NewDocumentEnvironment { #1 NiceMatrix } { ! O { } } { - \bool_gset_false:N \g_@@_NiceArray_bool + \bool_gset_true:N \g_@@_delims_bool \str_gset:Nn \g_@@_name_env_str { #1 NiceMatrix } \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 } \@@_begin_of_NiceMatrix:nV { #1 } \l_@@_columns_type_tl @@ -7047,9 +7095,12 @@ version 2005/12/01 or later. % \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 } + \bool_lazy_or:nnT + { \clist_if_empty_p:N \l_@@_vlines_clist } + { \l_@@_except_borders_bool } + { \bool_set_true:N \l_@@_NiceMatrix_without_vlines_bool } \@@_begin_of_NiceMatrix:nV { } \l_@@_columns_type_tl } { \endNiceArray } @@ -7077,36 +7128,6 @@ version 2005/12/01 or later. { \dim_set_eq:NN \l_@@_width_dim \linewidth } \str_gset:Nn \g_@@_name_env_str { NiceTabular } \keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 } - \int_compare:nNnT \l_@@_tab_rounded_corners_dim > \c_zero_dim - { - \bool_if:NT \l_@@_hvlines_bool - { - \bool_set_true:N \l_@@_except_borders_bool - % we should try to be more efficient in the number of lines of code here - \tl_if_empty:NTF \l_@@_rules_color_tl - { - \tl_gput_right:Nn \g_@@_pre_code_after_tl - { - \@@_stroke_block:nnn - { rounded-corners = \dim_use:N \l_@@_tab_rounded_corners_dim } - { 1-1 } - { \int_use:N \c@iRow - \int_use:N \c@jCol } - } - } - { - \tl_gput_right:Nn \g_@@_pre_code_after_tl - { - \@@_stroke_block:nnn - { - rounded-corners = \dim_use:N \l_@@_tab_rounded_corners_dim , - draw = \l_@@_rules_color_tl - } - { 1-1 } - { \int_use:N \c@iRow - \int_use:N \c@jCol } - } - } - } - } \tl_if_empty:NF \l_@@_short_caption_tl { \tl_if_empty:NT \l_@@_caption_tl @@ -7131,7 +7152,7 @@ version 2005/12/01 or later. } } { } - \bool_set_true:N \l_@@_NiceTabular_bool + \bool_set_true:N \l_@@_tabular_bool \NiceArray { #2 } } { \endNiceArray } @@ -7166,7 +7187,7 @@ version 2005/12/01 or later. \dim_zero_new:N \l_@@_width_dim \dim_set:Nn \l_@@_width_dim { #1 } \keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 } - \bool_set_true:N \l_@@_NiceTabular_bool + \bool_set_true:N \l_@@_tabular_bool \NiceArray { #3 } } { \endNiceArray } @@ -7179,7 +7200,7 @@ version 2005/12/01 or later. \str_gset:Nn \g_@@_name_env_str { NiceTabular* } \dim_set:Nn \l_@@_tabular_width_dim { #1 } \keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 } - \bool_set_true:N \l_@@_NiceTabular_bool + \bool_set_true:N \l_@@_tabular_bool \NiceArray { #3 } } { \endNiceArray } @@ -7189,6 +7210,33 @@ version 2005/12/01 or later. % \bigskip % \section{After the construction of the array} % +% \bigskip +% \begin{macrocode} +\cs_new_protected:Npn \@@_deal_with_rounded_corners: + { + \bool_lazy_all:nT + { + { \int_compare_p:nNn \l_@@_tab_rounded_corners_dim > \c_zero_dim } + \l_@@_hvlines_bool + { ! \g_@@_delims_bool } + { ! \l_@@_except_borders_bool } + } + { + \bool_set_true:N \l_@@_except_borders_bool + \tl_gput_right:Nn \g_@@_pre_code_after_tl + { + \_@@_stroke_block:nnn + { + rounded-corners = \dim_use:N \l_@@_tab_rounded_corners_dim , + draw = \l_@@_rules_color_tl + } + { 1-1 } + { \int_use:N \c@iRow - \int_use:N \c@jCol } + } + } + } +% +% % \medskip % \begin{macrocode} \cs_new_protected:Npn \@@_after_array: @@ -7383,6 +7431,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} + \@@_deal_with_rounded_corners: \tl_if_empty:NF \l_@@_hlines_clist \@@_draw_hlines: \tl_if_empty:NF \l_@@_vlines_clist \@@_draw_vlines: % \end{macrocode} @@ -7450,7 +7499,7 @@ version 2005/12/01 or later. % % \medskip % |\g_@@_pre_code_before_tl| is for instructions in the cells of the array such as -% |\rowcolor| and |\cellcolor| (when the key |colortbl-like| is in +% |\rowcolor| and |\cellcolor| (when the key |color-inside| is in % force). These instructions will be written on the |aux| file to be added to % the |code-before| in the next run. % \begin{macrocode} @@ -9258,10 +9307,24 @@ version 2005/12/01 or later. % The command |\@@_rotate:| will be linked to |\rotate| in % |{NiceArrayWithDelims}|. % \begin{macrocode} -\cs_new_protected:Npn \@@_rotate: { \bool_gset_true:N \g_@@_rotate_bool } +\NewDocumentCommand \@@_rotate: { O { } } + { + \bool_gset_true:N \g_@@_rotate_bool + \keys_set:nn { NiceMatrix / rotate } { #1 } + } % \end{macrocode} % % \bigskip +% \begin{macrocode} +\keys_define:nn { NiceMatrix / rotate } + { + c .code:n = \bool_gset_true:N \g_@@_rotate_c_bool , + c .value_forbidden:n = true , + unknown .code:n = \@@_error:n { Unknown~key~for~rotate } + } +% \end{macrocode} +% +% \bigskip % \section{The command \textbackslash line accessible in code-after} % % In the |\CodeAfter|, the command |\@@_line:nn| will be linked to |\line|. This @@ -9858,6 +9921,9 @@ version 2005/12/01 or later. % 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]|. +% +% In \pkg{nicematrix}, the commmand |\@@_rowcolors| apperas as a special case of +% |\@@_rowlistcolors|. % % |#1| (optional) is the color space ; % |#2| is a list of intervals of rows ; @@ -9909,9 +9975,8 @@ version 2005/12/01 or later. % index of the loop over the rows. % \begin{macrocode} \int_set:Nn \l_tmpa_int \l_tmpa_tl - \bool_if:NTF \l_@@_rowcolors_restart_bool - { \int_set:Nn \l_@@_color_int 1 } - { \int_set:Nn \l_@@_color_int \l_tmpa_tl } + \int_set:Nn \l_@@_color_int + { \bool_if:NTF \l_@@_rowcolors_restart_bool 1 \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 @@ -9979,10 +10044,11 @@ version 2005/12/01 or later. % % \bigskip % The command |\rowcolors| (available in the |\CodeBefore|) is a specialisation -% of the most general command |\rowlistcolors|. +% of the most general command |\rowlistcolors|. The last argument, which is a +% optional argument between square brackets is provided by curryfication. % \begin{macrocode} -\NewDocumentCommand \@@_rowcolors { O { } m m m O { } } - { \@@_rowlistcolors [ #1 ] { #2 } { { #3 } , { #4 } } [ #5 ] } +\NewDocumentCommand \@@_rowcolors { O { } m m m } + { \@@_rowlistcolors [ #1 ] { #2 } { { #3 } , { #4 } } } % \end{macrocode} % % \bigskip @@ -10155,7 +10221,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% When the user uses the key |colortbl-like|, the following command will +% When the user uses the key |color-inside|, the following command will % be linked to |\cellcolor| in the tabular. % \begin{macrocode} \NewDocumentCommand \@@_cellcolor_tabular { O { } m } @@ -10175,7 +10241,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% When the user uses the key |colortbl-like|, the following command will +% When the user uses the key |color-inside|, the following command will % be linked to |\rowcolor| in the tabular. % \begin{macrocode} \NewDocumentCommand \@@_rowcolor_tabular { O { } m } @@ -10190,6 +10256,31 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% When the user uses the key |color-inside|, the following command will +% be linked to |\rowcolors| in the tabular. The last argument (an optional +% argument between square brackets is taken by curryfication). +% \begin{macrocode} +\NewDocumentCommand { \@@_rowcolors_tabular } { O { } m m } + { \@@_rowlistcolors_tabular [ #1 ] { #2 , #3 } } +% \end{macrocode} +% +% \bigskip +% When the user uses the key |color-inside|, the following command will +% be linked to |\rowlistcolors| in the tabular. +% \begin{macrocode} +\NewDocumentCommand { \@@_rowlistcolors_tabular } { O { } m O { } } + { + \peek_remove_spaces:n + { + \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl + { + \@@_rowlistcolors + [ #1 ] { \int_use:N \c@iRow } { #2 } [ restart, #3 ] + } + } + } +% \end{macrocode} % % \bigskip % \begin{macrocode} @@ -10272,7 +10363,13 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_OnlyMainNiceMatrix_i:n #1 { \int_compare:nNnF \c@iRow = 0 - { \int_compare:nNnF \c@iRow = \l_@@_last_row_int { #1 } } + { + \int_compare:nNnF \c@iRow = \l_@@_last_row_int + { + \int_compare:nNnT \c@jCol > \c_zero_int + { \bool_if:NF \l_@@_in_last_col_bool { #1 } } + } + } } % \end{macrocode} % Remember that |\c@iRow| is not always inferior to |\l_@@_last_row_int| because @@ -10582,11 +10679,11 @@ version 2005/12/01 or later. { \int_step_inline:nnn { - \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool } + \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } 1 2 } { - \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool } + \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } { \int_eval:n { \c@jCol + 1 } } \c@jCol } @@ -10839,7 +10936,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 \g_@@_NiceArray_bool + \bool_if:NF \g_@@_delims_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 @@ -10854,7 +10951,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 \g_@@_NiceArray_bool + \bool_if:NF \g_@@_delims_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 } } @@ -10898,11 +10995,11 @@ version 2005/12/01 or later. { \int_step_inline:nnn { - \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool } + \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } 1 2 } { - \bool_if:nTF { \g_@@_NiceArray_bool && ! \l_@@_except_borders_bool } + \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } { \int_eval:n { \c@iRow + 1 } } \c@iRow } @@ -12007,8 +12104,23 @@ version 2005/12/01 or later. % |\NewExpandableDocumentCommand| because it has an optional argument between % |<| and |>|. It's mandatory to use an expandable command. % +% % \begin{macrocode} -\NewExpandableDocumentCommand \@@_Block: { O { } m D < > { } +m } +\cs_new_protected:Npn \@@_block:n #1 + { + \peek_meaning:NTF [ + { \@@_block_i:n { #1 } } + { \@@_Block_i:[#1] } + } + +\cs_new_protected:Npn \@@_block_i:n #1[#2] { \@@_block:n {#1,#2} } + +\cs_new_protected:Npn \@@_Block: { \@@_block:n { } } +% \end{macrocode} +% +% \bigskip +% \begin{macrocode} +\NewExpandableDocumentCommand \@@_Block_i: { O { } m D < > { } +m } { % \end{macrocode} % If the first mandatory argument of the command (which is the size of the block @@ -12210,8 +12322,8 @@ version 2005/12/01 or later. % the tabular is the same as the external alignment of the tabular (that is to % say the position of the block in its zone of merged cells). % \begin{macrocode} - \bool_if:NT \g_@@_rotate_bool { \str_set:Nn \l_@@_hpos_block_str c } - \bool_if:NTF \l_@@_NiceTabular_bool + \bool_if:NT \g_@@_rotate_bool { \str_set:Nn \l_@@_hpos_block_str c } + \bool_if:NTF \l_@@_tabular_bool { \bool_lazy_all:nTF { @@ -12268,6 +12380,20 @@ version 2005/12/01 or later. \box_grotate:cn { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } { 90 } + \bool_if:NT \g_@@_rotate_c_bool + { + \hbox_gset:cn + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + { + \c_math_toggle_token + \vcenter + { + \box_use:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + \c_math_toggle_token + } + } \bool_gset_false:N \g_@@_rotate_bool } % \end{macrocode} @@ -12321,12 +12447,17 @@ version 2005/12/01 or later. % alignment and that's why we put a key corresponding to the value of % |\l_@@_hpos_block_str|, which is fixed by the type of current column. % \begin{macrocode} - { \exp_not:n { #3 } , \l_@@_hpos_block_str } + { + \exp_not:n { #3 } , + \l_@@_hpos_block_str , + \bool_if:NT \g_@@_rotate_c_bool { v-center } + } { \box_use_drop:c { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } } } + \bool_set_false:N \g_@@_rotate_c_bool } % \end{macrocode} % @@ -12343,7 +12474,7 @@ version 2005/12/01 or later. \l_tmpa_tl { \exp_not:n { #3 } } { - \bool_if:NTF \l_@@_NiceTabular_bool + \bool_if:NTF \l_@@_tabular_bool { \group_begin: \bool_if:NF \l_@@_respect_arraystretch_bool @@ -12539,6 +12670,7 @@ version 2005/12/01 or later. % % % \medskip +% The following command |\@@_Block_v:nnnnnn| will actually draw the block. % |#1| is the first row of the block; % |#2| is the first column of the block; % |#3| is the last row of the block; @@ -13061,7 +13193,8 @@ version 2005/12/01 or later. \keys_define:nn { NiceMatrix / BlockStroke } { color .tl_set:N = \l_@@_draw_tl , - draw .tl_set:N = \l_@@_draw_tl , + draw .code:n = + \exp_args:Nx \tl_if_empty:nF { #1 } { \tl_set:Nn \l_@@_draw_tl { #1 } } , draw .default:n = default , line-width .dim_set:N = \l_@@_line_width_dim , rounded-corners .dim_set:N = \l_@@_rounded_corners_dim , @@ -13328,6 +13461,8 @@ version 2005/12/01 or later. delimiters / max-width .default:n = true , delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } , delimiters .value_required:n = true , + rounded-corners .dim_set:N = \l_@@_tab_rounded_corners_dim , + rounded-corners .default:n = 4 pt } % \end{macrocode} % @@ -13345,20 +13480,13 @@ version 2005/12/01 or later. % The group is for the protection of the keys. % \begin{macrocode} \group_begin: - \bool_set_true:N \l_@@_Matrix_bool - \str_if_eq:nnT { #1 } { . } - { - \str_if_eq:nnT { #2 } { . } - { \bool_set_false:N \l_@@_Matrix_bool } - } \keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl % \end{macrocode} -% We nullify the command |\@@_transform_preamble:| because we will provide a +% We nullify the command |\@@_transform_preamble_i:| 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: + \bool_set_false:N \l_@@_preamble_bool \use:x { \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } @@ -13394,13 +13522,12 @@ version 2005/12/01 or later. } % \end{macrocode} % -% % \begin{macrocode} \cs_set_protected:Npn \@@_define_com:nnn #1 #2 #3 { \cs_set_protected:cpn { #1 AutoNiceMatrix } { - \bool_gset_false:N \g_@@_NiceArray_bool + \bool_gset_true:N \g_@@_delims_bool \str_gset:Nx \g_@@_name_env_str { #1 AutoNiceMatrix } \AutoNiceMatrixWithDelims { #2 } { #3 } } @@ -13421,8 +13548,7 @@ version 2005/12/01 or later. \NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } } { \group_begin: - \bool_gset_true:N \g_@@_NiceArray_bool - % \bool_set_true:N \l_@@_Matrix_bool + \bool_gset_false:N \g_@@_delims_bool \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ] \group_end: } @@ -14817,7 +14943,7 @@ version 2005/12/01 or later. % The class \cls{beamer} has its own system to extract footnotes and that's why % we have nothing to do if \cls{beamer} is used. % \begin{macrocode} - \IfClassLoadeTF { beamer } + \IfClassLoadedTF { beamer } { \bool_set_false:N \c_@@_footnote_bool } { \IfPackageLoadedTF { footnotehyper } @@ -15146,7 +15272,16 @@ version 2005/12/01 or later. { Unknown~key.\\ There~is~only~two~keys~available~here:~width~and~color.\\ - You~key~'\l_keys_key_str'~will~be~ignored. + Your~key~'\l_keys_key_str'~will~be~ignored. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { Unknown~key~for~rotate } + { + Unknown~key.\\ + The~only~key~available~here~is~'c'.\\ + Your~key~'\l_keys_key_str'~will~be~ignored. } % \end{macrocode} % @@ -15887,6 +16022,7 @@ version 2005/12/01 or later. renew-dots,~ renew-matrix,~ respect-arraystretch,~ + rounded-corners,~ right-margin,~ rules~(with~the~subkeys~'color'~and~'width'),~ small,~ @@ -15920,7 +16056,7 @@ version 2005/12/01 or later. code-for-first-row,~ code-for-last-col,~ code-for-last-row,~ - colortbl-like,~ + color-inside,~ columns-width,~ corners,~ create-extra-nodes,~ @@ -15943,6 +16079,7 @@ version 2005/12/01 or later. renew-dots,~ respect-arraystretch,~ right-margin,~ + rounded-corners,~ rules~(with~the~subkeys~'color'~and~'width'),~ small,~ t,~ @@ -15981,7 +16118,7 @@ version 2005/12/01 or later. code-for-first-row,~ code-for-last-col,~ code-for-last-row,~ - colortbl-like,~ + color-inside,~ columns-type,~ columns-width,~ corners,~ @@ -16007,6 +16144,7 @@ version 2005/12/01 or later. renew-dots,~ respect-arraystretch,~ right-margin,~ + rounded-corners,~ rules~(with~the~subkeys~'color'~and~'width'),~ small,~ t,~ @@ -16042,7 +16180,7 @@ version 2005/12/01 or later. code-for-first-row,~ code-for-last-col,~ code-for-last-row,~ - colortbl-like,~ + color-inside,~ columns-width,~ corners,~ custom-line,~ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf index de3bb30332..af7f6d735e 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix-french.pdf and b/macros/latex/contrib/nicematrix/nicematrix-french.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex index 6fd43c26a6..072769dfa6 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -715,7 +715,7 @@ la consigne générale donnée dans le préambule pour cette colonne (cf.~\ref{h |\Block| ou colorier le fond avec des bords arrondis avec les clés |fill| et |rounded-corners|.\footnote{Pour colorier simplement le fond d'une case, il n'y a pas besoin d'utiliser un bloc mono-case : on peut utiliser la commande |\cellcolor| si la - clé |colortbl-like| est utilisée : voir p.~\pageref{colortbl-like}.} + clé |color-inside| est utilisée : voir p.~\pageref{color-inside}.} \item On peut tracer une ou plusieurs bordures de la case avec la clé |borders|. \end{itemize} @@ -1806,8 +1806,6 @@ par une virgule) : l'extension \pkg{xcolor} ; \item \index{opacity (clé des commandes comme\newline \texttt{\textbackslash rowcolor}, etc.)} -\colorbox{yellow!50}{\textbf{Nouveau 6.18}} - une spécification d'opacité selon la forme \texttt{opacity = \textsl{valeur}}.\footnote{Attention : cette fonctionnalité génère des instructions de transparence dans le \textsc{pdf} résultant et certains lecteurs de @@ -2119,7 +2117,7 @@ Stéphanie \\ On peut aussi utiliser dans la commande |\rowlistcolors| une série de couleurs définie par la commande |\definecolorseries| de \pkg{xcolor} (et initialisée avec |\resetcolorseries|\footnote{Pour l'initialisation, on a - utilisé dans l'exemple qui suit le compteur |iRow| qui, quand il est utilisé + utilisé dans l'exemple qui suit le compteur LaTeX |iRow| qui, quand il est utilisé dans le |\CodeBefore| (ou le |\CodeAfter|) désigne le nombre de rangées du tableau : cf~p.~\pageref{iRow}. Cela permet un ajustement de la gradation des couleurs à la taille du tableau.}). @@ -2258,10 +2256,10 @@ spécial & 12 & 12 & 0.5 & 70 \\ On a utilisé le type de colonne |S| de \pkg{siunitx}. -\subsection{Outils de coloriage avec la syntaxe de colortbl} +\subsection{Outils de coloriage en tableau} -\label{colortbl-like} -\index{colortbl-like} +\label{color-inside} +\index{color-inside} \index{cellcolor@\texttt{\textbackslash cellcolor}!commande en tableau} \index{rowcolor@\texttt{\textbackslash rowcolor}!commande en tableau} \index{columncolor@\texttt{\textbackslash columncolor}!commande dans le @@ -2269,11 +2267,13 @@ On a utilisé le type de colonne |S| de \pkg{siunitx}. On peut accéder aux outils de coloriage précédents avec une syntaxe proche de celle proposée par \pkg{colortbl} (même si \pkg{colortbl} n'est pas chargé). On -doit pour cela utiliser la clé |colortbl-like| dans l'environnement +doit pour cela utiliser la clé |color-inside|\footnote{Il existe un alias pour + cette clé : \texttt{colortbl-like}.} dans l'environnement concerné.\footnote{Pour le moment, cette clé n'est \emph{pas} disponible dans |\NiceMatrixOptions|.} -On a alors accès aux trois commandes suivantes : +On a alors accès aux commandes suivantes (les trois premières sont inspirées par +\pkg{colortbl} mais sont indépendantes de \pkg{colortbl}) : \begin{itemize} \item |\cellcolor| qui colorie la case courante\footnote{Néanmoins, cette commande |\cellcolor| supprimera les espaces qui la suivent, ce que ne fait @@ -2284,13 +2284,17 @@ On a alors accès aux trois commandes suivantes : que la commande éponyme de \pkg{colortbl} (néanmoins, contrairement à la commande |\columncolor| de \pkg{colortbl}, celle de \pkg{nicematrix} peut apparaître à l'intérieur d'une autre commande, elle-même utilisée dans le -préambule). +préambule) ; +\item \colorbox{yellow!50}{\textbf{Nouveau 6.21}}\enskip |\rowcolors| qui prend pour arguments deux couleurs et colorie la suite du +tableau avec ces deux couleurs ; +\item \colorbox{yellow!50}{\textbf{Nouveau 6.21}}\enskip |\rowlistcolors| qui prend pour argument une liste de couleurs et colorie +la suite du tableau avec ces couleurs. \end{itemize} \medskip \begin{Verbatim} \NewDocumentCommand { \Blue } { } {~emphase#\columncolor{blue!15}@} -\begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} +\begin{NiceTabular}[color-inside]{>{\Blue}c>{\Blue}cc} \toprule ~emphase#\rowcolor{red!15}@ Nom & Prénom & Année de naissance \\ @@ -2306,7 +2310,7 @@ Dupont & Chantal & 15 janvier 1998 \\ \begin{center} \NewDocumentCommand { \Blue } { } {\columncolor{blue!15}} -\begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} +\begin{NiceTabular}[color-inside]{>{\Blue}c>{\Blue}cc} \toprule \rowcolor{red!15} Nom & Prénom & Année de naissance \\ @@ -2350,7 +2354,7 @@ La clé |rowcolor| fixe la couleur de fond et la clé |color| fixe la couleur du texte.\footnote{La clé |color| utilise la commande |\color| mais insère aussi une instruction |\leavevmode| devant. Cela évite un espace vertical parasite dans les cases qui correspondent à des colonnes de type - |p|, |b|, |m|, |X| et |V| (qui débutent en mode vertical).} + |p|, |b|, |m|, |X| et |V| (qui débutent en mode vertical de LateX).} \item \index{bold (clé de \texttt{\textbackslash RowStyle})} La clé |bold| impose des caractères gras aux éléments de la rangée, qu'ils @@ -4429,34 +4433,38 @@ la clé |caption| à la partie \ref{s:caption}, p.~\pageref{s:caption}). \section{Autres fonctionnalités} -\subsection{La clé rounded-corners de \{NiceTabular\}} +\subsection{La clé rounded-corners} \label{tabular-rounded-corners} \index{rounded-corners!clé de \texttt{\{NiceTabular\}}} \index{Coins arrondis!pour un tableau} -\colorbox{yellow!50}{\textbf{Nouveau 6.18}}\par\nobreak - -\smallskip La clé |rounded-corners| que l'on décrit maintenant n'a pas de lien direct avec la clé |corners| (qui sert à spécifier les «coins vides») décrite à la partie~\ref{corners}, p.~\pageref{corners}. \smallskip -L'environnement |{NiceTabular}| propose une clé |rounded-corners| qui spécifie -que le tableau devra avoir des coins arrondis avec le rayon égal à la valeur -de cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur est la valeur - par défaut des «\texttt{rounded corners}» de PGF/Tikz.}). Plus précisément, -cette clé a deux effets que l'on décrit maintenant. +La clé |rounded-corners| spécifie que le tableau ou la matrice devra avoir des +coins arrondis avec un rayon égal à la valeur de cette clé (la valeur par défaut est +4~pt\footnote{Cette valeur est la valeur par défaut des «\texttt{rounded + corners}» de PGF/Tikz.}). Plus précisément, cette clé a deux effets que l'on +décrit maintenant. \begin{itemize} \item Toutes les commandes de coloriage de cases, colonnes et rangées (que ce soit dans le |\CodeBefore| ou bien directement dans le tableau (quand la clé -|colortbl-like| est utilisée) respectent ces coins arrondis pour le tableau. +|color-inside| est utilisée) respectent ces coins arrondis pour le tableau. \item Quand la clé |hvlines| est utilisée, les filets extérieurs sont tracés -avec des coins arrondis. +avec des coins arrondis.\footnote{Bien sûr, lorsqu'il s'agit d'un environnement + avec des délimiteurs (|{pNiceArray}|, |{pNiceMatrix}|, etc.) la clé + |hvlines| ne trace pas les filets extérieurs.} \end{itemize} +\bigskip +\colorbox{yellow!50}{\textbf{Nouveau 6.21}} Cette clé est disponible dans tous +les environnements et commandes de \pkg{nicematrix} (comme +|\pAutoNiceMatrix|) et également dans |\NiceMatrixOptions|. + \bigskip \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] \begin{NiceTabular}{ccc}[hvlines,~emphase#rounded-corners@] @@ -4644,6 +4652,19 @@ $A = \begin{pNiceMatrix}[last-row,last-col=4] \end{pNiceMatrix}$ \end{varwidth} +\bigskip +\colorbox{yellow!50}{\textbf{Nouveau 6.21}}\enskip La commande |\rotate| accepte +une option |c| entre crochets : |\rotate[c]|. Quand cette clé est utilisée, le +contenu, après rotation, est composé dans une |\vcenter|, ce qui fait que, le +plus souvent, on obtiendra un centrage vertical. + + +\medskip +Attention : la commande |\rotate| est prévue pour être utilisée dans un |\Block| +ou bien dans des colonnes de type |l|, |c|, |r|, |w| ou |W|; si elle est +utilisée dans un autre type de colonne (commme |p{...}|), les résultats ne +seront peut-être pas ceux attendus. + \subsection{L'option small} @@ -4883,9 +4904,9 @@ $\begin{NiceArrayWithDelims} \indexcommand{OnlyMainNiceMatrix} La commande |\OnlyMainNiceMatrix| n'exécute son argument que si on se trouve -dans le tableau principal, c'est-à-dire que l'on n'est pas dans les rangées -extérieures. Si elle est utilisée hors d'un environnement de \pkg{nicematrix}, -elle est sans effet. +dans le tableau principal, c'est-à-dire que l'on est ni dans les rangées +extérieures, ni dans les colonnes extérieures. Si elle est utilisée hors d'un +environnement de \pkg{nicematrix}, elle est sans effet. Pour un exemple d'utilisation, voir \url{tex.stackexchange.com/questions/488566} @@ -6657,14 +6678,14 @@ composantes de la matrice.\footnote{Pour la commande |\cline|, voir la remarque \vspace{1cm} Il est possible de colorier une rangée avec |\rowcolor| dans le |\CodeBefore| (ou avec |\rowcolor| dans une case de la rangée si on utilise la clé -|colortbl-like| − même si \pkg{colortbl} n'est pas chargé). +|color-inside| − même si \pkg{colortbl} n'est pas chargé). -\index{colortbl-like|textit} +\index{color-inside|textit} \index{rowcolor@\texttt{\textbackslash rowcolor}!commande en tableau|textit} \begin{Verbatim} -\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,colortbl-like] +\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] ~emphase#\rowcolor{red!15}@A_{11} & A_{12} & A_{13} & A_{14} \\ A_{21} & ~emphase#\rowcolor{red!15}@A_{22} & A_{23} & A_{24} \\ A_{31} & A_{32} & ~emphase#\rowcolor{red!15}@A_{33} & A_{34} \\ @@ -6674,7 +6695,7 @@ Il est possible de colorier une rangée avec |\rowcolor| dans le |\CodeBefore| -\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,colortbl-like] +\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] \rowcolor{red!15}A_{11} & A_{12} & A_{13} & A_{14} \\ A_{21} & \rowcolor{red!15}A_{22} & A_{23} & A_{24} \\ A_{31} & A_{32} & \rowcolor{red!15}A_{33} & A_{34} \\ diff --git a/macros/latex/contrib/nicematrix/nicematrix.ins b/macros/latex/contrib/nicematrix/nicematrix.ins index 2fff6fcb8c..838315cbb2 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.ins +++ b/macros/latex/contrib/nicematrix/nicematrix.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2018-2022 by F. Pantigny +%% Copyright (C) 2018-2023 by F. Pantigny %% %% %% This file may be distributed and/or modified under the diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf index ec37719356..7a7606184d 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix.pdf and b/macros/latex/contrib/nicematrix/nicematrix.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix.tex b/macros/latex/contrib/nicematrix/nicematrix.tex index 9987ba819b..91758773dd 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.tex +++ b/macros/latex/contrib/nicematrix/nicematrix.tex @@ -687,7 +687,7 @@ derogation of the type of column given in the preamble of the array. command |\Block| and to fill the background with rounded corners with the keys |fill| and |rounded-corners|.\footnote{If one simply wishes to color the background of a unique cell, there is no point using the command |\Block|: -it's possible to use the command |\cellcolor| (when the key |colortbl-like| is +it's possible to use the command |\cellcolor| (when the key |color-inside| is used).} \item It's possible to draw one or several borders of the cell with the key |borders|. @@ -1753,7 +1753,6 @@ by a comma) \item the colorimetric space (|RGB|, |rgb|, |HTML|, etc) as specified by the the extension \pkg{xcolor}; \item \index{opacity (key of commands such as\newline \texttt{\textbackslash rowcolor}, etc.)} -\colorbox{yellow!50}{\textbf{New 6.18}}\par\nobreak a specification of opacity of the form \texttt{opacity = \textsl{value}}.\footnote{Caution : that feature creates instructions of transparency in the \textsc{pdf} and some \textsc{pdr} don't support such instructions.} @@ -2198,9 +2197,9 @@ special & 12 & 12 & 0.5 & 70 \\ We have used the type of column |S| of \pkg{siunitx}. -\subsection{Color tools with the syntax of colortbl} +\subsection{Color tools to be used inside the tabular} -\index{colortbl-like} +\index{color-inside} \index{cellcolor@\texttt{\textbackslash cellcolor}!command in tabular} \index{rowcolor@\texttt{\textbackslash rowcolor}!command in tabular} \index{columncolor@\texttt{\textbackslash columncolor}!command in the preamble @@ -2208,11 +2207,12 @@ We have used the type of column |S| of \pkg{siunitx}. It's possible to access the preceding tools with a syntax close to the syntax -of \pkg{colortbl}. For that, one must use the key |colortbl-like| in the +of \pkg{colortbl}. For that, one must use the key |color-inside|\footnote{There + is an alias for that key : \texttt{colortbl-like}.} in the current environment.\footnote{Up to now, this key is \emph{not} available in |\NiceMatrixOptions|.} -There are three commands available (they are inspired by \pkg{colortbl} but -are \emph{independent} of \pkg{colortbl}): +There are several commands available (the first three ones are inspired by +\pkg{colortbl} but are \emph{independent} of \pkg{colortbl}): \begin{itemize} \item |\cellcolor| which colorizes a cell;\footnote{However, this command |\cellcolor| will delete the following spaces, which does not the command @@ -2223,13 +2223,17 @@ the row; with the same syntax as the corresponding command of \pkg{colortbl} (however, unlike the command |\columncolor| of \pkg{colortbl}, this command |\columncolor| can appear within another command, itself used in the -preamble of the array). +preamble of the array); +\item \colorbox{yellow!50}{\textbf{New 6.21}}\enskip |\rowcolors| which takes in as arguments two colors and color the rest of +the tabular with those colors; +\item \colorbox{yellow!50}{\textbf{New 6.21}}\enskip |\rowlistcolors| which takes in as argument a color and color the rest of +the tabular with the colors of that list of colors. \end{itemize} \smallskip \begin{Verbatim} \NewDocumentCommand { \Blue } { } { ~emphase#\columncolor{blue!15}@ } -\begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} +\begin{NiceTabular}[color-inside]{>{\Blue}c>{\Blue}cc} \toprule ~emphase#\rowcolor{red!15}@ Last name & First name & Birth day \\ @@ -2245,7 +2249,7 @@ Dupont & Chantal & 15 janvier 1998 \\ \begin{center} \NewDocumentCommand { \Blue } { } { \columncolor{blue!15} } -\begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} +\begin{NiceTabular}[color-inside]{>{\Blue}c>{\Blue}cc} \toprule \rowcolor{red!15} Last name & First name & Birth day \\ @@ -2288,7 +2292,7 @@ color of the text.\footnote{The key |color| uses the command |\color| but inserts also an instruction |\leavevmode| before. This instruction prevents a extra vertical space in the cells which belong to columns of type |p|, |b|, |m|, |X| and |V| (which start in -vertical mode).} +vertical mode of LaTeX).} \item \index{bold (key of \texttt{\textbackslash RowStyle})} The key |bold| enforces bold characters for the cells of the row, both in math and text mode. \end{itemize} @@ -4331,34 +4335,37 @@ provided by \pkg{nicematrix} (see the key |caption| in the section \section{Other features} -\subsection{The key rounded-corners of \{NiceTabular\}} +\subsection{The key rounded-corners} \label{tabular-rounded-corners} \index{rounded-corners!key of \texttt{\{NiceTabular\}}} \index{Corners (rounded ---)!for a tabular} -\colorbox{yellow!50}{\textbf{New 6.18}}\par\nobreak - -\smallskip The key |rounded-corners| that we will describe now has no direct link with the key |corners| (which is used to specify ``empty corners'') described in the part~\ref{corners}, p.~\pageref{corners}. \smallskip -The environment |{NiceTabular}| provides a key |rounded-corners| which specify -that the tabular should have rounded corners with a radius equal to the value of -that key (the default value is 4~pt\footnote{This value is the initial value of - the \emph{rounded corners} of Tikz.}). More precisely, that key has two -effects that we describe now. +The key |rounded-corners| specifies that the tabular should have rounded corners +with a radius equal to the value of that key (the default value is +4~pt\footnote{This value is the initial value of the \emph{rounded corners} of + Tikz.}). More precisely, that key has two effects that we describe now. \begin{itemize} \item All the commands for coloring the cells, columns and rows (in the -|\CodeBefore| but also directly in the array when the key |colortbl-like| is +|\CodeBefore| but also directly in the array when the key |color-inside| is used) will respect those rounded corners. \item When the key |hvlines| is used, the exterior rules will be drawn with -rounded corners. +rounded corners.\footnote{Of course, when used in an environment with delimiters +(|{pNiceMatrix}|, |{bNiceArray}|, etc.), the key |hvlines| does not draw the +exterior rules.} \end{itemize} + +\colorbox{yellow!50}{New 6.21}\enskip That key is available in all +the environments and commands (e.g. |\pAutoNiceMatrix|) of \pkg{nicematrix} and also +in the command |\NiceMatrixOptions|. + \bigskip \begin{BVerbatim}[baseline=c,boxwidth=9cm] \begin{NiceTabular} @@ -4549,6 +4556,17 @@ $A = \begin{pNiceMatrix}[last-row=4,last-col=4] \end{pNiceMatrix}$ \end{varwidth} +\bigskip +\colorbox{yellow!50}{\textbf{New 6.21}}\enskip The command |\tabular| has a key +|c|: |\tabular[c]|. When that key is used, the content is composed in a +|\vcenter| and, therefore, in most cases, we will have a vertical alignment. + + + +\bigskip +Caution: the command |\rotate| is designed to be used in a |\Block| or in +columns of type |l|, |r|, |c|, |w| ou |W|; if it is used in other column types +(such as |p{...}|), the result will maybe differ from what is expected. \subsection{The option small} @@ -4788,8 +4806,8 @@ $\begin{NiceArrayWithDelims} The command |\OnlyMainNiceMatrix| executes its argument only when it is in the main part of the array, that is to say when it is not in one of the exterior -rows. If it is used outside an environment of \pkg{nicematrix}, that command is -no-op. +rows or one of the exterior columns. If it is used outside an environment of +\pkg{nicematrix}, that command is no-op. For an example of utilisation, see \url{tex.stackexchange.com/questions/488566} @@ -6561,16 +6579,16 @@ see the remark p.~\pageref{remark-cline}.} \vspace{1cm} It's possible to color a row with |\rowcolor| in the |code-before| (or with -|\rowcolor| in the first cell of the row if the key |colortbl-like| is +|\rowcolor| in the first cell of the row if the key |color-inside| is used−even when \pkg{colortbl} is not loaded). -\index{colortbl-like|textit} +\index{color-inside|textit} \index{rowcolor@\texttt{\textbackslash rowcolor}!command in tabular|textit} \medskip \begin{Verbatim} -\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,colortbl-like] +\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] ~emphase#\rowcolor{red!15}@A_{11} & A_{12} & A_{13} & A_{14} \\ A_{21} & ~emphase#\rowcolor{red!15}@A_{22} & A_{23} & A_{24} \\ A_{31} & A_{32} & ~emphase#\rowcolor{red!15}@A_{33} & A_{34} \\ @@ -6580,7 +6598,7 @@ used−even when \pkg{colortbl} is not loaded). -\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,colortbl-like] +\[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] \rowcolor{red!15}A_{11} & A_{12} & A_{13} & A_{14} \\ A_{21} & \rowcolor{red!15}A_{22} & A_{23} & A_{24} \\ A_{31} & A_{32} & \rowcolor{red!15}A_{33} & A_{34} \\ @@ -6885,6 +6903,15 @@ The successive versions of the file |nicematrix.sty| provided by TeXLive are ava \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} } +\subsection*{Changes between version 6.20a and 6.21} + +Key |c| for the command |\tabularnote|. + +New commands |\rowcolors| and |\rowlistcolors| available in the array itself +(previously, there were only two commands |\rowcolors| and |\rowlistcolors| +avaailable in the |\CodeBefore|. + + \subsection*{Changes between version 6.20 and 6.20a} The value of the key |name| of an environment of \pkg{nicematrix} is expanded -- cgit v1.2.3