summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nicematrix
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-30 21:29:09 +0000
committerKarl Berry <karl@freefriends.org>2020-06-30 21:29:09 +0000
commit39e1b29fb6805f0ed171d8547196bb3a20b94838 (patch)
tree38385550e12c63da124776bb2c4d556555447829 /Master/texmf-dist/tex/latex/nicematrix
parent5e414716e2db683d25868668a82195c6229aedd1 (diff)
nicematrix (30jun20)
git-svn-id: svn://tug.org/texlive/trunk@55710 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicematrix')
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty183
1 files changed, 157 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index d286a1bb15c..70dedcb495c 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{4.3}
-\def\myfiledate{2020/06/12}
+\def\myfileversion{4.4}
+\def\myfiledate{2020/06/30}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
\RequirePackage{l3keys2e}
@@ -323,6 +323,7 @@
\bool_new:N \l__nicematrix_hlines_bool
\bool_new:N \l__nicematrix_vlines_bool
\bool_new:N \l__nicematrix_hvlines_bool
+\bool_new:N \l__nicematrix_hvlines_except_corners_bool
\bool_new:N \l__nicematrix_nullify_dots_bool
\bool_new:N \l__nicematrix_auto_columns_width_bool
\str_new:N \l__nicematrix_name_str
@@ -418,6 +419,8 @@
}
\keys_define:nn { NiceMatrix / Env }
{
+ hvlines-except-corners .bool_set:N = \l__nicematrix_hvlines_except_corners_bool ,
+ hvlines-except-corners .default:n = true ,
code-before .code:n =
{
\tl_if_empty:nF { #1 }
@@ -1771,6 +1774,8 @@
{
\bool_if:NT \l__nicematrix_hlines_bool \__nicematrix_draw_hlines:
\bool_if:NT \l__nicematrix_vlines_bool \__nicematrix_draw_vlines:
+ \bool_if:NT \l__nicematrix_hvlines_except_corners_bool
+ \__nicematrix_draw_hvlines_except_corners:
}
\cs_set_eq:NN \ialign \__nicematrix_old_ialign:
\seq_if_empty:NF \g__nicematrix_blocks_seq \__nicematrix_draw_blocks:
@@ -3076,27 +3081,10 @@
{
\group_begin:
\CT@arc@
- \bool_if:NT \l__nicematrix_NiceArray_bool
- {
- \pgfpicture
- \pgfrememberpicturepositiononpagetrue
- \pgf@relevantforpicturesizefalse
- \pgfsetlinewidth \arrayrulewidth
- \pgfsetrectcap
- \__nicematrix_qpoint:n { col - 1 }
- \dim_set_eq:NN \l_tmpa_dim \pgf@x
- \__nicematrix_qpoint:n { row -1 }
- \dim_set_eq:NN \l_tmpb_dim \pgf@y
- \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \c@jCol }
- \dim_set_eq:NN \l_tmpc_dim \pgf@x
- \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \c@iRow }
- \pgfpathrectanglecorners
- { \pgfpoint \l_tmpa_dim \l_tmpb_dim }
- { \pgfpoint \l_tmpc_dim \pgf@y }
- \pgfusepathqstroke
- \endpgfpicture
- }
- \int_step_variable:nnNn 2 \c@iRow \l_tmpa_tl
+ \int_step_variable:nnNn
+ { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 }
+ { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c@iRow } \c@iRow }
+ \l_tmpa_tl
{
\int_step_variable:nNn \c@jCol \l_tmpb_tl
{
@@ -3105,6 +3093,31 @@
{ \__nicematrix_test_if_hline_in_block:nnnn ##1 }
\seq_map_inline:Nn \g__nicematrix_pos_of_xdots_seq
{ \__nicematrix_test_if_hline_in_block:nnnn ##1 }
+ \bool_if:NT \l__nicematrix_hvlines_except_corners_bool
+ {
+ \int_compare:nNnTF \l_tmpa_tl = { \c@iRow + 1 }
+ {
+ \seq_if_in:NxT
+ \l__nicematrix_empty_corner_cells_seq
+ { \__nicematrix_pred:n \l_tmpa_tl - \l_tmpb_tl }
+ { \bool_set_false:N \g_tmpa_bool }
+ }
+ {
+ \seq_if_in:NxT
+ \l__nicematrix_empty_corner_cells_seq
+ { \l_tmpa_tl - \l_tmpb_tl }
+ {
+ \int_compare:nNnTF \l_tmpa_tl = 1
+ { \bool_set_false:N \g_tmpa_bool }
+ {
+ \seq_if_in:NxT
+ \l__nicematrix_empty_corner_cells_seq
+ { \__nicematrix_pred:n \l_tmpa_tl - \l_tmpb_tl }
+ { \bool_set_false:N \g_tmpa_bool }
+ }
+ }
+ }
+ }
\bool_if:NT \g_tmpa_bool
{
\pgfpicture
@@ -3127,13 +3140,41 @@
}
\int_step_variable:nNn \c@iRow \l_tmpa_tl
{
- \int_step_variable:nnNn 2 \c@jCol \l_tmpb_tl
+ \int_step_variable:nnNn
+ { \bool_if:NTF \l__nicematrix_NiceArray_bool 1 2 }
+ { \bool_if:NTF \l__nicematrix_NiceArray_bool { \__nicematrix_succ:n \c@jCol } \c@jCol }
+ \l_tmpb_tl
{
\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 }
\seq_map_inline:Nn \g__nicematrix_pos_of_xdots_seq
{ \__nicematrix_test_if_vline_in_block:nnnn ##1 }
+ \bool_if:NT \l__nicematrix_hvlines_except_corners_bool
+ {
+ \int_compare:nNnTF \l_tmpb_tl = { \__nicematrix_succ:n \c@jCol }
+ {
+ \seq_if_in:NxT
+ \l__nicematrix_empty_corner_cells_seq
+ { \l_tmpa_tl - \__nicematrix_pred:n \l_tmpb_tl }
+ { \bool_set_false:N \g_tmpa_bool }
+ }
+ {
+ \seq_if_in:NxT
+ \l__nicematrix_empty_corner_cells_seq
+ { \l_tmpa_tl - \l_tmpb_tl }
+ {
+ \int_compare:nNnTF \l_tmpb_tl = 1
+ { \bool_set_false:N \g_tmpa_bool }
+ {
+ \seq_if_in:NxT
+ \l__nicematrix_empty_corner_cells_seq
+ { \l_tmpa_tl - \__nicematrix_pred:n \l_tmpb_tl }
+ { \bool_set_false:N \g_tmpa_bool }
+ }
+ }
+ }
+ }
\bool_if:NT \g_tmpa_bool
{
\pgfpicture
@@ -3157,7 +3198,7 @@
\group_end:
\seq_gclear:N \g__nicematrix_pos_of_xdots_seq
}
-\cs_set_protected:Npn \__nicematrix_test_if_hline_in_block:nnnn #1 #2 #3 #4
+\cs_new_protected:Npn \__nicematrix_test_if_hline_in_block:nnnn #1 #2 #3 #4
{
\int_compare:nNnT \l_tmpa_tl > { #1 }
{
@@ -3171,7 +3212,7 @@
}
}
}
-\cs_set_protected:Npn \__nicematrix_test_if_vline_in_block:nnnn #1 #2 #3 #4
+\cs_new_protected:Npn \__nicematrix_test_if_vline_in_block:nnnn #1 #2 #3 #4
{
\int_compare:nNnT \l_tmpa_tl > { #1 - 1 }
{
@@ -3185,6 +3226,95 @@
}
}
}
+\cs_new_protected:Npn \__nicematrix_draw_hvlines_except_corners:
+ {
+ \seq_clear_new:N \l__nicematrix_empty_corner_cells_seq
+ \__nicematrix_compute_a_corner:nnnnnn 1 1 1 1 \c@iRow \c@jCol
+ \__nicematrix_compute_a_corner:nnnnnn 1 \c@jCol 1 { -1 } \c@iRow 1
+ \__nicematrix_compute_a_corner:nnnnnn \c@iRow 1 { -1 } 1 1 \c@jCol
+ \__nicematrix_compute_a_corner:nnnnnn \c@iRow \c@jCol { -1 } { -1 } 1 1
+ \__nicematrix_draw_hvlines_ii:
+ }
+\cs_new_protected:Npn \__nicematrix_compute_a_corner:nnnnnn #1 #2 #3 #4 #5 #6
+ {
+ \bool_set_false:N \l_tmpa_bool
+ \int_zero_new:N \l__nicematrix_last_empty_row_int
+ \int_step_inline:nnnn { #1 } { #3 } { #5 }
+ {
+ \__nicematrix_test_if_cell_in_a_block:nx { ##1 } { \int_eval:n { #2 } }
+ \bool_if:nTF
+ {
+ \cs_if_exist_p:c
+ { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - \int_eval:n { #2 } }
+ ||
+ \l_tmpb_bool
+ }
+ { \bool_set_true:N \l_tmpa_bool }
+ {
+ \bool_if:NF \l_tmpa_bool
+ { \int_set:Nn \l__nicematrix_last_empty_row_int { ##1 } }
+ }
+ }
+ \bool_set_false:N \l_tmpa_bool
+ \int_zero_new:N \l__nicematrix_last_empty_column_int
+ \int_step_inline:nnnn { #2 } { #4 } { #6 }
+ {
+ \__nicematrix_test_if_cell_in_a_block:xn { \int_eval:n { #1 } } { ##1 }
+ \bool_if:nTF
+ {
+ \cs_if_exist_p:c
+ { pgf @ sh @ ns @ \__nicematrix_env: - \int_eval:n { #1 } - ##1 }
+ || \l_tmpb_bool
+ }
+ { \bool_set_true:N \l_tmpa_bool }
+ {
+ \bool_if:NF \l_tmpa_bool
+ { \int_set:Nn \l__nicematrix_last_empty_column_int { ##1 } }
+ }
+ }
+ \int_step_inline:nnnn { #1 } { #3 } \l__nicematrix_last_empty_row_int
+ {
+ \bool_set_false:N \l_tmpa_bool
+ \int_step_inline:nnnn { #2 } { #4 } \l__nicematrix_last_empty_column_int
+ {
+ \__nicematrix_test_if_cell_in_a_block:nn { ##1 } { ####1 }
+ \bool_if:nTF
+ {
+ \cs_if_exist_p:c
+ { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - ####1 }
+ || \l_tmpb_bool
+ }
+ { \bool_set_true:N \l_tmpa_bool }
+ {
+ \bool_if:NF \l_tmpa_bool
+ {
+ \int_set:Nn \l__nicematrix_last_empty_column_int { ####1 }
+ \seq_put_right:Nn
+ \l__nicematrix_empty_corner_cells_seq
+ { ##1 - ####1 }
+ }
+ }
+ }
+ }
+ }
+\cs_new_protected:Npn \__nicematrix_test_if_cell_in_a_block:nn #1 #2
+ {
+ \bool_set_false:N \l_tmpb_bool
+ \seq_map_inline:Nn \g__nicematrix_pos_of_blocks_seq
+ { \__nicematrix_test_if_cell_in_block:nnnnnnn { #1 } { #2 } ##1 }
+ }
+\cs_generate_variant:Nn \__nicematrix_test_if_cell_in_a_block:nn { nx , xn }
+\cs_new_protected:Npn \__nicematrix_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6
+ {
+ \bool_if:nT
+ {
+ \int_compare_p:n { #3 <= #1 }
+ && \int_compare_p:n { #1 <= #5 }
+ && \int_compare_p:n { #4 <= #2 }
+ && \int_compare_p:n { #2 <= #6 }
+ }
+ { \bool_set_true:N \l_tmpb_bool }
+ }
\cs_new:Npn \__nicematrix_hdottedline:
{
\noalign { \skip_vertical:N 2\l__nicematrix_radius_dim }
@@ -3944,6 +4074,7 @@
first-row,~
hlines,~
hvlines,~
+ hvlines-except-corners,~
last-col,~
last-row,~
left-margin,~