Beamer の定理名の後に改行がない

Beamer の定理名の後に改行がない

私は質問の答えを適用しましたビーマーの定理名の直後の定理の内容私の質問に対して。\inserttheorempunctuation の後に \normalfont を配置しましたが、結果は予想外でした。画像 1 をご覧ください。

            \documentclass[envcountsect]{beamer}
            \usetheme{CambridgeUS}
            \usefonttheme{serif}
            \makeatletter
            \setbeamertemplate{theorem begin}
            {%
                \begin{\inserttheoremblockenv}
                    {%
                        \inserttheoremheadfont
                        \inserttheoremname
                        \inserttheoremnumber
                        \ifx \inserttheoremaddition \empty \else\ (\inserttheoremaddition)\fi%
                        \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}

結果は次のとおりです。

ここに画像の説明を入力してください

コンテンツをすぐ後に置きたいのですが定理(改行なし)こんな感じです

ここに画像の説明を入力してください

答え1

書式設定コマンドをタイトルではなく本文に配置し、見出し要素のフォントと色theoremblockenvを選択して、block title要求するスタイルを模倣する必要があります。タイトル付きとタイトルなしのブロックの 2 つの例を比較してください。

サンプル出力

\documentclass[envcountsect]{beamer}

\usetheme{CambridgeUS}
\usefonttheme{serif}

\usepackage{etoolbox}

\makeatletter
\setbeamertemplate{theorem begin}
{%
\begin{\inserttheoremblockenv}
  {}{\usebeamerfont*{block title}\usebeamercolor[fg]{block title}%
  \inserttheoremname
  \inserttheoremnumber
  \ifx \inserttheoremaddition \empty \else\ (\inserttheoremaddition)\fi
  \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}

関連情報