假设我有两个表。我想用另一个表替换顶部表,保持第二个表不变。如何在一个框架中执行此操作?代码应该是这样的:
\begin{table}[visibility on=<{2}>]
\centering
\begin{tabular}{|c|c|}
\hline
A & B \\
\hline
C & D \\
\hline
\end{tabular}
\end{table}
但添加[visibility on=<{2}>]
似乎没有任何作用。我希望我已经把我的问题说清楚了。
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{subfiles}
\usepackage{circuitikz}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes.gates.logic.US,shapes.gates.logic.IEC,calc}
\usetikzlibrary{overlay-beamer-styles} %<-added
\usepackage{multirow}
\usetikzlibrary{positioning}
\usepackage{colortbl}
\usetheme{Madrid}
\setbeamertemplate{itemize items}[square]
\begin{document}
\setbeamercovered{dynamic}
\begin{frame}{Frame Title}
\begin{table}[]
\centering
\begin{tabular}{|c|c|}
\hline
A & B \\
\hline
C & D \\
\hline
\end{tabular}
\end{table}
\begin{table}[]
\begin{tabular}{|c|c|}
\hline
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}
答案1
visible on
(非)技巧visibility on
适用于tikzpicture
s 的元素(当加载 时\usetikzlibrary{overlay-beamer-styles}
,就像您所做的那样)。在tikzpicture
s 之外,您只需要\only
。
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{subfiles}
\usepackage{circuitikz}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes.gates.logic.US,shapes.gates.logic.IEC,calc}
\usetikzlibrary{overlay-beamer-styles} %<-added
\usepackage{multirow}
\usetikzlibrary{positioning}
\usepackage{colortbl}
\usetheme{Madrid}
\setbeamertemplate{itemize items}[square]
\begin{document}
\setbeamercovered{dynamic}
\begin{frame}{Frame Title}
\only<2>{\begin{table}[]
\centering
\begin{tabular}{|c|c|}
\hline
A & B \\
\hline
C & D \\
\hline
\end{tabular}
\end{table}}
\begin{table}[]
\begin{tabular}{|c|c|}
\hline
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}