diff options
author | Karl Berry <karl@freefriends.org> | 2022-03-12 20:34:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-03-12 20:34:24 +0000 |
commit | 65307ba55aef6eb6541ec5ac312ac8556b24e690 (patch) | |
tree | ae946c766f054cfd5c739ff7de3bd574a8c9e026 /Master/texmf-dist/source/latex/nicematrix | |
parent | 8de94f8f5521ceef2a689992ad69fc11d84082da (diff) |
nicematrix (12mar22)
git-svn-id: svn://tug.org/texlive/trunk@62660 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/nicematrix')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 352 |
1 files changed, 230 insertions, 122 deletions
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 |