Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
4  
Good question (not sure if it has a good answer though) –  David Carlisle Mar 5 '13 at 20:28
    
A slightly related discussion was on chat some time ago if a word starts with capital A and then a vertical character follows. It certainly looks odd but I guess one can live with that. chat.stackexchange.com/transcript/message/7786643#7786643 –  percusse Mar 5 '13 at 20:29
    
To preserve the font of the , while fixing the distance, also $v\in V\!$, could be used here, while other combination of a letter and some punctuation might require a different negative horizontal space. –  Stephen Mar 5 '13 at 20:39
    
@percusse: There it seems to be a decision (or slackness?) of the font designer, i.e. DEK: the A bsence could be mollified in the kerning table :-) –  Hendrik Vogt Mar 5 '13 at 20:48
    
Kerning is off if you use an accent. Cmp. $v\in V,$ where \ldots, but $v \in \tilde{V},$ where \ldots. –  deimi Mar 6 '13 at 10:01
show 1 more comment

1 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

share|improve this answer
    
Thanks for the workaround. But indeed, this impairs the readability of the code so much that I'd use it only if the text and math commas differ too much. Would you personally prefer to maintain the kern if there was an easy solution that is "logically pure"? –  Hendrik Vogt Mar 5 '13 at 20:53
    
I can't believe I'd do that if writing the code by hand (I'd probably put the comma outside and just not worry) If I was generating the tex from something else, I might do it though... –  David Carlisle Mar 5 '13 at 21:28
    
Sorry, I don't quite get what you mean. Maybe my previous comment was unclear. What I meant is this: would you deem it good if just typing $v\in V$, where would yield the tighter kerning? –  Hendrik Vogt Mar 5 '13 at 21:32
1  
yes I think it looks better but since TeX doesn't do that I probably wouldn't risk breaking everything trying to insert some automatic xspace style lookahead with \everymath. I'd either just live without the kern or genarate the tex with the correction applied where necessary. Not so much worse than having to add \/ sometimes/ –  David Carlisle Mar 5 '13 at 21:51
    
Thanks a lot for the detailed comment! –  Hendrik Vogt Mar 5 '13 at 21:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.