# adding a node to a qroof in tikz-qtree

I need a node in the head element of a qroof in tikz-qtree (using tikz-qtree-compat). I need the 'np' to be a node so I can draw an arrow to it. However, the following breaks:

\documentclass[10pt]{article}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\begin{document}
\begin{tikzpicture}
\Tree [ .TP I [ .T' T[past] [ .\node(vp){vP}; { } [ .v' v\\saw [ .VP { } [ .V' V(saw) \qroof{a man}.\node(nP){nP} ] ] ] ] ] ]
\end{tikzpicture}
\end{document}


The error is: Undefined control sequence \node(nP)nP.

Any ideas on how to accomplish a node there?

-
It is always best to compose a MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. That would not only clarify the question but also help to test that the solution does indeed fix your problem. –  Peter Grill Nov 15 '11 at 18:55
@PeterGrill: sorry. I added one. –  Nate Glenn Nov 15 '11 at 19:00

There are limits to the direct compatibility of qtree commands. The \qroof command is emulated with the \node command, which is why it can't use a \node as its label. But tikz-qtree has its own method for doing roof structures. You should use this for more complex roofs:

\documentclass[10pt]{article}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\tikzset{every tree node/.style={align=center, anchor=north}} % to allow linebreaks
\begin{document}
\begin{tikzpicture}
\Tree [ .TP I [ .T\1 T\\{[past]} [ .\node(vp){vP}; { } [ .v\1 v\\saw
[ .VP { } [ .V\1 V\\(saw) [.\node(nP){nP}; \edge[roof]; {a man} ] ] ] ] ] ] ]
\end{tikzpicture}
\end{document}


P.S. I also cleaned up some of your formatting: you should use \1 for formatting bar levels instead of just '.

-