diff options
author | Karl Berry <karl@freefriends.org> | 2023-05-16 20:22:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-05-16 20:22:30 +0000 |
commit | 9878b019471468462f25f79fd6a5837b9bcad076 (patch) | |
tree | 65cd04ec4a6524830f9ec0d9be55d241acf87c98 /Master/texmf-dist/tex/latex | |
parent | 8e9d8b027e86eefeb1788f42ec5fc0a8c76548ba (diff) |
nicematrix (16may23)
git-svn-id: svn://tug.org/texlive/trunk@67135 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 363 |
1 files changed, 191 insertions, 172 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index e676ebb9bca..e49a5c7964f 100644 --- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty +++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% nicematrix.dtx (with options: `package') +%% nicematrix-code.dtx (with options: `package') %% %% Copyright (C) 2018-2023 by F. Pantigny %% @@ -18,10 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{6.18} -\def\myfiledate{2023/04/19} - - +\def\myfileversion{6.19} +\def\myfiledate{2023/05/15} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -100,7 +98,7 @@ } \hook_gput_code:nnn { begindocument / after } { . } { - \@ifpackageloaded { mdwtab } + \IfPackageLoadedTF { mdwtab } { \__nicematrix_fatal:n { mdwtab~loaded } } { \bool_if:NF \c__nicematrix_no_test_for_array_bool @@ -122,29 +120,12 @@ \cs_generate_variant:Nn \str_lowercase:n { V } \hook_gput_code:nnn { begindocument } { . } { - \@ifpackageloaded { varwidth } - { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_true_bool } } - { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_false_bool } } - \@ifpackageloaded { booktabs } - { \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_const:Nn \c__nicematrix_enumitem_loaded_bool { \c_true_bool } } - { \bool_const:Nn \c__nicematrix_enumitem_loaded_bool { \c_false_bool } } - \@ifpackageloaded { tabularx } - { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_true_bool } } - { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_false_bool } } - \@ifpackageloaded { floatrow } - { \bool_const:Nn \c__nicematrix_floatrow_loaded_bool { \c_true_bool } } - { \bool_const:Nn \c__nicematrix_floatrow_loaded_bool { \c_false_bool } } - \@ifpackageloaded { tikz } - { - \bool_const:Nn \c__nicematrix_tikz_loaded_bool \c_true_bool + \IfPackageLoadedTF { tikz } + { \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 } } @@ -189,7 +170,7 @@ } \hook_gput_code:nnn { begindocument } { . } { - \@ifpackageloaded { booktabs } + \IfPackageLoadedTF { booktabs } { \iow_now:Nn \@mainaux \nicematrix@redefine@check@rerun } { } } @@ -202,11 +183,10 @@ { \__nicematrix_old_pgfutil@check@rerun { ##1 } { ##2 } } } } -\bool_new:N \l__nicematrix_colortbl_loaded_bool \hook_gput_code:nnn { begindocument } { . } { - \@ifpackageloaded { colortbl } - { \bool_set_true:N \l__nicematrix_colortbl_loaded_bool } + \IfPackageLoadedTF { colortbl } + { } { \cs_set_protected:Npn \CT@arc@ { } \cs_set:Npn \arrayrulecolor #1 # { \CT@arc { #1 } } @@ -301,23 +281,12 @@ } \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 } } - } + { \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 } { . } - { - \@ifpackageloaded { siunitx } - { \bool_set_true:N \l__nicematrix_siunitx_loaded_bool } - { } - } \hook_gput_code:nnn { begindocument } { . } { - \bool_if:nTF { ! \l__nicematrix_siunitx_loaded_bool } - { \cs_set_eq:NN \__nicematrix_renew_NC@rewrite@S: \prg_do_nothing: } + \IfPackageLoadedTF { siunitx } { \cs_new_protected:Npn \__nicematrix_renew_NC@rewrite@S: { @@ -336,6 +305,7 @@ } } } + { \cs_set_eq:NN \__nicematrix_renew_NC@rewrite@S: \prg_do_nothing: } } \cs_new_protected:Npn \__nicematrix_rescan_for_spanish:N #1 { @@ -354,7 +324,7 @@ \cs_new_protected:Npn \__nicematrix_qpoint:n #1 { \pgfpointanchor { \__nicematrix_env: - #1 } { center } } \int_new:N \g__nicematrix_NiceMatrixBlock_int -\int_new:N \l__nicematrix_note_in_caption_int +\int_new:N \g__nicematrix_notes_caption_int \dim_new:N \l__nicematrix_columns_width_dim \dim_new:N \l__nicematrix_col_width_dim \dim_set:Nn \l__nicematrix_col_width_dim { -1 cm } @@ -431,7 +401,6 @@ \dim_zero_new:N \l__nicematrix_tmpc_dim \dim_zero_new:N \l__nicematrix_tmpd_dim \bool_new:N \g__nicematrix_empty_cell_bool -\bool_new:N \g__nicematrix_second_composition_bool \dim_new:N \g__nicematrix_width_last_col_dim \dim_new:N \g__nicematrix_width_first_col_dim \seq_new:N \g__nicematrix_blocks_seq @@ -528,14 +497,7 @@ \cs_set:Npn \thetabularnote { { \__nicematrix_notes_style:n { tabularnote } } } \hook_gput_code:nnn { begindocument } { . } { - \bool_if:nTF { ! \c__nicematrix_enumitem_loaded_bool } - { - \NewDocumentCommand \tabularnote { m } - { - \__nicematrix_error_or_warning:n { enumitem~not~loaded } - \__nicematrix_gredirect_none:n { enumitem~not~loaded } - } - } + \IfPackageLoadedTF { enumitem } { \newlist { tabularnotes } { enumerate } { 1 } \setlist [ tabularnotes ] @@ -556,7 +518,7 @@ label = \__nicematrix_notes_label_in_list:n { \__nicematrix_notes_style:n { tabularnotes*i } } } - \NewDocumentCommand \tabularnote { m } + \NewDocumentCommand \tabularnote { o m } { \bool_if:nT { \cs_if_exist_p:N \@captype || \l__nicematrix_in_env_bool } { @@ -564,93 +526,123 @@ { \__nicematrix_error:n { tabularnote~forbidden } } { \bool_if:NTF \l__nicematrix_in_caption_bool - { \__nicematrix_tabularnote_ii:n { #1 } } - { \__nicematrix_tabularnote_i:n { #1 } } + { \__nicematrix_tabularnote_caption:nn { #1 } { #2 } } + { \__nicematrix_tabularnote:nn { #1 } { #2 } } } } } - \cs_new_protected:Npn \__nicematrix_tabularnote_i:n #1 + } + { + \NewDocumentCommand \tabularnote { o m } { - \int_zero:N \l_tmpa_int - \bool_if:NT \l__nicematrix_notes_detect_duplicates_bool - { - \seq_map_indexed_inline:Nn \g__nicematrix_notes_seq - { - \tl_if_eq:nnT { #1 } { ##2 } - { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: } - } - \int_compare:nNnF \l_tmpa_int = 0 - { \int_add:Nn \l_tmpa_int \l__nicematrix_note_in_caption_int } - } - \int_compare:nNnTF \l_tmpa_int = 0 - { - \int_gincr:N \c@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_notes_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 - { - \seq_use:Nnnn - \l__nicematrix_notes_labels_seq { , } { , } { , } - } - } - \int_gsub:Nn \c@tabularnote { 1 } - \int_set_eq:NN \l_tmpa_int \c@tabularnote - \refstepcounter { tabularnote } - \int_compare:nNnT \l_tmpa_int = \c@tabularnote - { \int_gincr:N \c@tabularnote } - \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 } - } + \__nicematrix_error_or_warning:n { enumitem~not~loaded } + \__nicematrix_gredirect_none:n { enumitem~not~loaded } } - \cs_new_protected:Npn \__nicematrix_tabularnote_ii:n #1 + } + } +\cs_new_protected:Npn \__nicematrix_tabularnote:nn #1 #2 + { + \int_zero:N \l_tmpa_int + \bool_if:NT \l__nicematrix_notes_detect_duplicates_bool + { + \seq_map_indexed_inline:Nn \g__nicematrix_notes_seq { - \int_gincr:N \c@tabularnote - \bool_if:NTF \g__nicematrix_caption_finished_bool - { - \int_compare:nNnTF - \c@tabularnote > { \tl_count:N \g__nicematrix_notes_in_caption_seq } - { \int_gset:Nn \c@tabularnote { 1 } } - \seq_if_in:NnF \g__nicematrix_notes_in_caption_seq { #1 } - { \__nicematrix_fatal:n { Identical~notes~in~caption } } - } + \tl_if_eq:nnT { { #1 } { #2 } } { ##2 } + { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: } + } + \int_compare:nNnF \l_tmpa_int = \c_zero_int + { \int_add:Nn \l_tmpa_int \g__nicematrix_notes_caption_int } + } + \int_compare:nNnT \l_tmpa_int = \c_zero_int + { + \seq_gput_right:Nn \g__nicematrix_notes_seq { { #1 } { #2 } } + \tl_if_novalue:nT { #1 } { \int_gincr:N \c@tabularnote } + } + \seq_put_right:Nx \l__nicematrix_notes_labels_seq + { + \tl_if_novalue:nTF { #1 } + { + \__nicematrix_notes_format:n { - \seq_if_in:NnTF \g__nicematrix_notes_in_caption_seq { #1 } + \int_eval:n { - \bool_gset_true:N \g__nicematrix_caption_finished_bool - \int_gset:Nn \c@tabularnote { 1 } + \int_compare:nNnTF \l_tmpa_int = \c_zero_int + \c@tabularnote + \l_tmpa_int } - { \seq_gput_right:Nn \g__nicematrix_notes_in_caption_seq { #1 } } } - \seq_put_right:Nx \l__nicematrix_notes_labels_seq - { \__nicematrix_notes_format:n { \int_use:N \c@tabularnote } } - \peek_meaning:NF \tabularnote + } + { #1 } + } + \peek_meaning:NF \tabularnote + { + \hbox_set:Nn \l_tmpa_box + { + \__nicematrix_notes_label_in_tabular:n { - \hbox_set:Nn \l_tmpa_box - { - \__nicematrix_notes_label_in_tabular:n - { - \seq_use:Nnnn - \l__nicematrix_notes_labels_seq { , } { , } { , } - } - } - \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 } + \seq_use:Nnnn + \l__nicematrix_notes_labels_seq { , } { , } { , } } } + \int_gsub:Nn \c@tabularnote { 1 } + \int_set_eq:NN \l_tmpa_int \c@tabularnote + \refstepcounter { tabularnote } + \int_compare:nNnT \l_tmpa_int = \c@tabularnote + { \int_gincr:N \c@tabularnote } + \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 } + } + } +\cs_new_protected:Npn \__nicematrix_tabularnote_caption:nn #1 #2 + { + \bool_if:NTF \g__nicematrix_caption_finished_bool + { + \int_compare:nNnT + \c@tabularnote = \g__nicematrix_notes_caption_int + { \int_gzero:N \c@tabularnote } + \bool_set_false:N \l_tmpa_bool + \seq_map_inline:Nn \g__nicematrix_notes_in_caption_seq + { \__nicematrix_if_eq_two_three:nnn ##1 { #2 } } + \bool_if:NF \l_tmpa_bool + { \__nicematrix_error:n { Identical~notes~in~caption } } + } + { + \bool_set_false:N \l_tmpa_bool + \seq_map_inline:Nn \g__nicematrix_notes_in_caption_seq + { \__nicematrix_if_eq_two_three:nnn ##1 { #2 } } + \bool_if:NTF \l_tmpa_bool + { + \bool_gset_true:N \g__nicematrix_caption_finished_bool + \int_gset_eq:NN \g__nicematrix_notes_caption_int \c@tabularnote + \int_gzero:N \c@tabularnote + } + { \seq_gput_right:Nn \g__nicematrix_notes_in_caption_seq { { #1 } { #2 } } } + } + \tl_if_novalue:nT { #1 } { \int_gincr:N \c@tabularnote } + \seq_put_right:Nx \l__nicematrix_notes_labels_seq + { + \tl_if_novalue:nTF { #1 } + { \__nicematrix_notes_format:n { \int_use:N \c@tabularnote } } + { #1 } + } + \peek_meaning:NF \tabularnote + { + \__nicematrix_notes_label_in_tabular:n + { \seq_use:Nnnn \l__nicematrix_notes_labels_seq { , } { , } { , } } + \seq_clear:N \l__nicematrix_notes_labels_seq + } + } +\cs_new_protected:Npn \__nicematrix_if_eq_two_three:nnn #1 #2 #3 + { + \tl_if_eq:nnT { #2 } { #3 } + { + \bool_set_true:N \l_tmpa_bool + \seq_map_break: } } +\cs_new_protected:Npn \__nicematrix_count_novalue_first:nn #1 #2 + { \tl_if_novalue:nT { #1 } { \int_gincr:N \g__nicematrix_notes_caption_int } } \cs_new_protected:Npn \__nicematrix_pgf_rect_node:nnnnn #1 #2 #3 #4 #5 { \begin { pgfscope } @@ -944,8 +936,9 @@ { \hook_gput_code:nnn { begindocument } { . } { - \bool_if:NT \c__nicematrix_enumitem_loaded_bool + \IfPackageLoadedTF { enumitem } { \setlist* [ tabularnotes ] { #1 } } + { } } } , enumitem-keys .value_required:n = true , @@ -953,8 +946,9 @@ { \hook_gput_code:nnn { begindocument } { . } { - \bool_if:NT \c__nicematrix_enumitem_loaded_bool + \IfPackageLoadedTF { enumitem } { \setlist* [ tabularnotes* ] { #1 } } + { } } } , enumitem-keys-para .value_required:n = true , @@ -1445,8 +1439,9 @@ \int_gzero:N \g__nicematrix_total_X_weight_int \__nicematrix_expand_clist:N \l__nicematrix_hlines_clist \__nicematrix_expand_clist:N \l__nicematrix_vlines_clist - \bool_if:NT \c__nicematrix_booktabs_loaded_bool + \IfPackageLoadedTF { booktabs } { \tl_put_left:Nn \@BTnormal \__nicematrix_create_row_node_i: } + { } \box_clear_new:N \l__nicematrix_cell_box \normalbaselines \bool_if:NT \l__nicematrix_small_bool @@ -1464,7 +1459,7 @@ } \cs_set_nopar:Npn \ialign { - \bool_if:NTF \l__nicematrix_colortbl_loaded_bool + \IfPackageLoadedTF { colortbl } { \CT@everycr { @@ -1524,7 +1519,7 @@ { \tl_if_empty:NF \l__nicematrix_note_in_caption_tl { - \int_set_eq:NN \l__nicematrix_note_in_caption_int + \int_gset_eq:NN \g__nicematrix_notes_caption_int { \l__nicematrix_note_in_caption_tl } \int_gset:Nn \c@tabularnote { \l__nicematrix_note_in_caption_tl } } @@ -1635,7 +1630,7 @@ \bool_if:NT \g__nicematrix_recreate_cell_nodes_bool \__nicematrix_recreate_cell_nodes: \endpgfpicture \__nicematrix_create_blocks_nodes: - \bool_if:NT \c__nicematrix_tikz_loaded_bool + \IfPackageLoadedTF { tikz } { \tikzset { @@ -1643,6 +1638,7 @@ { overlay , name~prefix = \__nicematrix_env: - } } } + { } \cs_set_eq:NN \cellcolor \__nicematrix_cellcolor \cs_set_eq:NN \rectanglecolor \__nicematrix_rectanglecolor \cs_set_eq:NN \roundedrectanglecolor \__nicematrix_roundedrectanglecolor @@ -2363,7 +2359,7 @@ \tl_set:Nn \l_tmpa_tl { #1 } \tl_replace_all:Nnn \l_tmpa_tl { \__nicematrix_S: } { S } \__nicematrix_keys_p_column:V \l_tmpa_tl - \bool_if:NTF \c__nicematrix_varwidth_loaded_bool + \IfPackageLoadedTF { varwidth } { \__nicematrix_patch_preamble_iv_iv:nn { #2 } { varwidth } } { \__nicematrix_error_or_warning:n { varwidth~not~loaded } @@ -2439,7 +2435,7 @@ { \__nicematrix_patch_preamble_vii_ii:n { #1 } } \cs_new_protected:Npn \__nicematrix_patch_preamble_vii_ii:n #1 { - \cs_if_exist:NTF \siunitx_cell_begin:w + \IfPackageAtLeastTF { siunitx } { 2022/01/01 } { \tl_gput_right:NV \g__nicematrix_preamble_tl \g__nicematrix_pre_cell_tl \tl_gclear:N \g__nicematrix_pre_cell_tl @@ -2860,15 +2856,14 @@ \bool_set_false:N \g__nicematrix_caption_finished_bool \int_gzero:N \c@tabularnote \__nicematrix_insert_caption: - \int_gset:Nn \c@tabularnote - { \seq_count:N \g__nicematrix_notes_in_caption_seq } - \int_compare:nNnF \c@tabularnote = 0 + \int_compare:nNnT \g__nicematrix_notes_caption_int > 0 { \tl_gput_right:Nx \g__nicematrix_aux_tl { \tl_set:Nn \exp_not:N \l__nicematrix_note_in_caption_tl - { \int_eval:n { \c@tabularnote } } + { \int_use:N \g__nicematrix_notes_caption_int } } + \int_gzero:N \g__nicematrix_notes_caption_int } } } @@ -2902,11 +2897,13 @@ { \group_begin: \bool_set_true:N \l__nicematrix_in_caption_bool - \bool_if:NT \c__nicematrix_floatrow_loaded_bool + \IfPackageLoadedTF { floatrow } { \cs_set_eq:NN \@makecaption \FR@makecaption } + { } \tl_if_empty:NTF \l__nicematrix_short_caption_tl - { \caption { \l__nicematrix_caption_tl } } - { \caption [ \l__nicematrix_short_caption_tl ] { \l__nicematrix_caption_tl } } + { \caption } + { \caption [ \l__nicematrix_short_caption_tl ] } + { \l__nicematrix_caption_tl } \tl_if_empty:NF \l__nicematrix_label_tl { \label { \l__nicematrix_label_tl } } \group_end: } @@ -2932,13 +2929,17 @@ \bool_if:NTF \l__nicematrix_notes_para_bool { \begin { tabularnotes* } - \seq_map_inline:Nn \g__nicematrix_notes_seq { \item ##1 } \strut + \seq_map_inline:Nn \g__nicematrix_notes_seq + { \__nicematrix_one_tabularnote:nn ##1 } + \strut \end { tabularnotes* } \par } { \tabularnotes - \seq_map_inline:Nn \g__nicematrix_notes_seq { \item ##1 } \strut + \seq_map_inline:Nn \g__nicematrix_notes_seq + { \__nicematrix_one_tabularnote:nn ##1 } + \strut \endtabularnotes } } @@ -2946,7 +2947,7 @@ \group_end: \bool_if:NT \l__nicematrix_notes_bottomrule_bool { - \bool_if:NTF \c__nicematrix_booktabs_loaded_bool + \IfPackageLoadedTF { booktabs } { \skip_vertical:N \aboverulesep { \CT@arc@ \hrule height \heavyrulewidth } @@ -2958,6 +2959,12 @@ \seq_gclear:N \g__nicematrix_notes_in_caption_seq \int_gzero:N \c@tabularnote } +\cs_set_protected:Npn \__nicematrix_one_tabularnote:nn #1 + { + \tl_if_novalue:nTF { #1 } + { \item } + { \item [ \__nicematrix_notes_label_in_list:n { #1 } ] } + } \cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes_b: { \pgfpicture @@ -3562,7 +3569,9 @@ } \NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } } { - \bool_if:NT \c__nicematrix_tabularx_loaded_bool { \newcolumntype { X } { \__nicematrix_X } } + \IfPackageLoadedTF { tabularx } + { \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 } @@ -3678,7 +3687,7 @@ \__nicematrix_adjust_pos_of_blocks_seq: \tl_if_empty:NF \l__nicematrix_hlines_clist \__nicematrix_draw_hlines: \tl_if_empty:NF \l__nicematrix_vlines_clist \__nicematrix_draw_vlines: - \bool_if:NT \c__nicematrix_tikz_loaded_bool + \IfPackageLoadedTF { tikz } { \tikzset { @@ -3690,6 +3699,7 @@ } } } + { } \cs_set_eq:NN \ialign \__nicematrix_old_ialign: \cs_set_eq:NN \SubMatrix \__nicematrix_SubMatrix \cs_set_eq:NN \UnderBrace \__nicematrix_UnderBrace @@ -5897,12 +5907,11 @@ } \keys_define:nn { NiceMatrix / custom-line } { - % 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 .str_set:N = \l__nicematrix_letter_str , letter .value_required:n = true , - command .code:n = \str_set:Nn \l__nicematrix_command_str { #1 } , + command .str_set:N = \l__nicematrix_command_str , command .value_required:n = true , - ccommand .code:n = \str_set:Nn \l__nicematrix_ccommand_str { #1 } , + ccommand .str_set:N = \l__nicematrix_ccommand_str , ccommand .value_required:n = true , } \cs_new_protected:Npn \__nicematrix_custom_line_i:n #1 @@ -5913,8 +5922,9 @@ \keys_set:nn { NiceMatrix / custom-line-bis } { #1 } \bool_if:NT \l__nicematrix_tikz_rule_bool { - \cs_if_exist:NF \tikzpicture - { \__nicematrix_error:n { tikz~in~custom-line~without~tikz } } + \IfPackageLoadedTF { tikz } + { } + { \__nicematrix_error:n { tikz~in~custom-line~without~tikz }} \bool_if:NT \l__nicematrix_color_bool { \__nicematrix_error:n { color~in~custom-line~with~tikz } } } @@ -6440,7 +6450,9 @@ } } } - \seq_mapthread_function:NNN + \cs_if_exist_use:NF + \seq_map_pairwise_function:NNN + \seq_mapthread_function:NNN \g__nicematrix_multicolumn_cells_seq \g__nicematrix_multicolumn_sizes_seq \__nicematrix_node_for_multicolumn:nn @@ -6743,7 +6755,7 @@ \keys_define:nn { NiceMatrix / Block / SecondPass } { tikz .code:n = - \bool_if:NTF \c__nicematrix_tikz_loaded_bool + \IfPackageLoadedTF { tikz } { \seq_put_right:Nn \l__nicematrix_tikz_seq { { #1 } } } { \__nicematrix_error:n { tikz~key~without~tikz } } , tikz .value_required:n = true , @@ -8244,7 +8256,10 @@ \pgf@relevantforpicturesizefalse \pgfpathrectanglecorners { \__nicematrix_qpoint:n { 1 } } - { \__nicematrix_qpoint:n { \int_eval:n { \c@iRow + 1 } } } + { + \__nicematrix_qpoint:n + { \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } } + } \pgfsetfillopacity { 0.75 } \pgfsetfillcolor { white } \pgfusepathqfill @@ -8376,35 +8391,36 @@ } \bool_if:NT \c__nicematrix_footnote_bool { - \@ifclassloaded { beamer } + \IfClassLoadeTF { beamer } { \bool_set_false:N \c__nicematrix_footnote_bool } { - \@ifpackageloaded { footnotehyper } + \IfPackageLoadedTF { footnotehyper } { \__nicematrix_error:n { footnote~with~footnotehyper~package } } { \usepackage { footnote } } } } \bool_if:NT \c__nicematrix_footnotehyper_bool { - \@ifclassloaded { beamer } + \IfClassLoadedTF { beamer } { \bool_set_false:N \c__nicematrix_footnote_bool } { - \@ifpackageloaded { footnote } + \IfPackageLoadedTF { footnote } { \__nicematrix_error:n { footnotehyper~with~footnote~package } } { \usepackage { footnotehyper } } } \bool_set_true:N \c__nicematrix_footnote_bool } \bool_new:N \l__nicematrix_underscore_loaded_bool -\@ifpackageloaded { underscore } +\IfPackageLoadedTF { underscore } { \bool_set_true:N \l__nicematrix_underscore_loaded_bool } { } \hook_gput_code:nnn { begindocument } { . } { \bool_if:NF \l__nicematrix_underscore_loaded_bool { - \@ifpackageloaded { underscore } + \IfPackageLoadedTF { underscore } { \__nicematrix_error:n { underscore~after~nicematrix } } + { } } } \bool_if:NTF \c__nicematrix_messages_for_Overleaf_bool @@ -8437,21 +8453,23 @@ } } { - \bool_lazy_and:nnTF - { \bool_if_p:n \c__nicematrix_tabularx_loaded_bool } - { ! \str_if_eq_p:Vn \g__nicematrix_name_env_str { NiceTabularX } } + \IfPackageLoadedTF { tabularx } { - \int_compare:nNnTF \c@iRow = \c_zero_int - { \__nicematrix_fatal:n { X~columns~with~tabularx } } + \str_if_eq:VnTF \g__nicematrix_name_env_str { NiceTabularX } { - \__nicematrix_fatal:nn { too~much~cols~for~array } + \int_compare:nNnTF \c@iRow = \c_zero_int + { \__nicematrix_fatal:n { X~columns~with~tabularx } } { - However,~this~message~may~be~erroneous:~ - maybe~you~have~used~X~columns~while~'tabularx'~is~loaded,~ - ~which~is~forbidden~(however,~it's~still~possible~to~use~ - X~columns~in~{NiceTabularX}). + \__nicematrix_fatal:nn { too~much~cols~for~array } + { + However,~this~message~may~be~erroneous:~ + maybe~you~have~used~X~columns~while~'tabularx'~is~loaded,~ + ~which~is~forbidden~(however,~it's~still~possible~to~use~ + X~columns~in~{NiceTabularX}). + } } } + { \__nicematrix_fatal:nn { too~much~cols~for~array } { } } } { \__nicematrix_fatal:nn { too~much~cols~for~array } { } } } @@ -8816,7 +8834,8 @@ (in~the~key~'borders'~of~the~command~\token_to_str:N \Block).~ The~available~values~are:~left,~right,~top~and~bottom~(and~you~can~ also~use~the~key~'tikz' - \bool_if:nF \c__nicematrix_tikz_loaded_bool + \IfPackageLoadedTF { tikz } + { } {~if~you~load~the~LaTeX~package~'tikz'}).\\ This~specification~of~border~will~be~ignored. } @@ -9003,7 +9022,7 @@ { siunitx~too~old.\\ You~can't~use~'S'~columns~because~your~version~of~'siunitx'~ - is~too~old.~You~need~at~least~v~3.0~and~your~log~file~says:~"siunitx,~ + is~too~old.~You~need~at~least~v~3.0.38~and~your~log~file~says:~"siunitx,~ \use:c { ver @ siunitx.sty }". \\ This~error~is~fatal. } |