I'm trying to customize beamer theorems, putting theorem name and theorem body in the same box. But my customization causes extra space below theorems.
A MWE is as follows:
\documentclass{beamer}
\newtheorem{thm}{Theorem}
\begin{document}
\begin{frame}
\begin{thm}Text$$Math$$\end{thm}
\hrule Text
\setbeamertemplate{theorem begin}{\bfseries\inserttheoremname\quad\normalfont}
\setbeamertemplate{theorem end}{}
\begin{thm}Text$$Math$$\end{thm}
\hrule Text
\end{frame}
\end{document}

How could I remove extra space below my customized theorems?
