summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-05-25 20:19:39 +0000
committerKarl Berry <karl@freefriends.org>2022-05-25 20:19:39 +0000
commit5197d298c71622d80effcb59d4f3ac688ba65213 (patch)
treef37c16c21ae70c5b4b7a6239380ae5ae308bb897 /Master/texmf-dist/source/latex
parent40f4e413edcccdf0e0a2f4bfef2d1f128c88d8f0 (diff)
nicematrix (25may22)
git-svn-id: svn://tug.org/texlive/trunk@63402 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx206
1 files changed, 161 insertions, 45 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index c95554cfac4..a0776552eee 100644
--- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
+++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{6.8a}
-\def\myfiledate{2022/05/08}
+\def\myfileversion{6.9}
+\def\myfiledate{2022/05/25}
%
%
%<*batchfile>
@@ -1188,7 +1188,7 @@ version 2005/12/01 or later.
% \subsection{Commands for customized rules}
% \label{custom-line}
%
-% \colorbox{yellow!50}{\textbf{New 6.5}}\enskip It's possible to define commands
+% \colorbox{yellow!50}{\textbf{New 6.5}}\enskip It's also possible to define commands
% and letters for customized rules with the key |custom-line| available in
% |\NiceMatrixOptions| and in the options of individual environments. That key
% takes in as argument a list of \textsl{key=value} pairs. First, there is two
@@ -1925,7 +1925,7 @@ version 2005/12/01 or later.
% \begin{itemize}
% \item The key |nb-rows| sets
% the number of rows to which the specifications of the current command will
-% apply.
+% apply (with the special value |*|, it will apply to all the following rows).
% \item The keys |cell-space-top-limit|, |cell-space-bottom-limit| and
% |cell-space-limits| are available with the same meaning that the corresponding
% global keys (cf. p.~\pageref{cell-space}).
@@ -2754,11 +2754,13 @@ version 2005/12/01 or later.
% \label{customisation}
% The dotted lines drawn by |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, |\Iddots|,
% |\Hdotsfor| and |\Vdotsfor| (and by the command |\line| in the |\CodeAfter|
-% which is described p.~\pageref{line-in-code-after}) may be customized by three
+% which is described p.~\pageref{line-in-code-after}) may be customized by the following
% options (specified between square brackets after the command):
% \begin{itemize}
% \item |color|;
+% \item |radius|;
% \item |shorten|;
+% \item |inter|;
% \item |line-style|.
% \end{itemize}
%
@@ -2768,7 +2770,9 @@ version 2005/12/01 or later.
% |\Cdots|, |\Ldots|, |\Vdots|, etc.), and, thus have for names:
% \begin{itemize}
% \item |xdots/color|;
+% \item |xdots/radius|;
% \item |xdots/shorten|;
+% \item |xdots/inter|;
% \item |xdots/line-style|.
% \end{itemize}
%
@@ -2783,6 +2787,12 @@ version 2005/12/01 or later.
% special treatment: cf. p.~\pageref{exterior}.
%
% \bigskip
+% \colorbox{yellow!50}{\textbf{New 6.9}}\enskip
+% \textbf{The option xdots/radius}\par\nobreak
+%
+% The option |radius| fixes the radius of the dots. The initial value is 0.53~pt.
+%
+% \bigskip
% \textbf{The option xdots/shorten}\par\nobreak
%
% \smallskip
@@ -2793,6 +2803,15 @@ version 2005/12/01 or later.
% recommanded to use a unit of length dependent of the current font).
%
% \bigskip
+% \colorbox{yellow!50}{\textbf{New 6.9}}\enskip
+% \textbf{The option xdots/inter}\par\nobreak
+%
+% \smallskip
+% The option |xdots/inter| fixes the length between the dots. The initial value
+% is 0.45~em (it is recommanded to use a unit of length dependent of the current
+% font).
+%
+% \bigskip
% \textbf{The option xdots/line-style}\par\nobreak
%
% \smallskip
@@ -3588,6 +3607,34 @@ version 2005/12/01 or later.
%
% \section{Other features}
%
+% \section{Autres fonctionnalités}
+%
+% \subsection{Command \textbackslash ShowCellNames}
+%
+% \colorbox{yellow!50}{\textbf{New 6.9}} The command |\ShowCellNames|,
+% which may be used in the |\CodeBefore| and in the |\CodeAfter| display the name (with the
+% form $i$-$j$) of each cell.
+%
+% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
+% \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
+% \CodeBefore
+% \ShowCellNames
+% \Body
+% \Block{2-2}{} & & test \\
+% & & blabla \\
+% & some text & nothing
+% \end{NiceTabular}
+% \end{BVerbatim}
+% \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt]
+% \CodeBefore
+% \ShowCellNames
+% \Body
+% \Block{2-2}{} & & test \\
+% & & blabla \\
+% & some text & nothing
+% \end{NiceTabular}
+%
+%
% \subsection{Use of the column type S of siunitx}
%
% If the package \pkg{siunitx} is loaded (before or after \pkg{nicematrix}),
@@ -3878,7 +3925,7 @@ version 2005/12/01 or later.
% \end{bNiceMatrix}$
%
% \medskip
-% This colour alos applies to the delimiters drawn by the command |\SubMatrix|
+% This colour also applies to the delimiters drawn by the command |\SubMatrix|
% (cf.~p.~\pageref{sub-matrix}).
%
% \subsection{The environment \{NiceArrayWithDelims\}}
@@ -5688,11 +5735,8 @@ version 2005/12/01 or later.
% this package for technical reasons.
%
% \bigskip
-% We load some packages. The package \pkg{xparse} is still loaded for use on
-% Overleaf. However, since oct. 2021, Overleaf uses TeXLive 2021 and we will be
-% able to delete that row.
+% We load some packages.
% \begin{macrocode}
-\RequirePackage { xparse }
\RequirePackage { array }
\RequirePackage { amsmath }
% \end{macrocode}
@@ -7146,9 +7190,9 @@ version 2005/12/01 or later.
% (when |line-style| is equal to |standard|, which is the initial value). The
% initial value is 0.45~em but it will be changed if the option |small| is used.
% \begin{macrocode}
-\dim_new:N \l_@@_inter_dots_dim
+\dim_new:N \l_@@_xdots_inter_dim
\hook_gput_code:nnn { begindocument } { . }
- { \dim_set:Nn \l_@@_inter_dots_dim { 0.45 em } }
+ { \dim_set:Nn \l_@@_xdots_inter_dim { 0.45 em } }
% \end{macrocode}
% We use a hook only by security in case \cls{revtex4-1}
% is used (even though it is obsolete).
@@ -7171,9 +7215,9 @@ version 2005/12/01 or later.
% |line-style| is equal to |standard|, which is the initial value). The initial
% value is 0.53~pt but it will be changed if the option |small| is used.
% \begin{macrocode}
-\dim_new:N \l_@@_radius_dim
+\dim_new:N \l_@@_xdots_radius_dim
\hook_gput_code:nnn { begindocument } { . }
- { \dim_set:Nn \l_@@_radius_dim { 0.53 pt } }
+ { \dim_set:Nn \l_@@_xdots_radius_dim { 0.53 pt } }
% \end{macrocode}
% We use a hook only by security in case \cls{revtex4-1} is used (even though it
% is obsolete).
@@ -7378,9 +7422,17 @@ version 2005/12/01 or later.
{ \dim_set:Nn \l_@@_xdots_shorten_dim { #1 } } ,
% \end{macrocode}
% We use a hook only by security in case \cls{revtex4-1}
-% is used (even though it is obsolete).
+% is used (even though it is obsolete). Idem for the following keys.
% \begin{macrocode}
shorten .value_required:n = true ,
+ radius .code:n =
+ \hook_gput_code:nnn { begindocument } { . }
+ { \dim_set:Nn \l_@@_xdots_radius_dim { #1 } } ,
+ radius .value_required:n = true ,
+ inter .code:n =
+ \hook_gput_code:nnn { begindocument } { . }
+ { \dim_set:Nn \l_@@_xdots_inter_dim { #1 } } ,
+ radius .value_required:n = true ,
% \end{macrocode}
% The options |down| and |up| are not documented for the final user because he
% should use the syntax with |^| and |_|.
@@ -8904,6 +8956,7 @@ version 2005/12/01 or later.
\cs_set_eq:NN \columncolor \@@_columncolor
\cs_set_eq:NN \chessboardcolors \@@_chessboardcolors
\cs_set_eq:NN \SubMatrix \@@_SubMatrix_in_code_before
+ \cs_set_eq:NN \ShowCellNames \@@_ShowCellNames
}
% \end{macrocode}
%
@@ -10190,7 +10243,7 @@ version 2005/12/01 or later.
{
% \end{macrocode}
% We test whether the version of \pkg{nicematrix} is at least 3.0. We will
-% change de programmation of the test further with something like |\VersionAtLeast|.
+% change de programmation of the test further with something like |\@ifpackagelater|.
%
% \begin{macrocode}
\cs_if_exist:NTF \siunitx_cell_begin:w
@@ -10437,7 +10490,7 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_patch_preamble_xii:n #1
{
\tl_gput_right:Nn \g_@@_preamble_tl
- { ! { \skip_horizontal:N 2\l_@@_radius_dim } }
+ { ! { \skip_horizontal:N 2\l_@@_xdots_radius_dim } }
% \end{macrocode}
% The command |\@@_vdottedline:n| is protected, and, therefore, won't be
% expanded before writing on |\g_@@_internal_code_after_tl|.
@@ -10545,13 +10598,13 @@ version 2005/12/01 or later.
\int_compare:nNnTF \c@jCol = 0
{ \int_eval:n { \c@iRow + 1 } }
{ \int_use:N \c@iRow }
- } % modified 2022/01/10
+ }
{ \int_eval:n { \c@jCol + 1 } }
{
\int_compare:nNnTF \c@jCol = 0
{ \int_eval:n { \c@iRow + 1 } }
{ \int_use:N \c@iRow }
- } % modified 2022/01/10
+ }
{ \int_eval:n { \c@jCol + #1 } }
{ } % for the name of the block
}
@@ -11918,19 +11971,18 @@ version 2005/12/01 or later.
\bool_set_false:N \l_@@_final_open_bool
% \end{macrocode}
%
-% If the option |small| is used, the values |\l_@@_radius_dim| and
-% |\l_@@_inter_dots_dim| (used to draw the dotted lines created by
+% If the option |small| is used, the values |\l_@@_xdots_radius_dim| and
+% |\l_@@_xdots_inter_dim| (used to draw the dotted lines created by
% |\hdottedline| and |\vdottedline| and also for all the other dotted lines when
% |line-style| is equal to |standard|, which is the initial value) are changed.
% \begin{macrocode}
\bool_if:NT \l_@@_small_bool
{
- \dim_set:Nn \l_@@_radius_dim { 0.37 pt }
- \dim_set:Nn \l_@@_inter_dots_dim { 0.25 em }
+ \dim_set:Nn \l_@@_xdots_radius_dim { 0.7 \l_@@_xdots_radius_dim }
+ \dim_set:Nn \l_@@_xdots_inter_dim { 0.55 \l_@@_xdots_inter_dim }
% \end{macrocode}
% The dimension |\l_@@_xdots_shorten_dim| corresponds to the option
-% |xdots/shorten| available to the user. That's why we give a new value
-% according to the current value, and not an absolute value.
+% |xdots/shorten| available to the user.
% \begin{macrocode}
\dim_set:Nn \l_@@_xdots_shorten_dim { 0.6 \l_@@_xdots_shorten_dim }
}
@@ -11983,6 +12035,7 @@ version 2005/12/01 or later.
\cs_set_eq:NN \SubMatrix \@@_SubMatrix
\cs_set_eq:NN \UnderBrace \@@_UnderBrace
\cs_set_eq:NN \OverBrace \@@_OverBrace
+ \cs_set_eq:NN \ShowCellNames \@@_ShowCellNames
\cs_set_eq:NN \line \@@_line
\g_@@_internal_code_after_tl
\tl_gclear:N \g_@@_internal_code_after_tl
@@ -12678,8 +12731,8 @@ version 2005/12/01 or later.
% want the dots really ``on'' the line of texte. Of course, maybe we should not
% do that when the option |line-style| is used (?).
% \begin{macrocode}
- \dim_add:Nn \l_@@_y_initial_dim \l_@@_radius_dim
- \dim_add:Nn \l_@@_y_final_dim \l_@@_radius_dim
+ \dim_add:Nn \l_@@_y_initial_dim \l_@@_xdots_radius_dim
+ \dim_add:Nn \l_@@_y_final_dim \l_@@_xdots_radius_dim
\@@_draw_line:
}
% \end{macrocode}
@@ -13279,14 +13332,14 @@ version 2005/12/01 or later.
\bool_if:NTF \l_@@_final_open_bool
{
\int_set:Nn \l_tmpa_int
- { \dim_ratio:nn \l_@@_l_dim \l_@@_inter_dots_dim }
+ { \dim_ratio:nn \l_@@_l_dim \l_@@_xdots_inter_dim }
}
{
\int_set:Nn \l_tmpa_int
{
\dim_ratio:nn
{ \l_@@_l_dim - \l_@@_xdots_shorten_dim }
- \l_@@_inter_dots_dim
+ \l_@@_xdots_inter_dim
}
}
}
@@ -13297,7 +13350,7 @@ version 2005/12/01 or later.
{
\dim_ratio:nn
{ \l_@@_l_dim - \l_@@_xdots_shorten_dim }
- \l_@@_inter_dots_dim
+ \l_@@_xdots_inter_dim
}
}
{
@@ -13305,7 +13358,7 @@ version 2005/12/01 or later.
{
\dim_ratio:nn
{ \l_@@_l_dim - 2 \l_@@_xdots_shorten_dim }
- \l_@@_inter_dots_dim
+ \l_@@_xdots_inter_dim
}
}
}
@@ -13318,12 +13371,12 @@ version 2005/12/01 or later.
\dim_set:Nn \l_tmpa_dim
{
( \l_@@_x_final_dim - \l_@@_x_initial_dim ) *
- \dim_ratio:nn \l_@@_inter_dots_dim \l_@@_l_dim
+ \dim_ratio:nn \l_@@_xdots_inter_dim \l_@@_l_dim
}
\dim_set:Nn \l_tmpb_dim
{
( \l_@@_y_final_dim - \l_@@_y_initial_dim ) *
- \dim_ratio:nn \l_@@_inter_dots_dim \l_@@_l_dim
+ \dim_ratio:nn \l_@@_xdots_inter_dim \l_@@_l_dim
}
% \end{macrocode}
%
@@ -13349,7 +13402,7 @@ version 2005/12/01 or later.
{
( \l_@@_x_final_dim - \l_@@_x_initial_dim ) *
\dim_ratio:nn
- { \l_@@_l_dim - \l_@@_inter_dots_dim * \l_tmpa_int }
+ { \l_@@_l_dim - \l_@@_xdots_inter_dim * \l_tmpa_int }
{ 2 \l_@@_l_dim }
* \l_tmpb_int
}
@@ -13357,7 +13410,7 @@ version 2005/12/01 or later.
{
( \l_@@_y_final_dim - \l_@@_y_initial_dim ) *
\dim_ratio:nn
- { \l_@@_l_dim - \l_@@_inter_dots_dim * \l_tmpa_int }
+ { \l_@@_l_dim - \l_@@_xdots_inter_dim * \l_tmpa_int }
{ 2 \l_@@_l_dim }
* \l_tmpb_int
}
@@ -13366,7 +13419,7 @@ version 2005/12/01 or later.
{
\pgfpathcircle
{ \pgfpoint \l_@@_x_initial_dim \l_@@_y_initial_dim }
- { \l_@@_radius_dim }
+ { \l_@@_xdots_radius_dim }
\dim_add:Nn \l_@@_x_initial_dim \l_tmpa_dim
\dim_add:Nn \l_@@_y_initial_dim \l_tmpb_dim
}
@@ -13923,9 +13976,11 @@ version 2005/12/01 or later.
bold .bool_set:N = \l_tmpa_bool ,
bold .default:n = true ,
bold .initial:n = false ,
- nb-rows .int_set:N = \l_@@_key_nb_rows_int ,
+ nb-rows .code:n =
+ \str_if_eq:nnTF { #1 } { * }
+ { \int_set_eq:NN \l_@@_key_nb_rows_int 500 }
+ { \int_set:Nn \l_@@_key_nb_rows_int { #1 } } ,
nb-rows .value_required:n = true ,
- nb-rows .initial:n = 1 ,
rowcolor .tl_set:N = \l_@@_tmpc_tl ,
rowcolor .value_required:n = true ,
rowcolor .initial:n = ,
@@ -13938,6 +13993,7 @@ version 2005/12/01 or later.
\NewDocumentCommand \@@_RowStyle:n { O { } m }
{
\tl_clear:N \l_tmpa_tl
+ \int_set:Nn \l_@@_key_nb_rows_int 1
\keys_set:nn { NiceMatrix / RowStyle } { #1 }
% \end{macrocode}
% If the key |rowcolor| has been used.
@@ -15249,11 +15305,11 @@ version 2005/12/01 or later.
{ \dim_sub:Nn \l_@@_x_initial_dim \arraycolsep }
% \end{macrocode}
% For reasons purely aesthetic, we do an adjustment in the case of a rounded
-% bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a
+% bracket. The correction by |0.5 \l_@@_xdots_inter_dim| is \emph{ad hoc} for a
% better result.
% \begin{macrocode}
\tl_if_eq:NnF \g_@@_left_delim_tl (
- { \dim_add:Nn \l_@@_x_initial_dim { 0.5 \l_@@_inter_dots_dim } }
+ { \dim_add:Nn \l_@@_x_initial_dim { 0.5 \l_@@_xdots_inter_dim } }
}
\@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } }
\dim_set_eq:NN \l_@@_x_final_dim \pgf@x
@@ -15263,7 +15319,7 @@ version 2005/12/01 or later.
\bool_if:NT \l_@@_NiceArray_bool
{ \dim_add:Nn \l_@@_x_final_dim \arraycolsep }
\tl_if_eq:NnF \g_@@_right_delim_tl )
- { \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_inter_dots_dim } }
+ { \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_xdots_inter_dim } }
}
\CT@arc@
\@@_draw_line:
@@ -15843,7 +15899,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new:Npn \@@_hdottedline:
{
- \noalign { \skip_vertical:N 2\l_@@_radius_dim }
+ \noalign { \skip_vertical:N 2\l_@@_xdots_radius_dim }
\@@_hdottedline_i:
}
% \end{macrocode}
@@ -18763,7 +18819,59 @@ version 2005/12/01 or later.
{ }
}
% \end{macrocode}
+%
+% \bigskip
+% \subsection*{The command \textbackslash ShowCellNames}
%
+% \begin{macrocode}
+\NewDocumentCommand \@@_ShowCellNames { }
+ {
+ \int_step_inline:nn \c@iRow
+ {
+ \begin { tikzpicture }
+ \@@_qpoint:n { row - ##1 }
+ \dim_set_eq:NN \l_tmpa_dim \pgf@y
+ \@@_qpoint:n { row - \int_eval:n { ##1 + 1 } }
+ \dim_gset:Nn \g_tmpa_dim { ( \l_tmpa_dim + \pgf@y ) / 2 }
+ \dim_gset:Nn \g_tmpb_dim { \l_tmpa_dim - \pgf@y }
+ \end { tikzpicture }
+ \int_step_inline:nn \c@jCol
+ {
+ \hbox_set:Nn \l_tmpa_box
+ { \normalfont \Large \color { red ! 50 } ##1 - ####1 }
+ \begin { tikzpicture }
+ \@@_qpoint:n { col - ####1 }
+ \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x
+ \@@_qpoint:n { col - \int_eval:n { ####1 + 1 } }
+ \dim_set:Nn \l_tmpa_dim { \pgf@x - \l_@@_tmpc_dim }
+ \fp_set:Nn \l_tmpa_fp
+ {
+ \fp_min:nn
+ {
+ \fp_min:nn
+ { \dim_ratio:nn { \l_tmpa_dim } { \box_wd:N \l_tmpa_box } }
+ { \dim_ratio:nn { \g_tmpb_dim } { \box_ht_plus_dp:N \l_tmpa_box } }
+ }
+ { 1.0 }
+ }
+ \box_scale:Nnn \l_tmpa_box { \fp_use:N \l_tmpa_fp } { \fp_use:N \l_tmpa_fp }
+ \pgftransformshift
+ {
+ \pgfpoint
+ { 0.5 * ( \l_@@_tmpc_dim + \pgf@x ) }
+ { \dim_use:N \g_tmpa_dim }
+ }
+ \pgfnode
+ { rectangle }
+ { center }
+ { \box_use:N \l_tmpa_box }
+ { }
+ { }
+ \end { tikzpicture }
+ }
+ }
+ }
+% \end{macrocode}
%
%
% \bigskip
@@ -19100,9 +19208,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_msg_new:nn { Unknown~key~for~xdots }
{
- As~for~now,~there~is~only~three~keys~available~here:~'color',~'line-style'~
- and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~
- this~key~will~be~ignored.
+ As~for~now,~there~is~only~five~keys~available~here:~'color',~'inter',~
+ 'line-style',~'radius',~
+ and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~
+ If~you~go~on,~this~key~will~be~ignored.
}
% \end{macrocode}
%
@@ -20459,6 +20568,13 @@ version 2005/12/01 or later.
% argument, only one note is created at the end of the tabular (but all the
% labels are present, of course).
%
+% \subsection*{Changes between version 6.8 and 6.9}
+%
+% New keys |xdots/radius| and |xdots/inter| for customisation of the continuous
+% dotted lines.
+%
+% New command |\ShowCellNames| available in the |\CodeBefore| and in the |\CodeAfter|.
+%
% \PrintIndex
%
% \tableofcontents