summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nicematrix
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-16 19:57:34 +0000
committerKarl Berry <karl@freefriends.org>2021-07-16 19:57:34 +0000
commit7dae219cffdd41f06364c53711ced32311b69733 (patch)
tree7f163c4465942e3007af0bbe6e63e1a5965361a3 /Master/texmf-dist/tex/latex/nicematrix
parent189cdddc0579b30df1ea73a5d8583a8c8ce7f66f (diff)
nicematrix (16jul21)
git-svn-id: svn://tug.org/texlive/trunk@59952 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicematrix')
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty197
1 files changed, 154 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index 81f4976f7a4..bbd810f13e4 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.17a}
-\def\myfiledate{2021/07/04}
+\def\myfileversion{5.18}
+\def\myfiledate{2021/07/15}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -123,7 +123,9 @@
\AtBeginDocument
{
\@ifpackageloaded { colortbl }
- { \bool_set_true:N \c__nicematrix_colortbl_loaded_bool }
+ {
+ \bool_set_true:N \c__nicematrix_colortbl_loaded_bool
+ }
{
\cs_set_protected:Npn \CT@arc@ { }
\cs_set:Npn \arrayrulecolor #1 # { \CT@arc { #1 } }
@@ -132,7 +134,6 @@
\dim_compare:nNnT \baselineskip = \c_zero_dim \noalign
{ \cs_gset:Npn \CT@arc@ { \color #1 { #2 } } }
}
- \cs_set_protected:Npn \CT@drsc@ { }
\cs_set:Npn \doublerulesepcolor #1 # { \CT@drs { #1 } }
\cs_set:Npn\CT@drs #1 #2
{
@@ -151,6 +152,7 @@
}
}
}
+\cs_set_protected:Npn \CT@drsc@ { }
\cs_set:Npn \__nicematrix_standard_cline #1 { \__nicematrix_standard_cline:w #1 \q_stop }
\cs_set:Npn \__nicematrix_standard_cline:w #1-#2 \q_stop
{
@@ -329,6 +331,7 @@
\bool_new:N \g__nicematrix_not_empty_cell_bool
\tl_new:N \l__nicematrix_code_before_tl
\bool_new:N \l__nicematrix_code_before_bool
+\tl_new:N \g__nicematrix_row_style_tl
\dim_new:N \l__nicematrix_x_initial_dim
\dim_new:N \l__nicematrix_y_initial_dim
\dim_new:N \l__nicematrix_x_final_dim
@@ -848,7 +851,7 @@
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 ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix }
}
\keys_define:nn { NiceMatrix / NiceArray }
{
@@ -865,7 +868,7 @@
tabularnote .value_required:n = true ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceArray }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceArray }
}
\keys_define:nn { NiceMatrix / pNiceArray }
{
@@ -878,7 +881,7 @@
small .value_forbidden:n = true ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceMatrix }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrix }
}
\keys_define:nn { NiceMatrix / NiceTabular }
{
@@ -893,10 +896,11 @@
\int_zero:N \l__nicematrix_last_col_int ,
r .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
l .code:n = \__nicematrix_error:n { r~or~l~with~preamble } ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceTabular }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceTabular }
}
\cs_new_protected:Npn \__nicematrix_Cell:
{
+ \tl_gclear:N \g__nicematrix_exit_cell_tl
\cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter_i:n
\int_gincr:N \c@jCol
\int_compare:nNnT \c@jCol = 1
@@ -907,6 +911,7 @@
\c_math_toggle_token
\bool_if:NT \l__nicematrix_small_bool \scriptstyle
}
+ \g__nicematrix_row_style_tl
\int_compare:nNnTF \c@iRow = 0
{
\int_compare:nNnT \c@jCol > 0
@@ -925,6 +930,7 @@
}
\cs_new_protected:Npn \__nicematrix_begin_of_row:
{
+ \tl_gclear:N \g__nicematrix_row_style_tl
\int_gincr:N \c@iRow
\dim_gset_eq:NN \g__nicematrix_dp_ante_last_row_dim \g__nicematrix_dp_last_row_dim
\dim_gset:Nn \g__nicematrix_dp_last_row_dim { \box_dp:N \@arstrutbox }
@@ -998,6 +1004,7 @@
{
\__nicematrix_math_toggle_token:
\hbox_set_end:
+ \g__nicematrix_exit_cell_tl
\bool_if:NT \g__nicematrix_rotate_bool \__nicematrix_rotate_cell_box:
\__nicematrix_adjust_size_box:
\box_set_ht:Nn \l__nicematrix_cell_box
@@ -1129,8 +1136,8 @@
\str_if_empty:NF \l__nicematrix_name_str
{
\pgfnodealias
- { \l__nicematrix_name_str - row - \int_use:N \c@iRow }
- { \__nicematrix_env: - row - \int_use:N \c@iRow }
+ { \l__nicematrix_name_str - row - \__nicematrix_succ:n \c@iRow }
+ { \__nicematrix_env: - row - \__nicematrix_succ:n \c@iRow }
}
\endpgfpicture
}
@@ -1256,6 +1263,7 @@
\cs_set_eq:NN \CodeAfter \__nicematrix_CodeAfter:
\cs_set_eq:NN \diagbox \__nicematrix_diagbox:nn
\cs_set_eq:NN \NotEmpty \__nicematrix_NotEmpty:
+ \cs_set_eq:NN \RowStyle \__nicematrix_RowStyle:n
\bool_if:NT \l__nicematrix_colortbl_like_bool \__nicematrix_colortbl_like:
\bool_if:NT \l__nicematrix_renew_dots_bool \__nicematrix_renew_dots:
\seq_gclear:N \g__nicematrix_multicolumn_cells_seq
@@ -1337,6 +1345,40 @@
\bool_set_true:N \l__nicematrix_code_before_bool
\__nicematrix_pre_array:
}
+\keys_define:nn { NiceMatrix / RowStyle }
+ {
+ cell-space-top-limit .code:n =
+ {
+ \tl_gput_right:Nn \g__nicematrix_row_style_tl
+ {
+ \tl_gput_right:Nn \g__nicematrix_exit_cell_tl
+ { \dim_set:Nn \l__nicematrix_cell_space_top_limit_dim { #1 } }
+ }
+ } ,
+ cell-space-top-limit .value_required:n = true ,
+ cell-space-bottom-limit .code:n =
+ {
+ \tl_gput_right:Nn \g__nicematrix_row_style_tl
+ {
+ \tl_gput_right:Nn \g__nicematrix_exit_cell_tl
+ { \dim_set:Nn \l__nicematrix_cell_space_bottom_limit_dim { #1 } }
+ }
+ } ,
+ cell-space-bottom-limit .value_required:n = true ,
+ cell-space-limits .meta:n =
+ {
+ cell-space-top-limit = #1 ,
+ cell-space-bottom-limit = #1 ,
+ } ,
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~RowStyle }
+ }
+\NewDocumentCommand \__nicematrix_RowStyle:n { O { } m }
+ {
+ \tl_gset:Nn \g__nicematrix_row_style_tl { #2 }
+ \keys_set:nn { NiceMatrix / RowStyle } { #1 }
+ #2
+ \ignorespaces
+ }
\cs_new_protected:Npn \__nicematrix_pre_code_before:
{
\int_set:Nn \c@iRow { \seq_item:Nn \c__nicematrix_size_seq 2 }
@@ -1479,6 +1521,7 @@
\seq_gclear:N \g__nicematrix_pos_of_stroken_blocks_seq
\seq_gclear:N \g__nicematrix_pos_of_xdots_seq
\tl_gclear_new:N \g__nicematrix_code_before_tl
+ \tl_gclear:N \g__nicematrix_row_style_tl
\bool_gset_false:N \g__nicematrix_aux_found_bool
\tl_if_exist:cT { c__nicematrix _ \int_use:N \g__nicematrix_env_int _ tl }
{
@@ -2152,6 +2195,11 @@
}
\cs_new_protected:Npn \__nicematrix_use_arraybox_with_notes_c:
{
+ \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ {
+ \box_set_wd:Nn \l__nicematrix_the_array_box
+ { \box_wd:N \l__nicematrix_the_array_box - \arraycolsep }
+ }
\begin { minipage } [ t ] { \box_wd:N \l__nicematrix_the_array_box }
\box_use_drop:N \l__nicematrix_the_array_box
\__nicematrix_create_extra_nodes:
@@ -2436,8 +2484,8 @@
}
\int_gset:Nn \g_tmpa_int 1
\bool_if:NTF \g__nicematrix_last_col_found_bool
+ { \prg_replicate:nn { \g__nicematrix_col_total_int - 3 } }
{ \prg_replicate:nn { \g__nicematrix_col_total_int - 2 } }
- { \prg_replicate:nn { \g__nicematrix_col_total_int - 1 } }
{
&
\omit
@@ -2464,15 +2512,51 @@
}
\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 } }
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_skip
+ \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 \l__nicematrix_code_before_bool
+ {
+ \hbox
+ {
+ \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 }
+ \skip_horizontal:N 0.5\arrayrulewidth
+ \bool_lazy_and:nnT \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ { \skip_horizontal:N \arraycolsep }
+ }
+ }
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgfcoordinate { \__nicematrix_env: - col - \__nicematrix_succ:n \g_tmpa_int }
+ {
+ \bool_lazy_and:nnTF \l__nicematrix_Matrix_bool \l__nicematrix_NiceArray_bool
+ {
+ \pgfpoint
+ { - 0.5 \arrayrulewidth - \arraycolsep }
+ \c_zero_dim
+ }
+ { \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 }
+ }
+ \endpgfpicture
\bool_if:NT \g__nicematrix_last_col_found_bool
{
\hbox_overlap_right:n
@@ -2896,6 +2980,8 @@
\dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 }
\dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 }
\pgfnode { __nicematrix_diag_node } { center } { } { \__nicematrix_env: - ##1 } { }
+ \str_if_empty:NF \l__nicematrix_name_str
+ { \pgfnodealias { \l__nicematrix_name_str - ##1 } { \__nicematrix_env: - ##1 } }
}
\int_set:Nn \l_tmpa_int { \int_max:nn \c@iRow \c@jCol + 1 }
\__nicematrix_qpoint:n { row - \int_min:nn { \l_tmpa_int } { \c@iRow + 1 } }
@@ -2906,6 +2992,15 @@
\pgfnodealias
{ \__nicematrix_env: - last }
{ \__nicematrix_env: - \int_eval:n { \int_max:nn \c@iRow \c@jCol + 1 } }
+ \str_if_empty:NF \l__nicematrix_name_str
+ {
+ \pgfnodealias
+ { \l__nicematrix_name_str - \int_use:N \l_tmpa_int }
+ { \__nicematrix_env: - \int_use:N \l_tmpa_int }
+ \pgfnodealias
+ { \l__nicematrix_name_str - last }
+ { \__nicematrix_env: - last }
+ }
\endpgfpicture
}
\cs_new_protected:Npn \__nicematrix_find_extremities_of_line:nnnn #1 #2 #3 #4
@@ -5173,6 +5268,7 @@
\tl_if_empty:NTF \l__nicematrix_color_tl
{ \int_compare:nNnT { #2 } = 1 \set@color }
{ \color { \l__nicematrix_color_tl } }
+ \int_compare:nNnT { #1 } = 1 \g__nicematrix_row_style_tl
\group_begin:
\cs_set:Npn \arraystretch { 1 }
\dim_set_eq:NN \extrarowheight \c_zero_dim
@@ -5376,27 +5472,27 @@
\seq_gput_left:Nn \g__nicematrix_pos_of_blocks_seq { { #1 } { #2 } { #3 } { #4 } }
\group_begin:
\keys_set:nn { NiceMatrix / Block / SecondPass } { #5 }
- \tl_if_empty:NF \l__nicematrix_draw_tl
+ \bool_if:NT \l__nicematrix_hvlines_block_bool
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
- \__nicematrix_stroke_block:nnn
+ \__nicematrix_hvlines_block:nnn
{ \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
- \seq_gput_right:Nn \g__nicematrix_pos_of_stroken_blocks_seq
- { { #1 } { #2 } { #3 } { #4 } }
}
- \bool_if:NT \l__nicematrix_hvlines_block_bool
+ \tl_if_empty:NF \l__nicematrix_draw_tl
{
\tl_gput_right:Nx \g_nicematrix_code_after_tl
{
- \__nicematrix_hvlines_block:nnn
+ \__nicematrix_stroke_block:nnn
{ \exp_not:n { #5 } }
{ #1 - #2 }
{ \int_use:N \l__nicematrix_last_row_int - \int_use:N \l__nicematrix_last_col_int }
}
+ \seq_gput_right:Nn \g__nicematrix_pos_of_stroken_blocks_seq
+ { { #1 } { #2 } { #3 } { #4 } }
}
\clist_if_empty:NF \l__nicematrix_borders_clist
{
@@ -5795,7 +5891,7 @@
{
\exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
{ * { \int_use:N \l__nicematrix_nb_cols_int } { \l__nicematrix_type_of_col_tl } }
- [ \l_tmpa_tl ]
+ [ \exp_not:V \l_tmpa_tl ]
}
\int_compare:nNnT \l__nicematrix_first_row_int = 0
{
@@ -6062,12 +6158,18 @@
{ \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] }
}
}
-\NewDocumentCommand \__nicematrix_SubMatrix { m m m m O { } }
+\AtBeginDocument
{
- \peek_remove_spaces:n
- { \__nicematrix_sub_matrix:nnnnn { #1 } { #2 } { #3 } { #4 } { #5 } }
- }
-\cs_new_protected:Npn \__nicematrix_sub_matrix:nnnnn #1 #2 #3 #4 #5
+ \tl_set:Nn \l__nicematrix_argspec_tl { m m m m O { } E { _ ^ } { { } { } } }
+ \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl
+ \exp_args:NNV \NewDocumentCommand \__nicematrix_SubMatrix \l__nicematrix_argspec_tl
+ {
+ \peek_remove_spaces:n
+ { \__nicematrix_sub_matrix:nnnnnnn
+ { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } }
+ }
+ }
+\cs_new_protected:Npn \__nicematrix_sub_matrix:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\group_begin:
\tl_clear_new:N \l__nicematrix_first_i_tl
@@ -6117,13 +6219,13 @@
{
\dim_compare:nNnTF \l__nicematrix_x_final_dim = { - \c_max_dim }
{ \__nicematrix_error:nn { impossible~delimiter } { right } }
- { \__nicematrix_sub_matrix_i:nn { #1 } { #4 } }
+ { \__nicematrix_sub_matrix_i:nnnn { #1 } { #4 } { #6 } { #7 } }
}
\endpgfpicture
}
\group_end:
}
-\cs_new_protected:Npn \__nicematrix_sub_matrix_i:nn #1 #2
+\cs_new_protected:Npn \__nicematrix_sub_matrix_i:nnnn #1 #2 #3 #4
{
\__nicematrix_qpoint:n { row - \l__nicematrix_first_i_tl - base }
\dim_set:Nn \l__nicematrix_y_initial_dim
@@ -6250,9 +6352,10 @@
{ ( \l__nicematrix_y_initial_dim + \l__nicematrix_y_final_dim ) / 2 }
}
\str_if_empty:NTF \l__nicematrix_submatrix_name_str
- { \__nicematrix_node_right:nn #2 { } }
+ { \__nicematrix_node_right:nnnn #2 { } { #3 } { #4 } }
{
- \__nicematrix_node_right:nn #2 { \__nicematrix_env: - \l__nicematrix_submatrix_name_str - right }
+ \__nicematrix_node_right:nnnn #2
+ { \__nicematrix_env: - \l__nicematrix_submatrix_name_str - right } { #3 } { #4 }
}
\cs_set_eq:NN \pgfpointanchor \__nicematrix_pgfpointanchor:n
\flag_clear_new:n { nicematrix }
@@ -6324,7 +6427,7 @@
{ #2 }
{ }
}
-\cs_new_protected:Npn \__nicematrix_node_right:nn #1 #2
+\cs_new_protected:Npn \__nicematrix_node_right:nnnn #1 #2 #3 #4
{
\pgfnode
{ rectangle }
@@ -6343,6 +6446,8 @@
\@width \c_zero_dim
}
\right #1
+ \tl_if_empty:nF { #3 } { _ { \smash { #3 } } }
+ ^ { \smash { #4 } }
\c_math_toggle_token
}
{ #2 }
@@ -6350,7 +6455,7 @@
}
\bool_new:N \c__nicematrix_footnotehyper_bool
\bool_new:N \c__nicematrix_footnote_bool
-\__nicematrix_msg_new:nnn { Unknown~option~for~package }
+\__nicematrix_msg_new:nnn { Unknown~key~for~package }
{
The~key~'\l_keys_key_str'~is~unknown. \\
If~you~go~on,~it~will~be~ignored. \\
@@ -6394,7 +6499,7 @@
transparent .value_forbidden:n = true,
footnote .bool_set:N = \c__nicematrix_footnote_bool ,
footnotehyper .bool_set:N = \c__nicematrix_footnotehyper_bool ,
- unknown .code:n = \__nicematrix_error:n { Unknown~option~for~package }
+ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~package }
}
\ProcessKeysOptions { NiceMatrix / Package }
\__nicematrix_msg_new:nn { footnote~with~footnotehyper~package }
@@ -6540,10 +6645,16 @@
}
\__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~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.
}
+\__nicematrix_msg_new:nn { Unknown~key~for~RowStyle }
+ {
+ As~for~now,~there~is~only~three~keys~available~here:~'cell-space-top-limit',~
+ 'cell-space-bottom-limit~and~'cell-space-limits'~(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 }
{
As~for~now,~there~is~only~two~keys~available~here:~'cols'~and~'respect-blocks'~
@@ -6848,7 +6959,7 @@
vlines,~
xdots~(several~subkeys).
}
-\__nicematrix_msg_new:nnn { Unknown~option~for~NiceArray }
+\__nicematrix_msg_new:nnn { Unknown~key~for~NiceArray }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceArray\}. \\
@@ -6900,7 +7011,7 @@
xdots/shorten~and~
xdots/line-style.
}
-\__nicematrix_msg_new:nnn { Unknown~option~for~NiceMatrix }
+\__nicematrix_msg_new:nnn { Unknown~key~for~NiceMatrix }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~
\__nicematrix_full_name_env:. \\
@@ -6951,7 +7062,7 @@
xdots/shorten~and~
xdots/line-style.
}
-\__nicematrix_msg_new:nnn { Unknown~option~for~NiceTabular }
+\__nicematrix_msg_new:nnn { Unknown~key~for~NiceTabular }
{
The~key~'\l_keys_key_str'~is~unknown~for~the~environment~
\{NiceTabular\}. \\