4

I have this beautiful tree, but I have not been able to stretch it. Specifically I want to increase the distance between the first and second children and their grandchildren. Any suggestions?

   \documentclass[border=10pt]{standalone}
 \usepackage[edges]{forest}

\begin{document}


\begin{forest}
        for tree={
            thick,
            l sep=0.55cm,
            s sep=0.55cm,
            child anchor=west,
            parent anchor=east,
            grow'=east,
            draw,
            anchor=west,
            node options={draw,font=\sffamily},
            edge={semithick},
            align=center,
            node options={draw,font=\sffamily},
            edge={semithick},
            forked edges,
            where n children={11}{rotate=90, anchor=center}{},
            where n children=2{rotate=90, anchor=center}{},
            where n children=6{rotate=90, anchor=center}{},
            where n children=8{rotate=90, anchor=center}{},
        },
        %           edge path={
        %               \noexpand \path[\forestoption{edge}]
        %               (.child anchor) 
        %               -- +(-10pt,0) 
        %               |- (!u.parent anchor)
        %               \forestoption{edge label};
        %           },
        %           ver/.style={rotate=90, child anchor=north, parent anchor=south, anchor=center},
        %   }
        [Mother branch, 
        [First Child
        [Grand child []]
        [Grand child    []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        ]
        [Second Child
        [Grand child [ ]]
        [Grand child [] ]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        ]
        ]
    \end{forest}
\end{document}
  • 2
    This distance is to a large extent controlled by l sep. If you increase it to, say l sep=1.55cm, the distance will become larger. What precisely do you want to achieve? – user121799 Apr 24 '19 at 3:14
  • Thanks marmot, I will like to strech the distance between the first/second child and grand child. Changing to 1.55cm only increases the distance of the grandchild not the connecting line between the first/second child and the grandchild – Abdulhameed Apr 24 '19 at 3:41
  • I added something where you can selectively increase (or decrease) these distances. – user121799 Apr 24 '19 at 3:49
5

You can selectively increase the level distance by saying e.g.

where level=2{l+=0.5cm,fork sep=8mm}{}, 

where I also adjusted the fork sep for the optics. MWE:

\documentclass[border=10pt]{standalone}
 \usepackage[edges]{forest}

\begin{document}


\begin{forest}
        for tree={
            thick,
            l sep=0.55cm,
            where level=2{l+=0.5cm,fork sep=8mm}{},         
            s sep=0.55cm,
            child anchor=west,
            parent anchor=east,
            grow'=east,
            draw,
            anchor=west,
            node options={draw,font=\sffamily},
            edge={semithick},
            align=center,
            node options={draw,font=\sffamily},
            edge={semithick},
            forked edges,
            where n children={11}{rotate=90, anchor=center}{},
            where n children=2{rotate=90, anchor=center}{},
            where n children=6{rotate=90, anchor=center}{},
            where n children=8{rotate=90, anchor=center}{},
        },
        [Mother branch, 
        [First Child
        [Grand child []]
        [Grand child    []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        ]
        [Second Child
        [Grand child [ ]]
        [Grand child [] ]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        ]
        ]
    \end{forest}
\end{document}

enter image description here

| improve this answer | |
4

i'm guessing, that you looking for something like this:

enter image description here

which is obtained with the following mwe:

\documentclass[border=10pt]{standalone}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
        for tree={
            grow'=east,
            anchor=west,
            node options={draw, thick, font=\sffamily},
            edge={semithick},
            forked edges,
            l sep=6mm,
            s sep=4mm,
            fork sep = 2.5mm,           % new, distance from parent to branching point
            where level=1{s sep=1mm}{}, % new
            where level=2{}{rotate=90, anchor=center} % new
        },
        [Mother branch,
        [First Child
        [Grand child []]
        [Grand child    []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        ]
        [Second Child
        [Grand child [ ]]
        [Grand child [] ]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        [Grand child []]
        ]
        ]
    \end{forest}
\end{document}

changes in comparison to your mwe are indicated with % new. i also remove all doubled code lines in your mwe.

| improve this answer | |

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.