tcolorbox 内部主题 - 模糊背景

tcolorbox 内部主题 - 模糊背景

我受到 SamCarter 的演讲的启发,并尝试了以下步骤来获得模糊的背景效果。

我刚刚从她那里复制了代码。但似乎不起作用。我是不是漏掉了什么?

\documentclass{beamer}
\usetheme{Warsaw}

\useinnertheme{tcolorbox}

\begin{document}


\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]
{/home/vrgovinda/goloka-pictures/3-realms_2.jpg}};%
\end{scope}
\end{tcbclipframe}
}}}

\begin{block}{block title}
    Hare Krishna
\end{block}


\end{frame}
\end{document}

beamerinnerthemetcolorbox.sty我的文件夹中有相关内容texmf

结果如下:

https://imgur.com/s66Jx8p.png

答案1

Beamer 的语法不太好,它允许\begin{frame},\begin{frame}{frametitle}\begin{frame}{frametitle}{framesubtitle}。为此,它会测试其后的下一个字符是否\begin{frame}为 a {,然后假定这将是帧标题的开头。

比较这两帧的结果:

\documentclass{beamer}

\begin{document}

\begin{frame}
{test}
\end{frame}

\begin{frame}

{test}
\end{frame}
\end{document}

因此,在您的特定代码中,{\tcbset...}被解释为框架标题,并且修改永远不会到达框架主体中而不是标题中的块。

example-image-duck在下面的代码中将第二幅图替换为背景图像的模糊版本:

\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}

在此处输入图片描述

相关内容