diff options
author | Karl Berry <karl@freefriends.org> | 2022-07-16 19:53:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-07-16 19:53:27 +0000 |
commit | 629a432a9034ac43fc2d8a4dbcb0b9eb6a7bed91 (patch) | |
tree | 8ee1d80ec941f44ac22e0e4c2a40bc14dc8a3c99 /Master/texmf-dist/tex/latex | |
parent | 008679e38b09bc64ddc0f791f70c18b21270624b (diff) |
nicematrix (16jul22)
git-svn-id: svn://tug.org/texlive/trunk@63912 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 509 |
1 files changed, 311 insertions, 198 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index e16f4e24ea7..3034746e98c 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.10a} -\def\myfiledate{2022/06/26} +\def\myfileversion{6.11} +\def\myfiledate{2022/07/16} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -43,11 +43,12 @@ { \msg_new:nnn { nicematrix } { #1 } { #2 \\ #3 } } { \msg_new:nnnn { nicematrix } { #1 } { #2 } { #3 } } } - +\str_if_eq:VnT \c_sys_jobname_str { output } + { \bool_set_true:N \c__nicematrix_messages_for_Overleaf_bool } \cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn { \msg_redirect_name:nnn { nicematrix } } \tl_new:N \l__nicematrix_argspec_tl -\cs_generate_variant:Nn \seq_gset_split:Nnn { N V n } +\cs_generate_variant:Nn \seq_set_split:Nnn { N V n } \cs_generate_variant:Nn \keys_define:nn { n x } \hook_gput_code:nnn { begindocument } { . } { @@ -146,7 +147,7 @@ { \cs_gset:Npn \CT@arc@ { \color #1 { #2 } } } } \cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } } - \cs_set:Npn\CT@drs #1 #2 + \cs_set:Npn \CT@drs #1 #2 { \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign { \cs_gset:Npn \CT@drsc@ { \color #1 { #2 } } } @@ -206,18 +207,36 @@ \cs_generate_variant:Nn \__nicematrix_cline_i:nn { e n } \cs_new:Npn \__nicematrix_math_toggle_token: { \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token } -\cs_new_protected:Npn \__nicematrix_set_CT@arc@: - { \peek_meaning:NTF [ \__nicematrix_set_CT@arc@_i: \__nicematrix_set_CT@arc@_ii: } -\cs_new_protected:Npn \__nicematrix_set_CT@arc@_i: [ #1 ] #2 \q_stop - { \cs_set:Npn \CT@arc@ { \color [ #1 ] { #2 } } } -\cs_new_protected:Npn \__nicematrix_set_CT@arc@_ii: #1 \q_stop - { \cs_set:Npn \CT@arc@ { \color { #1 } } } -\cs_new_protected:Npn \__nicematrix_set_CT@drsc@: - { \peek_meaning:NTF [ \__nicematrix_set_CT@drsc@_i: \__nicematrix_set_CT@drsc@_ii: } -\cs_new_protected:Npn \__nicematrix_set_CT@drsc@_i: [ #1 ] #2 \q_stop - { \cs_set:Npn \CT@drsc@ { \color [ #1 ] { #2 } } } -\cs_new_protected:Npn \__nicematrix_set_CT@drsc@_ii: #1 \q_stop - { \cs_set:Npn \CT@drsc@ { \color { #1 } } } +\cs_new_protected:Npn \__nicematrix_set_CT@arc@:n #1 + { + \tl_if_blank:nF { #1 } + { + \tl_if_head_eq_meaning:nNTF { #1 } [ + { \cs_set:Npn \CT@arc@ { \color #1 } } + { \cs_set:Npn \CT@arc@ { \color { #1 } } } + } + } +\cs_generate_variant:Nn \__nicematrix_set_CT@arc@:n { V } +\cs_new_protected:Npn \__nicematrix_set_CT@drsc@:n #1 + { + \tl_if_head_eq_meaning:nNTF { #1 } [ + { \cs_set:Npn \CT@drsc@ { \color #1 } } + { \cs_set:Npn \CT@drsc@ { \color { #1 } } } + } +\cs_generate_variant:Nn \__nicematrix_set_CT@drsc@:n { V } +\cs_new:Npn \__nicematrix_exp_color_arg:Nn #1 #2 + { + \tl_if_head_eq_meaning:nNTF { #2 } [ + { #1 #2 } + { #1 { #2 } } + } +\cs_generate_variant:Nn \__nicematrix_exp_color_arg:Nn { N V } +\cs_new_protected:Npn \__nicematrix_color:n #1 + { + \tl_if_blank:nF { #1 } + { \__nicematrix_exp_color_arg:Nn \color { #1 } } + } +\cs_generate_variant:Nn \__nicematrix_color:n { V } \cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor \bool_new:N \l__nicematrix_siunitx_loaded_bool \hook_gput_code:nnn { begindocument } { . } @@ -266,7 +285,7 @@ \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 \g__nicematrix_NiceArray_bool \bool_new:N \l__nicematrix_NiceTabular_bool \dim_new:N \l__nicematrix_tabular_width_dim \dim_new:N \l__nicematrix_rule_width_dim @@ -274,6 +293,9 @@ \bool_new:N \g__nicematrix_rotate_bool \bool_new:N \l__nicematrix_X_column_bool \tl_new:N \g__nicematrix_aux_tl +\tl_new:N \l__nicematrix_columns_type_tl +\hook_gput_code:nnn { begindocument } { . } + { \__nicematrix_set_preamble:Nn \l__nicematrix_columns_type_tl { c } } \cs_new_protected:Npn \__nicematrix_test_if_math_mode: { \if_mode_math: \else: @@ -435,7 +457,7 @@ } \NewDocumentCommand \tabularnote { m } { - \bool_if:nTF { ! \l__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool } + \bool_if:nTF { ! \g__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool } { \__nicematrix_error:n { tabularnote~forbidden } } { \int_zero:N \l_tmpa_int @@ -620,7 +642,8 @@ color .tl_set:N = \l__nicematrix_rules_color_tl , color .value_required:n = true , width .dim_set:N = \arrayrulewidth , - width .value_required:n = true + width .value_required:n = true , + unknown .code:n = \__nicematrix_error:n { Unknown~key~for~rules } } \keys_define:nn { NiceMatrix / Global } { @@ -855,9 +878,11 @@ allow-duplicate-names .value_forbidden:n = true , notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } , notes .value_required:n = true , - sub-matrix .code:n = - \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , + sub-matrix .code:n = \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , sub-matrix .value_required:n = true , + matrix / columns-type .code:n = + \__nicematrix_set_preamble:Nn \l__nicematrix_columns_type_tl { #1 }, + matrix / columns-type .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrixOptions } } \NewDocumentCommand \NiceMatrixOptions { m } @@ -870,8 +895,10 @@ \int_set:Nn \l__nicematrix_last_col_int { -1 } } { \int_set:Nn \l__nicematrix_last_col_int { #1 } } , - l .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl l , - r .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl r , + columns-type .code:n = \__nicematrix_set_preamble:Nn \l__nicematrix_columns_type_tl { #1 } , + columns-type .value_required:n = true , + l .meta:n = { columns-type = l } , + r .meta:n = { columns-type = r } , small .bool_set:N = \l__nicematrix_small_bool , small .value_forbidden:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix } @@ -1118,7 +1145,7 @@ { \exp_not:n { #3 } } } } -\cs_new_protected:Npn \__nicematrix_array: +\cs_new_protected:Npn \__nicematrix_array:n { \bool_if:NTF \l__nicematrix_NiceTabular_bool { \dim_set_eq:NN \col@sep \tabcolsep } @@ -1129,6 +1156,7 @@ \@tabarray [ \str_if_eq:VnTF \l__nicematrix_baseline_tl c c t ] } +\cs_generate_variant:Nn \__nicematrix_array:n { V } \cs_set_eq:NN \__nicematrix_old_ialign: \ialign \cs_new_protected:Npn \__nicematrix_create_row_node: { @@ -1348,10 +1376,9 @@ \int_gset:Nn \g__nicematrix_last_row_node_int { -1 } \__nicematrix_pre_array_ii: \box_clear_new:N \l__nicematrix_the_array_box - \__nicematrix_construct_preamble: \dim_zero_new:N \l__nicematrix_left_delim_dim \dim_zero_new:N \l__nicematrix_right_delim_dim - \bool_if:NTF \l__nicematrix_NiceArray_bool + \bool_if:NTF \g__nicematrix_NiceArray_bool { \dim_gset:Nn \l__nicematrix_left_delim_dim { 2 \arraycolsep } \dim_gset:Nn \l__nicematrix_right_delim_dim { 2 \arraycolsep } @@ -1591,12 +1618,11 @@ \bool_set_true:N \l__nicematrix_code_before_bool \tl_put_right:NV \l__nicematrix_code_before_tl \g__nicematrix_code_before_tl } - \bool_if:NTF \l__nicematrix_NiceArray_bool + \bool_if:NTF \g__nicematrix_NiceArray_bool { \keys_set:nn { NiceMatrix / NiceArray } } { \keys_set:nn { NiceMatrix / pNiceArray } } { #3 , #5 } - \tl_if_empty:NF \l__nicematrix_rules_color_tl - { \exp_after:wN \__nicematrix_set_CT@arc@: \l__nicematrix_rules_color_tl \q_stop } + \__nicematrix_set_CT@arc@:V \l__nicematrix_rules_color_tl \IfBooleanTF { #6 } \__nicematrix_CodeBefore_Body:w \__nicematrix_pre_array: } { @@ -1663,7 +1689,7 @@ \skip_horizontal:N \col@sep \skip_horizontal:N \g__nicematrix_width_first_col_dim } - \bool_if:NTF \l__nicematrix_NiceArray_bool + \bool_if:NTF \g__nicematrix_NiceArray_bool { \str_case:VnF \l__nicematrix_baseline_tl { @@ -1688,8 +1714,7 @@ \hbox_set:Nn \l_tmpa_box { \c_math_toggle_token - \tl_if_empty:NF \l__nicematrix_delimiters_color_tl - { \color { \l__nicematrix_delimiters_color_tl } } + \__nicematrix_color:V \l__nicematrix_delimiters_color_tl \exp_after:wN \left \g__nicematrix_left_delim_tl \vcenter { @@ -1706,8 +1731,7 @@ } \skip_vertical:n { -\l_tmpb_dim + \arrayrulewidth } } - \tl_if_empty:NF \l__nicematrix_delimiters_color_tl - { \color { \l__nicematrix_delimiters_color_tl } } + \__nicematrix_color:V \l__nicematrix_delimiters_color_tl \exp_after:wN \right \g__nicematrix_right_delim_tl \c_math_toggle_token } @@ -1726,12 +1750,14 @@ \bool_if:NF \l__nicematrix_Matrix_bool { \int_compare:nNnT \c@jCol < \g__nicematrix_static_num_of_col_int - { \__nicematrix_error:n { columns~not~used } } + { + \__nicematrix_error:n { columns~not~used } + \group_begin: + \globaldefs = 1 + \__nicematrix_msg_redirect_name:nn { columns~not~used } { none } + \group_end: + } } - \group_begin: - \globaldefs = 1 - \__nicematrix_msg_redirect_name:nn { columns~not~used } { error } - \group_end: \__nicematrix_after_array: \egroup \iow_now:Nn \@mainaux { \ExplSyntaxOn } @@ -1744,32 +1770,32 @@ \iow_now:Nn \@mainaux { \ExplSyntaxOff } \bool_if:NT \c__nicematrix_footnote_bool \endsavenotes } -\cs_new_protected:Npn \__nicematrix_construct_preamble: +\cs_new_protected:Npn \__nicematrix_transform_preamble: { \group_begin: \bool_if:NF \l__nicematrix_Matrix_bool - { - \__nicematrix_newcolumntype w [ 2 ] { \__nicematrix_w: { ##1 } { ##2 } } - \__nicematrix_newcolumntype W [ 2 ] { \__nicematrix_W: { ##1 } { ##2 } } - \cs_if_exist:NT \NC@find@V { \__nicematrix_newcolumntype V { \__nicematrix_V: } } - \exp_args:NV \@temptokena \g__nicematrix_preamble_tl - \@tempswatrue - \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list } - \int_gzero:N \c@jCol - \tl_gclear:N \g__nicematrix_preamble_tl - \bool_gset_false:N \g_tmpb_bool - \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all } - { - \tl_gset:Nn \g__nicematrix_preamble_tl - { ! { \skip_horizontal:N \arrayrulewidth } } - } - { - \clist_if_in:NnT \l__nicematrix_vlines_clist 1 - { - \tl_gset:Nn \g__nicematrix_preamble_tl - { ! { \skip_horizontal:N \arrayrulewidth } } - } - } + { + \__nicematrix_newcolumntype w [ 2 ] { \__nicematrix_w: { ##1 } { ##2 } } + \__nicematrix_newcolumntype W [ 2 ] { \__nicematrix_W: { ##1 } { ##2 } } + \cs_if_exist:NT \NC@find@V { \__nicematrix_newcolumntype V { \__nicematrix_V: } } + \exp_args:NV \@temptokena \g__nicematrix_preamble_tl + \@tempswatrue + \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list } + \int_gzero:N \c@jCol + \tl_gclear:N \g__nicematrix_preamble_tl + \bool_gset_false:N \g_tmpb_bool + \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all } + { + \tl_gset:Nn \g__nicematrix_preamble_tl + { ! { \skip_horizontal:N \arrayrulewidth } } + } + { + \clist_if_in:NnT \l__nicematrix_vlines_clist 1 + { + \tl_gset:Nn \g__nicematrix_preamble_tl + { ! { \skip_horizontal:N \arrayrulewidth } } + } + } \seq_clear:N \g__nicematrix_cols_vlism_seq \int_zero:N \l_tmpa_int \exp_after:wN \__nicematrix_patch_preamble:n \the \@temptokena \q_stop @@ -1784,16 +1810,16 @@ } \group_end: \bool_lazy_or:nnT - { ! \str_if_eq_p:Vn \g__nicematrix_left_delim_tl { . } } - { ! \str_if_eq_p:Vn \g__nicematrix_right_delim_tl { . } } - { \bool_set_false:N \l__nicematrix_NiceArray_bool } + { ! \str_if_eq_p:Vn \g__nicematrix_left_delim_tl { . } } + { ! \str_if_eq_p:Vn \g__nicematrix_right_delim_tl { . } } + { \bool_gset_false:N \g__nicematrix_NiceArray_bool } \bool_if:NT \g_tmpb_bool { \bool_set_true:N \l__nicematrix_bar_at_end_of_pream_bool } \int_compare:nNnTF \l__nicematrix_first_col_int = 0 { \tl_gput_left:NV \g__nicematrix_preamble_tl \c__nicematrix_preamble_first_col_tl } { \bool_lazy_all:nT { - \l__nicematrix_NiceArray_bool + \g__nicematrix_NiceArray_bool { \bool_not_p:n \l__nicematrix_NiceTabular_bool } { \tl_if_empty_p:N \l__nicematrix_vlines_clist } { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool } @@ -1805,7 +1831,7 @@ { \bool_lazy_all:nT { - \l__nicematrix_NiceArray_bool + \g__nicematrix_NiceArray_bool { \bool_not_p:n \l__nicematrix_NiceTabular_bool } { \tl_if_empty_p:N \l__nicematrix_vlines_clist } { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool } @@ -2270,6 +2296,15 @@ \tl_gput_right:Nn \g__nicematrix_preamble_tl { < { #1 } } \__nicematrix_patch_preamble_xi:n } +\cs_new_protected:Npn \__nicematrix_set_preamble:Nn #1 #2 + { + \@temptokena { #2 } + \@tempswatrue + \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list } + \tl_gclear:N \g__nicematrix_preamble_tl + \exp_after:wN \__nicematrix_patch_m_preamble:n \the \@temptokena \q_stop + \tl_set_eq:NN #1 \g__nicematrix_preamble_tl + } \cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3 { \multispan { #1 } @@ -2399,22 +2434,7 @@ { \str_if_eq:nnTF { #1 } { < } \__nicematrix_patch_m_preamble_ix:n - { - \tl_if_eq:NnTF \l__nicematrix_vlines_clist { all } - { - \tl_gput_right:Nn \g__nicematrix_preamble_tl - { ! { \skip_horizontal:N \arrayrulewidth } } - } - { - \exp_args:NNx - \clist_if_in:NnT \l__nicematrix_vlines_clist { \int_eval:n { \c@jCol + 1 } } - { - \tl_gput_right:Nn \g__nicematrix_preamble_tl - { ! { \skip_horizontal:N \arrayrulewidth } } - } - } - \__nicematrix_patch_m_preamble:n { #1 } - } + { \__nicematrix_patch_m_preamble:n { #1 } } } \cs_new_protected:Npn \__nicematrix_patch_m_preamble_ix:n #1 { @@ -2472,7 +2492,7 @@ } \cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes_c: { - \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool + \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \g__nicematrix_NiceArray_bool { \box_set_wd:Nn \l__nicematrix_the_array_box { \box_wd:N \l__nicematrix_the_array_box - \arraycolsep } @@ -2624,7 +2644,10 @@ { \peek_meaning:NTF \end \__nicematrix_analyze_end:Nn - { \exp_args:NV \__nicematrix_array: \g__nicematrix_preamble_tl } + { + \__nicematrix_transform_preamble: + \__nicematrix_array:V \g__nicematrix_preamble_tl + } } } { @@ -2641,35 +2664,56 @@ \str_if_eq:nnT { ##1 } { \\ } { \__nicematrix_fatal:n { double-backslash~in~light-syntax } } } - \__nicematrix_light_syntax_i #1 \CodeAfter \q_stop + \__nicematrix_light_syntax_i:w #1 \CodeAfter \q_stop + } + { + \__nicematrix_create_col_nodes: + \endarray } - { } -\cs_new_protected:Npn \__nicematrix_light_syntax_i #1\CodeAfter #2\q_stop +\cs_new_protected:Npn \__nicematrix_light_syntax_i:w #1\CodeAfter #2\q_stop { \tl_gput_right:Nn \g_nicematrix_code_after_tl { #2 } - \seq_gclear_new:N \g__nicematrix_rows_seq + \seq_clear_new:N \l__nicematrix_rows_seq \tl_set_rescan:Nno \l__nicematrix_end_of_row_tl { } \l__nicematrix_end_of_row_tl - \seq_gset_split:NVn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 } + \seq_set_split:NVn \l__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 } + \seq_pop_right:NN \l__nicematrix_rows_seq \l_tmpa_tl + \tl_if_empty:NF \l_tmpa_tl + { \seq_put_right:NV \l__nicematrix_rows_seq \l_tmpa_tl } \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 - \__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 + { \int_set:Nn \l__nicematrix_last_row_int { \seq_count:N \l__nicematrix_rows_seq } } + \tl_clear_new:N \l__nicematrix_new_body_tl + \int_zero_new:N \l__nicematrix_nb_cols_int + \seq_pop_left:NN \l__nicematrix_rows_seq \l_tmpa_tl + \__nicematrix_line_with_light_syntax:V \l_tmpa_tl + \seq_map_inline:Nn \l__nicematrix_rows_seq + { + \tl_put_right:Nn \l__nicematrix_new_body_tl { \\ } + \__nicematrix_line_with_light_syntax:n { ##1 } + } + \int_compare:nNnT \l__nicematrix_last_col_int = { -1 } + { + \int_set:Nn \l__nicematrix_last_col_int + { \l__nicematrix_nb_cols_int - 1 + \l__nicematrix_first_col_int } + } + \__nicematrix_transform_preamble: + \__nicematrix_array:V \g__nicematrix_preamble_tl \l__nicematrix_new_body_tl } \cs_new_protected:Npn \__nicematrix_line_with_light_syntax:n #1 - { \tl_if_empty:nF { #1 } { \\ \__nicematrix_line_with_light_syntax_i:n { #1 } } } -\cs_new_protected:Npn \__nicematrix_line_with_light_syntax_i:n #1 { - \seq_gclear_new:N \g__nicematrix_cells_seq - \seq_gset_split:Nnn \g__nicematrix_cells_seq { ~ } { #1 } - \seq_gpop_left:NN \g__nicematrix_cells_seq \l_tmpa_tl - \l_tmpa_tl - \seq_map_inline:Nn \g__nicematrix_cells_seq { & ##1 } + \seq_clear_new:N \l__nicematrix_cells_seq + \seq_set_split:Nnn \l__nicematrix_cells_seq { ~ } { #1 } + \int_set:Nn \l__nicematrix_nb_cols_int + { + \int_max:nn + \l__nicematrix_nb_cols_int + { \seq_count:N \l__nicematrix_cells_seq } + } + \seq_pop_left:NN \l__nicematrix_cells_seq \l_tmpa_tl + \tl_put_right:NV \l__nicematrix_new_body_tl \l_tmpa_tl + \seq_map_inline:Nn \l__nicematrix_cells_seq + { \tl_put_right:Nn \l__nicematrix_new_body_tl { & ##1 } } } -\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax_i:n { V } +\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax:n { V } \cs_new_protected:Npn \__nicematrix_analyze_end:Nn #1 #2 { \str_if_eq:VnT \g__nicematrix_name_env_str { #2 } @@ -2806,7 +2850,7 @@ \int_gincr:N \g_tmpa_int \bool_lazy_all:nT { - \l__nicematrix_NiceArray_bool + \g__nicematrix_NiceArray_bool { \bool_not_p:n \l__nicematrix_NiceTabular_bool } { \clist_if_empty_p:N \l__nicematrix_vlines_clist } { \bool_not_p:n \l__nicematrix_exterior_arraycolsep_bool } @@ -2818,13 +2862,13 @@ \hbox { \skip_horizontal:N -0.5\arrayrulewidth - \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool + \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \g__nicematrix_NiceArray_bool { \skip_horizontal:N -\arraycolsep } \pgfsys@markposition { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } } \skip_horizontal:N 0.5\arrayrulewidth - \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool + \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \g__nicematrix_NiceArray_bool { \skip_horizontal:N \arraycolsep } } } @@ -2832,7 +2876,7 @@ \pgfrememberpicturepositiononpagetrue \pgfcoordinate { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } } { - \bool_lazy_and:nnTF \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool + \bool_lazy_and:nnTF \l__nicematrix_Matrix_bool \g__nicematrix_NiceArray_bool { \pgfpoint { - 0.5 \arrayrulewidth - \arraycolsep } @@ -2969,7 +3013,7 @@ } \NewDocumentEnvironment { NiceArray } { } { - \bool_set_true:N \l__nicematrix_NiceArray_bool + \bool_gset_true:N \g__nicematrix_NiceArray_bool \str_if_empty:NT \g__nicematrix_name_env_str { \str_gset:Nn \g__nicematrix_name_env_str { NiceArray } } \NiceArrayWithDelims . . @@ -2979,6 +3023,7 @@ { \NewDocumentEnvironment { #1 NiceArray } { } { + \bool_gset_false:N \g__nicematrix_NiceArray_bool \str_if_empty:NT \g__nicematrix_name_env_str { \str_gset:Nn \g__nicematrix_name_env_str { #1 NiceArray } } \__nicematrix_test_if_math_mode: @@ -3002,21 +3047,29 @@ \c@MaxMatrixCols { \int_eval:n { \l__nicematrix_last_col_int - 1 } } } - { > \__nicematrix_cell_begin:w #2 < \__nicematrix_cell_end: } + { #2 } } } -\cs_generate_variant:Nn \__nicematrix_begin_of_NiceMatrix:nn { n e } -\clist_map_inline:nn { { } , p , b , B , v , V } +\cs_generate_variant:Nn \__nicematrix_begin_of_NiceMatrix:nn { n V } +\clist_map_inline:nn { p , b , B , v , V } { \NewDocumentEnvironment { #1 NiceMatrix } { ! O { } } { + \bool_gset_false:N \g__nicematrix_NiceArray_bool \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 } - \__nicematrix_begin_of_NiceMatrix:ne { #1 } \l__nicematrix_type_of_col_tl + \__nicematrix_begin_of_NiceMatrix:nV { #1 } \l__nicematrix_columns_type_tl } { \use:c { end #1 NiceArray } } } +\NewDocumentEnvironment { NiceMatrix } { ! O { } } + { + \bool_gset_false:N \g__nicematrix_NiceArray_bool + \str_gset:Nn \g__nicematrix_name_env_str { NiceMatrix } + \keys_set:nn { NiceMatrix / NiceMatrix } { #1 } + \__nicematrix_begin_of_NiceMatrix:nV { } \l__nicematrix_columns_type_tl + } + { \endNiceArray } \cs_new_protected:Npn \__nicematrix_NotEmpty: { \bool_gset_true:N \g__nicematrix_not_empty_cell_bool } \NewDocumentEnvironment { NiceTabular } { O { } m ! O { } } @@ -4384,32 +4437,32 @@ cell-space-top-limit = #1 , cell-space-bottom-limit = #1 , } , - color .tl_set:N = \l_tmpa_tl , + color .tl_set:N = \l__nicematrix_color_tl , color .value_required:n = true , bold .bool_set:N = \l_tmpa_bool , bold .default:n = true , bold .initial:n = false , nb-rows .code:n = \str_if_eq:nnTF { #1 } { * } - { \int_set_eq:NN \l__nicematrix_key_nb_rows_int 500 } + { \int_set:Nn \l__nicematrix_key_nb_rows_int { 500 } } { \int_set:Nn \l__nicematrix_key_nb_rows_int { #1 } } , nb-rows .value_required:n = true , - rowcolor .tl_set:N = \l__nicematrix_tmpc_tl , + rowcolor .tl_set:N = \l_tmpa_tl , rowcolor .value_required:n = true , rowcolor .initial:n = , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~RowStyle } } \NewDocumentCommand \__nicematrix_RowStyle:n { O { } m } { - \tl_clear:N \l_tmpa_tl + \group_begin: + \tl_clear:N \l__nicematrix_color_tl \int_set:Nn \l__nicematrix_key_nb_rows_int 1 \keys_set:nn { NiceMatrix / RowStyle } { #1 } - \tl_if_empty:NF \l__nicematrix_tmpc_tl + \tl_if_empty:NF \l_tmpa_tl { \tl_gput_right:Nx \g_nicematrix_code_before_tl { - \__nicematrix_rectanglecolor - { \l__nicematrix_tmpc_tl } + \__nicematrix_exp_color_arg:NV \__nicematrix_rectanglecolor \l_tmpa_tl { \int_use:N \c@iRow - \int_use:N \c@jCol } { \int_use:N \c@iRow - * } } @@ -4417,8 +4470,7 @@ { \tl_gput_right:Nx \g_nicematrix_code_before_tl { - \__nicematrix_rowcolor - { \l__nicematrix_tmpc_tl } + \__nicematrix_exp_color_arg:NV \__nicematrix_rowcolor \l_tmpa_tl { \int_eval:n { \c@iRow + 1 } - \int_eval:n { \c@iRow + \l__nicematrix_key_nb_rows_int - 1 } @@ -4452,10 +4504,13 @@ } } } - \tl_if_empty:NF \l_tmpa_tl + \tl_if_empty:NF \l__nicematrix_color_tl { \tl_gput_right:Nx \g__nicematrix_row_style_tl - { \mode_leave_vertical: \exp_not:N \color { \l_tmpa_tl } } + { + \mode_leave_vertical: + \__nicematrix_color:n { \l__nicematrix_color_tl } + } } \bool_if:NT \l_tmpa_bool { @@ -4471,6 +4526,7 @@ } } \tl_gput_right:Nn \g__nicematrix_row_style_tl { \fi } + \group_end: \g__nicematrix_row_style_tl \ignorespaces } @@ -4827,7 +4883,12 @@ position .value_required:n = true , start .int_set:N = \l__nicematrix_start_int , start .initial:n = 1 , - end .int_set:N = \l__nicematrix_end_int , + end .code:n = + \bool_lazy_or:nnTF + { \tl_if_empty_p:n { #1 } } + { \str_if_eq_p:nn { #1 } { last } } + { \int_set_eq:NN \l__nicematrix_end_int \c@jCol } + { \int_set:Nn \l__nicematrix_end_int { #1 } } } \keys_define:nn { NiceMatrix / RulesBis } { @@ -4836,9 +4897,9 @@ dotted .bool_set:N = \l__nicematrix_dotted_bool , dotted .initial:n = false , dotted .default:n = true , - color .code:n = \__nicematrix_set_CT@arc@: #1 \q_stop , + color .code:n = \__nicematrix_set_CT@arc@:n { #1 } , color .value_required:n = true , - sep-color .code:n = \__nicematrix_set_CT@drsc@: #1 \q_stop , + sep-color .code:n = \__nicematrix_set_CT@drsc@:n { #1 } , sep-color .value_required:n = true , tikz .tl_set:N = \l__nicematrix_tikz_rule_tl , tikz .value_required:n = true , @@ -5022,11 +5083,11 @@ { \int_step_inline:nnn { - \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + \bool_if:nTF { \g__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } 1 2 } { - \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + \bool_if:nTF { \g__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } { \int_eval:n { \c@jCol + 1 } } \c@jCol } @@ -5184,7 +5245,7 @@ \int_compare:nNnT \l__nicematrix_local_start_int = 1 { \dim_sub:Nn \l__nicematrix_x_initial_dim \l__nicematrix_left_margin_dim - \bool_if:NT \l__nicematrix_NiceArray_bool + \bool_if:NT \g__nicematrix_NiceArray_bool { \dim_sub:Nn \l__nicematrix_x_initial_dim \arraycolsep } \tl_if_eq:NnF \g__nicematrix_left_delim_tl ( { \dim_add:Nn \l__nicematrix_x_initial_dim { 0.5 \l__nicematrix_xdots_inter_dim } } @@ -5194,7 +5255,7 @@ \int_compare:nNnT \l__nicematrix_local_end_int = \c@jCol { \dim_add:Nn \l__nicematrix_x_final_dim \l__nicematrix_right_margin_dim - \bool_if:NT \l__nicematrix_NiceArray_bool + \bool_if:NT \g__nicematrix_NiceArray_bool { \dim_add:Nn \l__nicematrix_x_final_dim \arraycolsep } \tl_if_eq:NnF \g__nicematrix_right_delim_tl ) { \dim_gsub:Nn \l__nicematrix_x_final_dim { 0.5 \l__nicematrix_xdots_inter_dim } } @@ -5224,11 +5285,11 @@ { \int_step_inline:nnn { - \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + \bool_if:nTF { \g__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } 1 2 } { - \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + \bool_if:nTF { \g__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } { \int_eval:n { \c@iRow + 1 } } \c@iRow } @@ -5270,11 +5331,15 @@ \cs_new_protected:Npn \__nicematrix_custom_line:n #1 { \str_clear_new:N \l__nicematrix_command_str + \str_clear_new:N \l__nicematrix_ccommand_str \str_clear_new:N \l__nicematrix_letter_str \keys_set_known:nnN { NiceMatrix / custom-line } { #1 } \l__nicematrix_other_keys_tl - \bool_lazy_and:nnTF - { \str_if_empty_p:N \l__nicematrix_letter_str } - { \str_if_empty_p:N \l__nicematrix_command_str } + \bool_lazy_all:nTF + { + { \str_if_empty_p:N \l__nicematrix_letter_str } + { \str_if_empty_p:N \l__nicematrix_command_str } + { \str_if_empty_p:N \l__nicematrix_ccommand_str } + } { \__nicematrix_error:n { No~letter~and~no~command } } { \exp_args:NV \__nicematrix_custom_line_i:n \l__nicematrix_other_keys_tl } } @@ -5283,9 +5348,10 @@ % here, we will use change in the future to use .str_set:N letter .code:n = \str_set:Nn \l__nicematrix_letter_str { #1 } , letter .value_required:n = true , - % here, we will use change in the future to use .str_set:N command .code:n = \str_set:Nn \l__nicematrix_command_str { #1 } , command .value_required:n = true , + ccommand .code:n = \str_set:Nn \l__nicematrix_ccommand_str { #1 } , + ccommand .value_required:n = true , } \cs_new_protected:Npn \__nicematrix_custom_line_i:n #1 { @@ -5324,6 +5390,7 @@ } } \str_if_empty:NF \l__nicematrix_command_str { \__nicematrix_h_custom_line:n { #1 } } + \str_if_empty:NF \l__nicematrix_ccommand_str { \__nicematrix_c_custom_line:n { #1 } } } \str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX|()[]!@<> } \keys_define:nn { NiceMatrix / custom-line-bis } @@ -5382,6 +5449,41 @@ \seq_put_left:NV \l__nicematrix_custom_line_commands_seq \l__nicematrix_command_str } \cs_generate_variant:Nn \__nicematrix_h_custom_line:nn { n V } +\cs_new_protected:Npn \__nicematrix_c_custom_line:n #1 + { + \exp_args:Nc \NewExpandableDocumentCommand + { nicematrix - \l__nicematrix_ccommand_str } + { O { } m } + { + \noalign + { + \__nicematrix_compute_rule_width:n { #1 , ##1 } + \skip_vertical:n { \l__nicematrix_rule_width_dim } + \clist_map_inline:nn + { ##2 } + { \__nicematrix_c_custom_line_i:nn { #1 , ##1 } { ####1 } } + } + } + \seq_put_left:NV \l__nicematrix_custom_line_commands_seq \l__nicematrix_ccommand_str + } +\cs_new_protected:Npn \__nicematrix_c_custom_line_i:nn #1 #2 + { + \str_if_in:nnTF { #2 } { - } + { \__nicematrix_cut_on_hyphen:w #2 \q_stop } + { \__nicematrix_cut_on_hyphen:w #2 - #2 \q_stop } + \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl + { + \__nicematrix_hline:n + { + #1 , + start = \l_tmpa_tl , + end = \l_tmpb_tl , + position = \int_eval:n { \c@iRow + 1 } , + total-width = \dim_use:N \l__nicematrix_rule_width_dim + } + } + } +\cs_generate_variant:Nn \__nicematrix_c_custom_line:nn { n V } \cs_new_protected:Npn \__nicematrix_compute_rule_width:n #1 { \bool_set_false:N \l__nicematrix_tikz_rule_bool @@ -5419,7 +5521,8 @@ } } } -\__nicematrix_custom_line:n { letter = : , command = hdottedline , dotted } +\__nicematrix_custom_line:n + { letter = : , command = hdottedline , ccommand = cdottedline, dotted } \cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnnn #1 #2 #3 #4 #5 { \bool_lazy_all:nT @@ -5904,7 +6007,7 @@ { \tl_if_empty:NTF \l__nicematrix_color_tl { \int_compare:nNnT { #2 } = 1 \set@color } - { \color { \l__nicematrix_color_tl } } + { \__nicematrix_color:V \l__nicematrix_color_tl } \int_compare:nNnT { #1 } = 1 \g__nicematrix_row_style_tl \group_begin: \bool_if:NF \l__nicematrix_respect_arraystretch_bool @@ -6068,7 +6171,9 @@ draw .default:n = default , rounded-corners .dim_set:N = \l__nicematrix_rounded_corners_dim , rounded-corners .default:n = 4 pt , - color .code:n = \color { #1 } \tl_set:Nn \l__nicematrix_draw_tl { #1 } , + color .code:n = + \__nicematrix_color:n { #1 } + \tl_set:Nn \l__nicematrix_draw_tl { #1 } , color .value_required:n = true , borders .clist_set:N = \l__nicematrix_borders_clist , borders .value_required:n = true , @@ -6205,12 +6310,12 @@ } \tl_if_empty:NF \l__nicematrix_fill_tl { - \exp_last_unbraced:NV \__nicematrix_extract_brackets \l__nicematrix_fill_tl \q_stop \tl_gput_right:Nx \g_nicematrix_code_before_tl { \exp_not:N \roundedrectanglecolor - [ \l_tmpa_tl ] - { \exp_not:V \l_tmpb_tl } + \exp_args:NV \tl_if_head_eq_meaning:nNTF \l__nicematrix_fill_tl [ + { \l__nicematrix_fill_tl } + { { \l__nicematrix_fill_tl } } { #1 - #2 } { \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int } { \dim_use:N \l__nicematrix_rounded_corners_dim } @@ -6403,13 +6508,6 @@ \endpgfpicture \group_end: } -\NewDocumentCommand \__nicematrix_extract_brackets { O { } } - { - \tl_set:Nn \l_tmpa_tl { #1 } - \__nicematrix_store_in_tmpb_tl - } -\cs_new_protected:Npn \__nicematrix_store_in_tmpb_tl #1 \q_stop - { \tl_set:Nn \l_tmpb_tl { #1 } } \cs_new_protected:Npn \__nicematrix_stroke_block:nnn #1 #2 #3 { \group_begin: @@ -6423,7 +6521,7 @@ { \str_if_eq:VnTF \l__nicematrix_draw_tl { default } { \CT@arc@ } - { \exp_args:NV \pgfsetstrokecolor \l__nicematrix_draw_tl } + { \__nicematrix_color:V \l__nicematrix_draw_tl } } \pgfsetcornersarced { @@ -6653,9 +6751,11 @@ } \keys_define:nn { NiceMatrix / Auto } { - l .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl l , - r .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl r , - c .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl c + columns-type .code:n = \__nicematrix_set_preamble:Nn \l__nicematrix_columns_type_tl { #1 } , + columns-type .value_required:n = true , + l .meta:n = { columns-type = l } , + r .meta:n = { columns-type = r } , + c .meta:n = { columns-type = c } } \NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } } { @@ -6663,12 +6763,16 @@ \int_zero_new:N \l__nicematrix_nb_cols_int \__nicematrix_set_size:n #4 \q_stop \group_begin: - \tl_set:Nn \l__nicematrix_type_of_col_tl c + \bool_set_true:N \l__nicematrix_Matrix_bool \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl + \cs_set_eq:NN \__nicematrix_transform_preamble: \prg_do_nothing: \use:x { \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } - { * { \int_use:N \l__nicematrix_nb_cols_int } { \l__nicematrix_type_of_col_tl } } + { + * { \int_use:N \l__nicematrix_nb_cols_int } + { \exp_not:V \l__nicematrix_columns_type_tl } + } [ \exp_not:V \l_tmpa_tl ] } \int_compare:nNnT \l__nicematrix_first_row_int = 0 @@ -6696,6 +6800,7 @@ { \cs_set_protected:cpn { #1 AutoNiceMatrix } { + \bool_gset_false:N \g__nicematrix_NiceArray_bool \str_gset:Nx \g__nicematrix_name_env_str { #1 AutoNiceMatrix } \AutoNiceMatrixWithDelims { #2 } { #3 } } @@ -6708,7 +6813,7 @@ \NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } } { \group_begin: - \bool_set_true:N \l__nicematrix_NiceArray_bool + \bool_gset_true:N \g__nicematrix_NiceArray_bool \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ] \group_end: } @@ -6857,8 +6962,7 @@ { \nullfont \c_math_toggle_token - \tl_if_empty:NF \l__nicematrix_delimiters_color_tl - { \color { \l__nicematrix_delimiters_color_tl } } + \__nicematrix_color:V \l__nicematrix_delimiters_color_tl \bool_if:nTF { #3 } { \left #1 } { \left . } \vcenter { @@ -6941,16 +7045,22 @@ { \peek_remove_spaces:n { - \__nicematrix_cut_on_hyphen:w #3 \q_stop - \tl_clear_new:N \l__nicematrix_tmpc_tl - \tl_clear_new:N \l__nicematrix_tmpd_tl - \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl - \__nicematrix_cut_on_hyphen:w #2 \q_stop - \seq_gput_right:Nx \g__nicematrix_submatrix_seq - { { \l_tmpa_tl } { \l_tmpb_tl } { \l__nicematrix_tmpc_tl } { \l__nicematrix_tmpd_tl } } \tl_gput_right:Nn \g__nicematrix_internal_code_after_tl { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] } + \__nicematrix_SubMatrix_in_code_before_i { #2 } { #3 } + } + } +\NewDocumentCommand \__nicematrix_SubMatrix_in_code_before_i + { > { \SplitArgument { 1 } { - } } m > { \SplitArgument { 1 } { - } } m } + { \__nicematrix_SubMatrix_in_code_before_i:nnnn #1 #2 } +\cs_new_protected:Npn \__nicematrix_SubMatrix_in_code_before_i:nnnn #1 #2 #3 #4 + { + \seq_gput_right:Nx \g__nicematrix_submatrix_seq + { + { \str_if_eq:nnTF { #1 } { last } { \int_use:N \c@iRow } { #1 } } + { \str_if_eq:nnTF { #2 } { last } { \int_use:N \c@jCol } { #2 } } + { \str_if_eq:nnTF { #3 } { last } { \int_use:N \c@iRow } { #3 } } + { \str_if_eq:nnTF { #4 } { last } { \int_use:N \c@jCol } { #4 } } } } \hook_gput_code:nnn { begindocument } { . } @@ -6962,30 +7072,27 @@ \peek_remove_spaces:n { \__nicematrix_sub_matrix:nnnnnnn - { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } + { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } } } } -\cs_new_protected:Npn \__nicematrix_compute_i_j:nn #1 #2 +\NewDocumentCommand \__nicematrix_compute_i_j:nn + { > { \SplitArgument { 1 } { - } } m > { \SplitArgument { 1 } { - } } m } + { \__nicematrix_compute_i_j:nnnn #1 #2 } +\cs_new_protected:Npn \__nicematrix_compute_i_j:nnnn #1 #2 #3 #4 { - \tl_clear_new:N \l__nicematrix_first_i_tl - \tl_clear_new:N \l__nicematrix_first_j_tl - \tl_clear_new:N \l__nicematrix_last_i_tl - \tl_clear_new:N \l__nicematrix_last_j_tl - \__nicematrix_cut_on_hyphen:w #1 \q_stop - \tl_if_eq:NnTF \l_tmpa_tl { last } + \tl_set:Nn \l__nicematrix_first_i_tl { #1 } + \tl_set:Nn \l__nicematrix_first_j_tl { #2 } + \tl_set:Nn \l__nicematrix_last_i_tl { #3 } + \tl_set:Nn \l__nicematrix_last_j_tl { #4 } + \tl_if_eq:NnT \l__nicematrix_first_i_tl { last } { \tl_set:NV \l__nicematrix_first_i_tl \c@iRow } - { \tl_set_eq:NN \l__nicematrix_first_i_tl \l_tmpa_tl } - \tl_if_eq:NnTF \l_tmpb_tl { last } + \tl_if_eq:NnT \l__nicematrix_first_j_tl { last } { \tl_set:NV \l__nicematrix_first_j_tl \c@jCol } - { \tl_set_eq:NN \l__nicematrix_first_j_tl \l_tmpb_tl } - \__nicematrix_cut_on_hyphen:w #2 \q_stop - \tl_if_eq:NnTF \l_tmpa_tl { last } + \tl_if_eq:NnT \l__nicematrix_last_i_tl { last } { \tl_set:NV \l__nicematrix_last_i_tl \c@iRow } - { \tl_set_eq:NN \l__nicematrix_last_i_tl \l_tmpa_tl } - \tl_if_eq:NnTF \l_tmpb_tl { last } + \tl_if_eq:NnT \l__nicematrix_last_j_tl { last } { \tl_set:NV \l__nicematrix_last_j_tl \c@jCol } - { \tl_set_eq:NN \l__nicematrix_last_j_tl \l_tmpb_tl } } \cs_new_protected:Npn \__nicematrix_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7 { @@ -7067,8 +7174,7 @@ \dim_zero:N \nulldelimiterspace \group_begin: \pgfsetlinewidth { 1.1 \arrayrulewidth } - \tl_if_empty:NF \l__nicematrix_rules_color_tl - { \exp_after:wN \__nicematrix_set_CT@arc@: \l__nicematrix_rules_color_tl \q_stop } + \__nicematrix_set_CT@arc@:V \l__nicematrix_rules_color_tl \CT@arc@ \seq_map_inline:Nn \g__nicematrix_cols_vlism_seq { @@ -7220,8 +7326,7 @@ { \nullfont \c_math_toggle_token - \tl_if_empty:NF \l__nicematrix_delimiters_color_tl - { \color { \l__nicematrix_delimiters_color_tl } } + \__nicematrix_color:V \l__nicematrix_delimiters_color_tl \left #1 \vcenter { @@ -7244,8 +7349,7 @@ { \nullfont \c_math_toggle_token - \tl_if_empty:NF \l__nicematrix_delimiters_color_tl - { \color { \l__nicematrix_delimiters_color_tl } } + \__nicematrix_color:V \l__nicematrix_delimiters_color_tl \left . \vcenter { @@ -7474,7 +7578,6 @@ } } } -\bool_new:N \c__nicematrix_messages_for_Overleaf_bool \bool_new:N \c__nicematrix_footnotehyper_bool \bool_new:N \c__nicematrix_footnote_bool \msg_new:nnnn { nicematrix } { Unknown~key~for~package } @@ -7603,7 +7706,7 @@ you~try~to~use~more~columns~than~allowed~by~your~ \__nicematrix_full_name_env:.\__nicematrix_message_hdotsfor:\ Recall~that~the~maximal~ number~of~columns~for~a~matrix~is~fixed~by~the~LaTeX~counter~ - 'MaxMatrixCols'.~Its~actual~value~is~\int_use:N \c@MaxMatrixCols.~ + 'MaxMatrixCols'.~Its~current~value~is~\int_use:N \c@MaxMatrixCols.~ This~error~is~fatal. } \__nicematrix_msg_new:nn { too~much~cols~for~array } @@ -7628,7 +7731,8 @@ Columns~not~used.\\ The~preamble~of~your~\__nicematrix_full_name_env:\ announces~\int_use:N \g__nicematrix_static_num_of_col_int\ columns~but~you~use~only~\int_use:N \c@jCol.\\ - The~columns~you~did~not~used~won't~be~created. + The~columns~you~did~not~used~won't~be~created.\\ + We~won't~have~similar~error~till~the~end~of~the~document. } \__nicematrix_msg_new:nn { in~first~col } { @@ -7671,6 +7775,12 @@ Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~ is~'standard'.~That~key~will~be~ignored. } +\__nicematrix_msg_new:nn { Unknown~key~for~rules } + { + Unknown~key.\\ + There~is~only~two~keys~available~here:~width~and~color.\\ + You~key~'\l_keys_key_str'~will~be~ignored. + } \__nicematrix_msg_new:nnn { Unknown~key~for~custom-line } { Unknown~key.\\ @@ -7786,8 +7896,8 @@ { Erroneous~use.\\ Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~ - key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~key~'command'~ - (to~draw~horizontal~rules).\\ + key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~keys~'command'~or~ + ~'ccommand'~(to~draw~horizontal~rules).\\ However,~you~can~go~on. } \__nicematrix_msg_new:nn { Forbidden~letter } @@ -8013,7 +8123,8 @@ { siunitx~too~old.\\ You~can't~use~'S'~columns~because~your~version~of~'siunitx'~ - is~too~old.~You~need~at~least~v~3.0.\\ + is~too~old.~You~need~at~least~v~3.0~and~your~log~file~says:~"siunitx,~ + \use:c { ver @ siunitx.sty }". \\ This~error~is~fatal. } \__nicematrix_msg_new:nnn { Unknown~key~for~Brace } @@ -8136,6 +8247,7 @@ last-row,~ left-margin,~ light-syntax,~ + matrix/columns-type,~ notes~(several~subkeys),~ nullify-dots,~ renew-dots,~ @@ -8226,6 +8338,7 @@ code-for-last-col,~ code-for-last-row,~ colortbl-like,~ + columns-type,~ columns-width,~ corners,~ create-extra-nodes,~ |