我有一张带有一些文字的幻灯片,我想在它们下面添加一棵树。
每个节点的暂停实际上并不重要,但如果可能的话,效果会更好。是否有可能改变森林的大小?
我尝试了此代码但树超出了页面大小:
\documentclass{beamer}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\usepackage{lipsum}
\begin{document}
\begin{frame}[fragile]{Introduction}
\begin{itemize}
\setlength\itemsep{1em}
\item \lipsum[1][1-5]
\item \lipsum[1][1-5]
\end{itemize}
\begin{figure}
\begin{forest}
for tree = {
circle,
draw,
edge = {-Straight Barb, semithick},
l sep=8mm,
s sep=15mm,
minimum size = 3em,
EL/.style 2 args = {edge label={%
node[midway, font=\footnotesize, align=center,
inner sep=2pt, anchor=south #1]{#2}},
},
}
[Outlook,
[Humidity, EL={east}{sunny}
[Play, EL={east}{H $\leq$ 75}]
[Don't play, EL={west}{H > 75}]
]
[Play, EL={east}{Overcast}]
[Wind, EL={west}{Raining}
[Play, EL={east}{weak}]
[Don't play, EL={west}{strong}]
]
]
\end{forest}
\end{figure}
\end{frame}
\end{document}
答案1
之前曾有人询问过如何扩大森林森林树木的规模
要在节点之间暂停,您可以使用以下解决方案https://tex.stackexchange.com/a/112471/36296
\usepackage[T1]{fontenc}
如果你想>
在文档中看到 - 符号,请使用
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{overlay-beamer-styles}
\usepackage{lipsum}
\forestset{
visible on/.style={
for tree={
/tikz/visible on={#1},
edge+={/tikz/visible on={#1}}}}}
\begin{document}
\begin{frame}[fragile]
\frametitle{Introduction}
\begin{itemize}
\setlength\itemsep{1em}
\item \lipsum[1][1-5]
\item \lipsum[1][1-5]
\end{itemize}
\begin{figure}
\scriptsize
\begin{forest}
for tree = {
ellipse,
draw,
edge = {-Straight Barb, semithick},
l sep=1.5em,
s sep=2.5em,
minimum width=6em,
EL/.style 2 args = {edge label={%
node[midway, font=\tiny, align=center,
inner sep=2pt, anchor=south #1]{#2}},
},
}
[Outlook
[Humidity, visible on=<2->, EL={east}{sunny}
[Play, visible on=<3->, visible on=<3->, EL={east}{H $\leq$ 75}]
[Don't play, visible on=<4->, EL={west}{H > 75}]
]
[Play, visible on=<5->, EL={east}{Overcast}]
[Wind, visible on=<6->, EL={west}{Raining}
[Play, visible on=<7->, EL={east}{weak}]
[Don't play, visible on=<8->, EL={west}{strong}]
]
]
\end{forest}
\end{figure}
\end{frame}
\end{document}