[Tex/LaTex] Beamerposter: rounded and shadowed blocks

beamerbeamerposter

I want to create rounded blocks with shadows in beamerposter. The MWE does that, but in an ugly way: the bottom corners of the header are rounded and have a shadow, and the top corners of the text block have corners and a shadow. For a pleasing design the two should be better integrated.

enter image description here

\documentclass[final]{beamer}

\mode<presentation>{\usetheme{Berlin}}

\usepackage[orientation=portrait,size=a0,scale=1.4,debug]{beamerposter}

%From https://tex.stackexchange.com/questions/47264/beamer-round-blocks-without-fading
% \setbeamertemplate{blocks}[rounded][shadow=true]
% \makeatletter
% \pgfdeclareverticalshading[lower.bg,upper.bg]{bmb@transition}{200cm}{%
%   color(0pt)=(lower.bg); color(4pt)=(lower.bg); color(4pt)=(upper.bg)}
% \makeatother

\setbeamertemplate{block begin}{
\vskip.75ex
\begin{beamercolorbox}[rounded=true,shadow=true,leftskip=1cm,colsep*=.75ex]{block title}%
\usebeamerfont*{block title}\insertblocktitle
\end{beamercolorbox}%
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[rounded=true,shadow=true,colsep*=.75ex,sep=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block end}{
\end{beamercolorbox}
}

\begin{document}
  \begin{frame}
  \begin{columns}
  \begin{column}{.3\textwidth}
    \vfill
    \begin{block}{\large Fontsizes}
      \centering
      {\tiny tiny}\par
      {\scriptsize scriptsize}\par
      {\footnotesize footnotesize}\par
      {\normalsize normalsize}\par
    \end{block}
    \vfill
    \end{column}
    \end{columns}
  \end{frame}

\end{document}

The commented code in the MWE is taken from the answer to: Beamer round blocks without fading. And I uncomment it and comment the template blog begin, I get what I want, but loose the cleverer spacing of other template.

enter image description here

So my question is basically: how do I get the nice corners and shadows from the second picture into the first?

Disclaimer: My question is very similar to Rounded and shadow for block, but as there has not been an MWE added since Sep 2012 I post a new question.

Best Answer

I stumbled in a similar problem and solved it with the tcolorbox package. Here is the code:

\documentclass[final]{beamer}
\usepackage[orientation=portrait,size=a0,scale=1.4,debug]{beamerposter}     
\usepackage{tcolorbox}                                 %
\tcbuselibrary{skins}                                  %  preamble 
\usepackage{tikz}                                      %
\usetikzlibrary{shadows,shadings}                      %

\tikzset{myshadow/.style={                             % custom shadow with tikz
         opacity=.85,
         shadow xshift=0.15,
         shadow yshift=-0.15,
         shade,
         shading=axis,
         shading angle=230}
         } 
\tcbset{                                               % set a custom tcolorbox  
        skin=enhanced,                                 % enables use of shadows
        frame style={fill=gray,drop shadow={myshadow}}, % sets the frame color and the shadow properties
        bottom=7mm,                                    % distance between the body text and the bottom frame
        top=14mm,                                      % distance between the body text and the top frame
        boxrule=0mm,                                   % frame width
        bottomtitle=5mm,                               % distance between the title text and the bottom title frame               
        toptitle=5mm,                                  % distance between the title text and the top title frame
        lefttitle=1cm                                  % title text left margin
}  
\begin{document}
\begin{frame}  
\begin{columns}
\begin{column}{.3\textwidth}
\begin{tcolorbox}[title=\large Fontsizes]
 \centering
  {\tiny tiny}\par
  {\scriptsize scriptsize}\par
  {\footnotesize footnotesize}\par
  {\normalsize normalsize}\par
\end{tcolorbox}
\end{column}
\end{columns}
\end{frame}
\end{document}

the result is this:
enter image description here
for comparison:
enter image description here

I tried to explain everything in the code. If you want all the tcolorboxes to be like this, just put the \tcbset code in the preamble, otherwise start a group just before the tcolorboxes you want to customize in that way.

The only thing that doesn't really look the same is the shadow (my shadow isn't blurred), but with some tweaks and the shadows.blur tikzlibrary it should be possible to obtain the exact same result.