2

I'm trying to add either a word or a tree to the DP node that is connected to the main tree by the wavy lines, in the same way that the V node has the expression "smokes" below it. How can I do this?

\documentclass[12pt,a4paper]{article}   
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}

\begin{document}
\ex.
\leavevmode\vadjust{\vspace{-\baselineskip}}\newline
\begin{tikzpicture}
\tikzset{level 1+/.style={sibling distance=2\baselineskip}}
\Tree [.\node(z){TP}; \edge[white]; ˜ [.T\1 T [.\node(y){DP}; \edge[white];
˜ [.V smokes ]]]]
\node (x) at (-4,-4) {DP}  ; 
\draw (x.east) to [out=0, in=180] (y.south); 
\draw (x.east) to [out=0, in=180] (z.south);
%\draw[help lines] (-4,-4) grid (4,4)
\end{tikzpicture}

\end{document}
Alenanno
  • 37,338
user65526
  • 845

1 Answers1

3

The problem is that you have two \Tree commands in one tikzpicture so Tikz confuses them and thinks they are just one tree. Usually this is solved by enclosing each in a separate tikzpicture but in your case this is not advisable. A less invading way to do the same thing is to use scopes.

In this case we'll apply the shift to the scope itself and not the main node of the second tree.

Output

figure 1

Code

\documentclass[12pt,a4paper]{article}   

\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}

\begin{document}
%\ex
\leavevmode\vadjust{\vspace{-\baselineskip}}\newline
\begin{tikzpicture}
\begin{scope}
\tikzset{level 1+/.style={sibling distance=2\baselineskip}}
\Tree [.\node(z){TP}; \edge[white]; ˜ [.T\1 T [.\node(y){DP}; \edge[white];
˜ [.V smokes ]]]]
\end{scope}
\begin{scope}[shift={(-4,-4)}]
\Tree [.\node(x){DP}; [.smokes ]] 
\end{scope}
\draw (x.east) to [out=0, in=180] (y.south); 
\draw (x.east) to [out=0, in=180] (z.south);
%\draw[help lines] (-4,-4) grid (4,4)
\end{tikzpicture}
\end{document}
Alenanno
  • 37,338