在我的论文中,如果数定理陈述为1.12
,则证明为1.13
。如何使证明的数量为
1.12
?
我用
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[secn]{Corollary}
\newtheorem{proposition}[secn]{Proposition}
\newtheorem{lemma}[secn]{Lemma}
\newtheorem{problem}[secn]{Problem}
\newtheorem{pd}{Problem Statement}
\newtheorem{proof}[secn]{Proof}
\begin{proof}
\end{proof}
我变得像这样:
引理 2.9 ..............................................
.........................................
证明 2.10 我们有两种情况。
这不起作用:
\theoremstyle{plain}
\newtheorem{theorem}[secn]{Theorem}
\newtheorem{corollary}[secn]{Corollary}
\newtheorem{proposition}[secn]{Proposition}
\newtheorem{lemma}[secn]{Lemma}
\newtheorem{problem}[secn]{Problem}
\newtheorem{pd}{Problem Statement}
\newtheorem{proof}[secn]{Proof}
\usepackage{ntheorem}
\theoremstyle{plain}
%newtheorem{theorem}{Theorem}[section]
% ...
%\newtheorem{proof}[theorem]{Proof} % 'proof' and 'theorem' use same counter variable
\usepackage{etoolbox}
\AtBeginEnvironment{proof}{\addtocounter{theorem}{-1}}
答案1
这会为每个证明分配紧接在前的语句的编号,但使用可选参数来覆盖它。
\documentclass{article}
\usepackage{ntheorem}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{pd}{Problem Statement}
\theorembodyfont{\normalfont}
\newtheorem{proofinner}{Proof}
\newenvironment{proof}[1][]
{\if\relax\detokenize{#1}\relax
% no optional argument
\renewcommand\theproofinner{\thetheorem}%
\else
\renewcommand{\theproofinner}{#1}%
\fi
\proofinner}
{\endproofinner}
\begin{document}
\section{Title}
\begin{theorem}\label{thm:main}
Main theorem
\end{theorem}
\begin{lemma}
Whatever
\end{lemma}
\begin{proof}
Here it is.
\end{proof}
\begin{theorem}
Whatever
\end{theorem}
\begin{proof}
Here it is.
\end{proof}
\begin{proof}[\ref{thm:main}]
Proof of main.
\end{proof}
\end{document}
答案2
可以在定理 1.12 结束后、相关证明开始前手动1
从定理计数器中减去。此过程可以借助etoolbox
包及其\AtBeginEnvironment
指令自动完成。
(这假设proof
应该总是携带与其关联的定理类环境相同的数字。如果您偶尔需要覆盖这一点,只需\addtocounter{theorem}{1}
在 之前提供一个语句即可\begin{proof}
。)
\documentclass{article}
\usepackage{ntheorem}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
% ...
\newtheorem{proof}[theorem]{Proof} % 'proof' and 'theorem' use same counter variable
\usepackage{etoolbox}
\AtBeginEnvironment{proof}{\addtocounter{theorem}{-1}}
\begin{document}
\setcounter{section}{1} % just for this example
\setcounter{theorem}{11}
\begin{theorem} bla bla bla \end{theorem}
\begin{proof} ble ble ble \end{proof}
\end{document}