# Fixing LaTeX math commas

If you use different fonts for text and math in your LaTeX documents (not generally recommended, but necessary if your favourite font does not come with mathematics support), you may have found yourself annoyed by having two differently shaped commas, one in text mode and the other in math mode. Here’s a demonstration with Times as the text font and Computer Modern as the math font:

`The vertices $(1,0,0)$, $(0,1,0)$, and $(0,0,1)$\dots`

A simple way of fixing this is to force math mode to use the text font comma. I’ll stick to Times and Computer Modern here, so the first thing is to load Times (CM is there by default, and, obviously, these two fonts can be replaced with any pair of fonts of your liking):

```
\usepackage[T1]{fontenc}
\usepackage{times}
```

Next, we need to declare Times as a symbol font and force math mode to use its comma (note that these need to go in the preamble):

```
\DeclareSymbolFont{mymathcomma}{T1}{ptm}{m}{n}
\DeclareMathSymbol{,}{\mathpunct}{mymathcomma}{`,}
```

The first line declares a font with name `mymathcomma`

with T1 encoding, calling the `ptm`

(Times) font family, medium series (`m`

) and upright shape (`n`

). (If using a font other than Times, see here for how to identify the font family name.) The second line redefines the math mode comma as a mathematics punctuation character and calls for the comma (``,`

) in the previously declared symbol font `mymathcomma`

.

Voilà:

`The vertices $(1,0,0)$, $(0,1,0)$, and $(0,0,1)$\dots`

À propos, fntguide.pdf has a lot of relevant info.