Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to change the red color for - the titles - the topics

How to adjust the position of the header1 and 2?

\documentclass{beamer}

\usetheme{CambridgeUS}


% Set Color ==============================

% Custom colors
\usepackage{xcolor}

% http://www.computerhope.com/htmcolor.htm
\definecolor{gold}{HTML}{FDD017}
\definecolor{deep sky blue}{HTML}{3BB9FF}
\definecolor{light sky blue}{HTML}{82CAFA}

\makeatletter
\definecolor{mybackground}{HTML}{82CAFA}
\definecolor{myforeground}{HTML}{0000A0}

\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=black}

\setbeamercolor{background canvas}{fg=myforeground, bg=white}
\setbeamercolor{background}{fg=myforeground, bg=mybackground}

\setbeamercolor{palette primary}{fg=black, bg=gray!30!white}
\setbeamercolor{palette secondary}{fg=black, bg=gray!20!white}
\setbeamercolor{palette tertiary}{fg=black, bg=gold}
\makeatother
% Set Color ==============================



\title{Title1}
\subtitle{Title2}
\author{Author}
\institute{Institute}
\date{Date}


\begin{document}

\frame{

}

\section[Outline]{}
\frame{\tableofcontents}

\section{Header1}
\subsection{Header2}
\frame{\frametitle{Topic1}
%
HTML color codes are the \textbf{hexadecimal triplets} representing the colors red, green, and blue.
\vspace{0.25cm}
%
These color codes can be used to change the color of the background, text, and tables on a web page.
}
%
%
\end{document}

Title1 and 2 Title

Topic1 and Header1 & 2 Topic

Align text left or right, center Align text left or right, center

share|improve this question
1  
possible duplicate? tex.stackexchange.com/questions/53288/… –  Papiro May 12 '13 at 2:31
1  
What do you mean by "adjusting the position"? Do you want to chenge which parameter(s) exactly? –  Gonzalo Medina May 12 '13 at 2:38
1  
@Langevin I think I still don't understand. Do you want the entries in the table of contents to be, for example, centered? –  Gonzalo Medina May 12 '13 at 3:14
1  
@Langevin A now I see what you mean. In some minutes I'll give an answer. –  Gonzalo Medina May 12 '13 at 3:25
1  
I am sorry to bother you, but may I ask if there's any problem with the answer below? I ask because I noticed that you have asked several follow-up questions (which you have accepted), but since you haven't accepted the answer to this one I wonder if there's something wrong with it. –  Gonzalo Medina May 13 '13 at 17:53

1 Answer 1

up vote 4 down vote accepted

To change the color for the frame title and for the title and subtitle, you need to redefine the beamer colors frametitle and title:

\setbeamercolor{frametitle}{<color>}
\setbeamercolor{title}{<color>}

to change the position of the headers, you need to redefine the headline template as defined in the outer theme infolines (internally used by CambridgeUS). Here's the original definition:

\defbeamertemplate*{headline}{infolines theme}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,left]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
  \end{beamercolorbox}}%
  \vskip0pt%
}

As you can see, the alignment for the first beamercolorbox is right, and the one for the second box is left: you can change these as you wish.

In the following example I used a shade of cyan for the titles (not the best choice) and I used center for both boxes in the headline:

\documentclass{beamer}

\usetheme{CambridgeUS}


% Set Color ==============================

% Custom colors
\usepackage{xcolor}

% http://www.computerhope.com/htmcolor.htm
\definecolor{gold}{HTML}{FDD017}
\definecolor{deep sky blue}{HTML}{3BB9FF}
\definecolor{light sky blue}{HTML}{82CAFA}

\definecolor{mybackground}{HTML}{82CAFA}
\definecolor{myforeground}{HTML}{0000A0}

\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{example text}{fg=black}

\setbeamercolor{background canvas}{fg=myforeground, bg=white}
\setbeamercolor{background}{fg=myforeground, bg=mybackground}

\setbeamercolor{palette primary}{fg=black, bg=gray!30!white}
\setbeamercolor{palette secondary}{fg=black, bg=gray!20!white}
\setbeamercolor{palette tertiary}{fg=black, bg=gold}

\setbeamercolor{frametitle}{fg=cyan!80!black}
\setbeamercolor{title}{fg=cyan!80!black}

\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,center]{section in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,center]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
  \end{beamercolorbox}}%
  \vskip0pt%
}

% Set Color ==============================

\title{Title1}
\subtitle{Title2}
\author{Author}
\institute{Institute}
\date{Date}


\begin{document}

\frame{\maketitle}

\section[Outline]{}
\frame{\tableofcontents}

\section{Header1}
\subsection{Header2}
\frame{\frametitle{Topic1}
%
HTML color codes are the \textbf{hexadecimal triplets} representing the colors red, green, and blue.
%
These color codes can be used to change the color of the background, text, and tables on a web page.
}

\end{document}

enter image description here

share|improve this answer
    
Thank you Gonzalo Medina for your very useful input. How do you change the color of the bands of the frame titles? For example, in the last slide, "Topic1" is colored in cyan!80!black. But how do I change the pale grey color of the band that contains the title? –  user32950 Jun 28 '13 at 15:25
    
@user32950 use bg=<color> in the frametitle color specification, as in \setbeamercolor{frametitle}{fg=cyan!80!black,bg=red}. –  Gonzalo Medina Jun 28 '13 at 17:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.