# Help in Tree diagram using Tikz package

My requirement is as follow:

I've achieved this by using the below tag:

\documentclass[10pt]{book}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{linguex}%
\usepackage{tikz}%
\usetikzlibrary{decorations.text,calc,arrows.meta}%
\usepackage{tikz-qtree}%

%\usepackage{showframe}
\begin{document}

\ex.
\a. John destroyed the sandcastle.
\b.
\Tree [.InitP [.{\sc initiator} { John} ] [ [.Init ] [.ProcP
[.{\sc undergoer} { the sandcastle} ] [ [.Proc ] [.ResP [.{\sc
resultee} { $<$the sandcastle$>$ } ] [ [.Res ] [.XP \edge[roof];
{\sc ground$/$final state} ] ] ] ] ] ] ]

\end{document}


And the output comes as:

This is easy to do by creating named nodes for the relevant heads of your phrases and then using the positioning library to add a node to the left. I've used arrows to connect the nodes; if you just want a line with no arrowhead, remove the -> from the \draw commands. If you have a lot of these trees, you may find it easier to do this using the forest package instead of tikz-qtree, since it allows you to instantly create a named node simply by adding a name=... key.

I've added both solutions into one document. I've also replaced the times package with newtxtext and newtxmath; The times package is deprecated. I've also changed all your \sc to \scshape since two letter font changing commands are also deprecated (see Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX? for why). I've created a macro for bar levels, \1 this is defined already within a \Tree environment if you load the tikz-qtree-compat package, but is useful to have more generally for syntax.

I've also made a few other cosmetic changes to your tree (and since the tree you've drawn doesn't include Tense, I've left it off of the label.)

\documentclass[10pt]{book}
\usepackage[T1]{fontenc}
\usepackage{newtxmath,newtxtext} % don't use {times} it's deprecated
\usepackage{linguex}%
\usepackage{tikz}%
\usetikzlibrary{positioning}%
\usepackage{tikz-qtree,tikz-qtree-compat}%
\usepackage[linguistics]{forest}
\newcommand*\1{\ensuremath{'}}

\begin{document}

\ex.
\a. John destroyed the sandcastle.
\b.
\begin{tikzpicture}[baseline]
\Tree [.InitP [.{{\scshape initiator}\\John} ] [.Init\1 [.\node(Init){Init}; ] [.ProcP
[.{{\scshape undergoer}\\the sandcastle} ] [.Proc\1 [.\node(Proc){Proc}; ] [.ResP [.{{\scshape
resultee}\\$<$the sandcastle$>$ } ] [.Res\1 [.\node(Res){Res}; ] [.XP \edge[roof];
{\scshape ground$/$final state} ] ] ] ] ] ] ]
\node [below left=3cm of Init,font=\itshape] (D) {destroy};
\draw[->] (D.east) -- (Init);
\draw[->] (D.east) -- (Proc);
\draw[->] (D.east) -- (Res);
\end{tikzpicture}
\b.
\begin{forest}
[InitP [{{\scshape initiator}\\John} ] [Init\1 [Init,name=Init  ] [ProcP
[{{\scshape undergoer}\\the sandcastle} ] [Proc\1 [Proc,name=Proc  ] [ResP [{{\scshape
resultee}\\$<$the sandcastle$>$ } ] [Res\1 [Res,name=Res  ] [XP[{\scshape ground$/$final state},roof ] ] ] ] ] ]]]
\node [below left=3.5cm of Init,font=\itshape] (D) {destroy};
\draw[->] (D.east) -- (Init);
\draw[->] (D.east) -- (Proc);
\draw[->] (D.east) -- (Res);
\end{forest}

\end{document}


• By using this suggestion, vertical bar between the text "initiator" and "John" was missed, please suggest... – MadyYuvi Dec 8 '17 at 9:23
• @MadyYuvi That was deliberate on my part. But if you want to put it back, then instead of the node [{{\scshape Initiator}\\John} ] use [{\scshape Initiator} [ John ]]. But this is not really appropriate, since John isn't a terminal node in the tree. So if you really must show structure there, I would use [{\scshape Initiator} [ John,roof ]] (this is using forest syntax). The tikz-qtree version would be [.InitP [.{\scshape initiator} \edge[roof]; John ] – Alan Munn Dec 8 '17 at 11:58
• is it possible to fix the Tree within text width without using the tag "\begin{adjustbox}...\end{adjustbox}, hence this will reduce the font size by auto.... – MadyYuvi Dec 15 '17 at 13:17
• @MadyYuvi There are limited things you can do in tikz-qtree. You can make a negative sibling distance: \begin{tikzpicture}[baseline,sibling distance=-15pt] ... will reduce the branch widths substantially in this example without sacrificing readability. You can also add a negative xshift to the picture to shift the tree leftwards a bit. Forest trees are optimized for compactness, (as you can see) so there's less you can do to make them more compact. – Alan Munn Dec 16 '17 at 16:54