tcolorbox 内部主题——自动将块大小调整为文本大小

tcolorbox 内部主题——自动将块大小调整为文本大小

相关问题 -tcolorbox 内部主题 - 模糊背景

平均能量损失

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

但是我希望使用 tcolorbox 内部主题时块大小能够适合其中的文本内容。有人能给出提示吗?

答案1

内部主题tcolorbox尽力模仿默认的投影仪块,包括它们的宽度。

对于这种情况,我会使用普通的 tcolorbox(带有选项hbox)而不是块:

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

在此处输入图片描述

相关内容