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.

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.

share|improve this question
2  
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

1 Answer 1

up vote 3 down vote accepted
\documentclass[border=12pt]{standalone}
\begin{document}
$a-b$ and $a{-}b$ and $a\!-\!b$ and $a\!\!-\!\!b$
\end{document}

enter image description here

share|improve this answer

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.