# Period after math-mode equation

If I write

If $x \rightarrow y$, then $y \rightarrow z$.


it looks fine. But if the sentence is more involved and formulas longer, I tend to change $...$ to $...$. In many cases I think the result is ok, especially if there's only one equation in the end of the sentence.

However, in the above example it would be like:

If

x→y

, then

y→z

.

The comma and period doesn't look very nice.

Sure, I could break it up and say If formula (1) holds, then formula (2) holds, but this is usually an overkill in my opinion.

TL;DR: What do you do with periods after sentences ending with a $...$-equation?

-
The question as to whether you should do this or not is ... contentious. Take a look at tex.stackexchange.com/questions/11821/punctuation-in-equations and follow the links. –  Loop Space Oct 27 '11 at 8:54

You insert the period as part of the equation and therefore also in math mode, as opposed to putting it outside the equation.

\documentclass{article}
\begin{document}
If $x\rightarrow y,$ then $y\rightarrow z.$
\end{document}


Naturally, this may lead to a slightly off-center spacing due to the punctuation (albeit marginally visible). However, to correct for this, you can use \phantom{<punct>} on the opposite side:

\documentclass{article}
\begin{document}
If $\phantom{,}x\rightarrow y,$ then $\phantom{.}y\rightarrow z.$
\end{document}

-
Ok, yea, that's obviously an option. You know for sure that this common practice? –  aioobe Oct 27 '11 at 8:00
Since equations (or mathematics in general, whether in-line \textstyle or in \displaystyle) form part of the textual flow, it is my opinion that they can include punctuation. If you want to correct for the possible centered misalignment, see my updated answer. –  Werner Oct 27 '11 at 8:09
Nice update :-) –  aioobe Oct 27 '11 at 8:14

Punctuation in displayed formulas should stay within the formula:

If
$x\to y,$
then
$y\to z.$


Somebody leaves a space before the punctuation (I don't); others completely suppress punctuation in displayed formulas, on the basis that the display is doing the work and the reader can infer commas or periods from the context.

Which style to use is a question of personal taste; the most important thing is to be coherent along the document.

-
+1, nice answer. I like the "reader can infer commas" part :-) (seems slightly nastier to let the reader infer periods though) –  aioobe Oct 27 '11 at 8:06
@aioobe That's why I always use punctuation also in displayed formulas; in rare cases this needs rephrasing in order to avoid ambiguities in formulas, but I prefer to be consistent. In the "no punctuation" style, the presence of a period can be inferred by a following capital letter. –  egreg Oct 27 '11 at 8:09