Saving vertical space in tree diagram
I don't know if this is helpful but, as a follow up to discussion in comments, you might make the tree more generally compact by doing something like this:
\documentclass[ngerman]{scrreprt}
\usepackage[edges]{forest}
\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={
% forked edges,
draw,
rounded corners,
node options={align=center,},
text width=2.7cm,
},
where level=0{%
}{%
folder,
grow'=0,
if level=1{%
before typesetting nodes={child anchor=north},
edge path'={(!u.parent anchor) -- ++(0,-5pt) -| (.child anchor)},
}{},
}
[LMS, fill=gray!25, parent
[Funktionale \\Anforderungen, for tree={fill=brown!25, child}
[Lerninhalte organisieren]
[Lerninhalte erstellen]
[Lerninhalte abfragen]
[Kommunikation]
[Benutzerkonten\-führung]
[Steuerungs\-funktionen]
]
[Nicht-Funktionale Anforderungen, for tree={fill=red!25,child}
[Zuverl{\"a}ssig\-keit]
[Skalierbar\-keit und Effizienz]
[Benutzer\-freundlich\-keit]
[Portierbarkeit]
[Datenschutz / Informationssicherheit]
[Erweiterbar\-keit]
[Anpassbarkeit]
]
[Technische Rahmen\-bedinungen, for tree={fill=blue!25, child}
[System\-architektur]
[Software\-kriterien]
[Schnittstellen]
[Wartung und Support
[Support\-leistungen]
[Software-Pflege]
]
]
]
\end{forest}
}
\end{center}
\end{document}
Note that resizing graphics which contain text is not recommended as you end up with a motley of different font sizes. So, if you can avoid resizing the box like that, it would be preferable.
EDIT
To address the queries in comments:
'Centre' is actually ambiguous - centre relative to what? I would recommend aligning the root with the middle child. The easiest way to do this is probably to add
calign with current edge
to the relevant child node:[Nicht-Funktionale Anforderungen, for tree={fill=red!25,child}, calign with current edge
which gives
The edges are being controlled in multiple ways:
forked edges
applies to the entire tree (although it is not actually doing anything as it is being overridden in all cases);folder
changes the edges for all nodes below the root, which is to say, all nodes which can possibly have edges;edge path'
then makes a final change for the nodes in the first level only, which are the edges you were trying to change.
So to revert to the default style for the first level, we want to:
- delete
forked edges
; - delete
edge path
.
folder
doesn't harm anything here, so we can just leave that:
If we wanted the edges to begin from a common point, we could redefine parent anchor
for the root:
where level=0{%
parent anchor=children,
}{%
or we could use an alternative definition of edge path
of whatever kind we wanted. For example:
where level=0{%
parent anchor=children,
}{%
folder,
grow'=0,
if level=1{%
before typesetting nodes={child anchor=north},
edge path'={%
(!u.parent anchor) -- ++(0,-5pt) -- (.child anchor)
},
}{},
}
You could align the nodes on the next level with tier=<some name>
:
% arara: pdflatex
\documentclass[ngerman]{scrreprt}
\usepackage[edges]{forest}
\tikzset{%
,parent/.style={align=center,text width=3cm,rounded corners=3pt}
,child/.style={align=center,text width=3cm,rounded corners=3pt}
}
\begin{document}
\begin{figure}\centering
\begin{forest}
for tree={%
,scale=.78
,grow'=east
,forked edges
,draw
,rounded corners
,node options={align=center}
,text width=2.7cm
,anchor=west
}
[LMS, fill=gray!25, parent
[Funktionale \\Anforderungen, tier=align here, for tree={fill=brown!25, child}
[Lerninhalte organisieren]
[Lerninhalte erstellen]
[Lerninhalte abfragen]
[Kommunikation]
[Benutzerkonten\-führung]
[Steuerungs\-funktionen]
]
[Nicht-Funktionale Anforderungen, for tree={fill=red!25,child}
[Zuverl{\"a}ssig\-keit]
[Skalierbar\-keit und Effizienz]
[Benutzer\-freundlich\-keit]
[Portierbarkeit]
[Datenschutz / Informationssicherheit]
[Erweiterbar\-keit]
[Anpassbarkeit, tier=align here]
]
[Technische Rahmen\-bedinungen, tier=align here, for tree={fill=blue!25, child}
[System\-architektur]
[Software\-kriterien]
[Schnittstellen]
[Wartung und Support
[Support\-leistungen]
[Software-Pflege]
]
]
]
\end{forest}
\end{figure}
\end{document}