For those themes using the infolines
outer theme, such as CambridgeUS
, you can add the following lines to the preamble:
\setbeamertemplate{headline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
\usebeamerfont{section in head/foot}\thesection\ \insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
\end{beamercolorbox}}%
\vskip0pt%
}
EDIT: In the following example I defined a \Switch
command that allows to turn on/off the numbering of the sections in the headline; initially, it is set to 0
(turn off numbering), but redefining it to be 1
will turn on the numbering; the command can be redefined as many times as required:
\documentclass{beamer}
\usepackage{ifthen}
\usetheme{CambridgeUS}
\newcommand\Switch{0}
\newcommand\SecInHead{%
\ifthenelse{\equal{\Switch}{1}}
{\thesection.}{}}
\setbeamertemplate{headline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
\usebeamerfont{section in head/foot}\SecInHead\insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
\end{beamercolorbox}}%
\vskip0pt%
}
\begin{document}
\begin{frame}
Test frame with un-numbered section
\end{frame}
\renewcommand\Switch{1}
\section{Section a}
\begin{frame}
Test frame with numbered section
\end{frame}
\renewcommand\Switch{0}
\begin{frame}
Test frame with un-numbered section
\end{frame}
\end{document}
The CambridgeUS
theme uses the outer theme infolines
. You can download the original file from CTAN and use it as a basis to make your own outer theme with an external link.
In this example the footer contains a fourth field with a link to the beamer user guide:
\mode<presentation>
\setbeamercolor*{author in head/foot}{parent=palette tertiary}
\setbeamercolor*{title in head/foot}{parent=palette secondary}
\setbeamercolor*{date in head/foot}{parent=palette primary}
\setbeamercolor*{section in head/foot}{parent=palette tertiary}
\setbeamercolor*{subsection in head/foot}{parent=palette primary}
% colors for the external link field
\setbeamercolor*{external link}{parent=palette secondary}
\defbeamertemplate*{footline}{withlink theme}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}%
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber
\end{beamercolorbox}%
% this is a new field with an external link
\begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,right]{external link}%
\usebeamerfont{author in head/foot}\href{http://mirror.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf}{Link to manual}\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\defbeamertemplate*{headline}{withlink theme}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
\usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
\end{beamercolorbox}}%
\vskip0pt%
}
\setbeamersize{text margin left=1em,text margin right=1em}
\mode
<all>
Save this as beamerouterthemewithlink.sty
and put it in your project folder or the local tex-mf tree. Then you can use it by adding this line in your tex file:
\useoutertheme{withlink}
Similarly, you could also modify the header by adding another beamercolorbox
. Just make sure that the total width of all beamercolorbox
es is equal to \textwidth
.
Best Answer
You can change the color of the title by
However for me the example produces a red title.