While I still wonder about (\tikzparentnode.south |- 0,-10pt -| \tikzchildnode)
, the approach in usual TikZ (and forest
) is even a little bit more comprehensible (for me at least):
edge path={\noexpand\path[\forestoption{edge}]
(\forestOve{\forestove{@parent}}{name}.parent anchor)
-- ([shift={(0,-10pt)}]
\forestOve{\forestove{@parent}}{name} -| \forestove{name})
-- (\forestove{name}.child anchor)
\forestoption{edge label};
}
The kink of the line is shifted 10pt
downwards from parent -| child
.
Code
\documentclass[tikz,convert=false]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={%
% re-establishing the defaults:
child anchor=north,
parent anchor=south,
edge path={\noexpand\path[\forestoption{edge}]
(\forestOve{\forestove{@parent}}{name}.parent anchor)
-- ([shift={(0,-10pt)}]
\forestOve{\forestove{@parent}}{name} -| \forestove{name})
-- (\forestove{name}.child anchor)
\forestoption{edge label};
}
}
[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{forest}
\end{document}
Output
As Salim Bou pointed out in a comment, the reason the inner sep
appears ineffective is that the content of the node itself is rather large, relatively speaking. So the difference between 0.1mm
and 0.001mm
makes little difference as that only changes the margin around the content from tiny to more tiny.
As Salim Bou suggested, one approach is to delete the code adding the content to the tree's nodes. In this case, the inner sep
settings will actually determine the size of all nodes in the tree.
If you only want to adjust the size of that one node, however, you may prefer to override the content later. This will change only that node's content, if set as an argument for that node. Do note that most of the inner sep
settings could be simply deleted in this case, with almost no visual affect on the appearance.
I'd also suggest making use of styles to avoid duplicating settings. How best to do this depends on what you need. Here's a possible example which also illustrates the two methods of altering the sizing explained above.
\documentclass[border=10pt]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
s sep'+=5mm,
l'+=5mm,
},
my circle/.style={
circle, fill=#1,
},
red circle/.style={
my circle=red, inner sep=#1mm,
},
black circle/.style={
my circle=black, inner sep=#1mm,
},
black hole/.style={
circle, draw=black, inner sep=#1mm,
}
[, black circle=1
[, red circle=0.5
[, black hole=0.1]
[]
[, black hole=0.1]
[]
]
[]
[, red circle=0.5
[, red circle=0.25
[, black hole=0.1]
[, black hole=0.1]
[, black hole=0.1]
[, black hole=0.001]
]
[]
[]
[, black hole=0.1]
]
[, red circle=0.5]
]
\end{forest}
\begin{forest}
for tree={
delay={where content={}{content={\phantom{00}}}{}},
s sep'+=5mm,
l'+=5mm,
},
my circle/.style={
circle, fill=#1,
},
red circle/.style={
my circle=red, inner sep=#1mm,
},
black circle/.style={
my circle=black, inner sep=#1mm,
},
black hole/.style={
circle, draw=black, inner sep=#1mm,
}
[, black circle=1
[, red circle=0.5
[, black hole=0.1]
[]
[, black hole=0.1]
[]
]
[]
[, red circle=0.5
[, red circle=0.25
[, black hole=0.1]
[, black hole=0.1]
[, black hole=0.1]
[, black hole=0.001, before typesetting nodes={content=}]%%% <------------- ??
]
[]
[]
[, black hole=0.1]
]
[, red circle=0.5]
]
\end{forest}
\end{document}
The tree on the left shows the nodes with sizes determined by their inner sep
s. The tree on the right shows them with the phantom 00
as content, excepting the single tiny node where this is overridden.
Best Answer
You can use
or the more customizable
The first argument of
if
will be evaluated by PGFmath. If the result ist0
(false
) the third argument will be executed, otherwise the second argument.Code