[Tex/LaTex] Kerning between $\uptau$ and subscript

kerningmath-mode

I'm trying to get a $\uptau$ with a right-hook at the bottom:

\documentclass{article}
\usepackage{upgreek}
\begin{document}
   $\tau_X$
   $\uptau_X$
\end{document}

Unfortunately, there doesn't seem to be any kerning the $\uptau$ and a following subscript:

enter image description here

Wondering if there is a simple solution, or do users simply tolerate this.

Best Answer

It may perhaps be surprising, but TeX makes no provision at “machine-level” for inserting a negative kern before a subscript if the letter being subscripted has a shape that would make it recommendable: such a kern must be inserted manually, for example as

\tau_{\!X}

where the \! command inserts a negative thin space. More generally, you could say something like

\tau_{\mkern -4mu X}

and experiment until you find the correct value to place after \mkern.

Note, however, the difference between the two constructions

\tau_{\!X}

and

\tau\!_{X}

They differ in two ways: first, a “thin space” corresponds to two different absolute amounts in “text size” (latter alternative) and in “script size” (former one); second, in the first case the subscript is actually appended to the character “tau”, but in the second case it becomes the subscript of an atom whose nucleus is empty. Although the output that the two idioms yield may look almost the same at first sight, a closer glance will reveal it is not quite so.

Here is a minimal compilable example; if you uncomment the two \showlists commands, some tracing information will be displayed on your terminal that proves what we have just said.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{upgreek}

\showboxbreadth = 1000
\showboxdepth = 10
\tracingonline = 1



\begin{document}

Note that
\(
    \tau_{\!X},\uptau_{\!X} \ne \tau\!_{X},\uptau\!_{X}
    % \showlists
\).
% \showlists

Alternative: \( \tau_{\mkern -4mu X}, \uptau_{\mkern -3.5mu X} \).

\end{document}

And here is magnified view of the significant portion of the output:

Output of the code

Edit

The statement that “TeX makes no provision… for inserting a negative kern before a subscript” could be questioned, because, for example, $P_{x}^{2}$ and $Q_{x}^{2}$ yield different results, so let me clarify exactly what I mean here. As The TeXbook says, “a subscript will be ‘tucked in’ slightly when it follows certain letters” (bottom of p. 129); the point is that the amount of this “tucking in” depends only on the symbol being subscripted, and not on the subscript, whereas the amount of kerning between two characters is a function of both of them. Indeed, given an atom with a non-empty subscript and whose nucleus is simply a charcter, the horizontal placement the subscript is governed by the italic correction of that character; in a font intended for typesetting math, the italic correction of characters is actually used only for this purpose.