tikz-network icon indicating copy to clipboard operation
tikz-network copied to clipboard

Argument Spacing When Using lw Option for \ Edge Causes Compile Error in Latexmk with Tikz-Network Package

Open DiegoBneiNoah opened this issue 6 years ago • 3 comments

Writing the code with no spaces between the arguments of "\Edge[h local options i](Vertex i)(Vertex j)" normally handles processing:

\documentclass{article}
\usepackage {tikz-network}
\thispagestyle {empty}
\begin {document}
\begin {tikzpicture}
\Vertex{A} \Vertex [x = 2] {B} \Vertex [x = 2, y = -1] {C}
\Edge [lw = 3pt] (A) (B)
\Edge [lw = 5pt] (A) (C)
\end {tikzpicture}
\end {document}


But if there is spacing (whatever that is) between the arguments of "\Edge[h local options i](Vertex i)" as shown below:

\documentclass{article}
\usepackage{tikz-network}
\thispagestyle {empty}
\begin {document}
\begin {tikzpicture}
\Vertex {A} \Vertex [x = 2] {B} \Vertex [x = 2, y = -1] {C}
% Case 1: space between <[lw = 3pt]> and <(A)(B)>
\Edge [lw = 3pt] (A)(B)
% Case 2 (below): or even if there is a space between <(A)> and <(C)> as below
\Edge[lw = 5pt](A) (C)
\end {tikzpicture}
\end {document}


I get the following errors in their order as is the spacing in the code above:

Case 1 - Space between <[lw = 3pt]> and <(A)(B)> returns the following error:

Runaway argument?
(A)(B) \ end {tikzpicture} \ end {document}
! File ended while scanning use of \ @edge.
<inserted text>
\pair
<*> 17.tex
       
?

Case 2 - Space between <[lw = 5pt] (A)> and <(C)> returns the following error:

! Undefined control sequence.
\ pgfonlayer @ assert @ is @ active ... fonlayer @ isactive
                                                  {0} \ expandfter \ pgf @ asser ...

1.8 \ Edge [lw = 5pt] (A) (C)
                     
?

Note 1: Putting spacing between <\Edge> and <[h local options i](Vertex i)(Vertex j)> returns no error. Note 2: Examples taken from Section 2.2, page 15 of https://ctan.org/pkg/tikz-network. Note 3: Command latexmk and Zathura viewer were used. Apparently everything is related to using the lw (\Edge line width size) option. Note 4: As advised at https://tex.stackexchange.com/a/501300/178949 by user TeXnician there is apparently a guideline in the code script preventing the inclusion of spacing.

DiegoBneiNoah avatar Jul 24 '19 02:07 DiegoBneiNoah

Thank you for pointing that out. As TeXnician already mentioned in his answer on https://tex.stackexchange.com/a/501300/178949, this is a property of the \def command. As long as this space between (A) and (B) has not been defined, LaTeX expects the following command chain: \Edge[#1](#2)(#3) (without spaces).

To adjust the command to your preferences, you would have to change your tikz-network.sty file as follows:

Change line 585 from:

\def\@edge[#1](#2)(#3){

to

\def\@edge[#1] (#2) (#3){

It is not planned to add this feature in the near future, but I will add it to the enhancement list. If time permits, I will include it in the next version of tikz-network.

hackl avatar Jul 29 '19 14:07 hackl

Greatfull @hackl .

DiegoBneiNoah avatar Jul 29 '19 19:07 DiegoBneiNoah

I decided to reopen the issue to receive future notice of changes intended by @hackl

DiegoBneiNoah avatar Jul 30 '19 13:07 DiegoBneiNoah