# modulo operator rendering poorly

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.

• 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}$. – Najib Idrissi Jul 11 '15 at 8:36
• 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$. – Martin Sleziak Jul 11 '15 at 8:38
• Thanks. I chose \pmod. It looks like \mod is really useless and broken, but this is the wrong forum to complain about that :P . – Potatoswatter Jul 11 '15 at 8:40
• 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. – Jyrki Lahtonen Jul 11 '15 at 9:02
• @JyrkiLahtonen Oh, thanks, I guess my usage was wrong, then. – Potatoswatter Jul 11 '15 at 9:24

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$$

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.

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