# Spacing before punctuation in displayed equations

What is the correct spacing before punctuation in a displayed equation? I have the habit of writing

Let
$$y = f(x) \,,$$
where
$$x = 3 \,.$$


with a thinspace (\,) before the punctuation. In an answer to another question it was mentioned that this is not correct mathematical typesetting. So what would be the correct spacing?

-
A displayed equation like that surely doesn't need a full stop? Inline maths is a different matter... –  Seamus Jan 2 '11 at 23:10
I have experimented with omitting punctuation at the end of displayed equations only to have irate readers complain about it. Now I put it in, without any spaces. This is usually not a problem, except in equations that end with fractions, where the punctuation looks like it belongs in the denominator. A little extra space may be called for in those cases. –  Harald Hanche-Olsen Jan 2 '11 at 23:25
@Seamus: the equation by itself doesn't need any punctuation, but the equation would usually be part of a surrounding text. I'll add some nonsense text to the example to make it more clear. –  Olof Jan 2 '11 at 23:32
unless there is a particularly nasty artifact (due to fractions or the like), just put the punctuation right after the formula without inserting any space. –  Arturo Magidin Jan 3 '11 at 0:02

[The following is more ‘FYI’ than a real answer.]

I agree with other commenters that the space depends on house style (I hope there's little argument that the punctuation is usually desirable).

The breqn package allows the space before equation punctuation to be configurable. With this package (which is compatible with amsmath), you write

\begin{dmath}
y=f(x)
\end{dmath},
where
\begin{dmath}
x=3
\end{dmath}.


Note the equation punctuation in the source is placed after the environments close. When typeset, the punctuation is moved inside the equation, and the space inserted before it is defined by default to be a \thinspace; it can be changed by redefining

\newcommand\eqpunct[1]{\thinspace#1}


I prefer this small space as opposed to setting the punctuation naturally to emphasise that the punctuation is definitely not part of the mathematical expression. Note you could even remove all equation punctuation entirely (which might be appropriate, say, for seminar slides) by writing

\renewcommand\eqpunct[1]{}


and this wouldn't require changing any of the source of your mathematics.

-
Neat. That's a good idea and it makes better semantic sense. –  TH. Jan 3 '11 at 2:44
Nice, I didn't know about that feature of breqn. –  Olof Jan 10 '11 at 23:29

The correct spacing is simply,

Let
$$y=f(x),$$
where
$$x=3.$$


Some publishers may have a house style that requires some space, but that's up to them.

-
Many of my equations seem to end either in a fraction or with a subscript and then that looks a bit too tight. I also think I prefer a more even spacing, with the same space after all equations. –  Olof Jan 10 '11 at 23:28