LaTeX定理和证明

LaTeX定理和证明 Theorems & Proofs

原  文:Theorems and proofs
译  者:Xovee
翻译时间:2023年7月8日

介绍

数学文档中通常有着许多需要特殊格式的内容,例如定理、定义、命题、议论、推论、引理等等。本文介绍如何在LaTeX中定义这些环境。

带有编号的LaTeX环境可以由命令\newtheorem创建,它有两个参数:

\newtheorem{theorem}{Theorem}
  • 第一个参数是环境的命名
  • 第二个参数是环境在文档中所显示出来的文字。这些文字的格式是黑体,出现在环境的开头。
\documentclass{article}
\usepackage[english]{babel}
\newtheorem{theorem}{Theorem}
\begin{document}

\section{Introduction}
Theorems can easily be defined:

\begin{theorem}
Let \(f\) be a function whose derivative exists in every point, then \(f\) 
is a continuous function.
\end{theorem}
\end{document}

这个例子的输出是:
在这里插入图片描述

带有编号的定理、定义、推论和引理(Theorems, Definitions, Corollaries, and Lemmas)

带有编号的环境由两个额外的参数控制,例如在\newtheorem中:

\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}
\section{Introduction}
Theorems can easily be defined:

\begin{theorem}
Let \(f\) be a function whose derivative exists in every point, then \(f\) is 
a continuous function.
\end{theorem}

\begin{theorem}[Pythagorean theorem]
\label{pythagorean}
This is a theorem about right triangles and can be summarised in the next 
equation 
\[ x^2 + y^2 = z^2 \]
\end{theorem}

And a consequence of theorem \ref{pythagorean} is the statement in the next 
corollary.

\begin{corollary}
There's no right rectangle whose sides measure 3cm, 4cm, and 6cm.
\end{corollary}

You can reference theorems such as \ref{pythagorean} when a label is assigned.

\begin{lemma}
Given two line segments whose lengths are \(a\) and \(b\) respectively there is a 
real number \(r\) such that \(b=ra\).
\end{lemma}

这个例子的输出是:
在这里插入图片描述
在这个例子中,我们定义了三个新的环境。

  • \newtheorem{theorem}{Theorem}[section]
    我们在最后加入了一个额外的参数[section],这个参数的作用是在每一个新的章节中重新对该环境进行计数。例如1.1, 1.2, 1.3, 1.4, 2.1, 2.2, …

  • \newtheorem{corollary}{Corollary}[theorem]
    类似的,每一次一个新的theorem定义的时候,该环境会重新计数。

  • \newtheorem{lemma}[theorem]{Lemma}
    在这个例子中,我们定义的lemma环境将会使用与theorem环境一样的计数。

    扫描二维码关注公众号,回复: 16432700 查看本文章

有些著名的定理有着自己的名字,你可以显式地输出它们的名字:\begin{theorem}[Pythagorean theorem]

与LaTeX中许多其他的带编号环境类似,你可以使用\label命令来引用它们。

无编号的类定理环境

你也可以创建不带有编号的类似于定理的环境,用于评论或者示例等用途。amsthm包提供了这种功能。

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsthm}

\newtheorem*{remark}{Remark}

\begin{document}
Unnumbered theorem-like environments are also possible.

\begin{remark}
This statement is true, I guess.
\end{remark}
\end{document}

这个例子的输出是:
在这里插入图片描述
命令\newtheorem*的语法与没有星号的版本的语法相同(除了计数器参数)。在上面的例子中,我们创建了名为remark的无编号环境。

定理样式

有些时候我们需要使用样式来区分不同的环境,例如在一个文档中,使用不一样的样式来区分“定理”和“定义”。我们可以使用amsthm包来做到这一点:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{remark}
\newtheorem*{remark}{Remark}

\begin{document}
\section{Introduction}
Unnumbered theorem-like environments are also possible.

\begin{remark}
This statement is true, I guess.
\end{remark}

And the next is a somewhat informal definition

\begin{definition}[Fibration]
A fibration is a mapping between two topological spaces that has the homotopy lifting property for every space \(X\).
\end{definition}
\end{document}

这个例子的输出是:
在这里插入图片描述
命令\theoremstyle{ }设置了该编号环境的样式。在这个例子中,我们使用了两种样式:styledefinitionStyle样式使用斜体和Roman字体,而definition样式使用粗体和Roman字体。

更多类型的样式请见文末。

证明

在数学文档中,证明是非常重要的一个部分。它的样式通常也需要与正文区分开来。amsthm包提供了proof环境:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}
\section{Introduction}
\begin{lemma}
Given two line segments whose lengths are \(a\) and \(b\) respectively there 
is a real number \(r\) such that \(b=ra\).
\end{lemma}

\begin{proof}
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.
\end{proof}
\end{document}

这个例子的输出是:
在这里插入图片描述
我们可以看到,Proof的字体是斜体,它与之后的文字之间有一小段空白空间,并且在证明的最后有一个特殊符号(这个例子中是方框,我们可以使用其他的特殊符号)。

更改QED符号

证明最后的那个特殊符号被称为QED符号:

QED is an initialism of the Latin phrase quod erat demonstrandum, meaning “thus it has been demonstrated” – Wikipedia

你可以方便地更改QED符号:

\renewcommand\qedsymbol{$\blacksquare$}

你也可以直接使用QED三个字母作为QED符号:

\renewcommand\qedsymbol{QED}

请看下面的例子:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amssymb}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}
\section{Introduction}

\begin{lemma}
Given two line segments whose lengths are \(a\) and \(b\) respectively there 
is a real number \(r\) such that \(b=ra\).
\end{lemma}

\renewcommand\qedsymbol{$\blacksquare$}

\begin{proof}
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.
\end{proof}

\renewcommand\qedsymbol{QED}

\begin{proof}
To prove it by contradiction try and assume that the statement is false,
proceed from there and at some point you will arrive to a contradiction.
\end{proof}
\end{document}

在这里插入图片描述

可选的定理样式

  • definition:黑体标题,Roman正文。一般用于定义(definition)、条件(condition)、问题(problem)和例子(example)中。
  • plain:黑体标题,斜体正文。一般用于定理(theorem)、引理(lemma)、推论(corollary)、命题(proposition)和猜想(conjecture)中。
  • remark:斜体标题,Roman正文。一般用于评论(remark)、备注(notes)、注释(annotation)、申明(claim)、案例(case)、致谢(acknowledgment)和结论(conclusion)中。

扩展阅读

猜你喜欢

转载自blog.csdn.net/xovee/article/details/131611081
今日推荐