I am trying to get a 2x2 grid of background images in a Beamer frame. I'd like the images to touch on all side (i.e., no whitespace around images). I am able to get a tabular environment inside \usebackgroundtemplate{}
, but I have to play with negative \hspace{}
to eliminate the left "margin" (feels like a hack). The problem is that the top row of images is behind the Beamer titles. When I use a single background image, I am able to use something like \includegraphics[width=\paperwidth,height=\paperheight,trim=0cm 0cm
0cm -5cm,clip]{image.jpg}}
to push the image down below the Beamer titles. That also feels like a hack, but it works. However, I can't figure out how to do something similar with the tabular environment. A MWE follows which also contains an attempt at using minipage
environments, but all images end up in the same row despite trying many iterations of \linebreak
, \pagebreak
, etc.:
\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{default}
\usefonttheme[onlylarge]{structurebold}
\useinnertheme{rectangles}
\useoutertheme{smoothbars}
\setbeamertemplate{navigation symbols}{}
% 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
\usepackage{graphicx}
\begin{document}
\usebackgroundtemplate{%
\def\arraystretch{0}
\renewcommand{\tabcolsep}{0cm}
\hspace*{-0.4cm}
\begin{tabular}{@{}cc@{}}
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{} &
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{} \\
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{} &
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{} \\
\end{tabular}
}
\begin{frame}
\frametitle{Using tabular...}
\end{frame}
\usebackgroundtemplate{}
\usebackgroundtemplate{%
\begin{minipage}{1.0\paperwidth}
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{}
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{}
\end{minipage}
\begin{minipage}{1.0\paperwidth}
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{}
\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{}
\end{minipage}
}
\begin{frame}
\frametitle{Using minipage...} % All images end up on one line...
\end{frame}
\usebackgroundtemplate{}
\end{document}
Image posted by JLDiaz
\\[6mm]
\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}
.