到目前为止,我尝试重新定义 beamer 模板时没有成功。在texwelt.de我发现提示只需使用 \setbeamertemplate,但这不起作用。
\documentclass{beamer}
\usetheme{default}
\AtBeginDocument{%
\setbeamertemplate*{block example begin}
{
\par\vskip\medskipamount%
\begin{beamercolorbox}[colsep*=.75ex]{block title example}
\usebeamerfont*{block title example}\insertblocktitle%
\end{beamercolorbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title example}
{}
{\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body example}%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
\ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
}
\begin{document}
A
\end{document}
答案1
\AtBeginDocument
不是必需的,并且设置 beamer 模板的命令也不是\setbeamertemplate
。\setbeamertemplate*
以下代码对我来说很好用:
\documentclass{beamer}
\setbeamertemplate{block example begin}
{
\par\vskip\medskipamount%
\begin{beamercolorbox}[colsep*=.75ex]{block title example}
\usebeamerfont*{block title example}\insertblocktitle%
\end{beamercolorbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title example}
{}
{\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body example}%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
\ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\begin{document}
\begin{frame}
\begin{exampleblock}{Example}
Block content.
\end{exampleblock}
\end{frame}
\end{document}