From fe29944c3d5256062708e9b1ae62dc378f9d9993 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 9 May 2022 03:01:47 +0000 Subject: CTAN sync 202205090301 --- macros/latex/contrib/nicematrix/nicematrix.dtx | 253 +++++++++++++------------ 1 file changed, 134 insertions(+), 119 deletions(-) (limited to 'macros/latex/contrib/nicematrix/nicematrix.dtx') diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 74e7b7c98f..c95554cfac 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{6.8} -\def\myfiledate{2022/03/11} +\def\myfileversion{6.8a} +\def\myfiledate{2022/05/08} % % %<*batchfile> @@ -101,6 +101,8 @@ version 2005/12/01 or later. \makeatother + + \begin{document} \DocInput{nicematrix.dtx} \end{document} @@ -1181,59 +1183,7 @@ version 2005/12/01 or later. % It's possible to use the command |\diagbox| in a |\Block|. % % -% \subsection{Dotted rules} -% -% \label{dotted} -% -% In the environments of the package \pkg{nicematrix}, it's possible to use -% the command |\hdottedline| (provided by \pkg{nicematrix}) which is a -% counterpart of the classical command |\hline|. -% -% \medskip -% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -% \begin{pNiceMatrix} -% 1 & 2 & 3 & 4 & 5 \\ -% ~emphase#\hdottedline@ -% 6 & 7 & 8 & 9 & 10 \\ -% 11 & 12 & 13 & 14 & 15 -% \end{pNiceMatrix} -% \end{BVerbatim} -% $\begin{pNiceMatrix} -% 1 & 2 & 3 & 4 & 5 \\ -% \hdottedline -% 6 & 7 & 8 & 9 & 10 \\ -% 11 & 12 & 13 & 14 & 15 -% \end{pNiceMatrix}$ -% -% -% \bigskip -% In the environments with an explicit preamble (like |{NiceTabular}|, -% |{NiceArray}|, etc.), it's possible to draw a vertical dotted line with the -% specifier ``|:|''. -% -% \medskip -% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -% \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} -% 1 & 2 & 3 & 4 & 5 \\ -% 6 & 7 & 8 & 9 & 10 \\ -% 11 & 12 & 13 & 14 & 15 -% \end{NiceArray}\right)$ -% % -% \bigskip -% \emph{Remark}: In the package \pkg{array} (on which the package -% \pkg{nicematrix} relies), horizontal and vertical rules make the array larger -% or wider by a quantity equal to the width of the rule\footnote{In fact, with -% \pkg{array}, this is true only for |\hline| and ``"|"'' but not for |\cline|: -% cf p.~\pageref{remark-cline}}. In \pkg{nicematrix}, the dotted lines drawn by -% |\hdottedline| and ``|:|'' do likewise. -% % % \subsection{Commands for customized rules} % \label{custom-line} @@ -1274,36 +1224,12 @@ version 2005/12/01 or later. % \item the key |sep-color| sets the color between two successive rules (should be % used only in conjonction with |multiplicity|). % \end{itemize} -% -% \bigskip -% \item \emph{Second possibility}\par\nobreak -% -% The key |dotted| forces a style with dotted rules such as those created by -% |\hdottedline| or the letter ``|:|'' in the preamble (cf. -% p.~\pageref{dotted}). The key |color| may be used also in that case. % -% \bigskip -% \item \colorbox{yellow!50}{\textbf{New 6.6}}\enskip \emph{Third -% possibility}\par\nobreak -% -% It's possible to use the key |tikz| (if Tikz is loaded). In that case, the -% rule is drawn directly with Tikz by using as parameters the value of the key -% |tikz| which must be a list of \textsl{key=value} pairs which may be applied -% to a Tikz path. -% -% By default, no space is reserved for the rule that will be drawn with Tikz. It -% possible to specify a reservation (horizontal for a vertical rule and vertical -% for an horizontal one) with the key |width|. That value of that key, is, in -% some ways, the width of the rule that will be drawn (\pkg{nicematrix} does not -% compute that width from the characteristics of the rule specified in |tikz|). -% \end{itemize} -% -% \bigskip +% \medskip % That system may be used, in particular, for the definition of commands and % letters to draw rules with a specific color (and those rules will respect the -% blocks as do all rules of \pkg{nicematrix}). -% -% +% blocks and corners as do all the rules of \pkg{nicematrix}). +% % \medskip % \begin{Verbatim} % \begin{NiceTabular}{lcIcIc}~emphase#[custom-line = {letter=I, color=blue}]@ @@ -1318,6 +1244,23 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{Verbatim} % +% +% \bigskip +% \item \colorbox{yellow!50}{\textbf{New 6.6}}\enskip \emph{Second +% possibility}\par\nobreak +% +% It's possible to use the key |tikz| (if Tikz is loaded). In that case, the +% rule is drawn directly with Tikz by using as parameters the value of the key +% |tikz| which must be a list of \textsl{key=value} pairs which may be applied +% to a Tikz path. +% +% By default, no space is reserved for the rule that will be drawn with Tikz. It +% is possible to specify a reservation (horizontal for a vertical rule and +% vertical for an horizontal one) with the key |width|. That value of that key, +% is, in some ways, the width of the rule that will be drawn (\pkg{nicematrix} +% does not compute that width from the characteristics of the rule specified in +% |tikz|). +% % % \begin{center} % \begin{NiceTabular}{lcIcIc}[custom-line = {letter=I, color=blue}] @@ -1333,40 +1276,33 @@ version 2005/12/01 or later. % \end{center} % % \bigskip -% Here is an example of the key |tikz|. -% -% \begin{Verbatim} -% \documentclass{article} -% \usepackage{nicematrix,tikz} -% \usetikzlibrary{decorations.pathmorphing} +% Here is an example with the key |dotted| of Tikz. % +% \begin{BVerbatim}[boxwidth=9cm,baseline=c] % \NiceMatrixOptions % { % custom-line = % { % letter = I , -% ~emphase#tikz = { decorate, decoration = { coil, aspect = 0 } }}@ , -% ~emphase#width = 2 mm@ +% ~emphase#tikz = dotted@ , +% ~emphase#width = \pgflinewidth@ % } % } % -% \begin{document} % \begin{NiceTabular}{cIcIc} % one & two & three \\ % four & five & six \\ % seven & eight & nine % \end{NiceTabular} -% \end{document} -% \end{Verbatim} -% -% \begin{center} +% \end{BVerbatim} +% \begin{scope} % \NiceMatrixOptions % { % custom-line = % { % letter = I , -% tikz = { decorate, decoration = { coil, aspect = 0 } } , -% width = 2 mm +% tikz = dotted , +% width = \pgflinewidth % } % } % \begin{NiceTabular}{cIcIc} @@ -1374,9 +1310,81 @@ version 2005/12/01 or later. % four & five & six \\ % seven & eight & nine % \end{NiceTabular} -% \end{center} +% \end{scope} +% +% \bigskip +% \item \emph{Third possibility} : the key |dotted| +% \label{dotted} +% +% As one can see, the dots of a dotted line of Tikz have the shape of a square, +% and not a circle. That's why the extension \pkg{nicematrix} provides in the +% key |custom-line| a key |dotted| which will draw rounded dots. The value of +% the key |width| is, in this case, preset to the diameter of the dots. Those +% dotted rules are also used by \pkg{nicematrix} to draw continuous dotted rules +% between cells of the matrix with |\Cdots|, |\Vdots|, etc. (cf. p.~\pageref{Cdots}). +% +% In fact, \pkg{nicematrix} defines by default the command |\hdottedline| and the +% letter ``|:|'' for those dotted rules.\footnote{However, it's possible to +% overwrite those definitions with a |custom-line| (in order, for example, to +% switch to dashed lines).} +% +%\smallskip +%\begin{BVerbatim} +% +% \NiceMatrixOptions % ~textsl#présent dans nicematrix.sty@ +% { +% custom-line = +% { +% letter = : , +% command = hdottedline , +% ~emphase#dotted@ +% } +% } +% \end{BVerbatim} +% +% Thus, it's possible to use the command |\hdottedline| to draw a horizontal +% dotted rule. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] +% \begin{pNiceMatrix} +% 1 & 2 & 3 & 4 & 5 \\ +% ~emphase#\hdottedline@ +% 6 & 7 & 8 & 9 & 10 \\ +% 11 & 12 & 13 & 14 & 15 +% \end{pNiceMatrix} +% \end{BVerbatim} +% $\begin{pNiceMatrix} +% 1 & 2 & 3 & 4 & 5 \\ +% \hdottedline +% 6 & 7 & 8 & 9 & 10 \\ +% 11 & 12 & 13 & 14 & 15 +% \end{pNiceMatrix}$ % % +% \bigskip +% In the environments with an explicit preamble (like |{NiceTabular}|, +% |{NiceArray}|, etc.), it's possible to draw a vertical dotted line with the +% specifier ``|:|''. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm] +% \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} +% 1 & 2 & 3 & 4 & 5 \\ +% 6 & 7 & 8 & 9 & 10 \\ +% 11 & 12 & 13 & 14 & 15 +% \end{NiceArray}\right)$ +% +% \end{itemize} +% +% +% %\section{The color of the rows and columns} % % \subsection{Use of colortbl} @@ -2092,9 +2100,6 @@ version 2005/12/01 or later. % % \label{varwidth} % -% \colorbox{yellow!50}{\textbf{New 6.3}} -% -% \smallskip % Let's recall first the behaviour of the environment |{varwidth}| of the % eponymous package \pkg{varwidth}. That environment is similar to the classical % environment |{minipage}| but the width provided in the argument is only the @@ -3168,8 +3173,6 @@ version 2005/12/01 or later. % \subsection{The commands \textbackslash OverBrace and \textbackslash % UnderBrace in the \textbackslash CodeAfter} % -% \colorbox{yellow!50}{\textbf{New 6.4}} -% % The commands |\OverBrace| and |\UnderBrace| provide a way to put % horizontal braces on a part of the array. These commands take in three % arguments: @@ -3347,6 +3350,12 @@ version 2005/12/01 or later. % the environment of \pkg{nicematrix}. Thus, it's possible to use it on the % title inserted by |\caption| in an environment |{table}| of LaTeX. % +% \colorbox{yellow!50}{\textbf{New 6.8}}\enskip If several commands +% |\tabularnote| are used in a tabular with the same argument, only one note is +% inserted at the end of the tabular (but all the labels are composed, of +% course). It's possible to control that feature with the key +% |notes/detect-duplicates|. +% % \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} @@ -3370,11 +3379,11 @@ version 2005/12/01 or later. % 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 \\ +% Nightingale~emphase#\tabularnote{Considered as the first nurse of history}! +% ~emphase#\tabularnote{Nicknamed ``the Lady with the Lamp''.}! +% & Florence~emphase#\tabularnote{This note is shared by two references.}! & 90 \\ % Schoelcher & Victor & 89~emphase#\tabularnote{The label of the note is overlapping.}!\\ -% Touchet & Marie & 89 \\ +% Touchet & Marie~emphase#\tabularnote{This note is shared by two references.}! & 89 \\ % Wallis & John & 87 \\ % \bottomrule % \end{NiceTabular} @@ -3397,9 +3406,9 @@ version 2005/12/01 or later. % Churchill & Wiston & 91\\ % Nightingale\tabularnote{Considered as the first nurse of % history.}\tabularnote{Nicknamed ``the Lady with the Lamp''.} -% & Florence & 90 \\ +% & Florence\tabularnote{This note is shared by two references.} & 90 \\ % Schoelcher & Victor & 89\tabularnote{The label of the note is overlapping.}\\ -% Touchet & Marie & 89 \\ +% Touchet & Marie\tabularnote{This note is shared by two references.} & 89 \\ % Wallis & John & 87 \\ % \bottomrule % \end{NiceTabular} @@ -3549,12 +3558,10 @@ version 2005/12/01 or later. % It's also possible to add |\raggedright| or |\RaggedRight| in that key (|\RaggedRight| % is a command of \pkg{ragged2e}). % -% \item \colorbox{yellow!50}{\textbf{New 6.8}}\enskip Since the version 6.8, the -% duplicates in the notes of a tabular are detected by default: if several -% commands |\tabularnote| are used in a tabular with the same argument, only one -% note is inserted at the end of the tabular (but all the labels are composed, -% of course). It's possible to de-activate that feature with the key -% |notes/detect-duplicates| (whose initial value is |true|). +% \item The key |notes/detect-duplicates| activates the detection of the commands +% |\tabularnotes| with the same argument. +% +% Initial value : |true| % \end{itemize} % % @@ -11061,12 +11068,16 @@ version 2005/12/01 or later. % by LaTeX for incorrect nested environments). % \begin{macrocode} { - \peek_meaning_ignore_spaces:NTF \end \@@_analyze_end:Nn + \peek_remove_spaces:n + { + \peek_meaning:NTF \end + \@@_analyze_end:Nn % \end{macrocode} % Here is the call to |\array| (we have a dedicated macro |\@@_array:| because % of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}). % \begin{macrocode} - { \exp_args:NV \@@_array: \g_@@_preamble_tl } + { \exp_args:NV \@@_array: \g_@@_preamble_tl } + } } { \@@_create_col_nodes: @@ -13926,6 +13937,7 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \@@_RowStyle:n { O { } m } { + \tl_clear:N \l_tmpa_tl \keys_set:nn { NiceMatrix / RowStyle } { #1 } % \end{macrocode} % If the key |rowcolor| has been used. @@ -15321,9 +15333,12 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set:Npn \@@_Hline_i:n #1 { - \peek_meaning_ignore_spaces:NTF \Hline - { \@@_Hline_ii:nn { #1 + 1 } } - { \@@_Hline_iii:n { #1 } } + \peek_remove_spaces:n + { + \peek_meaning:NTF \Hline + { \@@_Hline_ii:nn { #1 + 1 } } + { \@@_Hline_iii:n { #1 } } + } } % \end{macrocode} % -- cgit v1.2.3