[Tex/LaTex] More efficient way to draw movement arrow to roof in tikz-qtree

linguisticstikz-pgftikz-qtreetikz-trees

When drawing syntactic representations in linguistics, one often uses a triangle to represent a unit whose internal structure is irrelevant. This can be accomplished with the tikz-qtree command \edge[roof]; {John}.

Now, sometimes I need to show the movement of such a unit whose internal structure is irrelevant to the point at hand. To do this, I usually make use of the positioning library, and define a node relative to the node above the triangle, like so:

\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-qtree}
\tikzset{every tree node/.style={align=center, anchor=north}}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
\Tree
[.TP
    [.\node(DP1-rel){DP}; \edge[roof]; {John} ]
    [.T$'$
        [.T ]
        [.\emph{v}P
            [.\node(DP2-rel){DP}; \edge[roof]; {$<$John$>$} ]
            [.\emph{v}$'$
                [.\emph{v}
                    [.V \node(V1){likes}; ]
                    [.\emph{v} ]
                ]
                [.VP
                    [.V \node(V2){$<$likes$>$}; ]
                    [.DP \edge[roof]; {Mary} ]
                ]
            ]
        ]
    ]
]
\node (DP1) [below=1cm of DP1-rel] {};
\node (DP2) [below=1cm of DP2-rel] {};
\draw[->] (DP2)..controls +(south west:1) and +(south:1)..(DP1);
\draw[->] (V2)..controls +(south:1) and +(south:1)..(V1);
\end{tikzpicture}

\end{document}

syntactic-tree

Is there an easier/better way to do this, where I don't have to define a relative node each time I need to move a unit whose internal structure is irrelevant (i.e., whose structure I'm representing with a triangle, using the tikz-qtree command \edge[roof]; {John})?

Best Answer

You can just make the text of the roof a node. (I also simplified the arrow syntax a bit.)

\documentclass{article}

\usepackage{tikz-qtree,tikz-qtree-compat}
\tikzset{every tree node/.style={align=center, anchor=north}}

\begin{document}


\begin{tikzpicture}
\Tree
[.TP
    [.DP \edge[roof]; \node (J) {John}; ]
    [.T$'$
        [.T ]
        [.\emph{v}P
            [.DP \edge[roof]; \node (Jtrace) {$<$John$>$}; ]
            [.\emph{v}$'$
                [.\emph{v}
                    [.V \node(V1){likes}; ]
                    [.\emph{v} ]
                ]
                [.VP
                    [.V \node(V2){$<$likes$>$}; ]
                    [.DP \edge[roof]; {Mary} ]
                ]
            ]
        ]
    ]
]

\draw[->] (Jtrace) [in=-90,out=-90,looseness=1.5]  to (J);
\draw[->] (V2) [in=-90,out=-90]  to (V1);
\end{tikzpicture}

\end{document}

output of code