3
$\begingroup$

The \mod operator is padded with too much space: $a \mod b$. Am I missing something in the TeX, or is something configured wrong?

I've tried with Firefox and Safari on OS X.

$\endgroup$
  • 9
    $\begingroup$ It's the correct behavior. If you want a "mod" with less space use \bmod (as in "binary mod"): $a \bmod b$. \mod is more keeping with the spirit of \pmod: $a \pmod{b}$. $\endgroup$ – Najib Idrissi Jul 11 '15 at 8:36
  • 1
    $\begingroup$ TeX.SE: typesetting modulus operator, as in remainder BTW there is also \pmod if you want to get something like $x^2\equiv-1 \pmod n$. $\endgroup$ – Martin Sleziak Jul 11 '15 at 8:38
  • $\begingroup$ Thanks. I chose \pmod. It looks like \mod is really useless and broken, but this is the wrong forum to complain about that :P . $\endgroup$ – Potatoswatter Jul 11 '15 at 8:40
  • 4
    $\begingroup$ Just to make sure that you know: \bmod is designed to look good if you want the remainder. Like $(7\bmod 5)=2$. OTOH \pmodis designed to look good, if you want a congruence. Like $5\equiv 7\pmod2$ or $14\equiv11\pmod3$. With \bmod the 'value' of the calculation is an integer. The 'value' of a congruence OTOH is boolean, because it is semantically a comparison operation. $\endgroup$ – Jyrki Lahtonen Jul 11 '15 at 9:02
  • $\begingroup$ @JyrkiLahtonen Oh, thanks, I guess my usage was wrong, then. $\endgroup$ – Potatoswatter Jul 11 '15 at 9:24
16
$\begingroup$

What \mod is for:

$$ 5 \equiv 8 \mod 3$$

What \bmod is for:

$$ 5 \bmod 3 = 2 $$

And for completeness, \pmod:

$$ -1 \equiv 8 \pmod 3$$

$\endgroup$
2
$\begingroup$

As a workaround with \mod (being a little forgetful and more than a little obstinate), I sometimes use the thin negative space modifier \! to remove the excess whitespace. Here are the results without the modifier, followed by using it once and then twice:

$$ 5 \equiv 8 \mod 3 $$

$$ 5 \equiv 8 \! \mod 3 $$

$$ 5 \equiv 8 \!\! \mod 3 $$

I generally find the latter to be about what I want for inline "modulo" equations.

$\endgroup$
  • 1
    $\begingroup$ you can also use \hspace{-2mm} $\endgroup$ – Surb Jul 13 '15 at 20:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .