4

I haven't found this question anywhere and therefore no answer to it.

I have a beamer presentation where I use \usebackgroundtemplate in order to put a background image. Now on some slides I would like the part left out by the image to be on a backround color other than white. I tried several positions of \setbeamercolor (inside/outside the frame, in a group with the frame, included in curly brackets, etc.) but nothing seems to work. It looks to me that \usebackgroundtemplate overrides the command \setbeamercolor.

Here is a minimal example:

\documentclass[12pt,a4paper,ucs,t,german]{beamer}
\usetheme{Ophaniel}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage[export]{adjustbox}

\title{\textcolor{black}{Playa Turquesa - Dominikanische Republik}}

\setbeamercolor{background canvas}{bg=}
\setbeamertemplate{frametitle}[default][center]

\begin{document}

\usebackgroundtemplate{%
  \parbox[c][\paperheight][c]{\paperwidth}{\centering{\includegraphics[scale=1.0]{../../../immobili/Repubblica-Dominicana/playaturquesa/Playa-Turquesa-Long-Logo-2.png}}}%
}

\begin{frame}
%\setbeamercolor{background}{bg=violet} % just a try, doesn't work
%\setbeamercolor{background canvas}{bg=violet} % this doesn't work either
\frametitle{\fcolorbox{black}{white}{Beispielpreise}}
Frame text here
\end{frame}

end{document}

The image is a .png with transparent background, so I would assume it should let see what's behind it.

Is there an easy way to do this?

Edited the question, thank you.

Ophaniel is my own theme that I did by just modifying another one. So I guess the code is not very compilable, if you don't have it. I'm not sure if there's anything there that could disturb the functioning of \setbeamercolor{background}. Should I publish the theme as well for you to be able to compile it?

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 6 '14 at 10:30
2
\documentclass[t]{beamer}

\setbeamerfont{frametitle}{size=\fontsize{24}{28},series=\bfseries}
\setbeamercolor{frametitle}{fg=black}

\setbeamercolor{bgcolor}{fg=black,bg=blue!20}
\pgfdeclareimage[width=\paperwidth]{mybackground}{back.pdf}

\setbeamertemplate{background canvas}{%
    \begin{picture}(30,273)
     \begin{beamercolorbox}[wd=1.1\paperwidth,ht=\paperheight]{bgcolor}
     \end{beamercolorbox}
        \put(-310,0){%
            \pgfuseimage{mybackground}
        }
    \end{picture}
}

\begin{document}

    \begin{frame}
        test
    \end{frame}

    \setbeamercolor{bgcolor}{fg=black,bg=red!20}
    \begin{frame}
        test
    \end{frame}

\end{document}

enter image description here

  • Thank you very much, samcarter. It was not the solution I adopted because I would have had to change my whole document too much, but you pointed me in the right direction and the "beamercolorbox" still worked. – Andyc Apr 7 '14 at 21:37
0

Using a macro (e.g. \opacity) works:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{mwe}

\usebackgroundtemplate{%
\tikz\node[opacity=\opacity,inner sep=0pt]%
{\includegraphics[height=\paperheight,width=\paperwidth]{example-image}};}

\begin{document}
\def\opacity{0.3}
\begin{frame}
first frame
\end{frame}

\def\opacity{1}
\begin{frame}
second frame
\end{frame}

\end{document}

first page second page

  • Thank you John. Very nice idea indeed the use of TikZ. Probably a little overkill for this purpose, but a great package. – Andyc Aug 15 '16 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.