From 9fb4a5e992bb10daf1cb0ad8f298a452e50caea8 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 19 Feb 2023 03:02:00 +0000 Subject: CTAN sync 202302190301 --- macros/latex/contrib/nicematrix/nicematrix.dtx | 540 +++++++++++++++++-------- 1 file changed, 367 insertions(+), 173 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 02d0f8e8b8..dceae17ad9 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.13f} -\def\myfiledate{2023/02/05} +\def\myfileversion{6.14} +\def\myfiledate{2023/02/18} % % %<*batchfile> @@ -533,28 +533,6 @@ version 2005/12/01 or later. % \end{bNiceArray}$ % \end{scope} % -% \medskip -% It's possible to set the horizontal position of the block with one of the keys -% |l|, |c| and |r|. -% -% -% \medskip -% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -% $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -% \Block~emphase#[r]@{3-3}<\LARGE>{A} & & & 0 \\ -% & & & \Vdots \\ -% & & & 0 \\ -% \hline -% 0 & \Cdots& 0 & 0 -% \end{bNiceArray}$ -% \end{BVerbatim} -% $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -% \Block[r]{3-3}<\LARGE>{A} & & & 0 \\ -% & & & \Vdots \\ -% & & & 0 \\ -% \hline -% 0 & \Cdots& 0 & 0 -% \end{bNiceArray}$ % % \interitem % In fact, the command |\Block| accepts as first optional argument (between @@ -581,8 +559,6 @@ version 2005/12/01 or later. % by |draw| and the shape drawn by |fill|) with a radius equal to the value of % that key (the default value is 4~pt\footnote{This value is the initial value % of the \emph{rounded corners} of Tikz.}); -% \item the keys |t| and |b| fix the base line that will be given to the block -% when it has a multi-line content (the lines are separated by |\\|); % \item when the key |tikz| is used, the Tikz path corresponding of the % rectangle which delimits the block is executed with Tikz\footnote{Tikz should % be loaded (by default, \pkg{nicematrix} only loads \textsc{pgf}) and, if it's @@ -602,6 +578,9 @@ version 2005/12/01 or later. % \textsl{key=value} of Tikz specifying the graphical characteristics of the % lines that will be drawn (for an example, see p.~\pageref{dashed}). % \end{itemize} +% +% There is also keys for the horizontal and vertical positions of the content of +% the block: cf.~\ref{horizontal-block} p.~\pageref{horizontal-block}). % % \interitem % {\bfseries One must remark that, by default, the commands |\Blocks| don't create space}. @@ -649,7 +628,9 @@ version 2005/12/01 or later. % that width. % % \item The specification of the horizontal position provided by the type of -% column (|c|, |r| or |l|) is taken into account for the blocks. +% column (|c|, |r| or |l|) is taken into account for the blocks (but the +% |\Block| may have its own specification of alignment: +% cf.~\ref{horizontal-block} p.~\pageref{horizontal-block}). % % \item The specifications of font specified for the column by a construction % |>{...}| in the preamble of the array are taken into account for the @@ -749,6 +730,31 @@ version 2005/12/01 or later. % % \subsection{Horizontal position of the content of the block} % +% \label{horizontal-block} +% +% The command |\Block| accepts the keys |l|, |c| and |r| for the horizontal +% position of its content. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +% $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] +% \Block~emphase#[r]@{3-3}<\LARGE>{A} & & & 0 \\ +% & & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% \end{BVerbatim} +% $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] +% \Block[r]{3-3}<\LARGE>{A} & & & 0 \\ +% & & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% +% +% % By default, the horizontal position of the content of a block is computed % by using the positions of the \emph{contents} of the columns implied in that % block. That's why, in the following example, the header ``First group'' is @@ -795,7 +801,167 @@ version 2005/12/01 or later. % contents of those columns), one may use the key |L|, |R| and |C| of the % command |\Block|. % +% \medskip +% Here is the same example with the key |C| for the first block. +% +% \medskip +% \begin{center} +% \fvset{commandchars=\~\#\+} +% \begin{BVerbatim} +% \begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}} +% \toprule +% Rank & ~emphase#\Block[C]{1-3}{First group}+ & & & \Block{1-3}{Second group} \\ +% & 1A & 1B & 1C & 2A & 2B & 2C \\ +% \midrule +% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\ +% 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\ +% 3 & 0.783 & 0.885 & 0.015 & 0.306 & 0.643 & 0.263\\ +% 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\ +% \bottomrule +% \end{NiceTabular} +% \end{BVerbatim} +% \end{center} % +% \bigskip +% \begin{center} +% \begin{NiceTabular}{@{}c!{\qquad}ccc!{\qquad}ccc@{}} +% \toprule +% Rank & \Block[C]{1-3}{First group} & & & \Block{1-3}{Second group} \\ +% & 1A & 1B & 1C & 2A & 2B & 2C \\ +% \midrule +% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\ +% 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\ +% 3 & 0.783 & 0.885 & 0.015 & 0.306 & 0.643 & 0.263\\ +% 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\ +% \bottomrule +% \end{NiceTabular} +% \end{center} +% +% +% \subsection{Vertical position of the content of the block} +% +% \colorbox{yellow!50}{\textbf{New 6.14}} +% +% For the vertical position, the commands |\Blocks| accepts the keys +% |v-center|\footnote{That key could not have been named |c| since the key |c| +% is used for the horizontal alignement.}, +% |t|, |b|, |T| and |B|. +% +% \begin{itemize} +% \item With the key |v-center|, the content of the block is vertically +% centered. +% \item With the key |t|, the baseline of the content of the block is aligned +% With the basline of the first row concerned by the block). +% \item with the key |b|, the baseline of the last row of the content of the +% block (we recall that the content of a block may contains several lines +% separated by |\\|) is aligned with the baseline of the last of the rows of the +% array involved in the block. +% \item With the key |T|, the content of the block is set upwards with only a +% margin equal to the PGF/Tikz parameter |inner ysep|. +% \item With the key |B|, the content of the block is set downwards with only a +% margin equal to the PGF/Tikz parameter |inner ysep|. +% \end{itemize} +% +% When no key is given, the key |v-center| applies (excepted in the mono-row blocks). +% +% +% +% \medskip +% \begin{scope} +% \NiceMatrixOptions{rules/color=[gray]{0.75}, hvlines} +% +% \begin{BVerbatim} +% \NiceMatrixOptions{rules/color=[gray]{0.75}, hvlines} +% \end{BVerbatim} +% +% \bigskip +% +% \begin{BVerbatim}[baseline=c,boxwidth=10cm] +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,~emphase#t@,l]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,t,l]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% +% +% \bigskip +% \begin{BVerbatim}[baseline=c,boxwidth=10cm] +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,~emphase#b@,r]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,b,r]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% +% \bigskip +% \begin{BVerbatim}[baseline=c,boxwidth=10cm] +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,~emphase#T@,l]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,T,l]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% +% +% \bigskip +% \begin{BVerbatim}[baseline=c,boxwidth=10cm] +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,~emphase#B@,r]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{ccc} +% \Block[fill=red!10,B,r]{4-2}{two\\lines} +% & & \Huge first\\ +% & & second \\ +% & & third \\ +% & & fourth \\ +% text & text \\ +% \end{NiceTabular} +% +% \end{scope} +% +% +% +% % \section{The rules} % % \label{rules} @@ -1000,10 +1166,9 @@ version 2005/12/01 or later. % In particular, this remark explains the difference between the standard % command |\hline| and the command |\Hline| provided by \pkg{nicematrix}. % -% \colorbox{yellow!50}{\textbf{New 6.13}}\enskip The key |\Hline| takes in an -% optional argument (between square brackets) which is a list of -% \textsl{key=value} pairs. For the description of those keys, see |custom-line| -% on p.~\pageref{custom-line}. +% The key |\Hline| takes in an optional argument (between square brackets) which +% is a list of \textsl{key=value} pairs. For the description of those keys, see +% |custom-line| on p.~\pageref{custom-line}. % % \subsubsection{The keys hlines and vlines} % @@ -1211,14 +1376,13 @@ version 2005/12/01 or later. % will be created by \pkg{nicematrix} and that will be available for the final % user in order to draw horizontal rules (similarly to |\hline|); % -% \item \colorbox{yellow!50}{\textbf{New 6.11}}\enskip the key |cccommand| is -% the name (without the backslash) of a command that will be created by -% \pkg{nicematrix} and that will be available for the final user to order to -% draw partial horizontal rules (similarly to |\cline|, hence the name -% |ccommand|): the argument of that command is a list of intervals of columns -% specified by the syntax~$i$ or $i$-$j$.\footnote{It's recommended to use such -% commands only once in a row because each use will create space between the -% rows corresponding to the total width of the rule.} +% \item the key |cccommand| is the name (without the backslash) of a command +% that will be created by \pkg{nicematrix} and that will be available for the +% final user to order to draw partial horizontal rules (similarly to |\cline|, +% hence the name |ccommand|): the argument of that command is a list of +% intervals of columns specified by the syntax~$i$ or $i$-$j$.\footnote{It's +% recommended to use such commands only once in a row because each use will +% create space between the rows corresponding to the total width of the rule.} % % \item the key |letter| takes in as argument a letter\footnote{The following % letters are forbidden: \verb+lcrpmbVX|()[]!@<>+} that the user will use in @@ -1653,7 +1817,7 @@ version 2005/12/01 or later. % \item The command |\rowcolors| (with a \emph{s}) takes its name from the % command |\rowcolors| of \pkg{colortbl}. The \emph{s} emphasizes % the fact that there is \emph{two} colors. This command colors alternately the -% rows of the tabular with the tow colors (provided in second and third +% rows of the tabular with the two colors (provided in second and third % argument), beginning with the row whose number is given in first (mandatory) % argument. % @@ -2862,11 +3026,6 @@ version 2005/12/01 or later. % The initial value is 0.3~em (it is recommanded to use a unit of length % dependent of the current font). % -% \smallskip -% \colorbox{yellow!50}{\textbf{New 6.10}}\enskip The keys |xdots/shorten-start| -% and |xdots/shorten-end| have been introduced in version 6.10. In the previous -% versions, there was only |xdots/shorten|. -% % \bigskip % \textbf{The option xdots/inter}\par\nobreak % @@ -2999,8 +3158,8 @@ version 2005/12/01 or later. % \begin{itemize} % \item a specification of cell of the form $i$-$j$ where is the % number of the row and $j$ is the number of the column; -% \item \colorbox{yellow!50}{\textbf{New 6.10}}\enskip the name of a block -% (created by the command |\Block| with the key |name| of that command). +% \item the name of a block (created by the command |\Block| with the key |name| +% of that command). % \end{itemize} % The options available for the customisation of the dotted lines created by % |\Cdots|, |\Vdots|, etc. are also available for this command (cf. @@ -3351,10 +3510,9 @@ version 2005/12/01 or later. % \subsection{Caption of a tabular} % % \smallskip -% \colorbox{yellow!50}{\bfseries New 6.12}\enskip The environment -% |{NiceTabular}| provides the keys |caption|, |short-caption| and |label| which -% may be used when the tabular is inserted in a floating environment (typically -% the environment |{table}|). +% The environment |{NiceTabular}| provides the keys |caption|, |short-caption| +% and |label| which may be used when the tabular is inserted in a floating +% environment (typically the environment |{table}|). % % \smallskip % With the key |caption|, the caption, when it is long, is wrapped at the width @@ -3469,10 +3627,9 @@ version 2005/12/01 or later. % \item There is a key |tabularnote| which provides a way to insert some text in % the zone of the notes before the numbered tabular notes. % -% \colorbox{yellow!50}{\textbf{New 6.13}}\enskip An alternative syntaxe is -% available with the environment |{TabularNote}|. That environment should be -% used at the end of the environment |{NiceTabular}| (but \emph{before} a -% potential instruction |\CodeAfter|). +% An alternative syntaxe is available with the environment |{TabularNote}|. That +% environment should be used at the end of the environment |{NiceTabular}| (but +% \emph{before} a potential instruction |\CodeAfter|). % % \item If the package \pkg{booktabs} has been loaded (before or after % \pkg{nicematrix}), the key |notes/bottomrule| draws a |\bottomrule| of @@ -3790,11 +3947,10 @@ version 2005/12/01 or later. % % \label{columns-width} % -% \colorbox{yellow!50}{\textbf{New 6.11}}\enskip The environments without -% preamble (|{NiceMatrix}|, |{pNiceMatrix}|, |{bNiceMatrix}|, etc.) and the -% commande |\pAutoNiceMatrix| (and its variants) provide an option -% |columns-type| to specify the type of column which will be used (the initial -% value is, of course, |c|). +% The environments without preamble (|{NiceMatrix}|, |{pNiceMatrix}|, +% |{bNiceMatrix}|, etc.) and the commande |\pAutoNiceMatrix| (and its variants) +% provide an option |columns-type| to specify the type of column which will be +% used (the initial value is, of course, |c|). % % The keys |l| and |r| are shortcuts for |columns-type=l| and |columns-type=r|. % @@ -7084,8 +7240,8 @@ version 2005/12/01 or later. % For the vertical position, the possible values are |c|, |t| and |b|. Of % course, it would be interesting to program a key |T| and a key |B|. % \begin{macrocode} -\tl_new:N \l_@@_vpos_of_block_tl -\tl_set:Nn \l_@@_vpos_of_block_tl { c } +\str_new:N \l_@@_vpos_of_block_str +\str_set:Nn \l_@@_vpos_of_block_str { c } % \end{macrocode} % % @@ -11138,7 +11294,7 @@ version 2005/12/01 or later. % After a specifier of column, we have to test whether there is one or several % |<{..}| because, after those potential |<{...}|, we have to insert % |!{\skip_horizontal:N ...}| when the key |vlines| is used. In fact, we have -% also to test wheter there is, after the |<{...}|, a |@{...}|. +% also to test whether there is, after the |<{...}|, a |@{...}|. % \begin{macrocode} \cs_new_protected:Npn \@@_patch_preamble_xi:n #1 { @@ -11162,7 +11318,7 @@ version 2005/12/01 or later. } } \@@_patch_preamble:n { #1 } - } + } } } % \end{macrocode} @@ -11188,15 +11344,16 @@ version 2005/12/01 or later. } { \exp_args:NNx - \clist_if_in:NnT \l_@@_vlines_clist { \int_eval:n { \c@jCol + 1 } } + \clist_if_in:NnTF \l_@@_vlines_clist { \int_eval:n { \c@jCol + 1 } } { \tl_gput_right:Nn \g_@@_preamble_tl { @ { #1 \skip_horizontal:N \arrayrulewidth } } } + { \tl_gput_right:Nn \g_@@_preamble_tl { @ { #1 } } } } \@@_patch_preamble:n } -% \end{macrocode} +% \end{macrocode} % % \bigskip % \begin{macrocode} @@ -11212,7 +11369,6 @@ version 2005/12/01 or later. \exp_after:wN \@@_patch_m_preamble:n \the \@temptokena \q_stop \group_end: \tl_set_eq:NN #1 \g_@@_preamble_tl - % \group_end: } % \end{macrocode} % @@ -17342,9 +17498,9 @@ version 2005/12/01 or later. R .value_forbidden:n = true , C .code:n = \str_set:Nn \l_@@_hpos_block_str c , C .value_forbidden:n = true , - t .code:n = \str_set:Nn \l_@@_vpos_of_block_tl t , + t .code:n = \str_set:Nn \l_@@_vpos_of_block_str t , t .value_forbidden:n = true , - b .code:n = \str_set:Nn \l_@@_vpos_of_block_tl b , + b .code:n = \str_set:Nn \l_@@_vpos_of_block_str b , b .value_forbidden:n = true , color .tl_set:N = \l_@@_color_tl , color .value_required:n = true , @@ -17560,27 +17716,32 @@ version 2005/12/01 or later. { { \int_compare_p:nNn { #2 } = 1 } { \dim_compare_p:n { \l_@@_col_width_dim >= \c_zero_dim } } - { ! \g_@@_rotate_bool } % added 2022/09/16 + { ! \g_@@_rotate_bool } } % \end{macrocode} % When the block is mono-column in a column with a fixed width (eg |p{3cm}|). % \begin{macrocode} - { - \begin { minipage } [ \l_@@_vpos_of_block_tl ] - { \l_@@_col_width_dim } - \str_case:Vn \l_@@_hpos_block_str - { - c \centering - r \raggedleft - l \raggedright - } + { + \use:x + { + \exp_not:N \begin { minipage }% + [ \str_lowercase:V { \l_@@_vpos_of_block_str } ] + { \l_@@_col_width_dim } + \str_case:Vn \l_@@_hpos_block_str + { + c \centering + r \raggedleft + l \raggedright + } + } #5 \end { minipage } } { \use:x { - \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_tl ] + \exp_not:N \begin { tabular }% + [ \str_lowercase:V { \l_@@_vpos_of_block_str } ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -17591,8 +17752,9 @@ version 2005/12/01 or later. \c_math_toggle_token \use:x { - \exp_not:N \begin { array } [ \l_@@_vpos_of_block_tl ] - { @ { } \l_@@_hpos_block_str @ { } } + \exp_not:N \begin { array }% + [ \str_lowercase:V { \l_@@_vpos_of_block_str } ] + { @ { } \l_@@_hpos_block_str @ { } } } #5 \end { array } @@ -17701,7 +17863,7 @@ version 2005/12/01 or later. { \str_set:Nn \l_@@_hpos_block_str c } \use:x { - \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_tl ] + \exp_not:N \begin { tabular } [ \l_@@_vpos_of_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -17722,7 +17884,7 @@ version 2005/12/01 or later. \c_math_toggle_token \use:x { - \exp_not:N \begin { array } [ \l_@@_vpos_of_block_tl ] + \exp_not:N \begin { array } [ \l_@@_vpos_of_block_str ] { @ { } \l_@@_hpos_block_str @ { } } } #5 @@ -17795,18 +17957,21 @@ version 2005/12/01 or later. C .code:n = \str_set:Nn \l_@@_hpos_block_str c \bool_set_true:N \l_@@_hpos_of_block_cap_bool , C .value_forbidden:n = true , - t .code:n = \str_set:Nn \l_@@_vpos_of_block_tl t , + t .code:n = \str_set:Nn \l_@@_vpos_of_block_str t , t .value_forbidden:n = true , - b .code:n = \str_set:Nn \l_@@_vpos_of_block_tl b , + T .code:n = \str_set:Nn \l_@@_vpos_of_block_str T , + T .value_forbidden:n = true , + b .code:n = \str_set:Nn \l_@@_vpos_of_block_str b , b .value_forbidden:n = true , + B .code:n = \str_set:Nn \l_@@_vpos_of_block_str B , + B .value_forbidden:n = true , + v-center .code:n = \str_set:Nn \l_@@_vpos_of_block_str { c } , + v-center .value_forbidden:n = true , name .tl_set:N = \l_@@_block_name_str , name .value_required:n = true , name .initial:n = , respect-arraystretch .bool_set:N = \l_@@_respect_arraystretch_bool , respect-arraystretch .default:n = true , - v-center .bool_set:N = \l_@@_v_center_bool , - v-center .default:n = true , - v-center .initial:n = false , transparent .bool_set:N = \l_@@_transparent_bool , transparent .default:n = true , transparent .initial:n = false , @@ -17871,6 +18036,14 @@ version 2005/12/01 or later. } % \end{macrocode} % +% +% \medskip +% |#1| is the first row of the block; +% |#2| is the first column of the block; +% |#3| is the last row of the block; +% |#4| is the last column of the block; +% |#5| is a list of \textsl{key=value} options; +% |#6| is the label % \begin{macrocode} \cs_new_protected:Npn \@@_Block_v:nnnnnn #1 #2 #3 #4 #5 #6 { @@ -17878,21 +18051,10 @@ version 2005/12/01 or later. % The group is for the keys. % \begin{macrocode} \group_begin: + \int_compare:nNnT { #1 } = { #3 } + { \str_set:Nn \l_@@_vpos_of_block_str { t } } \keys_set:nn { NiceMatrix / Block / SecondPass } { #5 } % \end{macrocode} -% -% -% We restrict the use of the key |v-center| to the case of a mono-row block. -% \begin{macrocode} - \bool_if:NT \l_@@_v_center_bool - { - \int_compare:nNnF { #1 } = { #3 } - { - \@@_error:n { Wrong~use~of~v-center } - \bool_set_false:N \l_@@_v_center_bool - } - } -% \end{macrocode} % % \begin{macrocode} \bool_if:NT \l_@@_vlines_block_bool @@ -18192,30 +18354,111 @@ version 2005/12/01 or later. } } % \end{macrocode} +% +% We take into account the case of a block of one row in the ``first row'' or +% the ``last row''. +% \begin{macrocode} + \int_compare:nNnT { #1 } = 0 + { + \int_compare:nNnT { #3 } = 0 + { \l_@@_code_for_first_row_tl } + } + \int_compare:nNnT { #1 } = \l_@@_last_row_int + { + \int_compare:nNnT { #3 } = \l_@@_last_row_int + { \l_@@_code_for_last_row_tl } + } +% \end{macrocode} +% % \medskip -% Now, we will put the label of the block beginning with the case of a |\Block| -% of one row. +% Now, we will put the label of the block. % \begin{macrocode} - \bool_if:nTF - { \int_compare_p:nNn { #1 } = { #3 } && ! \l_@@_v_center_bool } + \bool_lazy_any:nTF { + { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { c } } + { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { T } } + { \str_if_eq_p:Vn \l_@@_vpos_of_block_str { B } } + } +% \medskip +% \begin{macrocode} + { % \end{macrocode} -% We take into account the case of a block of one row in the ``first row'' or -% the ``last row''. +% If we are in the first column, we must put the block as if it was with the key~|r|. % \begin{macrocode} - \int_compare:nNnTF { #1 } = 0 - { \l_@@_code_for_first_row_tl } - { - \int_compare:nNnT { #1 } = \l_@@_last_row_int - \l_@@_code_for_last_row_tl + \int_compare:nNnT { #2 } = 0 + { \str_set:Nn \l_@@_hpos_block_str r } + \bool_if:nT \g_@@_last_col_found_bool + { + \int_compare:nNnT { #2 } = \g_@@_col_total_int + { \str_set:Nn \l_@@_hpos_block_str l } + } +% \end{macrocode} +% \begin{macrocode} + \tl_set:Nx \l_tmpa_tl + { + \str_case:Vn \l_@@_vpos_of_block_str + { + c { + \str_case:Vn \l_@@_hpos_block_str + { + c { center } + l { west } + r { east } + } + + } + T { + \str_case:Vn \l_@@_hpos_block_str + { + c { north } + l { north~west } + r { north~east } + } + + } + B { + \str_case:Vn \l_@@_hpos_block_str + { + c { south} + l { south~west } + r { south~east } + } + + } + } + } +% \end{macrocode} +% \begin{macrocode} + \pgftransformshift + { + \pgfpointanchor + { + \@@_env: - #1 - #2 - block + \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } + } + { \l_tmpa_tl } } + \pgfset { inner~xsep = \c_zero_dim } + \pgfnode + { rectangle } + { \l_tmpa_tl } + { \box_use_drop:N \l_@@_cell_box } { } { } + } +% \end{macrocode} +% +% \begin{macrocode} + { % \end{macrocode} -% If the block has only one row, we want the label of the block perfectly -% aligned on the baseline of the row. That's why we have constructed a -% |\pgfcoordinate| on the baseline of the row, in the first column of the array. -% Now, we retrieve the $y$-value of that node and we store it in |\l_tmpa_dim|. +% % \begin{macrocode} - \pgfextracty \l_tmpa_dim { \@@_qpoint:n { row - #1 - base } } + \pgfextracty \l_tmpa_dim + { + \@@_qpoint:n + { + row - \str_if_eq:VnTF \l_@@_vpos_of_block_str { b } { #3 } { #1 } + - base + } + } % \end{macrocode} % We retrieve (in |\pgf@x|) the $x$-value of the center of the block. % \begin{macrocode} @@ -18251,51 +18494,7 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \medskip -% If the number of rows is different of $1$, we will put the label of the block -% by using the short node (the label of the block has been composed in -% |\l_@@_cell_box|). -% \begin{macrocode} - { -% \end{macrocode} -% If we are in the first column, we must put the block as if it was with the key~|r|. % \begin{macrocode} - \int_compare:nNnT { #2 } = 0 - { \str_set:Nn \l_@@_hpos_block_str r } - \bool_if:nT \g_@@_last_col_found_bool - { - \int_compare:nNnT { #2 } = \g_@@_col_total_int - { \str_set:Nn \l_@@_hpos_block_str l } - } - \pgftransformshift - { - \pgfpointanchor - { - \@@_env: - #1 - #2 - block - \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short } - } - { - \str_case:Vn \l_@@_hpos_block_str - { - c { center } - l { west } - r { east } - } - } - } - \pgfset { inner~sep = \c_zero_dim } - \pgfnode - { rectangle } - { - \str_case:Vn \l_@@_hpos_block_str - { - c { center } - l { west } - r { east } - } - } - { \box_use_drop:N \l_@@_cell_box } { } { } - } \endpgfpicture \group_end: } @@ -20611,14 +20810,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \begin{macrocode} -\@@_msg_new:nn { Wrong~use~of~v-center } - { - Wrong~use~of~v-center.\\ - You~should~not~use~the~key~'v-center'~here~because~your~block~is~not~ - mono-row.~However,~you~can~go~on. - } -% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { No~letter~and~no~command } @@ -20964,9 +21155,9 @@ version 2005/12/01 or later. \c_@@_available_keys_str } { - The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~ - hlines,~hvlines,~l,~line-width,~name,~rounded-corners,~r,~respect-arraystretch, - ~t,~tikz,~transparent~and~vlines. + The~available~keys~are~(in~alphabetic~order):~b,~B,~borders,~c,~draw,~fill,~ + hlines,~hvlines,~l,~line-width,~name,~rounded-corners,~r,~respect-arraystretch,~ + t,~T,~tikz,~transparent~and~vlines. } % \end{macrocode} % @@ -21371,7 +21562,10 @@ version 2005/12/01 or later. % \small % \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} % } +% \subsection*{Changes between version 6.13 and 6.14} % +% New keys for the command |\Block| for the vertical position of the content of +% that block. % % \subsection*{Changes between version 6.12 and 6.13} % -- cgit v1.2.3