I have a chart with relatively positioned nodes. How do I calculate the horizontal distance x, between node "sub3" and node "key" and multiply that value by 2 and use it for the positioning of node "bang2" such that it is aligned with node bang1.
I tried using some of the code from page 54 of the TikZ Manual v2.10 to draw a circle at node "sub3" with a radius reaching to node "bang2" as a test to see if I can calculate this, but it failed. I know that the TikZ example uses absolute positioning rather than relative positioning. I assume this is why my test failed.
\documentclass[12pt]{standalone}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes,backgrounds,fit,calc}
\begin{document}
\begin{tikzpicture}[node distance=3cm, auto]
\tikzset{
mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=red!50,very thick, inner sep=1em, minimum size=3em, text centered},
keynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=orange!50,very thick, inner sep=1em, minimum size=3em, text centered},
bangnode/.style={shape=star, star points=20, star point ratio=1.65,draw=black, top color=white, bottom color=yellow!50,very thick, inner sep=2em, minimum size=3em, text centered,font=\bfseries},
myarrow/.style={->, >=latex', shorten >=1pt, thick},
mylabel/.style={text width=7em, text centered}
}
\node[bangnode](bang1){Bang};
\node[keynode,below left=2cm and 2cm of bang1](key){Key Message};
\node[mynode,below right of=key](sub1){Sub Topic 1};
\node[mynode,below of=sub1](sub2){Sub Topic 2};
\node[mynode,below of=sub2](sub3){Sub Topic 3};
\node[bangnode,below right=2cm and 2cm of sub3](bang2){Bang};
%ARROWS
\draw[<->,bend left=45] (sub1)[]to(sub2);
\draw[<->,bend left=45] (sub2)to(sub3);
\draw[<->,bend left=45] (sub1)to (key);
\draw[<->,bend left=45] (sub2)to (key);
\draw[<->,bend left=45] (sub3)to (key);
%\draw (key) let
% \p1 = ($ (sub3) - (key) $);
% in
% circle ({veclen(\x1,\y1)});
\begin{pgfonlayer}{background}
\node [fill=blue!10,fit=(bang1) (bang2) (sub1)(sub2)(sub3)(key)] {};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
- I know about this answer about getting the halfway distance between nodes
- I also know about this answer about computing the distance between nodes
- I also know about this question for computing horizontal distance between nodes, but it is confusing and does not really answer my question



\p1 = ($ (sub3) - (key) $);and your code would work. – percusse Nov 18 '12 at 23:19