8

I’m using \oplus and \ominus in a manuscript and I need an “\oplusminus”, that is, a ± in a big circle. Whatever I use will probably end up being published (though maybe only four times in the whole book), so I’m anxious for it to look elegant and natural, not hacked or unclear.

Stealing some code from egreg and Alain Matthes I've come up with the code below. It's fairly similar in proportions to \oplus and \ominus, but the match could be a bit better: I've had to shrink the \pm sign to footnotesize and then stick it into a \raisebox, yet the thickness doesn’t quite match that of \oplus and \ominus.

Does anyone have suggestions for improvement?

enter image description here

\documentclass[12pt]{report}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix}
\usepackage{amssymb, amsmath, mathptmx}

\newcommand{\opm}{ 
  \mathbin{
    \mathchoice
      {\buildcirclepm{\displaystyle}}
      {\buildcirclepm{\textstyle}}
      {\buildcirclepm{\scriptstyle}}
      {\buildcirclepm{\scriptscriptstyle}}
  } 
}

\newcommand\buildcirclepm[1]{%
  \begin{tikzpicture}[baseline=(X.base), inner sep=-.8, outer sep=-.65]
    \node[draw,circle] (X)  {\footnotesize\raisebox{.1ex}{$#1\pm$}};
  \end{tikzpicture}%
}

\begin{document}

$\ominus \opm \oplus$

\end{document}
7

You just need to tweak more parameters, namely use \scalebox or similar, and fine-tune all the numbers for all four sizes:

enter image description here

\documentclass[12pt]{report}

\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix}
\usepackage{amssymb, amsmath, mathptmx}

\newcommand{\opm}{ 
  \mathbin{
    \mathchoice
      {\buildcirclepm{\displaystyle     }{0.14ex}{0.95}{0.05ex}{.7}}
      {\buildcirclepm{\textstyle        }{0.14ex}{0.95}{0.05ex}{.7}}
      {\buildcirclepm{\scriptstyle      }{0.13ex}{0.955}{0.04ex}{.55}}
      {\buildcirclepm{\scriptscriptstyle}{0.08ex}{0.95}{0.03ex}{.45}}
  } 
}

\newcommand\buildcirclepm[5]{%
  \begin{tikzpicture}[baseline=(X.base), inner sep=-#5, outer sep=-.65]
    \node[draw,circle,line width=#4] (X)  {\footnotesize\raisebox{#2}{\scalebox{#3}{$#1\pm$}}};
  \end{tikzpicture}%
}

\begin{document}

\[
\ominus \opm \oplus
\]

\centerline{\(
{\ominus \opm \oplus}_{{\ominus \opm \oplus}_{\ominus \opm \oplus}}
\)}

\end{document}
  • On the sreenshot the symbol appears thicker. In the PDF viewer it does not. Who know where is the truth lying?... – yo' Jun 1 '13 at 10:46
  • Thanks for that. I didn't think to try it in different viewers, or even to print it out, to see if the line thickness is artificial artefact or a genuine disparity. I'll do that when I'm next at work. – Daniel Harbour Jun 2 '13 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.