[Tex/LaTex] How to make partially transparent beamercolorbox

beamerbeamerposter

In my poster, I added a background picture and make the blocks partially transparent, using the following code

\documentclass[final, 12pt]{beamer}
\usepackage[size=custom,width=120,height=120,scale=1.7,orientation=portrait]{beamerposter} 
\usepackage{ragged2e}
\usepackage{graphicx} 
\usepackage{lipsum} 
\usepackage{etoolbox}
\apptocmd{\frame}{\justifying}{}{}

\usebackgroundtemplate{\centering \includegraphics[width=\paperwidth, height=\paperheight]{Figure/LG_PKL.jpg}}
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.65}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block beamercolorbox begin}{\pgfsetfillopacity{0.65}}{\pgfsetfillopacity{1}}

\newenvironment<>{varblock}[2][\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}

\usecolortheme{rose}


\begin{document}
\begin{frame}

\begin{textblock}{}(0.55,0.05)
\begin{center}
\setlength{\textwidth}{113cm}
\begin{beamercolorbox}{block body}
gdsghfdhdfgh
\end{center}
\end{beamercolorbox}
\end{center}
\end{textblock}


\begin{textblock}{}(0.2,1.15)%
\begin{varblock}[35cm]{\textbf{1. Introduction}}
\justifying 
Space for discussion.
\end{varblock}
\end{textblock}

\end{document}

It works nice with block,but I need to make the beamercolorbox's also partially transparent.Can any one please help me?

Best Answer

Your example code has some errors and won't work. However, I could reprouce your problem with a simple modification to your sample code (I changed some settings to make my example simpler, but this is not relevant to the problem nor to the solution):

\documentclass[final, 12pt]{beamer}
\usepackage[size=custom,width=10,height=10,scale=.7,orientation=portrait]{beamerposter} 
\usepackage{graphicx} 
\usepackage{textpos} 

\usecolortheme{rose}

\usebackgroundtemplate{%
  \centering\includegraphics[width=\paperwidth, height=\paperheight]{ctanlion}}
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.65}}{\pgfsetfillopacity{1}}

\newenvironment<>{varblock}[2][\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}

\begin{document}

\begin{frame}
\begin{textblock}{}(0.55,0.05)
\setlength\textwidth{5cm}
\begin{beamercolorbox}[wd=5cm]{block body}
some test text\\
some test text
\end{beamercolorbox}
\end{textblock}

\vfill

\begin{textblock}{}(0.2,1.15)%
\begin{varblock}[5cm]{Introduction}
Space for discussion.
\end{varblock}
\end{textblock}
\end{frame}

\end{document}

The result shows that the beamercolobox color hides the background image:

enter image description here

To preven this problem, you can simply use \pgfsetfillopacity{0.65} inside the frame environment (or inside the textblock environment that holds the offending box if you want to keep the change local):

\documentclass[final, 12pt]{beamer}
\usepackage[size=custom,width=10,height=10,scale=.7,orientation=portrait]{beamerposter} 
\usepackage{graphicx} 
\usepackage{textpos} 

\usecolortheme{rose}

\usebackgroundtemplate{%
  \centering\includegraphics[width=\paperwidth, height=\paperheight]{ctanlion}}
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.65}}{\pgfsetfillopacity{1}}

\newenvironment<>{varblock}[2][\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}

\begin{document}

\begin{frame}
\pgfsetfillopacity{0.65}

\begin{textblock}{}(0.55,0.05)
\setlength\textwidth{5cm}
\begin{beamercolorbox}[wd=5cm]{block body}
some test text\\
some test text
\end{beamercolorbox}
\end{textblock}

\vfill

\begin{textblock}{}(0.2,1.15)%
\begin{varblock}[5cm]{Introduction}
Space for discussion.
\end{varblock}
\end{textblock}
\end{frame}

\end{document}

enter image description here

CTAN lion drawing by Duane Bibby.