Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Aug 9 '11 at 21:58

This question came from our site for professional and enthusiast programmers.

2  
Have a look at “How to look up a math symbol?” for ideas how you can easily find a particular symbol. –  Caramdir Aug 9 '11 at 22:10
    
Welcome to TeX.sx! Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  N.N. Aug 10 '11 at 7:32
    
Looks similar: tex.stackexchange.com/questions/4473/… –  pushpen.paul Oct 8 at 17:57

4 Answers 4

up vote 19 down vote accepted

try this:

$x\nmid y$

it's been known to 'save the day'.

share|improve this answer
    
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. –  user448810 Aug 5 '11 at 22:33
    
I got \nmid working with \usepackage{amssymb}. –  user448810 Aug 5 '11 at 22:46

Detexify is amazingly helpful in finding any symbol.

share|improve this answer
    
Wow. That's a really cool tool. –  Logan Feb 5 at 9:12

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.

share|improve this answer
    
I wonder why the \not introduces so much space. –  Dylan Moreland Jun 22 '12 at 1:11
1  
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 1:26
    
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 1:28
    
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 1:48

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.

share|improve this answer
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 1:11
    
@percusse: can you provide a more robust way? –  cxxl May 23 '13 at 8:02
    
@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

Your Answer

 
discard

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.