texlive[46747] Master/texmf-dist: nicematrix (27feb18)

commits+karl at tug.org commits+karl at tug.org
Tue Feb 27 00:16:50 CET 2018


Revision: 46747
          http://tug.org/svn/texlive?view=revision&revision=46747
Author:   karl
Date:     2018-02-27 00:16:50 +0100 (Tue, 27 Feb 2018)
Log Message:
-----------
nicematrix (27feb18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/nicematrix/README.md
    trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
    trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
    trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nicematrix/README.md	2018-02-26 23:16:27 UTC (rev 46746)
+++ trunk/Master/texmf-dist/doc/latex/nicematrix/README.md	2018-02-26 23:16:50 UTC (rev 46747)
@@ -5,5 +5,4 @@
 This extension is entirely contained in a single file : nicematrix.sty
 
 The LaTeX package nicematrix gives an environment NiceMatrix which is similar to environment
-matrix of mathtools but gives the possibility to draw beautiful ellipis dots between the cells 
-of the matrix.
\ No newline at end of file
+matrix but gives the possibility to draw ellipis dots between the cells of the matrix.
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/nicematrix/nicematrix.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2018-02-26 23:16:27 UTC (rev 46746)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2018-02-26 23:16:50 UTC (rev 46747)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{1.0}
-\def\myfiledate{2018/02/13}
+\def\myfileversion{1.1}
+\def\myfiledate{2018/02/26}
 %
 %
 %<*batchfile>
@@ -26,7 +26,7 @@
 \usedir{tex/latex/nicematrix}
 \preamble
 
-Copyright (C) 2017 by F. Pantigny
+Copyright (C) 2018 by F. Pantigny
 -----------------------------------
 
 This file may be distributed and/or modified under the
@@ -46,20 +46,15 @@
 %
 %<@@=nm>
 %<*driver>
-\documentclass{l3doc} % load fancyvrb, amsmath, array, color, etc.
+\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix)
 \VerbatimFootnotes
 \usepackage{xltxtra}
-\usepackage{lmodern}
 \usepackage{geometry}
-\usepackage[dvipsnames]{xcolor} % color is already loaded with l3doc (?)
 \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
-\usepackage{mathtools}
-\usepackage{amsfonts}
-\usepackage{stmaryrd}
 \usepackage{nicematrix}
 \NewDocumentEnvironment {scope} {} {} {}
 \def\interitem{\vskip 7mm plus 2 mm minus 3mm}          
-\def\emphase#1{{\color{RoyalPurple}#1}}
+\def\emphase{\bgroup\color{RoyalPurple}\let\next=}
 \fvset{commandchars=\~\#\@,formatcom={\color{gray}}}
 \parindent 0pt
 \DisableCrossrefs
@@ -83,8 +78,7 @@
 %
 % This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by the classical workflow
 % |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two compilations may be necessary. This package requires the
-% packages \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{mathtools} and \pkg{tikz}. The Tikz
-% libraries \pkg{calc} and \pkg{math} are also required.
+% packages \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{mathtools} and \pkg{tikz}. 
 %
 % \medskip
 % The package \pkg{nicematrix} aims to draw beautiful matrices in a way almost transparent for the user.
@@ -141,7 +135,9 @@
 % Inside these environments, five new commands are defined: |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots| and |\Iddots|.
 % These commands are intended to be used in place of |\dots|, |\cdots|, |\vdots|, |\ddots| and
 % |\iddots|.\footnote{The command |\iddots|, defined in \pkg{nicematrix}, is a variant of 
-% |\ddots| with dots going forward: \smash{$\iddots$}. If |mathdots| is loaded, the version of |mathdots| is used.}
+% |\ddots| with dots going forward: \smash{$\iddots$}. If the command |\iddots| is already defined (for example if
+% \pkg{mathdots} is loaded), the previous definition is not overwritten. Note that the package \pkg{yhmath} provides a
+% command |\adots| similar to |\iddots|.} 
 %
 % \smallskip
 % Each of them must be used alone in the cell of the array and it draws a dotted line between the first non-empty
@@ -207,7 +203,7 @@
 %
 % However, useless computations are performed by TeX before detecting that both instructions would eventually yield
 % the same dotted line. That's why the package \pkg{nicematrix} provides starred versions of |\Ldots|, |\Cdots|,
-% etc.: |\Ldots*|, |\Cdots*|, etc.. These versions are simply equivalent to |\hphantom{\ldots}|,
+% etc.: |\Ldots*|, |\Cdots*|, etc. These versions are simply equivalent to |\hphantom{\ldots}|,
 % |\hphantom{\cdots}|, etc. The user should use these starred versions whenever a classical version has already
 % been used for the same dotted line.\par\nobreak
 % \bigskip
@@ -484,9 +480,11 @@
 % \vskip1cm
 % \subsection{The ``empty'' cells}
 % 
-% An instruction like |\Ldots|, |\Cdots|, etc. tries to determine the first non-empty cell on both sides. However,
-% a empty cell is not necessarily a cell with no TeX content (that is to say a cell with no token between the two
-% ampersands~|&|). Indeed, a cell with contents |\hspace*{1cm}| may be considered as empty.
+% An instruction like |\Ldots|, |\Cdots|, etc. tries to determine the first non-empty cell on both
+% sides\footnote{If \pkg{nicematrix} can't find theses cells, an error |Imposible instruction| is raised. Nevertheless,
+% with the option |Silent|, these instructions are discarded silently.}. However, a empty cell is not necessarily a
+% cell with no TeX content (that is to say a cell with no token between the two ampersands~|&|). Indeed, a cell
+% with contents |\hspace*{1cm}| may be considered as empty.
 %
 % \interitem
 % For \pkg{nicematrix}, the precise rules are as follow.
@@ -608,18 +606,8 @@
 %
 % \subsection{Declaration of the package and extensions loaded}
 %
-%
-% First, Tikz and the Tikz libraries \pkg{calc} and \pkg{math} are loaded before the |\ProvidesExplPackage|. 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|}
-% 
-%    \begin{macrocode}
-\RequirePackage{tikz}
-\usetikzlibrary{calc,math}
-%    \end{macrocode}
-%
 % \bigskip
-% Then, we can give the traditionnal declaration of a package written with |expl3|:
+% We give the traditionnal declaration of a package written with |expl3|:
 %    \begin{macrocode}
 \RequirePackage{l3keys2e}
 \ProvidesExplPackage
@@ -632,10 +620,11 @@
 % The command for the treatment of the options of |\usepackage| is at the end of this package for technical reasons.
 %
 % \bigskip
-% We load \pkg{array} and \pkg{mathtools} (\pkg{mathtools} may be considered as the successor of \pkg{amsmath}).
+% We load \pkg{array} and \pkg{mathtools} (\pkg{mathtools} may be considered as the successor of \pkg{amsmath}) and \pkg{tikz}.
 %    \begin{macrocode}
 \RequirePackage{array}
 \RequirePackage{mathtools}
+\RequirePackage{tikz}
 %    \end{macrocode}
 %
 % \bigskip 
@@ -649,19 +638,19 @@
 % \subsection{Technical  definitions}
 %
 % First, we define a command |\iddots| similar to |\ddots| ($\ddots$) but with dots going forward ($\iddots$). We
-% use |\ProvideDocumentCommand|, and so, if the command |\iddots| has already been defined (for example by the
-% package \pkg{mathdots}), we don't define it again.
+% use |\ProvideDocumentCommand| of \pkg{xparse}, and so, if the command |\iddots| has already been defined (for
+% example by the package \pkg{mathdots}), we don't define it again.
 % 
 %    \begin{macrocode}
 \ProvideDocumentCommand \iddots {}
       {\mathinner{\mkern 1mu 
-                  \raise 1pt \hbox{.}
+                  \raise \p@ \hbox{.}
                   \mkern 2mu
-                  \raise 4pt\hbox{.}
+                  \raise 4\p@ \hbox{.}
                   \mkern 2mu
-                  \raise7pt \vbox{\kern 7pt 
-                                  \hbox{.}}
-                  \mkern1mu}}
+                  \raise 7\p@ \vbox{\kern 7pt 
+                                    \hbox{.}}
+                  \mkern 1mu}}
 %    \end{macrocode}
 %
 % This definition is a variant of the standard definition of |\ddots|.
