# Connecting two nodes in tree rectangular

I want to draw a tree like this:

The closest I could get to this was the following code:

\documentclass{minimal}

\usepackage{tikz-qtree}

\begin{document}

\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=2\baselineskip}}
\Tree[.IP NP
[.VP [.\node(v){V}; [ \node(v1){}; ] ]
NP
[.PP [.\node(p){P}; \node(p1){}; ]
NP ]
]
]
\draw (v) -- (v1) -- (p1) -- (p);
\end{tikzpicture}

\end{document}


But this involves empty auxiliary nodes and the lines have some space in the middle. Is there a simpler way to do this? Are there options to \drawthat can do this?

-

You can use the orthogonal intersection node and a little manual shift.

\documentclass{standalone}
\usepackage{tikz-qtree}

\begin{document}

\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=2\baselineskip}}
\Tree[.IP NP
[.VP [.\node(v){V};]
NP
[.PP [.\node(p){P};]
NP ]
]
]
\draw (v) |-  ([yshift=-5mm]v |- p) -| (p);
\end{tikzpicture}

\end{document}


-
Thanks! What does the manual shift do? Does it shift a v |- pobject? –  Stefan Müller Dec 2 '12 at 18:18
@StefanMüller It finds the orthogonal intersection (going down from v vertically and going to p horizontally. Then shifts 5mm down. –  percusse Dec 2 '12 at 18:28