我有一个奇怪的问题,每当我在 Mac OS 上将 caption 包与 beamer 类一起使用时(Windows 工作正常),表格标签都会更改为图形(最近才开始发生).. 我想知道可能是什么问题。
请参阅我的乳胶演示的序言:
\documentclass[english,usenames,dvipsnames]{beamer}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{amssymb}
\makeatletter
\providecommand{\tabularnewline}{\\}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
% (ERT) argument for the TOC
\AtBeginDocument{%
\let\origtableofcontents=\tableofcontents
\def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
\def\gobbletableofcontents#1{\origtableofcontents}
}
\numberwithin{equation}{section}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%\usetheme{Warsaw}
% or ...
%\usetheme{Madrid}
\usetheme{CambridgeUS}
\usecolortheme{beaver}
%\renewcommand{\tabcolsep}{0.2 cm}
\usepackage{textpos}
\usepackage{enumerate}
%\usepackage[shortlabels]{enumitem}
%\usepackage{anyfontsize}
\usepackage{multicol}
\usepackage{setspace}
\usepackage{latexsym}
%\setbeamertemplate{caption label separator}{: }
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{algorithm, algorithmic}
\renewcommand\thesubsection{\Alph{subsection}}
%\usepackage{algpseudocode}
\usepackage{graphicx}
%\usepackage{longtable}
\usepackage{bm}
\usepackage{wrapfig}
\usepackage{ragged2e}
\usepackage{lipsum}
\usepackage{fancybox}
\usepackage{listings}
\usepackage{cite}
\usepackage{color}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{tikz-network}
\usepackage{caption}
\usepackage{diagbox}
\setbeamercovered{transparent}
% or whatever (possibly just delete it)
\usepackage{multirow}
%\usepackage{algorithm2e}
%\usepackage{algorithmicx}
%\usepackage{float}
\setbeamertemplate{caption}[numbered]
\algsetup{linenosize=\small}
\renewcommand{\makebeamertitle}
{
\begingroup
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{}
\frame{\titlepage}
\endgroup
}
\makeatother
\begin{document}
\title[]{Example}
\author[latex forum]{example\and \\ \bigskip{}
}
\institute[]{%\includegraphics[scale=0.07]{institution-logo-filename} \\\\
}
\date[October 2019]{}
\makebeamertitle
%\beamerdefaultoverlayspecification{<+->}
\addtocounter{framenumber}{-1}
\section{Introduction}
\begin{frame}{CIs Disruptions Examples}
\begin{table}
\begin{tabular*}{12cm}{@{\extracolsep{\fill}}ll}
\toprule
Date & \multicolumn{1}{c}{Disruption}\tabularnewline
\midrule
\midrule
{\scriptsize{}November 1965} & {\scriptsize{}Blackout in ten states in the northeastern US affected
30 million people.}\tabularnewline
\midrule
\midrule
{\scriptsize{}July 1977} & {\scriptsize{}In New York’s suburbs,10 million people to lose power
for over 24 h.}\tabularnewline
\midrule
\midrule
{\scriptsize{}December 1978} & {\scriptsize{}Blackout in part of France due to voltage collapse.}\tabularnewline
\midrule
\midrule
{\scriptsize{}January 1981} & {\scriptsize{}1.5 million customers in Idaho, Utah, and Wyoming were
affected for 7 h.}\tabularnewline
\midrule
\midrule
{\scriptsize{}March 1982} & {\scriptsize{}Over 900 000 lost power for 1.5 h due to high-voltage
line failure in Oregon.}\tabularnewline
\midrule
\midrule
{\scriptsize{}December 1994} & {\scriptsize{}2 million customers from Arizona to Washington State
lost power.}\tabularnewline
\midrule
\midrule
{\scriptsize{}July 1996} & {\scriptsize{}Blackouts for 2 million customers in 14 states for approximately
6h.}\tabularnewline
\midrule
{\scriptsize{}August 2003} & {\scriptsize{}Northeastern United States and Canada cascading outages}\tabularnewline
\bottomrule
\end{tabular*}
\caption{\label{tab:Disruptions-Examples}Power Disruptions Examples}
\end{table}
\end{frame}
%
\end{document}
答案1
这看起来像是一个明显的错误。代码将表格的代码设置为:
\@ifclassloaded{beamer}{%
\caption@InfoNoLine{beamer document class}%
\let\caption@ORI@figure\figure
\def\figure{\caption@settype{figure}\caption@ORI@figure}
\let\caption@ORI@table\figure %<------------------------HERE
\def\table{\caption@settype{table}\caption@ORI@table}
}{}
向维护者报告。
答案2
Beamer 版本的表格必须由 caption 包替换。在 caption 加载后,只需使用以下命令恢复它:
\makeatletter
\renewenvironment{table}[1][]{%
\def\@captype{table}%
\par\nobreak\begin{center}\nobreak}
{\par\nobreak\end{center}\nobreak}
\makeatother
或者,可以使用以下方法保存和恢复表:
\let\beamertable=\table
\let\beamerendtable=\endtable
\usepackage{caption}
\let\table=\beamertable
\let\endtable=\beamerendtable