![Beamer:框架标题的框](https://linux22.com/image/373858/Beamer%EF%BC%9A%E6%A1%86%E6%9E%B6%E6%A0%87%E9%A2%98%E7%9A%84%E6%A1%86.png)
我准备了以下来源
\documentclass[10pt,fleqn,xcolor=svgnames]{beamer}
\setbeamercolor{background canvas}{bg=Green!10}
\setbeamercolor{frametitle}{fg=Brown,bg=Yellow!20}
\setbeamercolor{normal text}{bg=DarkBlue}
\mode<presentation>
\begin{document}
\begin{frame}
\frametitle{Bla Bla}
Bla bla
\end{frame}
\end{document}
结果如下:
我想稍微修改一下要加框的框架标题的黄色框。我尝试使用命令,\setbeamertemplate
但没有成功。这可能相当简单,其他主题中也有一些提示,但我还没有找到方法,而且我可能对 beamer 太不熟悉了!对此我很抱歉。
答案1
\documentclass[10pt,fleqn,xcolor=svgnames]{beamer}
\setbeamercolor{background canvas}{bg=Green!10}
\setbeamercolor{frametitle}{fg=Brown,bg=Yellow!20}
\setbeamercolor{normal text}{bg=DarkBlue}
\usepackage{tcolorbox}
\makeatletter
\setbeamertemplate{frametitle}{%
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\@tempdima=\textwidth%
\advance\@tempdima by\beamer@leftmargin%
\advance\@tempdima by\beamer@rightmargin%
\begin{tcolorbox}[colback=Yellow!20,coltext=Brown,enlarge left by=-\beamer@leftmargin,width=\paperwidth]
\usebeamerfont{frametitle}%
\vbox{}\vskip-1ex%
\if@tempswa\else\csname beamer@fteleft\endcsname\fi%
\strut\insertframetitle\strut\par%
{%
\ifx\insertframesubtitle\@empty%
\else%
{\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
\fi
}%
\vskip-1ex%
\if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
\end{tcolorbox}%
}
\makeatother
\begin{document}
\begin{frame}
\frametitle{Bla Bla}
Bla bla
\end{frame}
\end{document}