5

How do I create my own custom symbols?

I want to make a symbol similar to that of $\otimes,\ominus$, etc. It should be an equals sign enclosed by a circle, and also a slashed equals sign enclosed by a circle. Preferrably, the code should read $\oeq$ and $\oneq$, or something similar.


Thank you for your answers, they were very beneficial.

I am, so far, satisfied with the following definition for $\oeq$:

\newcommand\opn{\mathrel{\ooalign{$-$\cr
  \hidewidth\raise.45ex\hbox{$-$}\cr}}}
\newcommand\oeqq{\mathrel{\ooalign{$\opn$\cr
  \hidewidth\raise.21ex\hbox{$\ocircle\mkern.0mu$}\cr}}}
\newcommand{\oeq}{\mathrel{\lower.22ex\hbox{$\oeqq$}}}

Could anyone use this definition to obtain similarly $\oneq$, with the slash fully inside the circle?

Martin Scharrer
  • 262,582
  • 2
    Welcome to TeX.SX! While there is \olessthan in the stmaryrd package, there's nothing predefined for your \oeq and \oneq in the usually recommended Comprehensive List of LaTeX symbols. – egreg Jan 27 '13 at 17:07

2 Answers2

13

enter image description here

\documentclass[12pt]{article}

\pagestyle{empty}
\usepackage{mathtools,wasysym,graphicx}

\makeatletter
\newcommand\oo@ocircle[5]{\mathrel{\ooalign{\hfil\raisebox{#1\height}{\scalebox{#2}{$#4#5$}}\hfil\cr$#4#3$}}}
\newcommand\oneqx{\mathpalette{\oo@ocircle{0.025}{0.95}{\ocircle}}{\neq}}
\newcommand\oeq{\mathpalette{\oo@ocircle{0.025}{0.95}{\ocircle}}{=}}
\newcommand\oneq{\mathpalette{\oo@ocircle{0.025}{0.95}{\oslash}}{=}}
\newcommand\olt{\mathpalette{\oo@ocircle{0.06}{0.87}{\ocircle}}{\mkern-2mu<}}
\newcommand\ogt{\mathpalette{\oo@ocircle{0.06}{0.87}{\ocircle}}{>\mkern-2mu}}
\makeatother

\begin{document}

\[ \text{\ttfamily\ \ oeq: }A \oeq B_{A \oeq B_{A \oeq B}} \]
\[ \text{\ttfamily oneqx: }A \oneqx B_{A \oneqx B_{A \oneqx B}} \]
\[ \text{\ttfamily\ oneq: }A \oneq B_{A \oneq B_{A \oneq B}} \]
\[ \text{\ttfamily\ \ olt: }A \olt B_{A \olt B_{A \olt B}} \]
\[ \text{\ttfamily\ \ ogt: }A \ogt B_{A \ogt B_{A \ogt B}} \]

\end{document}

Remarks:

  • There's proper empty \ocircle in the package wasysym, one that matches oplus etc.

  • For the explanation of the code, this is a good reading: \subseteq + \circ as a single symbol ("open subset")

  • Since I was digged in the problem, I made matching \olt and \ogt as well.

yo'
  • 51,322
2

Here is a stab at it; it doesn't match the rule thickness contained in \oplus and \ominus though, nor does it bound the negation to the circle:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\oeq}{\mathrel{\text{\textcircled{$=$}}}}
\newcommand{\oneq}{\mathrel{\text{\textcircled{$\neq$}}}}
\begin{document}
$a \oplus b \ominus c$ \par
$a = b \neq c \oeq d \oneq e$ \par
\end{document}

amsmath's \text allows for ease-of-use when these relations are in super-/subscripts.

Werner
  • 603,163