From 3b77cea124ec726fae82ebc0edaffbc909bae368 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 12 Mar 2022 20:34:14 +0000 Subject: nicematrix (12mar22) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62659 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/nicematrix/nicematrix.sty | 237 +++++++++++++-------- 1 file changed, 149 insertions(+), 88 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 88cfb82de0f..354ff649e86 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.7} -\def\myfiledate{2022/03/02} +\def\myfileversion{6.8} +\def\myfiledate{2022/03/11} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -33,6 +33,7 @@ \RequirePackage { amsmath } \cs_new_protected:Npn \__nicematrix_error:n { \msg_error:nn { nicematrix } } \cs_new_protected:Npn \__nicematrix_error:nn { \msg_error:nnn { nicematrix } } +\cs_generate_variant:Nn \__nicematrix_error:nn { n x } \cs_new_protected:Npn \__nicematrix_error:nnn { \msg_error:nnnn { nicematrix } } \cs_new_protected:Npn \__nicematrix_fatal:n { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \__nicematrix_fatal:nn { \msg_fatal:nnn { nicematrix } } @@ -40,48 +41,50 @@ \cs_new_protected:Npn \__nicematrix_msg_new:nnn { \msg_new:nnnn { nicematrix } } \cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn { \msg_redirect_name:nnn { nicematrix } } -\bool_new:N \c__nicematrix_arydshln_loaded_bool -\bool_new:N \c__nicematrix_booktabs_loaded_bool -\bool_new:N \c__nicematrix_enumitem_loaded_bool -\bool_new:N \c__nicematrix_tabularx_loaded_bool -\bool_new:N \c__nicematrix_tikz_loaded_bool -\bool_new:N \c__nicematrix_varwidth_loaded_bool +\tl_new:N \l__nicematrix_argspec_tl +\cs_generate_variant:Nn \seq_gset_split:Nnn { N V n } +\cs_generate_variant:Nn \keys_define:nn { n x } \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { varwidth } - { \bool_set_true:N \c__nicematrix_varwidth_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_false_bool } } \@ifpackageloaded { arydshln } - { \bool_set_true:N \c__nicematrix_arydshln_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_arydshln_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_arydshln_loaded_bool { \c_false_bool } } \@ifpackageloaded { booktabs } - { \bool_set_true:N \c__nicematrix_booktabs_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_booktabs_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_booktabs_loaded_bool { \c_false_bool } } \@ifpackageloaded { enumitem } - { \bool_set_true:N \c__nicematrix_enumitem_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_enumitem_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_enumitem_loaded_bool { \c_false_bool } } \@ifpackageloaded { tabularx } - { \bool_set_true:N \c__nicematrix_tabularx_loaded_bool } + { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_false_bool } } { } \@ifpackageloaded { tikz } { - \bool_set_true:N \c__nicematrix_tikz_loaded_bool + \bool_const:Nn \c__nicematrix_tikz_loaded_bool \c_true_bool \tl_const:Nn \c__nicematrix_pgfortikzpicture_tl { \exp_not:N \tikzpicture } \tl_const:Nn \c__nicematrix_endpgfortikzpicture_tl { \exp_not:N \endtikzpicture } } { + \bool_const:Nn \c__nicematrix_tikz_loaded_bool \c_false_bool \tl_const:Nn \c__nicematrix_pgfortikzpicture_tl { \exp_not:N \pgfpicture } \tl_const:Nn \c__nicematrix_endpgfortikzpicture_tl { \exp_not:N \endpgfpicture } } } -\bool_new:N \c__nicematrix_revtex_bool \@ifclassloaded { revtex4-1 } - { \bool_set_true:N \c__nicematrix_revtex_bool } - { } -\@ifclassloaded { revtex4-2 } - { \bool_set_true:N \c__nicematrix_revtex_bool } - { } -\cs_if_exist:NT \rvtx@ifformat@geq { \bool_set_true:N \c__nicematrix_revtex_bool } + { \bool_const:Nn \c__nicematrix_revtex_bool \c_true_bool } + { + \@ifclassloaded { revtex4-2 } + { \bool_const:Nn \c__nicematrix_revtex_bool \c_true_bool } + { + \cs_if_exist:NT \rvtx@ifformat@geq + { \bool_const:Nn \c__nicematrix_revtex_bool \c_true_bool } + { \bool_const:Nn \c__nicematrix_revtex_bool \c_false_bool } + } + } \cs_generate_variant:Nn \tl_if_single_token_p:n { V } \regex_const:Nn \c__nicematrix_columncolor_regex { \c { columncolor } } \cs_new_protected:Npn \__nicematrix_provide_pgfsyspdfmark: @@ -124,11 +127,11 @@ { \__nicematrix_old_pgfutil@check@rerun { ##1 } { ##2 } } } } -\bool_new:N \c__nicematrix_colortbl_loaded_bool +\bool_new:N \l__nicematrix_colortbl_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { colortbl } - { \bool_set_true:N \c__nicematrix_colortbl_loaded_bool } + { \bool_set_true:N \l__nicematrix_colortbl_loaded_bool } { \cs_set_protected:Npn \CT@arc@ { } \cs_set:Npn \arrayrulecolor #1 # { \CT@arc { #1 } } @@ -211,16 +214,16 @@ \cs_new_protected:Npn \__nicematrix_set_CT@drsc@_ii: #1 \q_stop { \cs_set:Npn \CT@drsc@ { \color { #1 } } } \cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor -\bool_new:N \c__nicematrix_siunitx_loaded_bool +\bool_new:N \l__nicematrix_siunitx_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { siunitx } - { \bool_set_true:N \c__nicematrix_siunitx_loaded_bool } + { \bool_set_true:N \l__nicematrix_siunitx_loaded_bool } { } } \hook_gput_code:nnn { begindocument } { . } { - \bool_if:nTF { ! \c__nicematrix_siunitx_loaded_bool } + \bool_if:nTF { ! \l__nicematrix_siunitx_loaded_bool } { \cs_set_eq:NN \__nicematrix_renew_NC@rewrite@S: \prg_do_nothing: } { \cs_new_protected:Npn \__nicematrix_renew_NC@rewrite@S: @@ -255,6 +258,8 @@ \dim_new:N \l__nicematrix_width_dim \seq_new:N \g__nicematrix_names_seq \bool_new:N \l__nicematrix_in_env_bool +\bool_new:N \l__nicematrix_notes_detect_duplicates_bool +\bool_set_true:N \l__nicematrix_notes_detect_duplicates_bool \bool_new:N \l__nicematrix_NiceArray_bool \bool_new:N \l__nicematrix_NiceTabular_bool \dim_new:N \l__nicematrix_tabular_width_dim @@ -273,7 +278,8 @@ \colorlet { nicematrix-last-col } { . } \colorlet { nicematrix-last-row } { . } \str_new:N \g__nicematrix_name_env_str -\tl_set:Nn \g__nicematrix_com_or_env_str { environment } +\tl_new:N \g__nicematrix_com_or_env_str +\tl_gset:Nn \g__nicematrix_com_or_env_str { environment } \cs_new:Npn \__nicematrix_full_name_env: { \str_if_eq:VnTF \g__nicematrix_com_or_env_str { command } @@ -285,6 +291,7 @@ \tl_new:N \g__nicematrix_internal_code_after_tl \int_new:N \l__nicematrix_old_iRow_int \int_new:N \l__nicematrix_old_jCol_int +\seq_new:N \l__nicematrix_custom_line_commands_seq \tl_new:N \l__nicematrix_rules_color_tl \int_new:N \g__nicematrix_total_X_weight_int \bool_new:N \l__nicematrix_X_columns_aux_bool @@ -381,7 +388,13 @@ \newcounter { tabularnote } \seq_new:N \g__nicematrix_tabularnotes_seq \tl_new:N \l__nicematrix_tabularnote_tl -\int_new:N \l__nicematrix_number_of_notes_int +\seq_new:N \l__nicematrix_notes_labels_seq +\newcounter{nicematrix_draft} +\cs_new_protected:Npn \__nicematrix_notes_format:n #1 + { + \setcounter { nicematrix_draft } { #1 } + \__nicematrix_notes_style:n { nicematrix_draft } + } \cs_new:Npn \__nicematrix_notes_style:n #1 { \textit { \alph { #1 } } } \cs_new:Npn \__nicematrix_notes_label_in_tabular:n #1 { \textsuperscript { #1 } } \cs_new:Npn \__nicematrix_notes_label_in_list:n #1 { \textsuperscript { #1 } } @@ -418,27 +431,39 @@ \bool_if:nTF { ! \l__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool } { \__nicematrix_error:n { tabularnote~forbidden } } { - \int_incr:N \l__nicematrix_number_of_notes_int - \seq_gput_right:Nn \g__nicematrix_tabularnotes_seq { #1 } + \int_zero:N \l_tmpa_int + \bool_if:NT \l__nicematrix_notes_detect_duplicates_bool + { + \seq_map_indexed_inline:Nn \g__nicematrix_tabularnotes_seq + { + \tl_if_eq:nnT { #1 } { ##2 } + { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: } + } + } + \int_compare:nNnTF \l_tmpa_int = 0 + { + \stepcounter { tabularnote } + \seq_put_right:Nx \l__nicematrix_notes_labels_seq + { \__nicematrix_notes_format:n { \int_use:c { c @ tabularnote } } } + \seq_gput_right:Nn \g__nicematrix_tabularnotes_seq { #1 } + } + { + \seq_put_right:Nx \l__nicematrix_notes_labels_seq + { \__nicematrix_notes_format:n { \int_use:N \l_tmpa_int } } + } \peek_meaning:NF \tabularnote { \hbox_set:Nn \l_tmpa_box { \__nicematrix_notes_label_in_tabular:n { - \stepcounter { tabularnote } - \__nicematrix_notes_style:n { tabularnote } - \prg_replicate:nn { \l__nicematrix_number_of_notes_int - 1 } - { - , - \stepcounter { tabularnote } - \__nicematrix_notes_style:n { tabularnote } - } + \seq_use:Nnnn + \l__nicematrix_notes_labels_seq { , } { , } { , } } } \addtocounter { tabularnote } { -1 } \refstepcounter { tabularnote } - \int_zero:N \l__nicematrix_number_of_notes_int + \seq_clear:N \l__nicematrix_notes_labels_seq \hbox_overlap_right:n { \box_use:N \l_tmpa_box } \skip_horizontal:n { \box_wd:N \l_tmpa_box } } @@ -734,6 +759,8 @@ } } , enumitem-keys-para .value_required:n = true , + detect-duplicates .bool_set:N = \l__nicematrix_notes_detect_duplicates_bool , + detect-duplicates .default:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~notes } } \keys_define:nn { NiceMatrix / delimiters } @@ -808,6 +835,11 @@ allow-duplicate-names .value_forbidden:n = true , letter-for-dotted-lines .code:n = { + \__nicematrix_error:n { letter-for-dotted-lines } + \group_begin: + \globaldefs = 1 + \__nicematrix_msg_redirect_name:nn { letter-for-dotted-lines } { none } + \group_end: \tl_if_single_token:nTF { #1 } { \str_set:Nx \l__nicematrix_letter_for_dotted_lines_str { #1 } } { \__nicematrix_error:n { One~letter~allowed } } @@ -821,7 +853,6 @@ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrixOptions } } \str_new:N \l__nicematrix_letter_for_dotted_lines_str -\str_set_eq:NN \l__nicematrix_letter_for_dotted_lines_str \c_colon_str \NewDocumentCommand \NiceMatrixOptions { m } { \keys_set:nn { NiceMatrix / NiceMatrixOptions } { #1 } } \keys_define:nn { NiceMatrix / NiceMatrix } @@ -1194,7 +1225,7 @@ } \cs_set_nopar:Npn \ialign { - \bool_if:NTF \c__nicematrix_colortbl_loaded_bool + \bool_if:NTF \l__nicematrix_colortbl_loaded_bool { \CT@everycr { @@ -1231,7 +1262,6 @@ \cs_set_eq:NN \Vdots \__nicematrix_Vdots \cs_set_eq:NN \Ddots \__nicematrix_Ddots \cs_set_eq:NN \Iddots \__nicematrix_Iddots - \cs_set_eq:NN \hdottedline \__nicematrix_hdottedline: \cs_set_eq:NN \Hline \__nicematrix_Hline: \cs_set_eq:NN \Hspace \__nicematrix_Hspace: \cs_set_eq:NN \Hdotsfor \__nicematrix_Hdotsfor: @@ -1244,6 +1274,8 @@ \cs_set_eq:NN \diagbox \__nicematrix_diagbox:nn \cs_set_eq:NN \NotEmpty \__nicematrix_NotEmpty: \cs_set_eq:NN \RowStyle \__nicematrix_RowStyle:n + \seq_map_inline:Nn \l__nicematrix_custom_line_commands_seq + { \cs_set_eq:cc { ##1 } { nicematrix - ##1 } } \bool_if:NT \l__nicematrix_colortbl_like_bool \__nicematrix_colortbl_like: \bool_if:NT \l__nicematrix_renew_dots_bool \__nicematrix_renew_dots: \cs_set_eq:NN \multicolumn \__nicematrix_multicolumn:nnn @@ -1275,12 +1307,12 @@ { \bool_set_true:N \l__nicematrix_last_row_without_value_bool \bool_if:NT \g__nicematrix_aux_found_bool - { \int_set:Nn \l__nicematrix_last_row_int { \seq_item:Nn \c__nicematrix_size_seq 3 } } + { \int_set:Nn \l__nicematrix_last_row_int { \seq_item:Nn \g__nicematrix_size_seq 3 } } } \int_compare:nNnT \l__nicematrix_last_col_int = { -1 } { \bool_if:NT \g__nicematrix_aux_found_bool - { \int_set:Nn \l__nicematrix_last_col_int { \seq_item:Nn \c__nicematrix_size_seq 6 } } + { \int_set:Nn \l__nicematrix_last_col_int { \seq_item:Nn \g__nicematrix_size_seq 6 } } } \int_compare:nNnT \l__nicematrix_last_row_int > { -2 } { @@ -1330,10 +1362,10 @@ } \cs_new_protected:Npn \__nicematrix_pre_code_before: { - \int_set:Nn \c@iRow { \seq_item:Nn \c__nicematrix_size_seq 2 } - \int_set:Nn \c@jCol { \seq_item:Nn \c__nicematrix_size_seq 5 } - \int_set_eq:NN \g__nicematrix_row_total_int { \seq_item:Nn \c__nicematrix_size_seq 3 } - \int_set_eq:NN \g__nicematrix_col_total_int { \seq_item:Nn \c__nicematrix_size_seq 6 } + \int_set:Nn \c@iRow { \seq_item:Nn \g__nicematrix_size_seq 2 } + \int_set:Nn \c@jCol { \seq_item:Nn \g__nicematrix_size_seq 5 } + \int_set_eq:NN \g__nicematrix_row_total_int { \seq_item:Nn \g__nicematrix_size_seq 3 } + \int_set_eq:NN \g__nicematrix_col_total_int { \seq_item:Nn \g__nicematrix_size_seq 6 } \pgfsys@markposition { \__nicematrix_env: - position } \pgfsys@getposition { \__nicematrix_env: - position } \__nicematrix_picture_position: \pgfpicture @@ -1801,7 +1833,8 @@ { \str_case_e:nnF { #1 } { - \l__nicematrix_letter_for_dotted_lines_str { \__nicematrix_patch_preamble_xii:n #1 } + \l__nicematrix_letter_for_dotted_lines_str + { \__nicematrix_patch_preamble_xii:n #1 } \l__nicematrix_letter_vlism_tl { \seq_gput_right:Nx \g__nicematrix_cols_vlism_seq @@ -1810,15 +1843,6 @@ { \exp_not:N ! { \skip_horizontal:N \arrayrulewidth } } \__nicematrix_patch_preamble:n } - { : } - { - \bool_if:NTF \c__nicematrix_arydshln_loaded_bool - { - \tl_gput_right:Nn \g__nicematrix_preamble_tl { : } - \__nicematrix_patch_preamble:n - } - { \__nicematrix_fatal:n { colon~without~arydshln } } - } } { \keys_set_known:nnN { NiceMatrix / ColumnTypes } { #1 } \l_tmpa_tl @@ -2176,8 +2200,7 @@ \keys_set:nV { WithArrows / X-column } \l_tmpa_tl \int_compare:nNnT \l__nicematrix_weight_int < 0 { - \exp_args:Nnx \__nicematrix_error:nn { negative~weight } - { \int_use:N \l__nicematrix_weight_int } + \__nicematrix_error:nx { negative~weight } { \int_use:N \l__nicematrix_weight_int } \int_set:Nn \l__nicematrix_weight_int { - \l__nicematrix_weight_int } } \int_gadd:Nn \g__nicematrix_total_X_weight_int \l__nicematrix_weight_int @@ -2616,12 +2639,12 @@ \tl_gput_right:Nn \g_nicematrix_code_after_tl { #2 } \seq_gclear_new:N \g__nicematrix_rows_seq \tl_set_rescan:Nno \l__nicematrix_end_of_row_tl { } \l__nicematrix_end_of_row_tl - \exp_args:NNV \seq_gset_split:Nnn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 } + \seq_gset_split:NVn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 } \int_compare:nNnT \l__nicematrix_last_row_int = { -1 } { \int_set:Nn \l__nicematrix_last_row_int { \seq_count:N \g__nicematrix_rows_seq } } \exp_args:NV \__nicematrix_array: \g__nicematrix_preamble_tl \seq_gpop_left:NN \g__nicematrix_rows_seq \l_tmpa_tl - \exp_args:NV \__nicematrix_line_with_light_syntax_i:n \l_tmpa_tl + \__nicematrix_line_with_light_syntax_i:V \l_tmpa_tl \seq_map_function:NN \g__nicematrix_rows_seq \__nicematrix_line_with_light_syntax:n \__nicematrix_create_col_nodes: \endarray @@ -2636,6 +2659,7 @@ \l_tmpa_tl \seq_map_inline:Nn \g__nicematrix_cells_seq { & ##1 } } +\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax_i:n { V } \cs_new_protected:Npn \__nicematrix_analyze_end:Nn #1 #2 { \str_if_eq:VnT \g__nicematrix_name_env_str { #2 } @@ -2971,6 +2995,7 @@ { > \__nicematrix_cell_begin:w #2 < \__nicematrix_cell_end: } } } +\cs_generate_variant:Nn \__nicematrix_begin_of_NiceMatrix:nn { n e } \clist_map_inline:nn { { } , p , b , B , v , V } { \NewDocumentEnvironment { #1 NiceMatrix } { ! O { } } @@ -2978,7 +3003,7 @@ \str_gset:Nn \g__nicematrix_name_env_str { #1 NiceMatrix } \tl_set:Nn \l__nicematrix_type_of_col_tl c \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 } - \exp_args:Nne \__nicematrix_begin_of_NiceMatrix:nn { #1 } \l__nicematrix_type_of_col_tl + \__nicematrix_begin_of_NiceMatrix:ne { #1 } \l__nicematrix_type_of_col_tl } { \use:c { end #1 NiceArray } } } @@ -3005,8 +3030,7 @@ } \NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } } { - \bool_if:NT \c__nicematrix_tabularx_loaded_bool - { \newcolumntype { X } { \__nicematrix_X } } + \bool_if:NT \c__nicematrix_tabularx_loaded_bool { \newcolumntype { X } { \__nicematrix_X } } \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 } @@ -3035,7 +3059,7 @@ { \int_set_eq:NN \l__nicematrix_last_row_int \g__nicematrix_row_total_int } \tl_gput_right:Nx \g__nicematrix_aux_tl { - \seq_gset_from_clist:Nn \exp_not:N \c__nicematrix_size_seq + \seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_size_seq { \int_use:N \l__nicematrix_first_row_int , \int_use:N \c@iRow , @@ -3815,7 +3839,7 @@ \cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line: { \begin { scope } - \exp_args:No \__nicematrix_draw_unstandard_dotted_line:n + \__nicematrix_draw_unstandard_dotted_line:o { \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl } } \cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:n #1 @@ -3825,6 +3849,7 @@ \l__nicematrix_xdots_up_tl \l__nicematrix_xdots_down_tl } +\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:n { o } \cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:nnn #1 #2 #3 { \draw @@ -4778,8 +4803,8 @@ start .int_set:N = \l__nicematrix_start_int , start .initial:n = 1 , end .int_set:N = \l__nicematrix_end_int , - letter .code:n = \prg_do_nothing: , - command .code:n = \prg_do_nothing: + % letter .code:n = \prg_do_nothing: , + % command .code:n = \prg_do_nothing: } \keys_define:nn { NiceMatrix / RulesBis } { @@ -4871,8 +4896,8 @@ } \cs_new_protected:Npn \__nicematrix_vline_ii: { - \bool_set_false:N \l__nicematrix_dotted_bool - \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl + \bool_set_false:N \l__nicematrix_dotted_boo + \keys_set_known:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl \bool_if:NTF \l__nicematrix_dotted_bool \__nicematrix_vline_iv: { @@ -5053,7 +5078,7 @@ \cs_new_protected:Npn \__nicematrix_hline_ii: { \bool_set_false:N \l__nicematrix_dotted_bool - \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl + \keys_set_known:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl \bool_if:NTF \l__nicematrix_dotted_bool \__nicematrix_hline_iv: { @@ -5235,7 +5260,7 @@ \c__nicematrix_forbidden_letters_str \l__nicematrix_letter_str { \__nicematrix_error:n { Forbidden~letter } } { - \exp_args:Nnx \keys_define:nn { NiceMatrix / ColumnTypes } + \keys_define:nx { NiceMatrix / ColumnTypes } { \l__nicematrix_letter_str .code:n = { \__nicematrix_custom_line_i:n { \exp_not:n { #1 } } } @@ -5254,13 +5279,11 @@ + \doublerulesep * ( \l__nicematrix_tmpc_int - 1 ) } } - \exp_args:NnV \__nicematrix_define_h_custom_line:nn - { #1 } - \l__nicematrix_rule_width_dim + \__nicematrix_define_h_custom_line:nV { #1 } \l__nicematrix_rule_width_dim } } } -\str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX:|()[]!@<> } +\str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX|()[]!@<> } \keys_define:nn { NiceMatrix / Custom-Line } { % here, we will use change in the future to use .tl_set:N @@ -5278,10 +5301,11 @@ width .code:n = \dim_set:Nn \l__nicematrix_rule_width_dim { #1 } \bool_set_true:N \l_tmpb_bool , width .value_required:n = true , + unknown .code:n = \__nicematrix_error:n { Unknown~key~for~custom-line } } \cs_new_protected:Npn \__nicematrix_define_h_custom_line:nn #1 #2 { - \cs_set:cpn \l__nicematrix_command_str + \cs_set:cpn { nicematrix - \l__nicematrix_command_str } { \noalign { @@ -5290,7 +5314,9 @@ { \__nicematrix_hline:n { #1 , position = \int_eval:n { \c@iRow + 1 } } } } } + \seq_put_left:NV \l__nicematrix_custom_line_commands_seq \l__nicematrix_command_str } +\cs_generate_variant:Nn \__nicematrix_define_h_custom_line:nn { n V } \cs_new_protected:Npn \__nicematrix_custom_line_i:n #1 { \bool_if:NF \l_tmpa_bool @@ -5309,6 +5335,7 @@ \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl { \__nicematrix_vline:n { #1 , position = \int_eval:n { \c@jCol + 1 } } } } +\__nicematrix_custom_line:n { letter = : , command = hdottedline , dotted } \cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnnn #1 #2 #3 #4 { \bool_lazy_all:nT @@ -7331,6 +7358,7 @@ } { The~available~keys~are~(in~alphabetic~order):~ + allow-letter-for-dotted-lines,~ footnote,~ footnotehyper,~ renew-dots,~and @@ -7346,6 +7374,14 @@ transparent .value_forbidden:n = true, footnote .bool_set:N = \c__nicematrix_footnote_bool , footnotehyper .bool_set:N = \c__nicematrix_footnotehyper_bool , + allow-letter-for-dotted-lines .code:n = + { + \group_begin: + \globaldefs = 1 + \__nicematrix_msg_redirect_name:nn { letter-for-dotted-lines } { none } + \group_end: + } , + allow-letter-for-dotted-lines .value_forbidden:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~package } } \ProcessKeysOptions { NiceMatrix / Package } @@ -7388,17 +7424,17 @@ } \bool_set_true:N \c__nicematrix_footnote_bool } -\seq_new:N \c__nicematrix_types_of_matrix_seq -\seq_set_from_clist:Nn \c__nicematrix_types_of_matrix_seq +\seq_new:N \g__nicematrix_types_of_matrix_seq +\seq_gset_from_clist:Nn \g__nicematrix_types_of_matrix_seq { NiceMatrix , pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix } -\seq_set_map_x:NNn \c__nicematrix_types_of_matrix_seq \c__nicematrix_types_of_matrix_seq +\seq_gset_map_x:NNn \g__nicematrix_types_of_matrix_seq \g__nicematrix_types_of_matrix_seq { \tl_to_str:n { #1 } } \cs_new_protected:Npn \__nicematrix_error_too_much_cols: { - \seq_if_in:NVTF \c__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str + \seq_if_in:NVTF \g__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str { \int_compare:nNnTF \l__nicematrix_last_col_int = { -2 } { \__nicematrix_fatal:n { too~much~cols~for~matrix } } @@ -7495,6 +7531,22 @@ Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~ is~'standard'.~If~you~go~on,~this~key~will~be~ignored. } +\__nicematrix_msg_new:nnn { Unknown~key~for~custom-line } + { + The~key~'\l_keys_key_str'~is~unknown~in~a~'custom-line'.~ + If~you~go~on,~it~will~be~ignored. \\ + For~a~list~of~the~available~keys,~type~H~. + } + { + The~available~keys~are~(in~alphabetic~order):~ + color,~ + command,~ + dotted,~ + letter,~ + multiplicity,~ + sep-color,~ + tikz,~and~width. + } \__nicematrix_msg_new:nn { Unknown~key~for~xdots } { As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~ @@ -7575,7 +7627,16 @@ Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~ key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~key~'command'~ (to~draw~horizontal~rules).\\ - However,~you~can~go~on. + However,~you~can~go~on. + } +\__nicematrix_msg_new:nn { letter-for-dotted-lines } + { + The~key~'letter-for-dotted-lines'~is~now~obsolete~(you~should~ + use~'custom-line'~instead).~However,~you~can~go~on~for~this~time.~ + If~you~don't~want~to~see~that~message~again,~you~should~ + load~'nicematrix'~with~the~key~'allow-letter-for-dotted-lines'.~ + However,~'letter-for-dotted-lines'~will~be~deleted~in~a~future~ + version~of~'nicematrix'. } \__nicematrix_msg_new:nn { Forbidden~letter } { @@ -7842,6 +7903,7 @@ bottomrule,~ code-after,~ code-before,~ + detect-duplicates,~ enumitem-keys,~ enumitem-keys-para,~ para,~ @@ -7897,7 +7959,6 @@ last-col,~ last-row,~ left-margin,~ - letter-for-dotted-lines,~ light-syntax,~ notes~(several~subkeys),~ nullify-dots,~ -- cgit v1.2.3