summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-10-29 21:24:28 +0000
committerKarl Berry <karl@freefriends.org>2019-10-29 21:24:28 +0000
commit3b3b42b1273d6ac4e7182964334a2487c05fee64 (patch)
tree74f30b98f2dc2899d3cc8efc6652dea8cd89a42a
parentbfb7d42bbf34b6ee0ddee805cba07b7238a5c556 (diff)
nicematrix (29oct19)
git-svn-id: svn://tug.org/texlive/trunk@52573 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdfbin316632 -> 314351 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex86
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdfbin660302 -> 672477 bytes
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx672
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty424
5 files changed, 776 insertions, 406 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
index e2607f0c9be..d86a56a2c5f 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
index 49d8fc98ffb..c9980ab829f 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
@@ -11,7 +11,7 @@
\usepackage{array}
\usepackage{colortbl}
\usepackage{nicematrix}
-
+\usepackage{enumitem}
\usepackage{siunitx}
@@ -29,14 +29,14 @@ c & c & b & a & e
\usepackage{arydshln}
\usepackage{verbatim}
-% We use \MakeShortVerb of shortvrb and not \DefineShortVrb of fancyvrb
+% We use \MakeShortVerb of shortvrb and not \DefineShortVerb of fancyvrb
% because we don't want the contents of short verbatim colored in gray
\usepackage{shortvrb}
\MakeShortVerb{\|}
\usepackage{fancyvrb}
-\fvset{commandchars=\~\#\@,formatcom={\color{gray}}}
+\fvset{commandchars=\~\#\@,formatcom=\color{gray}}
\usepackage{titlesec}
\titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
@@ -45,20 +45,22 @@ c & c & b & a & e
\usepackage{multicol}
\setlength{\columnseprule}{0.4pt}
-\def\interitem{\vskip 7mm plus 2 mm minus 3mm}
+\def\interitem{\vspace{7mm plus 2 mm minus 3mm}}
\def\emphase{\bgroup\color{RoyalPurple}\let\next=}
\usepackage{footnote}
\usepackage[hyperfootnotes = false]{hyperref}
-\hypersetup{
- pdfinfo = {
- Title = { L’extension nicematrix },
- Subject = { Une extension LaTeX } ,
- Author = { F. Pantigny }
- }
-}
+\hypersetup
+ {
+ pdfinfo =
+ {
+ Title = L’extension nicematrix ,
+ Subject = Une extension LaTeX ,
+ Author = F. Pantigny
+ }
+ }
\NewDocumentEnvironment {scope} {} {} {}
@@ -133,6 +135,8 @@ Une commande|\NiceMatrixOptions| est fournie pour régler les options (la porté
commande est le groupe TeX courant).
+
+
\bigskip
\textbf{Un exemple d'utilisation pour les lignes en pointillés continues}
@@ -217,6 +221,8 @@ doivent pas être employées. Voir p.~\pageref{NiceArray} la partie concernant |
\section{Les lignes en pointillés continues}
+
+
À l'intérieur des environnements de l'extension \pkg{nicematrix}, de nouvelles commandes sont définies : |\Ldots|,
|\Cdots|, |\Vdots|, |\Ddots|, and |\Iddots|. Ces commandes sont conçues pour être utilisées à la place de |\dots|,
|\cdots|, |\vdots|, |\ddots| et |\iddots|.\footnote{La commande |\iddots|, définie dans \pkg{nicematrix}, est une
@@ -514,7 +520,7 @@ option est un alias pour la conjonction de deux options : |renew-dots| et |renew
\item L'option |renew-dots|\par\nobreak
Avec cette option, les commandes |\ldots|, |\cdots|, |\vdots|, |\ddots|, |\iddots|\footnotemark[\thefniddots] et
-|\hdotsfor| sont redéfinies dans les environnements de \pkg{nicematrix} et agissent comme |\Ldots|, |\Cdots|,
+|\hdotsfor| sont redéfinies dans les environnements de \pkg{nicematrix} et agissent alors comme |\Ldots|, |\Cdots|,
|\Vdots|, |\Ddots|, |\Iddots| et |\Hdotsfor| ; la commande |\dots| (points de suspension «automatiques» de
|amsmath|) est aussi redéfinie et se comporte comme |\Ldots|.
@@ -747,13 +753,13 @@ entre les nœuds).
\medskip
\begin{BVerbatim}[baseline=c,boxwidth=12cm]
-$\begin{pNiceMatrix}[~emphase#code-after = {\line {1-1} {3-3}}@]
+$\begin{pNiceMatrix}[~emphase#code-after = \line{1-1}{3-3}@]
0 & 0 & 0 \\
0 & & 0 \\
0 & 0 & 0
\end{pNiceMatrix}$
\end{BVerbatim}
-$\begin{pNiceMatrix}[code-after = {\line {1-1} {3-3}}]
+$\begin{pNiceMatrix}[code-after = \line{1-1}{3-3}]
0 & 0 & 0 \\
0 & & 0 \\
0 & 0 & 0
@@ -881,7 +887,7 @@ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\
\bigskip
Il y a plusieurs remarques à formuler.
%
-\begin{itemize}
+\begin{itemize}[beginpenalty=10000]
\item Si on utilise un environnement avec préambule explicite (c'est-à-dire |{NiceArray}| ou l'une de ses
variantes), on ne doit pas mettre dans ce préambule de spécification de colonne pour les éventuelles première et
dernière colonne : la première colonne sera automatiquement (et nécessairement) de type |R| et la dernière de type
@@ -941,7 +947,7 @@ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\
\emph{Remarques}
-\begin{itemize}
+\begin{itemize}[beginpenalty=10000]
\item Comme on peut le voir dans l'exemple précédent, un filet horizontal (tracé avec |\hline|) ne s'étend pas
dans les colonnes extérieures et un filet vertical (spécifié par un caractère «\verb+|+» dans le préambule du
tableau) ne s'étend pas dans les rangées extérieures.\footnote{Ce dernier point n'est pas valable si on a chargé,
@@ -1294,6 +1300,42 @@ En fait, l'option |small| correspond aux réglages suivants :
\item les caractéristiques des lignes en pointillés sont également modifiées.
\end{itemize}
+\section{Les compteurs iRow et jCol}
+
+Dans les cases du tableau, il est possible d'utiliser les compteurs LaTeX |iRow| et |jCol| qui représentent le
+numéro de la rangée courante et le numéro de la colonne courante\footnote{On rappelle que la «permière rangée» (si
+ elle existe) est $0$ et que le numéro de la «première colonne» (si elle existe) est $0$ également.}. Bien entendu,
+l'utilisateur ne doit pas modifier les valeurs de ces compteurs qui sont utilisés en interne par \pkg{nicematrix}.
+
+\medskip
+\begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
+$\begin{pNiceMatrix}%
+ [first-row,
+ first-col,
+ code-for-first-row = \mathbf{~emphase#\alph{jCol}@} ,
+ code-for-first-col = \mathbf{~emphase#\arabic{iRow}@} ]
+& & & & \\
+& 1 & 2 & 3 & 4 \\
+& 5 & 6 & 7 & 8 \\
+& 9 & 10 & 11 & 12
+\end{pNiceMatrix}$
+\end{BVerbatim}
+$\begin{pNiceMatrix}[first-row,
+ first-col,
+ code-for-first-row = \mathbf{\alph{jCol}} ,
+ code-for-first-col = \mathbf{\arabic{iRow}} ]
+& & & & \\
+& 1 & 2 & 3 & 4 \\
+& 5 & 6 & 7 & 8 \\
+& 9 & 10 & 11 & 12
+\end{pNiceMatrix}$
+
+\medskip
+Si des compteurs LaTeX nommés |iRow| ou |jCol| sont créés dans le document par d'autres extensions que
+\pkg{nicematrix} (ou tout simplement par l'utilisateur), ces compteurs sont masqués dans les environnements de
+\pkg{nicematrix}.
+
+
\section{L'option hlines}
@@ -1319,8 +1361,7 @@ c & c & b & a & e
Si l'extension \pkg{siunitx} est chargée (avant ou après \pkg{nicematrix}), il est possible d'utiliser les colonnes
de type |S| de \pkg{siunitx} dans les environnements de \pkg{nicematrix}. L'implémentation n'utilise explicitement
-aucune macro privée de \pkg{siunitx}. Les colonnes |d| de l'extension \pkg{dcolumn} ne sont pas prises en charge
-par \pkg{nicematrix}.
+aucune macro privée de \pkg{siunitx}.
\medskip
\begin{BVerbatim}[baseline = c, boxwidth = 10.5cm]
@@ -1340,6 +1381,8 @@ $\begin{pNiceArray}{SCWc{1cm}C}[nullify-dots,first-row]
7.2 & 0 & \Cdots & 0
\end{pNiceArray}$
+\medskip
+En revanche, les colonnes |d| de l'extension \pkg{dcolumn} ne sont pas prises en charge par \pkg{nicematrix}.
\section{Remarques techniques}
@@ -1599,7 +1642,10 @@ obsolètes :
|{VNiceArrayRC}|.
\end{itemize}
-Ils seront peut-être supprimés dans une version future de \pkg{nicematrix}.
+\medskip
+Une message est affiché dans le fichier |log| à chaque fois que l'un d'entre eux est utilisé. Néanmoins, il faut
+avoir conscience que ces environnements seront sans doute supprimés dans une version future de \pkg{nicematrix}.
+
\section{Exemples}
@@ -1607,7 +1653,7 @@ Ils seront peut-être supprimés dans une version future de \pkg{nicematrix}.
\subsection{Lignes en pointillés}
\medskip
-Une matrice tridiagonale :
+Une matrice tridiagonale :\par\nobreak
\bigskip
\begin{BVerbatim}[baseline=c]
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
index 1fd19c09ccd..ce320d5eb1f 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index 47271a5452e..4f3effcd146 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{3.5}
-\def\myfiledate{2019/10/13}
+\def\myfileversion{3.6}
+\def\myfiledate{2019/10/29}
%
%
%<*batchfile>
@@ -67,9 +67,9 @@ c & c & b & a & e
\NewDocumentEnvironment {scope} {} {} {}
-\def\interitem{\vskip 7mm plus 2 mm minus 3mm}
+\def\interitem{\vspace{7mm plus 2 mm minus 3mm}}
\def\emphase{\bgroup\color{RoyalPurple}\let\next=}
-\fvset{commandchars=\~\#\@,formatcom={\color{gray}}}
+\fvset{commandchars=\~\#\@,formatcom=\color{gray}}
\usepackage{titlesec}
\titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
\titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex}
@@ -92,9 +92,9 @@ c & c & b & a & e
% {
% pdfinfo =
% {
-% Title = { The extension 'nicematrix' } ,
-% Subject = { A LaTeX extension } ,
-% Author = { F. Pantigny }
+% Title = The extension 'nicematrix' ,
+% Subject = A LaTeX extension ,
+% Author = F. Pantigny
% }
% }
%
@@ -794,13 +794,13 @@ c & c & b & a & e
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=12cm]
-% $\begin{pNiceMatrix}[~emphase#code-after = {\line {1-1} {3-3}}@]
+% $\begin{pNiceMatrix}[~emphase#code-after = \line{1-1}{3-3}@]
% 0 & 0 & 0 \\
% 0 & & 0 \\
% 0 & 0 & 0
% \end{pNiceMatrix}$
% \end{BVerbatim}
-% $\begin{pNiceMatrix}[code-after = {\line {1-1} {3-3}}]
+% $\begin{pNiceMatrix}[code-after = \line{1-1}{3-3}]
% 0 & 0 & 0 \\
% 0 & & 0 \\
% 0 & 0 & 0
@@ -898,7 +898,7 @@ c & c & b & a & e
%
%
% \bigskip
-% \section{The exterior row and columns}
+% \section{The exterior rows and columns}
% The options |first-row|, |last-row|, |first-col| and |last-col| allow the
% composition of exterior rows and columns in the environments of
% \pkg{nicematrix}.
@@ -988,7 +988,7 @@ c & c & b & a & e
%
%
% \emph{Remarks}
-% \begin{itemize}
+% \begin{itemize}[beginpenalty=10000]
% \item As shown in the previous example, an horizontal rule (drawn by |\hline|)
% doesn't extend in the exterior columns and a vertical rule (specified by a
% ``\verb+|+'' in the preamble of the array) doesn't extend in the exterior
@@ -1359,6 +1359,43 @@ c & c & b & a & e
% \item the characteristics of the dotted lines are also modified.
% \end{itemize}
%
+% \section{The counters iRow and jCol}
+%
+% In the cells of the array, it's possible to use the LaTeX counters |iRow| and
+% |jCol| which represents the number of the current row and the number of the
+% current col\footnote{We recall that the first row (if it exists) has the
+% number~$0$ and that the first col (if it exists) has also the number~$0$).}. Of
+% course, the user must not change the value of the these counters which are
+% used internally by \pkg{nicematrix}.
+%
+% \medskip
+% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
+% $\begin{pNiceMatrix}% don't forget the %
+% [first-row,
+% first-col,
+% code-for-first-row = \mathbf{~emphase#\alph{jCol}@} ,
+% code-for-first-col = \mathbf{~emphase#\arabic{iRow}@} ]
+% & & & & \\
+% & 1 & 2 & 3 & 4 \\
+% & 5 & 6 & 7 & 8 \\
+% & 9 & 10 & 11 & 12
+% \end{pNiceMatrix}$
+% \end{BVerbatim}
+% $\begin{pNiceMatrix}[first-row,
+% first-col,
+% code-for-first-row = \mathbf{\alph{jCol}} ,
+% code-for-first-col = \mathbf{\arabic{iRow}} ]
+% & & & & \\
+% & 1 & 2 & 3 & 4 \\
+% & 5 & 6 & 7 & 8 \\
+% & 9 & 10 & 11 & 12
+% \end{pNiceMatrix}$
+%
+% \smallskip
+% If LaTeX counters called |iRow| and |jCol| are defined in the document by
+% extensions other than \pkg{nicematrix} (or by the user), they are shadowed in
+% the environements of \pkg{nicematrix}.
+%
% \section{The option hlines}
%
% You can add horizontal rules between rows in the environments of
@@ -1385,8 +1422,7 @@ c & c & b & a & e
% If the package \pkg{siunitx} is loaded (before or after \pkg{nicematrix}),
% it's possible to use the |S| column type of \pkg{siunitx} in the environments
% of \pkg{nicematrix}. The implementation doesn't use explicitly any private
-% macro of \pkg{siunitx}. The |d| columns of the package \pkg{dcolumn} are not
-% supported by \pkg{nicematrix}.
+% macro of \pkg{siunitx}.
%
%
% \medskip
@@ -1407,6 +1443,8 @@ c & c & b & a & e
% 7.2 & 0 & \Cdots & 0
% \end{pNiceArray}$
%
+% On the other hand, the |d| columns of the package \pkg{dcolumn} are not
+% supported by \pkg{nicematrix}.
%
% \section{Technical remarks}
%
@@ -2280,25 +2318,25 @@ c & c & b & a & e
% $\begin{array}{cc}
% &
% \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row]
-% & & C_j \\
+% & & C_j \\
% b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
-% \Vdots & & \Vdots & & \Vdots \\
-% & & b_{kj} \\
-% & & \Vdots \\
-% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
+% \Vdots & & \Vdots & & \Vdots \\
+% & & b_{kj} \\
+% & & \Vdots \\
+% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
% \end{bNiceArray} \\ \\
% \begin{bNiceArray}{CC>{\strut}CCC}[name=A,first-col]
-% & a_{11} & \Cdots & & & a_{nn} \\
-% & \Vdots & & & & \Vdots \\
+% & a_{11} & \Cdots & & & a_{nn} \\
+% & \Vdots & & & & \Vdots \\
% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
-% & \Vdots & & & & \Vdots \\
-% & a_{n1} & \Cdots & & & a_{nn} \\
+% & \Vdots & & & & \Vdots \\
+% & a_{n1} & \Cdots & & & a_{nn} \\
% \end{bNiceArray}
% &
% \begin{bNiceArray}{CC>{\strut}CCC}
-% & & & & \\
+% & & & & \\
% & & \Vdots \\
-% \Cdots & & c_{ij} \\
+% \Cdots & & c_{ij} \\
% \\
% \\
% \end{bNiceArray}
@@ -2330,14 +2368,11 @@ c & c & b & a & e
%
% \smallskip
% Of course, the package \pkg{nicematrix} uses the features of the package
-% \pkg{array}. It tries to be independant of its implementation. Unfortunately,
-% it was not possible to be strictly independant: the package \pkg{nicematrix}
+% \pkg{array}. It tries to be independent of its implementation. Unfortunately,
+% it was not possible to be strictly independent: the package \pkg{nicematrix}
% relies upon the fact that the package |{array}| uses |\ialign| to begin the
% |\halign|.
%
-% \smallskip
-% The desire to do no modification to existing code leads to complications in
-% the code of this extension.
%
% \subsection{Declaration of the package and extensions loaded}
%
@@ -2353,7 +2388,7 @@ c & c & b & a & e
% \begin{macrocode}
\RequirePackage{tikz}
\usetikzlibrary{fit}
-\RequirePackage{expl3}[2019/02/15]
+\RequirePackage{expl3}[2019/07/01]
% \end{macrocode}
%
% We give the traditionnal declaration of a package written with |expl3|:
@@ -2387,7 +2422,7 @@ c & c & b & a & e
% \begin{macrocode}
\RequirePackage { array }
\RequirePackage { amsmath }
-\RequirePackage { xparse } [ 2018-10-17 ]
+\RequirePackage { xparse } [ 2018-07-01 ]
% \end{macrocode}
%
% \bigskip
@@ -2422,6 +2457,13 @@ c & c & b & a & e
{ }
% \end{macrocode}
%
+%
+% The following message must be defined right now because it may be used during
+% the loading of the package.
+% \begin{macrocode}
+\@@_msg_new:nn { Draft~mode }
+ { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. }
+% \end{macrocode}
%
% \begin{macrocode}
\bool_if:NT \c_@@_draft_bool
@@ -2471,7 +2513,7 @@ c & c & b & a & e
% The dimension |\l_@@_columns_width_dim| will be used when the options specify
% that all the columns must have the same width (but, if the key |columns-width|
% is used with the special value |auto|, the boolean
-% |l_@@_auto_columns_width_bool| will be raised).
+% |l_@@_auto_columns_width_bool| also will be raised).
% \begin{macrocode}
\dim_new:N \l_@@_columns_width_dim
% \end{macrocode}
@@ -2565,7 +2607,7 @@ c & c & b & a & e
\dim_set:Nn \l_@@_inter_dots_dim { 0.45 em }
% \end{macrocode}
% The length |\l_@@_radius_dim| is the radius of the dots for the dotted lines.
-% The default value is 0.34~pt but it will changed if the option |small| is
+% The default value is 0.34~pt but it will be changed if the option |small| is
% used.
% \begin{macrocode}
\dim_new:N \l_@@_radius_dim
@@ -2582,6 +2624,19 @@ c & c & b & a & e
\tl_new:N \g_@@_code_after_tl
% \end{macrocode}
%
+%
+% \bigskip
+% The counters |\l_@@_save_iRow_int| and |\l_@@_save_jCol_int| will be used to
+% save the values of the eventual LaTeX counters |iRow| and |jCol|. These LaTeX
+% counters will be restored at the end of the environment.
+% \begin{macrocode}
+\int_new:N \l_@@_save_iRow_int
+\int_new:N \l_@@_save_jCol_int
+% \end{macrocode}
+%
+% The TeX counters |\c@iRow| and |\c@jCol| will be created in the beginning of
+% the environment |{NiceArrayWithDelims}| (if they don't exist previously).
+%
% \bigskip
% \subsubsection{Variables for the exterior rows and columns}
%
@@ -2844,7 +2899,7 @@ c & c & b & a & e
% \bigskip
% The following flag will be used when the current options specify that all the
% columns of the array must have the same width equal to the largest width of a
-% cell of the array (except the cell of the potential exterior columns).
+% cell of the array (except the cells of the potential exterior columns).
% \begin{macrocode}
\bool_new:N \l_@@_auto_columns_width_bool
% \end{macrocode}
@@ -2918,10 +2973,9 @@ c & c & b & a & e
%
% \bigskip
% An option to test whether the extra nodes will be created (these nodes are the
-% ``medium nodes'' and ``large nodes''). In some circonstancies, the extra nodes
-% are created automatically, for example when a dotted line has an ``open''
-% extremity.\footnote{In fact, we should not because, if there is a |w|~node,
-% the |w|~node is used instead of the ``medium'' node.}
+% ``medium nodes'' and the ``large nodes''). In some circonstancies, the extra
+% nodes are created automatically, for example when a dotted line has an
+% ``open'' extremity.
% \begin{macrocode}
create-extra-nodes .bool_set:N = \l_@@_extra_nodes_bool ,
left-margin .dim_set:N = \l_@@_left_margin_dim ,
@@ -2949,11 +3003,13 @@ c & c & b & a & e
{ \dim_set:Nn \l_@@_columns_width_dim { #1 } } ,
columns-width .value_required:n = true ,
name .code:n =
- \str_set:Nn \l_tmpa_str { #1 }
- \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str
- { \@@_error:nn { Duplicate~name } { #1 } }
- { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str }
- \str_set_eq:NN \l_@@_name_str \l_tmpa_str ,
+ \unless \ifmeasuring@
+ \str_set:Nn \l_tmpa_str { #1 }
+ \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str
+ { \@@_error:nn { Duplicate~name } { #1 } }
+ { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str }
+ \str_set_eq:NN \l_@@_name_str \l_tmpa_str
+ \fi ,
name .value_required:n = true ,
code-after .tl_gset:N = \g_@@_code_after_tl ,
code-after .value_required:n = true ,
@@ -3158,21 +3214,21 @@ c & c & b & a & e
\cs_new_protected:Nn \@@_Cell:
{
% \end{macrocode}
-% We increment |\g_@@_col_int|, which is the counter of the columns.
+% We increment |\c@jCol|, which is the counter of the columns.
% \begin{macrocode}
- \int_gincr:N \g_@@_col_int
+ \int_gincr:N \c@jCol
% \end{macrocode}
% Now, we increment the counter of the rows. We don't do this incrementation in
% the |\everycr| because some packages, like \pkg{arydshln}, create special rows
% in the |\halign| that we don't want to take into account.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_col_int = \c_one_int
+ \int_compare:nNnT \c@jCol = \c_one_int
{
\int_compare:nNnT \l_@@_first_col_int = \c_one_int
\@@_begin_of_row:
}
\int_gset:Nn \g_@@_col_total_int
- { \int_max:nn \g_@@_col_total_int \g_@@_col_int }
+ { \int_max:nn \g_@@_col_total_int \c@jCol }
% \end{macrocode}
% The content of the cell is composed in the box |\l_tmpa_box| because we want
% to compute some dimensions of the box. The |\hbox_set_end:| corresponding to
@@ -3182,10 +3238,21 @@ c & c & b & a & e
\hbox_set:Nw \l_tmpa_box
\c_math_toggle_token
\bool_if:NT \l_@@_small_bool \scriptstyle
- \int_compare:nNnTF \g_@@_row_int = \c_zero_int
- \l_@@_code_for_first_row_tl
+% \end{macrocode}
+%
+% We will call \emph{corners} of the matrix the cases which are at the
+% intersection of the exterior rows and exterior columns (of course, the four
+% corners doesn't always exist simultaneously). In a corner of the matrix, it
+% would be logical to use none of the codes |\l_@@_code_for_first_row_tl| and
+% \emph{al}. As for now, this result is acheived only for the north-west corner
+% (this allows an automatic numerotation of the rows ans the columns with |iRow|
+% and |jCol| with the first col and the first row --- probably the preferential
+% choice for such a numerotation).
+% \begin{macrocode}
+ \int_compare:nNnTF \c@iRow = \c_zero_int
+ { \int_compare:nNnT \c@jCol > \c_zero_int \l_@@_code_for_first_row_tl }
{
- \int_compare:nNnT \g_@@_row_int = \l_@@_last_row_int
+ \int_compare:nNnT \c@iRow = \l_@@_last_row_int
\l_@@_code_for_last_row_tl
}
}
@@ -3198,7 +3265,7 @@ c & c & b & a & e
% \begin{macrocode}
\cs_new_protected:Nn \@@_begin_of_row:
{
- \int_gincr:N \g_@@_row_int
+ \int_gincr:N \c@iRow
\dim_gset_eq:NN \g_@@_dp_ante_last_row_dim \g_@@_dp_last_row_dim
\dim_gzero:N \g_@@_dp_last_row_dim
\dim_gzero:N \g_@@_ht_last_row_dim
@@ -3213,14 +3280,14 @@ c & c & b & a & e
% \begin{macrocode}
\cs_new_protected:Npn \@@_actualization_for_first_and_last_row:
{
- \int_compare:nNnT \g_@@_row_int = \c_zero_int
+ \int_compare:nNnT \c@iRow = \c_zero_int
{
\dim_gset:Nn \g_@@_dp_row_zero_dim
{ \dim_max:nn \g_@@_dp_row_zero_dim { \box_dp:N \l_tmpa_box } }
\dim_gset:Nn \g_@@_ht_row_zero_dim
{ \dim_max:nn \g_@@_ht_row_zero_dim { \box_ht:N \l_tmpa_box } }
}
- \int_compare:nNnT \g_@@_row_int = \c_one_int
+ \int_compare:nNnT \c@iRow = \c_one_int
{
\dim_gset:Nn \g_@@_ht_row_one_dim
{ \dim_max:nn \g_@@_ht_row_one_dim { \box_ht:N \l_tmpa_box } }
@@ -3266,14 +3333,14 @@ c & c & b & a & e
[
anchor = base ,
name = nm - \int_use:N \g_@@_env_int -
- \int_use:N \g_@@_row_int -
- \int_use:N \g_@@_col_int ,
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol ,
alias =
\str_if_empty:NF \l_@@_name_str
{
\l_@@_name_str -
- \int_use:N \g_@@_row_int -
- \int_use:N \g_@@_col_int
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol
}
]
\bgroup
@@ -3342,14 +3409,14 @@ c & c & b & a & e
[
node~contents = { } ,
name = nm - \int_use:N \g_@@_env_int -
- \int_use:N \g_@@_row_int -
- \int_use:N \g_@@_col_int - w,
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol - w,
alias =
\str_if_empty:NF \l_@@_name_str
{
\l_@@_name_str -
- \int_use:N \g_@@_row_int -
- \int_use:N \g_@@_col_int - w
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol - w
} ,
inner~sep = \c_zero_dim ,
fit = (@@~south~west) (@@~north~east)
@@ -3414,8 +3481,8 @@ c & c & b & a & e
{ g_@@_ #1 _ lines _ tl }
{
\use:c { @@ _ draw _ #1 : nn }
- { \int_use:N \g_@@_row_int }
- { \int_use:N \g_@@_col_int }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
}
}
}
@@ -3459,17 +3526,17 @@ c & c & b & a & e
% \begin{macrocode}
\cs_new_protected:Npn \@@_everycr_i:
{
- \int_gzero:N \g_@@_col_int
+ \int_gzero:N \c@jCol
\bool_if:NT \l_@@_hlines_bool
{
% \end{macrocode}
-% The counter |\g_@@_row_int| has the value $-1$ only if there is a ``first
+% The counter |\c@iRow| has the value $-1$ only if there is a ``first
% row'' and that we are before that ``first row'', i.e. just before the
% beginning of the array.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_row_int > { -1 }
+ \int_compare:nNnT \c@iRow > { -1 }
{
- \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int
+ \int_compare:nNnF \c@iRow = \l_@@_last_row_int
{
\hrule \@height \arrayrulewidth
\skip_vertical:n { - \arrayrulewidth }
@@ -3487,6 +3554,13 @@ c & c & b & a & e
% \begin{macrocode}
\cs_new_protected:Npn \@@_pre_array:
{
+ \cs_if_exist:NT \theiRow
+ { \int_set_eq:NN \l_@@_save_iRow_int \c@iRow }
+ \int_gzero_new:N \c@iRow
+ \cs_if_exist:NT \thejCol
+ { \int_set_eq:NN \l_@@_save_jCol_int \c@jCol }
+ \int_gzero_new:N \c@jCol
+ \normalbaselines
% \end{macrocode}
% If the option |small| is used, we have to do some tuning. In particular, we
% change the value of |\arraystretch| (this parameter is used in the
@@ -3505,7 +3579,7 @@ c & c & b & a & e
% \medskip
% We switch to a global version of the boolean |\g_@@_extra_nodes_bool|,
% because, in some circonstancies, the boolean will be raised from inside a
-% cell of the |\halign| (in particular in a column of type |w|).
+% cell of the |\halign| (in particular in a column of type~|w|).
%
% \begin{macrocode}
\bool_gset_eq:NN \g_@@_extra_nodes_bool \l_@@_extra_nodes_bool
@@ -3614,14 +3688,13 @@ c & c & b & a & e
% \end{macrocode}
%
%
-% The counter |\g_@@_row_int| will be used to count the rows of the array (its
+% The counter |\c@iRow| will be used to count the rows of the array (its
% incrementation will be in the first cell of the row).
% \begin{macrocode}
- \int_gzero_new:N \g_@@_row_int
- \int_gset:Nn \g_@@_row_int { \l_@@_first_row_int - 1 }
+ \int_gset:Nn \c@iRow { \l_@@_first_row_int - 1 }
% \end{macrocode}
%
-% At the end of the environment |{array}|, |\g_@@_row_int| will be the total
+% At the end of the environment |{array}|, |\c@iRow| will be the total
% number de rows and |\g_@@_row_total_int| will be the number or rows excepted
% the last row (if |\l_@@_last_row_bool| has been raised with the option
% |last-row|).
@@ -3629,18 +3702,18 @@ c & c & b & a & e
\int_gzero_new:N \g_@@_row_total_int
% \end{macrocode}
%
-% The counter |\g_@@_col_int| will be used to count the columns of the array.
+% The counter |\c@jCol| will be used to count the columns of the array.
% Since we want to know the total number of columns of the matrix, we also
% create a counter |\g_@@_col_total_int|. These counters are updated in the
% command |\@@_Cell:| executed at the beginning of each cell.
% \begin{macrocode}
- \int_gzero_new:N \g_@@_col_int
\int_gzero_new:N \g_@@_col_total_int
% \end{macrocode}
%
% \begin{macrocode}
\cs_set_eq:NN \@ifnextchar \new@ifnextchar
% \end{macrocode}
+%
% We nullify the definitions of the column types |w| and |W| before their
% redefinition because we want to avoid a warning in the log file for a
% redefinition of a column type. We must put |\relax| and not
@@ -3670,7 +3743,17 @@ c & c & b & a & e
!
{
\skip_horizontal:n { 0.53 pt }
- \bool_gset_true:N \g_@@_extra_nodes_bool
+% \end{macrocode}
+% If the array is an array with all the columns of the same width, we don't ask
+% for the creation of the extra nodes because we will use the ``|col|'' nodes
+% for the vertical dotted line.
+% \begin{macrocode}
+ \bool_if:nF
+ {
+ \l_@@_auto_columns_width_bool
+ || \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim
+ }
+ { \bool_gset_true:N \g_@@_extra_nodes_bool }
% \end{macrocode}
%
% \medskip
@@ -3693,15 +3776,15 @@ c & c & b & a & e
% ``|:|'' encountered during the parsing has already been taken into account in
% the |code-after|.
% \begin{macrocode}
- \int_compare:nNnT \g_@@_col_int > \g_@@_last_vdotted_col_int
+ \int_compare:nNnT \c@jCol > \g_@@_last_vdotted_col_int
{
- \int_gset_eq:NN \g_@@_last_vdotted_col_int \g_@@_col_int
+ \int_gset_eq:NN \g_@@_last_vdotted_col_int \c@jCol
\tl_gput_right:Nx \g_@@_code_after_tl
% \end{macrocode}
% The command |\@@_vdottedline:n| is protected, and, therefore, won't be
% expanded before writing on |\g_@@_code_after_tl|.
% \begin{macrocode}
- { \@@_vdottedline:n { \int_use:N \g_@@_col_int } }
+ { \@@_vdottedline:n { \int_use:N \c@jCol } }
}
}
}
@@ -3899,13 +3982,13 @@ c & c & b & a & e
% |{NiceMatrixBlock}|), we add a row in the array to fix the width of the
% columns and construct the ``|col|'' nodes |nm-|\textsl{a}|-col-|\textsl{j}
% (these nodes will be used by the horizontal open dotted lines and by the
-% potential commands |\@@_vdottedline:n|).
+% commands |\@@_vdottedline:n|).
%
% \begin{macrocode}
{
\bool_if:nT
{
- ( \l_@@_auto_columns_width_bool && ! \l_@@_block_auto_columns_width_bool)
+ \l_@@_auto_columns_width_bool
|| \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim
}
{
@@ -3916,11 +3999,13 @@ c & c & b & a & e
% First, we put a ``|col|'' node on the left of the first column (of course, we
% have to do that \emph{after} the |\omit|).
% \begin{macrocode}
+ \skip_horizontal:N \arraycolsep
\tikz [ remember~picture , overlay ]
\coordinate [ name = nm - \int_use:N \g_@@_env_int - col - 0 ] ;
+ \skip_horizontal:n { - \arraycolsep }
% \end{macrocode}
% We compute in |\g_tmpa_dim| the common width of the columns. We use a global
-% variable because we are in a cell of an |\halign| and that we have to use this
+% variable because we are in a cell of an |\halign| and because we have to use this
% variable in other cells (of the same row). The affectation of |\g_tmpa_dim|,
% like all the affectations, must be done after the |\omit| of the cell.
% \begin{macrocode}
@@ -3936,18 +4021,20 @@ c & c & b & a & e
{
\dim_gset:Nn \g_tmpa_dim
{ \l_@@_columns_width_dim + 2 \arraycolsep }
- }
+ }
\skip_horizontal:N \g_tmpa_dim
+ \tikz [ remember~picture , overlay ]
+ \coordinate [ name = nm - \int_use:N \g_@@_env_int - col - 1 ] ;
% \end{macrocode}
% We begin a loop over the columns. The integer |\g_tmpa_int| will be the
-% number of columns of the current cell. This integer is not used to fix the
+% number of the current column. This integer is not used to fix the
% width of the column (since all the columns have the same width equal to
% |\g_@@_tmpa_dim|) but for the Tikz nodes.
% \begin{macrocode}
\int_gset:Nn \g_tmpa_int 1
\bool_if:nTF \g_@@_last_col_found_bool
+ { \prg_replicate:nn { \g_@@_col_total_int - 3 } }
{ \prg_replicate:nn { \g_@@_col_total_int - 2 } }
- { \prg_replicate:nn { \g_@@_col_total_int - 1 } }
{
&
\omit
@@ -3967,6 +4054,22 @@ c & c & b & a & e
col - \int_use:N \g_tmpa_int
] ;
}
+% \end{macrocode}
+% For the last column, we want a special treatment because of the final
+% |\arraycolsep|.
+% \begin{macrocode}
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_dim
+ \skip_horizontal:n { - \arraycolsep }
+ \tikz [ remember~picture , overlay ]
+ \coordinate
+ [
+ name = nm - \int_use:N \g_@@_env_int -
+ col - \int_use:N \g_tmpa_int
+ ] ;
+ \skip_horizontal:N \arraycolsep
}
\endarray
\c_math_toggle_token
@@ -3982,10 +4085,10 @@ c & c & b & a & e
{
\bool_if:NF \l_@@_last_row_without_value_bool
{
- \int_compare:nNnF \l_@@_last_row_int = \g_@@_row_int
+ \int_compare:nNnF \l_@@_last_row_int = \c@iRow
{
\@@_error:n { Wrong~last~row }
- \int_gset_eq:NN \l_@@_last_row_int \g_@@_row_int
+ \int_gset_eq:NN \l_@@_last_row_int \c@iRow
}
}
}
@@ -3997,12 +4100,8 @@ c & c & b & a & e
% \begin{macrocode}
\int_compare:nNnTF \l_@@_first_row_int = \c_zero_int
{
- \dim_set:Nn \l_tmpa_dim
- {
- \g_@@_ht_row_one_dim + \g_@@_dp_row_zero_dim
- + \lineskip
- + \g_@@_ht_row_zero_dim - \g_@@_ht_row_one_dim
- }
+ \dim_set:Nn \l_tmpa_dim
+ { \g_@@_dp_row_zero_dim + \lineskip + \g_@@_ht_row_zero_dim }
}
{ \dim_zero:N \l_tmpa_dim }
% \end{macrocode}
@@ -4016,11 +4115,7 @@ c & c & b & a & e
\int_compare:nNnTF \l_@@_last_row_int > { -2 }
{
\dim_set:Nn \l_tmpb_dim
- {
- \g_@@_ht_last_row_dim + \g_@@_dp_ante_last_row_dim
- + \lineskip
- + \g_@@_dp_last_row_dim - \g_@@_dp_ante_last_row_dim
- }
+ { \g_@@_ht_last_row_dim + \lineskip + \g_@@_dp_last_row_dim }
}
{ \dim_zero:N \l_tmpb_dim }
% \end{macrocode}
@@ -4136,7 +4231,7 @@ c & c & b & a & e
\hbox_set:Nw \l_tmpa_box
\c_math_toggle_token
\bool_if:NT \l_@@_small_bool \scriptstyle
- \l_@@_code_for_first_col_tl
+ \int_compare:nNnT \c@iRow > \c_zero_int \l_@@_code_for_first_col_tl
}
l
<
@@ -4173,13 +4268,13 @@ c & c & b & a & e
name =
nm -
\int_use:N \g_@@_env_int -
- \int_use:N \g_@@_row_int -
+ \int_use:N \c@iRow -
0 ,
alias =
\str_if_empty:NF \l_@@_name_str
{
\l_@@_name_str -
- \int_use:N \g_@@_row_int -
+ \int_use:N \c@iRow -
0
}
]
@@ -4209,9 +4304,9 @@ c & c & b & a & e
% column'' is really used.
% \begin{macrocode}
\bool_gset_true:N \g_@@_last_col_found_bool
- \int_gincr:N \g_@@_col_int
+ \int_gincr:N \c@jCol
\int_gset:Nn \g_@@_col_total_int
- { \int_max:nn \g_@@_col_total_int \g_@@_col_int }
+ { \int_max:nn \g_@@_col_total_int \c@jCol }
% \end{macrocode}
% The contents of the cell is constructed in the box |\l_tmpa_box| because we
% have to compute some dimensions of this box.
@@ -4263,14 +4358,14 @@ c & c & b & a & e
name =
nm -
\int_use:N \g_@@_env_int -
- \int_use:N \g_@@_row_int -
- \int_use:N \g_@@_col_int ,
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol ,
alias =
\str_if_empty:NF \l_@@_name_str
{
\l_@@_name_str -
- \int_use:N \g_@@_row_int -
- \int_use:N \g_@@_col_int
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol
}
]
{ \box_use:N \l_tmpa_box } ;
@@ -4395,10 +4490,6 @@ c & c & b & a & e
\@@_define_env:n V
% \end{macrocode}
%
-%
-% \bigskip
-% \subsection{Automatic width of the cells}
-%
%
% \bigskip
% \subsection{How to know whether a cell is ``empty''}
@@ -4504,15 +4595,16 @@ c & c & b & a & e
%
% \subsection{After the construction of the array}
%
-% The macro |\@@_after_array:| is called (via |\group_insert_after:N|) in
-% |{NiceArrayWithDelims}| and |{NiceMatrix}|.
%
% \begin{macrocode}
\cs_new_protected:Nn \@@_after_array:
{
- \int_compare:nNnTF \g_@@_row_int > \c_zero_int
+ \int_compare:nNnTF \c@iRow > \c_zero_int
\@@_after_array_i:
- { \@@_error:n { Zero~row } }
+ {
+ \@@_error:n { Zero~row }
+ \@@_restore_iRow_jCol:
+ }
}
% \end{macrocode}
%
@@ -4527,22 +4619,22 @@ c & c & b & a & e
\cs_if_exist:NT \tikz@library@external@loaded
{ \tikzset { external / export = false } }
% \end{macrocode}
-% Now, the definition of |\g_@@_col_int| and
-% |\g_@@_col_total_int| change: |\g_@@_col_int| will be the number of
+% Now, the definition of |\c@jCol| and
+% |\g_@@_col_total_int| change: |\c@jCol| will be the number of
% columns without the ``last column''; |\g_@@_col_total_int| will be the
% number of columns with this ``last column''.\footnote{We remind that the
% potential ``first column'' has the number~$0$.}
% \begin{macrocode}
- \int_gset_eq:NN \g_@@_col_int \g_@@_col_total_int
- \bool_if:nT \g_@@_last_col_found_bool { \int_gdecr:N \g_@@_col_int }
+ \int_gset_eq:NN \c@jCol \g_@@_col_total_int
+ \bool_if:nT \g_@@_last_col_found_bool { \int_gdecr:N \c@jCol }
% \end{macrocode}
%
-% We fix also the value of |\g_@@_row_int| and |\g_@@_row_total_int| with the
+% We fix also the value of |\c@iRow| and |\g_@@_row_total_int| with the
% same principle.
% \begin{macrocode}
- \int_gset_eq:NN \g_@@_row_total_int \g_@@_row_int
+ \int_gset_eq:NN \g_@@_row_total_int \c@iRow
\int_compare:nNnT \l_@@_last_row_int > { -1 }
- { \int_gsub:Nn \g_@@_row_int \c_one_int }
+ { \int_gsub:Nn \c@iRow \c_one_int }
% \end{macrocode}
%
% In the user has used the option |last-row| without value, we write in the
@@ -4642,17 +4734,26 @@ c & c & b & a & e
\tikzset
{
every~picture / .style =
- {
- overlay ,
- remember~picture ,
- name~prefix = nm - \int_use:N \g_@@_env_int -
- }
+ {
+ overlay ,
+ remember~picture ,
+ name~prefix = nm - \int_use:N \g_@@_env_int -
+ }
}
\cs_set_eq:NN \line \@@_line:nn
\g_@@_code_after_tl
\tl_gclear:N \g_@@_code_after_tl
\group_end:
\str_gclear:N \g_@@_type_env_str
+ \@@_restore_iRow_jCol:
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_restore_iRow_jCol:
+ {
+ \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c@iRow \l_@@_save_iRow_int }
+ \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c@jCol \l_@@_save_jCol_int }
}
% \end{macrocode}
%
@@ -4733,7 +4834,7 @@ c & c & b & a & e
% We test if we are still in the matrix.
% \begin{macrocode}
\bool_set_false:N \l_@@_final_open_bool
- \int_compare:nNnTF \l_@@_final_i_int > \g_@@_row_int
+ \int_compare:nNnTF \l_@@_final_i_int > \c@iRow
{
\int_compare:nNnT { #3 } = 1
{ \bool_set_true:N \l_@@_final_open_bool }
@@ -4745,7 +4846,7 @@ c & c & b & a & e
{ \bool_set_true:N \l_@@_final_open_bool }
}
{
- \int_compare:nNnT \l_@@_final_j_int > \g_@@_col_int
+ \int_compare:nNnT \l_@@_final_j_int > \c@jCol
{
\int_compare:nNnT { #4 } = 1
{ \bool_set_true:N \l_@@_final_open_bool }
@@ -4837,7 +4938,7 @@ c & c & b & a & e
{ \bool_set_true:N \l_@@_initial_open_bool }
}
{
- \int_compare:nNnT \l_@@_initial_j_int > \g_@@_col_int
+ \int_compare:nNnT \l_@@_initial_j_int > \c@jCol
{
\int_compare:nNnT { #4 } = { -1 }
{ \bool_set_true:N \l_@@_initial_open_bool }
@@ -4941,6 +5042,47 @@ c & c & b & a & e
\cs_generate_variant:Nn \@@_retrieve_coords:nn { x x }
% \end{macrocode}
%
+% \interitem
+% For the horizontal lines with open extremities, we must take into account the
+% ``|col|'' nodes created in the environments which have a fixed width of the
+% columns. The following command will recompute the $x$-value of the extremities
+% in this case (erasing the value computed in |\@@_retrieve_coords:nn|).
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_adjust_with_col_nodes:
+ {
+ \bool_if:NT \l_@@_initial_open_bool
+ {
+ \cs_if_exist:cT
+ { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - col - 0 }
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node \pgfutil@firstofone
+ ( nm - \int_use:N \g_@@_env_int - col - 0 )
+ \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
+ \end { tikzpicture }
+ }
+ }
+ \bool_if:NT \l_@@_final_open_bool
+ {
+ \cs_if_exist:cT
+ {
+ pgf@sh@ns@nm - \int_use:N \g_@@_env_int - col -
+ \int_use:N \c@jCol
+ }
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node \pgfutil@firstofone
+ (
+ nm - \int_use:N \g_@@_env_int - col -
+ \int_use:N \c@jCol
+ )
+ \dim_gset:Nn \g_@@_x_final_dim \pgf@x
+ \end { tikzpicture }
+ }
+ }
+ }
+% \end{macrocode}
+%
% \interitem
% \begin{macrocode}
\cs_new_protected:Nn \@@_draw_Ldots:nn
@@ -4996,6 +5138,7 @@ c & c & b & a & e
}
{ .base~west }
}
+ \@@_adjust_with_col_nodes:
\bool_if:NT \l_@@_initial_open_bool
{ \dim_gset_eq:NN \g_@@_y_initial_dim \g_@@_y_final_dim }
\bool_if:NT \l_@@_final_open_bool
@@ -5051,6 +5194,7 @@ c & c & b & a & e
}
{ .mid~west }
}
+ \@@_adjust_with_col_nodes:
\bool_if:NT \l_@@_initial_open_bool
{ \dim_gset_eq:NN \g_@@_y_initial_dim \g_@@_y_final_dim }
\bool_if:NT \l_@@_final_open_bool
@@ -5365,7 +5509,7 @@ c & c & b & a & e
\l_tmpb_int
}
\begin { tikzpicture } [ overlay ]
- \int_step_inline:nnnn 0 1 \l_tmpa_int
+ \int_step_inline:nnn 0 \l_tmpa_int
{
\pgfpathcircle
{ \pgfpoint { \g_@@_x_initial_dim } { \g_@@_y_initial_dim } }
@@ -5400,7 +5544,7 @@ c & c & b & a & e
\cs_new_protected:Nn \@@_add_to_empty_cells:
{
\cs_gset:cpx
- { @@ _ empty _ \int_use:N \g_@@_row_int - \int_use:N \g_@@_col_int }
+ { @@ _ empty _ \int_use:N \c@iRow - \int_use:N \c@jCol }
{ \int_use:N \g_@@_env_int }
}
% \end{macrocode}
@@ -5485,10 +5629,10 @@ c & c & b & a & e
\int_compare:nNnT #1 > 1
{
\seq_gput_left:Nx \g_@@_multicolumn_cells_seq
- { \int_eval:n \g_@@_row_int - \int_use:N \g_@@_col_int }
+ { \int_eval:n \c@iRow - \int_use:N \c@jCol }
\seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 }
}
- \int_gadd:Nn \g_@@_col_int { #1 - 1 }
+ \int_gadd:Nn \c@jCol { #1 - 1 }
}
% \end{macrocode}
%
@@ -5526,8 +5670,8 @@ c & c & b & a & e
\tl_gput_right:Nx \g_@@_Hdotsfor_lines_tl
{
\@@_draw_Hdotsfor:nnn
- { \int_use:N \g_@@_row_int }
- { \int_use:N \g_@@_col_int }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
{ #2 }
}
\prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
@@ -5563,7 +5707,7 @@ c & c & b & a & e
\bool_set_true:N \l_@@_initial_open_bool
}
}
- \int_compare:nNnTF { #2 + #3 -1 } = \g_@@_col_int
+ \int_compare:nNnTF { #2 + #3 -1 } = \c@jCol
{
\int_set:Nn \l_@@_final_j_int { #2 + #3 - 1 }
\bool_set_true:N \l_@@_final_open_bool
@@ -5601,34 +5745,41 @@ c & c & b & a & e
% \begin{macrocode}
\cs_new_protected:Nn \@@_line:nn
{
- \dim_zero_new:N \g_@@_x_initial_dim
- \dim_zero_new:N \g_@@_y_initial_dim
- \dim_zero_new:N \g_@@_x_final_dim
- \dim_zero_new:N \g_@@_y_final_dim
- \bool_set_false:N \l_@@_initial_open_bool
- \bool_set_false:N \l_@@_final_open_bool
- \bool_if:nTF
+ \bool_if:NF \c_@@_draft_bool
{
- \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #1 }
- &&
- \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #2 }
- }
- {
- \begin { tikzpicture }
- \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
- \tikz@parse@node \pgfutil@firstofone ( i )
- \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
- \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
- \tikz@parse@node \pgfutil@firstofone ( f )
- \dim_gset:Nn \g_@@_x_final_dim \pgf@x
- \dim_gset:Nn \g_@@_y_final_dim \pgf@y
- \end { tikzpicture }
- \@@_draw_tikz_line:
+ \dim_zero_new:N \g_@@_x_initial_dim
+ \dim_zero_new:N \g_@@_y_initial_dim
+ \dim_zero_new:N \g_@@_x_final_dim
+ \dim_zero_new:N \g_@@_y_final_dim
+ \bool_set_false:N \l_@@_initial_open_bool
+ \bool_set_false:N \l_@@_final_open_bool
+ \bool_if:nTF
+ {
+ \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #1 }
+ &&
+ \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - #2 }
+ }
+ {
+ \begin { tikzpicture }
+ \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
+ \tikz@parse@node \pgfutil@firstofone ( i )
+ \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
+ \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
+ \tikz@parse@node \pgfutil@firstofone ( f )
+ \dim_gset:Nn \g_@@_x_final_dim \pgf@x
+ \dim_gset:Nn \g_@@_y_final_dim \pgf@y
+ \end { tikzpicture }
+ \@@_draw_tikz_line:
+ }
+ {
+ \@@_error:nnn { unknown~cell~for~line~in~code-after }
+ { #1 } { #2 }
+ }
}
- { \@@_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 } }
}
% \end{macrocode}
%
+%
% The commands |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, and |\Iddots| don't use
% this command because they have to do other settings (for example, the diagonal
% lines must be parallelized).
@@ -5727,7 +5878,6 @@ c & c & b & a & e
\int_compare:nNnTF #1 = \c_zero_int
{ \@@_error:n { Use~of~:~in~first~position } }
{
- \@@_create_extra_nodes:
\bool_if:NF \c_@@_draft_bool
{
\dim_zero_new:N \g_@@_x_initial_dim
@@ -5737,50 +5887,63 @@ c & c & b & a & e
\bool_set_true:N \l_@@_initial_open_bool
\bool_set_true:N \l_@@_final_open_bool
% \end{macrocode}
-% In order to have the coordinates of the line to draw, we use the ``large
-% nodes''.
-% \begin{macrocode}
- \begin { tikzpicture } [ remember~picture ]
- \tikz@parse@node\pgfutil@firstofone
- ( 1 - #1 - large .north~east )
- \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
- \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
- \tikz@parse@node\pgfutil@firstofone
- ( \int_use:N \g_@@_row_int - #1 - large .south~east )
- \dim_gset:Nn \g_@@_x_final_dim \pgf@x
- \dim_gset:Nn \g_@@_y_final_dim \pgf@y
- \end { tikzpicture }
-% \end{macrocode}
-% However, if the previous column was constructed with a letter |w|, we use the
-% |w|-nodes to change the $x$-value of the nodes.
+% If a ``|col|'' node exists (if the array has been constructed with a fixed
+% width of column), we use it.
% \begin{macrocode}
- \cs_if_exist:cT
- { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - 1 - #1 - w }
+ \cs_if_exist:cTF
+ { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - col - #1 }
{
\begin { tikzpicture } [ remember~picture ]
\tikz@parse@node\pgfutil@firstofone
- ( 1 - #1 - w .north~east )
+ ( col - #1 )
\dim_gset:Nn \g_@@_x_initial_dim \pgf@x
- \tikz@parse@node\pgfutil@firstofone
- ( \int_use:N \g_@@_row_int - #1 - w .south~east )
\dim_gset:Nn \g_@@_x_final_dim \pgf@x
+ \dim_gset:Nn \g_@@_y_final_dim \pgf@y
\end { tikzpicture }
- \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep
- \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep
+ \dim_gset:Nn \g_@@_y_initial_dim { - \c_max_dim }
+ \int_step_inline:nn \c@jCol
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node\pgfutil@firstofone
+ ( 1 - ##1 . north~east )
+ \dim_gset:Nn \g_@@_y_initial_dim
+ { \dim_max:nn \g_@@_y_initial_dim \pgf@y }
+ \end { tikzpicture }
+ }
}
% \end{macrocode}
-% However, if a node of column exists (if the array has been constructed with a
-% fixed width of column), we use it.
+% If not, we use the ``large node''.
% \begin{macrocode}
- \cs_if_exist:cT
- { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - col - #1 }
{
\begin { tikzpicture } [ remember~picture ]
\tikz@parse@node\pgfutil@firstofone
- ( col - #1 )
+ ( 1 - #1 - large .north~east )
\dim_gset:Nn \g_@@_x_initial_dim \pgf@x
+ \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
+ \tikz@parse@node\pgfutil@firstofone
+ ( \int_use:N \c@iRow - #1 - large .south~east )
\dim_gset:Nn \g_@@_x_final_dim \pgf@x
+ \dim_gset:Nn \g_@@_y_final_dim \pgf@y
\end { tikzpicture }
+% \end{macrocode}
+% However, if the previous column was constructed with a letter |w|, we use the
+% |w|-nodes (and we erase the previous computation of the $x$-value of the
+% vertical dotted line).
+% \begin{macrocode}
+ \cs_if_exist:cT
+ { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - 1 - #1 - w }
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node\pgfutil@firstofone
+ ( 1 - #1 - w .north~east )
+ \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
+ \tikz@parse@node\pgfutil@firstofone
+ ( \int_use:N \c@iRow - #1 - w .south~east )
+ \dim_gset:Nn \g_@@_x_final_dim \pgf@x
+ \end { tikzpicture }
+ \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep
+ \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep
+ }
}
\@@_draw_tikz_line:
}
@@ -5789,7 +5952,6 @@ c & c & b & a & e
% \end{macrocode}
%
%
-%
% \bigskip
% \subsection{The vertical rules}
%
@@ -5800,7 +5962,7 @@ c & c & b & a & e
% with |\newcolumntype|:
% \begin{Verbatim}[commandchars=\~\#\+]
% \newcolumntype { | }
-% { ! { \int_compare:nNnF \g_@@_row_int = \c_zero_int \vline } }
+% { ! { \int_compare:nNnF \c@iRow = \c_zero_int \vline } }
% \end{Verbatim}
%
% However, this code fails is the user uses "\DefineShortVerb{\|}" of
@@ -5820,45 +5982,45 @@ c & c & b & a & e
{
\int_compare:nNnTF \l_@@_first_col_int = \c_zero_int
{
- \int_compare:nNnTF \g_@@_col_int = \c_zero_int
+ \int_compare:nNnTF \c@jCol = \c_zero_int
{
\int_compare:nNnTF \l_@@_first_row_int = \c_zero_int
{
- \int_compare:nNnF \g_@@_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int
+ \int_compare:nNnF \c@iRow = \l_@@_last_row_int
\@@_vline_i:
}
}
{
- \int_compare:nNnF \g_@@_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int
+ \int_compare:nNnF \c@iRow = \l_@@_last_row_int
\@@_vline_i:
}
}
}
{
- \int_compare:nNnF \g_@@_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int
+ \int_compare:nNnF \c@iRow = \l_@@_last_row_int
\@@_vline_i:
}
}
}
{
- \int_compare:nNnTF \g_@@_col_int = \c_zero_int
+ \int_compare:nNnTF \c@jCol = \c_zero_int
{
- \int_compare:nNnF \g_@@_row_int = { -1 }
+ \int_compare:nNnF \c@iRow = { -1 }
{
- \int_compare:nNnF \g_@@_row_int = { \l_@@_last_row_int - 1 }
+ \int_compare:nNnF \c@iRow = { \l_@@_last_row_int - 1 }
\@@_vline_i:
}
}
{
- \int_compare:nNnF \g_@@_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g_@@_row_int = \l_@@_last_row_int
+ \int_compare:nNnF \c@iRow = \l_@@_last_row_int
\@@_vline_i:
}
}
@@ -6043,7 +6205,7 @@ c & c & b & a & e
% \bigskip
% For ``large nodes'', the exterior rows and columns don't interfer.
% That's why the loop over the rows will start at 1 and the loop over the
-% columns will stop at $|\g_@@_col_int|$ (and not |\g_@@_col_total_int|). Idem
+% columns will stop at $|\c@jCol|$ (and not |\g_@@_col_total_int|). Idem
% for the rows.
% \begin{macrocode}
\int_set:Nn \l_@@_first_row_int 1
@@ -6054,7 +6216,7 @@ c & c & b & a & e
% \texttt{l_@@_column_\textsl{j}_min_dim} and
% \texttt{l_@@_column_\textsl{j}_max_dim}.
% \begin{macrocode}
- \int_step_variable:nNn { \g_@@_row_int - 1 } \@@_i:
+ \int_step_variable:nNn { \c@iRow - 1 } \@@_i:
{
\dim_set:cn { l_@@_row _ \@@_i: _ min _ dim }
{
@@ -6067,7 +6229,7 @@ c & c & b & a & e
\dim_set_eq:cc { l_@@_row _ \int_eval:n { \@@_i: + 1 } _ max _ dim }
{ l_@@_row_\@@_i: _min_dim }
}
- \int_step_variable:nNn { \g_@@_col_int - 1 } \@@_j:
+ \int_step_variable:nNn { \c@jCol - 1 } \@@_j:
{
\dim_set:cn { l_@@_column _ \@@_j: _ max _ dim }
{
@@ -6086,7 +6248,7 @@ c & c & b & a & e
{ l_@@_column _ 1 _ min _ dim }
\l_@@_left_margin_dim
\dim_add:cn
- { l_@@_column _ \int_use:N \g_@@_col_int _ max _ dim }
+ { l_@@_column _ \int_use:N \c@jCol _ max _ dim }
\l_@@_right_margin_dim
% \end{macrocode}
% Now, we can actually create the ``large nodes''.
@@ -6112,7 +6274,7 @@ c & c & b & a & e
\dim_gset:Nn \g_tmpa_dim \pgf@x
\tikz@parse@node \pgfutil@firstofone
( nm - \int_use:N \g_@@_env_int - 1 -
- \int_use:N \g_@@_col_int - large .north~east )
+ \int_use:N \c@jCol - large .north~east )
\dim_gset:Nn \g_tmpb_dim \pgf@x
\end { tikzpicture }
\iow_now:Nn \@mainaux \ExplSyntaxOn
@@ -6220,7 +6382,8 @@ c & c & b & a & e
inner~sep = \c_zero_dim ,
name = nm - \int_use:N \g_@@_env_int - \@@_i: - \@@_j: ,
alias =
- \str_if_empty:NF \l_@@_name_str { \l_@@_name_str - \@@_i: - \@@_j: }
+ \str_if_empty:NF \l_@@_name_str
+ { \l_@@_name_str - \@@_i: - \@@_j: }
]
;
}
@@ -6298,10 +6461,10 @@ c & c & b & a & e
\tl_gput_left:Nx \g_@@_code_after_tl
{
\@@_Block_iv:nnnnn
- { \int_use:N \g_@@_row_int }
- { \int_use:N \g_@@_col_int }
- { \int_eval:n { \g_@@_row_int + #1 - 1 } }
- { \int_eval:n { \g_@@_col_int + #2 - 1 } }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
+ { \int_eval:n { \c@iRow + #1 - 1 } }
+ { \int_eval:n { \c@jCol + #2 - 1 } }
\exp_not:n { { #3 $ #4 $ } }
}
}
@@ -6335,8 +6498,8 @@ c & c & b & a & e
{
\bool_if:nTF
{
- \int_compare_p:nNn { #3 } > \g_@@_row_int
- || \int_compare_p:nNn { #4 } > \g_@@_col_int
+ \int_compare_p:nNn { #3 } > \c@iRow
+ || \int_compare_p:nNn { #4 } > \c@jCol
}
{ \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
{
@@ -6461,17 +6624,13 @@ c & c & b & a & e
\@@_msg_new:nn { Wrong~last~row }
{
You~have~used~'last-row=\int_use:N \l_@@_last_row_int'~but~your~environment~
- \{\g_@@_type_env_str\}~seems~to~have~\int_use:N \g_@@_row_int\
- rows.~If~you~go~on,~the~value~of~\int_use:N \g_@@_row_int\
+ \{\g_@@_type_env_str\}~seems~to~have~\int_use:N \c@iRow
+ rows.~If~you~go~on,~the~value~of~\int_use:N \c@iRow
will~be~used~for~last~row.~You~can~avoid~this~problem~by~using~'last-row'~
without~value~(more~compilations~might~be~necessary).
}
% \end{macrocode}
%
-% \begin{macrocode}
-\@@_msg_new:nn { Draft~mode }
- { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. }
-% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { Yet~in~env }
@@ -6616,6 +6775,8 @@ c & c & b & a & e
}
% \end{macrocode}
%
+% The following message should be changed because, normally, there can be any
+% longer artefact in the environments of \pkg{amsmath}.
% \begin{macrocode}
\@@_msg_new:nnn { Duplicate~name }
{
@@ -6623,7 +6784,7 @@ c & c & b & a & e
the~same~environment~name~twice.~You~can~go~on,~but,~
maybe,~you~will~have~incorrect~results~especially~
if~you~use~'columns-width=auto'.~If~you~use~nicematrix~inside~some~
- environments~of~amsmath,~this~error~may~be~an~artefact.~In~this~case,
+ environments~of~amsmath,~this~error~may~be~an~artefact.~In~this~case,~
use~the~option~'allow-duplicate-names'.\\
For~a~list~of~the~names~already~used,~type~H~<return>. \\
}
@@ -6658,14 +6819,24 @@ c & c & b & a & e
first~position~of~the~preamble~of~the~environment~\{\g_@@_type_env_str\}. \\
If~you~go~on,~this~dotted~line~will~be~ignored.
}
-% \end{macrocode}
+% \end{macrocode}
%
%
% \subsection{Obsolete environments}
%
+% \begin{macrocode}
+\@@_msg_new:nn { Obsolete~environment }
+ {
+ The~environment~\{\@currenvir\}~is~obsolete.~
+ We~should~use~#1~instead.
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\NewDocumentEnvironment { pNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\pNiceArray
}
@@ -6675,6 +6846,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { bNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\bNiceArray
}
@@ -6684,6 +6857,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { BNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\BNiceArray
}
@@ -6693,6 +6868,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { vNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\vNiceArray
}
@@ -6702,6 +6879,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { VNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\VNiceArray
}
@@ -6711,6 +6890,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { pNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\int_set:Nn \l_@@_first_row_int \c_zero_int
\pNiceArray
@@ -6721,6 +6902,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { bNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\int_set:Nn \l_@@_first_row_int \c_zero_int
\bNiceArray
@@ -6731,6 +6914,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { BNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\int_set:Nn \l_@@_first_row_int \c_zero_int
\BNiceArray
@@ -6741,6 +6926,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { vNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\bool_set_true:N \l_@@_last_col_bool
\int_set:Nn \l_@@_first_row_int \c_zero_int
\vNiceArray
@@ -6751,6 +6938,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { VNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\int_set:Nn \l_@@_first_row_int \c_zero_int
\VNiceArray
@@ -6761,6 +6950,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { NiceArrayCwithDelims } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\NiceArrayWithDelims
}
@@ -6770,6 +6961,8 @@ c & c & b & a & e
% \begin{macrocode}
\NewDocumentEnvironment { NiceArrayRCwithDelims } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l_@@_last_col_int \c_zero_dim
\int_set:Nn \l_@@_first_row_int \c_zero_int
\NiceArrayWithDelims
@@ -6778,7 +6971,7 @@ c & c & b & a & e
% \end{macrocode}
%
%
-%
+% \vspace{1cm}
% \section{History}
%
% \subsection*{Changes between versions 1.0 and 1.1}
@@ -6850,15 +7043,15 @@ c & c & b & a & e
% \subsection*{Changes between version 2.1.2 and 2.1.3}
%
% When searching the end of a dotted line from a command like |\Cdots| issued in
-% the ``main matrix'' (not in the column |C|), the cells in the column |C| are
-% considered as outside the matrix. That means that it's possible to do the
-% following matrix with only a |\Cdots| command (and a single |\Vdots|).
-% \[\begin{pNiceArrayRC}{Wc{5mm}CWc{5mm}}
+% the ``main matrix'' (not in the exterior column), the cells in the exterior
+% column are considered as outside the matrix. That means that it's possible to
+% do the following matrix with only a |\Cdots| command (and a single |\Vdots|).
+% \[\begin{pNiceArray}{Wc{5mm}CWc{5mm}}[first-row,last-col]
% & C_j & \\
% \mbox{\Large $0$} & \Vdots & \mbox{\Large $0$} \\
% & \strut a & \Cdots & L_i \\
% \mbox{\Large $0$} & & \mbox{\Large $0$} \\
-% \end{pNiceArrayRC}\]
+% \end{pNiceArray}\]
%
% \subsection*{Changes between version 2.1.3 and 2.1.4}
%
@@ -6907,7 +7100,7 @@ c & c & b & a & e
% Modification of |\Hdotsfor|. Now |\Hdotsfor| erases the |\vlines| (of ``"|"'')
% as |\hdotsfor| does.
%
-% Composition of exterior rows and columns of the four sides of the matrix (and
+% Composition of exterior rows and columns on the four sides of the matrix (and
% not only on two sides) with the options |first-row|, |last-row|, |first-col|
% and |last-col|.
%
@@ -6918,8 +7111,8 @@ c & c & b & a & e
% Error message when the user gives an incorrect value for |last-row|.
%
% A dotted line can no longer cross another dotted line (except the dotted lines
-% drawn by |\cdottedline|, |:| (in the preamble of the array) and |\line| in
-% |code-after|.
+% drawn by |\cdottedline|, the symbol |:| (in the preamble of the array) and
+% |\line| in |code-after|.
%
% The starred versions of |\Cdots|, |\Ldots|, etc. are now deprecated because,
% with the new implementation, they become pointless. These starred versions
@@ -6960,8 +7153,24 @@ c & c & b & a & e
% \pkg{nicematrix} when the class \cls{standalone} or the package
% \pkg{standalone} is used.
%
+% \subsection*{Changes between version 3.4 and 3.5}
+%
+% Correction on a bug on the two previous versions where the |code-after| was
+% not executed.
%
+% \subsection*{Changes between version 3.5 and 3.6}
+%
+% LaTeX counters |iRow| and |jCol| available in the cells of the array.
+%
+% Addition of |\normalbaselines| before the construction of the array: in
+% environments like |{align}| of \pkg{amsmath} the value of |\baselineskip| is
+% changed and if the options |first-row| and |last-row| were used in an
+% environment of \pkg{nicematrix}, the position of the delimiters was wrong.
%
+% A warning is written in the |.log| file if an obsolete environment is used.
+%
+% There is no longer artificial errors |Duplicate~name| in the environments of
+% \pkg{amsmath}.
% \PrintIndex
%
% \tableofcontents
@@ -6970,6 +7179,7 @@ c & c & b & a & e
% Local Variables:
% TeX-fold-mode: t
% TeX-fold-preserve-comments: nil
+% ispell-local-dictionary: english
% fill-column: 80
% End:
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index 8365b0e24c7..7c650dca5aa 100644
--- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
+++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
@@ -18,11 +18,11 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{3.5}
-\def\myfiledate{2019/10/13}
+\def\myfileversion{3.6}
+\def\myfiledate{2019/10/29}
\RequirePackage{tikz}
\usetikzlibrary{fit}
-\RequirePackage{expl3}[2019/02/15]
+\RequirePackage{expl3}[2019/07/01]
\RequirePackage{l3keys2e}
\ProvidesExplPackage
{nicematrix}
@@ -35,7 +35,7 @@
\ProcessOptions \relax
\RequirePackage { array }
\RequirePackage { amsmath }
-\RequirePackage { xparse } [ 2018-10-17 ]
+\RequirePackage { xparse } [ 2018-07-01 ]
\cs_new_protected:Npn \__nm_error:n { \msg_error:nn { nicematrix } }
\cs_new_protected:Npn \__nm_error:nn { \msg_error:nnn { nicematrix } }
\cs_new_protected:Npn \__nm_error:nnn { \msg_error:nnnn { nicematrix } }
@@ -52,6 +52,8 @@
\@ifclassloaded { revtex4-2 }
{ \bool_set_true:N \c__nm_revtex_bool }
{ }
+\__nm_msg_new:nn { Draft~mode }
+ { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. }
\bool_if:NT \c__nm_draft_bool
{ \msg_warning:nn { nicematrix } { Draft~mode } }
\ProvideDocumentCommand \iddots { }
@@ -96,6 +98,8 @@
\dim_set:Nn \l__nm_radius_dim { 0.53 pt }
\str_new:N \g__nm_type_env_str
\tl_new:N \g__nm_code_after_tl
+\int_new:N \l__nm_save_iRow_int
+\int_new:N \l__nm_save_jCol_int
\int_new:N \l__nm_first_row_int
\int_set:Nn \l__nm_first_row_int 1
\int_new:N \l__nm_first_col_int
@@ -198,11 +202,13 @@
{ \dim_set:Nn \l__nm_columns_width_dim { #1 } } ,
columns-width .value_required:n = true ,
name .code:n =
- \str_set:Nn \l_tmpa_str { #1 }
- \seq_if_in:NVTF \g__nm_names_seq \l_tmpa_str
- { \__nm_error:nn { Duplicate~name } { #1 } }
- { \seq_gput_left:NV \g__nm_names_seq \l_tmpa_str }
- \str_set_eq:NN \l__nm_name_str \l_tmpa_str ,
+ \unless \ifmeasuring@
+ \str_set:Nn \l_tmpa_str { #1 }
+ \seq_if_in:NVTF \g__nm_names_seq \l_tmpa_str
+ { \__nm_error:nn { Duplicate~name } { #1 } }
+ { \seq_gput_left:NV \g__nm_names_seq \l_tmpa_str }
+ \str_set_eq:NN \l__nm_name_str \l_tmpa_str
+ \fi ,
name .value_required:n = true ,
code-after .tl_gset:N = \g__nm_code_after_tl ,
code-after .value_required:n = true ,
@@ -295,41 +301,41 @@
}
\cs_new_protected:Nn \__nm_Cell:
{
- \int_gincr:N \g__nm_col_int
- \int_compare:nNnT \g__nm_col_int = \c_one_int
+ \int_gincr:N \c@jCol
+ \int_compare:nNnT \c@jCol = \c_one_int
{
\int_compare:nNnT \l__nm_first_col_int = \c_one_int
\__nm_begin_of_row:
}
\int_gset:Nn \g__nm_col_total_int
- { \int_max:nn \g__nm_col_total_int \g__nm_col_int }
+ { \int_max:nn \g__nm_col_total_int \c@jCol }
\hbox_set:Nw \l_tmpa_box
\c_math_toggle_token
\bool_if:NT \l__nm_small_bool \scriptstyle
- \int_compare:nNnTF \g__nm_row_int = \c_zero_int
- \l__nm_code_for_first_row_tl
+ \int_compare:nNnTF \c@iRow = \c_zero_int
+ { \int_compare:nNnT \c@jCol > \c_zero_int \l__nm_code_for_first_row_tl }
{
- \int_compare:nNnT \g__nm_row_int = \l__nm_last_row_int
+ \int_compare:nNnT \c@iRow = \l__nm_last_row_int
\l__nm_code_for_last_row_tl
}
}
\cs_new_protected:Nn \__nm_begin_of_row:
{
- \int_gincr:N \g__nm_row_int
+ \int_gincr:N \c@iRow
\dim_gset_eq:NN \g__nm_dp_ante_last_row_dim \g__nm_dp_last_row_dim
\dim_gzero:N \g__nm_dp_last_row_dim
\dim_gzero:N \g__nm_ht_last_row_dim
}
\cs_new_protected:Npn \__nm_actualization_for_first_and_last_row:
{
- \int_compare:nNnT \g__nm_row_int = \c_zero_int
+ \int_compare:nNnT \c@iRow = \c_zero_int
{
\dim_gset:Nn \g__nm_dp_row_zero_dim
{ \dim_max:nn \g__nm_dp_row_zero_dim { \box_dp:N \l_tmpa_box } }
\dim_gset:Nn \g__nm_ht_row_zero_dim
{ \dim_max:nn \g__nm_ht_row_zero_dim { \box_ht:N \l_tmpa_box } }
}
- \int_compare:nNnT \g__nm_row_int = \c_one_int
+ \int_compare:nNnT \c@iRow = \c_one_int
{
\dim_gset:Nn \g__nm_ht_row_one_dim
{ \dim_max:nn \g__nm_ht_row_one_dim { \box_ht:N \l_tmpa_box } }
@@ -357,14 +363,14 @@
[
anchor = base ,
name = nm - \int_use:N \g__nm_env_int -
- \int_use:N \g__nm_row_int -
- \int_use:N \g__nm_col_int ,
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol ,
alias =
\str_if_empty:NF \l__nm_name_str
{
\l__nm_name_str -
- \int_use:N \g__nm_row_int -
- \int_use:N \g__nm_col_int
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol
}
]
\bgroup
@@ -411,14 +417,14 @@
[
node~contents = { } ,
name = nm - \int_use:N \g__nm_env_int -
- \int_use:N \g__nm_row_int -
- \int_use:N \g__nm_col_int - w,
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol - w,
alias =
\str_if_empty:NF \l__nm_name_str
{
\l__nm_name_str -
- \int_use:N \g__nm_row_int -
- \int_use:N \g__nm_col_int - w
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol - w
} ,
inner~sep = \c_zero_dim ,
fit = (__nm~south~west) (__nm~north~east)
@@ -436,8 +442,8 @@
{ g__nm_ #1 _ lines _ tl }
{
\use:c { __nm _ draw _ #1 : nn }
- { \int_use:N \g__nm_row_int }
- { \int_use:N \g__nm_col_int }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
}
}
}
@@ -458,12 +464,12 @@
{ \noalign { \__nm_everycr_i: } }
\cs_new_protected:Npn \__nm_everycr_i:
{
- \int_gzero:N \g__nm_col_int
+ \int_gzero:N \c@jCol
\bool_if:NT \l__nm_hlines_bool
{
- \int_compare:nNnT \g__nm_row_int > { -1 }
+ \int_compare:nNnT \c@iRow > { -1 }
{
- \int_compare:nNnF \g__nm_row_int = \l__nm_last_row_int
+ \int_compare:nNnF \c@iRow = \l__nm_last_row_int
{
\hrule \@height \arrayrulewidth
\skip_vertical:n { - \arrayrulewidth }
@@ -473,6 +479,13 @@
}
\cs_new_protected:Npn \__nm_pre_array:
{
+ \cs_if_exist:NT \theiRow
+ { \int_set_eq:NN \l__nm_save_iRow_int \c@iRow }
+ \int_gzero_new:N \c@iRow
+ \cs_if_exist:NT \thejCol
+ { \int_set_eq:NN \l__nm_save_jCol_int \c@jCol }
+ \int_gzero_new:N \c@jCol
+ \normalbaselines
\bool_if:NT \l__nm_small_bool
{
\cs_set:Npn \arraystretch { 0.47 }
@@ -536,10 +549,8 @@
}
\seq_gclear_new:N \g__nm_multicolumn_cells_seq
\seq_gclear_new:N \g__nm_multicolumn_sizes_seq
- \int_gzero_new:N \g__nm_row_int
- \int_gset:Nn \g__nm_row_int { \l__nm_first_row_int - 1 }
+ \int_gset:Nn \c@iRow { \l__nm_first_row_int - 1 }
\int_gzero_new:N \g__nm_row_total_int
- \int_gzero_new:N \g__nm_col_int
\int_gzero_new:N \g__nm_col_total_int
\cs_set_eq:NN \@ifnextchar \new@ifnextchar
\cs_set_eq:NN \NC@find@w \relax
@@ -553,12 +564,17 @@
!
{
\skip_horizontal:n { 0.53 pt }
- \bool_gset_true:N \g__nm_extra_nodes_bool
- \int_compare:nNnT \g__nm_col_int > \g__nm_last_vdotted_col_int
+ \bool_if:nF
{
- \int_gset_eq:NN \g__nm_last_vdotted_col_int \g__nm_col_int
+ \l__nm_auto_columns_width_bool
+ || \dim_compare_p:nNn \l__nm_columns_width_dim > \c_zero_dim
+ }
+ { \bool_gset_true:N \g__nm_extra_nodes_bool }
+ \int_compare:nNnT \c@jCol > \g__nm_last_vdotted_col_int
+ {
+ \int_gset_eq:NN \g__nm_last_vdotted_col_int \c@jCol
\tl_gput_right:Nx \g__nm_code_after_tl
- { \__nm_vdottedline:n { \int_use:N \g__nm_col_int } }
+ { \__nm_vdottedline:n { \int_use:N \c@jCol } }
}
}
}
@@ -672,15 +688,17 @@
{
\bool_if:nT
{
- ( \l__nm_auto_columns_width_bool && ! \l__nm_block_auto_columns_width_bool)
+ \l__nm_auto_columns_width_bool
|| \dim_compare_p:nNn \l__nm_columns_width_dim > \c_zero_dim
}
{
\crcr
\int_compare:nNnT \l__nm_first_col_int = 0 { \omit & }
\omit
+ \skip_horizontal:N \arraycolsep
\tikz [ remember~picture , overlay ]
\coordinate [ name = nm - \int_use:N \g__nm_env_int - col - 0 ] ;
+ \skip_horizontal:n { - \arraycolsep }
\bool_if:nTF
{
\l__nm_auto_columns_width_bool
@@ -693,12 +711,14 @@
{
\dim_gset:Nn \g_tmpa_dim
{ \l__nm_columns_width_dim + 2 \arraycolsep }
- }
+ }
\skip_horizontal:N \g_tmpa_dim
+ \tikz [ remember~picture , overlay ]
+ \coordinate [ name = nm - \int_use:N \g__nm_env_int - col - 1 ] ;
\int_gset:Nn \g_tmpa_int 1
\bool_if:nTF \g__nm_last_col_found_bool
+ { \prg_replicate:nn { \g__nm_col_total_int - 3 } }
{ \prg_replicate:nn { \g__nm_col_total_int - 2 } }
- { \prg_replicate:nn { \g__nm_col_total_int - 1 } }
{
&
\omit
@@ -711,6 +731,18 @@
col - \int_use:N \g_tmpa_int
] ;
}
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_dim
+ \skip_horizontal:n { - \arraycolsep }
+ \tikz [ remember~picture , overlay ]
+ \coordinate
+ [
+ name = nm - \int_use:N \g__nm_env_int -
+ col - \int_use:N \g_tmpa_int
+ ] ;
+ \skip_horizontal:N \arraycolsep
}
\endarray
\c_math_toggle_token
@@ -721,31 +753,23 @@
{
\bool_if:NF \l__nm_last_row_without_value_bool
{
- \int_compare:nNnF \l__nm_last_row_int = \g__nm_row_int
+ \int_compare:nNnF \l__nm_last_row_int = \c@iRow
{
\__nm_error:n { Wrong~last~row }
- \int_gset_eq:NN \l__nm_last_row_int \g__nm_row_int
+ \int_gset_eq:NN \l__nm_last_row_int \c@iRow
}
}
}
\int_compare:nNnTF \l__nm_first_row_int = \c_zero_int
{
\dim_set:Nn \l_tmpa_dim
- {
- \g__nm_ht_row_one_dim + \g__nm_dp_row_zero_dim
- + \lineskip
- + \g__nm_ht_row_zero_dim - \g__nm_ht_row_one_dim
- }
+ { \g__nm_dp_row_zero_dim + \lineskip + \g__nm_ht_row_zero_dim }
}
{ \dim_zero:N \l_tmpa_dim }
\int_compare:nNnTF \l__nm_last_row_int > { -2 }
{
\dim_set:Nn \l_tmpb_dim
- {
- \g__nm_ht_last_row_dim + \g__nm_dp_ante_last_row_dim
- + \lineskip
- + \g__nm_dp_last_row_dim - \g__nm_dp_ante_last_row_dim
- }
+ { \g__nm_ht_last_row_dim + \lineskip + \g__nm_dp_last_row_dim }
}
{ \dim_zero:N \l_tmpb_dim }
\int_compare:nNnT \l__nm_first_col_int = \c_zero_int
@@ -816,7 +840,7 @@
\hbox_set:Nw \l_tmpa_box
\c_math_toggle_token
\bool_if:NT \l__nm_small_bool \scriptstyle
- \l__nm_code_for_first_col_tl
+ \int_compare:nNnT \c@iRow > \c_zero_int \l__nm_code_for_first_col_tl
}
l
<
@@ -845,13 +869,13 @@
name =
nm -
\int_use:N \g__nm_env_int -
- \int_use:N \g__nm_row_int -
+ \int_use:N \c@iRow -
0 ,
alias =
\str_if_empty:NF \l__nm_name_str
{
\l__nm_name_str -
- \int_use:N \g__nm_row_int -
+ \int_use:N \c@iRow -
0
}
]
@@ -871,9 +895,9 @@
>
{
\bool_gset_true:N \g__nm_last_col_found_bool
- \int_gincr:N \g__nm_col_int
+ \int_gincr:N \c@jCol
\int_gset:Nn \g__nm_col_total_int
- { \int_max:nn \g__nm_col_total_int \g__nm_col_int }
+ { \int_max:nn \g__nm_col_total_int \c@jCol }
\hbox_set:Nw \l_tmpa_box
\c_math_toggle_token
\bool_if:NT \l__nm_small_bool \scriptstyle
@@ -913,14 +937,14 @@
name =
nm -
\int_use:N \g__nm_env_int -
- \int_use:N \g__nm_row_int -
- \int_use:N \g__nm_col_int ,
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol ,
alias =
\str_if_empty:NF \l__nm_name_str
{
\l__nm_name_str -
- \int_use:N \g__nm_row_int -
- \int_use:N \g__nm_col_int
+ \int_use:N \c@iRow -
+ \int_use:N \c@jCol
}
]
{ \box_use:N \l_tmpa_box } ;
@@ -1052,20 +1076,23 @@
}
\cs_new_protected:Nn \__nm_after_array:
{
- \int_compare:nNnTF \g__nm_row_int > \c_zero_int
+ \int_compare:nNnTF \c@iRow > \c_zero_int
\__nm_after_array_i:
- { \__nm_error:n { Zero~row } }
+ {
+ \__nm_error:n { Zero~row }
+ \__nm_restore_iRow_jCol:
+ }
}
\cs_new_protected:Nn \__nm_after_array_i:
{
\group_begin:
\cs_if_exist:NT \tikz@library@external@loaded
{ \tikzset { external / export = false } }
- \int_gset_eq:NN \g__nm_col_int \g__nm_col_total_int
- \bool_if:nT \g__nm_last_col_found_bool { \int_gdecr:N \g__nm_col_int }
- \int_gset_eq:NN \g__nm_row_total_int \g__nm_row_int
+ \int_gset_eq:NN \c@jCol \g__nm_col_total_int
+ \bool_if:nT \g__nm_last_col_found_bool { \int_gdecr:N \c@jCol }
+ \int_gset_eq:NN \g__nm_row_total_int \c@iRow
\int_compare:nNnT \l__nm_last_row_int > { -1 }
- { \int_gsub:Nn \g__nm_row_int \c_one_int }
+ { \int_gsub:Nn \c@iRow \c_one_int }
\bool_if:NT \l__nm_last_row_without_value_bool
{
\iow_now:Nn \@mainaux \ExplSyntaxOn
@@ -1114,17 +1141,23 @@
\tikzset
{
every~picture / .style =
- {
- overlay ,
- remember~picture ,
- name~prefix = nm - \int_use:N \g__nm_env_int -
- }
+ {
+ overlay ,
+ remember~picture ,
+ name~prefix = nm - \int_use:N \g__nm_env_int -
+ }
}
\cs_set_eq:NN \line \__nm_line:nn
\g__nm_code_after_tl
\tl_gclear:N \g__nm_code_after_tl
\group_end:
\str_gclear:N \g__nm_type_env_str
+ \__nm_restore_iRow_jCol:
+ }
+\cs_new_protected:Nn \__nm_restore_iRow_jCol:
+ {
+ \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c@iRow \l__nm_save_iRow_int }
+ \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c@jCol \l__nm_save_jCol_int }
}
\cs_new_protected:Nn \__nm_find_extremities_of_line:nnnn
{
@@ -1139,7 +1172,7 @@
\int_add:Nn \l__nm_final_i_int { #3 }
\int_add:Nn \l__nm_final_j_int { #4 }
\bool_set_false:N \l__nm_final_open_bool
- \int_compare:nNnTF \l__nm_final_i_int > \g__nm_row_int
+ \int_compare:nNnTF \l__nm_final_i_int > \c@iRow
{
\int_compare:nNnT { #3 } = 1
{ \bool_set_true:N \l__nm_final_open_bool }
@@ -1151,7 +1184,7 @@
{ \bool_set_true:N \l__nm_final_open_bool }
}
{
- \int_compare:nNnT \l__nm_final_j_int > \g__nm_col_int
+ \int_compare:nNnT \l__nm_final_j_int > \c@jCol
{
\int_compare:nNnT { #4 } = 1
{ \bool_set_true:N \l__nm_final_open_bool }
@@ -1211,7 +1244,7 @@
{ \bool_set_true:N \l__nm_initial_open_bool }
}
{
- \int_compare:nNnT \l__nm_initial_j_int > \g__nm_col_int
+ \int_compare:nNnT \l__nm_initial_j_int > \c@jCol
{
\int_compare:nNnT { #4 } = { -1 }
{ \bool_set_true:N \l__nm_initial_open_bool }
@@ -1279,6 +1312,39 @@
\end { tikzpicture }
}
\cs_generate_variant:Nn \__nm_retrieve_coords:nn { x x }
+\cs_new_protected:Nn \__nm_adjust_with_col_nodes:
+ {
+ \bool_if:NT \l__nm_initial_open_bool
+ {
+ \cs_if_exist:cT
+ { pgf@sh@ns@nm - \int_use:N \g__nm_env_int - col - 0 }
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node \pgfutil@firstofone
+ ( nm - \int_use:N \g__nm_env_int - col - 0 )
+ \dim_gset:Nn \g__nm_x_initial_dim \pgf@x
+ \end { tikzpicture }
+ }
+ }
+ \bool_if:NT \l__nm_final_open_bool
+ {
+ \cs_if_exist:cT
+ {
+ pgf@sh@ns@nm - \int_use:N \g__nm_env_int - col -
+ \int_use:N \c@jCol
+ }
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node \pgfutil@firstofone
+ (
+ nm - \int_use:N \g__nm_env_int - col -
+ \int_use:N \c@jCol
+ )
+ \dim_gset:Nn \g__nm_x_final_dim \pgf@x
+ \end { tikzpicture }
+ }
+ }
+ }
\cs_new_protected:Nn \__nm_draw_Ldots:nn
{
\cs_if_free:cT { __nm _ dotted _ #1 - #2 }
@@ -1321,6 +1387,7 @@
}
{ .base~west }
}
+ \__nm_adjust_with_col_nodes:
\bool_if:NT \l__nm_initial_open_bool
{ \dim_gset_eq:NN \g__nm_y_initial_dim \g__nm_y_final_dim }
\bool_if:NT \l__nm_final_open_bool
@@ -1368,6 +1435,7 @@
}
{ .mid~west }
}
+ \__nm_adjust_with_col_nodes:
\bool_if:NT \l__nm_initial_open_bool
{ \dim_gset_eq:NN \g__nm_y_initial_dim \g__nm_y_final_dim }
\bool_if:NT \l__nm_final_open_bool
@@ -1584,7 +1652,7 @@
\l_tmpb_int
}
\begin { tikzpicture } [ overlay ]
- \int_step_inline:nnnn 0 1 \l_tmpa_int
+ \int_step_inline:nnn 0 \l_tmpa_int
{
\pgfpathcircle
{ \pgfpoint { \g__nm_x_initial_dim } { \g__nm_y_initial_dim } }
@@ -1604,7 +1672,7 @@
\cs_new_protected:Nn \__nm_add_to_empty_cells:
{
\cs_gset:cpx
- { __nm _ empty _ \int_use:N \g__nm_row_int - \int_use:N \g__nm_col_int }
+ { __nm _ empty _ \int_use:N \c@iRow - \int_use:N \c@jCol }
{ \int_use:N \g__nm_env_int }
}
\NewDocumentCommand \__nm_Ldots { s }
@@ -1649,10 +1717,10 @@
\int_compare:nNnT #1 > 1
{
\seq_gput_left:Nx \g__nm_multicolumn_cells_seq
- { \int_eval:n \g__nm_row_int - \int_use:N \g__nm_col_int }
+ { \int_eval:n \c@iRow - \int_use:N \c@jCol }
\seq_gput_left:Nn \g__nm_multicolumn_sizes_seq { #1 }
}
- \int_gadd:Nn \g__nm_col_int { #1 - 1 }
+ \int_gadd:Nn \c@jCol { #1 - 1 }
}
\cs_new:Npn \__nm_Hdotsfor:
{
@@ -1670,8 +1738,8 @@
\tl_gput_right:Nx \g__nm_Hdotsfor_lines_tl
{
\__nm_draw_Hdotsfor:nnn
- { \int_use:N \g__nm_row_int }
- { \int_use:N \g__nm_col_int }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
{ #2 }
}
\prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
@@ -1697,7 +1765,7 @@
\bool_set_true:N \l__nm_initial_open_bool
}
}
- \int_compare:nNnTF { #2 + #3 -1 } = \g__nm_col_int
+ \int_compare:nNnTF { #2 + #3 -1 } = \c@jCol
{
\int_set:Nn \l__nm_final_j_int { #2 + #3 - 1 }
\bool_set_true:N \l__nm_final_open_bool
@@ -1719,31 +1787,37 @@
}
\cs_new_protected:Nn \__nm_line:nn
{
- \dim_zero_new:N \g__nm_x_initial_dim
- \dim_zero_new:N \g__nm_y_initial_dim
- \dim_zero_new:N \g__nm_x_final_dim
- \dim_zero_new:N \g__nm_y_final_dim
- \bool_set_false:N \l__nm_initial_open_bool
- \bool_set_false:N \l__nm_final_open_bool
- \bool_if:nTF
+ \bool_if:NF \c__nm_draft_bool
{
- \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g__nm_env_int - #1 }
- &&
- \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g__nm_env_int - #2 }
- }
- {
- \begin { tikzpicture }
- \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
- \tikz@parse@node \pgfutil@firstofone ( i )
- \dim_gset:Nn \g__nm_x_initial_dim \pgf@x
- \dim_gset:Nn \g__nm_y_initial_dim \pgf@y
- \tikz@parse@node \pgfutil@firstofone ( f )
- \dim_gset:Nn \g__nm_x_final_dim \pgf@x
- \dim_gset:Nn \g__nm_y_final_dim \pgf@y
- \end { tikzpicture }
- \__nm_draw_tikz_line:
+ \dim_zero_new:N \g__nm_x_initial_dim
+ \dim_zero_new:N \g__nm_y_initial_dim
+ \dim_zero_new:N \g__nm_x_final_dim
+ \dim_zero_new:N \g__nm_y_final_dim
+ \bool_set_false:N \l__nm_initial_open_bool
+ \bool_set_false:N \l__nm_final_open_bool
+ \bool_if:nTF
+ {
+ \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g__nm_env_int - #1 }
+ &&
+ \cs_if_exist_p:c { pgf@sh@ns@nm - \int_use:N \g__nm_env_int - #2 }
+ }
+ {
+ \begin { tikzpicture }
+ \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
+ \tikz@parse@node \pgfutil@firstofone ( i )
+ \dim_gset:Nn \g__nm_x_initial_dim \pgf@x
+ \dim_gset:Nn \g__nm_y_initial_dim \pgf@y
+ \tikz@parse@node \pgfutil@firstofone ( f )
+ \dim_gset:Nn \g__nm_x_final_dim \pgf@x
+ \dim_gset:Nn \g__nm_y_final_dim \pgf@y
+ \end { tikzpicture }
+ \__nm_draw_tikz_line:
+ }
+ {
+ \__nm_error:nnn { unknown~cell~for~line~in~code-after }
+ { #1 } { #2 }
+ }
}
- { \__nm_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 } }
}
\bool_if:NTF \c__nm_draft_bool
{ \cs_set_eq:NN \__nm_dotfill: \prg_do_nothing: }
@@ -1797,7 +1871,6 @@
\int_compare:nNnTF #1 = \c_zero_int
{ \__nm_error:n { Use~of~:~in~first~position } }
{
- \__nm_create_extra_nodes:
\bool_if:NF \c__nm_draft_bool
{
\dim_zero_new:N \g__nm_x_initial_dim
@@ -1806,39 +1879,52 @@
\dim_zero_new:N \g__nm_y_final_dim
\bool_set_true:N \l__nm_initial_open_bool
\bool_set_true:N \l__nm_final_open_bool
- \begin { tikzpicture } [ remember~picture ]
- \tikz@parse@node\pgfutil@firstofone
- ( 1 - #1 - large .north~east )
- \dim_gset:Nn \g__nm_x_initial_dim \pgf@x
- \dim_gset:Nn \g__nm_y_initial_dim \pgf@y
- \tikz@parse@node\pgfutil@firstofone
- ( \int_use:N \g__nm_row_int - #1 - large .south~east )
- \dim_gset:Nn \g__nm_x_final_dim \pgf@x
- \dim_gset:Nn \g__nm_y_final_dim \pgf@y
- \end { tikzpicture }
- \cs_if_exist:cT
- { pgf@sh@ns@nm -\int_use:N \g__nm_env_int - 1 - #1 - w }
+ \cs_if_exist:cTF
+ { pgf@sh@ns@nm -\int_use:N \g__nm_env_int - col - #1 }
{
\begin { tikzpicture } [ remember~picture ]
\tikz@parse@node\pgfutil@firstofone
- ( 1 - #1 - w .north~east )
+ ( col - #1 )
\dim_gset:Nn \g__nm_x_initial_dim \pgf@x
- \tikz@parse@node\pgfutil@firstofone
- ( \int_use:N \g__nm_row_int - #1 - w .south~east )
\dim_gset:Nn \g__nm_x_final_dim \pgf@x
+ \dim_gset:Nn \g__nm_y_final_dim \pgf@y
\end { tikzpicture }
- \dim_gadd:Nn \g__nm_x_initial_dim \arraycolsep
- \dim_gadd:Nn \g__nm_x_final_dim \arraycolsep
+ \dim_gset:Nn \g__nm_y_initial_dim { - \c_max_dim }
+ \int_step_inline:nn \c@jCol
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node\pgfutil@firstofone
+ ( 1 - ##1 . north~east )
+ \dim_gset:Nn \g__nm_y_initial_dim
+ { \dim_max:nn \g__nm_y_initial_dim \pgf@y }
+ \end { tikzpicture }
+ }
}
- \cs_if_exist:cT
- { pgf@sh@ns@nm -\int_use:N \g__nm_env_int - col - #1 }
{
\begin { tikzpicture } [ remember~picture ]
\tikz@parse@node\pgfutil@firstofone
- ( col - #1 )
+ ( 1 - #1 - large .north~east )
\dim_gset:Nn \g__nm_x_initial_dim \pgf@x
+ \dim_gset:Nn \g__nm_y_initial_dim \pgf@y
+ \tikz@parse@node\pgfutil@firstofone
+ ( \int_use:N \c@iRow - #1 - large .south~east )
\dim_gset:Nn \g__nm_x_final_dim \pgf@x
+ \dim_gset:Nn \g__nm_y_final_dim \pgf@y
\end { tikzpicture }
+ \cs_if_exist:cT
+ { pgf@sh@ns@nm -\int_use:N \g__nm_env_int - 1 - #1 - w }
+ {
+ \begin { tikzpicture } [ remember~picture ]
+ \tikz@parse@node\pgfutil@firstofone
+ ( 1 - #1 - w .north~east )
+ \dim_gset:Nn \g__nm_x_initial_dim \pgf@x
+ \tikz@parse@node\pgfutil@firstofone
+ ( \int_use:N \c@iRow - #1 - w .south~east )
+ \dim_gset:Nn \g__nm_x_final_dim \pgf@x
+ \end { tikzpicture }
+ \dim_gadd:Nn \g__nm_x_initial_dim \arraycolsep
+ \dim_gadd:Nn \g__nm_x_final_dim \arraycolsep
+ }
}
\__nm_draw_tikz_line:
}
@@ -1848,45 +1934,45 @@
{
\int_compare:nNnTF \l__nm_first_col_int = \c_zero_int
{
- \int_compare:nNnTF \g__nm_col_int = \c_zero_int
+ \int_compare:nNnTF \c@jCol = \c_zero_int
{
\int_compare:nNnTF \l__nm_first_row_int = \c_zero_int
{
- \int_compare:nNnF \g__nm_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g__nm_row_int = \l__nm_last_row_int
+ \int_compare:nNnF \c@iRow = \l__nm_last_row_int
\__nm_vline_i:
}
}
{
- \int_compare:nNnF \g__nm_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g__nm_row_int = \l__nm_last_row_int
+ \int_compare:nNnF \c@iRow = \l__nm_last_row_int
\__nm_vline_i:
}
}
}
{
- \int_compare:nNnF \g__nm_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g__nm_row_int = \l__nm_last_row_int
+ \int_compare:nNnF \c@iRow = \l__nm_last_row_int
\__nm_vline_i:
}
}
}
{
- \int_compare:nNnTF \g__nm_col_int = \c_zero_int
+ \int_compare:nNnTF \c@jCol = \c_zero_int
{
- \int_compare:nNnF \g__nm_row_int = { -1 }
+ \int_compare:nNnF \c@iRow = { -1 }
{
- \int_compare:nNnF \g__nm_row_int = { \l__nm_last_row_int - 1 }
+ \int_compare:nNnF \c@iRow = { \l__nm_last_row_int - 1 }
\__nm_vline_i:
}
}
{
- \int_compare:nNnF \g__nm_row_int = \c_zero_int
+ \int_compare:nNnF \c@iRow = \c_zero_int
{
- \int_compare:nNnF \g__nm_row_int = \l__nm_last_row_int
+ \int_compare:nNnF \c@iRow = \l__nm_last_row_int
\__nm_vline_i:
}
}
@@ -1982,7 +2068,7 @@
\__nm_create_nodes:
\int_set:Nn \l__nm_first_row_int 1
\int_set:Nn \l__nm_first_col_int 1
- \int_step_variable:nNn { \g__nm_row_int - 1 } \__nm_i:
+ \int_step_variable:nNn { \c@iRow - 1 } \__nm_i:
{
\dim_set:cn { l__nm_row _ \__nm_i: _ min _ dim }
{
@@ -1995,7 +2081,7 @@
\dim_set_eq:cc { l__nm_row _ \int_eval:n { \__nm_i: + 1 } _ max _ dim }
{ l__nm_row_\__nm_i: _min_dim }
}
- \int_step_variable:nNn { \g__nm_col_int - 1 } \__nm_j:
+ \int_step_variable:nNn { \c@jCol - 1 } \__nm_j:
{
\dim_set:cn { l__nm_column _ \__nm_j: _ max _ dim }
{
@@ -2014,7 +2100,7 @@
{ l__nm_column _ 1 _ min _ dim }
\l__nm_left_margin_dim
\dim_add:cn
- { l__nm_column _ \int_use:N \g__nm_col_int _ max _ dim }
+ { l__nm_column _ \int_use:N \c@jCol _ max _ dim }
\l__nm_right_margin_dim
\tikzset { name~suffix = -large }
\__nm_create_nodes:
@@ -2026,7 +2112,7 @@
\dim_gset:Nn \g_tmpa_dim \pgf@x
\tikz@parse@node \pgfutil@firstofone
( nm - \int_use:N \g__nm_env_int - 1 -
- \int_use:N \g__nm_col_int - large .north~east )
+ \int_use:N \c@jCol - large .north~east )
\dim_gset:Nn \g_tmpb_dim \pgf@x
\end { tikzpicture }
\iow_now:Nn \@mainaux \ExplSyntaxOn
@@ -2092,7 +2178,8 @@
inner~sep = \c_zero_dim ,
name = nm - \int_use:N \g__nm_env_int - \__nm_i: - \__nm_j: ,
alias =
- \str_if_empty:NF \l__nm_name_str { \l__nm_name_str - \__nm_i: - \__nm_j: }
+ \str_if_empty:NF \l__nm_name_str
+ { \l__nm_name_str - \__nm_i: - \__nm_j: }
]
;
}
@@ -2119,10 +2206,10 @@
\tl_gput_left:Nx \g__nm_code_after_tl
{
\__nm_Block_iv:nnnnn
- { \int_use:N \g__nm_row_int }
- { \int_use:N \g__nm_col_int }
- { \int_eval:n { \g__nm_row_int + #1 - 1 } }
- { \int_eval:n { \g__nm_col_int + #2 - 1 } }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
+ { \int_eval:n { \c@iRow + #1 - 1 } }
+ { \int_eval:n { \c@jCol + #2 - 1 } }
\exp_not:n { { #3 $ #4 $ } }
}
}
@@ -2141,8 +2228,8 @@
{
\bool_if:nTF
{
- \int_compare_p:nNn { #3 } > \g__nm_row_int
- || \int_compare_p:nNn { #4 } > \g__nm_col_int
+ \int_compare_p:nNn { #3 } > \c@iRow
+ || \int_compare_p:nNn { #4 } > \c@jCol
}
{ \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
{
@@ -2221,13 +2308,11 @@
\__nm_msg_new:nn { Wrong~last~row }
{
You~have~used~'last-row=\int_use:N \l__nm_last_row_int'~but~your~environment~
- \{\g__nm_type_env_str\}~seems~to~have~\int_use:N \g__nm_row_int\
- rows.~If~you~go~on,~the~value~of~\int_use:N \g__nm_row_int\
+ \{\g__nm_type_env_str\}~seems~to~have~\int_use:N \c@iRow
+ rows.~If~you~go~on,~the~value~of~\int_use:N \c@iRow
will~be~used~for~last~row.~You~can~avoid~this~problem~by~using~'last-row'~
without~value~(more~compilations~might~be~necessary).
}
-\__nm_msg_new:nn { Draft~mode }
- { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. }
\__nm_msg_new:nn { Yet~in~env }
{
Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~nested.\\
@@ -2351,7 +2436,7 @@
the~same~environment~name~twice.~You~can~go~on,~but,~
maybe,~you~will~have~incorrect~results~especially~
if~you~use~'columns-width=auto'.~If~you~use~nicematrix~inside~some~
- environments~of~amsmath,~this~error~may~be~an~artefact.~In~this~case,
+ environments~of~amsmath,~this~error~may~be~an~artefact.~In~this~case,~
use~the~option~'allow-duplicate-names'.\\
For~a~list~of~the~names~already~used,~type~H~<return>. \\
}
@@ -2377,38 +2462,55 @@
first~position~of~the~preamble~of~the~environment~\{\g__nm_type_env_str\}. \\
If~you~go~on,~this~dotted~line~will~be~ignored.
}
+\__nm_msg_new:nn { Obsolete~environment }
+ {
+ The~environment~\{\@currenvir\}~is~obsolete.~
+ We~should~use~#1~instead.
+ }
\NewDocumentEnvironment { pNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\pNiceArray
}
{ \endpNiceArray }
\NewDocumentEnvironment { bNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\bNiceArray
}
{ \endbNiceArray }
\NewDocumentEnvironment { BNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\BNiceArray
}
{ \endBNiceArray }
\NewDocumentEnvironment { vNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\vNiceArray
}
{ \endvNiceArray }
\NewDocumentEnvironment { VNiceArrayC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\VNiceArray
}
{ \endVNiceArray }
\NewDocumentEnvironment { pNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\int_set:Nn \l__nm_first_row_int \c_zero_int
\pNiceArray
@@ -2416,6 +2518,8 @@
{ \endpNiceArray }
\NewDocumentEnvironment { bNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\int_set:Nn \l__nm_first_row_int \c_zero_int
\bNiceArray
@@ -2423,6 +2527,8 @@
{ \endbNiceArray }
\NewDocumentEnvironment { BNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\int_set:Nn \l__nm_first_row_int \c_zero_int
\BNiceArray
@@ -2430,6 +2536,8 @@
{ \endBNiceArray }
\NewDocumentEnvironment { vNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\bool_set_true:N \l__nm_last_col_bool
\int_set:Nn \l__nm_first_row_int \c_zero_int
\vNiceArray
@@ -2437,6 +2545,8 @@
{ \endvNiceArray }
\NewDocumentEnvironment { VNiceArrayRC } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\int_set:Nn \l__nm_first_row_int \c_zero_int
\VNiceArray
@@ -2444,12 +2554,16 @@
{ \endVNiceArray }
\NewDocumentEnvironment { NiceArrayCwithDelims } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~option~'last-col' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\NiceArrayWithDelims
}
{ \endNiceArrayWithDelims }
\NewDocumentEnvironment { NiceArrayRCwithDelims } { }
{
+ \msg_info:nnn { nicematrix } { Obsolete~environment }
+ { the~options~'last-col'~and~'first-row' }
\int_set:Nn \l__nm_last_col_int \c_zero_dim
\int_set:Nn \l__nm_first_row_int \c_zero_int
\NiceArrayWithDelims