diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-03 21:11:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-03 21:11:59 +0000 |
commit | 253ee34e8aebfb8731d657b1fa4ef2c22f9e7f52 (patch) | |
tree | 9cf89df92efa7cf9f4ec184bbe44c120d65a2b9c /Master/texmf-dist | |
parent | 1ebdcbffb0e852f50e0dc8f4dfcadee48c11e105 (diff) |
nicematrix (3sep20)
git-svn-id: svn://tug.org/texlive/trunk@56256 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf | bin | 421955 -> 420416 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex | 111 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf | bin | 1016556 -> 1024124 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 432 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 248 |
5 files changed, 582 insertions, 209 deletions
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 bddd1a53c0e..1b03c3ddec3 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 7ea4ab69f85..ede56a3b74a 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex @@ -123,7 +123,7 @@ classique |latex|-|dvips|-|ps2pdf| (ou Adobe Distiller). \bigskip Cette extension nécessite et charge les extensions \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{amsmath} et \pkg{pgfcore} ainsi que le module \pkg{shapes} de \textsc{pgf} (l'extension \pkg{tikz}, qui est une surcouche de -\textsc{pgf} n'est \emph{pas} chargée). L'utilisateur final n'a qu'à charger l'extension \pkg{nicematrix} avec +\textsc{pgf}, n'est \emph{pas} chargée). L'utilisateur final n'a qu'à charger l'extension \pkg{nicematrix} avec l'instruction habituelle : |\usepackage{nicematrix}|. @@ -368,7 +368,7 @@ u_n & 1 & 2 & 4 & 8 & 16 & 32 \\ \bigskip -\colorbox{yellow!50}{\textbf{Nouveau 5.2}}\enskip On peut aussi utiliser la clé +\colorbox{yellow!30}{\textbf{Nouveau 5.2}}\enskip On peut aussi utiliser la clé |baseline| pour aligner une matrice sur un filet horizontal (tracé par |\hline|). On doit pour cela donner la valeur |line-|\textsl{i} où \textsl{i} est le numéro de la rangée qui suit ce filet horizontal. @@ -476,6 +476,9 @@ Rang & 1A & 1B & 1C & 2A & 2B & 2C \\ \end{NiceTabular} \end{center} +\interitem +\colorbox{yellow!50}{\textbf{Nouveau 5.3}}\enskip La commande |\Block| accepte +les options |l|, |c| et |r| pour le placement horizontal. \interitem On peut aussi utiliser la commande |\Block| dans des matrices mathématiques. @@ -561,7 +564,7 @@ Marie & Pauline \\ \hline \bigskip -\colorbox{yellow!50}{\textbf{Nouveau 5.2}}\enskip En revanche, les filets +\colorbox{yellow!30}{\textbf{Nouveau 5.2}}\enskip En revanche, les filets verticaux ne sont pas tracés à l'intérieur des blocs. @@ -807,7 +810,7 @@ Comme on le voit, un «coin vide» est constitué de la réunion de tous les rectangles vides partant de la case située exactement dans le coin. \bigskip -\colorbox{yellow!50}{\textbf{Nouveau 5.2}}\enskip On peut passer en argument de +\colorbox{yellow!30}{\textbf{Nouveau 5.2}}\enskip On peut passer en argument de |\hvlines-except-corners| une liste de coins à prendre en considération. Les coins étant désignés par |NW|, |SW|, |NE| et |SE| (\emph{north west}, \emph{south west}, \emph{north east} et \emph{south east}). @@ -1132,8 +1135,8 @@ Estelle & 15 \end{scope} \bigskip -\colorbox{yellow!50}{\textbf{Nouveau 5.2}}\enskip Il existe une option |respect-blocks| -pour la commande |\rowcolor|. Avec cette option, les ``rangées'' colorées +\colorbox{yellow!30}{\textbf{Nouveau 5.2}}\enskip Il existe une option |respect-blocks| +pour la commande |\rowcolors|. Avec cette option, les ``rangées'' colorées alternativement peuvent s'étendre sur plusieurs rangées réelles du tableau pour englober les blocs. @@ -1141,30 +1144,32 @@ englober les blocs. \begin{scope} \hfuzz=10cm \begin{BVerbatim}[baseline=c,boxwidth=9cm] -\begin{NiceTabular}{cr}[hvlines,code-before = +\begin{NiceTabular}{lr}[hvlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@] -\Block{2-1}{Pierre} & 12 \\ - & 13 \\ +\Block[l]{2-1}{Pierre} & 12 \\ + & 13 \\ Jacques & 8 \\ -\Block{3-1}{Stéphanie} & 18 \\ - & 17 \\ - & 15 \\ +\hphantom{Stéphanie} +\Block[l]{3-1}{Stéphanie} & 18 \\ + & 17 \\ + & 15 \\ Amélie & 20 \\ Henri & 14 \\ -\Block{2-1}{Estelle} & 15 \\ - & 19 +\Block[l]{2-1}{Estelle} & 15 \\ + & 19 \end{NiceTabular} \end{BVerbatim} -\begin{NiceTabular}{cr}[hvlines,code-before = \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] -\Block{2-1}{Pierre} & 12 \\ +\begin{NiceTabular}{lr}[hvlines,code-before = \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] +\Block[l]{2-1}{Pierre} & 12 \\ & 13 \\ Jacques & 8 \\ -\Block{3-1}{Stéphanie} & 18 \\ +\hphantom{Stéphanie} +\Block[l]{3-1}{Stéphanie} & 18 \\ & 17 \\ & 15 \\ Amélie & 20 \\ Henri & 14 \\ -\Block{2-1}{Estelle} & 15 \\ +\Block[l]{2-1}{Estelle} & 15 \\ & 19 \end{NiceTabular} \end{scope} @@ -1210,7 +1215,7 @@ On remarquera que ces commandes sont compatibles avec les commandes de \begin{NiceTabular}{lSSSS}% [code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}] ~emphase#\toprule@ -\Block{2-1}{Produit} \\ +\Block{2-1}{Produit} & \Block{1-3}{dimensions (cm)} & & & \Block{2-1}{\rotate Prix} \\ ~emphase#\cmidrule(rl){2-4}@ @@ -1259,14 +1264,15 @@ On a alors accès aux trois commandes suivantes : \item |\rowcolor| à utiliser dans une case et qui colorie le reste de la rangée ; \item |\columncolor| à utiliser dans le préambule de la même manière que la -commande éponyme de \pkg{colortbl}\footnote{Contrairement à la commande +commande éponyme de \pkg{colortbl} (néanmoins, contrairement à la commande |\columncolor| de \pkg{colortbl}, celle-ci peut apparaître à l'intérieur d'une -autre commande, elle-même utilisée dans le préambule.}. +autre commande, elle-même utilisée dans le préambule). \end{itemize} \medskip \begin{Verbatim} -\begin{NiceTabular}[colortbl-like]{*{2}{>{~emphase#\columncolor{blue!15}@}c}c} +\NewDocumentCommand { \Blue } { } { ~emphase#\columncolor{blue!15}@ } +\begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} \toprule ~emphase#\rowcolor{red!15}@ Nom & Prénom & Année de naissance \\ @@ -1281,7 +1287,8 @@ Dupont & Chantal & 15 janvier 1998 \\ \begin{center} -\begin{NiceTabular}[colortbl-like]{*{2}{>{\columncolor{blue!15}}c}c} +\NewDocumentCommand { \Blue } { } { \columncolor{blue!15} } +\begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} \toprule \rowcolor{red!15} Nom & Prénom & Année de naissance \\ @@ -1301,8 +1308,8 @@ Chacune de ces instructions |\cellcolor|, |\rowcolor| ou |\columncolor| (utilisée hors du |code-before|) produit une instruction |fill| (codée |f|) dans le \textsc{pdf} final. En cas de juxtaposition de rectangles de même couleur, une fine ligne blanche peut donc apparaître dans certains lecteurs de -\textsc{pdf}\footnote{Par exemple SumatraPDF v3.1.2, qui utilise MuPDF de Artifex - Software, dont le moteur de rendu \textsc{pdf} est appelé Fitz.} (entre les +\textsc{pdf}\footnote{Par exemple SumatraPDF, qui utilise MuPDF de Artifex + Software, ou PDF.js utilisé par Firefox.} (entre les deux premières colonnes dans l'exemple ci-dessus). Pour éviter cela, il convient d'utiliser les outils proposés dans le |code-before|. C'est ce que l'on fait dans le codage qui suit. @@ -1923,14 +1930,15 @@ C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] & & C[a_n^{(p)},a_1^{(p)}] & \Cdots \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}|, etc. En fait, cette option est un -alias pour la conjonction de deux options : |renew-dots| et +Si on a un document déjà tapé qui contient un grand nombre de matrices avec des +points de suspension, on peut souhaiter utiliser les lignes pointillées de +\pkg{nicematrix} sans avoir à modifier chaque matrice. Pour cela, +\pkg{nicematrix} propose 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 option - du |\usepackage| (ce sont les trois seules).} + |renew-dots|, |renew-matrix| peuvent être fixées avec la commande + |\NiceMatrixOptions|, mais elles peuvent aussi être passées en option du + |\usepackage|. Remarquons que la clé |transparent| est un alias, considéré + comme obsolète, pour la conjonction des clés |renew-dots| et |renew-matrix|.} \smallskip @@ -1951,14 +1959,14 @@ Avec cette option, l'environnement |{matrix}| est redéfini et se comporte comme \end{itemize} \bigskip -Par conséquent, avec l'option |transparent|, un code classique donne directement +Par conséquent, avec les options |renew-dots| et |renew-matrix|, un code classique donne directement le résultat fourni par \pkg{nicematrix}.\par\nobreak \bigskip \begin{scope} -\NiceMatrixOptions{transparent} +\NiceMatrixOptions{renew-dots,renew-matrix} \begin{BVerbatim}[baseline=c,boxwidth=10cm] -~emphase#\NiceMatrixOptions{transparent}@ +~emphase#\NiceMatrixOptions{renew-dots,renew-matrix}@ \begin{pmatrix} 1 & \cdots & \cdots & 1 \\ 0 & \ddots & & \vdots \\ @@ -2404,7 +2412,7 @@ séparés par des virgules quand on utilise plusieurs commandes |\tabularnote| successivement. Le marqueur |#1| est censé correspondre à un nom de compteur LaTeX. -Valeur initiale : |\emph{\alph{#1}}| +Valeur initiale : |\textit{\alph{#1}}| Une autre valeur possible pourrait être tout simplement |\arabic{#1}| @@ -2490,12 +2498,13 @@ Pour un exemple de personnalisation des notes de tableau, voir p.~\pageref{ex:no \subsection{Utilisation de \{NiceTabular\} avec threeparttable} -Si vous souhaitez utiliser l'environnement |{NiceTabular}| dans un environnement -|{threeparttable}| de l'extension éponyme, vous devez patcher l'environnement -|{threeparttable}| avec le code suivant. +Si vous souhaitez utiliser l'environnement |{NiceTabular}| ou |{NiceTAbular*}| +dans un environnement |{threeparttable}| de l'extension éponyme, vous devez +patcher |{threeparttable}| avec le code suivant. \begin{Verbatim}[commandchars=\~\#\!] \makeatletter -\AtBeginEnvironment{threeparttable}{\TPT@hookin{NiceTabular}} +\AtBeginEnvironment{threeparttable} + {\TPT@hookin{NiceTabular}\TPT@hookin{NiceTabular*}} \makeatother \end{Verbatim} @@ -3204,7 +3213,7 @@ L'extension \pkg{nicematrix} fournit deux variables internes mais publiques\foot publique alors que toute variable dont le nom débute par |\g__nicematrix| ou par |\l__nicematrix| est privée.} : \begin{itemize} -\item \colorbox{yellow!50}{\textbf{Nouveau 5.2}}\enskip |\g_nicematrix_code_before_tl| ; +\item \colorbox{yellow!30}{\textbf{Nouveau 5.2}}\enskip |\g_nicematrix_code_before_tl| ; \item |\g_nicematrix_code_after_tl|. \end{itemize} @@ -3421,10 +3430,14 @@ a+b & \Ddots & & \Vdots \\ a+b & \Cdots & a+b & 1 \end{pNiceMatrix}$ - - \end{scope} +\bigskip +\colorbox{yellow!50}{\textbf{Nouveau 5.3}}\enskip On peut choisir l'instruction + |\Ddots| qui sera tracée en premier (et qui servira pour tracer les suivantes + quand la parallélisation est activée) avec la clé |draw-first| : + |\Ddots[draw-first]|. + \subsection{Les cases «vides»} \label{empty-cells} @@ -4268,12 +4281,24 @@ L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\ \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ; \end{tikzpicture} + +\newpage + \section*{Autre documentation} Le document |nicematrix.pdf| (fourni avec l'extension \pkg{nicematrix}) contient une traduction anglaise de la documentation ici présente, ainsi que le code source commenté et un historique des versions. +\bigskip +Les versions successives du fichier |nicematrix.sty| fournies par +TeXLive sont disponibles sur le serveur \textsc{svn} de TeXLive : + +{ +\small +\url{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} +} + \end{document} % Local Variables: diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf Binary files differindex ebefac27a86..9743eb335d7 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 10e84b7b070..03a6705cd39 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{5.2} -\def\myfiledate{2020/08/19} +\def\myfileversion{5.3} +\def\myfiledate{2020/09/03} % % %<*batchfile> @@ -409,7 +409,7 @@ version 2005/12/01 or later. % \end{minipage} % % \bigskip -% \colorbox{yellow!50}{\textbf{New 5.2}}\enskip It's also possible to use the +% \colorbox{yellow!30}{\textbf{New 5.2}}\enskip It's also possible to use the % key |baseline| to align a matrix on an horizontal rule (drawn by |\hline|). In % this aim, one should give the value |line-|\textsl{i} where \textsl{i} is the % number of the row following the horizontal rule. @@ -518,6 +518,11 @@ version 2005/12/01 or later. % \end{center} % % +% \interitem +% \colorbox{yellow!50}{\textbf{New 5.3}}\enskip +% +% It's possible to use with the command |\Block| the options |l|, |r| and |c| +% for the horizontal positionning. % % % \interitem @@ -603,7 +608,7 @@ version 2005/12/01 or later. % % % \bigskip -% \colorbox{yellow!50}{\textbf{New 5.2}}\enskip However, the vertical rules are +% \colorbox{yellow!30}{\textbf{New 5.2}}\enskip However, the vertical rules are % not drawn in the blocks. % % \bigskip @@ -837,7 +842,7 @@ version 2005/12/01 or later. % rectangles starting from the cell actually in the corner of the array. % % \bigskip -% \colorbox{yellow!50}{\textbf{New 5.2}}\enskip It's possible to give as value to the +% \colorbox{yellow!30}{\textbf{New 5.2}}\enskip It's possible to give as value to the % key |\hvlines-except-corners| a list of the corners to take into % consideration. The corners are designed by |NW|, |SW|, |NE| and |SE| % (\emph{north west}, \emph{south west}, \emph{north east} and \emph{south @@ -1155,38 +1160,38 @@ version 2005/12/01 or later. % \end{scope} % % \bigskip -% \colorbox{yellow!50}{\textbf{New 5.2}}\enskip There is a key |respect-blocks| -% for the instruction |\rowcolor|. With that key, the ``rows'' alternately +% \colorbox{yellow!30}{\textbf{New 5.2}}\enskip There is a key |respect-blocks| +% for the instruction |\rowcolors|. With that key, the ``rows'' alternately % colored may extend over several row if they have to incorporate blocks. % % \medskip % \begin{scope} % \hfuzz=10cm % \begin{BVerbatim}[baseline=c,boxwidth=9cm] -% \begin{NiceTabular}{cr}[hvlines,code-before = +% \begin{NiceTabular}{lr}[hvlines,code-before = % ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@] -% \Block{2-1}{John} & 12 \\ +% \Block[l]{2-1}{John} & 12 \\ % & 13 \\ % Stephen & 8 \\ -% \Block{3-1}{Sarah} & 18 \\ +% \Block[l]{3-1}{Sarah} & 18 \\ % & 17 \\ % & 15 \\ % Ashley & 20 \\ % Henry & 14 \\ -% \Block{2-1}{Madison} & 15 \\ +% \Block[l]{2-1}{Madison} & 15 \\ % & 19 % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{cr}[hvlines,code-before = \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] -% \Block{2-1}{John} & 12 \\ +% \begin{NiceTabular}{lr}[hvlines,code-before = \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] +% \Block[l]{2-1}{John} & 12 \\ % & 13 \\ % Stephen & 8 \\ -% \Block{3-1}{Sarah} & 18 \\ +% \Block[l]{3-1}{Sarah} & 18 \\ % & 17 \\ % & 15 \\ % Ashley & 20 \\ % Henry & 14 \\ -% \Block{2-1}{Madison} & 15 \\ +% \Block[l]{2-1}{Madison} & 15 \\ % & 19 % \end{NiceTabular} % \end{scope} @@ -1230,7 +1235,7 @@ version 2005/12/01 or later. % \begin{NiceTabular}[c]{lSSSS}% % [code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}] % ~emphase#\toprule@ -% \Block{2-1}{Product} \\ +% \Block{2-1}{Product} & % \Block{1-3}{dimensions (cm)} & & & % \Block{2-1}{\rotate Price} \\ % ~emphase#\cmidrule(rl){2-4}@ @@ -1280,14 +1285,15 @@ version 2005/12/01 or later. % the row; % \item |\columncolor| which must be used in the preamble of the environment % with the same syntax as the corresponding command of -% \pkg{colortbl}\footnote{Unlike the command |\columncolor| of \pkg{colortbl}, +% \pkg{colortbl} (however, unlike the command |\columncolor| of \pkg{colortbl}, % this command |\columncolor| can appear within another command, itself used in the -% preamble.}. +% preamble). % \end{itemize} % % \medskip % \begin{Verbatim} -% \begin{NiceTabular}[colortbl-like]{*{2}{>{~emphase#\columncolor{blue!15}@}c}c} +% \NewDocumentCommand { \Blue } { } { ~emphase#\columncolor{blue!15}@ } +% \begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} % \toprule % ~emphase#\rowcolor{red!15}@ % Last name & First name & Birth day \\ @@ -1302,7 +1308,8 @@ version 2005/12/01 or later. % % % \begin{center} -% \begin{NiceTabular}[colortbl-like]{*{2}{>{\columncolor{blue!15}}c}c} +% \NewDocumentCommand { \Blue } { } { \columncolor{blue!15} } +% \begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} % \toprule % \rowcolor{red!15} % Last name & First name & Birth day \\ @@ -1319,8 +1326,8 @@ version 2005/12/01 or later. % Each instruction |\cellcolor|, |\rowcolor| or |\columncolor| will generate an % instruction |fill| (coded~|f|) in the resulting \textsc{pdf}. In cases of % juxtaposed colored rectangles, one may have a thin white color line in some -% \textsc{pdf} viewers\footnote{For example SumatraPDF v3.1.2, which uses MuPDF -% of Artifex Software, whose \textsc{pdf} renderer is called Fitz.} (between the +% \textsc{pdf} viewers\footnote{For example SumatraPDF, which uses MuPDF +% of Artifex Software, or PDF.js used by Firefox.} (between the % two first columns in the above example). In you want to avoid this problem, % you should use the tools in the |code-before|. That's what we do with the % following code. @@ -1931,15 +1938,15 @@ version 2005/12/01 or later. % % \subsection{How to generate the continuous dotted lines transparently} % -% The package \pkg{nicematrix} provides an option called |transparent| for using -% existing code transparently in the environments of the \pkg{amsmath} : -% |{matrix}|, |{pmatrix}|, |{bmatrix}|, etc. In fact, this -% option is an alias for the conjonction of two options: +% Imagine you have a document with a great number of mathematical matrices with +% ellipsis. You may wish to use the dotted lines of \pkg{nicematrix} without +% having to modify the code of each matrix. It's possible with the keys. % |renew-dots| and |renew-matrix|.\footnote{The options |renew-dots|, -% |renew-matrix| and |transparent| can be fixed with the command +% |renew-matrix| can be fixed with the command % |\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.)} +% as options of the command |\usepackage|. There is also a key |transparent| +% which is an alias for the conjonction of |renew-dots| and |renew-matrix| but it +% must be considered as obsolete.} % % \smallskip % @@ -1959,14 +1966,14 @@ version 2005/12/01 or later. % \end{itemize} % % \bigskip -% Therefore, with the option |transparent|, a classical code gives directly the -% ouput of \pkg{nicematrix}.\par\nobreak +% Therefore, with the keys |renew-dots| and |renew-matrix|, a classical code +% gives directly the ouput of \pkg{nicematrix}.\par\nobreak % % \bigskip % \begin{scope} -% \NiceMatrixOptions{transparent} +% \NiceMatrixOptions{renew-dots,renew-matrix} % \begin{BVerbatim}[baseline=c,boxwidth=10cm] -% ~emphase#\NiceMatrixOptions{transparent}@ +% ~emphase#\NiceMatrixOptions{renew-dots,renew-matrix}@ % \begin{pmatrix} % 1 & \cdots & \cdots & 1 \\ % 0 & \ddots & & \vdots \\ @@ -2481,12 +2488,13 @@ version 2005/12/01 or later. % \subsection{Use of \{NiceTabular\} with threeparttable} % % -% If you wish to use the environment |{NiceTabular}| in an environment -% |{threeparttable}| of the eponymous package, you have to patch the environment -% |{threeparttable}| with the following code: +% If you wish to use the environment |{NiceTabular}| or |{NiceTabular*}| in an +% environment |{threeparttable}| of the eponymous package, you have to patch the +% environment |{threeparttable}| with the following code: % \begin{Verbatim}[commandchars=\~\#\!] % \makeatletter -% \AtBeginEnvironment{threeparttable}{\TPT@hookin{NiceTabular}} +% \AtBeginEnvironment{threeparttable} +% {\TPT@hookin{NiceTabular}\TPT@hookin{NiceTabular*}} % \makeatother % \end{Verbatim} % @@ -3188,7 +3196,7 @@ version 2005/12/01 or later. % public and each variable with name beginning with |\g__nicematrix| or % |\l__nicematrix| is private.}: % \begin{itemize} -% \item \colorbox{yellow!50}{\textbf{New 5.2}}\enskip |\g_nicematrix_code_before_tl| ; +% \item \colorbox{yellow!30}{\textbf{New 5.2}}\enskip |\g_nicematrix_code_before_tl| ; % \item |\g_nicematrix_code_after_tl|. % \end{itemize} % @@ -3400,9 +3408,13 @@ version 2005/12/01 or later. % a+b & \Cdots & a+b & 1 % \end{pNiceMatrix}$ % -% % \end{scope} % +% \colorbox{yellow!50}{\textbf{New 5.3}}\enskip It's possible to specify the +% instruction |\Ddots| which will be drawn first (and which will be used to draw +% the other diagonal dotted line when the parallelization is in force) with the +% key |draw-first|: |\Ddots[draw-first]|. +% % \subsection{The ``empty'' cells} % % \label{empty-cells} @@ -5017,8 +5029,8 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% Some cells will be declared as ``empty'' (for example a cell with the -% instrution |\Cdot|). +% Some cells will be declared as ``empty'' (for example a cell with an +% instrution |\Cdots|). % \begin{macrocode} \bool_new:N \g_@@_empty_cell_bool % \end{macrocode} @@ -5087,6 +5099,19 @@ version 2005/12/01 or later. % \begin{macrocode} \tl_new:N \l_@@_color_tl % \end{macrocode} +% +% \medskip +% The parameter of position of the label of a block (|c|, |r| or |l|). +% \begin{macrocode} +\tl_new:N \l_@@_pos_of_block_tl +\tl_set:Nn \l_@@_pos_of_block_tl { c } +% \end{macrocode} +% +% \medskip +% Used when the key |draw-first| is used for |\Ddots| or |\Iddots|. +% \begin{macrocode} +\bool_new:N \l_@@_draw_first_bool +% \end{macrocode} % % \bigskip % \textbf{Variables for the exterior rows and columns}\par\nobreak @@ -5673,14 +5698,16 @@ version 2005/12/01 or later. % \begin{macrocode} down .tl_set:N = \l_@@_xdots_down_tl , up .tl_set:N = \l_@@_xdots_up_tl , +% \end{macrocode} +% The key |draw-first|, which is meant to be used only with |\Ddots| and +% |\Iddots|, which be catched when |\Ddots| or |\Iddots| is used (during the +% construction of the array and not when we draw the dotted lines). +% \begin{macrocode} + draw-first .code:n = \prg_do_nothing: , unknown .code:n = \@@_error:n { Unknown~option~for~xdots } } % \end{macrocode} % -% \bigskip -% The following keys are for the tabular notes (specified by the command -% |\tabularnote| inside |{NiceTabular}| and |{NiceArray}|). -% % % \bigskip % \begin{macrocode} @@ -5941,6 +5968,9 @@ version 2005/12/01 or later. % \begin{macrocode} renew-matrix .code:n = \@@_renew_matrix: , renew-matrix .value_forbidden:n = true , +% \end{macrocode} +% The key |transparent| is now considered as obsolete (because its name is ambiguous). +% \begin{macrocode} transparent .meta:n = { renew-dots , renew-matrix } , transparent .value_forbidden:n = true, % \end{macrocode} @@ -6303,9 +6333,9 @@ version 2005/12/01 or later. % \end{macrocode} % % \interitem -% The first argument of the following command |\@@_instruction_of_type:nn| +% The second argument of the following command |\@@_instruction_of_type:nnn| % defined below is the type of the instruction (|Cdots|, |Vdots|, |Ddots|, -% etc.). The second argument is the list of options. This command writes in the +% etc.). The third argument is the list of options. This command writes in the % corresponding |\g_@@_|\textsl{type}|_lines_tl| the instruction which will % actually draw the line after the construction of the matrix. % @@ -6339,21 +6369,23 @@ version 2005/12/01 or later. % % % \bigskip +% The first argument is a boolean which indicates whether you must put the +% instruction on the left or on the right on the list of instructions. % \begin{macrocode} -\cs_new_protected:Npn \@@_instruction_of_type:nn #1 #2 +\cs_new_protected:Npn \@@_instruction_of_type:nnn #1 #2 #3 { % \end{macrocode} % It's important to use a |\tl_gput_right:cx| and not a |\tl_gput_left:cx| % because we want the |\Ddots| lines to be drawn in the order of appearance % in the array (for parallelisation). % \begin{macrocode} - \tl_gput_right:cx - { g_@@_ #1 _ lines _ tl } + \bool_if:nTF { #1 } \tl_gput_left:cx \tl_gput_right:cx + { g_@@_ #2 _ lines _ tl } { - \use:c { @@ _ draw _ #1 : nnn } + \use:c { @@ _ draw _ #2 : nnn } { \int_use:N \c@iRow } { \int_use:N \c@jCol } - { \exp_not:n { #2 } } + { \exp_not:n { #3 } } } } % \end{macrocode} @@ -6371,7 +6403,7 @@ version 2005/12/01 or later. \cs_set_eq:NN \@acoll \@arrayacol \cs_set_eq:NN \@acolr \@arrayacol \cs_set_eq:NN \@acol \@arrayacol - \cs_set:Npn \@halignto { } + \cs_set_nopar:Npn \@halignto { } \@array@array } % \end{macrocode} @@ -6386,8 +6418,8 @@ version 2005/12/01 or later. { \dim_set_eq:NN \col@sep \tabcolsep } { \dim_set_eq:NN \col@sep \arraycolsep } \dim_compare:nNnTF \l_@@_tabular_width_dim = \c_zero_dim - { \cs_set:Npn \@halignto { } } - { \cs_set:Npx \@halignto { to \dim_use:N \l_@@_tabular_width_dim } } + { \cs_set_nopar:Npn \@halignto { } } + { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l_@@_tabular_width_dim } } % \end{macrocode} % It \pkg{colortbl} is loaded, |\@tabarray| has been redefined to incorporate % |\CT@start|. @@ -6568,7 +6600,7 @@ version 2005/12/01 or later. { % \end{macrocode} % \begin{macrocode} - \cs_set:Npn \arraystretch { 0.47 } + \cs_set_nopar:Npn \arraystretch { 0.47 } \dim_set:Nn \arraycolsep { 1.45 pt } } % \end{macrocode} @@ -6580,7 +6612,7 @@ version 2005/12/01 or later. % |\everycr| to |{ }| and we \emph{need} to have to change the value of % |\everycr|. % \begin{macrocode} - \cs_set:Npn \ialign + \cs_set_nopar:Npn \ialign { \bool_if:NTF \c_@@_colortbl_loaded_bool { @@ -6744,6 +6776,8 @@ version 2005/12/01 or later. \bgroup \tl_set:Nn \l_@@_left_delim_tl { #1 } \tl_set:Nn \l_@@_right_delim_tl { #2 } + \dim_zero:N \g_@@_width_last_col_dim + \dim_zero:N \g_@@_width_first_col_dim \bool_gset_false:N \g_@@_row_of_col_done_bool \str_if_empty:NT \g_@@_name_env_str { \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } } @@ -8221,6 +8255,7 @@ version 2005/12/01 or later. \skip_horizontal:N \l_@@_left_margin_dim \skip_horizontal:N \l_@@_extra_left_margin_dim } + \bool_gset_false:N \g_@@_empty_cell_bool \skip_horizontal:N -2\col@sep } } @@ -8290,6 +8325,7 @@ version 2005/12/01 or later. \@@_node_for_the_cell: } } + \bool_gset_false:N \g_@@_empty_cell_bool } } % \end{macrocode} @@ -8612,16 +8648,16 @@ version 2005/12/01 or later. % etc.) and no corners. In that case, we switch to a shortcut version of % |\@@_vline_i:nn| and |\@@_hline:nn|. % \begin{macrocode} - % \bool_lazy_all:nT - % { - % { \seq_if_empty_p:N \g_@@_pos_of_blocks_seq } - % { \seq_if_empty_p:N \g_@@_pos_of_xdots_seq } - % { \seq_if_empty_p:N \l_@@_empty_corner_cells_seq } - % } - % { - % \cs_set_eq:NN \@@_vline_i:nn \@@_vline_i_complete:nn - % \cs_set_eq:NN \@@_hline_i:nn \@@_hline_i_complete:nn - % } + \bool_lazy_all:nT + { + { \seq_if_empty_p:N \g_@@_pos_of_blocks_seq } + { \seq_if_empty_p:N \g_@@_pos_of_xdots_seq } + { \seq_if_empty_p:N \l_@@_empty_corner_cells_seq } + } + { + \cs_set_eq:NN \@@_vline_i:nn \@@_vline_i_complete:nn + \cs_set_eq:NN \@@_hline_i:nn \@@_hline_i_complete:nn + } \bool_if:NT \l_@@_hlines_bool \@@_draw_hlines: \bool_if:NT \l_@@_vlines_bool \@@_draw_vlines: \g_@@_internal_code_after_tl @@ -9201,7 +9237,6 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_Vdots:nnn #1 #2 #3 { - \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } \cs_if_free:cT { @@ _ dotted _ #1 - #2 } { \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 0 @@ -9218,6 +9253,8 @@ version 2005/12/01 or later. { \color { nicematrix-last-col } } } \keys_set:nn { NiceMatrix / xdots } { #3 } + \tl_if_empty:VF \l_@@_xdots_color_tl + { \color { \l_@@_xdots_color_tl } } \@@_actually_draw_Vdots: \group_end: } @@ -9796,7 +9833,7 @@ version 2005/12/01 or later. \int_compare:nNnTF \c@jCol = \l_@@_last_col_int { \@@_error:nn { in~last~col } \Ldots } { - \@@_instruction_of_type:nn { Ldots } + \@@_instruction_of_type:nnn \c_false_bool { Ldots } { #1 , down = #2 , up = #3 } } } @@ -9815,7 +9852,7 @@ version 2005/12/01 or later. \int_compare:nNnTF \c@jCol = \l_@@_last_col_int { \@@_error:nn { in~last~col } \Cdots } { - \@@_instruction_of_type:nn { Cdots } + \@@_instruction_of_type:nnn \c_false_bool { Cdots } { #1 , down = #2 , up = #3 } } } @@ -9834,7 +9871,7 @@ version 2005/12/01 or later. \int_compare:nNnTF \c@iRow = \l_@@_last_row_int { \@@_error:nn { in~last~row } \Vdots } { - \@@_instruction_of_type:nn { Vdots } + \@@_instruction_of_type:nnn \c_false_bool { Vdots } { #1 , down = #2 , up = #3 } } } @@ -9843,6 +9880,7 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \bigskip % \begin{macrocode} \exp_args:NNV \NewDocumentCommand \@@_Ddots \l_@@_argspec_tl @@ -9859,7 +9897,8 @@ version 2005/12/01 or later. \l_@@_last_col_int { \@@_error:nn { in~last~col } \Ddots } } { - \@@_instruction_of_type:nn { Ddots } + \keys_set_known:nn { NiceMatrix / Ddots } { #1 } + \@@_instruction_of_type:nnn \l_@@_draw_first_bool { Ddots } { #1 , down = #2 , up = #3 } } @@ -9885,7 +9924,8 @@ version 2005/12/01 or later. \l_@@_last_col_int { \@@_error:nn { in~last~col } \Iddots } } { - \@@_instruction_of_type:nn { Iddots } + \keys_set_known:nn { NiceMatrix / Ddots } { #1 } + \@@_instruction_of_type:nnn \l_@@_draw_first_bool { Iddots } { #1 , down = #2 , up = #3 } } @@ -9898,7 +9938,18 @@ version 2005/12/01 or later. % End of the |\AtBeginDocument|. % % -% +% \bigskip +% Despite its name, the following set of keys will be used for |\Ddots| but also +% for |\Iddots|. +% \begin{macrocode} +\keys_define:nn { NiceMatrix / Ddots } + { + draw-first .bool_set:N = \l_@@_draw_first_bool , + draw-first .default:n = true , + draw-first .value_forbidden:n = true + } +% \end{macrocode} +% % \bigskip % The command |\@@_Hspace:| will be linked to |\hspace| in |{NiceArray}|. % \begin{macrocode} @@ -9918,14 +9969,14 @@ version 2005/12/01 or later. \cs_new:Npn \@@_multicolumn:nnn #1 #2 #3 { % \begin{macrocode} -% We have to act in expandable way since it will begin by a |\multicolumn|. +% We have to act in an expandable way since it will begin by a |\multicolumn|. % \end{macrocode \exp_args:NNe \@@_old_multicolumn { #1 } % \end{macrocode} -% We will have to replace |\tl_lower_case:n| in the future -% since |\tl_lower_case:n| seems to be deprecated. +% We will have to replace |\tl_lower_case:n| in the future since it seems to be +% deprecated. % \begin{macrocode} { \exp_args:Ne \str_case:nn { \tl_lower_case:n { #2 } } @@ -9964,6 +10015,8 @@ version 2005/12/01 or later. } } \int_gadd:Nn \c@jCol { #1 - 1 } + \int_compare:nNnT \c@jCol > \g_@@_col_total_int + { \int_gset_eq:NN \g_@@_col_total_int \c@jCol } } } % \end{macrocode} @@ -9979,8 +10032,12 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new:Npn \@@_Hdotsfor: { - \multicolumn { 1 } { c } { } - \@@_Hdotsfor_i + \int_compare:nNnTF \c@jCol = 0 + { \@@_error:n { Hdotsfor~in~col~0 } } + { + \multicolumn { 1 } { c } { } + \@@_Hdotsfor_i + } } % \end{macrocode} % @@ -10010,7 +10067,7 @@ version 2005/12/01 or later. #1 , #3 , down = \exp_not:n { #4 } , up = \exp_not:n { #5 } } - } + } \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { c } { } } } } @@ -10799,9 +10856,12 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_vline_i:nn #1 #2 { % \end{macrocode} -% |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. +% |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When +% we have found a row corresponding to a rule to draw, we note its number in +% |\l_tmpc_tl|. % \begin{macrocode} \tl_set:Nx \l_tmpb_tl { #1 } + \tl_clear_new:N \l_tmpc_tl \int_step_variable:nNn \c@iRow \l_tmpa_tl { % \end{macrocode} @@ -10818,8 +10878,34 @@ version 2005/12/01 or later. { \@@_test_if_vline_in_block:nnnn ##1 } \clist_if_empty:NF \l_@@_except_corners_clist \@@_test_in_corner_v: - \bool_if:NT \g_tmpa_bool - { \@@_vline_ii:nnnn { #1 } { #2 } \l_tmpa_tl \l_tmpa_tl } + \bool_if:NTF \g_tmpa_bool + { + \tl_if_empty:NT \l_tmpc_tl +% \end{macrocode} +% We keep in memory that we have a rule to draw. +% \begin{macrocode} + { \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl } + } + { + \tl_if_empty:NF \l_tmpc_tl + { + \@@_vline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_eval:n { \l_tmpa_tl - 1 } } + \tl_clear:N \l_tmpc_tl + } + } + } + \tl_if_empty:NF \l_tmpc_tl + { + \@@_vline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_use:N \c@iRow } + \tl_clear:N \l_tmpc_tl } } % \end{macrocode} @@ -10945,9 +11031,12 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_hline_i:nn #1 #2 { % \end{macrocode} -% |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. +% |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. Whe, +% we have found a column corresponding to a rule to draw, we note its numver in +% |\l_tmpc_tl|. % \begin{macrocode} \tl_set:Nn \l_tmpa_tl { #1 } + \tl_clear_new:N \l_tmpc_tl \int_step_variable:nNn \c@jCol \l_tmpb_tl { % \end{macrocode} @@ -10963,8 +11052,34 @@ version 2005/12/01 or later. \seq_map_inline:Nn \g_@@_pos_of_xdots_seq { \@@_test_if_hline_in_block:nnnn ##1 } \clist_if_empty:NF \l_@@_except_corners_clist \@@_test_in_corner_h: - \bool_if:NT \g_tmpa_bool - { \@@_hline_ii:nnnn { #1 } { #2 } \l_tmpb_tl \l_tmpb_tl } + \bool_if:NTF \g_tmpa_bool + { + \tl_if_empty:NT \l_tmpc_tl +% \end{macrocode} +% We keep in memory that we have a rule to draw. +% \begin{macrocode} + { \tl_set_eq:NN \l_tmpc_tl \l_tmpb_tl } + } + { + \tl_if_empty:NF \l_tmpc_tl + { + \@@_hline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_eval:n { \l_tmpb_tl - 1 } } + \tl_clear:N \l_tmpc_tl + } + } + } + \tl_if_empty:NF \l_tmpc_tl + { + \@@_hline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_use:N \c@jCol } + \tl_clear:N \l_tmpc_tl } } % \end{macrocode} @@ -11046,7 +11161,7 @@ version 2005/12/01 or later. % \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_hline_i_complete:nn #1 #2 - { \@@_hline_ii:nnnn #1 #2 1 { \int_use:N \c@jCol } } + { \@@_hline_ii:nnnn { #1 } { #2 } 1 { \int_use:N \c@jCol } } % \end{macrocode} % % \bigskip @@ -11910,8 +12025,8 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_extract_coords_values: #1 - #2 \q_stop { - \cs_set:Npn \@@_i: { #1 } - \cs_set:Npn \@@_j: { #2 } + \cs_set_nopar:Npn \@@_i: { #1 } + \cs_set_nopar:Npn \@@_j: { #2 } } % \end{macrocode} % @@ -11950,7 +12065,7 @@ version 2005/12/01 or later. % because it has an optional argument between |<| and |>| (for TeX instructions % put before the math mode of the label) % -% It's mandatory to use a expandable command (probably because of the first +% It's mandatory to use an expandable command (probably because of the first % optional argument?). % \begin{macrocode} \NewExpandableDocumentCommand \@@_Block: { O { } m D < > { } m } @@ -12026,6 +12141,13 @@ version 2005/12/01 or later. tikz .value_required:n = true , color .tl_set:N = \l_@@_color_tl , color .value_required:n = true , + l .code:n = \tl_set:Nn \l_@@_pos_of_block_tl l , + l .value_forbidden:n = true , + r .code:n = \tl_set:Nn \l_@@_pos_of_block_tl r , + r .value_forbidden:n = true , + c .code:n = \tl_set:Nn \l_@@_pos_of_block_tl c , + c .value_forbidden:n = true , + unknown .code:n = \@@_error:n { Unknown~key~for~Block } } % \end{macrocode} % @@ -12062,15 +12184,15 @@ version 2005/12/01 or later. % % \medskip % \begin{macrocode} - \cs_set_protected:Npn \diagbox ##1 ##2 - { - \tl_gput_right:Nx \g_@@_internal_code_after_tl - { - \@@_actually_diagbox:nnnnnn - { #1 } { #2 } { #3 } { #4 } - { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } - } - } + \cs_set_protected_nopar:Npn \diagbox ##1 ##2 + { + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { + \@@_actually_diagbox:nnnnnn + { #1 } { #2 } { #3 } { #4 } + { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } + } + } % \end{macrocode} % % \medskip @@ -12176,8 +12298,11 @@ version 2005/12/01 or later. \cs_if_exist:cT { pgf @ sh @ ns @ \@@_env: - ##1 - #2 } { - \pgfpointanchor { \@@_env: - ##1 - #2 } { west } - \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor { \@@_env: - ##1 - #2 } { west } + \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + } } } % \end{macrocode} @@ -12196,8 +12321,11 @@ version 2005/12/01 or later. \cs_if_exist:cT { pgf @ sh @ ns @ \@@_env: - ##1 - #4 } { - \pgfpointanchor { \@@_env: - ##1 - #4 } { east } - \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor { \@@_env: - ##1 - #4 } { east } + \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + } } } \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } @@ -12224,7 +12352,8 @@ version 2005/12/01 or later. } % \end{macrocode} % \medskip -% Now, we will put the label of the block. +% Now, we will put the label of the block beginning with the case of a |\Block| +% of one row. % \begin{macrocode} \int_compare:nNnTF { #1 } = { #3 } { @@ -12248,24 +12377,65 @@ version 2005/12/01 or later. % \end{macrocode} % We retrieve (in |\pgf@x|) the $x$-value of the center of the block. % \begin{macrocode} - \@@_qpoint:n { #1 - #2 - block - short } + \pgfpointanchor + { \@@_env: - #1 - #2 - block - short } + { + \str_case:Vn \l_@@_pos_of_block_tl + { + c { center } + l { west } + r { east } + } + } % \end{macrocode} % We put the label of the block which has been composed in |\l_@@_cell_box|. % \begin{macrocode} \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim } - \pgfnode { rectangle } { base } + \pgfset { inner~sep = \c_zero_dim } + \pgfnode + { rectangle } + { + \str_case:Vn \l_@@_pos_of_block_tl + { + c { base } + l { base~west } + r { base~east } + } + } { \box_use_drop:N \l_@@_cell_box } { } { } } % \end{macrocode} % % \medskip % If the number of rows is different of $1$, we put the label of the block in -% the center of the (short) node (the label of the block has been composed in -% |\l_@@_cell_box|). +% using the short node (the label of the block has been composed in +% |\l_@@_cell_box|). % \begin{macrocode} { - \pgftransformshift { \@@_qpoint:n { #1 - #2 - block - short } } - \pgfnode { rectangle } { center } + \pgftransformshift + { + \pgfpointanchor + { \@@_env: - #1 - #2 - block - short } + { + \str_case:Vn \l_@@_pos_of_block_tl + { + c { center } + l { west } + r { east } + } + } + } + \pgfset { inner~sep = \c_zero_dim } + \pgfnode + { rectangle } + { + \str_case:Vn \l_@@_pos_of_block_tl + { + c { center } + l { west } + r { east } + } + } { \box_use_drop:N \l_@@_cell_box } { } { } } \endpgfpicture @@ -12891,6 +13061,14 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { Hdotsfor~in~col~0 } + { + You~can't~use~\token_to_str:N \Hdotsfor\ in~an~exterior~column~of~ + the~array.~If~you~go~on,~the~corresponding~dotted~line~won't~be~drawn. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { bad~corner } { #1~is~an~incorrect~specification~for~a~corner~(in~the~keys~ @@ -13009,7 +13187,19 @@ version 2005/12/01 or later. } % \end{macrocode} % -% +% \begin{macrocode} +\@@_msg_new:nnn { Unknown~key~for~Block } + { + The~key~'\l_keys_key_tl'~is~unknown~for~the~command~\token_to_str:N + \Block.\\ If~you~go~on,~it~will~be~ignored. \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~options~are~(in~alphabetic~order):~c,~ + color,~l,~and~r. + } +% \end{macrocode} +% % \begin{macrocode} \@@_msg_new:nnn { Unknown~key~for~notes } { @@ -13265,6 +13455,15 @@ version 2005/12/01 or later. % \vspace{1cm} % \section{History} % +% The successive versions of the file |nicematrix.sty| provided by TeXLive are available on the +% \textsc{svn} server of TeXLive: +% +% { +% \small +% \url{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} +% } +% +% % \subsection*{Changes between versions 1.0 and 1.1} % % The dotted lines are no longer drawn with Tikz nodes but with Tikz circles @@ -13615,7 +13814,16 @@ version 2005/12/01 or later. % The key |baseline| can take in as value of the form \textsl{line-i} to align % the |\hline| in the row \textsl{i}. % -% The key |hvlines-except-corners| may take in as value a list of corner (eg: NW,SE). +% The key |hvlines-except-corners| may take in as value a list of corners (eg: NW,SE). +% +% \subsection*{Changes between versions 5.2 and 5.3} +% +% Keys |c|, |r| and |l| for the command |\Block|. +% +% It's possible to use the key |draw-first| with |\Ddots| and |\Iddots| to +% specify which dotted line will be drawn first (the other lines will be drawn +% parallel to that one if parallelization is activated). +% % % \PrintIndex % diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index c4ffc2e87fa..ca4ab2c60d7 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{5.2} -\def\myfiledate{2020/08/19} +\def\myfileversion{5.3} +\def\myfiledate{2020/09/03} \RequirePackage{pgfcore} \usepgfmodule{shapes} @@ -297,6 +297,9 @@ \seq_new:N \g__nicematrix_pos_of_xdots_seq \int_new:N \g__nicematrix_static_num_of_col_int \tl_new:N \l__nicematrix_color_tl +\tl_new:N \l__nicematrix_pos_of_block_tl +\tl_set:Nn \l__nicematrix_pos_of_block_tl { c } +\bool_new:N \l__nicematrix_draw_first_bool \int_new:N \l__nicematrix_first_row_int \int_set:Nn \l__nicematrix_first_row_int 1 \int_new:N \l__nicematrix_first_col_int @@ -474,6 +477,7 @@ shorten .value_required:n = true , down .tl_set:N = \l__nicematrix_xdots_down_tl , up .tl_set:N = \l__nicematrix_xdots_up_tl , + draw-first .code:n = \prg_do_nothing: , unknown .code:n = \__nicematrix_error:n { Unknown~option~for~xdots } } \keys_define:nn { NiceMatrix / rules } @@ -861,15 +865,15 @@ } \endpgfpicture } -\cs_new_protected:Npn \__nicematrix_instruction_of_type:nn #1 #2 +\cs_new_protected:Npn \__nicematrix_instruction_of_type:nnn #1 #2 #3 { - \tl_gput_right:cx - { g__nicematrix_ #1 _ lines _ tl } + \bool_if:nTF { #1 } \tl_gput_left:cx \tl_gput_right:cx + { g__nicematrix_ #2 _ lines _ tl } { - \use:c { __nicematrix _ draw _ #1 : nnn } + \use:c { __nicematrix _ draw _ #2 : nnn } { \int_use:N \c@iRow } { \int_use:N \c@jCol } - { \exp_not:n { #2 } } + { \exp_not:n { #3 } } } } \cs_new_protected:Npn \__nicematrix_revtex_array: @@ -877,7 +881,7 @@ \cs_set_eq:NN \@acoll \@arrayacol \cs_set_eq:NN \@acolr \@arrayacol \cs_set_eq:NN \@acol \@arrayacol - \cs_set:Npn \@halignto { } + \cs_set_nopar:Npn \@halignto { } \@array@array } \cs_new_protected:Npn \__nicematrix_array: @@ -889,8 +893,8 @@ { \dim_set_eq:NN \col@sep \tabcolsep } { \dim_set_eq:NN \col@sep \arraycolsep } \dim_compare:nNnTF \l__nicematrix_tabular_width_dim = \c_zero_dim - { \cs_set:Npn \@halignto { } } - { \cs_set:Npx \@halignto { to \dim_use:N \l__nicematrix_tabular_width_dim } } + { \cs_set_nopar:Npn \@halignto { } } + { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l__nicematrix_tabular_width_dim } } \@tabarray } [ \str_if_eq:VnTF \l__nicematrix_baseline_str c c t ] @@ -976,10 +980,10 @@ \normalbaselines \bool_if:NT \l__nicematrix_small_bool { - \cs_set:Npn \arraystretch { 0.47 } + \cs_set_nopar:Npn \arraystretch { 0.47 } \dim_set:Nn \arraycolsep { 1.45 pt } } - \cs_set:Npn \ialign + \cs_set_nopar:Npn \ialign { \bool_if:NTF \c__nicematrix_colortbl_loaded_bool { @@ -1055,6 +1059,8 @@ \bgroup \tl_set:Nn \l__nicematrix_left_delim_tl { #1 } \tl_set:Nn \l__nicematrix_right_delim_tl { #2 } + \dim_zero:N \g__nicematrix_width_last_col_dim + \dim_zero:N \g__nicematrix_width_first_col_dim \bool_gset_false:N \g__nicematrix_row_of_col_done_bool \str_if_empty:NT \g__nicematrix_name_env_str { \str_gset:Nn \g__nicematrix_name_env_str { NiceArrayWithDelims } } @@ -1903,6 +1909,7 @@ \skip_horizontal:N \l__nicematrix_left_margin_dim \skip_horizontal:N \l__nicematrix_extra_left_margin_dim } + \bool_gset_false:N \g__nicematrix_empty_cell_bool \skip_horizontal:N -2\col@sep } } @@ -1946,6 +1953,7 @@ \__nicematrix_node_for_the_cell: } } + \bool_gset_false:N \g__nicematrix_empty_cell_bool } } \NewDocumentEnvironment { NiceArray } { } @@ -2115,16 +2123,16 @@ } \__nicematrix_draw_dotted_lines: \__nicematrix_compute_corners: - % \bool_lazy_all:nT - % { - % { \seq_if_empty_p:N \g__nicematrix_pos_of_blocks_seq } - % { \seq_if_empty_p:N \g__nicematrix_pos_of_xdots_seq } - % { \seq_if_empty_p:N \l__nicematrix_empty_corner_cells_seq } - % } - % { - % \cs_set_eq:NN \__nicematrix_vline_i:nn \__nicematrix_vline_i_complete:nn - % \cs_set_eq:NN \__nicematrix_hline_i:nn \__nicematrix_hline_i_complete:nn - % } + \bool_lazy_all:nT + { + { \seq_if_empty_p:N \g__nicematrix_pos_of_blocks_seq } + { \seq_if_empty_p:N \g__nicematrix_pos_of_xdots_seq } + { \seq_if_empty_p:N \l__nicematrix_empty_corner_cells_seq } + } + { + \cs_set_eq:NN \__nicematrix_vline_i:nn \__nicematrix_vline_i_complete:nn + \cs_set_eq:NN \__nicematrix_hline_i:nn \__nicematrix_hline_i_complete:nn + } \bool_if:NT \l__nicematrix_hlines_bool \__nicematrix_draw_hlines: \bool_if:NT \l__nicematrix_vlines_bool \__nicematrix_draw_vlines: \g__nicematrix_internal_code_after_tl @@ -2472,7 +2480,6 @@ } \cs_new_protected:Npn \__nicematrix_draw_Vdots:nnn #1 #2 #3 { - \tl_if_empty:VF \l__nicematrix_xdots_color_tl { \color { \l__nicematrix_xdots_color_tl } } \cs_if_free:cT { __nicematrix _ dotted _ #1 - #2 } { \__nicematrix_find_extremities_of_line:nnnn { #1 } { #2 } 1 0 @@ -2484,6 +2491,8 @@ { \color { nicematrix-last-col } } } \keys_set:nn { NiceMatrix / xdots } { #3 } + \tl_if_empty:VF \l__nicematrix_xdots_color_tl + { \color { \l__nicematrix_xdots_color_tl } } \__nicematrix_actually_draw_Vdots: \group_end: } @@ -2846,7 +2855,7 @@ \int_compare:nNnTF \c@jCol = \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Ldots } { - \__nicematrix_instruction_of_type:nn { Ldots } + \__nicematrix_instruction_of_type:nnn \c_false_bool { Ldots } { #1 , down = #2 , up = #3 } } } @@ -2861,7 +2870,7 @@ \int_compare:nNnTF \c@jCol = \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Cdots } { - \__nicematrix_instruction_of_type:nn { Cdots } + \__nicematrix_instruction_of_type:nnn \c_false_bool { Cdots } { #1 , down = #2 , up = #3 } } } @@ -2876,7 +2885,7 @@ \int_compare:nNnTF \c@iRow = \l__nicematrix_last_row_int { \__nicematrix_error:nn { in~last~row } \Vdots } { - \__nicematrix_instruction_of_type:nn { Vdots } + \__nicematrix_instruction_of_type:nnn \c_false_bool { Vdots } { #1 , down = #2 , up = #3 } } } @@ -2897,7 +2906,8 @@ \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Ddots } } { - \__nicematrix_instruction_of_type:nn { Ddots } + \keys_set_known:nn { NiceMatrix / Ddots } { #1 } + \__nicematrix_instruction_of_type:nnn \l__nicematrix_draw_first_bool { Ddots } { #1 , down = #2 , up = #3 } } @@ -2919,7 +2929,8 @@ \l__nicematrix_last_col_int { \__nicematrix_error:nn { in~last~col } \Iddots } } { - \__nicematrix_instruction_of_type:nn { Iddots } + \keys_set_known:nn { NiceMatrix / Ddots } { #1 } + \__nicematrix_instruction_of_type:nnn \l__nicematrix_draw_first_bool { Iddots } { #1 , down = #2 , up = #3 } } @@ -2928,6 +2939,12 @@ \bool_gset_true:N \g__nicematrix_empty_cell_bool } } +\keys_define:nn { NiceMatrix / Ddots } + { + draw-first .bool_set:N = \l__nicematrix_draw_first_bool , + draw-first .default:n = true , + draw-first .value_forbidden:n = true + } \cs_new_protected:Npn \__nicematrix_Hspace: { \bool_gset_true:N \g__nicematrix_empty_cell_bool @@ -2973,12 +2990,18 @@ } } \int_gadd:Nn \c@jCol { #1 - 1 } + \int_compare:nNnT \c@jCol > \g__nicematrix_col_total_int + { \int_gset_eq:NN \g__nicematrix_col_total_int \c@jCol } } } \cs_new:Npn \__nicematrix_Hdotsfor: { - \multicolumn { 1 } { c } { } - \__nicematrix_Hdotsfor_i + \int_compare:nNnTF \c@jCol = 0 + { \__nicematrix_error:n { Hdotsfor~in~col~0 } } + { + \multicolumn { 1 } { c } { } + \__nicematrix_Hdotsfor_i + } } \AtBeginDocument { @@ -3493,6 +3516,7 @@ \cs_new_protected:Npn \__nicematrix_vline_i:nn #1 #2 { \tl_set:Nx \l_tmpb_tl { #1 } + \tl_clear_new:N \l_tmpc_tl \int_step_variable:nNn \c@iRow \l_tmpa_tl { \bool_gset_true:N \g_tmpa_bool @@ -3502,8 +3526,31 @@ { \__nicematrix_test_if_vline_in_block:nnnn ##1 } \clist_if_empty:NF \l__nicematrix_except_corners_clist \__nicematrix_test_in_corner_v: - \bool_if:NT \g_tmpa_bool - { \__nicematrix_vline_ii:nnnn { #1 } { #2 } \l_tmpa_tl \l_tmpa_tl } + \bool_if:NTF \g_tmpa_bool + { + \tl_if_empty:NT \l_tmpc_tl + { \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl } + } + { + \tl_if_empty:NF \l_tmpc_tl + { + \__nicematrix_vline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_eval:n { \l_tmpa_tl - 1 } } + \tl_clear:N \l_tmpc_tl + } + } + } + \tl_if_empty:NF \l_tmpc_tl + { + \__nicematrix_vline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_use:N \c@iRow } + \tl_clear:N \l_tmpc_tl } } \cs_new_protected:Npn \__nicematrix_test_in_corner_v: @@ -3589,6 +3636,7 @@ \cs_new_protected:Npn \__nicematrix_hline_i:nn #1 #2 { \tl_set:Nn \l_tmpa_tl { #1 } + \tl_clear_new:N \l_tmpc_tl \int_step_variable:nNn \c@jCol \l_tmpb_tl { \bool_gset_true:N \g_tmpa_bool @@ -3597,8 +3645,31 @@ \seq_map_inline:Nn \g__nicematrix_pos_of_xdots_seq { \__nicematrix_test_if_hline_in_block:nnnn ##1 } \clist_if_empty:NF \l__nicematrix_except_corners_clist \__nicematrix_test_in_corner_h: - \bool_if:NT \g_tmpa_bool - { \__nicematrix_hline_ii:nnnn { #1 } { #2 } \l_tmpb_tl \l_tmpb_tl } + \bool_if:NTF \g_tmpa_bool + { + \tl_if_empty:NT \l_tmpc_tl + { \tl_set_eq:NN \l_tmpc_tl \l_tmpb_tl } + } + { + \tl_if_empty:NF \l_tmpc_tl + { + \__nicematrix_hline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_eval:n { \l_tmpb_tl - 1 } } + \tl_clear:N \l_tmpc_tl + } + } + } + \tl_if_empty:NF \l_tmpc_tl + { + \__nicematrix_hline_ii:nnnn + { #1 } + { #2 } + \l_tmpc_tl + { \int_use:N \c@jCol } + \tl_clear:N \l_tmpc_tl } } \cs_new_protected:Npn \__nicematrix_test_in_corner_h: @@ -3665,7 +3736,7 @@ \pgfusepathqstroke } \cs_new_protected:Npn \__nicematrix_hline_i_complete:nn #1 #2 - { \__nicematrix_hline_ii:nnnn #1 #2 1 { \int_use:N \c@jCol } } + { \__nicematrix_hline_ii:nnnn { #1 } { #2 } 1 { \int_use:N \c@jCol } } \cs_new_protected:Npn \__nicematrix_draw_hlines: { \int_step_inline:nnn @@ -4101,8 +4172,8 @@ } \cs_new_protected:Npn \__nicematrix_extract_coords_values: #1 - #2 \q_stop { - \cs_set:Npn \__nicematrix_i: { #1 } - \cs_set:Npn \__nicematrix_j: { #2 } + \cs_set_nopar:Npn \__nicematrix_i: { #1 } + \cs_set_nopar:Npn \__nicematrix_j: { #2 } } \cs_new_protected:Npn \__nicematrix_node_for_multicolumn:nn #1 #2 { @@ -4148,6 +4219,13 @@ tikz .value_required:n = true , color .tl_set:N = \l__nicematrix_color_tl , color .value_required:n = true , + l .code:n = \tl_set:Nn \l__nicematrix_pos_of_block_tl l , + l .value_forbidden:n = true , + r .code:n = \tl_set:Nn \l__nicematrix_pos_of_block_tl r , + r .value_forbidden:n = true , + c .code:n = \tl_set:Nn \l__nicematrix_pos_of_block_tl c , + c .value_forbidden:n = true , + unknown .code:n = \__nicematrix_error:n { Unknown~key~for~Block } } \cs_new_protected:Npn \__nicematrix_draw_blocks: { \seq_map_inline:Nn \g__nicematrix_blocks_seq { \__nicematrix_Block_iii:nnnnnn ##1 } } @@ -4165,15 +4243,15 @@ { #3 - #4 } } } - \cs_set_protected:Npn \diagbox ##1 ##2 - { - \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl - { - \__nicematrix_actually_diagbox:nnnnnn - { #1 } { #2 } { #3 } { #4 } - { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } - } - } + \cs_set_protected_nopar:Npn \diagbox ##1 ##2 + { + \tl_gput_right:Nx \g__nicematrix_internal_code_after_tl + { + \__nicematrix_actually_diagbox:nnnnnn + { #1 } { #2 } { #3 } { #4 } + { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } + } + } \bool_lazy_or:nnTF { \int_compare_p:nNn { #3 } > \g__nicematrix_row_total_int } { \int_compare_p:nNn { #4 } > \g__nicematrix_col_total_int } @@ -4203,8 +4281,11 @@ \cs_if_exist:cT { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #2 } { - \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west } - \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor { \__nicematrix_env: - ##1 - #2 } { west } + \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x } + } } } \dim_compare:nNnT \l_tmpb_dim = \c_max_dim @@ -4218,8 +4299,11 @@ \cs_if_exist:cT { pgf @ sh @ ns @ \__nicematrix_env: - ##1 - #4 } { - \pgfpointanchor { \__nicematrix_env: - ##1 - #4 } { east } - \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + \seq_if_in:NnF \g__nicematrix_multicolumn_cells_seq { ##1 - #2 } + { + \pgfpointanchor { \__nicematrix_env: - ##1 - #4 } { east } + \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + } } } \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } @@ -4246,14 +4330,55 @@ \l__nicematrix_code_for_last_row_tl } \pgfextracty \l_tmpa_dim { \__nicematrix_qpoint:n { row - #1 - base } } - \__nicematrix_qpoint:n { #1 - #2 - block - short } + \pgfpointanchor + { \__nicematrix_env: - #1 - #2 - block - short } + { + \str_case:Vn \l__nicematrix_pos_of_block_tl + { + c { center } + l { west } + r { east } + } + } \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim } - \pgfnode { rectangle } { base } + \pgfset { inner~sep = \c_zero_dim } + \pgfnode + { rectangle } + { + \str_case:Vn \l__nicematrix_pos_of_block_tl + { + c { base } + l { base~west } + r { base~east } + } + } { \box_use_drop:N \l__nicematrix_cell_box } { } { } } { - \pgftransformshift { \__nicematrix_qpoint:n { #1 - #2 - block - short } } - \pgfnode { rectangle } { center } + \pgftransformshift + { + \pgfpointanchor + { \__nicematrix_env: - #1 - #2 - block - short } + { + \str_case:Vn \l__nicematrix_pos_of_block_tl + { + c { center } + l { west } + r { east } + } + } + } + \pgfset { inner~sep = \c_zero_dim } + \pgfnode + { rectangle } + { + \str_case:Vn \l__nicematrix_pos_of_block_tl + { + c { center } + l { west } + r { east } + } + } { \box_use_drop:N \l__nicematrix_cell_box } { } { } } \endpgfpicture @@ -4619,6 +4744,11 @@ can't~be~executed~because~a~cell~doesn't~exist.\\ If~you~go~on~this~command~will~be~ignored. } +\__nicematrix_msg_new:nn { Hdotsfor~in~col~0 } + { + You~can't~use~\token_to_str:N \Hdotsfor\ in~an~exterior~column~of~ + the~array.~If~you~go~on,~the~corresponding~dotted~line~won't~be~drawn. + } \__nicematrix_msg_new:nn { bad~corner } { #1~is~an~incorrect~specification~for~a~corner~(in~the~keys~ @@ -4696,6 +4826,16 @@ The~value~of~key~'\l_keys_key_tl'~must~be~of~length~1.\\ If~you~go~on,~it~will~be~ignored. } +\__nicematrix_msg_new:nnn { Unknown~key~for~Block } + { + The~key~'\l_keys_key_tl'~is~unknown~for~the~command~\token_to_str:N + \Block.\\ If~you~go~on,~it~will~be~ignored. \\ + For~a~list~of~the~available~keys,~type~H~<return>. + } + { + The~available~options~are~(in~alphabetic~order):~c,~ + color,~l,~and~r. + } \__nicematrix_msg_new:nnn { Unknown~key~for~notes } { The~key~'\l_keys_key_tl'~is~unknown.\\ |