我有这个例子,为什么颜色渐变效果被删除
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{lipsum}
\usetheme{Warsaw}
\begin{document}
\begin{frame}{frame title}
lipsum[2]
\end{frame}
\setbeamertemplate{frametitle}[default][right]
\begin{frame}{frame title}
\lipsum[2]
\end{frame}
\setbeamertemplate{frametitle}[default][center]
\begin{frame}{frame title}
\lipsum[2]
\end{frame}
\end{document}
答案1
主题warsaw
不使用默认的框架标题,而是使用阴影外层主题中的框架标题。通过使用,\setbeamertemplate{frametitle}[default][...]
您可以明确地将此框架标题替换为默认主题中的框架标题,该主题没有颜色渐变。
如果您想要改变warsaw
框架标题中的某些内容,例如让其右对齐,您可以重新定义模板:
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{lipsum}
\usetheme{Warsaw}
\makeatletter
\setbeamertemplate{frametitle}
{%
\nointerlineskip%
\vskip-2pt%
\hbox{\leavevmode
\advance\beamer@leftmargin by -12bp%
\advance\beamer@rightmargin by -12bp%
\beamer@tempdim=\textwidth%
\advance\beamer@tempdim by \beamer@leftmargin%
\advance\beamer@tempdim by \beamer@rightmargin%
\hskip-\Gm@lmargin\hbox{%
\setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
\vbox{}\vskip-.75ex%
\leftskip0.3cm%
\rightskip0.3cm plus1fil\leavevmode
\hfill% <---- added to make it right aligned
\insertframetitle%
\ifx\insertframesubtitle\@empty%
\strut\par%
\else
\par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
\fi%
\nointerlineskip
\vbox{}%
\end{minipage}}%
\beamer@tempdim=\ht\beamer@tempbox%
\advance\beamer@tempdim by 2pt%
\begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
\usebeamercolor{frametitle right}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
\pgfusepath{clip}
\pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
\end{pgfpicture}
\hskip-\paperwidth%
\box\beamer@tempbox%
}%
\hskip-\Gm@rmargin%
}%
\nointerlineskip
\vskip-0.2pt
\hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
\vskip-2pt
}
\makeatother
\begin{document}
\begin{frame}{frame title}
lipsum[2]
\end{frame}
\end{document}