Dr. Manuel Kuehner
- This is a follow-up to https://tex.stackexchange.com/questions/588018/.
- The main question is, how to rearrange the branch "4.2" to save vertical space. Ideally, the branch "4.2" is flipped vertically (other ideas are welcome). (see **green** annotation)
- Small additional question: Can I locally (for a specific branch) increase the separation to the neighbor branch? (see **red** annotation)
**Disclaimer:** Cross post (https://tex.stackexchange.com/questions/588083)
----------
\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
forked edges,
l sep = 0, for children = {l*= 0.6},
for tree = {
align = center, % needed for "\\" in nodes. Irrelevant for thsi MWE as of now.
draw,
font = \tiny,
},
for descendants={
grow' = 0,
folder,
},
[0
[1]
[\ldots]
[2
[2.1]
[2.2]
[\ldots]
]
[3
[3.1]
[3.2]
]
[4
[4.1
[4.1.1]
[4.1.2]
[4.1.3]
[4.1.4]
[4.1.5]
]
[4.2
[4.2.1]
[4.2.2]
[4.2.3]
[4.2.4]
[4.2.5]
]
]
]
\end{forest}
\end{document}
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/KN0lR.png

Top Answer

marmot
Just to show how much daylight there is between some random attempt and a real answer by Sašo Živanović that you will hopefully get. The strategy here is to install `folder` for all but the root and another node. The manual `yshift` is ugly, of course.
```
\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
forked edges,
l sep = 0, for children = {l*= 0.6},
for tree = {
align = center, % needed for "\\" in nodes. Irrelevant for thsi MWE as of now.
draw,
font = \tiny,
},
for descendants={% switch on "folder" for all but one descendant
if={level==1&&n==5}{yshift=-1.7ex}{grow' = 0,folder},
},
[0
[1]
[\ldots]
[2
[2.1]
[2.2]
[\ldots]
]
[3
[3.1]
[3.2]
]
[4
[4.1
[4.1.1]
[4.1.2]
[4.1.3]
[4.1.4]
[4.1.5]
]
[4.2
[4.2.1]
[4.2.2]
[4.2.3]
[4.2.4]
[4.2.5]
]
]
]
\end{forest}
\end{document}
```
![Screen Shot 2021-03-20 at 11.24.24 PM.png](/image?hash=7fd03ace91944be94f26d3e0c7c0e1064bf5af6918034e2e9519f55c87d43066)