# removing whitespace in math expression

Sometimes, one doesn't want whitespace between tokens of a math expression, and how can one remove the whitespace? For example, $foo-bar$ displays as foo - bar, but foo-bar is prefered.

-
In this short example, the answer is straight-forward: - is interpreted as a binary operator, which has space around it. If you want to avoid such space, use {-}. But if you're using text in this way, why not just write foo-bar outside math mode? –  Werner Oct 18 '13 at 18:03
@Werner: or \mathord{-} –  Francis Oct 18 '13 at 18:09
Is your foo-bar the name of a variable? –  egreg Oct 18 '13 at 20:52

\documentclass[border=12pt]{standalone}
$a-b$ and $a{-}b$ and $a\!-\!b$ and $a\!\!-\!\!b$