diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 136 |
1 files changed, 82 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 520913cb4f4..f67f836841e 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.25} -\def\myfiledate{2023/10/24} +\def\myfileversion{6.25a} +\def\myfiledate{2023/11/03} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -406,7 +406,7 @@ \tl_new:N \l__nicematrix_rule_color_tl \bool_new:N \g__nicematrix_rotate_bool \bool_new:N \g__nicematrix_rotate_c_bool -\bool_new:N \l__nicematrix_X_column_bool +\bool_new:N \l__nicematrix_X_bool \bool_new:N \g__nicematrix_caption_finished_bool \tl_new:N \g__nicematrix_aux_tl \bool_new:N \g__nicematrix_aux_found_bool @@ -851,7 +851,7 @@ \hook_gput_code:nnn { begindocument } { . } { \dim_set:Nn \l__nicematrix_xdots_inter_dim { #1 } } , radius .value_required:n = true , - down .code:n = \tl_put_right:Nn \l__nicematrix_xdots_down_tl { #1 } , % modified 2023-08-09 + down .code:n = \tl_put_right:Nn \l__nicematrix_xdots_down_tl { #1 } , up .code:n = \tl_put_right:Nn \l__nicematrix_xdots_up_tl { #1 } , middle .code:n = \tl_put_right:Nn \l__nicematrix_xdots_middle_tl { #1 } , draw-first .code:n = \prg_do_nothing: , @@ -2222,7 +2222,7 @@ \cs_new_protected:Npn \__nicematrix_make_preamble_i_i:n #1 { \str_if_eq:nnTF { #1 } | - { \__nicematrix_make_preamble_iii:n | } + { \use:c { __nicematrix _ | } | } { \__nicematrix_make_preamble_i_ii:nn { } #1 } } \cs_new_protected:Npn \__nicematrix_make_preamble_i_ii:nn #1 #2 @@ -2322,12 +2322,12 @@ \str_set:Nn \l__nicematrix_hpos_col_str { j } \tl_set:Nn \l_tmpa_tl { #1 } \__nicematrix_keys_p_column:V \l_tmpa_tl - \__nicematrix_make_preamble_ii_iv:nn { #2 } { minipage } + \__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { } } \cs_new_protected:Npn \__nicematrix_keys_p_column:n #1 { \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl } \cs_generate_variant:Nn \__nicematrix_keys_p_column:n { V } -\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iv:nn #1 #2 +\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iv:nnn #1 #2 #3 { \use:e { @@ -2350,6 +2350,7 @@ L { \exp_not:N \RaggedRight } R { \exp_not:N \RaggedLeft } } + #3 } { \str_if_eq:VnT \l__nicematrix_vpos_col_str { m } \__nicematrix_center_cell_box: } { \str_if_eq:VnT \l__nicematrix_hpos_col_str { si } \siunitx_cell_begin:w } @@ -2379,7 +2380,7 @@ > { \dim_set:Nn \l__nicematrix_col_width_dim { #2 } \__nicematrix_cell_begin:w - \begin { #7 } [ #1 ] { #2 } + \use:c { #7 } [ #1 ] { #2 } \everypar { \vrule height \box_ht:N \@arstrutbox width \c_zero_dim @@ -2394,14 +2395,23 @@ < { #6 \@finalstrut \@arstrutbox - % \bool_if:NT \g__nicematrix_rotate_bool { \raggedright \hsize = 3 cm } - \end { #7 } + \use:c { end #7 } #4 \__nicematrix_cell_end: } } } -\cs_new_protected:Npn \__nicematrix_test_if_empty: \ignorespaces #1 +\str_new:N \c__nicematrix_ignorespaces_str +\str_set:Nx \c__nicematrix_ignorespaces_str { \ignorespaces } +\str_remove_all:Nn \c__nicematrix_ignorespaces_str { ~ } +\cs_new_protected:Npn \__nicematrix_test_if_empty: { \peek_after:Nw \__nicematrix_test_if_empty_i: } +\cs_new_protected:Npn \__nicematrix_test_if_empty_i: + { + \str_set:Nx \l_tmpa_str { \token_to_meaning:N \l_peek_token } + \str_if_eq:NNT \l_tmpa_str \c__nicematrix_ignorespaces_str + { \__nicematrix_test_if_empty:w } + } +\cs_new_protected:Npn \__nicematrix_test_if_empty:w \ignorespaces { \peek_meaning:NT \unskip { @@ -2411,16 +2421,14 @@ \skip_horizontal:N \l__nicematrix_col_width_dim } } - #1 } -\cs_new_protected:Npn \__nicematrix_test_if_empty_for_S: #1 +\cs_new_protected:Npn \__nicematrix_test_if_empty_for_S: { \peek_meaning:NT \__siunitx_table_skip:n { \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl { \box_set_wd:Nn \l__nicematrix_cell_box \c_zero_dim } } - #1 } \cs_new_protected:Npn \__nicematrix_center_cell_box: { @@ -2458,10 +2466,10 @@ \tl_set:Nn \l_tmpa_tl { #1 } \__nicematrix_keys_p_column:V \l_tmpa_tl \IfPackageLoadedTF { varwidth } - { \__nicematrix_make_preamble_ii_iv:nn { #2 } { varwidth } } + { \__nicematrix_make_preamble_ii_iv:nnn { #2 } { varwidth } { } } { \__nicematrix_error_or_warning:n { varwidth~not~loaded } - \__nicematrix_make_preamble_ii_iv:nn { #2 } { minipage } + \__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { } } } \cs_new:Npn \__nicematrix_w { \__nicematrix_make_preamble_w:nnnn { } } @@ -2533,20 +2541,24 @@ { \__nicematrix_make_preamble_S_i:n { #1 } } \cs_new_protected:Npn \__nicematrix_make_preamble_S_i:n #1 { - \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl - \tl_gclear:N \g__nicematrix_pre_cell_tl - \tl_gput_right:Nn \g__nicematrix_array_preamble_tl + \IfPackageLoadedTF { siunitx } { - > { - \__nicematrix_cell_begin:w - \keys_set:nn { siunitx } { #1 } - \siunitx_cell_begin:w + \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl + \tl_gclear:N \g__nicematrix_pre_cell_tl + \tl_gput_right:Nn \g__nicematrix_array_preamble_tl + { + > { + \__nicematrix_cell_begin:w + \keys_set:nn { siunitx } { #1 } + \siunitx_cell_begin:w + } + c + < { \siunitx_cell_end: \__nicematrix_cell_end: } } - c - < { \siunitx_cell_end: \__nicematrix_cell_end: } + \int_gincr:N \c@jCol + \__nicematrix_rec_preamble_after_col:n } - \int_gincr:N \c@jCol - \__nicematrix_rec_preamble_after_col:n + { \__nicematrix_fatal:n { siunitx~not~loaded } } } \cs_new:cpn { __nicematrix _ \token_to_str:N ( } #1 #2 { @@ -2718,16 +2730,17 @@ \bool_if:NTF \l__nicematrix_X_columns_aux_bool { \exp_args:Nne - \__nicematrix_make_preamble_ii_iv:nn + \__nicematrix_make_preamble_ii_iv:nnn { \l__nicematrix_weight_int \l__nicematrix_X_columns_dim } { minipage } + { \__nicematrix_no_update_width: } } { \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { > { \__nicematrix_cell_begin:w - \bool_set_true:N \l__nicematrix_X_column_bool + \bool_set_true:N \l__nicematrix_X_bool \NotEmpty \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl { \hbox_set:Nn \l__nicematrix_cell_box { } } @@ -2743,6 +2756,11 @@ \__nicematrix_rec_preamble_after_col:n } } +\cs_new_protected:Npn \__nicematrix_no_update_width: + { + \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl + { \cs_set_eq:NN \__nicematrix_update_max_cell_width: \prg_do_nothing: } + } \cs_new_protected:Npn \__nicematrix_make_preamble_vlism:n #1 { \seq_gput_right:Nx \g__nicematrix_cols_vlism_seq @@ -3327,8 +3345,8 @@ \bool_lazy_and:nnTF \l__nicematrix_auto_columns_width_bool { \bool_not_p:n \l__nicematrix_block_auto_columns_width_bool } - { \skip_gset_eq:NN \g_tmpa_skip \g__nicematrix_max_cell_width_dim } - { \skip_gset_eq:NN \g_tmpa_skip \l__nicematrix_columns_width_dim } + { \skip_gadd:Nn \g_tmpa_skip \g__nicematrix_max_cell_width_dim } + { \skip_gadd:Nn \g_tmpa_skip \l__nicematrix_columns_width_dim } \skip_gadd:Nn \g_tmpa_skip { 2 \col@sep } } \skip_horizontal:N \g_tmpa_skip @@ -6932,7 +6950,7 @@ \int_compare_p:nNn { \l_tmpb_int } = 1 ) && ! \tl_if_empty_p:n { #5 } - && ! \l__nicematrix_X_column_bool + && ! \l__nicematrix_X_bool } { \exp_args:Nee \__nicematrix_Block_iv:nnnnn } { \exp_args:Nee \__nicematrix_Block_v:nnnnn } @@ -6950,7 +6968,8 @@ { \int_use:N \c@jCol } { \int_eval:n { \c@iRow + #1 - 1 } } { \int_eval:n { \c@jCol + #2 - 1 } } - { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } + { \exp_not:n { ##1 } } + { \exp_not:n { ##2 } } } } \box_gclear_new:c @@ -7033,27 +7052,30 @@ } } } - \int_compare:nNnT { #1 } = 1 - { - \dim_gset:Nn \g__nicematrix_blocks_ht_dim - { - \dim_max:nn - \g__nicematrix_blocks_ht_dim - { - \box_ht:c - { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } - } - } - \dim_gset:Nn \g__nicematrix_blocks_dp_dim - { - \dim_max:nn - \g__nicematrix_blocks_dp_dim - { - \box_dp:c - { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } - } - } - } + \str_if_eq:VnT \l__nicematrix_vpos_of_block_str { c } + { + \int_compare:nNnT { #1 } = 1 + { + \dim_gset:Nn \g__nicematrix_blocks_ht_dim + { + \dim_max:nn + \g__nicematrix_blocks_ht_dim + { + \box_ht:c + { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } + } + } + \dim_gset:Nn \g__nicematrix_blocks_dp_dim + { + \dim_max:nn + \g__nicematrix_blocks_dp_dim + { + \box_dp:c + { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } + } + } + } + } \seq_gput_right:Nx \g__nicematrix_blocks_seq { \l_tmpa_tl @@ -9233,6 +9255,12 @@ in~order~to~use~the~key~'\l_keys_key_str'.\\ That~key~will~be~ignored. } +\__nicematrix_msg_new:nn { siunitx~not~loaded } + { + siunitx~not~loaded\\ + You~can't~use~the~columns~'S'~because~'siunitx'~is~not~loaded.\\ + That~error~is~fatal. + } \__nicematrix_msg_new:nn { ragged2e~not~loaded } { You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~ |