LaTeX presentation background picture

In one slide of a presentation I wanted to have a background picture and overlay it with several text blocks one after the other to have the effect of the text “coming out of” the background. It is tricky to align things in LaTeX beamer, especially if you want to have them on top of each other, so this is my solution: Two minipages that cover the whole slide on top of each other.

A slide is more or less 7cm high (depending a bit on your template). There probably is a length defined for that, but I was too lazy to look for it so I took the actual value. The width of the slide is of course \textwidth. I use vertically centered alignment for the minipage, but that is up to you (see the post Set height of a minipage for the options you can give to minipage).

The way it now works is the following. Create one minipage of full width and height. Use this to display the background image. Then jump back the full height and create a second minipage of full width and height to display the text inside of that. This is the code for my slide:

\begin{minipage}[c][7cm][c]{\textwidth}
\centering
\includegraphics[width=0.8\linewidth]{img/Reviews}
\end{minipage}

\vspace{-7cm}
\begin{minipage}[c][7cm][c]{\textwidth}
\centering

\visible<2->{
\colorbox{white}{\fbox{\textcolor{blue}{I was impressed by the fast shutter speed of D3200.}\only<3->{\textcolor{darkgreen}{~(\emph{positive})}}}}
}

\vspace{1cm}
\visible<4->{
\colorbox{white}{\fbox{\textcolor{blue}{The autofocus was \textbf{not} so reliable.}\only<5->{\textcolor{red}{~(\emph{negative})}}}}
}
\end{minipage}

Set height of a minipage

The width of a minipage is a mandatory parameter. But hidden in the optional parameters is a way to set a specific height for a minipage.

The first parameter is the position of the minipage relative to the baseline. Possible values are ‘t’ (top of the minipage is level with the line), ‘c’ (center of the minipage is level with the line) or ‘b’ (bottom of the minipage is level with the line).

The second parameter is the height. The minipage will have exactly this height. If the text inside the minipage is longer, it will spill out of the box, the height is not adjusted. If the text is shorter, the remainder of the box will be empty.

The last parameter is the vertical position of the text inside the minibox. Possible values are ‘t’ (top-aligned), ‘c’ (centered), and ‘b’ (bottom-aligned).

\begin{minipage}[t][5cm][t]{0.5\textwidth}
test
\end{minipage}