TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The way I currently do it is $x \not | y$, which looks awful. There's got to be something better available.

share|improve this question
Did you have a look at texdoc symbols? – Jukka Suomela Oct 23 '10 at 22:22
I usually prefer “x does not divide y” (at least in text). Also, have a look at “How to look up a math symbol?” for ideas how you can easily find a particular symbol. – Caramdir Oct 23 '10 at 22:52
@Caramdir: thanks! I knew about Detexify, but wasn't sure I could draw the symbol in the right orientation. But Detexify finds it in the other orientation as well. Fantastic. – Qiaochu Yuan Oct 23 '10 at 22:54
up vote 43 down vote accepted

$x\nmid y$ saves the day.

share|improve this answer
Thanks, Harald! For some reason I thought I had tried this already. – Qiaochu Yuan Oct 23 '10 at 22:40
Remember that \nmid is not defined in amsmath. amssymb is required for \nmid. – 4ae1e1 Nov 7 '13 at 20:14

An alternative to \nmid is to use the \centernot command from the centernot package. The resulting \centernot\mid symbol aligns perfectly with \mid and has a more pronounced slash than \nmid:

alt text

(On the right, the image shows how the commands behave in sub/superscript.)

share|improve this answer
\centernot is my favourite :) – Grzegorz Wierzowiecki Feb 8 '12 at 19:04

Another good looking (best to me) and easy option is to use the command \notdivides from the mathabx package. The code

\[ \prod_{a \notdivides b}^{a \notdivides b} a \notdivides b \]

creates the output

a \notdivides b

The negating line is longer than \nmid's but shorter than \centernot's.

share|improve this answer

$x \mod{y} \neq 0$ ;)

share|improve this answer
That's a programmer's answer. Mathematicians would probably write it $x \neq 0 (\mathrm{mod} y)$ – Novelocrat Oct 25 '10 at 2:53
We'd both be wrong in an algebraist's eyes because a congruence is technically in order: $x \ncong 0 \left( \mathrm{mod} y\right)$. Thanks for pointing that out. – everybodyelse Oct 25 '10 at 4:34
The TeXnically correct way to do either of those is $x \ncong 0 \pmod{y} :) – Ryan Reich Nov 21 '10 at 8:59

One possibility to assert, in symbols, that "a divides b" would be to use the MnSymbol package and then use $a \divides b$ (or $a \ndivides b$ for doesn't divide).

As I am typing a good deal of ring theory, I'm using those all the time.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.