]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-proof_by_cases.tex
More fiddling to get consistent spacing in proof-by-cases environments.
[mjotex.git] / mjo-proof_by_cases.tex
1 %
2 % A proof-by-cases environment. This gives you a nicely-indented list
3 % of cases for use in proofs.
4 %
5 % Example:
6 %
7 % Case 1 (x >= 0): herp.
8 %
9 % Case 2 (x < 0): derp.
10 %
11
12 % Used below to define pcases.
13 \usepackage{enumitem}
14
15 % Using the enumitem package, we define a new type of list, called
16 % ``pcases'' (proof by cases). Each case has a label with an arabic
17 % numeral (the case number), but also a \thiscase identifier. The
18 % macro \thiscase is defined below by the \case command, and gives the
19 % name or conditions or whatever that distinguish one case from
20 % another.
21 \newlist{pcases}{enumerate}{1}
22 \setlist[pcases]{
23 label=\textbf{Case~\arabic*}:~\protect\thiscase\textbf{.},
24 ref=\arabic*,
25 align=left,
26 leftmargin=0pt,
27 listparindent=\parindent,
28 parsep=\parskip,
29 itemsep=\baselineskip}
30
31 % The optional argument here gets stuffed into the \thiscase macro, to
32 % be called by pcases when it creates this list item. The \hfill is a
33 % hack intended to force the proof to start on a new line, rather than
34 % right after the colon. A \newline where the \hfill is does not work,
35 % so we consume the rest of the line instead.
36 \newcommand{\case}[1][]{
37 \def\thiscase{#1}%
38 \item \hfill\par\vspace{\baselineskip}
39 }