diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 108 |
1 files changed, 82 insertions, 26 deletions
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 |