0

I am typesetting a few proofs in LaTeX that have multiple cases, and sometimes I wish to indent each case to make my proof clearer (with about the same amount of horizontal space as a \qquad).

I have looked through many posts on TeX Stack Exchange, and I have tried many of the horizontal spacing commands at “What commands are there for horizontal spacing?” as well as \indent, but to no avail.

Here is a simple example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{case}{Case}

\begin{document}

\begin{theorem}
$\forall (n \in \mathbb{Z})\; 2 \vert (n^2 + n)$
\end{theorem}

\begin{proof}
    \begin{case}
    $2 \vert n$ \\
      $2 \vert n \iff \exists (k \in \mathbb{Z}) \text{ s.t. } n = 2k$
      \[
      \begin{array}{r@{\;}l@{\;}l@{\qquad}l}
        \implies & n^2 &= (2k)^2 \\
        &&= 4k^2 \\
        \implies & n^2 + n &= 4k^2 + 2k \\
        &&=2(2k^2+k) \\
        \multicolumn{3}{@{}c}{\text{Let $s = 2k^2 + k$. $k \in \mathbb{Z} \implies s \in \mathbb{Z}$}} \\
        \implies & \multicolumn{2}{@{}l}{\exists (s \in \mathbb{Z}) \text{ s.t. } n^2 + n = 2s} \\
        \iff & 2 \vert (n^2 + n)
      \end{array}
      \]
    \end{case}

    \begin{case}
    $2 \hspace{-2.5pt}\not\vert\, n$ \\
      $2 \vert n \iff \exists (k \in \mathbb{Z}) \text{ s.t. } n = 2k + 1$
      \[
      \begin{array}{r@{\;}l@{\;}l@{\qquad}l}
        \implies & n^2 &= (2k + 1)^2 \\
        &&= 4k^2 + 4k + 1 \\
        \implies & n^2 + n &= 4k^2 + 4k + 1 + 2k + 1 \\
        &&= 4k^2 + 6k + 2 \\
        &&= 2(2k^2 + 3k + 1) \\
        \multicolumn{3}{@{}c}{\text{Let $s = 2k^2 + 3k + 1$. $k \in \mathbb{Z} \implies s \in \mathbb{Z}$}} \\
        \implies & \multicolumn{2}{@{}l}{\exists (s \in \mathbb{Z}) \text{ s.t. } n^2 + n = 2s} \\
        \iff & 2 \vert (n^2 + n)
      \end{array}
      \]
      \vspace*{-2.25\baselineskip} \\
      \qedhere
    \end{case}
\end{proof}

\end{document}
2

I would do that with an enumerate-like environment, which is easy to customise with enumitem. So I defined a mycases list, with a convenient left margin:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb, bm}
\usepackage{amsthm}
\usepackage{calc}
\newlength{\casewd}
\setlength{\casewd}{\widthof{\bfseries Case 0.}}%
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\usepackage{enumitem}
\newlist{mycases}{enumerate}{1}
\setlist[mycases,1]{label = Case \arabic*: , wide=0pt, leftmargin=\dimexpr\casewd + \labelsep, font=\bfseries, topsep=2pt, itemsep=0pt}%

\begin{document}

\begin{theorem}
$\forall (n \in \mathbb{Z})\; 2 \mid(n^2 + n)$
\end{theorem}

\begin{proof}\mbox{}

    \begin{mycases}
    \item $\bm{2 \mid n.} $ \\
      ${}\mkern2mu 2 \mid n \iff \exists (k \in \mathbb{Z}) \text{ s.t. } n = 2k$
      \[
      \begin{array}{r@{\;}l@{\;}l@{\qquad}l}
        \implies & n^2 &= (2k)^2 \\
        &&= 4k^2 \\
        \implies & n^2 + n &= 4k^2 + 2k \\
        &&=2(2k^2+k) \\
        \multicolumn{3}{@{}c}{\text{Let $s = 2k^2 + k$. $k \in \mathbb{Z} \implies s \in \mathbb{Z}$}} \\
        \implies & \multicolumn{2}{@{}l}{\exists (s \in \mathbb{Z}) \text{ s.t. } n^2 + n = 2s} \\
        \iff & 2 \mid (n^2 + n)
      \end{array}
      \]
    \item $\bm{2\nmid n.} $ \\
      ${}\mkern2mu 2 \nmid n \iff \exists (k \in \mathbb{Z}) \text{ s.t. } n = 2k + 1$
      \[
      \begin{array}{r@{\;}l@{\;}l@{\qquad}l}
        \implies & n^2 &= (2k + 1)^2 \\
        &&= 4k^2 + 4k + 1 \\
        \implies & n^2 + n &= 4k^2 + 4k + 1 + 2k + 1 \\
        &&= 4k^2 + 6k + 2 \\
        &&= 2(2k^2 + 3k + 1) \\
        \multicolumn{3}{@{}c}{\text{Let $s = 2k^2 + 3k + 1$. $k \in \mathbb{Z} \implies s \in \mathbb{Z}$}} \\
        \implies & \multicolumn{2}{@{}l}{\exists (s \in \mathbb{Z}) \text{ s.t. } n^2 + n = 2s} \\
        \iff & 2 \mid (n^2 + n)
      \end{array}
      \]
      \vspace*{-2.25\baselineskip} \\
      \qedhere
    \end{mycases}
\end{proof}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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