What is going on with kerning when comparing math italics to italics?

The following minimal example

\documentclass{article}
\showoutput
\begin{document}
$AUC$
\textit{AUC}
\end{document}

produces in the .log some detail about the typesetting of the elements:

....\mathon
....\OML/cmm/m/it/10 A
....\OML/cmm/m/it/10 U
....\kern1.09026
....\OML/cmm/m/it/10 C
....\kern0.71527
....\mathoff
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/it/10 A
....\kern-0.25557
....\OT1/cmr/m/it/10 U
....\OT1/cmr/m/it/10 C
....\kern 1.45276
....\penalty 10000

Note how the construction of AUC in the first \mathon...\mathoff section comes from a different font cmm and that \kerns (spaces) are inserted after U and C. In comparison, a \kern is inserted after A and C in the second non-math component (also set in a different font cmr).

Here the take on the setting of the elements are that in math mode, adjacent elements are typically considered variables that are multiplied, while in text mode they represent something completely different. Perhaps a better example that exacerbates the spacing differences comes from using letters that form ligatures in text mode:

enter image description here

\documentclass{article}
\showoutput
\begin{document}
$off$
\textit{off}
\end{document}

\showoutput highlights this:

....\mathon
....\OML/cmm/m/it/10 o
....\OML/cmm/m/it/10 f
....\kern1.0764
....\OML/cmm/m/it/10 f
....\kern1.0764
....\mathoff
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/it/10 o
....\OT1/cmr/m/it/10  (ligature ff)
....\kern 2.11945
....\penalty 10000

Your first AUC in math mode means A multiplied by U multiplied by C. Hence not only there is no kerning as in the words, but also all spaces (you have not got them here, but you can try) are ignored. It is not a bug, it is a feature, so the user should remember of proper inserting (via \mathit or \textit) words in math mode.


The letters used in $AUC$ are from the cmmi family. They are slightly wider than than the same letters in cmti (text italic), but they have slightly smaller sidebearings. In math mode an italic correction is added after each letter. For A this is zero, and the one after C is not apparent unless something follows it or one uses \showoutput to exhibit it. The italic correction is the sole means of avoiding collisions between charaters in math. You would absolutely need this correction after U in something like $|U|$, but TeX doesn't check if the next symbol is slanted or upright, it just always adds the correction.

The math alphabet font cmmi, like most math fonts, has almost no kern or ligature information. Text fonts like cmti have a lot of such information and it is used to insert a positive kern beween A and U. You can get text italic to look a lot like math italic if you manually insert italic corrections: \textit{A\/U\/C\/}.

In text, it is expected that letters that immediately follow one another belong to the same word and the kerning information is intended to make them blend harmoniously. In math, there is typically no connection between adjacent letters and it would be misleading to try to make it look that way. If a sequence of letters in math is used to make up a single variable then one uses \mathit{AUC}, which just uses the same font as \textit{AUC} and uses all the kerning information in that font.

So the large space between U and C in math and the small one between A and U are not really intentional, but rather just not considered important enough to justify a more elaborate system.