From bf27672804b8dfb033345715f25e6570db144c75 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Feb 2021 21:53:07 +0000 Subject: nicematrix (22feb21) git-svn-id: svn://tug.org/texlive/trunk@57845 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/nicematrix/nicematrix.sty | 292 ++++++++++++++++----- 1 file changed, 221 insertions(+), 71 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 6a423f2b113..3a1076b1831 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.10} -\def\myfiledate{2021/02/05} +\def\myfileversion{5.11} +\def\myfiledate{2021/02/22} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -28,6 +28,7 @@ {\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 } } @@ -272,6 +273,8 @@ \__nicematrix_fatal:n { Outside~math~mode } \fi: } +\tl_new:N \l__nicematrix_letter_vlism_tl +\seq_new:N \g__nicematrix_cols_vlism_seq \colorlet { nicematrix-last-col } { . } \colorlet { nicematrix-last-row } { . } \str_new:N \g__nicematrix_name_env_str @@ -299,7 +302,6 @@ \dim_zero_new:N \l_tmpc_dim \dim_zero_new:N \l_tmpd_dim \bool_new:N \g__nicematrix_empty_cell_bool -\dim_new:N \__nicematrix_old_arraycolsep_dim \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 @@ -316,6 +318,11 @@ \tl_set:Nn \l__nicematrix_pos_of_block_tl { c } \bool_new:N \l__nicematrix_draw_first_bool \int_new:N \g__nicematrix_block_box_int +\dim_new:N \l__nicematrix_submatrix_extra_height_dim +\dim_new:N \l__nicematrix_submatrix_left_xshift_dim +\dim_new:N \l__nicematrix_submatrix_right_xshift_dim +\clist_new:N \l__nicematrix_submatrix_hlines_clist +\clist_new:N \l__nicematrix_submatrix_vlines_clist \int_new:N \l__nicematrix_first_row_int \int_set:Nn \l__nicematrix_first_row_int 1 \int_new:N \l__nicematrix_first_col_int @@ -500,7 +507,7 @@ 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: , - unknown .code:n = \__nicematrix_error:n { Unknown~option~for~xdots } + unknown .code:n = \__nicematrix_error:n { Unknown~key~for~xdots } } \keys_define:nn { NiceMatrix / rules } { @@ -511,6 +518,8 @@ } \keys_define:nn { NiceMatrix / Global } { + rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , + rules .value_required:n = true , standard-cline .bool_set:N = \l__nicematrix_standard_cline_bool , standard-cline .default:n = true , cell-space-top-limit .dim_set:N = \l__nicematrix_cell_space_top_limit_dim , @@ -543,6 +552,13 @@ code-for-last-row .value_required:n = true , hlines .bool_set:N = \l__nicematrix_hlines_bool , vlines .bool_set:N = \l__nicematrix_vlines_bool , + vlines-in-sub-matrix .code:n = + { + \tl_if_single_token:nTF { #1 } + { \tl_set:Nn \l__nicematrix_letter_vlism_tl { #1 } } + { \__nicematrix_error:n { One~letter~allowed } } + } , + vlines-in-sub-matrix .value_required:n = true , hvlines .code:n = { \bool_set_true:N \l__nicematrix_vlines_bool @@ -674,6 +690,7 @@ NiceMatrixOptions / rules .inherit:n = NiceMatrix / rules , NiceMatrixOptions / notes .inherit:n = NiceMatrix / notes , NiceMatrixOptions / sub-matrix .inherit:n = NiceMatrix / sub-matrix , + SubMatrix / rules .inherit:n = NiceMatrix / rules , CodeAfter / xdots .inherit:n = NiceMatrix / xdots , NiceMatrix .inherit:n = { @@ -706,6 +723,8 @@ } \keys_define:nn { NiceMatrix / NiceMatrixOptions } { + delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , + delimiters / color .value_required:n = true , delimiters-color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters-color .value_required:n = true , last-col .code:n = \tl_if_empty:nF { #1 } @@ -734,7 +753,7 @@ { \tl_if_single_token:nTF { #1 } { \str_set:Nx \l__nicematrix_letter_for_dotted_lines_str { #1 } } - { \__nicematrix_error:n { Bad~value~for~letter~for~dotted~lines } } + { \__nicematrix_error:n { One~letter~allowed } } } , letter-for-dotted-lines .value_required:n = true , notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } , @@ -760,6 +779,8 @@ r .code:n = \tl_set:Nn \l__nicematrix_type_of_col_tl r , small .bool_set:N = \l__nicematrix_small_bool , small .value_forbidden:n = true , + delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , + delimiters / color .value_required:n = true , delimiters-color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters-color .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix } @@ -779,6 +800,8 @@ tabularnote .value_required:n = true , delimiters-color .tl_set:N = \l__nicematrix_delimiters_color_tl , delimiters-color .value_required:n = true , + delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , + delimiters / color .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceArray } } \keys_define:nn { NiceMatrix / pNiceArray } @@ -1223,6 +1246,7 @@ { \pgfpointdiff \__nicematrix_picture_position: \__nicematrix_node_position: } } \endpgfpicture + \__nicematrix_create_diag_nodes: \group_begin: \bool_if:NT \c__nicematrix_tikz_loaded_bool { @@ -1436,6 +1460,7 @@ { ! { \skip_horizontal:N \arrayrulewidth } } } { \tl_gclear:N \g__nicematrix_preamble_tl } + \seq_clear:N \g__nicematrix_cols_vlism_seq \int_zero:N \l_tmpa_int \exp_after:wN \__nicematrix_patch_preamble:n \the \@temptokena \q_stop \int_gset_eq:NN \g__nicematrix_static_num_of_col_int \c@jCol @@ -1473,8 +1498,7 @@ } \dim_compare:nNnT \l__nicematrix_tabular_width_dim = \c_zero_dim { - \tl_gput_right:Nn - \g__nicematrix_preamble_tl + \tl_gput_right:Nn \g__nicematrix_preamble_tl { > { \__nicematrix_error_too_much_cols: } l } } \group_end: @@ -1511,14 +1535,24 @@ \str_if_eq:VnTF \l__nicematrix_letter_for_dotted_lines_str { #1 } { \__nicematrix_patch_preamble_xi:n #1 } { - \bool_lazy_and:nnTF - { \str_if_eq_p:nn { : } { #1 } } - \c__nicematrix_arydshln_loaded_bool + \str_if_eq:VnTF \l__nicematrix_letter_vlism_tl { #1 } { - \tl_gput_right:Nn \g__nicematrix_preamble_tl { : } + \seq_gput_right:Nx \g__nicematrix_cols_vlism_seq + { \int_eval:n { \c@jCol + 1 } } + \tl_gput_right:Nx \g__nicematrix_preamble_tl + { \exp_not:N ! { \skip_horizontal:N \arrayrulewidth } } \__nicematrix_patch_preamble:n } - { \__nicematrix_fatal:nn { unknown~column~type } { #1 } } + { + \bool_lazy_and:nnTF + { \str_if_eq_p:nn { : } { #1 } } + \c__nicematrix_arydshln_loaded_bool + { + \tl_gput_right:Nn \g__nicematrix_preamble_tl { : } + \__nicematrix_patch_preamble:n + } + { \__nicematrix_fatal:nn { unknown~column~type } { #1 } } + } } } } @@ -1576,11 +1610,15 @@ \__nicematrix_Cell: \begin { minipage } [ #1 ] { #3 } \mode_leave_vertical: - \arraybackslash % added in the version 5.8 - \box_use:N \@arstrutbox + \arraybackslash + \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt % v. 5.11 } c - < { \box_use:N \@arstrutbox \end { minipage } \__nicematrix_end_Cell: } + < { + \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt % v. 5.11 + \end { minipage } + \__nicematrix_end_Cell: + } } \int_gincr:N \c@jCol \__nicematrix_patch_preamble_x:n @@ -2062,6 +2100,7 @@ { > { + \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:n \bool_gset_true:N \g__nicematrix_after_col_zero_bool \__nicematrix_begin_of_row: \hbox_set:Nw \l__nicematrix_cell_box @@ -2106,6 +2145,7 @@ { > { + \cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:n \bool_gset_true:N \g__nicematrix_last_col_found_bool \int_gincr:N \c@jCol \int_gset_eq:NN \g__nicematrix_col_total_int \c@jCol @@ -2286,6 +2326,14 @@ } \iow_now:Nn \@mainaux \ExplSyntaxOff } + \__nicematrix_create_diag_nodes: + \str_if_empty:NF \l__nicematrix_name_str + { + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfnodealias { \l__nicematrix_name_str - ##1 } { \__nicematrix_env: - ##1 } + \endpgfpicture + } \bool_if:NT \l__nicematrix_parallelize_diags_bool { \int_gzero_new:N \g__nicematrix_ddots_int @@ -2409,6 +2457,19 @@ \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c@iRow \l__nicematrix_old_iRow_int } \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c@jCol \l__nicematrix_old_jCol_int } } +\cs_new_protected:Npn \__nicematrix_create_diag_nodes: + { + \int_step_inline:nn { \int_max:nn \c@iRow \c@jCol + 1 } + { + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \__nicematrix_qpoint:n { row - \int_min:nn { ##1 } { \c@iRow + 1 } } + \dim_set_eq:NN \l_tmpa_dim \pgf@y + \__nicematrix_qpoint:n { col - \int_min:nn { ##1 } { \c@jCol + 1 } } + \pgfcoordinate { \__nicematrix_env: - ##1 } { \pgfpoint \pgf@x \l_tmpa_dim } + \endpgfpicture + } + } \cs_new_protected:Npn \__nicematrix_find_extremities_of_line:nnnn #1 #2 #3 #4 { \cs_set:cpn { __nicematrix _ dotted _ #1 - #2 } { } @@ -3407,7 +3468,7 @@ \cs_if_free_p:c { pgf @ sh @ ns @ \__nicematrix_env: - #2 } } { - \__nicematrix_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 } + \__nicematrix_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 } } { \__nicematrix_draw_line_ii:nn { #1 } { #2 } } } @@ -3537,7 +3598,7 @@ cols .tl_set:N = \l__nicematrix_cols_tl , restart .bool_set:N = \l__nicematrix_rowcolors_restart_bool , restart .default:n = true , - unknown .code:n = \__nicematrix_error:n { Unknown~option~for~rowcolors } + unknown .code:n = \__nicematrix_error:n { Unknown~key~for~rowcolors } } \NewDocumentCommand \__nicematrix_rowcolors { O { } m m m O { } } { @@ -3740,11 +3801,11 @@ { \bool_gset_true:N \g_tmpa_bool \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq - { \__nicematrix_test_if_vline_in_block:nnnn ##1 } + { \__nicematrix_test_vline_in_block:nnnn ##1 } \seq_map_inline:Nn \g__nicematrix_pos_of_xdots_seq - { \__nicematrix_test_if_vline_in_block:nnnn ##1 } + { \__nicematrix_test_vline_in_block:nnnn ##1 } \seq_map_inline:Nn \g__nicematrix_pos_of_stroken_blocks_seq - { \__nicematrix_test_if_vline_in_stroken_block:nnnn ##1 } + { \__nicematrix_test_vline_in_stroken_block:nnnn ##1 } \clist_if_empty:NF \l__nicematrix_except_corners_clist \__nicematrix_test_in_corner_v: \bool_if:NTF \g_tmpa_bool @@ -3862,11 +3923,11 @@ { \bool_gset_true:N \g_tmpa_bool \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq - { \__nicematrix_test_if_hline_in_block:nnnn ##1 } + { \__nicematrix_test_hline_in_block:nnnn ##1 } \seq_map_inline:Nn \g__nicematrix_pos_of_xdots_seq - { \__nicematrix_test_if_hline_in_block:nnnn ##1 } + { \__nicematrix_test_hline_in_block:nnnn ##1 } \seq_map_inline:Nn \g__nicematrix_pos_of_stroken_blocks_seq - { \__nicematrix_test_if_hline_in_stroken_block:nnnn ##1 } + { \__nicematrix_test_hline_in_stroken_block:nnnn ##1 } \clist_if_empty:NF \l__nicematrix_except_corners_clist \__nicematrix_test_in_corner_h: \bool_if:NTF \g_tmpa_bool { @@ -3986,7 +4047,7 @@ { \__nicematrix_hline:nn { \__nicematrix_succ:n { \c@iRow } } { #1 } } \ifnum 0 = `{ \fi } } -\cs_new_protected:Npn \__nicematrix_test_if_hline_in_block:nnnn #1 #2 #3 #4 +\cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnn #1 #2 #3 #4 { \bool_lazy_all:nT { @@ -3997,7 +4058,7 @@ } { \bool_gset_false:N \g_tmpa_bool } } -\cs_new_protected:Npn \__nicematrix_test_if_vline_in_block:nnnn #1 #2 #3 #4 +\cs_new_protected:Npn \__nicematrix_test_vline_in_block:nnnn #1 #2 #3 #4 { \bool_lazy_all:nT { @@ -4008,7 +4069,7 @@ } { \bool_gset_false:N \g_tmpa_bool } } -\cs_new_protected:Npn \__nicematrix_test_if_hline_in_stroken_block:nnnn #1 #2 #3 #4 +\cs_new_protected:Npn \__nicematrix_test_hline_in_stroken_block:nnnn #1 #2 #3 #4 { \bool_lazy_all:nT { @@ -4019,7 +4080,7 @@ } { \bool_gset_false:N \g_tmpa_bool } } -\cs_new_protected:Npn \__nicematrix_test_if_vline_in_stroken_block:nnnn #1 #2 #3 #4 +\cs_new_protected:Npn \__nicematrix_test_vline_in_stroken_block:nnnn #1 #2 #3 #4 { \bool_lazy_all:nT { @@ -4176,11 +4237,9 @@ \bool_if:NTF \l__nicematrix_NiceArray_bool \c_zero_dim \arraycolsep + \l__nicematrix_right_margin_dim } - \tl_set:Nn \l_tmpa_tl { ( } - \tl_if_eq:NNF \l__nicematrix_left_delim_tl \l_tmpa_tl + \tl_if_eq:NnF \l__nicematrix_left_delim_tl ( { \dim_gadd:Nn \l__nicematrix_x_initial_dim { 0.5 \l__nicematrix_inter_dots_dim } } - \tl_set:Nn \l_tmpa_tl { ) } - \tl_if_eq:NNF \l__nicematrix_right_delim_tl \l_tmpa_tl + \tl_if_eq:NnF \l__nicematrix_right_delim_tl ) { \dim_gsub:Nn \l__nicematrix_x_final_dim { 0.5 \l__nicematrix_inter_dots_dim } } \tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl \__nicematrix_draw_line: @@ -4639,7 +4698,7 @@ draw .tl_set:N = \l__nicematrix_draw_tl , draw .default:n = default , color .code:n = - \__nicematrix_error:n { Key~color~for~Block } + \__nicematrix_fatal:n { Key~color~for~Block } \tl_set:Nn \l__nicematrix_fill_tl { #1 } , % color .code:n = \color { #1 } \tl_set:Nn \l__nicematrix_draw_tl { #1 } , color .value_required:n = true , @@ -4668,9 +4727,7 @@ \int_compare:nNnTF { #4 } > { 99 } { \int_set_eq:NN \l__nicematrix_last_col_int \c@jCol } { \int_set:Nn \l__nicematrix_last_col_int { #4 } } - \bool_lazy_or:nnTF - { \int_compare_p:nNn \l__nicematrix_last_row_int > \g__nicematrix_row_total_int } - { \int_compare_p:nNn \l__nicematrix_last_col_int > \g__nicematrix_col_total_int } + \int_compare:nNnTF \l__nicematrix_last_col_int > \g__nicematrix_col_total_int { \int_compare:nTF { \l__nicematrix_last_col_int <= \g__nicematrix_static_num_of_col_int } @@ -4684,7 +4741,11 @@ } { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } } } - { \__nicematrix_Block_v:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { + \int_compare:nNnTF \l__nicematrix_last_row_int > \g__nicematrix_row_total_int + { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } } + { \__nicematrix_Block_v:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + } } \cs_new_protected:Npn \__nicematrix_Block_v:nnnnnn #1 #2 #3 #4 #5 #6 { @@ -5052,13 +5113,16 @@ { \__nicematrix_math_toggle_token: #6 \__nicematrix_math_toggle_token: } { } { } \endpgfpicture } +\keys_define:nn { NiceMatrix } + { CodeAfter / rules .inherit:n = NiceMatrix / rules } \keys_define:nn { NiceMatrix / CodeAfter } { - sub-matrix .code:n = - \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , + sub-matrix .code:n = \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , sub-matrix .value_required:n = true , - delimiters-color .tl_set:N = \l__nicematrix_delimiters_color_tl , - delimiters-color .value_required:n = true , + delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , + delimiters / color .value_required:n = true , + rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , + rules .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~CodeAfter } } \cs_new:Npn \__nicematrix_CodeAfter: { \omit \__nicematrix_CodeAfter_i:n } @@ -5069,8 +5133,7 @@ } \cs_new_protected:Npn \__nicematrix_CodeAfter_ii:n #1 { - \str_if_eq:eeTF \@currenvir { #1 } - { \end { #1 } } + \str_if_eq:eeTF \@currenvir { #1 } { \end { #1 } } { \tl_gput_right:Nn \g_nicematrix_code_after_tl { \end { #1 } } \__nicematrix_CodeAfter_i:n @@ -5142,18 +5205,22 @@ right-xshift .value_required:n = true , xshift .meta:n = { left-xshift = #1, right-xshift = #1 } , xshift .value_required:n = true , - delimiters-color .tl_set:N = \l__nicematrix_delimiters_color_tl , - delimiters-color .value_required:n = true , + delimiters / color .tl_set:N = \l__nicematrix_delimiters_color_tl , + delimiters / color .value_required:n = true , slim .bool_set:N = \l__nicematrix_submatrix_slim_bool , slim .default:n = true , } \keys_define:nn { NiceMatrix } { - SubMatrix .inherit:n = NiceMatrix /sub-matrix , - CodeAfter / sub-matrix .inherit:n = NiceMatrix / sub-matrix + SubMatrix .inherit:n = NiceMatrix / sub-matrix , + CodeAfter / sub-matrix .inherit:n = NiceMatrix / sub-matrix , } \keys_define:nn { NiceMatrix / SubMatrix } { + hlines .clist_set:N = \l__nicematrix_submatrix_hlines_clist , + hlines .default:n = all , + vlines .clist_set:N = \l__nicematrix_submatrix_vlines_clist , + vlines .default:n = all , name .code:n = \tl_if_empty:nTF { #1 } { \__nicematrix_error:n { Invalid~name~format } } @@ -5169,6 +5236,8 @@ } { \__nicematrix_error:n { Invalid~name~format } } } , + rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } , + rules .value_required:n = true , name .value_required:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~SubMatrix } } @@ -5186,9 +5255,6 @@ { \int_compare_p:nNn \l_tmpd_tl > \g__nicematrix_col_total_int } { \__nicematrix_error:n { SubMatrix~too~large } } { - \dim_zero_new:N \l__nicematrix_submatrix_extra_height_dim - \dim_zero_new:N \l__nicematrix_submatrix_left_xshift_dim - \dim_zero_new:N \l__nicematrix_submatrix_right_xshift_dim \str_clear_new:N \l__nicematrix_submatrix_name_str \keys_set:nn { NiceMatrix / SubMatrix } { #5 } \pgfpicture @@ -5245,12 +5311,79 @@ \l__nicematrix_submatrix_extra_height_dim - \arrayrulewidth } \dim_set_eq:NN \nulldelimiterspace \c_zero_dim + \group_begin: + \pgfsetlinewidth { 1.1 \arrayrulewidth } + \tl_if_empty:NF \l__nicematrix_rules_color_tl + { \exp_after:wN \__nicematrix_set_CT@arc@: \l__nicematrix_rules_color_tl \q_stop } + \CT@arc@ + \seq_map_inline:Nn \g__nicematrix_cols_vlism_seq + { + \int_compare:nNnT \l_tmpb_tl < { ##1 } + { + \int_compare:nNnT { ##1 } < { \int_eval:n { \l_tmpd_tl + 1 } } + { + \__nicematrix_qpoint:n { col - ##1 } + \pgfpathmoveto { \pgfpoint \pgf@x \l__nicematrix_y_initial_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l__nicematrix_y_final_dim } + \pgfusepathqstroke + } + } + } + \tl_if_eq:NnTF \l__nicematrix_submatrix_vlines_clist { all } + { \int_step_inline:nn { \l_tmpd_tl - \l_tmpb_tl } } + { \clist_map_inline:Nn \l__nicematrix_submatrix_vlines_clist } + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn { ##1 } > 0 } + { \int_compare_p:nNn { ##1 } < { \l_tmpd_tl - \l_tmpb_tl + 1 } } + { + \__nicematrix_qpoint:n { col - \int_eval:n { ##1 + \l_tmpb_tl } } + \pgfpathmoveto { \pgfpoint \pgf@x \l__nicematrix_y_initial_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l__nicematrix_y_final_dim } + \pgfusepathqstroke + } + { \__nicematrix_error:nnn { Wrong~line~in~SubMatrix } { vertical } { ##1 } } + } + \tl_if_eq:NnTF \l__nicematrix_submatrix_hlines_clist { all } + { \int_step_inline:nn { \l_tmpc_tl - \l_tmpa_tl } } + { \clist_map_inline:Nn \l__nicematrix_submatrix_hlines_clist } + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn { ##1 } > 0 } + { \int_compare_p:nNn { ##1 } < { \l_tmpc_tl - \l_tmpa_tl + 1 } } + { + \__nicematrix_qpoint:n { row - \int_eval:n { ##1 + \l_tmpa_tl } } + \group_begin: + \dim_set:Nn \l_tmpa_dim + { \l__nicematrix_x_initial_dim - \l__nicematrix_submatrix_left_xshift_dim } + \str_case:nn { #1 } + { + ( { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } } + [ { \dim_sub:Nn \l_tmpa_dim { 0.2 mm } } + \{ { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } } + } + \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y } + \dim_set:Nn \l_tmpb_dim + { \l__nicematrix_x_final_dim + \l__nicematrix_submatrix_right_xshift_dim } + \str_case:nn { #4 } + { + ) { \dim_add:Nn \l_tmpb_dim { 0.9 mm } } + ] { \dim_add:Nn \l_tmpb_dim { 0.2 mm } } + \} { \dim_add:Nn \l_tmpb_dim { 0.9 mm } } + } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y } + \pgfusepathqstroke + \group_end: + } + { \__nicematrix_error:nnn { Wrong~line~in~SubMatrix } { horizontal } { ##1 } } + } \str_if_empty:NF \l__nicematrix_submatrix_name_str { \__nicematrix_pgf_rect_node:nnnnn \l__nicematrix_submatrix_name_str \l__nicematrix_x_initial_dim \l__nicematrix_y_initial_dim \l__nicematrix_x_final_dim \l__nicematrix_y_final_dim } + \group_end: \begin { pgfscope } \pgftransformshift { @@ -5325,7 +5458,6 @@ { #2 } { } } -%% \medskip \bool_new:N \c__nicematrix_footnotehyper_bool \bool_new:N \c__nicematrix_footnote_bool \__nicematrix_msg_new:nnn { Unknown~option~for~package } @@ -5492,15 +5624,15 @@ Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~ is~'standard'.~If~you~go~on,~this~key~will~be~ignored. } -\__nicematrix_msg_new:nn { Unknown~option~for~xdots } +\__nicematrix_msg_new:nn { Unknown~key~for~xdots } { - As~for~now~there~is~only~three~key~available~here:~'color',~'line-style'~ + As~for~now,~there~is~only~three~key~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. } -\__nicematrix_msg_new:nn { Unknown~option~for~rowcolors } +\__nicematrix_msg_new:nn { Unknown~key~for~rowcolors } { - As~for~now~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~ + As~for~now,~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~ (and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~ this~key~will~be~ignored. } @@ -5508,8 +5640,8 @@ { The~key~'color'~for~the~command~\token_to_str:N \Block\ is~deprecated:~you~should~use~'fill'~instead.\\ - You~can~go~on~for~this~time~but~remember~that~that~key~ - will~be~deleted~in~a~future~version. + This~error~is~fatal. + } \__nicematrix_msg_new:nn { ampersand~in~light-syntax } { @@ -5554,6 +5686,12 @@ A~name~must~be~accepted~by~the~regular~expression~[A-Za-z][A-Za-z0-9]*.\\ If~you~go~on,~this~key~will~be~ignored. } +\__nicematrix_msg_new:nn { Wrong~line~in~SubMatrix } + { + You~try~to~draw~a~#1~line~of~number~'#2'~in~a~ + \token_to_str:N \SubMatrix\ of~your~\__nicematrix_full_name_env:\ but~that~ + number~is~not~valid.~If~you~go~on,~it~will~be~ignored. + } \__nicematrix_msg_new:nn { empty~environment } { Your~\__nicematrix_full_name_env:\ is~empty.~This~error~is~fatal. } \__nicematrix_msg_new:nn { Delimiter~with~small } @@ -5562,7 +5700,7 @@ because~the~key~'small'~is~in~force.\\ This~error~is~fatal. } -\__nicematrix_msg_new:nn { unknown~cell~for~line~in~code-after } +\__nicematrix_msg_new:nn { unknown~cell~for~line~in~CodeAfter } { Your~command~\token_to_str:N\line\{#1\}\{#2\}~in~the~'code-after'~ can't~be~executed~because~a~cell~doesn't~exist.\\ @@ -5661,7 +5799,7 @@ (and~not~in~\token_to_str:N \vcenter).\\ This~error~is~fatal. } -\__nicematrix_msg_new:nn { Bad~value~for~letter~for~dotted~lines } +\__nicematrix_msg_new:nn { One~letter~allowed } { The~value~of~key~'\l_keys_key_str'~must~be~of~length~1.\\ If~you~go~on,~it~will~be~ignored. @@ -5685,17 +5823,31 @@ } { The~available~keys~are~(in~alphabetic~order):~ - delimiters-color,~ + delimiters/color,~ + rules~(with~the~subkeys~'color'~and~'width'),~ sub-matrix~(several~subkeys)~ and~xdots~(several~subkeys).~ The~latter~is~for~the~command~\token_to_str:N \line. } -\__nicematrix_msg_new:nn { Unknown~key~for~SubMatrix } +\__nicematrix_msg_new:nnn { Unknown~key~for~SubMatrix } { The~key~'\l_keys_key_str'~is~unknown.\\ - The~only~keys~available~here~are~'delimiters-color',~'extra-height',~ - 'left-xshift',~'name',~'right-xshift',~'slim'~and~'xshift'.\\ If~you~go~on,~this~key~will~be~ignored. \\ + For~a~list~of~the~available~keys~in~\token_to_str:N + \SubMatrix,~type~H~. + } + { + The~available~keys~are~(in~alphabetic~order):~ + 'delimiters/color',~ + 'extra-height',~ + 'hlines',~ + 'left-xshift',~ + 'name',~ + 'right-xshift',~ + 'rules'~(with~the~subkeys~'color'~and~'width'),~ + 'slim',~ + 'vlines'~and~'xshift'~(which~set~both~'left-xshift'~ + and~'right-xshift').\\ } \__nicematrix_msg_new:nnn { Unknown~key~for~notes } { @@ -5735,7 +5887,7 @@ create-extra-nodes,~ create-medium-nodes,~ create-large-nodes,~ - delimiters-color,~ + delimiters/color,~ end-of-row,~ first-col,~ first-row,~ @@ -5752,6 +5904,7 @@ renew-dots,~ renew-matrix,~ right-margin,~ + rules~(with~the~subkeys~'color'~and~'width'),~ small,~ sub-matrix~(several~subkeys), vlines,~ @@ -5782,7 +5935,7 @@ create-extra-nodes,~ create-medium-nodes,~ create-large-nodes,~ - delimiters-color,~ + delimiters/color,~ extra-left-margin,~ extra-right-margin,~ first-col,~ @@ -5800,8 +5953,7 @@ nullify-dots,~ renew-dots,~ right-margin,~ - rules/color,~ - rules/width,~ + rules~(with~the~subkeys~'color'~and~'width'),~ small,~ t,~ vlines,~ @@ -5834,7 +5986,7 @@ create-extra-nodes,~ create-medium-nodes,~ create-large-nodes,~ - delimiters-color,~ + delimiters/color,~ extra-left-margin,~ extra-right-margin,~ first-col,~ @@ -5852,8 +6004,7 @@ r,~ renew-dots,~ right-margin,~ - rules/color,~ - rules/width,~ + rules~(with~the~subkeys~'color'~and~'width'),~ small,~ t,~ vlines,~ @@ -5903,8 +6054,7 @@ nullify-dots,~ renew-dots,~ right-margin,~ - rules/color,~ - rules/width,~ + rules~(with~the~subkeys~'color'~and~'width'),~ t,~ vlines,~ xdots/color,~ -- cgit v1.2.3