78

What is the correct way to make the "does not divide" symbol in plain LaTeX 2e?

I'm talking about the symbol that is a vertical bar with a slash through it. I prefer not to install AMS or other packages, but instead to use plain LaTeX.

Charles Stewart
  • 21,014
  • 5
  • 65
  • 121
user448810
  • 5,615

6 Answers6

108

Try this:

$x\nmid y$

It has been known to 'save the day'.

2240
  • 103
  • That doesn't work in plain LaTeX. Do you know what package must be loaded to make it work? I tried \usepackage{amsfonts} but that doesn't work. And I still prefer a plain LaTeX solution. –  Aug 05 '11 at 22:33
  • 12
    I got \nmid working with \usepackage{amssymb}. –  Aug 05 '11 at 22:46
25

Detexify is amazingly helpful in finding any symbol.

ang mo
  • 469
7

Using \not with | works with plain LaTeX:

\documentclass{article}
\begin{document}
$2 \not| \;3 $
\end{document}

The symbols \\, and \: and \; create varying degrees of space if the symbols get too close.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
DJP
  • 12,451
  • I wonder why the \not introduces so much space. – Dylan Moreland Jun 22 '12 at 01:11
  • 2
    I'm not sure which space you're talking about but try this: $2 !!\not| ,3 $. The ! is negative space to get things closer together on the right and , will reduce space on the right – DJP Jun 22 '12 at 01:26
  • 1
    Oh, I didn't think you'd come back to this! Thanks very much. I just meant that while a|b is nice and compact, a\not|b puts a strange amount of space between a and |. – Dylan Moreland Jun 22 '12 at 01:28
  • 1
    I don't know why \not has so much extra space but if I had to guess it might be because \not can be used in conjunction with a lot of other symbols which are wider than | [eg \not\in or \not\subset]. So some combinations will look better than others depending on the symbol width being negated. – DJP Jun 22 '12 at 01:48
  • The spacing on \not\mid was ok when I used it on mathoverflow (http://mathoverflow.net/questions/256598/the-exceptional-isomorphism-between-pgl3-2-and-psl2-7-geometric-origin/256600#comment632258_256598) – theHigherGeometer Dec 07 '16 at 07:41
  • A relational operator intentionally has more spacing than a binary operator (since normally we group the terms of binary operators on the same side of a relation). You can change the spacing to that of a binary operator by wrapping the symbol in \mathbin, or even typeset it as an ordinary letter using \mathord. – Davislor Apr 28 '20 at 00:43
5

The ∤ symbol is available in Unicode as U+2224 Does Not Divide, and as \nmid from many packages, including: unicode-math, amssymb, stix, stix2, newtxmath and the less commonly-usedmnsymbol, fdsymbol and boisk.

Davislor
  • 44,045
5

To minimize used packages you can do this:
\newcommand{\ndiv}{\hspace{-4pt}\not|\hspace{2pt}}
From then on \ndiv will add the sign with appropriate spaces before and after.

blerbl
  • 51
  • 3
    If the font size changes, this can cause a lot of headache. At least you can opt for units like ex,em but still it would not be robust enough to be used elsewhere. – percusse Nov 27 '12 at 01:11
  • @percusse: can you provide a more robust way? – cxxl May 23 '13 at 08:02
  • 1
    @cxxl The answers above are pretty good. Otherwise you can look for the definitions from the LaTeX versions and carry them to plain TeX as raw macros. – percusse May 23 '13 at 20:55
0

After fine tuning, I'm pretty happy with defining a new command \doesnotdivide (or whatever you'd like to name it) as: \newcommand{\doesnotdivide}{\not\hspace{2.5pt}\mid}

I found that three points was too much and 2 points was not enough offset.

  • 2
    This is somewhat similar to blerbl's answer. Note that a comment there points out that measuring in em would be better than pt, since it would automatically adjust to a change in font size. – Teepeemm May 02 '19 at 00:23