3

Does anyone have an idea how to improve this diagram?

I don't know, but it doesn't really blows my mind, yet. For instance, I am not able to manage a good-looking line length and positioning where it is still clear which parts belong together...

I appreciate any help!

\documentclass[a4paper, 12pt]{report}

\usepackage{forest}
\usetikzlibrary{shapes,arrows,positioning,shadows,trees}

\begin{document}
\begin{center}
    \resizebox{.8\textwidth}{!}{%
        \begin{forest}
            for tree={
                child anchor=west,
                parent anchor=east,
                grow'=east,
                draw,
                l sep=2cm,
                node options={
                    align=center },
                text width=2.7cm,
                anchor=west,
                edge path={
                    \noexpand\path[\forestoption{edge}]
                    (.child anchor) -| +(-5pt,0) -- +(-5pt,0) |-
                    (!u.parent anchor)\forestoption{edge label};
                },
            }
            [LMS, s sep=.5cm
            [Funktionale \\Anforderungen]
            [Nicht-Funktionale Anforderungen
            [Zuverl{\"a}ssig\-keit]
            [Skalierbar\-keit und Effizienz]
            [Benutzer\-freundlich\-keit]
            [Portierbarkeit]
            [Datenschutz / Informationssicherheit]
            [Erweiterbar\-keit]
            [Anpassbarkeit]
            ]
            [Technische Rahmen\-bedinungen
            [System\-architektur]
            [Software\-kriterien]
            [Schnittstellen]
            [Wartung und Support
            [Support\-leistungen]
            [Software-Pflege]
            ]
            ]     
            ]
        \end{forest}    
    }
\end{center}

\end{document}

tree

4
  • I don't know what this represents, but are you sure it would not look better as a schemata?
    – cfr
    Commented Mar 12, 2016 at 2:01
  • @cfr, thanks for your reply! Honestly, idk what a schemata looks like. Would you have an example for me?
    – Eric
    Commented Mar 12, 2016 at 7:30
  • I don't know if that's an official name exactly. I was just following the package's name. I think it has examples, but let me know if not as I'm sure I've got an example somewhere since I used these for at least one diagram I did for notes I was making last summer. You could also probably get Forest to do it if you wanted to.
    – cfr
    Commented Mar 12, 2016 at 13:58
  • Ahh, you mean the kind of diagram with the brackets? This could be an option, indeed. In this specific situation the tree diagram is even more suitable though. Still, I highly appreciate your idea!
    – Eric
    Commented Mar 12, 2016 at 14:42

1 Answer 1

4

For other newcomer regarding tree diagrams, improving a standard tree could be done for instance by:

  • coloring elements
  • using classes like parent, child, grandchild
  • aaaand round corners

    \documentclass[a4paper, 12pt]{article}
    \usepackage{forest}
    
    \usetikzlibrary{shapes,arrows,positioning,shadows,trees}
    
    \tikzset{parent/.style={align=center,text width=3cm,rounded corners=3pt},
    child/.style={align=center,text width=3cm,rounded corners=3pt}
    }
    
    \begin{document}
    
    \begin{center}
    \resizebox{.7\textwidth}{!}{%
        \begin{forest}
            for tree={
                child anchor=west,
                parent anchor=east,
                grow'=east,
                draw,
                rounded corners,
                node options={
                    align=center },
                text width=2.7cm,
                anchor=west,
                edge path={
                    \noexpand\path[\forestoption{edge}]
                    (.child anchor) -| +(-5pt,0) -- +(-5pt,0) |-
                    (!u.parent anchor)\forestoption{edge label};
                },
            }       
            % Never have an empty line at this position!!! causes "Paragraph ended before \forestrset was complete. }"
            [LMS, fill=gray!30, parent
            [Funktionale \\Anforderungen, fill=brown!30, child]
            [Nicht-Funktionale Anforderungen, for tree={child, fill=red!30}
            [Zuverl{\"a}ssig\-keit]
            [Skalierbar\-keit und Effizienz]
            [Benutzer\-freundlich\-keit]
            [Portierbarkeit]
            [Datenschutz / Informationssicherheit]
            [Erweiterbar\-keit]
            [Anpassbarkeit]
            ]
            [Technische Rahmen\-bedinungen, for tree={child, fill=blue!30}
            [System\-architektur]
            [Software\-kriterien]
            [Schnittstellen]
            [Wartung und Support
            [Support\-leistungen]
            [Software-Pflege]
            ]
            ]     
            ]
        \end{forest}    
    }
    \end{center}
    
    \end{document}
    

improved tree

EDIT applying suggestion from Sašo Živanović.

(Note that this will work for forest v2 only)

\documentclass[a4paper, 12pt]{report}

\usepackage[edges]{forest}
\usetikzlibrary{trees}

%Defining Classes Parent and Child
\tikzset{parent/.style={text width=2cm,rounded corners=8pt},
    child/.style={text width=3cm,rounded corners=3pt}
}

\begin{document}
    \begin{center}
        \resizebox{.7\textwidth}{!}{%
            \begin{forest}
                forked edges,
                for tree={
                    grow'=east,
                    draw,
                    rounded corners,
                    node options={
                        align=center },
                }       
                % Never have an empty line somewhere!!! this causes "Paragraph ended before \forestrset was complete. }"
                [LMS, fill=gray!30, parent  %apply class (affects all elements below)
                    [Funktionale \\Anforderungen, fill=brown!30, child]     %apply class
                    [Nicht-Funktionale Anforderungen, for tree={child, fill=red!30}     %apply class
                        [Zuverl{\"a}ssig\-keit]
                        [Skalierbar\-keit und Effizienz]
                        [Benutzer\-freundlich\-keit]
                        [Portierbarkeit]
                        [Datenschutz / Informationssicherheit]
                        [Erweiterbar\-keit]
                        [Anpassbarkeit]
                    ]
                    [Technische Rahmen\-bedinungen, for tree={child, fill=blue!30}      %apply class
                        [System\-architektur]
                        [Software\-kriterien]
                        [Schnittstellen]
                        [Wartung und Support
                            [Support\-leistungen]
                            [Software-Pflege]
                        ]
                    ]     
                ]
            \end{forest}    
        }
    \end{center}

\end{document}

new tree

9
  • FYI, Forest v2 features style folder (in library edges). Commented Mar 10, 2016 at 21:31
  • @SašoŽivanović okay, that's good to know. Could you quickly tell how to use it particularly?
    – Eric
    Commented Mar 10, 2016 at 21:45
  • 1
    (i) Call the package by \usepackage[edges]{forest} or add \useforestlibrary{edges} to the preamble; (ii) Put for tree={grow'=east, folder} to the preamble of the forest tree. Commented Mar 10, 2016 at 21:53
  • Okay, I've done this. Loaded the edge-lib and added folder to the preamble, and now? Sorry, I couldn't make it apparently. What does this replace?
    – Eric
    Commented Mar 10, 2016 at 22:03
  • 1
    First, I assume you have forest v2. Second, you should remove edge path, and also anchor, child anchor and parent anchor`` from the existing tree preamble, as folder` sets all these. Commented Mar 10, 2016 at 22:18

You must log in to answer this question.

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