# Superscripts after fs - spacing

When certain characters in superscripts follow certain letters ("f" at least) they collide. I'm using a numeric superscripted citation style, but the problem is more general that that as the following MWE demonstrates:

\documentclass{article}
\begin{document}
f$^6$ f$^1$ y$^6$

f\,$^6$ f\,$^1$ y\,$^6$
\end{document}


In the first line, all but the first example look right; in the second line even f$^6$ looks rather wide, the other superscripts are floating off into the middle distance. This probably applies to \footnotes (with letters) as well, I just don't happen to have a combination that demonstrates that.

Can it really be right that for certain combinations I have to add a manual correction (\kern0.05em looks about right)? Or is there a more general solution?

-
f\/\textsuperscript{6} –  egreg May 27 '14 at 15:30

## 2 Answers

The font "knows" the adjustment needed here and makes it available as the italic correction \/

\documentclass{article}
\begin{document}
f$^6$ f$^1$ y$^6$

f\textsuperscript6 f\textsuperscript1 y\textsuperscript6

f\/\textsuperscript{6} f\/\textsuperscript{1} y\/\textsuperscript{6}  $\leftarrow$ this one

f\,$^6$ f\,$^1$ y\,$^6$

f\kern0.05em$^6$ f\kern0.05em$^1$ y\kern0.05em$^6$
\end{document}

-
It wouldn't have occurred to me to use an italic correction in this case! So I should be using \/\footnote and \/\supercite throughout? –  Chris H May 27 '14 at 15:47
@ChrisH arguably (and so egreg just argued in chat) that \textsuperscript command ought to have applied italic correction always, but it doesn't, so it needs to be added by the user: always applying \/ (or using your own command that does \/\textsuperscript is probably safe, most of the time, for upright fonts it will not add any space, but for some fonts, especially on f it may... –  David Carlisle May 27 '14 at 15:50

Using f$^6$ is not the best way to cope with this, because it's not math, so

f\textsuperscript{6}


would be a better way. The problem is that the character “f” slightly extends beyond its bounding box. There is a built-in mechanism for coping with this, the italic correction that, despite its name, can come to rescue also for non slanted fonts, which are the ones where the problem presents more often.

Unfortunately, \textsuperscript doesn't add the italic correction, which it should, in my opinion. More unfortunately, patching \textsuperscript is not sufficient for footnotes.

Let's do a test document:

\documentclass{article}

\begin{document}
f\textsuperscript{6} f\textsuperscript{1} y\textsuperscript{6}

f\footnote{A}
f\footnote{B}
f\footnote{C}
f\footnote{D}
f\footnote{E}
f\footnote{F}

\setcounter{footnote}{0}

y\footnote{A}
y\footnote{B}
y\footnote{C}
y\footnote{D}
y\footnote{E}
y\footnote{F}

\end{document}


that outputs

Now we patch \textsuperscript and \footnote; actually a couple of internal macros need to be patched.

\documentclass{article}
\usepackage{etoolbox}

\makeatletter
\pretocmd\@textsuperscript{\/}{}{}
\patchcmd\@footnotemark{\edef}{\/\edef}{}{}
\makeatother

\begin{document}
f\textsuperscript{6} f\textsuperscript{1} y\textsuperscript{6}

f\footnote{A}
f\footnote{B}
f\footnote{C}
f\footnote{D}
f\footnote{E}
f\footnote{F}

\setcounter{footnote}{0}

y\footnote{A}
y\footnote{B}
y\footnote{C}
y\footnote{D}
y\footnote{E}
y\footnote{F}

\end{document}


and we get

You can see that the output with y is unaffected, while it's improved for f, because we essentially add \/ before \textsuperscript and \footnote. If the font is properly designed, the italic correction should compensate the right amount of spacing.

A possible patch for \supercite is

\patchcmd{\mkbibsuperscript}{\unspace}{\unspace\/}{}{}


Example.

\documentclass{article}
\usepackage{biblatex}
\makeatletter
\pretocmd\@textsuperscript{\/}{}{}
\patchcmd\@footnotemark{\edef}{\/\edef}{}{}
\patchcmd{\mkbibsuperscript}{\unspace}{\unspace\/}{}{}
\makeatother

\addbibresource{xampl.bib}

\begin{document}
\nocite{*}

f\supercite{article-full}

\printbibliography
\end{document}


-
That's great, I agree that this feels like it should be internal to the superscripting commands, but I wouldn;t know where to start looking to patch them. I never actually have a need for bare superscripts in text, so forgot about \textsuperscript in reproducing the effect as minimally as possible. –  Chris H May 27 '14 at 18:36