From 5197d298c71622d80effcb59d4f3ac688ba65213 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 25 May 2022 20:19:39 +0000 Subject: nicematrix (25may22) git-svn-id: svn://tug.org/texlive/trunk@63402 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/nicematrix/nicematrix.sty | 122 +++++++++++++++------ 1 file changed, 91 insertions(+), 31 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index f1e3f087970..e2cf4c609d8 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.8a} -\def\myfiledate{2022/05/08} +\def\myfileversion{6.9} +\def\myfiledate{2022/05/25} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -28,7 +28,6 @@ {\myfiledate} {\myfileversion} {Enhanced arrays with the help of PGF/TikZ} -\RequirePackage { xparse } \RequirePackage { array } \RequirePackage { amsmath } \cs_new_protected:Npn \__nicematrix_error:n { \msg_error:nn { nicematrix } } @@ -524,15 +523,15 @@ \bool_new:N \l__nicematrix_standard_cline_bool \dim_new:N \l__nicematrix_cell_space_top_limit_dim \dim_new:N \l__nicematrix_cell_space_bottom_limit_dim -\dim_new:N \l__nicematrix_inter_dots_dim +\dim_new:N \l__nicematrix_xdots_inter_dim \hook_gput_code:nnn { begindocument } { . } - { \dim_set:Nn \l__nicematrix_inter_dots_dim { 0.45 em } } + { \dim_set:Nn \l__nicematrix_xdots_inter_dim { 0.45 em } } \dim_new:N \l__nicematrix_xdots_shorten_dim \hook_gput_code:nnn { begindocument } { . } { \dim_set:Nn \l__nicematrix_xdots_shorten_dim { 0.3 em } } -\dim_new:N \l__nicematrix_radius_dim +\dim_new:N \l__nicematrix_xdots_radius_dim \hook_gput_code:nnn { begindocument } { . } - { \dim_set:Nn \l__nicematrix_radius_dim { 0.53 pt } } + { \dim_set:Nn \l__nicematrix_xdots_radius_dim { 0.53 pt } } \tl_new:N \l__nicematrix_xdots_line_style_tl \tl_const:Nn \c__nicematrix_standard_tl { standard } \tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl @@ -580,6 +579,14 @@ \hook_gput_code:nnn { begindocument } { . } { \dim_set:Nn \l__nicematrix_xdots_shorten_dim { #1 } } , shorten .value_required:n = true , + radius .code:n = + \hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l__nicematrix_xdots_radius_dim { #1 } } , + radius .value_required:n = true , + inter .code:n = + \hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l__nicematrix_xdots_inter_dim { #1 } } , + radius .value_required:n = true , down .tl_set:N = \l__nicematrix_xdots_down_tl , up .tl_set:N = \l__nicematrix_xdots_up_tl , draw-first .code:n = \prg_do_nothing: , @@ -1404,6 +1411,7 @@ \cs_set_eq:NN \columncolor \__nicematrix_columncolor \cs_set_eq:NN \chessboardcolors \__nicematrix_chessboardcolors \cs_set_eq:NN \SubMatrix \__nicematrix_SubMatrix_in_code_before + \cs_set_eq:NN \ShowCellNames \__nicematrix_ShowCellNames } \cs_new_protected:Npn \__nicematrix_exec_code_before: { @@ -2233,7 +2241,7 @@ \cs_new_protected:Npn \__nicematrix_patch_preamble_xii:n #1 { \tl_gput_right:Nn \g__nicematrix_preamble_tl - { ! { \skip_horizontal:N 2\l__nicematrix_radius_dim } } + { ! { \skip_horizontal:N 2\l__nicematrix_xdots_radius_dim } } \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl { \__nicematrix_vdottedline:n { \int_use:N \c@jCol } } \__nicematrix_patch_preamble:n @@ -2288,13 +2296,13 @@ \int_compare:nNnTF \c@jCol = 0 { \int_eval:n { \c@iRow + 1 } } { \int_use:N \c@iRow } - } % modified 2022/01/10 + } { \int_eval:n { \c@jCol + 1 } } { \int_compare:nNnTF \c@jCol = 0 { \int_eval:n { \c@iRow + 1 } } { \int_use:N \c@iRow } - } % modified 2022/01/10 + } { \int_eval:n { \c@jCol + #1 } } { } % for the name of the block } @@ -3138,8 +3146,8 @@ \bool_set_false:N \l__nicematrix_final_open_bool \bool_if:NT \l__nicematrix_small_bool { - \dim_set:Nn \l__nicematrix_radius_dim { 0.37 pt } - \dim_set:Nn \l__nicematrix_inter_dots_dim { 0.25 em } + \dim_set:Nn \l__nicematrix_xdots_radius_dim { 0.7 \l__nicematrix_xdots_radius_dim } + \dim_set:Nn \l__nicematrix_xdots_inter_dim { 0.55 \l__nicematrix_xdots_inter_dim } \dim_set:Nn \l__nicematrix_xdots_shorten_dim { 0.6 \l__nicematrix_xdots_shorten_dim } } \__nicematrix_draw_dotted_lines: @@ -3163,6 +3171,7 @@ \cs_set_eq:NN \SubMatrix \__nicematrix_SubMatrix \cs_set_eq:NN \UnderBrace \__nicematrix_UnderBrace \cs_set_eq:NN \OverBrace \__nicematrix_OverBrace + \cs_set_eq:NN \ShowCellNames \__nicematrix_ShowCellNames \cs_set_eq:NN \line \__nicematrix_line \g__nicematrix_internal_code_after_tl \tl_gclear:N \g__nicematrix_internal_code_after_tl @@ -3574,8 +3583,8 @@ \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf@y } { \__nicematrix_set_final_coords_from_anchor:n { base~west } } - \dim_add:Nn \l__nicematrix_y_initial_dim \l__nicematrix_radius_dim - \dim_add:Nn \l__nicematrix_y_final_dim \l__nicematrix_radius_dim + \dim_add:Nn \l__nicematrix_y_initial_dim \l__nicematrix_xdots_radius_dim + \dim_add:Nn \l__nicematrix_y_final_dim \l__nicematrix_xdots_radius_dim \__nicematrix_draw_line: } \cs_new_protected:Npn \__nicematrix_draw_Cdots:nnn #1 #2 #3 @@ -3943,14 +3952,14 @@ \bool_if:NTF \l__nicematrix_final_open_bool { \int_set:Nn \l_tmpa_int - { \dim_ratio:nn \l__nicematrix_l_dim \l__nicematrix_inter_dots_dim } + { \dim_ratio:nn \l__nicematrix_l_dim \l__nicematrix_xdots_inter_dim } } { \int_set:Nn \l_tmpa_int { \dim_ratio:nn { \l__nicematrix_l_dim - \l__nicematrix_xdots_shorten_dim } - \l__nicematrix_inter_dots_dim + \l__nicematrix_xdots_inter_dim } } } @@ -3961,7 +3970,7 @@ { \dim_ratio:nn { \l__nicematrix_l_dim - \l__nicematrix_xdots_shorten_dim } - \l__nicematrix_inter_dots_dim + \l__nicematrix_xdots_inter_dim } } { @@ -3969,19 +3978,19 @@ { \dim_ratio:nn { \l__nicematrix_l_dim - 2 \l__nicematrix_xdots_shorten_dim } - \l__nicematrix_inter_dots_dim + \l__nicematrix_xdots_inter_dim } } } \dim_set:Nn \l_tmpa_dim { ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim ) * - \dim_ratio:nn \l__nicematrix_inter_dots_dim \l__nicematrix_l_dim + \dim_ratio:nn \l__nicematrix_xdots_inter_dim \l__nicematrix_l_dim } \dim_set:Nn \l_tmpb_dim { ( \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim ) * - \dim_ratio:nn \l__nicematrix_inter_dots_dim \l__nicematrix_l_dim + \dim_ratio:nn \l__nicematrix_xdots_inter_dim \l__nicematrix_l_dim } \int_set:Nn \l_tmpb_int { @@ -3993,7 +4002,7 @@ { ( \l__nicematrix_x_final_dim - \l__nicematrix_x_initial_dim ) * \dim_ratio:nn - { \l__nicematrix_l_dim - \l__nicematrix_inter_dots_dim * \l_tmpa_int } + { \l__nicematrix_l_dim - \l__nicematrix_xdots_inter_dim * \l_tmpa_int } { 2 \l__nicematrix_l_dim } * \l_tmpb_int } @@ -4001,7 +4010,7 @@ { ( \l__nicematrix_y_final_dim - \l__nicematrix_y_initial_dim ) * \dim_ratio:nn - { \l__nicematrix_l_dim - \l__nicematrix_inter_dots_dim * \l_tmpa_int } + { \l__nicematrix_l_dim - \l__nicematrix_xdots_inter_dim * \l_tmpa_int } { 2 \l__nicematrix_l_dim } * \l_tmpb_int } @@ -4010,7 +4019,7 @@ { \pgfpathcircle { \pgfpoint \l__nicematrix_x_initial_dim \l__nicematrix_y_initial_dim } - { \l__nicematrix_radius_dim } + { \l__nicematrix_xdots_radius_dim } \dim_add:Nn \l__nicematrix_x_initial_dim \l_tmpa_dim \dim_add:Nn \l__nicematrix_y_initial_dim \l_tmpb_dim } @@ -4372,9 +4381,11 @@ bold .bool_set:N = \l_tmpa_bool , bold .default:n = true , bold .initial:n = false , - nb-rows .int_set:N = \l__nicematrix_key_nb_rows_int , + 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 { #1 } } , nb-rows .value_required:n = true , - nb-rows .initial:n = 1 , rowcolor .tl_set:N = \l__nicematrix_tmpc_tl , rowcolor .value_required:n = true , rowcolor .initial:n = , @@ -4383,6 +4394,7 @@ \NewDocumentCommand \__nicematrix_RowStyle:n { O { } m } { \tl_clear:N \l_tmpa_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 { @@ -5154,7 +5166,7 @@ \bool_if:NT \l__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_inter_dots_dim } } + { \dim_add:Nn \l__nicematrix_x_initial_dim { 0.5 \l__nicematrix_xdots_inter_dim } } } \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_local_end_int + 1 } } \dim_set_eq:NN \l__nicematrix_x_final_dim \pgf@x @@ -5164,7 +5176,7 @@ \bool_if:NT \l__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_inter_dots_dim } } + { \dim_gsub:Nn \l__nicematrix_x_final_dim { 0.5 \l__nicematrix_xdots_inter_dim } } } \CT@arc@ \__nicematrix_draw_line: @@ -5502,7 +5514,7 @@ } \cs_new:Npn \__nicematrix_hdottedline: { - \noalign { \skip_vertical:N 2\l__nicematrix_radius_dim } + \noalign { \skip_vertical:N 2\l__nicematrix_xdots_radius_dim } \__nicematrix_hdottedline_i: } \cs_new_protected:Npn \__nicematrix_hdottedline_i: @@ -7356,6 +7368,53 @@ { } { } } +\NewDocumentCommand \__nicematrix_ShowCellNames { } + { + \int_step_inline:nn \c@iRow + { + \begin { tikzpicture } + \__nicematrix_qpoint:n { row - ##1 } + \dim_set_eq:NN \l_tmpa_dim \pgf@y + \__nicematrix_qpoint:n { row - \int_eval:n { ##1 + 1 } } + \dim_gset:Nn \g_tmpa_dim { ( \l_tmpa_dim + \pgf@y ) / 2 } + \dim_gset:Nn \g_tmpb_dim { \l_tmpa_dim - \pgf@y } + \end { tikzpicture } + \int_step_inline:nn \c@jCol + { + \hbox_set:Nn \l_tmpa_box + { \normalfont \Large \color { red ! 50 } ##1 - ####1 } + \begin { tikzpicture } + \__nicematrix_qpoint:n { col - ####1 } + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@x + \__nicematrix_qpoint:n { col - \int_eval:n { ####1 + 1 } } + \dim_set:Nn \l_tmpa_dim { \pgf@x - \l__nicematrix_tmpc_dim } + \fp_set:Nn \l_tmpa_fp + { + \fp_min:nn + { + \fp_min:nn + { \dim_ratio:nn { \l_tmpa_dim } { \box_wd:N \l_tmpa_box } } + { \dim_ratio:nn { \g_tmpb_dim } { \box_ht_plus_dp:N \l_tmpa_box } } + } + { 1.0 } + } + \box_scale:Nnn \l_tmpa_box { \fp_use:N \l_tmpa_fp } { \fp_use:N \l_tmpa_fp } + \pgftransformshift + { + \pgfpoint + { 0.5 * ( \l__nicematrix_tmpc_dim + \pgf@x ) } + { \dim_use:N \g_tmpa_dim } + } + \pgfnode + { rectangle } + { center } + { \box_use:N \l_tmpa_box } + { } + { } + \end { tikzpicture } + } + } + } \bool_new:N \c__nicematrix_footnotehyper_bool \bool_new:N \c__nicematrix_footnote_bool \__nicematrix_msg_new:nnn { Unknown~key~for~package } @@ -7557,9 +7616,10 @@ } \__nicematrix_msg_new:nn { Unknown~key~for~xdots } { - As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~ - and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~ - this~key~will~be~ignored. + As~for~now,~there~is~only~five~keys~available~here:~'color',~'inter',~ + 'line-style',~'radius',~ + and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~ + If~you~go~on,~this~key~will~be~ignored. } \__nicematrix_msg_new:nn { Unknown~key~for~rowcolors } { -- cgit v1.2.3