我正在制作演示文稿,想重复使用上一帧中带有相同标签的同一张表。我尝试了很多方法,但都没有成功。附件中您可以找到框架和代码。非常感谢。
\section{Conceptual Framework}
\begin{frame}
\frametitle{2. Conceptual Framework}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|}
& \multicolumn{1}{c}{} & \multicolumn{2}{c}{Player 2}\\
& \multicolumn{1}{c}{} & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} \\\cline{3-4}
\multirow{2}*{Player 1} & C & $b-c, b-c$ & $-c, b$ \\\cline{3-4}
& D & $b, -c$ & $0, 0$ \\\cline{3-4}
\end{tabular}
\caption{Prisoners' Dilemma}
\label{PD}
\end{table}
\begin{itemize}
\item{$b$ $>$ $c$ $>$ $0$}
\item{Given $c$ $>$ $0$, it is a dominant strategy to play D}
\item{Hence the NE of this game is (D,D) with payoff ($0$,$0$)}
\item{Since (C,C) gives $b$ - $c$ $>$ $0$, the equilibrium outcome (D,D) is inefficient}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{2. Conceptual Framework}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|}
& \multicolumn{1}{c}{} & \multicolumn{2}{c}{Player 2}\\
& \multicolumn{1}{c}{} & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} \\\cline{3-4}
\multirow{2}*{Player 1} & C & $b-c, b-c$ & $-c, b$ \\\cline{3-4}
& D & $b, -c$ & $0, 0$ \\\cline{3-4}
\end{tabular}
\renewcommand\thetable{\ref{PD}}
\caption{Prisoners' Dilemma}
\addtocounter{table}{-1}
\end{table}
\end{frame}
答案1
在下面的 MWE 中,我已将行移到\addtocounter{table}{-1}
第二帧中的标题之前。这将导致两个帧上的两个表格都使用相同的数字进行编号。
\documentclass{beamer}
\usepackage{array}
\usepackage{multirow}
\setbeamertemplate{caption}[numbered]
\begin{document}
\section{Conceptual Framework}
\begin{frame}
\frametitle{2. Conceptual Framework}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|}
& \multicolumn{1}{c}{} & \multicolumn{2}{c}{Player 2}\\
& \multicolumn{1}{c}{} & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} \\\cline{3-4}
\multirow{2}*{Player 1} & C & $b-c, b-c$ & $-c, b$ \\\cline{3-4}
& D & $b, -c$ & $0, 0$ \\\cline{3-4}
\end{tabular}
\caption{Prisoners' Dilemma}
\label{PD}
\end{table}
\begin{itemize}
\item $b$ $>$ $c$ $>$ $0$
\item Given $c$ $>$ $0$, it is a dominant strategy to play D
\item Hence the NE of this game is (D,D) with payoff ($0$,$0$)
\item Since (C,C) gives $b$ - $c$ $>$ $0$, the equilibrium outcome (D,D) is inefficient
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{2. Conceptual Framework}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|}
& \multicolumn{1}{c}{} & \multicolumn{2}{c}{Player 2}\\
& \multicolumn{1}{c}{} & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} \\\cline{3-4}
\multirow{2}*{Player 1} & C & $b-c, b-c$ & $-c, b$ \\\cline{3-4}
& D & $b, -c$ & $0, 0$ \\\cline{3-4}
\end{tabular}
\addtocounter{table}{-1} %<--------------------------
\caption{Prisoners' Dilemma}
\end{table}
\end{frame}
\end{document}
或者,您可能对使用覆盖在第二张幻灯片上重复表格感兴趣。这样,您只需指定一次表格代码(如果您想更改表格内容,这将更容易),并且如果您从第一张幻灯片切换到第二张幻灯片,表格将不会“跳跃”。
\documentclass{beamer}
\usepackage{array}
\usepackage{multirow}
\setbeamertemplate{caption}[numbered]
\begin{document}
\section{Conceptual Framework}
\begin{frame}
\frametitle{2. Conceptual Framework}
\onslide<1-2>{
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|}
& \multicolumn{1}{c}{} & \multicolumn{2}{c}{Player 2}\\
& \multicolumn{1}{c}{} & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} \\\cline{3-4}
\multirow{2}*{Player 1} & C & $b-c, b-c$ & $-c, b$ \\\cline{3-4}
& D & $b, -c$ & $0, 0$ \\\cline{3-4}
\end{tabular}
\caption{Prisoners' Dilemma}
\label{PD}
\end{table}}
\onslide<1-1>{
\begin{itemize}
\item $b$ $>$ $c$ $>$ $0$
\item Given $c$ $>$ $0$, it is a dominant strategy to play D
\item Hence the NE of this game is (D,D) with payoff ($0$,$0$)
\item Since (C,C) gives $b$ - $c$ $>$ $0$, the equilibrium outcome (D,D) is inefficient
\end{itemize} }
\end{frame}
\end{document}