I'm trying to get the plus-minus sign (\pm) in different colors.

I started with


and probably could further adjust it with some \vspace commands and \raisebox - but it just doesn't seem right. Is there a simple approach?



\[a \rgpm{green}{red} b \pm c  \] 

enter image description here

2 Answers 2


enter image description here

If you need a version that works across math styles (EDITED to add \cmp support):


enter image description here

  • I was about to ask for your edit, thank you very much! Nov 13, 2015 at 12:31
  • 1
    @thewaywewalk "The difficult we do immediately. The impossible takes a little longer." Nov 13, 2015 at 12:33
  • @thewaywewalk extending the \cpm macro to take color arguments is trivial, but if you would like it presented that way, let me know and I will edit. Nov 13, 2015 at 12:46
  • No, it's trivial, I can manage. If you're bored you could add the minus+plus version, that does not seem trivial. :D Nov 13, 2015 at 12:50
  • 1
    @thewaywewalk Done. Nov 13, 2015 at 13:09

Just for fun with plain TeX

  {\xcpm\displaystyle{.2ex}{.53ex}}% displaystyle
  {\xcpm\textstyle{.2ex}{.53ex}}% textstyle
  {\xcpm\scriptstyle{.16ex}{.43ex}}% scriptstyle
  {\xcpm\scriptscriptstyle{.11ex}{.35ex}}% scriptscriptstyle

      \raise #2\hbox{\pdfliteral{0 1 0 rg}$#1+$\pdfliteral{0 g}}\cr
      \lower #3\hbox{\pdfliteral{1 0 0 rg}$#1-$\pdfliteral{0 g}}%

$1 \pm 2 \cpm 3$

$_{1 \pm 2 \cpm 3}$

$_{_{1 \pm 2 \cpm 3}}$

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .