From 303483ff6a3d8cba2ec705af56e4fe3d797a9b22 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 29 Aug 2016 16:05:23 -0400 Subject: [PATCH] Use the calc package to ignore \baselinestretch around case labels. --- mjo-proof_by_cases.tex | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/mjo-proof_by_cases.tex b/mjo-proof_by_cases.tex index f2d9b90..daf08a8 100644 --- a/mjo-proof_by_cases.tex +++ b/mjo-proof_by_cases.tex @@ -12,6 +12,27 @@ % Used below to define pcases. \usepackage{enumitem} +% Needed to perform division in the definition of \singleblskip. +\usepackage{calc} + +% A \baselineskip without the \baselinestretch scaling factor. Even +% though \baselinestretch defaults to 1.0, it doesn't really have that +% value. Thus to avoid division by zero, we need to do the ``is this +% thing empty?'' hack. +% +% If we use \baselineskip instead of \singleblskip in our list, things +% get real ugly when the text is e.g. double-spaced. +% +\newlength{\singleblskip} +\setlength{\singleblskip}{ + \baselineskip / \real{ + \if\relax\detokenize{\baselinestretch}\relax + \baselinestretch% + \else + 1% + \fi} +} + % Using the enumitem package, we define a new type of list, called % ``pcases'' (proof by cases). Each case has a label with an arabic % numeral (the case number), but also a \thiscase identifier. The @@ -26,7 +47,7 @@ leftmargin=0pt, listparindent=\parindent, parsep=\parskip, - itemsep=\baselineskip} + itemsep=\singleblskip} % The optional argument here gets stuffed into the \thiscase macro, to % be called by pcases when it creates this list item. The \hfill is a @@ -35,5 +56,5 @@ % so we consume the rest of the line instead. \newcommand{\case}[1][]{ \def\thiscase{#1}% - \item \hfill\par\vspace{\baselineskip} + \item \hfill\par\vspace{\singleblskip} } -- 2.43.2