TransWikia.com

forest styling - Horizontal tree similar to a folder tree

TeX - LaTeX Asked by projetmbc on August 11, 2020

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}

One Answer

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}

Answered by js bibra on August 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP