diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-13 21:41:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-13 21:41:34 +0000 |
commit | e0ce141fcde2bce358ce1f883ceff960742cae4a (patch) | |
tree | 3b39189aa3ac9061f85fabecfcd414fa5709f3ed | |
parent | ed8702df3768e21a3ef87a2eec9ca8341aad9b7a (diff) |
nicematrix (13oct19)
git-svn-id: svn://tug.org/texlive/trunk@52370 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/README.md | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf | bin | 313943 -> 316632 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex | 56 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf | bin | 656408 -> 660302 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 386 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 62 |
6 files changed, 293 insertions, 217 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/README.md b/Master/texmf-dist/doc/latex/nicematrix/README.md index 056f0d84a4a..62c2d060890 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/README.md +++ b/Master/texmf-dist/doc/latex/nicematrix/README.md @@ -1,8 +1,8 @@ # Readme for the package nicematrix -Author : F. Pantigny (`fpantigny@wanadoo.fr`). +Author: F. Pantigny (`fpantigny@wanadoo.fr`). -CTAN page : `https://ctan.org/pkg/nicematrix` +CTAN page: `https://ctan.org/pkg/nicematrix` ## License The LaTeX extension `nicematrix` is distributed under the LPPL 1.3 license. @@ -12,7 +12,7 @@ The LaTeX extension `nicematrix` is distributed under the LPPL 1.3 license. The LaTeX package `nicematrix` provides new environments similar to the classical environments `{array}` and `{matrix}` but with some additional features. Among these features are the possibilities to fix the width of the columns, to draw continuous ellipsis dots between the cells -of the array and to add exterior rows and columns (so called 'border matrices'). +of the array and to add exterior rows and columns (so called *border matrices*). ## Installation diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf Binary files differindex c288f665cc0..e2607f0c9be 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex index fa07724b594..49d8fc98ffb 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex @@ -1,6 +1,7 @@ \documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix) \usepackage{xltxtra} \usepackage[french]{babel} +\frenchsetup{og = « , fg = »} \usepackage{geometry} \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} @@ -501,11 +502,11 @@ même rangée que |\Hdotsfor|). \subsection{Comment créer les lignes en pointillés de manière transparente} L'extension \pkg{nicematrix} fournit une option appelée |transparent| qui permet d'utiliser du code existant de -manière transparente dans les environnements de l'\pkg{amsmath} : |{matrix}|, |{pmatrix}|, |{bmatrix}|, etc. En -fait, cette option est un alias pour la conjonction de deux options : |renew-dots| et -|renew-matrix|.\footnote{Comme toutes les autres options, les options |renew-dots|, |renew-matrix| et |transparent| - peuvent être fixées avec la commande |\NiceMatrixOptions|, mais elles peuvent aussi être passées en options du - |\usepackage| (ce sont les trois seules).} +manière transparente dans les environnements de l'\pkg{amsmath} : |{matrix}|, |{pmatrix}|, etc. En fait, cette +option est un alias pour la conjonction de deux options : |renew-dots| et |renew-matrix|.\footnote{Comme toutes les + autres options, les options |renew-dots|, |renew-matrix| et |transparent| peuvent être fixées avec la commande + |\NiceMatrixOptions|, mais elles peuvent aussi être passées en options du |\usepackage| (ce sont les trois + seules).} \smallskip @@ -854,8 +855,8 @@ Les environnements de \pkg{nicematrix} permettent de composer des rangées et de \label{exterior} Si elle est présente, la première rangée est numérotée par $0$ (et non $1$). Il en est de même pour la première -colonne. Dans le cas général, on doit spécifier le numéro de la dernière rangée et de la dernière colonne (si elles -sont présentes). +colonne. Dans le cas général, on doit spécifier le numéro de la dernière rangée et de la dernière colonne comme +valeurs des options |last-row| and |last-col| (si elles sont présentes). \begin{Verbatim} $\begin{pNiceMatrix}[~emphase#first-row,last-row=5,first-col,last-col=5@] @@ -882,12 +883,13 @@ Il y a plusieurs remarques à formuler. % \begin{itemize} \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 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 |L|). +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 +|L|. \item Si on utilise un environnement avec préambule explicite et une dernière colonne, on doit utiliser l'option |last-col| \emph{sans} valeur. En effet le numéro de la dernière colonne est, dans ce cas, déduit du préambule (qui -contient nécessairement l'information du nombre de colonnes non extérieures). +contient nécessairement implicitement l'information du nombre de colonnes non extérieures). \item Pour une dernière rangée, l'option |last-row| peut en fait être utilisée sans préciser de valeur. Dans ce cas, \pkg{nicematrix} détermine, lors de la première compilation, le nombre de rangées rencontrées dans le tableau @@ -1099,13 +1101,13 @@ $\begin{pNiceMatrix}[columns-width = 1cm] \medskip Noter que l'espace inséré entre deux colonnes (égal à 2 |\arraycolsep|) n'est pas supprimé (il est évidemment -possible de le supprimer en mettant |\arraycolsep| à~$0$). +possible de le supprimer en mettant |\arraycolsep| à~$0$ avant). \bigskip -Il est possible de donner la valeur |auto| à l'option |columns-width| : toutes les colonnes du tableau +Il est possible de donner la valeur spéciale |auto| à l'option |columns-width|: toutes les colonnes du tableau auront alors une largeur égale à la largeur de la case la plus large du tableau.\footnote{Le résultat est atteint -dès la première compilation (mais Tikz écrivant des informations dans le fichier |.aux|, un message demandant une -deuxième compilation apparaîtra).}\par\nobreak + dès la première compilation (mais Tikz écrivant des informations dans le fichier |.aux|, un message demandant une + deuxième compilation apparaîtra).}\par\nobreak \medskip \begin{BVerbatim}[baseline=c,boxwidth=10cm] @@ -1122,8 +1124,8 @@ $\begin{pNiceMatrix}[columns-width = auto] \end{pNiceMatrix}$ \bigskip -Il est possible de fixer la largeur de toutes les colonnes de toutes les matrices dans une certaine portion de -document avec la commande |\NiceMatrixOptions|.\par\nobreak +Sans surprise, il est possible de fixer la largeur de toutes les colonnes de toutes les matrices dans une certaine +portion de document avec la commande |\NiceMatrixOptions|.\par\nobreak \medskip \begin{BVerbatim}[baseline=c,boxwidth=8.5cm] @@ -1489,20 +1491,18 @@ colonnes sans interférer avec le tracé des lignes en pointillés par \pkg{nice L'environnement |{array}| insère un espace horizontal égal à |\arraycolsep| avant et après chaque colonne. En particulier, il y a un espace égal à |\arraycolsep| avant et après le tableau. Cette caractéristique de -l'environnement |{array}| n'était probablement pas une bonne idée.\footnote{Dans la documentation de |{amsmath}|, - on peut lire : {\itshape The extra space of |\arraycolsep| that \pkg{array} adds on each side is a waste so we +l'environnement |{array}| n'était probablement pas une bonne idée\footnote{Dans la documentation de |{amsmath}|, on + peut lire : {\itshape The extra space of |\arraycolsep| that \pkg{array} adds on each side is a waste so we remove it [in |{matrix}|] (perhaps we should instead remove it from array in general, but that's a harder task).} Il est possible de supprimer les espaces pour un environnement |{array}| donné par une construction du - type |\begin{array}{@{}ccccc@{}}|.} % \end{array} - -L'environnement |{matrix}| et ses variantes (|{pmatrix}|, |{vmatrix}|, etc.) de \pkg{amsmath} prefèrent supprimer -ces espaces avec des instructions explicites |\hskip -\arraycolsep| et |{NiceArray}| agit de même. - -Néanmoins, l'utilisateur peut changer ce comportement avec l'option |exterior-arraycolsep| de la commande -|\NiceMatrixOptions|. Avec cette option, |{NiceArray}| va insérer le même espacement horizontal que |{array}|. - -Cette option est seulement pour la «compatibilité» puisque l'extension \pkg{nicematrix} fournit un contrôle plus -précis avec les options |left-margin|, |extra-left-margin|, etc. + type |\begin{array}{@{}ccccc@{}}...\end{array}|.}. L'environnement |{matrix}| et ses variantes (|{pmatrix}|, +|{vmatrix}|, etc.) de \pkg{amsmath} prefèrent supprimer ces espaces avec des instructions explicites +|\hskip -\arraycolsep|. L'extension \pkg{nicematrix} fait de même dans \emph{tous} ses environnements y compris +l'environnement |{NiceArray}|. Néanmoins, si l'utilisateur souhaite que l'environnement |{NiceArray}| se comporte +par défaut comme l'environnement |{array}| de \pkg{array} (par exemple pour faciliter l'adaptation d'un document +existant), il peut contrôler ce comportement avec l'option |exterior-arraycolsep| accessible via la commande +|\NiceMatrixOptions|. Avec cette option, des espaces extérieurs de longueur |\arraycolsep| seront insérés dans les +environnements |{NiceArray}| (les autres environnements de l'extension \pkg{nicematrix} ne sont pas affectés). \subsection{L'option de classe draft} diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf Binary files differindex 74ad63b6d37..1fd19c09ccd 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index 831a7fca85d..47271a5452e 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.4} -\def\myfiledate{2019/10/05} +\def\myfileversion{3.5} +\def\myfiledate{2019/10/13} % % %<*batchfile> @@ -45,7 +45,7 @@ version 2005/12/01 or later. %</batchfile> % %<*driver> -\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix) +\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz) \VerbatimFootnotes \usepackage{xltxtra} \usepackage[xetex]{geometry} @@ -114,10 +114,10 @@ c & c & b & a & e % % This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by % the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two or -% three compilations may be necessary. This package requires and \textbf{loads} the -% packages \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{amsmath} -% and \pkg{tikz}. It also loads the Tikz library \pkg{fit}. The final user only -% has to load the extension with |\usepackage{nicematrix}|. +% three compilations may be necessary. This package requires and \textbf{loads} +% the packages \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, +% \pkg{amsmath} and \pkg{tikz}. It also loads the Tikz library \pkg{fit}. The +% final user only has to load the extension with |\usepackage{nicematrix}|. % % % \medskip @@ -227,10 +227,10 @@ c & c & b & a & e % instead of |l|, |c| and |r|. It's possible to use the constructions % |w{...}{...}|, |W{...}{...}|\footnote{However, for the columns of type |w| and % |W|, the cells are composed in math mode (in the environments of -% \pkg{nicematrix}) whereas in |{array}| of \pkg{array}, they are composed in text mode.}, "|", -% |>{...}|, |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but the letters |p|, -% |m| and |b| should not be used. See p.~\pageref{NiceArray} the section -% relating to |{NiceArray}|. +% \pkg{nicematrix}) whereas in |{array}| of \pkg{array}, they are composed in +% text mode.}, "|", |>{...}|, |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but +% the letters |p|, |m| and |b| should not be used. See p.~\pageref{NiceArray} +% the section relating to |{NiceArray}|. % % % \section{The continuous dotted lines} @@ -550,10 +550,10 @@ c & c & b & a & e % \item The option |renew-dots|\par\nobreak % % With this option, the commands |\ldots|, |\cdots|, |\vdots|, |\ddots|, -% |\iddots|\footnotemark[\thefniddots] and |\hdotsfor| are redefined within the environments -% provided by \pkg{nicematrix} and behave like |\Ldots|, |\Cdots|, |\Vdots|, -% |\Ddots|, |\Iddots| and |\Hdotsfor|; the command |\dots| (``automatic dots'' -% of |amsmath|) is also redefined to behave like |\Ldots|. +% |\iddots|\footnotemark[\thefniddots] and |\hdotsfor| are redefined within the +% environments provided by \pkg{nicematrix} and behave like |\Ldots|, |\Cdots|, +% |\Vdots|, |\Ddots|, |\Iddots| and |\Hdotsfor|; the command |\dots| +% (``automatic dots'' of |amsmath|) is also redefined to behave like |\Ldots|. % % \item The option |renew-matrix|\par\nobreak % @@ -701,9 +701,8 @@ c & c & b & a & e % we have used the options |left-margin| and |right-margin|.\footnote{The % options |left-margin| and |right-margin| take dimensions as values but, if no % value is given, the default value is used, which is |\arraycolsep| (by -% default: 5~pt). There is -% also an option |margin| to fix both |left-margin| and |right-margin| to the -% same value.} +% default: 5~pt). There is also an option |margin| to fix both |left-margin| and +% |right-margin| to the same value.} % \[\begin{pNiceMatrix}[ % create-extra-nodes,left-margin,right-margin, % code-after = {\begin{tikzpicture} @@ -756,7 +755,8 @@ c & c & b & a & e % In this case, if we want a control over the height of the rows, we can add a % |\strut| in each row of the array. % \[\begin{pNiceMatrix}[ -% create-extra-nodes,left-margin,right-margin,extra-right-margin=3pt,extra-left-margin=3pt, +% create-extra-nodes,left-margin,right-margin,extra-right-margin=3pt, +% extra-left-margin=3pt, % code-after = {\begin{tikzpicture} % [every node/.style = {blend mode = multiply, % inner sep = -\pgflinewidth/2}, @@ -777,7 +777,8 @@ c & c & b & a & e % \end{pNiceMatrix}\] % % \bigskip -% We explain below how to fill the nodes created by \pkg{nicematrix} (cf. p. \pageref{highlight}). +% We explain below how to fill the nodes created by \pkg{nicematrix} (cf. p. +% \pageref{highlight}). % % \section{The code-after} % @@ -899,7 +900,8 @@ c & c & b & a & e % \bigskip % \section{The exterior row 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}. +% composition of exterior rows and columns in the environments of +% \pkg{nicematrix}. % \label{exterior} % % A potential first row has the number $0$ (and not $1$). Idem for the potential @@ -930,10 +932,10 @@ c & c & b & a & e % We have several remarks to do. % \begin{itemize} % \item For the environments with an explicit preamble (i.e. |{NiceArray}| and -% its variants), no letter must be given in the preamble for the potential first -% column and the potential last column: the first column will be automatically -% (and necessarily) of type |R| and the last column will be automatically of -% type |L|). +% its variants), no letter must be given in that preamble for the potential +% first column and the potential last column: the first column will be +% automatically (and necessarily) of type |R| and the last column will be +% automatically of % type |L|. % \item In an environment with an explicit preamble, the option |last-col| must % be used \emph{without} value: the number of columns will be automatically % computed from the preamble of the array. @@ -957,7 +959,7 @@ c & c & b & a & e % ~emphase#code-for-first-col@ = \color{blue}, % ~emphase#code-for-last-row@ = \color{green}, % ~emphase#code-for-last-col@ = \color{magenta}} -% $\begin{pNiceArray}{CC|CC}[first-row,last-row=5,first-col,last-col] +% $\begin{pNiceArray}{CC|CC}[first-row,last-row,first-col,last-col] % & C_1 & C_2 & C_3 & C_4 & \\ % L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ % L_2 & a_{21} & a_{22} & a_{23} & a_{24} & L_2 \\ @@ -973,7 +975,7 @@ c & c & b & a & e % code-for-first-col = \color{blue}, % code-for-last-row = \color{green}, % code-for-last-col = \color{magenta}} -% \[\begin{pNiceArray}{CC|CC}[first-row,last-row=5,first-col,last-col] +% \[\begin{pNiceArray}{CC|CC}[first-row,last-row,first-col,last-col] % & C_1 & \multicolumn1C{C_2} & C_3 & C_4 & \\ % L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ % L_2 & a_{21} & a_{22} & a_{23} & a_{24} & L_2 \\ @@ -997,10 +999,10 @@ c & c & b & a & e % the first and in the last row, he should use |!{\vline}| instead of \verb+|+ % in the preamble of the array.} % \item Logically, the potential option |columns-width| (described -% p.~\pageref{width}) doesn't apply to the ``first column'' and ``last column''. -% \item For technical reasons, it's not possible to use the option of the command |\\| -% after the ``first row'' or before the ``last row'' (the placement of the -% delimiters would be wrong). +% p.~\pageref{width}) doesn't apply to the ``first column'' and ``last column''. +% \item For technical reasons, it's not possible to use the option of the +% command |\\| after the ``first row'' or before the ``last row'' (the placement +% of the delimiters would be wrong). % \end{itemize} % % @@ -1051,8 +1053,10 @@ c & c & b & a & e % \end{NiceArray}\right)$ % % -% \bigskip -% These dotted lines do \emph{not} extend in the potential exterior rows and columns. +% \bigskip +% These dotted lines do \emph{not} extend in the potential exterior rows and +% columns. +% % % \medskip % \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] @@ -1152,9 +1156,9 @@ c & c & b & a & e % |\arraycolsep| equal to $0$~pt). % % \bigskip -% It's possible to give the value |auto| to the option |columns-width|: all the -% columns of the array will have a width equal to the widest cell of the -% array.\footnote{The result is achieved with only one compilation (but Tikz +% It's possible to give the special value |auto| to the option |columns-width|: +% all the columns of the array will have a width equal to the widest cell of +% the array.\footnote{The result is achieved with only one compilation (but Tikz % will have written informations in the |.aux| file and a message requiring a % second compilation will appear).}\par\nobreak % @@ -1173,8 +1177,8 @@ c & c & b & a & e % \end{pNiceMatrix}$ % % \bigskip -% It's possible to fix the width of the columns of all the matrices of a current -% scope with the command |\NiceMatrixOptions|.\par\nobreak +% Without surprise, it's possible to fix the width of the columns of all the +% matrices of a current scope with the command |\NiceMatrixOptions|.\par\nobreak % % \medskip % \begin{BVerbatim}[baseline=c,boxwidth=8.5cm] @@ -1243,7 +1247,9 @@ c & c & b & a & e % The command |\Block| must be used in the upper leftmost cell of the array with % two arguments. The first argument is the size of the block with the syntax % $i$\verb|-|$j$ where $i$ is the number of rows of the block and $j$ its number -% of columns. The second argument is the content of the block (composed in math mode). +% of columns. The second argument is the content of the block (composed in math +% mode). +% % % % \medskip @@ -1328,7 +1334,8 @@ c & c & b & a & e % \end{Verbatim} % % % \[\begin{bNiceArray}{CCCC|C}[small, last-col, -% code-for-last-col = \scriptscriptstyle, columns-width=3mm] +% code-for-last-col = \scriptscriptstyle, +% columns-width=3mm] % 1 & -2 & 3 & 4 & 5 \\ % 0 & 3 & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\ % 0 & 1 & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\ @@ -1338,8 +1345,8 @@ c & c & b & a & e % % \bigskip % One should note that the environment |{NiceMatrix}| with the option |small| is -% not composed \emph{exactly} as the environment |{smallmatrix}|. Indeed, all the -% environments of \pkg{nicematrix} are constructed upon |{array}| (of the +% not composed \emph{exactly} as the environment |{smallmatrix}|. Indeed, all +% the environments of \pkg{nicematrix} are constructed upon |{array}| (of the % extension \pkg{array}) whereas the environment |{smallmatrix}| is constructed % directly with an |\halign| of TeX. % @@ -1516,8 +1523,8 @@ c & c & b & a & e % % \label{empty-cells} % An instruction like |\Ldots|, |\Cdots|, etc. tries to determine the first -% non-empty cells on both sides. However, an empty cell is not necessarily a cell -% with no TeX content (that is to say a cell with no token between the two +% non-empty cells on both sides. However, an empty cell is not necessarily a +% cell with no TeX content (that is to say a cell with no token between the two % ampersands~|&|). Indeed, a cell with contents |\hspace*{1cm}| may be % considered as empty. % @@ -1558,25 +1565,24 @@ c & c & b & a & e % The environment |{array}| inserts an horizontal space equal to |\arraycolsep| % before and after each column. In particular, there is a space equal to % |\arraycolsep| before and after the array. This feature of the environment -% |{array}| was probably not a good idea.\footnote{In the documentation of +% |{array}| was probably not a good idea\footnote{In the documentation of % |{amsmath}|, we can read: {\itshape The extra space of |\arraycolsep| that % \pkg{array} adds on each side is a waste so we remove it [in |{matrix}|] % (perhaps we should instead remove it from array in general, but that's a % harder task).} It's possible to suppress these spaces for a given environment -% |{array}| with a construction like |\begin{array}{@{}ccccc@{}}|.} -% -% The environment |{matrix}| and its variants (|{pmatrix}|, |{vmatrix}|, etc.) -% of \pkg{amsmath} prefer to delete these spaces with explicit instructions -% |\hskip -\arraycolsep| and |{NiceArray}| does likewise. -% -% However, the user can change this behaviour with the boolean option -% |exterior-arraycolsep| of the command |\NiceMatrixOptions|. With this option, -% |{NiceArray}| will insert the same horizontal spaces as the environment -% |{array}|. -% -% This option is only for ``compatibility'' since the package \pkg{nicematrix} -% provides a more precise control with the options |left-margin|, -% |right-margin|, |extra-left-margin| and |extra-right-margin|. +% |{array}| with a construction like +% |\begin{array}{@{}ccccc@{}}...\end{array}|.}. +% The environment |{matrix}| of \pkg{amsmath} and its variants (|{pmatrix}|, +% |{vmatrix}|, etc.) of \pkg{amsmath} prefer to delete these spaces with +% explicit instructions |\hskip -\arraycolsep|. The extension \pkg{nicematrix} +% does the same in all its environments, |{NiceArray}| included. However, if the +% user wants the environment |{NiceArray}| behaving by default like the +% environment |{array}| of \pkg{array} (for example, when adapting an existing +% document) it's possible to control this behaviour with the option +% |exterior-arraycolsep|, set by the command |\NiceMatrixOptions|. With this +% option, exterior spaces of length |\arraycolsep| will be inserted in the +% environments |{NiceArray}| (the other environments of \pkg{nicematrix} are not +% affected). % % % \subsection{The class option draft} @@ -1591,7 +1597,9 @@ c & c & b & a & e % That's why, when the class option |draft| is used, the dotted lines are not % drawn, for a faster compilation. % -% \subsection{A technical problem with the argument of \textbackslash\textbackslash} +% \subsection{A technical problem with the argument of +% \textbackslash\textbackslash} +% % % For technical, reasons, if you use the optional argument of the command |\\|, % the vertical space added will also be added to the ``normal'' node @@ -1847,7 +1855,8 @@ c & c & b & a & e % \end{Verbatim} % % \arrayrulecolor{cyan} -% \[\begin{pNiceArray}{*6C|C}[nullify-dots,last-col,code-for-last-col={\scriptstyle}] +% \[\begin{pNiceArray}{*6C|C}[nullify-dots,last-col, +% code-for-last-col={\scriptstyle}] % 1 & 1 & 1 &\Cdots & & 1 & 0 & \\ % 0 & 1 & 0 &\Cdots & & 0 & & L_2 \gets L_2-L_1 \\ % 0 & 0 & 1 &\Ddots & & \Vdots & & L_3 \gets L_3-L_1 \\ @@ -1862,8 +1871,9 @@ c & c & b & a & e % % % \medskip -% In the following example, we use |{NiceMatrixBlock}| with the option |auto-columns-width| because -% we want the same automatic width for all the columns of the matrices. +% In the following example, we use |{NiceMatrixBlock}| with the option +% |auto-columns-width| because we want the same automatic width for all the +% columns of the matrices. % % \bigskip % \begin{BVerbatim} @@ -1952,7 +1962,8 @@ c & c & b & a & e % of the matrix (with the Tikz key ``|name suffix|'', it's easy to use the % ``large nodes''). % -% In order to have the continuity of the lines, we have to set |inner sep = -\pgflinewidth/2|. +% In order to have the continuity of the lines, we have to set +% |inner sep = -\pgflinewidth/2|. % % \begin{Verbatim} % $\begin{pNiceArray}{>{\strut}CCCC}% @@ -2032,8 +2043,9 @@ c & c & b & a & e % % % \bigskip -% This code fails with |latex|-|dvips|-|ps2pdf| because Tikz for |dvips|, as for now, doesn't support blend modes. However, the -% following code, in the preamble, should activate blend modes in this way of compilation. +% This code fails with |latex|-|dvips|-|ps2pdf| because Tikz for |dvips|, as for +% now, doesn't support blend modes. However, the following code, in the +% preamble, should activate blend modes in this way of compilation. % % % \begin{scope} \small @@ -2071,7 +2083,8 @@ c & c & b & a & e % \end{pNiceArray}\] % % \bigskip -% If we want to highlight each row of this matrix, we can use the previous technique three times. +% If we want to highlight each row of this matrix, we can use the previous +% technique three times. % % \begin{Verbatim} % \tikzset{myoptions/.style={remember picture, @@ -2117,7 +2130,8 @@ c & c & b & a & e % \end{pNiceArray}\] % % \medskip -% The result may seem disappointing. We can improve it by using the ``medium nodes'' instead of the ``normal nodes''. +% The result may seem disappointing. We can improve it by using the ``medium +% nodes'' instead of the ``normal nodes''. % % \begin{Verbatim} % \begin{tikzpicture}[myoptions, ~emphase#name suffix = -medium@] @@ -2149,7 +2163,8 @@ c & c & b & a & e % % \vspace{1cm} % -% In the following example, we use the ``large nodes'' to highlight a zone of the matrix.\par\nobreak +% In the following example, we use the ``large nodes'' to highlight a zone of +% the matrix.\par\nobreak % \begin{Verbatim} % \begin{pNiceArray}{>{\strut}CCCC}% % [create-extra-nodes,margin,extra-margin=2pt, @@ -2189,7 +2204,8 @@ c & c & b & a & e % % \subsection{Direct utilisation of the Tikz nodes} % -% In the following example, we illustrate the mathematical product of two matrices. +% In the following example, we illustrate the mathematical product of two +% matrices. % % \medskip % The utilisation of |{NiceMatrixBlock}| with the option |auto-columns-width| @@ -2210,7 +2226,8 @@ c & c & b & a & e % & % \end{Verbatim} % -% The matrix $B$ has a ``first row'' (for $C_j$) and that's why we use the key |first-row|. +% The matrix $B$ has a ``first row'' (for $C_j$) and that's why we use the key +% |first-row|. % \begin{Verbatim} % \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row] % & & C_j \\ @@ -2315,7 +2332,8 @@ c & c & b & a & e % 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} -% relies upon the fact that the package |{array}| uses |\ialign| to begin the |\halign|. +% 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 @@ -2323,9 +2341,10 @@ c & c & b & a & e % % \subsection{Declaration of the package and extensions loaded} % -% 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|} +% 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|} % % \begin{macrocode} %<@@=nm> @@ -2374,8 +2393,8 @@ c & c & b & a & e % \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_error:n { \msg_error:nn { nicematrix } } -\cs_new_protected:Npn \@@_error:nn { \msg_error:nn { nicematrix } } -\cs_new_protected:Npn \@@_error:nnn { \msg_error:nnn { nicematrix } } +\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { nicematrix } } +\cs_new_protected:Npn \@@_error:nnn { \msg_error:nnnn { nicematrix } } \cs_new_protected:Npn \@@_fatal:n { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \@@_fatal:nn { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { nicematrix } } @@ -2546,7 +2565,8 @@ 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 used. +% The default value is 0.34~pt but it will changed if the option |small| is +% used. % \begin{macrocode} \dim_new:N \l_@@_radius_dim \dim_set:Nn \l_@@_radius_dim { 0.53 pt } @@ -2699,20 +2719,21 @@ c & c & b & a & e % (|\group_begin:|--|\group_end:|) and we extract the two command names which % are in the toks |\@temptokena|. However, this extraction can be done only % when \pkg{siunitx} is loaded (and it may be loaded after \pkg{nicematrix}) -% and, in fact, after the beginning of the document --- because some instructions of -% \pkg{siunitx} are executed in a |\AtBeginDocument|). That's why this -% extraction will be done only at the first utilisation of an environment of -% \pkg{nicematrix} with the command |\@@_adapt_S_column:|. +% and, in fact, after the beginning of the document --- because some +% instructions of \pkg{siunitx} are executed in a |\AtBeginDocument|). That's +% why this extraction will be done only at the first utilisation of an +% environment of \pkg{nicematrix} with the command |\@@_adapt_S_column:|. % \begin{macrocode} \cs_set_protected:Npn \@@_adapt_S_column: { % \end{macrocode} % In the preamble of the LaTeX document, the boolean |\c_@@_siunitx_loaded_bool| -% won't be known. That's why we test the existence of |\c_@@_siunitx_loaded_bool| -% and not its value.\footnote{Indeed, \pkg{nicematrix} may be used -% in the preamble of the LaTeX document. For example, in this document, we compose a -% matrix in the box |\ExampleOne| before loading \pkg{arydshln} (because -% \pkg{arydshln} is not totally compatible with \pkg{nicematrix}).} +% won't be known. That's why we test the existence of +% |\c_@@_siunitx_loaded_bool| and not its value.\footnote{Indeed, +% \pkg{nicematrix} may be used in the preamble of the LaTeX document. For +% example, in this document, we compose a matrix in the box |\ExampleOne| before +% loading \pkg{arydshln} (because \pkg{arydshln} is not totally compatible with +% \pkg{nicematrix}).} % \begin{macrocode} \bool_if:NT \c_@@_siunitx_loaded_bool { @@ -2736,8 +2757,8 @@ c & c & b & a & e \tl_new:N \c_@@_table_print_tl \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } } % \end{macrocode} -% The token lists |\c_@@_table_collect_begin_tl| and |\c_@@_table_print_tl| contain -% now the two commands of \pkg{siunitx}. +% The token lists |\c_@@_table_collect_begin_tl| and |\c_@@_table_print_tl| +% contain now the two commands of \pkg{siunitx}. % % \smallskip % If the adaptation has been done, the command |\@@_adapt_S_column:| becomes @@ -3466,7 +3487,6 @@ c & c & b & a & e % \begin{macrocode} \cs_new_protected:Npn \@@_pre_array: { - \tl_clear:N \g_@@_code_after_tl % \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 @@ -3494,7 +3514,8 @@ c & c & b & a & e % \bigskip % The environment |{array}| uses internally the command |\ialign|. We change the % definition of |\ialign| for several reasons. In particular, |\ialign| sets -% |\everycr| to |{ }| and we \emph{need} to have to change the value of |\everycr|. +% |\everycr| to |{ }| and we \emph{need} to have to change the value of +% |\everycr|. % \begin{macrocode} \cs_set:Npn \ialign { @@ -3536,9 +3557,9 @@ c & c & b & a & e % \end{macrocode} % After its first utilisation, the definition of |\ialign| will revert % automatically to its default definition. With this programmation, we will -% have, in the cells of the array, a clean version of |\ialign|.\footnote{The user will -% probably not employ directly |\ialign| in the array... but more likely -% environments that utilize |\ialign| internally (e.g.: |{substack}|).} +% have, in the cells of the array, a clean version of |\ialign|.\footnote{The +% user will probably not employ directly |\ialign| in the array... but more +% likely environments that utilize |\ialign| internally (e.g.: |{substack}|).} % \begin{macrocode} \cs_set:Npn \ialign { @@ -3622,7 +3643,8 @@ c & c & b & a & e % \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 |\prg_do_nothing:|. +% redefinition of a column type. We must put |\relax| and not +% |\prg_do_nothing:|. % \begin{macrocode} \cs_set_eq:NN \NC@find@w \relax \cs_set_eq:NN \NC@find@W \relax @@ -3676,8 +3698,8 @@ c & c & b & a & e \int_gset_eq:NN \g_@@_last_vdotted_col_int \g_@@_col_int \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|. +% 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 } } } @@ -3785,7 +3807,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 common to |{NiceArrayWithDelims}| and +% |{NiceMatrix}|. % \begin{macrocode} \@@_pre_array: % \end{macrocode} @@ -3825,8 +3848,7 @@ c & c & b & a & e % % \medskip % The array will be composed in a box (named |\l_@@_the_array_box|) because we -% have to do manipulations concerning the potential exterior rows (such -% construction in a box is not possible for |{NiceMatrix}|). +% have to do manipulations concerning the potential exterior rows. % \begin{macrocode} \box_clear_new:N \l_@@_the_array_box % \end{macrocode} @@ -3855,8 +3877,8 @@ c & c & b & a & e } % \end{macrocode} % Here is the beginning of the box which will contain the array. The -% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the second part of -% the environment (and the closing |\c_math_toggle_token| also). +% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the second +% part of the environment (and the closing |\c_math_toggle_token| also). % \begin{macrocode} \hbox_set:Nw \l_@@_the_array_box \skip_horizontal:n \l_@@_left_margin_dim @@ -3875,9 +3897,9 @@ c & c & b & a & e % 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 potential -% commands |\@@_vdottedline:n|). +% 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|). % % \begin{macrocode} { @@ -3929,7 +3951,7 @@ c & c & b & a & e { & \omit -% \end{marocode} +% \end{macrocode} % The incrementation of the counter |\g_tmpa_int| must be done after the |\omit| % of the cell. % \begin{macrocode} @@ -4006,8 +4028,9 @@ c & c & b & a & e % \bigskip % Now, we begin the real construction in the output flow of TeX. First, we take % into account a potential ``first column'' (we remind that this ``first -% column'' has been constructed in an overlapping position and that we have computed -% its width in |\g_@@_width_first_col_dim|: see p.~\pageref{overlap-left}). +% column'' has been constructed in an overlapping position and that we have +% computed its width in |\g_@@_width_first_col_dim|: see +% p.~\pageref{overlap-left}). % \begin{macrocode} \int_compare:nNnT \l_@@_first_col_int = \c_zero_int { @@ -4028,7 +4051,7 @@ c & c & b & a & e \str_if_eq:VnTF \l_@@_pos_env_str { t } { \box_move_up:nn - { \l_tmpa_dim - \g_@@_ht_row_zero_dim + \g_@@_ht_row_one_dim } + { \l_tmpa_dim - \g_@@_ht_row_zero_dim + \g_@@_ht_row_one_dim } } } { @@ -4098,7 +4121,8 @@ c & c & b & a & e % % % \interitem -% Here is the preamble for the ``first column'' (if the user uses the key |first-col|) +% Here is the preamble for the ``first column'' (if the user uses the key +% |first-col|) % \begin{macrocode} \tl_const:Nn \c_@@_preamble_first_col_tl { @@ -4173,7 +4197,8 @@ c & c & b & a & e % \end{macrocode} % % -% Here is the preamble for the ``last column'' (if the user uses the key |last-col|). +% Here is the preamble for the ``last column'' (if the user uses the key +% |last-col|). % \begin{macrocode} \tl_const:Nn \c_@@_preamble_last_col_tl { @@ -4258,7 +4283,8 @@ c & c & b & a & e % \interitem % The environment |{NiceArray}| is constructed upon the environment % |{NiceArrayWithDelims}| but, in fact, there is a flag |\l_@@_NiceArray_bool|. -% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is raised. +% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is +% raised. % \begin{macrocode} \NewDocumentEnvironment { NiceArray } { } { @@ -4377,9 +4403,9 @@ c & c & b & a & e % \bigskip % \subsection{How to know whether a cell is ``empty''} % -% The conditionnal |\@@_if_not_empty_cell:nnT| tests whether a cell is empty. The -% first two arguments must be LaTeX3 counters for the row and the column of the -% considered cell. +% The conditionnal |\@@_if_not_empty_cell:nnT| tests whether a cell is empty. +% The first two arguments must be LaTeX3 counters for the row and the column of +% the considered cell. % \begin{macrocode} \prg_set_conditional:Npnn \@@_if_not_empty_cell:nn #1 #2 { T , TF } { @@ -4387,11 +4413,12 @@ c & c & b & a & e % First, we want to test whether the cell is in the virtual sequence of % ``non-empty'' cells. There are several important remarks: % \begin{itemize} -% \item we don't use a |expl3| sequence for efficiency ; +% \item we don't use a |expl3| sequence for efficiency; % \item the ``non-empty'' cells in this sequence are not, in fact, all the % non-empty cells of the array: on the contrary they are only cells declared % as non-empty for a special reason (as of now, there are only cells which are -% on a dotted line which is already drawn or which will be drawn ``just after'') ; +% on a dotted line which is already drawn or which will be drawn ``just +% after''); % \item the flag |\l_tmpa_bool| will be raised when the cell is actually on % this virtual sequence. % \end{itemize} @@ -4673,8 +4700,8 @@ c & c & b & a & e % coordinates of one extremity of the line; % \item |\l_@@_final_i_int| and |\l_@@_final_j_int| which are the coordinates of % the other extremity of the line; -% \item |\l_@@_initial_open_bool| and |\l_@@_final_open_bool| to indicate whether -% the extremities are open or not. +% \item |\l_@@_initial_open_bool| and |\l_@@_final_open_bool| to indicate +% whether the extremities are open or not. % \end{itemize} % % \begin{macrocode} @@ -5219,10 +5246,12 @@ c & c & b & a & e % \bigskip % \subsection{The actual instructions for drawing the dotted line with Tikz} % -% The command |\@@_draw_tikz_line:| draws the line using four implicit arguments: +% The command |\@@_draw_tikz_line:| draws the line using four implicit +% arguments: % -% \quad |\g_@@_x_initial_dim|, |\g_@@_y_initial_dim|, |\g_@@_x_final_dim| and |\g_@@_y_final_dim|. -% These variables are global for technical reasons: their first affectation was in an instruction |\tikz|. +% \quad |\g_@@_x_initial_dim|, |\g_@@_y_initial_dim|, |\g_@@_x_final_dim| and +% |\g_@@_y_final_dim|. These variables are global for technical reasons: their +% first affectation was in an instruction |\tikz|. % % \begin{macrocode} \cs_new_protected:Nn \@@_draw_tikz_line: @@ -5578,21 +5607,30 @@ c & c & b & a & e \dim_zero_new:N \g_@@_y_final_dim \bool_set_false:N \l_@@_initial_open_bool \bool_set_false:N \l_@@_final_open_bool - \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: + \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 } } } % \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 +% this command because they have to do other settings (for example, the diagonal % lines must be parallelized). % % \bigskip @@ -5608,20 +5646,16 @@ c & c & b & a & e % We want the horizontal lines at the same position\footnote{In fact, almost the % same position because of the width of the line: the width of a dotted line is % not the same as the width of a line created by |\hline|.} as the line created -% by |\hline| (or |\hdashline| of \pkg{arydshln}). To this end, we construct a -% ``false row'' and, in this row, we create a Tikz node (|\coordinate|) that -% will be used to have the $y$-value of the line. -% -% \begin{macrocode} -\cs_generate_variant:Nn \dim_set:Nn { N v } -% \end{macrocode} +% by |\hline| (or |\hdashline| of \pkg{arydshln}). That's why we use a +% |\noalign| to insert a box with a |\dotfill|. % % +% % \medskip -% Some extensions, like the extension \pkg{doc}, do a redefinition of the command -% |\dotfill| of LaTeX. That's why we define a command |\@@_dotfill:| as we wish. -% We test whether we are in draft mode because, in this case, we don't draw the -% dotted lines. +% Some extensions, like the extension \pkg{doc}, do a redefinition of the +% command |\dotfill| of LaTeX. That's why we define a command |\@@_dotfill:| as +% we wish. We test whether we are in draft mode because, in this case, we don't +% draw the dotted lines. % \begin{macrocode} \bool_if:NTF \c_@@_draft_bool { \cs_set_eq:NN \@@_dotfill: \prg_do_nothing: } @@ -5646,7 +5680,6 @@ c & c & b & a & e \c_math_toggle_token } \hfill - \skip_horizontal:n \c_zero_dim } } % \end{macrocode} @@ -5659,10 +5692,19 @@ c & c & b & a & e { \bool_gset_true:N \g_@@_extra_nodes_bool \cs_if_exist:cTF { @@_width_ \int_use:N \g_@@_env_int } - { \dim_set:Nv \l_tmpa_dim { @@_width_ \int_use:N \g_@@_env_int } } + { \dim_set_eq:Nc \l_tmpa_dim { @@_width_ \int_use:N \g_@@_env_int } } { \dim_set:Nn \l_tmpa_dim { 5 mm } } \hbox_overlap_right:n - { + { + \bool_if:nT + { + \l_@@_NiceArray_bool + && + ! \l_@@_exterior_arraycolsep_bool + && + \int_compare_p:nNn \l_@@_first_col_int > \c_zero_int + } + { \skip_horizontal:n { - \arraycolsep } } \hbox_to_wd:nn { \l_tmpa_dim + 2 \arraycolsep @@ -5695,7 +5737,8 @@ 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''. +% 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 @@ -5769,8 +5812,8 @@ c & c & b & a & e % preamble. % % Here is the definition of |\@@_vline:|. This definition \emph{must} be -% protected because you don't want that macro expanded during the construction of -% the preamble (the tests must be effective in each row and not once when the +% protected because you don't want that macro expanded during the construction +% of the preamble (the tests must be effective in each row and not once when the % preamble is constructed). % \begin{macrocode} \cs_new_protected:Npn \@@_vline: @@ -5999,8 +6042,9 @@ 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 for the rows. +% 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 +% for the rows. % \begin{macrocode} \int_set:Nn \l_@@_first_row_int 1 \int_set:Nn \l_@@_first_col_int 1 @@ -6189,11 +6233,11 @@ c & c & b & a & e % has no direct link with the environment |{NiceMatrixBlock}|. % % The following command will be linked to |\Block| in the environments of -% \pkg{nicematrix}. We define it with |\NewExpandableDocumentCommand| of \pkg{xparse} -% because it has an optionnal argument between |<| and |>| (for TeX instructions -% put before the math mode of the label) and because it must be expandable since -% it reduces (in the case of a block of only one row) to a command -% |\multicolumn|. +% \pkg{nicematrix}. We define it with |\NewExpandableDocumentCommand| of +% \pkg{xparse} because it has an optionnal argument between |<| and |>| (for TeX +% instructions put before the math mode of the label) and because it must be +% expandable since it reduces (in the case of a block of only one row) to a +% command |\multicolumn|. % \begin{macrocode} \NewExpandableDocumentCommand \@@_Block: { m D < > { } m } { @@ -6202,8 +6246,8 @@ c & c & b & a & e % \end{macrocode} % % \medskip -% The first argument of |\@@_Block:| (which is required) has a special syntax. It -% must be of the form $i$|-|$j$ where $i$ and $j$ are the size (in rows and +% The first argument of |\@@_Block:| (which is required) has a special syntax. +% It must be of the form $i$|-|$j$ where $i$ and $j$ are the size (in rows and % columns) of the block. % \begin{macrocode} \cs_new:Npn \@@_Block_i #1-#2 \q_stop @@ -6238,7 +6282,8 @@ c & c & b & a & e % \end{macrocode} % % \medskip -% The command |\@@_Block_iii:nnnn| is for the case of a block of $n$~rows with $n>1$. +% The command |\@@_Block_iii:nnnn| is for the case of a block of $n$~rows with +% $n>1$. % \begin{macrocode} \cs_new_protected:Npn \@@_Block_iii:nnnn #1 #2 #3 #4 { @@ -6264,8 +6309,8 @@ c & c & b & a & e % % \medskip % The command |\@@_gobble_ampersands:n| will gobble $n$ ampersands (and also the -% spaces) where $n$ is the argument of the command. This command is fully expandable -% and we need this feature. +% spaces) where $n$ is the argument of the command. This command is fully +% expandable and we need this feature. % \begin{macrocode} \group_begin: \char_set_catcode_letter:N \& @@ -6362,6 +6407,17 @@ c & c & b & a & e % % \subsection{Error messages of the package} % +% +% \begin{macrocode} +\@@_msg_new:nn { unknown~cell~for~line~in~code-after } + { + Your~command~\token_to_str:N\line\{#1\}\{#2\}~in~the~'code-after'~ + can't~be~executed~because~a~Tikz~node~doesn't~exist.\\ + If~you~go~on~this~command~will~be~ignored. + } +% \end{macrocode} +% +% % \begin{macrocode} \@@_msg_new:nn { last-col~non~empty~for~NiceArray } { @@ -6420,8 +6476,7 @@ c & c & b & a & e % \begin{macrocode} \@@_msg_new:nn { Yet~in~env } { - Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~ - nested.\\ + Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~nested.\\ This~error~is~fatal. } % \end{macrocode} @@ -6902,7 +6957,8 @@ c & c & b & a & e % Following a discussion on TeX StackExchange\footnote{cf. % |tex.stackexchange.com/questions/510841/nicematrix-and-tikz-external-optimize|}, % optimization of Tikz externalization is disabled in the environments of -% \pkg{nicematrix} when the class \cls{standalone} or the package \pkg{standalone} is used. +% \pkg{nicematrix} when the class \cls{standalone} or the package +% \pkg{standalone} is used. % % % diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index 9647cf9f4b5..8365b0e24c7 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.4} -\def\myfiledate{2019/10/05} +\def\myfileversion{3.5} +\def\myfiledate{2019/10/13} \RequirePackage{tikz} \usetikzlibrary{fit} \RequirePackage{expl3}[2019/02/15] @@ -37,8 +37,8 @@ \RequirePackage { amsmath } \RequirePackage { xparse } [ 2018-10-17 ] \cs_new_protected:Npn \__nm_error:n { \msg_error:nn { nicematrix } } -\cs_new_protected:Npn \__nm_error:nn { \msg_error:nn { nicematrix } } -\cs_new_protected:Npn \__nm_error:nnn { \msg_error:nnn { nicematrix } } +\cs_new_protected:Npn \__nm_error:nn { \msg_error:nnn { nicematrix } } +\cs_new_protected:Npn \__nm_error:nnn { \msg_error:nnnn { nicematrix } } \cs_new_protected:Npn \__nm_fatal:n { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \__nm_fatal:nn { \msg_fatal:nn { nicematrix } } \cs_new_protected:Npn \__nm_msg_new:nn { \msg_new:nnn { nicematrix } } @@ -473,7 +473,6 @@ } \cs_new_protected:Npn \__nm_pre_array: { - \tl_clear:N \g__nm_code_after_tl \bool_if:NT \l__nm_small_bool { \cs_set:Npn \arraystretch { 0.47 } @@ -761,7 +760,7 @@ \str_if_eq:VnTF \l__nm_pos_env_str { t } { \box_move_up:nn - { \l_tmpa_dim - \g__nm_ht_row_zero_dim + \g__nm_ht_row_one_dim } + { \l_tmpa_dim - \g__nm_ht_row_zero_dim + \g__nm_ht_row_one_dim } } } { @@ -1726,18 +1725,26 @@ \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 - \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: + \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 } } } -\cs_generate_variant:Nn \dim_set:Nn { N v } \bool_if:NTF \c__nm_draft_bool { \cs_set_eq:NN \__nm_dotfill: \prg_do_nothing: } { @@ -1755,7 +1762,6 @@ \c_math_toggle_token } \hfill - \skip_horizontal:n \c_zero_dim } } \cs_new:Npn \__nm_hdottedline: @@ -1764,10 +1770,19 @@ { \bool_gset_true:N \g__nm_extra_nodes_bool \cs_if_exist:cTF { __nm_width_ \int_use:N \g__nm_env_int } - { \dim_set:Nv \l_tmpa_dim { __nm_width_ \int_use:N \g__nm_env_int } } + { \dim_set_eq:Nc \l_tmpa_dim { __nm_width_ \int_use:N \g__nm_env_int } } { \dim_set:Nn \l_tmpa_dim { 5 mm } } \hbox_overlap_right:n { + \bool_if:nT + { + \l__nm_NiceArray_bool + && + ! \l__nm_exterior_arraycolsep_bool + && + \int_compare_p:nNn \l__nm_first_col_int > \c_zero_int + } + { \skip_horizontal:n { - \arraycolsep } } \hbox_to_wd:nn { \l_tmpa_dim + 2 \arraycolsep @@ -2171,6 +2186,12 @@ transparent .value_forbidden:n = true, } \ProcessKeysOptions { NiceMatrix / Package } +\__nm_msg_new:nn { unknown~cell~for~line~in~code-after } + { + Your~command~\token_to_str:N\line\{#1\}\{#2\}~in~the~'code-after'~ + can't~be~executed~because~a~Tikz~node~doesn't~exist.\\ + If~you~go~on~this~command~will~be~ignored. + } \__nm_msg_new:nn { last-col~non~empty~for~NiceArray } { In~the~environment~\{\g__nm_type_env_str\},~you~must~use~the~option~ @@ -2209,8 +2230,7 @@ { 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.\\ + Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~nested.\\ This~error~is~fatal. } \__nm_msg_new:nn { Outside~math~mode } |