![在 beamer 中定义 thmtools 定理](https://linux22.com/image/458339/%E5%9C%A8%20beamer%20%E4%B8%AD%E5%AE%9A%E4%B9%89%20thmtools%20%E5%AE%9A%E7%90%86.png)
我想thmtools
在 beamer 文档中使用它来设计定理。
下面的 MWE 给出了以下错误:
命令 \theorem 已定义。或名称 \end... 非法,请参阅手册第 192 页。
如何解决?
% !TEX TS-program = xelatex
\documentclass[twoside]{beamer}
\usepackage{amsthm,thmtools}
\declaretheoremstyle[
headfont=\normalfont\arial\bfseries,
notefont=\normalfont\arial\bfseries,
headpunct={},
postheadspace=\newline,
bodyfont = \normalfont,
spaceabove=8pt,
spacebelow=8pt
]{definition}
\declaretheorem[name=Theorem,numberwithin=section,style=definition]{theorem}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\newfontfamily\Arial{Arial}[Script=Latin,Language=English]
\newfontfamily\TimesE{Times New Roman}[Script=Latin,Language=English]
\newfontfamily\courier{Courier New}[Script=Latin,Language=English]
\begin{document}
\section{Introduction}
\begin{frame}
We begin the lecture by stating a theorem:
\begin{theorem}[Euclid]
For every prime $p$, there is a prime $p’>p$.
In particular, the list of primes,
\begin{equation}\label{eq:1}
2,3,5,7,\dots
\end{equation}
is infinite.
\end{theorem}
\end{frame}
\end{document}
答案1
您可以使用该notheorems
选项来阻止 beamer 定义它们(如果您愿意,请删除该twoside
选项。这对于 beamer 来说绝对没有意义)。
% !TEX TS-program = xelatex
\documentclass[notheorems]{beamer}
\usepackage{amsthm,thmtools}
\declaretheoremstyle[
headfont=\normalfont\arial\bfseries,
notefont=\normalfont\arial\bfseries,
headpunct={},
postheadspace=\newline,
bodyfont = \normalfont,
spaceabove=8pt,
spacebelow=8pt
]{definition}
\declaretheorem[name=Theorem,numberwithin=section,style=definition]{theorem}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\newfontfamily\Arial{Arial}[Script=Latin,Language=English]
\newfontfamily\TimesE{Times New Roman}[Script=Latin,Language=English]
\newfontfamily\courier{Courier New}[Script=Latin,Language=English]
\begin{document}
\section{Introduction}
\begin{frame}
We begin the lecture by stating a theorem:
\begin{theorem}[Euclid]
For every prime $p$, there is a prime $p’>p$.
In particular, the list of primes,
\begin{equation}\label{eq:1}
2,3,5,7,\dots
\end{equation}
is infinite.
\end{theorem}
\end{frame}
\end{document}