Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Beamer, transparent background colour

2,298 views
Skip to first unread message

Zarko Cucej

unread,
Sep 29, 2008, 6:25:09 AM9/29/08
to
Dear all,
I like to have in beamercolorbox transparent background colour. This I
try to achieve with naive solution:

\setbeamercolor{block body}{fg=black,bg={yellow!10,\opaqueness{.5}} }

but it is to naive an so it doesn't work. Do any one better idea how to
modified minimal (dummy) example below, that it will has a described
features?


regards, Zarko

p.s. I attach the background image example (a helicopter)


\documentclass{beamer}
%---------------------------------------------------------------%
\usepackage[slovene,english]{babel}
\usepackage[cp1250]{inputenc}\usepackage[T1]{fontenc}
\usepackage{graphics,tikz}
%---------------------------------------------------------------%
\defbeamertemplate{background}{image}[1][]{
\pgfdeclaremask[matte={1 1 1}]{background image}{#1}
\pgfdeclareimage[interpolate=true,
height=.8\textheight,
mask=background image]{background image}{#1}
\begin{pgfpicture}{0cm}{0cm}{\the\paperwidth}{-\the\paperheight}
\pgfputat{\pgfxy(6.4,-4.8)}
{\pgfbox[center,center]%
{\pgfuseimage{background image}}}
\end{pgfpicture}%
}
\setbeamertemplate{background}[image][slika3]
\setbeamercolor{block body}{fg=black,bg=yellow!10}

%---------------------------------------------------------------%
\begin{document}
%---------------------------------------------------------------%
\begin{frame}
\framesubtitle{Expertise with OPNET}
\framesubtitle{Test of back colour transparencies}
%------------------------------------------------------------ 9
\begin{beamercolorbox}[sep=0pt,wd=80mm]{block body}
\begin{itemize}
\item Modeliranje, simuliranje in vrednotenje TK omrežij
\item Merjenje in modeliranje telekomunikacijskega prometa
\item Ekspertni sistemi za optimiranje radijskih omrežij
\item Kakovost storitev v usmerjevalnih protokolih
\item Komunikacije v sprotnem času
\item Storitve s programskim paketom OPNET
\end{itemize}
\end{beamercolorbox}
\end{frame}
%---------------------------------------------------------------%
\end{document}

slika3.JPG

Kjell Magne Fauske

unread,
Sep 29, 2008, 7:54:40 AM9/29/08
to
>  slika3.JPG
> 29KViewDownload

Hacking beamercolorbox so that it is transparent seems not to be
straightforward. Look in the Beamer file 'base\beamerbasecolor.sty' if
you are adventurous. A better approach is probably to create a custom
environment that wraps the content inside a TikZ node with transparent
fill. Here is one way to do it:

\newenvironment{transbox}{%
\begin{tikzpicture}
\node[text width=\textwidth,
fill=yellow!10, fill opacity=0.5,text opacity=1] \bgroup%
}{\egroup;\end{tikzpicture}}


You can now write:

\begin{transbox}
\begin{itemize}
...
\end{itemize}
\end{transbox}

Here is your modified example:

%%%%


\documentclass{beamer}
%---------------------------------------------------------------%
\usepackage[slovene,english]{babel}
\usepackage[cp1250]{inputenc}\usepackage[T1]{fontenc}
\usepackage{graphics,tikz}
%---------------------------------------------------------------%
\defbeamertemplate{background}{image}[1][]{

\pgfdeclareimage[interpolate=true,
height=.8\textheight]{background image}{#1}


\begin{pgfpicture}{0cm}{0cm}{\the\paperwidth}{-\the\paperheight}
\pgfputat{\pgfxy(6.4,-4.8)}
{\pgfbox[center,center]%
{\pgfuseimage{background image}}}
\end{pgfpicture}%
}
\setbeamertemplate{background}[image][slika3]
\setbeamercolor{block body}{fg=black,bg=yellow!10}

\newenvironment{transbox}{%
\begin{tikzpicture}
\node[text width=\textwidth,
fill=yellow!10, fill opacity=0.5,text opacity=1] \bgroup%
}{\egroup;\end{tikzpicture}}


%---------------------------------------------------------------%
\begin{document}
%---------------------------------------------------------------%
\begin{frame}
\framesubtitle{Expertise with OPNET}
\framesubtitle{Test of back colour transparencies}
%------------------------------------------------------------ 9

\begin{transbox}


\begin{itemize}
\item Modeliranje, simuliranje in vrednotenje TK omrežij
\item Merjenje in modeliranje telekomunikacijskega prometa
\item Ekspertni sistemi za optimiranje radijskih omrežij
\item Kakovost storitev v usmerjevalnih protokolih

\item Komunikacije v sprotnem c(asu


\item Storitve s programskim paketom OPNET
\end{itemize}

\end{transbox}

\end{frame}
%---------------------------------------------------------------%
\end{document}

%%%%

Note. Your code for setting a transparent background picture is much
complicated than necessary. Recent versions of PDFTeX supports PNG
with alpha channel. You can replace all that mask stuff with an
\includegraphics and include a transparent PNG directly.

Hope this helps!

Regards,
Kjell Magne Fauske

Sebastian Szwarc

unread,
Sep 29, 2008, 12:29:15 PM9/29/08
to
Kjell could you explain a little this code:

\defbeamertemplate{background}{image}[1][]{
\pgfdeclareimage[interpolate=true,
height=.8\textheight]{background image}{#1}
\begin{pgfpicture}{0cm}{0cm}{\the\paperwidth}{-\the\paperheight}
\pgfputat{\pgfxy(6.4,-4.8)}
{\pgfbox[center,center]%
{\pgfuseimage{background image}}}
\end{pgfpicture}%
\setbeamertemplate{background}[image][slika3]

I dont see this intuitive...{image} is command or just name of the image?
and why to use:
\setbeamertemplate{background}[image][slika3] if earlier there is only
one paramter [1][]

Kjell Magne Fauske

unread,
Sep 29, 2008, 2:22:01 PM9/29/08
to

Your question should be directed to Zarko, but here it goes:

Zarko has used the \defbeamertemplate command to override the
background template. The \defbeamertemplate is powerful and highly
configurable. What Zarko does in this case is to first assign a
predefined option called 'image' to the background template. The
element takes one parameter, no default value is specified:

\defbeamertemplate{template name}{predefined option}[#arguments]
[default value]{template contents}

So when he wants to use this template he uses:
\setbeamertemplate{template name}[predefined option][argument]

I don't know if this makes much sense. I recommend reading chapter
'16.3.2 Using Beamer’s Templates' in the Beamer manual carefully to
understand all the details. 'image' is in this case just a name used
to trigger a specific variant of the background template. Beamer
defines a few variants of the background template, like for instance
grid. You invoke it using:

\setbeamertemplate{background}[grid]

You can even give it a parameter:

\setbeamertemplate{background}[grid][step=1cm]

- Kjell Magne Fauske

Kjell Magne Fauske

unread,
Sep 29, 2008, 2:26:48 PM9/29/08
to
On Sep 29, 8:22 pm, Kjell Magne Fauske <kjel...@gmail.com> wrote:

> Zarko has used the \defbeamertemplate command to override the
> background template. The \defbeamertemplate is powerful and highly
> configurable. What Zarko does in this case is to first assign a
> predefined option called 'image' to the background template. The
> element takes one parameter, no default value is specified:
>

Technically he has not overridden the background template. He has
added a new variant of the background template.

- Kjell Magne Fauske

Zarko Cucej

unread,
Sep 30, 2008, 1:54:25 AM9/30/08
to
Kjell Magne Fauske wrote:
> On Sep 29, 12:25 pm, Zarko Cucej <zarko.cu...@gmail.com> wrote:
>> Dear all,
>> I like to have in beamercolorbox transparent background colour. This I
>> try to achieve with naive solution:
>>
>> \setbeamercolor{block body}{fg=black,bg={yellow!10,\opaqueness{.5}} }
>>
>> but it is to naive an so it doesn't work. Do any one better idea how to
>> modified minimal (dummy) example below, that it will has a described
>> features?
>>
>> regards, Zarko
>>
[...]

>
> Hacking beamercolorbox so that it is transparent seems not to be
> straightforward. Look in the Beamer file 'base\beamerbasecolor.sty' if
> you are adventurous. A better approach is probably to create a custom
> environment that wraps the content inside a TikZ node with transparent
> fill. Here is one way to do it:
>
> \newenvironment{transbox}{%
> \begin{tikzpicture}
> \node[text width=\textwidth,
> fill=yellow!10, fill opacity=0.5,text opacity=1] \bgroup%
> }{\egroup;\end{tikzpicture}}
>
>
> You can now write:
>
> \begin{transbox}
> \begin{itemize}
> ...
> \end{itemize}
> \end{transbox}
>
> Here is your modified example:
>
> %%%%

[....]

thank you very much. thhis perfectly work!

kind regards, Zarko

0 new messages