# mathptmx gives me commas in the wrong font

When I use mathptmx, it gives me commas in computer modern not times roman. Anyone know how to fix this anomaly?

Compile this to see the difference:

\documentclass{article}
\usepackage{mathptmx}
\begin{document}
\textit{a}$a$ (the \textit{a}'s are the same, hurray)
,$,$ (the commas are different, grumble)
\end{document}

-

The font used by mathptmx is a virtual font made up of times letters and assorted symbols from other fonts. The designers chose to take the comma from the cm font rather than the font used for letters.

So if you want a different choice the correct place to change that is in the fontinst files that set up the virtual font. But that's a bit of a black art so an alternative is to give , a definition in TeX to pick up text mode comma. If you need this to get smaller in subscripts load amsmath as well which will redefine \textrm.

\documentclass{article}
\usepackage{mathptmx}
\mathcode,"8000

\begingroup
\lccode\~\,\lowercase{\endgroup
\def~{\mathpunct{\textrm{,}}}}
\begin{document}
\showoutput
\textit{a}$a$ (the \textit{a}'s are the same, hurray)
,$,$ (the commas are different, grumble)
\end{document}

-
David, that works perfectly. Many thanks. Daniel –  Daniel Apr 11 '12 at 6:05
The same question arises again for parentheses. The "(" and ")" that math mode uses are different from the main text font. I had a few goes at tweaking your code in the obvious ways. No luck. How can I make latex use the text mode parentheses? Thanks. –  Daniel Apr 13 '12 at 7:44
Well parenthesis are more difficult. If you just want normal sized parenthesis you could just do as above (I could fill in the details) but if you want \left(...\right)` to stretch then you need the parens to come from a proper math font with all the right magic built in to the font to allow resizing of delimiters. So I guess the designers of mathptmx picked the best freely available math font that they could find to go with times, for the stretchy delimiters, and then made the punctuation come from the same font for consistency. –  David Carlisle Apr 13 '12 at 8:30
You are pushing to the limits of what is possible without using a real new designed font. stix or mathtime for example are complete math fonts designed to match times. –  David Carlisle Apr 13 '12 at 8:30
Aha, I didn't know about stix and mathtime. I'll check them out. I wouldn't mind using stretchy delimiters from another font. The ugliness I'm trying to avoid is what results when a formula is bracketed in main text: "$)$)". With stretchy delimiters the contrast wouldn't be as acute. –  Daniel Apr 13 '12 at 8:54