我使用带有默认颜色主题的“Montepellier”主题创建了一个 latex beamer 演示文稿。我需要修改此主题(我想分别更改标题上下边框的颜色)。因此,我将“beamercolorthemedefault”复制到我的项目中,重命名并包含它(这有效!)。但我无法更改任何颜色 - 更改颜色没有效果。我以这种方式更改了默认设置(仅更改了第一行):
\ProvidesPackageRCS $Header:
/Users/joseph/Documents/LaTeX/beamer/base/themes/color/beamercolorthemedefault.sty,v d02a7cf4d8ae 2010/06/17 09:11:41 rivanvx $
\mode<presentation>
\definecolor{beamer@blendedblue}{rgb}{0.5,0.5,0.3} % changed this
\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=green!50!black}
\setbeamercolor{structure}{fg=beamer@blendedblue}
\setbeamercolor{background canvas}{parent=normal text}
\setbeamercolor{background}{parent=background canvas}
\setbeamercolor{palette primary}{fg=yellow,bg=yellow} % changed this
\setbeamercolor{palette secondary}{use=structure,fg=structure.fg!100!green} % changed this
\setbeamercolor{palette tertiary}{use=structure,fg=structure.fg!100!green} % changed this
但所有这些改变都没有效果?!(用另一个主题替换完整内容即可)那么如何更改任何颜色以及如何更改标题的边框?
答案1
我认为你做了一些非常复杂的事情,而解决方案本来可以更简单。此外,最好不要修改默认值themes
:如果你这样做,至少要更改主题名称。
例如,看看这个代码:
\documentclass{beamer}
\usetheme{Montpellier}
\begin{document}
\title{My title}
\author{My name}
\institute{My institute}
\makeatletter
\definecolor{beamer@blendedblue}{rgb}{0.5,0.5,0.3} % changed this
\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=green!50!black}
\setbeamercolor{structure}{fg=beamer@blendedblue}
\setbeamercolor{background canvas}{parent=normal text}
\setbeamercolor{background}{parent=background canvas}
\setbeamercolor{palette primary}{fg=yellow,bg=yellow} % changed this
\setbeamercolor{palette secondary}{use=structure,fg=structure.fg!100!green} % changed this
\setbeamercolor{palette tertiary}{use=structure,fg=structure.fg!100!green} % changed this
\makeatother
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{A frame}
\begin{itemize}
\item hello
\item hello again
\end{itemize}
\end{frame}
\end{document}
我以一种非常简单的方式得到了:
如果您想创建自己的颜色主题,请创建一个名为的文件,例如beamercolorthememyct.sty
:
\definecolor{beamer@blendedblue}{rgb}{0.5,0.5,0.3} % changed this
\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=green!50!black}
\setbeamercolor{structure}{fg=beamer@blendedblue}
\setbeamercolor{background canvas}{parent=normal text}
\setbeamercolor{background}{parent=background canvas}
\setbeamercolor{palette primary}{fg=yellow,bg=yellow} % changed this
\setbeamercolor{palette secondary}{use=structure,fg=structure.fg!100!green} % changed this
\setbeamercolor{palette tertiary}{use=structure,fg=structure.fg!100!green} % changed this
您可以将其放在演示文稿文件的同一文件夹中.tex
(我有 TeXLive 并且它可以运行)或放在您的个人树中。
那么上面显示的 MWE 将变成:
\documentclass{beamer}
\usetheme{Montpellier}
\usecolortheme{myct}
\begin{document}
\title{My title}
\author{My name}
\institute{My institute}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{A frame}
\begin{itemize}
\item hello
\item hello again
\end{itemize}
\end{frame}
\end{document}
与图形结果相同的两帧。
编辑
要更改上部和下部线头的颜色,您应该使用适当的键。例如,将这些行添加到您的theme color
:
\setbeamercolor{upper separation line head}{bg=green}
\setbeamercolor{lower separation line head}{bg=red}
让您获得: