texlive[51536] Master/texmf-dist: nicematrix (2jul19)

commits+karl at tug.org commits+karl at tug.org
Tue Jul 2 23:03:43 CEST 2019


Revision: 51536
          http://tug.org/svn/texlive?view=revision&revision=51536
Author:   karl
Date:     2019-07-02 23:03:43 +0200 (Tue, 02 Jul 2019)
Log Message:
-----------
nicematrix (2jul19)

Modified Paths:
--------------
    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/nicematrix.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2019-07-02 21:03:25 UTC (rev 51535)
+++ trunk/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx	2019-07-02 21:03:43 UTC (rev 51536)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{2.2}
-\def\myfiledate{2019/06/23}
+\def\myfileversion{2.2.1}
+\def\myfiledate{2019/07/02}
 %
 %
 %<*batchfile>
@@ -52,7 +52,6 @@
 \usepackage{geometry}
 \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
 \usepackage{nicematrix}
-\usetikzlibrary{fit}
 \NewDocumentEnvironment {scope} {} {} {}
 \def\interitem{\vskip 7mm plus 2 mm minus 3mm}          
 \def\emphase{\bgroup\color{RoyalPurple}\let\next=}
@@ -807,7 +806,8 @@
 % technical reasons, in this preamble, the user must use the letters |L|, |C|
 % and~|R|\footnote{The column types |L|, |C| and |R| are defined locally inside
 % |{NiceArray}| with |\newcolumntype| of \pkg{array}. This definition overrides
-% an eventual previous definition.} instead of |l|, |c| and |r|. It's possible
+% an eventual previous definition. In fact, the column types |w| and |W| are
+% also redefined.} instead of |l|, |c| and |r|. It's possible
 % to use the constructions \verb|w{...}{...}|, \verb|W{...}{...}|, \verb+|+,
 % |>{...}|, |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but the letters |p|,
 % |m| and |b| should not be used.\footnote{In a command |\multicolumn|, one
@@ -1081,7 +1081,8 @@
 % 6 & 7 & 8 & 9 & 10 \\
 % 11 & 12 & 13 & 14 & 15 
 % \end{pNiceMatrix}$
-% 
+%
+%
 % \bigskip
 % In the environments with an explicit preamble (like |{NiceArray}|, etc.), it's
 % possible to draw a vertical dotted line with the specifier ``|:|''.
@@ -1103,7 +1104,7 @@
 %
 % \bigskip
 % These dotted lines do \emph{not} extend in the ``first row'' and the ``last column''
-% of the environments with such features.
+% of the environments for the environments with such features (\emph{e.g.} |{pNiceArrayRC}|).
 % 
 % \medskip
 % \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
@@ -2107,7 +2108,7 @@
 %
 % \subsection{Technical  definitions}
 %
-% We test wether the current class is \cls{revtex4-1} or \cls{revtex4-2}.
+% We test whether the current class is \cls{revtex4-1} or \cls{revtex4-2}.
 %    \begin{macrocode}
 \bool_new:N \c_@@_revtex_bool
 \@ifclassloaded { revtex4-1 }
@@ -2202,14 +2203,47 @@
 \bool_new:N \l_@@_exterior_column_bool
 %    \end{macrocode}
 % 
+% \bigskip
+% Consider the following code :
+% \begin{center}
+% \begin{BVerbatim}
+% \begin{pNiceArrayC}{CC}
+% 1 & 2 
+% 3 & 4
+% \end{pNiceArrayC}
+% \end{BVerbatim}
+% \end{center}
+% In such a code, the last column of the environment |{pNiceArrayC}| is not
+% used. We want to be able to detect such a situation. We create a boolean for
+% that job.
+%    \begin{macrocode}
+\bool_new:N \g_@@_exterior_column_found_bool
+%    \end{macrocode}
+% This boolean will be raised in the last column of environments like |{pNiceArrayC}|.
 %
 % \bigskip
-% We want to known if we are in a environment |{NiceArray}| because we want to
+% We want to known if we are in an environment |{NiceArray}| because we want to
 % raise an error if the user tries to use nested environments |{NiceArray}|.
 %    \begin{macrocode}
 \bool_new:N \l_@@_in_NiceArray_bool
 %    \end{macrocode}
 % 
+%
+% \bigskip
+% A list of names of environments of the extension \pkg{nicematrix} which have a
+% preamble as argument. This list is used to parameter some erros messages.
+%
+%    \begin{macrocode}
+\seq_new:N \c_@@_env_with_preamble_seq
+\seq_set_from_clist:Nn \c_@@_env_with_preamble_seq
+  { 
+    NiceArray , NiceArrayCwithDelims , pNiceArrayC , vNiceArrayC , VNiceArrayC ,
+    bNiceArrayC , BNiceArrayC , NiceArrayRCwithDelims , pNiceArrayRC , 
+    vNiceArrayRC , VNiceArrayRC , bNiceArrayRC , BNiceArrayRC
+  }
+%    \end{macrocode}
+%
+%
 % \bigskip 
 % \subsection{The options}
 %
@@ -2235,7 +2269,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% The flag |\l_@@_parallelize_diags_bool| controls wether the diagonals are
+% The flag |\l_@@_parallelize_diags_bool| controls whether the diagonals are
 % parallelized. The initial value is~|true|.
 %    \begin{macrocode}
 \bool_new:N \l_@@_parallelize_diags_bool
@@ -2288,7 +2322,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% The boolean |\l_@@_extra_nodes_bool| will be used to indicate wether the
+% The boolean |\l_@@_extra_nodes_bool| will be used to indicate whether the
 % ``medium nodes'' and ``large nodes'' are created in the array. 
 %    \begin{macrocode}
 \bool_new:N \l_@@_extra_nodes_bool
@@ -2338,7 +2372,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% An option to test wether the extra nodes will be created (these nodes are the
+% An option to test whether the extra nodes will be created (these nodes are the
 % ``medium nodes'' and ``large nodes''). In some circonstancies, the extra nodes
 % are created automatically, for example when a dotted line has an ``open''
 % extremity. 
@@ -2467,13 +2501,22 @@
 %    \end{macrocode}
 %
 % \bigskip
+% Usually, an error is raised when the user tries to give the same to name two
+% distincts environments of \pkg{nicematrix} (theses names are global and not
+% local to the current TeX scope). However, the option |allow-duplicate-names|
+% disables this feature. 
 %    \begin{macrocode}
     allow-duplicate-names .code:n = 
-      \@@_msg_redirect_name:nn { Duplicate~name } {none} ,
+      \@@_msg_redirect_name:nn { Duplicate~name } { none } ,
     allow-duplicate-names .value_forbidden:n = true ,
 %    \end{macrocode}
 %
 % \bigskip
+% By default, the specifier used in the preamble of the array (for example in
+% |{pNiceArrayC}| to draw a vertical dotted line between two columns is the
+% colon ``|:|''. However, it's possible to change this letter with
+% |letter-for-dotted-lines| and, by the way, the letter ``|:|'' will remain free
+% for other packages (for example \pkg{arydshln}).
 %    \begin{macrocode}
     letter-for-dotted-lines .tl_set:N = \l_@@_letter_for_dotted_lines_str ,
     letter-for-dotted-lines .value_required:n = true ,
@@ -2646,8 +2689,7 @@
 % the |\everycr| because some packages, like \pkg{arydshln}, create special rows
 % in the |\halign| that we don't want to take into account. 
 %    \begin{macrocode}
-    \int_compare:nNnT \g_@@_column_int = \c_one_int
-       { \int_gincr:N \g_@@_row_int }                
+    \int_compare:nNnT \g_@@_column_int = 1 { \int_gincr:N \g_@@_row_int }                 
     \int_gset:Nn \g_@@_column_total_int 
        { \int_max:nn \g_@@_column_total_int \g_@@_column_int }
     \hbox_set:Nw \l_tmpa_box $ % $ 
@@ -2948,27 +2990,27 @@
     \bool_if:NT \l_@@_auto_columns_width_bool
       { 
         \group_insert_after:N \@@_write_max_cell_width:
-         \cs_if_free:cTF { _@@_max_cell_width_ \int_use:N \g_@@_env_int }
-           { \dim_set:Nn \l_@@_columns_width_dim \c_zero_dim }
-           { 
-             \dim_set:Nx \l_@@_columns_width_dim 
-               { \use:c { _@@_max_cell_width _ \int_use:N \g_@@_env_int } } 
-           }
+        \cs_if_free:cTF { _@@_max_cell_width_ \int_use:N \g_@@_env_int }
+          { \dim_set:Nn \l_@@_columns_width_dim \c_zero_dim }
+          { 
+            \dim_set:Nx \l_@@_columns_width_dim 
+              { \use:c { _@@_max_cell_width _ \int_use:N \g_@@_env_int } } 
+          }
 %    \end{macrocode}
 % If the environment has a name, we read the value of the maximal value of the
 % columns from |_@@_name_cell_width|{\ttfamily\slshape name} (the value will be
 % the correct value even if the number of the environment has changed (for
 % example because the user has created or deleted an environment before the
-% current one). 
+% current one)). 
 %    \begin{macrocode}
-         \str_if_empty:NF \l_@@_name_str
-           { 
-             \cs_if_free:cF { _@@_max_cell_width_ \l_@@_name_str }
-               { 
-                 \dim_set:Nx \l_@@_columns_width_dim 
-                   { \use:c { _@@_max_cell_width_ \l_@@_name_str } }
-               }
-           }
+        \str_if_empty:NF \l_@@_name_str
+          { 
+            \cs_if_free:cF { _@@_max_cell_width_ \l_@@_name_str }
+              { 
+                \dim_set:Nx \l_@@_columns_width_dim 
+                  { \use:c { _@@_max_cell_width_ \l_@@_name_str } }
+              }
+          }
       }
 %    \end{macrocode}
 % We don't want to patch any code and that's why some code is executed in a
@@ -3056,19 +3098,38 @@
           { 
             \skip_horizontal:n { 0.53 pt }
             \bool_gset_true:N \g_@@_extra_nodes_bool
-            \int_compare:nNnT \g_@@_row_int = 1
+%    \end{macrocode}
+%
+% \medskip
+% Consider the following code:
+% \begin{center}
+% \begin{BVerbatim}
+% \begin{NiceArray}{C:CC:C}
+% a & b
+% c & d \\
+% e & f & g & h \\
+% i & j & k & l 
+% \end{NiceArray}
+% \end{BVerbatim}
+% \end{center}
+% The first ``|:|'' in the preamble will be encountered during the first row of
+% the environment |{NiceArray}| but the second one will be encountered only in
+% the third row. We have to issue a command |\vdottedline:n| in the |code-after|
+% only one time for each ``|:|'' in the preamble. That's why we keep a counter
+% |\g_@@_last_vdotted_col_int| and with this counter, we know whether a letter
+% ``|:|'' encountered during the parsing has already been taken into account in
+% the |code-after|.
+%    \begin{macrocode}
+            \int_compare:nNnT \g_@@_column_int > \g_@@_last_vdotted_col_int
               {
-                \int_compare:nNnTF \g_@@_column_int = \c_zero_dim
-                  { \@@_error:n { Use~of~:~in~first~position } }
+                \int_gset_eq:NN \g_@@_last_vdotted_col_int \g_@@_column_int
+                \tl_gput_right:Nx \g_@@_code_after_tl
                   {
-                    \tl_gput_right:Nx \g_@@_code_after_tl
-                      {
-                        \exp_not:N \@@_vdottedline:n
-                        \exp_not:N {
-                        \int_use:N \g_@@_column_int 
-                        \exp_not:N }
-                      } 
-                  }
+                    \exp_not:N \@@_vdottedline:n
+                    \exp_not:N {
+                    \int_use:N \g_@@_column_int 
+                    \exp_not:N }
+                  } 
               }
           }
       } 
