我对 LaTeX 还比较陌生。我一直在努力将两棵树放在同一个投影仪幻灯片的正确位置。我能够让它们居中,但当我添加项目符号时,图片会不断向上移动。此外,我不得不缩小树的整体尺寸以使它们并排放置。但看起来树确实有空间可以稍微大一点。这是我到目前为止的代码:
\begin{frame}
\begin{figure}
\tiny
\begin{minipage}[b][5cm]{0.35\textwidth}
\begin{tikzpicture}[scale=.4,sibling distance=0pt]
\begin{forest}
for tree={circle, draw, fill=blue!80!darkgray!25}
[
[
[
[ [ ] [ ] ]
[ [ ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ]
[
[
[ [ ] [ ] ]
[ [,fill={red} ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ] ] ]
\end{forest}
\end{tikzpicture}
\end{minipage}
\begin{minipage}[b][5cm]{0.5\linewidth}
\begin{tikzpicture}[scale=.5,sibling distance=0pt]
\begin{forest}
for tree={circle, draw,fill=blue!80!darkgray!25,}
[
[
[
[ [ ] [ ] ]
[ [ ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ]
[
[
[ [,fill={red} ] [ ] ]
[ [ ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ] ] ]
\end{forest}
\end{tikzpicture}
\end{minipage}
\end{figure}
有人能帮忙把图片居中,这样添加项目符号就不会把图片移上去吗?任何帮助都非常感谢!谢谢
答案1
我认为您正在嵌套 tizkpictures,即 forest 已经创建了 tikzpicure。并且 beamer 有自己的方法将内容放在一起:列。因此您也不需要 minipages。如果您想要容纳所有内容,您可能需要进一步缩小 forests。
\documentclass{beamer}
\usepackage{forest}
\begin{document}
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{forest}
for tree={circle, draw, fill=blue!80!darkgray!25,scale=.3,sibling distance=0pt}
[
[
[
[ [ ] [ ] ]
[ [ ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ]
[
[
[ [ ] [ ] ]
[ [,fill={red} ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ] ] ]
\end{forest}
\end{column}
\begin{column}{0.5\textwidth}
\begin{forest}
for tree={circle, draw,fill=blue!80!darkgray!25,scale=.3,sibling distance=0pt}
[
[
[
[ [ ] [ ] ]
[ [ ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ]
[
[
[ [,fill={red} ] [ ] ]
[ [ ] [ ] ] ]
[
[ [ ] [ ] ]
[ [ ] [ ] ] ] ] ] ]
\end{forest}
\end{column}
\end{columns}
\end{frame}
\end{document}