summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-06 20:23:54 +0000
committerKarl Berry <karl@freefriends.org>2021-05-06 20:23:54 +0000
commitd23ce5cb0bb42ef0380b13d2d43d48afcc51b897 (patch)
tree65c2a60d8228f1f424836829ff29361773376a71 /Master/texmf-dist/source
parent4a3742b13d2d84ad2530328f8f4d6e51cba2182c (diff)
nicematrix (6may21)
git-svn-id: svn://tug.org/texlive/trunk@59105 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx764
1 files changed, 493 insertions, 271 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index 1b475cebada..0718d3cae59 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{5.15}
-\def\myfiledate{2021/04/25}
+\def\myfileversion{5.15a}
+\def\myfiledate{2021/05/06}
%
%
%<*batchfile>
@@ -26,6 +26,8 @@
\usedir{tex/latex/nicematrix}
\preamble
+
+
Copyright (C) 2018-2021 by F. Pantigny
-----------------------------------
@@ -4136,6 +4138,11 @@ version 2005/12/01 or later.
% \cls{aastex63}. If you want to use \pkg{nicematrix} with \cls{aastex63}, send
% me an email and I will try to solve the incompatibilies.
%
+%
+% \bigskip
+% the package \pkg{nicematrix} is not compatible with the class \cls{ieeeaccess}
+% (because that class is not compatible with PGF/Tikz).
+%
% \section{Examples}
%
% \subsection{Notes in the tabulars}
@@ -4855,12 +4862,20 @@ version 2005/12/01 or later.
%
% You will find the LaTeX code of that figure in the source file of this
% document.
-%
+% \tikzset{highlight/.style={rectangle,
+% fill=red!15,
+% rounded corners = 0.5 mm,
+% inner sep=1pt,
+% fit=#1}}%
% \[\begin{NiceArray}{*{6}{c}@{\hspace{6mm}}*{5}{c}}[nullify-dots]
-% \CodeBefore
+% \CodeBefore [create-cell-nodes]
% \SubMatrix({2-7}{6-11})
% \SubMatrix({7-2}{11-6})
% \SubMatrix({7-7}{11-11})
+% \begin{tikzpicture}
+% \node [highlight = (9-2) (9-6)] { } ;
+% \node [highlight = (2-9) (6-9)] { } ;
+% \end{tikzpicture}
% \Body
% & & & & & & & & \color{blue}\scriptstyle C_j \\
% & & & & & & b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
@@ -4875,12 +4890,9 @@ version 2005/12/01 or later.
% & \Vdots & & & & \Vdots \\
% & a_{n1} & \Cdots & & & a_{nn} \\
% \CodeAfter
-% \begin{tikzpicture}
-% \node [highlight = (9-2) (9-6)] { } ;
-% \node [highlight = (2-9) (6-9)] { } ;
-% \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ;
-% \end{tikzpicture}
+% \tikz \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ;
% \end{NiceArray}\]
+%
%
%\section{Implementation}
%
@@ -5477,6 +5489,14 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% The following counters will be used to count the numbers of rows and columns
+% of the array.
+% \begin{macrocode}
+\int_new:N \g_@@_row_total_int
+\int_new:N \g_@@_col_total_int
+% \end{macrocode}
+%
+% \bigskip
% The following token list will contain the type of the current cell (|l|, |c|
% or |r|). It will be used by the blocks.
% \begin{macrocode}
@@ -5519,9 +5539,9 @@ version 2005/12/01 or later.
%
% \bigskip
% If the user uses |{NiceArray}| or |{NiceTabular}| the flag
-% |\g_@@_NiceArray_bool| will be raised.
+% |\l_@@_NiceArray_bool| will be raised.
% \begin{macrocode}
-\bool_new:N \g_@@_NiceArray_bool
+\bool_new:N \l_@@_NiceArray_bool
% \end{macrocode}
% In fact, if there is delimiters in the preamble of |{NiceArray}| (eg:
% |[cccc]|), this boolean will be set to false.
@@ -6121,7 +6141,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\NewDocumentCommand \tabularnote { m }
{
- \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool }
+ \bool_if:nTF { ! \l_@@_NiceArray_bool && \l_@@_in_env_bool }
{ \@@_error:n { tabularnote~forbidden } }
{
% \end{macrocode}
@@ -6190,7 +6210,6 @@ version 2005/12/01 or later.
%
%
% \subsection*{Command for creation of rectangle nodes}
-%
%
% The following command should be used in a |{pgfpicture}|. It creates a
% rectangle (empty but with a name).
@@ -6257,7 +6276,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+%
% \bigskip
% \subsection*{The options}
%
@@ -6398,7 +6417,13 @@ version 2005/12/01 or later.
% \begin{macrocode}
\bool_new:N \l_@@_auto_columns_width_bool
% \end{macrocode}
-%
+%
+% \bigskip
+% The following boolean corresponds to the key |create-cell-nodes| of the
+% keyword |\CodeBefore|.
+% \begin{macrocode}
+\bool_new:N \g_@@_recreate_cell_nodes_bool
+% \end{macrocode}
%
% \bigskip
% The string |\l_@@_name_str| will contain the optional name of the
@@ -6531,6 +6556,9 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Global }
{
+ delimiters .code:n =
+ \keys_set:nn { NiceMatrix / delimiters } { #1 } ,
+ delimiters .value_required:n = true ,
rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } ,
rules .value_required:n = true ,
standard-cline .bool_set:N = \l_@@_standard_cline_bool ,
@@ -6613,7 +6641,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Env }
{
- delimiters/max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
+
% \end{macrocode}
% The key |hvlines-except-corners| is now deprecated.
% \begin{macrocode}
@@ -6727,7 +6755,17 @@ version 2005/12/01 or later.
unknown .code:n = \@@_error:n { Unknown~key~for~notes }
}
% \end{macrocode}
-%
+%
+% \begin{macrocode}
+\keys_define:nn { NiceMatrix / delimiters }
+ {
+ max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
+ max-width .default:n = true ,
+ color .tl_set:N = \l_@@_delimiters_color_tl ,
+ color .value_required:n = true ,
+ }
+% \end{macrocode}
+%
% \bigskip
% We begin the construction of the major sets of keys (used by the different
% user commands and environments).
@@ -6739,6 +6777,7 @@ version 2005/12/01 or later.
NiceMatrixOptions / xdots .inherit:n = NiceMatrix / xdots ,
NiceMatrixOptions / rules .inherit:n = NiceMatrix / rules ,
NiceMatrixOptions / notes .inherit:n = NiceMatrix / notes ,
+ NiceMatrixOptions / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceMatrixOptions / sub-matrix .inherit:n = NiceMatrix / sub-matrix ,
SubMatrix / rules .inherit:n = NiceMatrix / rules ,
CodeAfter / xdots .inherit:n = NiceMatrix / xdots ,
@@ -6749,6 +6788,7 @@ version 2005/12/01 or later.
} ,
NiceMatrix / xdots .inherit:n = NiceMatrix / xdots ,
NiceMatrix / rules .inherit:n = NiceMatrix / rules ,
+ NiceMatrix / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceTabular .inherit:n =
{
NiceMatrix / Global ,
@@ -6756,6 +6796,7 @@ version 2005/12/01 or later.
} ,
NiceTabular / xdots .inherit:n = NiceMatrix / xdots ,
NiceTabular / rules .inherit:n = NiceMatrix / rules ,
+ NiceTabular / delimiters .inherit:n = NiceMatrix / delimiters ,
NiceArray .inherit:n =
{
NiceMatrix / Global ,
@@ -6763,6 +6804,7 @@ version 2005/12/01 or later.
} ,
NiceArray / xdots .inherit:n = NiceMatrix / xdots ,
NiceArray / rules .inherit:n = NiceMatrix / rules ,
+ NiceArray / delimiters .inherit:n = NiceMatrix / delimiters ,
pNiceArray .inherit:n =
{
NiceMatrix / Global ,
@@ -6770,6 +6812,7 @@ version 2005/12/01 or later.
} ,
pNiceArray / xdots .inherit:n = NiceMatrix / xdots ,
pNiceArray / rules .inherit:n = NiceMatrix / rules ,
+ pNiceArray / delimiters .inherit:n = NiceMatrix / delimiters ,
}
% \end{macrocode}
%
@@ -6781,13 +6824,6 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrixOptions }
{
- delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
- delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
- delimiters / color .value_required:n = true ,
- delimiters-color .code:n =
- \tl_set:Nn \l_@@_delimiters_color_tl { #1 }
- \@@_error:n { delimiters-color deleted } ,
- delimiters-color .value_required:n = true ,
last-col .code:n = \tl_if_empty:nF { #1 }
{ \@@_error:n { last-col~non~empty~for~NiceMatrixOptions } }
\int_zero:N \l_@@_last_col_int ,
@@ -6900,12 +6936,6 @@ version 2005/12/01 or later.
r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
small .bool_set:N = \l_@@_small_bool ,
small .value_forbidden:n = true ,
- delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
- delimiters / color .value_required:n = true ,
- delimiters-color .code:n =
- \tl_set:Nn \l_@@_delimiters_color_tl { #1 }
- \@@_error:n { delimiters-color deleted } ,
- delimiters-color .value_required:n = true ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix }
}
% \end{macrocode}
@@ -6936,11 +6966,6 @@ version 2005/12/01 or later.
notes / bottomrule .default:n = true ,
tabularnote .tl_set:N = \l_@@_tabularnote_tl ,
tabularnote .value_required:n = true ,
- delimiters-color .code:n =
- \tl_set:Nn \l_@@_delimiters_color_tl { #1 }
- \@@_error:n { delimiters-color deleted } ,
- delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
- delimiters / color .value_required:n = true ,
r .code:n = \@@_error:n { r~or~l~with~preamble } ,
l .code:n = \@@_error:n { r~or~l~with~preamble } ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray }
@@ -7206,7 +7231,7 @@ version 2005/12/01 or later.
\bool_lazy_or:nnTF
\g_@@_not_empty_cell_bool
{ \dim_compare_p:nNn { \box_wd:N \l_@@_cell_box } > \c_zero_dim }
- \@@_node_for_the_cell:
+ \@@_node_for_cell:
{ \box_use_drop:N \l_@@_cell_box }
}
\int_gset:Nn \g_@@_col_total_int { \int_max:nn \g_@@_col_total_int \c@jCol }
@@ -7214,12 +7239,12 @@ version 2005/12/01 or later.
\bool_gset_false:N \g_@@_not_empty_cell_bool
}
% \end{macrocode}
-%
+%
% \medskip
% The following command creates the \textsc{pgf} name of the node with, of
% course, |\l_@@_cell_box| as the content.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_node_for_the_cell:
+\cs_new_protected:Npn \@@_node_for_cell:
{
\pgfpicture
\pgfsetbaseline \c_zero_dim
@@ -7244,6 +7269,53 @@ version 2005/12/01 or later.
\endpgfpicture
}
% \end{macrocode}
+%
+% \medskip
+% As its name says, the following command is a patch for the command
+% |\@@_node_for_cell:|. This patch will be appended on the left of
+% |\@@_noce_for_the_cell:| when the construction of the cell nodes (of the forme
+% |(i-j)|) in the |\CodeBefore| is required.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_node_for_cell:n #1
+ {
+ \cs_new_protected:Npn \@@_patch_node_for_cell:
+ {
+ \hbox_set:Nn \l_@@_cell_box
+ {
+ \box_move_up:nn { \box_ht:N \l_@@_cell_box}
+ \hbox_overlap_left:n
+ {
+ \pgfsys@markposition
+ { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol - NW }
+% \end{macrocode}
+% I don't know why the following adjustement is needed when the compilation is
+% done with XeLaTeX or with the classical way |latex|, |divps|, |ps2pdf| (or
+% Adobe Distiller). However, it seems to work.
+% \begin{macrocode}
+ #1
+ }
+ \box_use:N \l_@@_cell_box
+ \box_move_down:nn { \box_dp:N \l_@@_cell_box }
+ \hbox_overlap_left:n
+ {
+ \pgfsys@markposition
+ { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol - SE }
+ #1
+ }
+ }
+ }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\bool_lazy_or:nnTF \sys_if_engine_xetex_p: \sys_if_output_dvi_p:
+ {
+ \@@_patch_node_for_cell:n
+ { \skip_horizontal:n { 0.5 \box_wd:N \l_@@_cell_box } }
+ }
+ { \@@_patch_node_for_cell:n { } }
+% \end{macrocode}
+%
%
% \interitem
% The second argument of the following command |\@@_instruction_of_type:nnn|
@@ -7450,7 +7522,7 @@ version 2005/12/01 or later.
\peek_meaning:NTF [
{ \newcol@ #1 }
{ \newcol@ #1 [ 0 ] }
- }
+ }
% \end{macrocode}
%
%
@@ -7679,138 +7751,13 @@ version 2005/12/01 or later.
% \end{macrocode}
% This is the end of |\@@_pre_array_ii:|.
%
+%
% \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
-% the size of the array has been written in the |aux| file in a previous run. In
-% this case, a command |\@@_size_|{\slshape\ttfamily nb_of_env}|:| has been
-% created.
% \begin{macrocode}
\cs_new_protected:Npn \@@_pre_array:
{
\seq_gclear:N \g_@@_submatrix_seq
- \bool_if:NT \l_@@_code_before_bool
- {
-% \end{macrocode}
-% The list of the cells which are in the (empty) corners is stored in the |aux|
-% file because we have to know it before the execution of the |\CodeBefore| (the
-% commands which color the cells, row and columns won't color the cells which
-% are in the corners).
-% \begin{macrocode}
- \seq_if_exist:cT
- { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
- {
- \seq_set_eq:Nc \l_@@_corners_cells_seq
- { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
- }
-% \end{macrocode}
-% Now, we have to reconstruct the |row| nodes and the |col| nodes.
-% \begin{macrocode}
- \seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq }
- {
-% \end{macrocode}
-% First, we give values to the LaTeX counters |iRow| and |jCol|. We remind that,
-% in the |code-before| (and in the |\CodeAfter|) they represent the numbers of
-% rows and columns of the array (without the potential last row and last column).
-% \begin{macrocode}
- \int_zero_new:N \c@iRow
- \int_set:Nn \c@iRow
- { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 }
- \int_zero_new:N \c@jCol
- \int_set:Nn \c@jCol
- { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 }
-% \end{macrocode}
-% We have to adjust the values of |\c@iRow| and |\c@jCol| to take into account
-% the potential last row and last column. A value of $-2$ for
-% |\l_@@_last_row_int| means that there is no last row. Idem for the columns.
-% \begin{macrocode}
- \int_compare:nNnF \l_@@_last_row_int = { -2 }
- { \int_decr:N \c@iRow }
- \int_compare:nNnF \l_@@_last_col_int = { -2 }
- { \int_decr:N \c@jCol }
-% \end{macrocode}
-%
-% Now, we will create all the |col| nodes and |row| nodes with the informations
-% written in the |aux| file. You use the technique described in the page~1229 of
-% |pgfmanual.pdf|, version~3.1.4b.
-% \begin{macrocode}
- \pgfsys@markposition { \@@_env: - position }
- \pgfsys@getposition { \@@_env: - position } \@@_picture_position:
- \pgfpicture
-% \end{macrocode}
-% First, the creation of the |row| nodes.
-% \begin{macrocode}
- \int_step_inline:nnn
- { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 1 }
- { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 + 1 }
- {
- \pgfsys@getposition { \@@_env: - row - ##1 } \@@_node_position:
- \pgfcoordinate { \@@_env: - row - ##1 }
- { \pgfpointdiff \@@_picture_position: \@@_node_position: }
- }
-% \end{macrocode}
-% Now, the creation of the |col| nodes.
-% \begin{macrocode}
- \int_step_inline:nnn
- { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 3 }
- { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 + 1 }
- {
- \pgfsys@getposition { \@@_env: - col - ##1 } \@@_node_position:
- \pgfcoordinate { \@@_env: - col - ##1 }
- { \pgfpointdiff \@@_picture_position: \@@_node_position: }
- }
- \endpgfpicture
-% \end{macrocode}
-% Now, you create the diagonal nodes by using the |row| nodes and the |col|
-% nodes. If the engine is |xetex| or |luatex| we also create the ``½ nodes''.
-% \begin{macrocode}
- \@@_create_diag_nodes:
-% \end{macrocode}
-%
-% \medskip
-% Now, yet other settings before the execution of the |code-before|.
-% \begin{macrocode}
- \group_begin:
- \bool_if:NT \c_@@_tikz_loaded_bool
- {
- \tikzset
- {
- every~picture / .style =
- { overlay , name~prefix = \@@_env: - }
- }
- }
- \cs_set_eq:NN \cellcolor \@@_cellcolor
- \cs_set_eq:NN \rectanglecolor \@@_rectanglecolor
- \cs_set_eq:NN \roundedrectanglecolor \@@_roundedrectanglecolor
- \cs_set_eq:NN \rowcolor \@@_rowcolor
- \cs_set_eq:NN \rowcolors \@@_rowcolors
- \cs_set_eq:NN \arraycolor \@@_arraycolor
- \cs_set_eq:NN \columncolor \@@_columncolor
- \cs_set_eq:NN \chessboardcolors \@@_chessboardcolors
- \cs_set_eq:NN \SubMatrix \@@_SubMatrix_in_code_before
-% \end{macrocode}
-% We compose the |code-before| in math mode in order to nullify the spaces put
-% by the user between instructions in the |code-before|.
-% \begin{macrocode}
- \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
- \seq_gclear_new:N \g_@@_colors_seq
-% \end{macrocode}
-% Here is the |\CodeBefore|. As of now, the keys that may be provided to the
-% keyword |\CodeBefore| are the same as keys that may be provided to
-% |\CodeAfter|, hence the |\@@_CodeAfter_keys:|.
-% \begin{macrocode}
- \exp_last_unbraced:NV \@@_CodeAfter_keys: \l_@@_code_before_tl
-% \end{macrocode}
-% Now, all the cells which are specified to be colored by instructions in the
-% |\CodeBefore| will actually be colored. It's a two-stages mechanism because we
-% want to draw all the cells with the same color at the same time to absolutely
-% avoid thin white lines in some \textsc{pdf} viewers.
-% \begin{macrocode}
- \@@_actually_color:
- \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
- \group_end:
- }
- }
+ \bool_if:NT \l_@@_code_before_bool \@@_exec_code_before:
% \end{macrocode}
%
% A value of $-1$ for the counter |\l_@@_last_row_int| means that the user has
@@ -7854,7 +7801,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
% A value of $-1$ for the counter |\l_@@_last_col_int| means that the user has
% used the option |last-col| without value, that is to say without specifying
% the number of that last column. In this case, we try to read that value from
@@ -7885,7 +7831,6 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_pre_array_ii:
% \end{macrocode}
-%
%
% \medskip
% The array will be composed in a box (named |\l_@@_the_array_box|) because we
@@ -7908,7 +7853,6 @@ version 2005/12/01 or later.
% \begin{macrocode}
\@@_construct_preamble:
% \end{macrocode}
-%
% Now, the preamble is constructed in |\g_@@_preamble_tl|
%
% \medskip
@@ -7918,7 +7862,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\dim_zero_new:N \l_@@_left_delim_dim
\dim_zero_new:N \l_@@_right_delim_dim
- \bool_if:NTF \g_@@_NiceArray_bool
+ \bool_if:NTF \l_@@_NiceArray_bool
{
\dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep }
\dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep }
@@ -7933,8 +7877,6 @@ version 2005/12/01 or later.
\dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box }
}
% \end{macrocode}
-%
-%
%
% \bigskip
% Here is the beginning of the box which will contain the array. The
@@ -7972,6 +7914,226 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
+% \bigskip
+% \subsection*{The \textbackslash CodeBefore}
+%
+% The following command will be executed if the |\CodeBefore| has to be actually executed.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_pre_code_before:
+ {
+% \end{macrocode}
+% First, we give values to the LaTeX counters |iRow| and |jCol|. We remind that,
+% in the |code-before| (and in the |\CodeAfter|) they represent the numbers of
+% rows and columns of the array (without the potential last row and last column).
+% \begin{macrocode}
+ \int_zero_new:N \c@iRow
+ \int_set:Nn \c@iRow
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 }
+ \int_zero_new:N \c@jCol
+ \int_set:Nn \c@jCol
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 }
+% \end{macrocode}
+% We have to adjust the values of |\c@iRow| and |\c@jCol| to take into account
+% the potential last row and last column. A value of $-2$ for
+% |\l_@@_last_row_int| means that there is no last row. Idem for the columns.
+% \begin{macrocode}
+ \int_compare:nNnF \l_@@_last_row_int = { -2 }
+ { \int_decr:N \c@iRow }
+ \int_compare:nNnF \l_@@_last_col_int = { -2 }
+ { \int_decr:N \c@jCol }
+% \end{macrocode}
+%
+% Now, we will create all the |col| nodes and |row| nodes with the informations
+% written in the |aux| file. You use the technique described in the page~1229 of
+% |pgfmanual.pdf|, version~3.1.4b.
+% \begin{macrocode}
+ \pgfsys@markposition { \@@_env: - position }
+ \pgfsys@getposition { \@@_env: - position } \@@_picture_position:
+ \pgfpicture
+ \pgf@relevantforpicturesizefalse
+% \end{macrocode}
+% First, the recreation of the |row| nodes.
+% \begin{macrocode}
+ \int_step_inline:nnn
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 1 }
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 + 1 }
+ {
+ \pgfsys@getposition { \@@_env: - row - ##1 } \@@_node_position:
+ \pgfcoordinate { \@@_env: - row - ##1 }
+ { \pgfpointdiff \@@_picture_position: \@@_node_position: }
+ }
+% \end{macrocode}
+% Now, the recreation of the |col| nodes.
+% \begin{macrocode}
+ \int_step_inline:nnn
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 3 }
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 + 1 }
+ {
+ \pgfsys@getposition { \@@_env: - col - ##1 } \@@_node_position:
+ \pgfcoordinate { \@@_env: - col - ##1 }
+ { \pgfpointdiff \@@_picture_position: \@@_node_position: }
+ }
+% \end{macrocode}
+% Now, you recreate the diagonal nodes by using the |row| nodes and the |col|
+% nodes.
+% \begin{macrocode}
+ \@@_create_diag_nodes:
+% \end{macrocode}
+%
+% \medskip
+% Now, the creation of the cell nodes |(i-j)|.
+% \begin{macrocode}
+ \bool_if:NT \g_@@_recreate_cell_nodes_bool \@@_recreate_cell_nodes:
+ \endpgfpicture
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \bool_if:NT \c_@@_tikz_loaded_bool
+ {
+ \tikzset
+ {
+ every~picture / .style =
+ { overlay , name~prefix = \@@_env: - }
+ }
+ }
+ \cs_set_eq:NN \cellcolor \@@_cellcolor
+ \cs_set_eq:NN \rectanglecolor \@@_rectanglecolor
+ \cs_set_eq:NN \roundedrectanglecolor \@@_roundedrectanglecolor
+ \cs_set_eq:NN \rowcolor \@@_rowcolor
+ \cs_set_eq:NN \rowcolors \@@_rowcolors
+ \cs_set_eq:NN \arraycolor \@@_arraycolor
+ \cs_set_eq:NN \columncolor \@@_columncolor
+ \cs_set_eq:NN \chessboardcolors \@@_chessboardcolors
+ \cs_set_eq:NN \SubMatrix \@@_SubMatrix_in_code_before
+% \end{macrocode}
+% The list of the cells which are in the (empty) corners is stored in the |aux|
+% file because we have to know it before the execution of the |\CodeBefore| (the
+% commands which color the cells, rows and columns won't color the cells which
+% are in the corners).
+% \begin{macrocode}
+ \seq_if_exist:cT
+ { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
+ {
+ \seq_set_eq:Nc \l_@@_corners_cells_seq
+ { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq }
+ }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_exec_code_before:
+ {
+ \seq_gclear_new:N \g_@@_colors_seq
+ \bool_gset_false:N \g_@@_recreate_cell_nodes_bool
+ \group_begin:
+% \end{macrocode}
+%
+% We compose the |code-before| in math mode in order to nullify the spaces put
+% by the user between instructions in the |code-before|.
+% \begin{macrocode}
+ \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
+% \end{macrocode}
+%
+% Here is the |\CodeBefore|. The construction is a bit complicated because
+% |\l_@@_code_before_tl| may begin with keys between square brackets. Moreover,
+% after the analyze of those keys, we sometimes have to decide to do \emph{not}
+% execute the rest of |\l_@@_code_before_tl| (when it is asked for the creation
+% of cell nodes in the |\CodeBefore|). That's why we begin with a |\q_stop|: it
+% will be used to discard the rest of |\l_@@_code_before_tl|.
+% \begin{macrocode}
+ \exp_last_unbraced:NV \@@_CodeBefore_keys: \l_@@_code_before_tl \q_stop
+% \end{macrocode}
+% Now, all the cells which are specified to be colored by instructions in the
+% |\CodeBefore| will actually be colored. It's a two-stages mechanism because we
+% want to draw all the cells with the same color at the same time to absolutely
+% avoid thin white lines in some \textsc{pdf} viewers.
+% \begin{macrocode}
+ \@@_actually_color:
+ \bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
+ \group_end:
+ \bool_if:NT \g_@@_recreate_cell_nodes_bool
+ { \tl_put_left:Nn \@@_node_for_cell: \@@_patch_node_for_cell: }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+\keys_define:nn { NiceMatrix / CodeBefore }
+ {
+ create-cell-nodes .bool_gset:N = \g_@@_recreate_cell_nodes_bool ,
+ create-cell-nodes .default:n = true ,
+ sub-matrix .code:n = \keys_set:nn { NiceMatrix / sub-matrix } { #1 } ,
+ sub-matrix .value_required:n = true ,
+ delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
+ delimiters / color .value_required:n = true ,
+ unknown .code:n = \@@_error:n { Unknown~key~for~CodeAfter }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\NewDocumentCommand \@@_CodeBefore_keys: { O { } }
+ {
+ \keys_set:nn { NiceMatrix / CodeBefore } { #1 }
+ \@@_CodeBefore:w
+ }
+% \end{macrocode}
+%
+% We have extracted the options of the keyword |\CodeBefore| in order to see
+% whether the key |create-cell-nodes| has been used. Now, you can execute the
+% rest of the |\CodeAfter|, excepted, of course, if we are in the first
+% compilation.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_CodeBefore:w #1 \q_stop
+ {
+ \seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq }
+ {
+ \@@_pre_code_before:
+ #1
+ }
+ }
+% \end{macrocode}
+%
+% \bigskip
+%
+%
+% \bigskip
+% By default, if the user uses the |\CodeBefore|, only the |col| nodes, |row|
+% nodes and |diag| nodes are available in that |\CodeBefore|. With the key
+% |create-cell-nodes|, the cell nodes, that is to say the nodes of the form
+% |(i-j)| (but not the extra nodes) are also available because those nodes also
+% are recreated and that recreation is done by the following command.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_recreate_cell_nodes:
+ {
+ \int_step_inline:nnn
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 1 }
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 }
+ {
+ \int_step_inline:nnn
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 3 }
+ { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 }
+ {
+ \cs_if_exist:cT
+ { pgf @ sys @ pdf @ mark @ pos @ \@@_env: - ##1 - ####1 - NW }
+ {
+ \pgfsys@getposition
+ { \@@_env: - ##1 - ####1 - NW }
+ \@@_node_position:
+ \pgfsys@getposition
+ { \@@_env: - ##1 - ####1 - SE }
+ \@@_node_position_i:
+ \@@_pgf_rect_node:nnn
+ { \@@_env: - ##1 - ####1 }
+ { \pgfpointdiff \@@_picture_position: \@@_node_position: }
+ { \pgfpointdiff \@@_picture_position: \@@_node_position_i: }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+%
%
% \bigskip
% \subsection*{The environment \{NiceArrayWithDelims\}}
@@ -8076,7 +8238,7 @@ version 2005/12/01 or later.
% of |{NiceArray}| (|{pNiceArray}|, |{bNiceArray}|, etc.) because, for
% |{NiceArray}|, we have the options |t|, |c|, |b| and |baseline|.
% \begin{macrocode}
- \bool_if:NTF \g_@@_NiceArray_bool
+ \bool_if:NTF \l_@@_NiceArray_bool
{ \keys_set:nn { NiceMatrix / NiceArray } }
{ \keys_set:nn { NiceMatrix / pNiceArray } }
{ #3 , #5 }
@@ -8167,14 +8329,14 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% The construction of the real box is different when |\g_@@_NiceArray_bool| is
+% 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 no delimiter to put (but we have
% tabular notes to put). We begin with this case.
%
% Remark that, in all cases, |@@_use_arraybox_with_notes_c:| is used.
% \begin{macrocode}
- \bool_if:NTF \g_@@_NiceArray_bool
+ \bool_if:NTF \l_@@_NiceArray_bool
{
\str_case:VnF \l_@@_baseline_tl
{
@@ -8338,9 +8500,9 @@ version 2005/12/01 or later.
% the end).
% \begin{macrocode}
\bool_if:NF \l_@@_Matrix_bool
- {
- \@@_newcolumntype w [ 2 ] { \@@_w: { ##1 } { ##2 } }
- \@@_newcolumntype W [ 2 ] { \@@_W: { ##1 } { ##2 } }
+ {
+ \@@_newcolumntype w [ 2 ] { \@@_w: { ##1 } { ##2 } }
+ \@@_newcolumntype W [ 2 ] { \@@_W: { ##1 } { ##2 } }
% \end{macrocode}
%
% First, we have to store our preamble in the token register |\@temptokena|
@@ -8394,18 +8556,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\int_zero:N \l_tmpa_int
% \end{macrocode}
-% We will raise |\l_tmpa_bool| if we are in |{NiceArray}| and that the first
-% letter of the preamble is a opening delimiter (|[|, |(| of |\{|). In that
-% case, the environment |{NiceArray}| will be transformed to an environment of
-% the form |{xNiceArray}| after the construction of the preamble.
-% \begin{macrocode}
- \bool_set_false:N \l_tmpa_bool
-% \end{macrocode}
% Now, we actually patch the preamble (and it is constructed in
% |\g_@@_preamble_tl|).
% \begin{macrocode}
\exp_after:wN \@@_patch_preamble:n \the \@temptokena \q_stop
- \bool_if:NT \l_tmpa_bool { \bool_gset_false:N \g_@@_NiceArray_bool }
\int_gset_eq:NN \g_@@_static_num_of_col_int \c@jCol
}
% \end{macrocode}
@@ -8421,6 +8575,23 @@ version 2005/12/01 or later.
\g_@@_preamble_tl
}
% \end{macrocode}
+%
+% \medskip
+% Now, we can close the TeX group which was opened for the redefinition of
+% the columns of type |w| and |W|.
+% \begin{macrocode}
+ \group_end:
+% \end{macrocode}
+%
+% \medskip
+% If there was delimiters at the beginning or at the end of the preamble, the
+% environment |{NiceArray}| is transformed into an environment |{xNiceMatrix}|.
+% \begin{macrocode}
+ \bool_lazy_or:nnT
+ { ! \str_if_eq_p:Vn \g_@@_left_delim_tl { . } }
+ { ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } }
+ { \bool_set_false:N \l_@@_NiceArray_bool }
+% \end{macrocode}
%
% \bigskip
% We complete the preamble with the potential ``exterior columns''.
@@ -8430,7 +8601,7 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- \g_@@_NiceArray_bool
+ \l_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -8442,7 +8613,7 @@ version 2005/12/01 or later.
{
\bool_lazy_all:nT
{
- \g_@@_NiceArray_bool
+ \l_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
{ \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
@@ -8459,13 +8630,6 @@ version 2005/12/01 or later.
\tl_gput_right:Nn \g_@@_preamble_tl
{ > { \@@_error_too_much_cols: } l }
}
-% \end{macrocode}
-%
-% \medskip
-% Now, we have to close the TeX group which was opened for the redefinition of
-% the columns of type |w| and |W|.
-% \begin{macrocode}
- \group_end:
}
% \end{macrocode}
%
@@ -8488,9 +8652,9 @@ version 2005/12/01 or later.
\@@_w: { \@@_patch_preamble_v:nnnn { } #1 }
\@@_W: { \@@_patch_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
\@@_true_c: { \@@_patch_preamble_vi:n #1 }
- ( { \@@_patch_preamble_vii:n #1 }
- [ { \@@_patch_preamble_vii:n #1 }
- \{ { \@@_patch_preamble_vii:n #1 }
+ ( { \@@_patch_preamble_vii:nn #1 }
+ [ { \@@_patch_preamble_vii:nn #1 }
+ \{ { \@@_patch_preamble_vii:nn #1 }
) { \@@_patch_preamble_viii:nn #1 }
] { \@@_patch_preamble_viii:nn #1 }
\} { \@@_patch_preamble_viii:nn #1 }
@@ -8677,17 +8841,16 @@ version 2005/12/01 or later.
% \medskip
% For |(|, |[| and |\{|.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_patch_preamble_vii:n #1
+\cs_new_protected:Npn \@@_patch_preamble_vii:nn #1 #2
{
- \bool_if:NT \l_@@_small_bool
- { \@@_fatal:n { Delimiter~with~small } }
+ \bool_if:NT \l_@@_small_bool { \@@_fatal:n { Delimiter~with~small } }
% \end{macrocode}
% If we are before the column 1 and not in |{NiceArray}|, we reserve space for
% the left delimiter.
% \begin{macrocode}
\int_compare:nNnTF \c@jCol = \c_zero_int
{
- \bool_if:NTF \g_@@_NiceArray_bool
+ \str_if_eq:VnTF \g_@@_left_delim_tl { . }
{
% \end{macrocode}
% In that case, in fact, the firt letter of the preamble must be considered as
@@ -8695,67 +8858,52 @@ version 2005/12/01 or later.
% \begin{macrocode}
\tl_gset:Nn \g_@@_left_delim_tl { #1 }
\tl_gset:Nn \g_@@_right_delim_tl { . }
-% \end{macrocode}
-% We raise the boolean |\l_tmpa_bool|, which means that the environment
-% |{NiceArray}| will be transformed to |{xNiceArray}|.
-% \begin{macrocode}
- \bool_set_true:N \l_tmpa_bool
- \@@_patch_preamble:n
+ \@@_patch_preamble:n #2
}
{
\tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
\tl_gput_right:Nx \g_@@_internal_code_after_tl
{ \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
- \@@_patch_preamble_vii_i:n
+ \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
+ {
+ \@@_error:nn { delimiter~after~opening } { #2 }
+ \@@_patch_preamble:n
+ }
+ { \@@_patch_preamble:n #2 }
}
}
{
\tl_gput_right:Nx \g_@@_internal_code_after_tl
{ \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
- \@@_patch_preamble_vii_i:n
+ \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
+ {
+ \@@_error:nn { delimiter~after~opening } { #2 }
+ \@@_patch_preamble:n
+ }
+ { \@@_patch_preamble:n #2 }
}
}
% \end{macrocode}
%
-% \bigskip
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_patch_preamble_vii_i:n #1
- {
- \tl_if_in:nnTF { ( [ \{ ) ] \} } { #1 }
- {
- \@@_error:nn { delimiter~after~opening } { #1 }
- \@@_patch_preamble:n
- }
- { \@@_patch_preamble:n #1 }
- }
-% \end{macrocode}
%
% \bigskip
% For |)|, |]| and |\}|. We have two arguments for the following command because
% we directly read the following letter in the preamble (we have to see whether
% we have a opening delimiter following and we also have to see whether we are
% at the end of the preamble because, in that case, our letter must be
-% considered as the right delimiter of the environment).
+% considered as the right delimiter of the environment if the environment is
+% |{NiceArray}|).
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_viii:nn #1 #2
{
- \bool_if:NT \l_@@_small_bool
- { \@@_fatal:n { Delimiter~with~small } }
+ \bool_if:NT \l_@@_small_bool { \@@_fatal:n { Delimiter~with~small } }
\tl_if_in:nnTF { ) ] \} } { #2 }
- {
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
- { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
- \@@_error:nn { double~closing~delimiter } { #2 }
- \@@_patch_preamble:n
- }
+ { \@@_patch_preamble_viii_i:nnn #1 #2 }
{
\tl_if_eq:nnTF { \q_stop } { #2 }
{
- \bool_if:NTF \g_@@_NiceArray_bool
- {
- \tl_gset:Nn \g_@@_right_delim_tl { #1 }
- \bool_set_true:N \l_tmpa_bool
- }
+ \str_if_eq:VnTF \g_@@_right_delim_tl { . }
+ { \tl_gset:Nn \g_@@_right_delim_tl { #1 } }
{
\tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
\tl_gput_right:Nx \g_@@_internal_code_after_tl
@@ -8774,7 +8922,34 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_preamble_viii_i:nnn #1 #2 #3
+ {
+ \tl_if_eq:nnTF { \q_stop } { #3 }
+ {
+ \str_if_eq:VnTF \g_@@_right_delim_tl { . }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \tl_gset:Nn \g_@@_right_delim_tl { #2 }
+ }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \@@_error:nn { double~closing~delimiter } { #2 }
+ }
+ }
+ {
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool }
+ \@@_error:nn { double~closing~delimiter } { #2 }
+ \@@_patch_preamble:n #3
+ }
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\cs_new_protected:Npn \@@_patch_preamble_xi:n #1
{
@@ -9510,7 +9685,7 @@ version 2005/12/01 or later.
\hbox_overlap_left:n
{
\dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim
- \@@_node_for_the_cell:
+ \@@_node_for_cell:
{ \box_use_drop:N \l_@@_cell_box }
\skip_horizontal:N \l_@@_left_delim_dim
\skip_horizontal:N \l_@@_left_margin_dim
@@ -9591,7 +9766,7 @@ version 2005/12/01 or later.
\skip_horizontal:N \l_@@_right_delim_dim
\skip_horizontal:N \l_@@_right_margin_dim
\skip_horizontal:N \l_@@_extra_right_margin_dim
- \@@_node_for_the_cell:
+ \@@_node_for_cell:
}
}
\bool_gset_false:N \g_@@_empty_cell_bool
@@ -9602,19 +9777,19 @@ version 2005/12/01 or later.
%
% \interitem
% The environment |{NiceArray}| is constructed upon the environment
-% |{NiceArrayWithDelims}| but, in fact, there is a flag |\g_@@_NiceArray_bool|.
+% |{NiceArrayWithDelims}| but, in fact, there is a flag |\l_@@_NiceArray_bool|.
% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is
% raised.
% \begin{macrocode}
\NewDocumentEnvironment { NiceArray } { }
{
- \bool_gset_true:N \g_@@_NiceArray_bool
+ \bool_set_true:N \l_@@_NiceArray_bool
\str_if_empty:NT \g_@@_name_env_str
{ \str_gset:Nn \g_@@_name_env_str { NiceArray } }
% \end{macrocode}
% We put . and . for the delimiters but, in fact, that doesn't matter because
% these arguments won't be used in |{NiceArrayWithDelims}| (because the flag
-% |\g_@@_NiceArray_bool| is raised).
+% |\l_@@_NiceArray_bool| is raised).
% \begin{macrocode}
\NiceArrayWithDelims . .
}
@@ -9803,7 +9978,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% If the key |code-before| is used, we have to write on the |aux| file the actual
-% size of the array.
+% size of the array and other informations.
% \begin{macrocode}
\bool_if:NT \l_@@_code_before_bool
{
@@ -9837,12 +10012,13 @@ version 2005/12/01 or later.
{ c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq }
{ \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , }
}
+ \iow_now:Nn \@mainaux \ExplSyntaxOff
}
% \end{macrocode}
%
% \medskip
% Now, you create the diagonal nodes by using the |row| nodes and the |col|
-% nodes. If the engine is |xetex| or |luatex| we also create the ``½ nodes''.
+% nodes.
% \begin{macrocode}
\@@_create_diag_nodes:
% \end{macrocode}
@@ -10020,9 +10196,12 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \begin{macrocode}
+ % \bool_if:NT \l_@@_code_before_bool \@@_write_aux_for_cell_nodes:
+% \end{macrocode}
+%
% \medskip
% \begin{macrocode}
- \bool_gset_false:N \g_@@_NiceArray_bool
\str_gclear:N \g_@@_name_env_str
\@@_restore_iRow_jCol:
% \end{macrocode}
@@ -10040,12 +10219,14 @@ version 2005/12/01 or later.
% \bigskip
% The following command will extract the potential options (between square
% brackets) at the beginning of the |\CodeAfter| (that is to say, when
-% |\CodeAfter| is used, the options of that ``command'' |\CodeAfter|).
+% |\CodeAfter| is used, the options of that ``command'' |\CodeAfter|). Idem for
+% the |\CodeBefore.|
% \begin{macrocode}
\NewDocumentCommand \@@_CodeAfter_keys: { O { } }
{ \keys_set:nn { NiceMatrix / CodeAfter } { #1 } }
% \end{macrocode}
%
+%
%
% \bigskip
% We remind that the first mandatory argument of the command |\Block| is the
@@ -10144,6 +10325,53 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
+% \bigskip
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_write_aux_for_cell_nodes:
+ {
+ \pgfpicture
+ \pgfrememberpicturepositiononpagetrue
+ \pgf@relevantforpicturesizefalse
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ {
+ \int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int
+ {
+ \cs_if_exist:cT { pgf @ sh @ ns @ \@@_env: - ##1 - ####1 }
+ {
+ \pgfscope
+ \pgftransformshift
+ { \pgfpointanchor { \@@_env: - ##1 - ####1 } { north~west } }
+ \pgfnode
+ { rectangle }
+ { center }
+ {
+ \hbox
+ { \pgfsys@markposition { \@@_env: - ##1 - ####1 - NW } }
+ }
+ { }
+ { }
+ \endpgfscope
+ \pgfscope
+ \pgftransformshift
+ { \pgfpointanchor { \@@_env: - ##1 - ####1 } { south~east } }
+ \pgfnode
+ { rectangle }
+ { center }
+ {
+ \hbox
+ { \pgfsys@markposition { \@@_env: - ##1 - ####1 - SE } }
+ }
+ { }
+ { }
+ \endpgfscope
+ }
+ }
+ }
+ \endpgfpicture
+ \@@_create_extra_nodes:
+ }
+% \end{macrocode}
%
% \bigskip
% The following command creates the diagonal nodes (in fact, if the matrix is
@@ -12765,8 +12993,8 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_draw_vlines:
{
\int_step_inline:nnn
- { \bool_if:NTF \g_@@_NiceArray_bool 1 2 }
- { \bool_if:NTF \g_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol }
+ { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
+ { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol }
{
\tl_if_eq:NnF \l_@@_vlines_clist { all }
{ \clist_if_in:NnT \l_@@_vlines_clist { ##1 } }
@@ -12939,8 +13167,8 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_draw_hlines:
{
\int_step_inline:nnn
- { \bool_if:NTF \g_@@_NiceArray_bool 1 2 }
- { \bool_if:NTF \g_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow }
+ { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
+ { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow }
{
\tl_if_eq:NnF \l_@@_hlines_clist { all }
{ \clist_if_in:NnT \l_@@_hlines_clist { ##1 } }
@@ -13377,14 +13605,14 @@ version 2005/12/01 or later.
% We do a reduction by |\arraycolsep| for the environments with delimiters (and
% not for the other).
% \begin{macrocode}
- \bool_if:NTF \g_@@_NiceArray_bool \c_zero_dim \arraycolsep
+ \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep
- \l_@@_left_margin_dim
}
\@@_qpoint:n { col - \@@_succ:n \c@jCol }
\dim_set:Nn \l_@@_x_final_dim
{
\pgf@x -
- \bool_if:NTF \g_@@_NiceArray_bool \c_zero_dim \arraycolsep
+ \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep
+ \l_@@_right_margin_dim
}
% \end{macrocode}
@@ -13545,7 +13773,8 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \bigskip
+%
+%
% \subsection*{The extra nodes}
%
% First, two variants of the functions |\dim_min:nn| and |\dim_max:nn|.
@@ -13558,7 +13787,7 @@ version 2005/12/01 or later.
% \bigskip
% The following command is called in |\@@_use_arraybox_with_notes_c:| just
% before the construction of the blocks (if the creation of medium nodes is
-% required, medium nodes are also created for the blocks dans that construction
+% required, medium nodes are also created for the blocks and that construction
% uses the standard medium nodes).
% \begin{macrocode}
\cs_new_protected:Npn \@@_create_extra_nodes:
@@ -14570,7 +14799,7 @@ version 2005/12/01 or later.
%
% \medskip
% If the creation of the ``medium nodes'' is required, we create a ``medium
-% node'' for the block. The function |\@@_pgf_rect_node:nnnnn| takes in as
+% node'' for the block. The function |\@@_pgf_rect_node:nnn| takes in as
% arguments the name of the node and two \textsc{pgf} points.
% \begin{macrocode}
\bool_if:NT \l_@@_medium_nodes_bool
@@ -15013,13 +15242,14 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% We define also an command |\AutoNiceMatrix| similar to the environment |{NiceMatrix}|.
+% We define also a command |\AutoNiceMatrix| similar to the environment |{NiceMatrix}|.
% \begin{macrocode}
\NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } }
{
- \bool_gset_true:N \g_@@_NiceArray_bool
+ \group_begin:
+ \bool_set_true:N \l_@@_NiceArray_bool
\AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ]
- \bool_gset_false: \g_@@_NiceArray_bool
+ \group_end:
}
% \end{macrocode}
%
@@ -16010,17 +16240,6 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
-% \medskip
-% The following message will be deleted when we will delete the key
-% |delimiters-color| (and keep only the key |delimiters/color|).
-% \begin{macrocode}
-\@@_msg_new:nn { delimiters-color deleted }
- {
- The~key~'delimiters-color'~has~been~renamed~'delimiters/color'.\\
- ~However,~you~can~go~on~for~this~time.
- }
-% \end{macrocode}
-%
% \begin{macrocode}
\seq_new:N \c_@@_types_of_matrix_seq
\seq_set_from_clist:Nn \c_@@_types_of_matrix_seq
@@ -16579,7 +16798,7 @@ version 2005/12/01 or later.
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
- delimiters/color,~
+ delimiters~(several~subkeys),~
end-of-row,~
first-col,~
first-row,~
@@ -16689,7 +16908,7 @@ version 2005/12/01 or later.
create-extra-nodes,~
create-medium-nodes,~
create-large-nodes,~
- delimiters/color,~
+ delimiters~(several~subkeys),~
extra-left-margin,~
extra-right-margin,~
first-col,~
@@ -17271,6 +17490,9 @@ version 2005/12/01 or later.
% It's now possible to specify delimiters for submatrices in the preamble of an
% environment.
%
+%
+% \subsection*{Changes between versions 5.15 and 5.16}
+%
% \PrintIndex
%
% \tableofcontents