diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.pdf | bin | 433072 -> 425830 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex | 127 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf | bin | 1080998 -> 1078565 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 577 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty | 297 |
6 files changed, 507 insertions, 498 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 c203937ba55..833a876d410 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 1e14babd290..ca8beb88fc0 100644 --- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex +++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix-french.tex @@ -12,7 +12,6 @@ \usepackage{tikz} \usetikzlibrary{fit,patterns} - \usepackage{enumitem} \usepackage{siunitx} \usepackage{verbatim} @@ -236,8 +235,12 @@ $\begin{pmatrix} En s'inspirant de l'extension \pkg{cellspace} qui traite de ce problème, l'extension \pkg{nicematrix} propose deux clés |cell-space-top-limit| et |cell-space-bottom-limit| qui sont similaires aux deux paramètres -|\cellspacetoplimit| et |\cellspacebottomlimit| proposés par \pkg{cellspace}. La -valeur initiale de ces paramètres est $0$~pt pour que les environnements de +|\cellspacetoplimit| et |\cellspacebottomlimit| proposés par \pkg{cellspace}. + +\colorbox{yellow!50}{\textbf{Nouveau 5.9}}\enskip Il existe aussi une clé +|cell-space-limits| pour régler simultanément les deux paramètres. + +La valeur initiale de ces paramètres est $0$~pt pour que les environnements de \pkg{nicematrix} aient par défaut le même comportement que ceux de \pkg{array} et de l'\pkg{amsmath} mais une valeur de $1$~pt serait un bon choix. On conseille de régler leurs valeurs avec la commande @@ -247,7 +250,7 @@ conseille de régler leurs valeurs avec la commande \medskip \begin{Verbatim} -\NiceMatrixOptions{~emphase#cell-space-top-limit = 1pt,cell-space-bottom-limit = 1pt@} +\NiceMatrixOptions{~emphase#cell-space-limits = 1pt@} \end{Verbatim} \begin{BVerbatim}[baseline=c,boxwidth=9cm] @@ -257,10 +260,7 @@ $\begin{pNiceMatrix} \end{pNiceMatrix}$ \end{BVerbatim} \begin{scope} -\NiceMatrixOptions{ - cell-space-top-limit = 1pt , - cell-space-bottom-limit = 1pt , -} +\NiceMatrixOptions{ cell-space-limits = 1pt } $\begin{pNiceMatrix} \frac12 & -\frac12 \\ \frac13 & \frac14 \\ @@ -377,7 +377,7 @@ horizontal. \smallskip \begin{Verbatim} -\NiceMatrixOptions{cell-space-top-limit=1pt,cell-space-bottom-limit=1pt} +\NiceMatrixOptions{cell-space-limits=1pt} \end{Verbatim} \smallskip @@ -391,7 +391,7 @@ $A=\begin{pNiceArray}{cc|cc}[baseline=line-3] \end{pNiceArray}$ \end{BVerbatim} \begin{scope} -\NiceMatrixOptions{cell-space-top-limit=1pt,cell-space-bottom-limit=1pt} +\NiceMatrixOptions{cell-space-limits=1pt} \raisebox{-5mm}{$A=\begin{pNiceArray}{cc|cc}[baseline=line-3] \dfrac1A & \dfrac1B & 0 & 0 \\ \dfrac1C & \dfrac1D & 0 & 0 \\ @@ -420,11 +420,11 @@ avec deux arguments. \item Le premier argument est la taille de ce bloc avec la syntaxe $i$-$j$ où $i$ est le nombre de rangées et $j$ le nombre de colonnes du bloc. -\colorbox{yellow!30}{Nouveau 5.6}\enskip Si cet argument est laissé -blanc, la valeur par défaut est |1-1|. Si le nombre de rangées n'est pas -indiqué, le bloc s'étend jusqu'à la dernière rangée (idem pour les colonnes). +Si cet argument est laissé blanc, la valeur par défaut est |1-1|. Si le nombre +de rangées n'est pas indiqué, ou bien est égal à |*|, le bloc s'étend jusqu'à la +dernière rangée (idem pour les colonnes). -\item Le deuxième argument, est le contenu du bloc. On peut utiliser |\\| dans +\item Le deuxième argument est le contenu du bloc. On peut utiliser |\\| dans ce contenu pour avoir un contenu sur plusieurs lignes. Dans |{NiceTabular}|, le contenu est composé en mode texte tandis que, dans les autres environnements, il est composé en mode mathématique. @@ -538,11 +538,11 @@ arum & iris & jacinthe & muguet \end{center} \medskip -\colorbox{yellow!50}{\bfseries Nouveau 5.7}\enskip Comme on le voit sur cet -exemple, on peut fixer la couleur de fond avec la clé |fill| et la couleur du -cadre avec la clé |draw|\footnote{Si la clé |draw| est utilisée sans valeur, -c'est la couleur par défaut des filets de tableaux qui est utilisée.}. On peut -aussi fixer l'épaisseur du trait avec la clé |line-width|. +\colorbox{yellow!30}{Nouveau 5.7}\enskip Comme on le voit sur cet exemple, on +peut fixer la couleur de fond avec la clé |fill| et la couleur du cadre avec la +clé |draw|\footnote{Si la clé |draw| est utilisée sans valeur, c'est la couleur + par défaut des filets de tableaux qui est utilisée.}. On peut aussi fixer +l'épaisseur du trait avec la clé |line-width|. @@ -597,10 +597,9 @@ Henri & 14 \\ \hline \subsection{Les blocs mono-rangée} -\colorbox{yellow!30}{Nouveau 5.6}\enskip Pour les blocs mono-rangée, la -hauteur (\emph{height}) et la profondeur (\emph{depth}) naturelles sont prises en -compte pour la hauteur et la largeur de la rangée en cours (comme le fait la -commande standard |\multicolumn| de LaTeX). +Pour les blocs mono-rangée, la hauteur (\emph{height}) et la profondeur +(\emph{depth}) naturelles sont prises en compte pour la hauteur et la largeur de +la rangée en cours (comme le fait la commande standard |\multicolumn| de LaTeX). @@ -622,7 +621,7 @@ bloc sur plusieurs lignes. la consigne générale donnée dans le préambule pour cette colonne. \item On peut tracer un cadre autour du bloc avec la clé |draw| de la commande -|\Block|.\footnote{Pour colorier le fond d'une case, il n'est pas besoin +|\Block|.\footnote{Pour colorier le fond d'une case, il n'y a pas besoin d'utiliser un bloc mono-case : on peut utiliser la commande |\cellcolor| si la clé |colortbl-like| est utilisée : voir p.~\pageref{colortbl-like}.} \end{itemize} @@ -984,7 +983,7 @@ rectangles vides partant de la case située exactement dans le coin. \bigskip 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| +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}). \medskip @@ -1137,7 +1136,7 @@ SumatraPDF) donne de meilleurs résultats que Adobe Reader. couleur. Ce phénomène se produit quand chaque case est coloriée avec sa propre instruction |fill| (opérateur |fill| de PostScript noté |f| en PDF). C'est le cas avec \pkg{colortbl} avec lequel chaque case est coloriée -individuellement même si on utilise |\columncolor| ou |\rowcolor|. +individuellement, même si on utilise |\columncolor| ou |\rowcolor|. Concernant ce phénomène, Adobe Reader donne de meilleurs résultats que MuPDF. @@ -1195,9 +1194,6 @@ h & i & j \\ \hline \end{NiceTabular} \end{scope} -\medskip -Une commande |\cellcolor| ne produit qu'une instruction |fill| (codée |f|) dans -le \textsc{pdf}. \bigskip \item La commande |\rectanglecolor| prend trois arguments obligatoires. Le @@ -1266,9 +1262,6 @@ a_{10} & b_{10} & c_{10} \\ \end{NiceArray}$ \end{scope} -\medskip -Une commande |\rowcolor| ne produit qu'une instruction |fill| (codée |f|) dans -le \textsc{pdf}. \bigskip @@ -1305,7 +1298,7 @@ la forme $i$|-|$j$. \item \colorbox{yellow!50}{\textbf{Nouveau 5.8}}\enskip Avec la clé |restart|, chacun des intervalles de rangées spécifié par le premier argument de |\rowcolors| recommence avec la même couleur.\footnote{Autrement, la couleur d'une rangée ne - dépend que de la partié de son number.} + dépend que de la partié de son numéro.} \item Avec la clé |respect-blocks|, qui est de type booléen, les ``rangées'' @@ -1320,7 +1313,7 @@ tableau pour englober les blocs (créés par la commande |\Block|). \begin{BVerbatim}[baseline=c,boxwidth=9cm] \begin{NiceTabular}{clr}% [hvlines,code-before = ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@] -\Block{1-3}{Résultats} \\ +\Block{1-*}{Résultats} \\ \Block{2-1}{A}& Pierre & 12 \\ & Jacques & 8 \\ \Block{4-1}{B}& Stéphanie & 18 \\ @@ -1331,7 +1324,7 @@ tableau pour englober les blocs (créés par la commande |\Block|). \end{BVerbatim} \begin{NiceTabular}{clr}[hvlines, code-before = {\rowcolors{2}{blue!10}{}[cols=2-3,restart]},baseline=2] -\Block{1-3}{Résultats} \\ +\Block{1-*}{Résultats} \\ \Block{2-1}{A}& Pierre & 12 \\ & Jacques & 8 \\ \Block{4-1}{B}& Stéphanie & 18 \\ @@ -1505,52 +1498,6 @@ Dupont & Chantal & 15 janvier 1998 \\ \end{NiceTabular} \end{center} -\medskip -\emph{Remarque}\par\nobreak - -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, 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. - - -\medskip -\begin{Verbatim} -\begin{NiceTabular}[colortbl-like]{ccc}% - [code-before = ~emphase#\columncolor{blue!15}{1,2}@] -\toprule -\rowcolor{red!15} -Nom & Prénom & Année de naissance \\ -\midrule -Achard & Jacques & 5 juin 1962 \\ -Lefebvre & Mathilde & 23 mai 1988 \\ -Vanesse & Stéphanie & 30 octobre 1994 \\ -Dupont & Chantal & 15 janvier 1998 \\ -\bottomrule -\end{NiceTabular} -\end{Verbatim} - - -\begin{center} -\begin{NiceTabular}[colortbl-like]{ccc}% - [code-before = \columncolor{blue!15}{1,2}] -\toprule -\rowcolor{red!15} -Nom & Prénom & Année de naissance \\ -\midrule -Achard & Jacques & 5 juin 1962 \\ -Lefebvre & Mathilde & 23 mai 1988 \\ -Vanesse & Stéphanie & 30 octobre 1994 \\ -Dupont & Chantal & 15 janvier 1998 \\ -\bottomrule -\end{NiceTabular} -\end{center} - \section{La largeur des colonnes} @@ -2199,13 +2146,13 @@ mathématique avec |\scriptstyle|. \begin{BVerbatim}[baseline=c,boxwidth=10cm] $\begin{bNiceMatrix} 1 & \hspace*{1cm} & 0 \\[8mm] - & ~emphase#\Ddots^{n \text{ times}}@ & \\ + & ~emphase#\Ddots^{n \text{ fois}}@ & \\ 0 & & 1 \end{bNiceMatrix}$ \end{BVerbatim} $\begin{bNiceMatrix} 1 & \hspace*{1cm} & 0 \\[8mm] - & \Ddots^{n \text{ times}} & \\ + & \Ddots^{n \text{ fois}} & \\ 0 & & 1 \end{bNiceMatrix}$ @@ -2380,13 +2327,9 @@ I & 0 & \Cdots &0 \\ \medskip Pour améliorer la lisibilité du code, une syntaxe alternative est proposée : on peut spécifier les instructions du |code-after| à la fin de l'environnement, -après le mot-clé |\CodeAfter|\footnote{Dans certaines circonstances, on doit - mettre |\omit \CodeAfter|, |\omit| étant un mot-clé de TeX qui annule le motif - de la case courante.} (pour un exemple, voir page -\pageref{exemple-CodeAfter}). \colorbox{yellow!30}{Nouveau 5.5}\enskip -Avant la version 5.5, il fallait parfois mettre le mot-clé |\omit| devant -|\CodeAfter| dans certaines circonstances. Depuis la version 5.5, on ne doit -\emph{jamais} mettre |\omit|. +après le mot-clé |\CodeAfter| (pour un exemple, voir page +\pageref{exemple-CodeAfter}). + \section{Les notes dans les tableaux} @@ -3055,9 +2998,7 @@ lignes en pointillés entre les cases du tableau. \textbf{Attention} : Par défaut, aucun nœud n'est créé dans une case vide. \smallskip -\colorbox{yellow!30}{Nouveau 5.6}\enskip -Néanmoins, on peut forcer la création d'un nœud avec la commande -|\NotEmpty|.\footnote{Il faut toutefois remarquer qu'avec cette commande, la +Néanmoins, on peut forcer la création d'un nœud avec la commande |\NotEmpty|.\footnote{Il faut toutefois remarquer qu'avec cette commande, la case est considérée comme non vide, ce qui a des conséquences sur le tracé des lignes pointillées (cf.~p.~\pageref{Cdots}).} diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf Binary files differindex ac45e01da68..750e4fd6834 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 83f99f5cbd1..c6f1a06f31a 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.8} -\def\myfiledate{2021/01/01} +\def\myfileversion{5.9} +\def\myfiledate{2021/01/08} % % %<*batchfile> @@ -279,17 +279,22 @@ version 2005/12/01 or later. % Inspired by the package \pkg{cellspace} which deals with that problem, the % package \pkg{nicematrix} provides two keys |cell-space-top-limit| and % |cell-space-bottom-limit| similar to the parameters |\cellspacetoplimit| and -% |\cellspacebottomlimit| of \pkg{cellspace}. The initial value of these -% parameters is $0$~pt in order to have for the environments of \pkg{nicematrix} -% the same behaviour as those of \pkg{array} and \pkg{amsmath}. However, a value -% of $1$~pt would probably be a good choice and we suggest to set them with -% |\NiceMatrixOptions|.\footnote{One should remark that these parameters apply -% also to the columns of type |S| of \pkg{siunitx} whereas the package -% \pkg{cellspace} is not able to act on such columns of type~|S|.} +% |\cellspacebottomlimit| of \pkg{cellspace}. +% +% \colorbox{yellow!50}{\bfseries{New 5.9}}\enskip +% There is also a key |cell-space-limits| to set both parameters at once. +% +% The initial value of these parameters is $0$~pt in order to have for the +% environments of \pkg{nicematrix} the same behaviour as those of \pkg{array} +% and \pkg{amsmath}. However, a value of $1$~pt would probably be a good choice +% and we suggest to set them with |\NiceMatrixOptions|.\footnote{One should +% remark that these parameters apply also to the columns of type |S| of +% \pkg{siunitx} whereas the package \pkg{cellspace} is not able to act on such +% columns of type~|S|.} % % \medskip % \begin{Verbatim} -% \NiceMatrixOptions{~emphase#cell-space-top-limit = 1pt,cell-space-bottom-limit = 1pt@} +% \NiceMatrixOptions{~emphase#cell-space-limits = 1pt@} % \end{Verbatim} % % \begin{BVerbatim}[baseline=c,boxwidth=9cm] @@ -299,10 +304,7 @@ version 2005/12/01 or later. % \end{pNiceMatrix}$ % \end{BVerbatim} % \begin{scope} -% \NiceMatrixOptions{ -% cell-space-top-limit = 1pt , -% cell-space-bottom-limit = 1pt , -% } +% \NiceMatrixOptions{cell-space-limits = 1pt} % $\begin{pNiceMatrix} % \frac12 & -\frac12 \\ % \frac13 & \frac14 \\ @@ -419,7 +421,7 @@ version 2005/12/01 or later. % % \smallskip % \begin{Verbatim} -% \NiceMatrixOptions{cell-space-top-limit=1pt,cell-space-bottom-limit=1pt} +% \NiceMatrixOptions{cell-space-limits=1pt} % \end{Verbatim} % % \smallskip @@ -433,7 +435,7 @@ version 2005/12/01 or later. % \end{pNiceArray}$ % \end{BVerbatim} % \begin{scope} -% \NiceMatrixOptions{cell-space-top-limit=1pt,cell-space-bottom-limit=1pt} +% \NiceMatrixOptions{cell-space-limits=1pt} % \raisebox{-5mm}{$A=\begin{pNiceArray}{cc|cc}[baseline=line-3] % \dfrac1A & \dfrac1B & 0 & 0 \\ % \dfrac1C & \dfrac1D & 0 & 0 \\ @@ -461,9 +463,9 @@ version 2005/12/01 or later. % $i$\verb|-|$j$ where $i$ is the number of rows of the block and $j$ its number % of columns. % -% \colorbox{yellow!30}{New 5.6}\enskip If this argument is empty, its -% default value is |1-1|. If the number of rows is not specified, the block -% extends until the last row (idem for the columns). +% If this argument is empty, its default +% value is |1-1|. If the number of rows is not specified, or equal to |*|, the +% block extends until the last row (idem for the columns). % % \item The second argument is the content of the block. It's possible to use % |\\| in that content to have a content on several lines. In |{NiceTabular}| @@ -579,11 +581,11 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % -% \colorbox{yellow!50}{\bfseries New 5.7}\enskip As we can see on this example, -% it's possible to fill the block by using the key |fill| and to draw the frame -% with the key |draw|\footnote{If the key |draw| is used without value, the -% default color the rules of the tabulars is used}. It's also possible to change -% the width (thickness) of that rules with the key |line-width|. +% \colorbox{yellow!30}{New 5.7}\enskip As we can see on this example, it's +% possible to fill the block by using the key |fill| and to draw the frame with +% the key |draw|\footnote{If the key |draw| is used without value, the default +% color the rules of the tabulars is used}. It's also possible to change the +% width (thickness) of that rules with the key |line-width|. % % \subsection{The mono-column blocks} % @@ -636,9 +638,9 @@ version 2005/12/01 or later. % % \subsection{The mono-row blocks} % -% \colorbox{yellow!30}{New 5.6}\enskip For the mono-row blocks, the -% natural height and depth are taken into account for the height and depth of -% the current row (as does a standard |\multicolumn| of LaTeX). +% For the mono-row blocks, the natural height and depth are taken into account +% for the height and depth of the current row (as does a standard |\multicolumn| +% of LaTeX). % % \subsection{The mono-cell blocks} % @@ -1205,10 +1207,6 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{scope} % -% \medskip -% A command |\cellcolor| generates only one instruction |fill| (coded |f|) in the -% resulting \textsc{pdf}. -% % \bigskip % \item The command |\rectanglecolor| takes three mandatory arguments. The first % is the color. The second is the upper-left cell of the rectangle and the third @@ -1274,10 +1272,6 @@ version 2005/12/01 or later. % \end{NiceArray}$ % \end{scope} % -% \medskip -% A command |\rowcolor| generates only one instruction |fill| (coded |f|) in the -% resulting \textsc{pdf}. -% % % \bigskip % \item The command |\columncolor| takes its name from the command @@ -1323,7 +1317,7 @@ version 2005/12/01 or later. % \begin{BVerbatim}[baseline=c,boxwidth=10cm] % \begin{NiceTabular}{clr} % [hvlines,code-before = ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@] -% \Block{1-3}{Results} \\ +% \Block{1-}{Results} \\ % John & 12 \\ % Stephen & 8 \\ % Sarah & 18 \\ @@ -1334,7 +1328,7 @@ version 2005/12/01 or later. % \end{BVerbatim} % \begin{NiceTabular}{clr}[hvlines,code-before = % {\rowcolors{2}{blue!10}{}[cols=2-3,restart]},baseline=2] -% \Block{1-3}{Results} \\ +% \Block{1-}{Results} \\ % \Block{2-1}{A}& John & 12 \\ % & Stephen & 8 \\ % \Block{4-1}{B}& Sarah & 18 \\ @@ -1503,47 +1497,6 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % -% \medskip -% 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, 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. -% -% -% \medskip -% \begin{Verbatim} -% \begin{NiceTabular}[colortbl-like]{ccc}% -% [code-before = ~emphase#\columncolor{blue!15}{1,2}@] -% \toprule -% \rowcolor{red!15} -% Last name & First name & Birth day \\ -% \midrule -% Achard & Jacques & 5 juin 1962 \\ -% Lefebvre & Mathilde & 23 mai 1988 \\ -% Vanesse & Stephany & 30 octobre 1994 \\ -% Dupont & Chantal & 15 janvier 1998 \\ -% \bottomrule -% \end{NiceTabular} -% \end{Verbatim} -% -% -% \begin{center} -% \begin{NiceTabular}[colortbl-like]{ccc}[code-before = \columncolor{blue!15}{1,2}] -% \toprule -% \rowcolor{red!15} -% Last name & First name & Birth day \\ -% \midrule -% Achard & Jacques & 5 juin 1962 \\ -% Lefebvre & Mathilde & 23 mai 1988 \\ -% Vanesse & Stephany & 30 octobre 1994 \\ -% Dupont & Chantal & 15 janvier 1998 \\ -% \bottomrule -% \end{NiceTabular} -% \end{center} % % \section{The width of the columns} % \label{width} @@ -2353,9 +2306,7 @@ version 2005/12/01 or later. % For the legibility of the code, an alternative syntax is provided: it's % possible to give the instructions of the |\code-after| at the end of the % environment, after the keyword |\CodeAfter| (for an example, cf. -% p.~\pageref{example-CodeAfter}). \colorbox{yellow!30}{New 5.5}\enskip -% Before the version 5.5, it was necessary, in some circonstancies, to put the -% keyword |\omit| before |\CodeAfter|. Since version~5.5, one must never put~|\omit|. +% p.~\pageref{example-CodeAfter}). % % % @@ -3016,7 +2967,6 @@ version 2005/12/01 or later. % \textbf{Caution} : By default, no node is created in a empty cell. % % \smallskip -% \colorbox{yellow!30}{New 5.6}\enskip % However, it's possible to impose the creation of a node with the command |\NotEmpty|. % \footnote{One should note that, with that command, the cell is considered as % non-empty, which has consequencies for the continuous dotted lines (cf. @@ -5797,7 +5747,7 @@ version 2005/12/01 or later. % contain an integer (which represents the number of the row to which align the % array). % \begin{macrocode} -\str_new:N \l_@@_baseline_tl +\tl_new:N \l_@@_baseline_tl \tl_set:Nn \l_@@_baseline_tl c % \end{macrocode} % @@ -6005,6 +5955,12 @@ version 2005/12/01 or later. cell-space-top-limit .value_required:n = true , cell-space-bottom-limit .dim_set:N = \l_@@_cell_space_bottom_limit_dim , cell-space-bottom-limit .value_required:n = true , + cell-space-limits .code:n = + { + \dim_set:Nn \l_@@_cell_space_bottom_limit_dim { #1 } + \dim_set:Nn \l_@@_cell_space_top_limit_dim { #1 } + } , + cell-spaces-limits .value_required:n = true , xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , max-delimiter-width .bool_set:N = \l_@@_max_delimiter_width_bool , light-syntax .bool_set:N = \l_@@_light_syntax_bool , @@ -7282,7 +7238,9 @@ version 2005/12/01 or later. % by the user between instructions in the |code-before|. % \begin{macrocode} \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token + \seq_clear_new:N \l_@@_colors_seq \l_@@_code_before_tl + \@@_actually_color: \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token \group_end: } @@ -8329,9 +8287,9 @@ version 2005/12/01 or later. \tl_if_empty:nT { #1 } { \@@_fatal:n { empty~environment } } \tl_map_inline:nn { #1 } { - \tl_if_eq:nnT { ##1 } { & } + \str_if_eq:nnT { ##1 } { & } { \@@_fatal:n { ampersand~in~light-syntax } } - \tl_if_eq:nnT { ##1 } { \\ } + \str_if_eq:nnT { ##1 } { \\ } { \@@_fatal:n { double-backslash~in~light-syntax } } } % \end{macrocode} @@ -10012,59 +9970,6 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_line: { - \pgfrememberpicturepositiononpagetrue - \pgf@relevantforpicturesizefalse - \tl_if_eq:NNTF \l_@@_xdots_line_style_tl \c_@@_standard_tl - \@@_draw_standard_dotted_line: - \@@_draw_non_standard_dotted_line: - } -% \end{macrocode} -% -% \medskip -% We have to do a special construction with |\exp_args:NV| to be able to put in -% the list of options in the correct place in the Tikz instruction. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_non_standard_dotted_line: - { - \begin { scope } - \exp_args:No \@@_draw_non_standard_dotted_line:n - { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl } - } -% \end{macrocode} -% We have used the fact that, in \textsc{pgf}, un color name can be put directly -% in a list of options (that's why we have put diredtly |\l_@@_xdots_color_tl|). -% -% \smallskip -% The argument of |\@@_draw_non_standard_dotted_line:n| is, in fact, the list of options. -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:n #1 - { - \draw - [ - #1 , - shorten~> = \l_@@_xdots_shorten_dim , - shorten~< = \l_@@_xdots_shorten_dim , - ] - ( \l_@@_x_initial_dim , \l_@@_y_initial_dim ) - -- node [ sloped , above ] - { \c_math_toggle_token \scriptstyle \l_@@_xdots_up_tl \c_math_toggle_token } - node [ sloped , below ] - { - \c_math_toggle_token - \scriptstyle \l_@@_xdots_down_tl - \c_math_toggle_token - } - ( \l_@@_x_final_dim , \l_@@_y_final_dim ) ; - \end { scope } - } -% \end{macrocode} -% -% \bigskip -% The command |\@@_draw_standard_dotted_line:| draws the line with our system of points -% (which give a dotted line with real round points). -% \begin{macrocode} -\cs_new_protected:Npn \@@_draw_standard_dotted_line: - { % \end{macrocode} % First, we put the labels. % \begin{macrocode} @@ -10114,6 +10019,50 @@ version 2005/12/01 or later. } \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse + \tl_if_eq:NNTF \l_@@_xdots_line_style_tl \c_@@_standard_tl + \@@_draw_standard_dotted_line: + \@@_draw_non_standard_dotted_line: + } +% \end{macrocode} +% +% \medskip +% We have to do a special construction with |\exp_args:NV| to be able to put in +% the list of options in the correct place in the Tikz instruction. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_non_standard_dotted_line: + { + \begin { scope } + \exp_args:No \@@_draw_non_standard_dotted_line:n + { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl } + } +% \end{macrocode} +% We have used the fact that, in \textsc{pgf}, un color name can be put directly +% in a list of options (that's why we have put diredtly |\l_@@_xdots_color_tl|). +% +% \smallskip +% The argument of |\@@_draw_non_standard_dotted_line:n| is, in fact, the list of options. +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:n #1 + { + \draw + [ + #1 , + shorten~> = \l_@@_xdots_shorten_dim , + shorten~< = \l_@@_xdots_shorten_dim , + ] + ( \l_@@_x_initial_dim , \l_@@_y_initial_dim ) + -- + ( \l_@@_x_final_dim , \l_@@_y_final_dim ) ; + \end { scope } + } +% \end{macrocode} +% +% \bigskip +% The command |\@@_draw_standard_dotted_line:| draws the line with our system of points +% (which give a dotted line with real round points). +% \begin{macrocode} +\cs_new_protected:Npn \@@_draw_standard_dotted_line: + { \group_begin: % \end{macrocode} % The dimension |\l_@@_l_dim| is the length $\ell$ of the line to draw. We use @@ -10832,73 +10781,88 @@ version 2005/12/01 or later. % \bigskip % \subsection*{Colors of cells, rows and columns} % -% In the beginning of the |code-before|, the command |\@@_rowcolor:nn| will be -% linked to |\rowcolor| and the command |\@@_columncolor:nn| to |\columncolor|. +% We want to avoid the thin white lines that are shown in some \textsc{pdf} +% viewers (eg: with the engine MuPDF used by SumatraPDF). That's why we try to +% draw rectangles of the same color in the same instruction |\pgfusepathqfill| +% (and they will be in the same instruction |fill|---coded |f|--- in the +% resulting \textsc{pdf}). +% +% The commands |\@@_rowcolor|, |\@@_columncolor| and |\@@_rectanglecolor| +% (which are linked to |\rowcolor|, |\columncolor| and |\rectanglecolor| before +% the execution of the |code-before|) don't directly draw the corresponding +% rectangles. Instead, they store their instructions color by color: +% \begin{itemize} +% \item A sequence |\l_@@_colors_seq| will be built containing all the colors +% used by at least one of these instructions. Each \emph{color} may be prefixed +% by it color model (eg: |[gray]{0.5}|). +% \item For the color whose index in |\l_@@_colors_seq| is equal to~$i$, a list of +% instructions which use that color will be constructed in the token list +% |\l_@@_color_|$i$|_tl|. In that token list, the instructions will +% |\@@_rowcolor:n|, |\@@_columncolor:n| and |\@@_rectanglecolor:nn| +% (corresponding of |\@@_rowcolor|, |\@@_columncolor| and |\@@_rectanglecolor|). +% \end{itemize} +% % +% bigskip +% |#1| is the color and |#2| is an instruction using that color. Despite its +% name, the command |\@@_add_to_color_seq| doesn't only add a color to +% |\l_@@_colors_seq|: it also updates the corresponding token list +% |\l_@@_color_|$i$|_tl|. % \begin{macrocode} -\cs_set_protected:Npn \@@_cut_on_hyphen:w #1-#2\q_stop +\cs_new_protected:Npn \@@_add_to_colors_seq:nn #1 #2 { - \tl_set:Nn \l_tmpa_tl { #1 } - \tl_set:Nn \l_tmpb_tl { #2 } - } % \end{macrocode} -% -% \bigskip -% The following command uses two implicit arguments : |\l_@@_rows_tl| and -% |\l_@@_cols_tl| which are specifications for a set of row and a set of -% columns. The cartesian product is filled with the current color. +% Firt, we look for the number of the color and, if it's found, we store it in +% |\l_tmpa_int|. If the color is not present in |\l_@@_colors_seq|, +% |\l_tmpa_int| will remain equal to $0$. % \begin{macrocode} -\cs_new_protected:Npn \@@_cartesian_fill: - { + \int_zero:N \l_tmpa_int + \seq_map_indexed_inline:Nn \l_@@_colors_seq + { \tl_if_eq:nnT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } } + \int_compare:nNnTF \l_tmpa_int = \c_zero_int % \end{macrocode} -% We begin the loop over the columns. +% First, the case where the color is a \emph{new} color (not in the sequence). % \begin{macrocode} - \clist_map_inline:Nn \l_@@_cols_tl { - \tl_set:Nn \l_tmpa_tl { ##1 } - \tl_if_in:NnTF \l_tmpa_tl { - } - { \@@_cut_on_hyphen:w ##1 \q_stop } - { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop } - \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } - \tl_if_empty:NT \l_tmpb_tl - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \int_compare:nNnT \l_tmpb_tl > \c@jCol - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \@@_qpoint:n { col - \l_tmpa_tl } - \bool_lazy_and:nnTF - { \str_if_eq_p:Vn \l_tmpa_tl 0 } - { \int_compare_p:nNn \l_@@_first_col_int > 0 } - { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } - { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } - \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } + \seq_put_right:Nn \l_@@_colors_seq { #1 } + \tl_set:cn { l_@@_color _ \seq_count:N \l_@@_colors_seq _ tl } { #2 } + } % \end{macrocode} -% We begin the loop over the rows +% Now, the case where the color is \emph{not} a new color (the color is in the +% sequence at the position |\l_tmpa_int|). % \begin{macrocode} - \clist_map_inline:Nn \l_@@_rows_tl - { - \tl_set:Nn \l_tmpa_tl { ####1 } - \tl_if_in:NnTF \l_tmpa_tl { - } - { \@@_cut_on_hyphen:w ####1 \q_stop } - { \@@_cut_on_hyphen:w ####1 - ####1 \q_stop } - \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } - \tl_if_empty:NT \l_tmpb_tl - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } - \int_compare:nNnT \l_tmpb_tl > \c@iRow - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } + { \tl_put_right:cn { l_@@_color _ \int_use:N \l_tmpa_int _tl } { #2 } } + } % \end{macrocode} -% Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|. +% % \begin{macrocode} - \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } - \@@_qpoint:n { row - \l_tmpa_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } - \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } - { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - } +\cs_generate_variant:Nn \@@_add_to_colors_seq:nn { x n } +% \end{macrocode} +% +% \bigskip +% The macro |\@@_actually_color:| will actually fill all the rectangles, color by +% color (using the sequence |\l_@@_colors_seq| and all the token lists of the +% form |\l_@@_color_|$i$|_tl|). +% \begin{macrocode} +\cs_new_protected:Npn \@@_actually_color: + { + \pgfpicture + \pgf@relevantforpicturesizefalse + \seq_map_indexed_inline:Nn \l_@@_colors_seq + { + \color ##2 + \use:c { l_@@_color _ ##1 _tl } + \pgfusepathqfill } - \pgfusepathqfill + \endpgfpicture + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_set_protected:Npn \@@_cut_on_hyphen:w #1-#2\q_stop + { + \tl_set:Nn \l_tmpa_tl { #1 } + \tl_set:Nn \l_tmpb_tl { #2 } } % \end{macrocode} % @@ -10910,18 +10874,23 @@ version 2005/12/01 or later. { \tl_if_blank:nF { #2 } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \tl_set:Nn \l_@@_rows_tl { #3 } - \tl_set:Nn \l_@@_cols_tl { - } + \@@_add_to_colors_seq:xn + { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } + { \@@_rowcolor:n { #3 } } + } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_rowcolor:n #1 + { + \tl_set:Nn \l_@@_rows_tl { #1 } + \tl_set:Nn \l_@@_cols_tl { - } % \end{macrocode} -% The command |\@@_cartesian_fill:| takes in two implicit arguments: +% The command |\@@_cartesian_path:| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_row_tl|. % \begin{macrocode} - \@@_cartesian_fill: - \endpgfpicture - } + \@@_cartesian_path: } % \end{macrocode} % @@ -10933,18 +10902,22 @@ version 2005/12/01 or later. { \tl_if_blank:nF { #2 } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \tl_set:Nn \l_@@_rows_tl { - } - \tl_set:Nn \l_@@_cols_tl { #3 } + \@@_add_to_colors_seq:xn + { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } + { \@@_columncolor:n { #3 } } + } + } +% \end{macrocode} +% \begin{macrocode} +\cs_new_protected:Npn \@@_columncolor:n #1 + { + \tl_set:Nn \l_@@_rows_tl { - } + \tl_set:Nn \l_@@_cols_tl { #1 } % \end{macrocode} -% The command |\@@_cartesian_fill:| takes in two implicit arguments: +% The command |\@@_cartesian_path:| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_row_tl|. % \begin{macrocode} - \@@_cartesian_fill: - \endpgfpicture - } + \@@_cartesian_path: } % \end{macrocode} % @@ -10955,19 +10928,17 @@ version 2005/12/01 or later. \NewDocumentCommand \@@_rectanglecolor { O { } m m m } { \tl_if_blank:nF { #2 } - { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \@@_rectanglecolor_i:nn { #3 } { #4 } - \endpgfpicture + { + \@@_add_to_colors_seq:xn + { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } + { \@@_rectanglecolor:nn { #3 } { #4 } } } } % \end{macrocode} % % \bigskip % \begin{macrocode} -\cs_new_protected:Npn \@@_rectanglecolor_i:nn #1 #2 +\cs_new_protected:Npn \@@_rectanglecolor:nn #1 #2 { \@@_cut_on_hyphen:w #1 \q_stop \tl_clear_new:N \l_tmpc_tl @@ -10978,10 +10949,10 @@ version 2005/12/01 or later. \tl_set:Nx \l_@@_rows_tl { \l_tmpc_tl - \l_tmpa_tl } \tl_set:Nx \l_@@_cols_tl { \l_tmpd_tl - \l_tmpb_tl } % \end{macrocode} -% The command |\@@_cartesian_fill:| takes in two implicit arguments: +% The command |\@@_cartesian_path:| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_row_tl|. % \begin{macrocode} - \@@_cartesian_fill: + \@@_cartesian_path: } % \end{macrocode} % @@ -10991,18 +10962,28 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \@@_cellcolor { O { } m m } { - \tl_if_blank:nF { #2 } + \clist_map_inline:nn { #3 } + { \@@_rectanglecolor [ #1 ] { #2 } { ##1 } { ##1 } } + } +% \end{macrocode} +% +% \bigskip +% \begin{macrocode} +\NewDocumentCommand \@@_chessboardcolors { O { } m m } + { + \int_step_inline:nn { \int_use:N \c@iRow } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \clist_map_inline:nn { #3 } - { \@@_rectanglecolor_i:nn { ##1 } { ##1 } } - \pgfusepathqfill - \endpgfpicture - } + \int_step_inline:nn { \int_use:N \c@jCol } + { + \int_if_even:nTF { ####1 + ##1 } + { \@@_cellcolor [ #1 ] { #2 } } + { \@@_cellcolor [ #1 ] { #3 } } + { ##1 - ####1 } + } + } } % \end{macrocode} +% % % \bigskip % \begin{macrocode} @@ -11112,10 +11093,11 @@ version 2005/12/01 or later. { \color [ #1 ] } { #3 } % \end{macrocode} -% The command |\@@_cartesian_fill:| takes in two implicit arguments: +% The command |\@@_cartesian_path:| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_row_tl|. % \begin{macrocode} - \@@_cartesian_fill: + \@@_cartesian_path: + \pgfusepathqfill } \bool_set_false:N \l_tmpa_bool } @@ -11127,10 +11109,11 @@ version 2005/12/01 or later. { \color [ #1 ] } { #4 } % \end{macrocode} -% The command |\@@_cartesian_fill:| takes in two implicit arguments: +% The command |\@@_cartesian_path:| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_row_tl|. % \begin{macrocode} - \@@_cartesian_fill: + \@@_cartesian_path: + \pgfusepathqfill } \bool_set_true:N \l_tmpa_bool } @@ -11182,23 +11165,65 @@ version 2005/12/01 or later. % \end{macrocode} % % +% % \bigskip +% The following command uses two implicit arguments : |\l_@@_rows_tl| and +% |\l_@@_cols_tl| which are specifications for a set of rows and a set of +% columns. It creates a path but does \emph{not} fill it. It must be filled by +% another command after. % \begin{macrocode} -\NewDocumentCommand \@@_chessboardcolors { O { } m m } - { - \int_step_inline:nn { \int_use:N \c@iRow } +\cs_new_protected:Npn \@@_cartesian_path: + { +% \end{macrocode} +% We begin the loop over the columns. +% \begin{macrocode} + \clist_map_inline:Nn \l_@@_cols_tl { - \int_step_inline:nn { \int_use:N \c@jCol } - { - \int_if_even:nTF { ####1 + ##1 } - { \@@_cellcolor [ #1 ] { #2 } } - { \@@_cellcolor [ #1 ] { #3 } } - { ##1 - ####1 } + \tl_set:Nn \l_tmpa_tl { ##1 } + \tl_if_in:NnTF \l_tmpa_tl { - } + { \@@_cut_on_hyphen:w ##1 \q_stop } + { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop } + \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } + \tl_if_empty:NT \l_tmpb_tl + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } + \int_compare:nNnT \l_tmpb_tl > \c@jCol + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } + \@@_qpoint:n { col - \l_tmpa_tl } + \int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl + { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } + \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } + \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } +% \end{macrocode} +% We begin the loop over the rows +% \begin{macrocode} + \clist_map_inline:Nn \l_@@_rows_tl + { + \tl_set:Nn \l_tmpa_tl { ####1 } + \tl_if_in:NnTF \l_tmpa_tl { - } + { \@@_cut_on_hyphen:w ####1 \q_stop } + { \@@_cut_on_hyphen:w ####1 - ####1 \q_stop } + \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } + \tl_if_empty:NT \l_tmpb_tl + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } + \int_compare:nNnT \l_tmpb_tl > \c@iRow + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } +% \end{macrocode} +% Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|. +% \begin{macrocode} + \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } + \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } + \@@_qpoint:n { row - \l_tmpa_tl } + \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } + \pgfpathrectanglecorners + { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l_tmpa_dim \l_tmpb_dim } } - } + } } % \end{macrocode} % +% % \bigskip % When the user uses the key |colortbl-like|, the following command will % be linked to |\cellcolor| in the tabular. @@ -11211,7 +11236,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% When the user uses the key |rowcolor-in-tabular|, the following command will +% When the user uses the key |colortbll-like|, the following command will % be linked to |\rowcolor| in the tabular. % \begin{macrocode} \NewDocumentCommand \@@_rowcolor_tabular { O { } m } @@ -12646,8 +12671,27 @@ version 2005/12/01 or later. { % \end{macrocode} % +% \medskip +% We recall that |#1| and |#2| have been extracted from the first mandatory +% argument of |\Block| (which is of the syntax $i$|-|$j$). However, the user is +% allowed to omit $i$ or $j$ (or both). We detect that situation by replacing a +% missing value by 100 (it's a convention: when the block will actually be drawn +% these values will be detected and interpreted as \emph{maximal possible value}). +% \begin{macrocode} + \bool_lazy_or:nnTF + { \tl_if_blank_p:n { #1 } } + { \str_if_eq_p:nn { #1 } { * } } + { \int_set:Nn \l_tmpa_int { 100 } } + { \int_set:Nn \l_tmpa_int { #1 } } + \bool_lazy_or:nnTF + { \tl_if_blank_p:n { #2 } } + { \str_if_eq_p:nn { #2 } { * } } + { \int_set:Nn \l_tmpb_int { 100 } } + { \int_set:Nn \l_tmpb_int { #2 } } +% \end{macrocode} +% % \begin{macrocode} - \int_compare:nNnTF { #2 } = 1 + \int_compare:nNnTF \l_tmpb_int = 1 { \tl_if_empty:NTF \l_@@_cell_type_tl { \tl_set:Nn \l_@@_pos_of_block_tl c } @@ -12661,20 +12705,6 @@ version 2005/12/01 or later. \keys_set_known:nn { NiceMatrix / Block / FirstPass } { #3 } % \end{macrocode} % -% \medskip -% We recall that |#1| and |#2| have been extracted from the first mandatory -% argument of |\Block| (which is of the syntax $i$|-|$j$). However, the user is -% allowed to omit $i$ or $j$ (or both). We detect that situation by replacing a -% missing value by 100 (it's a convention: when the block will actually be drawn -% these values will be detected and interpreted as \emph{maximal possible value}). -% \begin{macrocode} - \tl_if_empty:nTF { #1 } - { \int_set:Nn \l_tmpa_int { 100 } } - { \int_set:Nn \l_tmpa_int { #1 } } - \tl_if_empty:nTF { #2 } - { \int_set:Nn \l_tmpb_int { 100 } } - { \int_set:Nn \l_tmpb_int { #2 } } -% \end{macrocode} % % \begin{macrocode} \tl_set:Nx \l_tmpa_tl @@ -12693,14 +12723,14 @@ version 2005/12/01 or later. % % \medskip % If the block is mono-column or mono-row, we have a special treatment. That's -% why we have two macros: |\@@_Block_iii:nnnnn| and |\@@_Block_iv:nnnnn| (the five +% why we have two macros: |\@@_Block_iv:nnnnn| and |\@@_Block_v:nnnnn| (the five % arguments of those macros are provided by curryfication). % \begin{macrocode} \bool_lazy_or:nnTF { \int_compare_p:nNn { \l_tmpa_int } = 1 } { \int_compare_p:nNn { \l_tmpb_int } = 1 } - { \exp_args:Nxx \@@_Block_iii:nnnnn } { \exp_args:Nxx \@@_Block_iv:nnnnn } + { \exp_args:Nxx \@@_Block_v:nnnnn } { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } } % \end{macrocode} @@ -12714,7 +12744,7 @@ version 2005/12/01 or later. % current row). However, that box will be put in the array \emph{after the % construction of the array} (by using \textsc{pgf}). % \begin{macrocode} -\cs_new_protected:Npn \@@_Block_iii:nnnnn #1 #2 #3 #4 #5 +\cs_new_protected:Npn \@@_Block_iv:nnnnn #1 #2 #3 #4 #5 { \int_gincr:N \g_@@_block_box_int \cs_set_protected_nopar:Npn \diagbox ##1 ##2 @@ -12847,7 +12877,7 @@ version 2005/12/01 or later. % composed right now in a box. The composition in a box will be done further, % just after the construction of the array. % \begin{macrocode} -\cs_new_protected:Npn \@@_Block_iv:nnnnn #1 #2 #3 #4 #5 +\cs_new_protected:Npn \@@_Block_v:nnnnn #1 #2 #3 #4 #5 { \seq_gput_right:Nx \g_@@_blocks_seq { @@ -12941,13 +12971,14 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_draw_blocks: { \cs_set_eq:NN \ialign \@@_old_ialign: - \seq_map_inline:Nn \g_@@_blocks_seq { \@@_Block_iii:nnnnnn ##1 } + \seq_map_inline:Nn \g_@@_blocks_seq { \@@_Block_iv:nnnnnn ##1 } } % \end{macrocode} % % \begin{macrocode} -\cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \@@_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6 { +% \end{macrocode} % The integer |\l_@@_last_row_int| will be the last row of the block and % |\l_@@_last_col_int| its last column. % \begin{macrocode} @@ -12985,12 +13016,12 @@ version 2005/12/01 or later. } { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } } } - { \@@_Block_iv:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { \@@_Block_v:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } } % \end{macrocode} % % \begin{macrocode} -\cs_new_protected:Npn \@@_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \@@_Block_v:nnnnnn #1 #2 #3 #4 #5 #6 { % \end{macrocode} % The sequence of the positions of the blocks will be used when drawing the rules @@ -13950,7 +13981,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { ampersand~in~light-syntax } { - You~can't~use~an~ampersand~(\token_to_str &)~to~separate~columns~because + You~can't~use~an~ampersand~(\token_to_str:N &)~to~separate~columns~because~ ~you~have~used~the~key~'light-syntax'.~This~error~is~fatal. } % \end{macrocode} @@ -14187,6 +14218,7 @@ version 2005/12/01 or later. The~available~keys~are~(in~alphabetic~order):~ allow-duplicate-names,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-for-first-col,~ code-for-first-row,~ @@ -14235,6 +14267,7 @@ version 2005/12/01 or later. baseline,~ c,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-after,~ code-for-first-col,~ @@ -14293,6 +14326,7 @@ version 2005/12/01 or later. baseline,~ c,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-after,~ code-for-first-col,~ @@ -14347,6 +14381,7 @@ version 2005/12/01 or later. baseline,~ c,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-after,~ code-for-first-col,~ @@ -14818,6 +14853,14 @@ version 2005/12/01 or later. % % Better error messages for the command |\Block|. % +% \subsection*{Changes between versions 5.8 and 5.9} +% +% Correction of a bug: in the previous versions, it was not possible to use the +% key |line-style| for the continuous dotted lines when the Tikz library |babel| +% was loaded. +% +% New key |cell-space-limits|. +% % \PrintIndex % % \tableofcontents diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.ins b/Master/texmf-dist/source/latex/nicematrix/nicematrix.ins index 7c31f665795..b6fbed12ca8 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.ins +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2018-2020 by F. Pantigny +%% Copyright (C) 2018-2021 by F. Pantigny %% %% %% This file may be distributed and/or modified under the @@ -17,7 +17,7 @@ \usedir{tex/latex/nicematrix} \preamble -Copyright (C) 2018-2020 by F. Pantigny +Copyright (C) 2018-2021 by F. Pantigny This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty index e43f82a0591..8e8cb2bc878 100644 --- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty +++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty @@ -6,7 +6,7 @@ %% %% nicematrix.dtx (with options: `package') %% -%% Copyright (C) 2018-2020 by F. Pantigny +%% Copyright (C) 2018-2021 by F. Pantigny %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -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.8} -\def\myfiledate{2021/01/01} +\def\myfileversion{5.9} +\def\myfiledate{2021/01/08} \RequirePackage{pgfcore} \usepgfmodule{shapes} \RequirePackage{l3keys2e} @@ -452,7 +452,7 @@ \tl_const:Nn \c__nicematrix_standard_tl { standard } \tl_set_eq:NN \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl \bool_new:N \l__nicematrix_light_syntax_bool -\str_new:N \l__nicematrix_baseline_tl +\tl_new:N \l__nicematrix_baseline_tl \tl_set:Nn \l__nicematrix_baseline_tl c \bool_new:N \l__nicematrix_exterior_arraycolsep_bool \bool_new:N \l__nicematrix_parallelize_diags_bool @@ -511,6 +511,12 @@ cell-space-top-limit .value_required:n = true , cell-space-bottom-limit .dim_set:N = \l__nicematrix_cell_space_bottom_limit_dim , cell-space-bottom-limit .value_required:n = true , + cell-space-limits .code:n = + { + \dim_set:Nn \l__nicematrix_cell_space_bottom_limit_dim { #1 } + \dim_set:Nn \l__nicematrix_cell_space_top_limit_dim { #1 } + } , + cell-spaces-limits .value_required:n = true , xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , max-delimiter-width .bool_set:N = \l__nicematrix_max_delimiter_width_bool , light-syntax .bool_set:N = \l__nicematrix_light_syntax_bool , @@ -1216,7 +1222,9 @@ \cs_set_eq:NN \columncolor \__nicematrix_columncolor \cs_set_eq:NN \chessboardcolors \__nicematrix_chessboardcolors \bool_if:NT \l__nicematrix_NiceTabular_bool \c_math_toggle_token + \seq_clear_new:N \l__nicematrix_colors_seq \l__nicematrix_code_before_tl + \__nicematrix_actually_color: \bool_if:NT \l__nicematrix_NiceTabular_bool \c_math_toggle_token \group_end: } @@ -1805,9 +1813,9 @@ \tl_if_empty:nT { #1 } { \__nicematrix_fatal:n { empty~environment } } \tl_map_inline:nn { #1 } { - \tl_if_eq:nnT { ##1 } { & } + \str_if_eq:nnT { ##1 } { & } { \__nicematrix_fatal:n { ampersand~in~light-syntax } } - \tl_if_eq:nnT { ##1 } { \\ } + \str_if_eq:nnT { ##1 } { \\ } { \__nicematrix_fatal:n { double-backslash~in~light-syntax } } } \__nicematrix_light_syntax_i #1 \CodeAfter \q_stop @@ -2798,40 +2806,6 @@ } \cs_new_protected:Npn \__nicematrix_draw_line: { - \pgfrememberpicturepositiononpagetrue - \pgf@relevantforpicturesizefalse - \tl_if_eq:NNTF \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl - \__nicematrix_draw_standard_dotted_line: - \__nicematrix_draw_non_standard_dotted_line: - } -\cs_new_protected:Npn \__nicematrix_draw_non_standard_dotted_line: - { - \begin { scope } - \exp_args:No \__nicematrix_draw_non_standard_dotted_line:n - { \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl } - } -\cs_new_protected:Npn \__nicematrix_draw_non_standard_dotted_line:n #1 - { - \draw - [ - #1 , - shorten~> = \l__nicematrix_xdots_shorten_dim , - shorten~< = \l__nicematrix_xdots_shorten_dim , - ] - ( \l__nicematrix_x_initial_dim , \l__nicematrix_y_initial_dim ) - -- node [ sloped , above ] - { \c_math_toggle_token \scriptstyle \l__nicematrix_xdots_up_tl \c_math_toggle_token } - node [ sloped , below ] - { - \c_math_toggle_token - \scriptstyle \l__nicematrix_xdots_down_tl - \c_math_toggle_token - } - ( \l__nicematrix_x_final_dim , \l__nicematrix_y_final_dim ) ; - \end { scope } - } -\cs_new_protected:Npn \__nicematrix_draw_standard_dotted_line: - { \bool_lazy_and:nnF { \tl_if_empty_p:N \l__nicematrix_xdots_up_tl } { \tl_if_empty_p:N \l__nicematrix_xdots_down_tl } @@ -2878,6 +2852,31 @@ } \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse + \tl_if_eq:NNTF \l__nicematrix_xdots_line_style_tl \c__nicematrix_standard_tl + \__nicematrix_draw_standard_dotted_line: + \__nicematrix_draw_non_standard_dotted_line: + } +\cs_new_protected:Npn \__nicematrix_draw_non_standard_dotted_line: + { + \begin { scope } + \exp_args:No \__nicematrix_draw_non_standard_dotted_line:n + { \l__nicematrix_xdots_line_style_tl , \l__nicematrix_xdots_color_tl } + } +\cs_new_protected:Npn \__nicematrix_draw_non_standard_dotted_line:n #1 + { + \draw + [ + #1 , + shorten~> = \l__nicematrix_xdots_shorten_dim , + shorten~< = \l__nicematrix_xdots_shorten_dim , + ] + ( \l__nicematrix_x_initial_dim , \l__nicematrix_y_initial_dim ) + -- + ( \l__nicematrix_x_final_dim , \l__nicematrix_y_final_dim ) ; + \end { scope } + } +\cs_new_protected:Npn \__nicematrix_draw_standard_dotted_line: + { \group_begin: \dim_zero_new:N \l__nicematrix_l_dim \dim_set:Nn \l__nicematrix_l_dim @@ -3355,92 +3354,76 @@ \dim_set_eq:NN \l__nicematrix_y_final_dim \pgf@y \__nicematrix_draw_line: } -\cs_set_protected:Npn \__nicematrix_cut_on_hyphen:w #1-#2\q_stop +\cs_new_protected:Npn \__nicematrix_add_to_colors_seq:nn #1 #2 { - \tl_set:Nn \l_tmpa_tl { #1 } - \tl_set:Nn \l_tmpb_tl { #2 } + \int_zero:N \l_tmpa_int + \seq_map_indexed_inline:Nn \l__nicematrix_colors_seq + { \tl_if_eq:nnT { #1 } { ##2 } { \int_set:Nn \l_tmpa_int { ##1 } } } + \int_compare:nNnTF \l_tmpa_int = \c_zero_int + { + \seq_put_right:Nn \l__nicematrix_colors_seq { #1 } + \tl_set:cn { l__nicematrix_color _ \seq_count:N \l__nicematrix_colors_seq _ tl } { #2 } + } + { \tl_put_right:cn { l__nicematrix_color _ \int_use:N \l_tmpa_int _tl } { #2 } } } -\cs_new_protected:Npn \__nicematrix_cartesian_fill: +\cs_generate_variant:Nn \__nicematrix_add_to_colors_seq:nn { x n } +\cs_new_protected:Npn \__nicematrix_actually_color: { - \clist_map_inline:Nn \l__nicematrix_cols_tl + \pgfpicture + \pgf@relevantforpicturesizefalse + \seq_map_indexed_inline:Nn \l__nicematrix_colors_seq { - \tl_set:Nn \l_tmpa_tl { ##1 } - \tl_if_in:NnTF \l_tmpa_tl { - } - { \__nicematrix_cut_on_hyphen:w ##1 \q_stop } - { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop } - \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } - \tl_if_empty:NT \l_tmpb_tl - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \int_compare:nNnT \l_tmpb_tl > \c@jCol - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } - \__nicematrix_qpoint:n { col - \l_tmpa_tl } - \bool_lazy_and:nnTF - { \str_if_eq_p:Vn \l_tmpa_tl 0 } - { \int_compare_p:nNn \l__nicematrix_first_col_int > 0 } - { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } - { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } - \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } - \clist_map_inline:Nn \l__nicematrix_rows_tl - { - \tl_set:Nn \l_tmpa_tl { ####1 } - \tl_if_in:NnTF \l_tmpa_tl { - } - { \__nicematrix_cut_on_hyphen:w ####1 \q_stop } - { \__nicematrix_cut_on_hyphen:w ####1 - ####1 \q_stop } - \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } - \tl_if_empty:NT \l_tmpb_tl - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } - \int_compare:nNnT \l_tmpb_tl > \c@iRow - { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } - \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } - \__nicematrix_qpoint:n { row - \l_tmpa_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } - \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } - { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - } + \color ##2 + \use:c { l__nicematrix_color _ ##1 _tl } + \pgfusepathqfill } - \pgfusepathqfill + \endpgfpicture + } +\cs_set_protected:Npn \__nicematrix_cut_on_hyphen:w #1-#2\q_stop + { + \tl_set:Nn \l_tmpa_tl { #1 } + \tl_set:Nn \l_tmpb_tl { #2 } } \NewDocumentCommand \__nicematrix_rowcolor { O { } m m } { \tl_if_blank:nF { #2 } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \tl_set:Nn \l__nicematrix_rows_tl { #3 } - \tl_set:Nn \l__nicematrix_cols_tl { - } - \__nicematrix_cartesian_fill: - \endpgfpicture + \__nicematrix_add_to_colors_seq:xn + { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } + { \__nicematrix_rowcolor:n { #3 } } } } +\cs_new_protected:Npn \__nicematrix_rowcolor:n #1 + { + \tl_set:Nn \l__nicematrix_rows_tl { #1 } + \tl_set:Nn \l__nicematrix_cols_tl { - } + \__nicematrix_cartesian_path: + } \NewDocumentCommand \__nicematrix_columncolor { O { } m m } { \tl_if_blank:nF { #2 } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \tl_set:Nn \l__nicematrix_rows_tl { - } - \tl_set:Nn \l__nicematrix_cols_tl { #3 } - \__nicematrix_cartesian_fill: - \endpgfpicture - } + \__nicematrix_add_to_colors_seq:xn + { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } + { \__nicematrix_columncolor:n { #3 } } + } + } +\cs_new_protected:Npn \__nicematrix_columncolor:n #1 + { + \tl_set:Nn \l__nicematrix_rows_tl { - } + \tl_set:Nn \l__nicematrix_cols_tl { #1 } + \__nicematrix_cartesian_path: } \NewDocumentCommand \__nicematrix_rectanglecolor { O { } m m m } { \tl_if_blank:nF { #2 } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \__nicematrix_rectanglecolor_i:nn { #3 } { #4 } - \endpgfpicture + \__nicematrix_add_to_colors_seq:xn + { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } + { \__nicematrix_rectanglecolor:nn { #3 } { #4 } } } } -\cs_new_protected:Npn \__nicematrix_rectanglecolor_i:nn #1 #2 +\cs_new_protected:Npn \__nicematrix_rectanglecolor:nn #1 #2 { \__nicematrix_cut_on_hyphen:w #1 \q_stop \tl_clear_new:N \l_tmpc_tl @@ -3450,19 +3433,24 @@ \__nicematrix_cut_on_hyphen:w #2 \q_stop \tl_set:Nx \l__nicematrix_rows_tl { \l_tmpc_tl - \l_tmpa_tl } \tl_set:Nx \l__nicematrix_cols_tl { \l_tmpd_tl - \l_tmpb_tl } - \__nicematrix_cartesian_fill: + \__nicematrix_cartesian_path: } \NewDocumentCommand \__nicematrix_cellcolor { O { } m m } { - \tl_if_blank:nF { #2 } + \clist_map_inline:nn { #3 } + { \__nicematrix_rectanglecolor [ #1 ] { #2 } { ##1 } { ##1 } } + } +\NewDocumentCommand \__nicematrix_chessboardcolors { O { } m m } + { + \int_step_inline:nn { \int_use:N \c@iRow } { - \pgfpicture - \pgf@relevantforpicturesizefalse - \tl_if_empty:nTF { #1 } \color { \color [ #1 ] } { #2 } - \clist_map_inline:nn { #3 } - { \__nicematrix_rectanglecolor_i:nn { ##1 } { ##1 } } - \pgfusepathqfill - \endpgfpicture + \int_step_inline:nn { \int_use:N \c@jCol } + { + \int_if_even:nTF { ####1 + ##1 } + { \__nicematrix_cellcolor [ #1 ] { #2 } } + { \__nicematrix_cellcolor [ #1 ] { #3 } } + { ##1 - ####1 } + } } } \keys_define:nn { NiceMatrix / rowcolors } @@ -3530,7 +3518,8 @@ \color { \color [ #1 ] } { #3 } - \__nicematrix_cartesian_fill: + \__nicematrix_cartesian_path: + \pgfusepathqfill } \bool_set_false:N \l_tmpa_bool } @@ -3541,7 +3530,8 @@ \color { \color [ #1 ] } { #4 } - \__nicematrix_cartesian_fill: + \__nicematrix_cartesian_path: + \pgfusepathqfill } \bool_set_true:N \l_tmpa_bool } @@ -3575,16 +3565,43 @@ \prg_return_true: \prg_return_false: } -\NewDocumentCommand \__nicematrix_chessboardcolors { O { } m m } +\cs_new_protected:Npn \__nicematrix_cartesian_path: { - \int_step_inline:nn { \int_use:N \c@iRow } + \clist_map_inline:Nn \l__nicematrix_cols_tl { - \int_step_inline:nn { \int_use:N \c@jCol } + \tl_set:Nn \l_tmpa_tl { ##1 } + \tl_if_in:NnTF \l_tmpa_tl { - } + { \__nicematrix_cut_on_hyphen:w ##1 \q_stop } + { \__nicematrix_cut_on_hyphen:w ##1 - ##1 \q_stop } + \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } + \tl_if_empty:NT \l_tmpb_tl + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } + \int_compare:nNnT \l_tmpb_tl > \c@jCol + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } + \__nicematrix_qpoint:n { col - \l_tmpa_tl } + \int_compare:nNnTF \l__nicematrix_first_col_int = \l_tmpa_tl + { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } + \__nicematrix_qpoint:n { col - \__nicematrix_succ:n \l_tmpb_tl } + \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } + \clist_map_inline:Nn \l__nicematrix_rows_tl { - \int_if_even:nTF { ####1 + ##1 } - { \__nicematrix_cellcolor [ #1 ] { #2 } } - { \__nicematrix_cellcolor [ #1 ] { #3 } } - { ##1 - ####1 } + \tl_set:Nn \l_tmpa_tl { ####1 } + \tl_if_in:NnTF \l_tmpa_tl { - } + { \__nicematrix_cut_on_hyphen:w ####1 \q_stop } + { \__nicematrix_cut_on_hyphen:w ####1 - ####1 \q_stop } + \tl_if_empty:NT \l_tmpa_tl { \tl_set:Nn \l_tmpa_tl { 1 } } + \tl_if_empty:NT \l_tmpb_tl + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } + \int_compare:nNnT \l_tmpb_tl > \c@iRow + { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@iRow } } + \__nicematrix_qpoint:n { row - \__nicematrix_succ:n \l_tmpb_tl } + \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } + \__nicematrix_qpoint:n { row - \l_tmpa_tl } + \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } + \pgfpathrectanglecorners + { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l_tmpa_dim \l_tmpb_dim } } } } @@ -4371,7 +4388,17 @@ \cs_new:Npn \__nicematrix_Block_i #1-#2 \q_stop { \__nicematrix_Block_ii:nnnnn { #1 } { #2 } } \cs_new_protected:Npn \__nicematrix_Block_ii:nnnnn #1 #2 #3 #4 #5 { - \int_compare:nNnTF { #2 } = 1 + \bool_lazy_or:nnTF + { \tl_if_blank_p:n { #1 } } + { \str_if_eq_p:nn { #1 } { * } } + { \int_set:Nn \l_tmpa_int { 100 } } + { \int_set:Nn \l_tmpa_int { #1 } } + \bool_lazy_or:nnTF + { \tl_if_blank_p:n { #2 } } + { \str_if_eq_p:nn { #2 } { * } } + { \int_set:Nn \l_tmpb_int { 100 } } + { \int_set:Nn \l_tmpb_int { #2 } } + \int_compare:nNnTF \l_tmpb_int = 1 { \tl_if_empty:NTF \l__nicematrix_cell_type_tl { \tl_set:Nn \l__nicematrix_pos_of_block_tl c } @@ -4379,12 +4406,6 @@ } { \tl_set:Nn \l__nicematrix_pos_of_block_tl c } \keys_set_known:nn { NiceMatrix / Block / FirstPass } { #3 } - \tl_if_empty:nTF { #1 } - { \int_set:Nn \l_tmpa_int { 100 } } - { \int_set:Nn \l_tmpa_int { #1 } } - \tl_if_empty:nTF { #2 } - { \int_set:Nn \l_tmpb_int { 100 } } - { \int_set:Nn \l_tmpb_int { #2 } } \tl_set:Nx \l_tmpa_tl { { \int_use:N \c@iRow } @@ -4395,11 +4416,11 @@ \bool_lazy_or:nnTF { \int_compare_p:nNn { \l_tmpa_int } = 1 } { \int_compare_p:nNn { \l_tmpb_int } = 1 } - { \exp_args:Nxx \__nicematrix_Block_iii:nnnnn } { \exp_args:Nxx \__nicematrix_Block_iv:nnnnn } + { \exp_args:Nxx \__nicematrix_Block_v:nnnnn } { \l_tmpa_int } { \l_tmpb_int } { #3 } { #4 } { #5 } } -\cs_new_protected:Npn \__nicematrix_Block_iii:nnnnn #1 #2 #3 #4 #5 +\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnn #1 #2 #3 #4 #5 { \int_gincr:N \g__nicematrix_block_box_int \cs_set_protected_nopar:Npn \diagbox ##1 ##2 @@ -4494,7 +4515,7 @@ } } } -\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnn #1 #2 #3 #4 #5 +\cs_new_protected:Npn \__nicematrix_Block_v:nnnnn #1 #2 #3 #4 #5 { \seq_gput_right:Nx \g__nicematrix_blocks_seq { @@ -4558,9 +4579,9 @@ \cs_new_protected:Npn \__nicematrix_draw_blocks: { \cs_set_eq:NN \ialign \__nicematrix_old_ialign: - \seq_map_inline:Nn \g__nicematrix_blocks_seq { \__nicematrix_Block_iii:nnnnnn ##1 } + \seq_map_inline:Nn \g__nicematrix_blocks_seq { \__nicematrix_Block_iv:nnnnnn ##1 } } -\cs_new_protected:Npn \__nicematrix_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6 { \int_zero_new:N \l__nicematrix_last_row_int \int_zero_new:N \l__nicematrix_last_col_int @@ -4586,9 +4607,9 @@ } { \msg_error:nnnn { nicematrix } { Block~too~large~1 } { #1 } { #2 } } } - { \__nicematrix_Block_iv:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { \__nicematrix_Block_v:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } } -\cs_new_protected:Npn \__nicematrix_Block_iv:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \__nicematrix_Block_v:nnnnnn #1 #2 #3 #4 #5 #6 { \seq_gput_left:Nn \g__nicematrix_pos_of_blocks_seq { { #1 } { #2 } { #3 } { #4 } } \group_begin: @@ -5147,7 +5168,7 @@ } \__nicematrix_msg_new:nn { ampersand~in~light-syntax } { - You~can't~use~an~ampersand~(\token_to_str &)~to~separate~columns~because + You~can't~use~an~ampersand~(\token_to_str:N &)~to~separate~columns~because~ ~you~have~used~the~key~'light-syntax'.~This~error~is~fatal. } \__nicematrix_msg_new:nn { double-backslash~in~light-syntax } @@ -5309,6 +5330,7 @@ The~available~keys~are~(in~alphabetic~order):~ allow-duplicate-names,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-for-first-col,~ code-for-first-row,~ @@ -5354,6 +5376,7 @@ baseline,~ c,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-after,~ code-for-first-col,~ @@ -5405,6 +5428,7 @@ baseline,~ c,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-after,~ code-for-first-col,~ @@ -5456,6 +5480,7 @@ baseline,~ c,~ cell-space-bottom-limit,~ + cell-space-limits,~ cell-space-top-limit,~ code-after,~ code-for-first-col,~ |