# CM fonts kerning in math superscripts

Using CM fonts with either a traditional engine or XeTeX, an expression such as $D^rf$ produces too much space between the r and the f in the output. It's easy to fix manually by inserting a \!. Is there a systematic way to do this? (I know the issue is the rectangularity of the bounding boxes used for kerning, and perhaps an automatic extra scriptstyle space specified after every superscript.) Other similar expressions with the same problem are $T^kM$, $J^{\ell}g$, etc. I find the kerning of the subscripts good enough. In particular $D^r_xf$ looks OK, although the subscript x could nestle better against the D.

Example

\documentclass[11pt]{amsart}
\begin{document}
$D^rf$  has too much space although $D_xf$ and $D^r_xf$ are OK.
\end{document}


• Please post a small document we can compile to see the issue. There are different ways to use the fonts with XeLaTeX and we have no idea which you are using. I am assuming to are referring to inline maths, hence the dollar signs, but it would all be a lot clearer with a minimal working example (MWE). – cfr Apr 16 '15 at 22:54
• I don't see any difference between this and the output when pdfLaTeX is used. Do you get something different with XeLaTeX? Is kerning used in maths mode? – cfr Apr 17 '15 at 1:04
• That's correct. No difference for pdflatex. The same issue occurs: the space between D^r and f is too big. Does your question "is kerning used in maths mode" imply that I need to make some declaration in order for kerning in math mode to occur with the CM fonts? – Charles Pugh Apr 17 '15 at 20:01
• If the problem is not specific to XeTeX, why have you asked the question this way? The way it is asked now, I assumed you thought the output different with XeTeX. – cfr Apr 17 '15 at 21:29
• The simple answer, alas, is that there's no ready-made and automatic way to "fix" the spacing issues you've identified. As DEK notes in the TeXbook, there will always be combinations of letters and/or symbols for which TeX's math-mode spacing rules can be improved by some further tweaking. Your posting identifies a handful of such combinations. – Mico Apr 18 '15 at 3:20

Your posting identifies a handful of combinations involving terms in the superscript position whose look can be improved with judicious tweaking. \Gamma_n and P_q are examples of expressions with terms in the subscript position that look better if some tweaking is applied, i.e., if they're written as $\Gamma_{\!n}$ and $P_{\!q}$, respectively.
• The output of $\int\!\!\int$ looks a lot better than that of $\int\int$, and
• the output of $\displaystyle\int\!\!\!\int$ looks much better than that of $\displaystyle\int\int$.
(Aside: the amsmath package offers the macro \iint, to free users from having to remember to insert those repeated negative thinspaces.)