考虑以下 MWE
\documentclass{beamer}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{positioning}% To get more advances positioning options
\usetikzlibrary{arrows}% To get more arrow heads
\usetikzlibrary{math,calc}
\usetikzlibrary{arrows.meta, bending, decorations.markings, angles, quotes, fit}
\usetikzlibrary{tikzmark}
\usetikzlibrary{scopes}
\mode<presentation> {
\usetheme{Boadilla}
\setbeamertemplate{footline}{}% get rid of footer completely
}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{amssymb, mathtools, amsfonts}
\definecolor{MyColor1}{rgb}{0.24, 0.59, 0.32}
\definecolor{MyColor2}{rgb}{0.85, 0.49, 0.19}
\definecolor{MyColor3}{rgb}{0.22, 0.42, 0.69}
\usepackage{tikz}
\usefonttheme{serif}
\begin{document}
\begin{frame}\frametitle{Examples}
\begin{center}
\begin{tabular}{c|c}
\onslide<1->{
$\langle\alpha,\beta\rangle = \langle\beta,\alpha\rangle =-1$
& $3\langle\alpha,\beta\rangle= \langle\beta,\alpha\rangle=-3$\\\midrule
& \\
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
\draw (-2,-2) rectangle (2,2);
\node (alpha) at (1.2,0) {$\alpha$};
\node (beta) at (120:1.2) {$\beta$};
\draw[->] (0,0) -- (0:1);
\draw[->] (0,0) -- (120:1);
\only<1>{
\foreach \angle in {60,180,240,300}{
\draw[->] (0,0) -- (\angle:1);
}
}
\draw[MyColor1] (0.5,0) arc (0:120:0.5);
\draw[fill=MyColor1, opacity=0.3] (0,0) -- (0.5,0) arc (0:120:0.5) -- cycle;
\end{tikzpicture} &
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
\draw (-2,-2) rectangle (2,2);
\node (alpha) at (1.2,0) {$\alpha$};
\node (beta) at (150:1.9) {$\beta$};
\draw[->] (0,0) -- (150:1.7320);
\draw[->] (0,0) -- (0:1);
\only<1>{
\foreach \angle in {30,60,90,120,180,210,240,270,300,330}{
\pgfmathsetmacro{\bigradius}{sqrt(3)}
\ifthenelse{\angle=30 \OR
\angle=90 \OR
\angle=150 \OR
\angle=210 \OR
\angle=270 \OR
\angle=330}{
\draw[->] (0,0) -- (\angle:\bigradius);
}{
\draw[->] (0,0) -- (\angle:1);
};
}
}
\draw[MyColor1] (0.5,0) arc (0:150:0.5);
\draw[fill=MyColor1, opacity=0.3] (0,0) -- (0.5,0) arc (0:150:0.5) -- cycle;
\end{tikzpicture}\\
& \\}
\only<2->{
\only<3>{
$\begin{pmatrix*}[r] \hphantom{-2} & \hphantom{-1}\\
\hphantom{-1} & \hphantom{-2}
\end{pmatrix*}$}
\only<4->{
$\begin{pmatrix*}
\only<4->{-2} & \only<5->{\color<5->{MyColor1}{-1}}\\
\only<5->{\color<5->{MyColor1}{-1}} & \only<4->{-2}
\end{pmatrix*}$}
&
\only<3>{
$\begin{pmatrix} \hphantom{-2} & \hphantom{-1}\\
\hphantom{-1} & \hphantom{-2}
\end{pmatrix}$}
\only<4->{
$\begin{pmatrix*}[r] \only<4->{-2} & \only<5->{\color<5->{MyColor1}{-1}}\\
\only<5->{\color<5->{MyColor1}{-3}} & \only<3->{-2}
\end{pmatrix*}$}
}
\end{tabular}
\end{center}
\end{frame}
\end{document}
它在正确的位置显示了它应该显示的内容,即显示的顺序是正确的。我对输出的唯一问题是,当显示某些元素时,表格的边框(中心线和第一行)会移动。我设法让两者tikzpictures
保持原位,但当我将矩阵添加到表格中时,它们也开始移动……
我不太明白问题出在哪里,因为我认为我应用了同样的技术来保持整个框架中的事物不变,但它有时似乎不起作用(这是我所采取的指导方针)...我可能以错误的方式处理这个问题,但我真的不知道除了在必要时添加空白之外,如何让事情保持在原位。
如果能提供任何关于如何让整个桌子保持固定同时显示不同部分的提示,我将不胜感激。
答案1
如果你使用为此而制作的[t]
选项和库,并丢弃隐藏的空间,你会得到overlay-beamer-styles
\documentclass{beamer}
\usepackage{tikz}
\usepackage{ifthen}
\usetikzlibrary{overlay-beamer-styles}
\mode<presentation> {
\usetheme{Boadilla}
\setbeamertemplate{footline}{}% get rid of footer completely
}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{amssymb, mathtools, amsfonts}
\definecolor{MyColor1}{rgb}{0.24, 0.59, 0.32}
\definecolor{MyColor2}{rgb}{0.85, 0.49, 0.19}
\definecolor{MyColor3}{rgb}{0.22, 0.42, 0.69}
\usefonttheme{serif}
\begin{document}
\begin{frame}[t]
\frametitle{Examples}
\begin{center}
\begin{tabular}{c|c}
\onslide<1->{
$\langle\alpha,\beta\rangle = \langle\beta,\alpha\rangle =-1$
& $3\langle\alpha,\beta\rangle= \langle\beta,\alpha\rangle=-3$\\\midrule
& \\
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
\draw (-2,-2) rectangle (2,2);
\node (alpha) at (1.2,0) {$\alpha$};
\node (beta) at (120:1.2) {$\beta$};
\draw[->] (0,0) -- (0:1);
\draw[->] (0,0) -- (120:1);
\foreach \angle in {60,180,240,300}{
\draw[->,visible on=<1>] (0,0) -- (\angle:1);
}
\draw[MyColor1] (0.5,0) arc (0:120:0.5);
\draw[fill=MyColor1, opacity=0.3] (0,0) -- (0.5,0) arc (0:120:0.5) -- cycle;
\end{tikzpicture} &
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
\draw (-2,-2) rectangle (2,2);
\node (alpha) at (1.2,0) {$\alpha$};
\node (beta) at (150:1.9) {$\beta$};
\draw[->] (0,0) -- (150:1.7320);
\draw[->] (0,0) -- (0:1);
\begin{scope}[visible on=<1>]
\foreach \angle in {30,60,90,120,180,210,240,270,300,330}{
\pgfmathsetmacro{\bigradius}{sqrt(3)}
\ifthenelse{\angle=30 \OR
\angle=90 \OR
\angle=150 \OR
\angle=210 \OR
\angle=270 \OR
\angle=330}{
\draw[->] (0,0) -- (\angle:\bigradius);
}{
\draw[->] (0,0) -- (\angle:1);
};
}
\end{scope}
\draw[MyColor1] (0.5,0) arc (0:150:0.5);
\draw[fill=MyColor1, opacity=0.3] (0,0) -- (0.5,0) arc (0:150:0.5) -- cycle;
\end{tikzpicture}\\
& \\}
\only<2->{%
\only<3>{%
$\begin{pmatrix*}[r] \hphantom{-2} & \hphantom{-1}\\
\hphantom{-1} & \hphantom{-2}
\end{pmatrix*}$}%
\only<4->{%
$\begin{pmatrix*}
\only<4->{-2} & \only<5->{\color<5->{MyColor1}{-1}}\\
\only<5->{\color<5->{MyColor1}{-1}} & \only<4->{-2}
\end{pmatrix*}$}%
&
\only<3>{%
$\begin{pmatrix} \hphantom{-2} & \hphantom{-1}\\
\hphantom{-1} & \hphantom{-2}
\end{pmatrix}$}%
\only<4->{%
$\begin{pmatrix*}[r] \only<4->{-2} & \only<5->{\color<5->{MyColor1}{-1}}\\
\only<5->{\color<5->{MyColor1}{-3}} & \only<3->{-2}
\end{pmatrix*}$}%
}%
\end{tabular}
\end{center}
\end{frame}
\end{document}
重点是让只出现在特殊幻灯片上的内容在其他幻灯片上不可见。这样,这些内容仍然对边界框有贡献,从而避免跳跃。
至于矩阵的移位,它们来自虚假空间,我通过%
在适当的地方添加字符将其删除。
离题:我删除了这里未使用的库。\ifthenelse
我不知道当有 pgf 可供使用时是否应该使用宏,但我保留了它。
答案2
只是为了使用解决方案overlayarea
\documentclass{beamer}
\usepackage{tikz}
\usepackage{ifthen}
\usetikzlibrary{overlay-beamer-styles}
\mode<presentation> {
\usetheme{Boadilla}
\setbeamertemplate{footline}{}% get rid of footer completely
}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{amssymb, mathtools, amsfonts}
\definecolor{MyColor1}{rgb}{0.24, 0.59, 0.32}
\definecolor{MyColor2}{rgb}{0.85, 0.49, 0.19}
\definecolor{MyColor3}{rgb}{0.22, 0.42, 0.69}
\usefonttheme{serif}
\begin{document}
\begin{frame}\frametitle{Examples}
\begin{overlayarea}{\textwidth}{0.5\paperheight}
\begin{center}
\begin{tabular}{c|c}
\onslide<1->{%
$\langle\alpha,\beta\rangle = \langle\beta,\alpha\rangle =-1$
& $3\langle\alpha,\beta\rangle= \langle\beta,\alpha\rangle=-3$\\\midrule
& \\
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
\draw (-2,-2) rectangle (2,2);
\node (alpha) at (1.2,0) {$\alpha$};
\node (beta) at (120:1.2) {$\beta$};
\draw[->] (0,0) -- (0:1);
\draw[->] (0,0) -- (120:1);
\only<1>{
\foreach \angle in {60,180,240,300}{
\draw[->] (0,0) -- (\angle:1);
}
}
\draw[MyColor1] (0.5,0) arc (0:120:0.5);
\draw[fill=MyColor1, opacity=0.3] (0,0) -- (0.5,0) arc (0:120:0.5) -- cycle;
\end{tikzpicture} &
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
\draw (-2,-2) rectangle (2,2);
\node (alpha) at (1.2,0) {$\alpha$};
\node (beta) at (150:1.9) {$\beta$};
\draw[->] (0,0) -- (150:1.7320);
\draw[->] (0,0) -- (0:1);
\only<1>{
\foreach \angle in {30,60,90,120,180,210,240,270,300,330}{
\pgfmathsetmacro{\bigradius}{sqrt(3)}
\ifthenelse{\angle=30 \OR
\angle=90 \OR
\angle=150 \OR
\angle=210 \OR
\angle=270 \OR
\angle=330}{
\draw[->] (0,0) -- (\angle:\bigradius);
}{
\draw[->] (0,0) -- (\angle:1);
};
}
}
\draw[MyColor1] (0.5,0) arc (0:150:0.5);
\draw[fill=MyColor1, opacity=0.3] (0,0) -- (0.5,0) arc (0:150:0.5) -- cycle;
\end{tikzpicture}\\
& \\}%
\only<2->{%
\only<3>{%
$\begin{pmatrix*}[r] \hphantom{-2} & \hphantom{-1}\\
\hphantom{-1} & \hphantom{-2}
\end{pmatrix*}$}%
\only<4->{%
$\begin{pmatrix*}
\only<4->{-2} & \only<5->{\color<5->{MyColor1}{-1}}\\
\only<5->{\color<5->{MyColor1}{-1}} & \only<4->{-2}
\end{pmatrix*}$}
&
\only<3>{%
$\begin{pmatrix} \hphantom{-2} & \hphantom{-1}\\
\hphantom{-1} & \hphantom{-2}
\end{pmatrix}$}%
\only<4->{%
$\begin{pmatrix*}[r] \only<4->{-2} & \only<5->{\color<5->{MyColor1}{-1}}\\
\only<5->{\color<5->{MyColor1}{-3}} & \only<3->{-2}
\end{pmatrix*}$}%
}%
\end{tabular}
\end{center}
\end{overlayarea}
\end{frame}
\end{document}