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've occasionally seen a negative (when a number is simply negative, not a subtraction), typeset as negative sign that's slightly skinnier and above the centre line of text. Is this proper notation for mathematics and how would one go about typesetting this in LaTeX?

Edit

I believe that calculators were what happened to give me this idea, couldn't find it in any of my math books. Thank you all for the help, it's much appreciated.

alt text

Thank you 'Antal S-Z' for the photo link.

However, the question remains, how exactly would I typeset this?

share|improve this question
2  
Perhaps an example of the kind of symbol you're interested in would help... –  Seamus Oct 31 '10 at 21:09
    
I've never seen this (but of course that doesn't mean it doesn't exist). Unicode has only one "minus" character, too. So I agree with Seamus: please give an example. –  Philipp Oct 31 '10 at 21:49
1  
I have seen this only in one situation: my kids regularly bring home from school math homework sheets that use this kind of notation. It seems that some math educationists believe that it is less confusing for kids if they use different symbols the binary operation of subtraction than for the unary operation of opposite. I have never seen it anywhere else. The symbol they use on the worksheet is so small and thin that it is almost invisible on the xerox copies the kids bring home. –  Jan Hlavacek Nov 1 '10 at 2:49
    
@Seamus, see the edit. I believe this is in fact what sparked my memory, I can't seem to find any similar notations in my piles of math books, but it makes sense why they did what they did. Antal S-Z below in a comment linked this photo and it seems to be what was driving my memory of that. –  EricR Nov 1 '10 at 2:55
2  
I've always seen this as the calculator programmers being too lazy to write a parser that can handle - as both a unary and a binary operator. –  asmeurer Sep 8 '13 at 19:57
show 2 more comments

6 Answers

up vote 21 down vote accepted

My understanding is that a negative sign is the same as a minus sign, but the spacing is different since it's a unary operator rather than a binary operator. You can see this in TeX: $-x$ has different spacing from $y-x$:

I'm not sure I can answer your question about it being proper, but I'll say that I've never seen mathematics typeset with a raised, smaller negative sign. (But take that with a grain of salt because most, but not all, math I read is typeset with LaTeX.)

share|improve this answer
1  
hmmm. sure I've seen people write $0^-$ or $0^+$, but not a preceding raised smaller minus sign. –  Yossi Farjoun Oct 31 '10 at 21:51
    
@Yossi Farjoun: I think the OP and TH. meant slightly raised with respect to vertical centre as opposed to a superscript. –  Willie Wong Oct 31 '10 at 23:03
2  
@Willie: Indeed. I seem to recall that my TI-8x calculator distinguished the symbols as the OP described, but I don't have batteries for it to check –  TH. Nov 1 '10 at 0:17
    
Now that you mention it, my TI-84+ does/did exactly that; this screenshot of what seems to be an emulator is an example. And SML uses ~3 for negative three, and 3-4 for three minus four, though that's driven out of a desire to avoid ambiguity. –  Antal S-Z Nov 1 '10 at 2:47
    
@All, thinking of it, my TI-84+ may be precisely what sparked my memory. –  EricR Nov 1 '10 at 2:53
show 1 more comment

Here is an example, but you still have to distinguish between unary and binary minus manually:

\documentclass{minimal}

\usepackage{xparse}

