$x \in (a-r,a+r)$ versus $|x-a| < |r-a|$ From the Princeton book for the GRE Subject Test in Maths:

That part seems to suggest that

if $x \in (a-r,a+r)$ then $f(x) < \frac1q < \varepsilon$ and hence $f$ is continuous at the irrationals in $(0,1)$.

I was thinking to establish continuity we needed to show that

if $|x-a| < \delta = |r-a|$ then $f(x) < \frac1q < \varepsilon$.

What's happening? If $x \in (a-r,a+r)$, then $|x-a| < \delta = |r-a|$?

It's a typo. It should have been:

Then, within the open interval $(a - \color{red}{\delta}, a + \color{red}{\delta})$, the value of $f(x)$ will be less than $\color{red}{\text{or equal to}}$ $\frac{1}{q}$

To see why this choice of $\delta$ works, we argue by contradiction.
Suppose instead that there is some $r^* \in (a - \delta, a + \delta)$ such that $f(r^*) > \frac{1}{q}$. Looking at how $f$ is defined, we know that $r^*$ can't be irrational (since $f(r^*) = 0 > \frac{1}{q}$ is absurd), so we know that $r^* = \frac{c}{d}$ for some integers $c, d$ in lowest terms with $d > 0$ and we know that $f(r^*) = \frac{1}{d} > \frac{1}{q}$ so that $d < q$. But since $\frac{c}{d} = r^* \in (a - \delta, a + \delta) \subseteq I = (0, 1)$, we know that $\frac{c}{d} < 1$ so that $r^*$ must have been one of the $\binom{q}{2}$ elements in the previous discussed list of rational numbers. Since $|r^* - a| < \delta = |r - a|$, we have found a number in the list that is closer to $a$ than $r$, contradicting the minimality of $r$ ($r$ was supposed to be the closest, not $r^*$). So we conclude that:
$$
|x - a| < \delta \iff x \in (a - \delta, a + \delta) \implies f(x) \leq \frac{1}{q} < \epsilon
$$
as desired.
