
Cerca de uma semana atrás, @cfr já forneceu uma solução muito decente paraeconomizando espaço vertical no meu diagrama de árvore. Infelizmente minha situação inicial mudou agora e estou diante de uma árvore horizontal que ultrapassa minhas habilidades. Na verdade, é a mesma árvore da minha pergunta anterior, com a diferença de que um dos três ramos principais agora faz parte dos dois ramos principais restantes. Aqui está o que eu tentei:
\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 alguns motivos, os nós com quebra de linha não se alinham bem... Alguém pode explicar por que ou melhor, como posso corrigir isso?
E existe uma maneira de separar apenas um nó de um nível? No exemplo, o nó "Technische Rahmenbedinungen" deve ser dividido à direita em 2 cm. s sep
aplica-se apenas a um nível inteiro...
Por último, mas não menos importante, alguém tem alguma ideia de como economizar um pouco mais de espaço horizontal aqui? O texto ainda é um pouco pequeno.
Eu também fiz isso, o que é uma boa alternativa, mas a horizontal me provoca:
\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}
Agradeço qualquer ajuda!
Responder1
Adicionando
anchor=parent,
para a árvore garantirá que os nós estejam alinhados de forma mais organizada:
Para mover um nó específico, você pode adicionar
before drawing tree={x'+=20mm}
para o nó em questão. Por exemplo:
Se quiser que ele se aplique também aos descendentes do nó, você pode adicioná-lo para toda a subárvore. Por exemplo:
[Technische Rahmen\-bedinungen, for tree={child, calign=last, fill=col1, before drawing tree={x'+=20mm}}
Claro, isso obviamente usa mais espaço horizontal em uma árvore que já parece estar espalhada de forma bastante desconfortável. (Por queprecisa ir 2cm para a direita? O que quer que isto represente, poderia ser representado de outra forma?)
É difícil saber o que sugerir em relação ao espaço horizontal. A sugestão mais óbvia é não fazer as coisas que você está fazendo paraaumentarespaço horizontal, como usar uniforme text width
mesmo para nós que não necessitam de tanto espaço. E a configuração s sep=3cm
obviamente aumenta ainda mais o uso do espaço horizontal.
Se você puder sacrificar essas restrições, poderá fazer algo assim:
\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
O acima funciona bem para mim 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}
Adicionando calign with current
a Anpassbarkeit
:
[Anpassbarkeit, calign with current]
produz