4

I have this small tree and I want to draw a line between the edges from node A to node B.

\begin{tikzpicture}[scale=0.8, level distance=1.5cm,
  every node/.style={draw, thick, rectangle, minimum width=2cm, minimum height=1cm, sibling distance=4cm, transform shape}]

\tikzset{edge from parent/.style={draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}}}

\Tree [ . \node (R){Crack password};
                            \node (A) {Acquire shadow file};
                            \node (B) {Acquire passwd file};
                        ]

\path (R) -- coordinate[left] (PA) (A);
\path (R) -- coordinate[right] (PB) (B);

\draw (PA) to[bend right=25] (PB);

\end{tikzpicture}

Picture of the problem

As we can see in the picture the bend line is being offset to the right. And I have no idea why.

2

You can specify north and south when you draw the paths between the nodes.

Output

figure 1

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz-qtree}

\usetikzlibrary{shapes,arrows,positioning}

\begin{document}
\begin{tikzpicture}[scale=0.8, level distance=1.5cm,
  every node/.style={draw, thick, rectangle, minimum width=2cm, minimum height=1cm, sibling distance=4cm, transform shape}]

\tikzset{edge from parent/.style={draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}}}

\Tree [ . \node (R){Crack password};
                            \node (A) {Acquire shadow file};
                            \node (B) {Acquire passwd file};
                        ]

\path (R.south) -- coordinate[left] (PA) (A.north);
\path (R.south) -- coordinate[right] (PB) (B.north);

\draw (PA) to[bend right=25] (PB);

\end{tikzpicture}
\end{document}
  • @Stene You're welcome, sir! :D – Alenanno May 20 '15 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.