2

I want to specify the parameters once and then apply them to a large number of \Vertex nodes.

I.e. for regular tikz nodes you can use \tikzstyle for repeating parameters for nodes. Also I want to set the parameters for \Vertex and not the underlying \node.

\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{tikz-network}
\tikzstyle{my_tikz_style}=[fill=green]
\tikzstyle{my_network_style}=[Math]
\tikzstyle{my_network_style_wrong}=[fill=red]
\begin{document}
\begin{tikzpicture}
  \node[my_tikz_style] (A) at (0,1){};
  \Vertex[Math,y=2]{B}
  % what works, but what I don't want: 
  \Vertex[y=3,style=my_network_style_wrong]{C}

% what i want, but doesn't work: %\Vertex[my_network_style,y=4]{D} \end{tikzpicture} \end{document}

I haven't found any way to do this in tikz network documentation.

If you can name decent alternative to the package tikz-network, please

wotanii
  • 123

1 Answers1

2

Reading the package documentation, it seems there is the possibility to set the style for all the \Vertex but not to create a style to use for some of them containing the boolean Math.

Try with a new command.

\documentclass{article}
%\usepackage{tikz}% tikz-network already loads TikZ
\usepackage{tikz-network}
% See: https://tex.stackexchange.com/questions/52372/should-tikzset-or-tikzstyle-be-used-to-define-tikz-styles
\tikzset{
    my_tikz_style/.style={fill=green},
    my_network_style_wrong/.style={fill=red}
    }
\newcommand{\mynetworkstyle}{Math}

\begin{document} \begin{tikzpicture} \node[my_tikz_style] (A) at (0,1){}; \Vertex[Math,y=2]{B} % what works, but what I don't want: \Vertex[y=3,style=my_network_style_wrong]{C}

% what you want: \Vertex[\mynetworkstyle,y=4]{D} \end{tikzpicture} \end{document}

enter image description here

CarLaTeX
  • 62,716