Posts

Showing posts from February 2, 2019

Call for node distance as a variable in TikZ

Image
5 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)