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 can I make a beamercolorbox in the background template take the whole width of the slide? The following doesn't work correctly (but it works for some other templates such as headline):

\documentclass{beamer}

\setbeamercolor{banner}{bg=green}

\setbeamertemplate{background}{
  \begin{beamercolorbox}[wd=\paperwidth,ht=2cm]{banner}
  \end{beamercolorbox}
}
\begin{document}
\begin{frame}
  \frametitle{AA}
  BB
\end{frame}
\end{document}
share|improve this question
    
Add \hspace{1cm} just before the beamercolorbox. –  percusse Jul 25 '12 at 15:53
    
that works (as long as it is not followed by any non-%ed line breaks). Do you want to make it an answer? –  Simon Byrne Jul 26 '12 at 10:27
    
To make it slightly more general, you can also use \hspace{\beamer@leftmargin} –  Simon Byrne Jul 27 '12 at 14:05
    
Oh please write up the answer. I forgot to find where that 1cm comes from but since you've found that please make it an answer. –  percusse Jul 27 '12 at 14:59
add comment

1 Answer

up vote 2 down vote accepted

It's due to the margin. Add some extra hspace and it all works (thanks @percusse).

\documentclass{beamer}

\setbeamercolor{banner}{bg=green}

\makeatletter
\setbeamertemplate{background}{
  \hspace{\beamer@leftmargin}%
  \begin{beamercolorbox}[wd=\paperwidth,ht=2cm]{banner}
  \end{beamercolorbox}
}
\makeatother

\begin{document}
\begin{frame}
  \frametitle{AA}
  BB
\end{frame}
\end{document}
share|improve this answer
add comment

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.