summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-09-17 21:02:28 +0000
committerKarl Berry <karl@freefriends.org>2018-09-17 21:02:28 +0000
commit7fa2af4037cdfb32ad97085be2e239b2cec7a593 (patch)
treef314de6cc55fcbcfe1e5a91d92d48f05e34da99e
parentc534f509d61c29eafdd2e650cd50caac0143f34a (diff)
nicematrix (17sep18)
git-svn-id: svn://tug.org/texlive/trunk@48685 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdfbin369259 -> 370325 bytes
-rw-r--r--Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx108
-rw-r--r--Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty44
3 files changed, 108 insertions, 44 deletions
diff --git a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
index f303bc90179..4a4306c9a63 100644
--- a/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
+++ b/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
index 753cebb6e9b..8994c044fc2 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{2.1}
-\def\myfiledate{2018/08/12}
+\def\myfileversion{2.1.1}
+\def\myfiledate{2018/09/16}
%
%
%<*batchfile>
@@ -1301,6 +1301,29 @@ version 2005/12/01 or later.
% possible to use |-- cycle| in |code-after|.
%
%
+% \subsection{Compatibility with dcolumn}
+%
+% If we want to make \pkg{nicematrix} compatible with \pkg{dcolumn}, it's necessary to patch the commands
+% |\DC@endcentre| and |\DC@endright| as follow.
+%
+% \bigskip
+% |\def\DC@endcentre{$\egroup|
+%
+% |\ifdim \wd\z@>\wd\tw@|
+%
+% |\setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}%|
+%
+% |\else|
+%
+% |\setbox\z@=\hbox to\wd\tw@{\hfill\unhbox\z@}\fi|
+%
+% |\@@_Cell:\box\z@\box\tw@ \@@_end_Cell:}|
+%
+% \medskip
+% |\def\DC@endright{$\hfil\egroup \@@_Cell:\box\z@\box\tw@ \@@_end_Cell:}|
+%
+%
+%
% \section{Examples}
%
% \subsection{Dotted lines}
@@ -1843,7 +1866,7 @@ version 2005/12/01 or later.
% \subsection{Declaration of the package and extensions loaded}
%
% First, \pkg{tikz} and the Tikz library |fit| are loaded before the |\ProvidesExplPackage|.
-% They are loaded this way because |\usetifkzlibrary| in |expl3| code fails.\footnote{cf.
+% They are loaded this way because |\usetikzlibrary| in |expl3| code fails.\footnote{cf.
% |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|}
%
%
@@ -2042,9 +2065,10 @@ version 2005/12/01 or later.
\dim_new:N \g_@@_extra_right_margin_dim
% \end{macrocode}
%
+%
% \bigskip
% We define a set of options which will be used with the command |NiceMatrixOptions|.\footnote{Before the version
-% 1.3, the names of the options were in ``caml style'' (like |ParallelizeDiagonals|) which was not a good idea. In
+% 1.3, the names of the options were in ``camel-case style'' (like |ParallelizeDiagonals|) which was not a good idea. In
% version 1.4, the names are converted in lowercase with hyphens (like |parallelize-diags|). For compatibility, the
% old names are conversed.}
% \begin{macrocode}
@@ -2094,7 +2118,14 @@ version 2005/12/01 or later.
code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl,
code-for-last-col .value_required:n = true,
% \end{macrocode}
-%
+%
+% \bigskip
+% Idem for the first row in environments like |{pNiceArrayRC}|.
+% \begin{macrocode}
+ code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl,
+ code-for-first-row .value_required:n = true,
+% \end{macrocode}
+%
% \bigskip
% The option |exterior-arraycolsep| will have effect only in |{NiceArray}| for those who want to have for
% |{NiceArray}| the same behaviour as |{array}|.
@@ -2134,7 +2165,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\msg_new:nnnn {nicematrix}
{Unknown~key~for~NiceMatrixOptions}
- {The~key~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~command
+ {The~key~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~command~
\token_to_str:N \NiceMatrixOptions.\\
If~you~go~on,~it~will~be~ignored.\\
For~a~list~of~the~available~keys,~type~H~<return>.}
@@ -2324,7 +2355,7 @@ version 2005/12/01 or later.
\int_gincr:N \g_@@_column_int
% \end{macrocode}
% Now, we increment the counter of the rows. We don't do this incrementation in the |\everycr| because some
-% packages, like \pkg{arydsln}, creates special rows in the |\halign| that we don't want to take into account.
+% packages, like \pkg{arydshln}, creates special rows in the |\halign| that we don't want to take into account.
% \begin{macrocode}
\int_compare:nNnT \g_@@_column_int = 1
{\int_gincr:N \g_@@_row_int}
@@ -2435,6 +2466,13 @@ version 2005/12/01 or later.
\NewDocumentEnvironment {NiceArray} {O{} m O{}}
{\cs_if_exist:NT \@@_in_NiceArray:
{\@@_msg_error:n {We~are~yet~in~an~environment~NiceArray}}
+% \end{macrocode}
+% We deactivate Tikz externalization (since we use Tikz pictures with the options |overlay| and
+% |remember picture|, there would be errors).
+% \begin{macrocode}
+ \ifcsname tikz@library@external@loaded\endcsname
+ \tikzset{external/export = false}
+ \fi
\cs_set:Npn \@@_in_NiceArray: {--Void--}
\aftergroup \@@_after_array:
\tl_gclear_new:N \g_@@_lines_to_draw_tl
@@ -2773,9 +2811,14 @@ version 2005/12/01 or later.
%
% \subsection{After the construction of the array}
%
+% First, we deactivate Tikz externalization (since we use Tikz pictures with the options |overlay| and
+% |remember picture|, there would be errors).
% \begin{macrocode}
\cs_new_protected:Nn \@@_after_array:
- {
+ {\group_begin:
+ \ifcsname tikz@library@external@loaded\endcsname
+ \tikzset{external/export = false}
+ \fi
% \end{macrocode}
% Now, the definition of the counters |\g_@@_column_int| and |\g_@@_column_total_int| change: |\g_@@_column_int|
% will be the number of columns without the exterior column (in an environment like |{pNiceArrayC}|) and
@@ -2835,7 +2878,6 @@ version 2005/12/01 or later.
% \bigskip
% Now, the |code-after|.
% \begin{macrocode}
- \group_begin:
\tikzset{every~picture/.style = {overlay,
remember~picture,
name~prefix = nm-\int_use:N \g_@@_env_int-}}
@@ -3424,6 +3466,8 @@ version 2005/12/01 or later.
\dim_zero_new:N \g_@@_y_initial_dim
\dim_zero_new:N \g_@@_x_final_dim
\dim_zero_new:N \g_@@_y_final_dim
+ \@@_bool_new:N \l_@@_initial_open_bool
+ \@@_bool_new:N \l_@@_final_open_bool
\begin{tikzpicture}
\path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
\tikz@parse@node\pgfutil@firstofone (i)
@@ -3569,19 +3613,9 @@ version 2005/12/01 or later.
% |\hbox_set:Nw \l_tmpa_box| ... |\hbox_set_end:|.
% \begin{macrocode}
>{\int_gincr:N \g_@@_column_int
- \int_gset:Nn \g_@@_column_total_int
+ \int_gset:Nn \g_@@_column_total_int
{\int_max:nn \g_@@_column_total_int \g_@@_column_int}
- \hbox_set:Nw \l_tmpa_box
- \tikz[remember~picture, inner~sep=0pt, minimum~width=0pt, baseline]
- \node [anchor=base,
- name = nm-\int_use:N \g_@@_env_int-
- \int_use:N \g_@@_row_int-
- \int_use:N \g_@@_column_int,
- alias = \tl_if_empty:NF \l_@@_name_tl
- {\l_@@_name_tl-
- \int_use:N \g_@@_row_int-
- \int_use:N \g_@@_column_int}]
- \bgroup $ % $
+ \hbox_set:Nw \l_tmpa_box $ % $
\l_@@_code_for_last_col_tl
}
l
@@ -3591,7 +3625,6 @@ version 2005/12/01 or later.
% of the cells of the last column (thus, it will be equal to the width of the last column).
% \begin{macrocode}
<{ $ % $
- \egroup ;
\hbox_set_end:
\dim_gset:Nn \g_@@_width_last_col_dim
{\dim_max:nn \g_@@_width_last_col_dim
@@ -3600,11 +3633,20 @@ version 2005/12/01 or later.
% \end{macrocode}
% The content of the cell is inserted in an overlapping position.
% \begin{macrocode}
- \hbox_overlap_right:n
- {\skip_horizontal:n
- { 2\arraycolsep + \l_@@_right_margin_dim
+ \hbox_overlap_right:n
+ {\skip_horizontal:n
+ { 2\arraycolsep + \l_@@_right_margin_dim
+ \l_@@_extra_right_margin_dim}
- \box_use:N \l_tmpa_box}}}}
+ \tikz[remember~picture, inner~sep=0pt, minimum~width=0pt, baseline]
+ \node [anchor=base,
+ name = nm-\int_use:N \g_@@_env_int-
+ \int_use:N \g_@@_row_int-
+ \int_use:N \g_@@_column_int,
+ alias = \tl_if_empty:NF \l_@@_name_tl
+ {\l_@@_name_tl-
+ \int_use:N \g_@@_row_int-
+ \int_use:N \g_@@_column_int}]
+ {\box_use:N \l_tmpa_box} ; } }}}
% \end{macrocode}
% This ends the preamble of the array that will be constructed (a rather long preamble, indeed).
%
@@ -3675,6 +3717,7 @@ version 2005/12/01 or later.
nullify-dots .bool_set:N = \l_@@_nullify_dots_bool ,
nullify-dots .default:n = true,
code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl,
+ code-for-first-row .value_required:n = true,
code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl,
code-for-last-col .value_required:n = true,
columns-width .code:n = \str_if_eq:nnTF {#1} {auto}
@@ -4037,6 +4080,7 @@ version 2005/12/01 or later.
{\begin{BNiceMatrix}}
{\end{BNiceMatrix}}}
% \end{macrocode}
+%
%
% \section{History}
%
@@ -4084,6 +4128,18 @@ version 2005/12/01 or later.
% The package \pkg{nicematrix} no longer loads \pkg{mathtools} but only \pkg{amsmath}.
%
% Creation of ``medium nodes'' and ``large nodes''.
+%
+% \subsection{Changes between version 2.1 and 2.1.1}
+%
+% Small corrections: for example, the option |code-for-first-row| is now available in the command |\NiceMatrixOptions|.
+%
+% Following a discussion on
+% TeX StackExchange\footnote{cf. |tex.stackexchange.com/questions/450841/tikz-externalize-and-nicematrix-package|},
+% Tikz externalization is now deactivated in the environments of the
+% extension \pkg{nicematrix}.\footnote{Before this version, there was an error when using \pkg{nicematrix} with
+% Tikz externalization. In any case, it's not possible to externalize the Tikz elements constructed by
+% \pkg{nicematrix} because they use the options |overlay| and |remember picture|.}
+%
% \endinput
% Local Variables:
% TeX-fold-mode: nil
diff --git a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
index 700a079f4d8..2b86f50602f 100644
--- a/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
+++ b/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
@@ -18,8 +18,8 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{2.1}
-\def\myfiledate{2018/08/12}
+\def\myfileversion{2.1.1}
+\def\myfiledate{2018/09/16}
\RequirePackage{tikz}
\usetikzlibrary{fit}
\RequirePackage{l3keys2e}
@@ -91,6 +91,8 @@
NullifyDots .meta:n = nullify-dots,
code-for-last-col .tl_set:N = \l__nm_code_for_last_col_tl,
code-for-last-col .value_required:n = true,
+ code-for-first-row .tl_set:N = \l__nm_code_for_first_row_tl,
+ code-for-first-row .value_required:n = true,
exterior-arraycolsep .bool_set:N = \l__nm_exterior_arraycolsep_bool ,
exterior-arraycolsep .default:n = true,
columns-width .code:n = \str_if_eq:nnTF {#1} {auto}
@@ -105,7 +107,7 @@
unknown .code:n = \__nm_msg_error:n {Unknown~key~for~NiceMatrixOptions}}
\msg_new:nnnn {nicematrix}
{Unknown~key~for~NiceMatrixOptions}
- {The~key~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~command
+ {The~key~"\tl_use:N\l_keys_key_tl"~is~unknown~for~the~command~
\token_to_str:N \NiceMatrixOptions.\\
If~you~go~on,~it~will~be~ignored.\\
For~a~list~of~the~available~keys,~type~H~<return>.}
@@ -285,6 +287,9 @@
\NewDocumentEnvironment {NiceArray} {O{} m O{}}
{\cs_if_exist:NT \__nm_in_NiceArray:
{\__nm_msg_error:n {We~are~yet~in~an~environment~NiceArray}}
+ \ifcsname tikz@library@external@loaded\endcsname
+ \tikzset{external/export = false}
+ \fi
\cs_set:Npn \__nm_in_NiceArray: {--Void--}
\aftergroup \__nm_after_array:
\tl_gclear_new:N \g__nm_lines_to_draw_tl
@@ -427,7 +432,10 @@
{\int_use:N \g__nm_row_int}
{\int_use:N \g__nm_column_int}}}
\cs_new_protected:Nn \__nm_after_array:
- {
+ {\group_begin:
+ \ifcsname tikz@library@external@loaded\endcsname
+ \tikzset{external/export = false}
+ \fi
\int_gset_eq:NN \g__nm_column_int \g__nm_column_total_int
\bool_if:NT \l__nm_exterior_column_bool {\int_gdecr:N \g__nm_column_int}
\seq_gclear_new:N \g__nm_yet_drawn_seq
@@ -448,7 +456,6 @@
\__nm_bool_new:N \l__nm_final_open_bool
\g__nm_lines_to_draw_tl}
\tl_gclear:N \g__nm_lines_to_draw_tl
- \group_begin:
\tikzset{every~picture/.style = {overlay,
remember~picture,
name~prefix = nm-\int_use:N \g__nm_env_int-}}
@@ -757,6 +764,8 @@
\dim_zero_new:N \g__nm_y_initial_dim
\dim_zero_new:N \g__nm_x_final_dim
\dim_zero_new:N \g__nm_y_final_dim
+ \__nm_bool_new:N \l__nm_initial_open_bool
+ \__nm_bool_new:N \l__nm_final_open_bool
\begin{tikzpicture}
\path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
\tikz@parse@node\pgfutil@firstofone (i)
@@ -841,22 +850,11 @@
>{\int_gincr:N \g__nm_column_int
\int_gset:Nn \g__nm_column_total_int
{\int_max:nn \g__nm_column_total_int \g__nm_column_int}
- \hbox_set:Nw \l_tmpa_box
- \tikz[remember~picture, inner~sep=0pt, minimum~width=0pt, baseline]
- \node [anchor=base,
- name = nm-\int_use:N \g__nm_env_int-
- \int_use:N \g__nm_row_int-
- \int_use:N \g__nm_column_int,
- alias = \tl_if_empty:NF \l__nm_name_tl
- {\l__nm_name_tl-
- \int_use:N \g__nm_row_int-
- \int_use:N \g__nm_column_int}]
- \bgroup $ % $
+ \hbox_set:Nw \l_tmpa_box $ % $
\l__nm_code_for_last_col_tl
}
l
<{ $ % $
- \egroup ;
\hbox_set_end:
\dim_gset:Nn \g__nm_width_last_col_dim
{\dim_max:nn \g__nm_width_last_col_dim
@@ -866,7 +864,16 @@
{\skip_horizontal:n
{ 2\arraycolsep + \l__nm_right_margin_dim
+ \l__nm_extra_right_margin_dim}
- \box_use:N \l_tmpa_box}}}}
+ \tikz[remember~picture, inner~sep=0pt, minimum~width=0pt, baseline]
+ \node [anchor=base,
+ name = nm-\int_use:N \g__nm_env_int-
+ \int_use:N \g__nm_row_int-
+ \int_use:N \g__nm_column_int,
+ alias = \tl_if_empty:NF \l__nm_name_tl
+ {\l__nm_name_tl-
+ \int_use:N \g__nm_row_int-
+ \int_use:N \g__nm_column_int}]
+ {\box_use:N \l_tmpa_box} ; } }}}
\NewDocumentEnvironment{NiceArrayCwithDelims} {mm O{} m O{}}
{\dim_gzero_new:N \g__nm_width_last_col_dim
\keys_set:nn {NiceMatrix/NiceArrayC} {#3,#5}
@@ -901,6 +908,7 @@
nullify-dots .bool_set:N = \l__nm_nullify_dots_bool ,
nullify-dots .default:n = true,
code-for-first-row .tl_set:N = \l__nm_code_for_first_row_tl,
+ code-for-first-row .value_required:n = true,
code-for-last-col .tl_set:N = \l__nm_code_for_last_col_tl,
code-for-last-col .value_required:n = true,
columns-width .code:n = \str_if_eq:nnTF {#1} {auto}