beamercolorbox 的虚线边框

beamercolorbox 的虚线边框

是否可以绘制带有虚线边框的 beamercolorbox?我在 Beamer 文档中找不到此类装饰的可能性。

答案1

您可以使用tcolorbox

\documentclass[aspectratio=169]{beamer}
\usetheme{default}
\usepackage[most]{tcolorbox}

\setbeamertemplate{blocks}[rounded][shadow=true]
%\setbeamercolor{block body example}{bg=red!20!white}
%\setbeamercolor{block title example}{fg=red, bg=red!40!white}
% \definecolor{bitsdeepBlue}{RGB}{42, 42, 134}



\newtcolorbox{myblock}[1][]{%
    enhanced jigsaw,%
    colback=red!20!white!90!,%
%    colframe=red!85!white!90!,%
    colbacktitle=red!45!white!90!,
    % size=small,%
    % boxrule=1pt,%
    title=\textbf{\textit{Example}},%
    halign title=flush left,%
    coltitle=red,%
    breakable,%
    drop fuzzy shadow=black!70!white,%
    left=0pt,
    titlerule=0pt,
    top=1pt,
    bottom=0pt,
    enlarge left by=-0.1cm,
    grow to right by=0.21cm,
    frame empty,
    borderline={0.5mm}{0mm}{red!85!white!90!,dashed},
}

\begin{document}
\begin{frame}{Frame Title}
\begin{myblock}
    this is default.
    \end{myblock}
\end{frame}
\end{document}

在此处输入图片描述


使用新的 tcolorbox 内部主题(https://www.ctan.org/pkg/beamertheme-tcolorbox),添加虚线边框现在变得更加简单:

\documentclass[aspectratio=169]{beamer}

\usetheme{Warsaw}
\useinnertheme{tcolorbox}

\tcbset{
  borderline={1.5pt}{-1.5pt}{block title.bg,dashed},
}
   
\begin{document}
\begin{frame}
\begin{block}{title}
    this is default.
\end{block}
\end{frame}
\end{document}

在此处输入图片描述

相关内容