diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicematrix')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 117 |
1 files changed, 75 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index a11a958ad7b..e51cb549e77 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{1.1} -\def\myfiledate{2018/02/26} +\def\myfileversion{1.2} +\def\myfiledate{2018/03/11} \RequirePackage{l3keys2e} \ProvidesExplPackage {nicematrix} @@ -42,6 +42,7 @@ \cs_new_protected:Nn \__nm_multicolumn:nn {\msg_error:nn {nicematrix} {multicolumn~forbidden}} \int_new:N \g__nm_env_int +\bool_new:N \l__nm_exterior_arraycolsep_bool \bool_new:N \l__nm_parallelize_diags_bool \bool_set_true:N \l__nm_parallelize_diags_bool \bool_new:N \l__nm_nullify_dots_bool @@ -58,16 +59,18 @@ Transparent .value_forbidden:n = true, NullifyDots .bool_set:N = \l__nm_nullify_dots_bool , NullifyDots .default:n = true, - Silent .code:n = {\msg_redirect_name:nnn {nicematrix} + Silent .code:n = {\msg_redirect_name:nnn {nicematrix} {Impossible~instruction} {none}} , - Silent .value_forbidden:n = true} + Silent .value_forbidden:n = true} \NewDocumentCommand \NiceMatrixOptions {m} {\keys_set:nn {NiceMatrix} {#1}} -\cs_new_protected:Nn \__nm_Cell: - { +\keys_define:nn {NiceArray} + {exterior-arraycolsep .bool_set:N = \l__nm_exterior_arraycolsep_bool , + exterior-arraycolsep .default:n = true} +\cs_new_protected:Nn \__nm_Cell:n + { \tl_gput_right:Nn \g__nm_preamble_aux_tl {#1} \int_gincr:N \g__nm_column_int - \int_gset:Nn \g__nm_nb_column_int {\int_max:nn \g__nm_nb_column_int \g__nm_column_int} \tikz[remember~picture, inner~sep = 0pt, minimum~width = 0pt, baseline] \node [anchor=base] (nm-\int_use:N \g__nm_env_int- \int_use:N \g__nm_line_int- @@ -75,42 +78,58 @@ \bgroup $} % $ \cs_new_protected:Nn \__nm_end_Cell: {$\egroup ;} % $ -\cs_new_protected:Nn \__nm_Cell_First_Column: - {\int_gincr:N \g__nm_line_int - \int_gset:Nn \g__nm_column_int 0 - \__nm_Cell:} \NewDocumentEnvironment {NiceMatrix} {} - { - \aftergroup \__nm_draw_lines: - \cs_set_eq:NN \Ldots \__nm_Ldots - \cs_set_eq:NN \Cdots \__nm_Cdots - \cs_set_eq:NN \Vdots \__nm_Vdots - \cs_set_eq:NN \Ddots \__nm_Ddots - \cs_set_eq:NN \Iddots \__nm_Iddots - \cs_set_eq:NN \Hspace \__nm_Hspace: - \cs_set_eq:NN \NiceMatrixEndPoint \__nm_NiceMatrixEndPoint: - \bool_if:NF \l__nm_renew_matrix_bool - {\cs_set_eq:NN \multicolumn \__nm_multicolumn:nn} - \bool_if:NT \l__nm_renew_dots_bool - {\cs_set_eq:NN \ldots \__nm_Ldots - \cs_set_eq:NN \cdots \__nm_Cdots - \cs_set_eq:NN \vdots \__nm_Vdots - \cs_set_eq:NN \ddots \__nm_Ddots - \cs_set_eq:NN \iddots \__nm_Iddots - \cs_set_eq:NN \dots \__nm_Ldots} + {\bool_set_false:N \l__nm_exterior_arraycolsep_bool + \NiceArray{*\c@MaxMatrixCols{C}}} + {\endarray + \skip_horizontal:n {-\arraycolsep}} +\NewDocumentEnvironment {NiceArray} {O{} m} + {\aftergroup \__nm_draw_lines: + \keys_set_known:nnN {NiceArray} {#1} \l_tmpa_tl + \cs_set:Npn \ialign + {\everycr{\noalign{\int_gincr:N \g__nm_line_int + \int_gzero:N \g__nm_column_int + \int_compare:nNnT {\tl_count:N \g__nm_preamble_aux_tl} + > {\tl_count:N \g__nm_preamble_tl} + {\tl_gset_eq:NN \g__nm_preamble_tl \g__nm_preamble_aux_tl} + \tl_gclear:N \g__nm_preamble_aux_tl}} + \skip_zero:N \tabskip + \cs_set:Npn \ialign {\everycr{} + \skip_zero:N \tabskip + \halign} + \halign} + \newcolumntype{L}{>{\__nm_Cell:n l}l<{\__nm_end_Cell:}} + \newcolumntype{C}{>{\__nm_Cell:n c}c<{\__nm_end_Cell:}} + \newcolumntype{R}{>{\__nm_Cell:n r}r<{\__nm_end_Cell:}} + \cs_set_eq:NN \Ldots \__nm_Ldots + \cs_set_eq:NN \Cdots \__nm_Cdots + \cs_set_eq:NN \Vdots \__nm_Vdots + \cs_set_eq:NN \Ddots \__nm_Ddots + \cs_set_eq:NN \Iddots \__nm_Iddots + \cs_set_eq:NN \Hspace \__nm_Hspace: + \cs_set_eq:NN \NiceMatrixEndPoint \__nm_NiceMatrixEndPoint: + \bool_if:NT \l__nm_renew_dots_bool + {\cs_set_eq:NN \ldots \__nm_Ldots + \cs_set_eq:NN \cdots \__nm_Cdots + \cs_set_eq:NN \vdots \__nm_Vdots + \cs_set_eq:NN \ddots \__nm_Ddots + \cs_set_eq:NN \iddots \__nm_Iddots} + \bool_if:NF \l__nm_renew_matrix_bool + {\cs_set_eq:NN \multicolumn \__nm_multicolumn:nn} \int_gincr:N \g__nm_env_int + \tl_clear_new:N \g__nm_preamble_tl + \tl_clear_new:N \g__nm_preamble_aux_tl \seq_gclear_new:N \g__nm_empty_cells_seq \int_gzero_new:N \g__nm_instruction_int \int_gzero_new:N \g__nm_line_int \int_gzero_new:N \g__nm_column_int - \int_gzero_new:N \g__nm_nb_column_int - \hskip -\arraycolsep \cs_set_eq:NN \@ifnextchar \new@ifnextchar - \int_set:Nn \l_tmpa_int {\c@MaxMatrixCols - 1} - \array{>{\__nm_Cell_First_Column:}c<{\__nm_end_Cell:} - *\l_tmpa_int{>{\__nm_Cell:}c<{\__nm_end_Cell:}}}} - {\endarray - \hskip -\arraycolsep} + \bool_if:NF \l__nm_exterior_arraycolsep_bool + {\skip_horizontal:n {-\arraycolsep}} + \array[\l_tmpa_tl]{#2}} + {\endarray + \bool_if:NF \l__nm_exterior_arraycolsep_bool + {\skip_horizontal:n {-\arraycolsep}}} \NewDocumentEnvironment {pNiceMatrix} {} {\left(\begin{NiceMatrix}} {\end{NiceMatrix}\right)} @@ -161,7 +180,10 @@ } \cs_new_protected:Nn \__nm_draw_lines: - { + {\int_compare:nNnT {\tl_count:N \g__nm_preamble_aux_tl} + > {\tl_count:N \g__nm_preamble_tl} + {\tl_set_eq:NN \g__nm_preamble_tl \g__nm_preamble_aux_tl} + \int_set:Nn \g__nm_column_int {\tl_count:N \g__nm_preamble_tl} \seq_clear_new:N \l__nm_yet_drawn_seq \int_zero_new:N \l__nm_type_int \int_zero_new:N \l__nm_line_int @@ -215,7 +237,7 @@ \bool_if:nTF { \int_compare_p:nNn \l__nm_final_i_int < 1 || \int_compare_p:nNn \l__nm_final_i_int > \g__nm_line_int || \int_compare_p:nNn \l__nm_final_j_int < 1 - || \int_compare_p:nNn \l__nm_final_j_int > \g__nm_nb_column_int} + || \int_compare_p:nNn \l__nm_final_j_int > \g__nm_column_int} {\bool_set_true:N \l__nm_impossible_instruction_bool \bool_set_true:N \l__nm_stop_loop_bool} {\__nm_if_not_empty_cell:nnT \l__nm_final_i_int \l__nm_final_j_int @@ -233,7 +255,7 @@ { \int_compare_p:nNn \l__nm_initial_i_int < 1 || \int_compare_p:nNn \l__nm_initial_i_int > \g__nm_line_int || \int_compare_p:nNn \l__nm_initial_j_int < 1 - || \int_compare_p:nNn \l__nm_initial_j_int > \g__nm_nb_column_int} + || \int_compare_p:nNn \l__nm_initial_j_int > \g__nm_column_int} {\bool_set_true:N \l__nm_impossible_instruction_bool \bool_set_true:N \l__nm_stop_loop_bool} {\__nm_if_not_empty_cell:nnT \l__nm_initial_i_int \l__nm_initial_j_int @@ -269,9 +291,9 @@ \dim_gset:Nn \g__nm_x_initial_dim \pgf@x \dim_gset:Nn \g__nm_y_initial_dim \pgf@y \tikz@parse@node\pgfutil@firstofone - (nm-\int_use:N \g__nm_env_int- - \int_use:N \l__nm_final_i_int- - \int_use:N \l__nm_final_j_int.#2) + (nm-\int_use:N \g__nm_env_int- + \int_use:N \l__nm_final_i_int- + \int_use:N \l__nm_final_j_int.#2) \dim_gset:Nn \g__nm_x_final_dim \pgf@x \dim_gset:Nn \g__nm_y_final_dim \pgf@y \end{tikzpicture} } @@ -283,6 +305,17 @@ \__nm_draw_tikz_line:} \cs_new_protected:Nn \__nm_draw_vdots_line: {\__nm_retrieve_coords:nn {south} {north} + \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \g__nm_preamble_tl \l__nm_initial_j_int} + \tl_set:Nn \l_tmpb_tl {l} + \tl_if_eq:NNT \l_tmpa_tl \l_tmpb_tl + {\dim_set:Nn \l_tmpa_dim {\dim_min:nn \g__nm_x_initial_dim \g__nm_x_final_dim} + \dim_set_eq:NN \g__nm_x_initial_dim \l_tmpa_dim + \dim_set_eq:NN \g__nm_x_final_dim \l_tmpa_dim} + \tl_set:Nn \l_tmpb_tl {r} + \tl_if_eq:NNT \l_tmpa_tl \l_tmpb_tl + {\dim_set:Nn \l_tmpa_dim {\dim_max:nn \g__nm_x_initial_dim \g__nm_x_final_dim} + \dim_set_eq:NN \g__nm_x_initial_dim \l_tmpa_dim + \dim_set_eq:NN \g__nm_x_final_dim \l_tmpa_dim} \__nm_draw_tikz_line:} \cs_new_protected:Nn \__nm_draw_ddots_line: {\__nm_retrieve_coords:nn {south~east} {north~west} |