投影机的序言问题

投影机的序言问题

我的序言是这样的:

\documentclass[]{beamer}

%opening
\title{}
\author{Sean Thrasher}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{url}
\usepackage{biblatex}
\usepackage{setspace} 
\usepackage{comment}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{subcaption}
\usepackage{braket}
\usepackage[dvipsnames]{xcolor}
\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\addbibresource{bibliography.bib}
\newtheorem{theorem}{Theorem}[section] 
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{proposition}{Proposition}[section]
\newtheorem{cor}[theorem] {Corollary} 
\newtheorem{remark}[theorem] {Remark} 
\newtheorem{ass}[theorem] {Assumptions} 
\theoremstyle{definition}
\newtheorem{definition}[theorem] {Definition} 
\newtheorem{conj}[theorem]{Conjecture} 
\newtheorem{step}{STEP}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{example}[theorem] {Example}
\newtheorem{idea}[theorem]{Idea}
\newtheorem{claim}[theorem]{Claim}
\newcommand{\nn}{\in \mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\bv}{\bibitem}
\DeclareMathOperator{\Cor}{Cor}

\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\Var}{Var}

\newtheorem{lem}{Lemma}
\newtheorem{thm}{Theorem}

并且它无法在 beamer 中正确渲染。

它说:包 geometry 的选项冲突,包 xcolor 的选项冲突(对于 inputenc 包),然后它说 \theorem、\lemma、\definition、\example 都已定义,并且缺少 \begin{document}。

确实呈现了某些内容,但幻灯片第一页上有“Theroem[section]”等。

在处理普通文档时我没有遇到这些问题,那么为什么 beamer 会出现问题呢?

答案1

有几个问题:

  • beamer 会自动为您定义最常用的定理。如果您不想使用它们而想定义自己的定理,则可以使用 classnotheorems选项。这样 beamer 就知道不要定义它们。

  • 如果您的 latex 发行版已过时,\usepackage[dvipsnames]{xcolor}在序言中使用类似的东西将导致选项冲突错误,因为 beamer 已经加载了诸如、、xcolor等许多软件包。您可以通过更新 latex 发行版或使用 beamer 类选项(而不是自己加载这些软件包)来避免这种情况。hyperrefgraphicxams*xcolor={dvipsnames}

总结:不要将其他类中的前言复制到 Beamer。只需添加您真正需要的包即可避免此类问题。


\documentclass[notheorems,xcolor={dvipsnames}]{beamer}

%opening
\title{}
\author{Sean Thrasher}
%\usepackage{amsthm}
%\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage{amsfonts}
%\usepackage{graphicx}
%\usepackage{epstopdf}
%\usepackage{url}
\usepackage{biblatex}
\usepackage{setspace} 
\usepackage{comment}
%\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{subcaption}
\usepackage{braket}
%\usepackage[dvipsnames]{xcolor}
\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\addbibresource{bibliography.bib}
\newtheorem{theorem}{Theorem}[section] 
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{proposition}{Proposition}[section]
\newtheorem{cor}[theorem] {Corollary} 
\newtheorem{remark}[theorem] {Remark} 
\newtheorem{ass}[theorem] {Assumptions} 
\theoremstyle{definition}
\newtheorem{definition}[theorem] {Definition} 
\newtheorem{conj}[theorem]{Conjecture} 
\newtheorem{step}{STEP}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{example}[theorem] {Example}
\newtheorem{idea}[theorem]{Idea}
\newtheorem{claim}[theorem]{Claim}
\newcommand{\nn}{\in \mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\bv}{\bibitem}
\DeclareMathOperator{\Cor}{Cor}

\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\Var}{Var}

\newtheorem{lem}{Lemma}
\newtheorem{thm}{Theorem}

\begin{document}
\begin{frame}
test
\end{frame}
\end{document}

相关内容