5

I want to show:

proof:
Case 1: .....
Case 2: .....

in a proof. The following is my rough codes:

\documentclass[12pt]{article} 
\usepackage{amsmath}
\begin{document}

\begin{proof}
\newenvironment{case}

\begin{case}
\item[title 1] XXXX
\end{case}

\begin{case}
\item[title 2] XXXX
\end{case}

\end{proof}
\end{document}

However, Latex shows \begin (proof) on input ended by \end (case)

How to show what I want to show?

The following is what I find; however, I cannot still finish it. Case numbering within proof

1
  • 2
    \newenvironment{}{}{} defines a new environment but you haven't given it a definition. See my answer here for information about writing your own macros (commands and environments).
    – cfr
    Commented Jun 18, 2015 at 23:39

3 Answers 3

7

Something like this?

\documentclass[12pt]{article}
\usepackage{mathtools,amsthm}
\newtheoremstyle{case}{}{}{}{}{}{:}{ }{}
\theoremstyle{case}
\newtheorem{case}{Case}
\begin{document}

\begin{proof}
  \begin{case}
    something
  \end{case}
  \begin{case}
    case
  \end{case}
\end{proof}

\end{document}

proof cases

2
  • This one does not refresh the counter after the proof environment ends. So for the next proof environment, it starts with Case 3. Commented Oct 28, 2018 at 16:37
  • \usepackage{chngcntr} and \counterwithin*{case}{lemma} etc., should fix that. Commented Apr 18, 2019 at 21:52
2

Why not just use e.g. description? Or enumitem, like:

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label=\textbf{Case \arabic*:}]
\item This is the first one
\item Another one
\end{enumerate}
Some random junk in between.
\begin{enumerate}[resume*]
\item This is the third one
\item Final one
\end{enumerate}
\end{document}
1

I may be a little late, but how about just defining a simple environment by yourself? Below is MWE, compiled successfully with pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) on Kubuntu 20.04.2 LTS:

\documentclass{article}
\usepackage{amsthm}

% Defines the `mycase` environment.
\newcounter{cases}
\newcounter{subcases}[cases]
\newenvironment{mycase}
{
    \setcounter{cases}{0}
    \setcounter{subcases}{0}
    \newcommand{\case}
    {
        \par\indent\stepcounter{cases}\textbf{Case \thecases.}
    }
    \newcommand{\subcase}
    {
        \par\indent\stepcounter{subcases}\textit{Subcase (\thesubcases):}
    }
}
{
    \par
}
\renewcommand*\thecases{\arabic{cases}}
\renewcommand*\thesubcases{\roman{subcases}}

\begin{document}
    \begin{proof}
        Let \(n\) be a natural number.
        \begin{mycase}
            \case \(n\) is even.
                \subcase \(0 \leq n \leq 32\);
                \subcase \(n \geq 34\).
            \case \(n\) is odd.
                \subcase \(1 \leq n \leq 31\);
                \subcase \(n \geq 33\).
        \end{mycase}
    \end{proof}
\end{document}

P.S. we use \( and \) instead of dollar signs to display inline mathematical formulae; the reason is explained in the link.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .