# Specifying the distance between levels in forest

I would like to have more space between the first level and the second level in the tree below. In tikz-qtree I can use

\tikzset{level 1+/.style={level distance=3\baselineskip}} \tikzset{level 2+/.style={level distance=2\baselineskip}}

Is there something equivalent in forest?

\documentclass{minimal}

\usepackage{forest}

\forestset{
sn edges/.style={for tree={parent anchor=south, child anchor=north,align=center,base=bottom,where n children=0{tier=word}{}}},
background tree/.style={for tree={text opacity=0.2,draw opacity=0.2,edge={draw opacity=0.2}}}
}

\begin{document}

\begin{forest}
sn edges
[S
[NP [er\\he] ]
[NP
[Det [das\\the] ]
[N [Buch\\book] ]
]
[NP
[Det [der\\the] ]
[N [Frau\\woman] ]
]
[V [gibt\\gives] ]
]
\end{forest}

\end{document}

• Have you looked at section 4.2 in the forest manual? – Torbjørn T. Mar 27 '14 at 10:32
• Thanks. The text before the example explains that it is an answer to my question, but it is not the best way to display this answer. This example is highly complex. Is the answer to shift all the nodes you want to be lowered manually? Hm. – Stefan Müller Mar 27 '14 at 10:50

Do you want something like

l sep+=<some length>


which will reduce the distance between tiers by <some length>?

To restrict this increase to only the distance between the root node and the first tier, you can use

for children={
l sep-=<some length>,
}


to reverse the increase. (There may be a more direct method - this is just what came most readily to hand.)

The following compares the default with increases of 1em and 2em respectively:

\documentclass{standalone}

\usepackage{forest}

\forestset{
sn edges/.style={for tree={parent anchor=south, child anchor=north,align=center,base=bottom,where n children=0{tier=word}{}}},
background tree/.style={for tree={text opacity=0.2,draw opacity=0.2,edge={draw opacity=0.2}}}
}

\begin{document}

\begin{forest}
sn edges
[S
[NP [er\\he] ]
[NP
[Det [das\\the] ]
[N [Buch\\book] ]
]
[NP
[Det [der\\the] ]
[N [Frau\\woman] ]
]
[V [gibt\\gives] ]
]
\end{forest}
\begin{forest}
sn edges,
l sep+=1em,
for children={
l sep-=1em,
}
[S
[NP [er\\he] ]
[NP
[Det [das\\the] ]
[N [Buch\\book] ]
]
[NP
[Det [der\\the] ]
[N [Frau\\woman] ]
]
[V [gibt\\gives] ]
]
\end{forest}
\begin{forest}
sn edges,
l sep+=2em,
for children={
l sep-=2em,
}
[S
[NP [er\\he] ]
[NP
[Det [das\\the] ]
[N [Buch\\book] ]
]
[NP
[Det [der\\the] ]
[N [Frau\\woman] ]
]
[V [gibt\\gives] ]
]
\end{forest}

\end{document}


• This only works for increasing the level distance, or for decreasing it once it has been increased (but not below a certain threshold). Is there a way to decrease the initial value in a similar way? – Timm Jul 1 '15 at 14:14
• @Timm You can use l sep-=<whatever>. It isn't restricted to reversing the effect of an earlier increase. Or you can specify l sep=<absolute value> to override the initial value completely. Is that what you mean? – cfr Jul 1 '15 at 15:15
• Yes, I'd like to override the initial value. But I don't get less than a certain distance. I can increase it like this [A [B,l=50mm][C,l=50mm]], but it's not possible for me to make it zero like this [A [B,l=0mm][C,l=0mm]]. I've also tried l sep and negative values. Hm. – Timm Jul 2 '15 at 7:35
• @Timm Since this question was about something else, I think you should post a new question with an example of what you are trying to do. It isn't easy to figure this stuff out in comments. Note that l sep is the minimum distance between levels. It isn't intended to be the maximum. – cfr Jul 2 '15 at 12:11