Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am looking for an alternate to the \pm symbol, and wondering if I am the only one bothered by it as I see that this has not been asked yet.

I have attempted to define one using my standard overkill solution using tikz. The one on the left is the standard \pm, and the one on the right is my version where there is a slight separation between the minus and the plus:

enter image description here

So, is there a better solution than that one I have. Or is there some typesetting standard that states that those two symbols are supposed to touch?

References:

Code:

\documentclass{article}
\usepackage{tikz}

\newcommand{\Mypm}{\mathbin{\tikz [x=1.4ex,y=1.4ex,line width=.1ex] \draw (0.0,0) -- (1.0,0) (0.5,0.08) -- (0.5,0.92) (0.0,0.5) -- (1.0,0.5);}}%

\begin{document}
\[
  x \pm f \Mypm y
\]
\end{document}
share|improve this question
    
Doesn't the shape of that character depend on the font used? –  ArTourter Apr 5 '12 at 0:23
    
I don't have much experience using different fonts, but you are probably right. If you have a particular font that produces a good \pm symbol, please let me know. –  Peter Grill Apr 5 '12 at 0:27
    
looking through tug.dk/FontCatalogue/mathfonts.html the kpfonts seem to fit your requirements, at least for the plus-minus character. there is a choice of serif and sans-serif shapes as well. –  ArTourter Apr 5 '12 at 0:41
    
@ArTourter: So how do I use just that one symbol from that font? –  Peter Grill Apr 5 '12 at 0:48
    
@PeterGrill: See Importing a Single Symbol From a Different Font. –  Werner Apr 5 '12 at 1:32

4 Answers 4

up vote 6 down vote accepted
\documentclass{article}
\makeatletter
\newcommand{\mypm}{\mathbin{\mathpalette\@mypm\relax}}
\newcommand{\@mypm}[2]{\ooalign{%
  \raisebox{.1\height}{$#1+$}\cr
  \smash{\raisebox{-.6\height}{$#1-$}}\cr}}
\makeatother
\begin{document}
$a+b\mypm c X_{\mypm_{\mypm}}(\mypm)$
\end{document}

I'd never recommend this, however. There's a reason why the \pm symbol sits on the baseline, rather than be centered to the axis, which makes it difficult to split the two parts. In any case, use "plus or minus" very sparingly other than for denoting error intervals, as it's generally very ambiguous.

enter image description here

share|improve this answer
    
Ah, so that's \ooalign that I was looking for! Thanks a lot. –  percusse Apr 5 '12 at 22:20
    
@percusse And \smash because the minus has the same height as the plus. –  egreg Apr 5 '12 at 22:21
    
I got the \smash part alright but was missing the \ooalign, now I found your mini course on it :) Easy if you know what you are looking for. –  percusse Apr 5 '12 at 22:23
    
@percusse It's in an easy reachable position in my bag of tricks. –  egreg Apr 5 '12 at 22:27

I wouldn't use rules (either tikz or primitive TeX ones) to fake characters unless absolutely desperate: it's impossible to make them look like font glyphs at all sizes due to the different way the renderer will snap rules and hinted fonts to pixel boundaries.

So I would strongly recommend going with a font whose glyph you prefer, or failing that, shifting a - and + from the font into appropriate positions.

The stix fonts do seem to have a small gap as you'd want. Currently it would be easier to access them from xetex, although standard tex support or then has long been promised.

share|improve this answer
4  
TeX support for STIX fonts is well under way, stay tuned ;). –  Khaled Hosny Apr 5 '12 at 10:42

After smashing and declaring as a binary operator the following seems to be convenient:

\documentclass{article}
\usepackage{amsmath,lipsum}
\newcommand{\mypm}{\mathbin{\smash{%
\raisebox{0.35ex}{%
            $\underset{\raisebox{0.5ex}{$\smash -$}}{\smash+}$%
            }%
        }%
    }%
}
\begin{document}
Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna.  
$A\mypm B$ \lipsum[3]
\[
A\mypm B \mypm B \mypm x \mypm f \mypm 0.001\%
\]
\end{document}

It might still need tweaking in terms of scaling and vertical positioning.

enter image description here

share|improve this answer
    
the toop of the plus really shouldn't be higher than the height of the tallest letter or punctuation symbol. try this between parentheses, and you'll see the problem. –  barbara beeton Apr 5 '12 at 13:41
    
This solution won't scale when used in a subscript, say, for example \[\lim_{x\ti\mypm0}\]. A solution should involve \mathpalette or \mathchoice somehow, I guess. –  cgnieder Apr 5 '12 at 13:49
    
@barbarabeeton you are right and it needs further tweaks. But I actually feel that PeterGrill is better at these things than me also I am counting on the answer of David in this one. If I have time I'll try to update it but if you have a fix please post it as an answer or just feel free to edit mine. –  percusse Apr 5 '12 at 14:10
    
@cgnieder You are right too and please refer to the answer of David in the link on my previous comment to barbara. –  percusse Apr 5 '12 at 14:11

With regards to typographic "standards": you can browse fonts (say at myfonts.com) and enter "±" as your sample text (use unicode). Scanning popular and top fonts seems to indicate that the majority separate the two components. Every one of the bestsellers that defines the glyph appropriately has a separation for example (4 April 2012). Unfortunately, many of the math fonts don't have this glyph at the unicode code-point, so a more relevant comparison is difficult (but possible by exploring the glyph-browser).

Still, looking through all my fonts, and browsing the font databases shows that it is certainly not a typographic standard to attach the two operators: the opposite appears to be much more common.

share|improve this answer
7  
The problem with "normal" fonts is that symbols like ± or ≤ are not designed at all to be used in formulas, but only with numbers, which means the design constrains are different: see for example Microsoft's Math Symbols Design Standards. A real math font must have its symbols aligned on the math axis and Knuth wanted the ± to sit on the baseline (which is not the case of ≤). As the + sign must not be too small (or else the readability of formulas suffer), having a separation on the ± would mean the + would be too high. –  Philippe Goutet Apr 5 '12 at 5:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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