# Typesetting Dependency Grammar trees with discontinuous constituents

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 edgeso that these phantom nodes were not connected. In addition I drew a line from vprtto 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?

You do not need no edge in addition to phantom. You can align the two Ns by using another tier option:

\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
[L1, phantom
[L2, phantom
[L3, phantom  [N, name=nacc, tier=mytier [wen\\who] ] ] ] ] ]
[glaubst\\believes]
[N [du\\you] ]
[Subjunction
[dass\\that]
[V-fin
[V-prt, name=vprt
[N, tier=mytier [ich\\I ] ]
[gesehen\\seen] ]
[habe\\have] ] ] ]
\draw (vprt.south)--(nacc.north);
\end{forest}

\end{document}


• Very cool! Thanks! With the tier I can drop the phantom nodes alltogether and add a no edge to nacc instead. – Stefan Müller Oct 2 '14 at 8:46