我已經應用了問題的答案投影機中定理名稱後面的定理內容對於我的問題。我把 \normalfont 放在 \inserttheorempunctuation 之後,但結果出乎意料。能看一下圖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
標題元素的字體和顏色以模仿您要求的樣式。比較帶標題和不帶標題的兩個區塊範例。
\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}