
考慮以下 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}
重要的一點是使僅出現在特殊投影片上的內容在其他投影片上不可見。這樣,這些東西仍然對邊界框有貢獻,可以避免跳躍。
至於矩陣的移位,它們來自虛假空間,我透過%
在適當的地方添加字元來刪除它們。
題外話:我刪除了此處未使用的庫。當一個人可以使用 pgf 時,是否應該使用該\ifthenelse
巨集我不知道,但我保留了它。
答案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}