2

Please, The code for the following tree is at: https://tex.stackexchange.com/questions/35526/tikz-tree-sibling-distance/35535

TikZ tree sibling distance

However, I want it to grow to the right as shown in the figure below. Please, help on this. Thank you. Best regards.

Here is the code as refereed above:

\documentclass[a4paper,10pt]{article}
\usepackage{geometry}
\usepackage{forest}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetikzlibrary{shadows}
\begin{document}
    \tikzset{
        my node style/.style={
            font=\small,
            top color=white,
            bottom color=blue!25,
            rectangle,
            rounded corners,
            minimum size=6mm,
            draw=blue!75,
            very thick,
            drop shadow,
            align=center,
        }
    }
    \forestset{
        my tree style/.style={
            for tree={
                parent anchor=south,
                child anchor=north,
                l sep+=5pt,
                my node style,
                edge={draw=blue!50, thick},
                edge path={
                    \noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(0,-7.5pt) -| (.child anchor)\forestoption{edge label};
                },
                if n children=3{
                    for children={
                        if n=2{calign with current}{}
                    }
                }{},
                delay={if content={}{shape=coordinate}{}}
            }
        }
    }
    \centering
\begin{forest}
    my tree style
    [Paletizador
    [Inicialização\\de sistema
    [Sensor X]
    [Acção Y]
    ]
    [Sacos
    [
    [
    [Linha/Coluna
    [Garra]
    [Rodar Garra]
    [Acção Y2]
    ]
    [Euro Pallet]
    [{Disposição $xyz$}
    [{$x=?$}]
    [{$y=?$}]
    [{$z=?$}]
    ]
    ]
    ]
    ]
    [Sistema de despacho
    [Sensor de peso\\/contador]
    [Tapete rolante\\de saída]
    ]
    ]
\end{forest}

\end{document}

enter image description here

Bernard
  • 271,350
Easy
  • 31

1 Answers1

4

Like this?

enter image description here

I left fine tuning of children's centering/positioning to you.

\documentclass[a4paper,10pt]{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}

\begin{document}
    \tikzset{
        my node style/.style={
            font=\small,
            top color=white,
            bottom color=blue!25,
            rectangle,
            rounded corners,
            minimum size=6mm,
            draw=blue!75,
            very thick,
            drop shadow,
            align=center,
        }
    }
    \forestset{
        my tree style/.style={
            for tree={grow=east,
                parent anchor=east, % <---
                child anchor=west,  % <---
                my node style,
        l sep=2em,
        forked edge,                % <---
        fork sep=1em,               % <---
        edge={draw=blue!50, thick},                
        if n children=3{for children={
                        if n=2{calign with current}{}}
                        }{},
%       delay={if content={}{shape=coordinate}{}},
        tier/.option=level,
                    }
        }
    }
\centering
    \begin{forest}
    my tree style
[Paletizador
    [Inicialização\\de sistema
        [Sensor X]
        [Acção Y]
    ]
    [Sacos,fit=band
        [Linha/Coluna
            [Garra]
            [Rodar Garra]
            [Acção Y2]
        ]
        [Euro Pallet,fit=band,before computing xy={s/.average={s}{siblings}}] % <---
        [{Disposição $xyz$}
            [{$x=?$}]
            [{$y=?$}]
            [{$z=?$}]
        ]
    ]
    [Sistema de despacho, 
        [Sensor de peso\\/contador]
        [Tapete rolante\\de saída]
    ]
]
    \end{forest}
\end{document}
Zarko
  • 296,517