# Where does the extra space come from after a capital P in math mode?

I’ve noticed that when a capital P appears in juxtaposition with another variable in math mode, an extra space is automatically inserted. This appears to happens in both plain TeX and in LaTeX. Here’s a plain TeX document that illustrates what I mean:

Surprisingly, $ABC$ behaves differently from $PQR$.
\bye


It isn’t immediately obvious from the rendered output that there is any difference between $ABC$ and $PQR$ (aside from the different letters, of course):

But if one selects the sentence in a PDF viewer, copies it, and pastes it as plain text, a small discrepancy appears:

Surprisingly, ABC behaves differently from P QR.


Note the extra space after the P! Where does it come from, and why is it there? It only shows up in math mode: {\it PQR} in text mode does not result in any additional space. I skimmed Chapter 18 of the TeXbook, “Fine Points of Mathematics Typing”, but did not see anything that would explain this phenomenon, though it’s possible I missed something.

Getting cut and paste from PDF tex is surprisingly difficult, essentially PDF just places characters by coordinate so the PDF reader when supplying text via cutting a selection has to guess where the words start. If you modify your input to

\tracingoutput1
\tracingonline1

Surprisingly, $ABC$ behaves differently from $PQR$.
\bye


You will see ABC is

...\mathon
...\teni A
...\teni B
...\kern0.50172
...\teni C
...\kern0.71527
...\mathoff


With some small kerns but PQR is

...\mathon
...\teni P
...\kern1.3889
...\teni Q
...\teni R
...\kern0.07726
...\mathoff


with a relatively large 1.4pt kern after the P. In comparison the word space after behaves is

...\tenrm e
...\tenrm s
...\glue 3.33333 plus 1.66666 minus 1.11111
...\tenrm d


so 3.3pt but in a tight line where the interword spaces make use of the minus component it may be only 2.2pt.

So some PDF readers may see the kern after P as a word space.

• Aha—I should have tried tracingoutput myself. But admittedly this does not quite answer my real question, which is where that kern comes from in the first place. In particular, I went down this line of investigation because I noticed that the kerning for $PQR$ still looks decent even when using LuaTeX with unicode-math and Latin Modern, and I don’t see any special kern pairs defined for 𝑃 in the Latin Modern OTF file. But that is a rather different question altogether, so I will ask it separately if I can’t figure out the rest on my own from here. Thanks! Commented Dec 12, 2021 at 10:22
• @AlexisKing it's the same italic correction, with unicode-math I see ....\TU/latinmodern-math.otf(1)/m/n/10 𝑃 ....\kern1.4 (italic) ....\TU/latinmodern-math.otf(1)/m/n/10 𝑄  Commented Dec 12, 2021 at 10:27
• Yes, that makes sense… upon a closer reading, I had not interpreted Rule 17 in Appendix G quite right. It says “If the symbol was not marked by Rule 14 above as a text symbol, or if \fontdimen parameter number 2 of its font is zero, set δ to the italic correction”, and Rule 14 does apply here, but I had overlooked the crucial bit about \fontdimen parameter number 2. So that answers the rest of my question—thanks again! Commented Dec 12, 2021 at 10:49