# A circled inequality relation symbol similar to the circled arithmetic operators

I'm looking for a variation on the \odot (a circled dot) and \oplus (a circled plus) operators, but for the inequality relations. In other words, I'm looking for the symbol to substitute for the blank in the second printed line of following example.

\documentclass{amsart}
\begin{document}
\begin{align*}
c\cdot x + y &\leq z\\
\end{align*}
\end{document}


I couldn't find any matching symbol using detexify.

We can make the circle match the \oplus one by suitable scaling.

The symbol to be circled has to be scaled depending on its size, so \ogeneric provides for an optional argument (default 0.7 that seems good for <).

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

\makeatletter
\newcommand{\ogeneric}[2][0.7]{%
\vphantom{\oplus}\mathpalette\o@generic{{#1}{#2}}%
}
\newcommand{\o@generic}[2]{\o@@generic#1#2}
\newcommand{\o@@generic}[3]{%
\begingroup
\sbox\z@{$\m@th#1\oplus$}%
\dimen@=\dimexpr\ht\z@+\dp\z@\relax
\savebox\tw@[\totalheight]{$\m@th#1\bigcirc$}%
\makebox[\wd\z@]{%
\ooalign{%
$#1\vcenter{\hbox{\resizebox{\dimen@}{!}{\usebox\tw@}}}$\cr
\hidewidth
$#1\vcenter{\hbox{\resizebox{#2\dimen@}{!}{$#1\vphantom{\oplus}{#3}$}}}$%
\hidewidth
\cr
}%
}%
\endgroup
}
\makeatother

\newcommand{\ole}{\mathrel{\ogeneric{<}}}
\newcommand{\oleq}{\mathrel{\ogeneric[0.6]{\leq}}}

\begin{document}

\begin{align*}
c\cdot x + y &\leq z\\
c\odot x\oplus y &\oleq z \\
c\odot x\oplus y &\ole z \\
\mbox{\textcolor{red}{$\oplus$}\llap{$\ole$}
$\oplus$\llap{\textcolor{red}{$\ole$}}}
\end{align*}

\end{document}


Note that color is just for the last line where \ole is superimposed to \oplus in order to see they match.

The defined symbols can be used also in subscripts and superscripts and they scale properly.

• Thanks. This is beautiful. By the way, in my opinion, the slanted version of \leq, namely \leqslant (suggested by Bernard) looks nicer. – Evan Aad Nov 8 '18 at 11:08
• Would you be so kind as to add parameters to your \ogeneric command to control the horizontal and vertical placement of the inner symbol with respect to the circle, so I can easily add new circled symbols? For instance, when I try to add a circled = symbol with \newcommand{\oeq}{\mathrel{\ogeneric{=}}}, the = turns out off center on the vertical axis. – Evan Aad Nov 8 '18 at 11:14
• @EvanAad Try now, I fixed the code adding a phantom. – egreg Nov 8 '18 at 11:27

You can certainly do this in many ways, one of them is TikZ. Loading TikZ only for that may be a bit of an overkill, but if you want to construct more symbols of this sort, this might be one of the easiest ways to go.

\documentclass{amsart}
\usepackage{tikz}
\begin{document}
\begin{align*}
c\cdot x + y &\leq z\\
c\odot x\oplus y &\tikz[baseline=(X.base)]{\node[circle,draw,inner
sep=1pt](X){$\leq$};} z
\end{align*}
\end{document}


• Thanks. I think to achieve best aesthetics, the circle should be the same size as the ones about the arithmetic operators, which means the inequality symbol needs to be shrunk a little. How can I achieve this? Also, how can I make this symbol behave like a binary relation in terms of the spaces surrounding it? – Evan Aad Nov 8 '18 at 6:25

To answer your question in your last comment, here is an easy way with pstricks. However I'm not sure scaling will look so nice, as the circled symbols won't be aligned with the other symbols. Anyway, I show in the following code some possible variants:

\documentclass{amsart}
\usepackage{amssymb}
\usepackage{pstricks, auto-pst-pdf}

\begin{document}

\begin{align*}
c\cdot x + y &\leq z\\
c\odot x\oplus y &\mathrel{\pscirclebox[framesep=-0.7pt, linewidth=0.4pt]{\leq}} z \\
c\odot x\oplus y &\mathrel{\pscirclebox[framesep=-0.7pt, linewidth=0.4pt]{\leqslant}} z \\
c\odot x\oplus y &\mathrel{\pscirclebox[framesep=-0.7pt, linewidth=0.4pt]{\leqslant\mkern2mu}} z
\end{align*}

\begin{align*}
c\cdot x + y &\leq z\\
c\odot x\oplus y &\mathrel{\psscalebox{0.67}{\pscirclebox[framesep=-0.7pt, linewidth=0.4pt]{\leq}}} z \\
c\odot x\oplus y &\mathrel{\psscalebox{0.67}{\pscirclebox[framesep=-0.7pt, linewidth=0.4pt]{\leqslant}}} z \\
c\odot x\oplus y &\mathrel{\psscalebox{0.67}{\pscirclebox[framesep=-0.7pt, linewidth=0.4pt]{\leqslant\mkern2mu}}} z
\end{align*}

\end{document}


• By the way, if I wish to have a \geq variant of the last version, what do I need to do besides changing \leqslant to \geqslant so that it looks as well positioned inside the circle as the \leq version? – Evan Aad Nov 8 '18 at 10:22
• I don't think you'll have to change whatever else. Just incase, what makes the circle look more centred is adding some math kerning after the symbol (\mkern2mu), which ensures the symbol looks slightly longer tha it is and thus moves the centre of the circle slightly rightwards. You can play with the value of this kerning if necessary. – Bernard Nov 8 '18 at 10:27
• One more question, please. What is auto-pst-pdf for? The reason I'm asking is that, for some reason, my TeX editor (Emacs) opens a different viewer than usual when I compile your example, and I think the reason is this package. – Evan Aad Nov 8 '18 at 10:38
• I'm sorry, but I'm going to switch the accepted answer to egreg's because his solution scales, is very easy to modify (e.g. add a \geq variant), and (this is not your fault, but it still annoys me) my TeX editor opens the same viewer as usual. – Evan Aad Nov 8 '18 at 10:57
• You don't have to be sorry – you accept the answer which is the most useful to you. – Bernard Nov 8 '18 at 17:01