I'm trying to build a tree that grows horizontally and which gives the possibility to introduce lists with a "folder" aspect in such a way as to specify a series of topics related to that node.
In the code that I have attached, there are two problems that I cannot solve:
the distance between the node whose children appear as folders and the first element of the folder nodes is greater than the other distances of the rest of the children.
the nodes belonging to the folder overlap the rest of the tree.
I had already opened a question on a similar topic (Forest folder in forked edges tree spacing problem), but I can't take advantage of what was suggested to me for this other situation.
In order to have a node with subtrees growing in different directions I tried to use what is suggested in this question:
Forest: different growing directions for branches on the same level
Is there any way to fix these problems?
MWE:
\documentclass[varwidth=20cm,tikz]{standalone}
\usepackage[edges]{forest}
\forestset{
rounded forked tree/.style={
for tree={
grow'=east,
fit=band,
rounded corners,
line width=1.6pt,
font=\sffamily\bfseries\Large,
inner xsep=5mm,
inner ysep=5mm,
outer ysep=0pt,
edge+={line width=1.6pt, rounded corners=2mm},
if n children=1{
for first={
before typesetting nodes={
edge+={rounded corners=0mm},
}
}
}{},
align=center,
l sep'=20mm,
s sep'=7mm,
fork sep'=8mm,
draw,
minimum height=15mm,
minimum width=20mm,
anchor=west,
},
forked edges,
},
folder subtree/.style={
for tree={
folder,
s sep'=5mm,
l sep'=10mm,
minimum height=5mm,
},
folder indent'=5mm,
anchor=west,
for descendants={
align=left,
anchor=base west,
base=top,
inner xsep=2mm,
inner ysep=1mm,
before typesetting nodes={
edge+={rounded corners=2mm},
},
edge path'/.expanded={
([xshift=\forestregister{folder indent}]!u.parent anchor) |- ([yshift=.6ex].base west)
},
},
},
phantom node/.style={
!c.content/.pgfmath=content("!parent"),
text opacity=0,
draw=none,
no edge,
before computing xy={
l=0,
s=0
}
},
grow subtree/.style={
for tree={grow=#1}
},
grow' subtree/.style={
for tree={grow'=#1}
},
}
\begin{document}
\begin{forest}
rounded forked tree,
[Root
[Node first line\\(Node second line)
[, phantom node, folder subtree
[Folder element]
[Folder element]
[Folder element
[Folder element child]
[Folder element child]
]
[Folder element first line\\(Folder element second line)]
[Folder element]
[Folder element]
]
[, phantom node, grow' subtree=east,
[Node]
[Node]
]
]
[Node
[Node first line\\(Node second line)]
[Node]
]
]
\end{forest}
\end{document}