跳到正文

Scissor LaTeX 中的 amsthm

amsthm 宏包在 Scissor LaTeX 中部分可用:\newtheorem、带星号的 \newtheorem*、[Mustermann] 这样的可选附注以及 proof 环境都可用,而 \theoremstyle、共享计数器或按节编号的计数器、证明标题和 \qedhere 不会生效。

宏包的作用

amsthm 让你用 \newtheorem 声明类似定理的环境,并提供一个以小方块结尾的 proof 环境。定理样式(plain、definition、remark)会改变标题和正文的外观。

这里可用的功能

命令在 Scissor LaTeX 中说明
\newtheorem{name}{Title}可用每个名称有自己的计数器:1、2、3。
\newtheorem{name}[other]{Title}部分可用共享计数器被忽略;该环境独立计数。
\newtheorem{name}{Title}[section]部分可用编号不会按节重置,也不会显示为 2.1。
\newtheorem*{name}{Title}可用无编号。
\begin{theorem}[note]可用附注显示在编号后的括号中。
\theoremstyle{...}忽略每个环境都是粗体标题、斜体正文。
proof部分可用标题始终是“Proof.”;[Proof of Lemma 2] 这样的可选标题会被忽略。以方块结尾。
\qedhere不支持包含它的公式显示为红色。
\qed, \qedsymbol不支持会被跳过,并在“问题”标签页中注明;证明末尾的方块只来自 proof 环境。

示例

在导言区声明环境,然后在正文中使用:

\newtheorem、附注和证明

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\begin{document}
\begin{lemma}
Every even number greater than 2 is the sum of two odd numbers.
\end{lemma}
\begin{theorem}[Mustermann]
The number 44 is the sum of two primes.
\end{theorem}
\begin{proof}
Take $44 = 3 + 41$, and both 3 and 41 are prime.
\end{proof}
\end{document}
由 Scissor LaTeX 排版: \newtheorem、附注和证明

用 \newtheorem* 声明无编号环境。\theoremstyle{definition} 这一行会被接受,但正文仍是斜体:

\newtheorem* 和 \theoremstyle

\documentclass{article}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem*{remark}{Remark}
\begin{document}
\begin{definition}
A number is \emph{even} if it is divisible by 2.
\end{definition}
\begin{remark}
By this definition, 0 and 44 are even.
\end{remark}
\end{document}
由 Scissor LaTeX 排版: \newtheorem* 和 \theoremstyle

\qedhere 会把方块移到证明末尾的行间公式中。这里不认识它,所以公式会变红:

\qedhere 让公式显示为红色

LaTeX导言区: \usepackage{amsthm}在编辑器中打开 (在新标签页中打开)
\begin{proof}
It remains to compute
\[ 44 = 4 \cdot 11. \qedhere \]
\end{proof}

以红色显示: 无法读取公式,因此改为显示其源代码。

去掉 \qedhere。方块会单独占一行,放在公式之后,这样同样正确:

去掉 \qedhere 的同一个证明

LaTeX导言区: \usepackage{amsthm}在编辑器中打开 (在新标签页中打开)
\begin{proof}
It remains to compute
\[ 44 = 4 \cdot 11. \]
\end{proof}

兼容性

  • 从 TeX 发行版迁移到这里: 文档可以排版。当多个环境共享计数器时,编号可能不同,并且所有定理样式看起来都像 plain。如果公式变红,请删除其中的 \qedhere。
  • 从这里迁移到 TeX 发行版: 只要每个环境都用 \newtheorem 声明过,文档无需修改即可在那里编译。

完整手册见 CTAN:ctan.org/pkg/amsthm。入门指南请参阅定理和证明。

另请参阅定理和证明和 cleveref。

常见问题

为什么我的引理和定理不共用一个计数器?

Scissor LaTeX 为每个环境分配独立的计数器,并忽略 [theorem] 参数。你的文档仍然可以编译,只是编号与 TeX 发行版中不同。

能修改证明的标题吗?

暂时还不能。proof 的可选参数会被忽略,标题始终是“Proof.”。你可以改为把标题写成证明的开头几个字。

本页的每个示例都在构建网站时由 Scissor LaTeX 排版。 最后更新:2026-11-07