1

I would like to take the following code that I created and do something along the lines in http://alpage.inria.fr/~clerger/tutorial/tag_example.png for the middle two trees where dotted lines are connecting the Vs to the V in the left tree. Is that possible (I prefer tikz)?

\documentclass{article}
\usepackage{qtree}


\begin{document}


\begin{tabular}{ll}

\Tree [.S [.NP John ] [.VP [.V sleeps ] ] ]

&

\Tree [.V [.V ] [.Adv a lot ] ]

\end{tabular}


\end{document}

It would also be nice not to split "a lot" into two nodes as in my tree and not in the example I sent.

1

Is using tikz-qtree an option? Then you can place both trees in the same tikzpicture, using a scope to xshift the second one, adding named nodes to the tree where needed, and drawing arrows between those nodes.

For the last question: {a lot}, not a lot.

enter image description here

\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{amsmath}

\begin{document}
\begin{tikzpicture}

\Tree [.\node (s) {S}; [.NP John ] [.VP [.\node(v1){V}; sleeps ] ] ]

\begin{scope}[xshift=3cm]
\Tree [.\node(v2){V}; [.\node(v3){V}; ] [.Adv {a lot} ] ]
\end{scope}

\path (s) -- node[yshift=4pt] {$\stackrel{\text{adj}}{\implies}$} (v2);

\draw [red,dashed,-stealth] (v2) to[bend right] (v1);
\draw [red,dashed,-stealth] (v3) to[bend right] (v1);
\end{tikzpicture}

\end{document}
  • May I also ask how you would go on about drawing the double arrows in between trees? If I just see an example here for the above two trees (though there are no double arrows between them in the original example), I think I will be able to generalize. – user2299502 Apr 9 '18 at 13:53
  • @user2299502 You mean the ones with subst and adj at the top of the diagram? You could do something like \node at (1.5,0) {$\stackrel{adj}{\implies}$}; (requires \usepackage{amsmath}). – Torbjørn T. Apr 9 '18 at 13:58
  • (Added vanilla qtree version of this answer.) – alexis Apr 11 '18 at 0:06
  • @alexis "You can also place two trees made with regular qtree in the same tikzpicture" -- only if the entire trees are placed inside nodes, and then you have nest a tikzpicture inside it again to get named nodes (bad practice). And it isn't what you did in your answer either. You placed three separate tikzpictures inside qtree trees, and used a fourth tikzpicture to draw the lines. By the way, if TikZ is used elsewhere in the OPs document, \tikzstyle{every picture}+=[remember picture] could cause problems, so I'd probably avoid it. – Torbjørn T. Apr 11 '18 at 6:21
  • You're right, I discovered the same when I tried it out-- that's why I ended up writing a separate answer. Neglected to correct the original comment; deleted now. – alexis Apr 13 '18 at 15:29
1

There's no need to use tikz-qtree for this: Although regular qtree doesn't use tikz internally, it is fully compatible with it. Here is Torbjørn's tikz solution translated to use regular qtree (and using the OP's method for placing trees side by side):

\documentclass{article}
\usepackage{tikz}
\usepackage{qtree}

\tikzstyle{every picture}+=[remember picture] 

\begin{document}

\begin{tabular}{ll}
\Tree [.S [.NP John ] [.VP [.\tikz\node(v1){V}; sleeps ] ] ]
&
\Tree [.\tikz\node(v2){V}; [.\tikz\node(v3){V}; ] [.Adv {a lot} ] ]
\end{tabular}

\begin{tikzpicture}[overlay]
\draw [red,dashed,-stealth] (v2) to[bend right] (v1);
\draw [red,dashed,-stealth] (v3) to[bend right] (v1);
\end{tikzpicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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