是否有可能将投影仪盒中的“褪色”阴影更改为“平面阴影”?
平面阴影指的是没有渐变的单一颜色阴影。理想情况下,我希望在库的样式中使用不透明阴影tikz.shadows
。可以按如下方式使用它为节点添加平面阴影:
\node[draw,drop shadow={opacity=.25, shadow xshift=0.07, shadow yshift=-0.07, color=green}] at (0,0) {node with green shadow};
这是我的 MWE beamer 文档,其中包含一个带有褪色阴影的框:
\documentclass{beamer}
\setbeamertemplate{blocks}[rounded][shadow=true] % use rounded blocks with standard beamer shadow
\begin{document}
\begin{frame}{Example frame}
\begin{block}{Block with shadow}
I, box, have a gradient shadow but I want a flat shadow.
\end{block}
\end{frame}
\end{document}
盒子阴影的定义肯定包含在包beamerbasedboxes.sty
中beamer
。不幸的是,我不明白代码,因为它主要使用低级 pgf 命令而不是 tikz 命令。到目前为止,我尝试修改此文件中的几个命令,但没有成功。或者也许我只是忽略了块模板的一个选项?
答案1
当有人提供仅有投影机的解决方案时,您可以考虑使用tcolorbox
其易于定制的盒子。
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\setbeamertemplate{blocks}[rounded][shadow=true] % use rounded blocks with standard beamer shadow
\begin{document}
\begin{frame}{Example frame}
\begin{block}{Block with shadow}
I, box, have a gradient shadow but I want a flat shadow.
\end{block}
\begin{tcolorbox}[enhanced,drop shadow, title=Example with tcolorbox]
I, box, have a flat shadow.
\end{tcolorbox}
\end{frame}
\end{document}
第二版本:
虽然我不知道我做了什么,但经过一些测试,我
从:
\documentclass{beamer}
\setbeamertemplate{blocks}[rounded][shadow=true] % use rounded blocks with standard beamer shadow
\makeatletter
\pgfdeclareradialshading[black,bg]{bmb@shadowball}{\pgfpointorigin}{%
color(0bp)=(black!20!bg); color(4bp)=(black!20!bg)}
\pgfdeclareradialshading[black,bg]{bmb@shadowballlarge}{\pgfpointorigin}{%
color(0bp)=(black!20!bg); color(4bp)=(black!20!bg); color(8bp)=(black!20!bg)}\pgfdeclareverticalshading[black,bg]{bmb@shadow}{200cm}{%
color(0bp)=(black!20!bg); color(4bp)=(black!20!bg); color(6bp)=(black!20!bg)}
\makeatother
\begin{document}
\begin{frame}{Example frame}
\begin{block}{Block with shadow}
I, box, have a gradient shadow but I want a flat shadow.
\end{block}
\end{frame}
\end{document}
答案2
您可以使用 tcolorbox 内部主题并添加平面阴影,如下所示:
\documentclass{beamer}
\usetheme{Warsaw}
\useinnertheme[rounded,shadow=false]{tcolorbox}
\tcbset{
drop shadow
}
\begin{document}
\begin{frame}{Example frame}
\begin{block}{Block with shadow}
I, box, have a gradient shadow but I want a flat shadow.
\end{block}
\end{frame}
\end{document}