]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-proof_by_cases.tex
Add a \break after \hfill in the proof-by-cases.
[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=\parindent}
27
28 % The optional argument here gets stuffed into the \thiscase macro, to
29 % be called by pcases when it creates this list item. The \hfill is a
30 % hack intended to force the proof to start on a new line, rather than
31 % right after the colon. A \newline where the \hfill is does not work,
32 % so we consume the rest of the line instead.
33 \newcommand{\case}[1][]{
34 \def\thiscase{#1}%
35 \item \hfill\break
36 }