Beamer 中的 Tikz 增量框图

Beamer 中的 Tikz 增量框图

我正在制作一个 Beamer 演示文稿,其中需要一个框图。我想在多张幻灯片上逐步生成框图,并在其下方添加不同的文本来解释正在发生的事情。有没有比每帧复制代码更有效的方法?此外,是否可以将图片固定在某个位置,而不是让它根据其下方的文本上下移动?

平均能量损失

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{matrix,graphs}
\usepackage{lipsum}
\begin{document}
\begin{frame}{System}
  \begin{tikzpicture}
    \matrix (m) [row sep = 2mm, column sep = 3mm, ampersand replacement=\&] {\node (A) [rectangle, draw] {A};\\
      \node (C) {\phantom{C}};\\
      };
  \end{tikzpicture}
  \begin{itemize}
  \item Now only block A is visible
  \end{itemize}
\end{frame}
\begin{frame}{System}
  \begin{tikzpicture}
    \matrix (m) [row sep = 2mm, column sep = 3mm, ampersand replacement=\&] {
      \node (A) [rectangle, draw] {A}; \& \node (B) [rectangle, draw] {B};\\
      \node (C) {\phantom{C}};\\
      };
      \graph [use existing nodes] {
        A -> B;
        };
  \end{tikzpicture}
  \begin{itemize}
  \item Block B is easy enough to add
  \end{itemize}
\end{frame}
\begin{frame}{System}
  \begin{tikzpicture}
    \matrix (m) [row sep = 2mm, column sep = 3mm, ampersand replacement=\&] {
      \node (A) [rectangle, draw] {A}; \& \node (B) [rectangle, draw] {B};\\
      \node (C) [rectangle, draw] {C};\\
      };
      \graph [use existing nodes] {
        A -> B;
        A -> C;
        };
  \end{tikzpicture}
  \begin{itemize}
  \item It's annoying to have to include \textbackslash phantom\{C\}
  \end{itemize}
\end{frame}
\begin{frame}{System}
  \begin{tikzpicture}
    \matrix (m) [row sep = 2mm, column sep = 3mm, ampersand replacement=\&] {
      \node (A) [rectangle, draw] {A}; \& \node (B) [rectangle, draw] {B};\\
      \node (C) [rectangle, draw] {C};\\
      };
      \graph [use existing nodes] {
        A -> B;
        A -> C;
        };
  \end{tikzpicture}
  \begin{itemize}
  \item Having a long text underneath also changes figure position which I don't want. \lipsum
  \end{itemize}
\end{frame}
\end{document}

注意:只要有 lipsum,我就不会有文本,我的真实框图和文本应该可以毫无问题地放入一个框架中。

谢谢

答案1

这是一个解决方案:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{matrix,graphs}
\usepackage{lipsum}
\begin{document}

\begin{frame}{System}
  \begin{tikzpicture}
    \matrix (m) [row sep = 2mm, column sep = 3mm, ampersand replacement=\&] {
      \node (A) [rectangle, draw] {A};
      \& \visible<2->{\node (B) [rectangle, draw] {B};}\\
      \visible<3->{\node (C) [rectangle, draw] {C};}\\
    };
    \visible<2->{\graph [use existing nodes] {A -> B;};}
    \visible<3->{\graph [use existing nodes] {A -> C;};}
  \end{tikzpicture}

  \begin{overprint}
    \onslide<1>
    \begin{itemize}
    \item Now only block A is visible
    \end{itemize}
    \onslide<2>
    \begin{itemize}
    \item Block B is easy enough to add
    \end{itemize}
    \onslide<3>
    \begin{itemize}
    \item Block C is easy enough to add
    \end{itemize}
    \onslide<4>
    \begin{itemize}
    \item \lipsum[6]
    \end{itemize}
  \end{overprint}
\end{frame}
\end{document}

在此处输入图片描述

相关内容