diff options
Diffstat (limited to 'macros/latex/contrib/nicematrix/nicematrix.tex')
-rw-r--r-- | macros/latex/contrib/nicematrix/nicematrix.tex | 205 |
1 files changed, 134 insertions, 71 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix.tex b/macros/latex/contrib/nicematrix/nicematrix.tex index cec4b584ca..7eb1243f18 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.tex +++ b/macros/latex/contrib/nicematrix/nicematrix.tex @@ -53,6 +53,11 @@ \NewDocumentCommand{\Definition}{m} {{\setlength{\fboxsep}{1pt}\colorbox{gray!20}{\ttfamily \vphantom{gl}#1}}} +\NewDocumentCommand{\DefinitionCommand}{m} + {{\setlength{\fboxsep}{1pt}\colorbox{gray!20}{\ttfamily + \vphantom{gl}\textbackslash #1}}} + + \usepackage{makeidx} \makeindex @@ -1434,7 +1439,9 @@ corners (designed by |NW|, |SW|, |NE| and |SE|). \medskip $\triangleright$ The corners are also taken into account by the tools provided by \pkg{nicematrix} to color cells, rows and columns. These tools don't color -the cells which are in the corners (cf.~p.~\pageref{color-in-code-before}). +the cells which are in the corners (cf.~p.~\pageref{color-in-code-before}). The +command |\TikzEveryCell| available in the |\CodeBefore| and the |\CodeAfter| +(cf. p.~\pageref{TikzEveryCell}) takes also into account the empty corners. \subsection{The command \textbackslash diagbox} @@ -2291,24 +2298,28 @@ current environment.\footnote{Up to now, this key is \emph{not} available in |\N There are several commands available (the first three ones are inspired by \pkg{colortbl} but are \emph{independent} of \pkg{colortbl}): \begin{itemize} -\item |\cellcolor| which colorizes a cell;\footnote{However, this command -|\cellcolor| will delete the following spaces, which does not the command -|\cellcolor| of \pkg{colortbl}.} -\item |\rowcolor| which must be used in a cell and which colorizes the end of -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} (however, unlike the command |\columncolor| of \pkg{colortbl}, -this command |\columncolor| can appear within another command, itself used in the -preamble of the array); -\item |\rowcolors| which takes in as arguments two colors and color the rest of -the tabular with those colors; -\item |\rowlistcolors| which takes in as argument a color and color the rest of -the tabular with the colors of that list of colors.\footnote{When the command - |\rowlistcolors| (or the command |\rowcolors| is used in a cell of the - column~$j$ of the array, the command applies only on the columns above~$j$ (by -design).} +\item \DefinitionCommand{cellcolor} which colorizes a cell;\footnote{However, + this command cellcolor will delete the following spaces, which does not the + command cellcolor of \pkg{colortbl}.} +\item \DefinitionCommand{rowcolor} which must be used in a cell and which +colorizes the end of the row;\footnote{If you want a commande to color the + following $n$~rows, consider the command |\RowStyle| and its key |rowcolor|, + p.~\pageref{RowStyle}} +\item \DefinitionCommand{columncolor} which must be used in the preamble of the +environment with the same syntax as the corresponding command of \pkg{colortbl} +(however, unlike the command columncolor of \pkg{colortbl}, this command +|\columncolor| can appear within another command, itself used in the preamble of +the array); +\item \DefinitionCommand{rowcolors} which takes in as arguments two colors and +color the rest of the tabular with those colors; +\item \DefinitionCommand{rowlistcolors} which takes in as argument a color and +color the rest of the tabular with the colors of that list of +colors.\footnote{When the command |\rowlistcolors| (or the command |\rowcolors| + is used in a cell of the column~$j$ of the array, the command applies only on + the columns above~$j$ (by design).} \end{itemize} +These commands are compatible with the commands for the overlays of Beamer +(|\only|, etc.) \smallskip \begin{Verbatim} @@ -2342,6 +2353,43 @@ Dupont & Chantal & 15 janvier 1998 \\ \end{NiceTabular} \end{center} +\bigskip +\colorbox{yellow!50}{\textbf{New 6.25}}\enskip Each use of the command +|\rowlistcolors| (or |\rowcolors|, which is, in fact, a special case of +|\rowlistcolors|) stops the potential coloring schemes\footnote{We say + \emph{schemes} in plural form because it's possible to start simultaneously + several coloring schemes if they apply on different columns.} specified by a +previous command |\rowlistcolors|. In particular, it's possible to start +coloring the rows with |\rowlistcolors{...}| and stop coloring by a command +|\rowlistcolors| with an empty argument. + +\bigskip +\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{NiceTabular}{c}[hvlines,color-inside] +one \\ +two \\ +~emphase#\rowlistcolors{red!15}@ +three \\ +four \\ +five \\ +~emphase#\rowlistcolors{}@ +six \\ +seven \\ +\end{NiceTabular} +\end{BVerbatim} +\begin{NiceTabular}{c}[hvlines,color-inside] +one \\ +two \\ +\rowlistcolors{red!15} +three \\ +four \\ +five \\ +\rowlistcolors{} +six \\ +seven \\ +\end{NiceTabular} + + \section{The command \textbackslash RowStyle} \label{RowStyle} @@ -2742,7 +2790,7 @@ the potential first column and the potential last column: they will automatically (and necessarily) be of type |r| for the first column and |l| for the last one.\footnote{The users wishing exterior columns with another type of alignment should consider the command |\SubMatrix| available in the -|\CodeAfter| (cf.~p.~\pageref{sub-matrix}).} +|\CodeAfter| and in the |\CodeBefore| (cf.~p.~\pageref{sub-matrix}).} \item One may wonder how \pkg{nicematrix} determines the number of rows and columns which are needed for the composition of the ``last row'' and ``last column''. @@ -2831,8 +2879,8 @@ p.~\pageref{width}) doesn't apply to the ``first column'' and ``last column''. \item For technical reasons, it's not possible to use the option of the command |\\| after the ``first row'' or before the ``last row''. The placement of the delimiters would be wrong. If you are looking for a workaround, -consider the command |\SubMatrix| in the |\CodeAfter| described -p.~\pageref{sub-matrix}. +consider the command |\SubMatrix| in the |\CodeAfter| (and the |\CodeBefore|) +described p.~\pageref{sub-matrix}. \end{itemize} @@ -3501,8 +3549,8 @@ a_{31} & a_{32} & a_{33} \bigskip For more complex constructions, in particular with delimiters spanning only a \emph{subset} of the rows of the array, one should consider the command -|\SubMatrix| available in the |\CodeAfter|. See the section~\ref{sub-matrix}, -p.~\pageref{sub-matrix}. +|\SubMatrix| available in the |\CodeAfter| (and the |\CodeBefore|). See the +section~\ref{sub-matrix}, p.~\pageref{sub-matrix}. \section{The \textbackslash CodeAfter} @@ -4008,7 +4056,9 @@ $\begin{pNiceMatrix} \index{SubMatrix@\texttt{\textbackslash TikzEveryCell} (command of \texttt{\textbackslash CodeAfter}\newline and \texttt{\textbackslash CodeBefore})|textbf} - +\label{TikzEveryCell} +\index{empty (key of \texttt{\textbackslash TikzEveryCell})} +\index{non empty (key of \texttt{\textbackslash TikzEveryCell})} \colorbox{yellow!50}{\textbf{New 6.24}}\enskip The command |\TikzEveryCell| @@ -6407,82 +6457,86 @@ fix a width for all the columns. That's what is done in the following example with the environment |{NiceMatrixBlock}| and its option |auto-columns-width|. \begin{Verbatim}[formatcom=\small\color{gray}] +\begin{Verbatim}[formatcom=\small\color{gray}] ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ \NiceMatrixOptions - { + { light-syntax, - last-col, code-for-last-col = \color{blue} \scriptstyle, + last-col, code-for-last-col = \color{blue}\scriptstyle, + vlines = 5 , + matrix/columns-type = r } \setlength{\extrarowheight}{1mm} -$\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 3 -18 12 1 4 ; -3 -46 29 -2 -15 ; - 9 10 -5 4 7 -\end{pNiceArray}$ + 9 10 -5 4 7 +\end{pNiceMatrix}$ \smallskip -$\begin{pNiceArray}{rrrr|r} -12 -8 7 5 3 ; +\quad $\begin{pNiceMatrix} +12 -8 7 5 3 ; 0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ; 0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ; 0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ; -\end{pNiceArray}$ +\end{pNiceMatrix}$ \smallskip -$\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 ; 0 64 -41 1 19 ; -0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 } -\end{pNiceArray}$ +0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 } +\end{pNiceMatrix}$ \smallskip -$\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 0 64 -41 1 19 ; -\end{pNiceArray}$ - +\end{pNiceMatrix}$ ~emphase#\end{NiceMatrixBlock}@ \end{Verbatim} -\bigskip -\index{auto-columns-width!(key of \texttt{\{NiceMatrixBlock\}})|textit} +\medskip +\index{auto-columns-width!(clé de \texttt{\{NiceMatrixBlock\}})|textit} \begin{NiceMatrixBlock}[auto-columns-width] \NiceMatrixOptions - { + { light-syntax, - last-col, code-for-last-col = \color{blue} \scriptstyle , + last-col, code-for-last-col = \color{blue}\scriptstyle, + vlines = 5 , + matrix/columns-type = r } \setlength{\extrarowheight}{1mm} -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 3 -18 12 1 4 ; -3 -46 29 -2 -15 ; - 9 10 -5 4 7 -\end{pNiceArray}$ + 9 10 -5 4 7 +\end{pNiceMatrix}$ \smallskip -\quad $\begin{pNiceArray}{rrrr|r} -12 -8 7 5 3 ; +\quad $\begin{pNiceMatrix} +12 -8 7 5 3 ; 0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ; 0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ; 0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ; -\end{pNiceArray}$ +\end{pNiceMatrix}$ \smallskip -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 ; 0 64 -41 1 19 ; -0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 } -\end{pNiceArray}$\par\nobreak +0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 } +\end{pNiceMatrix}$ \smallskip -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 0 64 -41 1 19 ; -\end{pNiceArray}$ +\end{pNiceMatrix}$ \end{NiceMatrixBlock} \bigskip @@ -6500,62 +6554,64 @@ composed with the maximal width, thanks to the boolean key \begin{Verbatim}[formatcom=\small\color{gray}] ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ \NiceMatrixOptions - { + { ~emphase#delimiters/max-width@, light-syntax, last-col, code-for-last-col = \color{blue}\scriptstyle, + vlines = 5 , + matrix/columns-type = r } \setlength{\extrarowheight}{1mm} -$\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 3 -18 12 1 4 ; -3 -46 29 -2 -15 ; - 9 10 -5 4 7 -\end{pNiceArray}$ - + 9 10 -5 4 7 +\end{pNiceMatrix}$ ... ~emphase#\end{NiceMatrixBlock}@ \end{Verbatim} -\bigskip +\medskip \begin{NiceMatrixBlock}[auto-columns-width] \NiceMatrixOptions - { + { delimiters/max-width, light-syntax, last-col, code-for-last-col = \color{blue}\scriptstyle, + vlines = 5 , + matrix/columns-type = r } \setlength{\extrarowheight}{1mm} -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 3 -18 12 1 4 ; -3 -46 29 -2 -15 ; - 9 10 -5 4 7 -\end{pNiceArray}$ + 9 10 -5 4 7 +\end{pNiceMatrix}$ \smallskip -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 ; 0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ; 0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ; 0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ; -\end{pNiceArray}$ +\end{pNiceMatrix}$ \smallskip -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 ; 0 64 -41 1 19 ; -0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 } -\end{pNiceArray}$\par\nobreak +0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 } +\end{pNiceMatrix}$ \smallskip -\quad $\begin{pNiceArray}{rrrr|r} +\quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; 0 64 -41 1 19 ; -\end{pNiceArray}$ - +\end{pNiceMatrix}$ \end{NiceMatrixBlock} @@ -7062,6 +7118,13 @@ The successive versions of the file |nicematrix.sty| provided by TeXLive are ava \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} } +\subsection*{Changes between version 6.24 and 6.25} + +Correction of several bugs. + +An instruction |\rowlistcolors| in the tabular stops the effect of a previous +|\rowlistcolors|. + \subsection*{Changes between version 6.23 and 6.24} |