Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 6 down vote accepted

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 '.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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