summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-03-06 22:02:24 +0000
committerKarl Berry <karl@freefriends.org>2022-03-06 22:02:24 +0000
commit98250b80df1a20f0ed70d1d97853f39c3c0467fc (patch)
tree0330f4c9996788b7ea952290f60caaf3043f526d /Master/texmf-dist/tex/latex
parent226300d10a48730fc65650a50b0728203c7f620c (diff)
nicematrix
git-svn-id: svn://tug.org/texlive/trunk@62479 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty335
1 files changed, 204 insertions, 131 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index 51b0a3e4936..88cfb82de0f 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.6}
-\def\myfiledate{2022/02/16}
+\def\myfileversion{6.7}
+\def\myfiledate{2022/03/02}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -40,10 +40,6 @@
\cs_new_protected:Npn \__nicematrix_msg_new:nnn { \msg_new:nnnn { nicematrix } }
\cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn
{ \msg_redirect_name:nnn { nicematrix } }
-\bool_new:N \c__nicematrix_in_preamble_bool
-\bool_set_true:N \c__nicematrix_in_preamble_bool
-\hook_gput_code:nnn { begindocument } { . }
- { \bool_set_false:N \c__nicematrix_in_preamble_bool }
\bool_new:N \c__nicematrix_arydshln_loaded_bool
\bool_new:N \c__nicematrix_booktabs_loaded_bool
\bool_new:N \c__nicematrix_enumitem_loaded_bool
@@ -163,7 +159,7 @@
\cs_set:Npn \__nicematrix_standard_cline:w #1-#2 \q_stop
{
\int_compare:nNnT \l__nicematrix_first_col_int = 0 { \omit & }
- \int_compare:nNnT { #1 } > 1 { \multispan { \__nicematrix_pred:n { #1 } } & }
+ \int_compare:nNnT { #1 } > 1 { \multispan { \int_eval:n { #1 - 1 } } & }
\multispan { \int_eval:n { #2 - #1 + 1 } }
{
\CT@arc@
@@ -196,12 +192,10 @@
\skip_horizontal:N \c_zero_dim
}
\peek_meaning_remove_ignore_spaces:NTF \cline
- { & \__nicematrix_cline_i:en { \__nicematrix_succ:n { #3 } } }
+ { & \__nicematrix_cline_i:en { \int_eval:n { #3 + 1 } } }
{ \everycr { } \cr }
}
\cs_generate_variant:Nn \__nicematrix_cline_i:nn { e n }
-\cs_new:Npn \__nicematrix_succ:n #1 { \the \numexpr #1 + 1 \relax }
-\cs_new:Npn \__nicematrix_pred:n #1 { \the \numexpr #1 - 1 \relax }
\cs_new:Npn \__nicematrix_math_toggle_token:
{ \bool_if:NF \l__nicematrix_NiceTabular_bool \c_math_toggle_token }
\cs_new_protected:Npn \__nicematrix_set_CT@arc@:
@@ -557,7 +551,9 @@
line-style .value_required:n = true ,
color .tl_set:N = \l__nicematrix_xdots_color_tl ,
color .value_required:n = true ,
- shorten .dim_set:N = \l__nicematrix_xdots_shorten_dim ,
+ shorten .code:n =
+ \hook_gput_code:nnn { begindocument } { . }
+ { \dim_set:Nn \l__nicematrix_xdots_shorten_dim { #1 } } ,
shorten .value_required:n = true ,
down .tl_set:N = \l__nicematrix_xdots_down_tl ,
up .tl_set:N = \l__nicematrix_xdots_up_tl ,
@@ -655,6 +651,11 @@
{
hvlines-except-corners .code:n =
{
+ \__nicematrix_error:n { hvlines-except-corners }
+ \group_begin:
+ \globaldefs = 1
+ \__nicematrix_msg_redirect_name:nn { hvlines-except-corners } { none }
+ \group_end:
\clist_set:Nn \l__nicematrix_corners_clist { #1 }
\clist_set:Nn \l__nicematrix_vlines_clist { all }
\clist_set:Nn \l__nicematrix_hlines_clist { all }
@@ -717,30 +718,16 @@
label-in-list .value_required:n = true ,
enumitem-keys .code:n =
{
- \bool_if:NTF \c__nicematrix_in_preamble_bool
- {
- \hook_gput_code:nnn { begindocument } { . }
- {
- \bool_if:NT \c__nicematrix_enumitem_loaded_bool
- { \setlist* [ tabularnotes ] { #1 } }
- }
- }
+ \hook_gput_code:nnn { begindocument } { . }
{
- \bool_if:NT \c__nicematrix_enumitem_loaded_bool
- { \setlist* [ tabularnotes ] { #1 } }
+ \bool_if:NT \c__nicematrix_enumitem_loaded_bool
+ { \setlist* [ tabularnotes ] { #1 } }
}
} ,
enumitem-keys .value_required:n = true ,
enumitem-keys-para .code:n =
{
- \bool_if:NTF \c__nicematrix_in_preamble_bool
- {
- \hook_gput_code:nnn { begindocument } { . }
- {
- \bool_if:NT \c__nicematrix_enumitem_loaded_bool
- { \setlist* [ tabularnotes* ] { #1 } }
- }
- }
+ \hook_gput_code:nnn { begindocument } { . }
{
\bool_if:NT \c__nicematrix_enumitem_loaded_bool
{ \setlist* [ tabularnotes* ] { #1 } }
@@ -829,7 +816,7 @@
notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } ,
notes .value_required:n = true ,
sub-matrix .code:n =
- \keys_set:nn { NiceMatrix / sub-matrix } { #1 } ,
+ \keys_set:nn { NiceMatrix / sub-matrix } { #1 } ,
sub-matrix .value_required:n = true ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrixOptions }
}
@@ -1067,12 +1054,12 @@
}
\box_use:N \l__nicematrix_cell_box
\box_move_down:nn { \box_dp:N \l__nicematrix_cell_box }
- \hbox_overlap_left:n
- {
- \pgfsys@markposition
- { \__nicematrix_env: - \int_use:N \c@iRow - \int_use:N \c@jCol - SE }
- #1
- }
+ \hbox_overlap_left:n
+ {
+ \pgfsys@markposition
+ { \__nicematrix_env: - \int_use:N \c@iRow - \int_use:N \c@jCol - SE }
+ #1
+ }
}
}
}
@@ -1114,19 +1101,20 @@
\vtop
{
\skip_vertical:N 0.5\arrayrulewidth
- \pgfsys@markposition { \__nicematrix_env: - row - \__nicematrix_succ:n \c@iRow }
+ \pgfsys@markposition
+ { \__nicematrix_env: - row - \int_eval:n { \c@iRow + 1 } }
\skip_vertical:N -0.5\arrayrulewidth
}
}
\pgfpicture
\pgfrememberpicturepositiononpagetrue
- \pgfcoordinate { \__nicematrix_env: - row - \__nicematrix_succ:n \c@iRow }
+ \pgfcoordinate { \__nicematrix_env: - row - \int_eval:n { \c@iRow + 1 } }
{ \pgfpoint \c_zero_dim { - 0.5 \arrayrulewidth } }
\str_if_empty:NF \l__nicematrix_name_str
{
\pgfnodealias
- { \l__nicematrix_name_str - row - \__nicematrix_succ:n \c@iRow }
- { \__nicematrix_env: - row - \__nicematrix_succ:n \c@iRow }
+ { \l__nicematrix_name_str - row - \int_eval:n { \c@iRow + 1 } }
+ { \__nicematrix_env: - row - \int_eval:n { \c@iRow + 1 } }
}
\endpgfpicture
}
@@ -1146,7 +1134,7 @@
\exp_args:NNx
\clist_if_in:NnT
\l__nicematrix_hlines_clist
- { \__nicematrix_succ:n \c@iRow }
+ { \int_eval:n { \c@iRow + 1 } }
}
{
\int_compare:nNnT \c@iRow > { -1 }
@@ -1477,9 +1465,9 @@
\dim_set_eq:NN \l_tmpa_dim \pgf@x
\__nicematrix_qpoint:n { #1 }
\dim_set_eq:NN \l_tmpb_dim \pgf@y
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #4 } }
+ \__nicematrix_qpoint:n { col - \int_eval:n { #4 + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@x
- \__nicematrix_qpoint:n { \__nicematrix_succ:n { #3 } }
+ \__nicematrix_qpoint:n { \int_eval:n { #3 + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@y
\__nicematrix_pgf_rect_node:nnnnn
{ \__nicematrix_env: - #5 }
@@ -1884,7 +1872,7 @@
{
\__nicematrix_vline:n
{
- position = \__nicematrix_succ:n \c@jCol ,
+ position = \int_eval:n { \c@jCol + 1 } ,
multiplicity = \int_use:N \l_tmpa_int ,
}
}
@@ -2109,7 +2097,7 @@
\cs_new_protected:Npn \__nicematrix_patch_preamble_viii_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 }
+ { \__nicematrix_delimiter:nnn #1 { \int_eval:n { \c@jCol + 1 } } \c_true_bool }
\tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
{
\__nicematrix_error:nn { delimiter~after~opening } { #2 }
@@ -2239,7 +2227,7 @@
}
{
\exp_args:NNx
- \clist_if_in:NnT \l__nicematrix_vlines_clist { \__nicematrix_succ:n \c@jCol }
+ \clist_if_in:NnT \l__nicematrix_vlines_clist { \int_eval:n { \c@jCol + 1 } }
{
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -2269,7 +2257,7 @@
\int_compare:nNnT { #1 } > 1
{
\seq_gput_left:Nx \g__nicematrix_multicolumn_cells_seq
- { \int_use:N \c@iRow - \__nicematrix_succ:n \c@jCol }
+ { \int_use:N \c@iRow - \int_eval:n { \c@jCol + 1 } }
\seq_gput_left:Nn \g__nicematrix_multicolumn_sizes_seq { #1 }
\seq_gput_right:Nx \g__nicematrix_pos_of_blocks_seq
{
@@ -2390,7 +2378,7 @@
}
{
\exp_args:NNx
- \clist_if_in:NnT \l__nicematrix_vlines_clist { \__nicematrix_succ:n \c@jCol }
+ \clist_if_in:NnT \l__nicematrix_vlines_clist { \int_eval:n { \c@jCol + 1 } }
{
\tl_gput_right:Nn \g__nicematrix_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
@@ -2417,7 +2405,7 @@
\pgfpicture
\__nicematrix_qpoint:n { row - 1 }
\dim_gset_eq:NN \g_tmpa_dim \pgf@y
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c@iRow }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \c@iRow + 1 } }
\dim_gadd:Nn \g_tmpa_dim \pgf@y
\dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim }
\str_if_in:NnTF \l__nicematrix_baseline_tl { line- }
@@ -2759,19 +2747,20 @@
\hbox
{
\skip_horizontal:N -0.5\arrayrulewidth
- \pgfsys@markposition { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ \pgfsys@markposition
+ { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } }
\skip_horizontal:N 0.5\arrayrulewidth
}
}
\pgfpicture
\pgfrememberpicturepositiononpagetrue
- \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ \pgfcoordinate { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } }
{ \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim }
\str_if_empty:NF \l__nicematrix_name_str
{
\pgfnodealias
- { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g_tmpa_int }
- { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ { \l__nicematrix_name_str - col - \int_eval:n { \g_tmpa_int + 1 } }
+ { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } }
}
\endpgfpicture
}
@@ -2797,7 +2786,9 @@
\skip_horizontal:N -0.5\arrayrulewidth
\bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
{ \skip_horizontal:N -\arraycolsep }
- \pgfsys@markposition { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ \pgfsys@markposition
+ { \__nicematrix_env: - col - \int_eval:n {
+ \g_tmpa_int + 1 } }
\skip_horizontal:N 0.5\arrayrulewidth
\bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
{ \skip_horizontal:N \arraycolsep }
@@ -2805,7 +2796,7 @@
}
\pgfpicture
\pgfrememberpicturepositiononpagetrue
- \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ \pgfcoordinate { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } }
{
\bool_lazy_and:nnTF \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
{
@@ -2818,8 +2809,8 @@
\str_if_empty:NF \l__nicematrix_name_str
{
\pgfnodealias
- { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g_tmpa_int }
- { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ { \l__nicematrix_name_str - col - \int_eval:n { \g_tmpa_int + 1 } }
+ { \__nicematrix_env: - col - \int_eval:n { \g_tmpa_int + 1 } }
}
\endpgfpicture
\bool_if:NT \g__nicematrix_last_col_found_bool
@@ -2830,17 +2821,21 @@
\bool_if:NT \l__nicematrix_code_before_bool
{
\pgfsys@markposition
- { \__nicematrix_env: - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
+ { \__nicematrix_env: - col - \int_eval:n { \g__nicematrix_col_total_int + 1 } }
}
\pgfpicture
\pgfrememberpicturepositiononpagetrue
- \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
+ \pgfcoordinate
+ { \__nicematrix_env: - col - \int_eval:n { \g__nicematrix_col_total_int + 1 } }
\pgfpointorigin
\str_if_empty:NF \l__nicematrix_name_str
{
\pgfnodealias
- { \l__nicematrix_name_str - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
- { \__nicematrix_env: - col - \__nicematrix_succ:n \g__nicematrix_col_total_int }
+ {
+ \l__nicematrix_name_str - col
+ - \int_eval:n { \g__nicematrix_col_total_int + 1 }
+ }
+ { \__nicematrix_env: - col - \int_eval:n { \g__nicematrix_col_total_int + 1 } }
}
\endpgfpicture
}
@@ -2971,7 +2966,7 @@
{
\int_compare:nNnTF \l__nicematrix_last_col_int < 0
\c@MaxMatrixCols
- { \__nicematrix_pred:n \l__nicematrix_last_col_int }
+ { \int_eval:n { \l__nicematrix_last_col_int - 1 } }
}
{ > \__nicematrix_cell_begin:w #2 < \__nicematrix_cell_end: }
}
@@ -3511,7 +3506,7 @@
}
\dim_compare:nNnT \l__nicematrix_x_final_dim = { - \c_max_dim }
{
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_final_j_int }
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_final_j_int + 1 } }
\dim_set_eq:NN \l__nicematrix_x_final_dim \pgf@x
\dim_sub:Nn \l__nicematrix_x_final_dim \col@sep
}
@@ -3588,7 +3583,7 @@
{
\__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_initial_i_int }
\dim_set_eq:NN \l_tmpa_dim \pgf@y
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l__nicematrix_initial_i_int }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_initial_i_int + 1 } }
\dim_set:Nn \l__nicematrix_y_initial_dim { ( \l_tmpa_dim + \pgf@y ) / 2 }
\dim_set_eq:NN \l__nicematrix_y_final_dim \l__nicematrix_y_initial_dim
}
@@ -3678,7 +3673,7 @@
{
\__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_initial_j_int }
\dim_set_eq:NN \l_tmpa_dim \pgf@x
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l__nicematrix_initial_j_int }
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_initial_j_int + 1 } }
\dim_set:Nn \l__nicematrix_x_initial_dim { ( \pgf@x + \l_tmpa_dim ) / 2 }
\dim_set_eq:NN \l__nicematrix_x_final_dim \l__nicematrix_x_initial_dim
\int_compare:nNnT \l__nicematrix_last_col_int > { -2 }
@@ -4625,7 +4620,7 @@
{
\bool_lazy_or:nnTF
{ \int_compare_p:nNn { #4 } = \c_zero_int }
- { \int_compare_p:nNn { #2 } = { \__nicematrix_succ:n { \c@jCol } } }
+ { \int_compare_p:nNn { #2 } = { \int_eval:n { \c@jCol + 1 } } }
\prg_return_false:
\prg_return_true:
}
@@ -4670,7 +4665,7 @@
\int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpa_tl
{ \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } }
{ \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } }
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth }
\clist_map_inline:Nn \l__nicematrix_rows_tl
{
@@ -4686,7 +4681,7 @@
\seq_if_in:NxF \l__nicematrix_corners_cells_seq
{ \l_tmpa_tl - \l__nicematrix_tmpc_tl }
{
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpb_tl }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth }
\__nicematrix_qpoint:n { row - \l_tmpa_tl }
\dim_set:Nn \l__nicematrix_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth }
@@ -4851,11 +4846,11 @@
}
\cs_new_protected:Npn \__nicematrix_test_in_corner_v:
{
- \int_compare:nNnTF \l_tmpb_tl = { \__nicematrix_succ:n \c@jCol }
+ \int_compare:nNnTF \l_tmpb_tl = { \int_eval:n { \c@jCol + 1 } }
{
\seq_if_in:NxT
\l__nicematrix_corners_cells_seq
- { \l_tmpa_tl - \__nicematrix_pred:n \l_tmpb_tl }
+ { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
{ \bool_set_false:N \g_tmpa_bool }
}
{
@@ -4868,7 +4863,7 @@
{
\seq_if_in:NxT
\l__nicematrix_corners_cells_seq
- { \l_tmpa_tl - \__nicematrix_pred:n \l_tmpb_tl }
+ { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } }
{ \bool_set_false:N \g_tmpa_bool }
}
}
@@ -4976,7 +4971,7 @@
}
{
\bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool }
- { \__nicematrix_succ:n \c@jCol }
+ { \int_eval:n { \c@jCol + 1 } }
\c@jCol
}
{
@@ -5032,11 +5027,11 @@
}
\cs_new_protected:Npn \__nicematrix_test_in_corner_h:
{
- \int_compare:nNnTF \l_tmpa_tl = { \__nicematrix_succ:n \c@iRow }
+ \int_compare:nNnTF \l_tmpa_tl = { \int_eval:n { \c@iRow + 1 } }
{
\seq_if_in:NxT
\l__nicematrix_corners_cells_seq
- { \__nicematrix_pred:n \l_tmpa_tl - \l_tmpb_tl }
+ { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
{
@@ -5049,7 +5044,7 @@
{
\seq_if_in:NxT
\l__nicematrix_corners_cells_seq
- { \__nicematrix_pred:n \l_tmpa_tl - \l_tmpb_tl }
+ { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl }
{ \bool_set_false:N \g_tmpa_bool }
}
}
@@ -5171,7 +5166,7 @@
}
{
\bool_if:nTF { \l__nicematrix_NiceArray_bool && ! \l__nicematrix_except_borders_bool }
- { \__nicematrix_succ:n \c@iRow }
+ { \int_eval:n { \c@iRow + 1 } }
\c@iRow
}
{
@@ -5268,15 +5263,17 @@
\str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX:|()[]!@<> }
\keys_define:nn { NiceMatrix / Custom-Line }
{
- letter .str_set:N = \l__nicematrix_letter_str ,
+ % here, we will use change in the future to use .tl_set:N
+ letter .code:n = \str_set:Nn \l__nicematrix_letter_str { #1 } ,
letter .value_required:n = true ,
- command .str_set:N = \l__nicematrix_command_str ,
+ % here, we will use change in the future to use .tl_set:N
+ command .code:n = \str_set:Nn \l__nicematrix_command_str { #1 } ,
command .value_required:n = true ,
multiplicity .int_set:N = \l__nicematrix_tmpc_int ,
multiplicity .initial:n = 1 ,
multiplicity .value_required:n = true ,
color .tl_set:N = \l_tmpa_tl ,
- color. value_required:n = true ,
+ color .value_required:n = true ,
tikz .code:n = \bool_set_true:N \l_tmpa_bool ,
width .code:n = \dim_set:Nn \l__nicematrix_rule_width_dim { #1 }
\bool_set_true:N \l_tmpb_bool ,
@@ -5310,7 +5307,7 @@
{ \skip_horizontal:n { \dim_use:N \l__nicematrix_rule_width_dim } }
}
\tl_gput_right:Nx \g__nicematrix_internal_code_after_tl
- { \__nicematrix_vline:n { #1 , position = \__nicematrix_succ:n \c@jCol } }
+ { \__nicematrix_vline:n { #1 , position = \int_eval:n { \c@jCol + 1 } } }
}
\cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnnn #1 #2 #3 #4
{
@@ -5456,13 +5453,13 @@
}
\cs_new_protected:Npn \__nicematrix_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
- \int_compare:nNnT { #3 } < { \__nicematrix_succ:n { #1 } }
+ \int_compare:nNnT { #3 } < { \int_eval:n { #1 + 1 } }
{
- \int_compare:nNnT { #1 } < { \__nicematrix_succ:n { #5 } }
+ \int_compare:nNnT { #1 } < { \int_eval:n { #5 + 1 } }
{
- \int_compare:nNnT { #4 } < { \__nicematrix_succ:n { #2 } }
+ \int_compare:nNnT { #4 } < { \int_eval:n { #2 + 1 } }
{
- \int_compare:nNnT { #2 } < { \__nicematrix_succ:n { #6 } }
+ \int_compare:nNnT { #2 } < { \int_eval:n { #6 + 1 } }
{ \bool_set_true:N \l_tmpb_bool }
}
}
@@ -5639,11 +5636,11 @@
{
(
\dim_use:c { l__nicematrix_row _ \__nicematrix_i: _ min _ dim } +
- \dim_use:c { l__nicematrix_row _ \__nicematrix_succ:n \__nicematrix_i: _ max _ dim }
+ \dim_use:c { l__nicematrix_row _ \int_eval:n { \__nicematrix_i: + 1 } _ max _ dim }
)
/ 2
}
- \dim_set_eq:cc { l__nicematrix_row _ \__nicematrix_succ:n \__nicematrix_i: _ max _ dim }
+ \dim_set_eq:cc { l__nicematrix_row _ \int_eval:n { \__nicematrix_i: + 1 } _ max _ dim }
{ l__nicematrix_row_\__nicematrix_i: _min_dim }
}
\int_step_variable:nNn { \c@jCol - 1 } \__nicematrix_j:
@@ -5653,11 +5650,11 @@
(
\dim_use:c { l__nicematrix_column _ \__nicematrix_j: _ max _ dim } +
\dim_use:c
- { l__nicematrix_column _ \__nicematrix_succ:n \__nicematrix_j: _ min _ dim }
+ { l__nicematrix_column _ \int_eval:n { \__nicematrix_j: + 1 } _ min _ dim }
)
/ 2
}
- \dim_set_eq:cc { l__nicematrix_column _ \__nicematrix_succ:n \__nicematrix_j: _ min _ dim }
+ \dim_set_eq:cc { l__nicematrix_column _ \int_eval:n { \__nicematrix_j: + 1 } _ min _ dim }
{ l__nicematrix_column _ \__nicematrix_j: _ max _ dim }
}
\dim_sub:cn
@@ -5978,7 +5975,7 @@
color .value_required:n = true ,
borders .clist_set:N = \l__nicematrix_borders_clist ,
borders .value_required:n = true ,
- hvlines .meta:n = { vlines = #1 , hlines = #1 } ,
+ hvlines .meta:n = { vlines , hlines } ,
vlines .bool_set:N = \l__nicematrix_vlines_block_bool,
vlines .default:n = true ,
hlines .bool_set:N = \l__nicematrix_hlines_block_bool,
@@ -6009,6 +6006,9 @@
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 ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~Block }
}
\cs_new_protected:Npn \__nicematrix_draw_blocks:
@@ -6050,6 +6050,14 @@
{
\group_begin:
\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
@@ -6144,9 +6152,9 @@
\dim_set_eq:NN \l_tmpa_dim \pgf@y
\__nicematrix_qpoint:n { col - #2 }
\dim_set_eq:NN \l_tmpb_dim \pgf@x
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { \l__nicematrix_last_row_int } }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_last_row_int + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@y
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@x
\__nicematrix_pgf_rect_node:nnnnn
{ \__nicematrix_env: - #1 - #2 - block }
@@ -6200,7 +6208,7 @@
}
\dim_compare:nNnT \l__nicematrix_tmpd_dim = { - \c_max_dim }
{
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } }
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_last_col_int + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@x
}
\__nicematrix_pgf_rect_node:nnnnn
@@ -6221,7 +6229,8 @@
{ south~east }
}
}
- \int_compare:nNnTF { #1 } = { #3 }
+ \bool_if:nTF
+ { \int_compare_p:nNn { #1 } = { #3 } && ! \l__nicematrix_v_center_bool }
{
\int_compare:nNnTF { #1 } = 0
{ \l__nicematrix_code_for_first_row_tl }
@@ -6339,9 +6348,9 @@
{ \tl_set:Nx \l_tmpa_tl { \int_use:N \c@iRow } }
\int_compare:nNnT \l_tmpb_tl > \c@jCol
{ \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } }
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpa_tl }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } }
\dim_set:Nn \l_tmpa_dim { \pgf@y }
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl }
+ \__nicematrix_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } }
\dim_set:Nn \l__nicematrix_tmpd_dim { \pgf@x }
\pgfpathrectanglecorners
{ \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim }
@@ -6379,7 +6388,7 @@
{
position = ##1 ,
start = \l__nicematrix_tmpc_tl ,
- end = \__nicematrix_pred:n \l_tmpa_tl
+ end = \int_eval:n { \l_tmpa_tl - 1 }
}
}
}
@@ -6414,32 +6423,55 @@
\dim_compare:nNnTF \l__nicematrix_rounded_corners_dim > \c_zero_dim
{ \__nicematrix_error:n { borders~forbidden } }
{
- \clist_map_inline:Nn \l__nicematrix_borders_clist
- {
- \clist_if_in:nnF { top , bottom , left , right } { ##1 }
- { \__nicematrix_error:nn { bad~border } { ##1 } }
- }
+ \tl_clear_new:N \l__nicematrix_borders_tikz_tl
+ \keys_set:nV
+ { NiceMatrix / OnlyForTikzInBorders }
+ \l__nicematrix_borders_clist
\__nicematrix_cut_on_hyphen:w #2 \q_stop
\tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl
\tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl
\__nicematrix_cut_on_hyphen:w #3 \q_stop
\tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } }
\tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } }
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgf@relevantforpicturesizefalse
- \CT@arc@
- \pgfsetlinewidth { 1.1 \l__nicematrix_line_width_dim }
- \clist_if_in:NnT \l__nicematrix_borders_clist { right }
- { \__nicematrix_stroke_vertical:n \l_tmpb_tl }
- \clist_if_in:NnT \l__nicematrix_borders_clist { left }
- { \__nicematrix_stroke_vertical:n \l__nicematrix_tmpd_tl }
- \clist_if_in:NnT \l__nicematrix_borders_clist { bottom }
- { \__nicematrix_stroke_horizontal:n \l_tmpa_tl }
- \clist_if_in:NnT \l__nicematrix_borders_clist { top }
- { \__nicematrix_stroke_horizontal:n \l__nicematrix_tmpc_tl }
- \endpgfpicture
- }
+ \__nicematrix_stroke_borders_block_i:
+ }
+ }
+\hook_gput_code:nnn { begindocument } { . }
+ {
+ \cs_new_protected:Npx \__nicematrix_stroke_borders_block_i:
+ {
+ \c__nicematrix_pgfortikzpicture_tl
+ \__nicematrix_stroke_borders_block_ii:
+ \c__nicematrix_endpgfortikzpicture_tl
+ }
+ }
+\cs_new_protected:Npn \__nicematrix_stroke_borders_block_ii:
+ {
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \CT@arc@
+ \pgfsetlinewidth { 1.1 \l__nicematrix_line_width_dim }
+ \clist_if_in:NnT \l__nicematrix_borders_clist { right }
+ { \__nicematrix_stroke_vertical:n \l_tmpb_tl }
+ \clist_if_in:NnT \l__nicematrix_borders_clist { left }
+ { \__nicematrix_stroke_vertical:n \l__nicematrix_tmpd_tl }
+ \clist_if_in:NnT \l__nicematrix_borders_clist { bottom }
+ { \__nicematrix_stroke_horizontal:n \l_tmpa_tl }
+ \clist_if_in:NnT \l__nicematrix_borders_clist { top }
+ { \__nicematrix_stroke_horizontal:n \l__nicematrix_tmpc_tl }
+ }
+\keys_define:nn { NiceMatrix / OnlyForTikzInBorders }
+ {
+ tikz .code:n =
+ \cs_if_exist:NTF \tikzpicture
+ { \tl_set:Nn \l__nicematrix_borders_tikz_tl { #1 } }
+ { \__nicematrix_error:n { tikz~in~borders~without~tikz } } ,
+ tikz .value_required:n = true ,
+ top .code:n = ,
+ bottom .code:n = ,
+ left .code:n = ,
+ right .code:n = ,
+ unknown .code:n = \__nicematrix_error:n { bad~border }
}
\cs_new_protected:Npn \__nicematrix_stroke_vertical:n #1
{
@@ -6448,9 +6480,16 @@
\__nicematrix_qpoint:n \l_tmpa_tl
\dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@y + 0.5 \l__nicematrix_line_width_dim }
\__nicematrix_qpoint:n { #1 }
- \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpb_dim }
- \pgfpathlineto { \pgfpoint \pgf@x \l__nicematrix_tmpc_dim }
- \pgfusepathqstroke
+ \tl_if_empty:NTF \l__nicematrix_borders_tikz_tl
+ {
+ \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpb_dim }
+ \pgfpathlineto { \pgfpoint \pgf@x \l__nicematrix_tmpc_dim }
+ \pgfusepathqstroke
+ }
+ {
+ \use:x { \exp_not:N \draw [ \l__nicematrix_borders_tikz_tl ] }
+ ( \pgf@x , \l_tmpb_dim ) -- ( \pgf@x , \l__nicematrix_tmpc_dim ) ;
+ }
}
\cs_new_protected:Npn \__nicematrix_stroke_horizontal:n #1
{
@@ -6461,16 +6500,23 @@
\__nicematrix_qpoint:n \l_tmpb_tl
\dim_set:Nn \l_tmpb_dim { \pgf@x + 0.5 \l__nicematrix_line_width_dim }
\__nicematrix_qpoint:n { #1 }
- \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y }
- \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y }
- \pgfusepathqstroke
+ \tl_if_empty:NTF \l__nicematrix_borders_tikz_tl
+ {
+ \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y }
+ \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y }
+ \pgfusepathqstroke
+ }
+ {
+ \use:x { \exp_not:N \draw [ \l__nicematrix_borders_tikz_tl ] }
+ ( \l_tmpa_dim , \pgf@y ) -- ( \l_tmpb_dim , \pgf@y ) ;
+ }
}
\keys_define:nn { NiceMatrix / BlockBorders }
{
borders .clist_set:N = \l__nicematrix_borders_clist ,
rounded-corners .dim_set:N = \l__nicematrix_rounded_corners_dim ,
rounded-corners .default:n = 4 pt ,
- line-width .dim_set:N = \l__nicematrix_line_width_dim
+ line-width .dim_set:N = \l__nicematrix_line_width_dim ,
}
\cs_new_protected:Npn \__nicematrix_block_tikz:nnnnn #1 #2 #3 #4 #5
{
@@ -6478,7 +6524,9 @@
\clist_map_inline:nn { #5 }
{
\path [ ##1 ]
- ( #1 -| #2 ) rectangle ( \__nicematrix_succ:n { #3 } -| \__nicematrix_succ:n { #4 } ) ;
+ ( #1 -| #2 )
+ rectangle
+ ( \int_eval:n { #3 + 1 } -| \int_eval:n { #4 + 1 } ) ;
}
\end { tikzpicture }
}
@@ -6609,9 +6657,9 @@
\__nicematrix_qpoint:n { col - #2 }
\dim_set_eq:NN \l_tmpb_dim \pgf@x
\pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { #3 } }
+ \__nicematrix_qpoint:n { row - \int_eval:n { #3 + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@y
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #4 } }
+ \__nicematrix_qpoint:n { col - \int_eval:n { #4 + 1 } }
\dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@x
\pgfpathlineto { \pgfpoint \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim }
{
@@ -6680,7 +6728,7 @@
\pgf@relevantforpicturesizefalse
\__nicematrix_qpoint:n { row - 1 }
\dim_set_eq:NN \l__nicematrix_y_initial_dim \pgf@y
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c@iRow }
+ \__nicematrix_qpoint:n { row - \int_eval:n { \c@iRow + 1 } }
\dim_set_eq:NN \l__nicematrix_y_final_dim \pgf@y
\bool_if:nTF { #3 }
{ \dim_set_eq:NN \l_tmpa_dim \c_max_dim }
@@ -7136,6 +7184,8 @@
yshift .dim_set:N = \l__nicematrix_brace_yshift_dim ,
yshift .value_required:n = true ,
yshift .initial:n = \c_zero_dim ,
+ color .tl_set:N = \l_tmpa_tl ,
+ color .value_required:n = true ,
unknown .code:n = \__nicematrix_error:n { Unknown~key~for~Brace }
}
\cs_new_protected:Npn \__nicematrix_brace:nnnnn #1 #2 #3 #4 #5
@@ -7151,7 +7201,9 @@
{ \__nicematrix_error:nn { Construct~too~large } { \OverBrace } }
}
{
+ \tl_clear:N \l_tmpa_tl % added the 2022-02-25
\keys_set:nn { NiceMatrix / Brace } { #4 }
+ \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } } % added the 2022-02-25
\pgfpicture
\pgfrememberpicturepositiononpagetrue
\pgf@relevantforpicturesizefalse
@@ -7390,6 +7442,13 @@
~(plus~the~potential~exterior~ones).~
This~error~is~fatal.
}
+\__nicematrix_msg_new:nn { hvlines-except-corners }
+ {
+ The~key~'hvlines-except-corners'~is~now~obsolete.~You~should~instead~use~the~
+ keys~'hvlines'~and~'corners'.\\
+ However,~you~can~go~on~for~this~time.~This~message~won't~be~shown~anymore~
+ in~this~document.
+ }
\__nicematrix_msg_new:nn { last~col~not~used }
{
The~key~'last-col'~is~in~force~but~you~have~not~used~that~last~column~
@@ -7506,6 +7565,11 @@
}
\__nicematrix_msg_new:nn { empty~environment }
{ Your~\__nicematrix_full_name_env:\ is~empty.~This~error~is~fatal. }
+\__nicematrix_msg_new:nn { 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 }
{
Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~
@@ -7573,9 +7637,12 @@
}
\__nicematrix_msg_new:nn { bad~border }
{
- #1~is~an~incorrect~specification~for~a~border~(in~the~key~
- 'borders'~of~the~command~\token_to_str:N \Block).~The~available~
- values~are:~left,~right,~top~and~bottom.\\
+ \l_keys_key_str\space~is~an~incorrect~specification~for~a~border~
+ (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
+ {~if~you~load~the~LaTeX~package~'tikz'}).\\
If~you~go~on,~this~specification~of~border~will~be~ignored.
}
\__nicematrix_msg_new:nn { tikz~key~without~tikz }
@@ -7660,6 +7727,12 @@
You~can~go~on~but~you~will~have~another~error~if~you~actually~
use~that~custom~line.
}
+\__nicematrix_msg_new:nn { tikz~in~borders~without~tikz }
+ {
+ You~have~used~the~key~'tikz'~in~a~key~'borders'~(of~a~
+ command~'\token_to_str:N\Block')~but~Tikz~is~not~loaded.~
+ If~you~go~on,~that~key~will~be~ignored.
+ }
\__nicematrix_msg_new:nn { color~in~custom-line~with~tikz }
{
In~a~'custom-line',~you~have~used~both~'tikz'~and~'color',~
@@ -7718,7 +7791,7 @@
For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~keys~are~(in~alphabetic~order):~left-shorten,~
+ The~available~keys~are~(in~alphabetic~order):~color,~left-shorten,~
right-shorten,~shorten~(which~fixes~both~left-shorten~and~
right-shorten)~and~yshift.
}