From aa43c542d837b6af95431d14e2a85cee8059fae5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 9 Nov 2023 22:25:37 +0000 Subject: nicematrix (3nov23) git-svn-id: svn://tug.org/texlive/trunk@68792 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/nicematrix/nicematrix-code.pdf | Bin 953487 -> 959106 bytes .../doc/latex/nicematrix/nicematrix-french.pdf | Bin 593655 -> 594905 bytes .../doc/latex/nicematrix/nicematrix-french.tex | 40 ++-- .../texmf-dist/doc/latex/nicematrix/nicematrix.pdf | Bin 610304 -> 610574 bytes .../texmf-dist/doc/latex/nicematrix/nicematrix.tex | 16 +- .../source/latex/nicematrix/nicematrix-code.dtx | 210 +++++++++++++-------- .../texmf-dist/tex/latex/nicematrix/nicematrix.sty | 136 +++++++------ 7 files changed, 248 insertions(+), 154 deletions(-) diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf index f2314771587..61c9ca2acb3 100644 Binary files a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf and b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-code.pdf differ diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf index 9ceefb5bfc4..5182d3d9663 100644 Binary files a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf and b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf differ diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex index 57c269627b1..ea91158d20c 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex @@ -179,7 +179,7 @@ chargé par défaut). \medskip \indexcommand{NiceMatrixOptions} -Une commande|\NiceMatrixOptions| est fournie pour régler les options (la portée +Une commande |\NiceMatrixOptions| est fournie pour régler les options (la portée des options fixées par cette commande est le groupe TeX courant : elles sont semi-globales). @@ -641,8 +641,8 @@ sont décrites ci-dessous (cf. \ref{horizontal-bloc} p.~\pageref{horizontal-bloc \interitem \textbf{On doit remarquer que, par défaut, les blocs ne créent pas d'espace}. Il -n'y a exception que pour les blocs mono-rangée et les blocs mono-colonne comme -expliqué plus loin. +n'y a exception que pour les blocs mono-rangée et les blocs mono-colonne dans +certaines conditions comme expliqué plus loin. \medskip @@ -733,7 +733,10 @@ Henri & 14 \\ \hline Pour les blocs mono-rangée, la hauteur (\emph{height}) et la profondeur (\emph{depth}) naturelles sont prises en compte pour la hauteur et la largeur de -la rangée en cours (comme le fait la commande standard |\multicolumn| de LaTeX). +la rangée en cours (comme le fait la commande standard |\multicolumn| de LaTeX), +sauf lorsqu'une option de placement vertical a été utilisée pour le bloc (une +des clés |t|, |b|, |v-center|, |T| et |B| décrites à la partie +\ref{vertical-pos-block}, p.~\pageref{vertical-pos-block}). \subsection{Les blocs mono-case} @@ -900,6 +903,8 @@ Rang & \Block[C]{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\ \subsection{Positionnement vertical du contenu des blocs} +\label{vertical-pos-block} + Concernant le positionnement vertical, la commande |\Block| admet les clés |v-center|\footnote{Cette clé ne peut être nommée \texttt{c} car la clé \texttt{c} est déjà prise pour le positionnement horizontal.}, |t|, |b|, |T| et~|B|. @@ -1264,7 +1269,7 @@ standard |\hline| et la commande |\Hline| proposée par \pkg{nicematrix}. Par ailleurs, la commande |\Hline| admet entre crochets un argument optionnel qui est une liste de couples \textsl{clé=valeur} qui décrivent un filet. Pour la -description de ces clés, voir |custom-line| +description de ces clés, voir |custom-line|, p.~\pageref{custom-line}.\footnote{Remarque technique. Si l'utilisateur définit une commande par-dessus la commande |\Hline|, il doit veiller à ce qu'elle soit \emph{développable} au sens de TeX (en utilisant @@ -1486,7 +1491,7 @@ $\triangleright$ Les coins sont également pris en compte par les outils de coloriage dans le |\CodeBefore|. Ces outils ne colorient pas les cases qui sont dans les coins (cf.~p.~\pageref{color-in-code-before}). La commande |\TikzEveryCell| disponible dans le |\CodeAfter| et le |\CodeBefore| (cf. -p.~\pageref{TikzEveryCell}). tient également compte des coins. +p.~\pageref{TikzEveryCell}) tient également compte des coins. \subsection{La commande \textbackslash diagbox} @@ -3998,10 +4003,13 @@ Part A & the first part \\ \vspace{1cm} +\emph{Attention} : La fonctionnalité suivante est fragile et ne fonctionne pas +avec le cheminement |latex|--|dvips|--|ps2pdf|.\par\nobreak + La clé |code| de la commande |\SubMatrix| permet d'insérer du code après la création de la matrice. Elle a surtout pour vocation d'être utilisée pour insérer des instructions TikZ, sachant que, dans les instructions TikZ insérées -dans cette clé, les nœuds de la forme |i-j| et \verb+i-|j+ sont interprétés avec +dans cette clé, les nœuds de la forme \verb+i-|j+ sont interprétés avec |i| et |j| étant des numéros de ligne et colonne \emph{relatifs à la sous-matrice}.\footnote{Attention : la syntaxe \texttt{j\string|-i} n'est \emph{pas} autorisée.} @@ -4150,11 +4158,11 @@ $\begin{pNiceMatrix} exécute avec TikZ le chemin rectangulaire qui correspond à chaque case du tableau, avec comme paramètres TikZ l'argument de |\TikzEveryCell|. Cet argument doit être une liste de couples \textsl{clé=valeur} applicables à un chemin -TikZ. En fait, cette commande s'applique à chaque cellule du tableau, exceptées +TikZ. En fait, cette commande s'applique à chaque case du tableau, exceptées celles situées dans les rangées et colonnes extérieures (cf.~p.~\pageref{exterior})o et celles situées dans les coins vides (quand la clé |corners| est utilisée: cf.~p.~\pageref{corners}). Elle s'applique en fait à chaque bloc (sauf ceux qui ont la clé |transparent|) et ne s'applique pas aux -cellules situées dans ces blocs. +cases situées dans ces blocs. \medskip En fait, dans la liste des clés passée en argument on peut mettre une clé @@ -4195,10 +4203,10 @@ l'argument de |\TikzEveryCell|. \bigskip La commande |\TikzEveryCell| possède deux clés : \begin{itemize} -\item avec la clé \Definition{empty}, la commande ne s'applique qu'aux cellules +\item avec la clé \Definition{empty}, la commande ne s'applique qu'aux cases vides ; \item avec la clé \Definition{non-empty}, la commande ne s'applique qu'aux -cellules non vides. +cases non vides. \end{itemize} @@ -4587,7 +4595,7 @@ d'avoir les notes calées à gauche, ce qui est plaisant si on compose des tableaux dans l'esprit de \pkg{booktabs} (voir par exemple la table~\ref{t:tabularnote}, p.~\pageref{t:tabularnote}). \medskip -La clé |notes/enumitem-keys| fournie par \pkg{nicematrix} permet modifier ce +La clé |notes/enumitem-keys| fournie par \pkg{nicematrix} permet de modifier ce type de liste de \pkg{enumitem} (en utilisant en interne la commande |\setlist*| de \pkg{enumitem}). @@ -5947,7 +5955,7 @@ clé |draw-first| : |\Ddots[draw-first]|\rlap{.} \label{empty-cells} Une instruction comme |\Ldots|, |\Cdots|, etc. essaye de déterminer la première -case vide de part et d'autre de la case considérée. Quand la clé |corners| +case non vide de part et d'autre de la case considérée. Quand la clé |corners| (cf.~p.~\pageref{corners}) est utilisée, les coins qui sont déterminés sont composés de cases vides. Néanmoins, une case «vide» n'est pas nécessairement sans contenu dans le codage TeX. Les règles précises sont les suivantes : @@ -5967,13 +5975,13 @@ la dernière case (deuxième rangée et deuxième colonne) est vide. \medskip \item Pour les colonnes de type |p|, |m|, |b|, |V|\footnote{Les colonnes de type |V| sont fournies par l'extension \pkg{varwidth}: cf.~p.~\pageref{varwidth}} -ou |X|\footnote{Voir p.~\pageref{colonne-X}}, la case est vide si (et seulement +ou |X|\footnote{Pour les colonnes |X|, voir p.~\pageref{colonne-X}}, la case est vide si (et seulement si) son contenu dans le codage TeX est vide (il n'y a que des espaces entre les deux esperluettes |&|). \medskip -\item Pour les colonnes de type |c|, |l|, |r| ou |w{...}{...}|, la case est -vide si (et seulement si) son rendu TeX est de largeur nulle. +\item Pour les colonnes de type |c|, |l|, |r|, |w{...}{...}| ou |W{...}{...}|, +la case est vide si (et seulement si) son rendu TeX est de largeur nulle. \medskip \item Une case qui contient la commande |\NotEmpty| est non vide (et un nœud diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf index 0184a263f72..c7eeb39bf47 100644 Binary files a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf and b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf differ diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex index 7eb1243f18f..7eb8e1783e0 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.tex @@ -616,9 +616,9 @@ There is also keys for the horizontal and vertical positions of the content of the block: cf.~\ref{horizontal-block} p.~\pageref{horizontal-block}. \interitem -{\bfseries One must remark that, by default, the commands |\Blocks| don't create space}. -There is exception only for the blocks mono-row and the blocks mono-column as -explained just below. +{\bfseries One must remark that, by default, the commands |\Blocks| don't create + space}. There is exception only for the blocks mono-column and the blocks +mono-row under some conditions as explained just below. \medskip In the following example, we have had to enlarge by hand the columns 2 and 3 @@ -707,7 +707,9 @@ Henry & 14 \\ \hline For the mono-row blocks, the natural height and depth are taken into account for the height and depth of the current row (as does a standard |\multicolumn| -of LaTeX). +of LaTeX), except when an option of vertical position has been used for the block +(one of the keys |t|, |b|, |v-center|, |T| and |B| described in the part +\ref{vertical-pos-block}, p.~\pageref{vertical-pos-block}). \subsection{The mono-cell blocks} @@ -873,6 +875,7 @@ Rank & \Block[C]{1-3}{First group} & & & \Block{1-3}{Second group} \\ \subsection{Vertical position of the content of the block} +\label{vertical-pos-block} For the vertical position, the command |\Blocks| accepts the keys |v-center|\footnote{That key could not have been named |c| since the key |c| @@ -3911,10 +3914,13 @@ p.~\pageref{submatrix-in-codebefore}. \vspace{1cm} +\emph{Caution} : The following functionnality is fragile and does not work with +the compilationn |latex|--|dvips|--|ps2pdf|.\par\nobreak + The key |code| of the command |\SubMatrix| allows the insertion of code after the construction of the submatrix. It's meant to be used to insert TikZ instructions because, in the TikZ instructions inserted by that code, the -nodes of the form |i-j| and \verb+i-|j+ are interpreted with |i| and |j| as +nodes of the form \verb+i-|j+ are interpreted with |i| and |j| as numbers of row and columns \emph{relative to the submatrix}.\footnote{Be careful: the syntax \verb+j|-i+ is \emph{not} allowed.} diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx index 4605970134c..6e883a8b82a 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix-code.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.25} -\def\myfiledate{2023/10/24} +\def\myfileversion{6.25a} +\def\myfiledate{2023/11/03} % % %<*batchfile> @@ -900,15 +900,15 @@ version 2005/12/01 or later. % The dimension |\l_@@_columns_width_dim| will be used when the options specify % that all the columns must have the same width (but, if the key |columns-width| % is used with the special value |auto|, the boolean -% |l_@@_auto_columns_width_bool| also will be raised). +% |\l_@@_auto_columns_width_bool| also will be raised). % \begin{macrocode} \dim_new:N \l_@@_columns_width_dim % \end{macrocode} % % \bigskip % The dimension |\l_@@_col_width_dim| will be available in each cell which -% belongs to a column of fixed width: |w{...}{...}|, |W{...}{...}|, |p{}|, -% |m{}|, |b{}| but also |X| (when the actual width of that column is known, that +% belongs to a column of fixed width: |w{...}{...}|, |W{...}{...}|, |p{...}|, +% |m{...}|, |b{...}| but also |X| (when the actual width of that column is known, that % is to say after the first compilation). It's the width of that column. It will % be used by some commands |\Block|. A non positive value means that the column % has no fixed width (it's a column of type |c|, |r|, |l|, etc.). @@ -1044,7 +1044,7 @@ version 2005/12/01 or later. % In a cell, it will be possible to know whether we are in a cell of a column of % type |X| thanks to that flag. % \begin{macrocode} -\bool_new:N \l_@@_X_column_bool +\bool_new:N \l_@@_X_bool % \end{macrocode} % % \begin{macrocode} @@ -2493,7 +2493,7 @@ version 2005/12/01 or later. % |\tl_put_right:Nn| and not |\tl_set:Nn| (or |.tl_set:N|) because we don't want % a direct use of |up=...| erased by a absent |^{...}|. % \begin{macrocode} - down .code:n = \tl_put_right:Nn \l_@@_xdots_down_tl { #1 } , % modified 2023-08-09 + down .code:n = \tl_put_right:Nn \l_@@_xdots_down_tl { #1 } , up .code:n = \tl_put_right:Nn \l_@@_xdots_up_tl { #1 } , middle .code:n = \tl_put_right:Nn \l_@@_xdots_middle_tl { #1 } , % \end{macrocode} @@ -4425,7 +4425,7 @@ version 2005/12/01 or later. \seq_gclear:N \g_@@_pos_of_blocks_seq % \end{macrocode} % In fact, the sequence |\g_@@_pos_of_blocks_seq| will also contain the -% positions of the cells with a |\diagbox|. +% positions of the cells with a |\diagbox| and the |\multicolumn|. % % \begin{macrocode} \seq_gclear:N \g_@@_pos_of_stroken_blocks_seq @@ -4992,7 +4992,7 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_make_preamble_i_i:n #1 { \str_if_eq:nnTF { #1 } | - { \@@_make_preamble_iii:n | } + { \use:c { @@ _ | } | } { \@@_make_preamble_i_ii:nn { } #1 } } % \end{macrocode} @@ -5149,7 +5149,7 @@ version 2005/12/01 or later. \str_set:Nn \l_@@_hpos_col_str { j } \tl_set:Nn \l_tmpa_tl { #1 } \@@_keys_p_column:V \l_tmpa_tl - \@@_make_preamble_ii_iv:nn { #2 } { minipage } + \@@_make_preamble_ii_iv:nnn { #2 } { minipage } { } } % \end{macrocode} % @@ -5161,9 +5161,10 @@ version 2005/12/01 or later. % % \medskip % The first argument is the width of the column. The second is the type of -% environment: |minipage| or |varwidth|. +% environment: |minipage| or |varwidth|. The third is some code added at the +% beginning of the cell. % \begin{macrocode} -\cs_new_protected:Npn \@@_make_preamble_ii_iv:nn #1 #2 +\cs_new_protected:Npn \@@_make_preamble_ii_iv:nnn #1 #2 #3 { \use:e { @@ -5192,6 +5193,7 @@ version 2005/12/01 or later. L { \exp_not:N \RaggedRight } R { \exp_not:N \RaggedLeft } } + #3 } { \str_if_eq:VnT \l_@@_vpos_col_str { m } \@@_center_cell_box: } { \str_if_eq:VnT \l_@@_hpos_col_str { si } \siunitx_cell_begin:w } @@ -5219,7 +5221,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip -% |#1| is the optional argument of |{minipage}| (or |{varwidth}|): |t| of |b|. +% |#1| is the optional argument of |{minipage}| (or |{varwidth}|): |t| or |b|. % Indeed, for the columns of type |m|, we use the value |b| here because there % is a special post-action in order to center vertically the box (see |#4|). % @@ -5260,7 +5262,11 @@ version 2005/12/01 or later. % \begin{macrocode} \dim_set:Nn \l_@@_col_width_dim { #2 } \@@_cell_begin:w - \begin { #7 } [ #1 ] { #2 } +% \end{macrocode} +% We use the form |\minipage|--|\endminipage| (|\varwidth|--|\endvarwidth|) for +% compatibility with \pkg{collcell} (2023-10-31). +% \begin{macrocode} + \use:c { #7 } [ #1 ] { #2 } % \end{macrocode} % The following lines have been taken from |array.sty|. % \begin{macrocode} @@ -5288,8 +5294,7 @@ version 2005/12/01 or later. % The following line has been taken from |array.sty|. % \begin{macrocode} \@finalstrut \@arstrutbox - % \bool_if:NT \g_@@_rotate_bool { \raggedright \hsize = 3 cm } - \end { #7 } + \use:c { end #7 } % \end{macrocode} % If the letter in the preamble is |m|, |#4| will be equal to % |\@@_center_cell_box:| (see just below). @@ -5302,35 +5307,50 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% +% \begin{macrocode} +\str_new:N \c_@@_ignorespaces_str +\str_set:Nx \c_@@_ignorespaces_str { \ignorespaces } +\str_remove_all:Nn \c_@@_ignorespaces_str { ~ } +% \end{macrocode} +% +% \bigskip +% In order to test whether a cell is empty, we test whether it begins by +% |\ignorespaces\unskip|. However, in some circunstancies, for example when +% |\collectcell| of \pkg{collcell} is used, the cell does not begin with +% |\ignorespaces|. In that case, we consider as not empty... +% +% First, we test if the next token is |\ignorespaces| and it's not very easy... % \begin{macrocode} -\cs_new_protected:Npn \@@_test_if_empty: \ignorespaces #1 +\cs_new_protected:Npn \@@_test_if_empty: { \peek_after:Nw \@@_test_if_empty_i: } +\cs_new_protected:Npn \@@_test_if_empty_i: + { + \str_set:Nx \l_tmpa_str { \token_to_meaning:N \l_peek_token } + \str_if_eq:NNT \l_tmpa_str \c_@@_ignorespaces_str + { \@@_test_if_empty:w } + } +\cs_new_protected:Npn \@@_test_if_empty:w \ignorespaces { \peek_meaning:NT \unskip { \tl_gput_right:Nn \g_@@_cell_after_hook_tl { \box_set_wd:Nn \l_@@_cell_box \c_zero_dim -% \end{macrocode} -% We put the following code in order to have a column with the correct width -% even when all the cells of the column are empty. -% \begin{macrocode} \skip_horizontal:N \l_@@_col_width_dim } } - #1 } -% \end{macrocode} -% +% \end{macrocode} +% % % \begin{macrocode} -\cs_new_protected:Npn \@@_test_if_empty_for_S: #1 +\cs_new_protected:Npn \@@_test_if_empty_for_S: { \peek_meaning:NT \__siunitx_table_skip:n { \tl_gput_right:Nn \g_@@_cell_after_hook_tl { \box_set_wd:Nn \l_@@_cell_box \c_zero_dim } } - #1 } % \end{macrocode} % @@ -5393,10 +5413,10 @@ version 2005/12/01 or later. \tl_set:Nn \l_tmpa_tl { #1 } \@@_keys_p_column:V \l_tmpa_tl \IfPackageLoadedTF { varwidth } - { \@@_make_preamble_ii_iv:nn { #2 } { varwidth } } + { \@@_make_preamble_ii_iv:nnn { #2 } { varwidth } { } } { \@@_error_or_warning:n { varwidth~not~loaded } - \@@_make_preamble_ii_iv:nn { #2 } { minipage } + \@@_make_preamble_ii_iv:nnn { #2 } { minipage } { } } } % \end{macrocode} @@ -5523,23 +5543,27 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_make_preamble_S_i:n #1 { - \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl - \tl_gclear:N \g_@@_pre_cell_tl - \tl_gput_right:Nn \g_@@_array_preamble_tl + \IfPackageLoadedTF { siunitx } { - > { - \@@_cell_begin:w - \keys_set:nn { siunitx } { #1 } - \siunitx_cell_begin:w + \tl_gput_right:NV \g_@@_array_preamble_tl \g_@@_pre_cell_tl + \tl_gclear:N \g_@@_pre_cell_tl + \tl_gput_right:Nn \g_@@_array_preamble_tl + { + > { + \@@_cell_begin:w + \keys_set:nn { siunitx } { #1 } + \siunitx_cell_begin:w + } + c + < { \siunitx_cell_end: \@@_cell_end: } } - c - < { \siunitx_cell_end: \@@_cell_end: } - } % \end{macrocode} % We increment the counter of columns and then we test for the presence of a |<|. % \begin{macrocode} - \int_gincr:N \c@jCol - \@@_rec_preamble_after_col:n + \int_gincr:N \c@jCol + \@@_rec_preamble_after_col:n + } + { \@@_fatal:n { siunitx~not~loaded } } } % \end{macrocode} % @@ -5827,16 +5851,17 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_X_columns_aux_bool { \exp_args:Nne - \@@_make_preamble_ii_iv:nn + \@@_make_preamble_ii_iv:nnn { \l_@@_weight_int \l_@@_X_columns_dim } { minipage } + { \@@_no_update_width: } } { \tl_gput_right:Nn \g_@@_array_preamble_tl { > { \@@_cell_begin:w - \bool_set_true:N \l_@@_X_column_bool + \bool_set_true:N \l_@@_X_bool % \end{macrocode} % You encounter a problem on 2023-03-04: for an environment with |X| columns, % during the first compilations (which are not the definitive one), sometimes, @@ -5869,6 +5894,15 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip +% \begin{macrocode} +\cs_new_protected:Npn \@@_no_update_width: + { + \tl_gput_right:Nn \g_@@_cell_after_hook_tl + { \cs_set_eq:NN \@@_update_max_cell_width: \prg_do_nothing: } + } +% \end{macrocode} +% +% \medskip % For the letter set by the user with |vlines-in-sub-matrix| (vlism). % \begin{macrocode} \cs_new_protected:Npn \@@_make_preamble_vlism:n #1 @@ -6863,13 +6897,13 @@ version 2005/12/01 or later. % \end{macrocode} % We compute in |\g_tmpa_skip| the common width of the columns (it's a skip and % not a dimension). We use a global variable because we are in a cell of an -% |\halign| and because we have to use this variable in other cells (of the same +% |\halign| and because we have to use that variable in other cells (of the same % row). The affectation of |\g_tmpa_skip|, like all the affectations, must be % done after the |\omit| of the cell. % % \smallskip -% We give a default value for |\g_tmpa_skip| (|0 pt plus 1 fill|) but it will -% just after be erased by a fixed value in the concerned cases. +% We give a default value for |\g_tmpa_skip| (|0 pt plus 1 fill|) but we will +% add some dimensions to it. % \begin{macrocode} \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } \bool_if:NF \l_@@_auto_columns_width_bool @@ -6878,8 +6912,8 @@ version 2005/12/01 or later. \bool_lazy_and:nnTF \l_@@_auto_columns_width_bool { \bool_not_p:n \l_@@_block_auto_columns_width_bool } - { \skip_gset_eq:NN \g_tmpa_skip \g_@@_max_cell_width_dim } - { \skip_gset_eq:NN \g_tmpa_skip \l_@@_columns_width_dim } + { \skip_gadd:Nn \g_tmpa_skip \g_@@_max_cell_width_dim } + { \skip_gadd:Nn \g_tmpa_skip \l_@@_columns_width_dim } \skip_gadd:Nn \g_tmpa_skip { 2 \col@sep } } \skip_horizontal:N \g_tmpa_skip @@ -11967,11 +12001,11 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% \section{The key corners} +% \section{The empty corners} % -% When the key |corners| is raised, the rules are not drawn in the -% corners. Of course, we have to compute the corners before we begin to draw the -% rules. +% When the key |corners| is raised, the rules are not drawn in the corners; they +% are not colored and |\TikzEveryCell| does not apply. Of course, we have to +% compute the corners before we begin to draw the rules. % % \begin{macrocode} \cs_new_protected:Npn \@@_compute_corners: @@ -12771,7 +12805,7 @@ version 2005/12/01 or later. % column, it's imperative. Otherwise, the process for the determination of the % widths of the columns will be wrong. % \begin{macrocode} - && ! \l_@@_X_column_bool + && ! \l_@@_X_bool } { \exp_args:Nee \@@_Block_iv:nnnnn } { \exp_args:Nee \@@_Block_v:nnnnn } @@ -12791,8 +12825,8 @@ version 2005/12/01 or later. % % |#1| is $i$ (the number of rows of the block), |#2| is $j$ (the number of % columns of the block), |#3| is the list of \textsl{key=values} pairs, |#4| are -% the tokens to put before the math mode and before the composition of the block -% and |#5| is the label (=content) of the block. +% the tokens to put before the potential math mode and before the composition of +% the block and |#5| is the label (=content) of the block. % \begin{macrocode} \cs_new_protected:Npn \@@_Block_iv:nnnnn #1 #2 #3 #4 #5 { @@ -12806,7 +12840,8 @@ version 2005/12/01 or later. { \int_use:N \c@jCol } { \int_eval:n { \c@iRow + #1 - 1 } } { \int_eval:n { \c@jCol + #2 - 1 } } - { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } + { \exp_not:n { ##1 } } + { \exp_not:n { ##2 } } } } \box_gclear_new:c @@ -12877,7 +12912,7 @@ version 2005/12/01 or later. { \int_compare_p:nNn { #2 } = 1 } % \end{macrocode} % Remind that, when the column has not a fixed width, the dimension -% |\l_@@_col_width_dim| has the conventionnal value of $-1$~cm. +% |\l_@@_col_width_dim| has the conventional value of $-1$~cm. % \begin{macrocode} { \dim_compare_p:n { \l_@@_col_width_dim >= \c_zero_dim } } { ! \g_@@_rotate_bool } @@ -12956,30 +12991,38 @@ version 2005/12/01 or later. } } % \end{macrocode} -% If we are in a mono-row block, we take into account the height and the -% depth of that block for the height and the depth of the row. +% If we are in a mono-row block and if that block has no vertical option for the +% position\footnote{If the block has a key of a vertical position, that means +% that it has to be put in a vertical space determined by the \emph{others} +% cells of the row. Therefore there is no point creating space here. Moreover, +% that would lead to problems when a multi-row block with a position key such as +% |b| or |B|.}, we take into account the height and the depth of that block for the +% height and the depth of the row. % \begin{macrocode} - \int_compare:nNnT { #1 } = 1 - { - \dim_gset:Nn \g_@@_blocks_ht_dim - { - \dim_max:nn - \g_@@_blocks_ht_dim - { - \box_ht:c - { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } - } - } - \dim_gset:Nn \g_@@_blocks_dp_dim - { - \dim_max:nn - \g_@@_blocks_dp_dim - { - \box_dp:c - { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } - } - } - } + \str_if_eq:VnT \l_@@_vpos_of_block_str { c } + { + \int_compare:nNnT { #1 } = 1 + { + \dim_gset:Nn \g_@@_blocks_ht_dim + { + \dim_max:nn + \g_@@_blocks_ht_dim + { + \box_ht:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + } + \dim_gset:Nn \g_@@_blocks_dp_dim + { + \dim_max:nn + \g_@@_blocks_dp_dim + { + \box_dp:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + } + } + } \seq_gput_right:Nx \g_@@_blocks_seq { \l_tmpa_tl @@ -16157,6 +16200,15 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { siunitx~not~loaded } + { + siunitx~not~loaded\\ + You~can't~use~the~columns~'S'~because~'siunitx'~is~not~loaded.\\ + That~error~is~fatal. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { ragged2e~not~loaded } { You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~ diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 520913cb4f4..f67f836841e 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.25} -\def\myfiledate{2023/10/24} +\def\myfileversion{6.25a} +\def\myfiledate{2023/11/03} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -406,7 +406,7 @@ \tl_new:N \l__nicematrix_rule_color_tl \bool_new:N \g__nicematrix_rotate_bool \bool_new:N \g__nicematrix_rotate_c_bool -\bool_new:N \l__nicematrix_X_column_bool +\bool_new:N \l__nicematrix_X_bool \bool_new:N \g__nicematrix_caption_finished_bool \tl_new:N \g__nicematrix_aux_tl \bool_new:N \g__nicematrix_aux_found_bool @@ -851,7 +851,7 @@ \hook_gput_code:nnn { begindocument } { . } { \dim_set:Nn \l__nicematrix_xdots_inter_dim { #1 } } , radius .value_required:n = true , - down .code:n = \tl_put_right:Nn \l__nicematrix_xdots_down_tl { #1 } , % modified 2023-08-09 + down .code:n = \tl_put_right:Nn \l__nicematrix_xdots_down_tl { #1 } , up .code:n = \tl_put_right:Nn \l__nicematrix_xdots_up_tl { #1 } , middle .code:n = \tl_put_right:Nn \l__nicematrix_xdots_middle_tl { #1 } , draw-first .code:n = \prg_do_nothing: , @@ -2222,7 +2222,7 @@ \cs_new_protected:Npn \__nicematrix_make_preamble_i_i:n #1 { \str_if_eq:nnTF { #1 } | - { \__nicematrix_make_preamble_iii:n | } + { \use:c { __nicematrix _ | } | } { \__nicematrix_make_preamble_i_ii:nn { } #1 } } \cs_new_protected:Npn \__nicematrix_make_preamble_i_ii:nn #1 #2 @@ -2322,12 +2322,12 @@ \str_set:Nn \l__nicematrix_hpos_col_str { j } \tl_set:Nn \l_tmpa_tl { #1 } \__nicematrix_keys_p_column:V \l_tmpa_tl - \__nicematrix_make_preamble_ii_iv:nn { #2 } { minipage } + \__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { } } \cs_new_protected:Npn \__nicematrix_keys_p_column:n #1 { \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl } \cs_generate_variant:Nn \__nicematrix_keys_p_column:n { V } -\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iv:nn #1 #2 +\cs_new_protected:Npn \__nicematrix_make_preamble_ii_iv:nnn #1 #2 #3 { \use:e { @@ -2350,6 +2350,7 @@ L { \exp_not:N \RaggedRight } R { \exp_not:N \RaggedLeft } } + #3 } { \str_if_eq:VnT \l__nicematrix_vpos_col_str { m } \__nicematrix_center_cell_box: } { \str_if_eq:VnT \l__nicematrix_hpos_col_str { si } \siunitx_cell_begin:w } @@ -2379,7 +2380,7 @@ > { \dim_set:Nn \l__nicematrix_col_width_dim { #2 } \__nicematrix_cell_begin:w - \begin { #7 } [ #1 ] { #2 } + \use:c { #7 } [ #1 ] { #2 } \everypar { \vrule height \box_ht:N \@arstrutbox width \c_zero_dim @@ -2394,14 +2395,23 @@ < { #6 \@finalstrut \@arstrutbox - % \bool_if:NT \g__nicematrix_rotate_bool { \raggedright \hsize = 3 cm } - \end { #7 } + \use:c { end #7 } #4 \__nicematrix_cell_end: } } } -\cs_new_protected:Npn \__nicematrix_test_if_empty: \ignorespaces #1 +\str_new:N \c__nicematrix_ignorespaces_str +\str_set:Nx \c__nicematrix_ignorespaces_str { \ignorespaces } +\str_remove_all:Nn \c__nicematrix_ignorespaces_str { ~ } +\cs_new_protected:Npn \__nicematrix_test_if_empty: { \peek_after:Nw \__nicematrix_test_if_empty_i: } +\cs_new_protected:Npn \__nicematrix_test_if_empty_i: + { + \str_set:Nx \l_tmpa_str { \token_to_meaning:N \l_peek_token } + \str_if_eq:NNT \l_tmpa_str \c__nicematrix_ignorespaces_str + { \__nicematrix_test_if_empty:w } + } +\cs_new_protected:Npn \__nicematrix_test_if_empty:w \ignorespaces { \peek_meaning:NT \unskip { @@ -2411,16 +2421,14 @@ \skip_horizontal:N \l__nicematrix_col_width_dim } } - #1 } -\cs_new_protected:Npn \__nicematrix_test_if_empty_for_S: #1 +\cs_new_protected:Npn \__nicematrix_test_if_empty_for_S: { \peek_meaning:NT \__siunitx_table_skip:n { \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl { \box_set_wd:Nn \l__nicematrix_cell_box \c_zero_dim } } - #1 } \cs_new_protected:Npn \__nicematrix_center_cell_box: { @@ -2458,10 +2466,10 @@ \tl_set:Nn \l_tmpa_tl { #1 } \__nicematrix_keys_p_column:V \l_tmpa_tl \IfPackageLoadedTF { varwidth } - { \__nicematrix_make_preamble_ii_iv:nn { #2 } { varwidth } } + { \__nicematrix_make_preamble_ii_iv:nnn { #2 } { varwidth } { } } { \__nicematrix_error_or_warning:n { varwidth~not~loaded } - \__nicematrix_make_preamble_ii_iv:nn { #2 } { minipage } + \__nicematrix_make_preamble_ii_iv:nnn { #2 } { minipage } { } } } \cs_new:Npn \__nicematrix_w { \__nicematrix_make_preamble_w:nnnn { } } @@ -2533,20 +2541,24 @@ { \__nicematrix_make_preamble_S_i:n { #1 } } \cs_new_protected:Npn \__nicematrix_make_preamble_S_i:n #1 { - \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl - \tl_gclear:N \g__nicematrix_pre_cell_tl - \tl_gput_right:Nn \g__nicematrix_array_preamble_tl + \IfPackageLoadedTF { siunitx } { - > { - \__nicematrix_cell_begin:w - \keys_set:nn { siunitx } { #1 } - \siunitx_cell_begin:w + \tl_gput_right:NV \g__nicematrix_array_preamble_tl \g__nicematrix_pre_cell_tl + \tl_gclear:N \g__nicematrix_pre_cell_tl + \tl_gput_right:Nn \g__nicematrix_array_preamble_tl + { + > { + \__nicematrix_cell_begin:w + \keys_set:nn { siunitx } { #1 } + \siunitx_cell_begin:w + } + c + < { \siunitx_cell_end: \__nicematrix_cell_end: } } - c - < { \siunitx_cell_end: \__nicematrix_cell_end: } + \int_gincr:N \c@jCol + \__nicematrix_rec_preamble_after_col:n } - \int_gincr:N \c@jCol - \__nicematrix_rec_preamble_after_col:n + { \__nicematrix_fatal:n { siunitx~not~loaded } } } \cs_new:cpn { __nicematrix _ \token_to_str:N ( } #1 #2 { @@ -2718,16 +2730,17 @@ \bool_if:NTF \l__nicematrix_X_columns_aux_bool { \exp_args:Nne - \__nicematrix_make_preamble_ii_iv:nn + \__nicematrix_make_preamble_ii_iv:nnn { \l__nicematrix_weight_int \l__nicematrix_X_columns_dim } { minipage } + { \__nicematrix_no_update_width: } } { \tl_gput_right:Nn \g__nicematrix_array_preamble_tl { > { \__nicematrix_cell_begin:w - \bool_set_true:N \l__nicematrix_X_column_bool + \bool_set_true:N \l__nicematrix_X_bool \NotEmpty \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl { \hbox_set:Nn \l__nicematrix_cell_box { } } @@ -2743,6 +2756,11 @@ \__nicematrix_rec_preamble_after_col:n } } +\cs_new_protected:Npn \__nicematrix_no_update_width: + { + \tl_gput_right:Nn \g__nicematrix_cell_after_hook_tl + { \cs_set_eq:NN \__nicematrix_update_max_cell_width: \prg_do_nothing: } + } \cs_new_protected:Npn \__nicematrix_make_preamble_vlism:n #1 { \seq_gput_right:Nx \g__nicematrix_cols_vlism_seq @@ -3327,8 +3345,8 @@ \bool_lazy_and:nnTF \l__nicematrix_auto_columns_width_bool { \bool_not_p:n \l__nicematrix_block_auto_columns_width_bool } - { \skip_gset_eq:NN \g_tmpa_skip \g__nicematrix_max_cell_width_dim } - { \skip_gset_eq:NN \g_tmpa_skip \l__nicematrix_columns_width_dim } + { \skip_gadd:Nn \g_tmpa_skip \g__nicematrix_max_cell_width_dim } + { \skip_gadd:Nn \g_tmpa_skip \l__nicematrix_columns_width_dim } \skip_gadd:Nn \g_tmpa_skip { 2 \col@sep } } \skip_horizontal:N \g_tmpa_skip @@ -6932,7 +6950,7 @@ \int_compare_p:nNn { \l_tmpb_int } = 1 ) && ! \tl_if_empty_p:n { #5 } - && ! \l__nicematrix_X_column_bool + && ! \l__nicematrix_X_bool } { \exp_args:Nee \__nicematrix_Block_iv:nnnnn } { \exp_args:Nee \__nicematrix_Block_v:nnnnn } @@ -6950,7 +6968,8 @@ { \int_use:N \c@jCol } { \int_eval:n { \c@iRow + #1 - 1 } } { \int_eval:n { \c@jCol + #2 - 1 } } - { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } + { \exp_not:n { ##1 } } + { \exp_not:n { ##2 } } } } \box_gclear_new:c @@ -7033,27 +7052,30 @@ } } } - \int_compare:nNnT { #1 } = 1 - { - \dim_gset:Nn \g__nicematrix_blocks_ht_dim - { - \dim_max:nn - \g__nicematrix_blocks_ht_dim - { - \box_ht:c - { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } - } - } - \dim_gset:Nn \g__nicematrix_blocks_dp_dim - { - \dim_max:nn - \g__nicematrix_blocks_dp_dim - { - \box_dp:c - { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } - } - } - } + \str_if_eq:VnT \l__nicematrix_vpos_of_block_str { c } + { + \int_compare:nNnT { #1 } = 1 + { + \dim_gset:Nn \g__nicematrix_blocks_ht_dim + { + \dim_max:nn + \g__nicematrix_blocks_ht_dim + { + \box_ht:c + { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } + } + } + \dim_gset:Nn \g__nicematrix_blocks_dp_dim + { + \dim_max:nn + \g__nicematrix_blocks_dp_dim + { + \box_dp:c + { g__nicematrix_ block _ box _ \int_use:N \g__nicematrix_block_box_int _ box } + } + } + } + } \seq_gput_right:Nx \g__nicematrix_blocks_seq { \l_tmpa_tl @@ -9233,6 +9255,12 @@ in~order~to~use~the~key~'\l_keys_key_str'.\\ That~key~will~be~ignored. } +\__nicematrix_msg_new:nn { siunitx~not~loaded } + { + siunitx~not~loaded\\ + You~can't~use~the~columns~'S'~because~'siunitx'~is~not~loaded.\\ + That~error~is~fatal. + } \__nicematrix_msg_new:nn { ragged2e~not~loaded } { You~have~to~load~'ragged2e'~in~order~to~use~the~key~'\l_keys_key_str'~in~ -- cgit v1.2.3