
Ich verwende Beamer und versuche, ein Wort in einer Tabelle über Overlays zu ändern. Auf einigen Folien sollte also "constant" und auf anderen Folien "non-constant" erscheinen - sowohl in derDasselbeBox. (Ich glaube, diese Box unterscheidet diese Frage von anderen.)
Wenn ich es mit onslide mache, reserviert beamer Platz für beide Wörter, was ich nicht will – das führt zu hässlichen Tabellenabständen. Wenn ich es jedoch mit only mache, verschiebt beamer die Tabelle während des Wortwechsels nach unten. Ich füge ein, was meiner Meinung nach ein minimales Beispiel für dieses letztere Phänomen ist. (Ersteres ist Standard.) Beachten Sie, dass das Problem verschwindet, wenn ich die erste Zeile der Tabelle (die über meiner problematischen Zeile) lösche und stattdessen eine Zeile unter der problematischen Zeile einfüge. (Ich melde es nur, falls es Leuten hilft, das herauszufinden.)
Danke!
\documentclass[xcolor=table]{beamer}
\usetheme{Frankfurt}
\usecolortheme{crane}
\begin{document}
\begin{frame}[t]{Test}
\onslide<2->{
\begin{center}
\begin{tabular}{| c || c c c c |}
\hline
& P4 & \onslide<1->{P3} &\onslide<1->{P2} & \onslide<1->{P1} \\ \hline
\only<6>{\cellcolor{yellow}} Cognition 1 & \only<6>
{\cellcolor{yellow}} $(a,c_{*})$ & \only<6>{\cellcolor{yellow}}
\onslide<1->{Constant} & \only<6>{\cellcolor{yellow}} \onslide<1-
{Constant} & \only<6>{\cellcolor{yellow}} \onslide<1->{Constant} \\
\only<5>{\cellcolor{yellow}} \only<1-7>{Cognition 2}\only<8>
{\alert{Cognition 3}}\only<9->{\alert{Cognition 4}} & \only<5>
{\cellcolor{yellow}} $(a,c_{*})$ & \only<5>{\cellcolor{yellow}}
\onslide<1->{$(a,b_{*})$} & \only<5>{\cellcolor{yellow}} \only<1-7,9>
{Constant}%
\only<8>{\alert{Non-Constant}} & \only<5>{\cellcolor{yellow}}
\only<1-8>{Constant}%
\only<9->{\alert{Non-Constant}} \\
\hline
\end{tabular}
\end{center}
}
\end{frame}
\end{document}
Antwort1
Wie ich in meinen Kommentaren angemerkt habe, liegt die Ursache Ihres Problems in der wude-Tabelle. Sie können es auf zwei Arten lösen:
- kleinere Schriftart verwenden
- Reduzieren Sie den Abstand zwischen den Tabellenspalten.
Es scheint, dass die Verwendung von \setlength\tabcolsep{3pt}
zu einem zufriedenstellenden Ergebnis führt:
\documentclass[xcolor=table]{beamer}
%\usetheme{Frankfurt}
%\usecolortheme{crane}
\begin{document}
\begin{frame}[t]{Test}
\onslide<2->{
\begin{center}\setlength\tabcolsep{3pt}
\begin{tabular}{| c || c c c c |}
\hline
& P4 & \onslide<1->{P3} &\onslide<1->{P2} & \onslide<1->{P1} \\ \hline
\only<6>{\cellcolor{yellow}} Cognition 1 & \only<6>
{\cellcolor{yellow}} $(a,c_{*})$ & \only<6>{\cellcolor{yellow}}
\onslide<1->{Constant} & \only<6>{\cellcolor{yellow}} \onslide<1-
{Constant} & \only<6>{\cellcolor{yellow}} \onslide<1->{Constant} \\
\only<5>{\cellcolor{yellow}} \only<1-7>{Cognition 2}\only<8>
{\alert{Cognition 3}}\only<9->{\alert{Cognition 4}} & \only<5>
{\cellcolor{yellow}} $(a,c_{*})$ & \only<5>{\cellcolor{yellow}}
\onslide<1->{$(a,b_{*})$} & \only<5>{\cellcolor{yellow}} \only<1-7,9>
{Constant}%
\only<8>{\alert{Non-Constant}} & \only<5>{\cellcolor{yellow}}
\only<1-8>{Constant}%
\only<9->{\alert{Non-Constant}} \\
\hline
\end{tabular}
\end{center}
}
\end{frame}
\end{document}
Nachtrag: Neben der oben genannten möglichen Lösung sei noch eine weitere erwähnt:
- lokal vergrößerte Textbreite des Rahmens.
Dies kann auch auf andere Weise erreicht werden. Eine Möglichkeit ist die Verwendung des Pakets „changepage and its macro
adjustwidth“. In diesem Fall lautet der Code
\documentclass[xcolor=table]{beamer}
%\usetheme{Frankfurt}
%\usecolortheme{crane}
\usepackage{changepage}
\begin{document}
\begin{frame}[t]{Test}
\onslide<2->{
\begin{adjustwidth}{-1em}{-1em}
\begin{center}
\begin{tabular}{| c || c c c c |}
\hline
& P4 & \onslide<1->{P3} &\onslide<1->{P2} & \onslide<1->{P1} \\ \hline
\only<6>{\cellcolor{yellow}} Cognition 1 & \only<6>
{\cellcolor{yellow}} $(a,c_{*})$ & \only<6>{\cellcolor{yellow}}
\onslide<1->{Constant} & \only<6>{\cellcolor{yellow}} \onslide<1-
{Constant} & \only<6>{\cellcolor{yellow}} \onslide<1->{Constant} \\
\only<5>{\cellcolor{yellow}} \only<1-7>{Cognition 2}\only<8>
{\alert{Cognition 3}}\only<9->{\alert{Cognition 4}} & \only<5>
{\cellcolor{yellow}} $(a,c_{*})$ & \only<5>{\cellcolor{yellow}}
\onslide<1->{$(a,b_{*})$} & \only<5>{\cellcolor{yellow}} \only<1-7,9>
{Constant}%
\only<8>{\alert{Non-Constant}} & \only<5>{\cellcolor{yellow}}
\only<1-8>{Constant}%
\only<9->{\alert{Non-Constant}} \\
\hline
\end{tabular}
\end{center}
\end{adjustwidth}
}
\end{frame}
\end{document}