[Tex/LaTex] How to nicely split proofs into different parts

environmentspage-breakingtheorems

I often break long proofs into smaller pieces, in order to make it easier to read and understand. I'm doing that by adding a fbox with "Part X: …". However, this doesn't work out very well all the time: the box and the according part of the proof can be split by a pagebreak, as illustrated in the code underneath.

\documentclass{article}

\usepackage{amsthm}
\usepackage{lipsum}

\parskip 12pt
\parindent 0pt
\newtheorem{theorem}{Theorem}

\begin{document}
    \lipsum[1-4]
    \begin{theorem}
        This is my theorem.
    \end{theorem}
    \begin{proof}
        Let's cut this long proof into little pieces.

        \fbox{Part 1: firstly}

        This is part 1.

        \fbox{Part 2: secondly}

        This is part 2.
    \end{proof}
\end{document}

Is there a way to prevent this in general? Is it possible to create a new environment that prevents splitting and that makes adding such a subproof easier (I'm sick of having to type \fbox{Part X: ...} all over again)? I'm looking for something that allows me to type for example

\begin{proof}
  Let's cut this long proof into little pieces.
  \begin{subproof}{Title of subproof 1}
    (subproof 1)
  \end{subproof}
  \begin{subproof}{Title of subproof 2}
    (subproof 2)
  \end{subproof}
\end{proof}

and that would result in

A proof with subproofs

Maybe Parts numbering in Proofs can help to number the subproofs automatically.

Best Answer

You could use the same mechanism as section titles:

\documentclass{article}

\usepackage{amsthm}
\usepackage{lipsum}

\newtheorem{theorem}{Theorem}

\makeatletter
\newcommand{\proofpart}[2]{%
  \par
  \addvspace{\medskipamount}%
  \noindent\emph{Part #1: #2}\par\nobreak
  \addvspace{\smallskipamount}%
  \@afterheading
}
\makeatother

\begin{document}
\lipsum[1-4]

\begin{theorem}
This is my theorem.
\end{theorem}

\begin{proof}
Let's cut this long proof into little pieces.

\proofpart{1}{firstly}

This is part 1.

\proofpart{2}{secondly}

This is part 2.

\proofpart{3}{thirdly}

This is part 3.
\end{proof}

\end{document}

Sorry, but I can't stand seeing nonzero parskip documents, that I find a waste of paper that adds nothing to clarity and readability.

A frame around “Part 1: firstly” is a punch in the eye, I suggest just italics like for “Proof”. In all honesty, I wouldn't add a line break after the proof part heading, but it's personal taste.

A variant that automatically numbers proof parts.

\documentclass{article}

\usepackage{amsthm,xpatch}
\usepackage{lipsum}

\newtheorem{theorem}{Theorem}

\makeatletter
\newcounter{proofpart}
\xpretocmd{\proof}{\setcounter{proofpart}{0}}{}{}
\newcommand{\proofpart}[1]{%
  \par
  \addvspace{\medskipamount}%
  \stepcounter{proofpart}%
  \noindent\emph{Part \theproofpart: #1}\par\nobreak\smallskip
  \@afterheading
}
\makeatother

\begin{document}

\lipsum[1-4]

\begin{theorem}
This is my theorem.
\end{theorem}

\begin{proof}
Let's cut this long proof into little pieces.

\proofpart{firstly}

This is part 1.

\proofpart{secondly}

This is part 2. \lipsum*[1]

\proofpart{thirdly}

This is part 3. \lipsum*[1]
\end{proof}

\end{document}