# Case numbering within proof [duplicate]

I am currently using this in the preamble:

\theoremstyle{plain}% default
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]
\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}


On the whole, this works exactly as I want it to. However for cases within a proof, I want the numbering to start at 1 again within each theorem: eg it should read:

Thm 1: blah blah
Proof:
Case 1:
Case 2:

Thm 2: blah blah blah
Proof:
Case 1:
Case 2:


Rather than in the second theorem the cases starting from 3 which is what currently happens.

Google suggested using something to do with numbered_within but I haven't managed to get the formatting right for this to work yet.. any ideas?

## marked as duplicate by Werner, Heiko Oberdiek, Adam Liter, Paul Gaborit, JesseApr 30 '14 at 0:28

• Maybe this: \newtheorem[thm]{Case}. Or you can use \begin{proof}[Case I]\end{proof}. – Sigur Apr 29 '14 at 21:20
• What theorem package are you using? It may be as simple as \makeatletter\@addtoreset{case}{thm}\makeatother... – Werner Apr 29 '14 at 21:26
• @Werner: what if it happens within the proof ot a proposition, lemma, &c.? – Bernard Apr 29 '14 at 21:36
• \newtheorem[thm]{Case} doesn't compile, the closest I have so far is \newtheorem{case}{Case}[thm] but although it resets the case counter as desired, that puts in the entire theorem number (which is 3 part not one as in the 'example') ie Case 3.2.1.1 which seems a little excessive. Package wise I am using amsmath and amsthm. Will experiment. – Zoe Kelly Apr 29 '14 at 21:41
• @Bernard: Then one can add more entries to the counter reset list: \@addtoreset{case}{lem}\@addtoreset{case}{prop}... – Werner Apr 29 '14 at 21:45

I have a simple solution with the ntheorem package and its \theorempostwork command: the case counter is reset at the end of the proof environment. However, the proof symbol will have to be set by hand if the proof ends in a case environment:

        \documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}

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

\theoremstyle{plain}
\newtheorem{thm}{Theorem}

\theorembodyfont{\upshape}
\newtheorem{case}{Case}

\theoremstyle{nonumberplain}
\theorembodyfont{\upshape}
\theoremsymbol{\scshape Q. E. D.}%\ensuremath{ _{\box}}
\theorempostwork{\setcounter{case}{0}}
\newtheorem{proof}{Proof}

\begin{document}

\begin{thm}
Once upon a time…
\end{thm}

\begin{proof}
Fiddle dee dee!
\begin{case}
First case of this proof
\end{case}
And now:
\begin{case}
Second case of this proof .\hfill\proofSymbol
\end{case}
\end{proof}

\begin{thm}
Once upon another time…
\end{thm}

\begin{proof}
Fiddle dee dee!
\begin{case}
First case of this proof
\end{case}
And now:
\begin{case}
Second case of this proof
\end{case}
This ends the proof of the theorem.
\end{proof}

\end{document}


• A very useful answer. It shows clearly how to use these theorem packages. – loved.by.Jesus Feb 18 '16 at 15:00