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!

  • 1
    While qtree can probably be made work with standard tikz commands in a similar manner, it might be worth looking into the forest package, which provides wonderfully many decoration options in its documentation. p. 8. has something along the lines of what you are looking for, one would just need to adapt the tikz commands to the precise directions. – lemontree Jan 9 at 13:31
  • Are you asking how to draw a tree of the NP "that student of physics"? – BillJ Jan 9 at 20:20
  • 1
    @BillJ No. The OP asks how to typeset the above examples with LaTeX. They already provided the tree they want. – lemontree Jan 9 at 20:46
  • @BillJ I just needed to know how to typeset it in LaTeX, I already have the tree :) – sebastian05 Jan 10 at 15:17
  • 1
    I'm voting to close this question as off-topic because it is a programming question that belongs to TeX - LaTeX – bytebuster Jan 16 at 0:51

Here is a version using the package forest:

\forestset{sn edges/.style={for tree={%
    s sep+=2pt,% increase the horizontal distance between nodes
    parent anchor=south, child anchor=north% make edges meet at the top


    \node[draw,outer sep=2pt,s sep=2cm,fit to=tree,name=spec]{}; % draw a box around the Adv subtree
    \node[anchor=east,align=center,left=of spec,name=spec-label]{specifier}; % draw a label for the specifier
    \draw[->] (spec-label) -- (spec); % draw an arrow from the label to the box
        \node[draw,outer sep=2pt,fit to=tree,name=head]{};
        \node[anchor=east,align=center,below=of head,name=head-label]{head};
        \draw[->] (head-label) -- (head);
        \node[draw,outer sep=2pt,fit to=tree,name=compl]{};
        \node[anchor=east,align=center,right=of compl,name=compl-label]{complement};
        \draw[->] (compl-label) -- (compl);
            [the party,roof]

enter image description here

One could fiddle around some more with the styling if one doesn't want the boxes to overlap etc., but this should be good enough for a start.

| improve this answer | |

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