@@ -3125,6 +3186,11 @@
 %    \begin{macrocode}
     \int_gzero_new:N \g_@@_column_int 
     \int_gzero_new:N \g_@@_column_total_int
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+    \int_gzero_new:N \g_@@_last_vdotted_col_int
+    \int_gset:Nn \g_@@_last_vdotted_col_int { -1 }
     \cs_set_eq:NN \@ifnextchar \new at ifnextchar
 %    \end{macrocode}
 %
@@ -3245,7 +3311,7 @@
 %    \end{macrocode}
 % 
 % \interitem
-% The conditionnal |\@@_if_not_empty_cell:nnT| tests wether a cell is empty. The
+% The conditionnal |\@@_if_not_empty_cell:nnT| tests whether a cell is empty. The
 % first two arguments must be LaTeX3 counters for the row and the column of the
 % considered cell. 
 %    \begin{macrocode}
@@ -3252,7 +3318,7 @@
 \prg_set_conditional:Npnn \@@_if_not_empty_cell:nn #1 #2 { T , TF }
 %    \end{macrocode}
 % If the cell is an 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
+% the cell must, of course, be considered as empty. It's easy to check whether we
 % are in this situation considering the correspondant Tikz node. 
 %    \begin{macrocode}
   { 
@@ -3342,11 +3408,30 @@
 % 
 % \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:
   { 
+    \int_compare:nNnTF \g_@@_row_int > 0
+      \@@_after_array_i:
+      { \@@_error:n { Zero~row } }
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@@_msg_new:nn { Zero~row }
+  { 
+    There~is~a~problem.~Maybe~your~environment~is~empty.~Maybe~you~have~used~L,~ 
+    ~C~and~R~instead~of~l,~c~and~r~in~the~preamble~of~your~environment.\\
+    If~you~go~on,~the~result~may~be~incorrect.
+  }
+%    \end{macrocode}
+%
+% \medskip
+% 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_i:
+  { 
     \group_begin:
     \cs_if_exist:NT \tikz at library@external at loaded
       { \tikzset { external / export = false } } 
@@ -3358,7 +3443,8 @@
 % column.  
 %    \begin{macrocode}
     \int_gset_eq:NN \g_@@_column_int \g_@@_column_total_int
-    \bool_if:NT \l_@@_exterior_column_bool { \int_gdecr:N \g_@@_column_int }
+    \bool_if:nT { \l_@@_exterior_column_bool && \g_@@_exterior_column_found_bool }
+       { \int_gdecr:N \g_@@_column_int }
 %    \end{macrocode}
 %
 % The sequence |\g_@@_yet_drawn_seq| contains a list of lines which have been
@@ -3371,7 +3457,7 @@
 % By default, the diagonal lines will be parallelized\footnote{It's possible to
 % use the option |parallelize-diags| to disable this parallelization.}. There
 % are two types of diagonals lines: the $|\Ddots|$ diagonals and the |\Iddots|
-% diagonals. We have to count both types in order to know wether a diagonal is
+% diagonals. We have to count both types in order to know whether a diagonal is
 % the first of its type in the current |{NiceArray}| environment.
 %    \begin{macrocode}
     \bool_if:NT \l_@@_parallelize_diags_bool
@@ -3481,7 +3567,7 @@
 % coordinates of one extremity of the line; 
 % \item |\l_@@_final_i_int| and |\l_@@_final_j_int| which are the coordinates of
 % the other extremity of the line; 
-% \item |\l_@@_initial_open_bool| and |\l_@@_final_open_bool| to indicate wether
+% \item |\l_@@_initial_open_bool| and |\l_@@_final_open_bool| to indicate whether
 % the extremities are open or not. 
 % \end{itemize}
 %
@@ -3643,13 +3729,13 @@
     \dim_gzero_new:N \g_@@_x_final_dim 
     \dim_gzero_new:N \g_@@_y_final_dim
     \begin { tikzpicture } [ remember~picture ]
-      \tikz at parse@node\pgfutil at firstofone
+      \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
+      \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 )
@@ -3751,7 +3837,7 @@
               { .north~west }
           }
 %    \end{macrocode}
-% The boolean |\l_tmpa_bool| indicates wether the column is of type |l| (|L| of
+% The boolean |\l_tmpa_bool| indicates whether the column is of type |l| (|L| of
 % |{NiceArray}|) or may be considered as if.
 %    \begin{macrocode}      
         \bool_set:Nn \l_tmpa_bool 
@@ -3768,7 +3854,7 @@
               { .north }
           }
 %    \end{macrocode}
-% The boolean |\l_tmpb_bool| indicates wether the column is of type |c| (|C| of
+% The boolean |\l_tmpb_bool| indicates whether the column is of type |c| (|C| of
 % |{NiceArray}|) or may be considered as if.
 %    \begin{macrocode}      
         \bool_set:Nn \l_tmpb_bool 
@@ -4243,7 +4329,7 @@
 % \bigskip
 % \subsection{The commands to draw dotted lines to separate columns and rows}
 %
-% The command |\hdottedline| draws a horizontal dotted line to separate two
+% The command |\hdottedline| draws an horizontal dotted line to separate two
 % rows. Similarly, the letter ``:'' in the preamble draws a vertical dotted line
 % (the letter can be changed with the option |letter-for-dotted-lines|). Both
 % mechanisms write instructions in the |code-after|. The actual instructions in
@@ -4250,67 +4336,66 @@
 % the |code-after| use the commands |\@@_hdottedline:n| and |\@@_vdottedline:n|.
 % 
 % \bigskip
+% We want the horizontal lines at the same position\footnote{In fact, almost the
+% same position because of the width of the line: the width of a dotted line is
+% not the same as the width of a line created by |\hline|.} as the line created
+% by |\hline| (or |\hdashline| of \pkg{arydshln}). To this end, we construct a
+% ``false row'' and, in this row, we create a Tikz node (|\coordinate|) that
+% will be used to have the $y$-value of the line.
+% 
+%    \begin{macrocode}
+\cs_generate_variant:Nn \dim_set:Nn { N v }
+%    \end{macrocode}
 %
-% The following command must \emph{not} be protected because it starts with |\noalign|.
+% \medskip
+% The command |\@@_hdottedline:| (which is linked to |\hdottedline| in the
+% environment |{NiceArray}|) begins with a |\noalign| which contains a
+% vertical skip which is part of the construction of the ``false row''.
+% 
+% \medskip
+% Some extension, like the extension \pkg{doc} do a redefinition of the command
+% |\dotfill| of LaTeX. That's why we define a command |\@@_dotfill:| as we wish.
 %    \begin{macrocode}
+\cs_set:Npn \@@_dotfill:
+  { \cleaders \hbox_to_wd:nn {.44em} {\hss .\hss } \hfill \kern \c_zero_dim }
+%    \end{macrocode}
+%                                      
+
+% This command must \emph{not} be protected because it starts with |\noalign|.
+%    \begin{macrocode}
 \cs_new:Nn \@@_hdottedline:
   {
-    \noalign { \skip_vertical:n { 0.53 pt } }
-    \@@_hdottedline_i:
-  }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\cs_new_protected:Nn \@@_hdottedline_i:
-  { 
-    \int_compare:nNnTF \g_@@_row_int < 2
-      { \@@_error:n { Use~of~hdottedline~in~first~position } }
-      {
+    \noalign 
+      { 
         \bool_gset_true:N \g_@@_extra_nodes_bool
-        \bool_if:NF \c_@@_draft_bool
-          {
-            \tl_gput_right:Nx \g_@@_code_after_tl 
+        \cs_if_exist:cTF { @@_width_ \int_use:N \g_@@_env_int }
+          { \dim_set:Nv \l_tmpa_dim { @@_width_ \int_use:N \g_@@_env_int } }
+          { \dim_set:Nn \l_tmpa_dim { 5 mm } }
+        \hbox_overlap_right:n 
+          { \hbox_to_wd:nn 
               { 
-                \exp_not:N \@@_hdottedline:n 
-                \exp_not:N { 
-                \int_eval:n { \g_@@_row_int - 1 } 
-                \exp_not:N }
+                \l_tmpa_dim + 2 \arraycolsep 
+                - \l_@@_left_margin_dim - \g_@@_right_margin_dim 
               } 
-          } 
-      }
+            \@@_dotfill: 
+          }
+      } 
   }
 %    \end{macrocode}
-% 
-% The argument of |\@@_hdottedline:n| is the number of the row \emph{after} which
-% we have to draw a dotted line.
-%    \begin{macrocode}
-\cs_new_protected:Nn \@@_hdottedline:n
-  { 
-    \@@_create_extra_nodes:
-    \dim_zero_new:N \g_@@_x_initial_dim
-    \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_set_true:N \l_@@_initial_open_bool 
-    \bool_set_true:N \l_@@_final_open_bool 
-    \begin { tikzpicture } [ remember~picture ]
-      \tikz at parse@node\pgfutil at firstofone
-        ( #1 - 1 -large .south~west )
-      \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
-        ( #1 - \int_use:N \g_@@_column_int -large .south~east )
-      \dim_gset:Nn \g_@@_x_final_dim \pgf at x
-      \dim_gset:Nn \g_@@_y_final_dim \pgf at y
-    \end { tikzpicture }
-    \@@_draw_tikz_line:
-  }
-%    \end{macrocode}
 %
+%
+%
 %    \begin{macrocode}
 \@@_msg_new:nn { Use~of~hdottedline~in~first~position }
   { 
     You~can't~use~the~command~\token_to_str:N\hdottedline\ in~the~first~row~ 
+    of~the~environment~\{\@currenvir\}.~But~maybe~you~have~used~l,~c~and~r~
+    instead~of~L,~C,~R~in~the~preamble~of~the~array.\\
+    If~you~go~on,~this~dotted~line~will~be~ignored.
+  }
+\@@_msg_new:nn { Use~of~hdottedline~in~first~position~bis }
+  { 
+    You~can't~use~the~command~\token_to_str:N\hdottedline\ in~the~first~row~ 
     of~the~environment~\{\@currenvir\}. \\
     If~you~go~on,~this~dotted~line~will~be~ignored.
   }
@@ -4322,8 +4407,8 @@
 \cs_new_protected:Nn \@@_vdottedline:n
   {
 %    \end{macrocode}
-% The following test is a security: normally, the error should have been capted
-% before. 
+% We should allow the letter ``|:|'' in the first position of the preamble
+% but that would need a special programmation.
 %    \begin{macrocode}
     \int_compare:nNnTF #1 = \c_zero_int
       { \@@_error:n { Use~of~:~in~first~position } }
@@ -4338,12 +4423,29 @@
             \bool_set_true:N \l_@@_initial_open_bool 
             \bool_set_true:N \l_@@_final_open_bool 
 %    \end{macrocode}
-% If the |w|-nodes are created in the previous column (that is if the previous
-% column was constructed explicitly of implicitly with a letter |w|), we use
-% that column in order to have the dotted lines perfectly aligned when we use
-% the environment |{NiceMatrixBlock}| with the option |auto-columns-width|.
+% In order to have the coordinates of the line to draw, we use the ``large nodes''.
 %    \begin{macrocode}
-            \cs_if_exist:cTF 
+            \begin { tikzpicture } [ remember~picture ]
+              \tikz at parse@node\pgfutil at firstofone
+                ( 1 - #1 - large .north~east )
+              \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
+                ( \int_use:N \g_@@_row_int - #1 - large .south~east )
+              \dim_gset:Nn \g_@@_x_final_dim \pgf at x
+              \dim_gset:Nn \g_@@_y_final_dim \pgf at y
+            \end { tikzpicture }
+%    \end{macrocode}
+% However, if the |w|-nodes are created in the previous column (that is if the
+% previous column was constructed explicitly or implicitly\footnote{A column is
+% constructed implicitly with the letter |w| if the option |columns-width| is
+% used or if the environment |{NiceMatrixBlock}| is used with the option
+% |auto-columns-width|.} with a letter |w|), we use the |w|-nodes to change the
+% $x$-value of the nodes in order to have the dotted lines perfectly aligned
+% when we use the environment |{NiceMatrixBlock}| with the option
+% |auto-columns-width|.
+%    \begin{macrocode}
+            \cs_if_exist:cT
               { pgf at sh@ns at nm -\int_use:N \g_@@_env_int - 1 - #1 - w }
               {
                 \begin { tikzpicture } [ remember~picture ]
@@ -4350,27 +4452,13 @@
                   \tikz at parse@node\pgfutil at firstofone
                     ( 1 - #1 - w .north~east )
                   \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
                     ( \int_use:N \g_@@_row_int - #1 - w .south~east )
                   \dim_gset:Nn \g_@@_x_final_dim \pgf at x
-                  \dim_gset:Nn \g_@@_y_final_dim \pgf at y
                 \end { tikzpicture }
                 \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep
                 \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep
               }
-              {
-                \begin { tikzpicture } [ remember~picture ]
-                  \tikz at parse@node\pgfutil at firstofone
-                    ( 1 - #1 - large .north~east )
-                  \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
-                    ( \int_use:N \g_@@_row_int - #1 - large .south~east )
-                  \dim_gset:Nn \g_@@_x_final_dim \pgf at x
-                  \dim_gset:Nn \g_@@_y_final_dim \pgf at y
-                \end { tikzpicture }
-              }
             \@@_draw_tikz_line:
           } 
       }
@@ -4502,6 +4590,7 @@
 \cs_new_protected:Nn \@@_NiceArrayC:n
   {
     \bool_set_true:N \l_@@_exterior_column_bool
+    \bool_gset_false:N \g_@@_exterior_column_found_bool
     \begin { NiceArray }
 %    \end{macrocode}
 % The beginning of the preamble is the argument of the environment
@@ -4517,6 +4606,7 @@
 %    \begin{macrocode}
         > 
           { 
+            \bool_gset_true:N \g_@@_exterior_column_found_bool
             \int_gincr:N \g_@@_column_int
             \int_gset:Nn \g_@@_column_total_int
               { \int_max:nn \g_@@_column_total_int \g_@@_column_int }
@@ -4526,7 +4616,7 @@
         l
 %    \end{macrocode}
 % 
-% We actualize the value of |\g_@@_with_last_col_dim| which, at the end of the
+% We actualize the value of |\g_@@_width_last_col_dim| which, at the end of the
 % array, will contain the maximal width of the cells of the last column (thus,
 % it will be equal to the width of the last column). 
 %    \begin{macrocode}
@@ -4803,7 +4893,7 @@
           \dim_zero_new:c { l_@@_row_\@@_i _max_dim } 
           \dim_set:cn { l_@@_row_\@@_i _max_dim } { - \c_max_dim }
         }
-      \int_step_variable:nnnNn 1 1 \g_@@_column_total_int \@@_j
+      \int_step_variable:nNn \g_@@_column_total_int \@@_j
         {
           \dim_zero_new:c { l_@@_column_\@@_j _min_dim } 
           \dim_set_eq:cN { l_@@_column_\@@_j _min_dim } \c_max_dim
@@ -4842,8 +4932,8 @@
 % We retrieve the coordinates of the anchor |north east| of the (normal) node of
 % the cell ($i$-$j$). They will be stored in |\pgf at x| and |\pgf at y|.
 %    \begin{macrocode}
-                 \tikz at parse@node \pgfutil at firstofone 
-                   ( nm - \int_use:N \g_@@_env_int - \@@_i - \@@_j .north~east )
+                  \tikz at parse@node \pgfutil at firstofone 
+                    ( nm - \int_use:N \g_@@_env_int - \@@_i - \@@_j .north~east )
                   \dim_set:cn { l_@@_row _ \@@_i _ max_dim }
                     { \dim_max:vn { l_@@_row _ \@@_i _ max_dim } \pgf at y }
                   \seq_if_in:NxF \g_@@_multicolumn_cells_seq { \@@_i - \@@_j }
@@ -4879,7 +4969,7 @@
 % \texttt{l_@@_column_\textsl{j}_min_dim} and
 % \texttt{l_@@_column_\textsl{j}_max_dim}.  
 %    \begin{macrocode} 
-      \int_step_variable:nnnNn 1 1 { \g_@@_row_int - 1 } \@@_i
+      \int_step_variable:nNn { \g_@@_row_int - 1 } \@@_i
         { 
           \dim_set:cn { l_@@_row _ \@@_i _ min _ dim }  
             {
@@ -4892,7 +4982,7 @@
           \dim_set_eq:cc { l_@@_row _ \int_eval:n { \@@_i + 1 } _ max _ dim } 
             { l_@@_row_\@@_i _min_dim } 
         }
-      \int_step_variable:nnnNn 1 1 { \g_@@_column_int - 1 } \@@_j
+      \int_step_variable:nNn { \g_@@_column_int - 1 } \@@_j
         { 
           \dim_set:cn { l_@@_column _ \@@_j _ max _ dim }  
             { 
@@ -4926,6 +5016,27 @@
 % the current TeX group). That's why we put a nullification of the command.
 %    \begin{macrocode}
       \cs_set:Nn \@@_create_extra_nodes: { }
+%    \end{macrocode}
+% 
+% \medskip
+% We can now compute the width of the array (used by |\hdottedline|).
+%    \begin{macrocode}
+      \begin { tikzpicture } [ remember~picture , overlay ]
+         \tikz at parse@node \pgfutil at firstofone 
+           ( nm - \int_use:N \g_@@_env_int - 1 - 1 - large .north~west )
+         \dim_gset:Nn \g_tmpa_dim \pgf at x 
+         \tikz at parse@node \pgfutil at firstofone 
+           ( nm - \int_use:N \g_@@_env_int - 1 - 
+                  \int_use:N \g_@@_column_int - large .north~east )
+         \dim_gset:Nn \g_tmpb_dim \pgf at x 
+      \end   { tikzpicture }      
+      \iow_now:Nn \@mainaux \ExplSyntaxOn 
+      \iow_now:Nx \@mainaux 
+        { 
+          \cs_gset:cpn { @@_width_ \int_use:N \g_@@_env_int }
+            { \dim_eval:n { \g_tmpb_dim - \g_tmpa_dim } } 
+        }
+      \iow_now:Nn \@mainaux \ExplSyntaxOff
   }
 %    \end{macrocode}
 % 
@@ -5061,7 +5172,7 @@
 %    \end{macrocode}
 % In the group, we can use |\seq_pop:NN| safely.
 %    \begin{macrocode}
-   \int_step_inline:nnnn 1 1 { \seq_count:N #1 }
+   \int_step_inline:nn { \seq_count:N #1 }
      { 
        \seq_pop:NN #1 \l_tmpa_tl
        \seq_pop:NN #2 \l_tmpb_tl
@@ -5201,6 +5312,13 @@
 % specifier ``|:|'' in the preamble (similar to the classical specifier
 % ``\verb+|+'' and the specifier ``|:|'' of \pkg{arydshln}).
 %
+% \subsection{Changes between version 2.2 and 2.2.1}
+%
+% Improvment of the vertical dotted lines drawn by the specifier ``:'' in the
+% preamble. 
+%
+% Modification of the position of the dotted lines drawn by |\hdottedline|.
+%
 % \endinput
 % Local Variables:
 % TeX-fold-mode: nil

Modified: trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2019-07-02 21:03:25 UTC (rev 51535)
+++ trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty	2019-07-02 21:03:43 UTC (rev 51536)
@@ -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.2}
-\def\myfiledate{2019/06/23}
+\def\myfileversion{2.2.1}
+\def\myfiledate{2019/07/02}
 \RequirePackage{tikz}
 \usetikzlibrary{fit}
 \RequirePackage{expl3}[2019/02/15]
@@ -66,7 +66,15 @@
 \int_new:N \l__nm_nb_first_row_int
 \int_set:Nn \l__nm_nb_first_row_int 1
 \bool_new:N \l__nm_exterior_column_bool
+\bool_new:N \g__nm_exterior_column_found_bool
 \bool_new:N \l__nm_in_NiceArray_bool
+\seq_new:N \c__nm_env_with_preamble_seq
+\seq_set_from_clist:Nn \c__nm_env_with_preamble_seq
+  {
+    NiceArray , NiceArrayCwithDelims , pNiceArrayC , vNiceArrayC , VNiceArrayC ,
+    bNiceArrayC , BNiceArrayC , NiceArrayRCwithDelims , pNiceArrayRC ,
+    vNiceArrayRC , VNiceArrayRC , bNiceArrayRC , BNiceArrayRC
+  }
 \str_new:N \l__nm_pos_env_str
 \str_set:Nn \l__nm_pos_env_str c
 \bool_new:N \l__nm_exterior_arraycolsep_bool
@@ -163,7 +171,7 @@
         { \__nm_error:n { Option~auto~for~columns-width } }
         { \dim_set:Nn \l__nm_columns_width_dim { #1 } } ,
     allow-duplicate-names .code:n =
-      \__nm_msg_redirect_name:nn { Duplicate~name } {none} ,
+      \__nm_msg_redirect_name:nn { Duplicate~name } { none } ,
     allow-duplicate-names .value_forbidden:n = true ,
     letter-for-dotted-lines .tl_set:N = \l__nm_letter_for_dotted_lines_str ,
     letter-for-dotted-lines .value_required:n = true ,
@@ -268,8 +276,7 @@
 \cs_new_protected:Nn \__nm_Cell:
   {
     \int_gincr:N \g__nm_column_int
-    \int_compare:nNnT \g__nm_column_int = \c_one_int
-       { \int_gincr:N \g__nm_row_int }
+    \int_compare:nNnT \g__nm_column_int = 1 { \int_gincr:N \g__nm_row_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 $ % $
@@ -446,20 +453,20 @@
     \bool_if:NT \l__nm_auto_columns_width_bool
       {
         \group_insert_after:N \__nm_write_max_cell_width:
-         \cs_if_free:cTF { __nm_max_cell_width_ \int_use:N \g__nm_env_int }
-           { \dim_set:Nn \l__nm_columns_width_dim \c_zero_dim }
-           {
-             \dim_set:Nx \l__nm_columns_width_dim
-               { \use:c { __nm_max_cell_width _ \int_use:N \g__nm_env_int } }
-           }
-         \str_if_empty:NF \l__nm_name_str
-           {
-             \cs_if_free:cF { __nm_max_cell_width_ \l__nm_name_str }
-               {
-                 \dim_set:Nx \l__nm_columns_width_dim
-                   { \use:c { __nm_max_cell_width_ \l__nm_name_str } }
-               }
-           }
+        \cs_if_free:cTF { __nm_max_cell_width_ \int_use:N \g__nm_env_int }
+          { \dim_set:Nn \l__nm_columns_width_dim \c_zero_dim }
+          {
+            \dim_set:Nx \l__nm_columns_width_dim
+              { \use:c { __nm_max_cell_width _ \int_use:N \g__nm_env_int } }
+          }
+        \str_if_empty:NF \l__nm_name_str
+          {
+            \cs_if_free:cF { __nm_max_cell_width_ \l__nm_name_str }
+              {
+                \dim_set:Nx \l__nm_columns_width_dim
+                  { \use:c { __nm_max_cell_width_ \l__nm_name_str } }
+              }
+          }
       }
     \bool_gset_eq:NN \g__nm_extra_nodes_bool \l__nm_extra_nodes_bool
     \dim_gset_eq:NN \g__nm_left_margin_dim \l__nm_left_margin_dim
@@ -499,18 +506,15 @@
           {
             \skip_horizontal:n { 0.53 pt }
             \bool_gset_true:N \g__nm_extra_nodes_bool
-            \int_compare:nNnT \g__nm_row_int = 1
+            \int_compare:nNnT \g__nm_column_int > \g__nm_last_vdotted_col_int
               {
-                \int_compare:nNnTF \g__nm_column_int = \c_zero_dim
-                  { \__nm_error:n { Use~of~:~in~first~position } }
+                \int_gset_eq:NN \g__nm_last_vdotted_col_int \g__nm_column_int
+                \tl_gput_right:Nx \g__nm_code_after_tl
                   {
-                    \tl_gput_right:Nx \g__nm_code_after_tl
-                      {
-                        \exp_not:N \__nm_vdottedline:n
-                        \exp_not:N {
-                        \int_use:N \g__nm_column_int
-                        \exp_not:N }
-                      }
+                    \exp_not:N \__nm_vdottedline:n
+                    \exp_not:N {
+                    \int_use:N \g__nm_column_int
+                    \exp_not:N }
                   }
               }
           }
@@ -529,6 +533,8 @@
     \int_gset:Nn \g__nm_row_int { \l__nm_nb_first_row_int - 1 }
     \int_gzero_new:N \g__nm_column_int
     \int_gzero_new:N \g__nm_column_total_int
+    \int_gzero_new:N \g__nm_last_vdotted_col_int
+    \int_gset:Nn \g__nm_last_vdotted_col_int { -1 }
     \cs_set_eq:NN \@ifnextchar \new at ifnextchar
     \bool_if:NF \l__nm_exterior_arraycolsep_bool
       { \skip_horizontal:n { - \arraycolsep } }
@@ -618,11 +624,24 @@
   }
 \cs_new_protected:Nn \__nm_after_array:
   {
+    \int_compare:nNnTF \g__nm_row_int > 0
+      \__nm_after_array_i:
+      { \__nm_error:n { Zero~row } }
+  }
+\__nm_msg_new:nn { Zero~row }
+  {
+    There~is~a~problem.~Maybe~your~environment~is~empty.~Maybe~you~have~used~L,~
+    ~C~and~R~instead~of~l,~c~and~r~in~the~preamble~of~your~environment.\\
+    If~you~go~on,~the~result~may~be~incorrect.
+  }
+\cs_new_protected:Nn \__nm_after_array_i:
+  {
     \group_begin:
     \cs_if_exist:NT \tikz at library@external at loaded
       { \tikzset { external / export = false } }
     \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 }
+    \bool_if:nT { \l__nm_exterior_column_bool && \g__nm_exterior_column_found_bool }
+       { \int_gdecr:N \g__nm_column_int }
     \seq_gclear_new:N \g__nm_yet_drawn_seq
     \bool_if:NT \l__nm_parallelize_diags_bool
       {
@@ -746,13 +765,13 @@
     \dim_gzero_new:N \g__nm_x_final_dim
     \dim_gzero_new:N \g__nm_y_final_dim
     \begin { tikzpicture } [ remember~picture ]
-      \tikz at parse@node\pgfutil at firstofone
+      \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
+      \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 )
@@ -1139,51 +1158,36 @@
     \end { tikzpicture }
     \__nm_draw_tikz_line:
   }
+\cs_generate_variant:Nn \dim_set:Nn { N v }
+\cs_set:Npn \__nm_dotfill:
+  { \cleaders \hbox_to_wd:nn {.44em} {\hss .\hss } \hfill \kern \c_zero_dim }
+
 \cs_new:Nn \__nm_hdottedline:
   {
-    \noalign { \skip_vertical:n { 0.53 pt } }
-    \__nm_hdottedline_i:
-  }
-\cs_new_protected:Nn \__nm_hdottedline_i:
-  {
-    \int_compare:nNnTF \g__nm_row_int < 2
-      { \__nm_error:n { Use~of~hdottedline~in~first~position } }
+    \noalign
       {
         \bool_gset_true:N \g__nm_extra_nodes_bool
-        \bool_if:NF \c__nm_draft_bool
-          {
-            \tl_gput_right:Nx \g__nm_code_after_tl
+        \cs_if_exist:cTF { __nm_width_ \int_use:N \g__nm_env_int }
+          { \dim_set:Nv \l_tmpa_dim { __nm_width_ \int_use:N \g__nm_env_int } }
+          { \dim_set:Nn \l_tmpa_dim { 5 mm } }
+        \hbox_overlap_right:n
+          { \hbox_to_wd:nn
               {
-                \exp_not:N \__nm_hdottedline:n
-                \exp_not:N {
-                \int_eval:n { \g__nm_row_int - 1 }
-                \exp_not:N }
+                \l_tmpa_dim + 2 \arraycolsep
+                - \l__nm_left_margin_dim - \g__nm_right_margin_dim
               }
+            \__nm_dotfill:
           }
       }
   }
-\cs_new_protected:Nn \__nm_hdottedline:n
+\__nm_msg_new:nn { Use~of~hdottedline~in~first~position }
   {
-    \__nm_create_extra_nodes:
-    \dim_zero_new:N \g__nm_x_initial_dim
-    \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
-    \bool_set_true:N \l__nm_initial_open_bool
-    \bool_set_true:N \l__nm_final_open_bool
-    \begin { tikzpicture } [ remember~picture ]
-      \tikz at parse@node\pgfutil at firstofone
-        ( #1 - 1 -large .south~west )
-      \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
-        ( #1 - \int_use:N \g__nm_column_int -large .south~east )
-      \dim_gset:Nn \g__nm_x_final_dim \pgf at x
-      \dim_gset:Nn \g__nm_y_final_dim \pgf at y
-    \end { tikzpicture }
-    \__nm_draw_tikz_line:
+    You~can't~use~the~command~\token_to_str:N\hdottedline\ in~the~first~row~
+    of~the~environment~\{\@currenvir\}.~But~maybe~you~have~used~l,~c~and~r~
+    instead~of~L,~C,~R~in~the~preamble~of~the~array.\\
+    If~you~go~on,~this~dotted~line~will~be~ignored.
   }
-\__nm_msg_new:nn { Use~of~hdottedline~in~first~position }
+\__nm_msg_new:nn { Use~of~hdottedline~in~first~position~bis }
   {
     You~can't~use~the~command~\token_to_str:N\hdottedline\ in~the~first~row~
     of~the~environment~\{\@currenvir\}. \\
@@ -1203,7 +1207,17 @@
             \dim_zero_new:N \g__nm_y_final_dim
             \bool_set_true:N \l__nm_initial_open_bool
             \bool_set_true:N \l__nm_final_open_bool
-            \cs_if_exist:cTF
+            \begin { tikzpicture } [ remember~picture ]
+              \tikz at parse@node\pgfutil at firstofone
+                ( 1 - #1 - large .north~east )
+              \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
+                ( \int_use:N \g__nm_row_int - #1 - large .south~east )
+              \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_if_exist:cT
               { pgf at sh@ns at nm -\int_use:N \g__nm_env_int - 1 - #1 - w }
               {
                 \begin { tikzpicture } [ remember~picture ]
@@ -1210,27 +1224,13 @@
                   \tikz at parse@node\pgfutil at firstofone
                     ( 1 - #1 - w .north~east )
                   \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
                     ( \int_use:N \g__nm_row_int - #1 - w .south~east )
                   \dim_gset:Nn \g__nm_x_final_dim \pgf at x
-                  \dim_gset:Nn \g__nm_y_final_dim \pgf at y
                 \end { tikzpicture }
                 \dim_gadd:Nn \g__nm_x_initial_dim \arraycolsep
                 \dim_gadd:Nn \g__nm_x_final_dim \arraycolsep
               }
-              {
-                \begin { tikzpicture } [ remember~picture ]
-                  \tikz at parse@node\pgfutil at firstofone
-                    ( 1 - #1 - large .north~east )
-                  \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
-                    ( \int_use:N \g__nm_row_int - #1 - large .south~east )
-                  \dim_gset:Nn \g__nm_x_final_dim \pgf at x
-                  \dim_gset:Nn \g__nm_y_final_dim \pgf at y
-                \end { tikzpicture }
-              }
             \__nm_draw_tikz_line:
           }
       }
@@ -1303,10 +1303,12 @@
 \cs_new_protected:Nn \__nm_NiceArrayC:n
   {
     \bool_set_true:N \l__nm_exterior_column_bool
+    \bool_gset_false:N \g__nm_exterior_column_found_bool
     \begin { NiceArray }
       { #1
         >
           {
+            \bool_gset_true:N \g__nm_exterior_column_found_bool
             \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 }
@@ -1487,7 +1489,7 @@
           \dim_zero_new:c { l__nm_row_\__nm_i _max_dim }
           \dim_set:cn { l__nm_row_\__nm_i _max_dim } { - \c_max_dim }
         }
-      \int_step_variable:nnnNn 1 1 \g__nm_column_total_int \__nm_j
+      \int_step_variable:nNn \g__nm_column_total_int \__nm_j
         {
           \dim_zero_new:c { l__nm_column_\__nm_j _min_dim }
           \dim_set_eq:cN { l__nm_column_\__nm_j _min_dim } \c_max_dim
@@ -1510,8 +1512,8 @@
                       \dim_set:cn { l__nm_column _ \__nm_j _ min_dim}
                         { \dim_min:vn { l__nm_column _ \__nm_j _min_dim } \pgf at x }
                     }
-                 \tikz at parse@node \pgfutil at firstofone
-                   ( nm - \int_use:N \g__nm_env_int - \__nm_i - \__nm_j .north~east )
+                  \tikz at parse@node \pgfutil at firstofone
+                    ( nm - \int_use:N \g__nm_env_int - \__nm_i - \__nm_j .north~east )
                   \dim_set:cn { l__nm_row _ \__nm_i _ max_dim }
                     { \dim_max:vn { l__nm_row _ \__nm_i _ max_dim } \pgf at y }
                   \seq_if_in:NxF \g__nm_multicolumn_cells_seq { \__nm_i - \__nm_j }
@@ -1525,7 +1527,7 @@
       \tikzset { name~suffix = -medium }
       \__nm_create_nodes:
       \int_set:Nn \l__nm_nb_first_row_int 1
-      \int_step_variable:nnnNn 1 1 { \g__nm_row_int - 1 } \__nm_i
+      \int_step_variable:nNn { \g__nm_row_int - 1 } \__nm_i
         {
           \dim_set:cn { l__nm_row _ \__nm_i _ min _ dim }
             {
@@ -1538,7 +1540,7 @@
           \dim_set_eq:cc { l__nm_row _ \int_eval:n { \__nm_i + 1 } _ max _ dim }
             { l__nm_row_\__nm_i _min_dim }
         }
-      \int_step_variable:nnnNn 1 1 { \g__nm_column_int - 1 } \__nm_j
+      \int_step_variable:nNn { \g__nm_column_int - 1 } \__nm_j
         {
           \dim_set:cn { l__nm_column _ \__nm_j _ max _ dim }
             {
@@ -1563,6 +1565,22 @@
       \__nm_create_nodes:
       \end{tikzpicture}
       \cs_set:Nn \__nm_create_extra_nodes: { }
+      \begin { tikzpicture } [ remember~picture , overlay ]
+         \tikz at parse@node \pgfutil at firstofone
+           ( nm - \int_use:N \g__nm_env_int - 1 - 1 - large .north~west )
+         \dim_gset:Nn \g_tmpa_dim \pgf at x
+         \tikz at parse@node \pgfutil at firstofone
+           ( nm - \int_use:N \g__nm_env_int - 1 -
+                  \int_use:N \g__nm_column_int - large .north~east )
+         \dim_gset:Nn \g_tmpb_dim \pgf at x
+      \end   { tikzpicture }
+      \iow_now:Nn \@mainaux \ExplSyntaxOn
+      \iow_now:Nx \@mainaux
+        {
+          \cs_gset:cpn { __nm_width_ \int_use:N \g__nm_env_int }
+            { \dim_eval:n { \g_tmpb_dim - \g_tmpa_dim } }
+        }
+      \iow_now:Nn \@mainaux \ExplSyntaxOff
   }
 \cs_new_protected:Nn \__nm_create_nodes:
   {
@@ -1627,7 +1645,7 @@
 \cs_new:Npn \__nm_seq_mapthread_function:NNN #1 #2 #3
   {
    \group_begin:
-   \int_step_inline:nnnn 1 1 { \seq_count:N #1 }
+   \int_step_inline:nn { \seq_count:N #1 }
      {
        \seq_pop:NN #1 \l_tmpa_tl
        \seq_pop:NN #2 \l_tmpb_tl



More information about the tex-live-commits mailing list