diff options
author | Karl Berry <karl@freefriends.org> | 2023-12-04 22:09:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-12-04 22:09:00 +0000 |
commit | 5b9a40e36800f9a52ca4573f534a04f8f011233f (patch) | |
tree | 2d60bae8600495c9a2da7b92e04f00ee13983998 /Master/texmf-dist/source/latex/nicematrix | |
parent | 4ff428a9cd5523d5bbdcc1b6227a45f74f9256ce (diff) |
nicematrix (4dec23)
git-svn-id: svn://tug.org/texlive/trunk@69034 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/nicematrix')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx | 1496 |
1 files changed, 828 insertions, 668 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx index 63334d973ff..3683787bcf0 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.26} -\def\myfiledate{2023/11/22} +\def\myfileversion{6.26a} +\def\myfiledate{2023/12/04} % % %<*batchfile> @@ -205,8 +205,8 @@ version 2005/12/01 or later. \bool_new:N \g_@@_messages_for_Overleaf_bool \bool_gset:Nn \g_@@_messages_for_Overleaf_bool { - \str_if_eq_p:Vn \c_sys_jobname_str { _region_ } % for Emacs - || \str_if_eq_p:Vn \c_sys_jobname_str { output } % for Overleaf + \str_if_eq_p:on \c_sys_jobname_str { _region_ } % for Emacs + || \str_if_eq_p:on \c_sys_jobname_str { output } % for Overleaf } % \end{macrocode} % @@ -370,6 +370,27 @@ version 2005/12/01 or later. % \bigskip % \section{Technical definitions} % +% +% The following constants are defined only for efficiency in the tests. +% \begin{macrocode} +\tl_const:Nn \c_@@_b_tl { b } +\tl_const:Nn \c_@@_c_tl { c } +\tl_const:Nn \c_@@_l_tl { l } +\tl_const:Nn \c_@@_r_tl { r } +\tl_const:Nn \c_@@_all_tl { all } +\tl_const:Nn \c_@@_dot_tl { . } +\tl_const:Nn \c_@@_default_tl { default } +\tl_const:Nn \c_@@_star_tl { * } +\str_const:Nn \c_@@_r_str { r } +\str_const:Nn \c_@@_c_str { c } +\str_const:Nn \c_@@_l_str { l } +\str_const:Nn \c_@@_R_str { R } +\str_const:Nn \c_@@_C_str { C } +\str_const:Nn \c_@@_L_str { L } +\str_const:Nn \c_@@_j_str { j } +\str_const:Nn \c_@@_si_str { si } +% \end{macrocode} +% % The following token list will be used for definitions of user commands (with % |\NewDocumentCommand|) with an embellishment using an \emph{underscore} (there % may be problems because of the catcode of the underscore). @@ -474,12 +495,12 @@ version 2005/12/01 or later. \mathinner { \tex_mkern:D 1 mu - \box_move_up:nn { 1 pt } { \hbox:n { . } } + \box_move_up:nn { 1 pt } { \hbox { . } } \tex_mkern:D 2 mu - \box_move_up:nn { 4 pt } { \hbox:n { . } } + \box_move_up:nn { 4 pt } { \hbox { . } } \tex_mkern:D 2 mu \box_move_up:nn { 7 pt } - { \vbox:n { \kern 7 pt \hbox:n { . } } } + { \vbox:n { \kern 7 pt \hbox { . } } } \tex_mkern:D 1 mu } } @@ -536,7 +557,7 @@ version 2005/12/01 or later. \cs_set:Npn \CT@arc #1 #2 { \dim_compare:nNnT \baselineskip = \c_zero_dim \noalign - { \cs_gset:Npn \CT@arc@ { \color #1 { #2 } } } + { \cs_gset_nopar:Npn \CT@arc@ { \color #1 { #2 } } } } % \end{macrocode} % Idem for |\CT@drs@|. @@ -570,7 +591,8 @@ version 2005/12/01 or later. \cs_set:Npn \@@_standard_cline:w #1-#2 \q_stop { \int_if_zero:nT \l_@@_first_col_int { \omit & } - \int_compare:nNnT { #1 } > 1 { \multispan { \int_eval:n { #1 - 1 } } & } + \int_compare:nNnT { #1 } > \c_one_int + { \multispan { \int_eval:n { #1 - 1 } } & } \multispan { \int_eval:n { #2 - #1 + 1 } } { \CT@arc@ @@ -647,10 +669,10 @@ version 2005/12/01 or later. % % % \bigskip -% The following command is a small shortcut. +% The following command will be nullified in the environment |{NiceTabular}|, +% |{NiceTabular*}| and |{NiceTabularX}|. % \begin{macrocode} -\cs_new:Npn \@@_math_toggle_token: - { \bool_if:NF \l_@@_tabular_bool \c_math_toggle_token } +\cs_set_eq:NN \@@_math_toggle: \c_math_toggle_token % \end{macrocode} % % \bigskip @@ -664,7 +686,7 @@ version 2005/12/01 or later. { \cs_set:Npn \CT@arc@ { \color { #1 } } } } } -\cs_generate_variant:Nn \@@_set_CT@arc@:n { V } +\cs_generate_variant:Nn \@@_set_CT@arc@:n { o } % \end{macrocode} % % \bigskip @@ -675,7 +697,7 @@ version 2005/12/01 or later. { \cs_set:Npn \CT@drsc@ { \color #1 } } { \cs_set:Npn \CT@drsc@ { \color { #1 } } } } -\cs_generate_variant:Nn \@@_set_CT@drsc@:n { V } +\cs_generate_variant:Nn \@@_set_CT@drsc@:n { o } % \end{macrocode} % % \bigskip @@ -688,14 +710,14 @@ version 2005/12/01 or later. { #1 #2 } { #1 { #2 } } } -\cs_generate_variant:Nn \@@_exp_color_arg:Nn { N V } +\cs_generate_variant:Nn \@@_exp_color_arg:Nn { N o } % \end{macrocode} % % The following command must be protected because of its use of the command |\color|. % \begin{macrocode} \cs_new_protected:Npn \@@_color:n #1 { \tl_if_blank:nF { #1 } { \@@_exp_color_arg:Nn \color { #1 } } } -\cs_generate_variant:Nn \@@_color:n { V } +\cs_generate_variant:Nn \@@_color:n { o } % \end{macrocode} % % \bigskip @@ -776,10 +798,10 @@ version 2005/12/01 or later. \hook_gput_code:nnn { begindocument } { . } { \bool_if:NTF \c_@@_revtex_bool - { \cs_new_protected:Npn \@@_redefine_mkpream: { } } + { \cs_set_eq:NN \@@_redefine_mkpream: \prg_do_nothing: } { \IfPackageLoadedTF { arydshln } - { \cs_new_protected:Npn \@@_redefine_mkpream: { } } + { \cs_set_eq:NN \@@_redefine_mkpream: \prg_do_nothing: } { \cs_new_protected:Npn \@@_redefine_mkpream: { \cs_set_eq:NN \@mkpream \@@_mkpream: } @@ -954,9 +976,10 @@ version 2005/12/01 or later. % |r|, |l|, |c| and |j|. For example, a column |p[l]{3cm}| will provide the % value |l| for all the cells of the column. % \begin{macrocode} -\str_new:N \l_@@_hpos_cell_str -\str_set:Nn \l_@@_hpos_cell_str { c } +\tl_new:N \l_@@_hpos_cell_tl +\tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_c_tl % \end{macrocode} +% % % \bigskip % When there is a mono-column block (created by the command |\Block|), we want @@ -974,13 +997,6 @@ version 2005/12/01 or later. \dim_new:N \g_@@_blocks_ht_dim \dim_new:N \g_@@_blocks_dp_dim % \end{macrocode} -% -% \bigskip -% The following dimension will be used by the command |\Block| for the blocks -% with a key of vertical position equal to |T| or |B|. -% \begin{macrocode} -\dim_new:N \l_@@_block_ysep_dim -% \end{macrocode} % % \bigskip % The following dimension correspond to the key |width| (which may be fixed in @@ -1110,7 +1126,7 @@ version 2005/12/01 or later. % |matrix / columns-type| of |\NiceMatrixOptions|. % \begin{macrocode} \tl_new:N \l_@@_columns_type_tl -\tl_set:Nn \l_@@_columns_type_tl { c } +\str_set:Nn \l_@@_columns_type_tl { c } % \end{macrocode} % % \bigskip @@ -1201,15 +1217,6 @@ version 2005/12/01 or later. \tl_new:N \l_@@_pgf_node_code_tl % \end{macrocode} % -% \bigskip -% The following token list has a function similar to -% |\g_nicematrix_code_after_tl| but it is used internally by \pkg{nicematrix}. -% In fact, we have to distinguish between |\g_nicematrix_code_after_tl| and -% |\g_@@_pre_code_after_tl| because we must take care of the order in which -% instructions stored in that parameters are executed. -% \begin{macrocode} - -% \end{macrocode} % % \bigskip % The so-called |\CodeBefore| is splitted in two parts because we want to control @@ -1462,7 +1469,16 @@ version 2005/12/01 or later. \int_new:N \l_@@_col_min_int \int_new:N \l_@@_col_max_int % \end{macrocode} -% +% \medskip +% The following counters will be used when drawing the rules. +% \begin{macrocode} +\int_new:N \l_@@_start_int +\int_set_eq:NN \l_@@_start_int \c_one_int +\int_new:N \l_@@_end_int +\int_new:N \l_@@_local_start_int +\int_new:N \l_@@_local_end_int +% \end{macrocode} +% % \medskip % The following sequence will be used when the command |\SubMatrix| is used in % the |\CodeBefore| (and not in the |\CodeAfter|). It will contain the position of @@ -1552,8 +1568,8 @@ version 2005/12/01 or later. % \medskip % For the vertical position, the possible values are |c|, |t| and |b|. % \begin{macrocode} -\str_new:N \l_@@_vpos_of_block_str -\str_set:Nn \l_@@_vpos_of_block_str { c } +\str_new:N \l_@@_vpos_block_str +\str_set:Nn \l_@@_vpos_block_str { c } % \end{macrocode} % % @@ -1640,7 +1656,7 @@ version 2005/12/01 or later. % the value will be~$0$. % \begin{macrocode} \int_new:N \l_@@_first_col_int -\int_set:Nn \l_@@_first_col_int 1 +\int_set_eq:NN \l_@@_first_col_int \c_one_int % \end{macrocode} % % \medskip @@ -1720,8 +1736,8 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_protected:Npn \@@_cut_on_hyphen:w #1-#2\q_stop { - \tl_set:Nn \l_tmpa_tl { #1 } - \tl_set:Nn \l_tmpb_tl { #2 } + \cs_set_nopar:Npn \l_tmpa_tl { #1 } + \cs_set_nopar:Npn \l_tmpb_tl { #2 } } % \end{macrocode} % @@ -1733,7 +1749,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_expand_clist:N #1 { - \clist_if_in:NnF #1 { all } + \clist_if_in:NVF #1 \c_@@_all_tl { \clist_clear:N \l_tmpa_clist \clist_map_inline:Nn #1 @@ -1741,8 +1757,8 @@ version 2005/12/01 or later. \tl_if_in:nnTF { ##1 } { - } { \@@_cut_on_hyphen:w ##1 \q_stop } { - \tl_set:Nn \l_tmpa_tl { ##1 } - \tl_set:Nn \l_tmpb_tl { ##1 } + \cs_set_nopar:Npn \l_tmpa_tl { ##1 } + \cs_set_nopar:Npn \l_tmpb_tl { ##1 } } \int_step_inline:nnn { \l_tmpa_tl } { \l_tmpb_tl } { \clist_put_right:Nn \l_tmpa_clist { ####1 } } @@ -1929,14 +1945,15 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \tabularnote { o m } { - \bool_if:nT { \cs_if_exist_p:N \@captype || \l_@@_in_env_bool } + \bool_lazy_or:nnT { \cs_if_exist_p:N \@captype } \l_@@_in_env_bool { - \bool_if:nTF { ! \l_@@_tabular_bool && \l_@@_in_env_bool } + \bool_lazy_and:nnTF { ! \l_@@_tabular_bool } \l_@@_in_env_bool { \@@_error:n { tabularnote~forbidden } } { \bool_if:NTF \l_@@_in_caption_bool - { \@@_tabularnote_caption:nn { #1 } { #2 } } - { \@@_tabularnote:nn { #1 } { #2 } } + \@@_tabularnote_caption:nn + \@@_tabularnote:nn + { #1 } { #2 } } } } @@ -2017,7 +2034,7 @@ version 2005/12/01 or later. % labels of these tabular notes (in the array). We compose those labels in a box % |\l_tmpa_box| because we will do a special construction in order to have this % box in an overlapping position if we are at the end of a cell when -% |\l_@@_hpos_cell_str| is equal to |c| or |r|. +% |\l_@@_hpos_cell_tl| is equal to |c| or |r|. % \begin{macrocode} \hbox_set:Nn \l_tmpa_box { @@ -2034,15 +2051,15 @@ version 2005/12/01 or later. % \end{macrocode} % We want the (last) tabular note referenceable (with the standard command |\label|). % \begin{macrocode} - \int_gsub:Nn \c@tabularnote { 1 } + \int_gdecr:N \c@tabularnote \int_set_eq:NN \l_tmpa_int \c@tabularnote \refstepcounter { tabularnote } \int_compare:nNnT \l_tmpa_int = \c@tabularnote { \int_gincr:N \c@tabularnote } \seq_clear:N \l_@@_notes_labels_seq \bool_lazy_or:nnTF - { \str_if_eq_p:Vn \l_@@_hpos_cell_str { c } } - { \str_if_eq_p:Vn \l_@@_hpos_cell_str { r } } + { \tl_if_eq_p:NN \l_@@_hpos_cell_tl \c_@@_c_tl } + { \tl_if_eq_p:NN \l_@@_hpos_cell_tl \c_@@_r_tl } { \hbox_overlap_right:n { \box_use:N \l_tmpa_box } % \end{macrocode} @@ -2071,8 +2088,7 @@ version 2005/12/01 or later. { \bool_if:NTF \g_@@_caption_finished_bool { - \int_compare:nNnT - \c@tabularnote = \g_@@_notes_caption_int + \int_compare:nNnT \c@tabularnote = \g_@@_notes_caption_int { \int_gzero:N \c@tabularnote } % \end{macrocode} % Now, we try to detect duplicate notes in the caption. @@ -2354,10 +2370,10 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip -% The following flag corresponds to the key |respect-arraystretch| (that key has -% an effect on the blocks). +% When the key |respect-arraystretch| is used, the following command will be nullified. % \begin{macrocode} -\bool_new:N \l_@@_respect_arraystretch_bool +\cs_new_protected:Npn \@@_reset_arraystretch: + { \cs_set_nopar:Npn \arraystretch { 1 } } % \end{macrocode} % % @@ -2596,13 +2612,13 @@ version 2005/12/01 or later. hvlines .code:n = { \bool_set_true:N \l_@@_hvlines_bool - \clist_set:Nn \l_@@_vlines_clist { all } - \clist_set:Nn \l_@@_hlines_clist { all } + \tl_set_eq:NN \l_@@_vlines_clist \c_@@_all_tl + \tl_set_eq:NN \l_@@_hlines_clist \c_@@_all_tl } , hvlines-except-borders .code:n = { - \clist_set:Nn \l_@@_vlines_clist { all } - \clist_set:Nn \l_@@_hlines_clist { all } + \tl_set_eq:NN \l_@@_vlines_clist \c_@@_all_tl + \tl_set_eq:NN \l_@@_hlines_clist \c_@@_all_tl \bool_set_true:N \l_@@_hvlines_bool \bool_set_true:N \l_@@_except_borders_bool } , @@ -2632,8 +2648,9 @@ version 2005/12/01 or later. extra-margin .meta:n = { extra-left-margin = #1 , extra-right-margin = #1 } , extra-margin .value_required:n = true , - respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool , - respect-arraystretch .default:n = true , + respect-arraystretch .code:n = + \cs_set_eq:NN \@@_reset_arraystretch: \prg_do_nothing: , + respect-arraystretch .value_forbidden:n = true , pgf-node-code .tl_set:N = \l_@@_pgf_node_code_tl , pgf-node-code .value_required:n = true } @@ -3051,50 +3068,75 @@ version 2005/12/01 or later. % the |\everycr| because some packages, like \pkg{arydshln}, create special rows % in the |\halign| that we don't want to take into account. % \begin{macrocode} - \int_compare:nNnT \c@jCol = 1 - { \int_compare:nNnT \l_@@_first_col_int = 1 \@@_begin_of_row: } + \int_compare:nNnT \c@jCol = \c_one_int + { \int_compare:nNnT \l_@@_first_col_int = \c_one_int \@@_begin_of_row: } % \end{macrocode} % The content of the cell is composed in the box |\l_@@_cell_box|. The -% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the -% |\@@_cell_end:| (and the potential |\c_math_toggle_token| also). +% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| is in the +% |\@@_cell_end:|. % \begin{macrocode} \hbox_set:Nw \l_@@_cell_box - \bool_if:NF \l_@@_tabular_bool - { - \c_math_toggle_token - \bool_if:NT \l_@@_small_bool \scriptstyle - } +% \end{macrocode} +% The following command is nullified in the tabulars. +% \begin{macrocode} + \@@_tuning_not_tabular_begin: % \end{macrocode} % % \begin{macrocode} + \@@_tuning_first_row: + \@@_tuning_last_row: \g_@@_row_style_tl + } % \end{macrocode} -% -% We will call \emph{corners} of the matrix the cases which are at the -% intersection of the exterior rows and exterior columns (of course, the four -% corners doesn't always exist simultaneously). % -% The codes |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the -% corners of the matrix. +% The following command will be nullified unless there is a first row. % \begin{macrocode} - \int_if_zero:nTF \c@iRow +\cs_new_protected:Npn \@@_tuning_first_row: + { + \int_if_zero:nT \c@iRow { - \int_compare:nNnT \c@jCol > 0 + \int_compare:nNnT \c@jCol > \c_zero_int { \l_@@_code_for_first_row_tl \xglobal \colorlet { nicematrix-first-row } { . } } } + } +% \end{macrocode} +% +% The following command will be nullified unless there is a last row and we +% know its value (\emph{ie}: |\l_@@_lat_row_int > 0|). +% \begin{macrocode} +\cs_new_protected:Npn \@@_tuning_last_row: + { + \int_compare:nNnT \c@iRow = \l_@@_last_row_int { - \int_compare:nNnT \c@iRow = \l_@@_last_row_int - { - \l_@@_code_for_last_row_tl - \xglobal \colorlet { nicematrix-last-row } { . } - } + \l_@@_code_for_last_row_tl + \xglobal \colorlet { nicematrix-last-row } { . } } } % \end{macrocode} +% +% A different value will be provided to the following command when the key +% |small| is in force. +% \begin{macrocode} +\cs_set_eq:NN \@@_tuning_key_small: \prg_do_nothing: +% \end{macrocode} % +% The following commands are nullified in the tabulars. +% \begin{macrocode} +\cs_set_nopar:Npn \@@_tuning_not_tabular_begin: + { + \c_math_toggle_token +% \end{macrocode} +% A special value is provided by the following controls sequence when the key +% |small| is in force. +% \begin{macrocode} + \@@_tuning_key_small: + } +\cs_set_eq:NN \@@_tuning_not_tabular_end: \c_math_toggle_token +% \end{macrocode} +% % \interitem % The following macro |\@@_begin_of_row| is usually used in the cell % number~$1$ of the row. However, when the key |first-col| is used, @@ -3140,7 +3182,7 @@ version 2005/12/01 or later. { \dim_max:nn \g_@@_ht_row_zero_dim { \box_ht:N \l_@@_cell_box } } } { - \int_compare:nNnT \c@iRow = 1 + \int_compare:nNnT \c@iRow = \c_one_int { \dim_gset:Nn \g_@@_ht_row_one_dim { \dim_max:nn \g_@@_ht_row_one_dim { \box_ht:N \l_@@_cell_box } } @@ -3204,8 +3246,11 @@ version 2005/12/01 or later. % % \begin{macrocode} \cs_new_protected:Npn \@@_cell_end: - { - \@@_math_toggle_token: + { +% \end{macrocode} +% The following command is nullified in the tabulars. +% \begin{macrocode} + \@@_tuning_not_tabular_end: \hbox_set_end: \@@_cell_end_i: } @@ -3273,11 +3318,14 @@ version 2005/12/01 or later. \bool_if:NTF \g_@@_empty_cell_bool { \box_use_drop:N \l_@@_cell_box } { - \bool_lazy_or:nnTF + \bool_if:NTF \g_@@_not_empty_cell_bool - { \dim_compare_p:nNn { \box_wd:N \l_@@_cell_box } > \c_zero_dim } \@@_node_for_cell: - { \box_use_drop:N \l_@@_cell_box } + { + \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim + \@@_node_for_cell: + { \box_use_drop:N \l_@@_cell_box } + } } \int_gset:Nn \g_@@_col_total_int { \int_max:nn \g_@@_col_total_int \c@jCol } \bool_gset_false:N \g_@@_empty_cell_bool @@ -3302,7 +3350,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_cell_end_for_w_s: { - \@@_math_toggle_token: + \@@_math_toggle: \hbox_set_end: \bool_if:NF \g_@@_rotate_bool { @@ -3569,7 +3617,7 @@ version 2005/12/01 or later. % \begin{macrocode} \tl_if_empty:NF \l_@@_hlines_clist { - \tl_if_eq:NnF \l_@@_hlines_clist { all } + \tl_if_eq:NNF \l_@@_hlines_clist \c_@@_all_tl { \exp_args:NNe \clist_if_in:NnT @@ -3704,6 +3752,10 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_nopar:Npn \arraystretch { 0.47 } \dim_set:Nn \arraycolsep { 1.45 pt } +% \end{macrocode} +% By default, |\@@_small_scripstyle:| is null. +% \begin{macrocode} + \cs_set_eq:NN \@@_tuning_key_small: \scriptstyle } % \end{macrocode} % @@ -3799,6 +3851,10 @@ version 2005/12/01 or later. \cs_set_eq:NN \rowcolor \@@_rowcolor_tabular \cs_set_eq:NN \rowcolors \@@_rowcolors_tabular \cs_set_eq:NN \rowlistcolors \@@_rowlistcolors_tabular + \int_compare:nNnT \l_@@_first_row_int > \c_zero_int + { \cs_set_eq:NN \@@_tuning_first_row: \prg_do_nothing: } + \int_compare:nNnT \l_@@_last_row_int < \c_zero_int + { \cs_set_eq:NN \@@_tuning_last_row: \prg_do_nothing: } \bool_if:NT \l_@@_renew_dots_bool \@@_renew_dots: % \end{macrocode} % We redefine |\multicolumn| and, since we want |\multicolumn| to be available @@ -4494,7 +4550,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} - \@@_set_CT@arc@:V \l_@@_rules_color_tl + \@@_set_CT@arc@:o \l_@@_rules_color_tl % \end{macrocode} % % \bigskip @@ -4540,7 +4596,7 @@ version 2005/12/01 or later. % |X|-column of weight~$n$, the width will be |\l_@@_X_columns_dim| multiplied % by~$n$. % \begin{macrocode} - \int_compare:nNnT \g_@@_total_X_weight_int > 0 + \int_compare:nNnT \g_@@_total_X_weight_int > \c_zero_int { \tl_build_gput_right:Nx \g_@@_aux_tl { @@ -4593,7 +4649,7 @@ version 2005/12/01 or later. % has the number~$0$.} % \begin{macrocode} \int_gset_eq:NN \c@jCol \g_@@_col_total_int - \bool_if:nTF \g_@@_last_col_found_bool + \bool_if:NTF \g_@@_last_col_found_bool { \int_gdecr:N \c@jCol } { \int_compare:nNnT \l_@@_last_col_int > { -1 } @@ -4617,10 +4673,7 @@ version 2005/12/01 or later. % p.~\pageref{overlap-left}). % \begin{macrocode} \int_if_zero:nT \l_@@_first_col_int - { - % \skip_horizontal:N \col@sep % 05-08-23 - \skip_horizontal:N \g_@@_width_first_col_dim - } + { \skip_horizontal:N \g_@@_width_first_col_dim } % \end{macrocode} % % The construction of the real box is different whether we have delimiters to @@ -4628,12 +4681,13 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:nTF { ! \g_@@_delims_bool } { - \str_case:VnF \l_@@_baseline_tl - { - b \@@_use_arraybox_with_notes_b: - c \@@_use_arraybox_with_notes_c: + \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_c_tl + \@@_use_arraybox_with_notes_c: + { + \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_b_tl + \@@_use_arraybox_with_notes_b: + \@@_use_arraybox_with_notes: } - \@@_use_arraybox_with_notes: } % \end{macrocode} % @@ -4669,7 +4723,7 @@ version 2005/12/01 or later. \hbox_set:Nn \l_tmpa_box { \c_math_toggle_token - \@@_color:V \l_@@_delimiters_color_tl + \@@_color:o \l_@@_delimiters_color_tl \exp_after:wN \left \g_@@_left_delim_tl \vcenter { @@ -4692,14 +4746,9 @@ version 2005/12/01 or later. % We take into account the ``last row'' (we have previously computed its total % height in |\l_tmpb_dim|). % \begin{macrocode} - \skip_vertical:n { -\l_tmpb_dim + \arrayrulewidth } + \skip_vertical:N -\l_tmpb_dim + \skip_vertical:N \arrayrulewidth } -% \end{macrocode} -% Curiously, we have to put again the following specification of color. -% Otherwise, with XeLaTeX (and not with the other engines), the closing -% delimiter is not colored. -% \begin{macrocode} - \@@_color:V \l_@@_delimiters_color_tl \exp_after:wN \right \g_@@_right_delim_tl \c_math_toggle_token } @@ -4713,7 +4762,8 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_delimiters_max_width_bool { \@@_put_box_in_flow_bis:nn - \g_@@_left_delim_tl \g_@@_right_delim_tl + \g_@@_left_delim_tl + \g_@@_right_delim_tl } \@@_put_box_in_flow: } @@ -4724,10 +4774,7 @@ version 2005/12/01 or later. % |\g_@@_width_last_col_dim|: see p.~\pageref{overlap-right}). % \begin{macrocode} \bool_if:NT \g_@@_last_col_found_bool - { - \skip_horizontal:N \g_@@_width_last_col_dim - % \skip_horizontal:N \col@sep % 2023-08-05 - } + { \skip_horizontal:N \g_@@_width_last_col_dim } \bool_if:NT \l_@@_preamble_bool { \int_compare:nNnT \c@jCol < \g_@@_static_num_of_col_int @@ -4752,7 +4799,7 @@ version 2005/12/01 or later. \iow_now:Nx \@mainaux { \tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl } - { \exp_not:V \g_@@_aux_tl } + { \exp_not:o \g_@@_aux_tl } } \iow_now:Nn \@mainaux { \ExplSyntaxOff } % \end{macrocode} @@ -4809,7 +4856,7 @@ version 2005/12/01 or later. % \begin{macrocode} \int_zero:N \l_tmpa_int \tl_gclear:N \g_@@_array_preamble_tl - \tl_if_eq:NnTF \l_@@_vlines_clist { all } + \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl { \tl_gset:Nn \g_@@_array_preamble_tl { ! { \skip_horizontal:N \arrayrulewidth } } @@ -4869,9 +4916,11 @@ version 2005/12/01 or later. % If there were delimiters at the beginning or at the end of the preamble, the % environment |{NiceArray}| is transformed into an environment |{xNiceMatrix}|. % \begin{macrocode} - \bool_lazy_or:nnT - { ! \str_if_eq_p:Vn \g_@@_left_delim_tl { . } } - { ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } } + \tl_if_eq:NNTF \g_@@_left_delim_tl \c_@@_dot_tl + { + \tl_if_eq:NNF \g_@@_right_delim_tl \c_@@_dot_tl + { \bool_gset_true:N \g_@@_delims_bool } + } { \bool_gset_true:N \g_@@_delims_bool } % \end{macrocode} % @@ -4885,28 +4934,34 @@ version 2005/12/01 or later. % We complete the preamble with the potential ``exterior columns'' (on both sides). % \begin{macrocode} \int_if_zero:nTF \l_@@_first_col_int - { \tl_gput_left:NV \g_@@_array_preamble_tl \c_@@_preamble_first_col_tl } + { \tl_gput_left:No \g_@@_array_preamble_tl \c_@@_preamble_first_col_tl } { - \bool_lazy_all:nT + \bool_if:NF \g_@@_delims_bool { - { \bool_not_p:n \g_@@_delims_bool } - { \bool_not_p:n \l_@@_tabular_bool } - { \tl_if_empty_p:N \l_@@_vlines_clist } - { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } + \bool_if:NF \l_@@_tabular_bool + { + \tl_if_empty:NT \l_@@_vlines_clist + { + \bool_if:NF \l_@@_exterior_arraycolsep_bool + { \tl_gput_left:Nn \g_@@_array_preamble_tl { @ { } } } + } + } } - { \tl_gput_left:Nn \g_@@_array_preamble_tl { @ { } } } } \int_compare:nNnTF \l_@@_last_col_int > { -1 } - { \tl_gput_right:NV \g_@@_array_preamble_tl \c_@@_preamble_last_col_tl } + { \tl_gput_right:No \g_@@_array_preamble_tl \c_@@_preamble_last_col_tl } { - \bool_lazy_all:nT + \bool_if:NF \g_@@_delims_bool { - { \bool_not_p:n \g_@@_delims_bool } - { \bool_not_p:n \l_@@_tabular_bool } - { \tl_if_empty_p:N \l_@@_vlines_clist } - { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } + \bool_if:NF \l_@@_tabular_bool + { + \tl_if_empty:NT \l_@@_vlines_clist + { + \bool_if:NF \l_@@_exterior_arraycolsep_bool + { \tl_gput_right:Nn \g_@@_array_preamble_tl { @ { } } } + } + } } - { \tl_gput_right:Nn \g_@@_array_preamble_tl { @ { } } } } % \end{macrocode} % We add a last column to raise a good error message when the user puts more @@ -4926,7 +4981,7 @@ version 2005/12/01 or later. % The preamble provided by the final user will be read by a finite % automata. The following function |\@@_rec_preamble:n| will read that preamble % (usually letter by letter) in a recursive way (hence the name of that function). -% in the preamble and +% in the preamble. % \begin{macrocode} \cs_new_protected:Npn \@@_rec_preamble:n #1 { @@ -4935,7 +4990,7 @@ version 2005/12/01 or later. % calling directly a function in the main hashtable of TeX (thanks to the % mechanism |\csname...\endcsname|. Be careful: all these functions take in as % first argument the letter (or token) itself.\footnote{We do that because it's -% a easy way to insert the letter at some places in the code that we will add to +% an easy way to insert the letter at some places in the code that we will add to % |\g_@@_array_preamble_tl|.} % \begin{macrocode} \cs_if_exist:cTF { @@ _ \token_to_str:N #1 } @@ -4965,23 +5020,47 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new:Npn \@@_c #1 { - \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gclear:N \g_@@_pre_cell_tl + \tl_gput_right:Nn \g_@@_array_preamble_tl + { > \@@_cell_begin:w c < \@@_cell_end: } +% \end{macrocode} +% +% We increment the counter of columns and then we test for the presence of a |<|. +% \begin{macrocode} + \int_gincr:N \c@jCol + \@@_rec_preamble_after_col:n + } +% \end{macrocode} +% \begin{macrocode} +\cs_new:Npn \@@_l #1 + { + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl \tl_gclear:N \g_@@_pre_cell_tl \tl_gput_right:Nn \g_@@_array_preamble_tl { - > { \@@_cell_begin:w \str_set:Nn \l_@@_hpos_cell_str { #1 } } - #1 + > { \@@_cell_begin:w \tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_l_tl } + l < \@@_cell_end: } + \int_gincr:N \c@jCol + \@@_rec_preamble_after_col:n + } % \end{macrocode} -% -% We increment the counter of columns and then we test for the presence of a |<|. % \begin{macrocode} +\cs_new:Npn \@@_r #1 + { + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gclear:N \g_@@_pre_cell_tl + \tl_gput_right:Nn \g_@@_array_preamble_tl + { + > { \@@_cell_begin:w \tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_r_tl } + r + < \@@_cell_end: + } \int_gincr:N \c@jCol \@@_rec_preamble_after_col:n } -\cs_set_eq:NN \@@_l \@@_c -\cs_set_eq:NN \@@_r \@@_c % \end{macrocode} % % \medskip @@ -5081,37 +5160,37 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { WithArrows / p-column } { - r .code:n = \str_set:Nn \l_@@_hpos_col_str { r } , + r .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_r_str , r .value_forbidden:n = true , - c .code:n = \str_set:Nn \l_@@_hpos_col_str { c } , + c .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_c_str , c .value_forbidden:n = true , - l .code:n = \str_set:Nn \l_@@_hpos_col_str { l } , + l .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_l_str , l .value_forbidden:n = true , R .code:n = \IfPackageLoadedTF { ragged2e } - { \str_set:Nn \l_@@_hpos_col_str { R } } + { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_R_str } { \@@_error_or_warning:n { ragged2e~not~loaded } - \str_set:Nn \l_@@_hpos_col_str { r } + \str_set_eq:NN \l_@@_hpos_col_str \c_@@_r_str } , R .value_forbidden:n = true , L .code:n = \IfPackageLoadedTF { ragged2e } - { \str_set:Nn \l_@@_hpos_col_str { L } } + { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_L_stsr } { \@@_error_or_warning:n { ragged2e~not~loaded } - \str_set:Nn \l_@@_hpos_col_str { l } + \str_set_eq:NN \l_@@_hpos_col_str \c_@@_l_str } , L .value_forbidden:n = true , C .code:n = \IfPackageLoadedTF { ragged2e } - { \str_set:Nn \l_@@_hpos_col_str { C } } + { \str_set_eq:NN \l_@@_hpos_col_str \c_@@_C_str } { \@@_error_or_warning:n { ragged2e~not~loaded } - \str_set:Nn \l_@@_hpos_col_str { c } + \str_set_eq:NN \l_@@_hpos_col_str \c_@@_c_str } , C .value_forbidden:n = true , - S .code:n = \str_set:Nn \l_@@_hpos_col_str { si } , + S .code:n = \str_set_eq:NN \l_@@_hpos_col_str \c_@@_si_str , S .value_forbidden:n = true , p .code:n = \str_set:Nn \l_@@_vpos_col_str { p } , p .value_forbidden:n = true , @@ -5167,9 +5246,9 @@ version 2005/12/01 or later. % the initial value), |l|, |c|, |r|, |L|, |C| and |R| (when the user has used % the corresponding key in the optional argument of the specifier). % \begin{macrocode} - \str_set:Nn \l_@@_hpos_col_str { j } - \tl_set:Nn \l_tmpa_tl { #1 } - \@@_keys_p_column:V \l_tmpa_tl + \str_set_eq:NN \l_@@_hpos_col_str \c_@@_j_str + % \tl_set:Nn \l_tmpa_tl { #1 } + \@@_keys_p_column:n { #1 } \@@_make_preamble_ii_iv:nnn { #2 } { minipage } { } } % \end{macrocode} @@ -5177,7 +5256,6 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_keys_p_column:n #1 { \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl } -\cs_generate_variant:Nn \@@_keys_p_column:n { V } % \end{macrocode} % % \medskip @@ -5190,22 +5268,22 @@ version 2005/12/01 or later. \use:e { \@@_make_preamble_ii_v:nnnnnnnn - { \str_if_eq:VnTF \l_@@_vpos_col_str { p } { t } { b } } + { \str_if_eq:onTF \l_@@_vpos_col_str { p } { t } { b } } { \dim_eval:n { #1 } } { % \end{macrocode} % The parameter |\l_@@_hpos_col_str| (as |\l_@@_vpos_col_str|) exists only % during the construction of the preamble. During the composition of the array -% itself, you will have, in each cell, the parameter |\l_@@_hpos_cell_str| which +% itself, you will have, in each cell, the parameter |\l_@@_hpos_cell_tl| which % will provide the horizontal alignment of the column to which belongs the cell. % \begin{macrocode} - \str_if_eq:VnTF \l_@@_hpos_col_str j - { \str_set:Nn \exp_not:N \l_@@_hpos_cell_str { } } + \str_if_eq:NNTF \l_@@_hpos_col_str \c_@@_j_str + { \tl_clear:N \exp_not:N \l_@@_hpos_cell_tl } { - \str_set:Nn \exp_not:N \l_@@_hpos_cell_str + \cs_set_nopar:Npn \exp_not:N \l_@@_hpos_cell_tl { \str_lowercase:V \l_@@_hpos_col_str } } - \str_case:Vn \l_@@_hpos_col_str + \str_case:on \l_@@_hpos_col_str { c { \exp_not:N \centering } l { \exp_not:N \raggedright } @@ -5216,12 +5294,12 @@ version 2005/12/01 or later. } #3 } - { \str_if_eq:VnT \l_@@_vpos_col_str { m } \@@_center_cell_box: } - { \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w } - { \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_end: } + { \str_if_eq:onT \l_@@_vpos_col_str { m } \@@_center_cell_box: } + { \str_if_eq:onT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w } + { \str_if_eq:onT \l_@@_hpos_col_str { si } \siunitx_cell_end: } { #2 } { - \str_case:VnF \l_@@_hpos_col_str + \str_case:onF \l_@@_hpos_col_str { { j } { c } { si } { c } @@ -5251,7 +5329,7 @@ version 2005/12/01 or later. % % |#3| is the coding for the horizontal position of the content of the cell % (|\centering|, |\raggedright|, |\raggedleft| or nothing). It's also possible -% to put in that |#3| some code to fix the value of |\l_@@_hpos_cell_str| which +% to put in that |#3| some code to fix the value of |\l_@@_hpos_cell_tl| which % will be available in each cell of the column. % % |#4| is an extra-code which contains |\@@_center_cell_box:| (when the column @@ -5268,10 +5346,10 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_make_preamble_ii_v:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8 { - \str_if_eq:VnTF \l_@@_hpos_col_str { si } + \tl_if_eq:NNTF \l_@@_hpos_col_str \c_@@_si_str { \tl_gput_right:Nn \g_@@_array_preamble_tl { > { \@@_test_if_empty_for_S: } } } { \tl_gput_right:Nn \g_@@_array_preamble_tl { > { \@@_test_if_empty: } } } - \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl \tl_gclear:N \g_@@_pre_cell_tl \tl_gput_right:Nn \g_@@_array_preamble_tl { @@ -5430,9 +5508,8 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_make_preamble_V_ii:nn #1 #2 { \str_set:Nn \l_@@_vpos_col_str { p } - \str_set:Nn \l_@@_hpos_col_str { j } - \tl_set:Nn \l_tmpa_tl { #1 } - \@@_keys_p_column:V \l_tmpa_tl + \str_set_eq:NN \l_@@_hpos_col_str \c_@@_j_str + \@@_keys_p_column:n { #1 } \IfPackageLoadedTF { varwidth } { \@@_make_preamble_ii_iv:nnn { #2 } { varwidth } { } } { @@ -5476,14 +5553,14 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_make_preamble_w_i:nnnn #1 #2 { - \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl \tl_gclear:N \g_@@_pre_cell_tl \tl_gput_right:Nn \g_@@_array_preamble_tl { > { \dim_set:Nn \l_@@_col_width_dim { #2 } \@@_cell_begin:w - \str_set:Nn \l_@@_hpos_cell_str { c } + \tl_set_eq:NN \l_@@_hpos_cell_tl \c_@@_c_tl } c < { @@ -5504,7 +5581,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_make_preamble_w_ii:nnnn #1 #2 #3 #4 { - \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl \tl_gclear:N \g_@@_pre_cell_tl \tl_gput_right:Nn \g_@@_array_preamble_tl { @@ -5517,7 +5594,7 @@ version 2005/12/01 or later. \dim_set:Nn \l_@@_col_width_dim { #4 } \hbox_set:Nw \l_@@_cell_box \@@_cell_begin:w - \str_set:Nn \l_@@_hpos_cell_str { #3 } + \cs_set_nopar:Npn \l_@@_hpos_cell_tl { #3 } } c < { @@ -5566,7 +5643,7 @@ version 2005/12/01 or later. { \IfPackageLoadedTF { siunitx } { - \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gput_right:No \g_@@_array_preamble_tl \g_@@_pre_cell_tl \tl_gclear:N \g_@@_pre_cell_tl \tl_gput_right:Nn \g_@@_array_preamble_tl { @@ -5601,14 +5678,14 @@ version 2005/12/01 or later. % \begin{macrocode} \int_if_zero:nTF \c@jCol { - \str_if_eq:VnTF \g_@@_left_delim_tl { . } + \tl_if_eq:NNTF \g_@@_left_delim_tl \c_@@_dot_tl { % \end{macrocode} % In that case, in fact, the first letter of the preamble must be considered as % the left delimiter of the array. % \begin{macrocode} \tl_gset:Nn \g_@@_left_delim_tl { #1 } - \tl_gset:Nn \g_@@_right_delim_tl { . } + \tl_gset_eq:NN \g_@@_right_delim_tl \c_@@_dot_tl \@@_rec_preamble:n #2 } { @@ -5657,7 +5734,7 @@ version 2005/12/01 or later. { \tl_if_eq:nnTF { \stop } { #2 } { - \str_if_eq:VnTF \g_@@_right_delim_tl { . } + \tl_if_eq:NNTF \g_@@_right_delim_tl \c_@@_dot_tl { \tl_gset:Nn \g_@@_right_delim_tl { #1 } } { \tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \enskip } } @@ -5684,7 +5761,7 @@ version 2005/12/01 or later. { \tl_if_eq:nnTF { \stop } { #3 } { - \str_if_eq:VnTF \g_@@_right_delim_tl { . } + \tl_if_eq:NNTF \g_@@_right_delim_tl \c_@@_dot_tl { \tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \enskip } } \tl_gput_right:Nx \g_@@_pre_code_after_tl @@ -5728,7 +5805,7 @@ version 2005/12/01 or later. \str_if_eq:nnTF { #1 } { @ } \@@_rec_preamble_after_col_ii:n { - \tl_if_eq:NnTF \l_@@_vlines_clist { all } + \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl { \tl_gput_right:Nn \g_@@_array_preamble_tl { ! { \skip_horizontal:N \arrayrulewidth } } @@ -5761,7 +5838,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_rec_preamble_after_col_ii:n #1 { - \tl_if_eq:NnTF \l_@@_vlines_clist { all } + \tl_if_eq:NNTF \l_@@_vlines_clist \c_@@_all_tl { \tl_gput_right:Nn \g_@@_array_preamble_tl { @ { #1 \skip_horizontal:N \arrayrulewidth } } @@ -5785,7 +5862,7 @@ version 2005/12/01 or later. { \tl_clear:N \l_tmpa_tl \int_step_inline:nn { #2 } { \tl_put_right:Nn \l_tmpa_tl { #3 } } - \exp_last_unbraced:NV \@@_rec_preamble:n \l_tmpa_tl + \exp_last_unbraced:No \@@_rec_preamble:n \l_tmpa_tl } % \end{macrocode} % @@ -5843,7 +5920,7 @@ version 2005/12/01 or later. % (when the user has used the corresponding key in the optional argument of the % specifier |X|). % \begin{macrocode} - \tl_set:Nn \l_@@_vpos_col_str { p } + \str_set:Nn \l_@@_vpos_col_str { p } % \end{macrocode} % % The integer |\l_@@_weight_int| will be the weight of the |X| column (the @@ -5853,11 +5930,13 @@ version 2005/12/01 or later. % of those columns as in \pkg{tabu} (now obsolete) or \pkg{tabularray}. % \begin{macrocode} \int_zero_new:N \l_@@_weight_int - \int_set:Nn \l_@@_weight_int { 1 } - \tl_set:Nn \l_tmpa_tl { #1 } - \@@_keys_p_column:V \l_tmpa_tl - \keys_set:nV { WithArrows / X-column } \l_tmpa_tl - \int_compare:nNnT \l_@@_weight_int < 0 + \int_set_eq:NN \l_@@_weight_int \c_one_int + \@@_keys_p_column:n { #1 } +% \end{macrocode} +% The unknown keys are put in |\l_tmpa_tl| +% \begin{macrocode} + \keys_set:no { WithArrows / X-column } \l_tmpa_tl + \int_compare:nNnT \l_@@_weight_int < \c_zero_int { \@@_error_or_warning:n { negative~weight } \int_set:Nn \l_@@_weight_int { - \l_@@_weight_int } @@ -5988,7 +6067,7 @@ version 2005/12/01 or later. % The following lines are an adaptation of the definition of |\multicolumn| in % \pkg{array}. % \begin{macrocode} - \exp_args:NV \@mkpream \g_@@_preamble_tl + \exp_args:No \@mkpream \g_@@_preamble_tl \@addtopreamble \@empty \endgroup % \end{macrocode} @@ -5997,7 +6076,7 @@ version 2005/12/01 or later. % Now, we do a treatment specific to \pkg{nicematrix} which has no equivalent % in the original definition of |\multicolumn|. % \begin{macrocode} - \int_compare:nNnT { #1 } > 1 + \int_compare:nNnT { #1 } > \c_one_int { \seq_gput_left:Nx \g_@@_multicolumn_cells_seq { \int_use:N \c@iRow - \int_eval:n { \c@jCol + 1 } } @@ -6067,7 +6146,7 @@ version 2005/12/01 or later. \cs_if_exist:cTF { NC @ find @ #1 } { \tl_set_eq:Nc \l_tmpa_tl { NC @ rewrite @ #1 } - \exp_last_unbraced:NV \@@_make_m_preamble:n \l_tmpa_tl + \exp_last_unbraced:No \@@_make_m_preamble:n \l_tmpa_tl } { \tl_if_eq:nnT { #1 } { S } @@ -6085,7 +6164,7 @@ version 2005/12/01 or later. { \tl_gput_right:Nn \g_@@_preamble_tl { - > { \@@_cell_begin:w \str_set:Nn \l_@@_hpos_cell_str { #1 } } + > { \@@_cell_begin:w \cs_set_nopar:Npn \l_@@_hpos_cell_tl { #1 } } #1 < \@@_cell_end: } @@ -6157,7 +6236,7 @@ version 2005/12/01 or later. \dim_set:Nn \l_@@_col_width_dim { #4 } \hbox_set:Nw \l_@@_cell_box \@@_cell_begin:w - \str_set:Nn \l_@@_hpos_cell_str { #3 } + \cs_set_nopar:Npn \l_@@_hpos_cell_tl { #3 } } c < { @@ -6210,12 +6289,14 @@ version 2005/12/01 or later. { \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim } \box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim } - \tl_if_eq:NnTF \l_@@_baseline_tl { c } + \tl_if_eq:NNTF \l_@@_baseline_tl \c_@@_c_tl { \box_use_drop:N \l_tmpa_box } \@@_put_box_in_flow_i: } % \end{macrocode} % +% \bigskip +% % \medskip % The command |\@@_put_box_in_flow_i:| is used when the value of % |\l_@@_baseline_tl| is different of |c| (which is the initial value and the @@ -6233,30 +6314,31 @@ version 2005/12/01 or later. % Now, |\g_tmpa_dim| contains the $y$-value of the center of the array (the % delimiters are centered in relation with this value). % \begin{macrocode} - \str_if_in:NnTF \l_@@_baseline_tl { line- } + \tl_if_in:NnTF \l_@@_baseline_tl { line- } { \int_set:Nn \l_tmpa_int { \str_range:Nnn \l_@@_baseline_tl 6 - { \tl_count:V \l_@@_baseline_tl } + { \tl_count:o \l_@@_baseline_tl } } \@@_qpoint:n { row - \int_use:N \l_tmpa_int } } { - \str_case:VnF \l_@@_baseline_tl - { - { t } { \int_set:Nn \l_tmpa_int 1 } - { b } { \int_set_eq:NN \l_tmpa_int \c@iRow } + \tl_if_eq:NnTF \l_@@_baseline_tl { t } + { \int_set_eq:NN \l_tmpa_int \c_one_int } + { + \tl_if_eq:NnTF \l_@@_baseline_tl { b } + { \int_set_eq:NN \l_tmpa_int \c@iRow } + { \int_set:Nn \l_tmpa_int \l_@@_baseline_tl } } - { \int_set:Nn \l_tmpa_int \l_@@_baseline_tl } \bool_lazy_or:nnT { \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int } { \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int } { \@@_error:n { bad~value~for~baseline } - \int_set:Nn \l_tmpa_int 1 + \int_set_eq:NN \l_tmpa_int \c_one_int } \@@_qpoint:n { row - \int_use:N \l_tmpa_int - base } % \end{macrocode} @@ -6289,7 +6371,7 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NT \l_@@_NiceMatrix_without_vlines_bool { - \int_compare:nNnT \c@jCol > 1 % added 2023-08-13 + \int_compare:nNnT \c@jCol > \c_one_int { \box_set_wd:Nn \l_@@_the_array_box { \box_wd:N \l_@@_the_array_box - \arraycolsep } @@ -6315,7 +6397,7 @@ version 2005/12/01 or later. % tabular notes for which the command |\tabularnote| has been used without its % optional argument (between square brackets). % \begin{macrocode} - \int_compare:nNnT \g_@@_notes_caption_int > 0 + \int_compare:nNnT \g_@@_notes_caption_int > \c_zero_int { \tl_build_gput_right:Nx \g_@@_aux_tl { @@ -6353,7 +6435,7 @@ version 2005/12/01 or later. { { ! \seq_if_empty_p:N \g_@@_notes_seq } { ! \seq_if_empty_p:N \g_@@_notes_in_caption_seq } - { ! \tl_if_empty_p:V \g_@@_tabularnote_tl } + { ! \tl_if_empty_p:o \g_@@_tabularnote_tl } } \@@_insert_tabularnotes: \cs_set_eq:NN \tabularnote \@@_tabularnote_error:n @@ -6408,7 +6490,7 @@ version 2005/12/01 or later. % caption is composed only once. In that case, we fix the value of % |\g_@@_caption_finished_bool| now. % \begin{macrocode} - \bool_if:NF \g_@@_caption_finished_bool % added 2023/06/30 + \bool_if:NF \g_@@_caption_finished_bool { \bool_gset_true:N \g_@@_caption_finished_bool \int_gset_eq:NN \g_@@_notes_caption_int \c@tabularnote @@ -6449,7 +6531,7 @@ version 2005/12/01 or later. % the |\unskip| are designed to give the ability to put a |\bottomrule| at the % end of the notes with a good vertical space. % \begin{macrocode} - \int_compare:nNnT \c@tabularnote > 0 + \int_compare:nNnT \c@tabularnote > \c_zero_int { \bool_if:NTF \l_@@_notes_para_bool { @@ -6545,7 +6627,7 @@ version 2005/12/01 or later. % We convert a value of |t| to a value of |1|. % \begin{macrocode} \tl_if_eq:NnT \l_@@_baseline_tl { t } - { \tl_set:Nn \l_@@_baseline_tl { 1 } } + { \cs_set_nopar:Npn \l_@@_baseline_tl { 1 } } % \end{macrocode} % Now, we convert the value of |\l_@@_baseline_tl| (which should represent an % integer) to an integer stored in |\l_tmpa_int|. @@ -6560,7 +6642,7 @@ version 2005/12/01 or later. \str_range:Nnn \l_@@_baseline_tl 6 - { \tl_count:V \l_@@_baseline_tl } + { \tl_count:o \l_@@_baseline_tl } } \@@_qpoint:n { row - \int_use:N \l_tmpa_int } } @@ -6668,7 +6750,7 @@ version 2005/12/01 or later. % Here is the call to |\array| (we have a dedicated macro |\@@_array:| because % of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}). % \begin{macrocode} - \exp_args:NV \@@_array: \g_@@_array_preamble_tl + \exp_args:No \@@_array: \g_@@_array_preamble_tl } } } @@ -6745,7 +6827,7 @@ version 2005/12/01 or later. % \begin{macrocode} \seq_pop_right:NN \l_@@_rows_seq \l_tmpa_tl \tl_if_empty:NF \l_tmpa_tl - { \seq_put_right:NV \l_@@_rows_seq \l_tmpa_tl } + { \seq_put_right:No \l_@@_rows_seq \l_tmpa_tl } % \end{macrocode} % If the environment uses the option |last-row| without value (i.e. without % saying the number of the rows), we have now the opportunity to compute that @@ -6769,7 +6851,7 @@ version 2005/12/01 or later. % First, we treat the first row. % \begin{macrocode} \seq_pop_left:NN \l_@@_rows_seq \l_tmpa_tl - \@@_line_with_light_syntax:V \l_tmpa_tl + \@@_line_with_light_syntax:o \l_tmpa_tl % \end{macrocode} % Now, the other rows (with the same treatment, excepted that we have to insert % |\\| between the rows). @@ -6802,7 +6884,7 @@ version 2005/12/01 or later. % |\@@_array:| because of compatibility with the classes \cls{revtex4-1} and % \cls{revtex4-2}). % \begin{macrocode} - \exp_args:NV \@@_array: \g_@@_array_preamble_tl \l_@@_new_body_tl + \exp_args:No \@@_array: \g_@@_array_preamble_tl \l_@@_new_body_tl } % \end{macrocode} % @@ -6818,11 +6900,11 @@ version 2005/12/01 or later. { \seq_count:N \l_@@_cells_seq } } \seq_pop_left:NN \l_@@_cells_seq \l_tmpa_tl - \exp_args:NNV \tl_build_put_right:Nn \l_@@_new_body_tl \l_tmpa_tl + \exp_args:NNo \tl_build_put_right:Nn \l_@@_new_body_tl \l_tmpa_tl \seq_map_inline:Nn \l_@@_cells_seq { \tl_build_put_right:Nn \l_@@_new_body_tl { & ##1 } } } -\cs_generate_variant:Nn \@@_line_with_light_syntax:n { V } +\cs_generate_variant:Nn \@@_line_with_light_syntax:n { o } % \end{macrocode} % % @@ -6833,7 +6915,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_analyze_end:Nn #1 #2 { - \str_if_eq:VnT \g_@@_name_env_str { #2 } + \str_if_eq:onT \g_@@_name_env_str { #2 } { \@@_fatal:n { empty~environment } } % \end{macrocode} % We reput in the stream the |\end{...}| we have extracted and the user will @@ -6962,10 +7044,10 @@ version 2005/12/01 or later. % We begin a loop over the columns. The integer |\g_tmpa_int| will be the % number of the current column. This integer is used for the Tikz nodes. % \begin{macrocode} - \int_gset:Nn \g_tmpa_int 1 + \int_gset_eq:NN \g_tmpa_int \c_one_int \bool_if:NTF \g_@@_last_col_found_bool - { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 3 } 0 } } - { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 2 } 0 } } + { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 3 } \c_zero_int } } + { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 2 } \c_zero_int } } { & \omit @@ -7010,17 +7092,17 @@ version 2005/12/01 or later. % The two following lines have been added on 2021-12-15 to solve a bug % mentionned by Joao Luis Soares by mail. % \begin{macrocode} - \int_compare:nNnT \g_@@_col_total_int = 1 + \int_compare:nNnT \g_@@_col_total_int = \c_one_int { \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } } \skip_horizontal:N \g_tmpa_skip \int_gincr:N \g_tmpa_int - \bool_lazy_all:nT + \bool_lazy_any:nT { - { \bool_not_p:n \g_@@_delims_bool } - { \bool_not_p:n \l_@@_tabular_bool } - { \clist_if_empty_p:N \l_@@_vlines_clist } - { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } - { ! \l_@@_bar_at_end_of_pream_bool } + \g_@@_delims_bool + \l_@@_tabular_bool + { ! \clist_if_empty_p:N \l_@@_vlines_clist } + \l_@@_exterior_arraycolsep_bool + \l_@@_bar_at_end_of_pream_bool } { \skip_horizontal:N -\col@sep } \bool_if:NT \l_@@_code_before_bool @@ -7120,22 +7202,21 @@ version 2005/12/01 or later. % have to compute some dimensions of this box. % \begin{macrocode} \hbox_set:Nw \l_@@_cell_box - \@@_math_toggle_token: - \bool_if:NT \l_@@_small_bool \scriptstyle + \@@_math_toggle: + \@@_tuning_key_small: % \end{macrocode} % We insert |\l_@@_code_for_first_col_tl|... but we don't insert it in the % potential ``first row'' and in the potential ``last row''. % \begin{macrocode} - \bool_lazy_and:nnT - { \int_compare_p:nNn \c@iRow > 0 } + \int_compare:nNnT \c@iRow > \c_zero_int { - \bool_lazy_or_p:nn - { \int_compare_p:nNn \l_@@_last_row_int < 0 } + \bool_lazy_or:nnT + { \int_compare_p:nNn \l_@@_last_row_int < \c_zero_int } { \int_compare_p:nNn \c@iRow < \l_@@_last_row_int } - } - { - \l_@@_code_for_first_col_tl - \xglobal \colorlet { nicematrix-first-col } { . } + { + \l_@@_code_for_first_col_tl + \xglobal \colorlet { nicematrix-first-col } { . } + } } } % \end{macrocode} @@ -7145,7 +7226,7 @@ version 2005/12/01 or later. l < { - \@@_math_toggle_token: + \@@_math_toggle: \hbox_set_end: \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: \@@_adjust_size_box: @@ -7202,16 +7283,16 @@ version 2005/12/01 or later. % have to compute some dimensions of this box. % \begin{macrocode} \hbox_set:Nw \l_@@_cell_box - \@@_math_toggle_token: - \bool_if:NT \l_@@_small_bool \scriptstyle + \@@_math_toggle: + \@@_tuning_key_small: % \end{macrocode} % We insert |\l_@@_code_for_last_col_tl|... but we don't insert it in the % potential ``first row'' and in the potential ``last row''. % \begin{macrocode} - \int_compare:nNnT \c@iRow > 0 + \int_compare:nNnT \c@iRow > \c_zero_int { \bool_lazy_or:nnT - { \int_compare_p:nNn \l_@@_last_row_int < 0 } + { \int_compare_p:nNn \l_@@_last_row_int < \c_zero_int } { \int_compare_p:nNn \c@iRow < \l_@@_last_row_int } { \l_@@_code_for_last_col_tl @@ -7222,7 +7303,7 @@ version 2005/12/01 or later. l < { - \@@_math_toggle_token: + \@@_math_toggle: \hbox_set_end: \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: \@@_adjust_size_box: @@ -7330,7 +7411,7 @@ version 2005/12/01 or later. { #2 } } \tl_set:Nn \l_tmpb_tl { \use:c { #1 NiceArray } } - \exp_args:NV \l_tmpb_tl \l_tmpa_tl + \exp_args:No \l_tmpb_tl \l_tmpa_tl } % \end{macrocode} % @@ -7426,13 +7507,22 @@ version 2005/12/01 or later. } } { } - \bool_set_true:N \l_@@_tabular_bool + \@@_settings_for_tabular: \NiceArray { #2 } } { \endNiceArray } % \end{macrocode} % -% +% \begin{macrocode} +\cs_new_protected:Npn \@@_settings_for_tabular: + { + \bool_set_true:N \l_@@_tabular_bool + \cs_set_eq:NN \@@_math_toggle: \prg_do_nothing: + \cs_set_eq:NN \@@_tuning_not_tabular_begin: \prg_do_nothing: + \cs_set_eq:NN \@@_tuning_not_tabular_end: \prg_do_nothing: + } +% \end{macrocode} +% % \bigskip % \begin{macrocode} \NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } } @@ -7441,7 +7531,7 @@ version 2005/12/01 or later. \dim_zero_new:N \l_@@_width_dim \dim_set:Nn \l_@@_width_dim { #1 } \keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 } - \bool_set_true:N \l_@@_tabular_bool + \@@_settings_for_tabular: \NiceArray { #3 } } { @@ -7458,7 +7548,7 @@ version 2005/12/01 or later. \str_gset:Nn \g_@@_name_env_str { NiceTabular* } \dim_set:Nn \l_@@_tabular_width_dim { #1 } \keys_set:nn { NiceMatrix / NiceTabular } { #2 , #4 } - \bool_set_true:N \l_@@_tabular_bool + \@@_settings_for_tabular: \NiceArray { #3 } } { \endNiceArray } @@ -7755,7 +7845,7 @@ version 2005/12/01 or later. % potential ``argument'' with the command |\@@_CodeAfter_keys:|. % \begin{macrocode} \bool_set_true:N \l_@@_in_code_after_bool - \exp_last_unbraced:NV \@@_CodeAfter_keys: \g_nicematrix_code_after_tl + \exp_last_unbraced:No \@@_CodeAfter_keys: \g_nicematrix_code_after_tl \scan_stop: \tl_gclear:N \g_nicematrix_code_after_tl \group_end: @@ -7774,7 +7864,7 @@ version 2005/12/01 or later. \tl_build_gput_right:Nx \g_@@_aux_tl { \tl_gset:Nn \exp_not:N \g_@@_pre_code_before_tl - { \exp_not:V \g_@@_pre_code_before_tl } + { \exp_not:o \g_@@_pre_code_before_tl } } \tl_gclear:N \g_@@_pre_code_before_tl } @@ -7783,7 +7873,7 @@ version 2005/12/01 or later. \tl_build_gput_right:Nx \g_@@_aux_tl { \tl_gset:Nn \exp_not:N \g_@@_code_before_tl - { \exp_not:V \g_nicematrix_code_before_tl } + { \exp_not:o \g_nicematrix_code_before_tl } } \tl_gclear:N \g_nicematrix_code_before_tl } @@ -8042,7 +8132,7 @@ version 2005/12/01 or later. \bool_set_false:N \l_@@_final_open_bool \int_compare:nNnTF \l_@@_final_i_int > \l_@@_row_max_int { - \int_compare:nNnTF { #3 } = 1 + \int_compare:nNnTF { #3 } = \c_one_int { \bool_set_true:N \l_@@_final_open_bool } { \int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int @@ -8058,7 +8148,7 @@ version 2005/12/01 or later. { \int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int { - \int_compare:nNnT { #4 } = 1 + \int_compare:nNnT { #4 } = \c_one_int { \bool_set_true:N \l_@@_final_open_bool } } } @@ -8137,7 +8227,7 @@ version 2005/12/01 or later. \bool_set_false:N \l_@@_initial_open_bool \int_compare:nNnTF \l_@@_initial_i_int < \l_@@_row_min_int { - \int_compare:nNnTF { #3 } = 1 + \int_compare:nNnTF { #3 } = \c_one_int { \bool_set_true:N \l_@@_initial_open_bool } { \int_compare:nNnT \l_@@_initial_j_int = { \l_@@_col_min_int - 1 } @@ -8147,7 +8237,7 @@ version 2005/12/01 or later. { \int_compare:nNnTF \l_@@_initial_j_int < \l_@@_col_min_int { - \int_compare:nNnT { #4 } = 1 + \int_compare:nNnT { #4 } = \c_one_int { \bool_set_true:N \l_@@_initial_open_bool } } { @@ -8265,18 +8355,25 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6 { - \bool_if:nT + \int_compare:nNnF { #3 } > { #1 } { - \int_compare_p:n { #3 <= #1 } - && \int_compare_p:n { #1 <= #5 } - && \int_compare_p:n { #4 <= #2 } - && \int_compare_p:n { #2 <= #6 } - } - { - \int_set:Nn \l_@@_row_min_int { \int_max:nn \l_@@_row_min_int { #3 } } - \int_set:Nn \l_@@_col_min_int { \int_max:nn \l_@@_col_min_int { #4 } } - \int_set:Nn \l_@@_row_max_int { \int_min:nn \l_@@_row_max_int { #5 } } - \int_set:Nn \l_@@_col_max_int { \int_min:nn \l_@@_col_max_int { #6 } } + \int_compare:nNnF { #1 } > { #5 } + { + \int_compare:nNnF { #4 } > { #2 } + { + \int_compare:nNnF { #2 } > { #6 } + { + \int_set:Nn \l_@@_row_min_int + { \int_max:nn \l_@@_row_min_int { #3 } } + \int_set:Nn \l_@@_col_min_int + { \int_max:nn \l_@@_col_min_int { #4 } } + \int_set:Nn \l_@@_row_max_int + { \int_min:nn \l_@@_row_max_int { #5 } } + \int_set:Nn \l_@@_col_max_int + { \int_min:nn \l_@@_col_max_int { #6 } } + } + } + } } } % \end{macrocode} @@ -8407,7 +8504,7 @@ version 2005/12/01 or later. { \color { nicematrix-last-row } } } \keys_set:nn { NiceMatrix / xdots } { #3 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Ldots: \group_end: } @@ -8502,7 +8599,7 @@ version 2005/12/01 or later. { \color { nicematrix-last-row } } } \keys_set:nn { NiceMatrix / xdots } { #3 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Cdots: \group_end: } @@ -8566,7 +8663,6 @@ version 2005/12/01 or later. { \dim_max:nn \l_@@_y_initial_dim \pgf@y } } } - % modified 2023-08-10 \dim_compare:nNnT \l_@@_y_initial_dim = { - \c_max_dim } { \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base } @@ -8599,7 +8695,6 @@ version 2005/12/01 or later. { \dim_min:nn \l_@@_y_final_dim \pgf@y } } } - % modified 2023-08-10 \dim_compare:nNnT \l_@@_y_final_dim = \c_max_dim { \@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base } @@ -8632,7 +8727,7 @@ version 2005/12/01 or later. { \color { nicematrix-last-col } } } \keys_set:nn { NiceMatrix / xdots } { #3 } - \tl_if_empty:VF \l_@@_xdots_color_tl + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Vdots: \group_end: @@ -8677,10 +8772,7 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x \dim_sub:Nn \l_@@_x_initial_dim \l_@@_left_margin_dim \dim_sub:Nn \l_@@_x_initial_dim \l_@@_extra_left_margin_dim - % \bool_if:NT \g_@@_delims_bool - % { - \dim_sub:Nn \l_@@_x_initial_dim \c_@@_shift_exterior_Vdots_dim - % } + \dim_sub:Nn \l_@@_x_initial_dim \c_@@_shift_exterior_Vdots_dim } { \bool_lazy_and:nnTF @@ -8694,12 +8786,7 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x \dim_add:Nn \l_@@_x_initial_dim \l_@@_right_margin_dim \dim_add:Nn \l_@@_x_initial_dim \l_@@_extra_right_margin_dim - % \bool_if:NT \g_@@_delims_bool - % { - \dim_add:Nn - \l_@@_x_initial_dim - \c_@@_shift_exterior_Vdots_dim - % } + \dim_add:Nn \l_@@_x_initial_dim \c_@@_shift_exterior_Vdots_dim } % \end{macrocode} % We have a dotted line open on both sides which is \emph{not} in an exterior column. @@ -8721,14 +8808,15 @@ version 2005/12/01 or later. % \begin{macrocode} { \bool_set_false:N \l_tmpa_bool - \bool_lazy_and:nnT - { ! \l_@@_initial_open_bool } - { ! \l_@@_final_open_bool } - { - \@@_set_initial_coords_from_anchor:n { south~west } - \@@_set_final_coords_from_anchor:n { north~west } - \bool_set:Nn \l_tmpa_bool - { \dim_compare_p:nNn \l_@@_x_initial_dim = \l_@@_x_final_dim } + \bool_if:NF \l_@@_initial_open_bool + { + \bool_if:NF \l_@@_final_open_bool + { + \@@_set_initial_coords_from_anchor:n { south~west } + \@@_set_final_coords_from_anchor:n { north~west } + \bool_set:Nn \l_tmpa_bool + { \dim_compare_p:nNn \l_@@_x_initial_dim = \l_@@_x_final_dim } + } } % \end{macrocode} % Now, we try to determine whether the column is of type |c| or may be @@ -8788,7 +8876,7 @@ version 2005/12/01 or later. \group_begin: \@@_open_shorten: \keys_set:nn { NiceMatrix / xdots } { #3 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Ddots: \group_end: } @@ -8833,7 +8921,7 @@ version 2005/12/01 or later. % We test if the diagonal line is the first one (the counter |\g_@@_ddots_int| % is created for this usage). % \begin{macrocode} - \int_compare:nNnTF \g_@@_ddots_int = 1 + \int_compare:nNnTF \g_@@_ddots_int = \c_one_int % \end{macrocode} % If the diagonal line is the first one, we have no adjustment of the line to do % but we store the $\Delta_x$ and the $\Delta_y$ of the line because these @@ -8883,7 +8971,7 @@ version 2005/12/01 or later. \group_begin: \@@_open_shorten: \keys_set:nn { NiceMatrix / xdots } { #3 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Iddots: \group_end: } @@ -8919,7 +9007,7 @@ version 2005/12/01 or later. \bool_if:NT \l_@@_parallelize_diags_bool { \int_gincr:N \g_@@_iddots_int - \int_compare:nNnTF \g_@@_iddots_int = 1 + \int_compare:nNnTF \g_@@_iddots_int = \c_one_int { \dim_gset:Nn \g_@@_delta_x_two_dim { \l_@@_x_final_dim - \l_@@_x_initial_dim } @@ -8970,7 +9058,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip -% We have to do a special construction with |\exp_args:NV| to be able to put in +% We have to do a special construction with |\exp_args:No| to be able to put in % the list of options in the correct place in the Tikz instruction. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_unstandard_dotted_line: @@ -8988,7 +9076,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_unstandard_dotted_line:n #1 { - \@@_draw_unstandard_dotted_line:nVVV + \@@_draw_unstandard_dotted_line:nooo { #1 } \l_@@_xdots_up_tl \l_@@_xdots_down_tl @@ -9048,53 +9136,31 @@ version 2005/12/01 or later. ) } } - \bool_lazy_and:nnT % security - { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } < \c_@@_max_l_dim } - { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } > { 1 pt } } +% \end{macrocode} +% It seems that, during the first compilations, the value of |\l_@@_l_dim| may +% be erroneous (equal to zero or very large). We must detect these cases +% because they would cause errors during the drawing of the dotted line. Maybe +% we should also write something in the |aux| file to say that one more +% compilation should be done. +% \begin{macrocode} + \dim_compare:nNnT \l_@@_l_dim < \c_@@_max_l_dim { - \dim_set:Nn \l_tmpa_dim - { - \l_@@_x_initial_dim - + ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) - * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim - } - \dim_set:Nn \l_tmpb_dim - { - \l_@@_y_initial_dim - + ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) - * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim - } - \dim_set:Nn \l_@@_tmpc_dim - { - \l_@@_x_final_dim - - ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) - * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim - } - \dim_set:Nn \l_@@_tmpd_dim - { - \l_@@_y_final_dim - - ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) - * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim - } - \dim_set_eq:NN \l_@@_x_initial_dim \l_tmpa_dim - \dim_set_eq:NN \l_@@_y_initial_dim \l_tmpb_dim - \dim_set_eq:NN \l_@@_x_final_dim \l_@@_tmpc_dim - \dim_set_eq:NN \l_@@_y_final_dim \l_@@_tmpd_dim + \dim_compare:nNnT \l_@@_l_dim > { 1 pt } + \@@_draw_unstandard_dotted_line_i: } % \end{macrocode} -% % % If the key |xdots/horizontal-labels| has been used. % \begin{macrocode} \bool_if:NT \l_@@_xdots_h_labels_bool - { - \tikzset - { - @@_node_above / .style = { auto = left } , - @@_node_below / .style = { auto = right } , - @@_node_middle / .style = { inner~sep = \c_@@_innersep_middle_dim } - } - } + { + \tikzset + { + @@_node_above / .style = { auto = left } , + @@_node_below / .style = { auto = right } , + @@_node_middle / .style = { inner~sep = \c_@@_innersep_middle_dim } + } + } \tl_if_empty:nF { #4 } { \tikzset { @@_node_middle / .append~style = { fill = white } } } \draw @@ -9111,7 +9177,44 @@ version 2005/12/01 or later. ( \l_@@_x_final_dim , \l_@@_y_final_dim ) ; \end { scope } } -\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:nnnn { n V V V } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_unstandard_dotted_line_i: + { + \dim_set:Nn \l_tmpa_dim + { + \l_@@_x_initial_dim + + ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) + * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim + } + \dim_set:Nn \l_tmpb_dim + { + \l_@@_y_initial_dim + + ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) + * \dim_ratio:nn \l_@@_xdots_shorten_start_dim \l_@@_l_dim + } + \dim_set:Nn \l_@@_tmpc_dim + { + \l_@@_x_final_dim + - ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) + * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim + } + \dim_set:Nn \l_@@_tmpd_dim + { + \l_@@_y_final_dim + - ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) + * \dim_ratio:nn \l_@@_xdots_shorten_end_dim \l_@@_l_dim + } + \dim_set_eq:NN \l_@@_x_initial_dim \l_tmpa_dim + \dim_set_eq:NN \l_@@_y_initial_dim \l_tmpb_dim + \dim_set_eq:NN \l_@@_x_final_dim \l_@@_tmpc_dim + \dim_set_eq:NN \l_@@_y_final_dim \l_@@_tmpd_dim + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:nnnn { n o o o } % \end{macrocode} % % \bigskip @@ -9145,10 +9248,11 @@ version 2005/12/01 or later. % we should also write something in the |aux| file to say that one more % compilation should be done. % \begin{macrocode} - \bool_lazy_or:nnF - { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } > \c_@@_max_l_dim } - { \dim_compare_p:nNn \l_@@_l_dim = \c_zero_dim } - \@@_draw_standard_dotted_line_i: + \dim_compare:nNnT \l_@@_l_dim < \c_@@_max_l_dim + { + \dim_compare:nNnT \l_@@_l_dim > { 1 pt } + \@@_draw_standard_dotted_line_i: + } \group_end: % \end{macrocode} % \begin{macrocode} @@ -9226,7 +9330,7 @@ version 2005/12/01 or later. { 2 \l_@@_l_dim } } \pgf@relevantforpicturesizefalse - \int_step_inline:nnn 0 \l_tmpa_int + \int_step_inline:nnn \c_zero_int \l_tmpa_int { \pgfpathcircle { \pgfpoint \l_@@_x_initial_dim \l_@@_y_initial_dim } @@ -9339,11 +9443,11 @@ version 2005/12/01 or later. % \begin{macrocode} \hook_gput_code:nnn { begindocument } { . } { - \tl_set:Nn \l_@@_argspec_tl { m E { _ ^ : } { { } { } { } } } - \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl + \cs_set_nopar:Npn \l_@@_argspec_tl { m E { _ ^ : } { { } { } { } } } + \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl \cs_new_protected:Npn \@@_Ldots { \@@_collect_options:n { \@@_Ldots_i } } - \exp_args:NNV \NewDocumentCommand \@@_Ldots_i \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Ldots_i \l_@@_argspec_tl { \int_if_zero:nTF \c@jCol { \@@_error:nn { in~first~col } \Ldots } @@ -9365,7 +9469,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Cdots { \@@_collect_options:n { \@@_Cdots_i } } - \exp_args:NNV \NewDocumentCommand \@@_Cdots_i \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Cdots_i \l_@@_argspec_tl { \int_if_zero:nTF \c@jCol { \@@_error:nn { in~first~col } \Cdots } @@ -9387,7 +9491,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Vdots { \@@_collect_options:n { \@@_Vdots_i } } - \exp_args:NNV \NewDocumentCommand \@@_Vdots_i \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Vdots_i \l_@@_argspec_tl { \int_if_zero:nTF \c@iRow { \@@_error:nn { in~first~row } \Vdots } @@ -9410,7 +9514,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Ddots { \@@_collect_options:n { \@@_Ddots_i } } - \exp_args:NNV \NewDocumentCommand \@@_Ddots_i \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Ddots_i \l_@@_argspec_tl { \int_case:nnF \c@iRow { @@ -9440,7 +9544,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Iddots { \@@_collect_options:n { \@@_Iddots_i } } - \exp_args:NNV \NewDocumentCommand \@@_Iddots_i \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Iddots_i \l_@@_argspec_tl { \int_case:nnF \c@iRow { @@ -9536,7 +9640,7 @@ version 2005/12/01 or later. % \begin{macrocode} \hook_gput_code:nnn { begindocument } { . } { - \tl_set:Nn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } } + \cs_set_nopar:Npn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl % \end{macrocode} % We don't put |!| before the last optionnal argument for homogeneity with @@ -9544,7 +9648,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Hdotsfor_i { \@@_collect_options:n { \@@_Hdotsfor_ii } } - \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_ii \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Hdotsfor_ii \l_@@_argspec_tl { \tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl { @@ -9563,7 +9667,7 @@ version 2005/12/01 or later. { & \multicolumn { 1 } { c } { } - \cs_set_eq:NN \CodeAfter \@@_CodeAfter_i: % added 2023-08-26 + \cs_set_eq:NN \CodeAfter \@@_CodeAfter_i: } } } @@ -9583,9 +9687,9 @@ version 2005/12/01 or later. % \end{macrocode} % For the column, it's a bit more complicated. % \begin{macrocode} - \int_compare:nNnTF { #2 } = 1 + \int_compare:nNnTF { #2 } = \c_one_int { - \int_set:Nn \l_@@_initial_j_int 1 + \int_set_eq:NN \l_@@_initial_j_int \c_one_int \bool_set_true:N \l_@@_initial_open_bool } { @@ -9632,7 +9736,7 @@ version 2005/12/01 or later. } \keys_set:nn { NiceMatrix / xdots } { #4 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Ldots: \group_end: % \end{macrocode} @@ -9652,11 +9756,11 @@ version 2005/12/01 or later. % \begin{macrocode} \hook_gput_code:nnn { begindocument } { . } { - \tl_set:Nn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } } + \cs_set_nopar:Npn \l_@@_argspec_tl { m m O { } E { _ ^ : } { { } { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl \cs_new_protected:Npn \@@_Vdotsfor: { \@@_collect_options:n { \@@_Vdotsfor_i } } - \exp_args:NNV \NewDocumentCommand \@@_Vdotsfor_i \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_Vdotsfor_i \l_@@_argspec_tl { \bool_gset_true:N \g_@@_empty_cell_bool \tl_gput_right:Nx \g_@@_HVdotsfor_lines_tl @@ -9690,9 +9794,9 @@ version 2005/12/01 or later. % \end{macrocode} % For the row, it's a bit more complicated. % \begin{macrocode} - \int_compare:nNnTF { #1 } = 1 + \int_compare:nNnTF { #1 } = \c_one_int { - \int_set:Nn \l_@@_initial_i_int 1 + \int_set_eq:NN \l_@@_initial_i_int \c_one_int \bool_set_true:N \l_@@_initial_open_bool } { @@ -9738,7 +9842,7 @@ version 2005/12/01 or later. { \color { nicematrix-last-col } } } \keys_set:nn { NiceMatrix / xdots } { #4 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Vdots: \group_end: % \end{macrocode} @@ -9819,13 +9923,14 @@ version 2005/12/01 or later. % \begin{macrocode} \hook_gput_code:nnn { begindocument } { . } { - \tl_set:Nn \l_@@_argspec_tl { O { } m m ! O { } E { _ ^ : } { { } { } { } } } + \cs_set_nopar:Npn \l_@@_argspec_tl + { O { } m m ! O { } E { _ ^ : } { { } { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl - \exp_args:NNV \NewDocumentCommand \@@_line \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_line \l_@@_argspec_tl { \group_begin: \keys_set:nn { NiceMatrix / xdots } { #1 , #4 , down = #5 , up = #6 } - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } + \tl_if_empty:oF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \use:e { \@@_line_i:nn @@ -9842,15 +9947,10 @@ version 2005/12/01 or later. { \bool_set_false:N \l_@@_initial_open_bool \bool_set_false:N \l_@@_final_open_bool - \bool_if:nTF - { - \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 } - || - \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 } - } - { - \@@_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 } - } + \bool_lazy_or:nnTF + { \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 } } + { \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 } } + { \@@_error:nnn { unknown~cell~for~line~in~CodeAfter } { #1 } { #2 } } % \end{macrocode} % The test of |measuring@| is a security (cf. question 686649 on TeX StackExchange). % \begin{macrocode} @@ -9922,7 +10022,7 @@ version 2005/12/01 or later. % |#1| is the first row \emph{after} the scope of the instructions in |#2| % \begin{macrocode} \cs_new:Npn \@@_if_row_less_than:nn #1 #2 - { \int_compare:nNnT { \int_use:N \c@iRow } < { #1 } { #2 } } + { \int_compare:nNnT \c@iRow < { #1 } { #2 } } % \end{macrocode} % % \bigskip @@ -9997,20 +10097,20 @@ version 2005/12/01 or later. \tl_gput_right:Nx \g_@@_pre_code_before_tl { % \end{macrocode} -% The command |\@@_exp_color_arg:NV| is \emph{fully expandable}. +% The command |\@@_exp_color_arg:No| is \emph{fully expandable}. % \begin{macrocode} - \@@_exp_color_arg:NV \@@_rectanglecolor \l_tmpa_tl + \@@_exp_color_arg:No \@@_rectanglecolor \l_tmpa_tl { \int_use:N \c@iRow - \int_use:N \c@jCol } { \int_use:N \c@iRow - * } } % \end{macrocode} % Then, the other rows (if there is several rows). % \begin{macrocode} - \int_compare:nNnT \l_@@_key_nb_rows_int > 1 + \int_compare:nNnT \l_@@_key_nb_rows_int > \c_one_int { \tl_gput_right:Nx \g_@@_pre_code_before_tl { - \@@_exp_color_arg:NV \@@_rowcolor \l_tmpa_tl + \@@_exp_color_arg:No \@@_rowcolor \l_tmpa_tl { \int_eval:n { \c@iRow + 1 } - \int_eval:n { \c@iRow + \l_@@_key_nb_rows_int - 1 } @@ -10241,7 +10341,7 @@ version 2005/12/01 or later. \@@_clip_with_rounded_corners: \seq_map_indexed_inline:Nn \g_@@_colors_seq { - \int_compare:nNnTF { ##1 } = 1 + \int_compare:nNnTF { ##1 } = \c_one_int { \cs_set_eq:NN \@@_cartesian_path:n \@@_cartesian_path_nocolor:n \use:c { g_@@_color _ 1 _tl } @@ -10285,7 +10385,7 @@ version 2005/12/01 or later. % \end{macrocode} % |\l_tmpa_tl| (if not empty) is now the opacity and |\l_tmpb_tl| (if not empty) is now the colorimetric space. % \begin{macrocode} - \tl_if_empty:NF \l_tmpa_tl { \exp_args:NV \pgfsetfillopacity \l_tmpa_tl } + \tl_if_empty:NF \l_tmpa_tl { \exp_args:No \pgfsetfillopacity \l_tmpa_tl } \tl_if_empty:NTF \l_tmpb_tl { \@declaredcolor } { \use:e { \exp_not:N \@undeclaredcolor [ \l_tmpb_tl ] } } @@ -10306,8 +10406,8 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_cartesian_color:nn #1 #2 { - \tl_set:Nn \l_@@_rows_tl { #1 } - \tl_set:Nn \l_@@_cols_tl { #2 } + \cs_set_nopar:Npn \l_@@_rows_tl { #1 } + \cs_set_nopar:Npn \l_@@_cols_tl { #2 } \@@_cartesian_path: } % \end{macrocode} @@ -10349,7 +10449,7 @@ version 2005/12/01 or later. { \@@_add_to_colors_seq:en { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } - { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt } } + { \@@_rectanglecolor:nnn { #3 } { #4 } { \c_zero_dim } } } } % \end{macrocode} @@ -10379,7 +10479,7 @@ version 2005/12/01 or later. \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #2 \q_stop - \tl_set:Nx \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl } + \tl_set:Nx \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl } \tl_set:Nx \l_@@_cols_tl { \l_@@_tmpd_tl - \l_tmpb_tl } % \end{macrocode} % The command |\@@_cartesian_path:n| takes in two implicit arguments: @@ -10404,9 +10504,9 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \@@_chessboardcolors { O { } m m } { - \int_step_inline:nn { \int_use:N \c@iRow } + \int_step_inline:nn \c@iRow { - \int_step_inline:nn { \int_use:N \c@jCol } + \int_step_inline:nn \c@jCol { \int_if_even:nTF { ####1 + ##1 } { \@@_cellcolor [ #1 ] { #2 } } @@ -10468,14 +10568,14 @@ version 2005/12/01 or later. \seq_clear_new:N \l_@@_colors_seq \seq_set_split:Nnn \l_@@_colors_seq { , } { #3 } \tl_clear_new:N \l_@@_cols_tl - \tl_set:Nn \l_@@_cols_tl { - } + \cs_set_nopar:Npn \l_@@_cols_tl { - } \keys_set:nn { NiceMatrix / rowcolors } { #4 } % \end{macrocode} % The counter |\l_@@_color_int| will be the rank of the current color in the list of % colors (modulo the length of the list). % \begin{macrocode} \int_zero_new:N \l_@@_color_int - \int_set:Nn \l_@@_color_int 1 + \int_set_eq:NN \l_@@_color_int \c_one_int \bool_if:NT \l_@@_respect_blocks_bool { % \end{macrocode} @@ -10494,10 +10594,10 @@ version 2005/12/01 or later. % \begin{macrocode} \clist_map_inline:nn { #2 } { - \tl_set:Nn \l_tmpa_tl { ##1 } + \cs_set_nopar:Npn \l_tmpa_tl { ##1 } \tl_if_in:NnTF \l_tmpa_tl { - } { \@@_cut_on_hyphen:w ##1 \q_stop } - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } + { \tl_set:No \l_tmpb_tl { \int_use:N \c@iRow } } % \end{macrocode} % Now, |l_tmpa_tl| and |l_tmpb_tl| are the first row and the last row of the % interval of rows that we have to treat. The counter |\l_tmpa_int| will be the @@ -10527,7 +10627,7 @@ version 2005/12/01 or later. % Now, the last row of the block is computed in |\l_tmpb_int|. % \begin{macrocode} } - \tl_set:Nx \l_@@_rows_tl + \tl_set:No \l_@@_rows_tl { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int } % \end{macrocode} % |\l_@@_tmpc_tl| will be the color that we will use. @@ -10595,11 +10695,13 @@ version 2005/12/01 or later. % \begin{macrocode} \prg_new_conditional:Nnn \@@_not_in_exterior:nnnnn p { - \bool_lazy_or:nnTF - { \int_if_zero_p:n { #4 } } - { \int_compare_p:nNn { #2 } = { \int_eval:n { \c@jCol + 1 } } } + \int_if_zero:nTF { #4 } \prg_return_false: - \prg_return_true: + { + \int_compare:nNnTF { #2 } > \c@jCol + \prg_return_false: + \prg_return_true: + } } % \end{macrocode} % @@ -10609,14 +10711,13 @@ version 2005/12/01 or later. % \begin{macrocode} \prg_new_conditional:Nnn \@@_intersect_our_row:nnnnn p { - \bool_if:nTF - { - \int_compare_p:n { #1 <= \l_tmpa_int } - && - \int_compare_p:n { \l_tmpa_int <= #3 } - } - \prg_return_true: + \int_compare:nNnTF { #1 } > \l_tmpa_int \prg_return_false: + { + \int_compare:nNnTF \l_tmpa_int > { #3 } + \prg_return_false: + \prg_return_true: + } } % \end{macrocode} % @@ -10628,50 +10729,62 @@ version 2005/12/01 or later. % below a command |\@@_cartesian_path:| which corresponds to a value $0$~pt for % the radius of the corners. % -% This command is in particular used in |\@@_rectanglecolor:nnn| (used in +% This command is, in particular, used in |\@@_rectanglecolor:nnn| (used in % |\@@_rectanglecolor|, itself used in |\@@_cellcolor|). % \begin{macrocode} \cs_new_protected:Npn \@@_cartesian_path_normal:n #1 { - \bool_lazy_any:nT + \dim_compare:nNnTF { #1 } = \c_zero_dim { - { ! \seq_if_empty_p:N \l_@@_corners_cells_seq } - { \dim_compare_p:nNn { #1 } = \c_zero_dim } - { ! \@@_nocolor_used_bool } + \bool_if:NTF + \@@_nocolor_used_bool + \@@_cartesian_path_normal_ii: + { + \seq_if_empty:NTF \l_@@_corners_cells_seq + { \@@_cartesian_path_normal_i:n { #1 } } + \@@_cartesian_path_normal_ii: + } } - { - \@@_expand_clist:NN \l_@@_cols_tl \c@jCol - \@@_expand_clist:NN \l_@@_rows_tl \c@iRow - } + { \@@_cartesian_path_normal_i:n { #1 } } + } +% \end{macrocode} +% +% +% \bigskip +% First, the situation where is a rectangular zone of cells will be colored as a +% whole (in the instructions of the resulting \textsc{pdf}). The argument is the +% radius of the corners. +% \begin{macrocode} +\cs_new_protected:Npn \@@_cartesian_path_normal_i:n #1 + { + \pgfsetcornersarced { \pgfpoint { #1 } { #1 } } % \end{macrocode} % We begin the loop over the columns. % \begin{macrocode} \clist_map_inline:Nn \l_@@_cols_tl { - \tl_set:Nn \l_tmpa_tl { ##1 } + \cs_set_nopar:Npn \l_tmpa_tl { ##1 } \tl_if_in:NnTF \l_tmpa_tl { - } { \@@_cut_on_hyphen:w ##1 \q_stop } { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop } - \bool_lazy_or:nnT - { \tl_if_blank_p:V \l_tmpa_tl } - { \str_if_eq_p:Vn \l_tmpa_tl { * } } - { \tl_set:Nn \l_tmpa_tl { 1 } } - \bool_lazy_or:nnT - { \tl_if_blank_p:V \l_tmpb_tl } - { \str_if_eq_p:Vn \l_tmpb_tl { * } } - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } + \tl_if_empty:NTF \l_tmpa_tl + { \cs_set_nopar:Npn \l_tmpa_tl { 1 } } + { + \tl_if_eq:NNT \l_tmpa_tl \c_@@_star_tl + { \cs_set_nopar:Npn \l_tmpa_tl { 1 } } + } + \tl_if_empty:NTF \l_tmpb_tl + { \tl_set:No \l_tmpb_tl { \int_use:N \c@jCol } } + { + \tl_if_eq:NNT \l_tmpb_tl \c_@@_star_tl + { \tl_set:No \l_tmpb_tl { \int_use:N \c@jCol } } + } \int_compare:nNnT \l_tmpb_tl > \g_@@_col_total_int - { \tl_set:Nx \l_tmpb_tl { \int_use:N \g_@@_col_total_int } } + { \tl_set:No \l_tmpb_tl { \int_use:N \g_@@_col_total_int } } % \end{macrocode} % |\l_@@_tmpc_tl| will contain the number of column. % \begin{macrocode} \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl -% \end{macrocode} -% If we decide to provide the commands |\cellcolor|, |\rectanglecolor|, -% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| in the -% |code-before| of a |\SubMatrix|, we will have to modify the following line, by -% adding a kind of offset. We will have also some other lines to modify. -% \begin{macrocode} \@@_qpoint:n { col - \l_tmpa_tl } \int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } @@ -10683,28 +10796,76 @@ version 2005/12/01 or later. % \begin{macrocode} \clist_map_inline:Nn \l_@@_rows_tl { - \tl_set:Nn \l_tmpa_tl { ####1 } + \cs_set_nopar:Npn \l_tmpa_tl { ####1 } \tl_if_in:NnTF \l_tmpa_tl { - } { \@@_cut_on_hyphen:w ####1 \q_stop } { \@@_cut_on_hyphen:w ####1 - ####1 \q_stop } - \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } - \tl_if_empty:NT \l_tmpb_tl - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } + \tl_if_empty:NTF \l_tmpa_tl + { \cs_set_nopar:Npn \l_tmpa_tl { 1 } } + { + \tl_if_eq:NNT \l_tmpa_tl \c_@@_star_tl + { \cs_set_nopar:Npn \l_tmpa_tl { 1 } } + } + \tl_if_empty:NTF \l_tmpb_tl + { \tl_set:No \l_tmpb_tl { \int_use:N \c@iRow } } + { + \tl_if_eq:NNT \l_tmpb_tl \c_@@_star_tl + { \tl_set:No \l_tmpb_tl { \int_use:N \c@iRow } } + } \int_compare:nNnT \l_tmpb_tl > \g_@@_row_total_int - { \tl_set:Nx \l_tmpb_tl { \int_use:N \g_@@_row_total_int } } + { \tl_set:No \l_tmpb_tl { \int_use:N \g_@@_row_total_int } } % \end{macrocode} % Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|. % \begin{macrocode} - \seq_if_in:NxF \l_@@_corners_cells_seq - { \l_tmpa_tl - \l_@@_tmpc_tl } + \cs_if_exist:cF + { @@ _ \l_tmpa_tl _ \l_@@_tmpc_tl _ nocolor } { \@@_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } } \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } \@@_qpoint:n { row - \l_tmpa_tl } \dim_set:Nn \l_@@_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } - \pgfsetcornersarced { \pgfpoint { #1 } { #1 } } + \pgfpathrectanglecorners + { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim } + { \pgfpoint \l_tmpa_dim \l_tmpb_dim } + } + } + } + } +% \end{macrocode} +% +% +% Now, the case where the cells will be colored cell by cell (it's mandatory for +% example if the key |corners| is used). +% \begin{macrocode} +\cs_new_protected:Npn \@@_cartesian_path_normal_ii: + { + \@@_expand_clist:NN \l_@@_cols_tl \c@jCol + \@@_expand_clist:NN \l_@@_rows_tl \c@iRow +% \end{macrocode} +% We begin the loop over the columns. +% \begin{macrocode} + \clist_map_inline:Nn \l_@@_cols_tl + { + \@@_qpoint:n { col - ##1 } + \int_compare:nNnTF \l_@@_first_col_int = { ##1 } + { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } + \@@_qpoint:n { col - \int_eval:n { ##1 + 1 } } + \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } +% \end{macrocode} +% We begin the loop over the rows. +% \begin{macrocode} + \clist_map_inline:Nn \l_@@_rows_tl + { + \seq_if_in:NnF \l_@@_corners_cells_seq + { ####1 - ##1 } + { + \@@_qpoint:n { row - \int_eval:n { ####1 + 1 } } + \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } + \@@_qpoint:n { row - ####1 } + \dim_set:Nn \l_@@_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } \cs_if_exist:cF - { @@ _ \l_tmpa_tl _ \l_@@_tmpc_tl _ nocolor } + { @@ _ ####1 _ ##1 _ nocolor } { \pgfpathrectanglecorners { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim } @@ -10716,12 +10877,14 @@ version 2005/12/01 or later. } % \end{macrocode} % +% +% % \bigskip % The following command corresponds to a radius of the corners equal to $0$~pt. % This command is used by the commands |\@@_rowcolors|, |\@@_columncolor| and % |\@@_rowcolor:n| (used in |\@@_rowcolor|). % \begin{macrocode} -\cs_new_protected:Npn \@@_cartesian_path: { \@@_cartesian_path:n { 0 pt } } +\cs_new_protected:Npn \@@_cartesian_path: { \@@_cartesian_path:n \c_zero_dim } % \end{macrocode} % % @@ -10761,20 +10924,20 @@ version 2005/12/01 or later. \clist_clear:N #1 \clist_map_inline:Nn \l_tmpa_clist { - \tl_set:Nn \l_tmpa_tl { ##1 } + \cs_set_nopar:Npn \l_tmpa_tl { ##1 } \tl_if_in:NnTF \l_tmpa_tl { - } { \@@_cut_on_hyphen:w ##1 \q_stop } { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop } \bool_lazy_or:nnT - { \tl_if_blank_p:V \l_tmpa_tl } - { \str_if_eq_p:Vn \l_tmpa_tl { * } } - { \tl_set:Nn \l_tmpa_tl { 1 } } + { \tl_if_blank_p:o \l_tmpa_tl } + { \str_if_eq_p:on \l_tmpa_tl { * } } + { \cs_set_nopar:Npn \l_tmpa_tl { 1 } } \bool_lazy_or:nnT - { \tl_if_blank_p:V \l_tmpb_tl } - { \str_if_eq_p:Vn \l_tmpb_tl { * } } - { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } } + { \tl_if_blank_p:o \l_tmpb_tl } + { \str_if_eq_p:on \l_tmpb_tl { * } } + { \tl_set:No \l_tmpb_tl { \int_use:N #2 } } \int_compare:nNnT \l_tmpb_tl > #2 - { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } } + { \tl_set:No \l_tmpb_tl { \int_use:N #2 } } \int_step_inline:nnn \l_tmpa_tl \l_tmpb_tl { \clist_put_right:Nn #1 { ####1 } } } @@ -11071,7 +11234,6 @@ version 2005/12/01 or later. position .int_set:N = \l_@@_position_int , position .value_required:n = true , start .int_set:N = \l_@@_start_int , - start .initial:n = 1 , end .code:n = \bool_lazy_or:nnTF { \tl_if_empty_p:n { #1 } } @@ -11140,7 +11302,6 @@ version 2005/12/01 or later. % The group is for the options. % \begin{macrocode} \group_begin: - \int_zero_new:N \l_@@_end_int \int_set_eq:NN \l_@@_end_int \c@iRow \keys_set_known:nnN { NiceMatrix / Rules } { #1 } \l_@@_other_keys_tl % \end{macrocode} @@ -11157,14 +11318,12 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_vline_i: { - \int_zero_new:N \l_@@_local_start_int - \int_zero_new:N \l_@@_local_end_int % \end{macrocode} % |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When % we have found a row corresponding to a rule to draw, we note its number in % |\l_@@_tmpc_tl|. % \begin{macrocode} - \tl_set:Nx \l_tmpb_tl { \int_eval:n \l_@@_position_int } + \tl_set:No \l_tmpb_tl { \int_use:N \l_@@_position_int } \int_step_variable:nnNn \l_@@_start_int \l_@@_end_int \l_tmpa_tl { @@ -11193,7 +11352,7 @@ version 2005/12/01 or later. { \int_set:Nn \l_@@_local_start_int \l_tmpa_tl } } { - \int_compare:nNnT \l_@@_local_start_int > 0 + \int_compare:nNnT \l_@@_local_start_int > \c_zero_int { \int_set:Nn \l_@@_local_end_int { \l_tmpa_tl - 1 } \@@_vline_ii: @@ -11201,7 +11360,7 @@ version 2005/12/01 or later. } } } - \int_compare:nNnT \l_@@_local_start_int > 0 + \int_compare:nNnT \l_@@_local_start_int > \c_zero_int { \int_set_eq:NN \l_@@_local_end_int \l_@@_end_int \@@_vline_ii: @@ -11225,7 +11384,7 @@ version 2005/12/01 or later. \l_@@_corners_cells_seq { \l_tmpa_tl - \l_tmpb_tl } { - \int_compare:nNnTF \l_tmpb_tl = 1 + \int_compare:nNnTF \l_tmpb_tl = \c_one_int { \bool_set_false:N \g_tmpa_bool } { \seq_if_in:NxT @@ -11278,9 +11437,9 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \bool_lazy_all:nT { - { \int_compare_p:nNn \l_@@_multiplicity_int > 1 } + { \int_compare_p:nNn \l_@@_multiplicity_int > \c_one_int } { \cs_if_exist_p:N \CT@drsc@ } - { ! \tl_if_blank_p:V \CT@drsc@ } + { ! \tl_if_blank_p:o \CT@drsc@ } } { \group_begin: @@ -11362,7 +11521,7 @@ version 2005/12/01 or later. \dim_set:Nn \l_tmpb_dim { \pgf@x - 0.5 \l_@@_rule_width_dim } \@@_qpoint:n { row - \int_eval:n { \l_@@_local_end_int + 1 } } \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y - \exp_args:NV \tikzset \l_@@_tikz_rule_tl + \exp_args:No \tikzset \l_@@_tikz_rule_tl \use:e { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] } ( \l_tmpb_dim , \l_tmpa_dim ) -- ( \l_tmpb_dim , \l_@@_tmpc_dim ) ; @@ -11379,17 +11538,14 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_draw_vlines: { \int_step_inline:nnn + { \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool 2 1 } { - \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } - 1 2 - } - { - \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } - { \int_eval:n { \c@jCol + 1 } } + \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool \c@jCol + { \int_eval:n { \c@jCol + 1 } } } { - \tl_if_eq:NnF \l_@@_vlines_clist { all } + \tl_if_eq:NNF \l_@@_vlines_clist \c_@@_all_tl { \clist_if_in:NnT \l_@@_vlines_clist { ##1 } } { \@@_vline:n { position = ##1 , total-width = \arrayrulewidth } } } @@ -11429,7 +11585,7 @@ version 2005/12/01 or later. % we have found a column corresponding to a rule to draw, we note its number in % |\l_@@_tmpc_tl|. % \begin{macrocode} - \tl_set:Nx \l_tmpa_tl { \int_use:N \l_@@_position_int } + \tl_set:No \l_tmpa_tl { \int_use:N \l_@@_position_int } \int_step_variable:nnNn \l_@@_start_int \l_@@_end_int \l_tmpb_tl { @@ -11458,7 +11614,7 @@ version 2005/12/01 or later. { \int_set:Nn \l_@@_local_start_int \l_tmpb_tl } } { - \int_compare:nNnT \l_@@_local_start_int > 0 + \int_compare:nNnT \l_@@_local_start_int > \c_zero_int { \int_set:Nn \l_@@_local_end_int { \l_tmpb_tl - 1 } \@@_hline_ii: @@ -11466,7 +11622,7 @@ version 2005/12/01 or later. } } } - \int_compare:nNnT \l_@@_local_start_int > 0 + \int_compare:nNnT \l_@@_local_start_int > \c_zero_int { \int_set_eq:NN \l_@@_local_end_int \l_@@_end_int \@@_hline_ii: @@ -11490,7 +11646,7 @@ version 2005/12/01 or later. \l_@@_corners_cells_seq { \l_tmpa_tl - \l_tmpb_tl } { - \int_compare:nNnTF \l_tmpa_tl = 1 + \int_compare:nNnTF \l_tmpa_tl = \c_one_int { \bool_set_false:N \g_tmpa_bool } { \seq_if_in:NxT @@ -11542,9 +11698,9 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \bool_lazy_all:nT { - { \int_compare_p:nNn \l_@@_multiplicity_int > 1 } + { \int_compare_p:nNn \l_@@_multiplicity_int > \c_one_int } { \cs_if_exist_p:N \CT@drsc@ } - { ! \tl_if_blank_p:V \CT@drsc@ } + { ! \tl_if_blank_p:o \CT@drsc@ } } { \group_begin: @@ -11634,7 +11790,7 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim \@@_qpoint:n { col - \int_use:N \l_@@_local_start_int } \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x - \int_compare:nNnT \l_@@_local_start_int = 1 + \int_compare:nNnT \l_@@_local_start_int = \c_one_int { \dim_sub:Nn \l_@@_x_initial_dim \l_@@_left_margin_dim \bool_if:NF \g_@@_delims_bool @@ -11688,7 +11844,7 @@ version 2005/12/01 or later. \dim_set:Nn \l_tmpb_dim { \pgf@y - 0.5 \l_@@_rule_width_dim } \@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } } \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x - \exp_args:NV \tikzset \l_@@_tikz_rule_tl + \exp_args:No \tikzset \l_@@_tikz_rule_tl \use:e { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] } ( \l_tmpa_dim , \l_tmpb_dim ) -- ( \l_@@_tmpc_dim , \l_tmpb_dim ) ; @@ -11705,17 +11861,14 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_draw_hlines: { \int_step_inline:nnn + { \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool 2 1 } { - \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } - 1 2 - } - { - \bool_if:nTF { ! \g_@@_delims_bool && ! \l_@@_except_borders_bool } - { \int_eval:n { \c@iRow + 1 } } + \bool_lazy_or:nnTF \g_@@_delims_bool \l_@@_except_borders_bool \c@iRow + { \int_eval:n { \c@iRow + 1 } } } { - \tl_if_eq:NnF \l_@@_hlines_clist { all } + \tl_if_eq:NNF \l_@@_hlines_clist \c_@@_all_tl { \clist_if_in:NnT \l_@@_hlines_clist { ##1 } } { \@@_hline:n { position = ##1 , total-width = \arrayrulewidth } } } @@ -11759,7 +11912,7 @@ version 2005/12/01 or later. \cs_set:Npn \@@_Hline_iv:nn #1 #2 { \@@_compute_rule_width:n { multiplicity = #1 , #2 } - \skip_vertical:n { \l_@@_rule_width_dim } + \skip_vertical:N \l_@@_rule_width_dim \tl_gput_right:Nx \g_@@_pre_code_after_tl { \@@_hline:n @@ -11808,7 +11961,7 @@ version 2005/12/01 or later. { \str_if_empty_p:N \l_@@_ccommand_str } } { \@@_error:n { No~letter~and~no~command } } - { \exp_args:NV \@@_custom_line_i:n \l_@@_other_keys_tl } + { \exp_args:No \@@_custom_line_i:n \l_@@_other_keys_tl } } % \end{macrocode} % @@ -11847,12 +12000,11 @@ version 2005/12/01 or later. \bool_if:NT \l_@@_color_bool { \@@_error:n { color~in~custom-line~with~tikz } } } - \bool_if:nT + \bool_if:NT \l_@@_dotted_rule_bool { - \int_compare_p:nNn \l_@@_multiplicity_int > 1 - && \l_@@_dotted_rule_bool + \int_compare:nNnT \l_@@_multiplicity_int > \c_one_int + { \@@_error:n { key~multiplicity~with~dotted } } } - { \@@_error:n { key~multiplicity~with~dotted } } \str_if_empty:NF \l_@@_letter_str { \int_compare:nTF { \str_count:N \l_@@_letter_str != 1 } @@ -11953,7 +12105,7 @@ version 2005/12/01 or later. % |\noalign| (which is in |\Hline|). % \begin{macrocode} \cs_set:cpn { nicematrix - \l_@@_command_str } { \Hline [ #1 ] } - \seq_put_left:NV \l_@@_custom_line_commands_seq \l_@@_command_str + \seq_put_left:No \l_@@_custom_line_commands_seq \l_@@_command_str } % \end{macrocode} % @@ -11983,7 +12135,7 @@ version 2005/12/01 or later. { \@@_c_custom_line_i:nn { #1 , ##1 } { ####1 } } } } - \seq_put_left:NV \l_@@_custom_line_commands_seq \l_@@_ccommand_str + \seq_put_left:No \l_@@_custom_line_commands_seq \l_@@_ccommand_str } % \end{macrocode} % The first argument is the list of key-value pairs characteristic of the line. @@ -12072,14 +12224,17 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_test_hline_in_block:nnnnn #1 #2 #3 #4 #5 { - \bool_lazy_all:nT + \int_compare:nNnT \l_tmpa_tl > { #1 } { - { \int_compare_p:nNn \l_tmpa_tl > { #1 } } - { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } } - { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } } - { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } } + \int_compare:nNnT \l_tmpa_tl < { #3 + 1 } + { + \int_compare:nNnT \l_tmpb_tl > { #2 - 1 } + { + \int_compare:nNnT \l_tmpb_tl < { #4 + 1 } + { \bool_gset_false:N \g_tmpa_bool } + } + } } - { \bool_gset_false:N \g_tmpa_bool } } % \end{macrocode} % @@ -12087,46 +12242,53 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_test_vline_in_block:nnnnn #1 #2 #3 #4 #5 { - \bool_lazy_all:nT - { - { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } } - { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } } - { \int_compare_p:nNn \l_tmpb_tl > { #2 } } - { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } } + \int_compare:nNnT \l_tmpa_tl > { #1 - 1 } + { + \int_compare:nNnT \l_tmpa_tl < { #3 + 1 } + { + \int_compare:nNnT \l_tmpb_tl > { #2 } + { + \int_compare:nNnT \l_tmpb_tl < { #4 + 1 } + { \bool_gset_false:N \g_tmpa_bool } + } + } } - { \bool_gset_false:N \g_tmpa_bool } } % \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \@@_test_hline_in_stroken_block:nnnn #1 #2 #3 #4 { - \bool_lazy_all:nT - { - { - ( \int_compare_p:nNn \l_tmpa_tl = { #1 } ) - || ( \int_compare_p:nNn \l_tmpa_tl = { #3 + 1 } ) - } - { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } } - { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } } + \int_compare:nNnT \l_tmpb_tl > { #2 - 1 } + { + \int_compare:nNnT \l_tmpb_tl < { #4 + 1 } + { + \int_compare:nNnTF \l_tmpa_tl = { #1 } + { \bool_gset_false:N \g_tmpa_bool } + { + \int_compare:nNnT \l_tmpa_tl = { #3 + 1 } + { \bool_gset_false:N \g_tmpa_bool } + } + } } - { \bool_gset_false:N \g_tmpa_bool } } % \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \@@_test_vline_in_stroken_block:nnnn #1 #2 #3 #4 { - \bool_lazy_all:nT + \int_compare:nNnT \l_tmpa_tl > { #1 - 1 } { - { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } } - { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } } - { - ( \int_compare_p:nNn \l_tmpb_tl = { #2 } ) - || ( \int_compare_p:nNn \l_tmpb_tl = { #4 + 1 } ) - } + \int_compare:nNnT \l_tmpa_tl < { #3 + 1 } + { + \int_compare:nNnTF \l_tmpb_tl = { #2 } + { \bool_gset_false:N \g_tmpa_bool } + { + \int_compare:nNnT \l_tmpb_tl = { #4 + 1 } + { \bool_gset_false:N \g_tmpa_bool } + } + } } - { \bool_gset_false:N \g_tmpa_bool } } % \end{macrocode} % @@ -12301,15 +12463,15 @@ version 2005/12/01 or later. % % % \begin{macrocode} -\cs_new_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7 +\cs_set_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7 { - \int_compare:nNnT { #3 } < { \int_eval:n { #1 + 1 } } + \int_compare:nNnF { #3 } > { #1 } { - \int_compare:nNnT { #1 } < { \int_eval:n { #5 + 1 } } + \int_compare:nNnF { #1 } > { #5 } { - \int_compare:nNnT { #4 } < { \int_eval:n { #2 + 1 } } + \int_compare:nNnF { #4 } > { #2 } { - \int_compare:nNnT { #2 } < { \int_eval:n { #6 + 1 } } + \int_compare:nNnF { #2 } > { #6 } { \bool_set_true:N \l_tmpb_bool } } } @@ -12565,7 +12727,7 @@ version 2005/12/01 or later. % Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:| % because this command will also be used for the creation of the ``large nodes''. % \begin{macrocode} - \tl_set:Nn \l_@@_suffix_tl { -medium } + \cs_set_nopar:Npn \l_@@_suffix_tl { -medium } \@@_create_nodes: \endpgfpicture } @@ -12588,7 +12750,7 @@ version 2005/12/01 or later. \pgf@relevantforpicturesizefalse \@@_computations_for_medium_nodes: \@@_computations_for_large_nodes: - \tl_set:Nn \l_@@_suffix_tl { - large } + \cs_set_nopar:Npn \l_@@_suffix_tl { - large } \@@_create_nodes: \endpgfpicture } @@ -12605,10 +12767,10 @@ version 2005/12/01 or later. % Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:| % because this command will also be used for the creation of the ``large nodes''. % \begin{macrocode} - \tl_set:Nn \l_@@_suffix_tl { - medium } + \cs_set_nopar:Npn \l_@@_suffix_tl { - medium } \@@_create_nodes: \@@_computations_for_large_nodes: - \tl_set:Nn \l_@@_suffix_tl { - large } + \cs_set_nopar:Npn \l_@@_suffix_tl { - large } \@@_create_nodes: \endpgfpicture } @@ -12622,8 +12784,8 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_computations_for_large_nodes: { - \int_set:Nn \l_@@_first_row_int 1 - \int_set:Nn \l_@@_first_col_int 1 + \int_set_eq:NN \l_@@_first_row_int \c_one_int + \int_set_eq:NN \l_@@_first_col_int \c_one_int % \end{macrocode} % We have to change the values of all the dimensions % \texttt{l_@@_row_\textsl{i}_min_dim}, \texttt{l_@@_row_\textsl{i}_max_dim}, @@ -12777,13 +12939,13 @@ version 2005/12/01 or later. R .value_forbidden:n = true , C .code:n = \str_set:Nn \l_@@_hpos_block_str c , C .value_forbidden:n = true , - t .code:n = \str_set:Nn \l_@@_vpos_of_block_str t , + t .code:n = \str_set:Nn \l_@@_vpos_block_str t , t .value_forbidden:n = true , - T .code:n = \str_set:Nn \l_@@_vpos_of_block_str T , + T .code:n = \str_set:Nn \l_@@_vpos_block_str T , T .value_forbidden:n = true , - b .code:n = \str_set:Nn \l_@@_vpos_of_block_str b , + b .code:n = \str_set:Nn \l_@@_vpos_block_str b , b .value_forbidden:n = true , - B .code:n = \str_set:Nn \l_@@_vpos_of_block_str B , + B .code:n = \str_set:Nn \l_@@_vpos_block_str B , B .value_forbidden:n = true , color .code:n = \@@_color:n { #1 } @@ -12792,8 +12954,9 @@ version 2005/12/01 or later. { \char_set_catcode_other:N ! } { #1 } , color .value_required:n = true , - respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool , - respect-arraystretch .default:n = true + respect-arraystretch .code:n = + \cs_set_eq:NN \@@_reset_arraystretch: \prg_do_nothing: , + respect-arraystretch .value_forbidden:n = true , } % \end{macrocode} % @@ -12819,7 +12982,7 @@ version 2005/12/01 or later. \peek_remove_spaces:n { \tl_if_blank:nTF { #2 } - { \@@_Block_i 1-1 \q_stop } + { \@@_Block_ii:nnnnn \c_one_int \c_one_int } { \int_compare:nNnTF { \char_value_catcode:n { 45 } } = { 13 } \@@_Block_i_czech \@@_Block_i @@ -12882,13 +13045,13 @@ version 2005/12/01 or later. % \medskip % If the block is mono-column. % \begin{macrocode} - \int_compare:nNnTF \l_tmpb_int = 1 + \int_compare:nNnTF \l_tmpb_int = \c_one_int { - \str_if_empty:NTF \l_@@_hpos_cell_str - { \str_set:Nn \l_@@_hpos_block_str c } - { \str_set_eq:NN \l_@@_hpos_block_str \l_@@_hpos_cell_str } + \tl_if_empty:NTF \l_@@_hpos_cell_tl + { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_c_str } + { \str_set:NV \l_@@_hpos_block_str \l_@@_hpos_cell_tl } } - { \str_set:Nn \l_@@_hpos_block_str c } + { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_c_str } % \end{macrocode} % The value of |\l_@@_hpos_block_str| may be modified by the keys of the % command |\Block| that we will analyze now. @@ -12921,9 +13084,9 @@ version 2005/12/01 or later. \bool_if:nTF { ( - \int_compare_p:nNn { \l_tmpa_int } = 1 + \int_compare_p:nNn \l_tmpa_int = \c_one_int || - \int_compare_p:nNn { \l_tmpb_int } = 1 + \int_compare_p:nNn \l_tmpb_int = \c_one_int ) && ! \tl_if_empty_p:n { #5 } % \end{macrocode} @@ -12994,15 +13157,15 @@ version 2005/12/01 or later. % |\documentclass| with |\RequirePackage{expl3}|). % \begin{macrocode} \tl_if_empty:NTF \l_@@_color_tl - { \int_compare:nNnT { #2 } = 1 \set@color } - { \@@_color:V \l_@@_color_tl } + { \int_compare:nNnT { #2 } = \c_one_int \set@color } + { \@@_color:o \l_@@_color_tl } % \end{macrocode} % If the block is mono-row, we use |\g_@@_row_style_tl| even if it has yet been % used in the beginning of the cell where the command |\Block| has been issued % because we want to be able to take into account a potential instruction of % color of the font in |\g_@@_row_style_tl|. % \begin{macrocode} - \int_compare:nNnT { #1 } = 1 + \int_compare:nNnT { #1 } = \c_one_int { \int_if_zero:nTF \c@iRow \l_@@_code_for_first_row_tl @@ -13012,8 +13175,10 @@ version 2005/12/01 or later. } \g_@@_row_style_tl } - \bool_if:NF \l_@@_respect_arraystretch_bool - { \cs_set:Npn \arraystretch { 1 } } +% \end{macrocode} +% The following command will be no-op when |respect-arraystretch| is in force. +% \begin{macrocode} + \@@_reset_arraystretch: \dim_zero:N \extrarowheight % \end{macrocode} % |#4| is the optional argument of the command |\Block|, provided with the @@ -13039,12 +13204,12 @@ version 2005/12/01 or later. { \bool_lazy_all:nTF { - { \int_compare_p:nNn { #2 } = 1 } + { \int_compare_p:nNn { #2 } = \c_one_int } % \end{macrocode} % Remind that, when the column has not a fixed width, the dimension % |\l_@@_col_width_dim| has the conventional value of $-1$~cm. % \begin{macrocode} - { \dim_compare_p:n { \l_@@_col_width_dim >= \c_zero_dim } } + { ! \dim_compare_p:nNn \l_@@_col_width_dim < \c_zero_dim } { ! \g_@@_rotate_bool } } % \end{macrocode} @@ -13055,9 +13220,9 @@ version 2005/12/01 or later. \use:e { \exp_not:N \begin { minipage }% - [ \str_lowercase:V { \l_@@_vpos_of_block_str } ] + [ \str_lowercase:V \l_@@_vpos_block_str ] { \l_@@_col_width_dim } - \str_case:Vn \l_@@_hpos_block_str + \str_case:on \l_@@_hpos_block_str { c \centering r \raggedleft l \raggedright } } #5 @@ -13070,7 +13235,7 @@ version 2005/12/01 or later. \use:e { \exp_not:N \begin { tabular }% - [ \str_lowercase:V { \l_@@_vpos_of_block_str } ] + [ \str_lowercase:V \l_@@_vpos_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -13086,7 +13251,7 @@ version 2005/12/01 or later. \use:e { \exp_not:N \begin { array }% - [ \str_lowercase:V { \l_@@_vpos_of_block_str } ] + [ \str_lowercase:V \l_@@_vpos_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -13108,7 +13273,7 @@ version 2005/12/01 or later. % If we are in a mono-column block, we take into account the width of that block % for the width of the column. % \begin{macrocode} - \int_compare:nNnT { #2 } = 1 + \int_compare:nNnT { #2 } = \c_one_int { \dim_gset:Nn \g_@@_blocks_wd_dim { @@ -13129,9 +13294,9 @@ version 2005/12/01 or later. % |b| or |B|.}, we take into account the height and the depth of that block for the % height and the depth of the row. % \begin{macrocode} - \str_if_eq:VnT \l_@@_vpos_of_block_str { c } + \str_if_eq:VnT \l_@@_vpos_block_str { c } { - \int_compare:nNnT { #1 } = 1 + \int_compare:nNnT { #1 } = \c_one_int { \dim_gset:Nn \g_@@_blocks_ht_dim { @@ -13197,7 +13362,7 @@ version 2005/12/01 or later. \bool_if:NTF \g_@@_rotate_c_bool { c } { - \str_case:VnF \l_@@_vpos_of_block_str + \str_case:onF \l_@@_vpos_block_str { b l B l t r T r } { \int_compare:nNnTF \c@iRow = \l_@@_last_row_int r l } } @@ -13264,8 +13429,10 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_tabular_bool { \group_begin: - \bool_if:NF \l_@@_respect_arraystretch_bool - { \cs_set:Npn \exp_not:N \arraystretch { 1 } } +% \end{macrocode} +% The following command will be no-op when |respect-arraystretch| is in force. +% \begin{macrocode} + \@@_reset_arraystretch: \exp_not:n { \dim_zero:N \extrarowheight @@ -13278,10 +13445,9 @@ version 2005/12/01 or later. % the tabular is the same as the external alignment of the tabular (that is to % say the position of the block in its zone of merged cells). % \begin{macrocode} - % \@@_adjust_hpos_rotate: \use:e { - \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_str ] + \exp_not:N \begin { tabular } [ \l_@@_vpos_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -13294,17 +13460,18 @@ version 2005/12/01 or later. % \begin{macrocode} { \group_begin: - \bool_if:NF \l_@@_respect_arraystretch_bool - { \cs_set:Npn \exp_not:N \arraystretch { 1 } } +% \end{macrocode} +% The following will be no-op when |respect-arraystretch| is in force. +% \begin{macrocode} + \@@_reset_arraystretch: \exp_not:n { \dim_zero:N \extrarowheight #4 - % \@@_adjust_hpos_rotate: - \c_math_toggle_token % :n c + \c_math_toggle_token \use:e { - \exp_not:N \begin { array } [ \l_@@_vpos_of_block_str ] + \exp_not:N \begin { array } [ \l_@@_vpos_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -13376,16 +13543,18 @@ version 2005/12/01 or later. \bool_set_true:N \l_@@_hpos_of_block_cap_bool , C .code:n = \str_set:Nn \l_@@_hpos_block_str c \bool_set_true:N \l_@@_hpos_of_block_cap_bool , - t .code:n = \str_set:Nn \l_@@_vpos_of_block_str t , - T .code:n = \str_set:Nn \l_@@_vpos_of_block_str T , - b .code:n = \str_set:Nn \l_@@_vpos_of_block_str b , - B .code:n = \str_set:Nn \l_@@_vpos_of_block_str B , - v-center .code:n = \str_set:Nn \l_@@_vpos_of_block_str { c } , + t .code:n = \str_set:Nn \l_@@_vpos_block_str t , + T .code:n = \str_set:Nn \l_@@_vpos_block_str T , + b .code:n = \str_set:Nn \l_@@_vpos_block_str b , + B .code:n = \str_set:Nn \l_@@_vpos_block_str B , + v-center .code:n = \str_set:Nn \l_@@_vpos_block_str { c } , v-center .value_forbidden:n = true , name .tl_set:N = \l_@@_block_name_str , name .value_required:n = true , name .initial:n = , - respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool , + respect-arraystretch .code:n = + \cs_set_eq:NN \@@_reset_arraystretch: \prg_do_nothing: , + respect-arraystretch .value_forbidden:n = true , transparent .bool_set:N = \l_@@_transparent_bool , transparent .default:n = true , transparent .initial:n = false , @@ -13435,10 +13604,7 @@ version 2005/12/01 or later. { \bool_lazy_and:nnTF \l_@@_preamble_bool - { - \int_compare_p:n - { \l_@@_last_col_int <= \g_@@_static_num_of_col_int } - } + { \int_compare_p:nNnF \l_@@_last_col_int > \g_@@_static_num_of_col_int } { \msg_error:nnnn { nicematrix } { Block~too~large~2 } { #1 } { #2 } \@@_msg_redirect_name:nn { Block~too~large~2 } { none } @@ -13471,7 +13637,7 @@ version 2005/12/01 or later. % \begin{macrocode} \group_begin: \int_compare:nNnT { #1 } = { #3 } - { \str_set:Nn \l_@@_vpos_of_block_str { t } } + { \str_set:Nn \l_@@_vpos_block_str { t } } \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } % \end{macrocode} % @@ -13496,28 +13662,28 @@ version 2005/12/01 or later. { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int } } } - \bool_if:nF + \bool_if:NF \l_@@_transparent_bool { - \l_@@_transparent_bool - || ( \l_@@_vlines_block_bool && \l_@@_hlines_block_bool ) - } - { + \bool_lazy_and:nnF \l_@@_vlines_block_bool \l_@@_hlines_block_bool + { % \end{macrocode} % The sequence of the positions of the blocks (excepted the blocks with the key % |hvlines|) will be used when drawing the rules (in fact, there is also the % |\multicolumn| and the |\diagbox| in that sequence). % \begin{macrocode} - \seq_gput_left:Nx \g_@@_pos_of_blocks_seq - { { #1 } { #2 } { #3 } { #4 } { \l_@@_block_name_str } } + \seq_gput_left:Nx \g_@@_pos_of_blocks_seq + { { #1 } { #2 } { #3 } { #4 } { \l_@@_block_name_str } } + } } % \end{macrocode} % % \bigskip % \begin{macrocode} - \bool_lazy_and:nnT - { ! (\tl_if_empty_p:N \l_@@_draw_tl) } - { \l_@@_hlines_block_bool || \l_@@_vlines_block_bool } - { \@@_error:n { hlines~with~color } } + \tl_if_empty:NF \l_@@_draw_tl + { + \bool_lazy_or:nnT \l_@@_hlines_block_bool \l_@@_vlines_block_bool + { \@@_error:n { hlines~with~color } } + } % \end{macrocode} % \bigskip % \begin{macrocode} @@ -13558,7 +13724,7 @@ version 2005/12/01 or later. \tl_set:Nx \l_@@_fill_tl { [ opacity = \l_@@_opacity_tl , - \tl_tail:V \l_@@_fill_tl + \tl_tail:o \l_@@_fill_tl } } { @@ -13569,7 +13735,7 @@ version 2005/12/01 or later. \tl_gput_right:Nx \g_@@_pre_code_before_tl { \exp_not:N \roundedrectanglecolor - \exp_args:NV \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [ + \exp_args:No \tl_if_head_eq_meaning:nNTF \l_@@_fill_tl [ { \l_@@_fill_tl } { { \l_@@_fill_tl } } { #1 - #2 } @@ -13796,9 +13962,9 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_lazy_any:nTF { - { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { c } } - { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { T } } - { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { B } } + { \str_if_eq_p:on \l_@@_vpos_block_str { c } } + { \str_if_eq_p:on \l_@@_vpos_block_str { T } } + { \str_if_eq_p:on \l_@@_vpos_block_str { B } } } % \end{macrocode} % \medskip @@ -13807,24 +13973,24 @@ version 2005/12/01 or later. % \end{macrocode} % If we are in the first column, we must put the block as if it was with the key~|r|. % \begin{macrocode} - \int_if_zero:nT { #2 } { \str_set:Nn \l_@@_hpos_block_str r } + \int_if_zero:nT { #2 } { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_r_str } % \end{macrocode} % If we are in the last column, we must put the block as if it was with the key~|l|. % \begin{macrocode} \bool_if:nT \g_@@_last_col_found_bool { \int_compare:nNnT { #2 } = \g_@@_col_total_int - { \str_set:Nn \l_@@_hpos_block_str l } + { \str_set_eq:NN \l_@@_hpos_block_str \c_@@_l_str } } % \end{macrocode} % |\l_tmpa_tl| will contain the anchor of the \textsc{pgf} node which will be used. % \begin{macrocode} \tl_set:Nx \l_tmpa_tl { - \str_case:Vn \l_@@_vpos_of_block_str + \str_case:on \l_@@_vpos_block_str { c { - \str_case:Vn \l_@@_hpos_block_str + \str_case:on \l_@@_hpos_block_str { c { center } l { west } @@ -13833,7 +13999,7 @@ version 2005/12/01 or later. } T { - \str_case:Vn \l_@@_hpos_block_str + \str_case:on \l_@@_hpos_block_str { c { north } l { north~west } @@ -13842,7 +14008,7 @@ version 2005/12/01 or later. } B { - \str_case:Vn \l_@@_hpos_block_str + \str_case:on \l_@@_hpos_block_str { c { south} l { south~west } @@ -13866,7 +14032,7 @@ version 2005/12/01 or later. \pgfset { inner~xsep = \c_zero_dim , - inner~ysep = \l_@@_block_ysep_dim + inner~ysep = \c_zero_dim } \pgfnode { rectangle } @@ -13874,7 +14040,7 @@ version 2005/12/01 or later. { \box_use_drop:N \l_@@_cell_box } { } { } } % \end{macrocode} -% End of the case when |\l_@@_vpos_of_block_str| is equal to |c|, |T| or |B|. +% End of the case when |\l_@@_vpos_block_str| is equal to |c|, |T| or |B|. % Now, the other cases. % \begin{macrocode} { @@ -13885,7 +14051,7 @@ version 2005/12/01 or later. { \@@_qpoint:n { - row - \str_if_eq:VnTF \l_@@_vpos_of_block_str { b } { #3 } { #1 } + row - \str_if_eq:onTF \l_@@_vpos_block_str { b } { #3 } { #1 } - base } } @@ -13899,7 +14065,7 @@ version 2005/12/01 or later. \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } } { - \str_case:Vn \l_@@_hpos_block_str + \str_case:on \l_@@_hpos_block_str { c { center } l { west } @@ -13914,7 +14080,7 @@ version 2005/12/01 or later. \pgfnode { rectangle } { - \str_case:Vn \l_@@_hpos_block_str + \str_case:on \l_@@_hpos_block_str { c { base } l { base~west } @@ -13953,9 +14119,9 @@ version 2005/12/01 or later. % If the user has used the key |color| of the command |\Block| without value, % the color fixed by |\arrayrulecolor| is used. % \begin{macrocode} - \str_if_eq:VnTF \l_@@_draw_tl { default } + \tl_if_eq:NNTF \l_@@_draw_tl \c_@@_default_tl { \CT@arc@ } - { \@@_color:V \l_@@_draw_tl } + { \@@_color:o \l_@@_draw_tl } } \pgfsetcornersarced { @@ -13964,30 +14130,31 @@ version 2005/12/01 or later. { \l_@@_rounded_corners_dim } } \@@_cut_on_hyphen:w #2 \q_stop - \bool_lazy_and:nnT - { \int_compare_p:n { \l_tmpa_tl <= \c@iRow } } - { \int_compare_p:n { \l_tmpb_tl <= \c@jCol } } - { - \@@_qpoint:n { row - \l_tmpa_tl } - \dim_set_eq:NN \l_tmpb_dim \pgf@y - \@@_qpoint:n { col - \l_tmpb_tl } - \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x - \@@_cut_on_hyphen:w #3 \q_stop - \int_compare:nNnT \l_tmpa_tl > \c@iRow - { \tl_set:Nx \l_tmpa_tl { \int_use:N \c@iRow } } - \int_compare:nNnT \l_tmpb_tl > \c@jCol - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \@@_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } } - \dim_set_eq:NN \l_tmpa_dim \pgf@y - \@@_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } } - \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x - \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } - \pgfpathrectanglecorners - { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } - { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim } - \dim_compare:nNnTF \l_@@_rounded_corners_dim = \c_zero_dim - { \pgfusepathqstroke } - { \pgfusepath { stroke } } + \int_compare:nNnF \l_tmpa_tl > \c@iRow + { + \int_compare:nNnF \l_tmpb_tl > \c@jCol + { + \@@_qpoint:n { row - \l_tmpa_tl } + \dim_set_eq:NN \l_tmpb_dim \pgf@y + \@@_qpoint:n { col - \l_tmpb_tl } + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x + \@@_cut_on_hyphen:w #3 \q_stop + \int_compare:nNnT \l_tmpa_tl > \c@iRow + { \tl_set:No \l_tmpa_tl { \int_use:N \c@iRow } } + \int_compare:nNnT \l_tmpb_tl > \c@jCol + { \tl_set:No \l_tmpb_tl { \int_use:N \c@jCol } } + \@@_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } } + \dim_set_eq:NN \l_tmpa_dim \pgf@y + \@@_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } } + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x + \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } + \pgfpathrectanglecorners + { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } + { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim } + \dim_compare:nNnTF \l_@@_rounded_corners_dim = \c_zero_dim + { \pgfusepathqstroke } + { \pgfusepath { stroke } } + } } \endpgfpicture \group_end: @@ -14311,17 +14478,11 @@ version 2005/12/01 or later. % \begin{macrocode} \group_begin: \keys_set_known:nnN { NiceMatrix / Auto } { #6 } \l_tmpa_tl -% \end{macrocode} -% We nullify the command |\@@_transform_preamble_i:| because we will provide a -% preamble which is yet transformed (by using |\l_@@_columns_type_tl| which is -% yet nicematrix-ready). -% \begin{macrocode} - % \bool_set_false:N \l_@@_preamble_bool \use:e { \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 } - { * { #4 } { \exp_not:V \l_@@_columns_type_tl } } - [ \exp_not:V \l_tmpa_tl ] + { * { #4 } { \exp_not:o \l_@@_columns_type_tl } } + [ \exp_not:o \l_tmpa_tl ] } \int_if_zero:nT \l_@@_first_row_int { @@ -14406,7 +14567,7 @@ version 2005/12/01 or later. % array, and it will extend, since it is no longer in |\l_@@_cell_box|. % \begin{macrocode} \cs_new_protected:Npn \@@_dotfill_i: - { \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim \@@_old_dotfill } + { \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } = \c_zero_dim \@@_old_dotfill } % \end{macrocode} % % \bigskip @@ -14497,7 +14658,7 @@ version 2005/12/01 or later. \pgfnode { rectangle } { south~west } { \begin { minipage } { 20 cm } - \@@_math_toggle_token: #5 \@@_math_toggle_token: + \@@_math_toggle: #5 \@@_math_toggle: \end { minipage } } { } @@ -14508,7 +14669,7 @@ version 2005/12/01 or later. { \begin { minipage } { 20 cm } \raggedleft - \@@_math_toggle_token: #6 \@@_math_toggle_token: + \@@_math_toggle: #6 \@@_math_toggle: \end { minipage } } { } @@ -14662,7 +14823,7 @@ version 2005/12/01 or later. % \begin{macrocode} \nullfont \c_math_toggle_token - \@@_color:V \l_@@_delimiters_color_tl + \@@_color:o \l_@@_delimiters_color_tl \bool_if:nTF { #3 } { \left #1 } { \left . } \vcenter { @@ -14820,9 +14981,9 @@ version 2005/12/01 or later. % \begin{macrocode} \hook_gput_code:nnn { begindocument } { . } { - \tl_set:Nn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } } + \cs_set_nopar:Npn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl - \exp_args:NNV \NewDocumentCommand \@@_SubMatrix \l_@@_argspec_tl + \exp_args:NNo \NewDocumentCommand \@@_SubMatrix \l_@@_argspec_tl { \peek_remove_spaces:n { @@ -14846,10 +15007,10 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_compute_i_j:nnnn #1 #2 #3 #4 { - \tl_set:Nn \l_@@_first_i_tl { #1 } - \tl_set:Nn \l_@@_first_j_tl { #2 } - \tl_set:Nn \l_@@_last_i_tl { #3 } - \tl_set:Nn \l_@@_last_j_tl { #4 } + \cs_set_nopar:Npn \l_@@_first_i_tl { #1 } + \cs_set_nopar:Npn \l_@@_first_j_tl { #2 } + \cs_set_nopar:Npn \l_@@_last_i_tl { #3 } + \cs_set_nopar:Npn \l_@@_last_j_tl { #4 } \tl_if_eq:NnT \l_@@_first_i_tl { last } { \tl_set:NV \l_@@_first_i_tl \c@iRow } \tl_if_eq:NnT \l_@@_first_j_tl { last } @@ -14869,9 +15030,8 @@ version 2005/12/01 or later. % The four following token lists correspond to the position of the |\SubMatrix|. % \begin{macrocode} \@@_compute_i_j:nn { #2 } { #3 } - % added 6.19b \int_compare:nNnT \l_@@_first_i_tl = \l_@@_last_i_tl - { \cs_set:Npn \arraystretch { 1 } } + { \cs_set_nopar:Npn \arraystretch { 1 } } \bool_lazy_or:nnTF { \int_compare_p:nNn \l_@@_last_i_tl > \g_@@_row_total_int } { \int_compare_p:nNn \l_@@_last_j_tl > \g_@@_col_total_int } @@ -14969,7 +15129,7 @@ version 2005/12/01 or later. % \begin{macrocode} \group_begin: \pgfsetlinewidth { 1.1 \arrayrulewidth } - \@@_set_CT@arc@:V \l_@@_rules_color_tl + \@@_set_CT@arc@:o \l_@@_rules_color_tl \CT@arc@ % \end{macrocode} % Now, we draw the potential vertical rules specified in the preamble of the @@ -15000,12 +15160,12 @@ version 2005/12/01 or later. % The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given % by curryfication. % \begin{macrocode} - \tl_if_eq:NnTF \l_@@_submatrix_vlines_clist { all } + \tl_if_eq:NNTF \l_@@_submatrix_vlines_clist \c_@@_all_tl { \int_step_inline:nn { \l_@@_last_j_tl - \l_@@_first_j_tl } } { \clist_map_inline:Nn \l_@@_submatrix_vlines_clist } { \bool_lazy_and:nnTF - { \int_compare_p:nNn { ##1 } > 0 } + { \int_compare_p:nNn { ##1 } > \c_zero_int } { \int_compare_p:nNn { ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } } @@ -15025,12 +15185,12 @@ version 2005/12/01 or later. % The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given % by curryfication. % \begin{macrocode} - \tl_if_eq:NnTF \l_@@_submatrix_hlines_clist { all } + \tl_if_eq:NNTF \l_@@_submatrix_hlines_clist \c_@@_all_tl { \int_step_inline:nn { \l_@@_last_i_tl - \l_@@_first_i_tl } } { \clist_map_inline:Nn \l_@@_submatrix_hlines_clist } { \bool_lazy_and:nnTF - { \int_compare_p:nNn { ##1 } > 0 } + { \int_compare_p:nNn { ##1 } > \c_zero_int } { \int_compare_p:nNn { ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } } @@ -15243,7 +15403,7 @@ version 2005/12/01 or later. { \nullfont \c_math_toggle_token - \@@_color:V \l_@@_delimiters_color_tl + \@@_color:o \l_@@_delimiters_color_tl \left #1 \vcenter { @@ -15274,7 +15434,7 @@ version 2005/12/01 or later. { \nullfont \c_math_toggle_token - \@@_color:V \l_@@_delimiters_color_tl + \@@_color:o \l_@@_delimiters_color_tl \left . \vcenter { @@ -15433,14 +15593,14 @@ version 2005/12/01 or later. { rectangle } { south } { - \vbox_top:n + \vtop { \group_begin: \everycr { } \halign { \hfil ## \hfil \crcr - \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr + \@@_math_toggle: #1 \@@_math_toggle: \cr \noalign { \skip_vertical:n { 3 pt } \nointerlineskip } \c_math_toggle_token \overbrace @@ -15479,7 +15639,7 @@ version 2005/12/01 or later. { \group_begin: \everycr { } - \vbox:n + \vbox { \halign { @@ -15494,7 +15654,7 @@ version 2005/12/01 or later. \c_math_toggle_token \cr \noalign { \skip_vertical:n { 3 pt } \nointerlineskip } - \@@_math_toggle_token: #1 \@@_math_toggle_token: \cr + \@@_math_toggle: #1 \@@_math_toggle: \cr } } \group_end: @@ -15958,13 +16118,13 @@ version 2005/12/01 or later. % \bigskip % If the user uses too much columns, the command |\@@_error_too_much_cols:| is % triggered. This command raises an error but also tries to give the best -% information to the user in the error message. The command |\seq_if_in:NVTF| is +% information to the user in the error message. The command |\seq_if_in:NoTF| is % not expandable and that's why we can't put it in the error message itself. We % have to do the test before the |\@@_fatal:n|. % \begin{macrocode} \cs_new_protected:Npn \@@_error_too_much_cols: { - \seq_if_in:NVTF \g_@@_types_of_matrix_seq \g_@@_name_env_str + \seq_if_in:NoTF \g_@@_types_of_matrix_seq \g_@@_name_env_str { \int_compare:nNnTF \l_@@_last_col_int = { -2 } { \@@_fatal:n { too~much~cols~for~matrix } } @@ -15986,7 +16146,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new:Npn \@@_message_hdotsfor: { - \tl_if_empty:VF \g_@@_HVdotsfor_lines_tl + \tl_if_empty:oF \g_@@_HVdotsfor_lines_tl { ~Maybe~your~use~of~\token_to_str:N \Hdotsfor\ is~incorrect.} } % \end{macrocode} |