Including a PDF with white background as transparent
Solution 1
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.
Solution 2
For as far as I know it is not possible to make LaTeX ignore the background, however if you open the PDF in Inkscape the background is usually just one element which is easy to remove (though you do have to do this separately for each frame).
-
You can use the
animate
package then use:\animategraphics{framerate}{basetitle}{start}{end}
For example if you want to play an animation at 10 fps, for which the frames are in
frame001.png
up toframe050.png
which are located in the folderanim/
, that would be:\animategraphics{10}{anim/frame}{001}{050}
You may also want to use some options (for example autoplay or step), for details I would direct you to the package documentation on http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/animate/animate.pdf.
I should point out that using the
animate
package may have some side effects when using anything else than Acrobat reader, in particular I find that background images tend to go all white in most PDF readers.
Related videos on Youtube
kloop
Updated on October 16, 2020Comments
-
kloop about 3 years
I actually have two related questions.
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?
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.
-
prettygully almost 12 yearshave a look at the
animate
package - it allows you to specify a series of pdf images which are then played. you simply include it, e.g.\documentclass{article} \usepackage{animate} \documentclass{article} \usepackage{animate} \begin{document} \centerline{ \animategraphics[controls,buttonsize=10pt, width=10cm]{4}{cv}{2}{101}} \end{document} -
Martin Schröder over 11 yearsPlease don't mix several questions into one.