3

Working from Typesetting Dependency Grammar trees with discontinuous constituents I try to set a graph with two discontinuities.

The first figure does what I want. It has nacc and the other N aligned by a tier specification and since the second N is a child of V-ptr, it is lower than V-ptr. In the second figure the N corresponding to ich is technically a child of the topmost V and hence it is not lower than V-ptr. Is there a way (without phantoms) to get the two Ns or the tier below V-ptr?

\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,name=nacc,no edge,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}


\begin{forest}
dg edges
[V
  [N,name=nacc,no edge,tier=mytier, [wen\\who] ]
  [glaubst\\believes] 
  [N,name=nich,no edge,tier=mytier, [ich\\I ] ]
  [N [du\\you] ]
  [Subjunction
    [dass\\that]
    [V-fin
      [V-prt, name=vprt
        [gesehen\\seen] ]
      [habe\\have] ] ] ]
\draw (vprt.south)--(nacc.north);
\draw (vprt.south)--(nich.north);
\end{forest}

\end{document}

enter image description here

Edit: One way to achive what I want is to use a phantom daughter of V-ptr and couple it with the tier:

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

\end{document}

enter image description here

But I somehow thought that it would be possible to specify that nodes should be below other nodes, that is, using tikzsyntax to express dominance relations that are not in the tree directly.

  • Wow, read 3-4 times and still didn't understand a thing :) – percusse Oct 2 '14 at 9:40
  • If I understand you want the first graph in both examples. So, what's the problem just changing the words? May be it's not formally correct but, who will look at forest source? – Ignasi Oct 2 '14 at 10:32
  • The graphs differ in the position of ich. In the first case ich is a child of V-prt. In the second case ich is a child of the top-most V. Since ich is a child of V-ptr in the first graph, it is typeset below this node. I want to have ich below V-ptr in the second figure as well and I am looking for a way to express this. So I need something that inserts space between the top-most Vand the two Ns for wenand ich. Or something that pushes the tier mytier down to the position it has in the first figure. – Stefan Müller Oct 2 '14 at 12:03
3

This solution uses a phantom node, and I know Stefan doesn't want it, but I don't know how to align (tier) first level children with a fifth level child if this doesn't exist. First example had a reference node but is missing in second one. Of course,I'm open to better solutions.

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

\end{document}

2nd version

Although with previous version the result was as expected, placing the phantom node as [gesehen\\seen] parent results in some inconveniences. It's easier if phantom node is [gesehen\\seen]'s brother although aligned with N nodes. The phantom node doesn't occupy vertical space and it's not necessary to redraw the edge to [gesehen\\seen]. This solution was proposed by Stefan Müller.

\begin{forest}
dg edges
[V
  [N,name=nacc,no edge,tier=mytier, [wen\\who] ]
  [glaubst\\believes] 
  [N,name=nich,no edge,tier=mytier, [ich\\I ] ]
  [N [du\\you] ]
  [Subjunction
    [dass\\that]
    [V-fin
      [V-prt, name=vprt
       [A, phantom, tier=mytier]
       [gesehen\\seen] ]
      [habe\\have] ] ] ]
\draw (vprt.south)--(nacc.north);
\draw (vprt.south)--(nich.north);
\end{forest}

Both codes result in:

enter image description here

  • Thanks, I did not see your answer before doing my edit of the question (I did not do a propper reload). If one puts the phantom as sister of gesehen one does not need the dotted line and one does not have to give gesehen a name. Your solution is much better than what I had in the beginning. I used three phantoms as parents of wenin order to get everything down below gesehen. Thanks again! – Stefan Müller Oct 3 '14 at 6:37
  • Ignasi would you mind changing the solution towards my edit in the question? I would the mark it as the correct answer and we could close this question. – Stefan Müller Oct 6 '14 at 7:01
  • @StefanMüller. Did it. Please, feel free to edit my answer if necessary. It's your solution. – Ignasi Oct 6 '14 at 7:55
2

I'm not entirely sure I understand the question. That is, I'm not sure why you want to avoid phantom so what the criteria are for an acceptable answer. However, the following does avoid phantom. Whether it does anything you consider equally obnoxious, I'm not so sure ;).

\documentclass[border=5pt]{standalone}

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

\end{document}

tree without phantom

  • 1
    I thought of a way to say that the N of ich is south west of V-ptr, so that tikz puts it on the right level itselve. If this is not possible a phnatom node as daughter of V-ptrand the tier connection to it is probably the best way to do it, since this will be as automatic and as font independent as possible. Thanks! – Stefan Müller Oct 6 '14 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.