summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix/nicematrix.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/nicematrix/nicematrix.dtx')
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx1833
1 files changed, 1452 insertions, 381 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index f4228206e9..4f023e6f6d 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{4.4}
-\def\myfiledate{2020/06/30}
+\def\myfileversion{5.0}
+\def\myfiledate{2020/07/15}
%
%
%<*batchfile>
@@ -83,8 +83,7 @@ version 2005/12/01 or later.
\int_gset:Nn,\int_gset_eq:NN,\int_gzero:N,\int_gzero_new:N,\int_if_odd:nTF,
\int_max:nn,\int_new:N,\int_set:Nn,\int_set_eq:NN,\int_step_inline:nnn,
\int_step_variable:nNn,\int_step_variable:nnNn,\int_sub:Nn,\int_use:N,\int_zero:N,
- \int_zero_new:N,\g_tmpa_int,\l_tmpa_int,\l_tmpb_int
-}
+ \int_zero_new:N,\g_tmpa_int,\l_tmpa_int,\l_tmpb_int}
\DoNotIndex{\dim_abs:n,\dim_add:Nn,\dim_compare:nNnTF,\dim_compare_p:nNn,
\dim_const:Nn,\dim_eval:n,\dim_gadd:Nn,\dim_gset:Nn,\dim_gset_eq:NN,
\dim_gset:Nn,\dim_gset_eq:NN,\dim_gsub:Nn,\dim_gzero_new:N,\dim_max:nn,
@@ -129,7 +128,7 @@ version 2005/12/01 or later.
%
% \vspace{1cm}
% \hspace{1cm}
-% $\begin{bNiceArray}{CCCC}[first-row,first-col,
+% $\begin{bNiceArray}{cccc}[first-row,first-col,
% code-for-first-col=\color{blue}\scriptstyle,
% code-for-first-row=\color{blue}\scriptstyle,
% columns-width = auto]
@@ -139,9 +138,9 @@ version 2005/12/01 or later.
% \Vdots & \Vdots & \Vdots & \Ddots & \Vdots\\
% L_n & a_{n1} & a_{n2} & \Cdots & a_{nn}
% \end{bNiceArray}$\hspace{2cm}
-% \begin{NiceTabular}{LSSSS}[code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
+% \begin{NiceTabular}{lSSSS}[code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
% \toprule
-% \Block{2-1}{Product} & \multicolumn{3}{C}{dimensions (cm)} & \Block{2-1}{\rotate Price} \\
+% \Block{2-1}{Product} & \multicolumn{3}{c}{dimensions (cm)} & \Block{2-1}{\rotate Price} \\
% \cmidrule(rl){2-4}
% & L & l & h \\
% \midrule
@@ -189,6 +188,20 @@ version 2005/12/01 or later.
% semi-global).
%
%
+% \bigskip
+% {\bfseries \color{red} Important
+%
+% In this version 5.0 of \pkg{nicematrix}, one must use the letters |l|, |c| and
+% |r| in the preambles of the environments and no longer the letters |L|, |C| and
+% |R|.
+%
+% For sake of compatibility with the previous versions, there exists an option
+% |define-L-C-R| which must be used when loading \pkg{nicematrix}.
+% \begin{Verbatim}
+% \usepackage[define-L-C-R]{nicematrix}
+% \end{Verbatim}
+% }
+%
% \newpage
%
% \section{The environments of this package}
@@ -214,22 +227,11 @@ version 2005/12/01 or later.
% \medskip
% The environments |{NiceArray}| and |{NiceTabular}| are similar to the
% environments |{array}| and |{tabular}| of the package \pkg{array} (which is
-% loaded by \pkg{nicematrix} ).
+% loaded by \pkg{nicematrix}).
%
-% \medskip
-% However, there are some small differences:
-% \begin{itemize}
-% \item For technical reasons, in the preamble of these environments, the user
-% must use the letters |L|, |C| and~|R|\footnote{The column types |L|, |C| and
-% |R| are defined locally inside |{NiceTabular}| or |{NiceArray}| with
-% |\newcolumntype| of \pkg{array}. This definition overrides an eventual
-% previous definition.} instead of |l|, |c| and |r|, included in the commands
-% |\multicolumn| and in the types of columns defined by |\newcolumntype|.
-%
-% * In |{NiceArray}| (and its variants), the columns of type |w| (ex. :
+% However, in |{NiceArray}| (and its variants), the columns of type |w| (e.g.:
% |wc{1cm}|) are composed in math mode whereas, in |{array}| of \pkg{array},
% they are composed in text mode.
-% \end{itemize}
%
% \medskip
% The environments |{pNiceArray}|, |{bNiceArray}|, etc. have no equivalent in
@@ -245,6 +247,18 @@ version 2005/12/01 or later.
% brackets, an optional list of \textsl{key=value} pairs. \textbf{There must be
% no space before the opening bracket (|[|) of this list of options.}
%
+%\bigskip
+% \textbf{Important}
+%
+% Before the version 5.0, it was mandatory to use, for technical reasons, the
+% letters |L|, |C| et |R| instead of |l|, |c| et |r| in the preambles of the
+% environments of \pkg{nicematrix}. If we want to be able to go on using these
+% letters, \pkg{nicematrix} must be loaded with the option |define-L-C-R|.
+% \begin{Verbatim}
+% \usepackage[define-L-C-R]{nicematrix}
+% \end{Verbatim}
+%
+%
% \section{The vertical space between the rows}
%
% It's well known that some rows of the arrays created by default with LaTeX
@@ -270,7 +284,9 @@ version 2005/12/01 or later.
% 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|.
+% |\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}
@@ -341,7 +357,7 @@ version 2005/12/01 or later.
% \item an item
% \smallskip
% \item \renewcommand{\arraystretch}{1.2}
-% $\begin{NiceArray}~emphase#[t]@{LCCCCCC}
+% $\begin{NiceArray}~emphase#[t]@{lcccccc}
% \hline
% n & 0 & 1 & 2 & 3 & 4 & 5 \\
% u_n & 1 & 2 & 4 & 8 & 16 & 32
@@ -354,7 +370,7 @@ version 2005/12/01 or later.
% \item an item
% \smallskip
% \item \renewcommand{\arraystretch}{1.2}
-% $\begin{NiceArray}[t]{LCCCCCC}
+% $\begin{NiceArray}[t]{lcccccc}
% \hline
% n & 0 & 1 & 2 & 3 & 4 & 5 \\
% u_n & 1 & 2 & 4 & 8 & 16 & 32 \\
@@ -373,7 +389,7 @@ version 2005/12/01 or later.
% \item an item
% \smallskip
% \item
-% $\begin{NiceArray}[t]{LCCCCCC}
+% $\begin{NiceArray}[t]{lcccccc}
% ~emphase#\toprule@
% n & 0 & 1 & 2 & 3 & 4 & 5 \\
% ~emphase#\midrule@
@@ -387,7 +403,7 @@ version 2005/12/01 or later.
% \item an item
% \smallskip
% \item
-% $\begin{NiceArray}[t]{LCCCCCC}
+% $\begin{NiceArray}[t]{lcccccc}
% \toprule
% n & 0 & 1 & 2 & 3 & 4 & 5 \\
% \midrule
@@ -415,7 +431,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}
-% \begin{NiceTabular}{CCCC}
+% \begin{NiceTabular}{cccc}
% rose & tulipe & marguerite & dahlia \\
% violette & ~emphase#\Block{2-2}{\LARGE\color{blue} fleurs}@ & & souci \\
% pervenche & & & lys \\
@@ -426,7 +442,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{center}
-% \begin{NiceTabular}{CCCC}
+% \begin{NiceTabular}{cccc}
% rose & tulipe & marguerite & dahlia \\
% violette & \Block{2-2}{\LARGE\color{blue} fleurs} & & souci \\
% pervenche & & & lys \\
@@ -435,7 +451,7 @@ version 2005/12/01 or later.
% \end{center}
%
% \interitem
-% On should remark that the horizontal centering of the contents of the blocks
+% One should remark that the horizontal centering of the contents of the blocks
% is correct even when an instruction such as |!{\qquad}| has been used in the
% preamble of the array in order to increase the space between two columns (this
% is not the case with |\multicolumn|). In the following example, the header
@@ -443,10 +459,11 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{center}
+% \fvset{commandchars=\~\#\+}
% \begin{BVerbatim}
-% \begin{NiceTabular}{C!{\qquad}CCC~emphase#!{\qquad}@CCC}
+% \begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}}
% \toprule
-% & ~emphase#\Block{1-3}{First group}@ & & & \Block{1-3}{Second group} \\
+% & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\
% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
% \midrule
% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
@@ -460,7 +477,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{center}
-% \begin{NiceTabular}{C!{\qquad}CCC!{\qquad}CCC}
+% \begin{NiceTabular}{@{}c!{\qquad}ccc!{\qquad}ccc@{}}
% \toprule
% & \Block{1-3}{First group} & & & \Block{1-3}{Second group} \\
% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
@@ -481,7 +498,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
-% $\begin{bNiceArray}{CCC|C}[margin]
+% $\begin{bNiceArray}{ccc|c}[margin]
% ~emphase#\Block{3-3}{A}@ & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
@@ -489,7 +506,7 @@ version 2005/12/01 or later.
% 0 & \Cdots& 0 & 0
% \end{bNiceArray}$
% \end{BVerbatim}
-% $\begin{bNiceArray}{CCC|C}[margin]
+% $\begin{bNiceArray}{ccc|c}[margin]
% \Block{3-3}{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
@@ -507,7 +524,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
-% $\begin{bNiceArray}{CCC|C}[margin]
+% $\begin{bNiceArray}{ccc|c}[margin]
% \Block{3-3}~emphase#<\Large>@{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
@@ -516,7 +533,7 @@ version 2005/12/01 or later.
% \end{bNiceArray}$
% \end{BVerbatim}
% \begin{scope}
-% $\begin{bNiceArray}{CCC|C}[margin]
+% $\begin{bNiceArray}{ccc|c}[margin]
% \Block{3-3}<\Large>{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
@@ -552,7 +569,7 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
-% \begin{NiceTabular}{|CCC|}[~emphase#rules/color=[gray]{0.9},rules/width=1pt@]
+% \begin{NiceTabular}{|ccc|}[~emphase#rules/color=[gray]{0.9},rules/width=1pt@]
% \hline
% rose & tulipe & lys \\
% arum & iris & violette \\
@@ -560,7 +577,7 @@ version 2005/12/01 or later.
% \hline
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|CCC|}[rules/color=[gray]{0.9},rules/width=1pt]
+% \begin{NiceTabular}{|ccc|}[rules/color=[gray]{0.9},rules/width=1pt]
% \hline
% rose & tulipe & lys \\
% arum & iris & violette \\
@@ -614,14 +631,14 @@ version 2005/12/01 or later.
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \setlength{\arrayrulewidth}{2pt}
-% \begin{NiceTabular}{CCCC} \hline
+% \begin{NiceTabular}{cccc} \hline
% A&B&C&D \\ ~emphase#\cline{2-2}@
% A&B&C&D \\ \hline
% \end{NiceTabular}
% \end{BVerbatim}
% \begin{scope}
% \setlength{\arrayrulewidth}{2pt}
-% \begin{NiceTabular}[c]{CCCC}
+% \begin{NiceTabular}[c]{cccc}
% \hline
% A&B&C&D \\
% \cline{2-2}
@@ -711,7 +728,7 @@ version 2005/12/01 or later.
% \medskip
% \begin{Verbatim}
% \setlength{\arrayrulewidth}{1pt}
-% \begin{NiceTabular}{CCCC}[~emphase#hvlines@,rules/color=blue]
+% \begin{NiceTabular}{cccc}[~emphase#hvlines@,rules/color=blue]
% rose & tulipe & marguerite & dahlia \\
% violette & \Block{2-2}{\LARGE\color{blue} fleurs} & & souci \\
% pervenche & & & lys \\
@@ -721,7 +738,7 @@ version 2005/12/01 or later.
%
% \begin{center}
% \setlength{\arrayrulewidth}{1pt}
-% \begin{NiceTabular}{CCCC}[hvlines,rules/color=blue]
+% \begin{NiceTabular}{cccc}[hvlines,rules/color=blue]
% rose & tulipe & marguerite & dahlia \\
% violette & \Block{2-2}{\LARGE\color{blue} fleurs} & & souci \\
% pervenche & & & lys \\
@@ -737,7 +754,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{Verbatim}
-% \begin{NiceTabular}{*{6}{C}}[~emphase#hvlines-except-corners@,cell-space-top-limit=3pt]
+% \begin{NiceTabular}{*{6}{c}}[~emphase#hvlines-except-corners@,cell-space-top-limit=3pt]
% & & & & A \\
% & & A & A & A \\
% & & & A \\
@@ -751,7 +768,7 @@ version 2005/12/01 or later.
% \end{Verbatim}
% %
% \begin{center}
-% \begin{NiceTabular}{*{6}{C}}[hvlines-except-corners,cell-space-top-limit=3pt]
+% \begin{NiceTabular}{*{6}{c}}[hvlines-except-corners,cell-space-top-limit=3pt]
% & & & & A \\
% & & A & A & A \\
% & & & A \\
@@ -769,7 +786,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{BVerbatim}[boxwidth=11cm,baseline=c]
-% \begin{NiceTabular}{*{6}{C}}%
+% \begin{NiceTabular}{*{6}{c}}%
% [~emphase#hvlines-except-corners@,cell-space-top-limit=3pt]
% 1\\
% 1&1\\
@@ -779,7 +796,7 @@ version 2005/12/01 or later.
% 1&5&10&10&5&1
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{*{6}{C}}[c,hvlines-except-corners,cell-space-top-limit=3pt]
+% \begin{NiceTabular}{*{6}{c}}[c,hvlines-except-corners,cell-space-top-limit=3pt]
% 1\\
% 1&1\\
% 1&2&1\\
@@ -798,7 +815,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
-% $\begin{NiceArray}{*{5}{C}}[hvlines]
+% $\begin{NiceArray}{*{5}{c}}[hvlines]
% ~emphase#\diagbox{x}{y}@ & e & a & b & c \\
% e & e & a & b & c \\
% a & a & e & c & b \\
@@ -806,7 +823,7 @@ version 2005/12/01 or later.
% c & c & b & a & e
% \end{NiceArray}$
% \end{BVerbatim}
-% $\begin{NiceArray}{*{5}{C}}[hvlines]
+% $\begin{NiceArray}{*{5}{c}}[hvlines]
% \diagbox{x}{y} & e & a & b & c \\
% e & e & a & b & c \\
% a & a & e & c & b \\
@@ -814,6 +831,8 @@ version 2005/12/01 or later.
% c & c & b & a & e
% \end{NiceArray}$
%
+% \medskip
+% It's possible to use the command |\diagbox| in a |\Block|.
%
%
% \subsection{Dotted rules}
@@ -848,13 +867,13 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
-% \left(\begin{NiceArray}{CCCC~emphase#:@C}
+% \left(\begin{NiceArray}{cccc~emphase#:@c}
% 1 & 2 & 3 & 4 & 5 \\
% 6 & 7 & 8 & 9 & 10 \\
% 11 & 12 & 13 & 14 & 15
% \end{NiceArray}\right)
% \end{BVerbatim}
-% $\left(\begin{NiceArray}{CCCC:C}
+% $\left(\begin{NiceArray}{cccc:c}
% 1 & 2 & 3 & 4 & 5 \\
% 6 & 7 & 8 & 9 & 10 \\
% 11 & 12 & 13 & 14 & 15
@@ -896,7 +915,8 @@ version 2005/12/01 or later.
%
% \medskip
% These commands are independent of \pkg{colortbl}.\footnote{Thus, it's possible
-% to coloror the rules, the cells, the rows, the columns, etc. without loading \pkg{colortbl}.}
+% to color the rules, the cells, the rows, the columns, etc. without loading
+% \pkg{colortbl}.}
%
% \medskip
% All these commands accept an optional argument (between square brackets and
@@ -916,7 +936,7 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{|C|C|C|}[code-before =
+% \begin{NiceTabular}{|c|c|c|}[code-before =
% ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@]
% \hline
% a & b & c \\ \hline
@@ -924,7 +944,7 @@ version 2005/12/01 or later.
% h & i & j \\ \hline
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|C|C|C|}[code-before =
+% \begin{NiceTabular}{|c|c|c|}[code-before =
% \cellcolor{red!15}{3-1,2-2,1-3}]
% \hline
% a & b & c \\ \hline
@@ -942,7 +962,7 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{|C|C|C|}[code-before =
+% \begin{NiceTabular}{|c|c|c|}[code-before =
% ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@]
% \hline
% a & b & c \\ \hline
@@ -950,7 +970,7 @@ version 2005/12/01 or later.
% h & i & j \\ \hline
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|C|C|C|}[code-before =
+% \begin{NiceTabular}{|c|c|c|}[code-before =
% \rectanglecolor{blue!15}{2-2}{3-3}]
% \hline
% a & b & c \\ \hline
@@ -971,7 +991,7 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz = 10cm
% \begin{BVerbatim}[boxwidth=9cm,baseline=c]
-% $\begin{NiceArray}{LLL}[hvlines, ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@]
+% $\begin{NiceArray}{lll}[hvlines, ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@]
% a_1 & b_1 & c_1 \\
% a_2 & b_2 & c_2 \\
% a_3 & b_3 & c_3 \\
@@ -984,7 +1004,7 @@ version 2005/12/01 or later.
% a_{10} & b_{10} & c_{10} \\
% \end{NiceArray}$
% \end{BVerbatim}
-% $\begin{NiceArray}{LLL}[baseline=4,hvlines, code-before = \rowcolor{red!15}{1,3-5,8-}]
+% $\begin{NiceArray}{lll}[baseline=4,hvlines, code-before = \rowcolor{red!15}{1,3-5,8-}]
% a_1 & b_1 & c_1 \\
% a_2 & b_2 & c_2 \\
% a_3 & b_3 & c_3 \\
@@ -1001,7 +1021,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \item The command |\columncolor| takes its name from the command
-% |\columncolor| of \pkg{colortbl}. Its syntax is similar to the syntaxe of
+% |\columncolor| of \pkg{colortbl}. Its syntax is similar to the syntax of
% |\rowcolor|.
%
% \bigskip
@@ -1017,7 +1037,7 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% \begin{NiceTabular}{LR}[hlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}@]
+% \begin{NiceTabular}{lr}[hlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}@]
% John & 12 \\
% Stephen & 8 \\
% Sarah & 18 \\
@@ -1026,7 +1046,7 @@ version 2005/12/01 or later.
% Madison & 15
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{LR}[hlines,code-before = \rowcolors{1}{blue!10}{},baseline=3]
+% \begin{NiceTabular}{lr}[hlines,code-before = \rowcolors{1}{blue!10}{},baseline=3]
% John & 12 \\
% Stephen & 8 \\
% Sarah & 18 \\
@@ -1044,13 +1064,13 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% $\begin{pNiceMatrix}[R,margin, ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@]
+% $\begin{pNiceMatrix}[r,margin, ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@]
% 1 & -1 & 1 \\
% -1 & 1 & -1 \\
% 1 & -1 & 1
% \end{pNiceMatrix}$
% \end{BVerbatim}
-% $\begin{pNiceMatrix}[R,baseline=1, margin, code-before = \chessboardcolors{red!15}{blue!15}]
+% $\begin{pNiceMatrix}[r,baseline=1, margin, code-before = \chessboardcolors{red!15}{blue!15}]
% 1 & -1 & 1 \\
% -1 & 1 & -1 \\
% 1 & -1 & 1
@@ -1058,7 +1078,7 @@ version 2005/12/01 or later.
% \end{scope}
%
% \medskip
-% We have used the key |R| which aligns all the columns rightwards (cf. p.~\pageref{key-R}).
+% We have used the key |r| which aligns all the columns rightwards (cf. p.~\pageref{key-R}).
% \end{itemize}
%
%
@@ -1071,7 +1091,7 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
-% \begin{NiceTabular}[c]{LSSSS}%
+% \begin{NiceTabular}[c]{lssss}%
% [code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
% ~emphase#\toprule@
% \Block{2-1}{Product} \\
@@ -1088,7 +1108,7 @@ version 2005/12/01 or later.
% ~emphase#\bottomrule@
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}[c]{LSSSS}[code-before = \rowcolor{red!15}{1-2}
+% \begin{NiceTabular}[c]{lssss}[code-before = \rowcolor{red!15}{1-2}
% \rowcolors{3}{blue!15}{}]
% \toprule
% \Block{2-1}{Product} &
@@ -1115,21 +1135,21 @@ version 2005/12/01 or later.
% In the environments with an explicit preamble (like |{NiceTabular}|,
% |{NiceArray}|, etc.), it's possible to fix the width of a given column with
% the standard letters |w| and |W| of the package \pkg{array}. In
-% |{NiceTabular}|, the cells of such columns are composed in texte mode but, in
+% |{NiceTabular}|, the cells of such columns are composed in text mode but, in
% |{NiceArray}|, |{pNiceArray}|, etc., they are composed in math mode (whereas,
% in |{array}| of \pkg{array}, they are composed in text mode).
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% \begin{NiceTabular}{~emphase#Wc{2cm}@CC}[hvlines]
+% \begin{NiceTabular}{~emphase#Wc{2cm}@cc}[hvlines]
% Paris & New York & Madrid \\
-% Berlin & London & Roma \\
+% Berlin & London & Roma \\
% Rio & Tokyo & Oslo
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{Wc{2cm}CC}[hvlines]
+% \begin{NiceTabular}{Wc{2cm}cc}[hvlines]
% Paris & New York & Madrid \\
-% Berlin & London & Roma \\
+% Berlin & London & Roma \\
% Rio & Tokyo & Oslo
% \end{NiceTabular}
%
@@ -1160,10 +1180,10 @@ version 2005/12/01 or later.
%
% \bigskip
% It's possible to give the special value |auto| to the option |columns-width|:
-% all the columns of the array will have a width equal to the widest cell of
-% the array.\footnote{The result is achieved with only one compilation (but Tikz
+% all the columns of the array will have a width equal to the widest cell of the
+% array.\footnote{The result is achieved with only one compilation (but PGF/Tikz
% will have written informations in the |.aux| file and a message requiring a
-% second compilation will appear).}\par\nobreak
+% second compilation will appear).}\par\nobreak
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
@@ -1285,11 +1305,11 @@ version 2005/12/01 or later.
%
% \bigskip
% We have several remarks to do.
-% \begin{itemize}
+% \begin{itemize}[beginpenalty=10000]
% \item For the environments with an explicit preamble (i.e. |{NiceArray}| and
% its variants), no letter must be given in that preamble for 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.
+% necessarily) be of type |r| for the first column and |l| for the last one.
% \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''.
@@ -1328,7 +1348,7 @@ version 2005/12/01 or later.
% ~emphase#code-for-first-col@ = \color{blue},
% ~emphase#code-for-last-row@ = \color{green},
% ~emphase#code-for-last-col@ = \color{magenta}}
-% $\begin{pNiceArray}{CC|CC}[first-row,last-row=5,first-col,last-col,nullify-dots]
+% $\begin{pNiceArray}{cc|cc}[first-row,last-row=5,first-col,last-col,nullify-dots]
% & C_1 & \Cdots & & C_4 & \\
% L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\
% \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\
@@ -1345,14 +1365,14 @@ version 2005/12/01 or later.
% code-for-last-row = \color{green},
% code-for-last-col = \color{magenta}}
% \begin{displaymath}
-% \begin{pNiceArray}{CC|CC}[first-row,last-row=5,first-col,last-col,nullify-dots]
-% & C_1 & \multicolumn1C{\Cdots} & & C_4 & \\
+% \begin{pNiceArray}{cc|cc}[first-row,last-row=5,first-col,last-col,nullify-dots]
+% & C_1 & \multicolumn1c{\Cdots} & & C_4 & \\
% L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\
% \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\
% \hline
% & a_{31} & a_{32} & a_{33} & a_{34} & \\
% L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\
-% & C_1 & \multicolumn1C{\Cdots} & & C_4 &
+% & C_1 & \multicolumn1c{\Cdots} & & C_4 &
% \end{pNiceArray}
% \end{displaymath}
% \end{scope}
@@ -1360,8 +1380,8 @@ version 2005/12/01 or later.
%
% \emph{Remarks}
% \begin{itemize}[beginpenalty=10000]
-% \item As shown in the previous example, the horizontal and rules doesn't
-% extend in the exterior rows and columns.
+% \item As shown in the previous example, the horizontal and vertical rules
+% doesn't extend in the exterior rows and columns.
%
% However, if one wishes to define new specifiers for columns in order to draw
% vertical rules (for example thicker than the standard rules), he should
@@ -1830,35 +1850,27 @@ version 2005/12/01 or later.
% cells relied par dotted lines.
%
% \medskip
-% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
-% \NiceMatrixOptions{nullify-dots}
-% $\begin{pNiceMatrix}[rules/color=gray,~emphase#hvlines@,margin]
-% 0 & \Cdots & & & & 0 \\
-% 1 & \Cdots & & & 1 & 2 \\
-% 0 & \Ddots & & & \Vdots & \Vdots \\
-% \Vdots & \Ddots & & & & \\
-% & & & & & \\
-% 0 & \Cdots & & 0 & 1 & 2 \\
-% \end{pNiceMatrix}$
+% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
+% $\begin{bNiceMatrix}[margin,~emphase#hvlines@]
+% \Block{3-3}<\LARGE>{A} & & & 0 \\
+% & \hspace*{1cm} & & \Vdots \\
+% & & & 0 \\
+% 0 & \Cdots& 0 & 0
+% \end{bNiceMatrix}$
% \end{BVerbatim}
-% \begin{scope}
-% \NiceMatrixOptions{nullify-dots}
-% $\begin{pNiceMatrix}[rules/color=gray,hvlines,margin]
-% 0 & \Cdots & & & & 0 \\
-% 1 & \Cdots & & & 1 & 2 \\
-% 0 & \Ddots & & & \Vdots & \Vdots \\
-% \Vdots & \Ddots & & & & \\
-% & & & & & \\
-% 0 & \Cdots & & 0 & 1 & 2 \\
-% \end{pNiceMatrix}$
-% \end{scope}
+% $\begin{bNiceMatrix}[margin,hvlines]
+% \Block{3-3}<\LARGE>{A} & & & 0 \\
+% & \hspace*{1cm} & & \Vdots \\
+% & & & 0 \\
+% 0 & \Cdots& 0 & 0
+% \end{bNiceMatrix}$
%
%
%
% \section{The code-after}
%
% \label{code-after}
-% The option |code-after| may be used to give some code that will be excuted
+% The option |code-after| may be used to give some code that will be executed
% after the construction of the matrix.\footnote{There is also a key
% |code-before| described p.~\pageref{code-before}.}
%
@@ -1866,7 +1878,7 @@ version 2005/12/01 or later.
% dotted lines between nodes. It takes two arguments for the two cells to rely,
% both of the form $i$-$j$ where is the number of row and $j$ is the number of
% column. It may be used, for example, to draw a dotted line
-% between two adjacents cells. \label{line-in-code-after}
+% between two adjacent cells. \label{line-in-code-after}
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
@@ -1889,14 +1901,337 @@ version 2005/12/01 or later.
% \end{scope}
%
% \medskip
-% For the readability of the code, an alternative syntax is provided: it's
+% 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.
+% environment, after the keyword |\CodeAfter|\footnote{In some circonstancies,
+% one must put |\omit \CodeAfter|. |\omit| is a keyword of TeX which cancels
+% the pattern of the current cell.}. For an example, cf.
% p.~\pageref{example-CodeAfter}.
%
%
%
+% \section{The notes in the tabulars}
+%
+% \label{s:notes}
+%
+% \subsection{The footnotes}
+%
+% \smallskip
+% The package \pkg{nicematrix} allows, by using \pkg{footnote} or
+% \pkg{footnotehyper}, the extraction of the notes inserted by |\footnote| in
+% the environments of \pkg{nicematrix} and their composition in the footpage
+% with the other notes of the document.
+%
+% \smallskip
+%
+% \smallskip
+% If \pkg{nicematrix} is loaded with the option |footnote| (with
+% |\usepackage[footnote]{nicematrix}| or with |\PassOptionsToPackage|), the
+% package \pkg{footnote} is loaded (if it is not yet loaded) and it is used to
+% extract the footnotes.
+%
+% \smallskip
+% If \pkg{nicematrix} is loaded with the option |footnotehyper|, the package
+% \pkg{footnotehyper} is loaded (if it is not yet loaded) ant it is used to
+% extract footnotes.
+%
+% \smallskip
+% Caution: The packages \pkg{footnote} and \pkg{footnotehyper} are incompatible.
+% The package \pkg{footnotehyper} is the successor of the package \pkg{footnote}
+% and should be used preferently. The package \pkg{footnote} has some drawbacks,
+% in particular: it must be loaded after the package \pkg{xcolor} and it is not
+% perfectly compatible with \pkg{hyperref}.
+%
+%
+% \subsection{The notes of tabular}
+%
+% The package \pkg{nicematrix} also provides a command |\tabularnote| which gives
+% the ability to specify notes that will be composed at the end of the array
+% with a width of line equal to the width of the array (excepted the potential
+% exterior columns). With no surprise, that command is available only in the
+% environments without delimiters, that is to say |{NiceTabular}|, |{NiceArray}|
+% and |{NiceMatrix}|.
+%
+% In fact, this command is available only if the extension \pkg{enumitem} has
+% been loaded (before or after \pkg{nicematrix}). Indeed, the notes are composed
+% at the end of the array with a type of list provided by the package
+% \pkg{enumitem}.
+%
+% \begin{scope}
+% \fvset{commandchars=\~\#\!}
+% \begin{Verbatim}
+% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
+% \toprule
+% Last name & First name & Birth day \\
+% \midrule
+% Achard\tabularnote{~emphase#Achard is an old family of the Poitou.!}
+% & Jacques & 5 juin 1962 \\
+% Lefebvre\tabularnote{~emphase#The name Lefebvre is an alteration of the name Lefebure.!}
+% & Mathilde & 23 mai 1988 \\
+% Vanesse & Stephany & 30 octobre 1994 \\
+% Dupont & Chantal & 15 janvier 1998 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{Verbatim}
+% \end{scope}
+%
+% \begin{center}
+% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
+% \toprule
+% Last name & First name & Birth day \\
+% \midrule
+% Achard\tabularnote{Achard is an old family of the Poitou.}
+% & Jacques & June 5, 2005 \\
+% Lefebvre\tabularnote{The name Lefebvre is an alteration of the name Lefebure.}
+% & Mathilde & January 23, 1975 \\
+% Vanesse & Stephany & October 30, 1994 \\
+% Dupont & Chantal & January 15, 1998 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{center}
+%
+%
+% \bigskip
+% \begin{itemize}
+% \item If you have several successive commands |\tabularnote{...}| \emph{with no
+% space at all between them}, the labels of the corresponding notes are composed
+% together, separated by commas.
+%
+% \item If a command |\tabularnote{...}| is exactly at the end of a cell (with
+% no space at all after), the label of the note is composed in an overlapping
+% position (towards the right). This structure may provide a better alignment of
+% the cells of a given column.
+%
+% \item If the key |notes/para| is used, the notes are composed at the end of
+% the array in a single paragraph (as with the key |para| of \pkg{threeparttable}).
+%
+% \item If the package \pkg{booktabs} has been loaded (before or after
+% \pkg{nicematrix}), the key |notes/bottomrule| draws a |\bottomrule| of
+% \pkg{booktabs} \emph{after} the notes.
+%
+% \item The command |\tabularnote| may be used \emph{before}
+% the environment of \pkg{nicematrix}. Thus, it's possible to use it on the
+% title inserted by |\caption| in an environment |{table}| of LaTeX.
+%
+% \item It's possible to create a reference to a tabular note created by |\tabularnote|
+% (with the usual command |\label| used after the |\tabularnote|).
+% \end{itemize}
+% %
+% For an illustration of some of those remarks, see table
+% \ref{t:tabularnote}, p.~\pageref{t:tabularnote}. This table has been composed
+% with the following code.
+%
+% \begin{center}
+% \fvset{commandchars=\~\#\!}
+% \begin{BVerbatim}[formatcom=\small\color{gray}]
+% \begin{table}
+% \setlength{\belowcaptionskip}{1ex}
+% \centering
+% \caption{Utilisation of \texttt{\textbackslash tabularnote}~emphase#\tabularnote{It's possible!
+% ~emphase#to put a note in the caption.}}!
+% \label{t:tabularnote}
+% \begin{NiceTabular}{@{}llc@{}[~emphase#notes/bottomrule!]
+% \toprule
+% Last name & First name & Length of life \\
+% \midrule
+% Churchill & Wiston & 91\\
+% Nightingale~emphase#\tabularnote{Considered as the first nurse of!
+% ~emphase#history.}\tabularnote{Nicknamed ``the Lady with the Lamp''.}!
+% & Florence & 90 \\
+% Schoelcher & Victor & 89~emphase#\tabularnote{The label of the note is overlapping.}!\\
+% Touchet & Marie & 89 \\
+% Wallis & John & 87 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{table}
+% \end{BVerbatim}
+% \end{center}
%
+%
+% \begin{table}
+% \setlength{\belowcaptionskip}{1ex}
+% \centering
+% \caption{Utilisation of \texttt{\textbackslash tabularnote}\tabularnote{It's possible
+% to put a note in the caption.}}
+% \label{t:tabularnote}
+% \begin{NiceTabular}{@{}llc@{}}[notes/bottomrule]
+% \toprule
+% Last name & First name & Length of life \\
+% \midrule
+% Churchill & Wiston & 91\\
+% Nightingale\tabularnote{Considered as the first nurse of
+% history.}\tabularnote{Nicknamed ``the Lady with the Lamp''.}
+% & Florence & 90 \\
+% Schoelcher & Victor & 89\tabularnote{The label of the note is overlapping.}\\
+% Touchet & Marie & 89 \\
+% Wallis & John & 87 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{table}
+%
+%
+%\subsection{Customisation of the tabular notes}
+%
+%
+% The tabular notes can be customized with a set of keys available in
+% |\NiceMatrixOptions|. The name of these keys is prefixed by |notes|.
+% \begin{itemize}
+% \item |notes/para|
+% \item |notes/bottomrule|
+% \item |notes/style|
+% \item |notes/label-in-tabular|
+% \item |notes/label-in-list|
+% \item |notes/enumitem-keys|
+% \item |notes/enumitem-keys-para|
+% \item |notes/code-before|
+% \end{itemize}
+% For sake of commodity, it is also possible to set these keys in
+% |\NiceMatrixOptions| via a key |notes| which takes as value a list of
+% pairs \textsl{key=value} where the name of the keys need no longer be
+% prefixed by |notes|:
+% \begin{center}
+% \begin{BVerbatim}[formatcom = \small \color{gray}]
+% \NiceMatrixOptions
+% {
+% notes =
+% {
+% bottomrule ,
+% style = ... ,
+% label-in-tabular = ... ,
+% enumitem-keys =
+% {
+% labelsep = ... ,
+% align = ... ,
+% ...
+% }
+% }
+% }
+% \end{BVerbatim}
+% \end{center}
+%
+%
+% \bigskip
+% We detail these keys.
+%
+% \begin{itemize}[itemsep=\medskipamount]
+% \item The key |notes/para| requires the composition of the notes (at the end of
+% the tabular) in a single paragraph.
+%
+% Initial value: |false|
+%
+% That key is also available within a given environment.
+%
+% \item The key |notes/bottomrule| adds a |\bottomrule| of \pkg{booktabs}
+% \emph{after} the notes. Of course, that rule is drawn only if there is really
+% notes in the tabular. The package \pkg{booktabs} must have been loaded (before
+% or after the package \pkg{nicematrix}). If it is not, an error is raised.
+%
+% Initial value: |false|
+%
+% That key is also available within a given environment.
+%
+% \item The key |notes/style| is a command whose argument is specified by |#1|
+% and which gives the style of numerotation of the notes. That style will be
+% used by |\ref| when referencing a tabular note marked with a command |\label|.
+% The labels formatted by that style are used, separated by commas, when the user
+% puts several consecutive commands |\tabularnote|. The marker |#1| is meant to
+% be the name of a LaTeX counter.
+%
+% Initial value: |\emph{\alph{#1}}|
+%
+% Another possible value should be a mere |\arabic{#1}|
+%
+% \item The key |notes/label-in-tabular| is a command whose argument is
+% specified by |#1| which is used when formatting the label of a note in the
+% tabular. Internally, this number of note has already been formatted by
+% |notes/style| before sent to that command.
+%
+% Initial value: |\textsuperscript{#1}|
+%
+% In French, it's a tradition of putting a small space before the label of note.
+% That tuning could be acheived by the following code:
+% %
+% \begin{Verbatim}
+% \NiceMatrixOptions{notes/label-in-tabular = \,\textsuperscript{~#1}}
+% \end{Verbatim}
+%
+%
+% \item The key |notes/label-in-list| is a command whose argument is specified
+% by |#1| which is used when formatting the label in the list of notes at the
+% end of the tabular. Internally, this number of note has already been formatted by
+% |notes/style| before sent to that command.
+%
+% Initial value: |\textsuperscript{#1}|
+%
+% In French, the labels of notes are not composed in upper position when
+% composing the notes. Such behaviour could be acheived by:
+% \begin{Verbatim}
+% \NiceMatrixOptions{notes/label-in-list = ~#1.\nobreak\hspace{0.25em}}
+% \end{Verbatim}
+% The command |\nobreak| is for the event that the option |para| is used.
+%
+%
+% \item The notes are composed at the end of the tabular by using internally a
+% style of list of \pkg{enumitem}.
+%
+% The key |notes/enumitem-keys| specifies a list of pairs
+% \textsl{key=value} (following the specifications of \pkg{enumitem}) to
+% customize that type of list.
+%
+% Initial value:\quad |noitemsep , leftmargin = * , align = left , labelsep = 0pt|
+%
+% This initial value contains the specification |align = left| which requires a
+% composition of the label leftwards in the box affected to that label.
+% With that tuning, the notes are composed flush left, which is pleasant when
+% composing tabulars in the spirit of \pkg{booktabs} (see for example the
+% table \ref{t:tabularnote}, p.~\pageref{t:tabularnote}).
+%
+%
+% \item The key |notes/enumitem-keys-para| is similar to the previous one but
+% corresponds to the type of list used when the option |para| is in force. Of
+% course, when the option |para| is used, a list of type |inline| (as called by
+% \pkg{enumitem}) is used and the pairs \textsl{key=value} should correspond to
+% such a list of type |inline| .
+%
+% Initial value:\quad |afterlabel = \nobreak, itemjoin = \quad|
+%
+%
+% \item The key |notes/code-before| est une token list inserted by \pkg{nicematrix}
+% just before the composition of the notes at the end of the tabular.
+%
+% Initial value: \textsl{empty}
+%
+% For example, if one wishes to compose all the notes in gray and |\footnotesize|,
+% he should use that key:
+% \begin{Verbatim}
+% \NiceMatrixOptions{notes/code-before = \footnotesize \color{gray}}
+% \end{Verbatim}
+% It's also possible to add |\raggedright| or |\RaggedRight| in that key (|\RaggedRight|
+% is a command of \pkg{ragged2e}).
+% \end{itemize}
+%
+%
+%
+% \bigskip
+% For an example of customization of the tabular notes, see p.~\pageref{ex:notes}.
+%
+%
+% \subsection{Utilisation of \{NiceTabular\} with threeparttable}
+%
+%
+% If you wish to use the environment |{NiceTabular}| in an environment
+% |{threeparttable}| of the eponymous package, you have to patch the environment
+% |{threeparttable}| with the following code:
+% \begin{Verbatim}[commandchars=\~\#\!]
+% \makeatletter
+% \AtBeginEnvironment{threeparttable}{\TPT@hookin{NiceTabular}}
+% \makeatother
+% \end{Verbatim}
+%
+% The command |\AtBeginEnvironment| is a command of the package \pkg{etoolbox}
+% which must have been loaded previously.
+%
+%
% \section{Other features}
%
% \subsection{Use of the column type S of siunitx}
@@ -1909,7 +2244,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}[baseline = c, boxwidth = 10.5cm]
-% $\begin{pNiceArray}{~emphase#S@CWc{1cm}C}[nullify-dots,first-row]
+% $\begin{pNiceArray}{~emphase#S@cWc{1cm}c}[nullify-dots,first-row]
% {C_1} & \Cdots & & C_n \\
% 2.3 & 0 & \Cdots & 0 \\
% 12.4 & \Vdots & & \Vdots \\
@@ -1917,7 +2252,7 @@ version 2005/12/01 or later.
% 7.2 & 0 & \Cdots & 0
% \end{pNiceArray}$
% \end{BVerbatim}
-% $\begin{pNiceArray}{SCWc{1cm}C}[nullify-dots,first-row]
+% $\begin{pNiceArray}{ScWc{1cm}c}[nullify-dots,first-row]
% {C_1} & \Cdots & & C_n \\
% 2.3 & 0 & \Cdots & 0 \\
% 12.4 & \Vdots & & \Vdots \\
@@ -1930,7 +2265,7 @@ version 2005/12/01 or later.
% supported by \pkg{nicematrix}.
%
%
-% \subsection{Alignement option in \{NiceMatrix\}}
+% \subsection{Alignment option in \{NiceMatrix\}}
%
% \label{key-R}
%
@@ -1942,12 +2277,12 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
-% $\begin{bNiceMatrix}[R]
+% $\begin{bNiceMatrix}[r]
% \cos x & - \sin x \\
% \sin x & \cos x
% \end{bNiceMatrix}$
% \end{BVerbatim}
-% $\begin{bNiceMatrix}[R]
+% $\begin{bNiceMatrix}[r]
% \cos x & - \sin x \\
% \sin x & \cos x
% \end{bNiceMatrix}$
@@ -2032,7 +2367,7 @@ version 2005/12/01 or later.
%
% \bigskip
% \begin{Verbatim}
-% $\begin{bNiceArray}{CCCC|C}[~emphase#small@,
+% $\begin{bNiceArray}{cccc|c}[~emphase#small@,
% last-col,
% code-for-last-col = \scriptscriptstyle,
% columns-width = 3mm ]
@@ -2042,7 +2377,7 @@ version 2005/12/01 or later.
% \end{bNiceArray}$
% \end{Verbatim}
% %
-% \[\begin{bNiceArray}{CCCC|C}[small, last-col,
+% \[\begin{bNiceArray}{cccc|c}[small, last-col,
% code-for-last-col = \scriptscriptstyle,
% columns-width=3mm]
% 1 & -2 & 3 & 4 & 5 \\
@@ -2120,7 +2455,7 @@ version 2005/12/01 or later.
% matrix, with the syntax $n$-$p$ where $n$ is the number of rows and $p$ the
% number of columns. The second argument is the pattern (it's a list of tokens
% which are inserted in each cell of the constructed matrix, excepted in the
-% cells of the eventual exterior rows and columns).
+% cells of the potential exterior rows and columns).
%
% \medskip
% \begin{Verbatim}
@@ -2188,14 +2523,14 @@ version 2005/12/01 or later.
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{~emphase#NiceArrayWithDelims@}
-% {\downarrow}{\uparrow}{CCC}[margin]
+% {\downarrow}{\uparrow}{ccc}[margin]
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9
% \end{~emphase#NiceArrayWithDelims@}$
% \end{BVerbatim}
% $\begin{NiceArrayWithDelims}
-% {\downarrow}{\uparrow}{CCC}[margin]
+% {\downarrow}{\uparrow}{ccc}[margin]
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9
@@ -2450,7 +2785,7 @@ version 2005/12/01 or later.
% \medskip
% \begin{BVerbatim}
% \large
-% \begin{NiceTabular}{wl{2cm}LL}[hvlines]
+% \begin{NiceTabular}{wl{2cm}ll}[hvlines]
% fraise & amande & abricot \\
% prune & pêche & poire \\[1ex]
% noix & noisette & brugnon
@@ -2460,7 +2795,7 @@ version 2005/12/01 or later.
% \hspace{0.9cm}
% \begin{scope}
% \large
-% \begin{NiceTabular}[c]{wl{2cm}LL}[hvlines]
+% \begin{NiceTabular}[c]{wl{2cm}ll}[hvlines]
% fraise & amande & abricot \\
% prune & pêche & poire \\[1ex]
% noix & noisette & brugnon
@@ -2474,7 +2809,7 @@ version 2005/12/01 or later.
% \hspace{1.5cm}
% \begin{scope}
% \large
-% \begin{NiceTabular}[c]{wl{2cm}LL}[hvlines,code-before = \chessboardcolors{red!15}{blue!15}]
+% \begin{NiceTabular}[c]{wl{2cm}ll}[hvlines,code-before = \chessboardcolors{red!15}{blue!15}]
% fraise & amande & abricot \\
% prune & pêche & poire \\[1ex]
% noix & noisette & brugnon
@@ -2490,7 +2825,7 @@ version 2005/12/01 or later.
% \hspace{1.5cm}
% \begin{scope}
% \large
-% \begin{NiceTabular}[c]{wl{2cm}LL}[hvlines,
+% \begin{NiceTabular}[c]{wl{2cm}ll}[hvlines,
% create-large-nodes,
% code-after = {\begin{tikzpicture}
% [every node/.style = {blend mode = multiply,
@@ -2522,7 +2857,7 @@ version 2005/12/01 or later.
% rule (with the names |col-|$j$), as described in the following figure. These
% nodes are available in the |code-before| and the |code-after|.
% \begin{center}
-% \begin{NiceTabular}{CCC}[hvlines,rules/width=1pt,rules/color=gray]
+% \begin{NiceTabular}{ccc}[hvlines,rules/width=1pt,rules/color=gray]
% rose & tulipe & lys \\
% arum & iris & violette \\
% muguet & dahlia & souci
@@ -2599,7 +2934,7 @@ version 2005/12/01 or later.
% The package \pkg{nicematrix} provides the command |\OnlyMainNiceMatrix|
% which is meant to be used in definitions of new column types. Its argument is
% evaluated if and only if we are in the main part of the array, that is to say
-% not in an eventual exterior row.
+% not in an potential exterior row.
%
% For example, one may wish to define a new column type |?| in order to draw a
% (black) heavy rule of width 1~pt. The following definition will do the
@@ -2615,14 +2950,14 @@ version 2005/12/01 or later.
% \newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}}
%
% \begin{BVerbatim}[baseline = c, boxwidth = 10.5cm]
-% $\begin{pNiceArray}{CC?CC}[first-row,last-row=3]
+% $\begin{pNiceArray}{cc?cc}[first-row,last-row=3]
% C_1 & C_2 & C_3 & C_4 \\
% a & b & c & d \\
% e & f & g & h \\
% C_1 & C_2 & C_3 & C_4
% \end{pNiceArray}$
% \end{BVerbatim}
-% $\begin{pNiceArray}{CC?CC}[first-row,last-row=3]
+% $\begin{pNiceArray}{cc?cc}[first-row,last-row=3]
% C_1 & C_2 & C_3 & C_4 \\
% a & b & c & d \\
% e & f & g & h \\
@@ -2773,15 +3108,114 @@ version 2005/12/01 or later.
%
% \subsection{Incompatibilities}
%
-% The package \pkg{nicematrix} is not compatible with \pkg{threeparttable}.
-%
-% \medskip
% The package \pkg{nicematrix} is not fully compatible with the package
% \pkg{arydshln} (because this package redefines many internal of \pkg{array}).
%
%
% \section{Examples}
%
+% \subsection{Notes in the tabulars}
+%
+% \label{ex:notes}
+%
+% The tools provided by \pkg{nicematrix} for the composition of the tabular
+% notes have been presented in the section \ref{s:notes} p.~\pageref{s:notes}.
+%
+% \medskip
+% Let's consider that we wish to number the notes of a tabular with
+% stars.\footnote{Of course, it's realistic only when there is very few notes in
+% the tabular.}
+%
+% \medskip
+% First, we write a command |\stars| similar the well-known commands
+% |\arabic|, |\alph|, |\Alph|, etc. which produce a number of stars equal to its argument
+% \footnote{In fact: the value of its argument.}
+% \begin{Verbatim}
+% \ExplSyntaxOn
+% \NewDocumentCommand ~emphase#\stars@ { m }
+% { \prg_replicate:nn { \value { ~#1 } } { $ \star $ } }
+% \ExplSyntaxOff
+% \end{Verbatim}
+% %
+% Of course, we change the style of the labels with the key |notes/style|.
+% However, it would be interesting to change also some parameters in the type of
+% list used to compose the notes at the end of the tabular.
+% First, we required a composition flush right for the labels with the setting
+% |align=right|.
+% Moreover, we want the labels to be composed on a width equal to the width of
+% the widest label. The widest label is, of course, the label with the greatest
+% number of stars. We know that number: it is equal to |\value{tabularnote}|
+% (because |tabularnote| is the LaTeX counter used by |\tabularnote| and,
+% therefore, at the end of the tabular, its value is equal to the total number
+% of tabular notes). We use the key |widest*| of \pkg{enumitem} in order to
+% require a width equal to that value: |widest*=\value{tabularnote}|.
+% \begin{Verbatim}
+% \NiceMatrixOptions
+% {
+% notes =
+% {
+% ~emphase#style = \stars{~#1} , @
+% ~emphase#enumitem-keys = @
+% ~emphase# { @
+% ~emphase# widest* = \value{tabularnote} ,@
+% ~emphase# align = right @
+% ~emphase# } @
+% }
+% }
+% \end{Verbatim}
+%
+%
+%
+% \begin{scope}
+% \ExplSyntaxOn
+% \NewDocumentCommand \stars { m }
+% { \prg_replicate:nn { \value { #1 } } { $ \star $ } }
+% \NiceMatrixOptions
+% {
+% notes =
+% {
+% style = \stars{#1} ,
+% enumitem-keys =
+% {
+% widest* = \value{tabularnote} ,
+% align = right
+% }
+% }
+% }
+% \ExplSyntaxOff
+% \begin{Verbatim}
+% \begin{NiceTabular}{~@{}llr~@{}}[first-row,code-for-first-row = \bfseries]
+% \toprule
+% Last name & First name & Birth day \\
+% \midrule
+% Achard\tabularnote{~emphase#Achard is an old family of the Poitou.@}
+% & Jacques & 5 juin 1962 \\
+% Lefebvre\tabularnote{~emphase#The name Lefebvre is an alteration of the name Lefebure.@}
+% & Mathilde & 23 mai 1988 \\
+% Vanesse & Stephany & 30 octobre 1994 \\
+% Dupont & Chantal & 15 janvier 1998 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{Verbatim}
+%
+% \begin{center}
+% \begin{NiceTabular}{@{}llr@{}}[first-row,code-for-first-row = \bfseries]
+% \toprule
+% Last name & First name & Birth day \\
+% \midrule
+% Achard\tabularnote{Achard is an old family of the Poitou.}
+% & Jacques & June 5, 2005 \\
+% Lefebvre\tabularnote{The name Lefebvre is an alteration of the name Lefebure.}
+% & Mathilde & January 23, 1975 \\
+% Vanesse & Stephany & October 30, 1994 \\
+% Dupont & Chantal & January 15, 1998 \\
+% \bottomrule
+% \end{NiceTabular}
+% \end{center}
+% \end{scope}
+%
+%
+%
% \subsection{Dotted lines}
%
%
@@ -2850,7 +3284,7 @@ version 2005/12/01 or later.
% \[\begin{BNiceMatrix}[nullify-dots]
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
-% \Cdots & & \multicolumn{6}{C}{10 \text{ other rows}} & \Cdots \\
+% \Cdots & & \multicolumn{6}{c}{10 \text{ other rows}} & \Cdots \\
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10
% \end{BNiceMatrix}\]
%
@@ -2885,7 +3319,7 @@ version 2005/12/01 or later.
% \bigskip
% \begin{BVerbatim}
% \setlength{\extrarowheight}{1mm}
-% \[\begin{vNiceArray}{CCCC:CCC}[columns-width=6mm]
+% \[\begin{vNiceArray}{cccc:ccc}[columns-width=6mm]
% a_0 & && &b_0 & & \\
% a_1 &\Ddots&& &b_1 &\Ddots& \\
% \Vdots&\Ddots&& &\Vdots &\Ddots&b_0 \\
@@ -2900,7 +3334,7 @@ version 2005/12/01 or later.
%
% \begin{scope}
% \setlength{\extrarowheight}{1mm}
-% \[\begin{vNiceArray}{CCCC:CCC}[columns-width=6mm]
+% \[\begin{vNiceArray}{cccc:ccc}[columns-width=6mm]
% a_0 & && &b_0 & & \\
% a_1 &\Ddots&& &b_1 &\Ddots& \\
% \Vdots&\Ddots&& &\Vdots &\Ddots&b_0 \\
@@ -2915,7 +3349,7 @@ version 2005/12/01 or later.
% An example for a linear system:\par\nobreak
%
% \begin{Verbatim}
-% $\begin{pNiceArray}{*6C|C}[nullify-dots,last-col,code-for-last-col=\scriptstyle]
+% $\begin{pNiceArray}{*6c|c}[nullify-dots,last-col,code-for-last-col=\scriptstyle]
% 1 & 1 & 1 &\Cdots & & 1 & 0 & \\
% 0 & 1 & 0 &\Cdots & & 0 & & L_2 \gets L_2-L_1 \\
% 0 & 0 & 1 &\Ddots & & \Vdots & & L_3 \gets L_3-L_1 \\
@@ -2926,7 +3360,7 @@ version 2005/12/01 or later.
% \end{Verbatim}
%
%
-% \[\begin{pNiceArray}{*6C|C}[nullify-dots,last-col,code-for-last-col=\scriptstyle]
+% \[\begin{pNiceArray}{*6c|c}[nullify-dots,last-col,code-for-last-col=\scriptstyle]
% 1 & 1 & 1 &\Cdots & & 1 & 0 & \\
% 0 & 1 & 0 &\Cdots & & 0 & & L_2 \gets L_2-L_1 \\
% 0 & 0 & 1 &\Ddots & & \Vdots & & L_3 \gets L_3-L_1 \\
@@ -2984,14 +3418,14 @@ version 2005/12/01 or later.
% \NiceMatrixOptions
% { last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
% \setlength{\extrarowheight}{1mm}
-% $\begin{pNiceArray}{CCCC:C}
+% $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 2 4 8 16 9 ;
% 3 9 27 81 36 ;
% 4 16 64 256 100
% \end{pNiceArray}$
% \medskip
-% $\begin{pNiceArray}{CCCC:C}
+% $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 0 2 6 14 7 { L_2 \gets -2 L_1 + L_2 } ;
% 0 6 24 78 33 { L_3 \gets -3 L_1 + L_3 } ;
@@ -3008,7 +3442,7 @@ version 2005/12/01 or later.
% \NiceMatrixOptions{last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
% \setlength{\extrarowheight}{1mm}
%
-% \enskip $\begin{pNiceArray}{CCCC:C}
+% \enskip $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 2 4 8 16 9 ;
% 3 9 27 81 36 ;
@@ -3017,7 +3451,7 @@ version 2005/12/01 or later.
%
% \medskip
%
-% \enskip $\begin{pNiceArray}{CCCC:C}
+% \enskip $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 0 2 6 14 7 { L_2 \gets -2 L_1 + L_2 } ;
% 0 6 24 78 33 { L_3 \gets -3 L_1 + L_3 } ;
@@ -3026,7 +3460,7 @@ version 2005/12/01 or later.
%
% \medskip
%
-% \enskip $\begin{pNiceArray}{CCCC:C}
+% \enskip $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 0 1 3 7 \frac72 { L_2 \gets \frac12 L_2 } ;
% 0 3 12 39 \frac{33}2 { L_3 \gets \frac12 L_3 } ;
@@ -3035,7 +3469,7 @@ version 2005/12/01 or later.
%
% \medskip
%
-% \enskip $\begin{pNiceArray}{CCCC:C}
+% \enskip $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 0 1 3 7 \frac72 ;
% 0 0 3 18 6 { L_3 \gets -3 L_2 + L_3 } ;
@@ -3044,7 +3478,7 @@ version 2005/12/01 or later.
%
% \medskip
%
-% \enskip $\begin{pNiceArray}{CCCC:C}
+% \enskip $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 0 1 3 7 \frac72 ;
% 0 0 1 6 2 { L_3 \gets \frac13 L_3 } ;
@@ -3053,7 +3487,7 @@ version 2005/12/01 or later.
%
% \medskip
%
-% \enskip $\begin{pNiceArray}{CCCC:C}
+% \enskip $\begin{pNiceArray}{cccc:c}
% 1 1 1 1 1 ;
% 0 1 3 7 \frac72 ;
% 0 0 1 6 2 ;
@@ -3090,7 +3524,7 @@ version 2005/12/01 or later.
% \label{example-CodeAfter}
%
% \begin{Verbatim}
-% $\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin = 2pt]
+% $\begin{pNiceArray}{>{\strut}cccc}[create-large-nodes,margin,extra-margin = 2pt]
% a_{11} & a_{12} & a_{13} & a_{14} \\
% a_{21} & a_{22} & a_{23} & a_{24} \\
% a_{31} & a_{32} & a_{33} & a_{34} \\
@@ -3106,7 +3540,7 @@ version 2005/12/01 or later.
% \end{pNiceArray}$
% \end{Verbatim}
%
-% \[\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin = 2pt]
+% \[\begin{pNiceArray}{>{\strut}cccc}[create-large-nodes,margin,extra-margin = 2pt]
% a_{11} & a_{12} & a_{13} & a_{14} \\
% a_{21} & a_{22} & a_{23} & a_{24} \\
% a_{31} & a_{32} & a_{33} & a_{34} \\
@@ -3226,14 +3660,14 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{Verbatim}
-% $\begin{pNiceArray}{CCC}[~emphase#name=example@,last-col,create-medium-nodes]
+% $\begin{pNiceArray}{ccc}[~emphase#name=example@,last-col,create-medium-nodes]
% a & a + b & a + b + c & L_1 \\
% a & a & a + b & L_2 \\
% a & a & a & L_3
% \end{pNiceArray}$
% \end{Verbatim}
%
-% \[\begin{pNiceArray}{CCC}[last-col]
+% \[\begin{pNiceArray}{ccc}[last-col]
% a & a + b & a + b + c & L_1 \\
% a & a & a + b & L_2 \\
% a & a & a & L_3
@@ -3274,7 +3708,7 @@ version 2005/12/01 or later.
% \medskip
% We obtain the following matrix.
%
-% \[\begin{pNiceArray}{CCC}[
+% \[\begin{pNiceArray}{ccc}[
% last-col,
% code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15,
% blend mode = multiply,
@@ -3303,7 +3737,7 @@ version 2005/12/01 or later.
% \medskip
% We obtain the following matrix.
%
-% \[\begin{pNiceArray}{CCC}[
+% \[\begin{pNiceArray}{ccc}[
% last-col,
% create-medium-nodes,
% code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15,
@@ -3327,7 +3761,7 @@ version 2005/12/01 or later.
% In the following example, we use the ``large nodes'' to highlight a zone of
% the matrix.\par\nobreak
% \begin{Verbatim}
-% \begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin=2pt]
+% \begin{pNiceArray}{>{\strut}cccc}[create-large-nodes,margin,extra-margin=2pt]
% A_{11} & A_{12} & A_{13} & A_{14} \\
% A_{21} & A_{22} & A_{23} & A_{24} \\
% A_{31} & A_{32} & A_{33} & A_{34} \\
@@ -3344,7 +3778,7 @@ version 2005/12/01 or later.
% \end{Verbatim}
%
%
-% \[\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin=2pt]
+% \[\begin{pNiceArray}{>{\strut}cccc}[create-large-nodes,margin,extra-margin=2pt]
% A_{11} & A_{12} & A_{13} & A_{14} \\
% A_{21} & A_{22} & A_{23} & A_{24} \\
% A_{31} & A_{32} & A_{33} & A_{34} \\
@@ -3386,7 +3820,7 @@ version 2005/12/01 or later.
% The matrix $B$ has a ``first row'' (for $C_j$) and that's why we use the key
% |first-row|.
% \begin{Verbatim}
-% \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row]
+% \begin{bNiceArray}{c>{\strut}cccc}[name=B,first-row]
% & & C_j \\
% b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
% \Vdots & & \Vdots & & \Vdots \\
@@ -3399,7 +3833,7 @@ version 2005/12/01 or later.
% The matrix $A$ has a ``first column'' (for $L_i$) and that's why we use the
% key |first-col|.
% \begin{Verbatim}
-% \begin{bNiceArray}{CC>{\strut}CCC}[name=A,first-col]
+% \begin{bNiceArray}{cc>{\strut}ccc}[name=A,first-col]
% & a_{11} & \Cdots & & & a_{1n} \\
% & \Vdots & & & & \Vdots \\
% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
@@ -3411,7 +3845,7 @@ version 2005/12/01 or later.
%
% In the matrix product, the two dotted lines have an open extremity.
% \begin{Verbatim}
-% \begin{bNiceArray}{CC>{\strut}CCC}
+% \begin{bNiceArray}{cc>{\strut}ccc}
% & & & & \\
% & & \Vdots \\
% \Cdots & & c_{ij} \\
@@ -3436,7 +3870,7 @@ version 2005/12/01 or later.
% \NiceMatrixOptions{nullify-dots}
% $\begin{array}{cc}
% &
-% \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row]
+% \begin{bNiceArray}{c>{\strut}cccc}[name=B,first-row]
% & & C_j \\
% b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
% \Vdots & & \Vdots & & \Vdots \\
@@ -3444,7 +3878,7 @@ version 2005/12/01 or later.
% & & \Vdots \\
% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
% \end{bNiceArray} \\ \\
-% \begin{bNiceArray}{CC>{\strut}CCC}[name=A,first-col]
+% \begin{bNiceArray}{cc>{\strut}ccc}[name=A,first-col]
% & a_{11} & \Cdots & & & a_{1n} \\
% & \Vdots & & & & \Vdots \\
% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
@@ -3452,7 +3886,7 @@ version 2005/12/01 or later.
% & a_{n1} & \Cdots & & & a_{nn} \\
% \end{bNiceArray}
% &
-% \begin{bNiceArray}{CC>{\strut}CCC}
+% \begin{bNiceArray}{cc>{\strut}ccc}
% & & & & \\
% & & \Vdots \\
% \Cdots & & c_{ij} \\
@@ -3519,7 +3953,7 @@ version 2005/12/01 or later.
{nicematrix}
{\myfiledate}
{\myfileversion}
- {Mathematical matrices with PGF/TikZ}
+ {Enhanced arrays with the help of PGF/TikZ}
% \end{macrocode}
%
%
@@ -3541,7 +3975,6 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { nicematrix } }
\cs_new_protected:Npn \@@_error:nnn { \msg_error:nnnn { nicematrix } }
\cs_new_protected:Npn \@@_fatal:n { \msg_fatal:nn { nicematrix } }
-\cs_new_protected:Npn \@@_fatal:nn { \msg_fatal:nnn { nicematrix } }
\cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { nicematrix } }
\cs_new_protected:Npn \@@_msg_new:nnn { \msg_new:nnnn { nicematrix } }
% \end{macrocode}
@@ -3555,15 +3988,24 @@ version 2005/12/01 or later.
% \bigskip
% \subsection*{Technical definitions}
%
+% \begin{macrocode}
+\bool_new:N \c_@@_in_preamble_bool
+\bool_set_true:N \c_@@_in_preamble_bool
+\AtBeginDocument { \bool_set_false:N \c_@@_in_preamble_bool }
+% \end{macrocode}
%
% \begin{macrocode}
\bool_new:N \c_@@_booktabs_loaded_bool
+\bool_new:N \c_@@_enumitem_loaded_bool
\bool_new:N \c_@@_tikz_loaded_bool
\AtBeginDocument
{
\@ifpackageloaded { booktabs }
{ \bool_set_true:N \c_@@_booktabs_loaded_bool }
{ }
+ \@ifpackageloaded { enumitem }
+ { \bool_set_true:N \c_@@_enumitem_loaded_bool }
+ { }
\@ifpackageloaded { tikz }
{
% \end{macrocode}
@@ -3782,6 +4224,13 @@ version 2005/12/01 or later.
{ \cs_set:Npn \CT@arc@ { \color { #1 } } }
% \end{macrocode}
%
+%
+% \bigskip
+% \begin{macrocode}
+\cs_new:Npn \@@_tab_or_array_colsep:
+ { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
+% \end{macrocode}
+%
% \bigskip
% \textbf{The column S of siunitx}\par\nobreak
%
@@ -3824,7 +4273,7 @@ version 2005/12/01 or later.
% {
% \tex_the:D \@temptokena
% > { ~emphase!\@@_Cell:+ \__siunitx_table_collect_begin: S {#1} }
-% c
+% ~emphase!\@@_true_c:+
% < { \__siunitx_table_print: ~emphase!\@@_end_Cell:+ }
% }
% \NC@find
@@ -3882,29 +4331,56 @@ version 2005/12/01 or later.
%
% \bigskip
% The command |\@@_renew_NC@rewrite@S:| will be used in each environment of
-% \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment
-% (only if the boolean |\c_@@_siunitx_loaded_bool| is raised, of course).
+% \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_renew_NC@rewrite@S:
+\AtBeginDocument
{
- \renewcommand*{\NC@rewrite@S}[1][]
+ \bool_if:nTF { ! \c_@@_siunitx_loaded_bool }
+ { \cs_set_eq:NN \@@_renew_NC@rewrite@S: \prg_do_nothing: }
{
- \@temptokena \exp_after:wN
+ \cs_new_protected:Npn \@@_renew_NC@rewrite@S:
{
- \tex_the:D \@temptokena
- > { \@@_Cell: \c_@@_table_collect_begin_tl S {##1} }
- c
- < { \c_@@_table_print_tl \@@_end_Cell: }
- }
- \NC@find
+ \renewcommand*{\NC@rewrite@S}[1][]
+ {
+ \@temptokena \exp_after:wN
+ {
+ \tex_the:D \@temptokena
+ > { \@@_Cell: \c_@@_table_collect_begin_tl S {##1} }
+% \end{macrocode}
+% |\@@_true_c:| will be replaced statically by |c| at the end of the construction
+% of the preamble.
+% \begin{macrocode}
+ \@@_true_c:
+ < { \c_@@_table_print_tl \@@_end_Cell: }
+ }
+ \NC@find
+ }
+ }
}
}
% \end{macrocode}
%
%
-% \bigskip
% \subsection*{Parameters}
%
+% \bigskip
+% For compatibility with versions prior to 5.0, we provide a load-time option
+% |define_L_C_R|. With this option, it's possible the letters |L|, |C| and |R|
+% instead of |l|, |c| and |r| in the preamble of the environments of
+% \pkg{nicematrix} as it was mandatory before version~5.0.
+% \begin{macrocode}
+\bool_new:N \c_@@_define_L_C_R_bool
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_define_L_C_R:
+ {
+ \newcolumntype L l
+ \newcolumntype C c
+ \newcolumntype R r
+ }
+% \end{document}
%
% \bigskip
% The following counter will count the environments |{NiceArray}|. The value of
@@ -3934,7 +4410,6 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
-%
% \bigskip
% The following command is only a syntaxic shortcut. The |q| in |qpoint| means
% \emph{quick}.
@@ -4016,8 +4491,7 @@ version 2005/12/01 or later.
% The following string will contain the word \emph{command} or
% \emph{environment} whether we are in a command of \pkg{nicematrix} or in an
% environment of \pkg{nicematrix}. The default value is \emph{environment}.
-% \begin{macrocode}
-\str_new:N \g_@@_com_or_env_str
+% \begin{macrocode}
\str_set:Nn \g_@@_com_or_env_str { environment }
% \end{macrocode}
%
@@ -4148,8 +4622,9 @@ version 2005/12/01 or later.
% \begin{macrocode}
\seq_new:N \g_@@_pos_of_blocks_seq
% \end{macrocode}
-% The sequence |\g_@@_pos_of_blocks_seq| will be used when we will draw the
-% rules required by the keys |hvlines| or |hvlines-except-corners|.
+% In fact, this sequence will also contain the positions of the cells with a
+% |\diagbox|. The sequence |\g_@@_pos_of_blocks_seq| will be used when we will
+% draw the rules required by the keys |hvlines| or |hvlines-except-corners|.
%
% \bigskip
% We will also manage a sequence for the positions of the dotted lines. These
@@ -4165,6 +4640,7 @@ version 2005/12/01 or later.
% required by the key |hvlines| (these rules won't be drawn within the virtual
% blocks corresponding to the dotted lines).
%
+%
%
% \bigskip
% \textbf{Variables for the exterior rows and columns}\par\nobreak
@@ -4197,7 +4673,7 @@ version 2005/12/01 or later.
%
% \medskip
% \item \textbf{Last row}\par\nobreak
-% The counter |\l_@@_last_row_int| is the number of the eventual ``last row'',
+% The counter |\l_@@_last_row_int| is the number of the potential ``last row'',
% as specified by the key |last-row|. A value of $-2$ means that there is no
% ``last row''. A value of $-1$ means that there is a ``last row'' but we don't
% know the number of that row (the key |last-row| has been used without value
@@ -4255,7 +4731,185 @@ version 2005/12/01 or later.
% \end{macrocode}
% This boolean is set to |false| at the end of |\@@_pre_array:|.
% \end{itemize}
-%
+%
+% \bigskip
+% \subsection*{The command \textbackslash tabularnote}
+%
+% \bigskip
+% The LaTeX counter |tabularnote| will be used to count the tabular notes during
+% the construction of the array (this counter won't be used during the
+% composition of the notes at the end of the array). You use a LaTeX counter
+% because we will use |\refstepcounter| in order to have the tabular notes
+% referenceable.
+% \begin{macrocode}
+\newcounter { tabularnote }
+% \end{macrocode}
+%
+% \bigskip
+% We will store in the following sequence the tabular notes of a given array.
+% \begin{macrocode}
+\seq_new:N \g_@@_tabularnotes_seq
+% \end{macrocode}
+%
+% \bigskip
+% The following counter will be used to count the number of successive tabular
+% notes such as in
+% |\tabularnote{Note 1}\tabularnote{Note 2}\tabularnote{Note 3}|.
+% In the tabular, the labels of those nodes are composed as a comma
+% separated list (e.g. \textsuperscript{\emph{a},\emph{b},\emph{c}}).
+% \begin{macrocode}
+\int_new:N \l_@@_number_of_notes_int
+% \end{macrocode}
+%
+% \bigskip
+% The following function can be redefined by using the key |notes/style|.
+% \begin{macrocode}
+\cs_new:Npn \@@_notes_style:n #1 { \emph { \alph { #1 } } }
+% \end{macrocode}
+%
+% \bigskip
+% The following fonction can be redefined by using the key
+% |notes/label-in-tabular|.
+% \begin{macrocode}
+\cs_new:Npn \@@_notes_label_in_tabular:n #1 { \textsuperscript { #1 } }
+% \end{macrocode}
+%
+% \bigskip
+% The following function can be redefined by using the key |notes/label-in-list|.
+% \begin{macrocode}
+\cs_new:Npn \@@_notes_label_in_list:n #1 { \textsuperscript { #1 } }
+% \end{macrocode}
+%
+% \bigskip
+% We define |\thetabularnote| because it will be used by LaTeX if the user want
+% to reference a footnote which has been marked by a |\label|. The TeX group is
+% for the case where the user has put an instruction such as |\color{red}| in
+% |\@@_notes_style:n|.
+% \begin{macrocode}
+\cs_set:Npn \thetabularnote { { \@@_notes_style:n { tabularnote } } }
+% \end{macrocode}
+%
+% \bigskip
+% The tabular notes will be available for the final user only when
+% \pkg{enumitem} is loaded. Indeed, the tabular notes will be composed at the end
+% of the array with a list customized by \pkg{enumitem} (a list |tabularnotes|
+% in the general case and a list |tabularnotes*| if the key |para| is in force).
+% However, we can test whether \pkg{enumitem} has been loaded only at the
+% beginning of the document (we want to allow the user to load \pkg{enumitem}
+% after \pkg{nicematrix}).
+% \begin{macrocode}
+\AtBeginDocument
+ {
+ \bool_if:nTF { ! \c_@@_enumitem_loaded_bool }
+ {
+ \NewDocumentCommand \tabularnote { m }
+ { \@@_error:n { enumitem~not~loaded } }
+ }
+ {
+% \end{macrocode}
+% The type of list |tabularnotes| will be used to format the tabular notes at
+% the end of the array in the general case and |tabularnotes*| will be used if
+% the key |para| is in force.
+% \begin{macrocode}
+ \newlist { tabularnotes } { enumerate } { 1 }
+ \setlist [ tabularnotes ]
+ {
+ noitemsep , leftmargin = * , align = left , labelsep = 0pt ,
+ label =
+ \@@_notes_label_in_list:n { \@@_notes_style:n { tabularnotesi } } ,
+ }
+ \newlist { tabularnotes* } { enumerate* } { 1 }
+ \setlist [ tabularnotes* ]
+ {
+ afterlabel = \nobreak ,
+ itemjoin = \quad ,
+ label =
+ \@@_notes_label_in_list:n { \@@_notes_style:n { tabularnotes*i } }
+ }
+% \end{macrocode}
+%
+% \medskip
+% The command |\tabularnote| is available in the whole document (and not only in
+% the environments of \pkg{nicematrix}) because we want it to be available in
+% the caption of a |{table}| (before the following |{NiceTabular}| or
+% |{NiceArray}|). That's also the reason why the variables |\c@tabularnote| and
+% |\g_@@_tabularnotes_seq| will be cleared at the end of the environment of
+% \pkg{nicematrix} (and not at the beginning).
+%
+% Unfortunately, if the package \pkg{caption} is loaded, the command |\caption|
+% evaluates its argument twice and since it is not aware (of course) of
+% |\tabularnote|, the command |\tabularnote| is, in fact, not usable in
+% |\caption| when \pkg{caption} is loaded.\footnote{We should try to find a
+% solution to that problem.}
+% \begin{macrocode}
+ \NewDocumentCommand \tabularnote { m }
+ {
+ \bool_if:nTF { ! \l_@@_NiceArray_bool && \l_@@_in_env_bool }
+ { \@@_error:n { tabularnote~forbidden } }
+ {
+% \end{macrocode}
+% |\l_@@_number_of_notes_int| is used to count the number of successive tabular
+% notes such as in
+% |\tabularnote{Note 1}\tabularnote{Note 2}\tabularnote{Note 3}|.
+% We will have to compose the labels of theses notes as a comma separated list
+% (e.g. \textsuperscript{\emph{a},\emph{b},\emph{c}}).
+% \begin{macrocode}
+ \int_incr:N \l_@@_number_of_notes_int
+% \end{macrocode}
+% We expand the content of the note at the point of utilisation of
+% |\tabularnote| as does |\footnote|.
+% \begin{macrocode}
+ \seq_gput_right:Nx \g_@@_tabularnotes_seq { #1 }
+ \peek_meaning:NF \tabularnote
+ {
+% \end{macrocode}
+% If the following token is \emph{not} a |\tabularnote|, we have finished the
+% sequence of successive commands |\tabularnote| and we have to format the
+% labels of these tabular notes (in the array). We compose those labels in a box
+% |\l_tmpa_box| because we will do a special construction in order to have this
+% box in a overlapping position if we are at the end of a cell.
+% \begin{macrocode}
+ \hbox_set:Nn \l_tmpa_box
+ {
+% \end{macrocode}
+% We remind that it is the command |\@@_notes_label_in_tabular:n| that will
+% (most of the time) put the labels in a |\textsuperscript|.
+% \begin{macrocode}
+ \@@_notes_label_in_tabular:n
+ {
+ \stepcounter { tabularnote }
+ \@@_notes_style:n { tabularnote }
+ \prg_replicate:nn { \l_@@_number_of_notes_int - 1 }
+ {
+ ,
+ \stepcounter { tabularnote }
+ \@@_notes_style:n { tabularnote }
+ }
+ }
+ }
+% \end{macrocode}
+% We use |\refstepcounter| in order to have the (last) tabular note referenceable
+% (with the standard command |\label|) and that's why we have to go back with a
+% decrementation of the counter |tabularnote| first.
+% \begin{macrocode}
+ \addtocounter { tabularnote } { -1 }
+ \refstepcounter { tabularnote }
+ \int_zero:N \l_@@_number_of_notes_int
+ \hbox_overlap_right:n { \box_use:N \l_tmpa_box }
+% \end{macrocode}
+% If the command |\tabularnote| is used exactly at the end of the cell, the
+% |\unskip| (inserted by \pkg{array}?) will delete the skip we insert now
+% and the label of the footnote will be composed in an overlapping position (by
+% design).
+% \begin{macrocode}
+ \skip_horizontal:n { \box_wd:N \l_tmpa_box }
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+%
%
%
% \subsection*{Command for creation of rectangle nodes}
@@ -4436,6 +5090,11 @@ version 2005/12/01 or later.
\bool_new:N \l_@@_hvlines_except_corners_bool
% \end{macrocode}
%
+% \begin{macrocode}
+\dim_new:N \l_@@_notes_above_space_dim
+\dim_set:Nn \l_@@_notes_above_space_dim { 1 mm }
+% \end{macrocode}
+%
% \bigskip
% The flag |\l_@@_nullify_dots_bool| corresponds to the option |nullify-dots|.
% When the flag is down, the instructions like |\vdots| are inserted within a
@@ -4525,23 +5184,21 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% First, we define a set of keys ``|NiceMatrix / Global|'' which will be used
-% (with the mechanism of |.inherit:n|) by other sets of keys.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / xdots }
{
line-style .code:n =
- {
- \bool_lazy_or:nnTF
+ {
+ \bool_lazy_or:nnTF
% \end{macrocode}
% We can't use |\c_@@_tikz_loaded_bool| to test whether \pkg{tikz} is loaded
% because |\NiceMatrixOptions| may be used in the preamble of the document.
% \begin{macrocode}
- { \cs_if_exist_p:N \tikzpicture }
- { \str_if_eq_p:nn { #1 } { standard } }
- { \tl_set:Nn \l_@@_xdots_line_style_tl { #1 } }
- { \@@_error:n { bad~option~for~line-style } }
- } ,
+ { \cs_if_exist_p:N \tikzpicture }
+ { \str_if_eq_p:nn { #1 } { standard } }
+ { \tl_set:Nn \l_@@_xdots_line_style_tl { #1 } }
+ { \@@_error:n { bad~option~for~line-style } }
+ } ,
line-style .value_required:n = true ,
color .tl_set:N = \l_@@_xdots_color_tl ,
color .value_required:n = true ,
@@ -4557,7 +5214,12 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \bigskip
+% The following keys are for the tabular notes (specified by the command
+% |\tabularnote| inside |{NiceTabular}| and |{NiceArray}|).
%
+%
+% \bigskip
% \begin{macrocode}
\keys_define:nn { NiceMatrix / rules }
{
@@ -4567,7 +5229,12 @@ version 2005/12/01 or later.
width .value_required:n = true
}
% \end{macrocode}
-%
+%
+%
+% \bigskip
+% First, we define a set of keys ``|NiceMatrix / Global|'' which will be used
+% (with the mechanism of |.inherit:n|) by other sets of keys.
+%
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Global }
{
@@ -4598,11 +5265,11 @@ version 2005/12/01 or later.
hlines .bool_set:N = \l_@@_hlines_bool ,
vlines .bool_set:N = \l_@@_vlines_bool ,
hvlines .code:n =
- {
- \bool_set_true:N \l_@@_hvlines_bool
- \bool_set_true:N \l_@@_vlines_bool
- \bool_set_true:N \l_@@_hlines_bool
- } ,
+ {
+ \bool_set_true:N \l_@@_hvlines_bool
+ \bool_set_true:N \l_@@_vlines_bool
+ \bool_set_true:N \l_@@_hlines_bool
+ } ,
parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
% \end{macrocode}
%
@@ -4641,13 +5308,13 @@ version 2005/12/01 or later.
hvlines-except-corners .bool_set:N = \l_@@_hvlines_except_corners_bool ,
hvlines-except-corners .default:n = true ,
code-before .code:n =
- {
- \tl_if_empty:nF { #1 }
- {
- \tl_set:Nn \l_@@_code_before_tl { #1 }
- \bool_set_true:N \l_@@_code_before_bool
- }
- } ,
+ {
+ \tl_if_empty:nF { #1 }
+ {
+ \tl_set:Nn \l_@@_code_before_tl { #1 }
+ \bool_set_true:N \l_@@_code_before_bool
+ }
+ } ,
% \end{macrocode}
% \bigskip
% The options |c|, |t| and |b| of the environment |{NiceArray}| have the same
@@ -4683,7 +5350,61 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+% \begin{macrocode}
+\keys_define:nn { NiceMatrix / notes }
+ {
+ para .bool_set:N = \l_@@_notes_para_bool ,
+ para .default:n = true ,
+ code-before .tl_set:N = \l_@@_notes_code_before_tl ,
+ code-before .value_required:n = true ,
+ code-after .tl_set:N = \l_@@_notes_code_after_tl ,
+ code-after .value_required:n = true ,
+ bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool ,
+ bottomrule .default:n = true ,
+ style .code:n = \cs_set:Nn \@@_notes_style:n { #1 } ,
+ style .value_required:n = true ,
+ label-in-tabular .code:n =
+ \cs_set:Nn \@@_notes_label_in_tabular:n { #1 } ,
+ label-in-tabular .value_required:n = true ,
+ label-in-list .code:n =
+ \cs_set:Nn \@@_notes_label_in_list:n { #1 } ,
+ label-in-list .value_required:n = true ,
+ enumitem-keys .code:n =
+ {
+ \bool_if:NTF \c_@@_in_preamble_bool
+ {
+ \AtBeginDocument
+ {
+ \bool_if:NT \c_@@_enumitem_loaded_bool
+ { \setlist* [ tabularnotes ] { #1 } }
+ }
+ }
+ {
+ \bool_if:NT \c_@@_enumitem_loaded_bool
+ { \setlist* [ tabularnotes ] { #1 } }
+ }
+ } ,
+ enumitem-keys .value_required:n = true ,
+ enumitem-keys-para .code:n =
+ {
+ \bool_if:NTF \c_@@_in_preamble_bool
+ {
+ \AtBeginDocument
+ {
+ \bool_if:NT \c_@@_enumitem_loaded_bool
+ { \setlist* [ tabularnotes* ] { #1 } }
+ }
+ }
+ {
+ \bool_if:NT \c_@@_enumitem_loaded_bool
+ { \setlist* [ tabularnotes* ] { #1 } }
+ }
+ } ,
+ enumitem-keys-para .value_required:n = true ,
+ unknown .code:n = \@@_error:n { Unknown~key~for~notes }
+ }
+% \end{macrocode}
+%
% \bigskip
% We begin the construction of the major sets of keys (used by the different
% user commands and environments).
@@ -4695,6 +5416,8 @@ version 2005/12/01 or later.
NiceMatrix / Global ,
} ,
NiceMatrixOptions / xdots .inherit:n = NiceMatrix / xdots ,
+ NiceMatrixOptions / rules .inherit:n = NiceMatrix / rules ,
+ NiceMatrixOptions / notes .inherit:n = NiceMatrix / notes ,
NiceMatrix .inherit:n =
{
NiceMatrix / Global ,
@@ -4796,10 +5519,13 @@ version 2005/12/01 or later.
{ \@@_error:n { Bad~value~for~letter~for~dotted~lines } }
} ,
letter-for-dotted-lines .value_required:n = true ,
+ notes .code:n = \keys_set:nn { NiceMatrix / notes } { #1 } ,
+ notes .value_required:n = true ,
unknown .code:n = \@@_error:n { Unknown~key~for~NiceMatrixOptions }
}
% \end{macrocode}
%
+%
% \begin{macrocode}
\str_new:N \l_@@_letter_for_dotted_lines_str
\str_set_eq:NN \l_@@_letter_for_dotted_lines_str \c_colon_str
@@ -4828,10 +5554,10 @@ version 2005/12/01 or later.
\int_set:Nn \l_@@_last_col_int { -1 }
}
{ \int_set:Nn \l_@@_last_col_int { #1 } } ,
- l .code:n = \tl_set:Nn \l_@@_type_of_col_tl L ,
- r .code:n = \tl_set:Nn \l_@@_type_of_col_tl R ,
- L .code:n = \tl_set:Nn \l_@@_type_of_col_tl L ,
- R .code:n = \tl_set:Nn \l_@@_type_of_col_tl R ,
+ l .code:n = \tl_set:Nn \l_@@_type_of_col_tl l ,
+ r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
+ L .code:n = \tl_set:Nn \l_@@_type_of_col_tl l ,
+ R .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
S .code:n = \bool_if:NTF \c_@@_siunitx_loaded_bool
{ \tl_set:Nn \l_@@_type_of_col_tl S }
{ \@@_error:n { option~S~without~siunitx } } ,
@@ -4861,6 +5587,10 @@ version 2005/12/01 or later.
last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
+ notes / para .bool_set:N = \l_@@_notes_para_bool ,
+ notes / para .default:n = true ,
+ notes / bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool ,
+ notes / bottomrule .default:n = true ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray }
}
% \end{macrocode}
@@ -4888,6 +5618,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceTabular }
{
+ notes / para .bool_set:N = \l_@@_notes_para_bool ,
+ notes / para .default:n = true ,
+ notes / bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool ,
+ notes / bottomrule .default:n = true ,
last-col .code:n = \tl_if_empty:nF {#1}
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
@@ -4988,7 +5722,7 @@ version 2005/12/01 or later.
% The following code is used in each cell of the array. It actualises quantities
% that, at the end of the array, will give informations about the vertical
% dimension of the two first rows and the two last rows. If the user uses the
-% |last-row|, some lines will be dynamically added to this command.
+% |last-row|, some lines of code will be dynamically added to this command.
% \begin{macrocode}
\cs_new_protected:Npn \@@_update_for_first_and_last_row:
{
@@ -5050,7 +5784,7 @@ version 2005/12/01 or later.
% \begin{itemize}
% \item if the width of the box |\l_@@_cell_box| (created with the content of
% the cell) is equal to zero, we consider the cell as empty (however,
-% this is not perfect since the user may have use a |\rlap|, a |\llap| or a
+% this is not perfect since the user may have used a |\rlap|, a |\llap| or a
% |\mathclap| of \pkg{mathtools}.
% \item the cells with a command |\Ldots| or |\Cdots|, |\Vdots|, etc.,
% should also be considered as empty; if |nullify-dots| is in force, there would
@@ -5278,9 +6012,9 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_set_protected:Npn \@@_newcolumntype #1
{
- \cs_if_free:cT { NC @ find @ #1 }
- { \NC@list \expandafter { \the \NC@list \NC@do #1 } }
- \cs_set:cpn {NC @ find @ #1 } ##1 #1 { \NC@ { ##1 } }
+ % \cs_if_free:cT { NC @ find @ #1 }
+ % { \NC@list \exp_after:wN { \the \NC@list \NC@do #1 } }
+ \cs_set:cpn { NC @ find @ #1 } ##1 #1 { \NC@ { ##1 } }
\peek_meaning:NTF [
{ \newcol@ #1 }
{ \newcol@ #1 [ 0 ] }
@@ -5318,7 +6052,7 @@ version 2005/12/01 or later.
%
% \bigskip
% The following code |\@@_pre_array:| is used in |{NiceArrayWithDelims}|. It
-% exists as a standalone macro only for lisibility.
+% exists as a standalone macro only for legibility.
% \label{prearray}
%
% \begin{macrocode}
@@ -5408,9 +6142,7 @@ version 2005/12/01 or later.
% \end{macrocode}
% After its first use, the definition of |\ialign| will revert
% automatically to its default definition. With this programmation, we will
-% have, in the cells of the array, a clean version of |\ialign|.\footnote{The
-% user will probably not use directly |\ialign| in the array... but more
-% likely environments that utilize |\ialign| internally (e.g.: |{substack}|).}
+% have, in the cells of the array, a clean version of |\ialign|.
% \begin{macrocode}
\cs_set_eq:NN \ialign \@@_old_ialign:
\halign
@@ -5499,15 +6231,6 @@ version 2005/12/01 or later.
\cs_set_eq:NN \@ifnextchar \new@ifnextchar
% \end{macrocode}
%
-% \bigskip
-% We define the new column types |L|, |C| and |R| that must be used instead of
-% |l|, |c| and |r| in the preamble of |{NiceArray}|. We use |\@@_newcolumntype|
-% because it will be slightly quicker thant |\newcolumtype|.
-% \begin{macrocode}
- \@@_newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
- \@@_newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
- \@@_newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
-% \end{macrocode}
%
% \bigskip
% We redefine the column types |p|, |m| and |b|. The command
@@ -5529,17 +6252,24 @@ version 2005/12/01 or later.
\hbox_set:Nw \l_@@_cell_box
\@@_Cell:
}
- c
+% \end{macrocode}
+% |\@@_true_c:| will be replaced statically by |c| at the end of the construction
+% of the preamble.
+% \begin{macrocode}
+ \@@_true_c:
< {
\@@_end_Cell:
\hbox_set_end:
% \end{macrocode}
-% The |\str_lowercase:n| is only for giving the user the ability to write
-% |wC{1cm}| instead of |wc{1cm}| for homogeneity with the letters |L|, |C| and
-% |R| used elsewhere in the preamble instead of |l|, |c| and |r|.
+% The construction with |\@@_foldcase:| (defined below) should be replaced by
+% |\str_foldcase:n| when that command of \pkg{expl3} will be widespread. That
+% construction is only for giving the user the ability to write |wC{1cm}|
+% instead of |wc{1cm}| for homogeneity with the letters |L|, |C| and |R| used
+% elsewhere in the preamble instead of |l|, |c| and |r|.
% \begin{macrocode}
- \makebox [ ##2 ] [ \str_lowercase:n { ##1 } ]
- { \box_use_drop:N \l_@@_cell_box }
+ \tl_set:Nn \l_tmpa_tl { ##1 }
+ \makebox [ ##2 ] [ \@@_foldcase: ]
+ { \box_use_drop:N \l_@@_cell_box }
}
}
\@@_newcolumntype W [ 2 ]
@@ -5548,12 +6278,17 @@ version 2005/12/01 or later.
\hbox_set:Nw \l_@@_cell_box
\@@_Cell:
}
- c
+% \end{macrocode}
+% |\@@_true_c:| will be replaced statically by |c| at the end of the construction
+% of the preamble.
+% \begin{macrocode}
+ \@@_true_c:
< {
\@@_end_Cell:
\hbox_set_end:
\cs_set_eq:NN \hss \hfil
- \makebox [ ##2 ] [ \str_lowercase:n { ##1 } ]
+ \tl_set:Nn \l_tmpa_tl { ##1 }
+ \makebox [ ##2 ] [ \@@_foldcase: ]
{ \box_use_drop:N \l_@@_cell_box }
}
}
@@ -5623,7 +6358,7 @@ version 2005/12/01 or later.
}
}
\int_gzero_new:N \g_@@_last_vdotted_col_int
- \bool_if:NT \c_@@_siunitx_loaded_bool \@@_renew_NC@rewrite@S:
+ \@@_renew_NC@rewrite@S:
\int_gset:Nn \g_@@_last_vdotted_col_int { -1 }
\bool_gset_false:N \g_@@_last_col_found_bool
% \end{macrocode}
@@ -5639,7 +6374,23 @@ version 2005/12/01 or later.
\tl_gclear_new:N \g_@@_Ddots_lines_tl
\tl_gclear_new:N \g_@@_Iddots_lines_tl
\tl_gclear_new:N \g_@@_HVdotsfor_lines_tl
- }
+ }
+% \end{macrocode}
+%
+% \medskip
+% The following command will be deleted when we will consider |\str_lowercase:n|
+% as widespread.
+% \begin{macrocode}
+\cs_set:Npn \@@_foldcase:
+ {
+ \tl_case:NnF \l_tmpa_tl
+ {
+ C { c }
+ L { l }
+ R { r }
+ }
+ { \l_tmpa_tl }
+ }
% \end{macrocode}
%
% \bigskip
@@ -5648,6 +6399,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } }
{
+ \bool_if:NT \c_@@_footnote_bool { \begin { savenotes } }
% \end{macrocode}
% The aim of the following |\bgroup| (the corresponding |\egroup| is, of course,
% at the end of the environment) is to be able to put an exposant to a matrix in
@@ -5712,6 +6464,8 @@ version 2005/12/01 or later.
\seq_clear:N \g_@@_blocks_seq
\seq_clear:N \g_@@_pos_of_blocks_seq
% \end{macrocode}
+% In fact, the sequence |\g_@@_pos_of_blocks_seq| will also contain the
+% positions of the cells with a |\diagbox|.
%
%
% The set of keys is not exactly the same for |{NiceArray}| and for the variants
@@ -5730,6 +6484,8 @@ version 2005/12/01 or later.
{ \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
% \end{macrocode}
%
+%
+%
% \bigskip
% If the key |code-before| is used, we have to create the |col| nodes and the
% |row| nodes before the creation of the array. First, we have to test whether
@@ -5909,7 +6665,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 #1 $ }
\dim_set:Nn \l_@@_left_delim_dim { \box_wd:N \l_tmpa_box }
- \hbox_set:Nn \l_tmpa_box { $\bBigg@ 5 #2 $ }
+ \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 #2 $ }
\dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box }
}
% \end{macrocode}
@@ -5921,10 +6677,62 @@ version 2005/12/01 or later.
\box_clear_new:N \l_@@_the_array_box
% \end{macrocode}
%
-% \medskip
+% \bigskip
% We construct the preamble of the array in |\l_tmpa_tl|.
% \begin{macrocode}
\tl_set:Nn \l_tmpa_tl { #4 }
+% \end{macrocode}
+%
+%
+% \bigskip
+% If the user has loaded |nicematrix| with the option |define-L-C-R|, he will be
+% able to use |L|, |C| and |R| instead of |l|, |c| and |r| in the preambles of
+% the environments of \pkg{nicematrix} (it's a compatibility mode since |L|, |C|
+% and |R| were mandatory before version 5.0).
+% \begin{macrocode}
+ \bool_if:NT \c_@@_define_L_C_R_bool \@@_define_L_C_R:
+% \end{macrocode}
+%
+% \bigskip
+% We will do an ``expansion''\footnote{This ``expansion'' expands all the
+% constructions with |*| and with the new column types defined by
+% |\newcolumntype|.} of the preamble (with the tools of \pkg{array}
+% itself) and a replacement of the specifiers |c|, |l| and |r| by the specifiers
+% |C|, |L| and |R|.
+%
+%
+% We store our preamble in the token register |\@temptokena| (those
+% ``token registers'' are not supported by \pkg{expl3}).
+% \begin{macrocode}
+ \@temptokena \exp_after:wN { \l_tmpa_tl }
+% \end{macrocode}
+% Initialisation of a flag used by \pkg{array} to detect the end of the expansion.
+% \begin{macrocode}
+ \@tempswatrue
+% \end{macrocode}
+% The following line actually does the expansion (it's has been copied from
+% |array.sty|).
+% \begin{macrocode}
+ \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
+% \end{macrocode}
+% We put back the preamble in our token list |\l_tmpa_tl|.
+% \begin{macrocode}
+ \tl_gset:NV \l_tmpa_tl \@temptokena
+% \end{macrocode}
+%
+% We do the replacement of letters |c|, |l| and |r| (these column types can't be
+% redefined by |\newcolumtype| of \pkg{array} and that's why we have to do the
+% job ``by hand'' after expansion of the preamble).
+% \begin{macrocode}
+ \tl_replace_all:Nnn \l_tmpa_tl c { > \@@_Cell: c < \@@_end_Cell: }
+ \tl_replace_all:Nnn \l_tmpa_tl l { > \@@_Cell: l < \@@_end_Cell: }
+ \tl_replace_all:Nnn \l_tmpa_tl r { > \@@_Cell: r < \@@_end_Cell: }
+ \tl_replace_all:Nnn \l_tmpa_tl \@@_true_c: c
+% \end{macrocode}
+%
+% \bigskip
+% We complete the preamble with the potential ``exterior columns''.
+% \begin{macrocode}
\int_compare:nNnTF \l_@@_first_col_int = 0
{ \tl_put_left:NV \l_tmpa_tl \c_@@_preamble_first_col_tl }
{
@@ -5949,8 +6757,13 @@ version 2005/12/01 or later.
}
{ \tl_put_right:Nn \l_tmpa_tl { @ { } } }
}
- \tl_put_right:Nn \l_tmpa_tl { > { \@@_error_too_much_cols: } L }
+ \tl_put_right:Nn \l_tmpa_tl { > { \@@_error_too_much_cols: } l }
% \end{macrocode}
+% Now, the preamble is constructed in |\l_tmpa_tl|
+%
+%
+%
+% \bigskip
% Here is the beginning of the box which will contain the array. The
% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the second
% part of the environment (and the closing |\c_math_toggle_token| also).
@@ -6011,7 +6824,7 @@ version 2005/12/01 or later.
% |0.5\arrayrulewidth| in order to reserve space for the width of the vertical
% rules drawn with Tikz after the end of the array. However, the last
% |\arraycolsep| is used once (between columns, |\arraycolsep| is used twice).
-% That's we add a |0.5 \arrayrulewidth| more.
+% That's why we add a |0.5 \arrayrulewidth| more.
% \begin{macrocode}
\bool_if:NT \l_@@_vlines_bool { \skip_horizontal:N 0.5\arrayrulewidth }
\hbox_set_end:
@@ -6036,11 +6849,11 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% Now, the definition of |\c@jCol| and
-% |\g_@@_col_total_int| change: |\c@jCol| will be the number of
-% columns without the ``last column''; |\g_@@_col_total_int| will be the
-% number of columns with this ``last column''.\footnote{We remind that the
-% potential ``first column'' (exterior) has the number~$0$.}
+% Now, the definition of |\c@jCol| and |\g_@@_col_total_int| change: |\c@jCol|
+% will be the number of columns without the ``last column'';
+% |\g_@@_col_total_int| will be the number of columns with this ``last
+% column''.\footnote{We remind that the potential ``first column'' (exterior)
+% has the number~$0$.}
% \begin{macrocode}
\int_gset_eq:NN \c@jCol \g_@@_col_total_int
\bool_if:nT \g_@@_last_col_found_bool { \int_gdecr:N \c@jCol }
@@ -6054,7 +6867,6 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
-%
% \bigskip
% \textbf{Now, we begin the real construction in the output flow of TeX}. First, we take
% into account a potential ``first column'' (we remind that this ``first
@@ -6069,35 +6881,37 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% The construction of the real box is different in |{NiceArray}| and in the
-% other environments because, in |{NiceArray}|, we have to take into account the
-% value of |baseline| and we have no delimiter to put. We begin with |{NiceArray}|.
+% The construction of the real box is different when |\l_@@_NiceArray_bool| is
+% true (|{NiceArray}| or |{NiceTabular}|) and in the other environments because,
+% in |{NiceArray}| or |{NiceTabular}|, we have to take into account the value of
+% |baseline| and we have no delimiter to put. We begin with this case.
% \begin{macrocode}
\bool_if:NTF \l_@@_NiceArray_bool
{
% \end{macrocode}
-% Remember that, when the key |b| is used, the |\array| (of \pkg{array}) is
+% Remember that, when the key |b| is used, the |{array}| (of \pkg{array}) is
% constructed with the option |t| (and not |b|). Now, we do the translation to
% take into account the option |b|.
% \begin{macrocode}
\str_if_eq:VnTF \l_@@_baseline_str { b }
{
- \pgfpicture
- \@@_qpoint:n { row - 1 }
- \dim_gset_eq:NN \g_tmpa_dim \pgf@y
- \@@_qpoint:n { row - \int_use:N \c@iRow - base }
- \dim_gsub:Nn \g_tmpa_dim \pgf@y
- \endpgfpicture
- \int_compare:nNnT \l_@@_first_row_int = 0
- {
- \dim_gadd:Nn \g_tmpa_dim
- { \g_@@_ht_row_zero_dim + \g_@@_dp_row_zero_dim }
- }
- \box_move_up:nn \g_tmpa_dim { \box_use_drop:N \l_@@_the_array_box }
+ \pgfpicture
+ \@@_qpoint:n { row - 1 }
+ \dim_gset_eq:NN \g_tmpa_dim \pgf@y
+ \@@_qpoint:n { row - \int_use:N \c@iRow - base }
+ \dim_gsub:Nn \g_tmpa_dim \pgf@y
+ \endpgfpicture
+ \dim_gadd:Nn \g_tmpa_dim \arrayrulewidth
+ \int_compare:nNnT \l_@@_first_row_int = 0
+ {
+ \dim_gadd:Nn \g_tmpa_dim \g_@@_ht_row_zero_dim
+ \dim_gadd:Nn \g_tmpa_dim \g_@@_dp_row_zero_dim
+ }
+ \box_move_up:nn \g_tmpa_dim { \@@_use_array_box_with_notes: }
}
{
\str_if_eq:VnTF \l_@@_baseline_str { c }
- { \box_use_drop:N \l_@@_the_array_box }
+ { \@@_use_array_box_with_notes: }
{
% \end{macrocode}
% We convert a value of |t| to a value of |1|.
@@ -6109,11 +6923,9 @@ version 2005/12/01 or later.
% integer) to an integer stored in |\l_tmpa_int|.
% \begin{macrocode}
\int_set:Nn \l_tmpa_int \l_@@_baseline_str
- \bool_if:nT
- {
- \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int
- || \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int
- }
+ \bool_lazy_or:nnT
+ { \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int }
+ { \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int }
{
\@@_error:n { bad~value~for~baseline }
\int_set:Nn \l_tmpa_int 1
@@ -6124,13 +6936,13 @@ version 2005/12/01 or later.
\@@_qpoint:n { row - \int_use:N \l_tmpa_int - base }
\dim_gsub:Nn \g_tmpa_dim \pgf@y
\endpgfpicture
+ \dim_gadd:Nn \g_tmpa_dim \arrayrulewidth
\int_compare:nNnT \l_@@_first_row_int = 0
{
- \dim_gadd:Nn \g_tmpa_dim
- { \g_@@_ht_row_zero_dim + \g_@@_dp_row_zero_dim }
+ \dim_gadd:Nn \g_tmpa_dim \g_@@_ht_row_zero_dim
+ \dim_gadd:Nn \g_tmpa_dim \g_@@_dp_row_zero_dim
}
- \box_move_up:nn \g_tmpa_dim
- { \box_use_drop:N \l_@@_the_array_box }
+ \box_move_up:nn \g_tmpa_dim { \@@_use_array_box_with_notes: }
}
}
}
@@ -6176,12 +6988,13 @@ version 2005/12/01 or later.
% height in |\l_tmpa_dim|). The |\hbox:n| (or |\hbox|) is necessary here.
% \begin{macrocode}
\skip_vertical:N -\l_tmpa_dim
+ \skip_vertical:N -\arrayrulewidth
\hbox
{
\bool_if:NTF \l_@@_NiceTabular_bool
{ \skip_horizontal:N -\tabcolsep }
{ \skip_horizontal:N -\arraycolsep }
- \box_use_drop:N \l_@@_the_array_box
+ \@@_use_array_box_with_notes:
\bool_if:NTF \l_@@_NiceTabular_bool
{ \skip_horizontal:N -\tabcolsep }
{ \skip_horizontal:N -\arraycolsep }
@@ -6191,6 +7004,7 @@ version 2005/12/01 or later.
% height in |\l_tmpb_dim|).
% \begin{macrocode}
\skip_vertical:N -\l_tmpb_dim
+ \skip_vertical:N \arrayrulewidth
}
\right #2
\c_math_toggle_token
@@ -6219,10 +7033,13 @@ version 2005/12/01 or later.
}
\@@_after_array:
\egroup
+ \bool_if:NT \c_@@_footnote_bool { \end { savenotes } }
}
% \end{macrocode}
% This is the end of the environment |{NiceArrayWithDelims}|.
%
+%
+%
% \bigskip
% The command |\@@_put_box_in_flow:| puts the box |\l_tmpa_box| (which contains
% the array) in the flow. It is used for the environments with delimiters.
@@ -6289,6 +7106,71 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_use_array_box_with_notes:
+ {
+ \int_compare:nNnTF \c@tabularnote = 0
+ { \box_use_drop:N \l_@@_the_array_box }
+ {
+ \begin { minipage } { \box_wd:N \l_@@_the_array_box }
+ \box_use_drop:N \l_@@_the_array_box
+ \skip_vertical:N 0.65ex
+% \end{macrocode}
+% The TeX group is for potential specifications in the
+% |\l_@@_notes_code_before_tl|.
+% \begin{macrocode}
+ \group_begin:
+ \l_@@_notes_code_before_tl
+% \end{macrocode}
+% We compose the tabular notes with a list of \pkg{enumitem}. The |\strut| and
+% the |\unskip| are designed to give the ability to put a |\bottomrule| at the
+% end of the notes with a good vertical space.
+% \begin{macrocode}
+ \bool_if:NTF \l_@@_notes_para_bool
+ {
+ \begin { tabularnotes* }
+ \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut
+ \end { tabularnotes* }
+% \end{macrocode}
+% The following |\par| is mandatory for the event that the user has put
+% |\footnotesize| (for example) in the |notes/code-before|.
+% \begin{macrocode}
+ \par
+ }
+ {
+ \tabularnotes
+ \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut
+ \endtabularnotes
+ }
+ \unskip
+ \group_end:
+ \bool_if:NT \l_@@_notes_bottomrule_bool
+ {
+ \bool_if:NTF \c_@@_booktabs_loaded_bool
+ {
+% \end{macrocode}
+% The two dimensions |\aboverulesep| et |\heavyrulewidth| are parameters defined
+% by \pkg{booktabs}.
+% \begin{macrocode}
+ \skip_vertical:N \aboverulesep
+% \end{macrocode}
+% |\CT@arc@| is the specification of color defined by \pkg{colortbl} but you use it
+% even if \pkg{colortbl} is not loaded.
+% \begin{macrocode}
+ { \CT@arc@ \hrule height \heavyrulewidth }
+ }
+ { \@@_error:n { bottomule~without~booktabs } }
+ }
+ \l_@@_notes_code_after_tl
+ \end { minipage }
+ \seq_gclear:N \g_@@_tabularnotes_seq
+ \int_gzero:N \c@tabularnote
+ }
+ }
+% \end{macrocode}
+%
+%
+% \bigskip
% The command |\@@_put_box_in_flow_bis:| is used when the option
% |max-delimiter-width| is used because, in this case, we have to adjust the
% widths of the delimiters. The arguments |#1| and |#2| are the delimiters
@@ -6489,7 +7371,6 @@ version 2005/12/01 or later.
\cs_new:Npn \@@_create_col_nodes:
{
\crcr
- \int_compare:nNnT \c@iRow = 0 { \@@_fatal:n { Zero~row } }
\int_compare:nNnT \l_@@_first_col_int = 0
{
\omit
@@ -6559,7 +7440,7 @@ version 2005/12/01 or later.
%
% \smallskip
% We give a default value for |\g_tmpa_skip| (|0 pt plus 1 fill|) but it will
-% just after erased by a fixed value in the concerned cases.
+% just after be erased by a fixed value in the concerned cases.
% \begin{macrocode}
\skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill }
\bool_if:NF \l_@@_auto_columns_width_bool
@@ -6882,7 +7763,7 @@ version 2005/12/01 or later.
\NewDocumentEnvironment { #1 NiceMatrix } { ! O { } }
{
\str_gset:Nn \g_@@_name_env_str { #1 NiceMatrix }
- \tl_set:Nn \l_@@_type_of_col_tl C
+ \tl_set:Nn \l_@@_type_of_col_tl c
\keys_set:nn { NiceMatrix / NiceMatrix } { ##1 }
\exp_args:Nnx \@@_begin_of_NiceMatrix:nn { #1 } \l_@@_type_of_col_tl
}
@@ -7144,7 +8025,7 @@ version 2005/12/01 or later.
% \end{macrocode}
% When |light-syntax| is used, we insert systematically a |\CodeAfter| in the
% flow. Thus, it's possible to have two instructions |\CodeAfter| and the second
-% one is eventually present in |\g_@@_code_after_tl|. That's why we set
+% one may be present in |\g_@@_code_after_tl|. That's why we set
% |\Code-after| to be \textsl{no-op} now.
% \begin{macrocode}
\cs_set_eq:NN \CodeAfter \prg_do_nothing:
@@ -7345,7 +8226,7 @@ version 2005/12/01 or later.
% \end{macrocode}
% If the case is empty, we declare that the cell as non-empty. Indeed, we will
% draw a dotted line and the cell will be on that dotted line. All the cells of
-% a dotted line have to be mark as ``dotted'' because we don't want
+% a dotted line have to be marked as ``dotted'' because we don't want
% intersections between dotted lines. We recall that the research of the
% extremities of the lines are all done in the same TeX group (the group of the
% environnement), even though, when the extremities are found, each line is
@@ -7545,8 +8426,7 @@ version 2005/12/01 or later.
{
\@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
\dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
- \dim_add:Nn \l_@@_x_initial_dim
- { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
+ \dim_add:Nn \l_@@_x_initial_dim \@@_tab_or_array_colsep:
\@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base }
\dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
}
@@ -7555,8 +8435,7 @@ version 2005/12/01 or later.
{
\@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
\dim_set_eq:NN \l_@@_x_final_dim \pgf@x
- \dim_sub:Nn \l_@@_x_final_dim
- { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
+ \dim_sub:Nn \l_@@_x_final_dim \@@_tab_or_array_colsep:
\@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base }
\dim_set_eq:NN \l_@@_y_final_dim \pgf@y
}
@@ -7625,7 +8504,7 @@ version 2005/12/01 or later.
\@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
\dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
\dim_add:Nn \l_@@_x_initial_dim
- { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
+ { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
}
{ \@@_set_initial_coords_from_anchor:n { mid~east } }
\bool_if:NTF \l_@@_final_open_bool
@@ -7633,7 +8512,7 @@ version 2005/12/01 or later.
\@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
\dim_set_eq:NN \l_@@_x_final_dim \pgf@x
\dim_sub:Nn \l_@@_x_final_dim
- { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
+ { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep }
}
{ \@@_set_final_coords_from_anchor:n { mid~west } }
\bool_lazy_and:nnTF
@@ -7701,8 +8580,8 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_actually_draw_Vdots:
{
% \end{macrocode}
-% The boolean |\l_tmpa_bool| indicates whether the column is of type |l| (|L| of
-% |{NiceArray}|) or may be considered as if.
+% The boolean |\l_tmpa_bool| indicates whether the column is of type |l| or may
+% be considered as if.
% \begin{macrocode}
\bool_set_false:N \l_tmpa_bool
\bool_lazy_or:nnF \l_@@_initial_open_bool \l_@@_final_open_bool
@@ -7713,8 +8592,8 @@ version 2005/12/01 or later.
{ \dim_compare_p:nNn \l_@@_x_initial_dim = \l_@@_x_final_dim }
}
% \end{macrocode}
-% Now, we try to determine whether the column is of type |c| (|C| of
-% |{NiceArray}|) or may be considered as if.
+% Now, we try to determine whether the column is of type |c| or may be
+% considered as if.
% \begin{macrocode}
\bool_if:NTF \l_@@_initial_open_bool
{
@@ -8042,7 +8921,7 @@ version 2005/12/01 or later.
\pgftransformshift
{
\pgfpointlineattime { 0.5 }
- { \pgfpoint \l_@@_x_initial_dim \l_@@_y_initial_dim }
+ { \pgfpoint \l_@@_x_initial_dim \l_@@_y_initial_dim }
{ \pgfpoint \l_@@_x_final_dim \l_@@_y_final_dim }
}
\pgftransformrotate
@@ -8051,7 +8930,7 @@ version 2005/12/01 or later.
{
atand
(
- \l_@@_y_final_dim - \l_@@_y_initial_dim ,
+ \l_@@_y_final_dim - \l_@@_y_initial_dim ,
\l_@@_x_final_dim - \l_@@_x_initial_dim
)
}
@@ -8232,7 +9111,7 @@ version 2005/12/01 or later.
% \pkg{nicematrix} rely upon |{NiceArray}|).
%
% The starred versions of these commands are deprecated since version~3.1 but,
-% as for now, they are still available with an error.
+% as of now, they are still available with an error.
%
%
% \medskip
@@ -8378,7 +9257,23 @@ version 2005/12/01 or later.
\cs_set_eq:NN \@@_old_multicolumn \multicolumn
\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
{
- \@@_old_multicolumn { #1 } { #2 } { #3 }
+% \begin{macrocode}
+% We have to act in expandable way since it will begin by a |\multicolumn|.
+% \end{macrocode
+ \exp_args:NNe
+ \@@_old_multicolumn
+ { #1 }
+% \end{macrocode}
+% We will have to replace |\tl_lower_case:n| in some times
+% since |\tl_lower_case:n| seems to be deprecated.
+% \begin{macrocode}
+ {
+ > \@@_Cell:
+ \bool_if:NT \c_@@_define_L_C_R_bool \tl_lower_case:n
+ #2
+ < \@@_end_Cell:
+ }
+ { #3 }
% \end{macrocode}
% The |\peek_remove_spaces:n| is mandatory.
% \begin{macrocode}
@@ -8413,7 +9308,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new:Npn \@@_Hdotsfor:
{
- \multicolumn { 1 } { C } { }
+ \multicolumn { 1 } { c } { }
\@@_Hdotsfor_i
}
% \end{macrocode}
@@ -8445,7 +9340,7 @@ version 2005/12/01 or later.
down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
}
}
- \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
+ \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { c } { } }
}
}
% \end{macrocode}
@@ -9355,17 +10250,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_hline_in_block:nnnn #1 #2 #3 #4
{
- \int_compare:nNnT \l_tmpa_tl > { #1 }
+ \bool_lazy_all:nT
{
- \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
- {
- \int_compare:nNnT \l_tmpb_tl > { #2 - 1 }
- {
- \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
- { \bool_gset_false:N \g_tmpa_bool }
- }
- }
+ { \int_compare_p:nNn \l_tmpa_tl > { #1 } }
+ { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
+ { \int_compare_p:nNn \l_tmpb_tl > { #2 - 1 } }
+ { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
}
+ { \bool_gset_false:N \g_tmpa_bool }
}
% \end{macrocode}
%
@@ -9373,17 +10265,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_vline_in_block:nnnn #1 #2 #3 #4
{
- \int_compare:nNnT \l_tmpa_tl > { #1 - 1 }
+ \bool_lazy_all:nT
{
- \int_compare:nNnT \l_tmpa_tl < { #3 + 1 }
- {
- \int_compare:nNnT \l_tmpb_tl > { #2 }
- {
- \int_compare:nNnT \l_tmpb_tl < { #4 + 1 }
- { \bool_gset_false:N \g_tmpa_bool }
- }
- }
+ { \int_compare_p:nNn \l_tmpa_tl > { #1 - 1 } }
+ { \int_compare_p:nNn \l_tmpa_tl < { #3 + 1 } }
+ { \int_compare_p:nNn \l_tmpb_tl > { #2 } }
+ { \int_compare_p:nNn \l_tmpb_tl < { #4 + 1 } }
}
+ { \bool_gset_false:N \g_tmpa_bool }
}
% \end{macrocode}
%
@@ -9440,7 +10329,7 @@ version 2005/12/01 or later.
\int_zero_new:N \l_@@_last_empty_row_int
\int_step_inline:nnnn { #1 } { #3 } { #5 }
{
- \@@_test_if_cell_in_a_block:nx { ##1 } { \int_eval:n { #2 } }
+ \@@_test_if_cell_in_a_block:nn { ##1 } { \int_eval:n { #2 } }
\bool_if:nTF
{
\cs_if_exist_p:c
@@ -9461,7 +10350,7 @@ version 2005/12/01 or later.
\int_zero_new:N \l_@@_last_empty_column_int
\int_step_inline:nnnn { #2 } { #4 } { #6 }
{
- \@@_test_if_cell_in_a_block:xn { \int_eval:n { #1 } } { ##1 }
+ \@@_test_if_cell_in_a_block:nn { \int_eval:n { #1 } } { ##1 }
\bool_if:nTF
{
\cs_if_exist_p:c
@@ -9507,33 +10396,33 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \bigskip
-% The following macro tests whether if a cell is in (at least) one of the blocks
-% of the array.
+% \bigskip
+% The following macro tests whether a cell is in (at least) one of
+% the blocks of the array (or in a cell with a |\diagbox|).
%
-% The flag |\l_tmpb_bool| will be raised if the cell |#1|-|#2| is in a block.
+% The flag |\l_tmpb_bool| will be raised if the cell |#1|-|#2| is in a block (or
+% in a cell with a |\diagbox|).
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_cell_in_a_block:nn #1 #2
{
+ \int_set:Nn \l_tmpa_int { #1 }
+ \int_set:Nn \l_tmpb_int { #2 }
\bool_set_false:N \l_tmpb_bool
\seq_map_inline:Nn \g_@@_pos_of_blocks_seq
- { \@@_test_if_cell_in_block:nnnnnnn { #1 } { #2 } ##1 }
+ { \@@_test_if_cell_in_block:nnnnnnn { \l_tmpa_int } { \l_tmpb_int } ##1 }
}
% \end{macrocode}
%
-% \begin{macrocode}
-\cs_generate_variant:Nn \@@_test_if_cell_in_a_block:nn { nx , xn }
-% \end{macrocode}
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_cell_in_block:nnnnnnn #1 #2 #3 #4 #5 #6
{
- \bool_if:nT
+ \bool_lazy_all:nT
{
- \int_compare_p:n { #3 <= #1 }
- && \int_compare_p:n { #1 <= #5 }
- && \int_compare_p:n { #4 <= #2 }
- && \int_compare_p:n { #2 <= #6 }
+ { \int_compare_p:n { #3 <= #1 } }
+ { \int_compare_p:n { #1 <= #5 } }
+ { \int_compare_p:n { #4 <= #2 } }
+ { \int_compare_p:n { #2 <= #6 } }
}
{ \bool_set_true:N \l_tmpb_bool }
}
@@ -9565,7 +10454,7 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_hdottedline_i:
{
% \end{macrocode}
-% We write in the code-after the instruction that will eventually draw the
+% We write in the code-after the instruction that will potentially draw the
% dotted line. It's not possible to draw this dotted line now because we don't
% know the length of the line (we don't even know the number of columns).
% \begin{macrocode}
@@ -9693,7 +10582,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% As for now, we have no option to control the style of the lines drawn by
+% As of now, we have no option to control the style of the lines drawn by
% |\hdottedline| and the specifier ``|:|'' in the preamble. That's why we impose
% the style |standard|.
% \begin{macrocode}
@@ -9761,7 +10650,7 @@ version 2005/12/01 or later.
\@@_qpoint:n { row - \@@_succ:n \c@iRow }
\dim_set:Nn \l_@@_y_final_dim { \pgf@y + 0.5 \l_@@_inter_dots_dim }
% \end{macrocode}
-% As for now, we have no option to control the style of the lines drawn by
+% As of now, we have no option to control the style of the lines drawn by
% |\hdottedline| and the specifier ``|:|'' in the preamble. That's why we impose
% the style |standard|.
% \begin{macrocode}
@@ -9770,7 +10659,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+%
%
% \bigskip
% \subsection*{The environment \{NiceMatrixBlock\}}
@@ -9829,7 +10718,7 @@ version 2005/12/01 or later.
\cs_gset:cpn
{ @@ _ max _ cell _ width _ \int_use:N \g_@@_NiceMatrixBlock_int }
% \end{macrocode}
-% For technical reasons, we have to include the width of an eventual rule on the
+% For technical reasons, we have to include the width of a potential rule on the
% right side of the cells.
% \begin{macrocode}
{ \dim_eval:n { \g_@@_max_cell_width_dim + \arrayrulewidth } }
@@ -10205,6 +11094,8 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_Block_ii:nnnnn #1 #2 #3 #4 #5
{
+ \bool_if:NT \l_@@_NiceTabular_bool
+ { \tl_if_empty:nF { #4 } { \@@_error:n { angle~option~in~NiceTabular } } }
% \end{macrocode}
%
% \medskip
@@ -10217,8 +11108,8 @@ version 2005/12/01 or later.
{ \int_eval:n { \c@jCol + #2 - 1 } }
}
% \end{macrocode}
-% Now, |\l_tmpa_tl| constains a ``object'' corresponding to the position of the
-% block whith four components surrounded by brackets:
+% Now, |\l_tmpa_tl| contains an ``object'' corresponding to the position of the
+% block whith four components surrounded by curly brackets:
%
% |{|\textsl{imin}|}{|\textsl{jmin}|}{|\textsl{imax}|}{|\textsl{jmax}|}|.
%
@@ -10229,7 +11120,7 @@ version 2005/12/01 or later.
% We also store a complete description of the block in the sequence
% |\g_@@_blocks_seq|. Of course, the sequences |\g_@@_pos_of_blocks_seq| and
% |\g_@@_blocks_seq| are redundant, but it's for efficiency. In
-% |\g_@@_blocks_seq|, each block is represented by an ``objet'' with six
+% |\g_@@_blocks_seq|, each block is represented by an ``object'' with six
% components:
%
% |{|\textsl{imin}|}{|\textsl{jmin}|}{|\textsl{imax}|}{|\textsl{jmax}|}{|\textsl{options}|}{|\textsl{contents}|}|.
@@ -10247,7 +11138,7 @@ version 2005/12/01 or later.
% \bigskip
% The key |tikz| is for Tikz options used when the \textsc{pgf} node of the
% block is created (the ``normal'' block node and not the ``short'' one nor the
-% ``medium'' one). \textbf{In fact, as for now, it is \emph{not} documented}. Is
+% ``medium'' one). \textbf{In fact, as of now, it is \emph{not} documented}. Is
% it really a good idea to provide such a key?
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Block }
@@ -10269,13 +11160,26 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6
{
% \end{macrocode}
-% The group is for the keys (even if, as for now, there is only one key, called
+% The group is for the keys (even if, as of now, there is only one key, called
% |tikz| and not documented).
% \begin{macrocode}
\group_begin:
\keys_set:nn { NiceMatrix / Block } { #5 }
% \end{macrocode}
%
+% \medskip
+% \begin{macrocode}
+ \cs_set_protected:Npn \diagbox ##1 ##2
+ {
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ {
+ \@@_actually_diagbox:nnnnnn
+ { #1 } { #2 } { #3 } { #4 } { ##1 } { ##2 }
+ }
+ }
+% \end{macrocode}
+%
+% \medskip
% \begin{macrocode}
\bool_lazy_or:nnTF
{ \int_compare_p:nNn { #3 } > \g_@@_row_total_int }
@@ -10298,7 +11202,7 @@ version 2005/12/01 or later.
% will be used by \pkg{nicematrix} to put the label of the node. The first one
% won't be used explicitely.
% \begin{Verbatim}
-% \begin{NiceTabular}{CC!{\hspace{1cm}}C}
+% \begin{NiceTabular}{cc!{\hspace{1cm}}c}
% \Block{2-2}{our block} & & one \\
% & & two \\
% three & four & five \\
@@ -10316,7 +11220,7 @@ version 2005/12/01 or later.
% \begin{tabular}{c!{\hspace{1cm}}c}
% We highlight the node |1-1-block|
% & We highlight the node |1-1-block-short| \\[2mm]
-% \begin{NiceTabular}{CC!{\hspace{1cm}}C}
+% \begin{NiceTabular}{cc!{\hspace{1cm}}c}
% \Block{2-2}{our block} & & one \\
% & & two \\
% three & four & five \\
@@ -10325,7 +11229,7 @@ version 2005/12/01 or later.
% \tikz \node [highlight = (1-1-block)] { } ;
% \end{NiceTabular}
% &
-% \begin{NiceTabular}{CC!{\hspace{1cm}}C}
+% \begin{NiceTabular}{cc!{\hspace{1cm}}c}
% \Block{2-2}{our block} & & one \\
% & & two \\
% three & four & five \\
@@ -10365,8 +11269,6 @@ version 2005/12/01 or later.
\end { pgfscope }
% \end{macrocode}
%
-%
-%
% \medskip
% We construct the |short| node.
% \begin{macrocode}
@@ -10522,7 +11424,7 @@ version 2005/12/01 or later.
\int_zero_new:N \l_@@_nb_cols_int
\@@_set_size:n #4 \q_stop
\begin { NiceArrayWithDelims } { #1 } { #2 }
- { * { \l_@@_nb_cols_int } { C } } [ #3 , #5 , #7 ]
+ { * { \l_@@_nb_cols_int } { c } } [ #3 , #5 , #7 ]
\int_compare:nNnT \l_@@_first_row_int = 0
{
\int_compare:nNnT \l_@@_first_col_int = 0 { & }
@@ -10533,7 +11435,7 @@ version 2005/12/01 or later.
{
\int_compare:nNnT \l_@@_first_col_int = 0 { & }
% \end{macrocode}
-% You put |{ }| before |#6| to avoid a hasty expansion of an eventual
+% You put |{ }| before |#6| to avoid a hasty expansion of a potential
% |\arabic{iRow}| at the beginning of the row which would result in an incorrect
% value of that |iRow| (since |iRow| is incremented in the first cell of the row
% of the |\halign|).
@@ -10613,24 +11515,47 @@ version 2005/12/01 or later.
% \bigskip
% \subsection*{The command \textbackslash diagbox}
%
+% The command |\diagbox| will be linked to |\diagbox:nn| in the environments of
+% \pkg{nicematrix}.
%
% \begin{macrocode}
\cs_new_protected:Npn \@@_diagbox:nn #1 #2
{
\tl_gput_right:Nx \g_@@_internal_code_after_tl
{
- \@@_actually_diagbox:nnnn
- { \int_use:N \c@iRow } { \int_use:N \c@jCol } { #1 } { #2 }
+ \@@_actually_diagbox:nnnnnn
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
+ { #1 }
+ { #2 }
+ }
+% \end{macrocode}
+% We put the cell with |\diagbox| in the sequence |\g_@@_pos_of_blocks_seq|
+% because a cell with |\diagbox| must be considered as non empty by the key
+% |hvlines-except-corners|.
+% \begin{macrocode}
+ \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
+ {
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
+ { \int_use:N \c@iRow }
+ { \int_use:N \c@jCol }
}
}
% \end{macrocode}
+%
+% \medskip
+% The command |\diagbox| is also redefined locally when we draw a block.
%
% \medskip
-% The two arguments of |\@@_actually_diagbox:nn| are the number of row and the
-% number of column of the cell to slash. The two other are the elements to draw
-% below and above the diagonal line.
+% The first four arguments of |\@@_actually_diagbox:nnnnnn| correspond to the
+% rectangle (=block) to slash (we recall that it's possible to use |\diagbox| in
+% a |\Block|). The two other are the elements to draw below and above the
+% diagonal line.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_actually_diagbox:nnnn #1 #2 #3 #4
+\cs_new_protected:Npn \@@_actually_diagbox:nnnnnn #1 #2 #3 #4 #5 #6
{
\pgfpicture
\pgf@relevantforpicturesizefalse
@@ -10640,9 +11565,9 @@ version 2005/12/01 or later.
\@@_qpoint:n { col - #2 }
\dim_set_eq:NN \l_tmpb_dim \pgf@x
\pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
- \@@_qpoint:n { row - \@@_succ:n { #1 } }
+ \@@_qpoint:n { row - \@@_succ:n { #3 } }
\dim_set_eq:NN \l_tmpc_dim \pgf@y
- \@@_qpoint:n { col - \@@_succ:n { #2 } }
+ \@@_qpoint:n { col - \@@_succ:n { #4 } }
\dim_set_eq:NN \l_tmpd_dim \pgf@x
\pgfpathlineto { \pgfpoint \l_tmpd_dim \l_tmpc_dim }
{
@@ -10659,14 +11584,17 @@ version 2005/12/01 or later.
\pgfscope
\pgftransformshift { \pgfpoint \l_tmpb_dim \l_tmpc_dim }
\pgfnode { rectangle } { south~west }
- { \@@_math_toggle_token: #3 \@@_math_toggle_token: } { } { }
+ { \@@_math_toggle_token: #5 \@@_math_toggle_token: } { } { }
\endpgfscope
\pgftransformshift { \pgfpoint \l_tmpd_dim \l_tmpa_dim }
\pgfnode { rectangle } { north~east }
- { \@@_math_toggle_token: #4 \@@_math_toggle_token: } { } { }
+ { \@@_math_toggle_token: #6 \@@_math_toggle_token: } { } { }
\endpgfpicture
}
% \end{macrocode}
+%
+%
+%
%
% \bigskip
% \subsection*{The keyword \textbackslash CodeAfter}
@@ -10710,7 +11638,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+%
%
% \bigskip
% \subsection*{We process the options at package loading}
@@ -10725,42 +11653,129 @@ version 2005/12/01 or later.
%
% Of course, the command |\NiceMatrix| must be defined before such an
% instruction is executed.
+%
+% \medskip
+%% \medskip
+% The boolean |\g_@@_footnotehyper_bool| will indicate if the option
+% |footnotehyper| is used.
+% \begin{macrocode}
+\bool_new:N \c_@@_footnotehyper_bool
+% \end{macrocode}
+%
+% \medskip
+% The boolean |\c_@@_footnote_bool| will indicate if the option |footnote| is
+% used, but quicky, it will also be set to |true| if the option |footnotehyper|
+% is used.
+% \begin{macrocode}
+\bool_new:N \c_@@_footnote_bool
+% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nnn { Unknown~option~for~package }
+ {
+ The~option~'\l_keys_key_tl'~is~unknown. \\
+ If~you~go~on,~it~will~be~ignored. \\
+ For~a~list~of~the~available~options,~type~H~<return>.
+ }
+ {
+ The~available~options~are~(in~alphabetic~order):~
+ define-L-C-R,~
+ footnote,~
+ footnotehyper,~
+ renew-dots,~
+ renew-matrix~and~
+ transparent.
+ }
+% \end{macrocode}
+%
+%
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Package }
{
+ define-L-C-R .bool_set:N = \c_@@_define_L_C_R_bool ,
+ define-L-C-R .default:n = true ,
renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
renew-dots .value_forbidden:n = true ,
renew-matrix .code:n = \@@_renew_matrix: ,
renew-matrix .value_forbidden:n = true ,
transparent .meta:n = { renew-dots , renew-matrix } ,
transparent .value_forbidden:n = true,
+ footnote .bool_set:N = \c_@@_footnote_bool ,
+ footnotehyper .bool_set:N = \c_@@_footnotehyper_bool ,
+ unknown .code:n = \@@_error:n { Unknown~option~for~package }
}
\ProcessKeysOptions { NiceMatrix / Package }
% \end{macrocode}
%
% \bigskip
-% \subsection*{Error messages of the package}
+% \begin{macrocode}
+\@@_msg_new:nn { footnote~with~footnotehyper~package }
+ {
+ You~can't~use~the~option~'footnote'~because~the~package~
+ footnotehyper~has~already~been~loaded.~
+ If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~
+ within~the~environments~of~nicematrix~will~be~extracted~with~the~tools~
+ of~the~package~footnotehyper.\\
+ If~you~go~on,~the~package~footnote~won't~be~loaded.
+ }
+% \end{macrocode}
%
-% The following command converts all the elements of a sequence (which are token
-% lists) into strings.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_convert_to_str_seq:N #1
- {
- \seq_clear:N \l_tmpa_seq
- \seq_map_inline:Nn #1
- {
- \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } }
+\@@_msg_new:nn { footnotehyper~with~footnote~package }
+ {
+ You~can't~use~the~option~'footnotehyper'~because~the~package~
+ footnote~has~already~been~loaded.~
+ If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~
+ within~the~environments~of~nicematrix~will~be~extracted~with~the~tools~
+ of~the~package~footnote.\\
+ If~you~go~on,~the~package~footnotehyper~won't~be~loaded.
+ }
+% \end{macrocode}
+%
+% \medskip
+% \begin{macrocode}
+\bool_if:NT \c_@@_footnote_bool
+ {
+ \@ifclassloaded { beamer }
+ { \msg_info:nn { nicematrix } { Option~incompatible~with~Beamer } }
+ {
+ \@ifpackageloaded { footnotehyper }
+ { \@@_error:n { footnote~with~footnotehyper~package } }
+ { \usepackage { footnote } }
}
- \seq_set_eq:NN #1 \l_tmpa_seq
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\bool_if:NT \c_@@_footnotehyper_bool
+ {
+ \@ifclassloaded { beamer }
+ { \@@_info:n { Option~incompatible~with~Beamer } }
+ {
+ \@ifpackageloaded { footnote }
+ { \@@_error:n { footnotehyper~with~footnote~package } }
+ { \usepackage { footnotehyper } }
+ }
+ \bool_set_true:N \c_@@_footnote_bool
+ }
+% \end{macrocode}
+% The flag |\c_@@_footnote_bool| is raised and so, we will only have to test
+% |\c_@@_footnote_bool| in order to know if we have to insert an environment
+% |{savenotes}|.
+%
+%
+% \bigskip
+% \subsection*{Error messages of the package}
+%
%
-% The following command creates a sequence of strings (|str|) from a |clist|.
+% The following command creates a sequence of strings (|str|) from a |clist|. Be
+% careful: we use |\seq_set_map:NNn| and the name of that function will maybe
+% change to |\eq_set_map_x:NNn|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_seq_of_str_from_clist:Nn #1 #2
{
\seq_set_from_clist:Nn #1 { #2 }
- \@@_convert_to_str_seq:N #1
+ \seq_set_map:NNn #1 #1 { \tl_to_str:n { ##1 } }
}
% \end{macrocode}
%
@@ -10899,6 +11914,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
% \begin{macrocode}
\@@_msg_new:nn { ampersand~in~light-syntax }
{
@@ -10978,12 +11994,46 @@ version 2005/12/01 or later.
{
You~try~to~draw~a~block~in~the~cell~#1-#2~of~your~matrix~but~the~matrix~is~
too~small~for~that~block. \\
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { angle~option~in~NiceTabular }
+ {
+ You~should~not~the~option~between~angle~brackets~(<~and~>)~for~a~command~
+ \token_to_str:N \Block\ in~\{NiceTabular\}.~However,~you~can~go~on.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { tabularnote~forbidden }
+ {
+ You~can't~use~the~command~\token_to_str:N\tabularnote\
+ ~in~a~\@@_full_name_env:.~This~command~is~available~only~in~
+ \{NiceTabular\},~\{NiceArray\}~and~\{NiceMatrix\}. \\
If~you~go~on,~this~command~will~be~ignored.
}
% \end{macrocode}
%
+% \begin{macrocode}
+\@@_msg_new:nn { bottomule~without~booktabs }
+ {
+ You~can't~use~the~option~'tabular/bottomrule'~because~you~haven't~
+ loaded~'booktabs'.\\
+ If~you~go~on,~this~option~will~be~ignored.
+ }
+% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { enumitem~not~loaded }
+ {
+ You~can't~use~the~command~\token_to_str:N\tabularnote\
+ ~because~you~haven't~loaded~'enumitem'.\\
+ If~you~go~on,~this~command~will~be~ignored.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nn { Wrong~last~row }
{
You~have~used~'last-row=\int_use:N \l_@@_last_row_int'~but~your~
@@ -10997,10 +12047,7 @@ version 2005/12/01 or later.
%
% \begin{macrocode}
\@@_msg_new:nn { Yet~in~env }
- {
- Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~nested.\\
- This~error~is~fatal.
- }
+ { Environments~of~nicematrix~can't~be~nested.\\ This~error~is~fatal. }
% \end{macrocode}
%
% \begin{macrocode}
@@ -11015,16 +12062,37 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_msg_new:nn { Bad~value~for~letter~for~dotted~lines }
{
- The~value~of~key~'\tl_use:N\l_keys_key_tl'~must~be~of~length~1.\\
+ The~value~of~key~'\l_keys_key_tl'~must~be~of~length~1.\\
If~you~go~on,~it~will~be~ignored.
}
% \end{macrocode}
%
%
% \begin{macrocode}
+\@@_msg_new:nnn { Unknown~key~for~notes }
+ {
+ The~key~'\l_keys_key_tl'~is~unknown.\\
+ If~you~go~on,~it~will~be~ignored. \\
+ For~a~list~of~the~available~keys~about~notes,~type~H~<return>.
+ }
+ {
+ The~available~options~are~(in~alphabetic~order):~
+ bottomrule,~
+ code-after,~
+ code-before,~
+ enumitem-keys,~
+ enumitem-keys-para,~
+ para,~
+ label-in-list,~
+ label-in-tabular~and~
+ style.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~NiceMatrixOptions }
{
- The~key~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~command~
+ The~key~'\l_keys_key_tl'~is~unknown~for~the~command~
\token_to_str:N \NiceMatrixOptions. \\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~*principal*~available~keys,~type~H~<return>.
@@ -11052,6 +12120,7 @@ version 2005/12/01 or later.
left-margin,~
letter-for-dotted-lines,~
light-syntax,~
+ notes~(several subkeys),~
nullify-dots,~
renew-dots,~
renew-matrix,~
@@ -11068,7 +12137,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceArray }
{
- The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
+ The~option~'\l_keys_key_tl'~is~unknown~for~the~environment~
\{NiceArray\}. \\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~*principal*~available~options,~type~H~<return>.
@@ -11100,6 +12169,8 @@ version 2005/12/01 or later.
left-margin,~
light-syntax,~
name,~
+ notes/bottomrule,~
+ notes/para,~
nullify-dots,~
renew-dots,~
right-margin,~
@@ -11121,7 +12192,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
{
- The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~
+ The~option~'\l_keys_key_tl'~is~unknown~for~the~
\@@_full_name_env:. \\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~*principal*~available~options,~type~H~<return>.
@@ -11173,7 +12244,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceTabular }
{
- The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
+ The~option~'\l_keys_key_tl'~is~unknown~for~the~environment~
\{NiceTabular\}. \\
If~you~go~on,~it~will~be~ignored. \\
For~a~list~of~the~*principal*~available~options,~type~H~<return>.
@@ -11205,6 +12276,8 @@ version 2005/12/01 or later.
left-margin,~
light-syntax,~
name,~
+ notes/bottomrule,~
+ notes/para,~
nullify-dots,~
renew-dots,~
right-margin,~
@@ -11243,15 +12316,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \begin{macrocode}
-\@@_msg_new:nn { Zero~row }
- {
- There~is~a~problem.~Maybe~you~have~used~l,~c~and~r~instead~of~L,~C~
- and~R~in~the~preamble~of~your~environment. \\
- This~error~is~fatal.
- }
-% \end{macrocode}
-%
%
% \vspace{1cm}
% \section{History}
@@ -11326,7 +12390,7 @@ version 2005/12/01 or later.
% the ``main matrix'' (not in the exterior column), the cells in the exterior
% column are considered as outside the matrix. That means that it's possible to
% do the following matrix with only a |\Cdots| command (and a single |\Vdots|).
-% \[\begin{pNiceArray}{Wc{5mm}CWc{5mm}}[first-row,last-col]
+% \[\begin{pNiceArray}{Wc{5mm}cWc{5mm}}[first-row,last-col]
% & C_j & \\
% \mbox{\Large $0$} & \Vdots & \mbox{\Large $0$} \\
% \strut & a & \Cdots & L_i \\
@@ -11541,7 +12605,7 @@ version 2005/12/01 or later.
% The option |baseline| is now available in all the environments of
% \pkg{nicematrix}. Before, it was available only in |{NiceArray}|.
%
-% New command |\CodeAfter| (in the environments of \pkg{nicematrix}).
+% New keyword |\CodeAfter| (in the environments of \pkg{nicematrix}).
%
%
% \subsection*{Changes between versions 3.15 and 4.0}
@@ -11574,7 +12638,14 @@ version 2005/12/01 or later.
% \subsection*{Changes between versions 4.3 and 4.4}
%
% New key |hvlines-except-corners|.
+%
+% \subsection*{Changes between versions 4.4 and 5.0}
+%
+% Use of the standard column types |l|, |c| and |r| instead of |L|, |C| and |R|.
%
+% It's now possible to use the command |\diagbox| in a |\Block|.
+%
+% Command |\tabularnote|
%
% \PrintIndex
%