1

I know how to draw a forked edge in the forest package

   \begin{forest}
    forked edges,
      [test [ok][doubled[test][fest][boost]]]
   \end{forest}

And it gives me this result

enter image description here

I would like to do double edges in forked tree as done in this screenshot, so only for certain edges enter image description here

does someone know how it can be done?

2

1 Answer 1

2

Here is a macro \doubleedge[<height>]{<firstnode>}{<secondnode>} to call just before \end{forest}. It requires that you name the leftmost and rightmost children below the double bar. The default height is 2mm above the north position of firstnode, but you can change that with the optional <height>. To make sure the doubled edges all look the same, the nodes should all be the same height, so I set minimum height to 3.5ex.

enter image description here

\documentclass{article}

\usepackage{forest}
\useforestlibrary{edges}

\newcommand{\doubleedge}[3][2mm]{\draw([yshift=#1]#2.north)--([yshift=#1]#2.north-|#3.north);}

\begin{document}

   \begin{forest}
    for tree={forked edge, draw, anchor=center, minimum height=3.5ex}
      [test[ok, name=j][doubled, name=k[test, name=A1][fest][boost, name=B1]]]  
    \doubleedge{A1}{B1};
    \doubleedge{k}{j};
   \end{forest}

\end{document}
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .