From 423d970d7b4fc4627d5e337f4e002fbd3300a5d0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 16 Feb 2022 21:17:13 +0000 Subject: nicematrix (16feb22) git-svn-id: svn://tug.org/texlive/trunk@62043 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/nicematrix/nicematrix-french.pdf | Bin 499106 -> 502752 bytes .../doc/latex/nicematrix/nicematrix-french.tex | 103 +++- .../texmf-dist/doc/latex/nicematrix/nicematrix.pdf | Bin 1482850 -> 1489647 bytes .../source/latex/nicematrix/nicematrix.dtx | 534 +++++++++++++-------- .../texmf-dist/tex/latex/nicematrix/nicematrix.sty | 323 +++++++------ 5 files changed, 618 insertions(+), 342 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf index 0e75045e9a0..060eb817730 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 fc2cc12e341..d97d20c70ef 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex @@ -10,7 +10,7 @@ \usepackage{nicematrix} \usepackage{tikz} -\usetikzlibrary{fit,patterns,arrows.meta} +\usetikzlibrary{fit,patterns,arrows.meta,decorations.pathmorphing} \usepackage{enumitem} \usepackage{siunitx} @@ -1246,7 +1246,8 @@ tracées par |\hdottedline| et «|:|» ont ce même effet. commandes et des lettres pour des filets personnalisés avec la clé |custom-line|, utilisable dans |\NiceMatrixOptions| ou bien dans un environnement. Cette clé prend en argument une liste de paires de la forme -\textsl{clé=valeur}. Les clés disponibles sont les suivantes : +\textsl{clé=valeur}. Il y a d'abord deux clés pour spécifier les outils qui +permettront d'utiliser ce nouveau type de filet. \begin{itemize} \item la clé |command| indique le nom (sans la contre-oblique) d'une commande @@ -1256,8 +1257,20 @@ tracer des filets horizontaux (de manière similaire à |\hline|) ; \item la clé |letter| prend en argument une lettre\footnote{Les lettres suivantes ne sont pas autorisées : \verb+lcrpmbVX:|()[]!@<>+} qui pourra être utilisée par l'utilisateur dans le préambule d'un environnement à préambule (comme -|{NiceTabular}|) pour spécifier un filet vertical ; +|{NiceTabular}|) pour spécifier un filet vertical. +\end{itemize} + +\bigskip +Pour la description du filet elle-même, il y a trois possibilités. + +\begin{itemize} +\item \emph{Première possibilité}\par\nobreak + +Il est possible de spécifier des filets multiples, colorés avec une couleur +entre les filets (comme on peut le faire avec \pkg{colortbl} par exemple). + +\begin{itemize} \item la clé |multiplicity| indique le nombre de traits successifs qui seront tracés : par exemple, une valeur de~$2$ va créer des filets doubles comme créés en standard par |\hline\hline| ou bien \verb+||+ dans le préambule d'un @@ -1266,13 +1279,35 @@ environnement ; \item la clé |color| fixe la couleur des filets ; \item la clé |sep-color| fixe la couleur entre deux filets consécutifs (n'a -d'intérêt que dans le cas où la clé |multiplicity| est utilisée) ; +d'intérêt que dans le cas où la clé |multiplicity| est utilisée). +\end{itemize} -\item la clé |dotted| impose un style de pointillés qui utilise le système -de pointillés de la commande |\hdottedline| (et de la lettre \verb|:|) décrit à -la partie précédente (cf. p.~\pageref{dotted}). +\bigskip +\item \emph{Deuxième possibilité}\par\nobreak + +On peut utiliser la clé |dotted| qui impose un style de pointillés qui utilise +le système de pointillés de la commande |\hdottedline| (et de la lettre +\verb|:|) décrit à la partie précédente (cf. p.~\pageref{dotted}). La clé +|color| est en fait aussi utilisable dans ce cas-là. + +\bigskip +\item \colorbox{yellow!50}{\textbf{Nouveau 6.6}}\enskip \emph{Troisième + possibilité} + +On peut utiliser la clé |tikz| (si Tikz est chargé, \pkg{nicematrix} ne +chargeant par défaut que \textsc{pgf}). Dans ce cas-là, le filet est tracé +directement avec Tikz en utilisant comme paramètres la valeur de la clé |tikz| +qui doit être une liste de couples \textsl{clé=valeur} applicables à un chemin +Tikz. + +Par défaut aucune réservation de place n'est faite par défaut pour le filet qui +sera tracé avec Tikz. On peut demander une réservation (horizontale pour un +filet vertical et verticale pour un filet horizontal) avec la clé |width| qui +est donc en quelque sorte la largeur du filet qui sera tracé (cette largeur +n'est pas déduite des caractéristiques fournies par la clé |tikz|). \end{itemize} + \medskip Ce système permet en particulier de définir des commandes pour tracer des filets avec une couleur spécifique (et ces filets respecteront les blocs comme les @@ -1307,6 +1342,52 @@ Produit C & 5 & 4 & 1 \\ \end{center} +\bigskip +Voici un exemple avec la clé |tikz|. + +\begin{Verbatim} +\documentclass{article} +\usepackage{nicematrix,tikz} +\usetikzlibrary{decorations.pathmorphing} + +\NiceMatrixOptions + { + custom-line = + { + letter = I , + ~emphase#tikz = { decorate, decoration = { coil, aspect = 0 } }}@ , + ~emphase#width = 2 mm@ + } + } + +\begin{document} +\begin{NiceTabular}{cIcIc} +un & deux & trois \\ +quatre & cinq & six \\ +sept & huit & neuf +\end{NiceTabular} +\end{document} +\end{Verbatim} + +\begin{center} +\NiceMatrixOptions + { + custom-line = + { + letter = I , + tikz = { decorate, decoration = { coil, aspect = 0 } } , + width = 2 mm + } + } +\begin{NiceTabular}{cIcIc} +un & deux & trois \\ +quatre & cinq & six \\ +sept & huit & neuf +\end{NiceTabular} +\end{center} + + + \section{Les couleurs des rangées et des colonnes} \subsection{Utilisation de colortbl} @@ -1812,7 +1893,9 @@ concerné.\footnote{Pour le moment, cette clé n'est \emph{pas} disponible dans On a alors accès aux trois commandes suivantes : \begin{itemize} -\item |\cellcolor| qui colorie la case courante ; +\item |\cellcolor| qui colorie la case courante\footnote{Néanmoins, cette + commande |\cellcolor| supprimera les espaces qui la suivent, ce que ne fait + pas la commande |\cellcolor| de \pkg{colortbl}.} ; \item |\rowcolor| à utiliser dans une case et qui colorie le reste de la rangée ; \item |\columncolor| à utiliser dans le préambule du tableau de la même manière @@ -2130,6 +2213,10 @@ un très très très très long texte \end{center} +Remarquons que l'extension \pkg{varwidth} a quelques problèmes (au moins dans sa +version 0.92). Par exemple, avec LuaLaTeX, elle en fonctionne pas si le contenu +commence par une instruction |\color|. + \subsection{Les colonnes X} diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf index 703b8f8c3b8..d96ed3fa4a6 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/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index 80d98ae17e3..cf717533a16 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.5} -\def\myfiledate{2022/01/23} +\def\myfileversion{6.6} +\def\myfiledate{2022/02/16} % % %<*batchfile> @@ -53,7 +53,7 @@ version 2005/12/01 or later. \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} \usepackage{tikz} -\usetikzlibrary{fit,patterns,arrows.meta} +\usetikzlibrary{fit,patterns,arrows.meta,decorations.pathmorphing} \usepackage{nicematrix} \usepackage{siunitx} \usepackage{varwidth} @@ -1257,8 +1257,9 @@ version 2005/12/01 or later. % \colorbox{yellow!50}{\textbf{New 6.5}}\enskip It's possible to define commands % and letters for customized rules with the key |custom-line| available in % |\NiceMatrixOptions| and in the options of individual environments. That key -% takes in as argument a list of \textsl{key=value} pairs. The available keys -% are the following: +% takes in as argument a list of \textsl{key=value} pairs. First, there is two +% keys to define the tools which will be used to use that new type of rule. +% % \begin{itemize} % \item the key |command| is the name (without the backslahs) of a command that % will be created by \pkg{nicematrix} and that will be available for the final @@ -1267,8 +1268,19 @@ version 2005/12/01 or later. % \item the key |letter| takes in as argument a letter\footnote{The following % 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; +% to specify a vertical rule. +% \end{itemize} +% +% \bigskip +% For the description of the rule itself, there is three possibilities. % +% \begin{itemize} +% \item \emph{First possibility}\par\nobreak +% +% It's possible to specify composite rules, with a color and a color for the +% inter-rule space (as possible with \pkg{colortbl} for instance). +% +% \begin{itemize} % \item the key |multiplicity| is the number to consecutive rules that will be % drawn: for instance, a value of $2$ will create double rules such those % created by |\hline\hline| or \verb+||+ in the preamble of an environment; @@ -1276,13 +1288,33 @@ version 2005/12/01 or later. % \item the key |color| sets the color of the rule ; % % \item the key |sep-color| sets the color between two successive rules (should be -% used only in conjonction with |multiplicity|); +% used only in conjonction with |multiplicity|). +% \end{itemize} +% +% \bigskip +% \item \emph{Second possibility}\par\nobreak +% +% The key |dotted| forces a style with dotted rules such as those created by +% |\hdottedline| or the letter ``|:|'' in the preamble (cf. +% p.~\pageref{dotted}). The key |color| may be used also in that case. % -% \item the key |dotted| forces a style with dotted rules such as those created by -% |\hdottedline| or the letter ``|:|'' in the preamble (cf. p.~\pageref{dotted}). +% \bigskip +% \item \colorbox{yellow!50}{\textbf{New 6.6}}\enskip \emph{Third +% possibility}\par\nobreak +% +% It's possible to use the key |tikz| (if Tikz is loaded). In that case, the +% rule is drawn directly with Tikz by using as parameters the value of the key +% |tikz| which must be a list of \textsl{key=value} pairs which may be applied +% to a Tikz path. +% +% By default, no space is reserved for the rule that will be drawn with Tikz. It +% possible to specify a reservation (horizontal for a vertical rule and vertical +% for an horizontal one) with the key |width|. That value of that key, is, in +% some ways, the width of the rule that will be drawn (\pkg{nicematrix} does not +% compute that width from the characteristics of the rule specified in |tikz|). % \end{itemize} % -% \medskip +% \bigskip % That system may be used, in particular, for the definition of commands and % letters to draw rules with a specific color (and those rules will respect the % blocks as do all rules of \pkg{nicematrix}). @@ -1316,7 +1348,50 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % -% +% \bigskip +% Here is an example of the key |tikz|. +% +% \begin{Verbatim} +% \documentclass{article} +% \usepackage{nicematrix,tikz} +% \usetikzlibrary{decorations.pathmorphing} +% +% \NiceMatrixOptions +% { +% custom-line = +% { +% letter = I , +% ~emphase#tikz = { decorate, decoration = { coil, aspect = 0 } }}@ , +% ~emphase#width = 2 mm@ +% } +% } +% +% \begin{document} +% \begin{NiceTabular}{cIcIc} +% one & two & three \\ +% four & five & six \\ +% seven & eight & nine +% \end{NiceTabular} +% \end{document} +% \end{Verbatim} +% +% \begin{center} +% \NiceMatrixOptions +% { +% custom-line = +% { +% letter = I , +% tikz = { decorate, decoration = { coil, aspect = 0 } } , +% width = 2 mm +% } +% } +% \begin{NiceTabular}{cIcIc} +% one & two & three \\ +% four & five & six \\ +% seven & eight & nine +% \end{NiceTabular} +% \end{center} +% % %\section{The color of the rows and columns} % @@ -1801,7 +1876,9 @@ version 2005/12/01 or later. % There are three commands available (they are inspired by \pkg{colortbl} but % are \emph{independent} of \pkg{colortbl}): % \begin{itemize} -% \item |\cellcolor| which colorizes a cell; +% \item |\cellcolor| which colorizes a cell;\footnote{However, this command +% |\cellcolor| will delete the following spaces, which does not the command +% |\cellcolor| of \pkg{colortbl}.} % \item |\rowcolor| which must be used in a cell and which colorizes the end of % the row; % \item |\columncolor| which must be used in the preamble of the environment @@ -2112,6 +2189,10 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % +% \bigskip +% One should remark that the extension \pkg{varwidth} (at least in its version +% 0.92) has some problems: for instance, with LuaLaTeX, it does not work when +% the content begins with |\color|. % % % \subsection{The columns X} @@ -5649,7 +5730,8 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_new:N \c_@@_in_preamble_bool \bool_set_true:N \c_@@_in_preamble_bool -\AtBeginDocument { \bool_set_false:N \c_@@_in_preamble_bool } +\hook_gput_code:nnn { begindocument } { . } + { \bool_set_false:N \c_@@_in_preamble_bool } % \end{macrocode} % % \begin{macrocode} @@ -5659,7 +5741,7 @@ version 2005/12/01 or later. \bool_new:N \c_@@_tabularx_loaded_bool \bool_new:N \c_@@_tikz_loaded_bool \bool_new:N \c_@@_varwidth_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { varwidth } { \bool_set_true:N \c_@@_varwidth_loaded_bool } @@ -5789,7 +5871,7 @@ version 2005/12/01 or later. % be modified. In order to avoid an error message in this case, we will redefine % |\pgfutil@check@rerun| in the |aux| file. % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { booktabs } { \iow_now:Nn \@mainaux \nicematrix@redefine@check@rerun } @@ -5816,7 +5898,7 @@ version 2005/12/01 or later. % redefinition of |\everycr|. % \begin{macrocode} \bool_new:N \c_@@_colortbl_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { colortbl } { \bool_set_true:N \c_@@_colortbl_loaded_bool } @@ -5989,7 +6071,7 @@ version 2005/12/01 or later. % loaded, we redefine the |S| columns of \pkg{siunitx}. % \begin{macrocode} \bool_new:N \c_@@_siunitx_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { siunitx } { \bool_set_true:N \c_@@_siunitx_loaded_bool } @@ -6003,7 +6085,7 @@ version 2005/12/01 or later. % The command |\@@_renew_NC@rewrite@S:| will be used in each environment of % \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment. % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \bool_if:nTF { ! \c_@@_siunitx_loaded_bool } { \cs_set_eq:NN \@@_renew_NC@rewrite@S: \prg_do_nothing: } @@ -6399,11 +6481,10 @@ version 2005/12/01 or later. % % \bigskip % 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|). +% |\l_tmpb_dim|. We creates two more in the same spirit. % \begin{macrocode} -\dim_zero_new:N \l_tmpc_dim -\dim_zero_new:N \l_tmpd_dim +\dim_zero_new:N \l_@@_tmpc_dim +\dim_zero_new:N \l_@@_tmpd_dim % \end{macrocode} % % \bigskip @@ -6831,7 +6912,7 @@ version 2005/12/01 or later. % beginning of the document (we want to allow the user to load \pkg{enumitem} % after \pkg{nicematrix}). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \bool_if:nTF { ! \c_@@_enumitem_loaded_bool } { @@ -7051,10 +7132,11 @@ version 2005/12/01 or later. % initial value is 0.45~em but it will be changed if the option |small| is used. % \begin{macrocode} \dim_new:N \l_@@_inter_dots_dim -\AtBeginDocument { \dim_set:Nn \l_@@_inter_dots_dim { 0.45 em } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_inter_dots_dim { 0.45 em } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even though it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} +% is used (even though it is obsolete). % % \bigskip % The following dimension is the minimal distance between a node (in fact an @@ -7063,10 +7145,11 @@ version 2005/12/01 or later. % distance may vary a little). % \begin{macrocode} \dim_new:N \l_@@_xdots_shorten_dim -\AtBeginDocument { \dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even though it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} is used (even though it +% is obsolete). % % \bigskip % The following dimension is the radius of the dots for the dotted lines (when @@ -7074,10 +7157,11 @@ version 2005/12/01 or later. % value is 0.53~pt but it will be changed if the option |small| is used. % \begin{macrocode} \dim_new:N \l_@@_radius_dim -\AtBeginDocument { \dim_set:Nn \l_@@_radius_dim { 0.53 pt } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_radius_dim { 0.53 pt } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even if it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} is used (even though it +% is obsolete). % % % \bigskip @@ -7134,10 +7218,11 @@ version 2005/12/01 or later. % \bigskip % \begin{macrocode} \dim_new:N \l_@@_notes_above_space_dim -\AtBeginDocument { \dim_set:Nn \l_@@_notes_above_space_dim { 1 mm } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_notes_above_space_dim { 1 mm } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even if it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} is used (even though it +% is obsolete). % % \bigskip % The flag |\l_@@_nullify_dots_bool| corresponds to the option |nullify-dots|. @@ -7487,7 +7572,7 @@ version 2005/12/01 or later. { \bool_if:NTF \c_@@_in_preamble_bool { - \AtBeginDocument + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c_@@_enumitem_loaded_bool { \setlist* [ tabularnotes ] { #1 } } @@ -7503,7 +7588,7 @@ version 2005/12/01 or later. { \bool_if:NTF \c_@@_in_preamble_bool { - \AtBeginDocument + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c_@@_enumitem_loaded_bool { \setlist* [ tabularnotes* ] { #1 } } @@ -7603,17 +7688,6 @@ version 2005/12/01 or later. renew-matrix .code:n = \@@_renew_matrix: , renew-matrix .value_forbidden:n = true , % \end{macrocode} -% The key |transparent| is now considered as obsolete (because its name is ambiguous). -% \begin{macrocode} - transparent .code:n = - { - \@@_renew_matrix: - \bool_set_true:N \l_@@_renew_dots_bool - \@@_error:n { Key~transparent } - } , - transparent .value_forbidden:n = true, -% \end{macrocode} -% % % \bigskip % The option |exterior-arraycolsep| will have effect only in |{NiceArray}| for @@ -8489,13 +8563,9 @@ version 2005/12/01 or later. % We redefine |\multicolumn| and, since we want |\multicolumn| to be available % in the potential environments |{tabular}| nested in the environments of % \pkg{nicematrix}, we patch |{tabular}| to go back to the original definition. -% The command |\AtBeginEnvironment| is the command of \pkg{l3hooks} and, if this -% command is not available (versions of LaTeX prior to 2020-10-01), -% \pkg{etoolbox} is loaded and the command |\AtBeginDocument| of \pkg{etoolbox} -% is used. % \begin{macrocode} \cs_set_eq:NN \multicolumn \@@_multicolumn:nnn - \AtBeginEnvironment { tabular } + \hook_gput_code:nnn { env / tabular / begin } { . } { \cs_set_eq:NN \multicolumn \@@_old_multicolumn } % \end{macrocode} % @@ -8972,15 +9042,15 @@ version 2005/12/01 or later. \@@_qpoint:n { #1 } \dim_set_eq:NN \l_tmpb_dim \pgf@y \@@_qpoint:n { col - \@@_succ:n { #4 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \@@_qpoint:n { \@@_succ:n { #3 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@y \@@_pgf_rect_node:nnnnn { \@@_env: - #5 } { \dim_use:N \l_tmpa_dim } { \dim_use:N \l_tmpb_dim } - { \dim_use:N \l_tmpc_dim } - { \dim_use:N \l_tmpd_dim } + { \dim_use:N \l_@@_tmpc_dim } + { \dim_use:N \l_@@_tmpd_dim } } } % \end{macrocode} @@ -12018,7 +12088,7 @@ version 2005/12/01 or later. % |\@@_draw_dotted_lines:| whether Tikz is loaded or not (in that case, only % \textsc{pgf} is loaded). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \cs_new_protected:Npx \@@_draw_dotted_lines: { @@ -12087,16 +12157,16 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \int_min:nn { ##1 } { \c@iRow + 1 } } \dim_set_eq:NN \l_tmpb_dim \pgf@y \@@_qpoint:n { col - \int_min:nn { ##1 + 1 } { \c@jCol + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \@@_qpoint:n { row - \int_min:nn { ##1 + 1 } { \c@iRow + 1 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@y \pgftransformshift { \pgfpoint \l_tmpa_dim \l_tmpb_dim } % \end{macrocode} % Now, |\l_tmpa_dim| and |\l_tmpb_dim| become the width and the height of the % node (of shape |@à_diag_node|) that we will construct. % \begin{macrocode} - \dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 } - \dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 } + \dim_set:Nn \l_tmpa_dim { ( \l_@@_tmpc_dim - \l_tmpa_dim ) / 2 } + \dim_set:Nn \l_tmpb_dim { ( \l_@@_tmpd_dim - \l_tmpb_dim ) / 2 } \pgfnode { @@_diag_node } { center } { } { \@@_env: - ##1 } { } \str_if_empty:NF \l_@@_name_str { \pgfnodealias { \l_@@_name_str - ##1 } { \@@_env: - ##1 } } @@ -13290,17 +13360,17 @@ version 2005/12/01 or later. % \pkg{nicematrix} rely upon |{NiceArray}|). % % -% \medskip +% \medskip % The syntax of these commands uses the character |_| as embellishment and % thats' why we have to insert a character |_| in the \emph{arg spec} of these % commands. However, we don't know the future catcode of |_| in the main % document (maybe the user will use \pkg{underscore}, and, in that case, the % catcode is $13$ because \pkg{underscore} activates |_|). That's why these -% commands will be defined in a |\AtBeginDocument| and the \emph{arg spec} will -% be rescanned. +% commands will be defined in a |\hook_gput_code:nnn { begindocument } { . }| +% and the \emph{arg spec} will be rescanned. % % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13418,7 +13488,7 @@ version 2005/12/01 or later. } } % \end{macrocode} -% End of the |\AtBeginDocument|. +% End of the |\AddToHook|. % % % \bigskip @@ -13487,7 +13557,7 @@ version 2005/12/01 or later. % |\NewDocumentCommand| is protected and that's why we have put the % |\multicolumn| before (in the definition of |\@@_Hdotsfor:|). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13513,7 +13583,7 @@ version 2005/12/01 or later. } } % \end{macrocode} -% Enf of |\AtBeginDocument|. +% Enf of |\AddToHook|. % % \medskip % \begin{macrocode} @@ -13594,7 +13664,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13614,7 +13684,7 @@ version 2005/12/01 or later. } } % \end{macrocode} -% Enf of |\AtBeginDocument|. +% Enf of |\AddToHook|. % % \begin{macrocode} \cs_new_protected:Npn \@@_Vdotsfor:nnnn #1 #2 #3 #4 @@ -13725,7 +13795,7 @@ version 2005/12/01 or later. % construction uses the fact the |\@@_line_i:nn| is protected and that % |\@@_double_int_eval:n| is fully expandable). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } m m ! O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13764,7 +13834,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \cs_new_protected:Npx \@@_draw_line_ii:nn #1 #2 { @@ -13831,7 +13901,7 @@ version 2005/12/01 or later. nb-rows .int_set:N = \l_@@_key_nb_rows_int , nb-rows .value_required:n = true , nb-rows .initial:n = 1 , - rowcolor .tl_set:N = \l_tmpc_tl , + rowcolor .tl_set:N = \l_@@_tmpc_tl , rowcolor .value_required:n = true , rowcolor .initial:n = , unknown .code:n = \@@_error:n { Unknown~key~for~RowStyle } @@ -13846,7 +13916,7 @@ version 2005/12/01 or later. % \end{macrocode} % If the key |rowcolor| has been used. % \begin{macrocode} - \tl_if_empty:NF \l_tmpc_tl + \tl_if_empty:NF \l_@@_tmpc_tl { % \end{macrocode} % First, the end of the current row (we remind that |\RowStyle| applies to the @@ -13855,7 +13925,7 @@ version 2005/12/01 or later. \tl_gput_right:Nx \g_nicematrix_code_before_tl { \@@_rectanglecolor - { \l_tmpc_tl } + { \l_@@_tmpc_tl } { \int_use:N \c@iRow - \int_use:N \c@jCol } { \int_use:N \c@iRow - * } } @@ -13867,7 +13937,7 @@ version 2005/12/01 or later. \tl_gput_right:Nx \g_nicematrix_code_before_tl { \@@_rowcolor - { \l_tmpc_tl } + { \l_@@_tmpc_tl } { \int_eval:n { \c@iRow + 1 } - \int_eval:n { \c@iRow + \l_@@_key_nb_rows_int - 1 } @@ -14092,13 +14162,13 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_rectanglecolor:nnn #1 #2 #3 { \@@_cut_on_hyphen:w #1 \q_stop - \tl_clear_new:N \l_tmpc_tl - \tl_clear_new:N \l_tmpd_tl - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_clear_new:N \l_@@_tmpc_tl + \tl_clear_new:N \l_@@_tmpd_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #2 \q_stop - \tl_set:Nx \l_@@_rows_tl { \l_tmpc_tl - \l_tmpa_tl } - \tl_set:Nx \l_@@_cols_tl { \l_tmpd_tl - \l_tmpb_tl } + \tl_set:Nx \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl } + \tl_set:Nx \l_@@_cols_tl { \l_@@_tmpd_tl - \l_tmpb_tl } % \end{macrocode} % The command |\@@_cartesian_path:n| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_rows_tl|. @@ -14221,9 +14291,9 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_rowcolors_restart_bool { \int_set:Nn \l_@@_color_int 1 } { \int_set:Nn \l_@@_color_int \l_tmpa_tl } - \int_zero_new:N \l_tmpc_int - \int_set:Nn \l_tmpc_int \l_tmpb_tl - \int_do_until:nNnn \l_tmpa_int > \l_tmpc_int + \int_zero_new:N \l_@@_tmpc_int + \int_set:Nn \l_@@_tmpc_int \l_tmpb_tl + \int_do_until:nNnn \l_tmpa_int > \l_@@_tmpc_int { % \end{macrocode} % We will compute in |\l_tmpb_int| the last row of the ``block''. @@ -14245,7 +14315,7 @@ version 2005/12/01 or later. \tl_set:Nx \l_@@_rows_tl { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int } % \end{macrocode} -% |\l_tmpc_tl| will be the color that we will use. +% |\l_@@_tmpc_tl| will be the color that we will use. % \begin{macrocode} \tl_clear_new:N \l_@@_color_tl \tl_set:Nx \l_@@_color_tl @@ -14373,9 +14443,9 @@ version 2005/12/01 or later. \int_compare:nNnT \l_tmpb_tl > \c@jCol { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } % \end{macrocode} -% |\l_tmpc_tl| will contain the number of column. +% |\l_@@_tmpc_tl| will contain the number of column. % \begin{macrocode} - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl % \end{macrocode} % If we decide to provide the commands |\cellcolor|, |\rectanglecolor|, % |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| in the @@ -14384,8 +14454,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_qpoint:n { col - \l_tmpa_tl } \int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl - { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } - { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } % \end{macrocode} @@ -14406,15 +14476,15 @@ version 2005/12/01 or later. % Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|. % \begin{macrocode} \seq_if_in:NxF \l_@@_corners_cells_seq - { \l_tmpa_tl - \l_tmpc_tl } + { \l_tmpa_tl - \l_@@_tmpc_tl } { \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } \@@_qpoint:n { row - \l_tmpa_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } + \dim_set:Nn \l_@@_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } \pgfsetcornersarced { \pgfpoint { #1 } { #1 } } \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim } { \pgfpoint \l_tmpa_dim \l_tmpb_dim } } } @@ -14647,7 +14717,9 @@ version 2005/12/01 or later. % \begin{macrocode} tikz .tl_set:N = \l_@@_tikz_rule_tl , tikz .value_required:n = true , - tikz .initial:n = + tikz .initial:n = , + width .dim_set:N = \l_@@_rule_width_dim , + width .value_required:n = true } % \end{macrocode} % @@ -14685,7 +14757,7 @@ version 2005/12/01 or later. % \end{macrocode} % |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When % we have found a row corresponding to a rule to draw, we note its number in -% |\l_tmpc_tl|. +% |\l_@@_tmpc_tl|. % \begin{macrocode} \tl_set:Nx \l_tmpb_tl { \int_eval:n \l_@@_position_int } \int_step_variable:nnNn \l_@@_start_int \l_@@_end_int @@ -14791,7 +14863,7 @@ version 2005/12/01 or later. \@@_qpoint:n { col - \int_use:N \l_@@_position_int } \dim_set_eq:NN \l_tmpb_dim \pgf@x \@@_qpoint:n { row - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \bool_lazy_all:nT { { \int_compare_p:nNn \l_@@_multiplicity_int > 1 } @@ -14802,26 +14874,26 @@ version 2005/12/01 or later. \group_begin: \CT@drsc@ \dim_add:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } - \dim_sub:Nn \l_tmpc_dim { 0.5 \arrayrulewidth } - \dim_set:Nn \l_tmpd_dim + \dim_sub:Nn \l_@@_tmpc_dim { 0.5 \arrayrulewidth } + \dim_set:Nn \l_@@_tmpd_dim { \l_tmpb_dim - ( \doublerulesep + \arrayrulewidth ) * ( \l_@@_multiplicity_int - 1 ) } \pgfpathrectanglecorners { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - { \pgfpoint \l_tmpd_dim \l_tmpc_dim } + { \pgfpoint \l_@@_tmpd_dim \l_@@_tmpc_dim } \pgfusepath { fill } \group_end: } \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim } \prg_replicate:nn { \l_@@_multiplicity_int - 1 } { \dim_sub:Nn \l_tmpb_dim \arrayrulewidth \dim_sub:Nn \l_tmpb_dim \doublerulesep \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim } } \CT@arc@ \pgfsetlinewidth { 1.1 \arrayrulewidth } @@ -14866,13 +14938,13 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \int_use:N \l_@@_local_start_int } \dim_set_eq:NN \l_tmpa_dim \pgf@y \@@_qpoint:n { col - \int_use:N \l_@@_position_int } - \dim_set_eq:NN \l_tmpb_dim \pgf@x + \dim_set:Nn \l_tmpb_dim { \pgf@x - 0.5 \l_@@_rule_width_dim } \@@_qpoint:n { row - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \exp_args:NV \tikzset \l_@@_tikz_rule_tl \use:x { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] } ( \l_tmpb_dim , \l_tmpa_dim ) -- - ( \l_tmpb_dim , \l_tmpc_dim ) ; + ( \l_tmpb_dim , \l_@@_tmpc_dim ) ; \end { tikzpicture } } % \end{macrocode} @@ -14934,7 +15006,7 @@ version 2005/12/01 or later. % \end{macrocode} % |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When % we have found a column corresponding to a rule to draw, we note its number in -% |\l_tmpc_tl|. +% |\l_@@_tmpc_tl|. % \begin{macrocode} \tl_set:Nx \l_tmpa_tl { \int_use:N \l_@@_position_int } \int_step_variable:nnNn \l_@@_start_int \l_@@_end_int @@ -15039,7 +15111,7 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \int_use:N \l_@@_position_int } \dim_set_eq:NN \l_tmpb_dim \pgf@y \@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \bool_lazy_all:nT { { \int_compare_p:nNn \l_@@_multiplicity_int > 1 } @@ -15049,25 +15121,25 @@ version 2005/12/01 or later. { \group_begin: \CT@drsc@ - \dim_set:Nn \l_tmpd_dim + \dim_set:Nn \l_@@_tmpd_dim { \l_tmpb_dim - ( \doublerulesep + \arrayrulewidth ) * ( \l_@@_multiplicity_int - 1 ) } \pgfpathrectanglecorners { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim } \pgfusepathqfill \group_end: } \pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } \prg_replicate:nn { \l_@@_multiplicity_int - 1 } { \dim_sub:Nn \l_tmpb_dim \arrayrulewidth \dim_sub:Nn \l_tmpb_dim \doublerulesep \pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } } \CT@arc@ \pgfsetlinewidth { 1.1 \arrayrulewidth } @@ -15175,13 +15247,13 @@ version 2005/12/01 or later. \@@_qpoint:n { col - \int_use:N \l_@@_local_start_int } \dim_set_eq:NN \l_tmpa_dim \pgf@x \@@_qpoint:n { row - \int_use:N \l_@@_position_int } - \dim_set_eq:NN \l_tmpb_dim \pgf@y + \dim_set:Nn \l_tmpb_dim { \pgf@y - 0.5 \l_@@_rule_width_dim } \@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \exp_args:NV \tikzset \l_@@_tikz_rule_tl \use:x { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] } ( \l_tmpa_dim , \l_tmpb_dim ) -- - ( \l_tmpc_dim , \l_tmpb_dim ) ; + ( \l_@@_tmpc_dim , \l_tmpb_dim ) ; \end { tikzpicture } } % \end{macrocode} @@ -15279,15 +15351,46 @@ 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 |\NiceMatrixOption|). +% final user uses the key |custom-line| in |\NiceMatrixOptions|). % \begin{macrocode} \cs_new_protected:Npn \@@_custom_line:n #1 { + \str_clear_new:N \l_@@_command_str + \str_clear_new:N \l_@@_letter_str + \dim_zero_new:N \l_@@_rule_width_dim +% \end{macrocode} +% The token list |\l_tmpa_tl| is for the key |color|. +% \begin{macrocode} + \tl_clear:N \l_tmpa_tl +% \end{macrocode} +% The flag |\l_tmpa_bool| will indicate whether the key |tikz| is present. +% \begin{macrocode} + \bool_set_false:N \l_tmpa_bool +% \end{macrocode} +% The flag |\l_tmpb_bool| will indicate whether the key |width| is present. +% \begin{macrocode} + \bool_set_false:N \l_tmpb_bool \keys_set_known:nn { NiceMatrix / Custom-Line } { #1 } + \bool_if:NT \l_tmpa_bool + { +% \end{macrocode} +% We can't use |\c_@@_tikz_loaded_bool| to test whether \pkg{tikz} is loaded +% because |\NiceMatrixOptions| may be used in the preamble of the document. +% \begin{macrocode} + \cs_if_exist:NF \tikzpicture + { \@@_error:n { tikz~in~custom-line~without~tikz } } + \tl_if_empty:NF \l_tmpa_tl + { \@@_error:n { color~in~custom-line~with~tikz } } + } + \bool_if:NT \l_tmpb_bool + { + \bool_if:NF \l_tmpa_bool + { \@@_error:n { key~width~without~key~tikz } } + } % \end{macrocode} % If the final user only wants to draw horizontal rules, he does not need to % specify a letter (for the vertical rules in the preamble of the array). On the -% other hand, if he only wants to draw vertical rules, the does not need to +% other hand, if he only wants to draw vertical rules, he does not need to % define a command (which is the tool to draw horizontal rules in the array). Of % course, a definition of custom lines with no letter and no command would be point-less. % @@ -15315,7 +15418,24 @@ version 2005/12/01 or later. { \@@_error:n { Several~letters } } } \str_if_empty:NF \l_@@_command_str - { \exp_args:NnV \@@_define_h_custom_line:nn { #1 } \l_tmpc_int } + { +% \end{macrocode} +% The flag |\l_tmpa_bool| means that the key 'tikz' have been used. When the key +% 'tikz' has not been used, the width of the rule is computed with the +% multiplicity of the rule. +% \begin{macrocode} + \bool_if:NF \l_tmpa_bool + { + \dim_set:Nn \l_@@_rule_width_dim + { + \arrayrulewidth * \l_@@_tmpc_int + + \doublerulesep * ( \l_@@_tmpc_int - 1 ) + } + } + \exp_args:NnV \@@_define_h_custom_line:nn + { #1 } + \l_@@_rule_width_dim + } } } % \end{macrocode} @@ -15329,47 +15449,52 @@ version 2005/12/01 or later. % However, the whole definition of the customized lines (as provided by the % final user as argument of |custom-line|) will also be used further with % other sets of keys (for instance |{NiceMatrix/Rules}|). That's why the -% following set of keys has only entries for three keys. +% following set of keys has only entries for a few keys. % \begin{macrocode} \keys_define:nn { NiceMatrix / Custom-Line } { letter .str_set:N = \l_@@_letter_str , letter .value_required:n = true , - letter .initial:n = , command .str_set:N = \l_@@_command_str , command .value_required:n = true , - command .initial:n = , + multiplicity .int_set:N = \l_@@_tmpc_int , + multiplicity .initial:n = 1 , + multiplicity .value_required:n = true , + color .tl_set:N = \l_tmpa_tl , + color. value_required:n = true , % \end{macrocode} -% We need to know the multiplicity of the rule right now in order to compute the -% total width of the rule (and reserve space both in vertical and horizontal rules). +% When the key |tikz| is used, the rule will be drawn with Tikz by using the set +% of keys specified in the value of that key |tikz|. % \begin{macrocode} - multiplicity .int_set:N = \l_tmpc_int , - multiplicity .initial:n = 1 , - multiplicity .value_required:n = true , + tikz .code:n = \bool_set_true:N \l_tmpa_bool , +% \end{macrocode} +% The key |width| must be used only when the key |tikz| is used. When used, the +% key |width| specifies the width of the rule: it will be used to reserve space +% (in the preamble of the array or in the command for the horizontal rules). +% \begin{macrocode} + width .code:n = \dim_set:Nn \l_@@_rule_width_dim { #1 } + \bool_set_true:N \l_tmpb_bool , + width .value_required:n = true , } % \end{macrocode} % % \bigskip % The following command will create the command that the final user will use in % its array to draw a horizontal rule (hence the `|h|` in the name). |#1| is the -% whole set of keys to pass to |\@@_line:n| and |#2| is the multiplicity of -% the line (number of consecutive rules). +% whole set of keys to pass to |\@@_line:n| and |#2| is the widht of the whole +% rule. % \begin{macrocode} \cs_new_protected:Npn \@@_define_h_custom_line:nn #1 #2 { % \end{macrocode} -% We use |\cs_set:cpn| and not |\cs_new:cpn| because we want a local définition. +% 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 { \noalign { - \skip_vertical:n - { - \dim_eval:n - { \arrayrulewidth * #2 + \doublerulesep * ( #2 - 1) } - } + \skip_vertical:n { #2 } \tl_gput_right:Nx \g_@@_internal_code_after_tl { \@@_hline:n { #1 , position = \int_eval:n { \c@iRow + 1 } } } } @@ -15377,24 +15502,26 @@ version 2005/12/01 or later. } % \end{macrocode} % +% The flag |\l_tmpa_bool| means that the key 'tikz' have been used. When the key +% 'tikz' has not been used, the width of the rule is computed with the +% multiplicity of the rule. % \begin{macrocode} \cs_new_protected:Npn \@@_custom_line_i:n #1 { + \bool_if:NF \l_tmpa_bool + { + \dim_set:Nn \l_@@_rule_width_dim + { + \arrayrulewidth * \l_@@_tmpc_int + + \doublerulesep * ( \l_@@_tmpc_int - 1) + } + } \tl_gput_right:Nx \g_@@_preamble_tl { \exp_not:N ! - { - \skip_horizontal:n - { - \dim_eval:n - { - \arrayrulewidth * \l_tmpc_int - + \doublerulesep * ( \l_tmpc_int - 1) - } - } - } + { \skip_horizontal:n { \dim_use:N \l_@@_rule_width_dim } } } - \tl_gput_right:Nx \g_@@_internal_code_after_tl + \tl_gput_right:Nx \g_@@_internal_code_after_tl { \@@_vline:n { #1 , position = \@@_succ:n \c@jCol } } } % \end{macrocode} @@ -16833,9 +16960,9 @@ version 2005/12/01 or later. \@@_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x \@@_qpoint:n { row - \@@_succ:n { \l_@@_last_row_int } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x % \end{macrocode} % % We construct the node for the block with the name |(#1-#2-block)|. @@ -16845,7 +16972,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_pgf_rect_node:nnnnn { \@@_env: - #1 - #2 - block } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim + \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim \str_if_empty:NF \l_@@_block_name_str { \pgfnodealias @@ -16902,7 +17029,7 @@ version 2005/12/01 or later. \@@_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x } - \dim_set:Nn \l_tmpd_dim { - \c_max_dim } + \dim_set:Nn \l_@@_tmpd_dim { - \c_max_dim } \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int { \cs_if_exist:cT @@ -16913,18 +17040,18 @@ version 2005/12/01 or later. \pgfpointanchor { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } { east } - \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + \dim_set:Nn \l_@@_tmpd_dim { \dim_max:nn \l_@@_tmpd_dim \pgf@x } } } } - \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } + \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim } { \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x } \@@_pgf_rect_node:nnnnn { \@@_env: - #1 - #2 - block - short } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim + \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim } % \end{macrocode} % @@ -17106,7 +17233,7 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \l_tmpa_tl } \dim_set:Nn \l_tmpb_dim { \pgf@y } \@@_qpoint:n { col - \l_tmpb_tl } - \dim_set:Nn \l_tmpc_dim { \pgf@x } + \dim_set:Nn \l_@@_tmpc_dim { \pgf@x } \@@_cut_on_hyphen:w #3 \q_stop \int_compare:nNnT \l_tmpa_tl > \c@iRow { \tl_set:Nx \l_tmpa_tl { \int_use:N \c@iRow } } @@ -17115,10 +17242,10 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl } \dim_set:Nn \l_tmpa_dim { \pgf@y } \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@x } + \dim_set:Nn \l_@@_tmpd_dim { \pgf@x } \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpb_dim } - { \pgfpoint \l_tmpd_dim \l_tmpa_dim } + { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } + { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim } \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } % \end{macrocode} % We can't use |\pgfusepathqstroke| because of the key |rounded-corners|. @@ -17155,19 +17282,19 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_line_width_dim \arrayrulewidth \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } \@@_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } - \int_step_inline:nnn \l_tmpd_tl \l_tmpb_tl + \int_step_inline:nnn \l_@@_tmpd_tl \l_tmpb_tl { \use:x { \@@_vline:n { position = ##1 , - start = \l_tmpc_tl , + start = \l_@@_tmpc_tl , end = \@@_pred:n \l_tmpa_tl } } @@ -17178,19 +17305,19 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_line_width_dim \arrayrulewidth \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } \@@_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } - \int_step_inline:nnn \l_tmpc_tl \l_tmpa_tl + \int_step_inline:nnn \l_@@_tmpc_tl \l_tmpa_tl { \use:x { \@@_hline:n { position = ##1 , - start = \l_tmpd_tl , + start = \l_@@_tmpd_tl , end = \int_eval:n { \l_tmpb_tl - 1 } } } @@ -17217,8 +17344,8 @@ version 2005/12/01 or later. { \@@_error:nn { bad~border } { ##1 } } } \@@_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } @@ -17230,11 +17357,11 @@ version 2005/12/01 or later. \clist_if_in:NnT \l_@@_borders_clist { right } { \@@_stroke_vertical:n \l_tmpb_tl } \clist_if_in:NnT \l_@@_borders_clist { left } - { \@@_stroke_vertical:n \l_tmpd_tl } + { \@@_stroke_vertical:n \l_@@_tmpd_tl } \clist_if_in:NnT \l_@@_borders_clist { bottom } { \@@_stroke_horizontal:n \l_tmpa_tl } \clist_if_in:NnT \l_@@_borders_clist { top } - { \@@_stroke_horizontal:n \l_tmpc_tl } + { \@@_stroke_horizontal:n \l_@@_tmpc_tl } \endpgfpicture } } @@ -17246,13 +17373,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_stroke_vertical:n #1 { - \@@_qpoint:n \l_tmpc_tl + \@@_qpoint:n \l_@@_tmpc_tl \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \l_@@_line_width_dim } \@@_qpoint:n \l_tmpa_tl - \dim_set:Nn \l_tmpc_dim { \pgf@y + 0.5 \l_@@_line_width_dim } + \dim_set:Nn \l_@@_tmpc_dim { \pgf@y + 0.5 \l_@@_line_width_dim } \@@_qpoint:n { #1 } \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \pgf@x \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l_@@_tmpc_dim } \pgfusepathqstroke } % \end{macrocode} @@ -17263,7 +17390,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_stroke_horizontal:n #1 { - \@@_qpoint:n \l_tmpd_tl + \@@_qpoint:n \l_@@_tmpd_tl \clist_if_in:NnTF \l_@@_borders_clist { left } { \dim_set:Nn \l_tmpa_dim { \pgf@x - 0.5 \l_@@_line_width_dim } } { \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \l_@@_line_width_dim } } @@ -17521,10 +17648,10 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_tmpb_dim \pgf@x \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } \@@_qpoint:n { row - \@@_succ:n { #3 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \@@_qpoint:n { col - \@@_succ:n { #4 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x - \pgfpathlineto { \pgfpoint \l_tmpd_dim \l_tmpc_dim } + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x + \pgfpathlineto { \pgfpoint \l_@@_tmpd_dim \l_@@_tmpc_dim } { % \end{macrocode} % The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of @@ -17537,7 +17664,7 @@ version 2005/12/01 or later. } \pgfset { inner~sep = 1 pt } \pgfscope - \pgftransformshift { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgftransformshift { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim } \pgfnode { rectangle } { south~west } { \begin { minipage } { 20 cm } @@ -17547,7 +17674,7 @@ version 2005/12/01 or later. { } { } \endpgfscope - \pgftransformshift { \pgfpoint \l_tmpd_dim \l_tmpa_dim } + \pgftransformshift { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim } \pgfnode { rectangle } { north~east } { \begin { minipage } { 20 cm } @@ -17826,13 +17953,13 @@ version 2005/12/01 or later. \peek_remove_spaces:n { \@@_cut_on_hyphen:w #3 \q_stop - \tl_clear_new:N \l_tmpc_tl - \tl_clear_new:N \l_tmpd_tl - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_clear_new:N \l_@@_tmpc_tl + \tl_clear_new:N \l_@@_tmpd_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #2 \q_stop \seq_gput_right:Nx \g_@@_submatrix_seq - { { \l_tmpa_tl } { \l_tmpb_tl } { \l_tmpc_tl } { \l_tmpd_tl } } + { { \l_tmpa_tl } { \l_tmpb_tl } { \l_@@_tmpc_tl } { \l_@@_tmpd_tl } } \tl_gput_right:Nn \g_@@_internal_code_after_tl { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] } } @@ -17854,7 +17981,7 @@ version 2005/12/01 or later. % For explanations about the construction with rescanning of the preamble, see % the documentation for the user command |\Cdots|. % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -18564,16 +18691,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \medskip -% Maybe we will completely delete the key 'transparent' in a future version. -% \begin{macrocode} -\@@_msg_new:nn { Key~transparent } - { - The~key~'transparent'~is~now~obsolete~(because~it's~name~ - is~not~clear).~You~must~use~the~conjonction~of~'renew-dots'~ - and~'renew-matrix'.~This~error~is~fatal. - } -% \end{macrocode} % % \begin{macrocode} \keys_define:nn { NiceMatrix / Package } @@ -18949,6 +19066,14 @@ version 2005/12/01 or later. If~you~go~on,~it~will~be~ignored. } % \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { key~width~without~key~tikz } + { + In~'custom-line',~you~have~used~'width'~without~'tikz'.~That's~not~correct.~ + If~you~go~on,~that~key~'width'~will~be~discarded. + } +% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { Several~letters } @@ -19142,6 +19267,25 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { tikz~in~custom-line~without~tikz } + { + You~have~used~the~key~'tikz'~in~the~definition~of~a~ + customized~line~(with~'custom-line')~but~Tikz~is~not~loaded.~ + You~can~go~on~but~you~will~have~another~error~if~you~actually~ + use~that~custom~line. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { color~in~custom-line~with~tikz } + { + In~a~'custom-line',~you~have~used~both~'tikz'~and~'color',~ + which~is~forbidden~(you~should~use~'color'~inside~the~key~'tikz').~ + If~you~go~on,~the~key~'color'~will~be~discarded. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Wrong~last~row } { You~have~used~'last-row=\int_use:N \l_@@_last_row_int'~but~your~ @@ -20107,6 +20251,10 @@ version 2005/12/01 or later. % % Key |respect-arraystretch|. % +% +% \subsection*{Changes between version 6.5 and 6.6} +% +% Keys |tikz| and |width| in |custom-line|. % \PrintIndex % % \tableofcontents diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index c20a52be74f..51b0a3e4936 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.5} -\def\myfiledate{2022/01/23} +\def\myfileversion{6.6} +\def\myfiledate{2022/02/16} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -42,14 +42,15 @@ { \msg_redirect_name:nnn { nicematrix } } \bool_new:N \c__nicematrix_in_preamble_bool \bool_set_true:N \c__nicematrix_in_preamble_bool -\AtBeginDocument { \bool_set_false:N \c__nicematrix_in_preamble_bool } +\hook_gput_code:nnn { begindocument } { . } + { \bool_set_false:N \c__nicematrix_in_preamble_bool } \bool_new:N \c__nicematrix_arydshln_loaded_bool \bool_new:N \c__nicematrix_booktabs_loaded_bool \bool_new:N \c__nicematrix_enumitem_loaded_bool \bool_new:N \c__nicematrix_tabularx_loaded_bool \bool_new:N \c__nicematrix_tikz_loaded_bool \bool_new:N \c__nicematrix_varwidth_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { varwidth } { \bool_set_true:N \c__nicematrix_varwidth_loaded_bool } @@ -112,7 +113,7 @@ \tex_mkern:D 1 mu } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { booktabs } { \iow_now:Nn \@mainaux \nicematrix@redefine@check@rerun } @@ -128,7 +129,7 @@ } } \bool_new:N \c__nicematrix_colortbl_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { colortbl } { \bool_set_true:N \c__nicematrix_colortbl_loaded_bool } @@ -217,13 +218,13 @@ { \cs_set:Npn \CT@drsc@ { \color { #1 } } } \cs_set_eq:NN \__nicematrix_old_pgfpointanchor \pgfpointanchor \bool_new:N \c__nicematrix_siunitx_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { siunitx } { \bool_set_true:N \c__nicematrix_siunitx_loaded_bool } { } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \bool_if:nTF { ! \c__nicematrix_siunitx_loaded_bool } { \cs_set_eq:NN \__nicematrix_renew_NC@rewrite@S: \prg_do_nothing: } @@ -304,8 +305,8 @@ \dim_new:N \l__nicematrix_y_initial_dim \dim_new:N \l__nicematrix_x_final_dim \dim_new:N \l__nicematrix_y_final_dim -\dim_zero_new:N \l_tmpc_dim -\dim_zero_new:N \l_tmpd_dim +\dim_zero_new:N \l__nicematrix_tmpc_dim +\dim_zero_new:N \l__nicematrix_tmpd_dim \bool_new:N \g__nicematrix_empty_cell_bool \dim_new:N \g__nicematrix_width_last_col_dim \dim_new:N \g__nicematrix_width_first_col_dim @@ -391,7 +392,7 @@ \cs_new:Npn \__nicematrix_notes_label_in_tabular:n #1 { \textsuperscript { #1 } } \cs_new:Npn \__nicematrix_notes_label_in_list:n #1 { \textsuperscript { #1 } } \cs_set:Npn \thetabularnote { { \__nicematrix_notes_style:n { tabularnote } } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \bool_if:nTF { ! \c__nicematrix_enumitem_loaded_bool } { @@ -505,11 +506,14 @@ \dim_new:N \l__nicematrix_cell_space_top_limit_dim \dim_new:N \l__nicematrix_cell_space_bottom_limit_dim \dim_new:N \l__nicematrix_inter_dots_dim -\AtBeginDocument { \dim_set:Nn \l__nicematrix_inter_dots_dim { 0.45 em } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l__nicematrix_inter_dots_dim { 0.45 em } } \dim_new:N \l__nicematrix_xdots_shorten_dim -\AtBeginDocument { \dim_set:Nn \l__nicematrix_xdots_shorten_dim { 0.3 em } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l__nicematrix_xdots_shorten_dim { 0.3 em } } \dim_new:N \l__nicematrix_radius_dim -\AtBeginDocument { \dim_set:Nn \l__nicematrix_radius_dim { 0.53 pt } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l__nicematrix_radius_dim { 0.53 pt } } \tl_new:N \l__nicematrix_xdots_line_style_tl \tl_const:Nn \c__nicematrix_standard_tl { standard } \tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl @@ -521,7 +525,8 @@ \bool_set_true:N \l__nicematrix_parallelize_diags_bool \clist_new:N \l__nicematrix_corners_clist \dim_new:N \l__nicematrix_notes_above_space_dim -\AtBeginDocument { \dim_set:Nn \l__nicematrix_notes_above_space_dim { 1 mm } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l__nicematrix_notes_above_space_dim { 1 mm } } \bool_new:N \l__nicematrix_nullify_dots_bool \bool_new:N \l__nicematrix_respect_arraystretch_bool \bool_new:N \l__nicematrix_auto_columns_width_bool @@ -714,7 +719,7 @@ { \bool_if:NTF \c__nicematrix_in_preamble_bool { - \AtBeginDocument + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c__nicematrix_enumitem_loaded_bool { \setlist* [ tabularnotes ] { #1 } } @@ -730,7 +735,7 @@ { \bool_if:NTF \c__nicematrix_in_preamble_bool { - \AtBeginDocument + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c__nicematrix_enumitem_loaded_bool { \setlist* [ tabularnotes* ] { #1 } } @@ -806,13 +811,6 @@ small .value_forbidden:n = true , renew-matrix .code:n = \__nicematrix_renew_matrix: , renew-matrix .value_forbidden:n = true , - transparent .code:n = - { - \__nicematrix_renew_matrix: - \bool_set_true:N \l__nicematrix_renew_dots_bool - \__nicematrix_error:n { Key~transparent } - } , - transparent .value_forbidden:n = true, exterior-arraycolsep .bool_set:N = \l__nicematrix_exterior_arraycolsep_bool , columns-width .code:n = \tl_if_eq:nnTF { #1 } { auto } @@ -1261,7 +1259,7 @@ \bool_if:NT \l__nicematrix_colortbl_like_bool \__nicematrix_colortbl_like: \bool_if:NT \l__nicematrix_renew_dots_bool \__nicematrix_renew_dots: \cs_set_eq:NN \multicolumn \__nicematrix_multicolumn:nnn - \AtBeginEnvironment { tabular } + \hook_gput_code:nnn { env / tabular / begin } { . } { \cs_set_eq:NN \multicolumn \__nicematrix_old_multicolumn } \seq_gclear:N \g__nicematrix_multicolumn_cells_seq \seq_gclear:N \g__nicematrix_multicolumn_sizes_seq @@ -1480,15 +1478,15 @@ \__nicematrix_qpoint:n { #1 } \dim_set_eq:NN \l_tmpb_dim \pgf@y \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #4 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@x \__nicematrix_qpoint:n { \__nicematrix_succ:n { #3 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@y + \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@y \__nicematrix_pgf_rect_node:nnnnn { \__nicematrix_env: - #5 } { \dim_use:N \l_tmpa_dim } { \dim_use:N \l_tmpb_dim } - { \dim_use:N \l_tmpc_dim } - { \dim_use:N \l_tmpd_dim } + { \dim_use:N \l__nicematrix_tmpc_dim } + { \dim_use:N \l__nicematrix_tmpd_dim } } } \cs_new_protected:Npn \__nicematrix_patch_for_revtex: @@ -3189,7 +3187,7 @@ } { #5 } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \cs_new_protected:Npx \__nicematrix_draw_dotted_lines: { @@ -3235,12 +3233,12 @@ \__nicematrix_qpoint:n { row - \int_min:nn { ##1 } { \c@iRow + 1 } } \dim_set_eq:NN \l_tmpb_dim \pgf@y \__nicematrix_qpoint:n { col - \int_min:nn { ##1 + 1 } { \c@jCol + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@x \__nicematrix_qpoint:n { row - \int_min:nn { ##1 + 1 } { \c@iRow + 1 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@y + \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@y \pgftransformshift { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 } - \dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 } + \dim_set:Nn \l_tmpa_dim { ( \l__nicematrix_tmpc_dim - \l_tmpa_dim ) / 2 } + \dim_set:Nn \l_tmpb_dim { ( \l__nicematrix_tmpd_dim - \l_tmpb_dim ) / 2 } \pgfnode { __nicematrix_diag_node } { center } { } { \__nicematrix_env: - ##1 } { } \str_if_empty:NF \l__nicematrix_name_str { \pgfnodealias { \l__nicematrix_name_str - ##1 } { \__nicematrix_env: - ##1 } } @@ -3994,7 +3992,7 @@ } \pgfusepathqfill } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l__nicematrix_argspec_tl { O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl @@ -4124,7 +4122,7 @@ \__nicematrix_Hdotsfor_i } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l__nicematrix_argspec_tl { O { } m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl @@ -4201,7 +4199,7 @@ \int_step_inline:nnn { #2 } { #2 + #3 - 1 } { \cs_set:cpn { __nicematrix _ dotted _ #1 - ##1 } { } } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l__nicematrix_argspec_tl { O { } m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl @@ -4279,7 +4277,7 @@ \cs_new_protected:Npn \__nicematrix_rotate: { \bool_gset_true:N \g__nicematrix_rotate_bool } \cs_new:Npn \__nicematrix_double_int_eval:n #1-#2 \q_stop { \int_eval:n { #1 } - \int_eval:n { #2 } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l__nicematrix_argspec_tl { O { } m m ! O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl @@ -4312,7 +4310,7 @@ } { \__nicematrix_draw_line_ii:nn { #1 } { #2 } } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \cs_new_protected:Npx \__nicematrix_draw_line_ii:nn #1 #2 { @@ -4353,7 +4351,7 @@ nb-rows .int_set:N = \l__nicematrix_key_nb_rows_int , nb-rows .value_required:n = true , nb-rows .initial:n = 1 , - rowcolor .tl_set:N = \l_tmpc_tl , + rowcolor .tl_set:N = \l__nicematrix_tmpc_tl , rowcolor .value_required:n = true , rowcolor .initial:n = , unknown .code:n = \__nicematrix_error:n { Unknown~key~for~RowStyle } @@ -4361,12 +4359,12 @@ \NewDocumentCommand \__nicematrix_RowStyle:n { O { } m } { \keys_set:nn { NiceMatrix / RowStyle } { #1 } - \tl_if_empty:NF \l_tmpc_tl + \tl_if_empty:NF \l__nicematrix_tmpc_tl { \tl_gput_right:Nx \g_nicematrix_code_before_tl { \__nicematrix_rectanglecolor - { \l_tmpc_tl } + { \l__nicematrix_tmpc_tl } { \int_use:N \c@iRow - \int_use:N \c@jCol } { \int_use:N \c@iRow - * } } @@ -4375,7 +4373,7 @@ \tl_gput_right:Nx \g_nicematrix_code_before_tl { \__nicematrix_rowcolor - { \l_tmpc_tl } + { \l__nicematrix_tmpc_tl } { \int_eval:n { \c@iRow + 1 } - \int_eval:n { \c@iRow + \l__nicematrix_key_nb_rows_int - 1 } @@ -4503,13 +4501,13 @@ \cs_new_protected:Npn \__nicematrix_rectanglecolor:nnn #1 #2 #3 { \__nicematrix_cut_on_hyphen:w #1 \q_stop - \tl_clear_new:N \l_tmpc_tl - \tl_clear_new:N \l_tmpd_tl - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_clear_new:N \l__nicematrix_tmpc_tl + \tl_clear_new:N \l__nicematrix_tmpd_tl + \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl \__nicematrix_cut_on_hyphen:w #2 \q_stop - \tl_set:Nx \l__nicematrix_rows_tl { \l_tmpc_tl - \l_tmpa_tl } - \tl_set:Nx \l__nicematrix_cols_tl { \l_tmpd_tl - \l_tmpb_tl } + \tl_set:Nx \l__nicematrix_rows_tl { \l__nicematrix_tmpc_tl - \l_tmpa_tl } + \tl_set:Nx \l__nicematrix_cols_tl { \l__nicematrix_tmpd_tl - \l_tmpb_tl } \__nicematrix_cartesian_path:n { #3 } } \NewDocumentCommand \__nicematrix_cellcolor { O { } m m } @@ -4573,9 +4571,9 @@ \bool_if:NTF \l__nicematrix_rowcolors_restart_bool { \int_set:Nn \l__nicematrix_color_int 1 } { \int_set:Nn \l__nicematrix_color_int \l_tmpa_tl } - \int_zero_new:N \l_tmpc_int - \int_set:Nn \l_tmpc_int \l_tmpb_tl - \int_do_until:nNnn \l_tmpa_int > \l_tmpc_int + \int_zero_new:N \l__nicematrix_tmpc_int + \int_set:Nn \l__nicematrix_tmpc_int \l_tmpb_tl + \int_do_until:nNnn \l_tmpa_int > \l__nicematrix_tmpc_int { \int_set_eq:NN \l_tmpb_int \l_tmpa_int \bool_if:NT \l__nicematrix_respect_blocks_bool @@ -4667,11 +4665,11 @@ { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } \int_compare:nNnT \l_tmpb_tl > \c@jCol { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl \__nicematrix_qpoint:n { col - \l_tmpa_tl } \int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpa_tl - { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } - { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } + { \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } + { \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl } \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } \clist_map_inline:Nn \l__nicematrix_rows_tl @@ -4686,15 +4684,15 @@ \int_compare:nNnT \l_tmpb_tl > \c@iRow { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } \seq_if_in:NxF \l__nicematrix_corners_cells_seq - { \l_tmpa_tl - \l_tmpc_tl } + { \l_tmpa_tl - \l__nicematrix_tmpc_tl } { \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpb_tl } \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } \__nicematrix_qpoint:n { row - \l_tmpa_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } + \dim_set:Nn \l__nicematrix_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } \pgfsetcornersarced { \pgfpoint { #1 } { #1 } } \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l__nicematrix_tmpc_dim \l__nicematrix_tmpd_dim } { \pgfpoint \l_tmpa_dim \l_tmpb_dim } } } @@ -4801,7 +4799,9 @@ sep-color .value_required:n = true , tikz .tl_set:N = \l__nicematrix_tikz_rule_tl , tikz .value_required:n = true , - tikz .initial:n = + tikz .initial:n = , + width .dim_set:N = \l__nicematrix_rule_width_dim , + width .value_required:n = true } \cs_new_protected:Npn \__nicematrix_vline:n #1 { @@ -4896,7 +4896,7 @@ \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_position_int } \dim_set_eq:NN \l_tmpb_dim \pgf@x \__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@y \bool_lazy_all:nT { { \int_compare_p:nNn \l__nicematrix_multiplicity_int > 1 } @@ -4907,26 +4907,26 @@ \group_begin: \CT@drsc@ \dim_add:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } - \dim_sub:Nn \l_tmpc_dim { 0.5 \arrayrulewidth } - \dim_set:Nn \l_tmpd_dim + \dim_sub:Nn \l__nicematrix_tmpc_dim { 0.5 \arrayrulewidth } + \dim_set:Nn \l__nicematrix_tmpd_dim { \l_tmpb_dim - ( \doublerulesep + \arrayrulewidth ) * ( \l__nicematrix_multiplicity_int - 1 ) } \pgfpathrectanglecorners { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - { \pgfpoint \l_tmpd_dim \l_tmpc_dim } + { \pgfpoint \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim } \pgfusepath { fill } \group_end: } \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \l__nicematrix_tmpc_dim } \prg_replicate:nn { \l__nicematrix_multiplicity_int - 1 } { \dim_sub:Nn \l_tmpb_dim \arrayrulewidth \dim_sub:Nn \l_tmpb_dim \doublerulesep \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \l__nicematrix_tmpc_dim } } \CT@arc@ \pgfsetlinewidth { 1.1 \arrayrulewidth } @@ -4958,13 +4958,13 @@ \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_local_start_int } \dim_set_eq:NN \l_tmpa_dim \pgf@y \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_position_int } - \dim_set_eq:NN \l_tmpb_dim \pgf@x + \dim_set:Nn \l_tmpb_dim { \pgf@x - 0.5 \l__nicematrix_rule_width_dim } \__nicematrix_qpoint:n { row - \int_eval:n { \l__nicematrix_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@y \exp_args:NV \tikzset \l__nicematrix_tikz_rule_tl \use:x { \exp_not:N \draw [ \l__nicematrix_tikz_rule_tl ] } ( \l_tmpb_dim , \l_tmpa_dim ) -- - ( \l_tmpb_dim , \l_tmpc_dim ) ; + ( \l_tmpb_dim , \l__nicematrix_tmpc_dim ) ; \end { tikzpicture } } \cs_new_protected:Npn \__nicematrix_draw_vlines: @@ -5077,7 +5077,7 @@ \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_position_int } \dim_set_eq:NN \l_tmpb_dim \pgf@y \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@x \bool_lazy_all:nT { { \int_compare_p:nNn \l__nicematrix_multiplicity_int > 1 } @@ -5087,25 +5087,25 @@ { \group_begin: \CT@drsc@ - \dim_set:Nn \l_tmpd_dim + \dim_set:Nn \l__nicematrix_tmpd_dim { \l_tmpb_dim - ( \doublerulesep + \arrayrulewidth ) * ( \l__nicematrix_multiplicity_int - 1 ) } \pgfpathrectanglecorners { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l__nicematrix_tmpc_dim \l__nicematrix_tmpd_dim } \pgfusepathqfill \group_end: } \pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim } \prg_replicate:nn { \l__nicematrix_multiplicity_int - 1 } { \dim_sub:Nn \l_tmpb_dim \arrayrulewidth \dim_sub:Nn \l_tmpb_dim \doublerulesep \pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim } } \CT@arc@ \pgfsetlinewidth { 1.1 \arrayrulewidth } @@ -5153,13 +5153,13 @@ \__nicematrix_qpoint:n { col - \int_use:N \l__nicematrix_local_start_int } \dim_set_eq:NN \l_tmpa_dim \pgf@x \__nicematrix_qpoint:n { row - \int_use:N \l__nicematrix_position_int } - \dim_set_eq:NN \l_tmpb_dim \pgf@y + \dim_set:Nn \l_tmpb_dim { \pgf@y - 0.5 \l__nicematrix_rule_width_dim } \__nicematrix_qpoint:n { col - \int_eval:n { \l__nicematrix_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@x \exp_args:NV \tikzset \l__nicematrix_tikz_rule_tl \use:x { \exp_not:N \draw [ \l__nicematrix_tikz_rule_tl ] } ( \l_tmpa_dim , \l_tmpb_dim ) -- - ( \l_tmpc_dim , \l_tmpb_dim ) ; + ( \l__nicematrix_tmpc_dim , \l_tmpb_dim ) ; \end { tikzpicture } } \cs_new_protected:Npn \__nicematrix_draw_hlines: @@ -5208,7 +5208,25 @@ \keys_define:nn { NiceMatrix / ColumnTypes } { } \cs_new_protected:Npn \__nicematrix_custom_line:n #1 { + \str_clear_new:N \l__nicematrix_command_str + \str_clear_new:N \l__nicematrix_letter_str + \dim_zero_new:N \l__nicematrix_rule_width_dim + \tl_clear:N \l_tmpa_tl + \bool_set_false:N \l_tmpa_bool + \bool_set_false:N \l_tmpb_bool \keys_set_known:nn { NiceMatrix / Custom-Line } { #1 } + \bool_if:NT \l_tmpa_bool + { + \cs_if_exist:NF \tikzpicture + { \__nicematrix_error:n { tikz~in~custom-line~without~tikz } } + \tl_if_empty:NF \l_tmpa_tl + { \__nicematrix_error:n { color~in~custom-line~with~tikz } } + } + \bool_if:NT \l_tmpb_bool + { + \bool_if:NF \l_tmpa_bool + { \__nicematrix_error:n { key~width~without~key~tikz } } + } \bool_lazy_and:nnTF { \str_if_empty_p:N \l__nicematrix_letter_str } { \str_if_empty_p:N \l__nicematrix_command_str } @@ -5232,7 +5250,19 @@ { \__nicematrix_error:n { Several~letters } } } \str_if_empty:NF \l__nicematrix_command_str - { \exp_args:NnV \__nicematrix_define_h_custom_line:nn { #1 } \l_tmpc_int } + { + \bool_if:NF \l_tmpa_bool + { + \dim_set:Nn \l__nicematrix_rule_width_dim + { + \arrayrulewidth * \l__nicematrix_tmpc_int + + \doublerulesep * ( \l__nicematrix_tmpc_int - 1 ) + } + } + \exp_args:NnV \__nicematrix_define_h_custom_line:nn + { #1 } + \l__nicematrix_rule_width_dim + } } } \str_const:Nn \c__nicematrix_forbidden_letters_str { lcrpmbVX:|()[]!@<> } @@ -5240,13 +5270,17 @@ { letter .str_set:N = \l__nicematrix_letter_str , letter .value_required:n = true , - letter .initial:n = , command .str_set:N = \l__nicematrix_command_str , command .value_required:n = true , - command .initial:n = , - multiplicity .int_set:N = \l_tmpc_int , + multiplicity .int_set:N = \l__nicematrix_tmpc_int , multiplicity .initial:n = 1 , multiplicity .value_required:n = true , + color .tl_set:N = \l_tmpa_tl , + color. value_required:n = true , + tikz .code:n = \bool_set_true:N \l_tmpa_bool , + width .code:n = \dim_set:Nn \l__nicematrix_rule_width_dim { #1 } + \bool_set_true:N \l_tmpb_bool , + width .value_required:n = true , } \cs_new_protected:Npn \__nicematrix_define_h_custom_line:nn #1 #2 { @@ -5254,11 +5288,7 @@ { \noalign { - \skip_vertical:n - { - \dim_eval:n - { \arrayrulewidth * #2 + \doublerulesep * ( #2 - 1) } - } + \skip_vertical:n { #2 } \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl { \__nicematrix_hline:n { #1 , position = \int_eval:n { \c@iRow + 1 } } } } @@ -5266,21 +5296,20 @@ } \cs_new_protected:Npn \__nicematrix_custom_line_i:n #1 { - \tl_gput_right:Nx \g__nicematrix_preamble_tl + \bool_if:NF \l_tmpa_bool { - \exp_not:N ! + \dim_set:Nn \l__nicematrix_rule_width_dim { - \skip_horizontal:n - { - \dim_eval:n - { - \arrayrulewidth * \l_tmpc_int - + \doublerulesep * ( \l_tmpc_int - 1) - } - } + \arrayrulewidth * \l__nicematrix_tmpc_int + + \doublerulesep * ( \l__nicematrix_tmpc_int - 1) } } - \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl + \tl_gput_right:Nx \g__nicematrix_preamble_tl + { + \exp_not:N ! + { \skip_horizontal:n { \dim_use:N \l__nicematrix_rule_width_dim } } + } + \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl { \__nicematrix_vline:n { #1 , position = \__nicematrix_succ:n \c@jCol } } } \cs_new_protected:Npn \__nicematrix_test_hline_in_block:nnnnn #1 #2 #3 #4 @@ -6116,12 +6145,12 @@ \__nicematrix_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { \l__nicematrix_last_row_int } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@y \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x + \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@x \__nicematrix_pgf_rect_node:nnnnn { \__nicematrix_env: - #1 - #2 - block } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim + \l_tmpb_dim \l_tmpa_dim \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim \str_if_empty:NF \l__nicematrix_block_name_str { \pgfnodealias @@ -6154,7 +6183,7 @@ \__nicematrix_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x } - \dim_set:Nn \l_tmpd_dim { - \c_max_dim } + \dim_set:Nn \l__nicematrix_tmpd_dim { - \c_max_dim } \int_step_inline:nnn \l__nicematrix_first_row_int \g__nicematrix_row_total_int { \cs_if_exist:cT @@ -6165,18 +6194,18 @@ \pgfpointanchor { \__nicematrix_env: - ##1 - \int_use:N \l__nicematrix_last_col_int } { east } - \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + \dim_set:Nn \l__nicematrix_tmpd_dim { \dim_max:nn \l__nicematrix_tmpd_dim \pgf@x } } } } - \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } + \dim_compare:nNnT \l__nicematrix_tmpd_dim = { - \c_max_dim } { \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { \l__nicematrix_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x + \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@x } \__nicematrix_pgf_rect_node:nnnnn { \__nicematrix_env: - #1 - #2 - block - short } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim + \l_tmpb_dim \l_tmpa_dim \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim } \bool_if:NT \l__nicematrix_medium_nodes_bool { @@ -6304,7 +6333,7 @@ \__nicematrix_qpoint:n { row - \l_tmpa_tl } \dim_set:Nn \l_tmpb_dim { \pgf@y } \__nicematrix_qpoint:n { col - \l_tmpb_tl } - \dim_set:Nn \l_tmpc_dim { \pgf@x } + \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@x } \__nicematrix_cut_on_hyphen:w #3 \q_stop \int_compare:nNnT \l_tmpa_tl > \c@iRow { \tl_set:Nx \l_tmpa_tl { \int_use:N \c@iRow } } @@ -6313,10 +6342,10 @@ \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpa_tl } \dim_set:Nn \l_tmpa_dim { \pgf@y } \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@x } + \dim_set:Nn \l__nicematrix_tmpd_dim { \pgf@x } \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpb_dim } - { \pgfpoint \l_tmpd_dim \l_tmpa_dim } + { \pgfpoint \l__nicematrix_tmpc_dim \l_tmpb_dim } + { \pgfpoint \l__nicematrix_tmpd_dim \l_tmpa_dim } \pgfsetlinewidth { 1.1 \l__nicematrix_line_width_dim } \pgfusepath { stroke } } @@ -6337,19 +6366,19 @@ \dim_set_eq:NN \l__nicematrix_line_width_dim \arrayrulewidth \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } \__nicematrix_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl \__nicematrix_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } - \int_step_inline:nnn \l_tmpd_tl \l_tmpb_tl + \int_step_inline:nnn \l__nicematrix_tmpd_tl \l_tmpb_tl { \use:x { \__nicematrix_vline:n { position = ##1 , - start = \l_tmpc_tl , + start = \l__nicematrix_tmpc_tl , end = \__nicematrix_pred:n \l_tmpa_tl } } @@ -6360,19 +6389,19 @@ \dim_set_eq:NN \l__nicematrix_line_width_dim \arrayrulewidth \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } \__nicematrix_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl \__nicematrix_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } - \int_step_inline:nnn \l_tmpc_tl \l_tmpa_tl + \int_step_inline:nnn \l__nicematrix_tmpc_tl \l_tmpa_tl { \use:x { \__nicematrix_hline:n { position = ##1 , - start = \l_tmpd_tl , + start = \l__nicematrix_tmpd_tl , end = \int_eval:n { \l_tmpb_tl - 1 } } } @@ -6391,8 +6420,8 @@ { \__nicematrix_error:nn { bad~border } { ##1 } } } \__nicematrix_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl \__nicematrix_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } @@ -6404,28 +6433,28 @@ \clist_if_in:NnT \l__nicematrix_borders_clist { right } { \__nicematrix_stroke_vertical:n \l_tmpb_tl } \clist_if_in:NnT \l__nicematrix_borders_clist { left } - { \__nicematrix_stroke_vertical:n \l_tmpd_tl } + { \__nicematrix_stroke_vertical:n \l__nicematrix_tmpd_tl } \clist_if_in:NnT \l__nicematrix_borders_clist { bottom } { \__nicematrix_stroke_horizontal:n \l_tmpa_tl } \clist_if_in:NnT \l__nicematrix_borders_clist { top } - { \__nicematrix_stroke_horizontal:n \l_tmpc_tl } + { \__nicematrix_stroke_horizontal:n \l__nicematrix_tmpc_tl } \endpgfpicture } } \cs_new_protected:Npn \__nicematrix_stroke_vertical:n #1 { - \__nicematrix_qpoint:n \l_tmpc_tl + \__nicematrix_qpoint:n \l__nicematrix_tmpc_tl \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \l__nicematrix_line_width_dim } \__nicematrix_qpoint:n \l_tmpa_tl - \dim_set:Nn \l_tmpc_dim { \pgf@y + 0.5 \l__nicematrix_line_width_dim } + \dim_set:Nn \l__nicematrix_tmpc_dim { \pgf@y + 0.5 \l__nicematrix_line_width_dim } \__nicematrix_qpoint:n { #1 } \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \pgf@x \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l__nicematrix_tmpc_dim } \pgfusepathqstroke } \cs_new_protected:Npn \__nicematrix_stroke_horizontal:n #1 { - \__nicematrix_qpoint:n \l_tmpd_tl + \__nicematrix_qpoint:n \l__nicematrix_tmpd_tl \clist_if_in:NnTF \l__nicematrix_borders_clist { left } { \dim_set:Nn \l_tmpa_dim { \pgf@x - 0.5 \l__nicematrix_line_width_dim } } { \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \l__nicematrix_line_width_dim } } @@ -6581,10 +6610,10 @@ \dim_set_eq:NN \l_tmpb_dim \pgf@x \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } \__nicematrix_qpoint:n { row - \__nicematrix_succ:n { #3 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l__nicematrix_tmpc_dim \pgf@y \__nicematrix_qpoint:n { col - \__nicematrix_succ:n { #4 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x - \pgfpathlineto { \pgfpoint \l_tmpd_dim \l_tmpc_dim } + \dim_set_eq:NN \l__nicematrix_tmpd_dim \pgf@x + \pgfpathlineto { \pgfpoint \l__nicematrix_tmpd_dim \l__nicematrix_tmpc_dim } { \CT@arc@ \pgfsetroundcap @@ -6592,7 +6621,7 @@ } \pgfset { inner~sep = 1 pt } \pgfscope - \pgftransformshift { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgftransformshift { \pgfpoint \l_tmpb_dim \l__nicematrix_tmpc_dim } \pgfnode { rectangle } { south~west } { \begin { minipage } { 20 cm } @@ -6602,7 +6631,7 @@ { } { } \endpgfscope - \pgftransformshift { \pgfpoint \l_tmpd_dim \l_tmpa_dim } + \pgftransformshift { \pgfpoint \l__nicematrix_tmpd_dim \l_tmpa_dim } \pgfnode { rectangle } { north~east } { \begin { minipage } { 20 cm } @@ -6767,18 +6796,18 @@ \peek_remove_spaces:n { \__nicematrix_cut_on_hyphen:w #3 \q_stop - \tl_clear_new:N \l_tmpc_tl - \tl_clear_new:N \l_tmpd_tl - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_clear_new:N \l__nicematrix_tmpc_tl + \tl_clear_new:N \l__nicematrix_tmpd_tl + \tl_set_eq:NN \l__nicematrix_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l__nicematrix_tmpd_tl \l_tmpb_tl \__nicematrix_cut_on_hyphen:w #2 \q_stop \seq_gput_right:Nx \g__nicematrix_submatrix_seq - { { \l_tmpa_tl } { \l_tmpb_tl } { \l_tmpc_tl } { \l_tmpd_tl } } + { { \l_tmpa_tl } { \l_tmpb_tl } { \l__nicematrix_tmpc_tl } { \l__nicematrix_tmpd_tl } } \tl_gput_right:Nn \g__nicematrix_internal_code_after_tl { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] } } } -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l__nicematrix_argspec_tl { m m m m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l__nicematrix_argspec_tl { } \l__nicematrix_argspec_tl @@ -7255,12 +7284,6 @@ renew-dots,~and renew-matrix. } -\__nicematrix_msg_new:nn { Key~transparent } - { - The~key~'transparent'~is~now~obsolete~(because~it's~name~ - is~not~clear).~You~must~use~the~conjonction~of~'renew-dots'~ - and~'renew-matrix'.~This~error~is~fatal. - } \keys_define:nn { NiceMatrix / Package } { renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool , @@ -7495,6 +7518,11 @@ You~can't~use~the~letter~'\l__nicematrix_letter_str'~for~a~customized~line.\\ If~you~go~on,~it~will~be~ignored. } +\__nicematrix_msg_new:nn { key~width~without~key~tikz } + { + In~'custom-line',~you~have~used~'width'~without~'tikz'.~That's~not~correct.~ + If~you~go~on,~that~key~'width'~will~be~discarded. + } \__nicematrix_msg_new:nn { Several~letters } { You~must~use~only~one~letter~as~value~for~the~key~'letter'~(and~ @@ -7625,6 +7653,19 @@ ~because~you~haven't~loaded~'enumitem'.\\ If~you~go~on,~this~command~will~be~ignored. } +\__nicematrix_msg_new:nn { tikz~in~custom-line~without~tikz } + { + You~have~used~the~key~'tikz'~in~the~definition~of~a~ + customized~line~(with~'custom-line')~but~Tikz~is~not~loaded.~ + You~can~go~on~but~you~will~have~another~error~if~you~actually~ + use~that~custom~line. + } +\__nicematrix_msg_new:nn { color~in~custom-line~with~tikz } + { + In~a~'custom-line',~you~have~used~both~'tikz'~and~'color',~ + which~is~forbidden~(you~should~use~'color'~inside~the~key~'tikz').~ + If~you~go~on,~the~key~'color'~will~be~discarded. + } \__nicematrix_msg_new:nn { Wrong~last~row } { You~have~used~'last-row=\int_use:N \l__nicematrix_last_row_int'~but~your~ -- cgit v1.2.3