Is it possible to use the node distance as a variable while expressing coordinates of new nodes with Calc and Positioning libraries? What I want to have is everything within a single piece of code for tikz picture.
This is what I have now.
\documentclass[12pt, a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows,calc}
\begin{document}
\begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node distance=2cm,semithick,on grid]
\tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
\node[state,label=center:$a$,inner sep=0pt] (a) {};
\node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:1cm) $) {};
\node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:1cm)$) {};
\path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
\path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
\end{tikzpicture}
\end{document}
I would like to be able to change the below expression with something like:
$(a) + sqrt(1/3)*2*(1:\nodedistance)$
Then if I would be copying the code elsewhere, such as a presentations, I would be able to change all these distances at once. Is that possible? If not, introducing a variable in the first line of the TikZ code, and using it afterwards instead the "\nodedistance", would also do.
Sorry if it's a dull question, I'm pretty new to TikZ.


/tikz/node distance/.append code={...}does what you want. This allows you to store the distance in a key that you can use. – Feb 03 '19 at 00:56