I want to draw different kinds of graphs which I want to define using styles. One particular graph has labelled nodes, and I want to be able to attach these labels using a custom key (cn
).
The following document demonstrates this, the problem is, that the node labels specified using cn
do not show up.
\documentclass{standalone}
\usepackage{tikz}
\tikzstyle{RegionGraph}=[
every node/.style={fill=blue!20},
every edge/.style={draw,latex-},
cn/.style={label={#1}}
]
\begin{document}
\begin{tikzpicture}[RegionGraph]
\draw (0,0) node[cn=1] (lr1) {$X_1$}
++(2,0) node[cn=0] (lr2) {$X_2$} edge (lr1);
\end{tikzpicture}
\end{document}
Where as, when I add the definition of the cn
-style directly to the picture, like in the following code, the labels do show.
\begin{tikzpicture}[RegionGraph,cn/.style={label={#1}}]
...
What am I doing wrong and how can it be fixed?