如何更改 Beamer 中导航栏的颜色?我正在使用“哥廷根“主题。我尝试了几次更改,但没有效果……
代码:
\documentclass{beamer}
\usepackage[british]{babel}
\usepackage{graphicx,hyperref,url}
\usepackage{color}
\usetheme[left]{Goettingen}
\begin{document}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}
\section{Introduction}
\begin{frame}
\frametitle{Introduction}
\begin{itemize}
\item This is just a short example
\item The comments in the \LaTeX\ file are most important
\item This is just the result after running pdflatex
\end{itemize}
\end{frame}
\section{Background information}
\begin{frame}
\frametitle{Background information}
\begin{block}{Slides with \LaTeX}
Beamer offers a lot of functions to create nice slides using \LaTeX.
\end{block}
\begin{block}{The basis}
This style uses the following default styles:
\begin{itemize}
\item split
\item whale
\item rounded
\item orchid
\end{itemize}
\end{block}
\end{frame}
\section{The important things}
\begin{frame}
\frametitle{The important things}
\begin{enumerate}
\item This just shows the effect of the style
\item It is not a Beamer tutorial
\item Read the Beamer manual for more help
\item Contact me only concerning the style file
\end{enumerate}
\end{frame}
\section{Analysis of the work}
\begin{frame}
\frametitle{Analysis of the work}
When you know how to work with the Beamer package it is easy to use.
\end{frame}
\section{Conclusion}
\begin{frame}
\frametitle{Conclusion}
\begin{itemize}
\item Easy to use
\item Good results
\end{itemize}
\end{frame}
\end{document}
答案1
我不确定您想要更改不同导航组件的哪些颜色,因此让我介绍其中的一些。
颜色导航符号可以使用以下方法更改:
\setbeamercolor{navigation symbols}{fg=red, bg=green}
颜色导航面板你可以通过输入来改变
\setbeamercolor{structure}{fg=red}
前
\usetheme[left]{Goettingen}
。但是请注意,颜色仍然会被洗掉,从上到下逐渐褪色。您可以更改标题在导航栏中使用
\setbeamercolor{palette sidebar secondary}{fg=yellow,bg=blue} \setbeamercolor{section in sidebar shaded}{fg=red,bg=black}
这些
secondary
颜色是当前活动的颜色。
我并不提倡这些特定的选择,尤其是因为他们这样做:
以下是生成该图像的代码:
\documentclass{beamer}
\usepackage[british]{babel}
\usepackage{graphicx,hyperref,url}
\usepackage{color}
\setbeamercolor{structure}{fg=red}
\usetheme[left]{Goettingen}
\setbeamercolor{navigation symbols}{fg=red, bg=green}
\setbeamercolor{palette sidebar secondary}{fg=yellow,bg=blue}
\setbeamercolor{section in sidebar shaded}{fg=red,bg=black}
\begin{document}
\begin{frame}{Outline}\tableofcontents \end{frame}
\section{Introduction}\begin{frame}{Introduction}\end{frame}
\section{Background}\begin{frame}{Background}\end{frame}
\end{document}
最后,可以通过放置
\makeatletter
\setbeamertemplate{sidebar canvas \beamer@sidebarside}%
[vertical shading][top=green,bottom=blue]
\makeatother
后您已设置颜色。将其拼接到上面的 MWE 中可得出:
再说一遍,尽管它们可能很漂亮,但我不推荐任何这些颜色。
答案2
当您想更改beamer
主题中的任何内容时,我建议您查看原始主题定义文件(beamerthemeGoettingen.sty
在本例中)。在那里,您将看到使用了哪些其他主题(innr、outer、font 等)以及您需要更改哪些模板。
Goettingen 主题文件只有 34 行,仅加载和自定义side bar
外部主题。在文件末尾你会发现
\setbeamertemplate{sidebar canvas \beamer@sidebarside}[vertical shading]
[top=structure.fg!25,bottom=structure.fg!10]
这意味着侧边栏的颜色是structure
。因此,如果你想更改它,可以这样
\setbeamercolor{structure}{fg=red}
作为安德鲁建议的可以做到这一点。但是许多 Beamer 主题元素都是基于structure
颜色的,因此如果您更改它,其他所有内容都会做到这一点。例如,查看 Andrew 答案图中的导航符号。它们是红色的,因为structure
已更改。
如果我只想更改侧边栏背景颜色,我会插入
\makeatletter
\setbeamertemplate{sidebar canvas \beamer@sidebarside}[vertical shading][top=red!25,bottom=red!10]
\makeatother
在我的序言中。结果将是
\documentclass{beamer}
\usepackage[british]{babel}
\usepackage{graphicx,hyperref,url}
\usepackage{color}
\usetheme[left]{Goettingen}
\makeatletter
\setbeamertemplate{sidebar canvas \beamer@sidebarside}[vertical shading][top=red!25,bottom=red!10]
\makeatother
\begin{document}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}
\section{Introduction}
\begin{frame}
\frametitle{Introduction}
\begin{itemize}
\item This is just a short example
\item The comments in the \LaTeX\ file are most important
\item This is just the result after running pdflatex
\end{itemize}
\end{frame}
\section{Background information}
\begin{frame}
\frametitle{Background information}
\begin{block}{Slides with \LaTeX}
Beamer offers a lot of functions to create nice slides using \LaTeX.
\end{block}
\begin{block}{The basis}
This style uses the following default styles:
\begin{itemize}
\item split
\item whale
\item rounded
\item orchid
\end{itemize}
\end{block}
\end{frame}
\section{The important things}
\begin{frame}
\frametitle{The important things}
\begin{enumerate}
\item This just shows the effect of the style
\item It is not a Beamer tutorial
\item Read the Beamer manual for more help
\item Contact me only concerning the style file
\end{enumerate}
\end{frame}
\section{Analysis of the work}
\begin{frame}
\frametitle{Analysis of the work}
When you know how to work with the Beamer package it is easy to use.
\end{frame}
\section{Conclusion}
\begin{frame}
\frametitle{Conclusion}
\begin{itemize}
\item Easy to use
\item Good results
\end{itemize}
\end{frame}
\end{document}