Overlay two symbols. How to make it work as subscript?

I am trying to construct a new symbol: a circle with a vertical bar through it. The following MWE sorta works but doesn't look quite right.

\documentclass[12pt]{amsart}

\newcommand{\bcirc}{\mathrel{\ooalign{$\circ$\cr\hidewidth\hbox{$|\mkern 1.9mu$}\cr}}}

\begin{document}

New symbol $x \bcirc_3 y$ works.
Also huge version {\huge$x \bcirc_2 y$} works fine.
In displaymath, compare:
\begin{align*}
x \bcirc_1 y &= \pi_{w \bcirc_2 z}  , \\
x \circ_1 y &= \pi_{w \circ_2 z}  .
\end{align*}

\end{document}

1. Spacing to the right of the new symbol seems slightly too large I think?
2. More importantly, this symbol does not resize when used as a subscript. Any tips/modifications I need to make to the definition?

This is based on an answer to this other tex.SE question.

• \mathpalette might be perfect here, as in the solution you linked. By the way, is the unbalancedness intended? – Manuel Jan 22 '15 at 15:31
• @Manuel: If by unbalancedness you mean the fact that the vertical bar does not go through the circles center, then no, this is not intended. I didn't see it before when I defined this in another document, it looked right to me there. (The other document uses amsart article class and whole lot more packages.) – 1k5 Jan 22 '15 at 15:46
• I didn't update the MWE, but used standalone class to produce the image included. Sorry. – 1k5 Jan 22 '15 at 15:49
• The symbol is siilar to a sans serif Phi, try \usepackage{tipa,amsmath,graphicx} \def\bcirc{\scalebox{.7}{\text{\sffamily\textphi}}} – Fran Jan 22 '15 at 21:30

1 Answer

You have to use \mathpalette:

\documentclass[12pt]{amsart}

\makeatletter
\newcommand{\bcirc}{\mathrel{\vphantom{|}\mathpalette\do@bcirc\relax}}
\newcommand{\do@bcirc}[2]{%
\ooalign{%
$#1\m@th\circ$\cr
\hidewidth$#1\m@th|$\hidewidth\cr
}%
}
\makeatother

\begin{document}

New symbol $x \bcirc_3 y$ works.
Also huge version {\huge$x \bcirc_2 y$} works fine.
In displaymath, compare:
\begin{align*}
x \bcirc_1 y &= \pi_{w \bcirc_2 z}  , \\
x \circ_1 y &= \pi_{w \circ_2 z}  .
\end{align*}

\end{document}


I used \hidewidth instead of manual kerning. Centering seems to be good.

• It looks too long to me, may be one prefers \rotatebox[origin=c]{90}{$#1\m@th-$} (with graphicx package) instead of $#1\m@th|$. – Manuel Jan 22 '15 at 16:39
• @Manuel For my use it's just right. It is a bar and a composition circle and that's precisely what I use the combined symbol for: its mathematical meaning is the combination of both. – 1k5 Jan 22 '15 at 18:45
• @1k5 Just in case someone in the future comes here and feels like it's a bit large. – Manuel Jan 22 '15 at 19:16