我正在尝试创建一个声明环境以ntheorem
在证明环境中使用。我尝试使用以下代码
\documentclass{article}
\usepackage{ntheorem}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\theoremheaderfont{\normalfont\itshape}
\newtheorem{claim}{Claim}
\theoremsymbol{\ensuremath{\blacksquare}} % \theoremsymbol{\ensuremath{_\square}}
\newtheorem{claimproof}{Proof of Claim}[claim]
\theoremstyle{nonumberplain}
\newtheorem{proof}{Proof}
\begin{document}
\begin{theorem}
asdjas aasdj adj
\end{theorem}
\begin{proof}
\begin{claim}
some claim
\end{claim}
\begin{claimproof}
asdasd asdasd
\end{claimproof}
\begin{claim} some other claim \end{claim}
\begin{claimproof}proof of claim\end{claimproof}
\end{proof}
\begin{lemma}
some lemma
\end{lemma}
\begin{proof}
asdlasd
\begin{claim} claim for lemma\end{claim}
\begin{claimproof}
askl adlksd
\end{claimproof}
\begin{claim} asdljkd
\end{claim}
\begin{claimproof}
asd aspdok
\end{claimproof}
\end{proof}
\end{document}
这种方法确实可行。但结果如下:
Theorem 1
...
Proof
...
Claim 1
Proof of Claim 1.1
..
Claim 2
Proof of Claim 2.1
但我想得到类似的东西
Theorem 1
...
Proof
...
Claim 1
Proof of Claim 1
..
Claim 2
Proof of Claim 2
更好的方法是将证明中引用的定理或引理的子编号作为编号,但我想这会让一切变得更加复杂
Theorem 1
...
Proof
...
Claim 1.1
Proof of Claim 1.1
..
Claim 1.2
Proof of Claim 2.1
Lemma 3
Proof
Claim 3.1
Proof of Claim 3.1
...
答案1
理解的可选参数非常重要\newtheorem
。
\newtheorem{claim}{Claim}
在整个文档中生成编号为 1、2、3、... 的“声明”。最后一个可选参数
\newtheorem{claimproof}{Proof of claim}[claim]
产生数字 X.1、X.2、X.3、...,其中 X 是前一个索赔的编号。
为了正确编号你的索赔,你需要类似
\newtheorem{claim}{Claim}[theorem]
因此根据先前的定理,索赔获得子数。
对于您对声明的证明,我认为您的要求是错误的,但我将在下面的第二个示例中说明如何执行您的要求。一般来说,人们希望能够自由地以与声明呈现顺序不同的顺序进行声明的证明;此外,声明陈述之后立即进行的声明证明实际上不需要用数字标记;如果证明距离较远或顺序不同,则使用 LaTeX 的\label
/\ref
机制提供正确的编号会更合适。
以下是一个例子:
\documentclass{article}
\usepackage[thmmarks]{ntheorem}
\usepackage{amssymb}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}{Claim}[theorem]
\theoremstyle{nonumberplain}
\theoremsymbol{\ensuremath{\Box}}
\newtheorem{proof}{Proof}
\makeatletter
\newtheoremstyle{nonumberplainnobrackets}%
{\item[\theorem@headerfont\hskip\labelsep ##1\theorem@separator]}%
{\item[\theorem@headerfont\hskip \labelsep ##1\ ##3\theorem@separator]}
\makeatother
\theoremstyle{nonumberplainnobrackets}
\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{claimproof}{Proof of claim}
\begin{document}
\begin{lemma}
A theorem.
\end{lemma}
\begin{proof}
Proof starts.
\begin{claim}
A claim.
\end{claim}
\begin{claimproof}
Proof of claim.
\end{claimproof}
Proof ends.
\end{proof}
\begin{theorem}
A theorem.
\end{theorem}
\begin{proof}
Proof starts.
\begin{claim}
A claim.
\end{claim}
\begin{claimproof}
Proof of claim.
\end{claimproof}
Proof continues.
\begin{claim}
\label{claim:one}
One claim.
\end{claim}
\begin{claim}
\label{claim:another}
Another claim.
\end{claim}
\begin{claimproof}[\ref{claim:another}]
Proving another claim.
\end{claimproof}
Text.
\begin{claimproof}[\ref{claim:one}]
Proving claim one.
\end{claimproof}
Finally the end.
\end{proof}
\end{document}
注意,我引入了一种新的定理样式来应对证明数量声明所需的排版。
如果你真的确定claimproof
s 不会以与声明不同的顺序出现,那么你可以使用以下方式进行设置
\theoremstyle{nonumberplain}
\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{claimproof}{Proof of claim \theclaim}
完整的例子是
\documentclass{article}
\usepackage[thmmarks]{ntheorem}
\usepackage{amssymb}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}{Claim}[theorem]
\theoremstyle{nonumberplain}
\theoremsymbol{\ensuremath{\Box}}
\newtheorem{proof}{Proof}
\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{claimproof}{Proof of claim \theclaim}
\begin{document}
\begin{lemma}
A theorem.
\end{lemma}
\begin{proof}
Proof starts.
\begin{claim}
A claim.
\end{claim}
\begin{claimproof}
Proof of claim.
\end{claimproof}
Proof ends.
\end{proof}
\begin{theorem}
A theorem.
\end{theorem}
\begin{proof}
Proof starts.
\begin{claim}
A claim.
\end{claim}
\begin{claimproof}
Proof of claim.
\end{claimproof}
Proof continues.
\begin{claim}
\label{claim:one}
One claim.
\end{claim}
Text.
\begin{claimproof}
Proving claim one.
\end{claimproof}
Finally the end.
\end{proof}
\end{document}