]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-proof_by_cases.tex
Use "big" versions of operators in \binopmany consumers.
[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. The ``loadonly'' parameter prevents
13 % a very bad interaction with the beamer document class.
14 \usepackage[loadonly]{enumitem}
15
16 % Needed to perform division in the definition of \singleblskip.
17 \usepackage{calc}
18
19 % A \baselineskip without the \baselinestretch scaling factor. Even
20 % though \baselinestretch defaults to 1.0, it doesn't really have that
21 % value. Thus to avoid division by zero, we need to do the ``is this
22 % thing empty?'' hack.
23 %
24 % If we use \baselineskip instead of \singleblskip in our list, things
25 % get real ugly when the text is e.g. double-spaced.
26 %
27 \newlength{\singleblskip}
28 \setlength{\singleblskip}{
29 \baselineskip/\real{
30 \if\relax\detokenize{\baselinestretch}\relax
31 \baselinestretch%
32 \else
33 1%
34 \fi}
35 }
36
37 % Using the enumitem package, we define a new type of list, called
38 % ``pcases'' (proof by cases). Each case has a label with an arabic
39 % numeral (the case number), but also a \thiscase identifier. The
40 % macro \thiscase is defined below by the \case command, and gives the
41 % name or conditions or whatever that distinguish one case from
42 % another.
43 \newlist{pcases}{enumerate}{1}
44 \setlist[pcases]{
45 label=\textbf{Case~\arabic*}:~\protect\thiscase\textbf{.},
46 ref=\arabic*,
47 align=left,
48 leftmargin=0pt,
49 listparindent=\parindent,
50 parsep=\parskip,
51 itemsep=\singleblskip}
52
53 % The optional argument here gets stuffed into the \thiscase macro, to
54 % be called by pcases when it creates this list item. The \hfill is a
55 % hack intended to force the proof to start on a new line, rather than
56 % right after the colon. A \newline where the \hfill is does not work,
57 % so we consume the rest of the line instead.
58 \newcommand{\case}[1][]{
59 \def\thiscase{#1}%
60 \item \hfill\par\vspace{\singleblskip}
61 }