diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 312 |
1 files changed, 170 insertions, 142 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index f08f221f1d0..153a9e97135 100644 --- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty +++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{6.28b} -\def\myfiledate{2024/06/29} +\def\myfileversion{6.28c} +\def\myfiledate{2024/08/22} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -811,7 +811,7 @@ \tl_new:N \l__nicematrix_xdots_color_tl \tl_new:N \l__nicematrix_delimiters_color_tl \bool_new:N \l__nicematrix_delimiters_max_width_bool -\keys_define:nn { NiceMatrix / xdots } +\keys_define:nn { nicematrix / xdots } { shorten-start .code:n = \hook_gput_code:nnn { begindocument } { . } @@ -855,7 +855,7 @@ draw-first .code:n = \prg_do_nothing: , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~xdots } } -\keys_define:nn { NiceMatrix / rules } +\keys_define:nn { nicematrix / rules } { color .tl_set:N = \l__nicematrix_rules_color_tl , color .value_required:n = true , @@ -863,7 +863,7 @@ width .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~rules } } -\keys_define:nn { NiceMatrix / Global } +\keys_define:nn { nicematrix / Global } { ampersand-in-blocks .bool_set:N = \l__nicematrix_amp_in_blocks_bool , ampersand-in-blocks .default:n = true , @@ -875,7 +875,7 @@ rounded-corners .dim_set:N = \l__nicematrix_tab_rounded_corners_dim , rounded-corners .default:n = 4 pt , custom-line .code:n = \__nicematrix_custom_line:n { #1 } , - rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , + rules .code:n = \keys_set:nn { nicematrix / rules } { #1 } , rules .value_required:n = true , standard-cline .bool_set:N = \l__nicematrix_standard_cline_bool , standard-cline .default:n = true , @@ -889,7 +889,7 @@ cell-space-bottom-limit = #1 , } , cell-space-limits .value_required:n = true , - xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , + xdots .code:n = \keys_set:nn { nicematrix / xdots } { #1 } , light-syntax .code:n = \bool_set_true:N \l__nicematrix_light_syntax_bool \bool_set_false:N \l__nicematrix_light_syntax_expanded_bool , @@ -965,7 +965,7 @@ pgf-node-code .tl_set:N = \l__nicematrix_pgf_node_code_tl , pgf-node-code .value_required:n = true } -\keys_define:nn { NiceMatrix / Env } +\keys_define:nn { nicematrix / environments } { corners .clist_set:N = \l__nicematrix_corners_clist , corners .default:n = { NW , SW , NE , SE } , @@ -1006,7 +1006,7 @@ color-inside .value_forbidden:n = true , colortbl-like .meta:n = color-inside } -\keys_define:nn { NiceMatrix / notes } +\keys_define:nn { nicematrix / notes } { para .bool_set:N = \l__nicematrix_notes_para_bool , para .default:n = true , @@ -1046,62 +1046,62 @@ detect-duplicates .default:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~notes } } -\keys_define:nn { NiceMatrix / delimiters } +\keys_define:nn { nicematrix / delimiters } { max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool , max-width .default:n = true , color .tl_set:N = \l__nicematrix_delimiters_color_tl , color .value_required:n = true , } -\keys_define:nn { NiceMatrix } +\keys_define:nn { nicematrix } { NiceMatrixOptions .inherit:n = - { NiceMatrix / Global } , - NiceMatrixOptions / xdots .inherit:n = NiceMatrix / xdots , - NiceMatrixOptions / rules .inherit:n = NiceMatrix / rules , - NiceMatrixOptions / notes .inherit:n = NiceMatrix / notes , - NiceMatrixOptions / sub-matrix .inherit:n = NiceMatrix / sub-matrix , - SubMatrix / rules .inherit:n = NiceMatrix / rules , - CodeAfter / xdots .inherit:n = NiceMatrix / xdots , - CodeBefore / sub-matrix .inherit:n = NiceMatrix / sub-matrix , - CodeAfter / sub-matrix .inherit:n = NiceMatrix / sub-matrix , + { nicematrix / Global } , + NiceMatrixOptions / xdots .inherit:n = nicematrix / xdots , + NiceMatrixOptions / rules .inherit:n = nicematrix / rules , + NiceMatrixOptions / notes .inherit:n = nicematrix / notes , + NiceMatrixOptions / sub-matrix .inherit:n = nicematrix / sub-matrix , + SubMatrix / rules .inherit:n = nicematrix / rules , + CodeAfter / xdots .inherit:n = nicematrix / xdots , + CodeBefore / sub-matrix .inherit:n = nicematrix / sub-matrix , + CodeAfter / sub-matrix .inherit:n = nicematrix / sub-matrix , NiceMatrix .inherit:n = { - NiceMatrix / Global , - NiceMatrix / Env , + nicematrix / Global , + nicematrix / environments , } , - NiceMatrix / xdots .inherit:n = NiceMatrix / xdots , - NiceMatrix / rules .inherit:n = NiceMatrix / rules , + NiceMatrix / xdots .inherit:n = nicematrix / xdots , + NiceMatrix / rules .inherit:n = nicematrix / rules , NiceTabular .inherit:n = { - NiceMatrix / Global , - NiceMatrix / Env + nicematrix / Global , + nicematrix / environments } , - NiceTabular / xdots .inherit:n = NiceMatrix / xdots , - NiceTabular / rules .inherit:n = NiceMatrix / rules , - NiceTabular / notes .inherit:n = NiceMatrix / notes , + NiceTabular / xdots .inherit:n = nicematrix / xdots , + NiceTabular / rules .inherit:n = nicematrix / rules , + NiceTabular / notes .inherit:n = nicematrix / notes , NiceArray .inherit:n = { - NiceMatrix / Global , - NiceMatrix / Env , + nicematrix / Global , + nicematrix / environments , } , - NiceArray / xdots .inherit:n = NiceMatrix / xdots , - NiceArray / rules .inherit:n = NiceMatrix / rules , + NiceArray / xdots .inherit:n = nicematrix / xdots , + NiceArray / rules .inherit:n = nicematrix / rules , pNiceArray .inherit:n = { - NiceMatrix / Global , - NiceMatrix / Env , + nicematrix / Global , + nicematrix / environments , } , - pNiceArray / xdots .inherit:n = NiceMatrix / xdots , - pNiceArray / rules .inherit:n = NiceMatrix / rules , + pNiceArray / xdots .inherit:n = nicematrix / xdots , + pNiceArray / rules .inherit:n = nicematrix / rules , } -\keys_define:nn { NiceMatrix / NiceMatrixOptions } +\keys_define:nn { nicematrix / NiceMatrixOptions } { delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters / color .value_required:n = true , delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool , delimiters / max-width .default:n = true , - delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } , + delimiters .code:n = \keys_set:nn { nicematrix / delimiters } { #1 } , delimiters .value_required:n = true , width .dim_set:N = \l__nicematrix_width_dim , width .value_required:n = true , @@ -1121,9 +1121,9 @@ allow-duplicate-names .code:n = \__nicematrix_msg_redirect_name:nn { Duplicate~name } { none } , allow-duplicate-names .value_forbidden:n = true , - notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } , + 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 .tl_set:N = \l__nicematrix_columns_type_tl , matrix / columns-type .value_required:n = true , @@ -1132,8 +1132,8 @@ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrixOptions } } \NewDocumentCommand \NiceMatrixOptions { m } - { \keys_set:nn { NiceMatrix / NiceMatrixOptions } { #1 } } -\keys_define:nn { NiceMatrix / NiceMatrix } + { \keys_set:nn { nicematrix / NiceMatrixOptions } { #1 } } +\keys_define:nn { nicematrix / NiceMatrix } { last-col .code:n = \tl_if_empty:nTF { #1 } { @@ -1149,13 +1149,13 @@ delimiters / color .value_required:n = true , delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool , delimiters / max-width .default:n = true , - delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } , + delimiters .code:n = \keys_set:nn { nicematrix / delimiters } { #1 } , delimiters .value_required:n = true , small .bool_set:N = \l__nicematrix_small_bool , small .value_forbidden:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix } } -\keys_define:nn { NiceMatrix / NiceArray } +\keys_define:nn { nicematrix / NiceArray } { small .bool_set:N = \l__nicematrix_small_bool , small .value_forbidden:n = true , @@ -1166,7 +1166,7 @@ l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceArray } } -\keys_define:nn { NiceMatrix / pNiceArray } +\keys_define:nn { nicematrix / pNiceArray } { first-col .code:n = \int_zero:N \l__nicematrix_first_col_int , last-col .code:n = \tl_if_empty:nF {#1} @@ -1177,7 +1177,7 @@ delimiters / color .value_required:n = true , delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool , delimiters / max-width .default:n = true , - delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } , + delimiters .code:n = \keys_set:nn { nicematrix / delimiters } { #1 } , delimiters .value_required:n = true , small .bool_set:N = \l__nicematrix_small_bool , small .value_forbidden:n = true , @@ -1185,12 +1185,12 @@ l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix } } -\keys_define:nn { NiceMatrix / NiceTabular } +\keys_define:nn { nicematrix / NiceTabular } { width .code:n = \dim_set:Nn \l__nicematrix_width_dim { #1 } \bool_set_true:N \l__nicematrix_width_used_bool , width .value_required:n = true , - notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } , + notes .code:n = \keys_set:nn { nicematrix / notes } { #1 } , tabularnote .tl_gset:N = \g__nicematrix_tabularnote_tl , tabularnote .value_required:n = true , caption .tl_set:N = \l__nicematrix_caption_tl , @@ -1206,14 +1206,14 @@ l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceTabular } } -\keys_define:nn { NiceMatrix / CodeAfter } +\keys_define:nn { nicematrix / CodeAfter } { delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters / color .value_required:n = true , - rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , + rules .code:n = \keys_set:nn { nicematrix / rules } { #1 } , rules .value_required:n = true , - xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , - sub-matrix .code:n = \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , + xdots .code:n = \keys_set:nn { nicematrix / xdots } { #1 } , + sub-matrix .code:n = \keys_set:nn { nicematrix / sub-matrix } { #1 } , sub-matrix .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~CodeAfter } } @@ -1839,11 +1839,11 @@ \bool_if:NT \g__nicematrix_recreate_cell_nodes_bool { \tl_put_left:Nn \__nicematrix_node_for_cell: \__nicematrix_patch_node_for_cell: } } -\keys_define:nn { NiceMatrix / CodeBefore } +\keys_define:nn { nicematrix / CodeBefore } { create-cell-nodes .bool_gset:N = \g__nicematrix_recreate_cell_nodes_bool , create-cell-nodes .default: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 , delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters / color .value_required:n = true , @@ -1851,7 +1851,7 @@ } \NewDocumentCommand \__nicematrix_CodeBefore_keys: { O { } } { - \keys_set:nn { NiceMatrix / CodeBefore } { #1 } + \keys_set:nn { nicematrix / CodeBefore } { #1 } \__nicematrix_CodeBefore:w } \cs_new_protected:Npn \__nicematrix_CodeBefore:w #1 \q_stop @@ -1999,8 +1999,8 @@ \tl_if_empty:NF \g__nicematrix_pre_code_before_tl { \bool_set_true:N \l__nicematrix_code_before_bool } \bool_if:NTF \g__nicematrix_delims_bool - { \keys_set:nn { NiceMatrix / pNiceArray } } - { \keys_set:nn { NiceMatrix / NiceArray } } + { \keys_set:nn { nicematrix / pNiceArray } } + { \keys_set:nn { nicematrix / NiceArray } } { #3 , #5 } \__nicematrix_set_CT@arc@:o \l__nicematrix_rules_color_tl \bool_if:nTF { #6 } \__nicematrix_CodeBefore_Body:w \__nicematrix_pre_array: @@ -2013,7 +2013,7 @@ \skip_horizontal:N \l__nicematrix_right_margin_dim \skip_horizontal:N \l__nicematrix_extra_right_margin_dim - % % awful workaround + % awful workaround \int_compare:nNnT \g__nicematrix_col_total_int = \c_one_int { \dim_compare:nNnT \l__nicematrix_columns_width_dim > \c_zero_dim @@ -2910,6 +2910,18 @@ { } % for the name of the block } } + \RenewDocumentCommand \cellcolor { O { } m } + { + \__nicematrix_test_color_inside: + \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl + { + \__nicematrix_rectanglecolor [ ##1 ] + { \exp_not:n { ##2 } } + { \int_use:N \c@iRow - \int_use:N \c@jCol } + { \int_use:N \c@iRow - \int_eval:n { \c@jCol + #1 } } + } + \ignorespaces + } \cs_set_nopar:Npn \@sharp { #3 } \@arstrut \@preamble @@ -3734,7 +3746,7 @@ \bool_set_true:N \l__nicematrix_last_col_without_value_bool \int_set:Nn \l__nicematrix_last_col_int { -1 } } - \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 } + \keys_set:nn { nicematrix / NiceMatrix } { ##1 } \__nicematrix_begin_of_NiceMatrix:nV { #1 } \l__nicematrix_columns_type_tl } { \use:c { end #1 NiceArray } } @@ -3747,7 +3759,7 @@ \bool_set_true:N \l__nicematrix_last_col_without_value_bool \int_set:Nn \l__nicematrix_last_col_int { -1 } } - \keys_set:nn { NiceMatrix / NiceMatrix } { #1 } + \keys_set:nn { nicematrix / NiceMatrix } { #1 } \bool_lazy_or:nnT { \clist_if_empty_p:N \l__nicematrix_vlines_clist } { \l__nicematrix_except_borders_bool } @@ -3762,7 +3774,7 @@ \dim_compare:nNnT \l__nicematrix_width_dim = \c_zero_dim { \dim_set_eq:NN \l__nicematrix_width_dim \linewidth } \str_gset:Nn \g__nicematrix_name_env_str { NiceTabular } - \keys_set:nn { NiceMatrix / NiceTabular } { #1 , #3 } + \keys_set:nn { nicematrix / NiceTabular } { #1 , #3 } \tl_if_empty:NF \l__nicematrix_short_caption_tl { \tl_if_empty:NT \l__nicematrix_caption_tl @@ -3807,7 +3819,7 @@ \str_gset:Nn \g__nicematrix_name_env_str { NiceTabularX } \dim_zero_new:N \l__nicematrix_width_dim \dim_set:Nn \l__nicematrix_width_dim { #1 } - \keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 } + \keys_set:nn { nicematrix / NiceTabular } { #2 , #4 } \__nicematrix_settings_for_tabular: \NiceArray { #3 } } @@ -3820,7 +3832,7 @@ { \str_gset:Nn \g__nicematrix_name_env_str { NiceTabular* } \dim_set:Nn \l__nicematrix_tabular_width_dim { #1 } - \keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 } + \keys_set:nn { nicematrix / NiceTabular } { #2 , #4 } \__nicematrix_settings_for_tabular: \NiceArray { #3 } } @@ -4006,7 +4018,7 @@ \cs_gset_eq:NN \CT@arc@ \__nicematrix_old_CT@arc@ } \NewDocumentCommand \__nicematrix_CodeAfter_keys: { O { } } - { \keys_set:nn { NiceMatrix / CodeAfter } { #1 } } + { \keys_set:nn { nicematrix / CodeAfter } { #1 } } \cs_new_protected:Npn \__nicematrix_adjust_pos_of_blocks_seq: { \seq_gset_map_x:NNn \g__nicematrix_pos_of_blocks_seq \g__nicematrix_pos_of_blocks_seq @@ -4393,7 +4405,7 @@ \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int { \color { nicematrix-last-row } } } - \keys_set:nn { NiceMatrix / xdots } { #3 } + \keys_set:nn { nicematrix / xdots } { #3 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Ldots: \group_end: @@ -4445,7 +4457,7 @@ \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int { \color { nicematrix-last-row } } } - \keys_set:nn { NiceMatrix / xdots } { #3 } + \keys_set:nn { nicematrix / xdots } { #3 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Cdots: \group_end: @@ -4541,7 +4553,7 @@ \int_compare:nNnT { #2 } = \l__nicematrix_last_col_int { \color { nicematrix-last-col } } } - \keys_set:nn { NiceMatrix / xdots } { #3 } + \keys_set:nn { nicematrix / xdots } { #3 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Vdots: @@ -4627,7 +4639,7 @@ \__nicematrix_find_extremities_of_line:nnnn { #1 } { #2 } 1 1 \group_begin: \__nicematrix_open_shorten: - \keys_set:nn { NiceMatrix / xdots } { #3 } + \keys_set:nn { nicematrix / xdots } { #3 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Ddots: \group_end: @@ -4658,11 +4670,14 @@ { \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim } } { - \dim_set:Nn \l__nicematrix_y_final_dim + \dim_compare:nNnF \g__nicematrix_delta_x_one_dim = \c_zero_dim { - \l__nicematrix_y_initial_dim + - ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim ) * - \dim_ratio:nn \g__nicematrix_delta_y_one_dim \g__nicematrix_delta_x_one_dim + \dim_set:Nn \l__nicematrix_y_final_dim + { + \l__nicematrix_y_initial_dim + + ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim ) * + \dim_ratio:nn \g__nicematrix_delta_y_one_dim \g__nicematrix_delta_x_one_dim + } } } } @@ -4676,7 +4691,7 @@ \__nicematrix_find_extremities_of_line:nnnn { #1 } { #2 } 1 { -1 } \group_begin: \__nicematrix_open_shorten: - \keys_set:nn { NiceMatrix / xdots } { #3 } + \keys_set:nn { nicematrix / xdots } { #3 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Iddots: \group_end: @@ -4707,11 +4722,14 @@ { \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim } } { - \dim_set:Nn \l__nicematrix_y_final_dim + \dim_compare:nNnF \g__nicematrix_delta_x_two_dim = \c_zero_dim { - \l__nicematrix_y_initial_dim + - ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim ) * - \dim_ratio:nn \g__nicematrix_delta_y_two_dim \g__nicematrix_delta_x_two_dim + \dim_set:Nn \l__nicematrix_y_final_dim + { + \l__nicematrix_y_initial_dim + + ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim ) * + \dim_ratio:nn \g__nicematrix_delta_y_two_dim \g__nicematrix_delta_x_two_dim + } } } } @@ -5064,7 +5082,7 @@ \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Ddots } } { - \keys_set_known:nn { NiceMatrix / Ddots } { #1 } + \keys_set_known:nn { nicematrix / Ddots } { #1 } \__nicematrix_instruction_of_type:nnn \l__nicematrix_draw_first_bool { Ddots } { #1 , down = #2 , up = #3 , middle = #4 } } @@ -5090,7 +5108,7 @@ \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Iddots } } { - \keys_set_known:nn { NiceMatrix / Ddots } { #1 } + \keys_set_known:nn { nicematrix / Ddots } { #1 } \__nicematrix_instruction_of_type:nnn \l__nicematrix_draw_first_bool { Iddots } { #1 , down = #2 , up = #3 , middle = #4 } } @@ -5100,7 +5118,7 @@ \bool_gset_true:N \g__nicematrix_empty_cell_bool } } -\keys_define:nn { NiceMatrix / Ddots } +\keys_define:nn { nicematrix / Ddots } { draw-first .bool_set:N = \l__nicematrix_draw_first_bool , draw-first .default:n = true , @@ -5210,7 +5228,7 @@ { \color { nicematrix-last-row } } } - \keys_set:nn { NiceMatrix / xdots } { #4 } + \keys_set:nn { nicematrix / xdots } { #4 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Ldots: \group_end: @@ -5291,7 +5309,7 @@ \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int { \color { nicematrix-last-col } } } - \keys_set:nn { NiceMatrix / xdots } { #4 } + \keys_set:nn { nicematrix / xdots } { #4 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Vdots: \group_end: @@ -5303,10 +5321,10 @@ \peek_remove_spaces:n { \bool_gset_true:N \g__nicematrix_rotate_bool - \keys_set:nn { NiceMatrix / rotate } { #1 } + \keys_set:nn { nicematrix / rotate } { #1 } } } -\keys_define:nn { NiceMatrix / rotate } +\keys_define:nn { nicematrix / rotate } { c .code:n = \bool_gset_true:N \g__nicematrix_rotate_c_bool , c .value_forbidden:n = true , @@ -5328,7 +5346,7 @@ \exp_args:NNo \NewDocumentCommand \__nicematrix_line \l__nicematrix_argspec_tl { \group_begin: - \keys_set:nn { NiceMatrix / xdots } { #1 , #4 , down = #5 , up = #6 } + \keys_set:nn { nicematrix / xdots } { #1 , #4 , down = #5 , up = #6 } \tl_if_empty:oF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \use:e { @@ -5382,7 +5400,7 @@ } } \cs_generate_variant:Nn \__nicematrix_put_in_row_style:n { e } -\keys_define:nn { NiceMatrix / RowStyle } +\keys_define:nn { nicematrix / RowStyle } { cell-space-top-limit .dim_set:N = \l_tmpa_dim , cell-space-top-limit .value_required:n = true , @@ -5414,7 +5432,7 @@ \int_set_eq:NN \l__nicematrix_key_nb_rows_int \c_one_int \dim_zero:N \l_tmpa_dim \dim_zero:N \l_tmpb_dim - \keys_set:nn { NiceMatrix / RowStyle } { #1 } + \keys_set:nn { nicematrix / RowStyle } { #1 } \tl_if_empty:NF \l_tmpa_tl { \tl_gput_right:Nx \g__nicematrix_pre_code_before_tl @@ -5669,7 +5687,7 @@ { 1 - 1 } { \int_use:N \c@iRow - \int_use:N \c@jCol } } -\keys_define:nn { NiceMatrix / rowcolors } +\keys_define:nn { nicematrix / rowcolors } { respect-blocks .bool_set:N = \l__nicematrix_respect_blocks_bool , respect-blocks .default:n = true , @@ -5685,7 +5703,7 @@ \seq_set_split:Nnn \l__nicematrix_colors_seq { , } { #3 } \tl_clear_new:N \l__nicematrix_cols_tl \cs_set_nopar:Npn \l__nicematrix_cols_tl { - } - \keys_set:nn { NiceMatrix / rowcolors } { #4 } + \keys_set:nn { nicematrix / rowcolors } { #4 } \int_zero_new:N \l__nicematrix_color_int \int_set_eq:NN \l__nicematrix_color_int \c_one_int \bool_if:NT \l__nicematrix_respect_blocks_bool @@ -6043,7 +6061,7 @@ } } } -\keys_define:nn { NiceMatrix / Rules } +\keys_define:nn { nicematrix / Rules } { position .int_set:N = \l__nicematrix_position_int , position .value_required:n = true , @@ -6055,7 +6073,7 @@ { \int_set_eq:NN \l__nicematrix_end_int \c@jCol } { \int_set:Nn \l__nicematrix_end_int { #1 } } } -\keys_define:nn { NiceMatrix / RulesBis } +\keys_define:nn { nicematrix / RulesBis } { multiplicity .int_set:N = \l__nicematrix_multiplicity_int , multiplicity .initial:n = 1 , @@ -6082,7 +6100,7 @@ { \group_begin: \int_set_eq:NN \l__nicematrix_end_int \c@iRow - \keys_set_known:nnN { NiceMatrix / Rules } { #1 } \l__nicematrix_other_keys_tl + \keys_set_known:nnN { nicematrix / Rules } { #1 } \l__nicematrix_other_keys_tl \int_compare:nNnT \l__nicematrix_position_int < { \c@jCol + 2 } \__nicematrix_vline_i: \group_end: @@ -6149,7 +6167,7 @@ \cs_new_protected:Npn \__nicematrix_vline_ii: { \tl_clear:N \l__nicematrix_tikz_rule_tl - \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl + \keys_set:nV { nicematrix / RulesBis } \l__nicematrix_other_keys_tl \bool_if:NTF \l__nicematrix_dotted_bool \__nicematrix_vline_iv: { @@ -6269,7 +6287,7 @@ \group_begin: \int_zero_new:N \l__nicematrix_end_int \int_set_eq:NN \l__nicematrix_end_int \c@jCol - \keys_set_known:nnN { NiceMatrix / Rules } { #1 } \l__nicematrix_other_keys_tl + \keys_set_known:nnN { nicematrix / Rules } { #1 } \l__nicematrix_other_keys_tl \__nicematrix_hline_i: \group_end: } @@ -6337,7 +6355,7 @@ \cs_new_protected:Npn \__nicematrix_hline_ii: { \tl_clear:N \l__nicematrix_tikz_rule_tl - \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl + \keys_set:nV { nicematrix / RulesBis } \l__nicematrix_other_keys_tl \bool_if:NTF \l__nicematrix_dotted_bool \__nicematrix_hline_iv: { @@ -6501,7 +6519,7 @@ \str_clear_new:N \l__nicematrix_ccommand_str \str_clear_new:N \l__nicematrix_letter_str \tl_clear_new:N \l__nicematrix_other_keys_tl - \keys_set_known:nnN { NiceMatrix / custom-line } { #1 } \l__nicematrix_other_keys_tl + \keys_set_known:nnN { nicematrix / custom-line } { #1 } \l__nicematrix_other_keys_tl \bool_lazy_all:nTF { { \str_if_empty_p:N \l__nicematrix_letter_str } @@ -6511,7 +6529,7 @@ { \__nicematrix_error:n { No~letter~and~no~command } } { \exp_args:No \__nicematrix_custom_line_i:n \l__nicematrix_other_keys_tl } } -\keys_define:nn { NiceMatrix / custom-line } +\keys_define:nn { nicematrix / custom-line } { letter .str_set:N = \l__nicematrix_letter_str , letter .value_required:n = true , @@ -6525,7 +6543,7 @@ \bool_set_false:N \l__nicematrix_tikz_rule_bool \bool_set_false:N \l__nicematrix_dotted_rule_bool \bool_set_false:N \l__nicematrix_color_bool - \keys_set:nn { NiceMatrix / custom-line-bis } { #1 } + \keys_set:nn { nicematrix / custom-line-bis } { #1 } \bool_if:NT \l__nicematrix_tikz_rule_bool { \IfPackageLoadedTF { tikz } @@ -6558,7 +6576,7 @@ } \tl_const:Nn \c__nicematrix_forbidden_letters_tl { lcrpmbVX|()[]!@<> } \str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX|()[]!@<> } -\keys_define:nn { NiceMatrix / custom-line-bis } +\keys_define:nn { nicematrix / custom-line-bis } { multiplicity .int_set:N = \l__nicematrix_multiplicity_int , multiplicity .initial:n = 1 , @@ -6580,7 +6598,7 @@ \bool_new:N \l__nicematrix_dotted_rule_bool \bool_new:N \l__nicematrix_tikz_rule_bool \bool_new:N \l__nicematrix_color_bool -\keys_define:nn { NiceMatrix / custom-line-width } +\keys_define:nn { nicematrix / custom-line-width } { multiplicity .int_set:N = \l__nicematrix_multiplicity_int , multiplicity .initial:n = 1 , @@ -6636,7 +6654,7 @@ \bool_set_false:N \l__nicematrix_tikz_rule_bool \bool_set_false:N \l__nicematrix_total_width_bool \bool_set_false:N \l__nicematrix_dotted_rule_bool - \keys_set_known:nn { NiceMatrix / custom-line-width } { #1 } + \keys_set_known:nn { nicematrix / custom-line-width } { #1 } \bool_if:NF \l__nicematrix_total_width_bool { \bool_if:NTF \l__nicematrix_dotted_rule_bool @@ -6842,7 +6860,7 @@ } } \bool_new:N \l__nicematrix_block_auto_columns_width_bool -\keys_define:nn { NiceMatrix / NiceMatrixBlock } +\keys_define:nn { nicematrix / NiceMatrixBlock } { auto-columns-width .code:n = { @@ -6855,7 +6873,7 @@ { \int_gincr:N \g__nicematrix_NiceMatrixBlock_int \dim_zero:N \l__nicematrix_columns_width_dim - \keys_set:nn { NiceMatrix / NiceMatrixBlock } { #1 } + \keys_set:nn { nicematrix / NiceMatrixBlock } { #1 } \bool_if:NT \l__nicematrix_block_auto_columns_width_bool { \cs_if_exist:cT @@ -7082,7 +7100,7 @@ { \int_use:N \g__nicematrix_env_int - \__nicematrix_i: - \__nicematrix_j: \l__nicematrix_suffix_tl} } } -\keys_define:nn { NiceMatrix / Block / FirstPass } +\keys_define:nn { nicematrix / Block / FirstPass } { j .code:n = \str_set:Nn \l__nicematrix_hpos_block_str j \bool_set_true:N \l__nicematrix_p_block_bool , @@ -7162,7 +7180,7 @@ { \str_set:NV \l__nicematrix_hpos_block_str \l__nicematrix_hpos_cell_tl } } { \str_set_eq:NN \l__nicematrix_hpos_block_str \c__nicematrix_c_str } - \keys_set_known:nn { NiceMatrix / Block / FirstPass } { #3 } + \keys_set_known:nn { nicematrix / Block / FirstPass } { #3 } \tl_set:Nx \l_tmpa_tl { { \int_use:N \c@iRow } @@ -7180,11 +7198,11 @@ \l__nicematrix_X_bool { \exp_args:Nee \__nicematrix_Block_v:nnnnn } { \tl_if_empty_p:n { #5 } } { \exp_args:Nee \__nicematrix_Block_v:nnnnn } { \int_compare_p:nNn \l_tmpa_int = \c_one_int } - { \exp_args:Nee \__nicematrix_Block_iv:nnnnn } + { \exp_args:Nee \__nicematrix_Block_iv:nnnnn } { \int_compare_p:nNn \l_tmpb_int = \c_one_int } - { \exp_args:Nee \__nicematrix_Block_iv:nnnnn } - } - { \exp_args:Nee \__nicematrix_Block_v:nnnnn } + { \exp_args:Nee \__nicematrix_Block_iv:nnnnn } + } + { \exp_args:Nee \__nicematrix_Block_v:nnnnn } { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } } \cs_new_protected:Npn \__nicematrix_Block_iv:nnnnn #1 #2 #3 #4 #5 @@ -7214,10 +7232,16 @@ \int_compare:nNnT { #1 } = \c_one_int { \int_if_zero:nTF \c@iRow - \l__nicematrix_code_for_first_row_tl + { + \cs_set_eq:NN \Block \__nicematrix_NullBlock: + \l__nicematrix_code_for_first_row_tl + } { \int_compare:nNnT \c@iRow = \l__nicematrix_last_row_int - \l__nicematrix_code_for_last_row_tl + { + \cs_set_eq:NN \Block \__nicematrix_NullBlock: + \l__nicematrix_code_for_last_row_tl + } } \g__nicematrix_row_style_tl } @@ -7442,7 +7466,7 @@ { \exp_not:n { #4 #5 } } } } -\keys_define:nn { NiceMatrix / Block / SecondPass } +\keys_define:nn { nicematrix / Block / SecondPass } { ampersand-in-blocks .bool_set:N = \l__nicematrix_amp_in_blocks_bool , ampersand-in-blocks .default:n = true , @@ -7566,7 +7590,7 @@ \group_begin: \int_compare:nNnT { #1 } = { #3 } { \str_set:Nn \l__nicematrix_vpos_block_str { t } } - \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } + \keys_set:nn { nicematrix / Block / SecondPass } { #5 } \tl_if_in:nnT { #6 } { & } { \bool_set_true:N \l__nicematrix_ampersand_bool } \bool_lazy_and:nnT \l__nicematrix_vlines_block_bool @@ -8000,7 +8024,7 @@ \group_begin: \tl_clear:N \l__nicematrix_draw_tl \dim_set_eq:NN \l__nicematrix_line_width_dim \arrayrulewidth - \keys_set_known:nn { NiceMatrix / BlockStroke } { #1 } + \keys_set_known:nn { nicematrix / BlockStroke } { #1 } \pgfpicture \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse @@ -8046,7 +8070,7 @@ \endpgfpicture \group_end: } -\keys_define:nn { NiceMatrix / BlockStroke } +\keys_define:nn { nicematrix / BlockStroke } { color .tl_set:N = \l__nicematrix_draw_tl , draw .code:n = @@ -8059,7 +8083,7 @@ \cs_new_protected:Npn \__nicematrix_vlines_block:nnn #1 #2 #3 { \dim_set_eq:NN \l__nicematrix_line_width_dim \arrayrulewidth - \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } + \keys_set_known:nn { nicematrix / BlockBorders } { #1 } \__nicematrix_cut_on_hyphen:w #2 \q_stop \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl @@ -8083,7 +8107,7 @@ \cs_new_protected:Npn \__nicematrix_hlines_block:nnn #1 #2 #3 { \dim_set_eq:NN \l__nicematrix_line_width_dim \arrayrulewidth - \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } + \keys_set_known:nn { nicematrix / BlockBorders } { #1 } \__nicematrix_cut_on_hyphen:w #2 \q_stop \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl @@ -8107,13 +8131,13 @@ \cs_new_protected:Npn \__nicematrix_stroke_borders_block:nnn #1 #2 #3 { \dim_set_eq:NN \l__nicematrix_line_width_dim \arrayrulewidth - \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } + \keys_set_known:nn { nicematrix / BlockBorders } { #1 } \dim_compare:nNnTF \l__nicematrix_rounded_corners_dim > \c_zero_dim { \__nicematrix_error:n { borders~forbidden } } { \tl_clear_new:N \l__nicematrix_borders_tikz_tl \keys_set:nV - { NiceMatrix / OnlyForTikzInBorders } + { nicematrix / OnlyForTikzInBorders } \l__nicematrix_borders_clist \__nicematrix_cut_on_hyphen:w #2 \q_stop \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl @@ -8148,7 +8172,7 @@ \clist_if_in:NnT \l__nicematrix_borders_clist { top } { \__nicematrix_stroke_horizontal:n \l__nicematrix_tmpc_tl } } -\keys_define:nn { NiceMatrix / OnlyForTikzInBorders } +\keys_define:nn { nicematrix / OnlyForTikzInBorders } { tikz .code:n = \cs_if_exist:NTF \tikzpicture @@ -8199,7 +8223,7 @@ ( \l_tmpa_dim , \pgf@y ) -- ( \l_tmpb_dim , \pgf@y ) ; } } -\keys_define:nn { NiceMatrix / BlockBorders } +\keys_define:nn { nicematrix / BlockBorders } { borders .clist_set:N = \l__nicematrix_borders_clist , rounded-corners .dim_set:N = \l__nicematrix_rounded_corners_dim , @@ -8212,7 +8236,7 @@ \__nicematrix_clip_with_rounded_corners: \clist_map_inline:nn { #5 } { - \keys_set_known:nnN { NiceMatrix / SpecialOffset } { ##1 } \l_tmpa_tl + \keys_set_known:nnN { nicematrix / SpecialOffset } { ##1 } \l_tmpa_tl \use:e { \exp_not:N \path [ \l_tmpa_tl ] } ( [ @@ -8233,8 +8257,12 @@ \end { tikzpicture } } \cs_generate_variant:Nn \__nicematrix_block_tikz:nnnnn { n n n n V } -\keys_define:nn { NiceMatrix / SpecialOffset } +\keys_define:nn { nicematrix / SpecialOffset } { offset .dim_set:N = \l__nicematrix_offset_dim } +\cs_new_protected:Npn \__nicematrix_NullBlock: + { \__nicematrix_collect_options:n { \__nicematrix_NullBlock_i: } } +\NewExpandableDocumentCommand \__nicematrix_NullBlock_i: { m m D < > { } +m } + { } \cs_set_protected:Npn \__nicematrix_renew_matrix: { \RenewDocumentEnvironment { pmatrix } { } @@ -8253,7 +8281,7 @@ { \BNiceMatrix } { \endBNiceMatrix } } -\keys_define:nn { NiceMatrix / Auto } +\keys_define:nn { nicematrix / Auto } { columns-type .tl_set:N = \l__nicematrix_columns_type_tl , columns-type .value_required:n = true , @@ -8264,7 +8292,7 @@ delimiters / color .value_required:n = true , delimiters / max-width .bool_set:N = \l__nicematrix_delimiters_max_width_bool , delimiters / max-width .default:n = true , - delimiters .code:n = \keys_set:nn { NiceMatrix / delimiters } { #1 } , + delimiters .code:n = \keys_set:nn { nicematrix / delimiters } { #1 } , delimiters .value_required:n = true , rounded-corners .dim_set:N = \l__nicematrix_tab_rounded_corners_dim , rounded-corners .default:n = 4 pt @@ -8275,7 +8303,7 @@ \cs_new_protected:Npn \__nicematrix_auto_nice_matrix:nnnnnn #1 #2 #3 #4 #5 #6 { \group_begin: - \keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl + \keys_set_known:nnN { nicematrix / Auto } { #6 } \l_tmpa_tl \use:e { \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } @@ -8468,7 +8496,7 @@ { } \endpgfpicture } -\keys_define:nn { NiceMatrix / sub-matrix } +\keys_define:nn { nicematrix / sub-matrix } { extra-height .dim_set:N = \l__nicematrix_submatrix_extra_height_dim , extra-height .value_required:n = true , @@ -8489,14 +8517,14 @@ hvlines .meta:n = { hlines, vlines } , hvlines .value_forbidden:n = true } -\keys_define:nn { NiceMatrix } +\keys_define:nn { nicematrix } { - SubMatrix .inherit:n = NiceMatrix / sub-matrix , - NiceArray / sub-matrix .inherit:n = NiceMatrix / sub-matrix , - pNiceArray / sub-matrix .inherit:n = NiceMatrix / sub-matrix , - NiceMatrixOptions / sub-matrix .inherit:n = NiceMatrix / sub-matrix , + SubMatrix .inherit:n = nicematrix / sub-matrix , + NiceArray / sub-matrix .inherit:n = nicematrix / sub-matrix , + pNiceArray / sub-matrix .inherit:n = nicematrix / sub-matrix , + NiceMatrixOptions / sub-matrix .inherit:n = nicematrix / sub-matrix , } -\keys_define:nn { NiceMatrix / SubMatrix } +\keys_define:nn { nicematrix / SubMatrix } { delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters / color .value_required:n = true , @@ -8522,7 +8550,7 @@ { \__nicematrix_error:n { Invalid~name } } } , name .value_required:n = true , - rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , + rules .code:n = \keys_set:nn { nicematrix / rules } { #1 } , rules .value_required:n = true , code .tl_set:N = \l__nicematrix_code_tl , code .value_required:n = true , @@ -8605,7 +8633,7 @@ { \__nicematrix_error:nn { Construct~too~large } { \SubMatrix } } { \str_clear_new:N \l__nicematrix_submatrix_name_str - \keys_set:nn { NiceMatrix / SubMatrix } { #5 } + \keys_set:nn { nicematrix / SubMatrix } { #5 } \pgfpicture \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse @@ -8884,7 +8912,7 @@ \peek_remove_spaces:n { \__nicematrix_brace:nnnnn { #2 } { #3 } { #4 } { #1 , #5 } { over } } } -\keys_define:nn { NiceMatrix / Brace } +\keys_define:nn { nicematrix / Brace } { left-shorten .bool_set:N = \l__nicematrix_brace_left_shorten_bool , left-shorten .default:n = true , @@ -8915,7 +8943,7 @@ } { \tl_clear:N \l_tmpa_tl - \keys_set:nn { NiceMatrix / Brace } { #4 } + \keys_set:nn { nicematrix / Brace } { #4 } \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } } \pgfpicture \pgfrememberpicturepositiononpagetrue @@ -9049,7 +9077,7 @@ \bool_new:N \l__nicematrix_not_empty_bool \bool_new:N \l__nicematrix_empty_bool -\keys_define:nn { NiceMatrix / TikzEveryCell } +\keys_define:nn { nicematrix / TikzEveryCell } { not-empty .code:n = \bool_lazy_or:nnTF @@ -9073,7 +9101,7 @@ \IfPackageLoadedTF { tikz } { \group_begin: - \keys_set:nn { NiceMatrix / TikzEveryCell } { #1 } + \keys_set:nn { nicematrix / TikzEveryCell } { #1 } \tl_set:Nn \l_tmpa_tl { { #2 } } \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq { \__nicematrix_for_a_block:nnnnn ##1 } @@ -9314,7 +9342,7 @@ renew-dots,~and~ renew-matrix. } -\keys_define:nn { NiceMatrix / Package } +\keys_define:nn { nicematrix / Package } { renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool , renew-dots .value_forbidden:n = true , @@ -9327,7 +9355,7 @@ no-test-for-array .default:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~package } } -\ProcessKeysOptions { NiceMatrix / Package } +\ProcessKeysOptions { nicematrix / Package } \__nicematrix_msg_new:nn { footnote~with~footnotehyper~package } { You~can't~use~the~option~'footnote'~because~the~package~ |