I try to typeset dependency trees:
Is there a package that does this? It should be compatible with xelatex
, i.e. not be based on pstricks
. I could not find anything with google or on CTAN. If there is no package, I would try to do it with forest
, but this seems not to be straightforward. How can this be done straightforwardly?
Edit: I found (half of) a solution in forest
:
\documentclass{article}
\usepackage{forest}
\forestset{
dg edges/.style={for tree={parent anchor=south, child anchor=north,align=center,base=bottom,where n children=0{tier=word,edge=dotted}{}}},
}
\begin{document}
\begin{forest}
dg edges
[V
[N
[D [the] ]
[child] ]
[reads]
[N
[D [a] ]
[book] ] ]
\end{forest}
\end{document}
This gets the dotted lines right and also aligns the words at the baseline. However, the alignment of the nodes is not right. If I could have N exactly on top of book and V above reads and do this in the style definition, this would be the preferred solution. Is there a way to do this in forest
?
Best Answer
This is an attempt where
tikz tree
is used. To align the text at the bottom adfont
style is defined.Code