[Tex/LaTex] Including a PDF with white background as transparent

beamertransparency

I actually have two related questions.

  1. I have a PDF I want to use with includegraphics in a beamer presentation. This PDF has a white background, which I want to be considered as transparent (so other items in the frame are printed above it. Is that possible?

  2. It is actually more than a single PDF that I want to include, to create animation (each PDF is a frame). Right now I create frames separately. Is there a way to use all PDFs for animation?

I tried something like:

 \includegraphics{\alt<1>{img1}{\alt<2>{img2}{img3}}}}

to get animation, but it does not work.

Best Answer

Regarding 1: I do not know if and how this is possible, would be happy to learn about it. I guess the transparency has to be already in the PDF.

Regarding 2: This can be done using \foreach from the TikZ/PGF package and and \includegraphics<+>. I usually put all frames of an animation as pages into a single PDF, so I can write:

\usepackage{pgffor} % if you do not already include tikz

\begin{frame}{Animation}
  \foreach \p in {1,...,10}{%
    \includegraphics<+>[page=\p, width=\textwidth]{animation.pdf}
  }
\end{frame}

If you do not have a single PDF, but a number of PDF files you might use pdftk to concatenate them. Alternatively, the following should work as well (I am not able to test this right now):

\usepackage{pgffor} % if you do not already include tikz

\begin{frame}{Animation}
  \foreach \f in {frame1.pdf, frame2.pdf, frame3.pdf}{%
    \includegraphics<+>[width=\textwidth]{\f}
  }
\end{frame}

A very nice thing property of this approach is that it becomes pretty easy to specify a different sequence (usually one containing fewer slides) for the handout version.

Related Question