  We study the number $p(n,t)$ of partitions of $n$ with difference $t$ between
largest and smallest parts. Our main result is an explicit formula for the
generating function $P_t(q) := \sum_{n \ge 1} p(n,t) \, q^n$. Somewhat
surprisingly, $P_t(q)$ is a rational function for $t>1$; equivalently, $p(n,t)$
is a quasipolynomial in $n$ for fixed $t>1$. Our result generalizes to
partitions with an arbitrary number of specified distances.
