From dbbd8181499cc3ffe5788ed349c21da867033a05 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 7 Mar 2023 22:24:01 +0000 Subject: nicematrix (7mar23) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2022.final@66446 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/nicematrix/nicematrix.dtx | 549 ++++++++++++++++----- 1 file changed, 420 insertions(+), 129 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index 30835280296..6ef8d2a7f78 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.15} -\def\myfiledate{2023/02/25} +\def\myfileversion{6.16} +\def\myfiledate{2023/03/06} % % %<*batchfile> @@ -60,6 +60,7 @@ version 2005/12/01 or later. \usepackage{siunitx} \usepackage{caption} \usepackage{varwidth} +\usepackage{tcolorbox} \usepackage[auto-lang=false]{lipsum} \NewDocumentEnvironment {scope} {} {} {} @@ -533,54 +534,58 @@ version 2005/12/01 or later. % \end{bNiceArray}$ % \end{scope} % +% \NewDocumentCommand{\Definition}{m} +% {{\setlength{\fboxsep}{1pt}\colorbox{gray!20}{\ttfamily \vphantom{gl}#1}}} +% % % \interitem % In fact, the command |\Block| accepts as first optional argument (between % square brackets) a list of couples \textsl{key=value}. The available keys are as % follows: % \begin{itemize} -% \item the keys |l|, |c| and |r| are used to fix the horizontal position of the -% content of the block, as explained previously; -% \item the key |fill| takes in as value a color and fills the block with that +% \item the key \Definition{fill} takes in as value a color and fills the block +% with that color; +% \item the key \Definition{draw} takes in as value a color and strokes the +% frame of the block with that color (the default value of that key is the +% current color of the rules of the array); +% \item the key \Definition{color} takes in as value a color and apply that +% color the content of the block but draws also the frame of the block with that % color; -% \item the key |draw| takes in as value a color and strokes the frame of the -% block with that color (the default value of that key is the current color of -% the rules of the array); -% \item the key |color| takes in as value a color and apply that color the -% content of the block but draws also the frame of the block with that color; -% \item the keys |hlines|, |vlines| and |hvlines| draw all the corresponding -% rules in the block;\footnote{However, the rules are not drawn in the -% sub-blocks of the block, as always with \pkg{nicematrix}: the rules are not -% drawn in the blocks (cf. section~\ref{rules} p.~\pageref{rules}).} -% \item the key |line-width| is the width of the rules (this key +% \item the keys \Definition{hlines}, \Definition{vlines} and +% \Definition{hvlines} draw all the corresponding rules in the +% block;\footnote{However, the rules are not drawn in the sub-blocks of the +% block, as always with \pkg{nicematrix}: the rules are not drawn in the blocks +% (cf. section~\ref{rules} p.~\pageref{rules}).} +% \item the key \Definition{line-width} is the width of the rules (this key % is meaningful only when one of the keys |draw|, |hvlines|, |vlines| and % |hlines| is used); -% \item the key |rounded-corners| requires rounded corners (for the frame drawn -% by |draw| and the shape drawn by |fill|) with a radius equal to the value of -% that key (the default value is 4~pt\footnote{This value is the initial value -% of the \emph{rounded corners} of Tikz.}); -% \item when the key |tikz| is used, the Tikz path corresponding of the -% rectangle which delimits the block is executed with Tikz\footnote{Tikz should -% be loaded (by default, \pkg{nicematrix} only loads \textsc{pgf}) and, if it's -% not, an error will be raised.} by using as options the value of that key -% |tikz| (which must be a list of keys allowed for a Tikz path). For examples, -% cf. p.~\pageref{tikz-key-examples}; -% \item the key |name| provides a name to the rectangular Tikz node +% \item the key \Definition{rounded-corners} requires rounded corners (for the +% frame drawn by |draw| and the shape drawn by |fill|) with a radius equal to +% the value of that key (the default value is 4~pt\footnote{This value is the +% initial value of the \emph{rounded corners} of Tikz.}); +% \item when the key \Definition{tikz} is used, the Tikz path corresponding of +% the rectangle which delimits the block is executed with Tikz\footnote{Tikz +% should be loaded (by default, \pkg{nicematrix} only loads \textsc{pgf}) and, +% if it's not, an error will be raised.} by using as options the value of that +% key |tikz| (which must be a list of keys allowed for a Tikz path). For +% examples, cf. p.~\pageref{tikz-key-examples}; +% \item the key \Definition{name} provides a name to the rectangular Tikz node % corresponding to the block; it's possible to use that name with Tikz in the % |\CodeAfter| of the environment (cf.~p.~\pageref{code-after}); -% \item the key |respect-arraystretch| prevents the setting of |\arraystretch| -% to $1$ at the beginning of the block (which is the behaviour by default) ; -% \item the key |borders| provides the ability to draw only some borders of the -% blocks; the value of that key is a (comma-separated) list of elements covered -% by |left|, |right|, |top| and |bottom|; it's possible, in fact, in the list -% which is the value of the key |borders|, to add an entry of the form -% |tikz={|\textsl{list}|}| where \textsl{list} is a list of couples +% \item the key \Definition{respect-arraystretch} prevents the setting of +% |\arraystretch| to $1$ at the beginning of the block (which is the behaviour +% by default) ; +% \item the key \Definition{borders} provides the ability to draw only some +% borders of the blocks; the value of that key is a (comma-separated) list of +% elements covered by |left|, |right|, |top| and |bottom|; it's possible, in +% fact, in the list which is the value of the key |borders|, to add an entry of +% the form |tikz={|\textsl{list}|}| where \textsl{list} is a list of couples % \textsl{key=value} of Tikz specifying the graphical characteristics of the -% lines that will be drawn (for an example, see p.~\pageref{dashed}). +% lines that will be drawn (for an example, see p.~\pageref{dashed}). % \item \colorbox{yellow!50}{\textbf{Nouveau 6.15}}\par\nobreak % By default, the rules are not drawn in the blocks (see the section about the % rules: section~\ref{rules} p.~\pageref{rules}). However, if the key -% |transparent| is used, the rules are drawn. For an example, see +% \Definition{transparent} is used, the rules are drawn. For an example, see % section~\ref{tikz-key-examples} on page~\pageref{tikz-key-examples}. % \end{itemize} % @@ -1115,7 +1120,7 @@ version 2005/12/01 or later. % also named |\arrayrulecolor|. The environments of \pkg{nicematrix} also % provide a key |rules/color| to fix the color of the rules in the current % environment. This key sets the value locally (whereas |\arrayrulecolor| acts -% globally). +% globally!). % % \medskip % \begin{scope} @@ -1231,7 +1236,9 @@ version 2005/12/01 or later. % % \bigskip % The key |hvlines-except-borders| is similar to the key |hvlines| but does not -% draw the rules on the horizontal and vertical borders of the array. +% draw the rules on the horizontal and vertical borders of the array. For an +% example of use of that key, see the part ``Use with tcolorbox`, +% p.~\pageref{tcolorbox}. % % \subsubsection{The (empty) corners} % @@ -1645,13 +1652,20 @@ version 2005/12/01 or later. % % \begin{Verbatim} % \begin{pNiceArray}{~textsl#preamble@} -% ~emphase#\CodeBefore@ +% ~emphase#\CodeBefore [~textsl#options@]@ % ~textsl#instructions of the code-before@ % ~emphase#\Body@ % ~textsl#contents of the environment@ % \end{pNiceArray} % \end{Verbatim} % +% \smallskip +% The optional argument between square brackets is a list of \textsl{key=value} +% pairs which will be presented progressively in this +% documentation.\footnote{The available keys are |create-cell-nodes|, +% |sub-matrix| (and its subkeys) and \texttt{delimiters-color}.} +% +% \medskip % New commands are available in that |\CodeBefore|: |\cellcolor|, % |\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors|, % |\rowlistcolors|, |\chessboardcolors| and |\arraycolor|.\footnote{Remark that, @@ -2689,7 +2703,7 @@ version 2005/12/01 or later. % \end{bNiceMatrix}$ % % \bigskip -% In the first column of this exemple, there are two instructions |\Vdots| but, +% In the first column of this example, there are two instructions |\Vdots| but, % of course, only one dotted line is drawn. % % \bigskip @@ -3129,6 +3143,81 @@ version 2005/12/01 or later. % \end{bNiceMatrix}$ % % +% \section{Delimiters in the preamble of the environnment} +% +% \label{delimiters-in-preamble} +% +% \colorbox{yellow!50}{\textbf{New 6.16}\enskip} +% In the environments with preamble (|{NiceArray}|, |{pNiceArray}|, etc.), it's +% possible to put vertical delimiters directly in the preamble of the +% environnment.\footnote{This syntax is inspired by the extension \pkg{blkarray}.} +% +% \smallskip +% The opening delimiters should be prefixed by the keyword |\left| and the +% closing delimiters by the keyword |\right|. It's not mandatory to use +% |\left| and |\right| pair-wise. +% +% \smallskip +% All the vertical extensible delimiters of LaTeX are allowed. +% +% \medskip +% Here is a example which uses the delimiters |\lgroup| and |\rgroup|. +% +% \smallskip +% \begin{BVerbatim} +% $\begin{NiceArray}{~emphase#\left\lgroup@ ccc~emphase#\right\rgroup@ l} +% 1 & 2 & 3 & +% 4 & 1 & 6 & +% 7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2 +% \end{NiceArray}$ +% \end{BVerbatim} +% +% \[\begin{NiceArray}{\left\lgroup ccc\right\rgroup l} +% 1 & 2 & 3 & \\ +% 4 & 1 & 6 & \\ +% 7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2 +% \end{NiceArray}\] +% +% \medskip +% For this example, it would also have been possible to use the environnment +% |{NiceArrayWithDelims}| (cf. the section \ref{NiceArrayWithDelims}, +% p.~\pageref{NiceArrayWithDelims}) and the key |last-col| (cf. p.~\pageref{exterior}). +% +% \bigskip +% There is a particular case: for the delimiters |(|, |[| and |\{| (and the +% corresponding closing delimiters), the prefixes |\left| et |\right| are +% optional.\footnote{For the delimiters |[| and |]|, the prefixes remain mandatory +% when there is a conflict of notation with the square brackets for the options +% of some descriptors of columns.} +% +% +% +% \bigskip +% When there are two successive delimiters (necessarily a closing one following by +% an opening one for another submatrix), a space equal to |\enskip| is +% automatically inserted. +% +% \medskip +% \begin{BVerbatim} +% $\begin{pNiceArray}{~emphase#(c)(c)(c)@} +% a_{11} & a_{12} & a_{13} \\ +% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ +% a_{31} & a_{32} & a_{33} +% \end{pNiceArray}$ +% \end{BVerbatim} +% +% \[\begin{pNiceArray}{(c)(c)(c)} +% a_{11} & a_{12} & a_{13} \\ +% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ +% a_{31} & a_{32} & a_{33} +% \end{pNiceArray}\] +% +% +% \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}. % % \section{The \textbackslash CodeAfter} % @@ -3222,34 +3311,9 @@ version 2005/12/01 or later. % % % -% \bigskip -% Despite its name, the command |\SubMatrix| may also be used within a -% |{NiceTabular}|. Here is an example (which uses |\bottomrule| and -% |\toprule| of \pkg{booktabs}). -% -% \begin{BVerbatim}[baseline=c] -% \begin{NiceTabular}{~@{}ll~@{}} -% \toprule -% Part A & the first part \\ -% \Block{2-1}{Part B} & a first sub-part \\ -% & a second sub-part \\ -% \bottomrule -% \CodeAfter -% ~emphase#\SubMatrix{\{}{2-2}{3-2}{.}@ -% \end{NiceTabular} -% \end{BVerbatim} -% \hspace{2cm} -% \begin{NiceTabular}{@{}ll@{}} -% \toprule -% Part A & the first part \\ -% \Block{2-1}{Part B} & a first sub-part \\ -% & a second sub-part \\ -% \bottomrule -% \CodeAfter -% \SubMatrix{\{}{2-2}{3-2}{.} -% \end{NiceTabular} % -% \subsection{The command \textbackslash SubMatrix in the \textbackslash CodeAfter} +% \subsection{The command \textbackslash SubMatrix in the \textbackslash +% CodeAfter (and also the \textbackslash CodeBefore)} % % \label{sub-matrix} % @@ -3272,7 +3336,7 @@ version 2005/12/01 or later. % |\SubMatrix[{2-2}{4-7}]|).} % \end{itemize} % -% One should remark that the command |\SubMatrix| draws the delimiters after the +% One should remark that the command |\SubMatrix| draws the delimiters \emph{after} the % construction of the array: no space is inserted by the command |\SubMatrix| % itself. That's why, in the following example, we have used the key |margin| % and you have added by hand some space between the third and fourth column with @@ -3302,6 +3366,29 @@ version 2005/12/01 or later. % \SubMatrix({1-4}{3-4}) % \end{NiceArray}$ % +% \medskip +% Eventually, in this example, it would probably have been easier to put the +% delimiters directly in the preamble of |{NiceArray}| (see +% section~\ref{delimiters-in-preamble}, p.~\pageref{delimiters-in-preamble}) +% with the following construction. +% +% \medskip +% \begin{scope} +% \hfuzz=15cm +% \begin{BVerbatim}[boxwidth=11cm,baseline=c] +% $\begin{NiceArray}{~emphase#(ccc)(c)@}[cell-space-limits=2pt] +% 1 & 1 & 1 & x \\ +% \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\ +% 1 & 2 & 3 & z +% \end{NiceArray}$ +% \end{BVerbatim} +% \end{scope} +% $\begin{NiceArray}{(ccc)(c)}[cell-space-limits=2pt] +% 1 & 1 & 1 & x \\ +% \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\ +% 1 & 2 & 3 & z +% \end{NiceArray}$ +% % \bigskip % In fact, the command |\SubMatrix| also takes in two optional arguments % specified by the traditional symbols |^| and |_| for material in superscript @@ -3349,9 +3436,11 @@ version 2005/12/01 or later. % the sub-matrix are drawn); % \item |hlines| is similar to |vlines| but for the horizontal rules; % \item |hvlines|, which must be used without value, draws all the vertical and -% horizontal rules. +% horizontal rules; +% \item |code| insert code, especially TikZ code, after the construcion of the +% submatrix. That key is detailed below. % \end{itemize} -% One should remark that these keys add their rules after the construction of +% One should remark that the keys add their rules after the construction of % the main matrix: no space is added between the rows and the columns of the % array for theses rules. % @@ -3428,32 +3517,32 @@ version 2005/12/01 or later. % % % \bigskip -% It's also possible to specify some delimiters\footnote{Those delimiters are -% |(|, |[|, |\{| and the closing ones. Of course, it's also -% possible to put \verb+|+ and \verb+||+ in the preamble of the environement.} -% by placing them in the preamble of the environment (for the environments with -% a preamble: |{NiceArray}|, |{pNiceArray}|, etc.). This syntax is inspired by -% the extension \pkg{blkarray}. -% -% When there are two successive delimiters (necessarily a closing one following by -% an opening one for another submatrix), a space equal to |\enskip| is -% automatically inserted. +% Despite its name, the command |\SubMatrix| may also be used within a +% |{NiceTabular}|. Here is an example (which uses |\bottomrule| and +% |\toprule| of \pkg{booktabs}). % % \medskip -% \begin{BVerbatim} -% $\begin{pNiceArray}{~emphase#(c)(c)(c)@} -% a_{11} & a_{12} & a_{13} \\ -% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ -% a_{31} & a_{32} & a_{33} -% \end{pNiceArray}$ +% \begin{BVerbatim}[baseline=c] +% \begin{NiceTabular}{~@{}ll~@{}} +% \toprule +% Part A & the first part \\ +% \Block{2-1}{Part B} & a first sub-part \\ +% & a second sub-part \\ +% \bottomrule +% \CodeAfter +% ~emphase#\SubMatrix{\{}{2-2}{3-2}{.}@ +% \end{NiceTabular} % \end{BVerbatim} -% -% \[\begin{pNiceArray}{(c)(c)(c)} -% a_{11} & a_{12} & a_{13} \\ -% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ -% a_{31} & a_{32} & a_{33} -% \end{pNiceArray}\] -% +% \hspace{2cm} +% \begin{NiceTabular}{@{}ll@{}} +% \toprule +% Part A & the first part \\ +% \Block{2-1}{Part B} & a first sub-part \\ +% & a second sub-part \\ +% \bottomrule +% \CodeAfter +% \SubMatrix{\{}{2-2}{3-2}{.} +% \end{NiceTabular} % % \bigskip % The command |\SubMatrix| is, in fact, also available in the |\CodeBefore|. By @@ -3464,6 +3553,55 @@ version 2005/12/01 or later. % For an example, see voir \ref{submatrix-in-codebefore} % p.~\pageref{submatrix-in-codebefore}. % +% +% +% \vspace{1cm} +% \colorbox{yellow!50}{\textbf{New 6.16}}\enskip The key |code| of the command +% |\SubMatrix| allows the insertion of code after the construction of the +% submatrix. It's meant to be used to insert TikZ instructions because, in the +% TikZ instructions inserted by that code, the nodes of the form |i-j| and +% \verb+i-|j+ are interpreted with |i| and |j| as numbers of row and columns +% \emph{relative to the submatrix}. +% +% \medskip +% \begin{scope} +% \fvset{commandchars=\~\#\!}% +% \begin{Verbatim} +% $\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} +% & & && -1 & 1 & 2 \\ +% & & && 0 & 3 & 4 \\ +% & & && 0 & 0 & 5 \\ +% 1 & 2 & 3 && -1 & 7 & 25 \\ +% 0 & 4 & 5 && 0 & 12 & 41 \\ +% 0 & 0 & 6 && 0 & 0 & 30 +% \CodeAfter +% ~emphase#\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}! +% \SubMatrix({1-5}{3-7})[~emphase#code = \MyDraw!] +% \SubMatrix({4-1}{6-3})[~emphase#code = \MyDraw!] +% \SubMatrix({4-5}{6-7})[~emphase#code = \MyDraw!] +% \end{NiceArray}$ +% \end{Verbatim} +% \end{scope} +% +% +% \[\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} +% & & && -1 & 1 & 2 \\ +% & & && 0 & 3 & 4 \\ +% & & && 0 & 0 & 5 \\ +% 1 & 2 & 3 && -1 & 7 & 25 \\ +% 0 & 4 & 5 && 0 & 12 & 41 \\ +% 0 & 0 & 6 && 0 & 0 & 30 +% \CodeAfter +% \NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;} +% \SubMatrix({1-5}{3-7})[code = \MyDraw ] +% \SubMatrix({4-1}{6-3})[code = \MyDraw ] +% \SubMatrix({4-5}{6-7})[code = \MyDraw ] +% \end{NiceArray}\] +% +% \medskip +% As we see, the drawing done by our command |\MyDraw| is \emph{relative} to the +% submatrix to which it is applied. +% % \subsection{The commands \textbackslash OverBrace and \textbackslash % UnderBrace in the \textbackslash CodeAfter} % @@ -3915,12 +4053,14 @@ version 2005/12/01 or later. % \makeatother % \end{Verbatim} % +% Nevertheless, the use of \pkg{threeparttable} in conjonction with +% \pkg{nicematrix} seems rather point-less because of the functionalities +% provided by \pkg{nicematrix}. % % % \section{Other features} % -% \section{Autres fonctionnalités} -% + % \subsection{Command \textbackslash ShowCellNames} % % The command |\ShowCellNames|, which may be used in the |\CodeBefore| and in @@ -4102,7 +4242,6 @@ version 2005/12/01 or later. % \end{bNiceArray}\] % % -% % \bigskip % One should note that the environment |{NiceMatrix}| with the option |small| is % not composed \emph{exactly} as the environment |{smallmatrix}|. Indeed, all @@ -4119,6 +4258,13 @@ version 2005/12/01 or later. % \item the characteristics of the dotted lines are also modified. % \end{itemize} % +% \medskip +% When the key |small| is in force, some functionalities of \pkg{nicematrix} are +% no longer available: for example, it's no longer possible to put vertical +% delimiters directly in the preamble of an environment with preamble (cf. +% section \ref{delimiters-in-preamble}, p.~\pageref{delimiters-in-preamble}). +% +% % \subsection{The counters iRow and jCol} % % \label{iRow} @@ -4249,6 +4395,8 @@ version 2005/12/01 or later. % % \subsection{The environment \{NiceArrayWithDelims\}} % +% \label{NiceArrayWithDelims} +% % In fact, the environment |{pNiceArray}| and its variants are based upon a % more general environment, called |{NiceArrayWithDelims}|. The first two % mandatory arguments of this environment are the left and right delimiters used @@ -5096,7 +5244,8 @@ version 2005/12/01 or later. % \url{https://tex.stackexchange.com/questions/528975/error-loading-tikz-in-ieeeaccess-class}} % % \bigskip -% In order to use \pkg{nicematrix} with the class \cls{aastex631}, you have to +% In order to use \pkg{nicematrix} with the class \cls{aastex631} +% (of the \emph{American Astronomical Society}), you have to % add the following lines in the preamble of your document : % % \begin{Verbatim} @@ -5106,8 +5255,9 @@ version 2005/12/01 or later. % \end{Verbatim} % % \bigskip -% In order to use \pkg{nicematrix} with the class \cls{sn-jnln}, \pkg{pgf} must -% be loaded before the |\documentclass|: +% In order to use \pkg{nicematrix} with the class \cls{sn-jnl} (of +% \emph{Springer Nature}), \pkg{pgf} must +% be loaded before the |\documentclass| with |\RequirePackage|: % % \begin{Verbatim} % \RequirePackage{pgf} @@ -5210,6 +5360,113 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % +% \subsection{Use with tcolorbox} +% +% \label{tcolorbox} +% +% Here is an example of use of |{NiceTabular}| within a command |\tcbox| of +% \pkg{tcolorbox}. We have used the key |hvlines-except-borders| in order all +% the rules excepted on the borders (which are, of course, added by \pkg{tcolorbox}) +% +% \medskip +% \begin{BVerbatim} +% \tcbset +% { +% colframe = blue!50!black , +% colback = white , +% colupper = red!50!black , +% fonttitle = \bfseries , +% nobeforeafter , +% center title +% } +% +% \tcbox +% [ +% left = 0mm , +% right = 0mm , +% top = 0mm , +% bottom = 0mm , +% boxsep = 0mm , +% toptitle = 0.5mm , +% bottomtitle = 0.5mm , +% title = My table +% ] +% { +% \renewcommand{\arraystretch}{1.2}% <-- the % is mandatory here +% \begin{NiceTabular}{rcl}[~emphase#hvlines-except-borders@,rules/color=blue!50!black] +% \CodeBefore +% \rowcolor{red!15}{1} +% \Body +% One & Two & Three \\ +% Men & Mice & Lions \\ +% Upper & Middle & Lower +% \end{NiceTabular} +% } +% \end{BVerbatim} +% +% \medskip +% \begin{center} +% \tcbset +% { +% colframe = blue!50!black , +% colback = white , +% colupper = red!50!black , +% fonttitle = \bfseries , +% nobeforeafter , +% center title +% } +% +% \tcbox +% [ +% left = 0mm , +% right = 0mm , +% top = 0mm , +% bottom = 0mm , +% boxsep = 0mm , +% toptitle = 0.5mm , +% bottomtitle = 0.5mm , +% title = My table +% ] +% { +% \renewcommand{\arraystretch}{1.2}\begin{NiceTabular}{rcl}[hvlines-except-borders,rules/color=blue!50!black] +% \CodeBefore +% \rowcolor{red!15}{1} +% \Body +% One & Two & Three \\ +% Men & Mice & Lions \\ +% Upper & Middle & Lower +% \end{NiceTabular} +% } +% \end{center} +% +% +% +% \vspace{1cm} +% That example shows the use of \pkg{nicematrix} in conjunction with +% \pkg{tcolorbox}. If one wishes a tabular with an exterior frame with rounded +% corners, it's not necessary to use \pkg{tcolorbox}: it's possible to use the +% command |\Block| with the key |rounded-corners|. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=10.5cm] +% \begin{NiceTabular}{rcl}[hvlines-except-borders] +% \Block[draw,transparent,~emphase#rounded-corners@]{*-*}{} +% One & Two & Three \\ +% Men & Mice & Lions \\ +% Upper & Middle & Lower +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{rcl}[hvlines-except-borders] +% \Block[draw,transparent,rounded-corners]{*-*}{} +% One & Two & Three \\ +% Men & Mice & Lions \\ +% Upper & Middle & Lower +% \end{NiceTabular} +% +% \medskip +% We have used the key |transparent| to have the rules specified by +% |hvlines-except-borders| drawn in the blocks (by default, the rules are not +% drawn in the blocks). % % \subsection{Notes in the tabulars} % @@ -6785,7 +7042,7 @@ version 2005/12/01 or later. % \bigskip % The following token list will contain the type of horizontal alignment of the % current cell as provided by the corresponding column. The possible values are -% |r|, |l|, |c|. For exemple, a column |p[l]{3cm}| will provide the value |l| +% |r|, |l|, |c|. For example, a column |p[l]{3cm}| will provide the value |l| % for all the cells of the column. % \begin{macrocode} \str_new:N \l_@@_hpos_cell_str @@ -7056,6 +7313,11 @@ version 2005/12/01 or later. \dim_new:N \l_@@_X_columns_dim % \end{macrocode} % +% \medskip +% \begin{macrocode} +\bool_new:N \l_@@_X_V_bool +% \end{macrocode} +% % \bigskip % This boolean will be used only to detect in an expandable way whether we are % at the beginning of the (potential) column zero, in order to raise an error if @@ -10524,34 +10786,36 @@ version 2005/12/01 or later. { \str_case:nnF { #1 } { - c { \@@_patch_preamble_i:n #1 } - l { \@@_patch_preamble_i:n #1 } - r { \@@_patch_preamble_i:n #1 } - > { \@@_patch_preamble_xiv:n } - ! { \@@_patch_preamble_ii:nn #1 } - @ { \@@_patch_preamble_ii:nn #1 } - | { \@@_patch_preamble_iii:n #1 } - p { \@@_patch_preamble_iv:n #1 } - b { \@@_patch_preamble_iv:n #1 } - m { \@@_patch_preamble_iv:n #1 } + c { \@@_patch_preamble_i:n #1 } + l { \@@_patch_preamble_i:n #1 } + r { \@@_patch_preamble_i:n #1 } + > { \@@_patch_preamble_xiv:n } + ! { \@@_patch_preamble_ii:nn #1 } + @ { \@@_patch_preamble_ii:nn #1 } + | { \@@_patch_preamble_iii:n #1 } + p { \@@_patch_preamble_iv:n #1 } + b { \@@_patch_preamble_iv:n #1 } + m { \@@_patch_preamble_iv:n #1 } \@@_V: { \@@_patch_preamble_v:n } - V { \@@_patch_preamble_v:n } - \@@_w: { \@@_patch_preamble_vi:nnnn { } #1 } - \@@_W: { \@@_patch_preamble_vi:nnnn { \@@_special_W: } #1 } - \@@_S: { \@@_patch_preamble_vii:n } - ( { \@@_patch_preamble_viii:nn #1 } - [ { \@@_patch_preamble_viii:nn #1 } - \{ { \@@_patch_preamble_viii:nn #1 } - ) { \@@_patch_preamble_ix:nn #1 } - ] { \@@_patch_preamble_ix:nn #1 } - \} { \@@_patch_preamble_ix:nn #1 } - X { \@@_patch_preamble_x:n } + V { \@@_patch_preamble_v:n } + \@@_w: { \@@_patch_preamble_vi:nnnn { } #1 } + \@@_W: { \@@_patch_preamble_vi:nnnn { \@@_special_W: } #1 } + \@@_S: { \@@_patch_preamble_vii:n } + ( { \@@_patch_preamble_viii:nn #1 } + [ { \@@_patch_preamble_viii:nn #1 } + \{ { \@@_patch_preamble_viii:nn #1 } + \left { \@@_patch_preamble_viii:nn } + ) { \@@_patch_preamble_ix:nn #1 } + ] { \@@_patch_preamble_ix:nn #1 } + \} { \@@_patch_preamble_ix:nn #1 } + \right { \@@_patch_preamble_ix:nn } + X { \@@_patch_preamble_x:n } % \end{macrocode} % When \pkg{tabularx} is loaded, a local redefinition of the specifier |X| is % done to replace |X| by |\@@_X|. Thus, our column type |X| will be used in the % |{NiceTabularX}|. % \begin{macrocode} - \@@_X { \@@_patch_preamble_x:n } + \@@_X { \@@_patch_preamble_x:n } \q_stop { } } { @@ -11173,7 +11437,7 @@ version 2005/12/01 or later. { \tl_gput_right:Nx \g_@@_pre_code_after_tl { \@@_delimiter:nnn #1 { \int_eval:n { \c@jCol + 1 } } \c_true_bool } - \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 } + \tl_if_in:nnTF { ( [ \{ ) ] \} \left \right } { #2 } { \@@_error:nn { delimiter~after~opening } { #2 } \@@_patch_preamble:n @@ -11183,7 +11447,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% For |)|, |]| and |\}|. We have two arguments for the following command because +% For the closing delimiters. We have two arguments for the following command because % we directly read the following letter in the preamble (we have to see whether % we have a opening delimiter following and we also have to see whether we are % at the end of the preamble because, in that case, our letter must be @@ -11208,7 +11472,7 @@ version 2005/12/01 or later. } } { - \tl_if_in:nnT { ( [ \{ } { #2 } + \tl_if_in:nnT { ( [ \{ \left } { #2 } { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } } \tl_gput_right:Nx \g_@@_pre_code_after_tl { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool } @@ -11273,7 +11537,10 @@ version 2005/12/01 or later. % of keys will be used to retrieve that value (in the counter |\l_@@_weight_int|). % \begin{macrocode} \keys_define:nn { WithArrows / X-column } - { unknown .code:n = \int_set:Nn \l_@@_weight_int { \l_keys_key_str } } + { + v .bool_set:N = \l_@@_X_V_bool , + unknown .code:n = \int_set:Nn \l_@@_weight_int { \l_keys_key_str } + } % \end{macrocode} % % @@ -11300,14 +11567,14 @@ version 2005/12/01 or later. % initial value is $1$). The user may specify a different value (such as $2$, % $3$, etc.) by putting that value in the optional argument of the specifier. % The weights of the |X| columns are used in the computation of the actual width -% of those columns as in \pkg{tabu} of \pkg{tabularray}. +% of those columns as in \pkg{tabu} (now obsolete) or \pkg{tabularray}. % \begin{macrocode} \int_zero_new:N \l_@@_weight_int \int_set:Nn \l_@@_weight_int { 1 } \tl_set:Nn \l_tmpa_tl { #1 } \tl_replace_all:Nnn \l_tmpa_tl { \@@_S: } { S } - \@@_keys_p_column:V \l_tmpa_tl - % \keys_set_known:nnN { WithArrows / p-column } { #1 } \l_tmpa_tl + \@@_keys_p_column:V \l_tmpa_tl + \bool_set_false:N \l_@@_X_V_bool \keys_set:nV { WithArrows / X-column } \l_tmpa_tl \int_compare:nNnT \l_@@_weight_int < 0 { @@ -11323,9 +11590,14 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NTF \l_@@_X_columns_aux_bool { + \exp_args:Nnx \@@_patch_preamble_iv_iv:nn { \l_@@_weight_int \l_@@_X_columns_dim } - { minipage } + { + \bool_if:NTF \l_@@_X_V_bool + { varwidth } + { minipage } + } } { \tl_gput_right:Nn \g_@@_preamble_tl @@ -11334,6 +11606,14 @@ version 2005/12/01 or later. \@@_cell_begin:w \bool_set_true:N \l_@@_X_column_bool % \end{macrocode} +% You encounter a problem on 2023-03-04: for an environment with |X| columns, +% during the first compilations (which are not the definitive one), sometimes, +% some cells are declared empty even if they should not. That's a problem +% because user's instructions may use these nodes. That's why we have added the +% following |\NotEmpty|. +% \begin{macrocode} + \NotEmpty +% \end{macrocode} % The following code will nullify the box of the cell. % \begin{macrocode} \tl_gput_right:Nn \g_@@_cell_after_hook_tl @@ -21400,6 +21680,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-borders,~ last-col,~ last-row,~ left-margin,~ @@ -21455,6 +21736,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-borders,~ last-col,~ last-row,~ left-margin,~ @@ -21516,6 +21798,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-borders,~ l,~ last-col,~ last-row,~ @@ -21575,6 +21858,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-borders,~ label,~ last-col,~ last-row,~ @@ -21641,6 +21925,13 @@ version 2005/12/01 or later. % \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} % } % +% \subsection*{Changes between version 6.15 and 6.16} +% +% It's now possible to put any LaTeX extensible delimiter (|\lgroup|, |\langle|, +% etc.) in the preamble of an environment with pramble (such as |{NiceArray}|) +% by prefixing them by |\left| and |\right|. +% +% New key |code| for the command |\SubMatrix| in the |\CodeAfter|. % % \subsection*{Changes between version 6.14 and 6.15} % -- cgit v1.2.3