[Tex/LaTex] How to typeset the math symbol with a circle and a rectangle attached to it

math-modesymbols

I would like to use a math-symbol, which looks like the following picture (a circle with a rectangle attached to it). Is there a package which provides such or if not, how can I create it by myself?

mystery symbol

I tried using detextify but did not get any satisfying result.

Best Answer

Without additional guidance, I made it based on \circ and defined it as \mathbin.

For a version that only works in the regular math size:

\documentclass{article}
\usepackage{xcolor}
\usepackage{stackengine}
\newcommand\mathkey{%
  \mathbin{\stackinset{r}{-.98pt}{c}{.3pt}{%
    \def\stackalignment{l}%
    \stackon[-.85pt]{\rule{2pt}{1.2pt}}{\textcolor{white}{\rule{1.65pt}{0.45pt}}}%
  }{$\circ$}\kern1.2pt}%
}
\begin{document}
$A\mathkey B$
\end{document}

enter image description here

For the version that works across math styles:

\documentclass{article}
\usepackage{xcolor}
\usepackage{stackengine,scalerel}
\newcommand\mathkey{%
  \mathbin{\scalerel*{\stackinset{r}{-.98pt}{c}{.3pt}{%
    \def\stackalignment{l}%
    \stackon[-.85pt]{\rule{2pt}{1.2pt}}{\textcolor{white}{\rule{1.65pt}{0.45pt}}}%
  }{$\circ$}\kern1.2pt}{\circ}}%
}
\begin{document}
$A\mathkey B$

$\scriptstyle A\mathkey B$

$\scriptscriptstyle A\mathkey B$
\end{document}

enter image description here

Note that the final \circ in the definition of \mathkey defines the vertical footprint of the \mathkey symbol. Thus, one could change that to something else, let's say X, in order to enlarge the resulting \mathkey:

\documentclass{article}
\usepackage{xcolor}
\usepackage{stackengine,scalerel}
\newcommand\mathkey{%
  \mathbin{\scalerel*{\stackinset{r}{-.98pt}{c}{.3pt}{%
    \def\stackalignment{l}%
    \stackon[-.85pt]{\rule{2pt}{1.2pt}}{\textcolor{white}{\rule{1.65pt}{0.45pt}}}%
  }{$\circ$}\kern1.2pt}{X}}%
}
\begin{document}
$A\mathkey B$

$\scriptstyle A\mathkey B$

$\scriptscriptstyle A\mathkey B$
\end{document}

enter image description here