
É possível usar o pacote florestal para cultivar uma árvore de forma que as crianças fiquem empilhadas verticalmente, assim:
Acabei fazendo isso: Se o pai é A e tem três filhos BCD, e eu quero anexar todos os filhos conforme mostrado acima, tive que fazer isso:
\begin{forest}
for tree={
draw,
% minimum height=2cm,
% anchor=west,
align=center
% calign
% child anchor=west
},
[{ROOT}, align=center
[{ A} , parent anchor=south, child anchor=north
[{B}, parent anchor=east, anchor=east, child anchor=east , calign=child edge
[{C}, parent anchor=east, anchor=east, child anchor=east, calign=child edge
[{D}, parent anchor=east, anchor=east, child anchor=east
]
]
]
]
\end{forest}
Como você pode ver, mesmo sendo todos filhos de A, tive que fazer de B o pai de C e de C o pai de D.
Responder1
Não apenas várias pessoas forneceram código para este diagrama antes, como eu definitivamente já respondi usando Forest antes.
Seria muito mais fácil se a imagem da pergunta estivesse vinculada à fonte, pois isso poderia me dar uma pista.
Sei que forneci uma solução Forest porque encontrei uma, mas parece que não forneci um link para minha resposta. E lembro de ter ficado chateado porque desenhei o diagrama do zero quando o OP poderia ter vinculado ao código que eu poderia ter copiado, colado e adaptado, já que já havia sido respondido antes (mas talvez o código não funcionasse mais ou não usasse Forest ou algo).
Este diagrama é extremamente irritante porque CONTINUA acontecendo comigo.
De qualquer forma, atualizei o código que tenho para Forest v.2 usando uma versão modificada do código emminha respostavinculado emComentário de Torbjørn T.. Esta versão usa o folder
estilo da edges
biblioteca.
\documentclass[border=5pt,tikz,multi]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,shadows.blur}
\forestset{%
colour me out/.style={outer color=#1!75, inner color=#1!50, draw=darkgray, thick, blur shadow, rounded corners},
rect/.append style={rectangle, rounded corners=2pt},
dir tree switch/.style args={at #1}{%
for tree={
edge=-Latex,
font=\sffamily,
fit=rectangle,
},
where level=#1{
for tree={
folder,
grow'=0,
},
delay={child anchor=north},
}{},
before typesetting nodes={
for tree={
content/.wrap value={\strut ##1},
},
if={isodd(n_children("!r"))}{
for nodewalk/.wrap pgfmath arg={{fake=r,n=##1}{calign with current edge}}{int((n_children("!r")+1)/2)},
}{},
},
},
}
\begin{document}
\begin{forest}
dir tree switch=at 1,
for tree={
font=\sffamily\bfseries,
rect,
align=center,
edge+={thick, draw=darkgray},
where level=0{%
colour me out=green!50!white,
}{%
if level=1{%
colour me out=green!95!black,
}{%
colour me out=magenta!50!orange!75!white,
edge+={-Triangle},
},
},
}
[Drawing\\Diagrams
[Defining node\\and arrow styles
[Setting shape]
[Choosing colour]
[Adding shading]
]
[Positioning\\the nodes
[Using a matrix
[Absolutely]
[Relatively]
[Using overlays]
]
]
[Drawing arrows\\between nodes
[Default arrows
[Arrow library]
[Re-sizing tips]
[Shortening]
[Bending]
]
]
]
\end{forest}
\end{document}