From 9c5706814f2f593a9f52c51ad02b61e9bacd9ee4 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 24 Jul 2021 03:01:03 +0000 Subject: CTAN sync 202107240301 --- .../latex/contrib/nicematrix/nicematrix-french.pdf | Bin 463891 -> 466543 bytes .../latex/contrib/nicematrix/nicematrix-french.tex | 84 ++++- macros/latex/contrib/nicematrix/nicematrix.dtx | 416 +++++++++++++++++---- macros/latex/contrib/nicematrix/nicematrix.pdf | Bin 1339461 -> 1355018 bytes 4 files changed, 399 insertions(+), 101 deletions(-) (limited to 'macros/latex/contrib/nicematrix') diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf index 8f455bfe5d..6965309fe9 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix-french.pdf and b/macros/latex/contrib/nicematrix/nicematrix-french.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex index 4db0a583f1..d941d2f9f8 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -29,8 +29,6 @@ \titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex} \titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex} -\usepackage{multicol} -\setlength{\columnseprule}{0.4pt} \def\LetterAt{@} \def\interitem{\vspace{7mm plus 2 mm minus 3mm}} @@ -524,7 +522,7 @@ couleur ; couleur (la valeur par défaut de cette clé est la couleur courante des filets du tableau) ; \item la clé |color| prend en argument une couleur et l'applique au contenu et -trace également le cadre avec cette couleur. +trace également le cadre avec cette couleur ; \item la clé |line-width| fixe la largeur des filets servant pour le cadre (n'a d'intérêt que si |draw| ou |hvlines| est utilisée) ; \item la clé |rounded-corners| impose des coins arrondis (pour le cadre dessiné @@ -536,7 +534,15 @@ cette clé prend comme valeur une liste d'éléments parmi les suivants : |left| |right|, |top| et |bottom| ; \item les clés |t| et |b| réglent la ligne de base qui sera donnée au bloc quand celui-ci est constitué de plusieurs lignes (séparées par la commande |\\|) ; -\item la clé |hvlines| trace tous les filets horizontaux et verticaux dans le bloc. +\item la clé |hvlines| trace tous les filets horizontaux et verticaux dans le +bloc ; +\item \colorbox{yellow!50}{\textbf{Nouveau 5.19}}\enskip quand la clé |tikz| est +utilisée, le chemin Tikz correspondant au rectangle délimitant le bloc est +exécuté avec Tikz\footnote{Tikz doit être chargé préalablement (par défaut, + \pkg{nicematrix} ne charge que \textsc{pgf}), faute de quoi, une erreur sera + levée.} en utilisant comme options la valeur de cette clé |tikz| (qui doit +donc être une liste de clés Tikz applicables à un chemin de Tikz). Pour des +exemple d'utilisation de cette clé |tikz|, voir p.~\pageref{tikz-key-examples}. \end{itemize} @@ -932,7 +938,7 @@ p.~\pageref{OnlyMainNiceMatrix}. Les outils proposés par \pkg{nicematrix} pour tracer des filets sont les suivants : \begin{itemize} -\item les clés |hlines|, |vlines| et |hvlines| ; +\item les clés |hlines|, |vlines|, |hvlines| et |hvlines-except-borders|; \item le spécificateur «\verb+|+» dans le préambule (pour les environnements à préambule) ; \item la commande |\Hline|. @@ -986,7 +992,7 @@ $\begin{pNiceMatrix}[vlines,rules/width=0.2pt] -\subsubsection{La clé hvlines} +\subsubsection{Les clés hvlines et hvlines-except-borders} \label{hvlines} La clé |hvlines|, qui ne prend pas de valeur, est la conjonction des clés @@ -1739,7 +1745,7 @@ Dupont & Chantal & 15 janvier 1998 \\ \colorbox{yellow!50}{\bfseries Nouveau 5.18}\enskip La commande |\RowStyle| prend en argument des instructions de mise en forme qui seront appliquées à -chacune des cellules restantes sur la rangée en cours. +chacune des cases restantes sur la rangée en cours. \medskip Elle prend aussi en premier argument optionnel, entre crochets, une liste de @@ -2902,8 +2908,8 @@ fin de tableau selon un type de liste défini par l'extension \pkg{enumitem}. \begin{scope} \fvset{commandchars=\~\#\!} \begin{Verbatim} -\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -\toprule +\begin{NiceTabular}{@{}llr@{}} +\toprule \RowStyle{\bfseries} Nom & Prénom & Date de naissance \\ \midrule Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}! @@ -2918,8 +2924,8 @@ Dupont & Chantal & 15 janvier 1998 \\ \end{scope} \begin{center} -\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -\toprule +\begin{NiceTabular}{@{}llr@{}} +\toprule \RowStyle{\bfseries} Nom & Prénom & Date de naissance \\ \midrule Achard\tabularnote{La famille Achard est une très ancienne famille du Poitou.} @@ -3844,11 +3850,11 @@ noix & noisette & brugnon Les nœuds que l'on vient de décrire ne sont pas accessibles par défaut dans le |\CodeBefore| (décrit p.~\pageref{code-before}). \par\nobreak -\colorbox{yellow!50}{\textbf{Nouveau 5.16}}\enskip On peut rendre ces nœuds -accessibles dans le |\CodeBefore| en utilisant la clé |create-cell-nodes| du -mot-clé |\CodeBefore| (dans ce cas-là, les nœuds sont créés une première fois -avant la construction du tableau en utilisant des informations écrites dans le -fichier |aux| puis recréés lors de la composition du tableau proprement dit). +On peut rendre ces nœuds accessibles dans le |\CodeBefore| en utilisant la clé +|create-cell-nodes| du mot-clé |\CodeBefore| (dans ce cas-là, les nœuds sont +créés une première fois avant la construction du tableau en utilisant des +informations écrites dans le fichier |aux| puis recréés lors de la composition +du tableau proprement dit). \subsection{Les nœuds indiquant la position des filets} @@ -4294,6 +4300,44 @@ L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess \section{Exemples} +\subsection{Utilisation de la clé «tikz» de la commande \textbackslash Block} + +\label{tikz-key-examples} + + +\begin{Verbatim} +\ttfamily \small +\begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines] + \Block[~emphase#tikz={pattern=grid,pattern color=lightgray}@]{} + {pattern = grid,\\ pattern color = lightgray} +& \Block[~emphase#tikz={pattern = north west lines,pattern color=blue}@]{} + {pattern = north west lines,\\ pattern color = blue} +& \Block[~emphase#tikz={outer color = red!50, inner color=white }@]{2-1} + {outer color = red!50,\\ inner color = white} \\ + \Block[~emphase#tikz={pattern = sixpointed stars, pattern color = blue!15}@]{} + {pattern = sixpointed stars,\\ pattern color = blue!15} +& \Block[~emphase#tikz={left color = blue!50}@]{} + {left color = blue!50} \\ +\end{NiceTabular} +\end{Verbatim} + +\begin{center} +\ttfamily \small +\begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines] + \Block[tikz={pattern=grid,pattern color=lightgray}]{} + {pattern = grid,\\ pattern color = lightgray} +& \Block[tikz={pattern = north west lines,pattern color=blue}]{} + {pattern = north west lines,\\ pattern color = blue} +& \Block[tikz={outer color = red!50, inner color=white }]{2-1} + {outer color = red!50,\\ inner color = white} \\ + \Block[tikz={pattern = sixpointed stars, pattern color = blue!15}]{} + {pattern = sixpointed stars,\\ pattern color = blue!15} +& \Block[tikz={left color = blue!50}]{} + {left color = blue!50} \\ +\end{NiceTabular} +\end{center} + + \subsection{Notes dans les tableaux} \label{ex:notes} @@ -4362,8 +4406,8 @@ nombre total de notes dans le tableau). On utilise alors la clé |widest*| de \ExplSyntaxOff \fvset{commandchars=\~\#\!} \begin{Verbatim} -\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -\toprule +\begin{NiceTabular}{@{}llr@{}} +\toprule \RowStyle{\bfseries} Nom & Prénom & Date de naissance \\ \midrule Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}! @@ -4377,8 +4421,8 @@ Dupont & Chantal & 15 janvier 1998 \\ \end{Verbatim} \begin{center} -\begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -\toprule +\begin{NiceTabular}{@{}llr@{}} +\toprule \RowStyle{\bfseries} Nom & Prénom & Date de naissance \\ \midrule Achard\tabularnote{La famille Achard est une très ancienne famille du Poitou.} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index fdaa5ac42a..095a776390 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{5.18} -\def\myfiledate{2021/07/15} +\def\myfileversion{5.19} +\def\myfiledate{2021/07/23} % % %<*batchfile> @@ -65,8 +65,6 @@ version 2005/12/01 or later. \usepackage{titlesec} \titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex} \titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex} -\usepackage{multicol} -\setlength{\columnseprule}{0.4pt} \usepackage{footnotehyper} \usepackage{varwidth} \def\LetterAt{@} @@ -160,7 +158,7 @@ version 2005/12/01 or later. % The package \pkg{nicematrix} is entirely contained in the file % |nicematrix.sty|. This file may be put in the current directory or in a % |texmf| tree. However, the best is to install \pkg{nicematrix} with a TeX -% distribution as MiKTeX, TeXlive or MacTeX. +% distribution such as MiKTeX, TeXlive or MacTeX. % % \bigskip % \emph{Remark}: If you use LaTeX via Internet with, for example, Overleaf, you @@ -583,7 +581,15 @@ version 2005/12/01 or later. % by |left|, |right|, |top| and |bottom|; % \item the keys |t| and |b| fix the base line that will be given to the block % when it has a multi-line content (the lines are separated by |\\|); -% \item the keys |hvlines| draws all the vertical and horizontal rules in the block. +% \item the keys |hvlines| draws all the vertical and horizontal rules in the +% block; +% \item \colorbox{yellow!50}{\textbf{New 5.19}}\enskip when the key |tikz| is +% used, the Tikz path corresponding of the rectangle which delimits the block is +% executed with Tikz\footnote{Tikz should be loaded (by default, +% \pkg{nicematrix} only loads \textsc{pgf}) and, if it's not, an error will be +% raised.} by using as options the value of that key |tikz| (which must be a +% list of keys allowed for a Tikz path). For examples, cf. +% p.~\pageref{tikz-key-examples}. % \end{itemize} % % \interitem @@ -955,7 +961,7 @@ version 2005/12/01 or later. % % Here are the tools provided by \pkg{nicematrix} for the rules. % \begin{itemize} -% \item the keys |hlines|, |vlines| and |hvlines|; +% \item the keys |hlines|, |vlines|, |hvlines| and |hvlines-except-borders|; % \item the specifier ``\verb+|+'' in the preamble (for the environments with % preamble); % \item the command |\Hline|. @@ -967,7 +973,7 @@ version 2005/12/01 or later. % \begin{itemize} % \item These blocks are: % \begin{itemize} -% \item the blocks created by the command |\Block|\footnote{And also the command \verb|\multicolumn| also +% \item the blocks created by the command |\Block|\footnote{And also the command \verb|\multicolumn| but % it's recommended to use instead |\Block| in the environments of % \pkg{nicematrix}.} presented % p.~\pageref{Block}; @@ -1007,7 +1013,7 @@ version 2005/12/01 or later. % % % -% \subsubsection{The key hvlines} +% \subsubsection{The keys hvlines and hvlines-except-borders} % \label{hvlines} % % The key |hvlines| (no value) is the conjonction of the keys |hlines| and |vlines|. @@ -1035,7 +1041,7 @@ version 2005/12/01 or later. % % \bigskip % \colorbox{yellow!50}{\bfseries New 5.17}\enskip The key -% |hvlines-except-corners| is similar to the key |hvlines| but does not draw the +% |hvlines-except-borders| is similar to the key |hvlines| but does not draw the % rules on the horizontal and vertical borders of the array. % % \subsubsection{The (empty) corners} @@ -1438,7 +1444,7 @@ version 2005/12/01 or later. % \begin{BVerbatim}[boxwidth=9cm,baseline=c] % $\begin{NiceArray}{lll}[hvlines] % \CodeBefore -% ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@ +% ~emphase#\rowcolor{red!15}{1,3-5,8-}@ % \Body % a_1 & b_1 & c_1 \\ % a_2 & b_2 & c_2 \\ @@ -2670,7 +2676,7 @@ version 2005/12/01 or later. % \bigskip % \colorbox{yellow!50}{\bfseries New 5.18}\enskip In fact, the command % |\SubMatrix| also takes in two optional arguments specified by the -% traditionnal symbols |^| and |_| for material in superscript and subscript. +% traditional symbols |^| and |_| for material in superscript and subscript. % % \medskip % \begin{scope} @@ -2697,7 +2703,7 @@ version 2005/12/01 or later. % \bigskip % The options of the command |\SubMatrix| are as follows: % \begin{itemize} -% \item |left-xshift| and |right-shift| shift horizontally the delimiters (there +% \item |left-xshift| and |right-xshift| shift horizontally the delimiters (there % exists also the key |xshift| which fixes both parameters); % \item |extra-height| adds a quantity to the total height of the delimiters % (height |\ht| + depth |\dp|); @@ -2869,8 +2875,8 @@ version 2005/12/01 or later. % \begin{scope} % \fvset{commandchars=\~\#\!} % \begin{Verbatim} -% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -% \toprule +% \begin{NiceTabular}{@{}llr@{}} +% \toprule \RowStyle{\bfseries} % Last name & First name & Birth day \\ % \midrule % Achard\tabularnote{~emphase#Achard is an old family of the Poitou.!} @@ -2885,8 +2891,8 @@ version 2005/12/01 or later. % \end{scope} % % \begin{center} -% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -% \toprule +% \begin{NiceTabular}{@{}llr@{}} +% \toprule \RowStyle{\bfseries} % Last name & First name & Birth day \\ % \midrule % Achard\tabularnote{Achard is an old family of the Poitou.} @@ -3796,11 +3802,11 @@ version 2005/12/01 or later. % The nodes we have described are not available by default in the |\CodeBefore| % (described p.~\pageref{code-before}).\par\nobreak % -% \colorbox{yellow!50}{\textbf{New 5.16}}\enskip It's possible to have these -% nodes available in the |\CodeBefore| by using the key |create-cell-nodes| of -% the keyword |\CodeBefore| (in that case, the nodes are created first before -% the construction of the array by using informations written on the |aux| file -% and created a second time during the contruction of the array itself). +% It's possible to have these nodes available in the |\CodeBefore| by using the +% key |create-cell-nodes| of the keyword |\CodeBefore| (in that case, the nodes +% are created first before the construction of the array by using informations +% written on the |aux| file and created a second time during the contruction of +% the array itself). % % \subsection{The nodes which indicate the position of the rules} % @@ -4232,6 +4238,43 @@ version 2005/12/01 or later. % % \section{Examples} % +% \subsection{Utilisation of the key ``tikz'' of the command \textbackslash Block} +%\label{tikz-key-examples} +% +% +% \begin{Verbatim} +% \ttfamily \small +% \begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines] +% \Block[~emphase#tikz={pattern=grid,pattern color=lightgray}@]{} +% {pattern = grid,\\ pattern color = lightgray} +% & \Block[~emphase#tikz={pattern = north west lines,pattern color=blue}@]{} +% {pattern = north west lines,\\ pattern color = blue} +% & \Block[~emphase#tikz={outer color = red!50, inner color=white }@]{2-1} +% {outer color = red!50,\\ inner color = white} \\ +% \Block[~emphase#tikz={pattern = sixpointed stars, pattern color = blue!15}@]{} +% {pattern = sixpointed stars,\\ pattern color = blue!15} +% & \Block[~emphase#tikz={left color = blue!50}@]{} +% {left color = blue!50} \\ +% \end{NiceTabular} +% \end{Verbatim} +% +% \begin{center} +% \ttfamily \small +% \begin{NiceTabular}{m{4.5cm}m{4.5cm}m{4.5cm}}[hvlines] +% \Block[tikz={pattern=grid,pattern color=lightgray}]{} +% {pattern = grid,\\ pattern color = lightgray} +% & \Block[tikz={pattern = north west lines,pattern color=blue}]{} +% {pattern = north west lines,\\ pattern color = blue} +% & \Block[tikz={outer color = red!50, inner color=white }]{2-1} +% {outer color = red!50,\\ inner color = white} \\ +% \Block[tikz={pattern = sixpointed stars, pattern color = blue!15}]{} +% {pattern = sixpointed stars,\\ pattern color = blue!15} +% & \Block[tikz={left color = blue!50}]{} +% {left color = blue!50} \\ +% \end{NiceTabular} +% \end{center} +% +% % \subsection{Notes in the tabulars} % % \label{ex:notes} @@ -4302,8 +4345,8 @@ version 2005/12/01 or later. % } % \ExplSyntaxOff % \begin{Verbatim} -% \begin{NiceTabular}{~@{}llr~@{}}[first-row,code-for-first-row = \bfseries] -% \toprule +% \begin{NiceTabular}{~@{}llr~@{}} +% \toprule \RowStyle{\bfseries} % Last name & First name & Birth day \\ % \midrule % Achard\tabularnote{~emphase#Achard is an old family of the Poitou.@} @@ -4317,8 +4360,8 @@ version 2005/12/01 or later. % \end{Verbatim} % % \begin{center} -% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries] -% \toprule +% \begin{NiceTabular}{@{}llr@{}} +% \toprule \RowStyle{\bfseries} % Last name & First name & Birth day \\ % \midrule % Achard\tabularnote{Achard is an old family of the Poitou.} @@ -5002,7 +5045,8 @@ version 2005/12/01 or later. % \end{macrocode} % % -% We give the traditional declaration of a package written with |expl3|: +% We give the traditional declaration of a package written with the L3 +% programming layer. % \begin{macrocode} \RequirePackage{l3keys2e} \ProvidesExplPackage @@ -5250,10 +5294,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% We need that line for the case where you use \verb+||+ with \pkg{colortbl} loaded. -% \begin{macrocode} -\cs_set_protected:Npn \CT@drsc@ { } -% \end{macrocode} % % \bigskip % We have to redefine |\cline| for several reasons. The command |\@@_cline| will @@ -5478,7 +5518,8 @@ version 2005/12/01 or later. % For compatibility with versions prior to 5.0, we provide a load-time option % |define_L_C_R|. With this option, it's possible to use the letters |L|, |C| % and |R| instead of |l|, |c| and |r| in the preamble of the environments of -% \pkg{nicematrix} as it was mandatory before version~5.0. +% \pkg{nicematrix} as it was mandatory before version~5.0. This key will +% probably be deleted in a future version. % \begin{macrocode} \bool_new:N \c_@@_define_L_C_R_bool % \end{macrocode} @@ -5639,6 +5680,7 @@ version 2005/12/01 or later. \tl_new:N \g_@@_aux_tl % \end{macrocode} % +% % \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_test_if_math_mode: @@ -5743,6 +5785,21 @@ version 2005/12/01 or later. \tl_new:N \l_@@_rules_color_tl % \end{macrocode} % +% \bigskip +% The number of letters |X| in the preamble of the array. +% \begin{macrocode} +\int_new:N \g_@@_nb_of_X_int +% \end{macrocode} +% +% If there is at least one |X|-column in the preamble of the array, the +% following flag will be raised via the |aux| file. The length +% |l_@@_x_columns_dim| will be the width of the |X|-columns. That value is +% computed after the contruction of the array during the first compilation in +% order to be used in the following run. +% \begin{macrocode} +\bool_new:N \l_@@_X_columns_aux_bool +\dim_new:N \l_@@_X_columns_dim +% \end{macrocode} % % \bigskip % This boolean will be used only to detect in an expandable way whether we are @@ -5805,9 +5862,9 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% \pkg{expl3} provides scratch dimensions |\l_tmpa_dim| and |\l_tmpb_dim|. We -% creates two more in the same spirit (if they don't exist yet: that's why we -% use |\dim_zero_new:N|). +% The L3 programming layer provides scratch dimensions |\l_tmpa_dim| and +% |\l_tmpb_dim|. We creates two more in the same spirit (if they don't exist +% yet: that's why we use |\dim_zero_new:N|). % \begin{macrocode} \dim_zero_new:N \l_tmpc_dim \dim_zero_new:N \l_tmpd_dim @@ -5933,11 +5990,12 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip -% The following parameters correspond to the keys |fill|, |draw|, |borders| and -% |rounded-corners| of the command |\Block|. +% The following parameters correspond to the keys |fill|, |draw|, |tikz|, |borders|, +% and |rounded-corners| of the command |\Block|. % \begin{macrocode} \tl_new:N \l_@@_fill_tl \tl_new:N \l_@@_draw_tl +\seq_new:N \l_@@_tikz_seq \clist_new:N \l_@@_borders_clist \dim_new:N \l_@@_rounded_corners_dim % \end{macrocode} @@ -5946,8 +6004,7 @@ version 2005/12/01 or later. % |corners| is used). % % \medskip -% The following token list correspond to the key |color| of the command -% |\Block|. +% The following token list correspond to the key |color| of the command |\Block|. % \begin{macrocode} \tl_new:N \l_@@_color_tl % \end{macrocode} @@ -7126,7 +7183,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Cell: { - \tl_gclear:N \g_@@_exit_cell_tl +% \end{macrocode} +% The token list |\g_@@_post_treatment_cell_tl| will be set during the +% composition of the box |\l_@@_cell_box| and will be used \emph{after} the +% composition in order to modify that box (that's why it's called a +% \emph{post-treatment}). +% \begin{macrocode} + \tl_gclear:N \g_@@_post_treatment_cell_tl % \end{macrocode} % At the beginning of the cell, we link |\CodeAfter| to a command which do % \emph{not} begin with |\omit| (whereas the standard version of |\CodeAfter| @@ -7285,7 +7348,12 @@ version 2005/12/01 or later. { \@@_math_toggle_token: \hbox_set_end: - \g_@@_exit_cell_tl +% \end{macrocode} +% The token list |\g_@@_post_treatment_cell_tl| is (potentially) set during the +% composition of the box |\l_@@_cell_box| and is used now \emph{after} the +% composition in order to modify that box. +% \begin{macrocode} + \g_@@_post_treatment_cell_tl \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: \@@_adjust_size_box: % \end{macrocode} @@ -8044,7 +8112,7 @@ version 2005/12/01 or later. { \tl_gput_right:Nn \g_@@_row_style_tl { - \tl_gput_right:Nn \g_@@_exit_cell_tl + \tl_gput_right:Nn \g_@@_post_treatment_cell_tl { \dim_set:Nn \l_@@_cell_space_top_limit_dim { #1 } } } } , @@ -8053,7 +8121,7 @@ version 2005/12/01 or later. { \tl_gput_right:Nn \g_@@_row_style_tl { - \tl_gput_right:Nn \g_@@_exit_cell_tl + \tl_gput_right:Nn \g_@@_post_treatment_cell_tl { \dim_set:Nn \l_@@_cell_space_bottom_limit_dim { #1 } } } } , @@ -8439,6 +8507,29 @@ version 2005/12/01 or later. % End of the construction of the array (in the box |\l_@@_the_array_box|). % % \bigskip +% Now, if there is at least one |X|-column in the environment, we compute the +% width that those columns will have (in the next compilation). +% \begin{macrocode} + \int_compare:nNnT \g_@@_nb_of_X_int > 0 + { + \bool_if:NTF \l_@@_X_columns_aux_bool + { \dim_set_eq:NN \l_tmpa_dim \l_@@_X_columns_dim } + { + \dim_set:Nn \l_tmpa_dim + { + ( \textwidth - \box_wd:N \l_@@_the_array_box ) + / \int_use:N \g_@@_nb_of_X_int + } + } + \tl_gput_right:Nx \g_@@_aux_tl + { + \bool_set_true:N \l_@@_X_columns_aux_bool + \dim_set:Nn \l_@@_X_columns_dim { \dim_use:N \l_tmpa_dim } + } + } +% \end{macrocode} +% +% \bigskip % It the user has used the key |last-row| with a value, we control that the % given value is correct (since we have just constructed the array, we know the % real number of rows of the array). @@ -8626,10 +8717,11 @@ version 2005/12/01 or later. % current environment. % \begin{macrocode} \iow_now:Nn \@mainaux { \ExplSyntaxOn } + \iow_now:Nn \@mainaux { \char_set_catcode_space:n { 32 } } \iow_now:Nx \@mainaux { \tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl } - \iow_newline: { \iow_newline: \exp_not:V \g_@@_aux_tl } + { \exp_not:V \g_@@_aux_tl } } \iow_now:Nn \@mainaux { \ExplSyntaxOff } % \end{macrocode} @@ -8660,7 +8752,7 @@ version 2005/12/01 or later. % using |\newcolumntype|). % % Since we use the tools of \pkg{array} to do this expansion, we will have a -% programmation which is not in the style of \pkg{expl3}. +% programmation which is not in the style of the L3 programming layer. % % % \bigskip @@ -8686,7 +8778,7 @@ version 2005/12/01 or later. % \end{macrocode} % % First, we have to store our preamble in the token register |\@temptokena| -% (those ``token registers'' are \emph{not} supported by \pkg{expl3}). +% (those ``token registers'' are \emph{not} supported by the L3 programming layer). % \begin{macrocode} \exp_args:NV \@temptokena \g_@@_preamble_tl % \end{macrocode} @@ -8729,6 +8821,10 @@ version 2005/12/01 or later. } } % \end{macrocode} +% The number of letters |X| in the preamble of the array. +% \begin{macrocode} + \int_gzero:N \g_@@_nb_of_X_int +% \end{macrocode} % The sequence |\g_@@_cols_vlsim_seq| will contain the numbers of the columns % where you will to have to draw vertical lines in the potential sub-matrices % (hence the name |vlism|). @@ -8784,7 +8880,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% We complete the preamble with the potential ``exterior columns''. +% We complete the preamble with the potential ``exterior columns'' (on both sides). % \begin{macrocode} \int_compare:nNnTF \l_@@_first_col_int = 0 { \tl_gput_left:NV \g_@@_preamble_tl \c_@@_preamble_first_col_tl } @@ -8811,7 +8907,7 @@ version 2005/12/01 or later. { \tl_gput_right:Nn \g_@@_preamble_tl { @ { } } } } % \end{macrocode} -% We add a last column to raise a good error message when the user put more +% We add a last column to raise a good error message when the user puts more % columns than allowed by its preamble. However, for technical reasons, it's not % possible to do that in |{NiceTabular*}| (|\l_@@_tabular_width_dim|=0pt). % \begin{macrocode} @@ -8837,8 +8933,8 @@ version 2005/12/01 or later. @ { \@@_patch_preamble_ii:nn #1 } | { \@@_patch_preamble_iii:n #1 } p { \@@_patch_preamble_iv:nnn t #1 } - m { \@@_patch_preamble_iv:nnn c #1 } b { \@@_patch_preamble_iv:nnn b #1 } + m { \@@_patch_preamble_iv:nnn b #1 } \@@_w: { \@@_patch_preamble_v:nnnn { } #1 } \@@_W: { \@@_patch_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 } \@@_true_c: { \@@_patch_preamble_vi:n #1 } @@ -8848,6 +8944,7 @@ version 2005/12/01 or later. ) { \@@_patch_preamble_viii:nn #1 } ] { \@@_patch_preamble_viii:nn #1 } \} { \@@_patch_preamble_viii:nn #1 } + X { \@@_patch_preamble_xii: } C { \@@_error:nn { old~column~type } #1 } L { \@@_error:nn { old~column~type } #1 } R { \@@_error:nn { old~column~type } #1 } @@ -8959,7 +9056,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip -% For |p|, |m| and |b| +% For |p| and |b| % \begin{macrocode} \cs_new_protected:Npn \@@_patch_preamble_iv:nnn #1 #2 #3 { @@ -8968,14 +9065,29 @@ version 2005/12/01 or later. > { \@@_Cell: \begin { minipage } [ #1 ] { \dim_eval:n { #3 } } - \mode_leave_vertical: +% \end{macrocode} +% The following lines have been taken from |array.sty|. +% \begin{macrocode} + \everypar + { + \vrule height \box_ht:N \@arstrutbox width \c_zero_dim + \everypar { } + } + \g_@@_row_style_tl % added the 2021-07-17 \arraybackslash - \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt } c < { - \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt +% \end{macrocode} +% The following line has been taken from |array.sty|. +% \begin{macrocode} + \@finalstrut \@arstrutbox \end { minipage } +% \end{macrocode} +% If the letter in the preamble is |m|, you require a post-treatment for the box +% |\l_@@_cell_box|. +% \begin{macrocode} + \str_if_eq:nnT { #2 } m \@@_center_cell_box: \@@_end_Cell: } } @@ -8987,6 +9099,42 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% The following command will be used in |m|-columns in order to center +% vertically the box. In fact, despite its name, the command does not always +% center the cell. Indeed, if there is only one row in the cell, it should not +% be centered vertically. It's not possible to know the number of rows of the +% cell. However, you consider (as in \pkg{array}) that if the height of the cell +% is no more that the height of |\@arstrutbox|, there is only one row. +% \begin{macrocode} +\cs_new_protected:Npn \@@_center_cell_box: + { +% \end{macrocode} +% By putting instructions in |\g_@@_post_treatment_cell_tl|, we require a +% post-treatment of the box |\l_@@_cell_box|. +% \begin{macrocode} + \tl_gput_right:Nn \g_@@_post_treatment_cell_tl + { + \int_compare:nNnT + { \box_ht:N \l_@@_cell_box } + > + { \box_ht:N \@arstrutbox } + { + \hbox_set:Nn \l_@@_cell_box + { + \box_move_down:nn + { + ( \box_ht:N \l_@@_cell_box - \box_ht:N \@arstrutbox + + \baselineskip ) / 2 + } + { \box_use:N \l_@@_cell_box } + } + } + } + } +% \end{macrocode} +% +% % \medskip % For |w| and |W| % \begin{macrocode} @@ -9192,7 +9340,42 @@ version 2005/12/01 or later. } % \end{macrocode} % -% +% \bigskip +% For the case of a letter |X| +% \begin{macrocode} +\cs_new_protected:Npn \@@_patch_preamble_xii: + { + \int_gincr:N \g_@@_nb_of_X_int +% \end{macrocode} +% We test whether you know the width of the |X|-columns by reading the value in +% the |aux| file (of course, this is not possible at the first compilation). +% \begin{macrocode} + \bool_if:NTF \l_@@_X_columns_aux_bool + { \exp_args:NNNV \@@_patch_preamble_iv:nnn t p \l_@@_X_columns_dim } + { + \tl_gput_right:Nn \g_@@_preamble_tl + { + > { + \@@_Cell: + \tl_set:Nn \l_@@_cell_type_tl { c } +% \end{macrocode} +% The following code will nullify the box of the cell. +% \begin{macrocode} + \tl_gput_right:Nn \g_@@_post_treatment_cell_tl + { \hbox_set:Nn \l_@@_cell_box { } } +% \end{macrocode} +% The content of the cell is composed in |\l_tmpa_box| which will be discarded. +% \begin{macrocode} + } + c + < { \@@_end_Cell: } + } + \int_gincr:N \c@jCol + \@@_patch_preamble_x:n + } + } +% \end{macrocode} +% % \bigskip % \subsection*{The redefinition of \textbackslash multicolumn} % @@ -9555,7 +9738,13 @@ version 2005/12/01 or later. % notes (that means that a |\vtop{\hsize=...}| is not enough). % \begin{macrocode} \begin { minipage } [ t ] { \box_wd:N \l_@@_the_array_box } - \box_use_drop:N \l_@@_the_array_box +% \end{macrocode} +% The |\hbox| avoids that the |pgfpicture| inside |\@@_draw_blocks| adds a extra +% vertical space before the notes. +% \begin{macrocode} + \hbox:n + { + \box_use_drop:N \l_@@_the_array_box % \end{macrocode} % We have to draw the blocks right now because there may be tabular notes in % some blocks (which are not mono-column: the blocks which are mono-column @@ -9563,8 +9752,9 @@ version 2005/12/01 or later. % extra nodes before creating the blocks since there are |medium| nodes to create % for the blocks. % \begin{macrocode} - \@@_create_extra_nodes: - \seq_if_empty:NF \g_@@_blocks_seq \@@_draw_blocks: + \@@_create_extra_nodes: + \seq_if_empty:NF \g_@@_blocks_seq \@@_draw_blocks: + } \bool_lazy_or:nnT { \int_compare_p:nNn \c@tabularnote > 0 } { ! \tl_if_empty_p:V \l_@@_tabularnote_tl } @@ -9729,6 +9919,10 @@ version 2005/12/01 or later. \vcenter { \vbox_to_ht:nn +% \end{macrocode} +% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available +% on Overleaf. +% \begin{macrocode} { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box } { } } @@ -9742,6 +9936,10 @@ version 2005/12/01 or later. \c_math_toggle_token \left . \vbox_to_ht:nn +% \end{macrocode} +% Here, you should use |\box_ht_plus_dp:N| when TeXLive 2021 will be available +% on Overleaf. +% \begin{macrocode} { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box } { } \right #2 @@ -10022,8 +10220,8 @@ version 2005/12/01 or later. % \begin{macrocode} \int_gset:Nn \g_tmpa_int 1 \bool_if:NTF \g_@@_last_col_found_bool - { \prg_replicate:nn { \g_@@_col_total_int - 3 } } - { \prg_replicate:nn { \g_@@_col_total_int - 2 } } + { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 3 } 0 } } + { \prg_replicate:nn { \int_max:nn { \g_@@_col_total_int - 2 } 0 } } { & \omit @@ -10465,8 +10663,7 @@ version 2005/12/01 or later. \int_use:N \l_@@_first_col_int , \int_use:N \c@jCol , \int_use:N \g_@@_col_total_int - } - \iow_newline: + } } % \end{macrocode} % We write also the potential content of |\g_@@_pos_of_blocks_seq| (it will be @@ -10478,7 +10675,6 @@ version 2005/12/01 or later. { \seq_gset_from_clist:Nn \exp_not:N \g_@@_pos_of_blocks_seq { \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , } - \iow_newline: } } \seq_if_empty:NF \g_@@_multicolumn_cells_seq @@ -10487,10 +10683,8 @@ version 2005/12/01 or later. { \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_cells_seq { \seq_use:Nnnn \g_@@_multicolumn_cells_seq , , , } - \iow_newline: \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_sizes_seq { \seq_use:Nnnn \g_@@_multicolumn_sizes_seq , , , } - \iow_newline: } } % \end{macrocode} @@ -10674,12 +10868,12 @@ version 2005/12/01 or later. { \tl_gset:Nn \exp_not:N \g_@@_code_before_tl { \exp_not:V \g_nicematrix_code_before_tl } - \iow_newline: } \bool_set_true:N \l_@@_code_before_bool } % \end{macrocode} -% +% +% % \begin{macrocode} % \bool_if:NT \l_@@_code_before_bool \@@_write_aux_for_cell_nodes: % \end{macrocode} @@ -11787,7 +11981,7 @@ version 2005/12/01 or later. % % % \bigskip -% \subsection*{The actual instructions for drawing the dotted line with Tikz} +% \subsection*{The actual instructions for drawing the dotted lines with Tikz} % % The command |\@@_draw_line:| should be used in a |{pgfpicture}|. It has six % implicit arguments: @@ -11916,7 +12110,7 @@ version 2005/12/01 or later. \group_begin: % \end{macrocode} % The dimension |\l_@@_l_dim| is the length $\ell$ of the line to draw. We use -% the floating point reals of \pkg{expl3} to compute this length. +% the floating point reals of the L3 programming layer to compute this length. % \begin{macrocode} \dim_zero_new:N \l_@@_l_dim \dim_set:Nn \l_@@_l_dim @@ -13373,9 +13567,12 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_tmpb_dim \pgf@x \@@_qpoint:n { row - \@@_succ:n { #4 } } \dim_set_eq:NN \l_tmpc_dim \pgf@y - \bool_lazy_and:nnT - { \int_compare_p:nNn { #2 } > 1 } - { ! \tl_if_blank_p:V \CT@drsc@ } + \bool_lazy_all:nT + { + { \int_compare_p:nNn { #2 } > 1 } + { \cs_if_exist_p:N \CT@drsc@ } % condition added in version 5.18a + { ! \tl_if_blank_p:V \CT@drsc@ } + } { \group_begin: \CT@drsc@ @@ -13768,7 +13965,6 @@ version 2005/12/01 or later. { \seq_set_from_clist:Nn \exp_not:N \l_@@_corners_cells_seq { \seq_use:Nnnn \l_@@_corners_cells_seq , , , } - \iow_newline: } } } @@ -14701,9 +14897,15 @@ version 2005/12/01 or later. % why we have two macros: |\@@_Block_iv:nnnnn| and |\@@_Block_v:nnnnn| (the five % arguments of those macros are provided by curryfication). % \begin{macrocode} - \bool_lazy_or:nnTF - { \int_compare_p:nNn { \l_tmpa_int } = 1 } - { \int_compare_p:nNn { \l_tmpb_int } = 1 } + \bool_if:nTF + { + ( + \int_compare_p:nNn { \l_tmpa_int } = 1 + || + \int_compare_p:nNn { \l_tmpb_int } = 1 + ) + && ! \tl_if_empty_p:n { #5 } + } { \exp_args:Nxx \@@_Block_iv:nnnnn } { \exp_args:Nxx \@@_Block_v:nnnnn } { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } @@ -14742,9 +14944,9 @@ version 2005/12/01 or later. % \end{macrocode} % For a mono-column block, if the user has specified a color for the column in % the preamble of the array, we want to fix that color in the box we construct. -% We do that with |\set@color| and not |\color_ensure_current:| because that -% command seems to be bugged: it doesn't work in XeLaTeX when \pkg{fontspec} is -% loaded. +% We do that with |\set@color| and not |\color_ensure_current:| (in order to use +% |\color_ensure_current:| safely, you should load \pkg{l3backend} before the +% |\documentclass| with |\RequirePackage{expl3}|). % \begin{macrocode} \tl_if_empty:NTF \l_@@_color_tl { \int_compare:nNnT { #2 } = 1 \set@color } @@ -14932,6 +15134,11 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { NiceMatrix / Block / SecondPass } { + tikz .code:n = + \bool_if:NTF \c_@@_tikz_loaded_bool + { \seq_put_right:Nn \l_@@_tikz_seq { { #1 } } } + { \@@_error:n { tikz~key~without~tikz } } , + tikz .value_required:n = true , fill .tl_set:N = \l_@@_fill_tl , fill .value_required:n = true , draw .tl_set:N = \l_@@_draw_tl , @@ -15031,7 +15238,7 @@ version 2005/12/01 or later. % % \begin{macrocode} \cs_new_protected:Npn \@@_Block_v:nnnnnn #1 #2 #3 #4 #5 #6 - { + { % \end{macrocode} % The sequence of the positions of the blocks will be used when drawing the rules % (in fact, there is also the |\multicolumn| and the |\diagbox| in that sequence). @@ -15107,6 +15314,21 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% \begin{macrocode} + \seq_if_empty:NF \l_@@_tikz_seq + { + \tl_gput_right:Nx \g_nicematrix_code_before_tl + { + \@@_block_tikz:nnnnn + { #1 } + { #2 } + { \int_use:N \l_@@_last_row_int } + { \int_use:N \l_@@_last_col_int } + { \seq_use:Nn \l_@@_tikz_seq { , } } + } + } +% \end{macrocode} % % \medskip % \begin{macrocode} @@ -15630,6 +15852,25 @@ version 2005/12/01 or later. line-width .dim_set:N = \l_@@_line_width_dim } % \end{macrocode} +% +% \bigskip +% The following command will be used if the key |tikz| has been used for the +% command |\Block|. The arguments |#1| and |#2| are the coordinates of the first +% cell and |#3| and |#4| the coordinates of the last cell of the block. |#5| is +% a comma-separated list of the Tikz keys used with the path. +% \begin{macrocode} +\cs_new_protected:Npn \@@_block_tikz:nnnnn #1 #2 #3 #4 #5 + { + \begin { tikzpicture } + \clist_map_inline:nn { #5 } + { + \path [ ##1 ] + ( #1 -| #2 ) rectangle ( \@@_succ:n { #3 } -| \@@_succ:n { #4 } ) ; + } + \end { tikzpicture } + } +% \end{macrocode} +% % % \subsection*{How to draw the dotted lines transparently} % \begin{macrocode} @@ -16821,7 +17062,7 @@ version 2005/12/01 or later. } % \end{macrocode} % -% +% % \begin{macrocode} \@@_msg_new:nn { too~much~cols~for~matrix~with~last~col } { @@ -17121,6 +17362,15 @@ version 2005/12/01 or later. If~you~go~on,~this~specification~of~border~will~be~ignored. } % \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { tikz~key~without~tikz } + { + You~can't~use~the~key~'tikz'~for~the~command~'\token_to_str:N + \Block'~because~you~have~not~loaded~Tikz.~ + If~you~go~on,~this~key~will~be~ignored. + } +% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { last-col~non~empty~for~NiceArray } @@ -17257,7 +17507,7 @@ version 2005/12/01 or later. } { The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~ - hvlines,~l,~line-width,~rounded-corners,~r~and~t. + hvlines,~l,~line-width,~rounded-corners,~r,~t~and~tikz. } % \end{macrocode} % @@ -18064,6 +18314,10 @@ version 2005/12/01 or later. % % New command |\RowStyle| % +% \subsection*{Changes between versions 5.18 and 5.19} +% +% New key |tikz| for the command |\Block|. +% % \PrintIndex % % \tableofcontents diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf index 18b8189cdf..db334606da 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix.pdf and b/macros/latex/contrib/nicematrix/nicematrix.pdf differ -- cgit v1.2.3