I want to include a logo in the pdf pages included in Beamer.
I tried writing macro and progressed so far.
\documentclass[fleqn,xcolor=dvipsnames]{beamer}
\newlength{\logosize}
\setlength{\logosize}{7.50mm}
\newlength{\logoXinpdf}
\newlength{\logoYinpdf}
\setlength{\logoXinpdf}{0.9\textwidth}
\setlength{\logoYinpdf}{0.8\textheight}
\usepackage{pdfpages}
\def\getpdfpages#1#2{\begingroup
\setbeamercolor{background canvas}{bg=}
\includepdf[pages={#1},picturecommand={\put(\logoXinpdf,\logoYinpdf){\pgfimage[width=\logosize]{mylogo}}}]{#2}
\endgroup}
\begin{document}
\getpdfpages{{9,12}}{mypdf.pdf}
\end{document}
However, when I run pdfLaTeX, I get an error in the line of,
! A <box> was supposed to be here.
<to be read again>
\unitlength
l.23 \getpdfpages{{9,12}}{mypdf.pdf}
I understand that the problem is with the \put
command. If I replace the \logoXinpdf,\logoYinpdf
lengths with absolute numbers, everything works fine.
Is there a way I can use these defined lengths with the \put
command?
Best Answer
It's actually sufficient just to locally disable
\unitlength
(assuming this is a picture mode command internally.\put
expects a multiplier and does essentiallySo if
\unitlength
is empty it is OK to pass lengths to put. Heiko'spicture
package takes this a bit further and adds some conditional logic so that you can use either a length or a multiplier, so that\unitlength
becomes essentially a default unit. So it is probably enough just to loadpicture
and make no change to your code.