# No break line after theorem name in beamer

I have applied the answer of question Theorem content right after theorem name in beamer to my question. I put \normalfont after \inserttheorempunctuation but the result is unexpected. Could you please see the image 1.

            \documentclass[envcountsect]{beamer}
\usetheme{CambridgeUS}
\usefonttheme{serif}
\makeatletter
\setbeamertemplate{theorem begin}
{%
\begin{\inserttheoremblockenv}
{%
\inserttheoremname
\inserttheoremnumber
\inserttheorempunctuation
\normalfont
}
}
\setbeamertemplate{theorem end}{\end{\inserttheoremblockenv}}
\makeatother

\begin{document}
\section{ABC}
\begin{frame}
\begin{theorem}[ABC]
This is a theorem
\end{theorem}
\end{frame}
\end{document}


The result is:

I would like to put the content right after Theorem (no break line). It looks like this

• This is the same question as tex.stackexchange.com/questions/203483/…, which have been deleted by the OP some minutes ago.
– user31729
Sep 28 '14 at 6:00
• I just posted again my question. This question is not duplicate with tex.stackexchange.com/questions/33171/…. I think that everybody can see it and help me. Sep 28 '14 at 6:04
• Of course we see -- I don't think, that reposting it again will prevent it from being marked as duplicate again.
– user31729
Sep 28 '14 at 6:06
• The other question was closed since there is already a solution to your question which can be found here: tex.stackexchange.com/questions/33171/…. If this solution does not fit your needs, please clearify why this is the case.
– user31729
Sep 28 '14 at 6:12
• This linked post uses a "clean" theorem begin, while the OP here uses an inserttheoremblockenv - the culprit that inserts the line-break.
– Werner
Sep 28 '14 at 6:28

You need to put your formatting commands in to the body, rather than the title, of the theoremblockenv and select the block title font and colour for the heading elements to mimic the style you ask for. Compare with the two examples of blocks with and without titles.

\documentclass[envcountsect]{beamer}

\usetheme{CambridgeUS}
\usefonttheme{serif}

\usepackage{etoolbox}

\makeatletter
\setbeamertemplate{theorem begin}
{%
\begin{\inserttheoremblockenv}
{}{\usebeamerfont*{block title}\usebeamercolor[fg]{block title}%
\inserttheoremname
\inserttheoremnumber
\inserttheorempunctuation}
\normalfont
}
\setbeamertemplate{theorem end}{\end{\inserttheoremblockenv}}
\makeatother

\begin{document}

\section{ABC}

\begin{frame}

\begin{theorem}[ABC]
This is a theorem
\end{theorem}

Text.

\begin{block}{Block title}
A block with title.
\end{block}

Text.

\begin{block}{}
A block without title.
\end{block}

\end{frame}

\end{document}