I'm trying to figure out how to draw simple syntactic trees like the ones here, found in Heim & Kratzer's "Semantics & Generative Grammar." I do not want to include labels such as NP, VP, etc., and I will also need to be able to include more branching than in the examples shown here. Thanks for your help!
2 Answers
Since I happen to have a copy of Heim and Kratzer handy, your question is even more mysterious since most of their trees have labels (although some are unlablelled) and all are binary branching. Here's a tree using the forest package to get you started:
I've used the nice empty nodes style to allow labelless nodes, and created a pad style for nodes that are very small (like the 1 node). The calign with current addition to the DP node flattens the VP tree (without it, the tree looks quite ugly). [Thanks to cfr for that code.]
\documentclass{article}
\usepackage[linguistics]{forest}
\forestset{pad/.style={minimum width=5em}}
\begin{document}
\begin{forest}nice empty nodes
[S
[ {every linguist} ]
[ [1,pad ] [S [ John ]
[ [T,pad ]
[VP [V\\introduced ]
[DP\\$t_{1}$,calign with current ]
[PP\\{to Mary}]]]]]]
\end{forest}
\end{document}
Alternatively, if you don't mind how straight the empty node branches are, then you can use a slightly different definition for the empty nodes. This is probably better with non-binary trees. (And doesn't need the manual fixup in the DP node.)
\documentclass{article}
\usepackage[linguistics]{forest}
\forestset{pad/.style={minimum width=5em},
empty nodes/.style={
delay={where content={}{shape=coordinate,for parent={
for children={anchor=north}}}{}}
}}
\begin{document}
\begin{forest} empty nodes
[S
[ {every linguist} ]
[ [1,pad] [S [ John ]
[ [T,pad]
[VP [V\\introduced, ]
[DP\\$t_{1}$ ]
[PP\\{to Mary}]
]]]]]
\end{forest}
\end{document}
- 218,180
-
1(+1) For Forest 2. I'm not sure
nice empty nodesis a good idea unless the tree is at least primarily binary branching. – cfr Sep 25 '16 at 00:27
'More branching' is ambiguous. You might mean that you need some nodes to have more than 2 children or you might mean that you just need more binary branches.
In the second case, just using the linguistics library with nice empty nodes will do a lot for your tree. In the first case, however, nice empty nodes will cause problems. If your tree is mostly binary, as in AlanMunn's example, then overriding its effects on an ad hoc basis is a reasonable option. If, however, it diverges much further, you are better off not using nice empty nodes here at all.
Here's an adaption of Alan's example which demonstrates the problem.
\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[linguistics]{forest}
\forestset{pad/.style={minimum width=5em}}
\begin{document}
\begin{forest}
nice empty nodes
[S
[{every linguist}
]
[
[1, pad
]
[Additional thing]
[Other thing]
[S
[ John
]
[
[T, pad
]
[VP
[V\\introduced
]
[DP\\$t_{1}$, calign with current
]
[PP\\{to Mary}
]
]
]
]
]
]
\end{forest}
\end{document}
In this case, calign with current is not much help since we'll get either
There are two problems here. One is that there are an even number of children so there is no middle child to align with the parent. The other is that the non-binary branching is not restricted to terminal nodes of the tree.
It might be better in such cases to try to make the empty nodes less ugly rather than nice. For example,
\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[linguistics]{forest}
\forestset{%
pad/.style={minimum width=5em},
less ugly empty nodes/.style={%
nice empty nodes,
before typesetting nodes={%
where={(n_children())>2}{%
if={isodd(n_children())}{%
for n={int((n_children()+1)/2)}{calign with current},
}{%
for n={int((n_children())/2)}{insert after={[,phantom,calign with current]}},
},
if nodewalk valid={uu}{%
if={(n_children("!u")<3)&&(n_children("!uu")>2)}{!u.calign=midpoint}{},
}{%
if nodewalk valid=u{%
!u.calign=midpoint,
}{},
},
}{},
},
}
}
\begin{document}
\begin{forest}
less ugly empty nodes
[S
[{every linguist}
]
[
[1, pad
]
[Additional\\thing]
[Other\\thing]
[S
[ John
]
[
[T, pad
]
[VP
[V\\introduced
]
[DP\\$t_{1}$
]
[PP\\{to Mary}
]
]
]
]
]
]
\end{forest}
\end{document}
This doesn't do too badly even with really quite crazy-looking trees.
\begin{forest}
less ugly empty nodes
[S
[{every linguist}
]
[wants]
[
[1, pad
]
[Additional\\thing]
[Other\\thing]
[S
[ John
]
[
[T, pad
]
[VP
[V\\introduced
]
[DP\\$t_{1}$
]
[PP\\{to Mary}
]
]
]
]
]
[to be
[a]
[philosopher
[every philosopher
[wants]
[
[to]
[be]
[a
[mathematician]
]
]
]
]
]
]
\end{forest}
Ideally, I guess the code would test for craziness and adjust automatically. However, that answer would need a different and hopefully somewhat clearer question.
- 198,882








tikz-qtreeandforestboth allow n-ary branching trees and arbitrary label text. (You will need to enclose the labels in{...}if they have more content). So perhaps you should try to reproduce a tree from Heim and Kratzer in a minimal document, add your attempt to your question and ask about what you are having trouble with specifically. – Alan Munn Sep 24 '16 at 20:48linguisticsbecause it didn't exist at the time, but I'm not sure what about that answer you think helpful as I don't have the book. – cfr Sep 24 '16 at 23:39