ntheorem:在方程中手动放置证明结束符号

ntheorem:在方程中手动放置证明结束符号

我想用它ntheorem来生成定理和证明。我有一个证明结束符号,它工作正常,但如果结果不重要,我想把符号放在定理本身中。我有一个可以正常工作的东西,除非定理以方程式结尾。

我不能 100% 确定我是否正确使用了该包。以下是我对 MWE 的尝试:

\documentclass{article}
\usepackage{amssymb}
\usepackage[thmmarks]{ntheorem}

\newtheorem{thm}{Theorem}
\theoremstyle{nonumberplain}
\theorembodyfont{\normalfont}
\theoremsymbol{\ensuremath\square}
\newtheorem{proof}{Proof:}

\begin{document}

\begin{thm}
Some theorems need a proof.
\end{thm}
\begin{proof}
And the end of proof symbol works even with an equation such as
\[
P = NP.
\]
\end{proof}

\begin{thm}
Some are trivial and don't need a proof. \hfill\proofSymbol
\end{thm}

\begin{thm}
But how do you place the symbol when the trivial result ends with an equation
\[
x^{2}-1 = (x-1)(x+1)? \hfill\proofSymbol
\]
\end{thm}

\end{document}

此代码的输出

我所做的有什么更正吗?最重要的是,如何在定理 3 中正确放置证明结束符号?

答案1

您可以定义一个trivthm环境,它共享的计数器thm,并\theoremsymbol在此环境之前声明:

\documentclass{article}
\usepackage{amssymb}
\usepackage[thmmarks]{ntheorem}

\newtheorem{thm}{Theorem}

\theoremsymbol{\ensuremath\square}
\newtheorem{trivthm}[thm]{Theorem}
\theoremstyle{nonumberplain}
\theorembodyfont{\normalfont}
\newtheorem{proof}{Proof:}

\begin{document}

\begin{thm}
Some theorems need a proof.
\end{thm}
\begin{proof}
And the end of proof symbol works even with an equation such as
\[
P = NP.
\]
\end{proof}

\begin{trivthm}
Some are trivial and don't need a proof.
\end{trivthm}

\begin{trivthm}
But how do you place the symbol when the trivial result ends with an equation
\[
x^{2}-1 = (x-1)(x+1)?
\]
\end{trivthm}

\end{document}

在此处输入图片描述

相关内容