
次の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}
正しい位置に何が表示されるか、つまり表示されるものの順序が正しいかが表示されます。出力に関して私が抱えている唯一の問題は、一部の要素が表示されると、表の境界 (中央の線と最初の行) がずれてしまうことです。2 つを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}