# How to force unary minus (negative sign)?

• Jul 29th 2009, 10:37 PM
scorpion007
How to force unary minus (negative sign)?
Sometimes latex treats some code like $-0.4567$ as a binary minus operator and hence adds extra spacing like $3-4$, even though there is nothing to the left of the minus (in an align* environment).

Is it possible to force less space? I know of \! but that doesn't remove as much space as the negation operator. I suppose \! doesn't look too bad though, so it's not a big deal.
• Jul 29th 2009, 10:39 PM
Random Variable
$\text{-}0.4567$ ?
• Jul 29th 2009, 10:41 PM
scorpion007
Yeah, it works in this case, but not in:
Code:

  \begin{align*}   J_1(0.35)  &\approx  0 + (0.35-0)\left[0.497504+(0.35-0.2)\left[ \right.\right. \\     & -0.0371825+(0.35-0.4)\left[\right. \\ % on this line     & -0.05995\left.\right]\left.\right]\left.\right]\\ % and this one     &= {} 0.172331688   \end{align*}
Oh, oops, I didn't see the \text. But that makes the dash smaller than usual in the math env.
• Jul 30th 2009, 12:03 AM
flyingsquirrel
Quote:

Originally Posted by scorpion007
Yeah, it works in this case, but not in:
Code:

  \begin{align*}   J_1(0.35)  &\approx  0 + (0.35-0)\left[0.497504+(0.35-0.2)\left[ \right.\right. \\     & -0.0371825+(0.35-0.4)\left[\right. \\ % on this line     & -0.05995\left.\right]\left.\right]\left.\right]\\ % and this one     &= {} 0.172331688   \end{align*}

To get the unary minus sign type {-0.0371825} instead of -0.0371825.
Code:

  \begin{align*}   J_1(0.35)  &\approx  0 + (0.35-0)\left[0.497504+(0.35-0.2)\left[ \right.\right. \\     & {-0.0371825} + (0.35-0.4)\left[\right. \\ % on this line     & {-0.05995} \left.\right]\left.\right]\left.\right]\\ % and this one     &= {} 0.172331688   \end{align*}
• Jul 30th 2009, 12:45 AM
Opalg
Quote:

Originally Posted by flyingsquirrel
To get the unary minus sign type {-0.0371825} instead of -0.0371825.

Alternatively, type \mathord{-} instead of - .
• Jul 30th 2009, 03:59 AM
scorpion007
Awesome, thanks guys! Strangely though, it messes up the alignment slightly... Oh well.
• Jul 30th 2009, 04:36 AM
Opalg
Quote:

Originally Posted by scorpion007
Strangely though, it messes up the alignment slightly.

Yes, I noticed that. The problem is that the space gets removed on both sides of the minus sign, whereas you only want to lose it on the right. The amount of space that you need to restore is what TeX calls a "thin space", which you can insert by typing backslash comma. So replace -0.05995 by \,{-0.05995} or \,\mathord{-}0.05995 and everything will look good.
• Jul 30th 2009, 05:04 AM
scorpion007
Oh wow! Thanks! You're a genius.