I want to be able to typeset syntactic trees in a way that will achieve the following:
- straight spine when there is no label on the nonterminal node
- obtuse angle at each (binary) branch (so the tree is not too tall)
I'm having trouble making forest or (tikz-)qtree to achieve this easily. Surely there is someone with a solution to this problem out there.
Basically I want to achieve this (basically what I am asking is: what's some code to output something that looks similar to this:):
but what I get with tikz-qtree is
which I got using the following code:
\usepackage{tikz,tikz-qtree-compat}
\tikzset{baseline=0pt,level distance=20pt,sibling distance=0pt}
\begin{document}
\Tree [.CP [.who ] [ [.$\lambda_1$ ]
[.IP [.$t_1$ ] [.registered ] ] ] ]
\end{document}
or, with forest:
using the following code:
\usepackage[linguistics]{forest}
\newcommand{\tree}[1]{
\begin{forest}
for tree={
inner sep=0pt,
% where n children=0{font=\itshape}{},
% calign=fixed edge angles,
parent anchor=south,
},
before typesetting nodes={% page 52: example (81)
where content={}{% shape=coordinate gives an error if used here but this is *almost* right - it just leaves a little, tiny gap
text width=.001pt,
inner sep=0pt,
before drawing tree={% here we make sure that the tiny gap disappears so only the size is not quite dimensionless
shape=coordinate,
typeset node,
},
for parent={
for children={
anchor=north,
}
}
}{}
}
#1
\end{forest}
}
\begin{document}
\tree{
[CP [who] [ [$\lambda_1$]
[IP [$t_1$] [registered]]]]
}
\end{document}
Does anyone have an easy way of getting nice trees like in the first image (where not all nonterminals have labels, but some do, and the spine is nice and straight, but the trees are not too tall (i.e. distance between levels is small, in particular when the node labels are short. Perhaps another way to state this: lower limit on the angle at each branch, while keeping horizontal distance at a minimum too)? I imagine this should be a commonly desired thing among linguists. I'd be happy to learn there's an easy way of doing this... thanks!




calign=fixed edge angles,. Why? And does "no label" mean "no text" or "no edge label"? Could you perhaps try to illustrate this with a drawing? – Jan 17 '19 at 01:52forestcan't do this really. All the options are compromises. See e.g. A nice empty node with nice nodes in forest?, A nice empty node with nice nodes in forest?, How do I make trees with straight skeletons or spines?, Getting straight lines with empty nodes in forest. See also "Kinks" in long tikz-qtree branches for a similar problem withtikz-qtree. – Alan Munn Jan 17 '19 at 02:07qtree. Of course this limits the other fancier stuff you can do with the trees using the TikZ methods, but depending on your actual needs may be sufficient. – Alan Munn Jan 17 '19 at 02:09calign=fixed edge anglesdoes make the angles all the same, but in this case they are already the same without this what it really does is narrow the obtuse angles on a tree with long labels.... uncommenting it doesn't get me closer to the thing I want in this case. – postylem Jan 17 '19 at 18:04forestgives me, but force the distance between levels to be smaller than the default. – postylem Jan 17 '19 at 18:12nice empty nodesstyle I shared in this answer that includescalign angle=60along withcalign=fixed edge angles. That will reduce the height of the tree and make the angles more obtuse. But as @AlanMunn notes, you may occasionally run into errors with this. – Jason Zentz Jan 22 '19 at 23:13