# \subseteq + \circ as a single symbol (“open subset”)

I'm trying to create symbols \opn for "open subset" and \cls "closed subset". I want them to look like this:

My current solution is:

\def\opn{\!\ensuremath{\subseteq\!\!\!\!\!\raisebox{1pt}{$\circ$}}\,}
\def\cls{\!\ensuremath{\subseteq\!\!\!\!\!\raisebox{1pt}{$\bullet$}}\,}


But the problem is when I use this, Latex doesn't treat \subseteq and \circ as a single symbol, so the spacing is incorrect when for example I write $U~\!\!\!\opn\!\!\!~X$:

How can I make the position of the circle be fixed in the middle, so that \opn becomes a single symbol that is resizable, i.e. responds well to \huge?

Edit: @egreg @MartinScharrer: When using your command (to define the stalk of a sheaf)

\mathcal{F}_x:=\frac{\bigsqcup\{\mathcal{F}(U);\, x\in U \opn X\}}{s\sim s'
\,\Longleftrightarrow\, s\in\mathcal{F}(U)\text{ and }s'\in\mathcal{F}(U')\text{ and }
\exists x\in W \opn U\cap U'\!:s|_W=s'|_W}


I get ugly results, namely (egreg's solution)
and (Martin Scharrer's solution) .

Currently, I like this edited Martin's solution the most aesthetically appealing:

\def\opn{ \ensuremath{\mathrel{\subseteq \!\!\!\!\!\raisebox{1.63pt}{$\scriptstyle\circ$}}}}    %odprta podmnozica
\def\opnn{\ensuremath{\mathrel{\subsetneq\!\!\!\!\!\raisebox{1.63pt}{$\scriptstyle\circ$}}}}    %prava odprta podmnozica
\def\cls{ \ensuremath{\mathrel{\subseteq \!\!\!\!\!\raisebox{1.63pt}{$\scriptstyle\bullet$}}}}  %zaprta podmnozica
\def\clsn{\ensuremath{\mathrel{\subsetneq\!\!\!\!\!\raisebox{1.63pt}{$\scriptstyle\bullet$}}}}  %prava zaprta podmnozica


but there is still a problem in the above code. Could anyone edit this last code to fix the problem with spacing?

-
One should never use negative spacing like \! for something like this; see this answer of mine for details. –  Hendrik Vogt Jun 15 '12 at 17:31

Here is a possibility:

\newcommand\opn{\mathrel{\ooalign{$\subseteq$\cr
\hidewidth\raise.225ex\hbox{$\circ\mkern.5mu$}\cr}}}
\newcommand\cls{\mathrel{\ooalign{$\subseteq$\cr
\hidewidth\raise.225ex\hbox{$\bullet\mkern.5mu$}\cr}}}


The symbols will change size according to the context. They don't reduce in subscript or superscripts, for that something more is needed.

\mathcal{F}_x:=
\frac{\bigsqcup\{\mathcal{F}(U);\, x\in U \opn X\}}
{\exists x\in W \opn U\cap U'\!:s|_W=s'|_W}
$\bigskip$\displaystyle\opn\cls
\textstyle\opn\cls
\scriptstyle\opn\cls
#4%
\m@th
\ifcase#1 %
\ifcase#2 %
\subset
\else
\subseteq
\fi
\else
\ifcase#2 %
\supset
\else
\supseteq
\fi
\fi
$}% \sbox2{$#4\m@th\ifcase#3 \circ\else\bullet\fi$}% \@subsetcirc@resize#4% \ifcase#2 \else\@subsetcirc@eqcorr#4\fi \rlap{\unhcopy0}% \hbox to \wd0{% \hskip 0pt plus % \ifcase#1 \@subsetcircfill@close\else\@subsetcircfill@open\fi fil% \relax \unhbox2 % \hskip 0pt plus % \ifcase#1 \@subsetcircfill@open\else\@subsetcircfill@close\fi fil% \relax }% } % \@subsetcirc@resize{<math style>} % Resizes the circ/bullet in box 2. % It also tries to take care of the side bearings. \newcommand*{\@subsetcirc@resize}[1]{% \ifdim\@subsetcirc@scale pt=1pt % \else \sbox4{$#1\vcenter{}$}% \sbox2{\raisebox{-\ht4}[\ht4][\ht4]{\unhcopy2}}% \sbox2{$%
#1\m@th%
\vcenter{%
\hbox{%
\dimen6=.5\dimexpr\wd2 -2\ht2 + 2\ht4\relax
\kern\dimen6 %
\resizebox{!}{\@subsetcirc@scale\height}{%
\kern-\dimen6 %
\copy2 %
\kern-\dimen6 %
}%
\kern\dimen6 %
}%
}%
$}% \fi } % \@subsetcirc@eqcorr{<math style>} % Corrects the vertical position of circ/bullet in box 2 for % the symbols with the "equals" line. \newcommand*{\@subsetcirc@eqcorr}[1]{% \sbox6{$#1\subset}% \sbox2{% \raise\dimexpr\ht0-\ht6\relax\copy2 % }% } \makeatother % Symbol setup \subsetcircfills{1}{0} \subsetcircscale{.8} \begin{document} $X \subsetcirc Y \supsetcirc Z\, {\scriptstyle X \subsetcirc Y \supsetcirc Z}\, {\scriptscriptstyle X \subsetcirc Y \supsetcirc Z}$ $X \subsetbullet Y \supsetbullet Z\, {\scriptstyle X \subsetbullet Y \supsetbullet Z}\, {\scriptscriptstyle X \subsetbullet Y \supsetbullet Z}$ $X \subseteqcirc Y \supseteqcirc Z\, {\scriptstyle X \subseteqcirc Y \supseteqcirc Z}\, {\scriptscriptstyle X \subseteqcirc Y \supseteqcirc Z}$ $X \subseteqbullet Y \supseteqbullet Z\, {\scriptstyle X \subseteqbullet Y \supseteqbullet Z}\, {\scriptscriptstyle X \subseteqbullet Y \supseteqbullet Z}$ \end{document}  Result for \subsetcircfills{1}{0} \subsetcircscale{.8}  Result for \subsetcircfills{5}{2} \subsetcircscale{1}  - I mean that \ooalign is not typical application for this task because this composed operator is right aligned, no center aligned. When \ooalign is used then you must correct the positioning by special constant (.5mu in egregs answer). More straightforward is to use \llap: A \mathrel{{\subseteq}\raise.225ex\llap{$\circ$}} B$ Or, if you need to use this in script and scriptscript size too, then you can define the \opn macro as: \def\opn{\mathrel{{\subseteq}\mathpalette\opnA\circ}} \def\opnA#1#2{\raise\varpalette#1{.225}{.170}{.130}ex\llap{$#1#2$}} \def\varpalette#1#2#3#4{% \ifx#1\scriptstyle#3\else\ifx#1\scriptscriptstyle#4\else#2\fi\fi}$C \opn D_{a\opn b_{d\opn e}}\$

-