1

linked question - tcolorbox inner theme - blurred background

MWE

\documentclass{beamer}
\usetheme{Warsaw}

\useinnertheme{tcolorbox}

\begin{document}

\begingroup
  \setbeamercolor{block title}{fg=black}
  \setbeamerfont{block title}{series=\bfseries}
  \setbeamertemplate{background canvas}{%
    \begin{tikzpicture}[inner sep=0pt,remember picture,overlay]
      \node at (current page.center) {\includegraphics[width=\paperwidth]{example-image-duck}};
    \end{tikzpicture}
  }
\begin{frame}

\tcbset{
  enhanced,
  remember,
  frame hidden,
  interior hidden,
  underlay={
    \begin{tcbclipframe}
      \begin{scope}[inner sep=0pt, remember picture,overlay] 
        \fill[white] (current page.south west) rectangle (current page.north east);
        % blurred version of background image
        \node[opacity=0.9] at (current page.center) {\includegraphics[width=\paperwidth]{example-image-duck}};
      \end{scope}
    \end{tcbclipframe}
  }
}

\begin{block}{block title}
    text
\end{block}
\end{frame}
\endgroup

\end{document}

But I wanted the block size to fit the text contents inside while using tcolorbox inner theme. Can someone give a hint on this?

1 Answer 1

1

The tcolorbox inner theme tries very hard to mimic the default beamer blocks, including their width.

For this situation, I would use a normal tcolorbox (with the hbox option) instead of a block:

\documentclass{beamer}
\usetheme{Warsaw}

\useinnertheme{tcolorbox}

\begin{document}

\begingroup
  \setbeamercolor{block title}{fg=black}
  \setbeamerfont{block title}{series=\bfseries}
  \setbeamertemplate{background canvas}{%
    \begin{tikzpicture}[inner sep=0pt,remember picture,overlay]
      \node at (current page.center) {\includegraphics[width=\paperwidth]{example-image-duck}};
    \end{tikzpicture}
  }
  \tcbset{
    enhanced,
    remember,
    frame hidden,
    interior hidden,
    underlay={
      \begin{tcbclipframe}
        \begin{scope}[inner sep=0pt, remember picture,overlay] 
          \fill[white] (current page.south west) rectangle (current page.north east);
          % blurred version of background image
          \node[opacity=0.9] at (current page.center) {\includegraphics[width=\paperwidth]{example-image-duck}};
        \end{scope}
      \end{tcbclipframe}
    }
  }  
\begin{frame}
\begin{tcolorbox}[title={block title},coltitle=black,fonttitle=\bfseries,hbox]
    text text text
\end{tcolorbox}
\end{frame}
\endgroup

\end{document}

enter image description here

2
  • Thank you! Seems to be much simpler than I thought. tcolorbox ticks well for many use cases. Thanks to its developer.
    – vrgovinda
    Mar 13 at 3:34
  • @vrgovinda You're welcome! Mar 13 at 8:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .