Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using proof environment from amsthm to type proofs. Some proofs are long, so it would be nice to split them into numbered parts. I have defined new theorem environment called proofpart for that purpose.

The problem is that the proofpart counter does not reset inside a new proof and continues to grow. So I wonder how the counter can be reset for such case.

Sample document:

\documentclass{article}
\usepackage{amsthm}


\theoremstyle{definition}
\newtheorem{proofpart}{Part}
\newtheorem{theorem}{Theorem}

\begin{document}
  \begin{theorem}
    Some theorem
  \end{theorem}

  \begin{proof}
    Proof of some theorem
    \begin{proofpart} % 1
      First part 
    \end{proofpart}
    \begin{proofpart} % 2
      Second part
    \end{proofpart}
  \end{proof}


  \begin{theorem}
    Another theorem
  \end{theorem}

  \begin{proof}
    Proof of another theorem
    \begin{proofpart} % 3, but should be 1
      First part
    \end{proofpart}
    \begin{proofpart} % 4, but should be 2
      Second part
    \end{proofpart}
  \end{proof}

\end{document}
share|improve this question
1  
Hi. There is no need to say "thanks" in your posts. Upvoting is the preferred way here to say thank you to those who helped you. This takes time getting used to but one way in which this site maintains less noise. Welcome to TeX.sx! –  hpesoj626 Mar 11 '13 at 1:46
add comment

1 Answer

up vote 7 down vote accepted

One option would be to use \@addtoreset:

\documentclass{article}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{proofpart}{Part}
\newtheorem{theorem}{Theorem}
\makeatletter
\@addtoreset{proofpart}{theorem}
\makeatother

\begin{document}
  \begin{theorem}
    Some theorem
  \end{theorem}

  \begin{proof}
    Proof of some theorem
    \begin{proofpart} % 1
      First part 
    \end{proofpart}
    \begin{proofpart} % 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}


  \begin{theorem}
    Another theorem
  \end{theorem}

  \begin{proof}
    Proof of another theorem
    \begin{proofpart} % it is 1
      First part
    \end{proofpart}
    \begin{proofpart} % it is 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}

\end{document}

enter image description here

A little description taken from source2e:

\@addtoreset{foo}{bar} : Adds counterfooto the list of counters \cl@barto be reset when counterbar` is stepped.

Another option (suggested by Werner) would be to use the second optional argument for \newtheorem in the definition of proofpart (this requires defining this structure after the theorem environment) and a redefinition of the representation of the associated counter:

\documentclass{article}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{proofpart}{Part}[theorem]
\renewcommand\theproofpart{\arabic{proofpart}}

\begin{document}
  \begin{theorem}
    Some theorem
  \end{theorem}

  \begin{proof}
    Proof of some theorem
    \begin{proofpart} % 1
      First part 
    \end{proofpart}
    \begin{proofpart} % 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}


  \begin{theorem}
    Another theorem
  \end{theorem}

  \begin{proof}
    Proof of another theorem
    \begin{proofpart} % it is 1
      First part
    \end{proofpart}
    \begin{proofpart} % it is 2
      Second part\qedhere
    \end{proofpart}
  \end{proof}

\end{document}

\newtheorem{env-name}{doc-name}[counter], where counter is an existing or previouly defined counter, causes the env-name counter to be reset whenever the parent counter counter is incremented; however, the label will have the counter number pre-pended, so a redefinition of the representation is needed to suppress the pre-pendend string.

I also used \qedhere to correct the end-mark position.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.