How may I negate long equality signs?

As an answer to How do I make a long identity sign? @egreg offered the solutions:

\documentclass{article}
\usepackage{amsmath,color}

\makeatletter
\newlength{\longeq@wd}
\newcommand{\longeq}[1][2]{\mathrel{\mathpalette\longeq@{#1}}}
\newcommand{\longeq@}[2]{%
\begingroup
\settowidth\longeq@wd{$\m@th#1=$}%
\makebox[#2\longeq@wd][s]{%
$\m@th#1\mspace{1mu}$%
\ifdim#2pt<2pt
$\m@th#1{=}\hss{=}$%
\else
$\m@th#1{=}\kern-0.5\longeq@wd\cleaders\longeqfill@{#1}\hfil\kern-0.5\longeq@wd{=}$%
\fi
$\m@th#1\mspace{1mu}$%
}%
\endgroup
}
\newcommand{\longeqfill@}[1]{\hbox{$\m@th#1\mspace{-3mu}{=}\mspace{-3mu}$}}
\makeatother

\begin{document}

\makeatletter

$a==b$

$a\longeq b$

$a\longeq[1.25]b$

$a\longeq[1.5]b$

$a\longeq[1.75]b$

$a\longeq[3]b$

\end{document}


How may I negate the long identity signs as with $\neq$?

Use centernot:

\documentclass[draft]{article}
\usepackage{amsmath,centernot}

\makeatletter
\newlength{\longeq@wd}
\newcommand{\nlongeq}[1][2]{\centernot{\longeq[#1]}}
\newcommand{\longeq}[1][2]{\mathrel{\mathpalette\longeq@{#1}}}
\newcommand{\longeq@}[2]{%
\begingroup
\settowidth\longeq@wd{$\m@th#1=$}%
\makebox[#2\longeq@wd][s]{%
$\m@th#1\mspace{1mu}$%
\ifdim#2pt<2pt
$\m@th#1{=}\hss{=}$%
\else
$\m@th#1{=}\kern-0.5\longeq@wd\cleaders\longeqfill@{#1}\hfil\kern-0.5\longeq@wd{=}$%
\fi
$\m@th#1\mspace{1mu}$%
}%
\endgroup
}
\newcommand{\longeqfill@}[1]{\hbox{$\m@th#1\mspace{-3mu}{=}\mspace{-3mu}$}}
\makeatother

\begin{document}

\makeatletter

$a==b$

$a\longeq b\nlongeq c$

$a\longeq[1.25]b\nlongeq[1.25] c$

$a\longeq[1.5]b\nlongeq[1.5] c$

$a\longeq[1.75]b\nlongeq[1.75] c$

$a\longeq[3]b\nlongeq[3] c$

\end{document}


Employing the alternate solution at the cited answer, if you end up using an odd number of = signs for the construction, just apply \not to the middle one.

\documentclass{article}
\newcommand\longeq{\mathrel{{=}\mkern-4mu{=}\mkern-4mu{=}}}
\newcommand\nlongeq{\mathrel{{=}\mkern-4mu{\not=}\mkern-4mu{=}}}
\begin{document}
$x\longeq y \nlongeq z$
\end{document}


Werner, in a comment below, notes a simpler syntax of

\newcommand\longeq{=\joinrel=\joinrel=}
\newcommand\nlongeq{=\joinrel\not=\joinrel=}


However, the \joinrel (join relation) macro uses a 3mu shift to achieve the overlay, whereas, my original definition chose the shift as 4mu, making the overall length slightly shorter in my original case, by comparison.

If one finds it too wide, jack up the negativity of the \mkern. Here it is, to -10mu (was -4mu above):

• Oooo, \joinrel. – Werner Mar 4 at 17:02
• @Werner Yes, but \joinrel uses a 3mu shift. I chose 4mu. So there. – Steven B. Segletes Mar 4 at 18:10
• @StevenB.Segletes Thanks. I would have preferred the medium length identities in the answer of egreg. – Sapiens Mar 4 at 21:02
• @Sapiens Change my value of -4mu to, for example, -6mu or some other more-negative value, and the overall length will shrink. – Steven B. Segletes Mar 4 at 21:23