diff options
author | Karl Berry <karl@freefriends.org> | 2021-07-02 19:58:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-07-02 19:58:15 +0000 |
commit | 31ee4bf7e1919b058b64a635ebda307c5b01b7dc (patch) | |
tree | 9872b5171b7e63ca0339304a0b9113cfd33fd9b7 /Master/texmf-dist/tex/latex/nicematrix | |
parent | ca323ed8610cf4a6cc08774a0752db4a78750994 (diff) |
nicematrix (2jul21)
git-svn-id: svn://tug.org/texlive/trunk@59811 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicematrix')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 393 |
1 files changed, 289 insertions, 104 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 92d14db3298..c7c622f016a 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{5.16} -\def\myfiledate{2021/06/20} +\def\myfileversion{5.17} +\def\myfiledate{2021/07/01} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -360,6 +360,7 @@ \dim_new:N \l__nicematrix_line_width_dim \tl_new:N \l__nicematrix_hpos_of_block_tl \tl_set:Nn \l__nicematrix_hpos_of_block_tl { c } +\bool_new:N \l__nicematrix_hpos_of_block_cap_bool \tl_new:N \l__nicematrix_vpos_of_block_tl \tl_set:Nn \l__nicematrix_vpos_of_block_tl { c } \bool_new:N \l__nicematrix_draw_first_bool @@ -528,6 +529,7 @@ \str_new:N \l__nicematrix_name_str \bool_new:N \l__nicematrix_medium_nodes_bool \bool_new:N \l__nicematrix_large_nodes_bool +\bool_new:N \l__nicematrix_except_borders_bool \dim_new:N \l__nicematrix_left_margin_dim \dim_new:N \l__nicematrix_right_margin_dim \dim_new:N \l__nicematrix_extra_left_margin_dim @@ -616,6 +618,12 @@ \clist_set:Nn \l__nicematrix_vlines_clist { all } \clist_set:Nn \l__nicematrix_hlines_clist { all } } , + hvlines-except-borders .code:n = + { + \clist_set:Nn \l__nicematrix_vlines_clist { all } + \clist_set:Nn \l__nicematrix_hlines_clist { all } + \bool_set_true:N \l__nicematrix_except_borders_bool + } , parallelize-diags .bool_set:N = \l__nicematrix_parallelize_diags_bool , renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool , renew-dots .value_forbidden:n = true , @@ -1616,6 +1624,7 @@ \@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 @@ -1645,6 +1654,7 @@ { ! \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 } + \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 } { @@ -1771,9 +1781,12 @@ \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl { \__nicematrix_vline:nn { \__nicematrix_succ:n \c@jCol } { \int_use:N \l_tmpa_int } } \int_zero:N \l_tmpa_int + \str_if_eq:nnT { #1 } { \q_stop } + { \bool_gset_true:N \g_tmpb_bool } \__nicematrix_patch_preamble:n #1 } } +\bool_new:N \l__nicematrix_bar_at_end_of_pream_bool \cs_new_protected:Npn \__nicematrix_patch_preamble_iv:nnn #1 #2 #3 { \tl_gput_right:Nn \g__nicematrix_preamble_tl @@ -1836,26 +1849,21 @@ } { \tl_gput_right:Nn \g__nicematrix_preamble_tl { ! { \enskip } } - \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl - { \__nicematrix_delimiter:nnn #1 { \__nicematrix_succ:n \c@jCol } \c_true_bool } - \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 } - { - \__nicematrix_error:nn { delimiter~after~opening } { #2 } - \__nicematrix_patch_preamble:n - } - { \__nicematrix_patch_preamble:n #2 } + \__nicematrix_patch_preamble_vii_i:nn { #1 } { #2 } } } + { \__nicematrix_patch_preamble_vii_i:nn { #1 } { #2 } } + } +\cs_new_protected:Npn \__nicematrix_patch_preamble_vii_i:nn #1 #2 + { + \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl + { \__nicematrix_delimiter:nnn #1 { \__nicematrix_succ:n \c@jCol } \c_true_bool } + \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 } { - \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl - { \__nicematrix_delimiter:nnn #1 { \__nicematrix_succ:n \c@jCol } \c_true_bool } - \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 } - { - \__nicematrix_error:nn { delimiter~after~opening } { #2 } - \__nicematrix_patch_preamble:n - } - { \__nicematrix_patch_preamble:n #2 } + \__nicematrix_error:nn { delimiter~after~opening } { #2 } + \__nicematrix_patch_preamble:n } + { \__nicematrix_patch_preamble:n #2 } } \cs_new_protected:Npn \__nicematrix_patch_preamble_viii:nn #1 #2 { @@ -1942,6 +1950,158 @@ \tl_gput_right:Nn \g__nicematrix_preamble_tl { < { #1 } } \__nicematrix_patch_preamble_x:n } +\cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3 + { + \multispan { #1 } + \begingroup + \@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 + \exp_args:NV \@mkpream \g__nicematrix_preamble_tl + \int_compare:nNnT { #1 } > 1 + { + \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq + { \int_use:N \c@iRow - \__nicematrix_succ:n \c@jCol } + \seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 } + \seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq + { + { \int_use:N \c@iRow } + { \int_eval:n { \c@jCol + 1 } } + { \int_use:N \c@iRow } + { \int_eval:n { \c@jCol + #1 } } + } + } + \cs_set:Npn \@sharp { #3 } + \set@typeset@protect + \cs_set_eq:NN \@startpbox \__nicematrixstartpbox + \cs_set_eq:NN \@endpbox \__nicematrixendpbox + \@arstrut + \@preamble + \hbox { } + \endgroup + \int_gadd:Nn \c@jCol { #1 - 1 } + \int_compare:nNnT \c@jCol > \g__nicematrix_col_total_int + { \int_gset_eq:NN \g__nicematrix_col_total_int \c@jCol } + \ignorespaces + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble:n #1 + { + \str_case:nnF { #1 } + { + c { \__nicematrix_patch_m_preamble_i:n #1 } + l { \__nicematrix_patch_m_preamble_i:n #1 } + r { \__nicematrix_patch_m_preamble_i:n #1 } + > { \__nicematrix_patch_m_preamble_ii:nn #1 } + ! { \__nicematrix_patch_m_preamble_ii:nn #1 } + @ { \__nicematrix_patch_m_preamble_ii:nn #1 } + | { \__nicematrix_patch_m_preamble_iii:n #1 } + p { \__nicematrix_patch_m_preamble_iv:nnn t #1 } + m { \__nicematrix_patch_m_preamble_iv:nnn c #1 } + b { \__nicematrix_patch_m_preamble_iv:nnn b #1 } + \__nicematrix_w: { \__nicematrix_patch_m_preamble_v:nnnn { } #1 } + \__nicematrix_W: { \__nicematrix_patch_m_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 } + \__nicematrix_true_c: { \__nicematrix_patch_m_preamble_vi:n #1 } + C { \__nicematrix_error:nn { old~column~type } #1 } + L { \__nicematrix_error:nn { old~column~type } #1 } + R { \__nicematrix_error:nn { old~column~type } #1 } + \q_stop { } + } + { \__nicematrix_fatal:nn { unknown~column~type } { #1 } } + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_i:n #1 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl + { + > { \__nicematrix_Cell: \tl_set:Nn \l__nicematrix_cell_type_tl { #1 } } + #1 + < \__nicematrix_end_Cell: + } + \__nicematrix_patch_m_preamble_x:n + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_ii:nn #1 #2 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl { #1 { #2 } } + \__nicematrix_patch_m_preamble:n + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_iii:n #1 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl { #1 } + \__nicematrix_patch_m_preamble:n + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_iv:nnn #1 #2 #3 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl + { + > { + \__nicematrix_Cell: + \begin { minipage } [ #1 ] { \dim_eval:n { #3 } } + \mode_leave_vertical: + \arraybackslash + \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt + } + c + < { + \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt + \end { minipage } + \__nicematrix_end_Cell: + } + } + \__nicematrix_patch_m_preamble_x:n + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_v:nnnn #1 #2 #3 #4 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl + { + > { + \hbox_set:Nw \l__nicematrix_cell_box + \__nicematrix_Cell: + \tl_set:Nn \l__nicematrix_cell_type_tl { #3 } + } + c + < { + \__nicematrix_end_Cell: + #1 + \hbox_set_end: + \bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box: + \__nicematrix_adjust_size_box: + \makebox [ #4 ] [ #3 ] { \box_use_drop:N \l__nicematrix_cell_box } + } + } + \__nicematrix_patch_m_preamble_x:n + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_vi:n #1 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl { c } + \__nicematrix_patch_m_preamble_x:n + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_x:n #1 + { + \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 { \__nicematrix_succ:n \c@jCol } + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl + { ! { \skip_horizontal:N \arrayrulewidth } } + } + } + \__nicematrix_patch_m_preamble:n { #1 } + } + } +\cs_new_protected:Npn \__nicematrix_patch_m_preamble_ix:n #1 + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl { < { #1 } } + \__nicematrix_patch_m_preamble_x:n + } \cs_new_protected:Npn \__nicematrix_put_box_in_flow: { \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim } @@ -2305,11 +2465,19 @@ } \endpgfpicture } + \bool_lazy_all:nT + { + \l__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 } + { ! \l__nicematrix_bar_at_end_of_pream_bool } + } + { \skip_horizontal:n { - \col@sep } } \bool_if:NT \g__nicematrix_last_col_found_bool { \hbox_overlap_right:n { - % \skip_horizontal:N \col@sep \skip_horizontal:N \g__nicematrix_width_last_col_dim \bool_if:NT \l__nicematrix_code_before_bool { @@ -3583,49 +3751,6 @@ \hspace } \cs_set_eq:NN \__nicematrix_old_multicolumn \multicolumn -\cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3 - { - \exp_args:NNe - \__nicematrix_old_multicolumn - { #1 } - { - \exp_args:Ne \str_case:nn { \str_foldcase:n { #2 } } - { - l { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: } - r { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: } - c { > \__nicematrix_Cell: c < \__nicematrix_end_Cell: } - { l | } { > \__nicematrix_Cell: l < \__nicematrix_end_Cell: | } - { r | } { > \__nicematrix_Cell: r < \__nicematrix_end_Cell: | } - { c | } { > \__nicematrix_Cell: c < \__nicematrix_end_Cell: | } - { | l } { | > \__nicematrix_Cell: l < \__nicematrix_end_Cell: } - { | r } { | > \__nicematrix_Cell: r < \__nicematrix_end_Cell: } - { | c } { | > \__nicematrix_Cell: c < \__nicematrix_end_Cell: } - { | l | } { | > \__nicematrix_Cell: l < \__nicematrix_end_Cell: | } - { | r | } { | > \__nicematrix_Cell: r < \__nicematrix_end_Cell: | } - { | c | } { | > \__nicematrix_Cell: c < \__nicematrix_end_Cell: | } - } - } - { #3 } - \peek_remove_spaces:n - { - \int_compare:nNnT #1 > 1 - { - \seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq - { \int_use:N \c@iRow - \int_use:N \c@jCol } - \seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 } - \seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq - { - { \int_use:N \c@iRow } - { \int_use:N \c@jCol } - { \int_use:N \c@iRow } - { \int_eval:n { \c@jCol + #1 - 1 } } - } - } - \int_gadd:Nn \c@jCol { #1 - 1 } - \int_compare:nNnT \c@jCol > \g__nicematrix_col_total_int - { \int_gset_eq:NN \g__nicematrix_col_total_int \c@jCol } - } - } \cs_new:Npn \__nicematrix_Hdotsfor: { \bool_lazy_and:nnTF @@ -3658,7 +3783,8 @@ { #2 } { #1 , #3 , - down = \exp_not:n { #4 } , up = \exp_not:n { #5 } + down = \exp_not:n { #4 } , + up = \exp_not:n { #5 } } } \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { c } { } } @@ -4328,8 +4454,15 @@ \cs_new_protected:Npn \__nicematrix_draw_vlines: { \int_step_inline:nnn - { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 } - { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c@jCol } \c@jCol } + { + \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + 1 2 + } + { + \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + { \__nicematrix_succ:n \c@jCol } + \c@jCol + } { \tl_if_eq:NnF \l__nicematrix_vlines_clist { all } { \clist_if_in:NnT \l__nicematrix_vlines_clist { ##1 } } @@ -4451,8 +4584,15 @@ \cs_new_protected:Npn \__nicematrix_draw_hlines: { \int_step_inline:nnn - { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 } - { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c@iRow } \c@iRow } + { + \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + 1 2 + } + { + \bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool } + { \__nicematrix_succ:n \c@iRow } + \c@iRow + } { \tl_if_eq:NnF \l__nicematrix_hlines_clist { all } { \clist_if_in:NnT \l__nicematrix_hlines_clist { ##1 } } @@ -4953,6 +5093,12 @@ r .value_forbidden:n = true , c .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c , c .value_forbidden:n = true , + L .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl l , + L .value_forbidden:n = true , + R .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl r , + R .value_forbidden:n = true , + C .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c , + C .value_forbidden:n = true , t .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl t , t .value_forbidden:n = true , b .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl b , @@ -5176,6 +5322,15 @@ r .value_forbidden:n = true , c .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c , c .value_forbidden:n = true , + L .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl l + \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool , + L .value_forbidden:n = true , + R .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl r + \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool , + R .value_forbidden:n = true , + C .code:n = \tl_set:Nn \l__nicematrix_hpos_of_block_tl c + \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool , + C .value_forbidden:n = true , t .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl t , t .value_forbidden:n = true , b .code:n = \tl_set:Nn \l__nicematrix_vpos_of_block_tl b , @@ -5297,47 +5452,50 @@ { \__nicematrix_env: - #1 - #2 - block } \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim \end { pgfscope } - \dim_set_eq:NN \l_tmpb_dim \c_max_dim - \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int + \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - \cs_if_exist:cT - { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 } + \dim_set_eq:NN \l_tmpb_dim \c_max_dim + \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int { - \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 } + \cs_if_exist:cT + { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 } { - \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west } - \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west } + \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + } } } - } - \dim_compare:nNnT \l_tmpb_dim = \c_max_dim - { - \__nicematrix_qpoint:n { col - #2 } - \dim_set_eq:NN \l_tmpb_dim \pgf@x - } - \dim_set:Nn \l_tmpd_dim { - \c_max_dim } - \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int - { - \cs_if_exist:cT - { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int } + \dim_compare:nNnT \l_tmpb_dim = \c_max_dim { - \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 } + \__nicematrix_qpoint:n { col - #2 } + \dim_set_eq:NN \l_tmpb_dim \pgf@x + } + \dim_set:Nn \l_tmpd_dim { - \c_max_dim } + \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int + { + \cs_if_exist:cT + { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int } { - \pgfpointanchor - { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int } - { east } - \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor + { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int } + { east } + \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + } } } + \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } + { + \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } } + \dim_set_eq:NN \l_tmpd_dim \pgf@x + } + \__nicematrix_pgf_rect_node:nnnnn + { \__nicematrix_env: - #1 - #2 - block - short } + \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim } - \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } - { - \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x - } - \__nicematrix_pgf_rect_node:nnnnn - { \__nicematrix_env: - #1 - #2 - block - short } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim \bool_if:NT \l__nicematrix_medium_nodes_bool { \__nicematrix_pgf_rect_node:nnn @@ -5362,7 +5520,10 @@ } \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } } \pgfpointanchor - { \__nicematrix_env: - #1 - #2 - block - short } + { + \__nicematrix_env: - #1 - #2 - block + \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short } + } { \str_case:Vn \l__nicematrix_hpos_of_block_tl { @@ -5396,7 +5557,10 @@ \pgftransformshift { \pgfpointanchor - { \__nicematrix_env: - #1 - #2 - block - short } + { + \__nicematrix_env: - #1 - #2 - block + \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short } + } { \str_case:Vn \l__nicematrix_hpos_of_block_tl { @@ -5614,13 +5778,26 @@ \int_set:Nn \l__nicematrix_nb_rows_int { #1 } \int_set:Nn \l__nicematrix_nb_cols_int { #2 } } +\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 + } \NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } } { \int_zero_new:N \l__nicematrix_nb_rows_int \int_zero_new:N \l__nicematrix_nb_cols_int \__nicematrix_set_size:n #4 \q_stop - \begin { NiceArrayWithDelims } { #1 } { #2 } - { * { \l__nicematrix_nb_cols_int } { c } } [ #3 , #5 , #7 ] + \group_begin: + \tl_set:Nn \l__nicematrix_type_of_col_tl c + \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl + \use:x + { + \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } + { * { \int_use:N \l__nicematrix_nb_cols_int } { \l__nicematrix_type_of_col_tl } } + [ \l_tmpa_tl ] + } \int_compare:nNnT \l__nicematrix_first_row_int = 0 { \int_compare:nNnT \l__nicematrix_first_col_int = 0 { & } @@ -5640,6 +5817,7 @@ \int_compare:nNnT \l__nicematrix_last_col_int > { -1 } { & } \\ } \end { NiceArrayWithDelims } + \group_end: } \cs_set_protected:Npn \__nicematrix_define_com:nnn #1 #2 #3 { @@ -6193,10 +6371,17 @@ is~not~clear).~You~should~use~the~conjonction~of~'renew-dots'~ and~'renew-matrix'.~However,~you~can~go~on. } +\__nicematrix_msg_new:nn { define-L-C-R } + { + You~have~used~the~key~'define-L-C-R'.~Please~note~that~this~key~ + will~probably~be~deleted~in~a~future~version~of~'nicematrix'.\\ + However,~you~can~go~on. + } \keys_define:nn { NiceMatrix / Package } { - define-L-C-R .bool_set:N = \c__nicematrix_define_L_C_R_bool , - define-L-C-R .default:n = true , + define-L-C-R .code:n = + \__nicematrix_error:n { define-L-C-R } + \bool_set_true:N \c__nicematrix_define_L_C_R_bool , renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool , renew-dots .value_forbidden:n = true , renew-matrix .code:n = \__nicematrix_renew_matrix: , |