0

I'm trying to add descriptions to certain nodes in a Syntax tree. I'm using qtree, but I can't seem to find a way to do this. I'm also trying to box some, but not all of the nodes in the tree. Here's an idea of what I'm looking for:

enter image description here

I just have some very simple tree code for now:

\Tree[.NP [.Det that ] [.N' [.N student ] [.PP \edge[roof]; {of physics} ] ] ]

Thanks for the help!

js bibra
  • 21,280
  • https://tex.stackexchange.com/questions/361148/forest-for-linguistics-proportional-alignment-like-in-qtree?rq=1 – js bibra Jan 08 '20 at 23:49
  • https://tex.stackexchange.com/questions/5447/how-can-i-draw-simple-trees-in-latex/254926#254926 – js bibra Jan 08 '20 at 23:52
  • https://tex.stackexchange.com/questions/17600/how-to-draw-syntactical-trees-with-parallel-leaves-for-a-natural-language/17605#17605 – js bibra Jan 08 '20 at 23:54

1 Answers1

0

Welcome! Assuming you want to use your tree here, you could do

\documentclass{standalone}
\usepackage{tikz-qtree,tikz-qtree-compat}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}[every pin edge/.style={stealth-,shorten <=0.5pt},
Fit/.style={draw,inner sep=0.2pt,fit=#1},sibling distance=1em,font=\sffamily]
\Tree[.NP 
 [.\node(Det){Det}; \node(that){that}; ] 
 [.N' 
    [.\node(N){N}; \node(S){student}; ] 
    [.\node(PP){PP}; \edge[roof]; \node(OP){of physics}; ] 
 ] 
]
%
\node[Fit=(Det)(that),pin=left:specifier]{};
\node[Fit=(N)(S),pin=below:head]{};
\node[Fit=(PP)(OP),pin=right:complement]{};
\end{tikzpicture}
\end{document} 

enter image description here

The same methods work for forest.