From 6b9ed20cb01cb52c7aaf2a48202f5d8aa588ff79 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 3 Mar 2022 03:01:15 +0000 Subject: CTAN sync 202203030301 --- .../latex/contrib/nicematrix/nicematrix-french.pdf | Bin 502752 -> 501207 bytes .../latex/contrib/nicematrix/nicematrix-french.tex | 241 ++++----- macros/latex/contrib/nicematrix/nicematrix.dtx | 583 ++++++++++++--------- macros/latex/contrib/nicematrix/nicematrix.pdf | Bin 1489647 -> 1502769 bytes 4 files changed, 445 insertions(+), 379 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 060eb81773..2c086429fa 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 d97d20c70e..e4f2286cf9 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -113,7 +113,7 @@ spécial & 12 & 12 & 0.5 & 70 \\ L'extension \pkg{nicematrix} est entièrement contenue dans le fichier |nicematrix.sty|. Ce fichier peut être placé dans le répertoire courant ou dans une arborescence |texmf|. Le mieux reste néanmoins d'installer \pkg{nicematrix} -avec une distribution TeX comme MiKTeX, TeXlive ou MacTeX. +avec une distribution TeX comme MiKTeX, TeX~Live ou MacTeX. \medskip \emph{Remarque} : Si vous utilisez un service LaTeX via Internet (ex. : @@ -137,26 +137,29 @@ chargée). L'utilisateur final n'a qu'à charger l'extension \pkg{nicematrix} av l'instruction habituelle : |\usepackage{nicematrix}|. \medskip -Si vous utilisez une distribution TeXLive, sachez que TeXLive 2020 au minimum +Si vous utilisez une distribution TeX~Live, sachez que TeX~Live 2020 au minimum est requis pour faire fonctionner \pkg{nicematrix}. \medskip -L'idée de \pkg{nicematrix} est de créer des nœuds \textsc{pgf} derrière les cases et les positions des filets des -tableaux créés par \pkg{array} et de les utiliser pour développer de nouvelles fonctionnalités. Comme toujours avec -\textsc{pgf}, les coordonnées de ces nœuds sont écrites dans le fichier |aux| pour être utilisées à la -compilation suivante. C'est pourquoi l'utilisation de \pkg{nicematrix} nécessite \textbf{plusieurs compilations +L'idée de \pkg{nicematrix} est de créer des nœuds \textsc{pgf} derrière les +cases et les positions des filets des tableaux créés par \pkg{array} et de les +utiliser pour développer de nouvelles fonctionnalités. Comme toujours avec +\textsc{pgf}, les coordonnées de ces nœuds sont écrites dans le fichier |aux| +pour être utilisées à la compilation suivante. C'est pourquoi l'utilisation de +\pkg{nicematrix} nécessite \textbf{plusieurs compilations successives}.\footnote{Si vous utilisez Overleaf, Overleaf effectue - automatiquement le nombre de - compilations nécessaire.} + automatiquement le nombre de compilations nécessaire.} \medskip -La plupart des fonctionnalités de \pkg{nicematrix} sont accessibles sans avoir à utiliser explicitement -\textsc{pgf} ou Tikz (ce dernier n'est d'ailleurs pas chargé par défaut). +La plupart des fonctionnalités de \pkg{nicematrix} sont accessibles sans avoir à +utiliser explicitement \textsc{pgf} ou Tikz (ce dernier n'est d'ailleurs pas +chargé par défaut). \medskip -Une commande|\NiceMatrixOptions| est fournie pour régler les options (la portée des options fixées par cette -commande est le groupe TeX courant : elles sont semi-globales). +Une commande|\NiceMatrixOptions| est fournie pour régler les options (la portée +des options fixées par cette commande est le groupe TeX courant : elles sont +semi-globales). \newpage @@ -528,9 +531,6 @@ d'intérêt que si |draw| ou |hvlines| est utilisée) ; par |draw| et le fond dessiné par |fill|) avec un rayon égal à la valeur de cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur par défaut est la valeur initiale des \emph{rounded corners} de Tikz.}) ; -\item la clé |borders| permet de ne tracer que certaines des bordures du bloc : -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 les clés |hlines|, |vlines| et |hvlines| tracent les filets correspondants @@ -540,14 +540,21 @@ 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é +applicables à un chemin de Tikz). Pour des exemples d'utilisation de cette clé |tikz|, voir p.~\pageref{tikz-key-examples} ; -\item \colorbox{yellow!50}{\textbf{Nouveau 6.3}}\enskip la clé |name| donne un -nom au nœud Tikz rectangulaire correspondant au bloc ; on peut utiliser ce nom -avec Tikz dans le |\CodeAfter| (cf p.~\pageref{code-after}); +\item la clé |name| donne un nom au nœud Tikz rectangulaire correspondant au +bloc ; on peut utiliser ce nom avec Tikz dans le |\CodeAfter| (cf.~p.~\pageref{code-after}); \item \colorbox{yellow!50}{\textbf{Nouveau 6.5}}\enskip la clé |respect-arraystretch| évite la remise à $1$ de |\arraystretch| en début de -bloc (qui a lieu par défaut). +bloc (qui a lieu par défaut) ; +\item la clé |borders| permet de ne tracer que certaines des bordures du bloc : +cette clé prend comme valeur une liste d'éléments parmi les suivants : |left|, +|right|, |top| et |bottom| ; \newline +\colorbox{yellow!50}{\textbf{Nouveau 6.7}}\enskip on peut en fait, dans la liste +qui est la valeur de la clé |borders| mettre une entrée de la forme +|tikz={|\textsl{liste}|}| où \textsl{liste} est une liste de couples +\textsl{clé=valeur} de Tikz spécifiant les caractéristiques graphiques des +traits qui seront dessinés (pour un exemple, voir p.~\pageref{tiretes}). \end{itemize} @@ -824,12 +831,6 @@ Il reste néanmoins possible de définir un spécificateur, nommé par exemple \newcolumntype{I}{!{\vrule}} \end{Verbatim} -En fait, en l'occurrence, il serait peut-être plus habile d'insérer -|\OnlyMainNiceMatrix| (cf. p.~\pageref{OnlyMainNiceMatrix}) : -\begin{Verbatim} -\newcolumntype{I}{!{\OnlyMainNiceMatrix{\vrule}}} -\end{Verbatim} - \subsubsection{La commande \textbackslash cline} @@ -935,12 +936,6 @@ muguet & dahlia & souci \\ \end{NiceTabular} \end{scope} -\medskip -Si on veut définir de nouveaux spécificateurs de colonnes pour des filets (par -exemple plus épais ou bien d'une couleur spécifique), on aura peut-être intérêt -à utiliser la commande |\OnlyMainNiceMatrix| décrite -p.~\pageref{OnlyMainNiceMatrix}. - \medskip @@ -1082,9 +1077,7 @@ A & A & A & A & A & A \\ \medskip Quand la clé |corners| est utilisée, \pkg{nicematrix} calcule les coins vides et ces coins sont alors pris en compte par les outils de tracés de filets (les -filets ne seront pas tracés dans ces coins vides). \emph{Remarque} : Dans les -versions précédentes de \pkg{nicematrix}, il n'y avait qu'une clé -|hvlines-except-corners| (maintenant considérée comme obsolète). +filets ne seront pas tracés dans ces coins vides). \medskip \begin{BVerbatim}[boxwidth=11cm,baseline=c] @@ -1183,8 +1176,7 @@ Cette commande |\diagbox| peut aussi être utilisée dans un |\Block|. Dans les environnements de \pkg{nicematrix}, il est possible d'utiliser la commande |\hdottedline| (fournie par \pkg{nicematrix}) qui est l'équivalent pour -les pointillés des commandes |\hline| et |\hdashline| (cette dernière étant une -commande de \pkg{arydshln}). +les pointillés de la commande |\hline|. \medskip \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] @@ -1225,11 +1217,7 @@ $\begin{pNiceArray}{cccc:c} \medskip Il est possible de changer dans \pkg{nicematrix} la lettre utilisée pour indiquer dans le préambule un trait vertical en pointillés avec l'option -|letter-for-dotted-lines| disponible dans |\NiceMatrixOptions|. -Ainsi libérée, la lettre «|:|» peut être utilisée par ailleurs (par exemple par -l'extension \pkg{arydshln}\footnote{On remarquera néanmoins que l'extension - \pkg{arydshln} n'est pas parfaitement compatible avec l'extension \pkg{nicematrix}.}). - +|letter-for-dotted-lines| disponible dans |\NiceMatrixOptions|. \medskip \emph{Remarque} : Quand l'extension \pkg{array} (sur laquelle s'appuie @@ -1241,6 +1229,7 @@ largeur du trait\footnote{En fait, avec l'extension \pkg{array}, cela est vrai tracées par |\hdottedline| et «|:|» ont ce même effet. \subsection{Commandes pour filets personnalisés} +\label{custom-line} \colorbox{yellow!50}{\textbf{Nouveau 6.5}}\enskip Il est possible de définir des commandes et des lettres pour des filets personnalisés avec la clé @@ -1255,9 +1244,9 @@ qui sera créée par \pkg{nicematrix} et que l'utilisateur pourra utiliser pour tracer des filets horizontaux (de manière similaire à |\hline|) ; \item la clé |letter| prend en argument une lettre\footnote{Les lettres - suivantes ne sont pas autorisées : \verb+lcrpmbVX:|()[]!@<>+} qui pourra être utilisée par -l'utilisateur dans le préambule d'un environnement à préambule (comme -|{NiceTabular}|) pour spécifier un filet vertical. + suivantes ne sont pas autorisées : \verb+lcrpmbVX:|()[]!@<>+} qui pourra être +utilisée par l'utilisateur dans le préambule d'un environnement à préambule +(comme |{NiceTabular}|) pour spécifier un filet vertical. \end{itemize} \bigskip @@ -1282,7 +1271,7 @@ environnement ; d'intérêt que dans le cas où la clé |multiplicity| est utilisée). \end{itemize} -\bigskip +\medskip \item \emph{Deuxième possibilité}\par\nobreak On peut utiliser la clé |dotted| qui impose un style de pointillés qui utilise @@ -1290,7 +1279,7 @@ 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 +\medskip \item \colorbox{yellow!50}{\textbf{Nouveau 6.6}}\enskip \emph{Troisième possibilité} @@ -1948,23 +1937,20 @@ seront appliquées à chacune des cases restantes sur la rangée en cours. Elle prend aussi en premier argument optionnel, entre crochets, une liste de couples \textsl{clé=valeur}. \begin{itemize} -\item \colorbox{yellow!50}{\bfseries Nouveau 6.3}\enskip La clé |nb-rows| -indique le nombre de rangées consécutives concernées par les spécifications de -cette commande. +\item La clé |nb-rows| indique le nombre de rangées consécutives concernées par +les spécifications de cette commande. \item Les clés |cell-space-top-limit|, |cell-space-bottom-limit| et |cell-space-limits| sont disponibles avec le même effet que les clés globales de même nom (cf. p.~\pageref{cell-space}). -\item \colorbox{yellow!50}{\bfseries Nouveau 6.3}\enskip La clé |rowcolor| fixe -la couleur de fond et la clé |color| fixe la couleur du texte.\footnote{La clé - |color| utilise la commande |\color| mais insère aussi une instruction - |\leavevmode| devant. Cela évite un espace vertical parasite dans les cellules - qui correspondent à des colonnes de type |p|, |b|, |m| et |X| (qui débutent en - mode vertical).} +\item La clé |rowcolor| fixe la couleur de fond et la clé |color| fixe la +couleur du texte.\footnote{La clé |color| utilise la commande |\color| mais + insère aussi une instruction |\leavevmode| devant. Cela évite un espace + vertical parasite dans les cellules qui correspondent à des colonnes de type + |p|, |b|, |m| et |X| (qui débutent en mode vertical).} -\item \colorbox{yellow!50}{\bfseries Nouveau 6.3}\enskip La clé |bold| impose -des caractères gras aux éléments de la rangée, qu'ils soient en mode texte ou -bien en mode mathématique. +\item La clé |bold| impose des caractères gras aux éléments de la rangée, qu'ils +soient en mode texte ou bien en mode mathématique. \end{itemize} \medskip @@ -2391,11 +2377,10 @@ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\ \emph{Remarques} \begin{itemize}[beginpenalty=10000] \item Comme on peut le voir dans l'exemple précédent, les filets horizontaux et -verticaux ne s'étendent pas dans les rangées et colonnes extérieures. +verticaux ne s'étendent pas dans les rangées et colonnes extérieures. Cette +remarque s'applique aussi aux filets définis par les outils de personnalisation +de \pkg{nicematrix} (cf. la clé |custom-line| p.~\pageref{custom-line}). -Néanmoins, si on veut définir de nouveaux spécificateurs de colonnes pour des -filets (par exemple plus épais), on aura sans doute intérêt à utiliser la -commande |\OnlyMainNiceMatrix| décrite p.~\pageref{OnlyMainNiceMatrix}. \item Une spécification de couleur présente dans |code-for-first-row| s'applique à une ligne pointillée tracée dans cette «première rangée» (sauf si une valeur a été donnée à |xdots/color|). Idem pour les autres. @@ -2435,7 +2420,7 @@ ligne horizontale ; pour |\Vdots|, c'est une ligne verticale et pour |\Ddots| et |\Iddots|, ce sont des lignes diagonales. On peut changer la couleur d'une ligne avec l'option~|color|.\footnote{Il est aussi possible de changer la couleur de toutes ces lignes pointillées avec l'option |xdots/color| (\textsl{xdots} pour - rappeler que cela s'applique à |\Cdots|, |\Ldots|, |Vdots|, etc.) : cf. + rappeler que cela s'applique à |\Cdots|, |\Ldots|, |\Vdots|, etc.) : cf. p.~\pageref{customization}). }\par\nobreak \medskip @@ -2813,7 +2798,8 @@ par trois options (que l'on met entre crochets après la commande) : Ces options peuvent aussi être fixées avec |\NiceMatrixOptions|, comme options de |\CodeAfter|, ou bien au niveau d'un environnement mais elles doivent alors -être préfixées par |xdots|, ce qui fait que leurs noms deviennent : +être préfixées par |xdots| (\textsl{xdots} pour rappeler que cela s'applique à +|\Cdots|, |\Ldots|, |\Vdots|, etc.), ce qui fait que leurs noms deviennent : % \begin{itemize} \item |xdots/color| ; @@ -2907,9 +2893,9 @@ b & a & b & \Ddots & & \Vdots \\ Les lignes pointillées délimitent des blocs virtuels qui ont le même comportement vis à vis des filets que les blocs créés par |\Block| (les filets -spécifiés par le spécificateur \verb+|+ dans le préambule, la commande |\Hline| -et par les clés |vlines|, |hlines|, |hvlines| et |hvlines-except-borders| ne -sont pas tracés dans les blocs).\footnote{En revanche, la commande |\line| dans le |\CodeAfter| +spécifiés par le spécificateur \verb+|+ dans le préambule, la commande |\Hline|, +les clés |vlines|, |hlines|, |hvlines| et |hvlines-except-borders| et les outils +créés par |custom-line| ne sont pas tracés dans les blocs).\footnote{En revanche, la commande |\line| dans le |\CodeAfter| (cf.~p.~\pageref{line-in-code-after}) ne crée pas de bloc.} \medskip @@ -2941,7 +2927,8 @@ Pour améliorer la lisibilité du code, une syntaxe alternative est proposée : peut spécifier les instructions du |code-after| à la fin de l'environnement, après le mot-clé |\CodeAfter|. Bien que ce soit un mot-clé, |\CodeAfter| accepte quand même un argument optionnel (entre crochets). Les clés autorisées -forment un sous-ensemble des clés acceptées par |\NiceMatrixOptions|. +dans cet argument optionnel forment un sous-ensemble des clés acceptées par +|\NiceMatrixOptions|. \medskip Les utilisateurs expérimentés peuvent, en particulier, utiliser les nœuds @@ -3271,7 +3258,10 @@ c'est la position du filet vertical éventuel qui est utilisée (de même pour \item |shorten|, qui est la conjonction des clés |left-shorten| et |right-shorten| ; -\item |yshift|, qui déplace verticalement l'accolade (et son label). +\item |yshift|, qui déplace verticalement l'accolade (et son label) ; + +\item \colorbox{yellow!50}{\textbf{Nouveau 6.7}}\enskip |color| qui fixe la +couleur de l'accolade et du label. \end{itemize} \bigskip @@ -3579,8 +3569,7 @@ suivante (avec, bien sûr, des clés de \pkg{enumitem}) : La spécification |align = left| de ce style demande que le label de la note soit composé à gauche dans la boîte qui lui est dévolue. Ce réglage a l'avantage d'avoir les notes calées à gauche, ce qui est plaisant si on compose des -tableaux dans l'esprit de \pkg{booktabs} (voir par exemple la table -\ref{t:tabularnote}, p.~\pageref{t:tabularnote}). +tableaux dans l'esprit de \pkg{booktabs} (voir par exemple la table~\ref{t:tabularnote}, p.~\pageref{t:tabularnote}). \medskip La clé |notes/enumitem-keys| fournie par \pkg{nicematrix} permet modifier ce @@ -3958,6 +3947,14 @@ $\begin{NiceArrayWithDelims} \end{NiceArrayWithDelims}$ +\subsection{La commande \textbackslash OnlyMainNiceMatrix} + +La commande |\OnlyMainNiceMatrix| n'exécute son argument que si on se trouve +dans le tableau principal, c'est-à-dire que l'on n'est pas dans les rangées +extérieures. Si elle est utilisée hors d'un environnement de \pkg{nicematrix}, +elle est sans effet. + +Pour un exemple d'utilisation, voir \url{tex.stackexchange.com/questions/488566} \section{Utilisation de Tikz avec nicematrix} @@ -4627,52 +4624,6 @@ mante & raie & poule Première remarque : l'extension \pkg{nicematrix} doit être chargée après l'extension \pkg{underscore}. Si ce n'est pas le cas, une erreur est levée. -\subsection{Pour définir de nouveaux types de colonnes} - -\label{OnlyMainNiceMatrix} - -L'extension \pkg{nicematrix} fournit la commande |\OnlyMainNiceMatrix| qui est -destinée à être utilisée dans des définitions de nouveaux types de colonnes. Son -argument n'est exécuté que si on se place dans la partie principale du tableau, -c'est-à-dire que l'on n'est pas dans l'une des éventuelles rangées extérieures. - -Par exemple, si on souhaite définir un type de colonne |?| pour tracer un trait fort (noir) d'épaisseur 1~pt, on -pourra écrire\footnote{La commande |\vrule| est une commande de TeX (et non de LaTeX).} : -\begin{Verbatim} -\newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}} -\end{Verbatim} - -Le trait fort correspondant ne s'étendra pas dans les rangées -extérieures.\footnote{Un tel filet utilisant les techniques classiques de - \pkg{array}, il ne traversera pas les doubles filets horizontaux de |\hline\hline|.} - -\medskip -\begin{scope} -\newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}} - -\begin{BVerbatim}[baseline = c, boxwidth = 10.5cm] -$\begin{pNiceArray}{cc?cc}[first-row,last-row=3] -C_1 & C_2 & C_3 & C_4 \\ -a & b & c & d \\ -e & f & g & h \\ -C_1 & C_2 & C_3 & C_4 -\end{pNiceArray}$ -\end{BVerbatim} -$\begin{pNiceArray}{cc?cc}[first-row,last-row=3] -C_1 & C_2 & C_3 & C_4 \\ -a & b & c & d \\ -e & f & g & h \\ -C_1 & C_2 & C_3 & C_4 -\end{pNiceArray}$ -\end{scope} - -\medskip -Le spécificateur |?| ainsi créé est aussi utilisable dans les environnements -|{tabular}| et |{array}| (de \pkg{array}) et, dans ce cas, |\OnlyMainNiceMatrix| -est sans effet. - - - @@ -4831,16 +4782,6 @@ environnements de l'extension \pkg{nicematrix} ne sont pas affectés). \subsection{Incompatibilités} -L'extension \pkg{nicematrix} n'est pas parfaitement compatible avec l'extension \pkg{arydshln} (parce que cette -extension redéfinit de nombreuses commandes internes de \pkg{array}). - -Pour pouvoir utiliser \pkg{arydshln}, il faut, de toutes manières, au préalable, -libérer la lettre «|:|» en choisissant une autre lettre pour les filets verticaux -pointillés de \pkg{nicematrix} : - -\begin{Verbatim} -\NiceMatrixOptions{letter-for-dotted-lines=;} -\end{Verbatim} \medskip L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess} @@ -4866,6 +4807,15 @@ doit être chargé avant le |\documentclass|: \documentclass{sn-jnl} \end{Verbatim} +\medskip +L'extension \pkg{nicematrix} n'est pas parfaitement compatible avec l'extension +\pkg{arydshln} (parce que cette extension redéfinit de nombreuses commandes +internes de \pkg{array}). De toutes manières, dans le cadre de \pkg{nicematrix}, +il est conseillé de tracer les filets en tiretés avec les commandes de +\pkg{nicematrix} en créant un style de ligne personnalisée avec |custom-line| : +cf.~p.~\pageref{custom-line}. + + \section{Exemples} \subsection{Utilisation de la clé «tikz» de la commande \textbackslash Block} @@ -5163,6 +5113,41 @@ $\begin{pNiceMatrix}[first-row,first-col] \end{pNiceMatrix}\] \end{scope} +\subsection{Lignes en tiretés} + +\label{tiretes} + +Dans l'exemple suivant, on utilise des commandes |\Block| pour tracer des filets +en tiretés. Cet exemple nécessite que Tikz soit chargé (par +|\usepackage{tikz}|). + +\begin{Verbatim} +\begin{pNiceMatrix} +~emphase#\Block[borders={bottom,right,tikz=dashed}]{2-2}{}@ +1 & 2 & 0 & 0 & 0 & 0 \\ +4 & 5 & 0 & 0 & 0 & 0 \\ +0 & 0 & ~emphase#\Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{}@ + 7 & 1 & 0 & 0 \\ +0 & 0 & -1 & 2 & 0 & 0 \\ +0 & 0 & 0 & 0 & ~emphase#\Block[borders={left,top,tikz=dashed}]{2-2}{}@ + 3 & 4 \\ +0 & 0 & 0 & 0 & 1 & 4 +\end{pNiceMatrix} +\end{Verbatim} + + +\[\begin{pNiceMatrix} +\Block[borders={bottom,right,tikz=dashed}]{2-2}{} +1 & 2 & 0 & 0 & 0 & 0 \\ +4 & 5 & 0 & 0 & 0 & 0 \\ +0 & 0 & \Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{} + 7 & 1 & 0 & 0 \\ +0 & 0 & -1 & 2 & 0 & 0 \\ +0 & 0 & 0 & 0 & \Block[borders={left,top,tikz=dashed}]{2-2}{} + 3 & 4 \\ +0 & 0 & 0 & 0 & 1 & 4 +\end{pNiceMatrix}\] + \subsection{Empilements de matrices} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index cf717533a1..a1196bba16 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{6.6} -\def\myfiledate{2022/02/16} +\def\myfileversion{6.7} +\def\myfiledate{2022/03/02} % % %<*batchfile> @@ -158,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 such as MiKTeX, TeXlive or MacTeX. +% distribution such as MiKTeX, TeX Live or MacTeX. % % \medskip % \emph{Remark}: If you use LaTeX via Internet with, for example, Overleaf, you @@ -184,7 +184,7 @@ version 2005/12/01 or later. % |\usepackage{nicematrix}|. % % \medskip -% If you use TeXLive as TeX distribution, you should note that TeXLive 2020 at +% If you use TeX~Live as TeX distribution, you should note that TeX~Live 2020 at % least is required by \pkg{nicematrix}. % % \medskip @@ -571,9 +571,6 @@ version 2005/12/01 or later. % by |draw| and the shape drawn by |fill|) with a radius equal to the value of % that key (the default value is 4~pt\footnote{This value is the initial value % of the \emph{rounded corners} of Tikz.}); -% \item the key |borders| provides the ability to draw only some borders of the -% blocks; the value of that key is a (comma-separated) list of elements covered -% 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 |hlines|, |vlines| and |hvlines| draw all the corresponding @@ -584,13 +581,20 @@ version 2005/12/01 or later. % 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}; -% \item \colorbox{yellow!50}{\textbf{New 6.3}}\enskip the key |name| provides a -% name to the rectangular Tikz node corresponding to the block; it's possible to -% use that name with Tikz in the |\CodeAfter| of the environment -% (cf.~p.~\pageref{code-after}); +% \item the key |name| provides a name to the rectangular Tikz node +% corresponding to the block; it's possible to use that name with Tikz in the +% |\CodeAfter| of the environment (cf.~p.~\pageref{code-after}); % \item \colorbox{yellow!50}{\textbf{New 6.5}}\enskip the key % |respect-arraystretch| prevents the setting of |\arraystretch| to $1$ at the -% beginning of the block (which is the behaviour by default). +% beginning of the block (which is the behaviour by default) ; +% \item the key |borders| provides the ability to draw only some borders of the +% blocks; the value of that key is a (comma-separated) list of elements covered +% by |left|, |right|, |top| and |bottom|;\newline +% \colorbox{yellow!50}{\textbf{Nouveau 6.7}}\enskip it's possible, in fact, in +% the list which is the value of the key |borders|, to add an entry of the form +% |tikz={|\textsl{list}|}| where \textsl{list} is a list of couples +% \textsl{key=value} of Tikz specifying the graphical characteristics of the +% lines that will be drawn (for an example, see p.~\pageref{dashed}). % \end{itemize} % % \interitem @@ -853,12 +857,6 @@ version 2005/12/01 or later. % \newcolumntype{I}{!{\vrule}} % \end{Verbatim} % -% However, in this case, it is probably more clever to add a command -% |\OnlyMainNiceMatrix| (cf. p.~\pageref{OnlyMainNiceMatrix}): -% \begin{Verbatim} -% \newcolumntype{I}{!{\OnlyMainNiceMatrix{\vrule}}} -% \end{Verbatim} -% % % \bigskip % \subsubsection{The command \textbackslash cline} @@ -959,11 +957,6 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{scope} % -% \medskip -% If one wishes to define new specifiers for columns in order to draw vertical -% rules (for example with a specific color or thicker than the standard rules), -% he should consider the command |\OnlyMainNiceMatrix| described on -% page~\pageref{OnlyMainNiceMatrix}. % % % \subsection{The tools of nicematrix for the rules} @@ -987,7 +980,7 @@ version 2005/12/01 or later. % \pkg{nicematrix}.} presented % p.~\pageref{Block}; % \item the blocks implicitely delimited by the continuous dotted lines created -% by |\Cdots|, |Vdots|, etc. (cf.~p.~\pageref{Cdots}). +% by |\Cdots|, |\Vdots|, etc. (cf.~p.~\pageref{Cdots}). % \end{itemize} % \item The corners are created by the key |corners| explained below (see p.~\pageref{corners}). % \end{itemize} @@ -1098,9 +1091,7 @@ version 2005/12/01 or later. % \bigskip % When the key |corners| is used, \pkg{nicematrix} computes the (empty) corners % and these corners will be taken into account by the tools for drawing the -% rules (the rules won't be drawn in the corners). \emph{Remark}: In the -% previous versions of \pkg{nicematrix}, there was only a key -% |hvlines-except-corners| (now considered as obsolete). +% rules (the rules won't be drawn in the corners). % % \bigskip % \begin{BVerbatim}[boxwidth=11cm,baseline=c] @@ -1196,8 +1187,7 @@ version 2005/12/01 or later. % % In the environments of the package \pkg{nicematrix}, it's possible to use % the command |\hdottedline| (provided by \pkg{nicematrix}) which is a -% counterpart of the classical commands |\hline| and |\hdashline| (the latter is -% a command of \pkg{arydshln}). +% counterpart of the classical command |\hline|. % % \medskip % \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] @@ -1238,10 +1228,7 @@ version 2005/12/01 or later. % \bigskip % It's possible to change in \pkg{nicematrix} the letter used to specify a % vertical dotted line with the option |letter-for-dotted-lines| available in -% |\NiceMatrixOptions|. Thus released, the letter ``|:|'' can be used otherwise -% (for example by the package \pkg{arydshln}\footnote{However, one should remark -% that the package \pkg{arydshln} is not fully compatible with -% \pkg{nicematrix}.}). +% |\NiceMatrixOptions|. % % \bigskip % \emph{Remark}: In the package \pkg{array} (on which the package @@ -1253,7 +1240,8 @@ version 2005/12/01 or later. % % % \subsection{Commands for customized rules} -% +% \label{custom-line} +% % \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 @@ -1931,20 +1919,20 @@ version 2005/12/01 or later. % That command also takes in as optional argument (between square brackets) % a list of \textsl{key=value} pairs. % \begin{itemize} -% \item \colorbox{yellow!50}{\bfseries New 6.3}\enskip The key |nb-rows| sets +% \item The key |nb-rows| sets % the number of rows to which the specifications of the current command will % apply. % \item The keys |cell-space-top-limit|, |cell-space-bottom-limit| and % |cell-space-limits| are available with the same meaning that the corresponding % global keys (cf. p.~\pageref{cell-space}). -% \item \colorbox{yellow!50}{\bfseries New 6.3}\enskip The key |rowcolor| sets +% \item The key |rowcolor| sets % the color of the background and the key |color| sets the % color of the text.\footnote{The key |color| uses the command % |\color| but inserts also an instruction |\leavevmode| before. This % instruction prevents a extra vertical space in the cells which belong to % columns of type |p|, |b|, |m| and |X| (which start in % vertical mode).} -% \item \colorbox{yellow!50}{\bfseries New 6.3}\enskip The key |bold| enforces +% \item The key |bold| enforces % bold characters for the cells of the row, both in math mode and text mode. % \end{itemize} % @@ -2361,12 +2349,9 @@ version 2005/12/01 or later. % \emph{Remarks} % \begin{itemize}[beginpenalty=10000] % \item As shown in the previous example, the horizontal and vertical rules -% don't extend in the exterior rows and columns. -% -% However, if one wishes to define new specifiers for columns in order to draw -% vertical rules (for example thicker than the standard rules), he should -% consider the command |\OnlyMainNiceMatrix| described on -% page~\pageref{OnlyMainNiceMatrix}. +% don't extend in the exterior rows and columns. This remark also applies to the +% customized rules created by the key |custom-line| +% (cf.~p.~\pageref{custom-line}). % % \item A specification of color present in |code-for-first-row| also applies to % a dotted line drawn in that exterior ``first row'' (excepted if a value has @@ -2778,7 +2763,8 @@ version 2005/12/01 or later. % % These options may also be fixed with |\NiceMatrixOptions|, as options of % |\CodeAfter| or at the level of a given environment but, in those cases, they -% must be prefixed by |xdots|, and, thus have for names: +% must be prefixed by |xdots| (\textsl{xdots} to remind that it works for +% |\Cdots|, |\Ldots|, |\Vdots|, etc.), and, thus have for names: % \begin{itemize} % \item |xdots/color|; % \item |xdots/shorten|; @@ -2867,8 +2853,9 @@ version 2005/12/01 or later. % % The dotted lines determine virtual blocks which have the same behaviour % regarding the rules (the rules specified by the specifier \verb+|+ in the -% preamble, by the command |\Hline| and by the keys |hlines|, |vlines|, -% |hvlines| and |hvlines-except-borders| are not drawn within the +% preamble, by the command |\Hline|, by the keys |hlines|, |vlines|, +% |hvlines| and |hvlines-except-borders| and by the tools created by +% |custom-line| are not drawn within the % blocks).\footnote{On the other side, the command |\line| in the % |\CodeAfter| (cf.~p.~\pageref{line-in-code-after}) does \emph{not} create % block.} @@ -2903,7 +2890,8 @@ version 2005/12/01 or later. % possible to give the instructions of the |code-after| at the end of the % environment, after the keyword |\CodeAfter|. Although |\CodeAfter| is a % keyword, it takes in an optional argument (between square brackets). The keys -% accepted form a subset of the keys of the command |\WithArrowsOptions|. +% accepted in that optional ragument form a subset of the keys of the command +% |\WithArrowsOptions|. % % % \medskip @@ -3230,7 +3218,10 @@ version 2005/12/01 or later. % \item |shorten|, which is the conjunction of the keys |left-shorten| and % |right-shorten|; % -% \item |yshift|, which shifts vertically the brace (and its label). +% \item |yshift|, which shifts vertically the brace (and its label) ; +% +% \item \colorbox{yellow!50}{\textbf{New 6.7}}\enskip |color|, which sets the +% color of the brace (and its label). % \end{itemize} % % \bigskip @@ -3904,7 +3895,13 @@ version 2005/12/01 or later. % 7 & 8 & 9 % \end{NiceArrayWithDelims}$ % +% \subsection{The command \textbackslash OnlyMainNiceMatrix} +% +% The command |\OnlyMainNiceMatrix| executes its argument only when it is in the +% main part of the array, that is to say it is not in one of the exterior rows. +% If it is used outside an environment of \pkg{nicematrix}, that command is no-op. % +% For an example of utilisation, see \url{tex.stackexchange.com/questions/488566} % % \section{Use of Tikz with nicematrix} % @@ -4024,10 +4021,9 @@ version 2005/12/01 or later. % \end{pNiceMatrix}\] % % -% \colorbox{yellow!50}{\bfseries New 6.3}\enskip The nodes of the last column -% (excepted the potential «last column» specified by |last-col|) may also be -% indicated by $i$-|last|. Similarly, the nodes of the last row may be indicated -% by |last|-$j$. +% The nodes of the last column (excepted the potential «last column» specified +% by |last-col|) may also be indicated by $i$-|last|. Similarly, the nodes of +% the last row may be indicated by |last|-$j$. % % \subsubsection{The columns V of varwidth} % @@ -4560,51 +4556,6 @@ version 2005/12/01 or later. % % \section{Technical remarks} % -% \subsection{Definition of new column types} -% -% \label{OnlyMainNiceMatrix} -% -% The package \pkg{nicematrix} provides the command |\OnlyMainNiceMatrix| -% which is meant to be used in definitions of new column types. Its argument is -% evaluated if and only if we are in the main part of the array, that is to say -% not in a potential exterior row. -% -% For example, one may wish to define a new column type |?| in order to draw a -% (black) heavy rule of width 1~pt. The following definition will do the -% job\footnote{The command |\vrule| is a TeX (and not LaTeX) command.}: -% -% \begin{Verbatim} -% \newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}} -% \end{Verbatim} -% -% The heavy vertical rule won't extend in the exterior rows.\footnote{Of course, -% such rule is defined by the classical technics of \pkg{nicematrix} and, for -% this reason, won't cross the double rules of |\hline\hline|.} -% \medskip -% \begin{scope} -% \newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}} -% -% \begin{BVerbatim}[baseline = c, boxwidth = 10.5cm] -% $\begin{pNiceArray}{cc?cc}[first-row,last-row=3] -% C_1 & C_2 & C_3 & C_4 \\ -% a & b & c & d \\ -% e & f & g & h \\ -% C_1 & C_2 & C_3 & C_4 -% \end{pNiceArray}$ -% \end{BVerbatim} -% $\begin{pNiceArray}{cc?cc}[first-row,last-row=3] -% C_1 & C_2 & C_3 & C_4 \\ -% a & b & c & d \\ -% e & f & g & h \\ -% C_1 & C_2 & C_3 & C_4 -% \end{pNiceArray}$ -% \end{scope} -% -% \medskip -% This specifier |?| may be used in the standard environments |{tabular}| and -% |{array}| (of the package \pkg{array}) and, in this case, the command -% |\OnlyMainNiceMatrix| is no-op. -% % % % \subsection{Diagonal lines} @@ -4753,20 +4704,10 @@ version 2005/12/01 or later. % % % -% \subsection{Incompatibilities} -% -% The package \pkg{nicematrix} is not fully compatible with the package -% \pkg{arydshln} (because this package redefines many internal of \pkg{array}). -% -% Anyway, in order to use \pkg{arydshln}, one must first free the letter ``|:|'' -% by giving a new letter for the vertical dotted rules of \pkg{nicematrix}: % -% \begin{Verbatim} -% \NiceMatrixOptions{letter-for-dotted-lines=;} -% \end{Verbatim} +% \subsection{Incompatibilities} % % -% \bigskip % The package \pkg{nicematrix} is not compatible with the class \cls{ieeeaccess} % (because that class is not compatible with PGF/Tikz).\footnote{See % \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}} @@ -4790,6 +4731,13 @@ version 2005/12/01 or later. % \documentclass{sn-jnl} % \end{Verbatim} % +% \bigskip +% The package \pkg{nicematrix} is not fully compatible with the package +% \pkg{arydshln} (because this package redefines many internal of \pkg{array}). +% By any means, in the context of \pkg{nicematrix}, it's recommended to draw +% dashed rules with the tools provided by \pkg{nicematrix}, by creating a +% customized line style with |custom-line|: cf.~p.~\pageref{custom-line}. +% % % \section{Examples} % @@ -5085,6 +5033,40 @@ version 2005/12/01 or later. % \end{pNiceMatrix}\] % \end{scope} % +% \subsection{Dashed rules} +% \label{dashed} +% +% In the following example, we use the command |\Block| to draw dashed rules. +% For that example, Tikz should be loaded (by |\usepackage{tikz}|). +% +% +% \begin{Verbatim} +% \begin{pNiceMatrix} +% ~emphase#\Block[borders={bottom,right,tikz=dashed}]{2-2}{}@ +% 1 & 2 & 0 & 0 & 0 & 0 \\ +% 4 & 5 & 0 & 0 & 0 & 0 \\ +% 0 & 0 & ~emphase#\Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{}@ +% 7 & 1 & 0 & 0 \\ +% 0 & 0 & -1 & 2 & 0 & 0 \\ +% 0 & 0 & 0 & 0 & ~emphase#\Block[borders={left,top,tikz=dashed}]{2-2}{}@ +% 3 & 4 \\ +% 0 & 0 & 0 & 0 & 1 & 4 +% \end{pNiceMatrix} +% \end{Verbatim} +% +% +% \[\begin{pNiceMatrix} +% \Block[borders={bottom,right,tikz=dashed}]{2-2}{} +% 1 & 2 & 0 & 0 & 0 & 0 \\ +% 4 & 5 & 0 & 0 & 0 & 0 \\ +% 0 & 0 & \Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{} +% 7 & 1 & 0 & 0 \\ +% 0 & 0 & -1 & 2 & 0 & 0 \\ +% 0 & 0 & 0 & 0 & \Block[borders={left,top,tikz=dashed}]{2-2}{} +% 3 & 4 \\ +% 0 & 0 & 0 & 0 & 1 & 4 +% \end{pNiceMatrix}\] +% % % \subsection{Stacks of matrices} % @@ -5725,16 +5707,8 @@ version 2005/12/01 or later. % \bigskip % \subsection*{Technical definitions} % -% % \medskip % \begin{macrocode} -\bool_new:N \c_@@_in_preamble_bool -\bool_set_true:N \c_@@_in_preamble_bool -\hook_gput_code:nnn { begindocument } { . } - { \bool_set_false:N \c_@@_in_preamble_bool } -% \end{macrocode} -% -% \begin{macrocode} \bool_new:N \c_@@_arydshln_loaded_bool \bool_new:N \c_@@_booktabs_loaded_bool \bool_new:N \c_@@_enumitem_loaded_bool @@ -5947,7 +5921,7 @@ version 2005/12/01 or later. \cs_set:Npn \@@_standard_cline:w #1-#2 \q_stop { \int_compare:nNnT \l_@@_first_col_int = 0 { \omit & } - \int_compare:nNnT { #1 } > 1 { \multispan { \@@_pred:n { #1 } } & } + \int_compare:nNnT { #1 } > 1 { \multispan { \int_eval:n { #1 - 1 } } & } \multispan { \int_eval:n { #2 - #1 + 1 } } { \CT@arc@ @@ -6016,19 +5990,12 @@ version 2005/12/01 or later. % several |\cline|). % \begin{macrocode} \peek_meaning_remove_ignore_spaces:NTF \cline - { & \@@_cline_i:en { \@@_succ:n { #3 } } } + { & \@@_cline_i:en { \int_eval:n { #3 + 1 } } } { \everycr { } \cr } } \cs_generate_variant:Nn \@@_cline_i:nn { e n } % \end{macrocode} % -% \bigskip -% The following commands are only for efficiency. They must \emph{not} be protected -% because it will be used (for instance) in names of \textsc{pgf} nodes. -% \begin{macrocode} -\cs_new:Npn \@@_succ:n #1 { \the \numexpr #1 + 1 \relax } -\cs_new:Npn \@@_pred:n #1 { \the \numexpr #1 - 1 \relax } -% \end{macrocode} % % \bigskip % The following command is a small shortcut. @@ -7358,7 +7325,13 @@ version 2005/12/01 or later. line-style .value_required:n = true , color .tl_set:N = \l_@@_xdots_color_tl , color .value_required:n = true , - shorten .dim_set:N = \l_@@_xdots_shorten_dim , + shorten .code:n = + \hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_xdots_shorten_dim { #1 } } , +% \end{macrocode} +% We use a hook only by security in case \cls{revtex4-1} +% is used (even though it is obsolete). +% \begin{macrocode} shorten .value_required:n = true , % \end{macrocode} % The options |down| and |up| are not documented for the final user because he @@ -7495,6 +7468,11 @@ version 2005/12/01 or later. % \begin{macrocode} hvlines-except-corners .code:n = { + \@@_error:n { hvlines-except-corners } + \group_begin: + \globaldefs = 1 + \@@_msg_redirect_name:nn { hvlines-except-corners } { none } + \group_end: \clist_set:Nn \l_@@_corners_clist { #1 } \clist_set:Nn \l_@@_vlines_clist { all } \clist_set:Nn \l_@@_hlines_clist { all } @@ -7570,34 +7548,20 @@ version 2005/12/01 or later. label-in-list .value_required:n = true , enumitem-keys .code:n = { - \bool_if:NTF \c_@@_in_preamble_bool - { - \hook_gput_code:nnn { begindocument } { . } - { - \bool_if:NT \c_@@_enumitem_loaded_bool - { \setlist* [ tabularnotes ] { #1 } } - } - } + \hook_gput_code:nnn { begindocument } { . } { - \bool_if:NT \c_@@_enumitem_loaded_bool - { \setlist* [ tabularnotes ] { #1 } } + \bool_if:NT \c_@@_enumitem_loaded_bool + { \setlist* [ tabularnotes ] { #1 } } } } , enumitem-keys .value_required:n = true , enumitem-keys-para .code:n = { - \bool_if:NTF \c_@@_in_preamble_bool - { - \hook_gput_code:nnn { begindocument } { . } - { - \bool_if:NT \c_@@_enumitem_loaded_bool - { \setlist* [ tabularnotes* ] { #1 } } - } - } + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c_@@_enumitem_loaded_bool { \setlist* [ tabularnotes* ] { #1 } } - } + } } , enumitem-keys-para .value_required:n = true , unknown .code:n = \@@_error:n { Unknown~key~for~notes } @@ -7736,7 +7700,7 @@ version 2005/12/01 or later. notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } , notes .value_required:n = true , sub-matrix .code:n = - \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , + \keys_set:nn { NiceMatrix / sub-matrix } { #1 } , sub-matrix .value_required:n = true , unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrixOptions } } @@ -8170,12 +8134,12 @@ version 2005/12/01 or later. } \box_use:N \l_@@_cell_box \box_move_down:nn { \box_dp:N \l_@@_cell_box } - \hbox_overlap_left:n - { - \pgfsys@markposition - { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol - SE } - #1 - } + \hbox_overlap_left:n + { + \pgfsys@markposition + { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol - SE } + #1 + } } } } @@ -8294,19 +8258,20 @@ version 2005/12/01 or later. \vtop { \skip_vertical:N 0.5\arrayrulewidth - \pgfsys@markposition { \@@_env: - row - \@@_succ:n \c@iRow } + \pgfsys@markposition + { \@@_env: - row - \int_eval:n { \c@iRow + 1 } } \skip_vertical:N -0.5\arrayrulewidth } } \pgfpicture \pgfrememberpicturepositiononpagetrue - \pgfcoordinate { \@@_env: - row - \@@_succ:n \c@iRow } + \pgfcoordinate { \@@_env: - row - \int_eval:n { \c@iRow + 1 } } { \pgfpoint \c_zero_dim { - 0.5 \arrayrulewidth } } \str_if_empty:NF \l_@@_name_str { \pgfnodealias - { \l_@@_name_str - row - \@@_succ:n \c@iRow } - { \@@_env: - row - \@@_succ:n \c@iRow } + { \l_@@_name_str - row - \int_eval:n { \c@iRow + 1 } } + { \@@_env: - row - \int_eval:n { \c@iRow + 1 } } } \endpgfpicture } @@ -8341,7 +8306,7 @@ version 2005/12/01 or later. \exp_args:NNx \clist_if_in:NnT \l_@@_hlines_clist - { \@@_succ:n \c@iRow } + { \int_eval:n { \c@iRow + 1 } } } { % \end{macrocode} @@ -9041,9 +9006,9 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_tmpa_dim \pgf@x \@@_qpoint:n { #1 } \dim_set_eq:NN \l_tmpb_dim \pgf@y - \@@_qpoint:n { col - \@@_succ:n { #4 } } + \@@_qpoint:n { col - \int_eval:n { #4 + 1 } } \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x - \@@_qpoint:n { \@@_succ:n { #3 } } + \@@_qpoint:n { \int_eval:n { #3 + 1 } } \dim_set_eq:NN \l_@@_tmpd_dim \pgf@y \@@_pgf_rect_node:nnnnn { \@@_env: - #5 } @@ -9834,7 +9799,7 @@ version 2005/12/01 or later. { \@@_vline:n { - position = \@@_succ:n \c@jCol , + position = \int_eval:n { \c@jCol + 1 } , multiplicity = \int_use:N \l_tmpa_int , } % \end{macrocode} @@ -10239,7 +10204,7 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_patch_preamble_viii_i:nn #1 #2 { \tl_gput_right:Nx \g_@@_internal_code_after_tl - { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool } + { \@@_delimiter:nnn #1 { \int_eval:n { \c@jCol + 1 } } \c_true_bool } \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 } { \@@_error:nn { delimiter~after~opening } { #2 } @@ -10454,7 +10419,7 @@ version 2005/12/01 or later. } { \exp_args:NNx - \clist_if_in:NnT \l_@@_vlines_clist { \@@_succ:n \c@jCol } + \clist_if_in:NnT \l_@@_vlines_clist { \int_eval:n { \c@jCol + 1 } } { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \skip_horizontal:N \arrayrulewidth } } @@ -10526,7 +10491,7 @@ version 2005/12/01 or later. \int_compare:nNnT { #1 } > 1 { \seq_gput_left:Nx \g_@@_multicolumn_cells_seq - { \int_use:N \c@iRow - \@@_succ:n \c@jCol } + { \int_use:N \c@iRow - \int_eval:n { \c@jCol + 1 } } \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } \seq_gput_right:Nx \g_@@_pos_of_blocks_seq { @@ -10707,7 +10672,7 @@ version 2005/12/01 or later. } { \exp_args:NNx - \clist_if_in:NnT \l_@@_vlines_clist { \@@_succ:n \c@jCol } + \clist_if_in:NnT \l_@@_vlines_clist { \int_eval:n { \c@jCol + 1 } } { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \skip_horizontal:N \arrayrulewidth } } @@ -10756,7 +10721,7 @@ version 2005/12/01 or later. \pgfpicture \@@_qpoint:n { row - 1 } \dim_gset_eq:NN \g_tmpa_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \c@iRow } + \@@_qpoint:n { row - \int_eval:n { \c@iRow + 1 } } \dim_gadd:Nn \g_tmpa_dim \pgf@y \dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim } % \end{macrocode} @@ -11317,7 +11282,8 @@ version 2005/12/01 or later. \hbox { \skip_horizontal:N -0.5\arrayrulewidth - \pgfsys@markposition { \@@_env: - col - \@@_succ:n \g_tmpa_int } + \pgfsys@markposition + { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } } \skip_horizontal:N 0.5\arrayrulewidth } } @@ -11326,13 +11292,13 @@ version 2005/12/01 or later. % \begin{macrocode} \pgfpicture \pgfrememberpicturepositiononpagetrue - \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int } + \pgfcoordinate { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } } { \pgfpoint { - 0.5 \arrayrulewidth } \c_zero_dim } \str_if_empty:NF \l_@@_name_str { \pgfnodealias - { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int } - { \@@_env: - col - \@@_succ:n \g_tmpa_int } + { \l_@@_name_str - col - \int_eval:n { \g_tmpa_int + 1 } } + { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } } } \endpgfpicture } @@ -11372,7 +11338,9 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool { \skip_horizontal:N -\arraycolsep } - \pgfsys@markposition { \@@_env: - col - \@@_succ:n \g_tmpa_int } + \pgfsys@markposition + { \@@_env: - col - \int_eval:n { + \g_tmpa_int + 1 } } \skip_horizontal:N 0.5\arrayrulewidth \bool_lazy_and:nnT \l_@@_Matrix_bool \l_@@_NiceArray_bool { \skip_horizontal:N \arraycolsep } @@ -11380,7 +11348,7 @@ version 2005/12/01 or later. } \pgfpicture \pgfrememberpicturepositiononpagetrue - \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int } + \pgfcoordinate { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } } { \bool_lazy_and:nnTF \l_@@_Matrix_bool \l_@@_NiceArray_bool { @@ -11393,8 +11361,8 @@ version 2005/12/01 or later. \str_if_empty:NF \l_@@_name_str { \pgfnodealias - { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int } - { \@@_env: - col - \@@_succ:n \g_tmpa_int } + { \l_@@_name_str - col - \int_eval:n { \g_tmpa_int + 1 } } + { \@@_env: - col - \int_eval:n { \g_tmpa_int + 1 } } } \endpgfpicture % \end{macrocode} @@ -11409,17 +11377,21 @@ version 2005/12/01 or later. \bool_if:NT \l_@@_code_before_bool { \pgfsys@markposition - { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } + { \@@_env: - col - \int_eval:n { \g_@@_col_total_int + 1 } } } \pgfpicture \pgfrememberpicturepositiononpagetrue - \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } + \pgfcoordinate + { \@@_env: - col - \int_eval:n { \g_@@_col_total_int + 1 } } \pgfpointorigin \str_if_empty:NF \l_@@_name_str { - \pgfnodealias - { \l_@@_name_str - col - \@@_succ:n \g_@@_col_total_int } - { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } + \pgfnodealias + { + \l_@@_name_str - col + - \int_eval:n { \g_@@_col_total_int + 1 } + } + { \@@_env: - col - \int_eval:n { \g_@@_col_total_int + 1 } } } \endpgfpicture } @@ -11645,7 +11617,7 @@ version 2005/12/01 or later. { \int_compare:nNnTF \l_@@_last_col_int < 0 \c@MaxMatrixCols - { \@@_pred:n \l_@@_last_col_int } + { \int_eval:n { \l_@@_last_col_int - 1 } } } { > \@@_cell_begin:w #2 < \@@_cell_end: } } @@ -12575,7 +12547,7 @@ version 2005/12/01 or later. % \begin{macrocode} \dim_compare:nNnT \l_@@_x_final_dim = { - \c_max_dim } { - \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int } + \@@_qpoint:n { col - \int_eval:n { \l_@@_final_j_int + 1 } } \dim_set_eq:NN \l_@@_x_final_dim \pgf@x \dim_sub:Nn \l_@@_x_final_dim \col@sep } @@ -12722,7 +12694,7 @@ version 2005/12/01 or later. { \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int } \dim_set_eq:NN \l_tmpa_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \l_@@_initial_i_int } + \@@_qpoint:n { row - \int_eval:n { \l_@@_initial_i_int + 1 } } \dim_set:Nn \l_@@_y_initial_dim { ( \l_tmpa_dim + \pgf@y ) / 2 } \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim } @@ -12855,7 +12827,7 @@ version 2005/12/01 or later. { \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int } \dim_set_eq:NN \l_tmpa_dim \pgf@x - \@@_qpoint:n { col - \@@_succ:n \l_@@_initial_j_int } + \@@_qpoint:n { col - \int_eval:n { \l_@@_initial_j_int + 1 } } \dim_set:Nn \l_@@_x_initial_dim { ( \pgf@x + \l_tmpa_dim ) / 2 } \dim_set_eq:NN \l_@@_x_final_dim \l_@@_x_initial_dim % \end{macrocode} @@ -14380,7 +14352,7 @@ version 2005/12/01 or later. { \bool_lazy_or:nnTF { \int_compare_p:nNn { #4 } = \c_zero_int } - { \int_compare_p:nNn { #2 } = { \@@_succ:n { \c@jCol } } } + { \int_compare_p:nNn { #2 } = { \int_eval:n { \c@jCol + 1 } } } \prg_return_false: \prg_return_true: } @@ -14456,7 +14428,7 @@ version 2005/12/01 or later. \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 } } - \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } + \@@_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } } \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } % \end{macrocode} % We begin the loop over the rows. @@ -14478,7 +14450,7 @@ version 2005/12/01 or later. \seq_if_in:NxF \l_@@_corners_cells_seq { \l_tmpa_tl - \l_@@_tmpc_tl } { - \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } + \@@_qpoint:n { row - \int_eval:n { \l_tmpb_tl + 1 } } \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 } @@ -14808,11 +14780,11 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_test_in_corner_v: { - \int_compare:nNnTF \l_tmpb_tl = { \@@_succ:n \c@jCol } + \int_compare:nNnTF \l_tmpb_tl = { \int_eval:n { \c@jCol + 1 } } { \seq_if_in:NxT \l_@@_corners_cells_seq - { \l_tmpa_tl - \@@_pred:n \l_tmpb_tl } + { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } } { \bool_set_false:N \g_tmpa_bool } } { @@ -14825,7 +14797,7 @@ version 2005/12/01 or later. { \seq_if_in:NxT \l_@@_corners_cells_seq - { \l_tmpa_tl - \@@_pred:n \l_tmpb_tl } + { \l_tmpa_tl - \int_eval:n { \l_tmpb_tl - 1 } } { \bool_set_false:N \g_tmpa_bool } } } @@ -14964,7 +14936,7 @@ version 2005/12/01 or later. } { \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool } - { \@@_succ:n \c@jCol } + { \int_eval:n { \c@jCol + 1 } } \c@jCol } { @@ -15057,11 +15029,11 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_test_in_corner_h: { - \int_compare:nNnTF \l_tmpa_tl = { \@@_succ:n \c@iRow } + \int_compare:nNnTF \l_tmpa_tl = { \int_eval:n { \c@iRow + 1 } } { \seq_if_in:NxT \l_@@_corners_cells_seq - { \@@_pred:n \l_tmpa_tl - \l_tmpb_tl } + { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl } { \bool_set_false:N \g_tmpa_bool } } { @@ -15074,7 +15046,7 @@ version 2005/12/01 or later. { \seq_if_in:NxT \l_@@_corners_cells_seq - { \@@_pred:n \l_tmpa_tl - \l_tmpb_tl } + { \int_eval:n { \l_tmpa_tl - 1 } - \l_tmpb_tl } { \bool_set_false:N \g_tmpa_bool } } } @@ -15273,7 +15245,7 @@ version 2005/12/01 or later. } { \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool } - { \@@_succ:n \c@iRow } + { \int_eval:n { \c@iRow + 1 } } \c@iRow } { @@ -15453,15 +15425,17 @@ version 2005/12/01 or later. % \begin{macrocode} \keys_define:nn { NiceMatrix / Custom-Line } { - letter .str_set:N = \l_@@_letter_str , + % here, we will use change in the future to use .tl_set:N + letter .code:n = \str_set:Nn \l_@@_letter_str { #1 } , letter .value_required:n = true , - command .str_set:N = \l_@@_command_str , + % here, we will use change in the future to use .tl_set:N + command .code:n = \str_set:Nn \l_@@_command_str { #1 } , command .value_required:n = true , 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 , + color .value_required:n = true , % \end{macrocode} % 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|. @@ -15522,7 +15496,7 @@ version 2005/12/01 or later. { \skip_horizontal:n { \dim_use:N \l_@@_rule_width_dim } } } \tl_gput_right:Nx \g_@@_internal_code_after_tl - { \@@_vline:n { #1 , position = \@@_succ:n \c@jCol } } + { \@@_vline:n { #1 , position = \int_eval:n { \c@jCol + 1 } } } } % \end{macrocode} % @@ -15622,8 +15596,8 @@ version 2005/12/01 or later. { \@@_error:nn { bad~corner } { ##1 } } } % \end{macrocode} -% Even if the user has used the key |corners| (or the key -% |hvlines-except-corners|), the list of cells in the corners may be empty. +% Even if the user has used the key |corners| the list of cells in the corners +% may be empty. % \begin{macrocode} \seq_if_empty:NF \l_@@_corners_cells_seq { @@ -15764,13 +15738,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6 #7 { - \int_compare:nNnT { #3 } < { \@@_succ:n { #1 } } + \int_compare:nNnT { #3 } < { \int_eval:n { #1 + 1 } } { - \int_compare:nNnT { #1 } < { \@@_succ:n { #5 } } + \int_compare:nNnT { #1 } < { \int_eval:n { #5 + 1 } } { - \int_compare:nNnT { #4 } < { \@@_succ:n { #2 } } + \int_compare:nNnT { #4 } < { \int_eval:n { #2 + 1 } } { - \int_compare:nNnT { #2 } < { \@@_succ:n { #6 } } + \int_compare:nNnT { #2 } < { \int_eval:n { #6 + 1 } } { \bool_set_true:N \l_tmpb_bool } } } @@ -16137,11 +16111,11 @@ version 2005/12/01 or later. { ( \dim_use:c { l_@@_row _ \@@_i: _ min _ dim } + - \dim_use:c { l_@@_row _ \@@_succ:n \@@_i: _ max _ dim } + \dim_use:c { l_@@_row _ \int_eval:n { \@@_i: + 1 } _ max _ dim } ) / 2 } - \dim_set_eq:cc { l_@@_row _ \@@_succ:n \@@_i: _ max _ dim } + \dim_set_eq:cc { l_@@_row _ \int_eval:n { \@@_i: + 1 } _ max _ dim } { l_@@_row_\@@_i: _min_dim } } \int_step_variable:nNn { \c@jCol - 1 } \@@_j: @@ -16151,11 +16125,11 @@ version 2005/12/01 or later. ( \dim_use:c { l_@@_column _ \@@_j: _ max _ dim } + \dim_use:c - { l_@@_column _ \@@_succ:n \@@_j: _ min _ dim } + { l_@@_column _ \int_eval:n { \@@_j: + 1 } _ min _ dim } ) / 2 } - \dim_set_eq:cc { l_@@_column _ \@@_succ:n \@@_j: _ min _ dim } + \dim_set_eq:cc { l_@@_column _ \int_eval:n { \@@_j: + 1 } _ min _ dim } { l_@@_column _ \@@_j: _ max _ dim } } % \end{macrocode} @@ -16678,7 +16652,7 @@ version 2005/12/01 or later. color .value_required:n = true , borders .clist_set:N = \l_@@_borders_clist , borders .value_required:n = true , - hvlines .meta:n = { vlines = #1 , hlines = #1 } , + hvlines .meta:n = { vlines , hlines } , vlines .bool_set:N = \l_@@_vlines_block_bool, vlines .default:n = true , hlines .bool_set:N = \l_@@_hlines_block_bool, @@ -16709,6 +16683,9 @@ version 2005/12/01 or later. name .initial:n = , respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool , respect-arraystretch .default:n = true , + v-center .bool_set:N = \l_@@_v_center_bool , + v-center .default:n = true , + v-center .initial:n = false , unknown .code:n = \@@_error:n { Unknown~key~for~Block } } % \end{macrocode} @@ -16783,6 +16760,19 @@ version 2005/12/01 or later. \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } % \end{macrocode} % +% +% We restrict the use of the key |v-center| to the case of a mono-row block. +% \begin{macrocode} + \bool_if:NT \l_@@_v_center_bool + { + \int_compare:nNnF { #1 } = { #3 } + { + \@@_error:n { Wrong~use~of~v-center } + \bool_set_false:N \l_@@_v_center_bool + } + } +% \end{macrocode} +% % \begin{macrocode} \bool_if:NT \l_@@_vlines_block_bool { @@ -16959,9 +16949,9 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_tmpa_dim \pgf@y \@@_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x - \@@_qpoint:n { row - \@@_succ:n { \l_@@_last_row_int } } + \@@_qpoint:n { row - \int_eval:n { \l_@@_last_row_int + 1 } } \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y - \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } + \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x % \end{macrocode} % @@ -17046,7 +17036,7 @@ version 2005/12/01 or later. } \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim } { - \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } + \@@_qpoint:n { col - \int_eval:n { \l_@@_last_col_int + 1 } } \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x } \@@_pgf_rect_node:nnnnn @@ -17079,7 +17069,8 @@ version 2005/12/01 or later. % Now, we will put the label of the block beginning with the case of a |\Block| % of one row. % \begin{macrocode} - \int_compare:nNnTF { #1 } = { #3 } + \bool_if:nTF + { \int_compare_p:nNn { #1 } = { #3 } && ! \l_@@_v_center_bool } { % \end{macrocode} % We take into account the case of a block of one row in the ``first row'' or @@ -17239,9 +17230,9 @@ version 2005/12/01 or later. { \tl_set:Nx \l_tmpa_tl { \int_use:N \c@iRow } } \int_compare:nNnT \l_tmpb_tl > \c@jCol { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl } + \@@_qpoint:n { row - \int_eval:n { \l_tmpa_tl + 1 } } \dim_set:Nn \l_tmpa_dim { \pgf@y } - \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } + \@@_qpoint:n { col - \int_eval:n { \l_tmpb_tl + 1 } } \dim_set:Nn \l_@@_tmpd_dim { \pgf@x } \pgfpathrectanglecorners { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } @@ -17272,7 +17263,7 @@ version 2005/12/01 or later. % % % \bigskip -% The first argument of |\@@_hvlines_block:nnn| is a list of options for the +% The first argument of |\@@_vlines_block:nnn| is a list of options for the % rules that we will draw. The second argument is the upper-left cell of the % block (with, as usual, the syntax $i$|-|$j$) and the third is the last cell of % the block (with the same syntax). @@ -17295,7 +17286,7 @@ version 2005/12/01 or later. { position = ##1 , start = \l_@@_tmpc_tl , - end = \@@_pred:n \l_tmpa_tl + end = \int_eval:n { \l_tmpa_tl - 1 } } } } @@ -17338,35 +17329,68 @@ version 2005/12/01 or later. \dim_compare:nNnTF \l_@@_rounded_corners_dim > \c_zero_dim { \@@_error:n { borders~forbidden } } { - \clist_map_inline:Nn \l_@@_borders_clist - { - \clist_if_in:nnF { top , bottom , left , right } { ##1 } - { \@@_error:nn { bad~border } { ##1 } } - } + \tl_clear_new:N \l_@@_borders_tikz_tl + \keys_set:nV + { NiceMatrix / OnlyForTikzInBorders } + \l_@@_borders_clist \@@_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 \@@_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 } } - \pgfpicture - \pgfrememberpicturepositiononpagetrue - \pgf@relevantforpicturesizefalse - \CT@arc@ - \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } - \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 } - \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 } - \endpgfpicture - } + \@@_stroke_borders_block_i: + } + } +% \end{macrocode} +% +% \begin{macrocode} +\hook_gput_code:nnn { begindocument } { . } + { + \cs_new_protected:Npx \@@_stroke_borders_block_i: + { + \c_@@_pgfortikzpicture_tl + \@@_stroke_borders_block_ii: + \c_@@_endpgfortikzpicture_tl + } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_stroke_borders_block_ii: + { + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \CT@arc@ + \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } + \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 } + \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 } } % \end{macrocode} % +% \begin{macrocode} +\keys_define:nn { NiceMatrix / OnlyForTikzInBorders } + { + tikz .code:n = + \cs_if_exist:NTF \tikzpicture + { \tl_set:Nn \l_@@_borders_tikz_tl { #1 } } + { \@@_error:n { tikz~in~borders~without~tikz } } , + tikz .value_required:n = true , + top .code:n = , + bottom .code:n = , + left .code:n = , + right .code:n = , + unknown .code:n = \@@_error:n { bad~border } + } +% \end{macrocode} +% +% % \medskip % The following command is used to stroke the left border and the right border. % The argument |#1| is the number of column (in the sense of the |col| node). @@ -17378,9 +17402,16 @@ version 2005/12/01 or later. \@@_qpoint:n \l_tmpa_tl \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 } - \pgfusepathqstroke + \tl_if_empty:NTF \l_@@_borders_tikz_tl + { + \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l_@@_tmpc_dim } + \pgfusepathqstroke + } + { + \use:x { \exp_not:N \draw [ \l_@@_borders_tikz_tl ] } + ( \pgf@x , \l_tmpb_dim ) -- ( \pgf@x , \l_@@_tmpc_dim ) ; + } } % \end{macrocode} % @@ -17397,9 +17428,16 @@ version 2005/12/01 or later. \@@_qpoint:n \l_tmpb_tl \dim_set:Nn \l_tmpb_dim { \pgf@x + 0.5 \l_@@_line_width_dim } \@@_qpoint:n { #1 } - \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y } - \pgfusepathqstroke + \tl_if_empty:NTF \l_@@_borders_tikz_tl + { + \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y } + \pgfusepathqstroke + } + { + \use:x { \exp_not:N \draw [ \l_@@_borders_tikz_tl ] } + ( \l_tmpa_dim , \pgf@y ) -- ( \l_tmpb_dim , \pgf@y ) ; + } } % \end{macrocode} % @@ -17411,7 +17449,7 @@ version 2005/12/01 or later. borders .clist_set:N = \l_@@_borders_clist , rounded-corners .dim_set:N = \l_@@_rounded_corners_dim , rounded-corners .default:n = 4 pt , - line-width .dim_set:N = \l_@@_line_width_dim + line-width .dim_set:N = \l_@@_line_width_dim , } % \end{macrocode} % @@ -17427,7 +17465,9 @@ version 2005/12/01 or later. \clist_map_inline:nn { #5 } { \path [ ##1 ] - ( #1 -| #2 ) rectangle ( \@@_succ:n { #3 } -| \@@_succ:n { #4 } ) ; + ( #1 -| #2 ) + rectangle + ( \int_eval:n { #3 + 1 } -| \int_eval:n { #4 + 1 } ) ; } \end { tikzpicture } } @@ -17647,9 +17687,9 @@ version 2005/12/01 or later. \@@_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \@@_qpoint:n { row - \@@_succ:n { #3 } } + \@@_qpoint:n { row - \int_eval:n { #3 + 1 } } \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y - \@@_qpoint:n { col - \@@_succ:n { #4 } } + \@@_qpoint:n { col - \int_eval:n { #4 + 1 } } \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x \pgfpathlineto { \pgfpoint \l_@@_tmpd_dim \l_@@_tmpc_dim } { @@ -17806,7 +17846,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_qpoint:n { row - 1 } \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \c@iRow } + \@@_qpoint:n { row - \int_eval:n { \c@iRow + 1 } } \dim_set_eq:NN \l_@@_y_final_dim \pgf@y % \end{macrocode} % @@ -18485,6 +18525,8 @@ version 2005/12/01 or later. yshift .dim_set:N = \l_@@_brace_yshift_dim , yshift .value_required:n = true , yshift .initial:n = \c_zero_dim , + color .tl_set:N = \l_tmpa_tl , + color .value_required:n = true , unknown .code:n = \@@_error:n { Unknown~key~for~Brace } } % \end{macrocode} @@ -18513,7 +18555,9 @@ version 2005/12/01 or later. { \@@_error:nn { Construct~too~large } { \OverBrace } } } { + \tl_clear:N \l_tmpa_tl % added the 2022-02-25 \keys_set:nn { NiceMatrix / Brace } { #4 } + \tl_if_empty:NF \l_tmpa_tl { \color { \l_tmpa_tl } } % added the 2022-02-25 \pgfpicture \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse @@ -18866,6 +18910,16 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { hvlines-except-corners } + { + The~key~'hvlines-except-corners'~is~now~obsolete.~You~should~instead~use~the~ + keys~'hvlines'~and~'corners'.\\ + However,~you~can~go~on~for~this~time.~This~message~won't~be~shown~anymore~ + in~this~document. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { last~col~not~used } { The~key~'last-col'~is~in~force~but~you~have~not~used~that~last~column~ @@ -19050,6 +19104,14 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { Wrong~use~of~v-center } + { + You~should~not~use~the~key~'v-center'~here~because~your~block~is~not~ + mono-row.~However,~you~can~go~on. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { No~letter~and~no~command } { Your~use~of~'custom-line'~is~no-op~since~you~don't~have~used~the~ @@ -19148,9 +19210,12 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { bad~border } { - #1~is~an~incorrect~specification~for~a~border~(in~the~key~ - 'borders'~of~the~command~\token_to_str:N \Block).~The~available~ - values~are:~left,~right,~top~and~bottom.\\ + \l_keys_key_str\space~is~an~incorrect~specification~for~a~border~ + (in~the~key~'borders'~of~the~command~\token_to_str:N \Block).~ + The~available~values~are:~left,~right,~top~and~bottom~(and~you~can~ + also~use~the~key~'tikz' + \bool_if:nF \c_@@_tikz_loaded_bool + {~if~you~load~the~LaTeX~package~'tikz'}).\\ If~you~go~on,~this~specification~of~border~will~be~ignored. } % \end{macrocode} @@ -19277,6 +19342,15 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { tikz~in~borders~without~tikz } + { + You~have~used~the~key~'tikz'~in~a~key~'borders'~(of~a~ + command~'\token_to_str:N\Block')~but~Tikz~is~not~loaded.~ + If~you~go~on,~that~key~will~be~ignored. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { color~in~custom-line~with~tikz } { In~a~'custom-line',~you~have~used~both~'tikz'~and~'color',~ @@ -19361,7 +19435,7 @@ version 2005/12/01 or later. For~a~list~of~the~available~keys,~type~H~. } { - The~available~keys~are~(in~alphabetic~order):~left-shorten,~ + The~available~keys~are~(in~alphabetic~order):~color,~left-shorten,~ right-shorten,~shorten~(which~fixes~both~left-shorten~and~ right-shorten)~and~yshift. } @@ -20255,6 +20329,13 @@ version 2005/12/01 or later. % \subsection*{Changes between version 6.5 and 6.6} % % Keys |tikz| and |width| in |custom-line|. +% +% \subsection*{Changes between version 6.6 and 6.7} +% +% Key |color| for |\OverBrace| and |\UnderBrace| in the |\CodeAfter| +% +% Key |tikz| in the key |borders| of a command |\Block| +% % \PrintIndex % % \tableofcontents diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf index d96ed3fa4a..2bac20ae75 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix.pdf and b/macros/latex/contrib/nicematrix/nicematrix.pdf differ -- cgit v1.2.3