答案1
欢迎!假设你想在这里使用你的树,你可以这样做
\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}
同样的方法也适用于森林。