1

I want to create an arrow between two nodes like the red one in below example.

Example Tree

I've seen the following in documentation, but tbh I don't understand how to use it and I need to use it in more than one tree.

enter image description here

  • 2
    Welcome to Tex.SE. Show us what you have done so far so that we can help you complete it. – nidhin Nov 5 '18 at 18:34
2

It works precisely as described in the documentation...

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage[edges]{forest}
\begin{document}
\tikzset{state/.style={draw,circle}}
\forestset{d/.style={dotted,edge=dotted},
r/.style={red,edge=red}}
\begin{forest}
for tree={state,edge={-},grow=south,l sep=6mm,s sep=10mm},
[22,d
 [13,d
  [30,red,edge=dotted
   [15,r]
   [85,r]{\draw[<->,red] () to[bend right=45] node[midway,above
   right,font=\small]{zam} (!u.east);}
  ]
  [71
   [17]
   [20]
  ]
 ]
 [11,d
  [33,edge=dotted
   [32]
  ]
  [55,d]
 ]
]
\end{forest}
\end{document}

enter image description here

  • @kkiermasz The same thing. Just add after the closing ] in the line below that arrow {\draw[<->,red] (.north) to[bend left=45] node[midway,above left,font=\small]{zam} (!u.west);}. Why does that work? Because () is the current node, i.e. the one after which you place the command, (.north) is its north anchor, and (!u) is its parent. The example in the manual is slightly more complex in that (!us) is the sibling of the parent (i.e. aunt or uncle). – user121799 Nov 6 '18 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.