# Symbol used to indicate indivisibility

In the following definition, I am denoting the condition that $a$ is not an integral multiple of $b$. Why is there such a big space between $b$ and the vertical bar with a slash through it?

\documentclass{amsart}
\usepackage{amsmath}

\begin{document}

\noindent
The integers $q$ and $r$ are called the \textbf{quotient} and \textbf{remainder},
respectively, in the division of $a$ by $b$. If $r \neq 0$, $a$ is not divisible by $b$.
The indivisibility of $a$ by $b$ is denoted by \boldmath$b \not\vert a$\unboldmath.

\end{document}

• \usepackage{amssymb} and \nmid – egreg Mar 23 at 17:14
• If, for some reason, you can't use \nmid, I suggest you write $b\mathrel{\not\vert}a$ to get even spacing around \not\vert. That said, \nmid looks a lot better... – Mico Mar 23 at 17:49
• What is the code to indicate that $a$ is divisible by $b$? – A gal named Desire Mar 23 at 17:52
• $b \vert a$, or $b \mid a$? – A gal named Desire Mar 23 at 17:52
• $b\mid a$ has the correct spacing. – Bernard Mar 23 at 18:15

The spacing issue is caused by the fact that there are three different kinds of math symbols: binary operations (e.g. + and \times, binary relations (e.g. < and \leq) and ordinary characters (e.g. ! and \infty). Each has its own spacing. Relations typically have the largest, slightly more than operations and significantly more than ordinary characters. Operation spacing uses \mathbin, relation spacing uses mathrel, and ordinary character spacing can use {} (or nothing if it's already an ordinary character). These are illustrated in the following table:

Since "divides" is a relation, the correct spacing is given by \mathrel, which is the default for \mid. The negated relation, as suggested in the comments by @egreg is given by the command \nmid. Notice that the spacing is identical to \mid.

\nmid uses the amssymb package.

Here is the code to produce the above table:

\documentclass{article}

\usepackage{amssymb}

\begin{document}

\begin{tabular}{ll}
$a\vert b$ & \verb$a\vert b$\\
$a|b$ & \verb$a|b$\\
$a\mathbin{|}b$ & \verb$a\mathbin{|}b$\\
$a\mathrel{|}b$ & \verb$a\mathrel{|}b$\\
$a\mid b$ & \verb$a\mid b$\\
$a\nmid b$ & \verb$a\nmid b$
\end{tabular}

\end{document}