0

I would like to obtain the following formatting for a tree with the excellent package forest only. Maybe the example in page 82 of the documentation or this other post could be a starting point.

enter image description here

Here is the code for a horizontal standard tree.

\documentclass[12pt,a4paper]{article}

\usepackage{forest}

\begin{document}

\begin{forest}
    for tree = {%
        grow'  = 0,
        l      = 2.5cm,
        parent anchor=east,
        s sep  = 1.2cm,
    },
    [
        [A
            [B]
            [C
                [D]
                [E]
            ]
        ]
        [F]
    ]
\end{forest}
\end{document}
-1

With plain tikz

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,calc}

\begin{document}
\begin{tikzpicture}
\draw[line width=2pt] (0,0)node(a){}--(12,0)node[fill=white](B){B};
\node[fill=white]at ($(a)!0.50!(B)$) (A) {A};
\node[fill=white, below=of A, yshift=-4cm] (F){F};
\draw[line width=2pt] ($(a)!0.10!(B)$) |-(F);
\node[fill=white, below=of B, yshift=-1cm] (C){C};
\draw[line width=2pt] ($(a)!0.60!(B)$) |-(C);
\node[fill=white, right=of C, xshift=2cm] (D){D};
\draw[line width=2pt] (C) --(D);
\node[fill=white, below=of D, yshift=-1cm] (E){E};
\draw[line width=2pt] ($(C)!0.20!(D)$) |-(E);
\end{tikzpicture}

    
\end{document}
1
  • 1
    Thanks for this but I really need to do that with forest because this would be a way among another to display probabilistic trees.
    – projetmbc
    Jul 31 '20 at 14:14

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.