[Tex/LaTex] Finishing math with a period

best practicesmath-modepunctuation

I am new to this site and couldn't find this question after a quick search but it may have been asked before.

This is possibly the most inconsequential issue one can have, but it has been bothering me for months.

When I finish a line of math (especially with the double $$), I often end with a period. I also usually use the \text command to distinguish the period from a decimal point.

My question is: is there any difference at all? I don't seriously think anyone would ever notice unless they looked at the TeX code, so this is more of a theoretical question.


Which one is "correct"?

$$|f(x)-(y)|<\epsilon\text{.}$$

or

$$|f(x)-(y)|<\epsilon.$$

Best Answer

Since you mention \text, you're using LaTeX or AMS-TeX. I'll assume LaTeX.

First of all, your formulas are incorrect because they have $$ (see Why is \[ ... \] preferable to $$ ... $$?). This settled, let's look at fontmath.ltx, where we find, for the common punctuation one can find at the end of a formula,

\DeclareMathSymbol{,}{\mathpunct}{letters}{"3B}
\DeclareMathSymbol{.}{\mathord}{letters}{"3A}
\DeclareMathSymbol{;}{\mathpunct}{operators}{"3B}

As you see, the comma and the period are taken from the math letters font; the semicolon, instead, comes from the main text font (upright).

So, yes, in principle there is a difference. With \text{.} you get the period from the font that was current when the formula started, so it will be from the italic font in the statement of a theorem (under normal settings) and the same for the comma.

On the other hand, an italic period is not easy to distinguish from an upright one. Here's a comparison, first the punctuation sign in text mode (upright or italic), then in math mode:

enter image description here

I'd use the math mode ones, particularly for the semicolon. With other fonts the differences might be bigger, but I'd always go for upright notwithstanding the context.

As Guho rightly observes in comments, with \text you also lose the kerning between the last symbol and the punctuation; try a formula my students so often forget :-(

\[
\dim\operatorname{im} f+\dim\ker f=\dim V.
\]

and

\[
\dim\operatorname{im} f+\dim\ker f=\dim V\text{.}
\]

Kerning differences

People might argue whether the first is better than the second ad infinitum, though. The kerning in the first case is the reason why Knuth decided to take the period and the comma from the math letters font.

In case you fear a period or comma can be ambiguously seen as part of the formula, use a thin space before it, like \,. I wouldn't use more this space, but it's personal preferences. Somebody likes to separate punctuation with a quad (I heartily disagree).


If you're using AMS-TeX, the situation is fully similar, because the math symbol setting is the same as in plain TeX, which has

\mathcode`\,="613B
\mathcode`\.="013A
\mathcode`\;="603B

which comes to the same choice of math fonts.