# Making a certain tree style the default for forest

We are putting together latex classes for books. We want to make a certain tree style the default for forest. With the example below one has to define the style (sn edges) in every tree. Is there a way to get rid of this specification and make it the default?

\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}


Not sure if the question is unsolved Stefan, but this code for instance is applied to all forest environments:

\forestset{.style={for tree={l=1em, l sep=1em, s sep=1em}}}


In essence, just drop the style name :)

Hope this helps.

• You can also say \forestset{.style={sn edges}} – Andrew Swann May 13 '14 at 12:53
• I had no idea this is possible, and I'm the author of forest :-) However, to make the issue clearer, the next version will implement key default preamble. Usage just as above: \forestset{default preamble/.style={sn edges}}} – Sašo Živanović Dec 11 '14 at 14:24
• @SašoŽivanović, Are you indicating in your example that the sn edges style will be pre-loaded by forest so that the code for the style doesn't have be copied into the preamble? I like the flexibility and simple syntax of forest, and it's great for compact trees, but I hesitate to recommend it to my linguistics students because it doesn't work "out of the box" the way tikz-qtree does. If I could tell them to just use \usepackage[linguistics]{forest} where the linguistics option would load sn edges and nice empty nodes for every tree, that would be great. – Jason Zentz Jul 22 '15 at 19:42
• The feature will be added in v1.1. This summer, promise! ;-) Thanks for the \usepackage[linguistics]{forest} idea, I like it! – Sašo Živanović Jul 22 '15 at 22:36
• Progress report: it took a long time and lots of work, but I'm finally in the testing phase. TeX.SE is a great help here, as I'm checking for discrepancies between v1.0.x and v1.1 using the code posted on this site! – Sašo Živanović Oct 24 '15 at 2:00