diff options
Diffstat (limited to 'macros/latex/contrib/nicematrix/nicematrix-code.dtx')
-rw-r--r-- | macros/latex/contrib/nicematrix/nicematrix-code.dtx | 90 |
1 files changed, 52 insertions, 38 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix-code.dtx b/macros/latex/contrib/nicematrix/nicematrix-code.dtx index cfb0eb00d0..dea9c0ecd7 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-code.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix-code.dtx @@ -2,7 +2,7 @@ % % This file should be compiled with $xelatex$. % -% Copyright (C) 2018-2023 by F. Pantigny +% Copyright (C) 2018-2024 by F. Pantigny % ------------------------------------------ % % This file may be distributed and/or modified under the @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.26b} -\def\myfiledate{2023/12/13} +\def\myfileversion{6.26c} +\def\myfiledate{2024/01/02} % % %<*batchfile> @@ -29,7 +29,7 @@ \preamble -Copyright (C) 2018-2023 by F. Pantigny +Copyright (C) 2018-2024 by F. Pantigny ----------------------------------- This file may be distributed and/or modified under the @@ -121,7 +121,7 @@ version 2005/12/01 or later. % \pkg{nicematrix} relies upon the fact that the package |{array}| uses % |\ialign| to begin the |\halign|. % -% +% % \bigskip % \section{Declaration of the package and packages loaded} % @@ -1821,15 +1821,15 @@ version 2005/12/01 or later. % argument of |\tabularnote|.} % \item During the composition of the main tabular, the tabular notes will be % numbered from |\g_@@_notes_caption_int|+1 and the notes will be stored in -% |\g_@@_notes_seq|. Each composant of |\g_@@_notes_seq| will be a kind of +% |\g_@@_notes_seq|. Each component of |\g_@@_notes_seq| will be a kind of % couple of the form : \texttt{\{\textsl{label}\}\{\textsl{text of the -% tabularnote}\}}. The first composante is the optional argument (between square +% tabularnote}\}}. The first component is the optional argument (between square % brackets) of the command |\tabularnote| (if the optional argument is not used, % the value will be the special marker |\c_novalue_tl|). % \item During the composition of the caption (value of |\l_@@_caption_tl|), the % tabular notes will be numbered from $1$ to |\g_@@_notes_caption_int| and the % notes themselves will be stored in |\g_@@_notes_in_caption_seq|. The structure -% of the composantes of that sequence will be the same as for |\g_@@_notes_seq|. +% of the components of that sequence will be the same as for |\g_@@_notes_seq|. % \item After the composition of the main tabular and after the composition of % the caption, the sequences |\g_@@_notes_in_caption_seq| and |\g_@@_notes_seq| % will be merged (in that order) and the notes will be composed. @@ -1973,6 +1973,11 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \begin{macrocode} +\cs_new_protected:Npn \@@_test_first_novalue:nnn #1 #2 #3 + { \tl_if_novalue:nT { #1 } { #3 } } +% \end{macrocode} +% % \bigskip % For the version in normal conditions, that is to say not in the |caption|. % |#1| is the optional argument of |\tabularnote| (maybe equal to the special @@ -1998,12 +2003,20 @@ version 2005/12/01 or later. % \end{center} % If the user have used |\tabularnote| without the optional argument, the % \texttt{\textsl{label}} will be the special marker |\c_novalue_tl|. +% +% When we will go through the sequence |\g_@@_notes_seq|, we will count in +% |\l_tmpb_int| the notes without explicit label in order to have the +% ``current'' value of the counter |\c@tabularnote|. % \begin{macrocode} + \int_zero:N \l_tmpb_int \seq_map_indexed_inline:Nn \g_@@_notes_seq { + \@@_test_first_novalue:nnn ##2 { \int_incr:N \l_tmpb_int } \tl_if_eq:nnT { { #1 } { #2 } } { ##2 } - { - \int_set:Nn \l_tmpa_int { ##1 } + { + \tl_if_novalue:nTF { #1 } + { \int_set_eq:NN \l_tmpa_int \l_tmpb_int } + { \int_set:Nn \l_tmpa_int { ##1 } } \seq_map_break: } } @@ -4536,7 +4549,7 @@ version 2005/12/01 or later. % Now, we prepare the token list for the instructions that we will have to write % on the |aux| file at the end of the environment. % \begin{macrocode} - \tl_build_gbegin:N \g_@@_aux_tl + \tl_gclear:N \g_@@_aux_tl % \end{macrocode} % % \begin{macrocode} @@ -4609,7 +4622,7 @@ version 2005/12/01 or later. % \begin{macrocode} \int_compare:nNnT \g_@@_total_X_weight_int > \c_zero_int { - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \bool_set_true:N \l_@@_X_columns_aux_bool \dim_set:Nn \l_@@_X_columns_dim @@ -4804,7 +4817,6 @@ version 2005/12/01 or later. % We write on the |aux| file all the informations corresponding to the % current environment. % \begin{macrocode} - \tl_build_gend:N \g_@@_aux_tl \iow_now:Nn \@mainaux { \ExplSyntaxOn } \iow_now:Nn \@mainaux { \char_set_catcode_space:n { 32 } } \iow_now:Nx \@mainaux @@ -6410,7 +6422,7 @@ version 2005/12/01 or later. % \begin{macrocode} \int_compare:nNnT \g_@@_notes_caption_int > \c_zero_int { - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \tl_set:Nn \exp_not:N \l_@@_note_in_caption_tl { \int_use:N \g_@@_notes_caption_int } @@ -7637,7 +7649,7 @@ version 2005/12/01 or later. % % \medskip % \begin{macrocode} - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \seq_gset_from_clist:Nn \exp_not:N \g_@@_size_seq { @@ -7656,7 +7668,7 @@ version 2005/12/01 or later. % \begin{macrocode} \seq_if_empty:NF \g_@@_pos_of_blocks_seq { - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \seq_gset_from_clist:Nn \exp_not:N \g_@@_pos_of_blocks_seq { \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , } @@ -7664,7 +7676,7 @@ version 2005/12/01 or later. } \seq_if_empty:NF \g_@@_multicolumn_cells_seq { - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_cells_seq { \seq_use:Nnnn \g_@@_multicolumn_cells_seq , , , } @@ -7872,7 +7884,7 @@ version 2005/12/01 or later. \seq_if_empty:NF \g_@@_rowlistcolors_seq { \@@_clear_rowlistcolors_seq: } \tl_if_empty:NF \g_@@_pre_code_before_tl { - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \tl_gset:Nn \exp_not:N \g_@@_pre_code_before_tl { \exp_not:o \g_@@_pre_code_before_tl } @@ -7881,7 +7893,7 @@ version 2005/12/01 or later. } \tl_if_empty:NF \g_nicematrix_code_before_tl { - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \tl_gset:Nn \exp_not:N \g_@@_code_before_tl { \exp_not:o \g_nicematrix_code_before_tl } @@ -10060,10 +10072,8 @@ version 2005/12/01 or later. \keys_define:nn { NiceMatrix / RowStyle } { cell-space-top-limit .dim_set:N = \l_tmpa_dim , - cell-space-top-limit .initial:n = \c_zero_dim , cell-space-top-limit .value_required:n = true , cell-space-bottom-limit .dim_set:N = \l_tmpb_dim , - cell-space-bottom-limit .initial:n = \c_zero_dim , cell-space-bottom-limit .value_required:n = true , cell-space-limits .meta:n = { @@ -10095,6 +10105,8 @@ version 2005/12/01 or later. \tl_clear:N \l_tmpa_tl % value of \rowcolor \tl_clear:N \l_@@_color_tl \int_set_eq:NN \l_@@_key_nb_rows_int \c_one_int + \dim_zero:N \l_tmpa_dim + \dim_zero:N \l_tmpb_dim \keys_set:nn { NiceMatrix / RowStyle } { #1 } % \end{macrocode} % If the key |rowcolor| has been used. @@ -10135,15 +10147,16 @@ version 2005/12/01 or later. % \begin{macrocode} \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim { - \@@_put_in_row_style:n + \exp_args:Nx \@@_put_in_row_style:n { - \exp_not:n - { - \tl_gput_right:Nn \g_@@_cell_after_hook_tl - { - \dim_set:Nn \l_@@_cell_space_top_limit_dim - { \dim_use:N \l_tmpa_dim } - } + \tl_gput_right:Nn \exp_not:N \g_@@_cell_after_hook_tl + { +% \end{macrocode} +% It's not possible to chanage the following code by using |\dim_set_eq:NN| +% (because of expansion). +% \begin{macrocode} + \dim_set:Nn \l_@@_cell_space_top_limit_dim + { \dim_use:N \l_tmpa_dim } } } } @@ -10152,15 +10165,12 @@ version 2005/12/01 or later. % \begin{macrocode} \dim_compare:nNnT \l_tmpb_dim > \c_zero_dim { - \@@_put_in_row_style:n + \exp_args:Nx \@@_put_in_row_style:n { - \exp_not:n - { - \tl_gput_right:Nn \g_@@_cell_after_hook_tl - { - \dim_set:Nn \l_@@_cell_space_bottom_limit_dim - { \dim_use:N \l_tmpb_dim } - } + \tl_gput_right:Nn \exp_not:N \g_@@_cell_after_hook_tl + { + \dim_set:Nn \l_@@_cell_space_bottom_limit_dim + { \dim_use:N \l_tmpb_dim } } } } @@ -12345,7 +12355,7 @@ version 2005/12/01 or later. % commands which color the |rows|, |columns| and |cells| must not color the % cells in the corners. % \begin{macrocode} - \tl_build_gput_right:Nx \g_@@_aux_tl + \tl_gput_right:Nx \g_@@_aux_tl { \seq_set_from_clist:Nn \exp_not:N \l_@@_corners_cells_seq { \seq_use:Nnnn \l_@@_corners_cells_seq , , , } @@ -17156,6 +17166,7 @@ version 2005/12/01 or later. left-margin,~ light-syntax,~ matrix/columns-type,~ + no-cell-nodes,~ notes~(several~subkeys),~ nullify-dots,~ pgf-node-code,~ @@ -17214,6 +17225,7 @@ version 2005/12/01 or later. left-margin,~ light-syntax,~ name,~ + no-cell-nodes,~ nullify-dots,~ pgf-node-code,~ renew-dots,~ @@ -17278,6 +17290,7 @@ version 2005/12/01 or later. left-margin,~ light-syntax,~ name,~ + no-cell-nodes,~ nullify-dots,~ pgf-node-code,~ r,~ @@ -17340,6 +17353,7 @@ version 2005/12/01 or later. left-margin,~ light-syntax,~ name,~ + no-cell-nodes,~ notes~(several~subkeys),~ nullify-dots,~ pgf-node-code,~ |