[Tex/LaTex] Is it always best practice to not include text punctuation in inline math mode

best practiceskerningmath-modepunctuation

It has been pointed out on this site, e.g. here by egreg, that text punctuation doesn't belong to the formula in inline math. I've been following this practice for a long time, so I write for all $v\in V$, where ... as opposed to for all $v\in V,$ where .... However, the first version prevents kerning between V and the comma. Note that the comma is a lot closer to the V in the second version:

output with V

\documentclass{article}
\begin{document}
$v\in V$, where \quad $v\in V,$ where 
\end{document}

Note that there's no difference between the two versions if I replace V with A:

output with A

Now I'm wondering: Should I start including punctuation in my formulas to enable proper kerning, at least as long as fonts are used where the text and math punctuation glyphs look the same? Or are there reasons why the kerning is not desirable anyway?

Best Answer

If you want to maintain the kern but still keep your math expressions logically pure of sentence punctuation, and practically available for use in a document class that uses different text and math fonts, you could add a hand correction after the math, but in practice I'm not sure you'd want to do this:

\documentclass{article}
\def\kn#1#2{{\sbox0{$#1#2$}\sbox2{$#1{}#2$}\kern\dimexpr\wd0-\wd2\relax}#2}
\begin{document}
$v\in V$\kn V, where \quad $v\in V,$ where 
\end{document}

enter image description here

Related Question