5

According to the manual of forestit was developed to get trees like the one on the right-hand side of the following figure rather then the one on the left-hand side:

enter image description here

Usually I want the dense trees too, but there is a situation in which the other trees are more appropriate. For Tree Adjoining Grammar, one wants to have a format that allows other phrases to be plugged into the leaf nodes. This does not work for the second tree in the figure below:

enter image description here

So, question: Is there a way to specify in the style statement for tag trees below that the upper NP nodes in the second example should be placed further to the left so that there is no other material below these two NPs?

\documentclass{minimal}   

\usepackage{forest}



\forestset{
tag/.style={for tree={parent anchor=south, child anchor=north,align=center,base=top}},
% a style that creates an arrow pointing to the substitution node from a tree top node encoded as daughter 
substitution/.style={edge={<-,dashed},l+=\baselineskip}}

\begin{document}

\begin{forest}
tag
[S
        [NP$\downarrow$,
          [NP, substitution
            [John]]]
        [VP
                [V
                        [laughs]]]]
\end{forest}
\hspace{2em}
\begin{forest}
tag
[S
        [NP$_2^2\downarrow$]
        [S
                [NP$_2^1\downarrow$]
                [S
                        [NP
                                [PRO]]
                        [VP
                                [NP$_2^1$
                                        [e]]
                                [NP$_2^2$
                                        [e]]
                                [V$_2$
                                        [zu überf\"uhren]]]]]]
\end{forest}


\end{document}

\end{forest}

I know of s and s sep, but I would prefer a style specification that does this for all TAG trees and I do not know how to achieve this.

7

May be fit=rectangle (page 29) is what you're looking for:

\documentclass{standalone}   

\usepackage{forest}

\forestset{
tag/.style={for tree={parent anchor=south, child anchor=north,align=center,base=top}},
% a style that creates an arrow pointing to the substitution node from a tree top node encoded as daughter 
substitution/.style={edge={<-,dashed},l+=\baselineskip}}

\begin{document}

\begin{forest}
tag
[S
        [NP$\downarrow$,
          [NP, substitution
            [John]]]
        [VP
                [V
                        [laughs]]]]
\end{forest}
\hspace{2em}
\begin{forest}
tag
[S
        [NP$_2^2\downarrow$]
        [S, fit=rectangle
                [NP$_2^1\downarrow$]
                [S, fit=rectangle,
                        [NP
                                [PRO]]
                        [VP
                                [NP$_2^1$
                                        [e]]
                                [NP$_2^2$
                                        [e]]
                                [V$_2$
                                        [zu überf\"uhren]]]]]]
\end{forest}


\end{document}

enter image description here

  • Thanks! I took the fit=band option, although I do not see a difference for the examples at hand. I added the fit-declaration to the style declaration so that it applies to all nodes automatically. Thanks a lot! This package is a monster! But I am getting closer to understanding something. =:-) – Stefan Müller Oct 16 '14 at 19:15
  • 1
    @StefanMüller Similarly here. This answer seems to have solved your problem and, if it has, you should consider accepting it. – cfr Dec 17 '14 at 22:49

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.