I managed to typeset simple Dependency Grammar trees (Typesetting Dependency Grammar trees), but now want to have non projective graphs. The solution with forest
is the following:
\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,calign with current edge}{}}},
}
\begin{document}
\begin{forest}
dg edges
[V
[N, phantom,no edge
[L1, phantom,no edge
[L2, phantom,no edge
[L3, phantom,no edge [ N,name=nacc [wen\\who] ] ] ] ] ]
[glaubst\\believes]
[N [du\\you] ]
[Subjunction
[dass\\that]
[V-fin
[V-prt, name=vprt
[N [ich\\I ] ]
[gesehen\\seen] ]
[habe\\have] ] ] ]
\draw (vprt.south)--(nacc.north);
\end{forest}
\end{document}
This produces the following figure:
I filled up the empty tree positions with phantom nodes and added no edge
so that these phantom nodes were not connected. In addition I drew a line from vprt
to nacc
by hand.
This is almost it, but I have two questions:
Can this be done better (simpler)?
There is a problem with the alignment of the two Ns. The leftmost N is higher than the right one. Is there a way to put them onto the same line? Is this difference due to the phantoms having no height?