我在 Beamer 有以下森林:
\begin{forest}
for tree={
align=center,
font=\sffamily,
%edge+={thick, -{Stealth[]}},
l sep'+=10pt,
fork sep'=10pt,
},
forked edges,
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[Degredation Modeling
[Mechanical\\Models]
[Statistical\\Models
[Deterministic\\Models]
[Probabilistic\\Models
[Continuous\\Distributions]
[Bayesian\\Models]
]
[Stochastic\\Models
[Markov Models]
[Poisson and \\Other Processes]
]
]
[Mechanical-Statistical \\Models]
[Artificial Intelligence\\Models ]
]
\end{forest}
}
我想要做的是,我想将概率模型和随机模型子层中的最后四片叶子组合起来,并写出这些模型的共同优点和缺点。我该如何进行如下所示的反向分支?(它不必是直箭头或直线,任何表明这四个节点也有效的符号都可以)
答案1
像这样?
一种可能性是给终端节点命名(参见下面的 MWE)并在其下方绘制额外的节点,并将该节点与命名节点连接起来。
\documentclass{beamer}
\usepackage[edges]{forest}
\usetikzlibrary{calc} % <--------
\begin{document}
\begin{forest}
for tree={
align=center,
font=\sffamily,
forked edge,
s sep'=2pt,
l sep'=8pt,
fork sep'=7pt,
},
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[Degredation Modeling
[Mechanical\\Models]
[Statistical\\Models
[Deterministic\\Models]
[Probabilistic\\Models
[Continuous\\Distributions, name=a] % <---
[Bayesian\\Models, name=b] % <---
]
[Stochastic\\Models
[Markov\\ Models, name=c] % <---
[Poisson and \\Other Processes, name=d] % <---
]
]
[Mechanical-Statistical \\Models]
[Artificial Intelligence\\Models]
]
\foreach \i in {a,...,d} % <---------
\draw[semithick]
(\i) -- ($(a)!0.5!(d) + (0,-1.5)$)
node[below, align=center] {They are acurate,\\
but require data, etc} ;
\end{forest}
\end{document}
编辑:MWE 现已被应用于beamer
文档类。-