You can use the \addtobeamertemplate
command to add the image to every frame in which the \frametitle
command is used. You only add the image to the frametitle
template. A simple example using the textpos
package to control the placement of the image:
\documentclass{beamer}
\usepackage{textpos}
\addtobeamertemplate{frametitle}{
\begin{textblock*}{\paperwidth}(-10pt,0pt)
\includegraphics[width=.9\paperwidth,height=1cm]{onebit_29}
\end{textblock*}
}
\begin{document}
\begin{frame}
\frametitle{Some long title to overlap the included image}
Test
\end{frame}
\end{document}
The \hspace
"hack" can be easily avoided; you are leaving spurious blank spaces in your code; suppress them by using %
right after \def\arraystretch{0}
and \setlength{\tabcolsep}{0cm}
.
To place your grid, you can use TikZ with a \node
containing the tabular
array of images; the width of each image will be 0.5\paperwidth
; the tricky part is to calculate the precise height; the obvious choice, 0.5\textheight
(and not 0.5\paperheight
), won't be a good choice since it doesn't take into account the height of the frametitle
box, so the height will be 0.5\textheight-0.5\ftht
, where \ftht
represents the height of the frametitle
box.
TikZ will then be used to place the node at ( $ (current page.center) + (0,-\ftht) $ )
; using \ftht
in all the calculations will allow you to make the necessary adjustments (for example, if there's a theme change affecting the height of the default frametitle box) by simply making one change in the code. For example, for the Madrid theme the approximate value (obtained through trial/error) was 4ex
:
\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{default}
\usefonttheme[onlylarge]{structurebold}
\useinnertheme{rectangles}
\useoutertheme{smoothbars}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usetikzlibrary{calc}
\newlength\ftht
\setlength\ftht{4ex}
% Code for placeholder images
\makeatletter
\AtBeginDocument{%
\def\Ginclude@graphics#1{%
\begingroup\fboxsep=-\fboxrule
\fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
\rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother
\begin{document}
\usebackgroundtemplate{%
\begin{tikzpicture}[remember picture,overlay]
\node at ( $ (current page.center) + (0,-\ftht) $ )
{
\def\arraystretch{0}%
\setlength\tabcolsep{0cm}%
\begin{tabular}[t]{cc}
\includegraphics[width=0.5\paperwidth,height=\dimexpr0.5\textheight-0.5\ftht\relax]{} &
\includegraphics[width=0.5\paperwidth,height=\dimexpr0.5\textheight-0.5\ftht\relax]{} \\
\includegraphics[width=0.5\paperwidth,height=\dimexpr0.5\textheight-0.5\ftht\relax]{} &
\includegraphics[width=0.5\paperwidth,height=\dimexpr0.5\textheight-0.5\ftht\relax]{} \\
\end{tabular}%
};
\end{tikzpicture}%
}
\begin{frame}
\frametitle{Using tabular}
\end{frame}
\end{document}
Unfortunately, if a frame has a two line title (or no title), the value for \ftht
will have to be changed.
Best Answer
Here is one way of doing this in ConTeXt. To set the color of a page, we need:
At each page, the
setups
specified indefinebackgrounds
are re-evaluated. So, to change the color of each page, we can simply change the value of the background color to a random color. It is easier to do so in Lua. So, here is a complete example:which gives