@@ -742,10 +731,20 @@
 % classical |{matrix}| and |\ldots|, |\vdots|, etc.). This option is set by default.
 %    \begin{macrocode}
       NullifyDots          .bool_set:N = \l_@@_nullify_dots_bool ,
-      NullifyDots          .default:n  = true}
+      NullifyDots          .default:n  = true,
 %    \end{macrocode}
 %
 % \bigskip
+% With the option |Silent|, no error is generated for the impossible instructions. This option can be useful when
+% adapting an existing code. 
+%    \begin{macrocode}
+     Silent                .code:n  = {\msg_redirect_name:nnn {nicematrix} 
+                                                              {Impossible~instruction}
+                                                              {none}} , 
+     Silent                .value_forbidden:n = true}
+%    \end{macrocode}
+% 
+% \bigskip
 % |\NiceMatrixOptions| is the command of the \pkg{nicematrix} package to fix options at the document level. The
 % scope of these specification is the current TeX group.
 %    \begin{macrocode}
@@ -929,10 +928,9 @@
 % If the cell is a implicit cell (that is after the symbol |\\| of end of row), the cell must, of course, be
 % considered as empty. It's easy to check wether we are in this situation considering the correspondant Tikz node.
 %    \begin{macrocode}
-       {\cs_if_exist:cTF {pgf at sh@ns at nm-
-                                    \int_use:N \g_@@_env_int-
-                                    \int_use:N #1-
-                                    \int_use:N #2}
+       {\cs_if_exist:cTF {pgf at sh@ns at nm-\int_use:N \g_@@_env_int-
+                                       \int_use:N #1-
+                                       \int_use:N #2}
 %    \end{macrocode}
 % We manage a list of ``empty cells'' called |\g_@@_empty_cells_seq|. In fact, this list is not a list of all the
 % empty cells of the array but only those explicitely declared empty for some reason. It's easy to check if the
@@ -944,26 +942,24 @@
 %    \end{macrocode}
 % In the general case, we consider the width of the Tikz node corresponding to the cell. In order to compute this
 % width, we have to extract the coordinate of the west and east anchors of the node. This extraction needs a
-% command |\tikz| but, in fact, nothing is drawn.
+% command environment |{pgfpicture}| but, in fact, nothing is drawn. 
 %    \begin{macrocode}
-             {\tikz[remember~picture]
-                \path let \p1 = (nm-
-                                 \int_use:N \g_@@_env_int-
-                                 \int_use:N #1-
-                                 \int_use:N #2.east),
-                          \p2 = (nm-
-                                 \int_use:N \g_@@_env_int-
-                                 \int_use:N #1-
-                                 \int_use:N #2.west)
-                      in \pgfextra {\dim_gset:Nn \g_tmpa_dim {\x1}
-                                    \dim_gset:Nn \g_tmpb_dim {\x2}} ;
+             {\begin{pgfpicture}
 %    \end{macrocode}
-% We compute in |\g_tmpa_dim| the width of the Tikz node.
+% We store the name of the node corresponding to the cell in |\l_tmpa_tl|.
 %    \begin{macrocode}
-              \dim_gsub:Nn \g_tmpa_dim \g_tmpb_dim
-              \dim_compare:nNnTF {\dim_abs:n \g_tmpa_dim} < {0.5 pt}
+                \tl_set:Nx \l_tmpa_tl {nm-\int_use:N \g_@@_env_int-
+                                          \int_use:N #1-
+                                          \int_use:N #2}
+                \pgfpointanchor \l_tmpa_tl {east}
+                \dim_gset:Nn \g_tmpa_dim \pgf at x
+                \pgfpointanchor \l_tmpa_tl {west}
+                \dim_gset:Nn \g_tmpb_dim \pgf at x
+              \end{pgfpicture}
+              \dim_compare:nNnTF {\dim_abs:n {\g_tmpb_dim-\g_tmpa_dim}} < {0.5 pt}
                     {\prg_return_false:}
-                    {\prg_return_true:}}}
+                    {\prg_return_true:}
+             }}
           {\prg_return_false:}
        }
 %    \end{macrocode}
@@ -1229,30 +1225,32 @@
 % |\l_@@_final_i_int| and |\l_@@_final_j_int|.
 %
 % The two arguments of the command |\@@_retrieve_coords:nn| are the anchors that must be used for the two nodes.
-% These anchors must be given with the point (e.g.: |.north|, |.south|, etc.).
 %
 % The coordinates are stored in |\g_@@_x_initial_dim|, |\g_@@_y_initial_dim|, |\g_@@_x_final_dim|,
-% |\g_@@_y_final_dim|. These variables are global for technical reasons: we have to do an affectation in a Tikz
-% picture.
+% |\g_@@_y_final_dim|. These variables are global for technical reasons: we have to do an affectation in an
+% environment |{pgfpicture}|.
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_retrieve_coords:nn
-     {\tikz[remember~picture]
-       \path let \p1 = (nm-\int_use:N \g_@@_env_int-
-                           \int_use:N \l_@@_initial_i_int-
-                           \int_use:N \l_@@_initial_j_int #1),
-                 \p2 = (nm-\int_use:N \g_@@_env_int-
-                           \int_use:N \l_@@_final_i_int-
-                           \int_use:N \l_@@_final_j_int #2)
-             in \pgfextra {\dim_gset:Nn \g_@@_x_initial_dim {\x1}
-                           \dim_gset:Nn \g_@@_y_initial_dim {\y1}
-                           \dim_gset:Nn \g_@@_x_final_dim {\x2}
-                           \dim_gset:Nn \g_@@_y_final_dim {\y2}} ; }
+     {\begin{tikzpicture}[remember~picture]
+      \tikz at parse@node\pgfutil at firstofone
+             (nm-\int_use:N \g_@@_env_int-
+                 \int_use:N \l_@@_initial_i_int-
+                 \int_use:N \l_@@_initial_j_int.#1)
+      \dim_gset:Nn \g_@@_x_initial_dim \pgf at x
+      \dim_gset:Nn \g_@@_y_initial_dim \pgf at y
+      \tikz at parse@node\pgfutil at firstofone
+                 (nm-\int_use:N \g_@@_env_int-
+                     \int_use:N \l_@@_final_i_int-
+                     \int_use:N \l_@@_final_j_int.#2)
+      \dim_gset:Nn \g_@@_x_final_dim \pgf at x
+      \dim_gset:Nn \g_@@_y_final_dim \pgf at y
+      \end{tikzpicture} }
 %    \end{macrocode}
 %
 % \interitem
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_draw_ldots_line:
-      {\@@_retrieve_coords:nn {.south~east} {.south~west}
+      {\@@_retrieve_coords:nn {south~east} {south~west}
        \@@_draw_tikz_line:}
 %    \end{macrocode}
 %
@@ -1259,7 +1257,7 @@
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_draw_cdots_line:
-      {\@@_retrieve_coords:nn {.mid~east} {.mid~west}
+      {\@@_retrieve_coords:nn {mid~east} {mid~west}
        \@@_draw_tikz_line:}
 %    \end{macrocode}
 %
@@ -1266,7 +1264,7 @@
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_draw_vdots_line:
-      {\@@_retrieve_coords:nn {.south} {.north}
+      {\@@_retrieve_coords:nn {south} {north}
        \@@_draw_tikz_line:}
 %    \end{macrocode}
 %
@@ -1276,7 +1274,7 @@
 % one.
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_draw_ddots_line:
-   {\@@_retrieve_coords:nn {.south~east} {.north~west}
+   {\@@_retrieve_coords:nn {south~east} {north~west}
 %    \end{macrocode}
 % We have retrieved the coordinates in the usual way (they are stored in |\g_@@_x_initial_dim|, etc.).
 % If the parallelization of the diagonals is set, we will have (maybe) to adjust the fourth coordinate.
@@ -1311,7 +1309,7 @@
 % We draw the |\Iddots| diagonals in the same way.
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_draw_iddots_line:
-   {\_@@_retrieve_coords:nn {.south~west} {.north~east} 
+   {\@@_retrieve_coords:nn {south~west} {north~east} 
     \bool_if:NT \l_@@_parallelize_diags_bool
        {\int_incr:N \l_@@_iddots_int
         \int_compare:nNnTF \l_@@_iddots_int = 1
@@ -1330,29 +1328,59 @@
 % The command |\@@_draw_tikz_line:| draws the line using four implicit arguments: 
 %
 % \quad |\g_@@_x_initial_dim|, |\g_@@_y_initial_dim|, |\g_@@_x_final_dim| and |\g_@@_y_final_dim|. 
-
-% These variables are global for technical reasons: we have to do affectations in an instruction |\tikz|.
+% These variables are global for technical reasons: their first affectation was in an instruction |\tikz|.
 %
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_draw_tikz_line:
-                     {\begin{tikzpicture}[overlay]
-                        \tikzmath{
-                           coordinate~\a , \b ;
-                           real~\l, \x, \d ;
-                           integer~\n ; 
-                           \a = (\g_@@_x_initial_dim, \g_@@_y_initial_dim) ;
-                           \b = (\g_@@_x_final_dim,  \g_@@_y_final_dim) ;
-                           \l = veclen(\bx-\ax,\by-\ay) ;
-                           \n = (\l - 0.54em)/(0.45em) ;
-                           \x = (\l - \n*0.45em)/(2*\l) ;
-                           \d = 0.45em / \l ; 
-                           if~\n>0
-                           then~{ for~\k in~{0,...,\n}
-                                  { {\node at ($(\a)!\x+\k*\d!(\b)$) {.} ; } ; } ;
-                            }  ;
-                           }
-                      \end{tikzpicture}}
+                     { 
 %    \end{macrocode}
+% The dimension |\l_@@_l_dim| is the length $\ell$ of the line to draw. We use the floating point reals of
+% \pkg{expl3} to compute this length.
+%    \begin{macrocode}
+                       \dim_zero_new:N \l_@@_l_dim
+                       \dim_set:Nn \l_@@_l_dim
+                                  { \fp_to_dim:n 
+                                      { sqrt( (  \dim_use:N \g_@@_x_final_dim 
+                                                -\dim_use:N \g_@@_x_initial_dim) ^2
+                                             +(  \dim_use:N \g_@@_y_final_dim 
+                                                -\dim_use:N \g_@@_y_initial_dim) ^2 )}
+                                  }
+%    \end{macrocode}
+% The integer |\l_tmpa_int| is the number of dots of the dotted line.
+%    \begin{macrocode}
+                       \int_set:Nn \l_tmpa_int {\dim_ratio:nn {\l_@@_l_dim - 0.54em} 
+                                                              {0.45em}}
+%    \end{macrocode}
+% The dimensions |\l_tmpa_dim| and |\l_tmpb_dim| are the coordinates of the vector between two dots in the
+% dotted line.
+%    \begin{macrocode}
+                       \dim_set:Nn \l_tmpa_dim { (\g_@@_x_final_dim - \g_@@_x_initial_dim) 
+                                                  * \dim_ratio:nn {0.45em} \l_@@_l_dim}
+                       \dim_set:Nn \l_tmpb_dim { (\g_@@_y_final_dim - \g_@@_y_initial_dim) 
+                                                  * \dim_ratio:nn {0.45em} \l_@@_l_dim}
+%    \end{macrocode}
+% In the loop over the dots (|\int_step_inline:nnnn|), the dimensions |\g_@@_x_initial_dim| and
+% |\g_@@_y_initial_dim| will be used for the coordinates of the dots.
+%    \begin{macrocode}
+                       \dim_gadd:Nn \g_@@_x_initial_dim
+                           { (\g_@@_x_final_dim - \g_@@_x_initial_dim)
+                               * \dim_ratio:nn {\l_@@_l_dim - 0.45 em * \l_tmpa_int}
+                                               {\l_@@_l_dim * 2}}
+                       \dim_gadd:Nn \g_@@_y_initial_dim 
+                           { (\g_@@_y_final_dim - \g_@@_y_initial_dim)
+                              * \dim_ratio:nn {\l_@@_l_dim - 0.45 em * \l_tmpa_int}
+                                              {\l_@@_l_dim * 2}}
+                       \begin{tikzpicture}[overlay]
+                       \int_step_inline:nnnn 0 1 \l_tmpa_int
+                          { \pgfpathcircle{\pgfpoint{\g_@@_x_initial_dim}
+                                                    {\g_@@_y_initial_dim}}
+                                          {0.53pt}
+                            \pgfusepath{fill}
+                            \dim_gadd:Nn \g_@@_x_initial_dim \l_tmpa_dim
+                            \dim_gadd:Nn \g_@@_y_initial_dim \l_tmpb_dim }
+                       \end{tikzpicture}
+}
+%    \end{macrocode}
 %
 % \bigskip
 % \subsection{User commands available in environments {NiceMatrix}}
@@ -1480,8 +1508,17 @@
               probably~be~wrong.}
 %    \end{macrocode}
 %
+%
+% \section{History}
+%
+% \subsection{Changes between versions 1.0 and 1.1}
+% 
+% Option |Silent| (with this option, the impossible instructions are discarded silently).
+%
+% The dotted lines are no longer drawn with Tikz nodes but with Tikz circles (for efficiency).
+% 
+% Modification of the code which is now twice faster.
 % \endinput
-%
 % Local Variables:
 % TeX-fold-mode: nil
 % End:

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2018-02-26 23:16:27 UTC (rev 46746)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2018-02-26 23:16:50 UTC (rev 46747)
@@ -18,10 +18,8 @@
 %% and version 1.3 or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\myfileversion{1.0}
-\def\myfiledate{2018/02/13}
-\RequirePackage{tikz}
-\usetikzlibrary{calc,math}
+\def\myfileversion{1.1}
+\def\myfiledate{2018/02/26}
 \RequirePackage{l3keys2e}
 \ProvidesExplPackage
   {nicematrix}
@@ -30,16 +28,17 @@
   {Draws nice dotted lines in matrix environments}
 \RequirePackage{array}
 \RequirePackage{mathtools}
+\RequirePackage{tikz}
 \RequirePackage{xparse}
 \ProvideDocumentCommand \iddots {}
       {\mathinner{\mkern 1mu
-                  \raise 1pt \hbox{.}
+                  \raise \p@ \hbox{.}
                   \mkern 2mu
-                  \raise 4pt\hbox{.}
+                  \raise 4\p@ \hbox{.}
                   \mkern 2mu
-                  \raise7pt \vbox{\kern 7pt
-                                  \hbox{.}}
-                  \mkern1mu}}
+                  \raise 7\p@ \vbox{\kern 7pt
+                                    \hbox{.}}
+                  \mkern 1mu}}
 \cs_new_protected:Nn \__nm_multicolumn:nn
        {\msg_error:nn {nicematrix} {multicolumn~forbidden}}
 \int_new:N \g__nm_env_int
@@ -58,7 +57,11 @@
       Transparent          .meta:n     = {RenewDots,RenewMatrix},
       Transparent          .value_forbidden:n = true,
       NullifyDots          .bool_set:N = \l__nm_nullify_dots_bool ,
-      NullifyDots          .default:n  = true}
+      NullifyDots          .default:n  = true,
+     Silent                .code:n  = {\msg_redirect_name:nnn {nicematrix}
+                                                              {Impossible~instruction}
+                                                              {none}} ,
+     Silent                .value_forbidden:n = true}
 \NewDocumentCommand \NiceMatrixOptions {m}
     {\keys_set:nn {NiceMatrix} {#1}}
 \cs_new_protected:Nn \__nm_Cell:
@@ -124,28 +127,25 @@
    {\left\lVert\begin{NiceMatrix}}
    {\end{BNiceMatrix}\right\rVert}
 \prg_set_conditional:Npnn \__nm_if_not_empty_cell:nn #1#2 {T}
-       {\cs_if_exist:cTF {pgf at sh@ns at nm-
-                                    \int_use:N \g__nm_env_int-
-                                    \int_use:N #1-
-                                    \int_use:N #2}
+       {\cs_if_exist:cTF {pgf at sh@ns at nm-\int_use:N \g__nm_env_int-
+                                       \int_use:N #1-
+                                       \int_use:N #2}
           {\seq_if_in:NxTF \g__nm_empty_cells_seq
                            {\int_use:N #1-\int_use:N #2}
              {\prg_return_false:}
-             {\tikz[remember~picture]
-                \path let \p1 = (nm-
-                                 \int_use:N \g__nm_env_int-
-                                 \int_use:N #1-
-                                 \int_use:N #2.east),
-                          \p2 = (nm-
-                                 \int_use:N \g__nm_env_int-
-                                 \int_use:N #1-
-                                 \int_use:N #2.west)
-                      in \pgfextra {\dim_gset:Nn \g_tmpa_dim {\x1}
-                                    \dim_gset:Nn \g_tmpb_dim {\x2}} ;
-              \dim_gsub:Nn \g_tmpa_dim \g_tmpb_dim
-              \dim_compare:nNnTF {\dim_abs:n \g_tmpa_dim} < {0.5 pt}
+             {\begin{pgfpicture}
+                \tl_set:Nx \l_tmpa_tl {nm-\int_use:N \g__nm_env_int-
+                                          \int_use:N #1-
+                                          \int_use:N #2}
+                \pgfpointanchor \l_tmpa_tl {east}
+                \dim_gset:Nn \g_tmpa_dim \pgf at x
+                \pgfpointanchor \l_tmpa_tl {west}
+                \dim_gset:Nn \g_tmpb_dim \pgf at x
+              \end{pgfpicture}
+              \dim_compare:nNnTF {\dim_abs:n {\g_tmpb_dim-\g_tmpa_dim}} < {0.5 pt}
                     {\prg_return_false:}
-                    {\prg_return_true:}}}
+                    {\prg_return_true:}
+             }}
           {\prg_return_false:}
        }
 \cs_new_protected:Nn \__nm_instruction_of_type:n
@@ -261,28 +261,31 @@
          }
 }
 \cs_new_protected:Nn \__nm_retrieve_coords:nn
-     {\tikz[remember~picture]
-       \path let \p1 = (nm-\int_use:N \g__nm_env_int-
-                           \int_use:N \l__nm_initial_i_int-
-                           \int_use:N \l__nm_initial_j_int #1),
-                 \p2 = (nm-\int_use:N \g__nm_env_int-
-                           \int_use:N \l__nm_final_i_int-
-                           \int_use:N \l__nm_final_j_int #2)
-             in \pgfextra {\dim_gset:Nn \g__nm_x_initial_dim {\x1}
-                           \dim_gset:Nn \g__nm_y_initial_dim {\y1}
-                           \dim_gset:Nn \g__nm_x_final_dim {\x2}
-                           \dim_gset:Nn \g__nm_y_final_dim {\y2}} ; }
+     {\begin{tikzpicture}[remember~picture]
+      \tikz at parse@node\pgfutil at firstofone
+             (nm-\int_use:N \g__nm_env_int-
+                 \int_use:N \l__nm_initial_i_int-
+                 \int_use:N \l__nm_initial_j_int.#1)
+      \dim_gset:Nn \g__nm_x_initial_dim \pgf at x
+      \dim_gset:Nn \g__nm_y_initial_dim \pgf at y
+      \tikz at parse@node\pgfutil at firstofone
+                 (nm-\int_use:N \g__nm_env_int-
+                     \int_use:N \l__nm_final_i_int-
+                     \int_use:N \l__nm_final_j_int.#2)
+      \dim_gset:Nn \g__nm_x_final_dim \pgf at x
+      \dim_gset:Nn \g__nm_y_final_dim \pgf at y
+      \end{tikzpicture} }
 \cs_new_protected:Nn \__nm_draw_ldots_line:
-      {\__nm_retrieve_coords:nn {.south~east} {.south~west}
+      {\__nm_retrieve_coords:nn {south~east} {south~west}
        \__nm_draw_tikz_line:}
 \cs_new_protected:Nn \__nm_draw_cdots_line:
-      {\__nm_retrieve_coords:nn {.mid~east} {.mid~west}
+      {\__nm_retrieve_coords:nn {mid~east} {mid~west}
        \__nm_draw_tikz_line:}
 \cs_new_protected:Nn \__nm_draw_vdots_line:
-      {\__nm_retrieve_coords:nn {.south} {.north}
+      {\__nm_retrieve_coords:nn {south} {north}
        \__nm_draw_tikz_line:}
 \cs_new_protected:Nn \__nm_draw_ddots_line:
-   {\__nm_retrieve_coords:nn {.south~east} {.north~west}
+   {\__nm_retrieve_coords:nn {south~east} {north~west}
     \bool_if:NT \l__nm_parallelize_diags_bool
        {\int_incr:N \l__nm_ddots_int
         \int_compare:nNnTF \l__nm_ddots_int = 1
@@ -294,7 +297,7 @@
                       * \dim_ratio:nn \l__nm_delta_y_one_dim \l__nm_delta_x_one_dim }}}
     \__nm_draw_tikz_line:}
 \cs_new_protected:Nn \__nm_draw_iddots_line:
-   {\__nm_retrieve_coords:nn {.south~west} {.north~east}
+   {\__nm_retrieve_coords:nn {south~west} {north~east}
     \bool_if:NT \l__nm_parallelize_diags_bool
        {\int_incr:N \l__nm_iddots_int
         \int_compare:nNnTF \l__nm_iddots_int = 1
@@ -305,25 +308,40 @@
                       (\g__nm_x_final_dim - \g__nm_x_initial_dim)
                       * \dim_ratio:nn \l__nm_delta_y_two_dim \l__nm_delta_x_two_dim }}}
     \__nm_draw_tikz_line:}
-
 \cs_new_protected:Nn \__nm_draw_tikz_line:
-                     {\begin{tikzpicture}[overlay]
-                        \tikzmath{
-                           coordinate~\a , \b ;
-                           real~\l, \x, \d ;
-                           integer~\n ;
-                           \a = (\g__nm_x_initial_dim, \g__nm_y_initial_dim) ;
-                           \b = (\g__nm_x_final_dim,  \g__nm_y_final_dim) ;
-                           \l = veclen(\bx-\ax,\by-\ay) ;
-                           \n = (\l - 0.54em)/(0.45em) ;
-                           \x = (\l - \n*0.45em)/(2*\l) ;
-                           \d = 0.45em / \l ;
-                           if~\n>0
-                           then~{ for~\k in~{0,...,\n}
-                                  { {\node at ($(\a)!\x+\k*\d!(\b)$) {.} ; } ; } ;
-                            }  ;
-                           }
-                      \end{tikzpicture}}
+                     {
+                       \dim_zero_new:N \l__nm_l_dim
+                       \dim_set:Nn \l__nm_l_dim
+                                  { \fp_to_dim:n
+                                      { sqrt( (  \dim_use:N \g__nm_x_final_dim
+                                                -\dim_use:N \g__nm_x_initial_dim) ^2
+                                             +(  \dim_use:N \g__nm_y_final_dim
+                                                -\dim_use:N \g__nm_y_initial_dim) ^2 )}
+                                  }
+                       \int_set:Nn \l_tmpa_int {\dim_ratio:nn {\l__nm_l_dim - 0.54em}
+                                                              {0.45em}}
+                       \dim_set:Nn \l_tmpa_dim { (\g__nm_x_final_dim - \g__nm_x_initial_dim)
+                                                  * \dim_ratio:nn {0.45em} \l__nm_l_dim}
+                       \dim_set:Nn \l_tmpb_dim { (\g__nm_y_final_dim - \g__nm_y_initial_dim)
+                                                  * \dim_ratio:nn {0.45em} \l__nm_l_dim}
+                       \dim_gadd:Nn \g__nm_x_initial_dim
+                           { (\g__nm_x_final_dim - \g__nm_x_initial_dim)
+                               * \dim_ratio:nn {\l__nm_l_dim - 0.45 em * \l_tmpa_int}
+                                               {\l__nm_l_dim * 2}}
+                       \dim_gadd:Nn \g__nm_y_initial_dim
+                           { (\g__nm_y_final_dim - \g__nm_y_initial_dim)
+                              * \dim_ratio:nn {\l__nm_l_dim - 0.45 em * \l_tmpa_int}
+                                              {\l__nm_l_dim * 2}}
+                       \begin{tikzpicture}[overlay]
+                       \int_step_inline:nnnn 0 1 \l_tmpa_int
+                          { \pgfpathcircle{\pgfpoint{\g__nm_x_initial_dim}
+                                                    {\g__nm_y_initial_dim}}
+                                          {0.53pt}
+                            \pgfusepath{fill}
+                            \dim_gadd:Nn \g__nm_x_initial_dim \l_tmpa_dim
+                            \dim_gadd:Nn \g__nm_y_initial_dim \l_tmpb_dim }
+                       \end{tikzpicture}
+}
 \cs_set_eq:NN \__nm_ldots \ldots
 \cs_set_eq:NN \__nm_cdots \cdots
 \cs_set_eq:NN \__nm_vdots \vdots



More information about the tex-live-commits mailing list