# Forest have label for nodes that is separate from content

I am trying to get a hierarchical tree built using the forest package where each node is labelled with the parent nodes label + the node index, e.g,:

I've tried a lot of different things, including various node walks. There are two issues: 1) labels appear directly above nodes (e.g., right on the edge line) 2) I can't get this recursive labelling working at all - the best I can do is make each nodes label "parentIndex.nodeIndex"

• You expect us to retype your tree from the image just in order to create a style which labels the nodes? Only the last bit is interesting. The rest you've already done, so it's old hat. – cfr Feb 3 '17 at 2:31

I think I ought not answer do-it-for-mes like this one, especially ones asked by those clearly capable of posting code. I'm going to regardless because I like trees.

I provide answers to do-it-for-mes on a strictly as-is basis. I answer these questions not just because I want to but only, solely and purely for that reason. Expect me to be less than sympathetic to requests for explanations or adjustments. I spent the time setting the problem up. If you'd wanted me to explain, you'd have helped me to help you.

\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
forked edges,
for tree={
align=center,
draw,
rounded corners,
l sep'+=15pt,
},
my label/.style={
label={[anchor=south east]above:#1},
},
before typesetting nodes={
for descendants={
temptoksa/.option=n,
for nodewalk={
while={>On>{level}{1}}{u,+temptoksa=.,+temptoksa/.option=n}
}{},
my label/.register=temptoksa,
},
}
[Things it is time to speak of \dots
[Shoes
[An invention designed to\\protect the wealthy and\\trample the poor.]
]
[Ships
[Occasionally to be\\found in bottles.]
]
[Sealing was
[Not to be confused\\with ceiling wax.]
]
[Cabbages
[{A traditional medicine for\\poverty, everywhere believed\\efficacious by the rich\\and known ineffective\\by the poor.}]
]
[Kings
[Hereditary obsolescence.]
]
[Why the sea is boiling hot
[\emph{Non sequitur}.]
]
[Whether pigs have wings
[Falsehood.
[\emph{A posteriori.}]
[Contingent.]
]
]
]
\end{forest}
\end{document}


Since you not provide code for your tree, I use some my tree:

\documentclass[border=3mm]{standalone}
\usepackage[edges]{forest}

\begin{document}
\tikzset{every label/.style={xshift=-4ex, text width=6ex, align=right,
inner sep=1pt, font=\footnotesize, text=red}}
\begin{forest}
for tree={              % style of tree nodes
font=\footnotesize,
draw, semithick, rounded corners,
align = center,
inner sep = 2mm,
% style of tree (edges, distances, direction)
edge = {draw, semithick, -stealth},
parent anchor = east,
child anchor = west,
grow = south,
forked edge,            % for forked edge
l sep = 12mm,   % level distance
fork sep = 6mm,    % distance from parent to branching point
}