37

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?

30

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}
  • 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.) – Hendrik Vogt Jan 16 '11 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. – Hendrik Vogt Jan 16 '11 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? – Yiannis Lazarides Jan 16 '11 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). – Philippe Goutet Jan 16 '11 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. – Hendrik Vogt Jan 17 '11 at 9:11
23

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.

14

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
    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. – Blaisorblade Jul 22 '17 at 5:13
12

\! 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 \!.

  • 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 Apr 20 '17 at 19:11
  • @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/… – Blaisorblade Jul 22 '17 at 5:15
  • What exactly does "with the best value" mean and how is it determined? – Geoff Pointer Sep 4 '17 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.