[Tex/LaTex] Kerning of subscripts

kerninglatin-modernsubscriptsxetex

I have a large document that's full of subscripted variables that represent points and vectors. I want to typeset the points and vectors upright and bold. I'm using Unicode Math with Latin Modern, and typesetting using XeLaTeX. I get results like this:

uglymess

I was hoping for much better kerning of the subscript n on my letter \mathbf{P}.
I realize that I can correct each occurrence individually, but that doesn't really seem like the right approach.

My bold \mathbf{P} is actually defined by a macro, so my next attempt was to put the correction in this macro. But that didn't work because the correction is only needed when the \mathbf{P} is followed by a subscript.

I'm wondering if I have a somehow corrupted version of Latin Modern Math, because the subscript kerning isn't working properly in Microsoft Word, either. The kerning does work if I use the Cambria font in MS Word.

Here is a sample document:

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}

\def\A {\mathbf{A}}
\def\P {\mathbf{P}}

\begin{document}
\[  \P(x) = \P_n + \A^n  \]
\end{document}

Can I fix this problem without editing thousands of formulae individually?

My Solution (For Now)

It seems that the best I can do for now is something like:

\def\Ps #1{\P_{ \mkern-3.5mu  {#1}}}
...
\[  \P(x) = \Ps{1} + \Ps{2} + \cdots + \Ps{n}  \]

This gives results that look good, to me:

better

And it's easy to remove this hack if/when the Latin Modern fonts get fixed.

Best Answer

The \mathbf alphabet of Latin Modern Math (the version shipped with TeX Live 2013) does not have any provisions for correctly positioning super or subscripts, neither italic correction (the old TeX way, still supported in OpenType math) or math cut-ins (the new, more versatile way). So this is a font issue and the most straightforward way to fix it, apart from using a different font, is to fix the font itself.