3

I'm trying to draw movement arrows in the following tree (it works with the \qtree package) :

\Tree [.CP [\qroof{which book on syntax}.DP ] [.C' [.C will ] [.TP [\qroof{The students}.DP ]  [.T' [.<T> will ] [.V' [.V buy ] [\qroof{which book on syntax}.DP ] ] ] ] ] ]

I've tried to implement the neat explanation in Alan Munn's answer on this thread More efficient way to draw movement arrow to roof in tikz-qtree, but I made a mistake somewhere, and I don't know where :

\documentclass{article}

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

\begin{document}


\begin{tikzpicture}
\Tree 
[.CP 
    [.DP \edge[roof]; \node (x) {which book on syntax}; ] 
    [.C$' $
         [.C {will} ; ]
         [.TP 
            [.DP \edge[roof]; {The students}; ]  
            [.T' 
                [.$<$T$>$ {will}; ]
                [.V$'$ 
                    [.V {buy}; ] 
                    [.DP \edge[roof]; \node (y) {which book on syntax} ] 
                ] 
            ] 
         ] 
    ] 
]

\draw[->] (y) [in=-90,out=-90,looseness=1.5]  to (x);
\end{tikzpicture}

\end{document}

The error message I'm getting is:

! Package pgf Error: No shape named y is known. See the pgf package documentation for explanation.

I've tried to find the answer in the pgf manual, but since this is a mix of tikz and qtree, I just can't seem to find it. I'm posting it here on the off-chance that it's visible immediately to the experienced eye.

1 Answer 1

5

You're missing a semicolon after your \node (y) command (all TikZ commands end in a semicolon). You've also got lots of extra semicolons you don't need which I've removed, and a spurious space in your $C' $ node.

I've also removed some extra braces around things that aren't needed (although not a problem) and removed the lines between your heads and the words (which is linguisitically incorrect).

\documentclass{article}

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

\begin{document}


\begin{tikzpicture}
\Tree 
[.CP 
    [.DP \edge[roof]; \node (x) {which book on syntax}; ] 
    [.C$'$
         [.C\\will ]
         [.TP 
            [.DP \edge[roof]; {The students} ]  
            [.T' 
                [.$<$T$>$\\will ]
                [.V$'$ 
                    [.V\\buy ] 
                    [.DP \edge[roof]; \node (y) {which book on syntax}; ] 
                ] 
            ] 
         ] 
    ] 
]
\draw[->] (y) [in=-90,out=-90,looseness=1.5]  to (x);
\end{tikzpicture}

\end{document}

output of code

1
  • 1
    Thank you very much for your correction, and for the initial code, it was most helpful!
    – VinceNoir
    Commented Nov 22, 2018 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .