diff options
author | Karl Berry <karl@freefriends.org> | 2022-03-12 20:34:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-03-12 20:34:14 +0000 |
commit | 3b77cea124ec726fae82ebc0edaffbc909bae368 (patch) | |
tree | 48ef5e086523637c4e1b43a28062f62b73e60bb6 /Master/texmf-dist | |
parent | 2d2e317a75f264a366ebaaa1beebecd78c44e89b (diff) |
nicematrix (12mar22) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62659 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf | bin | 501207 -> 501742 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex | 17 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf | bin | 1502769 -> 1511486 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 352 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 237 |
5 files changed, 392 insertions, 214 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf Binary files differindex 2c086429fa1..bfccc07f4e4 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex index e4f2286cf9d..4e76c71235d 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex @@ -1244,7 +1244,7 @@ qui sera créée par \pkg{nicematrix} et que l'utilisateur pourra utiliser pour tracer des filets horizontaux (de manière similaire à |\hline|) ; \item la clé |letter| prend en argument une lettre\footnote{Les lettres - suivantes ne sont pas autorisées : \verb+lcrpmbVX:|()[]!@<>+} qui pourra être + suivantes ne sont pas autorisées : \verb+lcrpmbVX|()[]!@<>+} qui pourra être utilisée par l'utilisateur dans le préambule d'un environnement à préambule (comme |{NiceTabular}|) pour spécifier un filet vertical. \end{itemize} @@ -3323,9 +3323,9 @@ l'extension \pkg{xcolor} et elle n'est pas parfaitement compatible avec L'extension \pkg{nicematrix} propose aussi une commande |\tabularnote| qui permet de spécifier des notes qui seront composées à la fin du tableau avec une longueur de ligne égale à la largeur du tableau (hors éventuelles colonnes -extérieures). Sans surprise, cette commande n'est disponible que dans les -environnements sans délimiteurs, c'est-à-dire |{NiceTabular}|, |{NiceArray}| et -|{NiceMatrix}|. +extérieures spécifiées par |first-col| et |last-col|). Sans surprise, cette +commande n'est disponible que dans les environnements sans délimiteurs, +c'est-à-dire |{NiceTabular}|, |{NiceArray}| et |{NiceMatrix}|. En fait, cette commande n'est disponible que si l'extension \pkg{enumitem} a été chargée (avant ou après \pkg{nicematrix}). Les notes sont en effet composées en @@ -3467,6 +3467,7 @@ disponibles dans |\NiceMatrixOptions|. Ces clés ont un nom préfixé par |notes \item |notes/enumitem-keys| \item |notes/enumitem-keys-para| \item |notes/code-before| +\item |notes/detect-duplicates| \end{itemize} Pour la commmodité, il est aussi possible de fixer ces clés dans |\NiceMatrixOptions| via une clé |notes| qui prend en argument une liste de @@ -3601,6 +3602,14 @@ Si on souhaite, par exemple, que les notes soient composées en gris et en \end{Verbatim} On peut aussi mettre dans cette clé |\raggedright| ou |\RaggedRight| (cette dernière est une commande de \pkg{ragged2e}). + +\item \colorbox{yellow!50}{\textbf{Nouveau 6.8}}\enskip À partir de la version +6.8, les doublons dans les notes de tableau sont détectés par défaut: lorsque +plusieurs commandes |\tabularnote| sont utilisées avec le même argument, une +seule note est insérée en fin de tableau (mais tous les labels sont marqués). Il +est possible de désactiver cette fonctionnalité avec la clé +|notes/detect-duplicates| (sa valeur initiale est |true|). + \end{itemize} diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf Binary files differindex 2bac20ae75b..3629b4506a5 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index a1196bba162..74e7b7c98f3 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{6.7} -\def\myfiledate{2022/03/02} +\def\myfileversion{6.8} +\def\myfiledate{2022/03/11} % % %<*batchfile> @@ -1225,10 +1225,6 @@ version 2005/12/01 or later. % 11 & 12 & 13 & 14 & 15 % \end{NiceArray}\right)$ % -% \bigskip -% It's possible to change in \pkg{nicematrix} the letter used to specify a -% vertical dotted line with the option |letter-for-dotted-lines| available in -% |\NiceMatrixOptions|. % % \bigskip % \emph{Remark}: In the package \pkg{array} (on which the package @@ -1254,7 +1250,7 @@ version 2005/12/01 or later. % user in order to draw horizontal rules (similarly to |\hline|); % % \item the key |letter| takes in as argument a letter\footnote{The following -% letters are forbidden: \verb+lcrpmbVX:|()[]!@<>+} that the user will use in +% letters are forbidden: \verb+lcrpmbVX|()[]!@<>+} that the user will use in % the preamble of an environment with preamble (such as |{NiceTabular}| in order % to specify a vertical rule. % \end{itemize} @@ -3279,12 +3275,12 @@ version 2005/12/01 or later. % % \subsection{The notes of tabular} % -% The package \pkg{nicematrix} also provides a command |\tabularnote| which gives -% the ability to specify notes that will be composed at the end of the array -% with a width of line equal to the width of the array (excepted the potential -% exterior columns). With no surprise, that command is available only in the -% environments without delimiters, that is to say |{NiceTabular}|, |{NiceArray}| -% and |{NiceMatrix}|. +% The package \pkg{nicematrix} also provides a command |\tabularnote| which +% gives the ability to specify notes that will be composed at the end of the +% array with a width of line equal to the width of the array (excepted the +% potential exterior columns specified by |first-col| and |last-col|). With no +% surprise, that command is available only in the environments without +% delimiters, that is to say |{NiceTabular}|, |{NiceArray}| and |{NiceMatrix}|. % % In fact, this command is available only if the extension \pkg{enumitem} has % been loaded (before or after \pkg{nicematrix}). Indeed, the notes are composed @@ -3552,6 +3548,13 @@ version 2005/12/01 or later. % \end{Verbatim} % It's also possible to add |\raggedright| or |\RaggedRight| in that key (|\RaggedRight| % is a command of \pkg{ragged2e}). +% +% \item \colorbox{yellow!50}{\textbf{New 6.8}}\enskip Since the version 6.8, the +% duplicates in the notes of a tabular are detected by default: if several +% commands |\tabularnote| are used in a tabular with the same argument, only one +% note is inserted at the end of the tabular (but all the labels are composed, +% of course). It's possible to de-activate that feature with the key +% |notes/detect-duplicates| (whose initial value is |true|). % \end{itemize} % % @@ -5691,6 +5694,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_error:n { \msg_error:nn { nicematrix } } \cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { nicematrix } } +\cs_generate_variant:Nn \@@_error:nn { n x } \cs_new_protected:Npn \@@_error:nnn { \msg_error:nnnn { nicematrix } } \cs_new_protected:Npn \@@_fatal:n { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \@@_fatal:nn { \msg_fatal:nnn { nicematrix } } @@ -5707,30 +5711,34 @@ version 2005/12/01 or later. % \bigskip % \subsection*{Technical definitions} % +% \begin{macrocode} +\tl_new:N \l_@@_argspec_tl +% \end{macrocode} +% +% \begin{macrocode} +\cs_generate_variant:Nn \seq_gset_split:Nnn { N V n } +\cs_generate_variant:Nn \keys_define:nn { n x } +% \end{macrocode} +% % \medskip % \begin{macrocode} -\bool_new:N \c_@@_arydshln_loaded_bool -\bool_new:N \c_@@_booktabs_loaded_bool -\bool_new:N \c_@@_enumitem_loaded_bool -\bool_new:N \c_@@_tabularx_loaded_bool -\bool_new:N \c_@@_tikz_loaded_bool -\bool_new:N \c_@@_varwidth_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { varwidth } - { \bool_set_true:N \c_@@_varwidth_loaded_bool } - { } + { \bool_const:Nn \c_@@_varwidth_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c_@@_varwidth_loaded_bool { \c_false_bool } } \@ifpackageloaded { arydshln } - { \bool_set_true:N \c_@@_arydshln_loaded_bool } - { } + { \bool_const:Nn \c_@@_arydshln_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c_@@_arydshln_loaded_bool { \c_false_bool } } \@ifpackageloaded { booktabs } - { \bool_set_true:N \c_@@_booktabs_loaded_bool } - { } + { \bool_const:Nn \c_@@_booktabs_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c_@@_booktabs_loaded_bool { \c_false_bool } } \@ifpackageloaded { enumitem } - { \bool_set_true:N \c_@@_enumitem_loaded_bool } - { } + { \bool_const:Nn \c_@@_enumitem_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c_@@_enumitem_loaded_bool { \c_false_bool } } \@ifpackageloaded { tabularx } - { \bool_set_true:N \c_@@_tabularx_loaded_bool } + { \bool_const:Nn \c_@@_tabularx_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c_@@_tabularx_loaded_bool { \c_false_bool } } { } \@ifpackageloaded { tikz } { @@ -5748,11 +5756,12 @@ version 2005/12/01 or later. % |\AtBeginDocument| the correct version of some commands. The tokens % |\exp_not:N| are mandatory. % \begin{macrocode} - \bool_set_true:N \c_@@_tikz_loaded_bool + \bool_const:Nn \c_@@_tikz_loaded_bool \c_true_bool \tl_const:Nn \c_@@_pgfortikzpicture_tl { \exp_not:N \tikzpicture } \tl_const:Nn \c_@@_endpgfortikzpicture_tl { \exp_not:N \endtikzpicture } } { + \bool_const:Nn \c_@@_tikz_loaded_bool \c_false_bool \tl_const:Nn \c_@@_pgfortikzpicture_tl { \exp_not:N \pgfpicture } \tl_const:Nn \c_@@_endpgfortikzpicture_tl { \exp_not:N \endpgfpicture } } @@ -5761,22 +5770,25 @@ version 2005/12/01 or later. % % We test whether the current class is \cls{revtex4-1} (deprecated) or % \cls{revtex4-2} because these classes redefines |\array| (of \pkg{array}) in a -% way incompatible with our programmation. At the date January 2021, the current +% way incompatible with our programmation. At the date January 2022, the current % version \cls{revtex4-2} is 4.2e (compatible with \pkg{booktabs}). % % \begin{macrocode} -\bool_new:N \c_@@_revtex_bool \@ifclassloaded { revtex4-1 } - { \bool_set_true:N \c_@@_revtex_bool } - { } -\@ifclassloaded { revtex4-2 } - { \bool_set_true:N \c_@@_revtex_bool } - { } + { \bool_const:Nn \c_@@_revtex_bool \c_true_bool } + { + \@ifclassloaded { revtex4-2 } + { \bool_const:Nn \c_@@_revtex_bool \c_true_bool } + { % \end{macrocode} % Maybe one of the previous classes will be loaded inside another class... We % try to detect that situation. % \begin{macrocode} -\cs_if_exist:NT \rvtx@ifformat@geq { \bool_set_true:N \c_@@_revtex_bool } + \cs_if_exist:NT \rvtx@ifformat@geq + { \bool_const:Nn \c_@@_revtex_bool \c_true_bool } + { \bool_const:Nn \c_@@_revtex_bool \c_false_bool } + } + } % \end{macrocode} % % \bigskip @@ -5871,11 +5883,11 @@ version 2005/12/01 or later. % We have to know whether \pkg{colortbl} is loaded in particular for the % redefinition of |\everycr|. % \begin{macrocode} -\bool_new:N \c_@@_colortbl_loaded_bool +\bool_new:N \l_@@_colortbl_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { colortbl } - { \bool_set_true:N \c_@@_colortbl_loaded_bool } + { \bool_set_true:N \l_@@_colortbl_loaded_bool } { % \end{macrocode} % The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of @@ -6037,11 +6049,11 @@ version 2005/12/01 or later. % We want to know whether the package \pkg{siunitx} is loaded and, if it is % loaded, we redefine the |S| columns of \pkg{siunitx}. % \begin{macrocode} -\bool_new:N \c_@@_siunitx_loaded_bool +\bool_new:N \l_@@_siunitx_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { siunitx } - { \bool_set_true:N \c_@@_siunitx_loaded_bool } + { \bool_set_true:N \l_@@_siunitx_loaded_bool } { } } % \end{macrocode} @@ -6054,7 +6066,7 @@ version 2005/12/01 or later. % \begin{macrocode} \hook_gput_code:nnn { begindocument } { . } { - \bool_if:nTF { ! \c_@@_siunitx_loaded_bool } + \bool_if:nTF { ! \l_@@_siunitx_loaded_bool } { \cs_set_eq:NN \@@_renew_NC@rewrite@S: \prg_do_nothing: } { \cs_new_protected:Npn \@@_renew_NC@rewrite@S: @@ -6209,6 +6221,13 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The following key corresponds to the key |notes/detect_duplicates|. +% \begin{macrocode} +\bool_new:N \l_@@_notes_detect_duplicates_bool +\bool_set_true:N \l_@@_notes_detect_duplicates_bool +% \end{macrocode} +% +% \bigskip % If the user uses |{NiceArray}| or |{NiceTabular}| the flag % |\l_@@_NiceArray_bool| will be raised. % \begin{macrocode} @@ -6277,7 +6296,7 @@ version 2005/12/01 or later. % |vlism| stands for \emph{vertical lines in sub-matrices}. % \begin{macrocode} \tl_new:N \l_@@_letter_vlism_tl -% \end{macrocode} +% \end{macrocode} % % The list of the columns where vertical lines in sub-matrices (vlism) must be % drawn. Of course, the actual value of this sequence will be known after the @@ -6305,7 +6324,8 @@ version 2005/12/01 or later. % \emph{environment} whether we are in a command of \pkg{nicematrix} or in an % environment of \pkg{nicematrix}. The default value is \emph{environment}. % \begin{macrocode} -\tl_set:Nn \g_@@_com_or_env_str { environment } +\tl_new:N \g_@@_com_or_env_str +\tl_gset:Nn \g_@@_com_or_env_str { environment } % \end{macrocode} % % \bigskip @@ -6356,11 +6376,18 @@ version 2005/12/01 or later. \int_new:N \l_@@_old_iRow_int \int_new:N \l_@@_old_jCol_int % \end{macrocode} -% % The TeX counters |\c@iRow| and |\c@jCol| will be created in the beginning of % |{NiceArrayWithDelims}| (if they don't exist previously). % % \bigskip +% The following sequence will contain the names (without backslash) of the +% commands created by |custom-line| (commands used by the final user in order to +% draw horizontal rules). +% \begin{macrocode} +\seq_new:N \l_@@_custom_line_commands_seq +% \end{macrocode} +% +% \bigskip % The following token list corresponds to the key |rules/color| available % in the environments. % \begin{macrocode} @@ -6833,13 +6860,18 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The following counter will be used to count the number of successive tabular -% notes such as in -% |\tabularnote{Note 1}\tabularnote{Note 2}\tabularnote{Note 3}|. -% In the tabular, the labels of those nodes are composed as a comma -% separated list (e.g. \textsuperscript{\textit{a},\textit{b},\textit{c}}). % \begin{macrocode} -\int_new:N \l_@@_number_of_notes_int +\seq_new:N \l_@@_notes_labels_seq +% \end{macrocode} +% +% \bigskip +% \begin{macrocode} +\newcounter{nicematrix_draft} +\cs_new_protected:Npn \@@_notes_format:n #1 + { + \setcounter { nicematrix_draft } { #1 } + \@@_notes_style:n { nicematrix_draft } + } % \end{macrocode} % % \bigskip @@ -6933,18 +6965,33 @@ version 2005/12/01 or later. { \@@_error:n { tabularnote~forbidden } } { % \end{macrocode} -% |\l_@@_number_of_notes_int| is used to count the number of successive tabular -% notes such as in -% |\tabularnote{Note 1}\tabularnote{Note 2}\tabularnote{Note 3}|. -% We will have to compose the labels of theses notes as a comma separated list -% (e.g. \textsuperscript{\emph{a},\emph{b},\emph{c}}). -% \begin{macrocode} - \int_incr:N \l_@@_number_of_notes_int -% \end{macrocode} -% We expand the content of the note at the point of use of -% |\tabularnote| as does |\footnote|. +% You have to see whether the argument of |\tabularnote| has yet been used as +% argument of another |\tabularnote| in the same tabular. In that case, there +% will be only one note (for both commands |\tabularnote|) at the end of the +% tabular. We search the argument of our command |\tabularnote| in the +% |\g_@@_tabularnotes_seq|. The position in the sequence will be stored in +% |\l_tmpa_int| (0 if the text is not in the sequence yet). % \begin{macrocode} - \seq_gput_right:Nn \g_@@_tabularnotes_seq { #1 } + \int_zero:N \l_tmpa_int + \bool_if:NT \l_@@_notes_detect_duplicates_bool + { + \seq_map_indexed_inline:Nn \g_@@_tabularnotes_seq + { + \tl_if_eq:nnT { #1 } { ##2 } + { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: } + } + } + \int_compare:nNnTF \l_tmpa_int = 0 + { + \stepcounter { tabularnote } + \seq_put_right:Nx \l_@@_notes_labels_seq + { \@@_notes_format:n { \int_use:c { c @ tabularnote } } } + \seq_gput_right:Nn \g_@@_tabularnotes_seq { #1 } + } + { + \seq_put_right:Nx \l_@@_notes_labels_seq + { \@@_notes_format:n { \int_use:N \l_tmpa_int } } + } \peek_meaning:NF \tabularnote { % \end{macrocode} @@ -6962,14 +7009,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_notes_label_in_tabular:n { - \stepcounter { tabularnote } - \@@_notes_style:n { tabularnote } - \prg_replicate:nn { \l_@@_number_of_notes_int - 1 } - { - , - \stepcounter { tabularnote } - \@@_notes_style:n { tabularnote } - } + \seq_use:Nnnn + \l_@@_notes_labels_seq { , } { , } { , } } } % \end{macrocode} @@ -6979,7 +7020,7 @@ version 2005/12/01 or later. % \begin{macrocode} \addtocounter { tabularnote } { -1 } \refstepcounter { tabularnote } - \int_zero:N \l_@@_number_of_notes_int + \seq_clear:N \l_@@_notes_labels_seq \hbox_overlap_right:n { \box_use:N \l_tmpa_box } % \end{macrocode} % If the command |\tabularnote| is used exactly at the end of the cell, the @@ -7564,6 +7605,8 @@ version 2005/12/01 or later. } } , enumitem-keys-para .value_required:n = true , + detect-duplicates .bool_set:N = \l_@@_notes_detect_duplicates_bool , + detect-duplicates .default:n = true , unknown .code:n = \@@_error:n { Unknown~key~for~notes } } % \end{macrocode} @@ -7684,14 +7727,16 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% By default, the specifier used in the preamble of the array (for example in -% |{pNiceArray}|) to draw a vertical dotted line between two columns is the -% colon ``|:|''. However, it's possible to change this letter with -% |letter-for-dotted-lines| and, by the way, the letter ``|:|'' will remain free -% for other packages (for example \pkg{arydshln}). +% The key |letter-for-dotted-lines| is now obsolete. You will delete it in a +% future version. % \begin{macrocode} letter-for-dotted-lines .code:n = { + \@@_error:n { letter-for-dotted-lines } + \group_begin: + \globaldefs = 1 + \@@_msg_redirect_name:nn { letter-for-dotted-lines } { none } + \group_end: \tl_if_single_token:nTF { #1 } { \str_set:Nx \l_@@_letter_for_dotted_lines_str { #1 } } { \@@_error:n { One~letter~allowed } } @@ -7707,9 +7752,10 @@ version 2005/12/01 or later. % \end{macrocode} % % +% The following string will initially be empty. It will be set by the key +% 'letter-for-dotted-lines'. % \begin{macrocode} \str_new:N \l_@@_letter_for_dotted_lines_str -\str_set_eq:NN \l_@@_letter_for_dotted_lines_str \c_colon_str % \end{macrocode} % % \bigskip @@ -8447,7 +8493,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_nopar:Npn \ialign { - \bool_if:NTF \c_@@_colortbl_loaded_bool + \bool_if:NTF \l_@@_colortbl_loaded_bool { \CT@everycr { @@ -8509,7 +8555,6 @@ version 2005/12/01 or later. \cs_set_eq:NN \Vdots \@@_Vdots \cs_set_eq:NN \Ddots \@@_Ddots \cs_set_eq:NN \Iddots \@@_Iddots - \cs_set_eq:NN \hdottedline \@@_hdottedline: \cs_set_eq:NN \Hline \@@_Hline: \cs_set_eq:NN \Hspace \@@_Hspace: \cs_set_eq:NN \Hdotsfor \@@_Hdotsfor: @@ -8522,6 +8567,8 @@ version 2005/12/01 or later. \cs_set_eq:NN \diagbox \@@_diagbox:nn \cs_set_eq:NN \NotEmpty \@@_NotEmpty: \cs_set_eq:NN \RowStyle \@@_RowStyle:n + \seq_map_inline:Nn \l_@@_custom_line_commands_seq + { \cs_set_eq:cc { ##1 } { nicematrix - ##1 } } \bool_if:NT \l_@@_colortbl_like_bool \@@_colortbl_like: \bool_if:NT \l_@@_renew_dots_bool \@@_renew_dots: % \end{macrocode} @@ -8629,12 +8676,12 @@ version 2005/12/01 or later. { \bool_set_true:N \l_@@_last_row_without_value_bool \bool_if:NT \g_@@_aux_found_bool - { \int_set:Nn \l_@@_last_row_int { \seq_item:Nn \c_@@_size_seq 3 } } + { \int_set:Nn \l_@@_last_row_int { \seq_item:Nn \g_@@_size_seq 3 } } } \int_compare:nNnT \l_@@_last_col_int = { -1 } { \bool_if:NT \g_@@_aux_found_bool - { \int_set:Nn \l_@@_last_col_int { \seq_item:Nn \c_@@_size_seq 6 } } + { \int_set:Nn \l_@@_last_col_int { \seq_item:Nn \g_@@_size_seq 6 } } } % \end{macrocode} % @@ -8777,10 +8824,10 @@ version 2005/12/01 or later. % (with potentially a last exterior row) and |\g_@@_col_total_int| is the number % of the last column (with potentially a last exterior column). % \begin{macrocode} - \int_set:Nn \c@iRow { \seq_item:Nn \c_@@_size_seq 2 } - \int_set:Nn \c@jCol { \seq_item:Nn \c_@@_size_seq 5 } - \int_set_eq:NN \g_@@_row_total_int { \seq_item:Nn \c_@@_size_seq 3 } - \int_set_eq:NN \g_@@_col_total_int { \seq_item:Nn \c_@@_size_seq 6 } + \int_set:Nn \c@iRow { \seq_item:Nn \g_@@_size_seq 2 } + \int_set:Nn \c@jCol { \seq_item:Nn \g_@@_size_seq 5 } + \int_set_eq:NN \g_@@_row_total_int { \seq_item:Nn \g_@@_size_seq 3 } + \int_set_eq:NN \g_@@_col_total_int { \seq_item:Nn \g_@@_size_seq 6 } % \end{macrocode} % % @@ -9684,7 +9731,8 @@ version 2005/12/01 or later. { \str_case_e:nnF { #1 } { - \l_@@_letter_for_dotted_lines_str { \@@_patch_preamble_xii:n #1 } + \l_@@_letter_for_dotted_lines_str + { \@@_patch_preamble_xii:n #1 } \l_@@_letter_vlism_tl { \seq_gput_right:Nx \g_@@_cols_vlism_seq @@ -9693,15 +9741,6 @@ version 2005/12/01 or later. { \exp_not:N ! { \skip_horizontal:N \arrayrulewidth } } \@@_patch_preamble:n } - { : } - { - \bool_if:NTF \c_@@_arydshln_loaded_bool - { - \tl_gput_right:Nn \g_@@_preamble_tl { : } - \@@_patch_preamble:n - } - { \@@_fatal:n { colon~without~arydshln } } - } } % \end{macrocode} % Now the case of a letter set by the final user for a customized rule. Such @@ -9724,6 +9763,7 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \bigskip % Now, we will list all the auxiliary functions for the different types of % entries in the preamble of the array. @@ -10340,8 +10380,7 @@ version 2005/12/01 or later. \keys_set:nV { WithArrows / X-column } \l_tmpa_tl \int_compare:nNnT \l_@@_weight_int < 0 { - \exp_args:Nnx \@@_error:nn { negative~weight } - { \int_use:N \l_@@_weight_int } + \@@_error:nx { negative~weight } { \int_use:N \l_@@_weight_int } \int_set:Nn \l_@@_weight_int { - \l_@@_weight_int } } \int_gadd:Nn \g_@@_total_X_weight_int \l_@@_weight_int @@ -11086,7 +11125,7 @@ version 2005/12/01 or later. % \begin{macrocode} \seq_gclear_new:N \g_@@_rows_seq \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl - \exp_args:NNV \seq_gset_split:Nnn \g_@@_rows_seq \l_@@_end_of_row_tl { #1 } + \seq_gset_split:NVn \g_@@_rows_seq \l_@@_end_of_row_tl { #1 } % \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 know that @@ -11105,7 +11144,7 @@ version 2005/12/01 or later. % exit the first cell of the array. % \begin{macrocode} \seq_gpop_left:NN \g_@@_rows_seq \l_tmpa_tl - \exp_args:NV \@@_line_with_light_syntax_i:n \l_tmpa_tl + \@@_line_with_light_syntax_i:V \l_tmpa_tl \seq_map_function:NN \g_@@_rows_seq \@@_line_with_light_syntax:n \@@_create_col_nodes: \endarray @@ -11126,8 +11165,10 @@ version 2005/12/01 or later. \l_tmpa_tl \seq_map_inline:Nn \g_@@_cells_seq { & ##1 } } +\cs_generate_variant:Nn \@@_line_with_light_syntax_i:n { V } % \end{macrocode} % +% % \bigskip % The following command is used by the code which detects whether the % environment is empty (we raise a fatal error in this case: it's only a @@ -11622,6 +11663,7 @@ version 2005/12/01 or later. { > \@@_cell_begin:w #2 < \@@_cell_end: } } } +\cs_generate_variant:Nn \@@_begin_of_NiceMatrix:nn { n e } % \end{macrocode} % % \begin{macrocode} @@ -11632,7 +11674,7 @@ version 2005/12/01 or later. \str_gset:Nn \g_@@_name_env_str { #1 NiceMatrix } \tl_set:Nn \l_@@_type_of_col_tl c \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 } - \exp_args:Nne \@@_begin_of_NiceMatrix:nn { #1 } \l_@@_type_of_col_tl + \@@_begin_of_NiceMatrix:ne { #1 } \l_@@_type_of_col_tl } { \use:c { end #1 NiceArray } } } @@ -11688,8 +11730,7 @@ version 2005/12/01 or later. % definition of that columns in \pkg{tabularx} (this would result in an error in % |{NiceTabularX}|). % \begin{macrocode} - \bool_if:NT \c_@@_tabularx_loaded_bool - { \newcolumntype { X } { \@@_X } } + \bool_if:NT \c_@@_tabularx_loaded_bool { \newcolumntype { X } { \@@_X } } \str_gset:Nn \g_@@_name_env_str { NiceTabularX } \dim_zero_new:N \l_@@_width_dim \dim_set:Nn \l_@@_width_dim { #1 } @@ -11754,7 +11795,7 @@ version 2005/12/01 or later. % \begin{macrocode} \tl_gput_right:Nx \g_@@_aux_tl { - \seq_gset_from_clist:Nn \exp_not:N \c_@@_size_seq + \seq_gset_from_clist:Nn \exp_not:N \g_@@_size_seq { \int_use:N \l_@@_first_row_int , \int_use:N \c@iRow , @@ -13086,7 +13127,7 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_draw_unstandard_dotted_line: { \begin { scope } - \exp_args:No \@@_draw_unstandard_dotted_line:n + \@@_draw_unstandard_dotted_line:o { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl } } % \end{macrocode} @@ -13103,6 +13144,7 @@ version 2005/12/01 or later. \l_@@_xdots_up_tl \l_@@_xdots_down_tl } +\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:n { o } % \end{macrocode} % % \begin{macrocode} @@ -14657,8 +14699,8 @@ version 2005/12/01 or later. % from a list of pairs \textsl{key=value} of a definition of a customized rule % (with the key |custom-line| of |\NiceMatrixOptions|). % \begin{macrocode} - letter .code:n = \prg_do_nothing: , - command .code:n = \prg_do_nothing: + % letter .code:n = \prg_do_nothing: , + % command .code:n = \prg_do_nothing: } % \end{macrocode} % @@ -14809,8 +14851,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_vline_ii: { - \bool_set_false:N \l_@@_dotted_bool - \keys_set:nV { NiceMatrix / RulesBis } \l_@@_other_keys_tl + \bool_set_false:N \l_@@_dotted_boo +% \end{macrocode} +% We use |\keys_set_known:nV| and not |\keys_set:nV| because there may be the +% keys |letter| and |command| in the list (these keys are present if the rule +% comes from a customized line (created by |custom-line|). +% \begin{macrocode} + \keys_set_known:nV { NiceMatrix / RulesBis } \l_@@_other_keys_tl \bool_if:NTF \l_@@_dotted_bool \@@_vline_iv: { @@ -15059,7 +15106,12 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_hline_ii: { \bool_set_false:N \l_@@_dotted_bool - \keys_set:nV { NiceMatrix / RulesBis } \l_@@_other_keys_tl +% \end{macrocode} +% We use |\keys_set_known:nV| and not |\keys_set:nV| because there may be the +% keys |letter| and |command| in the list (these keys are present if the rule +% comes from a customized line (created by |custom-line|). +% \begin{macrocode} + \keys_set_known:nV { NiceMatrix / RulesBis } \l_@@_other_keys_tl \bool_if:NTF \l_@@_dotted_bool \@@_hline_iv: { @@ -15323,7 +15375,7 @@ version 2005/12/01 or later. % % \medskip % The following command will create the customized rule (it is executed when the -% final user uses the key |custom-line| in |\NiceMatrixOptions|). +% final user uses the key |custom-line|, for example in |\NiceMatrixOptions|). % \begin{macrocode} \cs_new_protected:Npn \@@_custom_line:n #1 { @@ -15380,7 +15432,12 @@ version 2005/12/01 or later. \c_@@_forbidden_letters_str \l_@@_letter_str { \@@_error:n { Forbidden~letter } } { - \exp_args:Nnx \keys_define:nn { NiceMatrix / ColumnTypes } +% \end{macrocode} +% The final user can, locally, redefine a letter of column type. That's +% compatible with the use of |\keys_define:nn|: the definition is local and may +% overwrite a previous definition. +% \begin{macrocode} + \keys_define:nx { NiceMatrix / ColumnTypes } { \l_@@_letter_str .code:n = { \@@_custom_line_i:n { \exp_not:n { #1 } } } @@ -15404,16 +15461,14 @@ version 2005/12/01 or later. + \doublerulesep * ( \l_@@_tmpc_int - 1 ) } } - \exp_args:NnV \@@_define_h_custom_line:nn - { #1 } - \l_@@_rule_width_dim + \@@_define_h_custom_line:nV { #1 } \l_@@_rule_width_dim } } } % \end{macrocode} % % \begin{macrocode} -\str_const:Nn \c_@@_forbidden_letters_str { lcrpmbVX:|()[]!@<> } +\str_const:Nn \c_@@_forbidden_letters_str { lcrpmbVX|()[]!@<> } % \end{macrocode} % % \medskip @@ -15449,6 +15504,7 @@ version 2005/12/01 or later. width .code:n = \dim_set:Nn \l_@@_rule_width_dim { #1 } \bool_set_true:N \l_tmpb_bool , width .value_required:n = true , + unknown .code:n = \@@_error:n { Unknown~key~for~custom-line } } % \end{macrocode} % @@ -15464,7 +15520,7 @@ version 2005/12/01 or later. % We use |\cs_set:cpn| and not |\cs_new:cpn| because we want a local definition. % Moreover, the command must \emph{not} be protected since it begins with |\noalign|. % \begin{macrocode} - \cs_set:cpn \l_@@_command_str + \cs_set:cpn { nicematrix - \l_@@_command_str } { \noalign { @@ -15473,7 +15529,9 @@ version 2005/12/01 or later. { \@@_hline:n { #1 , position = \int_eval:n { \c@iRow + 1 } } } } } + \seq_put_left:NV \l_@@_custom_line_commands_seq \l_@@_command_str } +\cs_generate_variant:Nn \@@_define_h_custom_line:nn { n V } % \end{macrocode} % % The flag |\l_tmpa_bool| means that the key 'tikz' have been used. When the key @@ -15500,6 +15558,9 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \begin{macrocode} +\@@_custom_line:n { letter = : , command = hdottedline , dotted } +% \end{macrocode} % % \subsubsection*{The key hvlines} % @@ -18728,6 +18789,7 @@ version 2005/12/01 or later. } { The~available~keys~are~(in~alphabetic~order):~ + allow-letter-for-dotted-lines,~ footnote,~ footnotehyper,~ renew-dots,~and @@ -18747,6 +18809,14 @@ version 2005/12/01 or later. transparent .value_forbidden:n = true, footnote .bool_set:N = \c_@@_footnote_bool , footnotehyper .bool_set:N = \c_@@_footnotehyper_bool , + allow-letter-for-dotted-lines .code:n = + { + \group_begin: + \globaldefs = 1 + \@@_msg_redirect_name:nn { letter-for-dotted-lines } { none } + \group_end: + } , + allow-letter-for-dotted-lines .value_forbidden:n = true , unknown .code:n = \@@_error:n { Unknown~key~for~package } } \ProcessKeysOptions { NiceMatrix / Package } @@ -18823,13 +18893,13 @@ version 2005/12/01 or later. % % % \begin{macrocode} -\seq_new:N \c_@@_types_of_matrix_seq -\seq_set_from_clist:Nn \c_@@_types_of_matrix_seq +\seq_new:N \g_@@_types_of_matrix_seq +\seq_gset_from_clist:Nn \g_@@_types_of_matrix_seq { NiceMatrix , pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix } -\seq_set_map_x:NNn \c_@@_types_of_matrix_seq \c_@@_types_of_matrix_seq +\seq_gset_map_x:NNn \g_@@_types_of_matrix_seq \g_@@_types_of_matrix_seq { \tl_to_str:n { #1 } } % \end{macrocode} % @@ -18842,7 +18912,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_error_too_much_cols: { - \seq_if_in:NVTF \c_@@_types_of_matrix_seq \g_@@_name_env_str + \seq_if_in:NVTF \g_@@_types_of_matrix_seq \g_@@_name_env_str { \int_compare:nNnTF \l_@@_last_col_int = { -2 } { \@@_fatal:n { too~much~cols~for~matrix } } @@ -18994,6 +19064,25 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nnn { Unknown~key~for~custom-line } + { + The~key~'\l_keys_key_str'~is~unknown~in~a~'custom-line'.~ + If~you~go~on,~it~will~be~ignored. \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + color,~ + command,~ + dotted,~ + letter,~ + multiplicity,~ + sep-color,~ + tikz,~and~width. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Unknown~key~for~xdots } { As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~ @@ -19117,11 +19206,23 @@ version 2005/12/01 or later. Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~ key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~key~'command'~ (to~draw~horizontal~rules).\\ - However,~you~can~go~on. + However,~you~can~go~on. } % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { letter-for-dotted-lines } + { + The~key~'letter-for-dotted-lines'~is~now~obsolete~(you~should~ + use~'custom-line'~instead).~However,~you~can~go~on~for~this~time.~ + If~you~don't~want~to~see~that~message~again,~you~should~ + load~'nicematrix'~with~the~key~'allow-letter-for-dotted-lines'.~ + However,~'letter-for-dotted-lines'~will~be~deleted~in~a~future~ + version~of~'nicematrix'. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Forbidden~letter } { You~can't~use~the~letter~'\l_@@_letter_str'~for~a~customized~line.\\ @@ -19495,6 +19596,7 @@ version 2005/12/01 or later. bottomrule,~ code-after,~ code-before,~ + detect-duplicates,~ enumitem-keys,~ enumitem-keys-para,~ para,~ @@ -19556,7 +19658,6 @@ version 2005/12/01 or later. last-col,~ last-row,~ left-margin,~ - letter-for-dotted-lines,~ light-syntax,~ notes~(several~subkeys),~ nullify-dots,~ @@ -20336,6 +20437,13 @@ version 2005/12/01 or later. % % Key |tikz| in the key |borders| of a command |\Block| % +% \subsection*{Changes between version 6.7 and 6.8} +% +% In the notes of a tabular (with the command |\tabularnote|), the duplicates +% are now detected: when several commands |\tabularnote| are used with the same +% argument, only one note is created at the end of the tabular (but all the +% labels are present, of course). +% % \PrintIndex % % \tableofcontents diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 88cfb82de0f..354ff649e86 100644 --- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty +++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -\def\myfileversion{6.7} -\def\myfiledate{2022/03/02} +\def\myfileversion{6.8} +\def\myfiledate{2022/03/11} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -33,6 +33,7 @@ \RequirePackage { amsmath } \cs_new_protected:Npn \__nicematrix_error:n { \msg_error:nn { nicematrix } } \cs_new_protected:Npn \__nicematrix_error:nn { \msg_error:nnn { nicematrix } } +\cs_generate_variant:Nn \__nicematrix_error:nn { n x } \cs_new_protected:Npn \__nicematrix_error:nnn { \msg_error:nnnn { nicematrix } } \cs_new_protected:Npn \__nicematrix_fatal:n { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \__nicematrix_fatal:nn { \msg_fatal:nnn { nicematrix } } @@ -40,48 +41,50 @@ \cs_new_protected:Npn \__nicematrix_msg_new:nnn { \msg_new:nnnn { nicematrix } } \cs_new_protected:Npn \__nicematrix_msg_redirect_name:nn { \msg_redirect_name:nnn { nicematrix } } -\bool_new:N \c__nicematrix_arydshln_loaded_bool -\bool_new:N \c__nicematrix_booktabs_loaded_bool -\bool_new:N \c__nicematrix_enumitem_loaded_bool -\bool_new:N \c__nicematrix_tabularx_loaded_bool -\bool_new:N \c__nicematrix_tikz_loaded_bool -\bool_new:N \c__nicematrix_varwidth_loaded_bool +\tl_new:N \l__nicematrix_argspec_tl +\cs_generate_variant:Nn \seq_gset_split:Nnn { N V n } +\cs_generate_variant:Nn \keys_define:nn { n x } \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { varwidth } - { \bool_set_true:N \c__nicematrix_varwidth_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_varwidth_loaded_bool { \c_false_bool } } \@ifpackageloaded { arydshln } - { \bool_set_true:N \c__nicematrix_arydshln_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_arydshln_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_arydshln_loaded_bool { \c_false_bool } } \@ifpackageloaded { booktabs } - { \bool_set_true:N \c__nicematrix_booktabs_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_booktabs_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_booktabs_loaded_bool { \c_false_bool } } \@ifpackageloaded { enumitem } - { \bool_set_true:N \c__nicematrix_enumitem_loaded_bool } - { } + { \bool_const:Nn \c__nicematrix_enumitem_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_enumitem_loaded_bool { \c_false_bool } } \@ifpackageloaded { tabularx } - { \bool_set_true:N \c__nicematrix_tabularx_loaded_bool } + { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_true_bool } } + { \bool_const:Nn \c__nicematrix_tabularx_loaded_bool { \c_false_bool } } { } \@ifpackageloaded { tikz } { - \bool_set_true:N \c__nicematrix_tikz_loaded_bool + \bool_const:Nn \c__nicematrix_tikz_loaded_bool \c_true_bool \tl_const:Nn \c__nicematrix_pgfortikzpicture_tl { \exp_not:N \tikzpicture } \tl_const:Nn \c__nicematrix_endpgfortikzpicture_tl { \exp_not:N \endtikzpicture } } { + \bool_const:Nn \c__nicematrix_tikz_loaded_bool \c_false_bool \tl_const:Nn \c__nicematrix_pgfortikzpicture_tl { \exp_not:N \pgfpicture } \tl_const:Nn \c__nicematrix_endpgfortikzpicture_tl { \exp_not:N \endpgfpicture } } } -\bool_new:N \c__nicematrix_revtex_bool \@ifclassloaded { revtex4-1 } - { \bool_set_true:N \c__nicematrix_revtex_bool } - { } -\@ifclassloaded { revtex4-2 } - { \bool_set_true:N \c__nicematrix_revtex_bool } - { } -\cs_if_exist:NT \rvtx@ifformat@geq { \bool_set_true:N \c__nicematrix_revtex_bool } + { \bool_const:Nn \c__nicematrix_revtex_bool \c_true_bool } + { + \@ifclassloaded { revtex4-2 } + { \bool_const:Nn \c__nicematrix_revtex_bool \c_true_bool } + { + \cs_if_exist:NT \rvtx@ifformat@geq + { \bool_const:Nn \c__nicematrix_revtex_bool \c_true_bool } + { \bool_const:Nn \c__nicematrix_revtex_bool \c_false_bool } + } + } \cs_generate_variant:Nn \tl_if_single_token_p:n { V } \regex_const:Nn \c__nicematrix_columncolor_regex { \c { columncolor } } \cs_new_protected:Npn \__nicematrix_provide_pgfsyspdfmark: @@ -124,11 +127,11 @@ { \__nicematrix_old_pgfutil@check@rerun { ##1 } { ##2 } } } } -\bool_new:N \c__nicematrix_colortbl_loaded_bool +\bool_new:N \l__nicematrix_colortbl_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { colortbl } - { \bool_set_true:N \c__nicematrix_colortbl_loaded_bool } + { \bool_set_true:N \l__nicematrix_colortbl_loaded_bool } { \cs_set_protected:Npn \CT@arc@ { } \cs_set:Npn \arrayrulecolor #1 # { \CT@arc { #1 } } @@ -211,16 +214,16 @@ \cs_new_protected:Npn \__nicematrix_set_CT@drsc@_ii: #1 \q_stop { \cs_set:Npn \CT@drsc@ { \color { #1 } } } \cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor -\bool_new:N \c__nicematrix_siunitx_loaded_bool +\bool_new:N \l__nicematrix_siunitx_loaded_bool \hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { siunitx } - { \bool_set_true:N \c__nicematrix_siunitx_loaded_bool } + { \bool_set_true:N \l__nicematrix_siunitx_loaded_bool } { } } \hook_gput_code:nnn { begindocument } { . } { - \bool_if:nTF { ! \c__nicematrix_siunitx_loaded_bool } + \bool_if:nTF { ! \l__nicematrix_siunitx_loaded_bool } { \cs_set_eq:NN \__nicematrix_renew_NC@rewrite@S: \prg_do_nothing: } { \cs_new_protected:Npn \__nicematrix_renew_NC@rewrite@S: @@ -255,6 +258,8 @@ \dim_new:N \l__nicematrix_width_dim \seq_new:N \g__nicematrix_names_seq \bool_new:N \l__nicematrix_in_env_bool +\bool_new:N \l__nicematrix_notes_detect_duplicates_bool +\bool_set_true:N \l__nicematrix_notes_detect_duplicates_bool \bool_new:N \l__nicematrix_NiceArray_bool \bool_new:N \l__nicematrix_NiceTabular_bool \dim_new:N \l__nicematrix_tabular_width_dim @@ -273,7 +278,8 @@ \colorlet { nicematrix-last-col } { . } \colorlet { nicematrix-last-row } { . } \str_new:N \g__nicematrix_name_env_str -\tl_set:Nn \g__nicematrix_com_or_env_str { environment } +\tl_new:N \g__nicematrix_com_or_env_str +\tl_gset:Nn \g__nicematrix_com_or_env_str { environment } \cs_new:Npn \__nicematrix_full_name_env: { \str_if_eq:VnTF \g__nicematrix_com_or_env_str { command } @@ -285,6 +291,7 @@ \tl_new:N \g__nicematrix_internal_code_after_tl \int_new:N \l__nicematrix_old_iRow_int \int_new:N \l__nicematrix_old_jCol_int +\seq_new:N \l__nicematrix_custom_line_commands_seq \tl_new:N \l__nicematrix_rules_color_tl \int_new:N \g__nicematrix_total_X_weight_int \bool_new:N \l__nicematrix_X_columns_aux_bool @@ -381,7 +388,13 @@ \newcounter { tabularnote } \seq_new:N \g__nicematrix_tabularnotes_seq \tl_new:N \l__nicematrix_tabularnote_tl -\int_new:N \l__nicematrix_number_of_notes_int +\seq_new:N \l__nicematrix_notes_labels_seq +\newcounter{nicematrix_draft} +\cs_new_protected:Npn \__nicematrix_notes_format:n #1 + { + \setcounter { nicematrix_draft } { #1 } + \__nicematrix_notes_style:n { nicematrix_draft } + } \cs_new:Npn \__nicematrix_notes_style:n #1 { \textit { \alph { #1 } } } \cs_new:Npn \__nicematrix_notes_label_in_tabular:n #1 { \textsuperscript { #1 } } \cs_new:Npn \__nicematrix_notes_label_in_list:n #1 { \textsuperscript { #1 } } @@ -418,27 +431,39 @@ \bool_if:nTF { ! \l__nicematrix_NiceArray_bool && \l__nicematrix_in_env_bool } { \__nicematrix_error:n { tabularnote~forbidden } } { - \int_incr:N \l__nicematrix_number_of_notes_int - \seq_gput_right:Nn \g__nicematrix_tabularnotes_seq { #1 } + \int_zero:N \l_tmpa_int + \bool_if:NT \l__nicematrix_notes_detect_duplicates_bool + { + \seq_map_indexed_inline:Nn \g__nicematrix_tabularnotes_seq + { + \tl_if_eq:nnT { #1 } { ##2 } + { \int_set:Nn \l_tmpa_int { ##1 } \seq_map_break: } + } + } + \int_compare:nNnTF \l_tmpa_int = 0 + { + \stepcounter { tabularnote } + \seq_put_right:Nx \l__nicematrix_notes_labels_seq + { \__nicematrix_notes_format:n { \int_use:c { c @ tabularnote } } } + \seq_gput_right:Nn \g__nicematrix_tabularnotes_seq { #1 } + } + { + \seq_put_right:Nx \l__nicematrix_notes_labels_seq + { \__nicematrix_notes_format:n { \int_use:N \l_tmpa_int } } + } \peek_meaning:NF \tabularnote { \hbox_set:Nn \l_tmpa_box { \__nicematrix_notes_label_in_tabular:n { - \stepcounter { tabularnote } - \__nicematrix_notes_style:n { tabularnote } - \prg_replicate:nn { \l__nicematrix_number_of_notes_int - 1 } - { - , - \stepcounter { tabularnote } - \__nicematrix_notes_style:n { tabularnote } - } + \seq_use:Nnnn + \l__nicematrix_notes_labels_seq { , } { , } { , } } } \addtocounter { tabularnote } { -1 } \refstepcounter { tabularnote } - \int_zero:N \l__nicematrix_number_of_notes_int + \seq_clear:N \l__nicematrix_notes_labels_seq \hbox_overlap_right:n { \box_use:N \l_tmpa_box } \skip_horizontal:n { \box_wd:N \l_tmpa_box } } @@ -734,6 +759,8 @@ } } , enumitem-keys-para .value_required:n = true , + detect-duplicates .bool_set:N = \l__nicematrix_notes_detect_duplicates_bool , + detect-duplicates .default:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~notes } } \keys_define:nn { NiceMatrix / delimiters } @@ -808,6 +835,11 @@ allow-duplicate-names .value_forbidden:n = true , letter-for-dotted-lines .code:n = { + \__nicematrix_error:n { letter-for-dotted-lines } + \group_begin: + \globaldefs = 1 + \__nicematrix_msg_redirect_name:nn { letter-for-dotted-lines } { none } + \group_end: \tl_if_single_token:nTF { #1 } { \str_set:Nx \l__nicematrix_letter_for_dotted_lines_str { #1 } } { \__nicematrix_error:n { One~letter~allowed } } @@ -821,7 +853,6 @@ unknown .code:n = \__nicematrix_error:n { Unknown~key~for~NiceMatrixOptions } } \str_new:N \l__nicematrix_letter_for_dotted_lines_str -\str_set_eq:NN \l__nicematrix_letter_for_dotted_lines_str \c_colon_str \NewDocumentCommand \NiceMatrixOptions { m } { \keys_set:nn { NiceMatrix / NiceMatrixOptions } { #1 } } \keys_define:nn { NiceMatrix / NiceMatrix } @@ -1194,7 +1225,7 @@ } \cs_set_nopar:Npn \ialign { - \bool_if:NTF \c__nicematrix_colortbl_loaded_bool + \bool_if:NTF \l__nicematrix_colortbl_loaded_bool { \CT@everycr { @@ -1231,7 +1262,6 @@ \cs_set_eq:NN \Vdots \__nicematrix_Vdots \cs_set_eq:NN \Ddots \__nicematrix_Ddots \cs_set_eq:NN \Iddots \__nicematrix_Iddots - \cs_set_eq:NN \hdottedline \__nicematrix_hdottedline: \cs_set_eq:NN \Hline \__nicematrix_Hline: \cs_set_eq:NN \Hspace \__nicematrix_Hspace: \cs_set_eq:NN \Hdotsfor \__nicematrix_Hdotsfor: @@ -1244,6 +1274,8 @@ \cs_set_eq:NN \diagbox \__nicematrix_diagbox:nn \cs_set_eq:NN \NotEmpty \__nicematrix_NotEmpty: \cs_set_eq:NN \RowStyle \__nicematrix_RowStyle:n + \seq_map_inline:Nn \l__nicematrix_custom_line_commands_seq + { \cs_set_eq:cc { ##1 } { nicematrix - ##1 } } \bool_if:NT \l__nicematrix_colortbl_like_bool \__nicematrix_colortbl_like: \bool_if:NT \l__nicematrix_renew_dots_bool \__nicematrix_renew_dots: \cs_set_eq:NN \multicolumn \__nicematrix_multicolumn:nnn @@ -1275,12 +1307,12 @@ { \bool_set_true:N \l__nicematrix_last_row_without_value_bool \bool_if:NT \g__nicematrix_aux_found_bool - { \int_set:Nn \l__nicematrix_last_row_int { \seq_item:Nn \c__nicematrix_size_seq 3 } } + { \int_set:Nn \l__nicematrix_last_row_int { \seq_item:Nn \g__nicematrix_size_seq 3 } } } \int_compare:nNnT \l__nicematrix_last_col_int = { -1 } { \bool_if:NT \g__nicematrix_aux_found_bool - { \int_set:Nn \l__nicematrix_last_col_int { \seq_item:Nn \c__nicematrix_size_seq 6 } } + { \int_set:Nn \l__nicematrix_last_col_int { \seq_item:Nn \g__nicematrix_size_seq 6 } } } \int_compare:nNnT \l__nicematrix_last_row_int > { -2 } { @@ -1330,10 +1362,10 @@ } \cs_new_protected:Npn \__nicematrix_pre_code_before: { - \int_set:Nn \c@iRow { \seq_item:Nn \c__nicematrix_size_seq 2 } - \int_set:Nn \c@jCol { \seq_item:Nn \c__nicematrix_size_seq 5 } - \int_set_eq:NN \g__nicematrix_row_total_int { \seq_item:Nn \c__nicematrix_size_seq 3 } - \int_set_eq:NN \g__nicematrix_col_total_int { \seq_item:Nn \c__nicematrix_size_seq 6 } + \int_set:Nn \c@iRow { \seq_item:Nn \g__nicematrix_size_seq 2 } + \int_set:Nn \c@jCol { \seq_item:Nn \g__nicematrix_size_seq 5 } + \int_set_eq:NN \g__nicematrix_row_total_int { \seq_item:Nn \g__nicematrix_size_seq 3 } + \int_set_eq:NN \g__nicematrix_col_total_int { \seq_item:Nn \g__nicematrix_size_seq 6 } \pgfsys@markposition { \__nicematrix_env: - position } \pgfsys@getposition { \__nicematrix_env: - position } \__nicematrix_picture_position: \pgfpicture @@ -1801,7 +1833,8 @@ { \str_case_e:nnF { #1 } { - \l__nicematrix_letter_for_dotted_lines_str { \__nicematrix_patch_preamble_xii:n #1 } + \l__nicematrix_letter_for_dotted_lines_str + { \__nicematrix_patch_preamble_xii:n #1 } \l__nicematrix_letter_vlism_tl { \seq_gput_right:Nx \g__nicematrix_cols_vlism_seq @@ -1810,15 +1843,6 @@ { \exp_not:N ! { \skip_horizontal:N \arrayrulewidth } } \__nicematrix_patch_preamble:n } - { : } - { - \bool_if:NTF \c__nicematrix_arydshln_loaded_bool - { - \tl_gput_right:Nn \g__nicematrix_preamble_tl { : } - \__nicematrix_patch_preamble:n - } - { \__nicematrix_fatal:n { colon~without~arydshln } } - } } { \keys_set_known:nnN { NiceMatrix / ColumnTypes } { #1 } \l_tmpa_tl @@ -2176,8 +2200,7 @@ \keys_set:nV { WithArrows / X-column } \l_tmpa_tl \int_compare:nNnT \l__nicematrix_weight_int < 0 { - \exp_args:Nnx \__nicematrix_error:nn { negative~weight } - { \int_use:N \l__nicematrix_weight_int } + \__nicematrix_error:nx { negative~weight } { \int_use:N \l__nicematrix_weight_int } \int_set:Nn \l__nicematrix_weight_int { - \l__nicematrix_weight_int } } \int_gadd:Nn \g__nicematrix_total_X_weight_int \l__nicematrix_weight_int @@ -2616,12 +2639,12 @@ \tl_gput_right:Nn \g_nicematrix_code_after_tl { #2 } \seq_gclear_new:N \g__nicematrix_rows_seq \tl_set_rescan:Nno \l__nicematrix_end_of_row_tl { } \l__nicematrix_end_of_row_tl - \exp_args:NNV \seq_gset_split:Nnn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 } + \seq_gset_split:NVn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 } \int_compare:nNnT \l__nicematrix_last_row_int = { -1 } { \int_set:Nn \l__nicematrix_last_row_int { \seq_count:N \g__nicematrix_rows_seq } } \exp_args:NV \__nicematrix_array: \g__nicematrix_preamble_tl \seq_gpop_left:NN \g__nicematrix_rows_seq \l_tmpa_tl - \exp_args:NV \__nicematrix_line_with_light_syntax_i:n \l_tmpa_tl + \__nicematrix_line_with_light_syntax_i:V \l_tmpa_tl \seq_map_function:NN \g__nicematrix_rows_seq \__nicematrix_line_with_light_syntax:n \__nicematrix_create_col_nodes: \endarray @@ -2636,6 +2659,7 @@ \l_tmpa_tl \seq_map_inline:Nn \g__nicematrix_cells_seq { & ##1 } } +\cs_generate_variant:Nn \__nicematrix_line_with_light_syntax_i:n { V } \cs_new_protected:Npn \__nicematrix_analyze_end:Nn #1 #2 { \str_if_eq:VnT \g__nicematrix_name_env_str { #2 } @@ -2971,6 +2995,7 @@ { > \__nicematrix_cell_begin:w #2 < \__nicematrix_cell_end: } } } +\cs_generate_variant:Nn \__nicematrix_begin_of_NiceMatrix:nn { n e } \clist_map_inline:nn { { } , p , b , B , v , V } { \NewDocumentEnvironment { #1 NiceMatrix } { ! O { } } @@ -2978,7 +3003,7 @@ \str_gset:Nn \g__nicematrix_name_env_str { #1 NiceMatrix } \tl_set:Nn \l__nicematrix_type_of_col_tl c \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 } - \exp_args:Nne \__nicematrix_begin_of_NiceMatrix:nn { #1 } \l__nicematrix_type_of_col_tl + \__nicematrix_begin_of_NiceMatrix:ne { #1 } \l__nicematrix_type_of_col_tl } { \use:c { end #1 NiceArray } } } @@ -3005,8 +3030,7 @@ } \NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } } { - \bool_if:NT \c__nicematrix_tabularx_loaded_bool - { \newcolumntype { X } { \__nicematrix_X } } + \bool_if:NT \c__nicematrix_tabularx_loaded_bool { \newcolumntype { X } { \__nicematrix_X } } \str_gset:Nn \g__nicematrix_name_env_str { NiceTabularX } \dim_zero_new:N \l__nicematrix_width_dim \dim_set:Nn \l__nicematrix_width_dim { #1 } @@ -3035,7 +3059,7 @@ { \int_set_eq:NN \l__nicematrix_last_row_int \g__nicematrix_row_total_int } \tl_gput_right:Nx \g__nicematrix_aux_tl { - \seq_gset_from_clist:Nn \exp_not:N \c__nicematrix_size_seq + \seq_gset_from_clist:Nn \exp_not:N \g__nicematrix_size_seq { \int_use:N \l__nicematrix_first_row_int , \int_use:N \c@iRow , @@ -3815,7 +3839,7 @@ \cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line: { \begin { scope } - \exp_args:No \__nicematrix_draw_unstandard_dotted_line:n + \__nicematrix_draw_unstandard_dotted_line:o { \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl } } \cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:n #1 @@ -3825,6 +3849,7 @@ \l__nicematrix_xdots_up_tl \l__nicematrix_xdots_down_tl } +\cs_generate_variant:Nn \__nicematrix_draw_unstandard_dotted_line:n { o } \cs_new_protected:Npn \__nicematrix_draw_unstandard_dotted_line:nnn #1 #2 #3 { \draw @@ -4778,8 +4803,8 @@ start .int_set:N = \l__nicematrix_start_int , start .initial:n = 1 , end .int_set:N = \l__nicematrix_end_int , - letter .code:n = \prg_do_nothing: , - command .code:n = \prg_do_nothing: + % letter .code:n = \prg_do_nothing: , + % command .code:n = \prg_do_nothing: } \keys_define:nn { NiceMatrix / RulesBis } { @@ -4871,8 +4896,8 @@ } \cs_new_protected:Npn \__nicematrix_vline_ii: { - \bool_set_false:N \l__nicematrix_dotted_bool - \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl + \bool_set_false:N \l__nicematrix_dotted_boo + \keys_set_known:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl \bool_if:NTF \l__nicematrix_dotted_bool \__nicematrix_vline_iv: { @@ -5053,7 +5078,7 @@ \cs_new_protected:Npn \__nicematrix_hline_ii: { \bool_set_false:N \l__nicematrix_dotted_bool - \keys_set:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl + \keys_set_known:nV { NiceMatrix / RulesBis } \l__nicematrix_other_keys_tl \bool_if:NTF \l__nicematrix_dotted_bool \__nicematrix_hline_iv: { @@ -5235,7 +5260,7 @@ \c__nicematrix_forbidden_letters_str \l__nicematrix_letter_str { \__nicematrix_error:n { Forbidden~letter } } { - \exp_args:Nnx \keys_define:nn { NiceMatrix / ColumnTypes } + \keys_define:nx { NiceMatrix / ColumnTypes } { \l__nicematrix_letter_str .code:n = { \__nicematrix_custom_line_i:n { \exp_not:n { #1 } } } @@ -5254,13 +5279,11 @@ + \doublerulesep * ( \l__nicematrix_tmpc_int - 1 ) } } - \exp_args:NnV \__nicematrix_define_h_custom_line:nn - { #1 } - \l__nicematrix_rule_width_dim + \__nicematrix_define_h_custom_line:nV { #1 } \l__nicematrix_rule_width_dim } } } -\str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX:|()[]!@<> } +\str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX|()[]!@<> } \keys_define:nn { NiceMatrix / Custom-Line } { % here, we will use change in the future to use .tl_set:N @@ -5278,10 +5301,11 @@ width .code:n = \dim_set:Nn \l__nicematrix_rule_width_dim { #1 } \bool_set_true:N \l_tmpb_bool , width .value_required:n = true , + unknown .code:n = \__nicematrix_error:n { Unknown~key~for~custom-line } } \cs_new_protected:Npn \__nicematrix_define_h_custom_line:nn #1 #2 { - \cs_set:cpn \l__nicematrix_command_str + \cs_set:cpn { nicematrix - \l__nicematrix_command_str } { \noalign { @@ -5290,7 +5314,9 @@ { \__nicematrix_hline:n { #1 , position = \int_eval:n { \c@iRow + 1 } } } } } + \seq_put_left:NV \l__nicematrix_custom_line_commands_seq \l__nicematrix_command_str } +\cs_generate_variant:Nn \__nicematrix_define_h_custom_line:nn { n V } \cs_new_protected:Npn \__nicematrix_custom_line_i:n #1 { \bool_if:NF \l_tmpa_bool @@ -5309,6 +5335,7 @@ \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl { \__nicematrix_vline:n { #1 , position = \int_eval:n { \c@jCol + 1 } } } } +\__nicematrix_custom_line:n { letter = : , command = hdottedline , dotted } \cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnnn #1 #2 #3 #4 { \bool_lazy_all:nT @@ -7331,6 +7358,7 @@ } { The~available~keys~are~(in~alphabetic~order):~ + allow-letter-for-dotted-lines,~ footnote,~ footnotehyper,~ renew-dots,~and @@ -7346,6 +7374,14 @@ transparent .value_forbidden:n = true, footnote .bool_set:N = \c__nicematrix_footnote_bool , footnotehyper .bool_set:N = \c__nicematrix_footnotehyper_bool , + allow-letter-for-dotted-lines .code:n = + { + \group_begin: + \globaldefs = 1 + \__nicematrix_msg_redirect_name:nn { letter-for-dotted-lines } { none } + \group_end: + } , + allow-letter-for-dotted-lines .value_forbidden:n = true , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~package } } \ProcessKeysOptions { NiceMatrix / Package } @@ -7388,17 +7424,17 @@ } \bool_set_true:N \c__nicematrix_footnote_bool } -\seq_new:N \c__nicematrix_types_of_matrix_seq -\seq_set_from_clist:Nn \c__nicematrix_types_of_matrix_seq +\seq_new:N \g__nicematrix_types_of_matrix_seq +\seq_gset_from_clist:Nn \g__nicematrix_types_of_matrix_seq { NiceMatrix , pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix } -\seq_set_map_x:NNn \c__nicematrix_types_of_matrix_seq \c__nicematrix_types_of_matrix_seq +\seq_gset_map_x:NNn \g__nicematrix_types_of_matrix_seq \g__nicematrix_types_of_matrix_seq { \tl_to_str:n { #1 } } \cs_new_protected:Npn \__nicematrix_error_too_much_cols: { - \seq_if_in:NVTF \c__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str + \seq_if_in:NVTF \g__nicematrix_types_of_matrix_seq \g__nicematrix_name_env_str { \int_compare:nNnTF \l__nicematrix_last_col_int = { -2 } { \__nicematrix_fatal:n { too~much~cols~for~matrix } } @@ -7495,6 +7531,22 @@ Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~ is~'standard'.~If~you~go~on,~this~key~will~be~ignored. } +\__nicematrix_msg_new:nnn { Unknown~key~for~custom-line } + { + The~key~'\l_keys_key_str'~is~unknown~in~a~'custom-line'.~ + If~you~go~on,~it~will~be~ignored. \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~keys~are~(in~alphabetic~order):~ + color,~ + command,~ + dotted,~ + letter,~ + multiplicity,~ + sep-color,~ + tikz,~and~width. + } \__nicematrix_msg_new:nn { Unknown~key~for~xdots } { As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~ @@ -7575,7 +7627,16 @@ Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~ key~'letter'~(for~a~letter~for~vertical~rules)~nor~the~key~'command'~ (to~draw~horizontal~rules).\\ - However,~you~can~go~on. + However,~you~can~go~on. + } +\__nicematrix_msg_new:nn { letter-for-dotted-lines } + { + The~key~'letter-for-dotted-lines'~is~now~obsolete~(you~should~ + use~'custom-line'~instead).~However,~you~can~go~on~for~this~time.~ + If~you~don't~want~to~see~that~message~again,~you~should~ + load~'nicematrix'~with~the~key~'allow-letter-for-dotted-lines'.~ + However,~'letter-for-dotted-lines'~will~be~deleted~in~a~future~ + version~of~'nicematrix'. } \__nicematrix_msg_new:nn { Forbidden~letter } { @@ -7842,6 +7903,7 @@ bottomrule,~ code-after,~ code-before,~ + detect-duplicates,~ enumitem-keys,~ enumitem-keys-para,~ para,~ @@ -7897,7 +7959,6 @@ last-col,~ last-row,~ left-margin,~ - letter-for-dotted-lines,~ light-syntax,~ notes~(several~subkeys),~ nullify-dots,~ |