diff options
author | Karl Berry <karl@freefriends.org> | 2023-02-19 01:55:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-02-19 01:55:38 +0000 |
commit | 182344e06908d094f7104bd3d1cef17d757da5c9 (patch) | |
tree | 0ce5777c08da0af9645a521353ccee80da3d4820 /Master/texmf-dist/tex/latex | |
parent | eacd49dde4e27a13a615f8b4e0a7d93626176d89 (diff) |
nicematrix (19feb23) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2022.final@65902 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 205 |
1 files changed, 118 insertions, 87 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index f9cb813cd99..7b4b2fbf8b6 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.13f} -\def\myfiledate{2023/02/05} +\def\myfileversion{6.14} +\def\myfiledate{2023/02/18} \RequirePackage{pgfcore} \usepgfmodule{shapes} @@ -460,8 +460,8 @@ \str_new:N \l__nicematrix_hpos_block_str \str_set:Nn \l__nicematrix_hpos_block_str { 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 } +\str_new:N \l__nicematrix_vpos_of_block_str +\str_set:Nn \l__nicematrix_vpos_of_block_str { c } \bool_new:N \l__nicematrix_draw_first_bool \bool_new:N \l__nicematrix_vlines_block_bool \bool_new:N \l__nicematrix_hlines_block_bool @@ -2552,7 +2552,7 @@ } } \__nicematrix_patch_preamble:n { #1 } - } + } } } \cs_new_protected:Npn \__nicematrix_patch_preamble_xiii:n #1 @@ -2569,11 +2569,12 @@ } { \exp_args:NNx - \clist_if_in:NnT \l__nicematrix_vlines_clist { \int_eval:n { \c@jCol + 1 } } + \clist_if_in:NnTF \l__nicematrix_vlines_clist { \int_eval:n { \c@jCol + 1 } } { \tl_gput_right:Nn \g__nicematrix_preamble_tl { @ { #1 \skip_horizontal:N \arrayrulewidth } } } + { \tl_gput_right:Nn \g__nicematrix_preamble_tl { @ { #1 } } } } \__nicematrix_patch_preamble:n } @@ -2589,7 +2590,6 @@ \exp_after:wN \__nicematrix_patch_m_preamble:n \the \@temptokena \q_stop \group_end: \tl_set_eq:NN #1 \g__nicematrix_preamble_tl - % \group_end: } \cs_new:Npn \__nicematrix_multicolumn:nnn #1 #2 #3 { @@ -6320,9 +6320,9 @@ R .value_forbidden:n = true , C .code:n = \str_set:Nn \l__nicematrix_hpos_block_str c , C .value_forbidden:n = true , - t .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_tl t , + t .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str t , t .value_forbidden:n = true , - b .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_tl b , + b .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str b , b .value_forbidden:n = true , color .tl_set:N = \l__nicematrix_color_tl , color .value_required:n = true , @@ -6425,24 +6425,29 @@ { { \int_compare_p:nNn { #2 } = 1 } { \dim_compare_p:n { \l__nicematrix_col_width_dim >= \c_zero_dim } } - { ! \g__nicematrix_rotate_bool } % added 2022/09/16 + { ! \g__nicematrix_rotate_bool } } { - \begin { minipage } [ \l__nicematrix_vpos_of_block_tl ] - { \l__nicematrix_col_width_dim } - \str_case:Vn \l__nicematrix_hpos_block_str - { - c \centering - r \raggedleft - l \raggedright - } + \use:x + { + \exp_not:N \begin { minipage }% + [ \str_lowercase:V { \l__nicematrix_vpos_of_block_str } ] + { \l__nicematrix_col_width_dim } + \str_case:Vn \l__nicematrix_hpos_block_str + { + c \centering + r \raggedleft + l \raggedright + } + } #5 \end { minipage } } { \use:x { - \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_of_block_tl ] + \exp_not:N \begin { tabular }% + [ \str_lowercase:V { \l__nicematrix_vpos_of_block_str } ] { @ { } \l__nicematrix_hpos_block_str @ { } } } #5 @@ -6453,8 +6458,9 @@ \c_math_toggle_token \use:x { - \exp_not:N \begin { array } [ \l__nicematrix_vpos_of_block_tl ] - { @ { } \l__nicematrix_hpos_block_str @ { } } + \exp_not:N \begin { array }% + [ \str_lowercase:V { \l__nicematrix_vpos_of_block_str } ] + { @ { } \l__nicematrix_hpos_block_str @ { } } } #5 \end { array } @@ -6532,7 +6538,7 @@ { \str_set:Nn \l__nicematrix_hpos_block_str c } \use:x { - \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_of_block_tl ] + \exp_not:N \begin { tabular } [ \l__nicematrix_vpos_of_block_str ] { @ { } \l__nicematrix_hpos_block_str @ { } } } #5 @@ -6553,7 +6559,7 @@ \c_math_toggle_token \use:x { - \exp_not:N \begin { array } [ \l__nicematrix_vpos_of_block_tl ] + \exp_not:N \begin { array } [ \l__nicematrix_vpos_of_block_str ] { @ { } \l__nicematrix_hpos_block_str @ { } } } #5 @@ -6617,18 +6623,21 @@ C .code:n = \str_set:Nn \l__nicematrix_hpos_block_str c \bool_set_true:N \l__nicematrix_hpos_of_block_cap_bool , C .value_forbidden:n = true , - t .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_tl t , + t .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str t , t .value_forbidden:n = true , - b .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_tl b , + T .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str T , + T .value_forbidden:n = true , + b .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str b , b .value_forbidden:n = true , + B .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str B , + B .value_forbidden:n = true , + v-center .code:n = \str_set:Nn \l__nicematrix_vpos_of_block_str { c } , + v-center .value_forbidden:n = true , name .tl_set:N = \l__nicematrix_block_name_str , name .value_required:n = true , name .initial:n = , respect-arraystretch .bool_set:N = \l__nicematrix_respect_arraystretch_bool , respect-arraystretch .default:n = true , - v-center .bool_set:N = \l__nicematrix_v_center_bool , - v-center .default:n = true , - v-center .initial:n = false , transparent .bool_set:N = \l__nicematrix_transparent_bool , transparent .default:n = true , transparent .initial:n = false , @@ -6669,15 +6678,9 @@ \cs_new_protected:Npn \__nicematrix_Block_v:nnnnnn #1 #2 #3 #4 #5 #6 { \group_begin: + \int_compare:nNnT { #1 } = { #3 } + { \str_set:Nn \l__nicematrix_vpos_of_block_str { t } } \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } - \bool_if:NT \l__nicematrix_v_center_bool - { - \int_compare:nNnF { #1 } = { #3 } - { - \__nicematrix_error:n { Wrong~use~of~v-center } - \bool_set_false:N \l__nicematrix_v_center_bool - } - } \bool_if:NT \l__nicematrix_vlines_block_bool { \tl_gput_right:Nx \g_nicematrix_code_after_tl @@ -6856,76 +6859,110 @@ { south~east } } } - \bool_if:nTF - { \int_compare_p:nNn { #1 } = { #3 } && ! \l__nicematrix_v_center_bool } + \int_compare:nNnT { #1 } = 0 { - \int_compare:nNnTF { #1 } = 0 + \int_compare:nNnT { #3 } = 0 { \l__nicematrix_code_for_first_row_tl } + } + \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int + { + \int_compare:nNnT { #3 } = \l__nicematrix_last_row_int + { \l__nicematrix_code_for_last_row_tl } + } + \bool_lazy_any:nTF + { + { \str_if_eq_p:Vn \l__nicematrix_vpos_of_block_str { c } } + { \str_if_eq_p:Vn \l__nicematrix_vpos_of_block_str { T } } + { \str_if_eq_p:Vn \l__nicematrix_vpos_of_block_str { B } } + } + { + \int_compare:nNnT { #2 } = 0 + { \str_set:Nn \l__nicematrix_hpos_block_str r } + \bool_if:nT \g__nicematrix_last_col_found_bool { - \int_compare:nNnT { #1 } = \l__nicematrix_last_row_int - \l__nicematrix_code_for_last_row_tl + \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int + { \str_set:Nn \l__nicematrix_hpos_block_str l } } - \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } } - \pgfpointanchor + \tl_set:Nx \l_tmpa_tl { - \__nicematrix_env: - #1 - #2 - block - \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short } + \str_case:Vn \l__nicematrix_vpos_of_block_str + { + c { + \str_case:Vn \l__nicematrix_hpos_block_str + { + c { center } + l { west } + r { east } + } + + } + T { + \str_case:Vn \l__nicematrix_hpos_block_str + { + c { north } + l { north~west } + r { north~east } + } + + } + B { + \str_case:Vn \l__nicematrix_hpos_block_str + { + c { south} + l { south~west } + r { south~east } + } + + } + } } + \pgftransformshift { - \str_case:Vn \l__nicematrix_hpos_block_str + \pgfpointanchor { - c { center } - l { west } - r { east } + \__nicematrix_env: - #1 - #2 - block + \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short } } + { \l_tmpa_tl } } - \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim } - \pgfset { inner~sep = \c_zero_dim } + \pgfset { inner~xsep = \c_zero_dim } \pgfnode { rectangle } + { \l_tmpa_tl } + { \box_use_drop:N \l__nicematrix_cell_box } { } { } + } + { + \pgfextracty \l_tmpa_dim { - \str_case:Vn \l__nicematrix_hpos_block_str + \__nicematrix_qpoint:n { - c { base } - l { base~west } - r { base~east } + row - \str_if_eq:VnTF \l__nicematrix_vpos_of_block_str { b } { #3 } { #1 } + - base } } - { \box_use_drop:N \l__nicematrix_cell_box } { } { } - } - { - \int_compare:nNnT { #2 } = 0 - { \str_set:Nn \l__nicematrix_hpos_block_str r } - \bool_if:nT \g__nicematrix_last_col_found_bool + \pgfpointanchor { - \int_compare:nNnT { #2 } = \g__nicematrix_col_total_int - { \str_set:Nn \l__nicematrix_hpos_block_str l } + \__nicematrix_env: - #1 - #2 - block + \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short } } - \pgftransformshift { - \pgfpointanchor - { - \__nicematrix_env: - #1 - #2 - block - \bool_if:NF \l__nicematrix_hpos_of_block_cap_bool { - short } - } + \str_case:Vn \l__nicematrix_hpos_block_str { - \str_case:Vn \l__nicematrix_hpos_block_str - { - c { center } - l { west } - r { east } - } + c { center } + l { west } + r { east } } } + \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim } \pgfset { inner~sep = \c_zero_dim } \pgfnode { rectangle } { \str_case:Vn \l__nicematrix_hpos_block_str { - c { center } - l { west } - r { east } + c { base } + l { base~west } + r { base~east } } } { \box_use_drop:N \l__nicematrix_cell_box } { } { } @@ -8511,12 +8548,6 @@ Empty~environment.\\ Your~\__nicematrix_full_name_env:\ is~empty.~This~error~is~fatal. } -\__nicematrix_msg_new:nn { Wrong~use~of~v-center } - { - Wrong~use~of~v-center.\\ - You~should~not~use~the~key~'v-center'~here~because~your~block~is~not~ - mono-row.~However,~you~can~go~on. - } \__nicematrix_msg_new:nn { No~letter~and~no~command } { Erroneous~use.\\ @@ -8765,9 +8796,9 @@ \c__nicematrix_available_keys_str } { - The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~ - hlines,~hvlines,~l,~line-width,~name,~rounded-corners,~r,~respect-arraystretch, - ~t,~tikz,~transparent~and~vlines. + The~available~keys~are~(in~alphabetic~order):~b,~B,~borders,~c,~draw,~fill,~ + hlines,~hvlines,~l,~line-width,~name,~rounded-corners,~r,~respect-arraystretch,~ + t,~T,~tikz,~transparent~and~vlines. } \__nicematrix_msg_new:nn { Version~of~siunitx~too~old } { |