# Line-break after \not

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

\documentclass{article}
\begin{document}
\vbox{\hsize=0pt\relax $a\not{=}b$}
\vbox{\hsize=0pt\relax $a\not=b$}
\end{document}


(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

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
\mathord
.\fam1 a
\mathrel
.\fam2 6
\mathord
.\mathrel
..\fam0 =
\mathord
.\fam1 b


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