\makeatletter
\NewDocumentCommand{\raisedminus}{m}{%
  \raisebox{0.2em}{$\m@th#1{-}$}%
}
\NewDocumentCommand{\unaryminus}{}{%
  \mathbin{%
    \mathchoice{%
      \raisedminus\scriptstyle
    }{%
      \raisedminus\scriptstyle
    }{%
      \raisedminus\scriptscriptstyle
    }{%
      \raisedminus\scriptscriptstyle
    }%
  }%
}
\makeatother

\begin{document}

$\unaryminus 3 - 4$

\end{document}

output

share|improve this answer
    
I don't think you want a \mathbin since it isn't a binary operator. \mathord seems more appropriate. (I think that boxes are normally set with ordinary spacing so nothing is actually needed.) –  TH. Nov 1 '10 at 9:53
    
In this case it doesn't actually matter because the Bin atom is converted to an Ord atom at all places where it is reasonable. (That is how the normal minus works, after all.) –  Philipp Nov 1 '10 at 10:12
    
thank you. This works exactly as I would expect it to. Cheers. –  EricR Nov 1 '10 at 13:52
add comment

Here is a LuaLaTeX approach that discovers unary minuses automatically (but the \raisebox doesn't work for a reason I don't understand):

\documentclass{minimal}

\usepackage{luatextra}
\usepackage{xparse}

\makeatletter
\NewDocumentCommand{\raisedminus}{m}{%
  \raisebox{0.2em}{$\m@th#1{-}$}%
}
\makeatother

\newsavebox{\scriptraisedminus}
\sbox{\scriptraisedminus}{\raisedminus{\scriptstyle}}
\newsavebox{\scriptscriptraisedminus}
\sbox{\scriptscriptraisedminus}{\raisedminus{\scriptscriptstyle}}

\begin{luacode}
local unary_minus = node.new(15)
unary_minus.display = node.new(16, 0)
unary_minus.display.nucleus = node.new(32)
unary_minus.display.nucleus.list = node.copy_list(tex.getbox(\number\scriptraisedminus))
unary_minus.text = node.new(16, 0)
unary_minus.text.nucleus = node.new(32)
unary_minus.text.nucleus.list = node.copy_list(tex.getbox(\number\scriptraisedminus))
unary_minus.script = node.new(16, 0)
unary_minus.script.nucleus = node.new(32)
unary_minus.script.nucleus.list = node.copy_list(tex.getbox(\number\scriptscriptraisedminus))
unary_minus.scriptscript = node.new(16, 0)
unary_minus.scriptscript.nucleus = node.new(32)
unary_minus.scriptscript.nucleus.list = node.copy_list(tex.getbox(\number\scriptscriptraisedminus))

function is_bin_conv_to_ord(v, p)
  if not v or v.id \string~= 16 or v.subtype \string~= 4 then return false end
  if not p then return true end
  if p.id == 16 and ((p.subtype >= 1 and p.subtype <= 6) or p.subtype == 8) then return true end
  local n = v.next
  if q and q.id == 16 and (q.subtype == 5 or q.subtype == 7 or q.subtype == 8) then return true end
  return false
end

function replace_unary_minus(head, displaytype, need_penalties)
  local p = nil
  local v = head
  while v do
    if is_bin_conv_to_ord(v, p) then
      local n = v.nucleus
      if n and n.id == 31 and n.fam == 2 and n.char == 0 then
        node.insert_after(head, v, node.copy(unary_minus))
        head, w = node.remove(head, v)
      end
    end
    p = v
    v = v.next
  end
  return node.mlist_to_hlist(head, displaytype, need_penalties)
end

luatexbase.add_to_callback("mlist_to_hlist", replace_unary_minus, "replace_unary_minus")
\end{luacode}

\begin{document}

$-3 - 4$

\end{document}

output

share|improve this answer
add comment

I'll throw in a few thoughts to answer the part "Is this proper notation for mathematics" of the question. First of all: No, it's not proper. One reason, as others have observed before me: It's just never used, except in school textbooks where they have to distiguish two different keys on the calculator keyboard. So, if you type a manual for a calculator, you can use Philipp's \unaryminus. (And otherwise you shouldn't use it.)

The second reason: Try to use the symbol in handwriting. Will you really manage to write it in a way that it is always clear which of two minus symbols is meant? At least I wouldn't. I think this is one of the reasons why in mathematics there is just this one minus sign.

What I can't answer is why they have two different keys on the calculator. Maybe it was for simplifying the programming in the early days, or it's for didactic reason; I don't know.

share|improve this answer
    
for your second reason, there are differences between em dash and en dash even though those are hard to distinguish when written by hand. –  momeara Apr 3 '12 at 17:08
    
2  
A comment by an anonymous user: "don't know for what reason it was introduced on the TI and other calculators, but as someone who works with low-performing remedial students, I can say that introducing the distinction is a pedagogical nightmare. It actually makes it more difficult for these students to grasp that 3 + -4 is the same as 3 - 4." –  topskip Jun 28 '12 at 9:40
    
(see suggested edit) –  Hendrik Vogt Jun 28 '12 at 9:57
    
For the record, this bit of pedagogy does exist independently of calculators. I learned this notation in secondary school in a year when graphing/programmable/etc calculators existed but were uncommon. (The class was in French, which may or may not be correlated with this notational convention.) –  Niel de Beaudrap Nov 1 '13 at 23:19
show 1 more comment

If latex gives you a binary minus and you want the unary minus (i.e. negative), just add curly braces around the expression, e.g. change -x to {-x}. See post #4 at mathhelpforum

share|improve this answer
2  
This is very helpful for instance in Miller index notation [1 {-1} 1] in crystallography. –  strpeter Dec 30 '13 at 13:00
add comment

I don't see this as a unary operator but more of a typesetting property of negative numerical values. Or as @tohecz pointed out in his comment to another answer

the unary minus is a "part of the numeral"

In light of this, I propose this solution. Which is very elegant if you get to the habit of using \num (from siunitx package) around all your numerical literals:

\documentclass{article}
\usepackage{siunitx}
\sisetup{bracket-negative-numbers, open-bracket={
    {}^-% your custom hack here
}, close-bracket={}}

\begin{document}
\noindent
\num{-1}\\
\num{1}\\
\num{-1e3}\\
\num{1e-3}\\
$\num{-3} - \num{4}$\\
$[\num{1}\,\num{-1}\,\num{1}]

\end{document}

minusnotation

Note: I don't particularly advocate for using {}^-, this seems quite extreme. I didn't want to clutter the answer with more code. Besides I wanted to have a code that works also for superscripts (for the exponent). If know of a short code that can do this elegantly please edit this answer.

share|improve this answer
add comment

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.