Following the examples in the documentation, it is not too difficult to customize the edge of trees using the tikz-qtree
package. The following code illustrates it:
\documentclass{standalone}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}
\tikzset{
edge from parent/.style={
draw,
edge from parent path={
(\tikzparentnode.south) -- (\tikzparentnode.south |- 0,-10pt -| \tikzchildnode) -- (\tikzchildnode)
}
}
}
\Tree [.ZZ
[.Bax
[.X
[.Y [.A ] [.B ] ]
[.Z [.C ] [.D ] ] ]
[.F
[.M [.E ] [.F ] ]
[.G [.G ] [.H ] ] ] ]
[.A
[.B
[.S [.I P R T V U ] [.J ] ]
[.I [.K ] [.L ] ] ]
[.M
[.L [.M ] [.N ] ]
[.A [.O ] [.P ] ] ] ] ]
\end{tikzpicture}
\end{document}
Its output is:
How can the same style of edges used in this example be accomplished with the forest
package?
Best Answer
While I still wonder about
(\tikzparentnode.south |- 0,-10pt -| \tikzchildnode)
, the approach in usual TikZ (andforest
) is even a little bit more comprehensible (for me at least):The kink of the line is shifted
10pt
downwards fromparent -| child
.Code
Output