Getting a citation on the same line as an equation, in theorem environment

Just wondered if anyone could help me with this issue. I'm trying to reference a theorem using \cite{ref}, but the theorem finishes with an equation, so the citation move onto the next line. This is the code I have:

\begin{thm}[Euler's Formula]
Let $G$ be any planar graph which contains $v$ vertices, $e$ edges and $f$ faces of $G$. Then,
$$v-e+f=2.$$
\cite{ref}
\end{thm}

• welcome to tex.sx. if you're using amsmath, you could try this: $v-e+f=2. \qquad \text{\cite{ref}}$ – barbara beeton Mar 19 '16 at 21:27
• Are you trying to create a cross-reference to a theorem that's been set up elsewhere in the document? If that's the case, you should use \ref{ref} rather than \cite{ref}. – Mico Mar 19 '16 at 21:28

if you're using amsmath, you could try this:
$v-e+f=2. \qquad \text{\cite{ref}}$

Why is $…$ preferable to $$? What are good learning resources for a LaTeX beginner? • It seems \text isn't even necessary. This is one more example why one should not use $$ … , b.t.w. – Bernard Mar 19 '16 at 21:48