
Hace aproximadamente una semana @cfr ya proporcionó una solución muy decente paraahorrando espacio vertical en mi diagrama de árbol. Lamentablemente mi situación inicial ha cambiado ahora y me encuentro ante un árbol horizontal que supera mis capacidades. En realidad es el mismo árbol que en mi pregunta anterior, con la diferencia de que una de las tres ramas principales ahora forma parte de las dos ramas principales restantes. Esto es lo que he probado:
\documentclass[a4paper,11pt]{article}
\usepackage[edges]{forest}
%Defining tikz classes for tree diagrams
\tikzset{parent/.style={align=center,text width=3cm,rounded corners=3pt},
child/.style={align=center,text width=3cm,rounded corners=3pt}
}
\colorlet{col1}{white}
\colorlet{col2}{gray!20}
\colorlet{col3}{gray!40}
\colorlet{col4}{gray!60}
\begin{document}
\begin{center}
\resizebox{\linewidth}{!}{%
\begin{forest}
forked edges,
for tree={
draw,
rounded corners,
node options={align=center,},
text width=2.7cm,
minimum height=1.5cm,
parent anchor=children,
}
[LMS, fill=col4, parent, s sep=3cm
[Funktionale \\Anforderungen, for tree={child, fill=col3}
[Lerninhalte organisieren, tier=first]
[Lerninhalte erstellen]
[Lerninhalte abfragen]
[Kommunikation]
[Benutzerkonten\-führung]
[Steuerungs\-funktionen]
]
[Nicht-Funktionale Anforderungen, tier=first, for tree={child, fill=col2}
[Zuverl{\"a}ssig\-keit]
[Skalierbar\-keit und Effizienz]
[Benutzer\-freundlich\-keit]
[Portierbarkeit]
[Datenschutz / Informationssicherheit]
[Erweiterbar\-keit]
[Anpassbarkeit]
[Technische Rahmen\-bedinungen, for tree={child, calign=last, fill=col1}
[System\-architektur]
[Software\-kriterien]
[Schnittstellen]
[Wartung und Support
[Support\-leistungen]
[Software-Pflege]
]
]
]
]
\end{forest}
}
\end{center}
\end{document}
Por algunas razones, los nodos con un salto de línea no se alinean bien... ¿Alguien puede explicar por qué o más bien cómo puedo solucionar este problema?
¿Y hay alguna manera de dividir solo un nodo de un nivel? En el ejemplo, el nodo "Technische Rahmenbedinungen" debe dividirse 2 cm hacia la derecha. s sep
solo aplica para todo un nivel...
Por último, pero no menos importante, ¿alguien tiene alguna idea de cómo ahorrar un poco más de espacio horizontal aquí? El texto todavía es un poco pequeño.
También hice esto, que por supuesto es una buena alternativa, pero la horizontal me molesta:
\documentclass[a4paper,11pt,ngerman]{article}
\usepackage[edges]{forest}
\usepackage{caption}
%Defining tikz classes for tree diagrams
\tikzset{parent/.style={align=center,text width=3cm,rounded corners=3pt},
child/.style={align=center,text width=3cm,rounded corners=3pt}
}
\colorlet{col1}{white}
\colorlet{col2}{gray!20}
\colorlet{col3}{gray!40}
\colorlet{col4}{gray!60}
\begin{document}
\begin{center}
\resizebox*{.75\linewidth}{!}{%
\begin{forest}
forked edges,
for tree={
grow'=east,
draw,
rounded corners,
text width=2.7cm,
node options={align=center},
}
[LMS, fill=col4, parent, s sep=1cm
[Funktionale \\Anforderungen, for tree={child, fill=col3}
[Lerninhalte organisieren]
[Lerninhalte erstellen]
[Lerninhalte abfragen, calign with current]
[Kommunikation]
[Benutzerkonten\-führung]
[Steuerungs\-funktionen]
]
[Nicht-Funktionale Anforderungen, for tree={child, fill=col2}
[Zuverl{\"a}ssig\-keit]
[Skalierbar\-keit und Effizienz]
[Benutzer\-freundlich\-keit]
[Portierbarkeit]
[Datenschutz/\\Informations-\\sicherheit, calign with current]
[Erweiterbar\-keit]
[Anpassbarkeit]
[Technische Rahmen\-bedinungen, calign=last, for tree={child, fill=col1}
[System\-architektur]
[Software\-kriterien]
[Schnittstellen]
[Wartung und Support
[Support\-leistungen]
[Software-Pflege]
]
]
]
]
\end{forest}}
\captionsetup{type=figure}
\captionof{figure}{Gliederung des UKSH Lastenheft: Subgliederung LMS}
\label{abb:GliederungUKSHLMS}
\end{center}
\end{document}
¡Agradezco cualquier ayuda!
Respuesta1
Añadiendo
anchor=parent,
para el árbol asegurará que los nodos estén alineados más claramente:
Para mover un nodo en particular, puede agregar
before drawing tree={x'+=20mm}
para el nodo en cuestión. Por ejemplo:
Si desea que se aplique también a los descendientes del nodo, puede agregarlo para todo el subárbol. Por ejemplo:
[Technische Rahmen\-bedinungen, for tree={child, calign=last, fill=col1, before drawing tree={x'+=20mm}}
Por supuesto, esto obviamente utiliza más espacio horizontal en un árbol que ya parece estar bastante incómodo. (Por qué¿Es necesario desplazarse 2 cm hacia la derecha? Lo que sea que esto represente, ¿podría representarse de otra manera?)
Es difícil saber qué sugerir respecto al espacio horizontal. La sugerencia más obvia es no hacer las cosas que estás haciendo paraaumentarespacio horizontal, como usar un uniforme text width
incluso para nodos que no requieren tanto espacio. Y la configuración s sep=3cm
obviamente aumenta aún más el uso del espacio horizontal.
Si puedes sacrificar esas restricciones, puedes hacer algo como esto:
\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage[edges]{forest}
%Defining tikz classes for tree diagrams
\forestset{%
parent/.style={text width=3cm,rounded corners=3pt},
child/.style={rounded corners=3pt},
my phantom/.style={inner xsep=0pt, draw=none, child anchor=children}
}
\colorlet{col1}{white}
\colorlet{col2}{gray!20}
\colorlet{col3}{gray!40}
\colorlet{col4}{gray!60}
\begin{document}
\begin{forest}
forked edges,
for tree={
draw,
rounded corners,
align=center,
text centered,
minimum height=1.5cm,
parent anchor=children,
anchor=parent,
},
before typesetting nodes={%
where n children=0{}{%
if content={}{}{%
text width=27mm
},
},
},
[LMS, fill=col4, parent
[Funktionale\\Anforderungen, for tree={child, fill=col3}
[Lerninhalte\\organisieren, tier=first]
[Lerninhalte\\erstellen]
[Lerninhalte\\abfragen]
[Kommunikation]
[Benutzerkonten-\\führung]
[Steuerungs-\\funktionen]
]
[, tier=first, my phantom
[Nicht-Funktionale\\Anforderungen, tier=second, for tree={child, fill=col2}
[Zuverl{\"a}ssig\-keit, tier=third]
[Skalierbar\-keit\\und Effizienz]
[Benutzer-\\freundlich\-keit]
[Portierbarkeit]
[Datenschutz\\/ Informa-\\tionssicherheit]
[Erweiterbar\-keit]
[Anpassbarkeit]
[, my phantom, tier=third
[Technische\\Rahmen-\\bedinungen, for tree={child, calign=last, fill=col1}
[System\-architektur]
[Software\-kriterien]
[Schnittstellen]
[Wartung\\und Support
[Support\-leistungen]
[Software-Pflege]
]
]
]
]
]
]
\end{forest}
\end{document}
EDITAR
Lo anterior funciona bien para mí por dentro \resizebox...
:
\documentclass{article}
\usepackage[edges]{forest}
%Defining tikz classes for tree diagrams
\forestset{%
parent/.style={text width=3cm,rounded corners=3pt},
child/.style={rounded corners=3pt},
my phantom/.style={inner xsep=0pt, draw=none, child anchor=children}
}
\colorlet{col1}{white}
\colorlet{col2}{gray!20}
\colorlet{col3}{gray!40}
\colorlet{col4}{gray!60}
\begin{document}
\resizebox*{\linewidth}{!}{%
\begin{forest}
forked edges,
for tree={
draw,
rounded corners,
align=center,
text centered,
minimum height=1.5cm,
parent anchor=children,
anchor=parent,
},
before typesetting nodes={%
where n children=0{}{%
if content={}{}{%
text width=27mm
},
},
},
[LMS, fill=col4, parent
[Funktionale\\Anforderungen, for tree={child, fill=col3}
[Lerninhalte\\organisieren, tier=first]
[Lerninhalte\\erstellen]
[Lerninhalte\\abfragen]
[Kommunikation]
[Benutzerkonten-\\führung]
[Steuerungs-\\funktionen]
]
[, tier=first, my phantom
[Nicht-Funktionale\\Anforderungen, tier=second, for tree={child, fill=col2}
[Zuverl{\"a}ssig\-keit, tier=third]
[Skalierbar\-keit\\und Effizienz]
[Benutzer-\\freundlich\-keit]
[Portierbarkeit]
[Datenschutz\\/ Informa-\\tionssicherheit]
[Erweiterbar\-keit]
[Anpassbarkeit]
[, my phantom, tier=third
[Technische\\Rahmen-\\bedinungen, for tree={child, calign=last, fill=col1}
[System\-architektur]
[Software\-kriterien]
[Schnittstellen]
[Wartung\\und Support
[Support\-leistungen]
[Software-Pflege]
]
]
]
]
]
]
\end{forest}}
\end{document}
Añadiendo calign with current
a Anpassbarkeit
:
[Anpassbarkeit, calign with current]
produce