summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-01-23 17:53:50 +0000
committerKarl Berry <karl@freefriends.org>2020-01-23 17:53:50 +0000
commit1611b583581d3f0327a05cd9c5633bcf4a9df9ed (patch)
tree687231459b386ee4b6ad90eb4575c52e1f4326ed /Master/texmf-dist
parent300a47794120fb8337724ab100edb9ce9f793088 (diff)
nicematrix (22jan20)
git-svn-id: svn://tug.org/texlive/trunk@53502 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdfbin317090 -> 311089 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex140
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdfbin699309 -> 690785 bytes
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx694
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty268
5 files changed, 682 insertions, 420 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf
index ccc4611524c..45b40e96bad 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 1035a9bab4a..c4324295c3e 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex
@@ -16,6 +16,8 @@
\usepackage{siunitx}
+\usepackage{unicode-math}
+
\newbox\ExampleOne
\setbox\ExampleOne\hbox{%
@@ -97,7 +99,7 @@ tableau.
Cette extension peut être utilisée avec |xelatex|, |lualatex| et |pdflatex| mais aussi avec le cheminement
classique |latex|-|dvips|-|ps2pdf| (ou Adobe Distiller). Deux ou trois compilations successives peuvent être
nécessaires. Cette extension nécessite et charge les extensions \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse},
-\pkg{array}, \pkg{amsmath} et \pkg{tikz} . Elle charge aussi la bibliothèque Tikz \pkg{fit}. L'utilisateur final
+\pkg{array}, \pkg{amsmath} et \pkg{tikz}. Elle charge aussi la bibliothèque Tikz \pkg{fit}. L'utilisateur final
n'a qu'à charger l'extension \pkg{nicematrix} avec l'instruction habituelle : |\usepackage{nicematrix}|.
@@ -556,6 +558,12 @@ $\begin{pmatrix}
\end{scope}
+\subsection{Réglage fin des lignes en pointillés}
+
+L'écart entre un nœud et l'extrémité d'une ligne en pointillés est fixée par |dotted-lines-margin|. La valeur
+initiale de cette clé est de $0.3$~em (il est conseillé d'utiliser une unité de mesure dépendante de la fonte
+courante). Pour un exemple, voir p.~\pageref{permutation}.
+
\section{Les nœuds Tikz créés par l'extension nicematrix}
@@ -1269,8 +1277,9 @@ Pour des raisons techniques, il n'est pas possible d'écrire |\Block{|$i$|-|$j$|
(mais on peut écrire |\Block{|$i$|-|$j$|}<>{<}| avec le résultat attendu).
+\section{Fonctionnalités avancées}
-\section{L'option small}
+\subsection{L'option small}
Avec l'option |small|, les environnements de l'extension \pkg{nicematrix} sont composés d'une manière proche de ce
que propose l'environnement |{smallmatrix}| de l'\pkg{amsmath} (et les environnements |{psmallmatrix}|,
@@ -1311,7 +1320,7 @@ 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}
+\subsection{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 le numéro de la «première
@@ -1366,11 +1375,11 @@ $C = ~emphase#\pAutoNiceMatrix@{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$
$C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$
-\section{L'option hlines}
+\subsection{L'option hlines}
Dans les environnements de \pkg{nicematrix}, on peut bien entendu ajouter des filets horizontaux entre les lignes
avec la commande~|\hline|. Par souci de commodité, l'extension \pkg{nicematrix} fournit l'option |hlines| qui impose
-directement que tous les filets horizontaux soient tracés (à l'exception, très naturelle, du filet avant
+directement que tous les filets horizontaux soient tracés (à l'exception, très naturelle, du filet avanet
l'éventuelle «première rangée» et après l'éventuelle «dernière rangée»).
\medskip
@@ -1385,8 +1394,42 @@ c & c & b & a & e
\end{BVerbatim}
\raisebox{-5mm}{\box\ExampleOne}
+\subsection{L'option light-syntax}
+
+L'option |light-syntax|\footnote{Cette option est inspirée de
+l'extension \pkg{spalign} de Joseph Rabinoff.} permet d'alléger la saisie des matrices, ainsi que leur lisibilité dans le source TeX.
+Lorsque cette option est activée, on doit utiliser le point-virgule comme marqueur de fin de rangée et séparer les
+colonnes par des espaces. On remarquera toutefois que, comme souvent dans le monde TeX, les espaces après les
+séquences de contrôles ne sont pas comptées et que les éléments entre accolades sont considérés comme un tout.
+
+\bigskip
+L'exemple suivant a été composé avec XeLaTeX en utilisant \pkg{unicode-math}, ce qui permet d'utiliser directement
+les lettres grecques en Unicode.
+
+\medskip
+\begin{scope}
+\def\alpha{$α$}
+\def\beta{$β$}
+\begin{BVerbatim}[baseline=c,boxwidth=10cm]
+$\begin{bNiceMatrix}[~emphase#light-syntax@,first-row,first-col]
+{} ~alpha ~beta ;
+~alpha 2\cos ~alpha {\cos ~alpha + \cos ~beta} ;
+~beta \cos ~alpha+\cos ~beta { 2 \cos ~beta }
+\end{bNiceMatrix}$
+\end{BVerbatim}
+\end{scope}
+%
+$\begin{bNiceMatrix}[light-syntax,first-row,first-col]
+{} α β ;
+α 2\cos α {\cos α + \cos β} ;
+β \cos α+\cos β { 2 \cos β }
+\end{bNiceMatrix}$
+
+\medskip
+On peut changer le caractère utilisé pour indiquer les fins de rangées avec l'option |end-of-row|. Comme dit
+précédemment, la valeur initiale de ce paramètre est un point-virgule.
-\section{Utilisation du type de colonne S de siunitx}
+\subsection{Utilisation du type de colonne S de siunitx}
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
@@ -1413,6 +1456,8 @@ $\begin{pNiceArray}{SCWc{1cm}C}[nullify-dots,first-row]
\medskip
En revanche, les colonnes |d| de l'extension \pkg{dcolumn} ne sont pas prises en charge par \pkg{nicematrix}.
+
+
\section{Remarques techniques}
\subsection{Pour définir de nouveaux types de colonnes}
@@ -1764,11 +1809,15 @@ b & a & b & \Ddots & & \Vdots \\
\vspace{2cm}
-Une matrice de permutation :
+Une matrice de permutation.
+
+À titre d'exemple, on a augmenté la valeur du paramètre |dotted-lines-margin|.
+
+\label{permutation}
\bigskip
\begin{BVerbatim}[baseline=c]
-$\begin{pNiceMatrix}
+$\begin{pNiceMatrix}[~emphase#dotted-lines-margin=6em@]
0 & 1 & 0 & & \Cdots & 0 \\
\Vdots & & & \Ddots & & \Vdots \\
& & & \Ddots & & \\
@@ -1778,7 +1827,7 @@ $\begin{pNiceMatrix}
\end{pNiceMatrix}$
\end{BVerbatim}
\hspace{2.5cm}
-$\begin{pNiceMatrix}
+$\begin{pNiceMatrix}[dotted-lines-margin=0.6em]
0 & 1 & 0 & & \Cdots & 0 \\
\Vdots & & & \Ddots & & \Vdots \\
& & & \Ddots & & \\
@@ -2052,15 +2101,15 @@ réglage de \pkg{colortbl} sont néanmoins assez limitées. C'est pourquoi nous
surligner une rangée de la matrice. Nous créons un nœud Tikz rectangulaire qui englobe les nœuds de la deuxième
rangée en utilisant les outils de la bibliothèque Tikz \pkg{fit}. Ce nœud est rempli après la construction de la
matrice. Pour que l'on puisse voir le texte \emph{sous} le nœud, nous devons utiliser la transparence avec le
-|blend mode| égal à |multiply|. Attention : certains lecteurs de \textsc{pdf} ne sont pas capables de rendre la
-transparence correctement.
+|blend mode| égal à |multiply|.
\tikzset{highlight/.style={rectangle,
fill=red!15,
blend mode = multiply,
rounded corners = 0.5 mm,
- inner sep=1pt}}
+ inner sep=1pt,
+ fit=#1}}
\medskip
\begin{Verbatim}
@@ -2068,16 +2117,17 @@ transparence correctement.
fill=red!15,
~emphase#blend mode = multiply@,
rounded corners = 0.5 mm,
- inner sep=1pt}}
+ inner sep=1pt,
+ fit=~#1}}
-$\begin{bNiceMatrix}[~emphase#code-after = {\tikz \node[highlight, fit = (2-1) (2-3)] {} ;}@]
+$\begin{bNiceMatrix}[~emphase#code-after = {\tikz \node [highlight = (2-1) (2-3)] {} ;}@]
0 & \Cdots & 0 \\
1 & \Cdots & 1 \\
0 & \Cdots & 0
\end{bNiceMatrix}$
\end{Verbatim}
-\[\begin{bNiceMatrix}[code-after = {\tikz \node[highlight, fit = (2-1) (2-3)] {} ;}]
+\[\begin{bNiceMatrix}[code-after = {\tikz \node [highlight = (2-1) (2-3)] {} ;}]
0 & \Cdots & 0 \\
1 & \Cdots & 1 \\
0 & \Cdots & 0
@@ -2131,25 +2181,27 @@ Si on veut surligner chaque rangée de la matrice, on peut utiliser la technique
\tikzset{mes-options/.style={remember picture,
overlay,
name prefix = exemple-,
- every node/.style = {fill = red!15,
- blend mode = multiply,
- inner sep = 0pt}}}
+ highlight/.style = {fill = red!15,
+ blend mode = multiply,
+ inner sep = 0pt,
+ fit = ~#1}}}
\end{Verbatim}
\tikzset{mes-options/.style={remember picture,
overlay,
name prefix = exemple-,
- every node/.style = {fill = red!15,
- blend mode = multiply,
- inner sep = 0pt}}}
+ highlight/.style = {fill = red!15,
+ blend mode = multiply,
+ inner sep = 0pt,
+ fit = #1}}}
\begin{Verbatim}
\begin{tikzpicture}[mes-options]
-\node [fit = (1-1) (1-3)] {} ;
-\node [fit = (2-1) (2-3)] {} ;
-\node [fit = (3-1) (3-3)] {} ;
+\node [highlight = (1-1) (1-3)] {} ;
+\node [highlight = (2-1) (2-3)] {} ;
+\node [highlight = (3-1) (3-3)] {} ;
\end{tikzpicture}
\end{Verbatim}
@@ -2158,12 +2210,13 @@ On obtient la matrice suivante.
\[\begin{pNiceArray}{CCC}[
last-col,
- code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15,
- blend mode = multiply,
- inner sep = 0pt}]
- \node [fit = (1-1) (1-3)] {} ;
- \node [fit = (2-1) (2-3)] {} ;
- \node [fit = (3-1) (3-3)] {} ;
+ code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15,
+ blend mode = multiply,
+ inner sep = 0pt,
+ fit = #1}]
+ \node [highlight = (1-1) (1-3)] {} ;
+ \node [highlight = (2-1) (2-3)] {} ;
+ \node [highlight = (3-1) (3-3)] {} ;
\end{tikzpicture}}]
a & a + b & a + b + c & L_1 \\
a & a & a + b & L_2 \\
@@ -2175,9 +2228,9 @@ Le résultat peut paraître décevant. On peut l'améliorer en utilisant les «n
\begin{Verbatim}
\begin{tikzpicture}[mes-options, ~emphase#name suffix = -medium@]
-\node [fit = (1-1) (1-3)] {} ;
-\node [fit = (2-1) (2-3)] {} ;
-\node [fit = (3-1) (3-3)] {} ;
+\node [highlight = (1-1) (1-3)] {} ;
+\node [highlight = (2-1) (2-3)] {} ;
+\node [highlight = (3-1) (3-3)] {} ;
\end{tikzpicture}
\end{Verbatim}
@@ -2187,13 +2240,14 @@ On obtient la matrice suivante.
\[\begin{pNiceArray}{CCC}[
last-col,
create-medium-nodes,
- code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15,
- blend mode = multiply,
- inner sep = 0pt},
+ code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15,
+ blend mode = multiply,
+ inner sep = 0pt,
+ fit = #1},
name suffix = -medium]
- \node [fit = (1-1) (1-3)] {} ;
- \node [fit = (2-1) (2-3)] {} ;
- \node [fit = (3-1) (3-3)] {} ;
+ \node [highlight = (1-1) (1-3)] {} ;
+ \node [highlight = (2-1) (2-3)] {} ;
+ \node [highlight = (3-1) (3-3)] {} ;
\end{tikzpicture}}]
a & a + b & a + b + c & L_1 \\
a & a & a + b & L_2 \\
@@ -2302,8 +2356,8 @@ Dans la matrice produit, on remarquera que les lignes en pointillés sont «semi
\begin{Verbatim}
\begin{tikzpicture}[remember picture, overlay]
- \node [highlight, fit = (A-3-1) (A-3-5) ] {} ;
- \node [highlight, fit = (B-1-3) (B-5-3) ] {} ;
+ \node [highlight = (A-3-1) (A-3-5) ] {} ;
+ \node [highlight = (B-1-3) (B-5-3) ] {} ;
\draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
\end{tikzpicture}
\end{Verbatim}
@@ -2341,8 +2395,8 @@ L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
\end{NiceMatrixBlock}
\begin{tikzpicture}[remember picture, overlay]
- \node [highlight, fit = (A-3-1) (A-3-5) ] {} ;
- \node [highlight, fit = (B-1-3) (B-5-3) ] {} ;
+ \node [highlight = (A-3-1) (A-3-5) ] {} ;
+ \node [highlight = (B-1-3) (B-5-3) ] {} ;
\draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
\end{tikzpicture}
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
index 01f2e3261be..c4738a01119 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 9ccfc120b5d..bbbc805d70e 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.9}
-\def\myfiledate{2020/01/10}
+\def\myfileversion{3.10}
+\def\myfiledate{2020/01/22}
%
%
%<*batchfile>
@@ -77,6 +77,7 @@ c & c & b & a & e
\usepackage{arydshln}
\setlength{\columnseprule}{0.4pt}
\usepackage{footnotehyper}
+\usepackage{unicode-math}
\parindent 0pt
\EnableCrossrefs
@@ -540,7 +541,7 @@ c & c & b & a & e
% option is an alias for the conjonction of two options:
% |renew-dots| and |renew-matrix|.\footnote{The options |renew-dots|,
% |renew-matrix| and |transparent| can be fixed with the command
-% |\NiceMatrixOptiosn| like the other options. However, they can also be fixed
+% |\NiceMatrixOptions| like the other options. However, they can also be fixed
% as options of the command |\usepackage| (it's an exception for these three
% specific options.)}
%
@@ -585,7 +586,12 @@ c & c & b & a & e
% \end{pmatrix}$
% \end{scope}
%
-%
+% \subsection{Fine tuning of the dotted lines}
+%
+% The distance between a node and the end of a dotted line is set by
+% |dotted-lines-margin|. The initial value of this key is $0.3$~em (it's
+% recommended to use a unit dependant of the current font). For an example,
+% cf.~p.~\pageref{permutation}.
%
%
% \section{The Tikz nodes created by nicematrix}
@@ -1326,8 +1332,9 @@ c & c & b & a & e
% write |\Block{|$i$|-|$j$|}<>{<}| with the expected result.
%
%
+% \section{Advanced features}
%
-% \section{The option small}
+% \subsection{The option small}
%
% With the option |small|, the environments of the extension \pkg{nicematrix}
% are composed in a way similar to the environment |{smallmatrix}| of the
@@ -1372,7 +1379,7 @@ c & c & b & a & e
% \item the characteristics of the dotted lines are also modified.
% \end{itemize}
%
-% \section{The counters iRow and jCol}
+% \subsection{The counters iRow and jCol}
%
% In the cells of the array, it's possible to use the LaTeX counters |iRow| and
% |jCol| which represent the number of the current row and the number of the
@@ -1429,7 +1436,7 @@ c & c & b & a & e
%
% $C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$
%
-% \section{The option hlines}
+% \subsection{The option hlines}
%
% You can add horizontal rules between rows in the environments of
% \pkg{nicematrix} with the usual command |\hline|. But, by convenience, the
@@ -1450,7 +1457,44 @@ c & c & b & a & e
% \end{BVerbatim}
% \raise-5mm\box\ExampleOne
%
-% \section{Utilisation of the column type S of siunitx}
+% \subsection{The option light-syntax}
+%
+% The option |light-syntax|\footnote{This option is inspired by the extension
+% \pkg{spalign} of Joseph Rabinoff.} allow the user to compose the arrays with a
+% lighter syntax, which gives a more readable TeX source.
+%
+% When this option is used, one should use the semicolon for the end of a row
+% and a space to separate the columns. However, as usual in the TeX world, the
+% spaces after a control sequence are discarded and the elements between curly
+% braces are considered as a whole.
+%
+% \bigskip
+% The following example has been composed with XeLaTeX with \pkg{unicode-math},
+% which allows the use of greek letters directly in the TeX source.
+%
+% \medskip
+% \begin{scope}
+% \def\alpha{$α$}
+% \def\beta{$β$}
+% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
+% $\begin{bNiceMatrix}[~emphase#light-syntax@,first-row,first-col]
+% {} ~alpha ~beta ;
+% ~alpha 2\cos ~alpha {\cos ~alpha + \cos ~beta} ;
+% ~beta \cos ~alpha+\cos ~beta { 2 \cos ~beta }
+% \end{bNiceMatrix}$
+% \end{BVerbatim}
+% \end{scope}
+% $\begin{bNiceMatrix}[light-syntax,first-row,first-col]
+% {} α β ;
+% α 2\cos α {\cos α + \cos β} ;
+% β \cos α+\cos β { 2 \cos β }
+% \end{bNiceMatrix}$
+%
+% \medskip
+% It's possible to change the character used to mark the end of rows with the
+% option |end-of-row|. As said before, the initial value is a semicolon.
+%
+% \subsection{Utilisation of the column type S of siunitx}
%
% 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
@@ -1480,6 +1524,8 @@ c & c & b & a & e
% On the other hand, the |d| columns of the package \pkg{dcolumn} are not
% supported by \pkg{nicematrix}.
%
+%
+%
% \section{Technical remarks}
%
% \subsection{Definition of new column types}
@@ -1571,7 +1617,7 @@ c & c & b & a & e
%
% The environments created by \pkg{nicematrix} are numbered by an internal
% global counter. The command |\NiceMatrixLastEnv| provides the number of the
-% last environment of \pkg{nicematrix} (for LaTeX, it's a —fully expandable—
+% last environment of \pkg{nicematrix} (for LaTeX, it's a ``fully expandable''
% command and not a counter).
%
% For the environment of number~$n$, the node in row~$i$ and column~$j$ has the
@@ -1850,11 +1896,13 @@ c & c & b & a & e
%
% \vspace{2cm}
%
-% A permutation matrix:
+% A permutation matrix (as an example, we have raised the value of
+% |dotted-lines-margin|).
%
+% \label{permutation}
% \bigskip
% \begin{BVerbatim}[baseline=c]
-% $\begin{pNiceMatrix}
+% $\begin{pNiceMatrix}[~emphase#dotted-lines-margin=0.6em@]
% 0 & 1 & 0 & & \Cdots & 0 \\
% \Vdots & & & \Ddots & & \Vdots \\
% & & & \Ddots & & \\
@@ -1864,7 +1912,7 @@ c & c & b & a & e
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \hspace{2.5cm}
-% $\begin{pNiceMatrix}
+% $\begin{pNiceMatrix}[dotted-lines-margin=0.6em]
% 0 & 1 & 0 & & \Cdots & 0 \\
% \Vdots & & & \Ddots & & \Vdots \\
% & & & \Ddots & & \\
@@ -2147,14 +2195,14 @@ c & c & b & a & e
% nodes of the second row with the Tikz library \pkg{fit}. This Tikz node is
% filled after the construction of the matrix. In order to see the text
% \emph{under} this node, we have to use transparency with the |blend mode|
-% equal to |multiply|. Warning: some \textsc{pdf} readers are not able to render
-% transparency correctly.
+% equal to |multiply|.
%
% \tikzset{highlight/.style={rectangle,
% fill=red!15,
% blend mode = multiply,
% rounded corners = 0.5 mm,
-% inner sep=1pt}}
+% inner sep=1pt,
+% fit = #1}}
%
% \medskip
% \begin{Verbatim}
@@ -2162,16 +2210,17 @@ c & c & b & a & e
% fill=red!15,
% ~emphase#blend mode = multiply@,
% rounded corners = 0.5 mm,
-% inner sep=1pt}}
+% inner sep=1pt,
+% fit = ~#1}}
%
-% $\begin{bNiceMatrix}[~emphase#code-after = {\tikz \node[highlight, fit = (2-1) (2-3)] {} ;}@]
+% $\begin{bNiceMatrix}[~emphase#code-after = {\tikz \node [highlight = (2-1) (2-3)] {} ;}@]
% 0 & \Cdots & 0 \\
% 1 & \Cdots & 1 \\
% 0 & \Cdots & 0
% \end{bNiceMatrix}$
% \end{Verbatim}
%
-% \[\begin{bNiceMatrix}[code-after = {\tikz \node[highlight, fit = (2-1) (2-3)] {} ;}]
+% \[\begin{bNiceMatrix}[code-after = {\tikz \node [highlight = (2-1) (2-3)] {} ;}]
% 0 & \Cdots & 0 \\
% 1 & \Cdots & 1 \\
% 0 & \Cdots & 0
@@ -2223,30 +2272,33 @@ c & c & b & a & e
% technique three times.
%
% \begin{Verbatim}
-% \tikzset{myoptions/.style={remember picture,
-% overlay,
-% name prefix = example-,
-% every node/.style = {fill = red!15,
-% blend mode = multiply,
-% inner sep = 0pt}}}
+% \tikzset{mes-options/.style={remember picture,
+% overlay,
+% name prefix = exemple-,
+% highlight/.style = {fill = red!15,
+% blend mode = multiply,
+% inner sep = 0pt,
+% fit = ~#1}}}
% \end{Verbatim}
%
%
-% \tikzset{myoptions/.style={remember picture,
-% overlay,
-% name prefix = example-,
-% every node/.style = {fill = red!15,
-% blend mode = multiply,
-% inner sep = 0pt}}}
+% \tikzset{mes-options/.style={remember picture,
+% overlay,
+% name prefix = exemple-,
+% highlight/.style = {fill = red!15,
+% blend mode = multiply,
+% inner sep = 0pt,
+% fit = #1}}}
%
% \begin{Verbatim}
-% \begin{tikzpicture}[myoptions]
-% \node [fit = (1-1) (1-3)] {} ;
-% \node [fit = (2-1) (2-3)] {} ;
-% \node [fit = (3-1) (3-3)] {} ;
+% \begin{tikzpicture}[mes-options]
+% \node [highlight = (1-1) (1-3)] {} ;
+% \node [highlight = (2-1) (2-3)] {} ;
+% \node [highlight = (3-1) (3-3)] {} ;
% \end{tikzpicture}
% \end{Verbatim}
%
+%
% \medskip
% We obtain the following matrix.
%
@@ -2269,10 +2321,10 @@ c & c & b & a & e
% nodes'' instead of the ``normal nodes''.
%
% \begin{Verbatim}
-% \begin{tikzpicture}[myoptions, ~emphase#name suffix = -medium@]
-% \node [fit = (1-1) (1-3)] {} ;
-% \node [fit = (2-1) (2-3)] {} ;
-% \node [fit = (3-1) (3-3)] {} ;
+% \begin{tikzpicture}[mes-options, ~emphase#name suffix = -medium@]
+% \node [highlight = (1-1) (1-3)] {} ;
+% \node [highlight = (2-1) (2-3)] {} ;
+% \node [highlight = (3-1) (3-3)] {} ;
% \end{tikzpicture}
% \end{Verbatim}
%
@@ -2282,19 +2334,21 @@ c & c & b & a & e
% \[\begin{pNiceArray}{CCC}[
% last-col,
% create-medium-nodes,
-% code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15,
-% blend mode = multiply,
-% inner sep = 0pt},
+% code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15,
+% blend mode = multiply,
+% inner sep = 0pt,
+% fit = #1},
% name suffix = -medium]
-% \node [fit = (1-1) (1-3)] {} ;
-% \node [fit = (2-1) (2-3)] {} ;
-% \node [fit = (3-1) (3-3)] {} ;
+% \node [highlight = (1-1) (1-3)] {} ;
+% \node [highlight = (2-1) (2-3)] {} ;
+% \node [highlight = (3-1) (3-3)] {} ;
% \end{tikzpicture}}]
-% a & a + b & a + b + c & L_1\\
+% a & a + b & a + b + c & L_1 \\
% a & a & a + b & L_2 \\
% a & a & a & L_3
% \end{pNiceArray}\]
%
+%
%
% \vspace{1cm}
%
@@ -2403,8 +2457,8 @@ c & c & b & a & e
%
% \begin{Verbatim}
% \begin{tikzpicture}[remember picture, overlay]
-% \node [highlight, fit = (A-3-1) (A-3-5) ] {} ;
-% \node [highlight, fit = (B-1-3) (B-5-3) ] {} ;
+% \node [highlight = (A-3-1) (A-3-5) ] {} ;
+% \node [highlight = (B-1-3) (B-5-3) ] {} ;
% \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
% \end{tikzpicture}
% \end{Verbatim}
@@ -2442,8 +2496,8 @@ c & c & b & a & e
% \end{NiceMatrixBlock}
%
% \begin{tikzpicture}[remember picture, overlay]
-% \node [highlight, fit = (A-3-1) (A-3-5) ] {} ;
-% \node [highlight, fit = (B-1-3) (B-5-3) ] {} ;
+% \node [highlight = (A-3-1) (A-3-5) ] {} ;
+% \node [highlight = (B-1-3) (B-5-3) ] {} ;
% \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
% \end{tikzpicture}
%
@@ -2473,13 +2527,14 @@ c & c & b & a & e
%
% \subsection{Declaration of the package and extensions loaded}
%
+%<@@=nicematrix>
+%
+% \bigskip
% First, \pkg{tikz} and the Tikz library |fit| are loaded before the
% |\ProvidesExplPackage|. They are loaded this way because |\usetikzlibrary| in
% |expl3| code fails.\footnote{cf.
% |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|}
%
-%<@@=nicematrix>
-%
% \begin{macrocode}
\RequirePackage{tikz}
\usetikzlibrary{fit}
@@ -2692,6 +2747,7 @@ c & c & b & a & e
{ }
}
% \end{macrocode}
+%
%
% \bigskip
% The length |\l_@@_inter_dots_dim| is the distance between two dots for the
@@ -2701,6 +2757,18 @@ c & c & b & a & e
\dim_new:N \l_@@_inter_dots_dim
\dim_set:Nn \l_@@_inter_dots_dim { 0.45 em }
% \end{macrocode}
+%
+% \bigskip
+% The length |\l_@@_dotted_lines_margin_dim| is the minimal distance between a
+% node (in fact an anchor of that node) and a dotted line (we say ``minimal''
+% because, by definition, a dotted line is not a continuous line and, therefore,
+% this distance may vary a little).
+% \begin{macrocode}
+\dim_new:N \l_@@_dotted_lines_margin_dim
+\dim_set:Nn \l_@@_dotted_lines_margin_dim { 0.3 em }
+% \end{macrocode}
+%
+% \bigskip
% 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 be changed if the option |small| is
% used.
@@ -2940,13 +3008,17 @@ c & c & b & a & e
}
}
% \end{macrocode}
-%
-%
+%
+%
% \bigskip
% \subsection{The options}
%
-%
-%
+% The boolean |\l_@@_light_syntax_bool| corresponds to the option |light-syntax|.
+% \begin{macrocode}
+\bool_new:N \l_@@_light_syntax_bool
+% \end{macrocode}
+%
+% \bigskip
% The token list |\l_@@_pos_env_str| will contain one of the three values |t|,
% |c| or |b| and will indicate the position of the environment as in the option
% of the environment |{array}|. For the environment |{pNiceMatrix}|,
@@ -3038,18 +3110,36 @@ c & c & b & a & e
\dim_new:N \l_@@_extra_right_margin_dim
% \end{macrocode}
%
+% \medskip
+% The token list |\l_@@_end_of_row_tl| corresponds to the option |end-of-row|.
+% It specifies the symbol used to mark the ends of rows when the light syntax is
+% used.
+% \begin{macrocode}
+\tl_new:N \l_@@_end_of_row_tl
+\tl_set:Nn \l_@@_end_of_row_tl { ; }
+% \end{macrocode}
%
-%
+%
% \bigskip
% First, we define a set of keys ``|NiceMatrix / Global|'' which will be used
% (with the mechanism of |.inherit:n|) by other sets of keys.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Global }
{
+ dotted-lines-margin .dim_set:N = \l_@@_dotted_lines_margin_dim ,
+ dotted-lines-margin .value_required:n = true ,
+ light-syntax .bool_set:N = \l_@@_light_syntax_bool ,
+ light-syntax .default:n = true ,
+ end-of-row .tl_set:N = \l_@@_end_of_row_tl ,
+ end-of-row .value_required:n = true ,
code-for-first-col .tl_set:N = \l_@@_code_for_first_col_tl ,
+ code-for-first-col .value_required:n = true ,
code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl ,
+ code-for-last-col .value_required:n = true ,
code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl ,
+ code-for-first-row .value_required:n = true ,
code-for-last-row .tl_set:N = \l_@@_code_for_last_row_tl ,
+ code-for-last-row .value_required:n = true ,
small .bool_set:N = \l_@@_small_bool ,
hlines .bool_set:N = \l_@@_hlines_bool ,
parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
@@ -3061,6 +3151,7 @@ c & c & b & a & e
% |\Vdots| and |\Ddots|.
% \begin{macrocode}
renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
+ renew-dots .value_forbidden:n = true ,
nullify-dots .bool_set:N = \l_@@_nullify_dots_bool ,
% \end{macrocode}
%
@@ -3081,21 +3172,7 @@ c & c & b & a & e
extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim ,
extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim ,
extra-margin .meta:n =
- { extra-left-margin = #1 , extra-right-margin = #1 } ,
-% \end{macrocode}
-% The following lines are the properties |.value_required:n| and
-% |.value_forbidden:n| or the keys. These properties have no effect because they
-% are not transmitted by inheritance (unfortunately). We maintain these lines in
-% the \textsc{dtx} only for the case of a modification of |l3keys|.
-%
-% \begin{macrocode}
-%<*comment>
- code-for-first-col .value_required:n = true ,
- code-for-last-col .value_required:n = true ,
- code-for-first-row .value_required:n = true ,
- code-for-last-row .value_required:n = true ,
- renew-dots .value_forbidden:n = true ,
-%</comment>
+ { extra-left-margin = #1 , extra-right-margin = #1 }
}
% \end{macrocode}
%
@@ -3109,6 +3186,7 @@ c & c & b & a & e
\str_if_eq:nnTF { #1 } { auto }
{ \bool_set_true:N \l_@@_auto_columns_width_bool }
{ \dim_set:Nn \l_@@_columns_width_dim { #1 } } ,
+ columns-width .value_required:n = true ,
name .code:n =
\unless \ifmeasuring@
\str_set:Nn \l_tmpa_str { #1 }
@@ -3117,26 +3195,17 @@ c & c & b & a & e
{ \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 ,
first-col .code:n = \int_zero:N \l_@@_first_col_int ,
first-row .code:n = \int_zero:N \l_@@_first_row_int ,
last-row .int_set:N = \l_@@_last_row_int ,
last-row .default:n = -1 ,
-% \end{macrocode}
-% The following lines are the properties |.value_required:n| and
-% |.value_forbidden:n| or the keys. These properties have no effect because they
-% are not transmitted by inheritance (unfortunately). We maintain these lines in
-% the \textsc{dtx} only for the case of a modification of |l3keys|.
-%
-% \begin{macrocode}
-%<*comment>
- columns-width .value_required:n = true ,
- name .value_required:n = true ,
- code-after .value_required:n = true ,
-%</comment>
}
% \end{macrocode}
-%
+%
+%
% \bigskip
% We begin the construction of the major sets of keys (used by the different
% user commands and environments).
@@ -3181,13 +3250,10 @@ c & c & b & a & e
% \begin{macrocode}
renew-matrix .code:n = \@@_renew_matrix: ,
renew-matrix .value_forbidden:n = true ,
- RenewMatrix .code:n = \@@_error:n { Option~RenewMatrix~suppressed }
- \@@_renew_matrix: ,
+ RenewMatrix .code:n = \@@_error:n { Option~RenewMatrix~suppressed } ,
transparent .meta:n = { renew-dots , renew-matrix } ,
transparent .value_forbidden:n = true,
- Transparent .code:n = \@@_error:n { Option~Transparent~suppressed }
- \@@_renew_matrix:
- \bool_set_true:N \l_@@_renew_dots_bool ,
+ Transparent .code:n = \@@_error:n { Option~Transparent~suppressed } ,
% \end{macrocode}
%
%
@@ -3296,7 +3362,7 @@ c & c & b & a & e
% be used without value because the number of columns of the array can be read
% in the preamble of the array.
% \begin{macrocode}
- last-col .code:n = \tl_if_empty:nF {#1}
+ last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray }
@@ -3359,12 +3425,9 @@ c & c & b & a & e
%
% 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).
+% corners doesn't always exist simultaneously). The codes
+% |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the corners of the
+% matrix.
% \begin{macrocode}
\int_compare:nNnTF \c@iRow = \c_zero_int
{ \int_compare:nNnT \c@jCol > \c_zero_int \l_@@_code_for_first_row_tl }
@@ -3483,63 +3546,34 @@ c & c & b & a & e
\cs_new_protected:Nn \@@_renewcolumntype:nn
{
\newcolumntype #1 [ 2 ]
- {
- > {
+ {
+ > {
\hbox_set:Nw \l_tmpa_box
- \@@_Cell:
+ \_@@_Cell:
}
c
- < {
- \@@_end_Cell:
+ < {
+ \_@@_end_Cell:
\hbox_set_end:
- #2
- \hbox_set:Nn \l_tmpb_box
- { \makebox [ ##2 ] [ ##1 ] { \box_use:N \l_tmpa_box } }
- \dim_set:Nn \l_tmpa_dim { \box_dp:N \l_tmpb_box }
- \box_move_down:nn \l_tmpa_dim
- {
- \vbox:n
- {
- \hbox_to_wd:nn { \box_wd:N \l_tmpb_box }
- {
- \hfil
- \tikz [ remember~picture , overlay ]
- \coordinate (@@~north~east) ;
- }
- \hbox:n
- {
- \tikz [ remember~picture , overlay ]
- \coordinate (@@~south~west) ;
- \box_move_up:nn \l_tmpa_dim { \box_use:N \l_tmpb_box }
- }
- }
- }
-% \end{macrocode}
-% The |w|-node is created using the Tikz library |fit| after construction of the
-% nodes |(@@~south~west)| and |(@@~north~east)|. It's not possible to construct
-% by a standard |node| instruction because such a construction give an erroneous
-% result with some engines (|XeTeX|, |LuaTeX|) although the result is good with
-% |pdflatex| (why?).
-% \begin{macrocode}
- \tikz [ remember~picture , overlay ]
- \node
+ #2
+ \tikz [ remember~picture ]
+ \node
[
- node~contents = { } ,
name = nm - \int_use:N \g_@@_env_int -
\int_use:N \c@iRow -
\int_use:N \c@jCol - w,
- alias =
+ alias =
\str_if_empty:NF \l_@@_name_str
- {
+ {
\l_@@_name_str -
\int_use:N \c@iRow -
- \int_use:N \c@jCol - w
+ \int_use:N \c@jCol - w
} ,
inner~sep = \c_zero_dim ,
- fit = (@@~south~west) (@@~north~east)
- ]
+ ]
+ { \makebox [ ##2 ] [ ##1 ] { \box_use:N \l_tmpa_box } }
;
- }
+ }
}
}
% \end{macrocode}
@@ -4012,8 +4046,8 @@ c & c & b & a & e
}
% \end{macrocode}
%
-% The code in |\@@_pre_array:| is common to |{NiceArrayWithDelims}| and
-% |{NiceMatrix}|.
+% The code in |\@@_pre_array:| is used only by |{NiceArrayWithDelims}|. It
+% exists only for historical reasons. We should change that.
% \begin{macrocode}
\@@_pre_array:
% \end{macrocode}
@@ -4036,7 +4070,6 @@ c & c & b & a & e
\c_math_toggle_token
\left #1 \vcenter to 3 cm { } \right.
\c_math_toggle_token
-
}
\dim_gset:Nn \g_@@_left_delim_dim { \box_wd:N \l_tmpa_box }
\hbox_set:Nn \l_tmpa_box
@@ -4089,119 +4122,28 @@ c & c & b & a & e
\skip_horizontal:n \l_@@_left_margin_dim
\skip_horizontal:n \l_@@_extra_left_margin_dim
\c_math_toggle_token
-% \end{macrocode}
-% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
-% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
-% \begin{macrocode}
- \exp_args:NV \@@_array: \l_tmpa_tl
+ \bool_if:NTF \l_@@_light_syntax_bool
+ { \begin { @@-light-syntax } }
+ { \begin { @@-normal-syntax } }
}
% \end{macrocode}
%
-% \bigskip
-% We begin the second part of the environment |{NiceArrayWithDelims}|. If all
-% the columns must have the same width (if the user has used the option
-% |columns-width| or the option |auto-column-width| of the environment
-% |{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
-% commands |\@@_vdottedline:n|).
%
% \begin{macrocode}
- {
- \bool_if:nT
- {
- \l_@@_auto_columns_width_bool
- || \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim
- }
- {
- \crcr
- \int_compare:nNnT \l_@@_first_col_int = 0 { \omit & }
- \omit
-% \end{macrocode}
-% 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 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}
- \bool_if:nTF
- {
- \l_@@_auto_columns_width_bool
- && ! \l_@@_block_auto_columns_width_bool
- }
- {
- \dim_gset:Nn \g_tmpa_dim
- { \g_@@_max_cell_width_dim + 2 \arraycolsep }
- }
- {
- \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 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 } }
- {
- &
- \omit
-% \end{macrocode}
-% The incrementation of the counter |\g_tmpa_int| must be done after the |\omit|
-% of the cell.
-% \begin{macrocode}
- \int_gincr:N \g_tmpa_int
- \skip_horizontal:N \g_tmpa_dim
-% \end{macrocode}
-% We create a ``|col|'' node on the right of the current column.
-% \begin{macrocode}
- \tikz [ remember~picture , overlay ]
- \coordinate
- [
- name = nm - \int_use:N \g_@@_env_int -
- 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
+ {
+ \bool_if:NTF \l_@@_light_syntax_bool
+ { \end { @@-light-syntax } }
+ { \end { @@-normal-syntax } }
\c_math_toggle_token
\skip_horizontal:n \l_@@_right_margin_dim
\skip_horizontal:n \l_@@_extra_right_margin_dim
\hbox_set_end:
% \end{macrocode}
-%
+% Now, the box containing the array is constructed (in |\l_@@_the_array_box|).
+% However, we have some computations to do before inserting that box in the TeX
+% flow (mainly because the exterior columns are in overlapping positions).
+%
% \bigskip
-%
% \begin{macrocode}
\int_compare:nNnT \l_@@_last_row_int > { -2 }
{
@@ -4216,7 +4158,6 @@ c & c & b & a & e
}
% \end{macrocode}
%
-%
% Now, we compute |\l_tmpa_dim| which is the vertical dimension of the ``first
% row'' above the array (when the key |first-row| is used).
% \begin{macrocode}
@@ -4338,6 +4279,195 @@ c & c & b & a & e
%
%
% \interitem
+% The construction of the array in the environment |{NiceArrayWithDelims}| is,
+% in fact, done by the environment |{@@-light-syntax}| or by the environment
+% |{@@-normal-syntax}| (whether the option |light-syntax| is used or not). When
+% the key |light-syntax| is not used, the construction is a standard
+% environment (and, thus, it's possible to use verbatim in the arrray).
+% \begin{macrocode}
+\NewDocumentEnvironment { @@-normal-syntax } { }
+% \end{macrocode}
+% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
+% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
+% \begin{macrocode}
+ { \exp_args:NV \@@_array: \l_tmpa_tl }
+ {
+% \end{macrocode}
+%
+% If all the columns must have the same width (if the user has used the option
+% |columns-width| or the option |auto-column-width| of the environment
+% |{NiceMatrixBlock}|), we will 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
+% commands |\@@_vdottedline:n|). We have written a dedicated function for that job.
+% \begin{macrocode}
+ \@@_create_row_of_col_nodes:
+ \endarray
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
+% When the key |light-syntax| is used, we use an environment which takes its whole
+% body as an argument (with the specifier |b| of \pkg{xparse}).
+% \begin{macrocode}
+\NewDocumentEnvironment { @@-light-syntax } { b }
+ {
+% \end{macrocode}
+% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
+% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
+% \begin{macrocode}
+ \exp_args:NV \@@_array: \l_tmpa_tl
+% \end{macrocode}
+% The body of the environment, which is stored in the argument |#1|, is now
+% splitted into items (and \emph{not} tokens)
+% \begin{macrocode}
+ \seq_gclear_new:N \g_@@_rows_seq
+ \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl
+ \exp_args:NNV \seq_gset_split:Nnn \g_@@_rows_seq \l_@@_end_of_row_tl { #1 }
+% \end{macrocode}
+% We need a global affectation because, when executing |\l_tmpa_tl|, we will
+% exit the first cell of the array.
+% \begin{macrocode}
+ \seq_gpop_left:NN \g_@@_rows_seq \l_tmpa_tl
+ \exp_args:NV \@@_line_with_light_syntax_i:n \l_tmpa_tl
+ \seq_map_function:NN \g_@@_rows_seq \@@_line_with_light_syntax:n
+ \@@_create_row_of_col_nodes:
+ \endarray
+ }
+% \end{macrocode}
+% Now, the second part of the environment. It is empty. That's not surprising
+% because we have caught the whole body of the environment with the specifier
+% |b| provided by \pkg{xparse}.
+% \begin{macrocode}
+ { }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_line_with_light_syntax_i:n #1
+ {
+ \seq_gclear_new:N \g_@@_cells_seq
+ \seq_gset_split:Nnn \g_@@_cells_seq { ~ } { #1 }
+ \seq_gpop_left:NN \g_@@_cells_seq \l_tmpa_tl
+ \l_tmpa_tl
+ \seq_map_function:NN \g_@@_cells_seq \@@_cell_with_light_syntax:n
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
+ {
+ \tl_if_empty:nF { #1 }
+ { \\ \@@_line_with_light_syntax_i:n { #1 } }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cell_with_light_syntax:n #1 { & #1 }
+% \end{macrocode}
+%
+% \bigskip
+% The command |\@@_create_row_of_col_nodes:| will construct the potential last
+% row. That last row (when it is created) is a false row used to fix the width
+% of the columns (when the array is constructed with an option whhich specify
+% the width of the columns) and create the |col|-nodes (that nodes will be used
+% by |\vdottedline| for instance).
+% \begin{macrocode}
+\cs_new:Npn \@@_create_row_of_col_nodes:
+ {
+ \bool_if:nT
+ {
+ \l_@@_auto_columns_width_bool
+ || \dim_compare_p:nNn \l_@@_columns_width_dim > \c_zero_dim
+ }
+ {
+ \crcr
+ \int_compare:nNnT \l_@@_first_col_int = 0 { \omit & }
+ \omit
+% \end{macrocode}
+% 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 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}
+ \bool_if:nTF
+ {
+ \l_@@_auto_columns_width_bool
+ && ! \l_@@_block_auto_columns_width_bool
+ }
+ {
+ \dim_gset:Nn \g_tmpa_dim
+ { \g_@@_max_cell_width_dim + 2 \arraycolsep }
+ }
+ {
+ \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 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 } }
+ {
+ &
+ \omit
+% \end{macrocode}
+% The incrementation of the counter |\g_tmpa_int| must be done after the |\omit|
+% of the cell.
+% \begin{macrocode}
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_dim
+% \end{macrocode}
+% We create a ``|col|'' node on the right of the current column.
+% \begin{macrocode}
+ \@@_create_col_node:
+ }
+% \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 }
+ \@@_create_col_node:
+ \skip_horizontal:N \arraycolsep
+ }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_create_col_node:
+ {
+ \tikz [ remember~picture , overlay ]
+ \coordinate
+ [
+ name = nm - \int_use:N \g_@@_env_int -
+ col - \int_use:N \g_tmpa_int
+ ] ;
+ }
+% \end{macrocode}
+%
+%
+% \interitem
% Here is the preamble for the ``first column'' (if the user uses the key
% |first-col|)
% \begin{macrocode}
@@ -4853,8 +4983,8 @@ c & c & b & a & e
\bool_if:nTF \g_@@_medium_nodes_bool
{
\bool_if:NTF \g_@@_large_nodes_bool
- \@@_create_medium_and_large_nodes:
- \@@_create_medium_nodes:
+ \@@_create_medium_and_large_nodes:
+ \@@_create_medium_nodes:
}
{ \bool_if:NT \g_@@_large_nodes_bool \@@_create_large_nodes: }
\int_zero_new:N \l_@@_initial_i_int
@@ -4926,11 +5056,11 @@ c & c & b & a & e
% a & a+b & a+b+c
% \end{pNiceMatrix}\]
% For a closed extremity, we use the normal node and for a open one, we use the
-% ``medium node'' or, if it exists, the |w|~node.
+% ``medium node'' or, if it exists, the |w|-node.
% \[ \begin{pNiceMatrix}[create-medium-nodes,
% code-after = {\begin{tikzpicture}
-% \node [highlight, fit={(2-1)}] {} ;
-% \node [highlight, fit={(2-3-medium)}] {};
+% \node [highlight = (2-1)] {} ;
+% \node [highlight = (2-3-medium) ] {};
% \end{tikzpicture}
% }]
% a+b+c & a+b & a\\
@@ -5149,7 +5279,7 @@ c & c & b & a & e
% \end{macrocode}
% If we have at least one open extremity, we create the ``medium nodes'' in the
% matrix\footnote{We should change this. Indeed, for an open extremity of an
-% \emph{horizontal} dotted line, we use the |w|~node, if, it exists, and not the
+% \emph{horizontal} dotted line, we use the |w|-node, if, it exists, and not the
% ``medium node''.}. We remind that, when used once, the command
% |\@@_create_medium_nodes:| becomes no-op in the current TeX group.
% \begin{macrocode}
@@ -5264,7 +5394,7 @@ c & c & b & a & e
\bool_if:NTF \l_@@_initial_open_bool
{
% \end{macrocode}
-% If a |w| node exists we use the |w| node for the extremity.
+% If a |w|-node exists we use the |w|-node for the extremity.
% \begin{macrocode}
\cs_if_exist:cTF
{
@@ -5606,18 +5736,30 @@ c & c & b & a & e
}
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn { \l_@@_l_dim - 0.3 em } \l_@@_inter_dots_dim }
+ {
+ \dim_ratio:nn
+ { \l_@@_l_dim - \l_@@_dotted_lines_margin_dim }
+ \l_@@_inter_dots_dim
+ }
}
}
{
\bool_if:NTF \l_@@_final_open_bool
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn { \l_@@_l_dim - 0.3 em } \l_@@_inter_dots_dim }
+ {
+ \dim_ratio:nn
+ { \l_@@_l_dim - \l_@@_dotted_lines_margin_dim }
+ \l_@@_inter_dots_dim
+ }
}
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn { \l_@@_l_dim - 0.6 em } \l_@@_inter_dots_dim}
+ {
+ \dim_ratio:nn
+ { \l_@@_l_dim - ( \l_@@_dotted_lines_margin_dim * 2 ) }
+ \l_@@_inter_dots_dim
+ }
}
}
% \end{macrocode}
@@ -6217,7 +6359,7 @@ c & c & b & a & e
\int_compare:nNnF \c@iRow = \c_zero_int
{
\int_compare:nNnF \c@iRow = \l_@@_last_row_int
- \@@_vline_i:
+ \@@_vline_i:
}
}
}
@@ -6440,12 +6582,12 @@ c & c & b & a & e
{
\begin { tikzpicture } [ remember~picture , overlay ]
\@@_computations_for_medium_nodes:
+ \tikzset { name~suffix = -medium }
% \end{macrocode}
% Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:|
% because this command will also be used for the creation of the ``large nodes''
% (after changing the value of |name-suffix|).
% \begin{macrocode}
- \tikzset { name~suffix = -medium }
\@@_create_nodes:
\end { tikzpicture }
\cs_set_protected:Npn \@@_create_medium_nodes: { }
@@ -6484,6 +6626,7 @@ c & c & b & a & e
{
\begin { tikzpicture } [ remember~picture , overlay ]
\@@_computations_for_medium_nodes:
+% \end{macrocode}
% Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:|
% because this command will also be used for the creation of the ``large nodes''
% (after changing the value of |name-suffix|).
@@ -6944,6 +7087,7 @@ c & c & b & a & e
% \subsection{Error messages of the package}
%
%
+%
% \begin{macrocode}
\@@_msg_new:nn { unknown~cell~for~line~in~code-after }
{
@@ -7025,7 +7169,7 @@ c & c & b & a & e
\@@_msg_new:nn { Option~Transparent~suppressed }
{
The~option~'Transparent'~has~been~renamed~'transparent'.\\
- However,~you~can~go~on~for~this~time.
+ If~you~go~on~this~command~will~be~ignored.
}
% \end{macrocode}
%
@@ -7033,7 +7177,7 @@ c & c & b & a & e
\@@_msg_new:nn { Option~RenewMatrix~suppressed }
{
The~option~'RenewMatrix'~has~been~renamed~'renew-matrix'.\\
- However,~you~can~go~on~for~this~time.
+ If~you~go~on~this~command~will~be~ignored.
}
% \end{macrocode}
%
@@ -7064,16 +7208,19 @@ c & c & b & a & e
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
+ dotted-lines-margin,~
+ end-of-row,~
exterior-arraycolsep,~
hlines,~
left-margin,~
letter-for-dotted-lines,~
+ light-syntax,~
nullify-dots,~
parallelize-diags,~
renew-dots,~
renew-matrix,~
right-margin,~
- small~
+ small,~
and~transparent
}
% \end{macrocode}
@@ -7099,6 +7246,8 @@ c & c & b & a & e
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
+ dotted-lines-margin,~
+ end-of-row,~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -7107,12 +7256,13 @@ c & c & b & a & e
last-col,~
last-row,~
left-margin,~
+ light-syntax,~
name,~
nullify-dots,~
parallelize-diags,~
renew-dots,~
right-margin,~
- small~
+ small,~
and~t.
}
% \end{macrocode}
@@ -7140,6 +7290,8 @@ c & c & b & a & e
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
+ dotted-lines-margin,~
+ end-of-row,~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -7148,26 +7300,25 @@ c & c & b & a & e
last-col,~
last-row,~
left-margin,~
+ light-syntax,~
name,~
nullify-dots,~
parallelize-diags,~
renew-dots,~
- right-margin~
+ right-margin,~
and~small.
}
% \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 }
{
The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
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,~
- use~the~option~'allow-duplicate-names'.\\
+ if~you~use~'columns-width=auto'.~If~you~don't~want~to~see~this~
+ message~again,~use~the~option~'allow-duplicate-names'.\\
For~a~list~of~the~names~already~used,~type~H~<return>. \\
}
{
@@ -7582,15 +7733,20 @@ c & c & b & a & e
%
% New options |create-medium-nodes| and |create-large-nodes|.
%
+% \subsection*{Changes between version 3.9 and 3.10}
+%
+% New option |light-syntax| (and |end-of-row|).
+%
+% New option |dotted-lines-margin| for fine tuning of the dotted lines.
+%
% \PrintIndex
%
% \tableofcontents
-% \endinput
%
+% \endinput
% 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 ce81093ceaa..9072571cef0 100644
--- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
+++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
@@ -18,8 +18,8 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{3.9}
-\def\myfiledate{2020/01/10}
+\def\myfileversion{3.10}
+\def\myfiledate{2020/01/22}
\RequirePackage{tikz}
\usetikzlibrary{fit}
\RequirePackage{expl3}[2019/07/01]
@@ -94,6 +94,8 @@
}
\dim_new:N \l__nicematrix_inter_dots_dim
\dim_set:Nn \l__nicematrix_inter_dots_dim { 0.45 em }
+\dim_new:N \l__nicematrix_dotted_lines_margin_dim
+\dim_set:Nn \l__nicematrix_dotted_lines_margin_dim { 0.3 em }
\dim_new:N \l__nicematrix_radius_dim
\dim_set:Nn \l__nicematrix_radius_dim { 0.53 pt }
\str_new:N \g__nicematrix_type_env_str
@@ -149,6 +151,7 @@
\NC@find
}
}
+\bool_new:N \l__nicematrix_light_syntax_bool
\str_new:N \l__nicematrix_pos_env_str
\str_set:Nn \l__nicematrix_pos_env_str c
\bool_new:N \l__nicematrix_exterior_arraycolsep_bool
@@ -168,16 +171,29 @@
\dim_new:N \g__nicematrix_width_first_col_dim
\dim_new:N \l__nicematrix_extra_left_margin_dim
\dim_new:N \l__nicematrix_extra_right_margin_dim
+\tl_new:N \l__nicematrix_end_of_row_tl
+\tl_set:Nn \l__nicematrix_end_of_row_tl { ; }
\keys_define:nn { NiceMatrix / Global }
{
+ dotted-lines-margin .dim_set:N = \l__nicematrix_dotted_lines_margin_dim ,
+ dotted-lines-margin .value_required:n = true ,
+ light-syntax .bool_set:N = \l__nicematrix_light_syntax_bool ,
+ light-syntax .default:n = true ,
+ end-of-row .tl_set:N = \l__nicematrix_end_of_row_tl ,
+ end-of-row .value_required:n = true ,
code-for-first-col .tl_set:N = \l__nicematrix_code_for_first_col_tl ,
+ code-for-first-col .value_required:n = true ,
code-for-last-col .tl_set:N = \l__nicematrix_code_for_last_col_tl ,
+ code-for-last-col .value_required:n = true ,
code-for-first-row .tl_set:N = \l__nicematrix_code_for_first_row_tl ,
+ code-for-first-row .value_required:n = true ,
code-for-last-row .tl_set:N = \l__nicematrix_code_for_last_row_tl ,
+ code-for-last-row .value_required:n = true ,
small .bool_set:N = \l__nicematrix_small_bool ,
hlines .bool_set:N = \l__nicematrix_hlines_bool ,
parallelize-diags .bool_set:N = \l__nicematrix_parallelize_diags_bool ,
renew-dots .bool_set:N = \l__nicematrix_renew_dots_bool ,
+ renew-dots .value_forbidden:n = true ,
nullify-dots .bool_set:N = \l__nicematrix_nullify_dots_bool ,
create-medium-nodes .bool_set:N = \l__nicematrix_medium_nodes_bool ,
create-large-nodes .bool_set:N = \l__nicematrix_large_nodes_bool ,
@@ -192,7 +208,7 @@
extra-left-margin .dim_set:N = \l__nicematrix_extra_left_margin_dim ,
extra-right-margin .dim_set:N = \l__nicematrix_extra_right_margin_dim ,
extra-margin .meta:n =
- { extra-left-margin = #1 , extra-right-margin = #1 } ,
+ { extra-left-margin = #1 , extra-right-margin = #1 }
}
\keys_define:nn { NiceMatrix / Env }
{
@@ -200,6 +216,7 @@
\str_if_eq:nnTF { #1 } { auto }
{ \bool_set_true:N \l__nicematrix_auto_columns_width_bool }
{ \dim_set:Nn \l__nicematrix_columns_width_dim { #1 } } ,
+ columns-width .value_required:n = true ,
name .code:n =
\unless \ifmeasuring@
\str_set:Nn \l_tmpa_str { #1 }
@@ -208,7 +225,9 @@
{ \seq_gput_left:NV \g__nicematrix_names_seq \l_tmpa_str }
\str_set_eq:NN \l__nicematrix_name_str \l_tmpa_str
\fi ,
+ name .value_required:n = true ,
code-after .tl_gset:N = \g__nicematrix_code_after_tl ,
+ code-after .value_required:n = true ,
first-col .code:n = \int_zero:N \l__nicematrix_first_col_int ,
first-row .code:n = \int_zero:N \l__nicematrix_first_row_int ,
last-row .int_set:N = \l__nicematrix_last_row_int ,
@@ -240,13 +259,10 @@
{
renew-matrix .code:n = \__nicematrix_renew_matrix: ,
renew-matrix .value_forbidden:n = true ,
- RenewMatrix .code:n = \__nicematrix_error:n { Option~RenewMatrix~suppressed }
- \__nicematrix_renew_matrix: ,
+ RenewMatrix .code:n = \__nicematrix_error:n { Option~RenewMatrix~suppressed } ,
transparent .meta:n = { renew-dots , renew-matrix } ,
transparent .value_forbidden:n = true,
- Transparent .code:n = \__nicematrix_error:n { Option~Transparent~suppressed }
- \__nicematrix_renew_matrix:
- \bool_set_true:N \l__nicematrix_renew_dots_bool ,
+ Transparent .code:n = \__nicematrix_error:n { Option~Transparent~suppressed } ,
exterior-arraycolsep .bool_set:N = \l__nicematrix_exterior_arraycolsep_bool ,
columns-width .code:n =
\str_if_eq:nnTF { #1 } { auto }
@@ -280,7 +296,7 @@
c .code:n = \str_set:Nn \l__nicematrix_pos_env_str c ,
t .code:n = \str_set:Nn \l__nicematrix_pos_env_str t ,
b .code:n = \str_set:Nn \l__nicematrix_pos_env_str b ,
- last-col .code:n = \tl_if_empty:nF {#1}
+ last-col .code:n = \tl_if_empty:nF { #1 }
{ \__nicematrix_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l__nicematrix_last_col_int ,
unknown .code:n = \__nicematrix_error:n { Unknown~option~for~NiceArray }
@@ -388,31 +404,9 @@
\__nicematrix_end_Cell:
\hbox_set_end:
#2
- \hbox_set:Nn \l_tmpb_box
- { \makebox [ ##2 ] [ ##1 ] { \box_use:N \l_tmpa_box } }
- \dim_set:Nn \l_tmpa_dim { \box_dp:N \l_tmpb_box }
- \box_move_down:nn \l_tmpa_dim
- {
- \vbox:n
- {
- \hbox_to_wd:nn { \box_wd:N \l_tmpb_box }
- {
- \hfil
- \tikz [ remember~picture , overlay ]
- \coordinate (__nicematrix~north~east) ;
- }
- \hbox:n
- {
- \tikz [ remember~picture , overlay ]
- \coordinate (__nicematrix~south~west) ;
- \box_move_up:nn \l_tmpa_dim { \box_use:N \l_tmpb_box }
- }
- }
- }
- \tikz [ remember~picture , overlay ]
+ \tikz [ remember~picture ]
\node
[
- node~contents = { } ,
name = nm - \int_use:N \g__nicematrix_env_int -
\int_use:N \c@iRow -
\int_use:N \c@jCol - w,
@@ -424,8 +418,8 @@
\int_use:N \c@jCol - w
} ,
inner~sep = \c_zero_dim ,
- fit = (__nicematrix~south~west) (__nicematrix~north~east)
]
+ { \makebox [ ##2 ] [ ##1 ] { \box_use:N \l_tmpa_box } }
;
}
}
@@ -648,7 +642,6 @@
\c_math_toggle_token
\left #1 \vcenter to 3 cm { } \right.
\c_math_toggle_token
-
}
\dim_gset:Nn \g__nicematrix_left_delim_dim { \box_wd:N \l_tmpa_box }
\hbox_set:Nn \l_tmpa_box
@@ -685,68 +678,14 @@
\skip_horizontal:n \l__nicematrix_left_margin_dim
\skip_horizontal:n \l__nicematrix_extra_left_margin_dim
\c_math_toggle_token
- \exp_args:NV \__nicematrix_array: \l_tmpa_tl
+ \bool_if:NTF \l__nicematrix_light_syntax_bool
+ { \begin { __nicematrix-light-syntax } }
+ { \begin { __nicematrix-normal-syntax } }
}
{
- \bool_if:nT
- {
- \l__nicematrix_auto_columns_width_bool
- || \dim_compare_p:nNn \l__nicematrix_columns_width_dim > \c_zero_dim
- }
- {
- \crcr
- \int_compare:nNnT \l__nicematrix_first_col_int = 0 { \omit & }
- \omit
- \skip_horizontal:N \arraycolsep
- \tikz [ remember~picture , overlay ]
- \coordinate [ name = nm - \int_use:N \g__nicematrix_env_int - col - 0 ] ;
- \skip_horizontal:n { - \arraycolsep }
- \bool_if:nTF
- {
- \l__nicematrix_auto_columns_width_bool
- && ! \l__nicematrix_block_auto_columns_width_bool
- }
- {
- \dim_gset:Nn \g_tmpa_dim
- { \g__nicematrix_max_cell_width_dim + 2 \arraycolsep }
- }
- {
- \dim_gset:Nn \g_tmpa_dim
- { \l__nicematrix_columns_width_dim + 2 \arraycolsep }
- }
- \skip_horizontal:N \g_tmpa_dim
- \tikz [ remember~picture , overlay ]
- \coordinate [ name = nm - \int_use:N \g__nicematrix_env_int - col - 1 ] ;
- \int_gset:Nn \g_tmpa_int 1
- \bool_if:nTF \g__nicematrix_last_col_found_bool
- { \prg_replicate:nn { \g__nicematrix_col_total_int - 3 } }
- { \prg_replicate:nn { \g__nicematrix_col_total_int - 2 } }
- {
- &
- \omit
- \int_gincr:N \g_tmpa_int
- \skip_horizontal:N \g_tmpa_dim
- \tikz [ remember~picture , overlay ]
- \coordinate
- [
- name = nm - \int_use:N \g__nicematrix_env_int -
- 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__nicematrix_env_int -
- col - \int_use:N \g_tmpa_int
- ] ;
- \skip_horizontal:N \arraycolsep
- }
- \endarray
+ \bool_if:NTF \l__nicematrix_light_syntax_bool
+ { \end { __nicematrix-light-syntax } }
+ { \end { __nicematrix-normal-syntax } }
\c_math_toggle_token
\skip_horizontal:n \l__nicematrix_right_margin_dim
\skip_horizontal:n \l__nicematrix_extra_right_margin_dim
@@ -834,6 +773,99 @@
}
\__nicematrix_after_array:
}
+\NewDocumentEnvironment { __nicematrix-normal-syntax } { }
+ { \exp_args:NV \__nicematrix_array: \l_tmpa_tl }
+ {
+ \__nicematrix_create_row_of_col_nodes:
+ \endarray
+ }
+\NewDocumentEnvironment { __nicematrix-light-syntax } { b }
+ {
+ \exp_args:NV \__nicematrix_array: \l_tmpa_tl
+ \seq_gclear_new:N \g__nicematrix_rows_seq
+ \tl_set_rescan:Nno \l__nicematrix_end_of_row_tl { } \l__nicematrix_end_of_row_tl
+ \exp_args:NNV \seq_gset_split:Nnn \g__nicematrix_rows_seq \l__nicematrix_end_of_row_tl { #1 }
+ \seq_gpop_left:NN \g__nicematrix_rows_seq \l_tmpa_tl
+ \exp_args:NV \__nicematrix_line_with_light_syntax_i:n \l_tmpa_tl
+ \seq_map_function:NN \g__nicematrix_rows_seq \__nicematrix_line_with_light_syntax:n
+ \__nicematrix_create_row_of_col_nodes:
+ \endarray
+ }
+ { }
+\cs_new_protected:Npn \__nicematrix_line_with_light_syntax_i:n #1
+ {
+ \seq_gclear_new:N \g__nicematrix_cells_seq
+ \seq_gset_split:Nnn \g__nicematrix_cells_seq { ~ } { #1 }
+ \seq_gpop_left:NN \g__nicematrix_cells_seq \l_tmpa_tl
+ \l_tmpa_tl
+ \seq_map_function:NN \g__nicematrix_cells_seq \__nicematrix_cell_with_light_syntax:n
+ }
+\cs_new_protected:Npn \__nicematrix_line_with_light_syntax:n #1
+ {
+ \tl_if_empty:nF { #1 }
+ { \\ \__nicematrix_line_with_light_syntax_i:n { #1 } }
+ }
+\cs_new_protected:Npn \__nicematrix_cell_with_light_syntax:n #1 { & #1 }
+\cs_new:Npn \__nicematrix_create_row_of_col_nodes:
+ {
+ \bool_if:nT
+ {
+ \l__nicematrix_auto_columns_width_bool
+ || \dim_compare_p:nNn \l__nicematrix_columns_width_dim > \c_zero_dim
+ }
+ {
+ \crcr
+ \int_compare:nNnT \l__nicematrix_first_col_int = 0 { \omit & }
+ \omit
+ \skip_horizontal:N \arraycolsep
+ \tikz [ remember~picture , overlay ]
+ \coordinate [ name = nm - \int_use:N \g__nicematrix_env_int - col - 0 ] ;
+ \skip_horizontal:n { - \arraycolsep }
+ \bool_if:nTF
+ {
+ \l__nicematrix_auto_columns_width_bool
+ && ! \l__nicematrix_block_auto_columns_width_bool
+ }
+ {
+ \dim_gset:Nn \g_tmpa_dim
+ { \g__nicematrix_max_cell_width_dim + 2 \arraycolsep }
+ }
+ {
+ \dim_gset:Nn \g_tmpa_dim
+ { \l__nicematrix_columns_width_dim + 2 \arraycolsep }
+ }
+ \skip_horizontal:N \g_tmpa_dim
+ \tikz [ remember~picture , overlay ]
+ \coordinate [ name = nm - \int_use:N \g__nicematrix_env_int - col - 1 ] ;
+ \int_gset:Nn \g_tmpa_int 1
+ \bool_if:nTF \g__nicematrix_last_col_found_bool
+ { \prg_replicate:nn { \g__nicematrix_col_total_int - 3 } }
+ { \prg_replicate:nn { \g__nicematrix_col_total_int - 2 } }
+ {
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_dim
+ \__nicematrix_create_col_node:
+ }
+ &
+ \omit
+ \int_gincr:N \g_tmpa_int
+ \skip_horizontal:N \g_tmpa_dim
+ \skip_horizontal:n { - \arraycolsep }
+ \__nicematrix_create_col_node:
+ \skip_horizontal:N \arraycolsep
+ }
+ }
+\cs_new_protected:Npn \__nicematrix_create_col_node:
+ {
+ \tikz [ remember~picture , overlay ]
+ \coordinate
+ [
+ name = nm - \int_use:N \g__nicematrix_env_int -
+ col - \int_use:N \g_tmpa_int
+ ] ;
+ }
\tl_const:Nn \c__nicematrix_preamble_first_col_tl
{
>
@@ -1145,8 +1177,8 @@
\bool_if:nTF \g__nicematrix_medium_nodes_bool
{
\bool_if:NTF \g__nicematrix_large_nodes_bool
- \__nicematrix_create_medium_and_large_nodes:
- \__nicematrix_create_medium_nodes:
+ \__nicematrix_create_medium_and_large_nodes:
+ \__nicematrix_create_medium_nodes:
}
{ \bool_if:NT \g__nicematrix_large_nodes_bool \__nicematrix_create_large_nodes: }
\int_zero_new:N \l__nicematrix_initial_i_int
@@ -1632,18 +1664,30 @@
}
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn { \l__nicematrix_l_dim - 0.3 em } \l__nicematrix_inter_dots_dim }
+ {
+ \dim_ratio:nn
+ { \l__nicematrix_l_dim - \l__nicematrix_dotted_lines_margin_dim }
+ \l__nicematrix_inter_dots_dim
+ }
}
}
{
\bool_if:NTF \l__nicematrix_final_open_bool
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn { \l__nicematrix_l_dim - 0.3 em } \l__nicematrix_inter_dots_dim }
+ {
+ \dim_ratio:nn
+ { \l__nicematrix_l_dim - \l__nicematrix_dotted_lines_margin_dim }
+ \l__nicematrix_inter_dots_dim
+ }
}
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn { \l__nicematrix_l_dim - 0.6 em } \l__nicematrix_inter_dots_dim}
+ {
+ \dim_ratio:nn
+ { \l__nicematrix_l_dim - ( \l__nicematrix_dotted_lines_margin_dim * 2 ) }
+ \l__nicematrix_inter_dots_dim
+ }
}
}
\dim_set:Nn \l_tmpa_dim
@@ -2011,7 +2055,7 @@
\int_compare:nNnF \c@iRow = \c_zero_int
{
\int_compare:nNnF \c@iRow = \l__nicematrix_last_row_int
- \__nicematrix_vline_i:
+ \__nicematrix_vline_i:
}
}
}
@@ -2460,12 +2504,12 @@
\__nicematrix_msg_new:nn { Option~Transparent~suppressed }
{
The~option~'Transparent'~has~been~renamed~'transparent'.\\
- However,~you~can~go~on~for~this~time.
+ If~you~go~on~this~command~will~be~ignored.
}
\__nicematrix_msg_new:nn { Option~RenewMatrix~suppressed }
{
The~option~'RenewMatrix'~has~been~renamed~'renew-matrix'.\\
- However,~you~can~go~on~for~this~time.
+ If~you~go~on~this~command~will~be~ignored.
}
\__nicematrix_msg_new:nn { Bad~value~for~letter~for~dotted~lines }
{
@@ -2489,16 +2533,19 @@
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
+ dotted-lines-margin,~
+ end-of-row,~
exterior-arraycolsep,~
hlines,~
left-margin,~
letter-for-dotted-lines,~
+ light-syntax,~
nullify-dots,~
parallelize-diags,~
renew-dots,~
renew-matrix,~
right-margin,~
- small~
+ small,~
and~transparent
}
\__nicematrix_msg_new:nnn { Unknown~option~for~NiceArray }
@@ -2521,6 +2568,8 @@
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
+ dotted-lines-margin,~
+ end-of-row,~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -2529,12 +2578,13 @@
last-col,~
last-row,~
left-margin,~
+ light-syntax,~
name,~
nullify-dots,~
parallelize-diags,~
renew-dots,~
right-margin,~
- small~
+ small,~
and~t.
}
\__nicematrix_msg_new:nnn { Unknown~option~for~NiceMatrix }
@@ -2555,6 +2605,8 @@
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
+ dotted-lines-margin,~
+ end-of-row,~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -2563,11 +2615,12 @@
last-col,~
last-row,~
left-margin,~
+ light-syntax,~
name,~
nullify-dots,~
parallelize-diags,~
renew-dots,~
- right-margin~
+ right-margin,~
and~small.
}
\__nicematrix_msg_new:nnn { Duplicate~name }
@@ -2575,9 +2628,8 @@
The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
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,~
- use~the~option~'allow-duplicate-names'.\\
+ if~you~use~'columns-width=auto'.~If~you~don't~want~to~see~this~
+ message~again,~use~the~option~'allow-duplicate-names'.\\
For~a~list~of~the~names~already~used,~type~H~<return>. \\
}
{