# How to number math mode equations?

Is it possible to number equations written in math mode? I tried "" around math mode, but it gives errors.

\documentclass{article}
\usepackage[french,USenglish]{babel}
\usepackage[mmddyyyy]{datetime}
\usepackage{amsmath,amssymb}
\begin{document}

I can number the equations using begin{equation}''.
$$A = \frac{\pi r^2}{2}$$

But, how to number the equations in written using math mode?
$\mathrm{ \frac {P \models Q\stackrel{Y} {\rightleftharpoons} P \mbox{, } P \lhd \langle X \rangle _Y} {P \models Q \rhd X} }$

$\mathrm{ \frac {P \models Q, P \lhd \langle X \rangle _Y} {Q \rhd X} }$

\end{document}


• It's common to refer to displayed math material as “equation” even if it isn't a proper equation with an = sign. Aug 5 '21 at 7:57
• Note that $...$ IS math mode, just unnumbered math mode. Aug 5 '21 at 8:53

I think (but I may be wrong) the gather environment may be what you're looking for. Note that display-style math is in effect inside a gather environment.

\documentclass{article}
\usepackage[french,USenglish]{babel}
\usepackage[mmddyyyy]{datetime}
\usepackage{amsmath,amssymb}
\begin{document}

I can number a single-line equation using an \texttt{equation} environment.
$$A = \frac{\pi r^2}{2}$$

I can number multi-line mathmode material with a \texttt{gather} environment.
\begin{gather}
\mathrm{ \frac {P \models Q\stackrel{Y} \rightleftharpoons P ,\
P \mathrel\lhd \langle X \rangle _Y} {P \models Q
\mathrel\rhd X} } \\[1ex] % "1ex" inserts a bit more vertical whitespace
\mathrm{ \frac {P \models Q,\
P \mathrel\lhd \langle X \rangle _Y} {Q \mathrel\rhd X} }
\end{gather}
\end{document}

• Congratulations for your 400K! It's not common knowledge, but the symbols \lhd and \rhd are binary operations (that is, \mathbin) rather than relations. Why? I really don't know, but it has been so since Lamport provided some additional symbols. In the case at hand, they seem to be used as relations, so something like \mathrel\lhd is needed (and a definition, of course, would be better). Aug 5 '21 at 7:56
• @egreg - Many thanks for the congrats! And many thanks for the suggestion to give \lhd and \rhd status math-rel`, which I've implemented gladly.
– Mico
Aug 5 '21 at 8:43