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.

Math mode adds extra horizontal space after superscripts. I have listed various options for removing it in the MWE. I would like to know if there is any recommended way of doing this in amsmath.

I am thinking of using \negthickspace for now. However, I am interested to know if that looks too tight for a professional typographer. As my thesis has a lot of superscripts, this small decision is going to make a lot of difference in the look and feel of the whole document.

enter image description here

MWE:

\documentclass[preview]{standalone}
\usepackage{amsmath}

\begin{document}
  %\noindent
  $R(u,x) = R(u^{*},x)$

  $R(u,x) = R(u^{*}\!,x)$

  $R(u,x) = R(u^{*}\negmedspace,x)$

  $R(u,x) = R(u^{*}\negthickspace,x)$

  $R(u,x) = R(u^{*}\!\!,x)$
\end{document}

EDIT: The default behaviour of latex looks more reasonable when you write $u^{*}\negmedspace \Sigma &= R(u^{*}\negmedspace,\Sigma)$ which yields

enter image description here

So if a global macro is to be written to introduce this negative spacing then it has to take into account the character that comes after the superscript. I don't know if this is possible or advisable.

share|improve this question
1  
IMHO I believe that the best option is the standard one, that is, don't use extra spaces. Let TeX does the job for you. –  Sigur Dec 26 '12 at 11:12
    
Personally, I think the version with \! looks best. –  Hendrik Vogt Mar 6 '13 at 8:55

1 Answer 1

up vote 15 down vote accepted

The next example only adds some boxes to make the spacing more visible:

\documentclass{article}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\begin{document}
$\fbox{$\fbox{$u$}^{\fbox{$\scriptstyle*$}}$}\mathpunct{\fbox{$,$}}\fbox{$x$}$
\end{document}

Boxes

The spacing between the superscript * and the comma , has three causes:

  • TeX adds \scriptspace after super- and subscripts. Default is 0.5pt in LaTeX and plain TeX. It is the space between the box around * and the surrounding box.
  • Inside the boxes for * and , there is some horizontal padding, called side bearings. It is a font property and not accessible in TeX.
  • The superscript and the comma have quite a large vertical distance, thus there is no need to have much horizontal space to avoid the glyphs to get too close. It looks indeed better, if the comma is moved leftwards.

However, caution is needed for the negative spacing, LaTeX defines (pseudo code):

\! = \mskip-\thinmuskip
\thinmuskip = 3mu
\medmuskip = 4mu plus 2mu minus 4mu
\thickmuskip = 5mu plus 5mu

and package amsmath adds (pseudo code):

\negmedspace = -\medmuskip
\negthickspace = -\thickmuskip

\thinmuskip and therefore \! are not using stretchability. However, the others are. Then the spacing can become quite ugly, if stretching/shrinking is applied. The negative sign causes the opposite effect making the spacing worse:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \hbox{$u^*\negmedspace,x+y$}
  \hbox spread -5pt{$u^*\negmedspace,x+y$}
  \hbox spread 5pt{$u^*\negmedspace,x+y$}
\end{document}

Streching/shrinking

For this, \! can be used. However, \negthickspace and \negmedspace should be avoided, they cancel the effect of \thickmuskip and \thinmuskip. \negthickspace and \negmedspace

The following macros \negmed and \negthick add a negative space in math mode using the values from \medmuskip and \thickmuskip without the stretch and shrink components:

\def\negstrip#1 #2\relax{-#1}
\newcommand*{\negmed}{%
  \mkern-\medmuskip
}
\newcommand*{\negthick}{%
  \mkern-\thickmuskip
}

The question, how much negative spacing could be used is also partly a matter of taste. I tend to something inbetween \! and \negmed, perhaps \mkern-3.5mu\relax.

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.