How can I create a circled not equal sign similar to the image below?
Best Answer
Here is a solution with a smaller \not bar, so the symbol is completely enclosed in the circle without the circle being too large.
Edit: I added another solution. The \circneqrel command provides a circled \neq symbol which is spaced as a binary relation symbol, considering the circle as the limits of the symbol (this is the first solution I posted). The \circneq command provides a similar symbol, but adjusting the spacing as if it was a simple \neq symbol.
\documentclass{article}
\usepackage{trimclip}
\newcommand{\newneq}{\clipbox{0pt 1.5pt 0pt 1.5pt}{$\neq$}}
\newlength{\bigcirclength}
\newlength{\neqlength}
\settowidth{\bigcirclength}{$\bigcirc$}
\settowidth{\neqlength}{$\neq$}
\newcommand{\circneqrel}{\mathrel{\makebox{$\bigcirc$\hspace*{-\bigcirclength}\makebox[\bigcirclength]{\newneq}}}}
\newcommand{\circneq}{\mathrel{\makebox{\makebox[\neqlength]{$\bigcirc$}\hspace*{-\neqlength}$\newneq$}}}
\begin{document}
\( E \circneqrel mc^3 \)
\( E \circneq mc^3 \)
\( E \neq mc^3 \)
\end{document}
The amsmath package provides the \overset and \underset macros that can be used to place one symbol above or below another. If you want text above and below, you could use \DeclareMathOperator* (also from amsmath).
There shouldn't be any problems using this in amsmath environments such as align.
\begin{align*}
A &\eq^b_a B \\
&\eq^b_a C
\end{align*}
However, if you use it in the middle column of an eqnarray or eqnarray* (which are generally considered to be obsolete), then you will need \displaystyle before \eq.
All of the above applies to egreg's suggestion of defining \eq via
Best Answer
Here is a solution with a smaller
\not
bar, so the symbol is completely enclosed in the circle without the circle being too large.Edit: I added another solution. The
\circneqrel
command provides a circled\neq
symbol which is spaced as a binary relation symbol, considering the circle as the limits of the symbol (this is the first solution I posted). The\circneq
command provides a similar symbol, but adjusting the spacing as if it was a simple\neq
symbol.