The text of my terminal nodes for my tree is overlapping. Does anyone know how to place the labels on multiple lines? I checked stackoverflow but did not find a solution. I can space out the tree but I prefer to add a second line to the node because eventually, the spacing can only go so far.
I tried adding a double backslash to the text but it created an error message. Does anyone have suggestions? Below is my code and images of what I am trying to do (before and ideally after)
Thank you.
\begin{tikzpicture} [scale=1.5]
\tikzstyle{solid node} =[circle,draw,inner sep=1.5,fill=black]
\tikzstyle{hollow node}=[circle,draw,inner sep=1.5]
\tikzstyle{level 1}=[level distance=15mm,sibling distance=3.5cm]
\tikzstyle{level 2}=[level distance=15mm,sibling distance=2.5cm]
\tikzstyle{level 3}=[level distance=15mm,sibling distance=1cm]
\node(0)[hollow node,label=above:{},align=left]{}
child{node[solid node]{}
child{node[hollow node,label=below,align=left:{appleJacks are great \ appleJacks are great}]{} edge from parent node[left]{a}}
child{node[hollow node,label=below:{appleJacks are great, \ appleJacks are great}]{} edge from parent node[right]{b}}
edge from parent node[left,xshift=-5]{action1}
}
child{node[solid node]{}
child{node[hollow node,label=below:{appleJacks are great, appleJacks are great}]{} edge from parent node[left]{a}}
child{node[hollow node,label=below:{appleJacks are great, appleJacks are great}]{} edge from parent node[right]{b}}
edge from parent node[right,xshift=5]{action2}
};
\drawdashed, label=above right:{my label}to(0-2);
\end{tikzpicture}




align=center(or any other alignment) or atext widthto be able to use\\in a node. See Q123671 – Qrrbrbirlbel Nov 20 '22 at 04:02label. Either as part of the theevery labelstyle or directly between the[and]of your label. The latter usually needs to have the whole argument enclosed in braces. The full syntax islabel={[<options>]<direction>:<text>}. – Qrrbrbirlbel Nov 20 '22 at 11:02