[Tex/LaTex] Period after math-mode equation

equationsmath-modepunctuation

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?

Best Answer

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

enter image description here

\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}