amsmath 中使用不同的 QED 符号进行不同的证明?

amsmath 中使用不同的 QED 符号进行不同的证明?

我正在尝试扩展 amsmath 包以获得两种不同的证明环境:

  • \begin{proof} ... \end{proof}
  • \begin{proof*} ... \end{proof*}

所以proof*除了 QED 符号之外,应该完全像证明一样运作。 proof应该提供一个黑色方块,而proof*提供普通方块。

我发现

\let\proof*\proof

\renewcommand{\qedsymbol}{$\blacksquare$}

在一些问题中,但这会改变每个 QED 符号。有什么建议吗?

答案1

这是一个直接使用 AMS 包的解决方案。我们设置了一个新环境myproofproof但其中包含了 的重新定义\qedsymbol

示例输出

\documentclass{article}

\usepackage{amsthm,amsmath,amssymb}

\newcommand*{\myproofname}{My proof}
\newenvironment{myproof}[1][\myproofname]{\begin{proof}[#1]\renewcommand*{\qedsymbol}{\(\blacksquare\)}}{\end{proof}}

\begin{document}

\begin{proof}
  Usual proof.
\end{proof}

\begin{myproof}
  New proof style.
\end{myproof}

\begin{proof}[Short]
  Standard proof
  \begin{equation*}
    a = b. \qedhere
  \end{equation*}
\end{proof}

\begin{myproof}[Short new style]
  New proof style
  \begin{equation*}
    a = b. \qedhere
  \end{equation*}
\end{myproof}

\end{document}

答案2

我也倾向于使用ntheoremBernard 秀。我只是想补充一下我如何使用amsthm

\documentclass[a4paper]{memoir}
\usepackage{amsthm}

\newenvironment{proof*}[1][\proofname]{
  \renewcommand\qedsymbol{\rule{3mm}{3mm}}
  \begin{proof}[#1]}{\end{proof}}

\begin{document}

\begin{proof}
  sfadf
\end{proof}

\begin{proof}[Proof of ...]
  sfadf
\end{proof}


\begin{proof*}
  asdfsf
\end{proof*}

\begin{proof*}[Proof of ...]
  sfadf
\end{proof*}



\end{document}

答案3

使用该包可以很容易地完成此操作ntheorem。此外,当证明以显示的方程式结尾时,它可以正确管理证明结束符号的位置。我添加了该cleveref包来展示它如何管理引用类型(例如,如果引用的定理变成命题,其引用将相应地更改):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

 \usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\usepackage{cleveref}

\theoremstyle{plain}
\theoremheaderfont{\bfseries}
\theoremseparator{.}
\theorembodyfont{\itshape}
\newtheorem{theorem}{Theorem}

\theoremstyle{nonumberplain}
\theoremheaderfont{\scshape}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\square}}
\newtheorem{proof}{Proof}

\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{blackproof}{Proof}
\begin{document}

\begin{theorem}[Some theorem]\label{thm:some-theorem}
This is an important theorem.
\end{theorem}

\begin{proof}
This is a very important proof.
\end{proof}

\begin{proof}[of \cref{thm:some-theorem}]
This is a very important proof.
\end{proof}

\begin{blackproof}[of \cref{thm:some-theorem}]
This is a very important proof.
\begin{align*}
    a & = b\\ c & = d.
\end{align*}
\end{blackproof}

\end{document} 

在此处输入图片描述

答案4

这是一个解决方案thmtools

\documentclass{article}
\usepackage{amsthm,amssymb,thmtools}

\declaretheoremstyle[
  spaceabove=6pt plus 6pt,
  spacebelow=6pt plus 6pt,
  headfont=\itshape,
  bodyfont=\normalfont,
  postheadspace={ },
  qed=\protect\thisproofqed,
]{proof}

\declaretheorem[
  name=\protect\thisproofname,
  style=proof,
  numbered=no,
]{gproof}

\newcommand\thisproofname{}
\newcommand\thisproofqed{}

\renewenvironment{proof}[1][\proofname]
  {\renewcommand\thisproofname{#1}%
   \renewcommand\thisproofqed{$\blacksquare$}%
   \gproof}
  {\endgproof}

\newenvironment{proof*}[1][\proofname]
  {\renewcommand\thisproofname{#1}%
   \renewcommand\thisproofqed{\openbox}%
   \gproof}
  {\endgproof}


\begin{document}

A starred proof follows.

\begin{proof*}
Something.
\end{proof*}

An unstarred proof follows.

\begin{proof}
Something.
\end{proof}

A starred proof follows.

\begin{proof*}
Something.
\end{proof*}

Let's see if we can nest them.

\begin{proof*}
Something depending on a lemma.
\begin{proof}[Proof of the lemma]
Wow!
\end{proof}
The end.
\end{proof*}

\end{document}

优点是不是使用ntheorem,因此能够\qedhere按照提供的方式使用amsthm

在此处输入图片描述

相关内容