[Tex/LaTex] Why is the ‘mod’ function in LaTeX so wide? (extra space on the left of it)

spacing

When trying to use the mod function that LaTeX offers, I always meet a problem: it seems to have a space or two in front of it that I can't delete without \hspace. Why is that and how can I fix it?

What shows up: $(\mod n)$

Enter image description here

What I want: $(\hspace{-0.3cm}\mod n)$

Enter image description here

Best Answer

See section 5.2 of the amsmath manual for the details of \mod and related commands (\mod, \pmod, \bmod, \pod) but the short version is that if you want parens around it, you should use \pmod:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
  1+1 \equiv 0 \pmod{2}
\end{equation*}
\end{document}

enter image description here

enter image description here (Taken from Version 2.1)

Related Question