Why does \not{=} allow a line-break before the =? Note that \not= does not allow a break.

\vbox{\hsize=0pt\relax $a\not{=}b$}
\vbox{\hsize=0pt\relax $a\not=b$}

(I had the misconception that \not is a macro that takes an argument, but in fact \not=\mathchar"3236.)


If you typeset $a\not{=}b$, you can see

enter image description here

Knuth optimization: \not is a math relation symbol of width zero, but the glyph extends outside the bounding box, so to be placed in the middle of the following relation (no space is added between consecutive Rel atoms).

However {=} is not a Rel atom, but an Ord one.

So you get \not, thickmuskip, =. And a break is allowed.

See Heiko Oberdiek’s centernot package to see what it does to overcome the problem when the following symbol is not as wide as an equals sign.

The preferred input is actually \neq or \ne, which has the same outcome and could even give a better result with some fonts.

  • Or, with the stackengine package, $a\mathrel{\stackengine{0pt}{=}{/}{O}{c}{F}{F}{L}}b$ will also work if = is substituted with something of different width. – Steven B. Segletes Nov 15 '17 at 16:55
  • you might mention that while with the input \not= you do get the expected output, using \neq which looks identical (with cm fonts) is generally preferable. – barbara beeton Nov 15 '17 at 17:27
  • Thanks. I know and use \neq; I noticed the line-break in trying to use \not{D} for the slashed notation. Now I've done the right thing by loading the slashed package and using \slashed{D}. – Bruno Le Floch Nov 16 '17 at 16:15
.\fam1 a
.\fam2 6
..\fam0 =
.\fam1 b

It is like \not{} so you get a mathrel not which allows breaking, followed by {=} which is a mathord =

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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