Your answer will work but is needlessly verbose as you can simply use relative node names to specify the edge path
.
\noexpand\path[\forestoption{edge}](!u.parent anchor) -- +(5pt,0) |- (.child anchor)\forestoption{edge label};},
(!u)
refers to the parent of the current node. ()
refers to the current node.
You can also align the terminal nodes for the whole tree in the preamble:
if n children=0{tier=word}{}
but anchoring the nodes at the left side makes for a neater tree:
anchor=west,
The result:
Complete code:
\documentclass[tikz]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
edge path={
\noexpand\path[\forestoption{edge}](!u.parent anchor) -- +(5pt,0) |- (.child anchor)\forestoption{edge label};},
grow=0,
reversed, % tree direction
parent anchor=east,
child anchor=west, % edge anchors
anchor=west,
if n children=0{tier=word}{}
}
[VP
[DP]
[V’
[V]
[DP]
]
]
\end{forest}
\end{document}
The simple, manual solution is to add fit=band
to the tmp
node, which puts the node's subtree in a rectangle of "infinite depth".
To automate this process, just add it to your for tree
.
for tree={% folder icons by default; override using file for file icons
directory,
fit=band
}
Best Answer
Using more-or-less the formulae kindly transcribed from the do-it-for-me image by egreg when the OP failed to provide any help whatsoever, together with a tweaked version of the
tableaux
style I developed for this answer, I drew a version of the tree using Forest as follows. For the record, I think I ought not answer this question but I'm giving in to my fascination with trees.