diff options
author | Karl Berry <karl@freefriends.org> | 2018-10-29 20:24:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-10-29 20:24:37 +0000 |
commit | f881cafce2416c2aee9afdfe9b50cb1040d67491 (patch) | |
tree | 01800e43b8d134adef79a510d4d8d6c815f17b2a /Master | |
parent | 515ed4cebfe8abbbffcefe812bf230fecc742b9c (diff) |
nicematrix (29oct18)
git-svn-id: svn://tug.org/texlive/trunk@49017 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf | bin | 373723 -> 377265 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 53 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 1243 |
4 files changed, 660 insertions, 638 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/README.md b/Master/texmf-dist/doc/latex/nicematrix/README.md index e25ae7d342a..39cc99c2853 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/README.md +++ b/Master/texmf-dist/doc/latex/nicematrix/README.md @@ -18,7 +18,7 @@ The package `nicematrix` is present in the distributions MiKTeX, TeXLive and Mac For a manual installation: -* put the files `nicematrix.ins` dans `nicematrix.dtx` in the same directory; +* put the files `nicematrix.ins` and `nicematrix.dtx` in the same directory; * run `latex nicematrix.ins`. The file `nicematrix.sty` will be generated. diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf Binary files differindex 067d1339fc2..2aed8722c97 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index 5069c020944..4179d74c84e 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{2.1.2} -\def\myfiledate{2018/10/05} +\def\myfileversion{2.1.3} +\def\myfiledate{2018/10/29} % % %<*batchfile> @@ -44,7 +44,7 @@ version 2005/12/01 or later. \endgroup %</batchfile> % -%<@@=nm> +%<@@=nicem> %<*driver> \documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix) \VerbatimFootnotes @@ -1929,9 +1929,9 @@ version 2005/12/01 or later. % \subsection{Technical definitions} % % \begin{macrocode} -\cs_new_protected:Nn \@@_msg_error:n +\cs_new_protected:Nn \@@_error:n {\msg_error:nn {nicematrix} {#1}} -\cs_new_protected:Nn \@@_msg_error:nn +\cs_new_protected:Nn \@@_error:nn {\msg_error:nn {nicematrix} {#1} {#2}} % \end{macrocode} % @@ -2165,7 +2165,7 @@ version 2005/12/01 or later. % In |\NiceMatrixOptions|, the special value |auto| is not available. % \begin{macrocode} columns-width .code:n = \str_if_eq:nnTF {#1} {auto} - {\@@_msg_error:n {Option~auto~for~columns-width}} + {\@@_error:n {Option~auto~for~columns-width}} {\dim_set:Nn \l_@@_columns_width_dim {#1}}, % \end{macrocode} % @@ -2186,7 +2186,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} - unknown .code:n = \@@_msg_error:n {Unknown~key~for~NiceMatrixOptions}} + unknown .code:n = \@@_error:n {Unknown~key~for~NiceMatrixOptions}} % \end{macrocode} % \begin{macrocode} \msg_new:nnnn {nicematrix} @@ -2241,7 +2241,7 @@ version 2005/12/01 or later. \l_@@_auto_columns_width_bool} {\dim_set:Nn \l_@@_columns_width_dim {#1}}, name .code:n = {\seq_if_in:NnTF \g_@@_names_seq {#1} - {\@@_msg_error:nn {Duplicate~name} {#1}} + {\@@_error:nn {Duplicate~name} {#1}} {\seq_gput_left:Nn \g_@@_names_seq {#1}} \tl_set:Nn \l_@@_name_tl {#1}}, name .value_required:n = true, @@ -2264,7 +2264,7 @@ version 2005/12/01 or later. right-margin .default:n = \arraycolsep, extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim, extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim, - unknown .code:n = \@@_msg_error:n {Unknown~option~for~NiceMatrix}} + unknown .code:n = \@@_error:n {Unknown~option~for~NiceMatrix}} % \end{macrocode} % % \begin{macrocode} @@ -2315,7 +2315,7 @@ version 2005/12/01 or later. {\dim_set:Nn \l_@@_columns_width_dim {#1}}, columns-width .value_required:n = true, name .code:n = {\seq_if_in:NnTF \g_@@_names_seq {#1} - {\@@_msg_error:nn {Duplicate~name} {#1}} + {\@@_error:nn {Duplicate~name} {#1}} {\seq_gput_left:Nn \g_@@_names_seq {#1}} \tl_set:Nn \l_@@_name_tl {#1}}, name .value_required:n = true, @@ -2339,7 +2339,7 @@ version 2005/12/01 or later. right-margin .default:n = \arraycolsep, extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim, extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim, - unknown .code:n = \@@_msg_error:n {Unknown~option~for~NiceArray}} + unknown .code:n = \@@_error:n {Unknown~option~for~NiceArray}} % \end{macrocode} % % \begin{macrocode} @@ -2534,7 +2534,7 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentEnvironment {NiceArray} {O{} m O{}} {\cs_if_exist:NT \@@_in_NiceArray: - {\@@_msg_error:n {We~are~yet~in~an~environment~NiceArray}} + {\@@_error:n {We~are~yet~in~an~environment~NiceArray}} % \end{macrocode} % We deactivate Tikz externalization (since we use Tikz pictures with the options |overlay| and % |remember picture|, there would be errors). @@ -3010,7 +3010,14 @@ version 2005/12/01 or later. || \int_compare_p:nNn \l_@@_final_j_int < 1 || \int_compare_p:nNn - \l_@@_final_j_int > \g_@@_column_total_int} + \l_@@_final_j_int > \g_@@_column_total_int +% \end{macrocode} +% If you arrive in the column |C| of an environment with such columns (like |{pNiceArrayC}|), you must consider that +% we are \emph{outside} the matrix except if we are drawing a vertical line (included in the column |C|). +% \begin{macrocode} + || \int_compare_p:nNn + \l_@@_final_j_int > \g_@@_column_int + && \int_compare_p:nNn {#4} > 0 } % \end{macrocode} % If we are outside the matrix, we have found the extremity of the dotted line and it's a \emph{open} extremity. % \begin{macrocode} @@ -3608,7 +3615,7 @@ version 2005/12/01 or later. {\dim_set:Nn \l_@@_columns_width_dim {#1}}, columns-width .value_required:n = true, name .code:n = {\seq_if_in:NnTF \g_@@_names_seq {#1} - {\@@_msg_error:nn {Duplicate~name} {#1}} + {\@@_error:nn {Duplicate~name} {#1}} {\seq_gput_left:Nn \g_@@_names_seq {#1}} \tl_set:Nn \l_@@_name_tl {#1}}, name .value_required:n = true, @@ -3623,7 +3630,7 @@ version 2005/12/01 or later. right-margin .default:n = \arraycolsep, extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim, extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim, - unknown .code:n = \@@_msg_error:n {Unknown~option~for~NiceArrayC}} + unknown .code:n = \@@_error:n {Unknown~option~for~NiceArrayC}} % \end{macrocode} % % \begin{macrocode} @@ -3785,7 +3792,7 @@ version 2005/12/01 or later. {\dim_set:Nn \l_@@_columns_width_dim {#1}}, columns-width .value_required:n = true, name .code:n = {\seq_if_in:NnTF \g_@@_names_seq {#1} - {\@@_msg_error:nn {Duplicate~name} {#1}} + {\@@_error:nn {Duplicate~name} {#1}} {\seq_gput_left:Nn \g_@@_names_seq {#1}} \tl_set:Nn \l_@@_name_tl {#1}}, code-after .tl_set:N = \l_@@_code_after_tl, @@ -3797,7 +3804,7 @@ version 2005/12/01 or later. right-margin .default:n = \arraycolsep, extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim, extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim, - unknown .code:n = \@@_msg_error:n {Unknown~option~for~NiceArrayRC}} + unknown .code:n = \@@_error:n {Unknown~option~for~NiceArrayRC}} % \end{macrocode} % % \begin{macrocode} @@ -4202,6 +4209,18 @@ version 2005/12/01 or later. % \subsection{Changes between version 2.1 and 2.1.2} % Option |draft|: with this option, the dotted lines are not drawn (quicker). % +% \subsection{Changes between version 2.1 and 2.1.3} +% When searching the end of a dotted line from a command like |\Cdots| issued in the ``main matrix'' (not in the +% column |C|), the cells in the column |C| are considered as outside the matrix. That means that it's possible to +% do the following matrix with only a |\Cdots| command (and a single |\Vdots|). +% \[\begin{pNiceArrayRC}{wc{5mm}Cwc{5mm}} +% & C_j & \\ +% \mbox{\Large $0$} & \Vdots & \mbox{\Large $0$} \\ +% & \strut a & \Cdots & L_i \\ +% \mbox{\Large $0$} & & \mbox{\Large $0$} \\ +% \end{pNiceArrayRC}\] +% +% % \endinput % Local Variables: % TeX-fold-mode: nil diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index f56c1921546..0774cd78404 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{2.1.2} -\def\myfiledate{2018/10/05} +\def\myfileversion{2.1.3} +\def\myfiledate{2018/10/29} \RequirePackage{tikz} \usetikzlibrary{fit} \RequirePackage{l3keys2e} @@ -28,18 +28,18 @@ {\myfiledate} {\myfileversion} {Several features to improve the typesetting of mathematical matrices with TikZ} -\bool_new:N \c__nm_draft_bool -\DeclareOption {draft} {\bool_set_true:N \c__nm_draft_bool} +\bool_new:N \c__nicem_draft_bool +\DeclareOption {draft} {\bool_set_true:N \c__nicem_draft_bool} \DeclareOption* {} \ProcessOptions \relax \RequirePackage{array} \RequirePackage{amsmath} \RequirePackage{xparse} -\cs_new_protected:Nn \__nm_msg_error:n +\cs_new_protected:Nn \__nicem_error:n {\msg_error:nn {nicematrix} {#1}} -\cs_new_protected:Nn \__nm_msg_error:nn +\cs_new_protected:Nn \__nicem_error:nn {\msg_error:nn {nicematrix} {#1} {#2}} -\cs_new_protected:Nn \__nm_bool_new:N +\cs_new_protected:Nn \__nicem_bool_new:N {\bool_if_exist:NTF #1 {\bool_set_false:N #1} {\bool_new:N #1}} @@ -52,63 +52,63 @@ \raise 7\p@ \vbox{\kern 7pt \hbox{.}} \mkern 1mu}} -\int_new:N \g__nm_env_int -\dim_new:N \l__nm_columns_width_dim -\seq_new:N \g__nm_names_seq -\int_new:N \l__nm_nb_first_row_int -\int_set:Nn \l__nm_nb_first_row_int 1 -\bool_new:N \l__nm_exterior_column_bool -\tl_new:N \l__nm_pos_env_tl -\tl_set:Nn \l__nm_pos_env_tl c -\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 -\bool_new:N \l__nm_auto_columns_width_bool -\tl_new:N \l__nm_code_for_last_col_tl -\tl_new:N \g__nm_name_tl -\tl_new:N \l__nm_name_tl -\bool_new:N \l__nm_extra_nodes_bool -\bool_new:N \g__nm_extra_nodes_bool -\dim_new:N \l__nm_left_margin_dim -\dim_new:N \l__nm_right_margin_dim -\dim_new:N \g__nm_left_margin_dim -\dim_new:N \g__nm_right_margin_dim -\dim_new:N \l__nm_extra_left_margin_dim -\dim_new:N \l__nm_extra_right_margin_dim -\dim_new:N \g__nm_extra_right_margin_dim +\int_new:N \g__nicem_env_int +\dim_new:N \l__nicem_columns_width_dim +\seq_new:N \g__nicem_names_seq +\int_new:N \l__nicem_nb_first_row_int +\int_set:Nn \l__nicem_nb_first_row_int 1 +\bool_new:N \l__nicem_exterior_column_bool +\tl_new:N \l__nicem_pos_env_tl +\tl_set:Nn \l__nicem_pos_env_tl c +\bool_new:N \l__nicem_exterior_arraycolsep_bool +\bool_new:N \l__nicem_parallelize_diags_bool +\bool_set_true:N \l__nicem_parallelize_diags_bool +\bool_new:N \l__nicem_nullify_dots_bool +\bool_new:N \l__nicem_auto_columns_width_bool +\tl_new:N \l__nicem_code_for_last_col_tl +\tl_new:N \g__nicem_name_tl +\tl_new:N \l__nicem_name_tl +\bool_new:N \l__nicem_extra_nodes_bool +\bool_new:N \g__nicem_extra_nodes_bool +\dim_new:N \l__nicem_left_margin_dim +\dim_new:N \l__nicem_right_margin_dim +\dim_new:N \g__nicem_left_margin_dim +\dim_new:N \g__nicem_right_margin_dim +\dim_new:N \l__nicem_extra_left_margin_dim +\dim_new:N \l__nicem_extra_right_margin_dim +\dim_new:N \g__nicem_extra_right_margin_dim \keys_define:nn {NiceMatrix/NiceMatrixOptions} - {parallelize-diags .bool_set:N = \l__nm_parallelize_diags_bool, + {parallelize-diags .bool_set:N = \l__nicem_parallelize_diags_bool, parallelize-diags .default:n = true, ParallelizeDiagonals .meta:n = parallelize-diags, - renew-dots .bool_set:N = \l__nm_renew_dots_bool, + renew-dots .bool_set:N = \l__nicem_renew_dots_bool, renew-dots .default:n = true, RenewDots .meta:n = renew-dots, - renew-matrix .code:n = \__nm_renew_matrix:, + renew-matrix .code:n = \__nicem_renew_matrix:, renew-matrix .value_forbidden:n = true, RenewMatrix .meta:n = renew-matrix, transparent .meta:n = {renew-dots,renew-matrix}, transparent .value_forbidden:n = true, Transparent .meta:n = transparent, - nullify-dots .bool_set:N = \l__nm_nullify_dots_bool , + nullify-dots .bool_set:N = \l__nicem_nullify_dots_bool , nullify-dots .default:n = true, NullifyDots .meta:n = nullify-dots, - code-for-last-col .tl_set:N = \l__nm_code_for_last_col_tl, + code-for-last-col .tl_set:N = \l__nicem_code_for_last_col_tl, code-for-last-col .value_required:n = true, - code-for-first-row .tl_set:N = \l__nm_code_for_first_row_tl, + code-for-first-row .tl_set:N = \l__nicem_code_for_first_row_tl, code-for-first-row .value_required:n = true, - exterior-arraycolsep .bool_set:N = \l__nm_exterior_arraycolsep_bool , + exterior-arraycolsep .bool_set:N = \l__nicem_exterior_arraycolsep_bool , exterior-arraycolsep .default:n = true, columns-width .code:n = \str_if_eq:nnTF {#1} {auto} - {\__nm_msg_error:n {Option~auto~for~columns-width}} - {\dim_set:Nn \l__nm_columns_width_dim {#1}}, - create-extra-nodes .bool_set:N = \l__nm_extra_nodes_bool, + {\__nicem_error:n {Option~auto~for~columns-width}} + {\dim_set:Nn \l__nicem_columns_width_dim {#1}}, + create-extra-nodes .bool_set:N = \l__nicem_extra_nodes_bool, create-extra-nodes .default:n = true, - left-margin .dim_set:N = \l__nm_left_margin_dim, + left-margin .dim_set:N = \l__nicem_left_margin_dim, left-margin .default:n = \arraycolsep, - right-margin .dim_set:N = \l__nm_right_margin_dim, + right-margin .dim_set:N = \l__nicem_right_margin_dim, right-margin .default:n = \arraycolsep, - unknown .code:n = \__nm_msg_error:n {Unknown~key~for~NiceMatrixOptions}} + unknown .code:n = \__nicem_error:n {Unknown~key~for~NiceMatrixOptions}} \msg_new:nnnn {nicematrix} {Unknown~key~for~NiceMatrixOptions} {The~key~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~command~ @@ -132,33 +132,33 @@ \NewDocumentCommand \NiceMatrixOptions {m} {\keys_set:nn {NiceMatrix/NiceMatrixOptions} {#1}} \keys_define:nn {NiceMatrix/NiceMatrix} - {parallelize-diags .bool_set:N = \l__nm_parallelize_diags_bool, + {parallelize-diags .bool_set:N = \l__nicem_parallelize_diags_bool, parallelize-diags .default:n = true, - renew-dots .bool_set:N = \l__nm_renew_dots_bool, + renew-dots .bool_set:N = \l__nicem_renew_dots_bool, renew-dots .default:n = true, - nullify-dots .bool_set:N = \l__nm_nullify_dots_bool , + nullify-dots .bool_set:N = \l__nicem_nullify_dots_bool , nullify-dots .default:n = true, columns-width .code:n = \str_if_eq:nnTF {#1} {auto} {\bool_set_true:N - \l__nm_auto_columns_width_bool} - {\dim_set:Nn \l__nm_columns_width_dim {#1}}, - name .code:n = {\seq_if_in:NnTF \g__nm_names_seq {#1} - {\__nm_msg_error:nn {Duplicate~name} {#1}} - {\seq_gput_left:Nn \g__nm_names_seq {#1}} - \tl_set:Nn \l__nm_name_tl {#1}}, + \l__nicem_auto_columns_width_bool} + {\dim_set:Nn \l__nicem_columns_width_dim {#1}}, + name .code:n = {\seq_if_in:NnTF \g__nicem_names_seq {#1} + {\__nicem_error:nn {Duplicate~name} {#1}} + {\seq_gput_left:Nn \g__nicem_names_seq {#1}} + \tl_set:Nn \l__nicem_name_tl {#1}}, name .value_required:n = true, - code-after .tl_set:N = \l__nm_code_after_tl, + code-after .tl_set:N = \l__nicem_code_after_tl, code-after .initial:n = \c_empty_tl, code-after .value_required:n = true, - create-extra-nodes .bool_set:N = \l__nm_extra_nodes_bool, + create-extra-nodes .bool_set:N = \l__nicem_extra_nodes_bool, create-extra-nodes .default:n = true, - left-margin .dim_set:N = \l__nm_left_margin_dim, + left-margin .dim_set:N = \l__nicem_left_margin_dim, left-margin .default:n = \arraycolsep, - right-margin .dim_set:N = \l__nm_right_margin_dim, + right-margin .dim_set:N = \l__nicem_right_margin_dim, right-margin .default:n = \arraycolsep, - extra-left-margin .dim_set:N = \l__nm_extra_left_margin_dim, - extra-right-margin .dim_set:N = \l__nm_extra_right_margin_dim, - unknown .code:n = \__nm_msg_error:n {Unknown~option~for~NiceMatrix}} + extra-left-margin .dim_set:N = \l__nicem_extra_left_margin_dim, + extra-right-margin .dim_set:N = \l__nicem_extra_right_margin_dim, + unknown .code:n = \__nicem_error:n {Unknown~option~for~NiceMatrix}} \msg_new:nnnn {nicematrix} {Unknown~option~for~NiceMatrix} {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~environment~ @@ -185,38 +185,38 @@ if~you~use~"columns-width=auto".\\ For~a~list~of~the~names~already~used,~type~H~<return>.} {The~names~already~defined~in~this~document~are:~ - \seq_use:Nnnn~\g__nm_names_seq~{,~} {,~} {~and~}.} + \seq_use:Nnnn~\g__nicem_names_seq~{,~} {,~} {~and~}.} \keys_define:nn {NiceMatrix/NiceArray} - {parallelize-diags .bool_set:N = \l__nm_parallelize_diags_bool, + {parallelize-diags .bool_set:N = \l__nicem_parallelize_diags_bool, parallelize-diags .default:n = true, - renew-dots .bool_set:N = \l__nm_renew_dots_bool, + renew-dots .bool_set:N = \l__nicem_renew_dots_bool, renew-dots .default:n = true, - nullify-dots .bool_set:N = \l__nm_nullify_dots_bool , + nullify-dots .bool_set:N = \l__nicem_nullify_dots_bool , nullify-dots .default:n = true, columns-width .code:n = \str_if_eq:nnTF {#1} {auto} - {\bool_set_true:N \l__nm_auto_columns_width_bool} - {\dim_set:Nn \l__nm_columns_width_dim {#1}}, + {\bool_set_true:N \l__nicem_auto_columns_width_bool} + {\dim_set:Nn \l__nicem_columns_width_dim {#1}}, columns-width .value_required:n = true, - name .code:n = {\seq_if_in:NnTF \g__nm_names_seq {#1} - {\__nm_msg_error:nn {Duplicate~name} {#1}} - {\seq_gput_left:Nn \g__nm_names_seq {#1}} - \tl_set:Nn \l__nm_name_tl {#1}}, + name .code:n = {\seq_if_in:NnTF \g__nicem_names_seq {#1} + {\__nicem_error:nn {Duplicate~name} {#1}} + {\seq_gput_left:Nn \g__nicem_names_seq {#1}} + \tl_set:Nn \l__nicem_name_tl {#1}}, name .value_required:n = true, - c .code:n = \tl_set:Nn \l__nm_pos_env_tl c, - t .code:n = \tl_set:Nn \l__nm_pos_env_tl t, - b .code:n = \tl_set:Nn \l__nm_pos_env_tl b, - code-after .tl_set:N = \l__nm_code_after_tl, + c .code:n = \tl_set:Nn \l__nicem_pos_env_tl c, + t .code:n = \tl_set:Nn \l__nicem_pos_env_tl t, + b .code:n = \tl_set:Nn \l__nicem_pos_env_tl b, + code-after .tl_set:N = \l__nicem_code_after_tl, code-after .initial:n = \c_empty_tl, code-after .value_required:n = true, - create-extra-nodes .bool_set:N = \l__nm_extra_nodes_bool, + create-extra-nodes .bool_set:N = \l__nicem_extra_nodes_bool, create-extra-nodes .default:n = true, - left-margin .dim_set:N = \l__nm_left_margin_dim, + left-margin .dim_set:N = \l__nicem_left_margin_dim, left-margin .default:n = \arraycolsep, - right-margin .dim_set:N = \l__nm_right_margin_dim, + right-margin .dim_set:N = \l__nicem_right_margin_dim, right-margin .default:n = \arraycolsep, - extra-left-margin .dim_set:N = \l__nm_extra_left_margin_dim, - extra-right-margin .dim_set:N = \l__nm_extra_right_margin_dim, - unknown .code:n = \__nm_msg_error:n {Unknown~option~for~NiceArray}} + extra-left-margin .dim_set:N = \l__nicem_extra_left_margin_dim, + extra-right-margin .dim_set:N = \l__nicem_extra_right_margin_dim, + unknown .code:n = \__nicem_error:n {Unknown~option~for~NiceArray}} \msg_new:nnnn {nicematrix} {Unknown~option~for~NiceArray} {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~environment~ @@ -238,169 +238,169 @@ renew-dots,~ right-margin,~ and~t.} -\cs_new_protected:Nn \__nm_Cell: +\cs_new_protected:Nn \__nicem_Cell: { - \int_gincr:N \g__nm_column_int - \int_compare:nNnT \g__nm_column_int = 1 - {\int_gincr:N \g__nm_row_int} - \int_gset:Nn \g__nm_column_total_int - {\int_max:nn \g__nm_column_total_int \g__nm_column_int} + \int_gincr:N \g__nicem_column_int + \int_compare:nNnT \g__nicem_column_int = 1 + {\int_gincr:N \g__nicem_row_int} + \int_gset:Nn \g__nicem_column_total_int + {\int_max:nn \g__nicem_column_total_int \g__nicem_column_int} \hbox_set:Nw \l_tmpa_box $ % $ - \int_compare:nNnT \g__nm_row_int = 0 - \l__nm_code_for_first_row_tl} -\cs_new_protected:Nn \__nm_end_Cell: + \int_compare:nNnT \g__nicem_row_int = 0 + \l__nicem_code_for_first_row_tl} +\cs_new_protected:Nn \__nicem_end_Cell: {$ % $ \hbox_set_end: - \dim_gset:Nn \g__nm_max_cell_width_dim - {\dim_max:nn \g__nm_max_cell_width_dim {\box_wd:N \l_tmpa_box}} - \int_compare:nNnT \g__nm_row_int = 0 - {\dim_gset:Nn \g__nm_max_dp_row_zero_dim - {\dim_max:nn \g__nm_max_dp_row_zero_dim {\box_dp:N \l_tmpa_box}} - \dim_gset:Nn \g__nm_max_ht_row_zero_dim - {\dim_max:nn \g__nm_max_ht_row_zero_dim {\box_ht:N \l_tmpa_box}}} - \int_compare:nNnT \g__nm_row_int = 1 - {\dim_gset:Nn \g__nm_max_ht_row_one_dim - {\dim_max:nn \g__nm_max_ht_row_one_dim {\box_ht:N \l_tmpa_box}}} + \dim_gset:Nn \g__nicem_max_cell_width_dim + {\dim_max:nn \g__nicem_max_cell_width_dim {\box_wd:N \l_tmpa_box}} + \int_compare:nNnT \g__nicem_row_int = 0 + {\dim_gset:Nn \g__nicem_max_dp_row_zero_dim + {\dim_max:nn \g__nicem_max_dp_row_zero_dim {\box_dp:N \l_tmpa_box}} + \dim_gset:Nn \g__nicem_max_ht_row_zero_dim + {\dim_max:nn \g__nicem_max_ht_row_zero_dim {\box_ht:N \l_tmpa_box}}} + \int_compare:nNnT \g__nicem_row_int = 1 + {\dim_gset:Nn \g__nicem_max_ht_row_one_dim + {\dim_max:nn \g__nicem_max_ht_row_one_dim {\box_ht:N \l_tmpa_box}}} \tikz[remember~picture, inner~sep = 0pt, minimum~width = 0pt, baseline] \node [anchor = base, - name = nm-\int_use:N \g__nm_env_int- - \int_use:N \g__nm_row_int- - \int_use:N \g__nm_column_int, - alias = \tl_if_empty:NF \l__nm_name_tl - {\tl_use:N \l__nm_name_tl- - \int_use:N \g__nm_row_int- - \int_use:N \g__nm_column_int} ] + name = nm-\int_use:N \g__nicem_env_int- + \int_use:N \g__nicem_row_int- + \int_use:N \g__nicem_column_int, + alias = \tl_if_empty:NF \l__nicem_name_tl + {\tl_use:N \l__nicem_name_tl- + \int_use:N \g__nicem_row_int- + \int_use:N \g__nicem_column_int} ] \bgroup \box_use:N \l_tmpa_box \egroup ;} \NewDocumentEnvironment {NiceMatrix} {O{}} {\keys_set:nn {NiceMatrix/NiceMatrix} {#1} - \tl_set:Nn \l__nm_pos_env_tl c - \bool_set_false:N \l__nm_exterior_arraycolsep_bool + \tl_set:Nn \l__nicem_pos_env_tl c + \bool_set_false:N \l__nicem_exterior_arraycolsep_bool \NiceArray{*\c@MaxMatrixCols{C}} } {\endarray \skip_horizontal:n {-\arraycolsep} - \skip_horizontal:n {\g__nm_right_margin_dim + \g__nm_extra_right_margin_dim}} + \skip_horizontal:n {\g__nicem_right_margin_dim + \g__nicem_extra_right_margin_dim}} \cs_generate_variant:Nn \dim_set:Nn {Nx} \msg_new:nnn {nicematrix} {We~are~yet~in~an~environment~NiceArray} {Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~ nested.~We~can~go~on,~but,~maybe,~you~will~have~errors~or~an~incorrect~ result.} -\cs_new_protected:Npn \__nm_define_dots: - {\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: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 - \cs_set_eq:NN \hdotsfor \__nm_Hdotsfor}} -\cs_new_protected:Npn \__nm_define_dots_to_nil: +\cs_new_protected:Npn \__nicem_define_dots: + {\cs_set_eq:NN \Ldots \__nicem_Ldots + \cs_set_eq:NN \Cdots \__nicem_Cdots + \cs_set_eq:NN \Vdots \__nicem_Vdots + \cs_set_eq:NN \Ddots \__nicem_Ddots + \cs_set_eq:NN \Iddots \__nicem_Iddots + \bool_if:NT \l__nicem_renew_dots_bool + {\cs_set_eq:NN \ldots \__nicem_Ldots + \cs_set_eq:NN \cdots \__nicem_Cdots + \cs_set_eq:NN \vdots \__nicem_Vdots + \cs_set_eq:NN \ddots \__nicem_Ddots + \cs_set_eq:NN \iddots \__nicem_Iddots + \cs_set_eq:NN \dots \__nicem_Ldots + \cs_set_eq:NN \hdotsfor \__nicem_Hdotsfor}} +\cs_new_protected:Npn \__nicem_define_dots_to_nil: {\cs_set_eq:NN \Ldots \prg_do_nothing: \cs_set_eq:NN \Cdots \prg_do_nothing: \cs_set_eq:NN \Vdots \prg_do_nothing: \cs_set_eq:NN \Ddots \prg_do_nothing: \cs_set_eq:NN \Iddots \prg_do_nothing: - \bool_if:NT \l__nm_renew_dots_bool + \bool_if:NT \l__nicem_renew_dots_bool {\cs_set_eq:NN \ldots \prg_do_nothing: \cs_set_eq:NN \cdots \prg_do_nothing: \cs_set_eq:NN \vdots \prg_do_nothing: \cs_set_eq:NN \ddots \prg_do_nothing: \cs_set_eq:NN \iddots \prg_do_nothing: \cs_set_eq:NN \dots \prg_do_nothing: - \cs_set_eq:NN \hdotsfor \__nm_Hdotsfor}} + \cs_set_eq:NN \hdotsfor \__nicem_Hdotsfor}} \NewDocumentEnvironment {NiceArray} {O{} m O{}} - {\cs_if_exist:NT \__nm_in_NiceArray: - {\__nm_msg_error:n {We~are~yet~in~an~environment~NiceArray}} + {\cs_if_exist:NT \__nicem_in_NiceArray: + {\__nicem_error:n {We~are~yet~in~an~environment~NiceArray}} \cs_if_exist:NT \tikz@library@external@loaded {\tikzset{external/export = false}} - \cs_set:Npn \__nm_in_NiceArray: {--Void--} - \aftergroup \__nm_after_array: - \tl_gclear_new:N \g__nm_lines_to_draw_tl - \int_gincr:N \g__nm_env_int - \bool_if:NF \l__nm_block_auto_columns_width_bool - {\dim_gzero_new:N \g__nm_max_cell_width_dim} - \dim_gzero_new:N \g__nm_max_dp_row_zero_dim - \dim_gzero_new:N \g__nm_max_ht_row_zero_dim - \dim_gzero_new:N \g__nm_max_ht_row_one_dim + \cs_set:Npn \__nicem_in_NiceArray: {--Void--} + \aftergroup \__nicem_after_array: + \tl_gclear_new:N \g__nicem_lines_to_draw_tl + \int_gincr:N \g__nicem_env_int + \bool_if:NF \l__nicem_block_auto_columns_width_bool + {\dim_gzero_new:N \g__nicem_max_cell_width_dim} + \dim_gzero_new:N \g__nicem_max_dp_row_zero_dim + \dim_gzero_new:N \g__nicem_max_ht_row_zero_dim + \dim_gzero_new:N \g__nicem_max_ht_row_one_dim \keys_set:nn {NiceMatrix/NiceArray} {#1,#3} - \bool_if:NT \l__nm_auto_columns_width_bool - {\aftergroup \__nm_write_max_cell_width: - \cs_if_free:cTF {__nm_max_cell_width_\int_use:N \g__nm_env_int} - {\dim_set:Nn \l__nm_columns_width_dim \c_zero_dim} - {\dim_set:Nx \l__nm_columns_width_dim - {\use:c {__nm_max_cell_width_\int_use:N \g__nm_env_int}}} - \tl_if_empty:NF \l__nm_name_tl - {\cs_if_free:cF {__nm_max_cell_width_\l__nm_name_tl} - {\dim_set:Nx \l__nm_columns_width_dim - {\use:c {__nm_max_cell_width_\l__nm_name_tl}}}} + \bool_if:NT \l__nicem_auto_columns_width_bool + {\aftergroup \__nicem_write_max_cell_width: + \cs_if_free:cTF {__nicem_max_cell_width_\int_use:N \g__nicem_env_int} + {\dim_set:Nn \l__nicem_columns_width_dim \c_zero_dim} + {\dim_set:Nx \l__nicem_columns_width_dim + {\use:c {__nicem_max_cell_width_\int_use:N \g__nicem_env_int}}} + \tl_if_empty:NF \l__nicem_name_tl + {\cs_if_free:cF {__nicem_max_cell_width_\l__nicem_name_tl} + {\dim_set:Nx \l__nicem_columns_width_dim + {\use:c {__nicem_max_cell_width_\l__nicem_name_tl}}}} } - \bool_gset_eq:NN \g__nm_extra_nodes_bool \l__nm_extra_nodes_bool - \dim_gset_eq:NN \g__nm_left_margin_dim \l__nm_left_margin_dim - \dim_gset_eq:NN \g__nm_right_margin_dim \l__nm_right_margin_dim - \dim_gset_eq:NN \g__nm_extra_right_margin_dim \l__nm_extra_right_margin_dim - \tl_gset_eq:NN \g__nm_code_after_tl \l__nm_code_after_tl - \tl_gset_eq:NN \g__nm_name_tl \l__nm_name_tl + \bool_gset_eq:NN \g__nicem_extra_nodes_bool \l__nicem_extra_nodes_bool + \dim_gset_eq:NN \g__nicem_left_margin_dim \l__nicem_left_margin_dim + \dim_gset_eq:NN \g__nicem_right_margin_dim \l__nicem_right_margin_dim + \dim_gset_eq:NN \g__nicem_extra_right_margin_dim \l__nicem_extra_right_margin_dim + \tl_gset_eq:NN \g__nicem_code_after_tl \l__nicem_code_after_tl + \tl_gset_eq:NN \g__nicem_name_tl \l__nicem_name_tl \cs_set:Npn \ialign - {\everycr{\noalign{\int_gzero:N \g__nm_column_int}} + {\everycr{\noalign{\int_gzero:N \g__nicem_column_int}} \tabskip = \c_zero_skip \cs_set:Npn \ialign {\everycr{} \tabskip = \c_zero_skip \halign} \halign} - \dim_compare:nNnTF \l__nm_columns_width_dim = \c_zero_dim - {\newcolumntype{L}{>{\__nm_Cell:}l<{\__nm_end_Cell:}} - \newcolumntype{C}{>{\__nm_Cell:}c<{\__nm_end_Cell:}} - \newcolumntype{R}{>{\__nm_Cell:}r<{\__nm_end_Cell:}}} - {\newcolumntype{L}{wl{\dim_use:N \l__nm_columns_width_dim}} - \newcolumntype{C}{wc{\dim_use:N \l__nm_columns_width_dim}} - \newcolumntype{R}{wr{\dim_use:N \l__nm_columns_width_dim}}} + \dim_compare:nNnTF \l__nicem_columns_width_dim = \c_zero_dim + {\newcolumntype{L}{>{\__nicem_Cell:}l<{\__nicem_end_Cell:}} + \newcolumntype{C}{>{\__nicem_Cell:}c<{\__nicem_end_Cell:}} + \newcolumntype{R}{>{\__nicem_Cell:}r<{\__nicem_end_Cell:}}} + {\newcolumntype{L}{wl{\dim_use:N \l__nicem_columns_width_dim}} + \newcolumntype{C}{wc{\dim_use:N \l__nicem_columns_width_dim}} + \newcolumntype{R}{wr{\dim_use:N \l__nicem_columns_width_dim}}} \cs_set_eq:NN \NC@find@w \relax \cs_set_eq:NN \NC@find@W \relax \newcolumntype{w}[2] {>{\hbox_set:Nw \l_tmpa_box - \__nm_Cell:} + \__nicem_Cell:} c - <{\__nm_end_Cell: + <{\__nicem_end_Cell: \hbox_set_end: \makebox[##2][##1]{\box_use:N \l_tmpa_box}}} \newcolumntype{W}[2] {>{\hbox_set:Nw \l_tmpa_box - \__nm_Cell:} + \__nicem_Cell:} c - <{\__nm_end_Cell: + <{\__nicem_end_Cell: \hbox_set_end: \cs_set_eq:NN \hss \hfil \makebox[##2][##1]{\box_use:N \l_tmpa_box}}} - \bool_if:NTF \c__nm_draft_bool - \__nm_define_dots_to_nil: - \__nm_define_dots: - \cs_set_eq:NN \Hspace \__nm_Hspace: - \cs_set_eq:NN \Hdotsfor \__nm_Hdotsfor - \cs_set_eq:NN \multicolumn \__nm_multicolumn:nnn - \seq_gclear_new:N \g__nm_empty_cells_seq - \seq_gclear_new:N \g__nm_multicolumn_cells_seq - \seq_gclear_new:N \g__nm_multicolumn_sizes_seq - \int_gzero_new:N \g__nm_row_int - \int_gset:Nn \g__nm_row_int {\l__nm_nb_first_row_int - 1} - \int_gzero_new:N \g__nm_column_int - \int_gzero_new:N \g__nm_column_total_int + \bool_if:NTF \c__nicem_draft_bool + \__nicem_define_dots_to_nil: + \__nicem_define_dots: + \cs_set_eq:NN \Hspace \__nicem_Hspace: + \cs_set_eq:NN \Hdotsfor \__nicem_Hdotsfor + \cs_set_eq:NN \multicolumn \__nicem_multicolumn:nnn + \seq_gclear_new:N \g__nicem_empty_cells_seq + \seq_gclear_new:N \g__nicem_multicolumn_cells_seq + \seq_gclear_new:N \g__nicem_multicolumn_sizes_seq + \int_gzero_new:N \g__nicem_row_int + \int_gset:Nn \g__nicem_row_int {\l__nicem_nb_first_row_int - 1} + \int_gzero_new:N \g__nicem_column_int + \int_gzero_new:N \g__nicem_column_total_int \cs_set_eq:NN \@ifnextchar \new@ifnextchar - \bool_if:NF \l__nm_exterior_arraycolsep_bool + \bool_if:NF \l__nicem_exterior_arraycolsep_bool {\skip_horizontal:n {-\arraycolsep}} - \skip_horizontal:n {\l__nm_left_margin_dim + \l__nm_extra_left_margin_dim} - \array[\l__nm_pos_env_tl]{#2}} + \skip_horizontal:n {\l__nicem_left_margin_dim + \l__nicem_extra_left_margin_dim} + \array[\l__nicem_pos_env_tl]{#2}} {\endarray - \bool_if:NF \l__nm_exterior_arraycolsep_bool + \bool_if:NF \l__nicem_exterior_arraycolsep_bool {\skip_horizontal:n {-\arraycolsep}} - \skip_horizontal:n {\g__nm_right_margin_dim + \g__nm_extra_right_margin_dim}} + \skip_horizontal:n {\g__nicem_right_margin_dim + \g__nicem_extra_right_margin_dim}} \NewDocumentEnvironment {pNiceMatrix} {} {\left(\begin{NiceMatrix}} {\end{NiceMatrix}\right)} @@ -416,24 +416,24 @@ \NewDocumentEnvironment {VNiceMatrix} {} {\left\lVert\begin{NiceMatrix}} {\end{NiceMatrix}\right\rVert} -\cs_new_protected:Nn \__nm_write_max_cell_width: - {\bool_if:NF \l__nm_block_auto_columns_width_bool +\cs_new_protected:Nn \__nicem_write_max_cell_width: + {\bool_if:NF \l__nicem_block_auto_columns_width_bool {\iow_now:Nn \@mainaux {\ExplSyntaxOn} \iow_now:Nx \@mainaux {\cs_gset:cpn - {__nm_max_cell_width_\int_use:N \g__nm_env_int} - {\dim_use:N \g__nm_max_cell_width_dim} } - \iow_now:Nx \@mainaux {\cs_gset:cpn {__nm_max_cell_width_\g__nm_name_tl} - {\dim_use:N \g__nm_max_cell_width_dim} } + {__nicem_max_cell_width_\int_use:N \g__nicem_env_int} + {\dim_use:N \g__nicem_max_cell_width_dim} } + \iow_now:Nx \@mainaux {\cs_gset:cpn {__nicem_max_cell_width_\g__nicem_name_tl} + {\dim_use:N \g__nicem_max_cell_width_dim} } \iow_now:Nn \@mainaux {\ExplSyntaxOff}}} -\prg_set_conditional:Npnn \__nm_if_not_empty_cell:nn #1#2 {T,TF} - {\cs_if_exist:cTF {pgf@sh@ns@nm-\int_use:N \g__nm_env_int- +\prg_set_conditional:Npnn \__nicem_if_not_empty_cell:nn #1#2 {T,TF} + {\cs_if_exist:cTF {pgf@sh@ns@nm-\int_use:N \g__nicem_env_int- \int_use:N #1- \int_use:N #2} - {\seq_if_in:NxTF \g__nm_empty_cells_seq + {\seq_if_in:NxTF \g__nicem_empty_cells_seq {\int_use:N #1-\int_use:N #2} {\prg_return_false:} {\begin{pgfpicture} - \tl_set:Nx \l_tmpa_tl {nm-\int_use:N \g__nm_env_int- + \tl_set:Nx \l_tmpa_tl {nm-\int_use:N \g__nicem_env_int- \int_use:N #1- \int_use:N #2} \pgfpointanchor \l_tmpa_tl {east} @@ -447,403 +447,406 @@ }} \prg_return_false: } -\cs_new_protected:Nn \__nm_instruction_of_type:n - {\tl_gput_right:Nx \g__nm_lines_to_draw_tl - {\exp_not:c {__nm_draw_#1:nn} - {\int_use:N \g__nm_row_int} - {\int_use:N \g__nm_column_int}}} -\cs_new_protected:Nn \__nm_after_array: +\cs_new_protected:Nn \__nicem_instruction_of_type:n + {\tl_gput_right:Nx \g__nicem_lines_to_draw_tl + {\exp_not:c {__nicem_draw_#1:nn} + {\int_use:N \g__nicem_row_int} + {\int_use:N \g__nicem_column_int}}} +\cs_new_protected:Nn \__nicem_after_array: {\group_begin: \cs_if_exist:NT \tikz@library@external@loaded {\tikzset{external/export = false}} - \int_gset_eq:NN \g__nm_column_int \g__nm_column_total_int - \bool_if:NT \l__nm_exterior_column_bool {\int_gdecr:N \g__nm_column_int} - \seq_gclear_new:N \g__nm_yet_drawn_seq - \bool_if:NT \l__nm_parallelize_diags_bool - {\int_zero_new:N \l__nm_ddots_int - \int_zero_new:N \l__nm_iddots_int - \dim_zero_new:N \l__nm_delta_x_one_dim - \dim_zero_new:N \l__nm_delta_y_one_dim - \dim_zero_new:N \l__nm_delta_x_two_dim - \dim_zero_new:N \l__nm_delta_y_two_dim} - \bool_if:NT \g__nm_extra_nodes_bool \__nm_create_extra_nodes: - \tl_if_empty:NF \g__nm_lines_to_draw_tl - {\int_zero_new:N \l__nm_initial_i_int - \int_zero_new:N \l__nm_initial_j_int - \int_zero_new:N \l__nm_final_i_int - \int_zero_new:N \l__nm_final_j_int - \__nm_bool_new:N \l__nm_initial_open_bool - \__nm_bool_new:N \l__nm_final_open_bool - \g__nm_lines_to_draw_tl} - \tl_gclear:N \g__nm_lines_to_draw_tl + \int_gset_eq:NN \g__nicem_column_int \g__nicem_column_total_int + \bool_if:NT \l__nicem_exterior_column_bool {\int_gdecr:N \g__nicem_column_int} + \seq_gclear_new:N \g__nicem_yet_drawn_seq + \bool_if:NT \l__nicem_parallelize_diags_bool + {\int_zero_new:N \l__nicem_ddots_int + \int_zero_new:N \l__nicem_iddots_int + \dim_zero_new:N \l__nicem_delta_x_one_dim + \dim_zero_new:N \l__nicem_delta_y_one_dim + \dim_zero_new:N \l__nicem_delta_x_two_dim + \dim_zero_new:N \l__nicem_delta_y_two_dim} + \bool_if:NT \g__nicem_extra_nodes_bool \__nicem_create_extra_nodes: + \tl_if_empty:NF \g__nicem_lines_to_draw_tl + {\int_zero_new:N \l__nicem_initial_i_int + \int_zero_new:N \l__nicem_initial_j_int + \int_zero_new:N \l__nicem_final_i_int + \int_zero_new:N \l__nicem_final_j_int + \__nicem_bool_new:N \l__nicem_initial_open_bool + \__nicem_bool_new:N \l__nicem_final_open_bool + \g__nicem_lines_to_draw_tl} + \tl_gclear:N \g__nicem_lines_to_draw_tl \tikzset{every~picture/.style = {overlay, remember~picture, - name~prefix = nm-\int_use:N \g__nm_env_int-}} - \cs_set_eq:NN \line \__nm_line:nn - \g__nm_code_after_tl + name~prefix = nm-\int_use:N \g__nicem_env_int-}} + \cs_set_eq:NN \line \__nicem_line:nn + \g__nicem_code_after_tl \group_end:} -\cs_new_protected:Nn \__nm_find_extremities_of_line:nnnn - {\int_set:Nn \l__nm_initial_i_int {#1} - \int_set:Nn \l__nm_initial_j_int {#2} - \int_set:Nn \l__nm_final_i_int {#1} - \int_set:Nn \l__nm_final_j_int {#2} - \bool_set_false:N \l__nm_initial_open_bool - \bool_set_false:N \l__nm_final_open_bool - \__nm_bool_new:N \l__nm_stop_loop_bool - \bool_do_until:Nn \l__nm_stop_loop_bool - {\int_add:Nn \l__nm_final_i_int {#3} - \int_add:Nn \l__nm_final_j_int {#4} +\cs_new_protected:Nn \__nicem_find_extremities_of_line:nnnn + {\int_set:Nn \l__nicem_initial_i_int {#1} + \int_set:Nn \l__nicem_initial_j_int {#2} + \int_set:Nn \l__nicem_final_i_int {#1} + \int_set:Nn \l__nicem_final_j_int {#2} + \bool_set_false:N \l__nicem_initial_open_bool + \bool_set_false:N \l__nicem_final_open_bool + \__nicem_bool_new:N \l__nicem_stop_loop_bool + \bool_do_until:Nn \l__nicem_stop_loop_bool + {\int_add:Nn \l__nicem_final_i_int {#3} + \int_add:Nn \l__nicem_final_j_int {#4} \bool_if:nTF { \int_compare_p:nNn - \l__nm_final_i_int < {\l__nm_nb_first_row_int - 1} + \l__nicem_final_i_int < {\l__nicem_nb_first_row_int - 1} || \int_compare_p:nNn - \l__nm_final_i_int > \g__nm_row_int + \l__nicem_final_i_int > \g__nicem_row_int || \int_compare_p:nNn - \l__nm_final_j_int < 1 + \l__nicem_final_j_int < 1 || \int_compare_p:nNn - \l__nm_final_j_int > \g__nm_column_total_int} - {\bool_set_true:N \l__nm_final_open_bool - \int_sub:Nn \l__nm_final_i_int {#3} - \int_sub:Nn \l__nm_final_j_int {#4} - \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 - {\bool_set_true:N \l__nm_stop_loop_bool}} + \l__nicem_final_j_int > \g__nicem_column_total_int + || \int_compare_p:nNn + \l__nicem_final_j_int > \g__nicem_column_int + && \int_compare_p:nNn {#4} > 0 } + {\bool_set_true:N \l__nicem_final_open_bool + \int_sub:Nn \l__nicem_final_i_int {#3} + \int_sub:Nn \l__nicem_final_j_int {#4} + \bool_set_true:N \l__nicem_stop_loop_bool} + {\__nicem_if_not_empty_cell:nnT + \l__nicem_final_i_int + \l__nicem_final_j_int + {\bool_set_true:N \l__nicem_stop_loop_bool}} } - \bool_set_false:N \l__nm_stop_loop_bool - \bool_do_until:Nn \l__nm_stop_loop_bool - {\int_sub:Nn \l__nm_initial_i_int {#3} - \int_sub:Nn \l__nm_initial_j_int {#4} + \bool_set_false:N \l__nicem_stop_loop_bool + \bool_do_until:Nn \l__nicem_stop_loop_bool + {\int_sub:Nn \l__nicem_initial_i_int {#3} + \int_sub:Nn \l__nicem_initial_j_int {#4} \bool_if:nTF { \int_compare_p:nNn - \l__nm_initial_i_int < \l__nm_nb_first_row_int + \l__nicem_initial_i_int < \l__nicem_nb_first_row_int || \int_compare_p:nNn - \l__nm_initial_i_int > \g__nm_row_int + \l__nicem_initial_i_int > \g__nicem_row_int || \int_compare_p:nNn - \l__nm_initial_j_int < 1 + \l__nicem_initial_j_int < 1 || \int_compare_p:nNn - \l__nm_initial_j_int > \g__nm_column_total_int} - {\bool_set_true:N \l__nm_initial_open_bool - \int_add:Nn \l__nm_initial_i_int {#3} - \int_add:Nn \l__nm_initial_j_int {#4} - \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 - {\bool_set_true:N \l__nm_stop_loop_bool}} + \l__nicem_initial_j_int > \g__nicem_column_total_int} + {\bool_set_true:N \l__nicem_initial_open_bool + \int_add:Nn \l__nicem_initial_i_int {#3} + \int_add:Nn \l__nicem_initial_j_int {#4} + \bool_set_true:N \l__nicem_stop_loop_bool} + {\__nicem_if_not_empty_cell:nnT + \l__nicem_initial_i_int + \l__nicem_initial_j_int + {\bool_set_true:N \l__nicem_stop_loop_bool}} } - \bool_if:nT {\l__nm_initial_open_bool || \l__nm_final_open_bool} - \__nm_create_extra_nodes: } -\prg_set_conditional:Npnn \__nm_if_yet_drawn: {F} - {\tl_set:Nx \l_tmpa_tl {\int_use:N \l__nm_initial_i_int- - \int_use:N \l__nm_initial_j_int- - \int_use:N \l__nm_final_i_int- - \int_use:N \l__nm_final_j_int} - \seq_if_in:NVTF \g__nm_yet_drawn_seq \l_tmpa_tl + \bool_if:nT {\l__nicem_initial_open_bool || \l__nicem_final_open_bool} + \__nicem_create_extra_nodes: } +\prg_set_conditional:Npnn \__nicem_if_yet_drawn: {F} + {\tl_set:Nx \l_tmpa_tl {\int_use:N \l__nicem_initial_i_int- + \int_use:N \l__nicem_initial_j_int- + \int_use:N \l__nicem_final_i_int- + \int_use:N \l__nicem_final_j_int} + \seq_if_in:NVTF \g__nicem_yet_drawn_seq \l_tmpa_tl {\prg_return_true:} - {\seq_gput_left:NV \g__nm_yet_drawn_seq \l_tmpa_tl + {\seq_gput_left:NV \g__nicem_yet_drawn_seq \l_tmpa_tl \prg_return_false:}} -\cs_new_protected:Nn \__nm_retrieve_coords:nn - {\dim_gzero_new:N \g__nm_x_initial_dim - \dim_gzero_new:N \g__nm_y_initial_dim - \dim_gzero_new:N \g__nm_x_final_dim - \dim_gzero_new:N \g__nm_y_final_dim +\cs_new_protected:Nn \__nicem_retrieve_coords:nn + {\dim_gzero_new:N \g__nicem_x_initial_dim + \dim_gzero_new:N \g__nicem_y_initial_dim + \dim_gzero_new:N \g__nicem_x_final_dim + \dim_gzero_new:N \g__nicem_y_final_dim \begin{tikzpicture}[remember~picture] \tikz@parse@node\pgfutil@firstofone - (nm-\int_use:N \g__nm_env_int- - \int_use:N \l__nm_initial_i_int- - \int_use:N \l__nm_initial_j_int #1) - \dim_gset:Nn \g__nm_x_initial_dim \pgf@x - \dim_gset:Nn \g__nm_y_initial_dim \pgf@y + (nm-\int_use:N \g__nicem_env_int- + \int_use:N \l__nicem_initial_i_int- + \int_use:N \l__nicem_initial_j_int #1) + \dim_gset:Nn \g__nicem_x_initial_dim \pgf@x + \dim_gset:Nn \g__nicem_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) - \dim_gset:Nn \g__nm_x_final_dim \pgf@x - \dim_gset:Nn \g__nm_y_final_dim \pgf@y + (nm-\int_use:N \g__nicem_env_int- + \int_use:N \l__nicem_final_i_int- + \int_use:N \l__nicem_final_j_int #2) + \dim_gset:Nn \g__nicem_x_final_dim \pgf@x + \dim_gset:Nn \g__nicem_y_final_dim \pgf@y \end{tikzpicture} } -\cs_generate_variant:Nn \__nm_retrieve_coords:nn {xx} -\cs_new_protected:Nn \__nm_draw_Ldots:nn - {\__nm_find_extremities_of_line:nnnn {#1} {#2} 0 1 - \__nm_if_yet_drawn:F \__nm_actually_draw_Ldots:} -\cs_new_protected:Nn \__nm_actually_draw_Ldots: - {\__nm_retrieve_coords:xx {\bool_if:NTF \l__nm_initial_open_bool +\cs_generate_variant:Nn \__nicem_retrieve_coords:nn {xx} +\cs_new_protected:Nn \__nicem_draw_Ldots:nn + {\__nicem_find_extremities_of_line:nnnn {#1} {#2} 0 1 + \__nicem_if_yet_drawn:F \__nicem_actually_draw_Ldots:} +\cs_new_protected:Nn \__nicem_actually_draw_Ldots: + {\__nicem_retrieve_coords:xx {\bool_if:NTF \l__nicem_initial_open_bool {-medium.base~west} {.base~east}} - {\bool_if:NTF \l__nm_final_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {-medium.base~east} {.base~west}} - \bool_if:NT \l__nm_initial_open_bool - {\dim_gset_eq:NN \g__nm_y_initial_dim \g__nm_y_final_dim } - \bool_if:NT \l__nm_final_open_bool - {\dim_gset_eq:NN \g__nm_y_final_dim \g__nm_y_initial_dim } - \dim_gadd:Nn \g__nm_y_initial_dim {0.53pt} - \dim_gadd:Nn \g__nm_y_final_dim {0.53pt} - \__nm_draw_tikz_line:} -\cs_new_protected:Nn \__nm_draw_Cdots:nn - {\__nm_find_extremities_of_line:nnnn {#1} {#2} 0 1 - \__nm_if_yet_drawn:F - {\__nm_retrieve_coords:xx {\bool_if:NTF \l__nm_initial_open_bool + \bool_if:NT \l__nicem_initial_open_bool + {\dim_gset_eq:NN \g__nicem_y_initial_dim \g__nicem_y_final_dim } + \bool_if:NT \l__nicem_final_open_bool + {\dim_gset_eq:NN \g__nicem_y_final_dim \g__nicem_y_initial_dim } + \dim_gadd:Nn \g__nicem_y_initial_dim {0.53pt} + \dim_gadd:Nn \g__nicem_y_final_dim {0.53pt} + \__nicem_draw_tikz_line:} +\cs_new_protected:Nn \__nicem_draw_Cdots:nn + {\__nicem_find_extremities_of_line:nnnn {#1} {#2} 0 1 + \__nicem_if_yet_drawn:F + {\__nicem_retrieve_coords:xx {\bool_if:NTF \l__nicem_initial_open_bool {-medium.mid~west} {.mid~east}} - {\bool_if:NTF \l__nm_final_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {-medium.mid~east} {.mid~west}} - \bool_if:NT \l__nm_initial_open_bool - {\dim_gset_eq:NN \g__nm_y_initial_dim \g__nm_y_final_dim } - \bool_if:NT \l__nm_final_open_bool - {\dim_gset_eq:NN \g__nm_y_final_dim \g__nm_y_initial_dim } - \__nm_draw_tikz_line:}} -\cs_new_protected:Nn \__nm_draw_Vdots:nn - {\__nm_find_extremities_of_line:nnnn {#1} {#2} 1 0 - \__nm_if_yet_drawn:F - {\__nm_retrieve_coords:xx {\bool_if:NTF \l__nm_initial_open_bool + \bool_if:NT \l__nicem_initial_open_bool + {\dim_gset_eq:NN \g__nicem_y_initial_dim \g__nicem_y_final_dim } + \bool_if:NT \l__nicem_final_open_bool + {\dim_gset_eq:NN \g__nicem_y_final_dim \g__nicem_y_initial_dim } + \__nicem_draw_tikz_line:}} +\cs_new_protected:Nn \__nicem_draw_Vdots:nn + {\__nicem_find_extremities_of_line:nnnn {#1} {#2} 1 0 + \__nicem_if_yet_drawn:F + {\__nicem_retrieve_coords:xx {\bool_if:NTF \l__nicem_initial_open_bool {-medium.north~west} {.south~west}} - {\bool_if:NTF \l__nm_final_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {-medium.south~west} {.north~west}} \bool_set:Nn \l_tmpa_bool - {\dim_compare_p:nNn \g__nm_x_initial_dim = \g__nm_x_final_dim} - \__nm_retrieve_coords:xx {\bool_if:NTF \l__nm_initial_open_bool + {\dim_compare_p:nNn \g__nicem_x_initial_dim = \g__nicem_x_final_dim} + \__nicem_retrieve_coords:xx {\bool_if:NTF \l__nicem_initial_open_bool {-medium.north} {.south}} - {\bool_if:NTF \l__nm_final_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {-medium.south} {.north}} \bool_set:Nn \l_tmpb_bool - {\dim_compare_p:nNn \g__nm_x_initial_dim = \g__nm_x_final_dim} + {\dim_compare_p:nNn \g__nicem_x_initial_dim = \g__nicem_x_final_dim} \bool_if:NF \l_tmpb_bool - {\dim_gset:Nn \g__nm_x_initial_dim + {\dim_gset:Nn \g__nicem_x_initial_dim {\bool_if:NTF \l_tmpa_bool \dim_min:nn \dim_max:nn - \g__nm_x_initial_dim \g__nm_x_final_dim} - \dim_gset_eq:NN \g__nm_x_final_dim \g__nm_x_initial_dim} - \__nm_draw_tikz_line:}} -\cs_new_protected:Nn \__nm_draw_Ddots:nn - {\__nm_find_extremities_of_line:nnnn {#1} {#2} 1 1 - \__nm_if_yet_drawn:F - {\__nm_retrieve_coords:xx {\bool_if:NTF \l__nm_initial_open_bool + \g__nicem_x_initial_dim \g__nicem_x_final_dim} + \dim_gset_eq:NN \g__nicem_x_final_dim \g__nicem_x_initial_dim} + \__nicem_draw_tikz_line:}} +\cs_new_protected:Nn \__nicem_draw_Ddots:nn + {\__nicem_find_extremities_of_line:nnnn {#1} {#2} 1 1 + \__nicem_if_yet_drawn:F + {\__nicem_retrieve_coords:xx {\bool_if:NTF \l__nicem_initial_open_bool {-medium.north~west} {.south~east}} - {\bool_if:NTF \l__nm_final_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {-medium.south~east} {.north~west}} - \bool_if:NT \l__nm_parallelize_diags_bool - {\int_incr:N \l__nm_ddots_int - \int_compare:nNnTF \l__nm_ddots_int = 1 - {\dim_set:Nn \l__nm_delta_x_one_dim {\g__nm_x_final_dim - \g__nm_x_initial_dim } - \dim_set:Nn \l__nm_delta_y_one_dim {\g__nm_y_final_dim - \g__nm_y_initial_dim }} - {\dim_gset:Nn \g__nm_y_final_dim - {\g__nm_y_initial_dim + - (\g__nm_x_final_dim - \g__nm_x_initial_dim) - * \dim_ratio:nn \l__nm_delta_y_one_dim \l__nm_delta_x_one_dim }}} - \__nm_draw_tikz_line:}} -\cs_new_protected:Nn \__nm_draw_Iddots:nn - {\__nm_find_extremities_of_line:nnnn {#1} {#2} 1 {-1} - \__nm_if_yet_drawn:F - {\__nm_retrieve_coords:xx {\bool_if:NTF \l__nm_initial_open_bool + \bool_if:NT \l__nicem_parallelize_diags_bool + {\int_incr:N \l__nicem_ddots_int + \int_compare:nNnTF \l__nicem_ddots_int = 1 + {\dim_set:Nn \l__nicem_delta_x_one_dim {\g__nicem_x_final_dim - \g__nicem_x_initial_dim } + \dim_set:Nn \l__nicem_delta_y_one_dim {\g__nicem_y_final_dim - \g__nicem_y_initial_dim }} + {\dim_gset:Nn \g__nicem_y_final_dim + {\g__nicem_y_initial_dim + + (\g__nicem_x_final_dim - \g__nicem_x_initial_dim) + * \dim_ratio:nn \l__nicem_delta_y_one_dim \l__nicem_delta_x_one_dim }}} + \__nicem_draw_tikz_line:}} +\cs_new_protected:Nn \__nicem_draw_Iddots:nn + {\__nicem_find_extremities_of_line:nnnn {#1} {#2} 1 {-1} + \__nicem_if_yet_drawn:F + {\__nicem_retrieve_coords:xx {\bool_if:NTF \l__nicem_initial_open_bool {-medium.north~east} {.south~west}} - {\bool_if:NTF \l__nm_final_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {-medium.south~west} {.north~east}} - \bool_if:NT \l__nm_parallelize_diags_bool - {\int_incr:N \l__nm_iddots_int - \int_compare:nNnTF \l__nm_iddots_int = 1 - {\dim_set:Nn \l__nm_delta_x_two_dim {\g__nm_x_final_dim - \g__nm_x_initial_dim} - \dim_set:Nn \l__nm_delta_y_two_dim {\g__nm_y_final_dim - \g__nm_y_initial_dim}} - {\dim_gset:Nn \g__nm_y_final_dim - {\g__nm_y_initial_dim + - (\g__nm_x_final_dim - \g__nm_x_initial_dim) - * \dim_ratio:nn \l__nm_delta_y_two_dim \l__nm_delta_x_two_dim }}} - \__nm_draw_tikz_line:}} -\cs_new_protected:Nn \__nm_draw_tikz_line: + \bool_if:NT \l__nicem_parallelize_diags_bool + {\int_incr:N \l__nicem_iddots_int + \int_compare:nNnTF \l__nicem_iddots_int = 1 + {\dim_set:Nn \l__nicem_delta_x_two_dim {\g__nicem_x_final_dim - \g__nicem_x_initial_dim} + \dim_set:Nn \l__nicem_delta_y_two_dim {\g__nicem_y_final_dim - \g__nicem_y_initial_dim}} + {\dim_gset:Nn \g__nicem_y_final_dim + {\g__nicem_y_initial_dim + + (\g__nicem_x_final_dim - \g__nicem_x_initial_dim) + * \dim_ratio:nn \l__nicem_delta_y_two_dim \l__nicem_delta_x_two_dim }}} + \__nicem_draw_tikz_line:}} +\cs_new_protected:Nn \__nicem_draw_tikz_line: { - \dim_zero_new:N \l__nm_l_dim - \dim_set:Nn \l__nm_l_dim + \dim_zero_new:N \l__nicem_l_dim + \dim_set:Nn \l__nicem_l_dim { \fp_to_dim:n - { sqrt( ( \dim_use:N \g__nm_x_final_dim - -\dim_use:N \g__nm_x_initial_dim) ^2 - +( \dim_use:N \g__nm_y_final_dim - -\dim_use:N \g__nm_y_initial_dim) ^2 )} + { sqrt( ( \dim_use:N \g__nicem_x_final_dim + -\dim_use:N \g__nicem_x_initial_dim) ^2 + +( \dim_use:N \g__nicem_y_final_dim + -\dim_use:N \g__nicem_y_initial_dim) ^2 )} } - \dim_compare:nNnF \l__nm_l_dim = \c_zero_dim - {\bool_if:NTF \l__nm_initial_open_bool - {\bool_if:NTF \l__nm_final_open_bool + \dim_compare:nNnF \l__nicem_l_dim = \c_zero_dim + {\bool_if:NTF \l__nicem_initial_open_bool + {\bool_if:NTF \l__nicem_final_open_bool {\int_set:Nn \l_tmpa_int - {\dim_ratio:nn {\l__nm_l_dim} {0.45em}}} + {\dim_ratio:nn {\l__nicem_l_dim} {0.45em}}} {\int_set:Nn \l_tmpa_int - {\dim_ratio:nn {\l__nm_l_dim - 0.3em} {0.45em}}}} - {\bool_if:NTF \l__nm_final_open_bool + {\dim_ratio:nn {\l__nicem_l_dim - 0.3em} {0.45em}}}} + {\bool_if:NTF \l__nicem_final_open_bool {\int_set:Nn \l_tmpa_int - {\dim_ratio:nn {\l__nm_l_dim - 0.3em} {0.45em}}} + {\dim_ratio:nn {\l__nicem_l_dim - 0.3em} {0.45em}}} {\int_set:Nn \l_tmpa_int - {\dim_ratio:nn {\l__nm_l_dim - 0.6em} {0.45em}}}} - \dim_set:Nn \l_tmpa_dim {(\g__nm_x_final_dim - \g__nm_x_initial_dim) - * \dim_ratio:nn {0.45em} \l__nm_l_dim} - \dim_set:Nn \l_tmpb_dim {(\g__nm_y_final_dim - \g__nm_y_initial_dim) - * \dim_ratio:nn {0.45em} \l__nm_l_dim} + {\dim_ratio:nn {\l__nicem_l_dim - 0.6em} {0.45em}}}} + \dim_set:Nn \l_tmpa_dim {(\g__nicem_x_final_dim - \g__nicem_x_initial_dim) + * \dim_ratio:nn {0.45em} \l__nicem_l_dim} + \dim_set:Nn \l_tmpb_dim {(\g__nicem_y_final_dim - \g__nicem_y_initial_dim) + * \dim_ratio:nn {0.45em} \l__nicem_l_dim} \int_set:Nn \l_tmpb_int - {\bool_if:NTF \l__nm_initial_open_bool - {\bool_if:NTF \l__nm_final_open_bool 1 0} - {\bool_if:NTF \l__nm_final_open_bool 2 1}} - \dim_gadd:Nn \g__nm_x_initial_dim - { (\g__nm_x_final_dim - \g__nm_x_initial_dim) - * \dim_ratio:nn {\l__nm_l_dim - 0.45 em * \l_tmpa_int} - {\l__nm_l_dim * 2} + {\bool_if:NTF \l__nicem_initial_open_bool + {\bool_if:NTF \l__nicem_final_open_bool 1 0} + {\bool_if:NTF \l__nicem_final_open_bool 2 1}} + \dim_gadd:Nn \g__nicem_x_initial_dim + { (\g__nicem_x_final_dim - \g__nicem_x_initial_dim) + * \dim_ratio:nn {\l__nicem_l_dim - 0.45 em * \l_tmpa_int} + {\l__nicem_l_dim * 2} * \l_tmpb_int} - \dim_gadd:Nn \g__nm_y_initial_dim - { (\g__nm_y_final_dim - \g__nm_y_initial_dim) - * \dim_ratio:nn {\l__nm_l_dim - 0.45 em * \l_tmpa_int} - {\l__nm_l_dim * 2} + \dim_gadd:Nn \g__nicem_y_initial_dim + { (\g__nicem_y_final_dim - \g__nicem_y_initial_dim) + * \dim_ratio:nn {\l__nicem_l_dim - 0.45 em * \l_tmpa_int} + {\l__nicem_l_dim * 2} * \l_tmpb_int} \begin{tikzpicture}[overlay] \int_step_inline:nnnn 0 1 \l_tmpa_int - { \pgfpathcircle{\pgfpoint{\g__nm_x_initial_dim} - {\g__nm_y_initial_dim}} + { \pgfpathcircle{\pgfpoint{\g__nicem_x_initial_dim} + {\g__nicem_y_initial_dim}} {0.53pt} \pgfusepath{fill} - \dim_gadd:Nn \g__nm_x_initial_dim \l_tmpa_dim - \dim_gadd:Nn \g__nm_y_initial_dim \l_tmpb_dim } + \dim_gadd:Nn \g__nicem_x_initial_dim \l_tmpa_dim + \dim_gadd:Nn \g__nicem_y_initial_dim \l_tmpb_dim } \end{tikzpicture}} } -\cs_set_eq:NN \__nm_ldots \ldots -\cs_set_eq:NN \__nm_cdots \cdots -\cs_set_eq:NN \__nm_vdots \vdots -\cs_set_eq:NN \__nm_ddots \ddots -\cs_set_eq:NN \__nm_iddots \iddots -\cs_new_protected:Nn \__nm_add_to_empty_cells: - {\seq_gput_right:Nx \g__nm_empty_cells_seq - {\int_use:N \g__nm_row_int- - \int_use:N \g__nm_column_int}} -\NewDocumentCommand \__nm_Ldots {s} - {\bool_if:nF {#1} {\__nm_instruction_of_type:n {Ldots}} - \bool_if:NF \l__nm_nullify_dots_bool {\phantom \__nm_ldots} - \__nm_add_to_empty_cells:} -\NewDocumentCommand \__nm_Cdots {s} - {\bool_if:nF {#1} {\__nm_instruction_of_type:n {Cdots}} - \bool_if:NF \l__nm_nullify_dots_bool {\phantom \__nm_cdots} - \__nm_add_to_empty_cells:} -\NewDocumentCommand \__nm_Vdots {s} - {\bool_if:nF {#1} {\__nm_instruction_of_type:n {Vdots}} - \bool_if:NF \l__nm_nullify_dots_bool {\phantom \__nm_vdots} - \__nm_add_to_empty_cells:} -\NewDocumentCommand \__nm_Ddots {s} - {\bool_if:nF {#1} {\__nm_instruction_of_type:n {Ddots}} - \bool_if:NF \l__nm_nullify_dots_bool {\phantom \__nm_ddots} - \__nm_add_to_empty_cells:} -\NewDocumentCommand \__nm_Iddots {s} - {\bool_if:nF {#1} {\__nm_instruction_of_type:n {Iddots}} - \bool_if:NF \l__nm_nullify_dots_bool {\phantom \__nm_iddots} - \__nm_add_to_empty_cells:} -\cs_new_protected:Nn \__nm_Hspace: - {\__nm_add_to_empty_cells: +\cs_set_eq:NN \__nicem_ldots \ldots +\cs_set_eq:NN \__nicem_cdots \cdots +\cs_set_eq:NN \__nicem_vdots \vdots +\cs_set_eq:NN \__nicem_ddots \ddots +\cs_set_eq:NN \__nicem_iddots \iddots +\cs_new_protected:Nn \__nicem_add_to_empty_cells: + {\seq_gput_right:Nx \g__nicem_empty_cells_seq + {\int_use:N \g__nicem_row_int- + \int_use:N \g__nicem_column_int}} +\NewDocumentCommand \__nicem_Ldots {s} + {\bool_if:nF {#1} {\__nicem_instruction_of_type:n {Ldots}} + \bool_if:NF \l__nicem_nullify_dots_bool {\phantom \__nicem_ldots} + \__nicem_add_to_empty_cells:} +\NewDocumentCommand \__nicem_Cdots {s} + {\bool_if:nF {#1} {\__nicem_instruction_of_type:n {Cdots}} + \bool_if:NF \l__nicem_nullify_dots_bool {\phantom \__nicem_cdots} + \__nicem_add_to_empty_cells:} +\NewDocumentCommand \__nicem_Vdots {s} + {\bool_if:nF {#1} {\__nicem_instruction_of_type:n {Vdots}} + \bool_if:NF \l__nicem_nullify_dots_bool {\phantom \__nicem_vdots} + \__nicem_add_to_empty_cells:} +\NewDocumentCommand \__nicem_Ddots {s} + {\bool_if:nF {#1} {\__nicem_instruction_of_type:n {Ddots}} + \bool_if:NF \l__nicem_nullify_dots_bool {\phantom \__nicem_ddots} + \__nicem_add_to_empty_cells:} +\NewDocumentCommand \__nicem_Iddots {s} + {\bool_if:nF {#1} {\__nicem_instruction_of_type:n {Iddots}} + \bool_if:NF \l__nicem_nullify_dots_bool {\phantom \__nicem_iddots} + \__nicem_add_to_empty_cells:} +\cs_new_protected:Nn \__nicem_Hspace: + {\__nicem_add_to_empty_cells: \hspace} -\cs_set_eq:NN \__nm_old_multicolumn \multicolumn -\cs_new:Nn \__nm_multicolumn:nnn - {\__nm_old_multicolumn{#1}{#2}{#3} +\cs_set_eq:NN \__nicem_old_multicolumn \multicolumn +\cs_new:Nn \__nicem_multicolumn:nnn + {\__nicem_old_multicolumn{#1}{#2}{#3} \int_compare:nNnT #1 > 1 - {\seq_gput_left:Nx \g__nm_multicolumn_cells_seq - {\int_eval:n {\g__nm_row_int} - - \int_use:N \g__nm_column_int} - \seq_gput_left:Nn \g__nm_multicolumn_sizes_seq {#1}} - \int_gadd:Nn \g__nm_column_int {#1-1}} -\NewDocumentCommand {\__nm_Hdotsfor} {O{} m} - {\tl_gput_right:Nx \g__nm_lines_to_draw_tl - {\exp_not:N \__nm_draw_Hdotsfor:nnn - {\int_use:N \g__nm_row_int} - {\int_use:N \g__nm_column_int} + {\seq_gput_left:Nx \g__nicem_multicolumn_cells_seq + {\int_eval:n {\g__nicem_row_int} - + \int_use:N \g__nicem_column_int} + \seq_gput_left:Nn \g__nicem_multicolumn_sizes_seq {#1}} + \int_gadd:Nn \g__nicem_column_int {#1-1}} +\NewDocumentCommand {\__nicem_Hdotsfor} {O{} m} + {\tl_gput_right:Nx \g__nicem_lines_to_draw_tl + {\exp_not:N \__nicem_draw_Hdotsfor:nnn + {\int_use:N \g__nicem_row_int} + {\int_use:N \g__nicem_column_int} {#2}} \prg_replicate:nn {#2-1} {&}} -\cs_new_protected:Nn \__nm_draw_Hdotsfor:nnn - {\bool_set_false:N \l__nm_initial_open_bool - \bool_set_false:N \l__nm_final_open_bool - \int_set:Nn \l__nm_initial_i_int {#1} - \int_set:Nn \l__nm_final_i_int {#1} +\cs_new_protected:Nn \__nicem_draw_Hdotsfor:nnn + {\bool_set_false:N \l__nicem_initial_open_bool + \bool_set_false:N \l__nicem_final_open_bool + \int_set:Nn \l__nicem_initial_i_int {#1} + \int_set:Nn \l__nicem_final_i_int {#1} \int_compare:nNnTF #2 = 1 - {\int_set:Nn \l__nm_initial_j_int 1 - \bool_set_true:N \l__nm_initial_open_bool} + {\int_set:Nn \l__nicem_initial_j_int 1 + \bool_set_true:N \l__nicem_initial_open_bool} {\int_set:Nn \l_tmpa_int {#2-1} - \__nm_if_not_empty_cell:nnTF \l__nm_initial_i_int \l_tmpa_int - {\int_set:Nn \l__nm_initial_j_int {#2-1}} - {\int_set:Nn \l__nm_initial_j_int {#2} - \bool_set_true:N \l__nm_initial_open_bool}} - \int_compare:nNnTF {#2+#3-1} = \g__nm_column_int - {\int_set:Nn \l__nm_final_j_int {#2+#3-1} - \bool_set_true:N \l__nm_final_open_bool} + \__nicem_if_not_empty_cell:nnTF \l__nicem_initial_i_int \l_tmpa_int + {\int_set:Nn \l__nicem_initial_j_int {#2-1}} + {\int_set:Nn \l__nicem_initial_j_int {#2} + \bool_set_true:N \l__nicem_initial_open_bool}} + \int_compare:nNnTF {#2+#3-1} = \g__nicem_column_int + {\int_set:Nn \l__nicem_final_j_int {#2+#3-1} + \bool_set_true:N \l__nicem_final_open_bool} {\int_set:Nn \l_tmpa_int {#2+#3} - \__nm_if_not_empty_cell:nnTF \l__nm_final_i_int \l_tmpa_int - {\int_set:Nn \l__nm_final_j_int {#2+#3}} - {\int_set:Nn \l__nm_final_j_int {#2+#3-1} - \bool_set_true:N \l__nm_final_open_bool}} - \bool_if:nT {\l__nm_initial_open_bool || \l__nm_final_open_bool} - \__nm_create_extra_nodes: - \__nm_actually_draw_Ldots:} -\cs_new_protected:Nn \__nm_line:nn - {\dim_zero_new:N \g__nm_x_initial_dim - \dim_zero_new:N \g__nm_y_initial_dim - \dim_zero_new:N \g__nm_x_final_dim - \dim_zero_new:N \g__nm_y_final_dim - \__nm_bool_new:N \l__nm_initial_open_bool - \__nm_bool_new:N \l__nm_final_open_bool + \__nicem_if_not_empty_cell:nnTF \l__nicem_final_i_int \l_tmpa_int + {\int_set:Nn \l__nicem_final_j_int {#2+#3}} + {\int_set:Nn \l__nicem_final_j_int {#2+#3-1} + \bool_set_true:N \l__nicem_final_open_bool}} + \bool_if:nT {\l__nicem_initial_open_bool || \l__nicem_final_open_bool} + \__nicem_create_extra_nodes: + \__nicem_actually_draw_Ldots:} +\cs_new_protected:Nn \__nicem_line:nn + {\dim_zero_new:N \g__nicem_x_initial_dim + \dim_zero_new:N \g__nicem_y_initial_dim + \dim_zero_new:N \g__nicem_x_final_dim + \dim_zero_new:N \g__nicem_y_final_dim + \__nicem_bool_new:N \l__nicem_initial_open_bool + \__nicem_bool_new:N \l__nicem_final_open_bool \begin{tikzpicture} \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ; \tikz@parse@node\pgfutil@firstofone (i) - \dim_gset:Nn \g__nm_x_initial_dim \pgf@x - \dim_gset:Nn \g__nm_y_initial_dim \pgf@y + \dim_gset:Nn \g__nicem_x_initial_dim \pgf@x + \dim_gset:Nn \g__nicem_y_initial_dim \pgf@y \tikz@parse@node\pgfutil@firstofone (f) - \dim_gset:Nn \g__nm_x_final_dim \pgf@x - \dim_gset:Nn \g__nm_y_final_dim \pgf@y + \dim_gset:Nn \g__nicem_x_final_dim \pgf@x + \dim_gset:Nn \g__nicem_y_final_dim \pgf@y \end{tikzpicture} - \__nm_draw_tikz_line:} -\bool_new:N \l__nm_block_auto_columns_width_bool + \__nicem_draw_tikz_line:} +\bool_new:N \l__nicem_block_auto_columns_width_bool \keys_define:nn {NiceMatrix/NiceMatrixBlock} {auto-columns-width .code:n = - {\bool_set_true:N \l__nm_block_auto_columns_width_bool - \dim_gzero_new:N \g__nm_max_cell_width_dim - \bool_set_true:N \l__nm_auto_columns_width_bool}} + {\bool_set_true:N \l__nicem_block_auto_columns_width_bool + \dim_gzero_new:N \g__nicem_max_cell_width_dim + \bool_set_true:N \l__nicem_auto_columns_width_bool}} \NewDocumentEnvironment {NiceMatrixBlock} {O{}} {\keys_set:nn {NiceMatrix/NiceMatrixBlock} {#1} - \int_zero_new:N \l__nm_first_env_block_int - \int_set:Nn \l__nm_first_env_block_int {\g__nm_env_int + 1}} - {\bool_if:NT \l__nm_block_auto_columns_width_bool + \int_zero_new:N \l__nicem_first_env_block_int + \int_set:Nn \l__nicem_first_env_block_int {\g__nicem_env_int + 1}} + {\bool_if:NT \l__nicem_block_auto_columns_width_bool {\iow_now:Nn \@mainaux {\ExplSyntaxOn} - \int_step_inline:nnnn \l__nm_first_env_block_int 1 \g__nm_env_int + \int_step_inline:nnnn \l__nicem_first_env_block_int 1 \g__nicem_env_int {\iow_now:Nx \@mainaux - {\cs_gset:cpn {__nm_max_cell_width_##1} - {\dim_use:N \g__nm_max_cell_width_dim}}} + {\cs_gset:cpn {__nicem_max_cell_width_##1} + {\dim_use:N \g__nicem_max_cell_width_dim}}} \iow_now:Nn \@mainaux {\ExplSyntaxOff}}} \keys_define:nn {NiceMatrix/NiceArrayC} - {parallelize-diags .bool_set:N = \l__nm_parallelize_diags_bool, + {parallelize-diags .bool_set:N = \l__nicem_parallelize_diags_bool, parallelize-diags .default:n = true, - renew-dots .bool_set:N = \l__nm_renew_dots_bool, + renew-dots .bool_set:N = \l__nicem_renew_dots_bool, renew-dots .default:n = true, - nullify-dots .bool_set:N = \l__nm_nullify_dots_bool , + nullify-dots .bool_set:N = \l__nicem_nullify_dots_bool , nullify-dots .default:n = true, - code-for-last-col .tl_set:N = \l__nm_code_for_last_col_tl, + code-for-last-col .tl_set:N = \l__nicem_code_for_last_col_tl, code-for-last-col .value_required:n = true, columns-width .code:n = \str_if_eq:nnTF {#1} {auto} {\bool_set_true:N - \l__nm_auto_columns_width_bool} - {\dim_set:Nn \l__nm_columns_width_dim {#1}}, + \l__nicem_auto_columns_width_bool} + {\dim_set:Nn \l__nicem_columns_width_dim {#1}}, columns-width .value_required:n = true, - name .code:n = {\seq_if_in:NnTF \g__nm_names_seq {#1} - {\__nm_msg_error:nn {Duplicate~name} {#1}} - {\seq_gput_left:Nn \g__nm_names_seq {#1}} - \tl_set:Nn \l__nm_name_tl {#1}}, + name .code:n = {\seq_if_in:NnTF \g__nicem_names_seq {#1} + {\__nicem_error:nn {Duplicate~name} {#1}} + {\seq_gput_left:Nn \g__nicem_names_seq {#1}} + \tl_set:Nn \l__nicem_name_tl {#1}}, name .value_required:n = true, - code-after .tl_set:N = \l__nm_code_after_tl, + code-after .tl_set:N = \l__nicem_code_after_tl, code-after .initial:n = \c_empty_tl, code-after .value_required:n = true, - create-extra-nodes .bool_set:N = \l__nm_extra_nodes_bool, + create-extra-nodes .bool_set:N = \l__nicem_extra_nodes_bool, create-extra-nodes .default:n = true, - left-margin .dim_set:N = \l__nm_left_margin_dim, + left-margin .dim_set:N = \l__nicem_left_margin_dim, left-margin .default:n = \arraycolsep, - right-margin .dim_set:N = \l__nm_right_margin_dim, + right-margin .dim_set:N = \l__nicem_right_margin_dim, right-margin .default:n = \arraycolsep, - extra-left-margin .dim_set:N = \l__nm_extra_left_margin_dim, - extra-right-margin .dim_set:N = \l__nm_extra_right_margin_dim, - unknown .code:n = \__nm_msg_error:n {Unknown~option~for~NiceArrayC}} + extra-left-margin .dim_set:N = \l__nicem_extra_left_margin_dim, + extra-right-margin .dim_set:N = \l__nicem_extra_right_margin_dim, + unknown .code:n = \__nicem_error:n {Unknown~option~for~NiceArrayC}} \msg_new:nnnn {nicematrix} {Unknown~option~for~NiceArrayC} {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~environment~ @@ -863,47 +866,47 @@ parallelize-diags~ renew-dots~ and~right-margin.} -\cs_new_protected:Nn \__nm_NiceArrayC:n - {\bool_set_true:N \l__nm_exterior_column_bool +\cs_new_protected:Nn \__nicem_NiceArrayC:n + {\bool_set_true:N \l__nicem_exterior_column_bool \begin{NiceArray} {#1 - >{\int_gincr:N \g__nm_column_int - \int_gset:Nn \g__nm_column_total_int - {\int_max:nn \g__nm_column_total_int \g__nm_column_int} + >{\int_gincr:N \g__nicem_column_int + \int_gset:Nn \g__nicem_column_total_int + {\int_max:nn \g__nicem_column_total_int \g__nicem_column_int} \hbox_set:Nw \l_tmpa_box $ % $ - \l__nm_code_for_last_col_tl + \l__nicem_code_for_last_col_tl } l <{ $ % $ \hbox_set_end: - \dim_gset:Nn \g__nm_width_last_col_dim - {\dim_max:nn \g__nm_width_last_col_dim + \dim_gset:Nn \g__nicem_width_last_col_dim + {\dim_max:nn \g__nicem_width_last_col_dim {\box_wd:N \l_tmpa_box}} \skip_horizontal:n {-2\arraycolsep} \hbox_overlap_right:n {\skip_horizontal:n - { 2\arraycolsep + \l__nm_right_margin_dim - + \l__nm_extra_right_margin_dim} + { 2\arraycolsep + \l__nicem_right_margin_dim + + \l__nicem_extra_right_margin_dim} \tikz[remember~picture, inner~sep=0pt, minimum~width=0pt, baseline] \node [anchor=base, - name = nm-\int_use:N \g__nm_env_int- - \int_use:N \g__nm_row_int- - \int_use:N \g__nm_column_int, - alias = \tl_if_empty:NF \l__nm_name_tl - {\l__nm_name_tl- - \int_use:N \g__nm_row_int- - \int_use:N \g__nm_column_int}] + name = nm-\int_use:N \g__nicem_env_int- + \int_use:N \g__nicem_row_int- + \int_use:N \g__nicem_column_int, + alias = \tl_if_empty:NF \l__nicem_name_tl + {\l__nicem_name_tl- + \int_use:N \g__nicem_row_int- + \int_use:N \g__nicem_column_int}] {\box_use:N \l_tmpa_box} ; } }}} \NewDocumentEnvironment{NiceArrayCwithDelims} {mm O{} m O{}} - {\dim_gzero_new:N \g__nm_width_last_col_dim + {\dim_gzero_new:N \g__nicem_width_last_col_dim \keys_set:nn {NiceMatrix/NiceArrayC} {#3,#5} - \bool_set_false:N \l__nm_exterior_arraycolsep_bool - \tl_set:Nn \l__nm_pos_env_tl c + \bool_set_false:N \l__nicem_exterior_arraycolsep_bool + \tl_set:Nn \l__nicem_pos_env_tl c \left#1 - \__nm_NiceArrayC:n {#4}} + \__nicem_NiceArrayC:n {#4}} {\end{NiceArray} \right#2 - \skip_horizontal:n \g__nm_width_last_col_dim + \skip_horizontal:n \g__nicem_width_last_col_dim } \NewDocumentEnvironment {pNiceArrayC} {} {\NiceArrayCwithDelims{(}{)}} @@ -921,35 +924,35 @@ {\NiceArrayCwithDelims{\{}{\}}} {\endNiceArrayCwithDelims} \keys_define:nn {NiceMatrix/NiceArrayRC} - {parallelize-diags .bool_set:N = \l__nm_parallelize_diags_bool, + {parallelize-diags .bool_set:N = \l__nicem_parallelize_diags_bool, parallelize-diags .default:n = true, - renew-dots .bool_set:N = \l__nm_renew_dots_bool, + renew-dots .bool_set:N = \l__nicem_renew_dots_bool, renew-dots .default:n = true, - nullify-dots .bool_set:N = \l__nm_nullify_dots_bool , + nullify-dots .bool_set:N = \l__nicem_nullify_dots_bool , nullify-dots .default:n = true, - code-for-first-row .tl_set:N = \l__nm_code_for_first_row_tl, + code-for-first-row .tl_set:N = \l__nicem_code_for_first_row_tl, code-for-first-row .value_required:n = true, - code-for-last-col .tl_set:N = \l__nm_code_for_last_col_tl, + code-for-last-col .tl_set:N = \l__nicem_code_for_last_col_tl, code-for-last-col .value_required:n = true, columns-width .code:n = \str_if_eq:nnTF {#1} {auto} {\bool_set_true:N - \l__nm_auto_columns_width_bool} - {\dim_set:Nn \l__nm_columns_width_dim {#1}}, + \l__nicem_auto_columns_width_bool} + {\dim_set:Nn \l__nicem_columns_width_dim {#1}}, columns-width .value_required:n = true, - name .code:n = {\seq_if_in:NnTF \g__nm_names_seq {#1} - {\__nm_msg_error:nn {Duplicate~name} {#1}} - {\seq_gput_left:Nn \g__nm_names_seq {#1}} - \tl_set:Nn \l__nm_name_tl {#1}}, - code-after .tl_set:N = \l__nm_code_after_tl, - create-extra-nodes .bool_set:N = \l__nm_extra_nodes_bool, + name .code:n = {\seq_if_in:NnTF \g__nicem_names_seq {#1} + {\__nicem_error:nn {Duplicate~name} {#1}} + {\seq_gput_left:Nn \g__nicem_names_seq {#1}} + \tl_set:Nn \l__nicem_name_tl {#1}}, + code-after .tl_set:N = \l__nicem_code_after_tl, + create-extra-nodes .bool_set:N = \l__nicem_extra_nodes_bool, create-extra-nodes .default:n = true, - left-margin .dim_set:N = \l__nm_left_margin_dim, + left-margin .dim_set:N = \l__nicem_left_margin_dim, left-margin .default:n = \arraycolsep, - right-margin .dim_set:N = \l__nm_right_margin_dim, + right-margin .dim_set:N = \l__nicem_right_margin_dim, right-margin .default:n = \arraycolsep, - extra-left-margin .dim_set:N = \l__nm_extra_left_margin_dim, - extra-right-margin .dim_set:N = \l__nm_extra_right_margin_dim, - unknown .code:n = \__nm_msg_error:n {Unknown~option~for~NiceArrayRC}} + extra-left-margin .dim_set:N = \l__nicem_extra_left_margin_dim, + extra-right-margin .dim_set:N = \l__nicem_extra_right_margin_dim, + unknown .code:n = \__nicem_error:n {Unknown~option~for~NiceArrayRC}} \msg_new:nnnn {nicematrix} {Unknown~option~for~NiceArrayRC} {The~option~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~environment~ @@ -971,31 +974,31 @@ renew-dots~ and~right~margin.} \NewDocumentEnvironment {NiceArrayRCwithDelims} {mm O{} m O{}} - {\int_zero:N \l__nm_nb_first_row_int - \dim_gzero_new:N \g__nm_width_last_col_dim + {\int_zero:N \l__nicem_nb_first_row_int + \dim_gzero_new:N \g__nicem_width_last_col_dim \keys_set:nn {NiceMatrix/NiceArrayRC} {#3,#5} - \bool_set_false:N \l__nm_exterior_arraycolsep_bool - \tl_set:Nn \l__nm_pos_env_tl c - \box_clear_new:N \l__nm_the_array_box - \hbox_set:Nw \l__nm_the_array_box + \bool_set_false:N \l__nicem_exterior_arraycolsep_bool + \tl_set:Nn \l__nicem_pos_env_tl c + \box_clear_new:N \l__nicem_the_array_box + \hbox_set:Nw \l__nicem_the_array_box $ % $ - \__nm_NiceArrayC:n {#4}} + \__nicem_NiceArrayC:n {#4}} { \end{NiceArray} $ % $ \hbox_set_end: \dim_set:Nn \l_tmpa_dim { ( \dim_max:nn {12pt} - {\g__nm_max_ht_row_one_dim + \g__nm_max_dp_row_zero_dim}) - + \g__nm_max_ht_row_zero_dim - - \g__nm_max_ht_row_one_dim } + {\g__nicem_max_ht_row_one_dim + \g__nicem_max_dp_row_zero_dim}) + + \g__nicem_max_ht_row_zero_dim + - \g__nicem_max_ht_row_one_dim } \hbox_set:Nn \l_tmpa_box {$ % $ \left#1 \vcenter {\skip_vertical:n {- \l_tmpa_dim} - \box_use_drop:N \l__nm_the_array_box} + \box_use_drop:N \l__nicem_the_array_box} \right#2 $ % $ - \skip_horizontal:n \g__nm_width_last_col_dim} + \skip_horizontal:n \g__nicem_width_last_col_dim} \box_set_ht:Nn \l_tmpa_box {\box_ht:N \l_tmpa_box + \l_tmpa_dim} \box_use_drop:N \l_tmpa_box } @@ -1016,98 +1019,98 @@ {\endNiceArrayRCwithDelims} \cs_generate_variant:Nn \dim_min:nn {vn} \cs_generate_variant:Nn \dim_max:nn {vn} -\cs_new_protected:Nn \__nm_create_extra_nodes: +\cs_new_protected:Nn \__nicem_create_extra_nodes: {\begin{tikzpicture}[remember~picture,overlay] - \int_step_variable:nnnNn \l__nm_nb_first_row_int 1 \g__nm_row_int \__nm_i - {\dim_zero_new:c {l__nm_row_\__nm_i _min_dim} - \dim_set_eq:cN {l__nm_row_\__nm_i _min_dim} \c_max_dim - \dim_zero_new:c {l__nm_row_\__nm_i _max_dim} - \dim_set:cn {l__nm_row_\__nm_i _max_dim} {-\c_max_dim}} - \int_step_variable:nnnNn 1 1 \g__nm_column_total_int \__nm_j - {\dim_zero_new:c {l__nm_column_\__nm_j _min_dim} - \dim_set_eq:cN {l__nm_column_\__nm_j _min_dim} \c_max_dim - \dim_zero_new:c {l__nm_column_\__nm_j _max_dim} - \dim_set:cn {l__nm_column_\__nm_j _max_dim} {-\c_max_dim}} - \int_step_variable:nnnNn \l__nm_nb_first_row_int 1 \g__nm_row_int \__nm_i - {\int_step_variable:nnnNn 1 1 \g__nm_column_total_int \__nm_j - {\cs_if_exist:cT {pgf@sh@ns@nm-\int_use:N \g__nm_env_int-\__nm_i-\__nm_j} + \int_step_variable:nnnNn \l__nicem_nb_first_row_int 1 \g__nicem_row_int \__nicem_i + {\dim_zero_new:c {l__nicem_row_\__nicem_i _min_dim} + \dim_set_eq:cN {l__nicem_row_\__nicem_i _min_dim} \c_max_dim + \dim_zero_new:c {l__nicem_row_\__nicem_i _max_dim} + \dim_set:cn {l__nicem_row_\__nicem_i _max_dim} {-\c_max_dim}} + \int_step_variable:nnnNn 1 1 \g__nicem_column_total_int \__nicem_j + {\dim_zero_new:c {l__nicem_column_\__nicem_j _min_dim} + \dim_set_eq:cN {l__nicem_column_\__nicem_j _min_dim} \c_max_dim + \dim_zero_new:c {l__nicem_column_\__nicem_j _max_dim} + \dim_set:cn {l__nicem_column_\__nicem_j _max_dim} {-\c_max_dim}} + \int_step_variable:nnnNn \l__nicem_nb_first_row_int 1 \g__nicem_row_int \__nicem_i + {\int_step_variable:nnnNn 1 1 \g__nicem_column_total_int \__nicem_j + {\cs_if_exist:cT {pgf@sh@ns@nm-\int_use:N \g__nicem_env_int-\__nicem_i-\__nicem_j} {\tikz@parse@node \pgfutil@firstofone - (nm-\int_use:N \g__nm_env_int-\__nm_i-\__nm_j.south~west) - \dim_set:cn {l__nm_row_\__nm_i _min_dim} - {\dim_min:vn {l__nm_row_\__nm_i _min_dim} \pgf@y} - \seq_if_in:NxF \g__nm_multicolumn_cells_seq {\__nm_i-\__nm_j} - {\dim_set:cn {l__nm_column_\__nm_j _min_dim} - {\dim_min:vn {l__nm_column_\__nm_j _min_dim} \pgf@x}} + (nm-\int_use:N \g__nicem_env_int-\__nicem_i-\__nicem_j.south~west) + \dim_set:cn {l__nicem_row_\__nicem_i _min_dim} + {\dim_min:vn {l__nicem_row_\__nicem_i _min_dim} \pgf@y} + \seq_if_in:NxF \g__nicem_multicolumn_cells_seq {\__nicem_i-\__nicem_j} + {\dim_set:cn {l__nicem_column_\__nicem_j _min_dim} + {\dim_min:vn {l__nicem_column_\__nicem_j _min_dim} \pgf@x}} \tikz@parse@node \pgfutil@firstofone - (nm-\int_use:N \g__nm_env_int-\__nm_i-\__nm_j.north~east) - \dim_set:cn {l__nm_row_\__nm_i _max_dim} - {\dim_max:vn {l__nm_row_\__nm_i _max_dim} \pgf@y} - \seq_if_in:NxF \g__nm_multicolumn_cells_seq {\__nm_i-\__nm_j} - {\dim_set:cn {l__nm_column_\__nm_j _max_dim} - {\dim_max:vn {l__nm_column_\__nm_j _max_dim} \pgf@x}}} + (nm-\int_use:N \g__nicem_env_int-\__nicem_i-\__nicem_j.north~east) + \dim_set:cn {l__nicem_row_\__nicem_i _max_dim} + {\dim_max:vn {l__nicem_row_\__nicem_i _max_dim} \pgf@y} + \seq_if_in:NxF \g__nicem_multicolumn_cells_seq {\__nicem_i-\__nicem_j} + {\dim_set:cn {l__nicem_column_\__nicem_j _max_dim} + {\dim_max:vn {l__nicem_column_\__nicem_j _max_dim} \pgf@x}}} }} \tikzset{name~suffix = -medium} - \__nm_create_nodes: - \int_set:Nn \l__nm_nb_first_row_int 1 - \int_step_variable:nnnNn 1 1 {\g__nm_row_int-1} \__nm_i - {\dim_set:cn {l__nm_row_\__nm_i _min_dim} - {( \dim_use:c {l__nm_row_\__nm_i _min_dim} - + \dim_use:c {l__nm_row_\int_eval:n{\__nm_i+1}_max_dim}) / 2} - \dim_set_eq:cc {l__nm_row_\int_eval:n{\__nm_i+1}_max_dim} - {l__nm_row_\__nm_i _min_dim} } - \int_step_variable:nnnNn 1 1 {\g__nm_column_int-1} \__nm_j - {\dim_set:cn {l__nm_column_\__nm_j _max_dim} - {( \dim_use:c {l__nm_column_\__nm_j _max_dim} - + \dim_use:c {l__nm_column_\int_eval:n{\__nm_j+1}_min_dim}) / 2} - \dim_set_eq:cc {l__nm_column_\int_eval:n{\__nm_j+1}_min_dim} - {l__nm_column_\__nm_j _max_dim} } - \dim_sub:cn {l__nm_column_1_min_dim} \g__nm_left_margin_dim - \dim_add:cn {l__nm_column_\int_use:N \g__nm_column_int _max_dim} - \g__nm_right_margin_dim + \__nicem_create_nodes: + \int_set:Nn \l__nicem_nb_first_row_int 1 + \int_step_variable:nnnNn 1 1 {\g__nicem_row_int-1} \__nicem_i + {\dim_set:cn {l__nicem_row_\__nicem_i _min_dim} + {( \dim_use:c {l__nicem_row_\__nicem_i _min_dim} + + \dim_use:c {l__nicem_row_\int_eval:n{\__nicem_i+1}_max_dim}) / 2} + \dim_set_eq:cc {l__nicem_row_\int_eval:n{\__nicem_i+1}_max_dim} + {l__nicem_row_\__nicem_i _min_dim} } + \int_step_variable:nnnNn 1 1 {\g__nicem_column_int-1} \__nicem_j + {\dim_set:cn {l__nicem_column_\__nicem_j _max_dim} + {( \dim_use:c {l__nicem_column_\__nicem_j _max_dim} + + \dim_use:c {l__nicem_column_\int_eval:n{\__nicem_j+1}_min_dim}) / 2} + \dim_set_eq:cc {l__nicem_column_\int_eval:n{\__nicem_j+1}_min_dim} + {l__nicem_column_\__nicem_j _max_dim} } + \dim_sub:cn {l__nicem_column_1_min_dim} \g__nicem_left_margin_dim + \dim_add:cn {l__nicem_column_\int_use:N \g__nicem_column_int _max_dim} + \g__nicem_right_margin_dim \tikzset{name~suffix = -large} - \__nm_create_nodes: + \__nicem_create_nodes: \end{tikzpicture} - \cs_set:Nn \__nm_create_extra_nodes: {}} -\cs_new_protected:Nn \__nm_create_nodes: - {\int_step_variable:nnnNn \l__nm_nb_first_row_int 1 \g__nm_row_int \__nm_i - {\int_step_variable:nnnNn 1 1 \g__nm_column_total_int \__nm_j - {\coordinate (__nm~south~west) - at (\dim_use:c {l__nm_column_\__nm_j _min_dim}, - \dim_use:c {l__nm_row_\__nm_i _min_dim}) ; - \coordinate (__nm~north~east) - at (\dim_use:c {l__nm_column_\__nm_j _max_dim}, - \dim_use:c {l__nm_row_\__nm_i _max_dim}) ; - \draw node [fit = {(__nm~south~west) (__nm~north~east)}, + \cs_set:Nn \__nicem_create_extra_nodes: {}} +\cs_new_protected:Nn \__nicem_create_nodes: + {\int_step_variable:nnnNn \l__nicem_nb_first_row_int 1 \g__nicem_row_int \__nicem_i + {\int_step_variable:nnnNn 1 1 \g__nicem_column_total_int \__nicem_j + {\coordinate (__nicem~south~west) + at (\dim_use:c {l__nicem_column_\__nicem_j _min_dim}, + \dim_use:c {l__nicem_row_\__nicem_i _min_dim}) ; + \coordinate (__nicem~north~east) + at (\dim_use:c {l__nicem_column_\__nicem_j _max_dim}, + \dim_use:c {l__nicem_row_\__nicem_i _max_dim}) ; + \draw node [fit = {(__nicem~south~west) (__nicem~north~east)}, inner~sep=0pt, - name = nm-\int_use:N \g__nm_env_int-\__nm_i-\__nm_j, - alias = \tl_if_empty:NF \g__nm_name_tl - {\tl_use:N \g__nm_name_tl-\__nm_i-\__nm_j}] + name = nm-\int_use:N \g__nicem_env_int-\__nicem_i-\__nicem_j, + alias = \tl_if_empty:NF \g__nicem_name_tl + {\tl_use:N \g__nicem_name_tl-\__nicem_i-\__nicem_j}] {} ; } } - \__nm_seq_mapthread_function:NNN \g__nm_multicolumn_cells_seq - \g__nm_multicolumn_sizes_seq - \__nm_node_for_multicolumn:nn + \__nicem_seq_mapthread_function:NNN \g__nicem_multicolumn_cells_seq + \g__nicem_multicolumn_sizes_seq + \__nicem_node_for_multicolumn:nn } -\cs_set:Npn \__nm_extract_coords: #1-#2\q_stop{\cs_set:Npn \__nm_i {#1} - \cs_set:Npn \__nm_j {#2}} -\cs_new_protected:Nn \__nm_node_for_multicolumn:nn - {\__nm_extract_coords: #1\q_stop - \coordinate (__nm~south~west) - at (\dim_use:c {l__nm_column_\__nm_j _min_dim}, - \dim_use:c {l__nm_row_\__nm_i _min_dim}) ; - \coordinate (__nm~north~east) - at (\dim_use:c {l__nm_column_\int_eval:n{\__nm_j+#2-1}_max_dim}, - \dim_use:c {l__nm_row_\__nm_i _max_dim}) ; - \draw node [fit = {(__nm~south~west) (__nm~north~east)}, +\cs_set:Npn \__nicem_extract_coords: #1-#2\q_stop{\cs_set:Npn \__nicem_i {#1} + \cs_set:Npn \__nicem_j {#2}} +\cs_new_protected:Nn \__nicem_node_for_multicolumn:nn + {\__nicem_extract_coords: #1\q_stop + \coordinate (__nicem~south~west) + at (\dim_use:c {l__nicem_column_\__nicem_j _min_dim}, + \dim_use:c {l__nicem_row_\__nicem_i _min_dim}) ; + \coordinate (__nicem~north~east) + at (\dim_use:c {l__nicem_column_\int_eval:n{\__nicem_j+#2-1}_max_dim}, + \dim_use:c {l__nicem_row_\__nicem_i _max_dim}) ; + \draw node [fit = {(__nicem~south~west) (__nicem~north~east)}, inner~sep=0pt, - name = nm-\int_use:N \g__nm_env_int-\__nm_i-\__nm_j, - alias = \tl_if_empty:NF \g__nm_name_tl - {\tl_use:N \g__nm_name_tl-\__nm_i-\__nm_j}] + name = nm-\int_use:N \g__nicem_env_int-\__nicem_i-\__nicem_j, + alias = \tl_if_empty:NF \g__nicem_name_tl + {\tl_use:N \g__nicem_name_tl-\__nicem_i-\__nicem_j}] {} ; } \ProcessKeysOptions {NiceMatrix} -\cs_new:Npn \__nm_seq_mapthread_function:NNN #1#2#3 +\cs_new:Npn \__nicem_seq_mapthread_function:NNN #1#2#3 {\group_begin: \int_step_inline:nnnn 1 1 {\seq_count:N #1} {\seq_pop:NN #1 \l_tmpa_tl @@ -1115,7 +1118,7 @@ \exp_args:NVV #3 \l_tmpa_tl \l_tmpb_tl} \group_end: } -\cs_set:Nn \__nm_renew_matrix: +\cs_set:Nn \__nicem_renew_matrix: {\RenewDocumentEnvironment {pmatrix} {} {\begin{pNiceMatrix}} {\end{pNiceMatrix}} |