In the following tree, I would like the bottom right node (in the base tier) to be directly under its parent, but it seems to automatically align with its sibling in the tier above. I've tried several of the calign options, but I don't want to change the positioning of the parent, only the positioning of the bottom child.
Is there a way to adjust the horizontal positioning of only this child?
\documentclass{beamer}
\usepackage{forest}
\begin{document}
\begin{frame}
\begin{forest}
for tree = {
draw, circle,
s sep = 6mm
}
[
[ [[,tier=base]] [] ]
[ [] [,tier=base] [] ]
]
\end{forest}
\end{frame}
\end{document}
Best Answer
The horizontal position of the child (or more precisely, its relative position wrt the parent in the dimension, perpendicular to the grotwh direction of the tree) can be adjusted using option
s
; see section 3.7.2 (Node position) of the Forest manual. In particular,s=0
will position it directly below (the anchor of) the parent.However, for this option to take effect, it must be changed after Forest does its positioning magic (in
pack stage
) and before it computes the absolute coordinates of the nodes (incompute xy stage
); see section 3.4.1 (Stages). This can be achieved using the temporal propagatorbefore computing xy
; see section 3.4.2 (Temporal propagators).To achieve the OP's goal, we must therefore equip the offending node with
before computing xy={s=0}
, as shown below.