2

In my thesis, if number theorem statement is 1.12, proof is coming as 1.13. How to make the number of proof as 1.12?

I use

\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}

I am getting like this:

Lemma 2.9 ........................................

......................................

Proof 2.10 We have two cases.

This is not working:

\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}}
user12290
  • 3,341

2 Answers2

3

This assigns every proof the number of the immediately preceding statement, but with an optional argument to override it.

\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}

enter image description here

egreg
  • 1,121,712
0

One could manually subtract 1 from the theorem counter after the end of Theorem 1.12 and before the start of the associated proof. This procedure may be automated with the help of the etoolbox package and its \AtBeginEnvironment directive.

(This assumes that the proof environment should always carry the same number as its associated theorem-like environment. If you need to override this on occasion, simply provide an \addtocounter{theorem}{1} statement before \begin{proof}.)

enter image description here

\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}
Mico
  • 506,678