[Tex/LaTex] How to write this symbol in latex? (disjoint sharp operator)

logicmath-operatorssymbols

I can't find this symbol used to indicate the disjoint sharp operator.

enter image description here

It's a # inside a circle. Is this symbol available in LaTex? if not, how can I draw it inside a mathematical equation?

Best Answer

You can use a scaled up version of \bigcirc and \ooalign:

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

\makeatletter
\newcommand{\makecircled}[2][\mathord]{#1{\mathpalette\make@circled{#2}}}
\newcommand{\make@circled}[2]{%
  \begingroup\m@th
  \vphantom{\biggercirc{#1}}%
  \ooalign{$#1\biggercirc{#1}$\cr\hidewidth$#1#2$\hidewidth\cr}%
  \endgroup
}
\newcommand{\biggercirc}[1]{%
  \vcenter{\hbox{\scalebox{1.4}{$\m@th#1\bigcirc$}}}%
}
\makeatother

\newcommand{\disjointsharp}{\makecircled[\mathbin]{\#}}

\begin{document}

$A\disjointsharp B_{A\disjointsharp B}$

\end{document}

enter image description here

I used \mathbin but it could be \mathrel depending on the meaning.

See https://tex.stackexchange.com/a/22375/4427 for a quick course on \ooalign.

With a smaller circle

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

\makeatletter
\newcommand{\makecircled}[2][\mathord]{#1{\mathpalette\make@circled{#2}}}
\newcommand{\make@circled}[2]{%
  \begingroup\m@th
  \vphantom{\bigcirc}%
  \ooalign{$#1\bigcirc$\cr\hidewidth$#1\make@smaller{#1}{#2}$\hidewidth\cr}%
  \endgroup
}
\newcommand{\make@smaller}[2]{%
  \vcenter{\hbox{\scalebox{0.7}{$\m@th#1#2$}}}%
}
\makeatother

\newcommand{\disjointsharp}{\makecircled[\mathbin]{\#}}

\begin{document}

$A\disjointsharp B_{A\disjointsharp B}$

\end{document}

enter image description here

When symbols are “bigger”, they are usually centered with respect to the formula axis.

Another possibility:

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

\makeatletter
\newcommand{\makecircled}[2][\mathord]{#1{\mathpalette\make@circled{#2}}}
\newcommand{\make@circled}[2]{%
  \begingroup\m@th
  \sbox\z@{$#1A$}%
  \sbox\tw@{%
    \raisebox{\depth}{%
      \vphantom{$#1A$}%
      \ooalign{%
        \hidewidth$#1\make@smaller{#1}{#2}$\hidewidth\cr
        $#1\bigcirc$\cr
      }%
    }%
  }%
  \resizebox{!}{\ht\z@}{\box\tw@}%
  \endgroup
}
\newcommand{\make@smaller}[2]{%
  \vcenter{\hbox{\scalebox{0.7}{$\m@th#1#2$}}}%
}
\makeatother

\newcommand{\disjointsharp}{\makecircled[\mathbin]{\#}}

\begin{document}

$A\disjointsharp B_{A\disjointsharp B}$

\end{document}

enter image description here