48

I have noticed that I hardly ever use the \negthinspace command \!. This is because I don't know how to use it properly (I do use other spacing commands quite a bit, because I can better understand the guidelines of when they might be useful). When might it be considered appropriate to use this spacing command?

5 Answers 5

40

Knuth in the TeXbook described the following spacing commands:

\, thin space (normally 1/6 of a quad);
\> medium space (normally 2/9 of a quad);
\; thick space (normally 5/18 of a quad);
\! negative thin space (normally 1/6 of a quad).

They are normally used in equations if you want to adjust the spacing slightly:

$x^2\!/2$
$\Gamma_{\!2}+\Delta^{\!2}$

Also when physical units appear in a formula, they should be set in roman type and separated from the preceding material by a thin space (the package "siunitx" does that). Other cases is after the factorial (!) etc.

The TeXbook definition is shown below:

\def\,{\mskip\thinmuskip} \def\!{\mskip-\thinmuskip}
5
  • Your last sentence is rather misleading. And you don't want to add a touch of space. Please be more careful in your answers :-) (And the new paragraph in your edit is only about \,, which wasn't asked for.) Commented Jan 16, 2011 at 20:50
  • By the way, I'd have given +1 if the only example had been $x^2\!/2$; this is also an example Knuth gave somewhere. Commented Jan 16, 2011 at 21:06
  • @Hendrik I made some adjustments to the answer. I would normally add a bit more on a post rather than stick to a point. We seem to disagree on this one. So be it! Why do you disagree with the second equation?
    – yannisl
    Commented Jan 16, 2011 at 21:10
  • 3
    @Hendrik: both examples Yiannis gave are from the TeXbook (page 169). Other common examples are \mathbb{F}_{\!p} and \mathbb{A}^{\!n} (of course, I would avoid typing \! often in my source code and wrap everything in macros). The need to use \! for some subscripts is because of an incorrect italic correction for the glyph in the TFM file (this is the case for \Gamma, \mathrm{F}, \mathbb{F} and others) while for superscript it is due to an unfortunate limitation of TeX (lifted in Opentype font, thankfully). Commented Jan 16, 2011 at 22:49
  • 1
    @Philippe, @Yiannis: Sorry, I was really to short in my second comment. I meant the examples for using \, which come a bit out of nowhere. Commented Jan 17, 2011 at 9:11
32

I often use \! in exponents after big closing parentheses:

\documentclass{minimal}
\begin{document}
\[
  \left( 1 + \frac{1}{n} \right)^{n} \quad
  \left( 1 + \frac{1}{n} \right)^{\!n}
\]
\end{document}

For me, the "n" is too far away from the parenthesis in the first version.

16

\! is a convenient abbreviation for a small negative space. Specifically, it's a negative \thinmuskip, which would normally be -.16667em. Though \thinmuskip might be redefined.

\! is often used for fine-tuning math formulas. But when does it happen, that \thinmuskip perfectly fits for the negative correction?

Though \! is easy to write, I tend to use \kern (or \hspace) with the best value instead of relying on -\thinmuskip coincidentally matching perfectly. So I can understand that you hardly ever use \!.

3
  • 1
    Is a \thinmuskip really measured in terms of em? Page 168 of the TeXbook claims that \thinmuskip = 3mu, \medmuskip = 4mu plus 2mu minus 4mu and \thickmuskip = 5mu plus 5mu---at least in Plain TeX.
    – David R
    Commented Apr 20, 2017 at 19:11
  • 1
    @DavidRobertson 1mu is 1/18em (of one of the active fonts, fam2, not sure what that means), so in that sense the answer is mostly right. tex.stackexchange.com/questions/41913/… Commented Jul 22, 2017 at 5:15
  • What exactly does "with the best value" mean and how is it determined? Commented Sep 4, 2017 at 4:50
15

Here are a few more examples of use of negatives spaces in math formulas (I’m not limiting myself to \! because, as Stephan mentioned in his answer, it’s not always the right amount). The choice of the amount of negative spacing is not absolute, and depends on both the font and whether it seems good to your eye:

alt text

1
  • 2
    Let me emphasize that (IIUC) one should stick if possible to math units mu (as you do) for space adjustments in a math context, to make code more robust in the face of font changes. But I've seen answers elsewhere using points or other units, so maybe I'm missing something. Commented Jul 22, 2017 at 5:13
2

Another use I have for \! is if I'm writing larger numbers in math mode where I need to use the comma separator. Since math mode treats comma as though it's used in text, it automatically adds a space. \! removes that space. Compare, for instance:

from $7,000$

and

from $7,\!000$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .