I know the question of punctuation at the end of displayed equations has been discussed many times in here (see e.g. here). However, as far as I see, one of the elephants in the room has never really been properly addressed: Suppose I type the following:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Consider the Pythagorean identity
\begin{equation}
c^2 = a^2 + b^2,
\end{equation}
and let us try to generalize it to non-right triangles.
\end{document}
Then the comma at the end of the equation will be taken from the math font, not the text font from which all the inline commas in the document will be taken. Depending on your font settings, these two commas may look quite different.
Furthermore, suppose that this takes place inside a theorem environment:
\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
Consider the Pythagorean identity
\begin{equation}
c^2 = a^2 + b^2,
\end{equation}
and let us try to generalize it to non-right triangles.
\begin{theorem}
If ( \gamma )~denotes the angle of the triangle, we have
\begin{equation}
c^2 = a^2 + b^2 - 2ab \cos(\gamma),
\end{equation}
which generalizes the usual Pythagorean identity.
\end{theorem}
\end{document}
See, the first comma is italic and the second is not! Is that really the way it’s supposed to be? Shouldn’t I be using \text{,} consistently in displayed math?
In other words, would the following not be the better solution?
\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
Consider the Pythagorean identity
\begin{equation}
c^2 = a^2 + b^2 \text{,}
\end{equation}
and let us try to generalize it to non-right triangles.
\begin{theorem}
If ( \gamma )~denotes the angle of the triangle, we have
\begin{equation}
c^2 = a^2 + b^2 - 2ab \cos(\gamma)
\text{,}
\end{equation}
which generalizes the usual Pythagorean identity.
\end{theorem}
\end{document}


\textif you must, but personally I'd avoid trailing punctuation in display math and omit the comma. – David Carlisle Apr 25 '23 at 08:43\textas well, I guess most people don't and I am just nitpicking, but I can't help it. – user242429 Apr 25 '23 at 10:01where .... I was also taught that commas are overused in normal text. – John Kormylo Apr 25 '23 at 12:37