
約1週間前に@cfrがすでに非常に適切な解決策を提供していましたツリー図の垂直方向のスペースを節約する残念ながら、当初の状況は変わり、私のスキルを超えた水平ツリーに直面しています。実際、これは前回の質問と同じツリーですが、3 つのメイン ブランチの 1 つが、残りの 2 つのメイン ブランチの一部になっているという違いがあります。私が試したことは次のとおりです。
\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}
何らかの理由で、改行のあるノードがうまく整列しません... 誰か、なぜこれを修正できるのか、あるいはどう修正できるのかを説明してもらえますか?
また、1 つのレベルの 1 つのノードだけを分割する方法はありますか? この例では、ノード「Technische Rahmenbedinungen」を右に 2cm 分割する必要があります。s sep
レベル全体に適用されます...
最後になりましたが、ここで水平方向のスペースをもう少し節約する方法をご存知の方はいらっしゃいますか? テキストはまだ少し小さすぎます。
私もこれを試しました。もちろんこれはかなり良い代替案ですが、水平方向が気になります。
\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}
ご協力いただければ幸いです。
答え1
追加
anchor=parent,
ツリーではノードがよりきれいに整列されることが保証されます。
特定のノードを移動するには、
before drawing tree={x'+=20mm}
問題のノードに対して。例:
ノードの子孫にも適用したい場合は、サブツリー全体に追加できます。例:
[Technische Rahmen\-bedinungen, for tree={child, calign=last, fill=col1, before drawing tree={x'+=20mm}}
もちろん、これは、すでにかなり不快に広がっているように見える木の水平方向のスペースをさらに使用することになります。なぜ2cm 右に移動する必要がありますか? これが何を表しているかにかかわらず、別の方法で表現することはできますか?
水平方向のスペースに関して何を提案すればよいか分かりません。最も明白な提案は、あなたが行っていることをしないことです。増加text width
それほど多くのスペースを必要としないノードにも均一を使用するなど、水平方向のスペースを節約します。また、設定によりs sep=3cm
、水平方向のスペースの使用が明らかにさらに増加します。
これらの制約を犠牲にできる場合は、次のようなことができます。
\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}
編集
上記は私の環境では問題なく動作します\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}
追加calign with current
先Anpassbarkeit
:
[Anpassbarkeit, calign with current]
生産する