Beamer:创建带有“凹陷”阴影的框

Beamer:创建带有“凹陷”阴影的框

我目前正在使用 beamer 类的块环境,我想知道是否有可能出现某种“凹陷”阴影。

根据文档,您只能选择打开或关闭阴影。

可视化某个东西属于“较低”的层次,类似于带有“凹陷”阴影的盒子http://www.html5code.nl/wp-content/uploads/css3_box_shadow8.png

答案1

你可以伪造与你的图像相似的东西

\documentclass{beamer}
\usetheme{CambridgeUS} 

\usepackage[most]{tcolorbox}  

\newenvironment{emblock}
  {\begin{actionenv}\begin{tcolorbox}[
                    enhanced,
            colframe=white,
            colback=white, 
                    borderline north={0.2mm}{0.6mm}{gray!25!white},
                    borderline west ={0.2mm}{0.6mm}{gray!25!white},
                    borderline north={0.2mm}{0.4mm}{gray!50!white},
                    borderline west ={0.2mm}{0.4mm}{gray!50!white},
                    borderline south ={0.2mm}{0.0mm}{gray!50!white},
                    borderline east ={0.2mm}{0.0mm}{gray!50!white},
                    borderline north={0.2mm}{0.2mm}{gray!75!white},
                    borderline west ={0.2mm}{0.2mm}{gray!75!white},
                    borderline north={0.2mm}{0.0mm}{gray},
                    borderline west ={0.2mm}{0.0mm}{gray},
    ]
  }
  {\end{tcolorbox}\end{actionenv}}

\newenvironment{hblock}
  {\begin{actionenv}\begin{tcolorbox}[
                    enhanced,
            colframe=white,
            colback=white, 
                    borderline south={0.2mm}{0.6mm}{gray},
                    borderline east ={0.2mm}{0.6mm}{gray},
                    borderline south={0.2mm}{0.4mm}{gray!75!white},
                    borderline east ={0.2mm}{0.4mm}{gray!75!white},             
                    borderline south={0.2mm}{0.2mm}{gray!50!white},
                    borderline east ={0.2mm}{0.2mm}{gray!50!white},
                    borderline north={0.2mm}{0.0mm}{gray!50!white},
                    borderline west ={0.2mm}{0.0mm}{gray!50!white},
                    borderline south={0.2mm}{0.0mm}{gray!25!white},
                    borderline east ={0.2mm}{0.0mm}{gray!25!white},
    ]
  }
  {\end{tcolorbox}\end{actionenv}}

\begin{document}
    \begin{frame} 
        \begin{emblock} 
            Preface 
            \end{emblock} 

        \begin{hblock} 
            Preface 
            \end{hblock}            
    \end{frame} 
\end{document}

在此处输入图片描述

答案2

也许是这样的:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{fadings}
\usetikzlibrary{backgrounds}

\definecolor{consolegray}{RGB}{192,192,192}
\newcommand\cfwidth{5pt}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[inner sep=1em,
      line width=\cfwidth,
      draw=consolegray,
      fill=black,
      text=consolegray] (error) 
 {\ttfamily\footnotesize\begin{tabular}{@{}l@{}}
! LaTeX Error: Something's wrong--perhaps a missing \textbackslash item.\\\\

See the LaTeX manual or LaTeX Companion for explanation.\\
Type  H <return>  for immediate help.\\
 ...
\end{tabular}};


\shade[left color=consolegray!70!black,right color=consolegray, middle color=consolegray!10!white] (error.south west) -- (error.north west) --
            ($(error.north west)+(\cfwidth,-\cfwidth)$)  -- ($(error.south west)+(\cfwidth,\cfwidth)$) --cycle ;

\shade[top color=consolegray!70!black,bottom color=consolegray, middle color=consolegray!10!white] (error.north west) -- (error.north east) --
            ($(error.north east)+(-\cfwidth,-\cfwidth)$)  -- ($(error.north west)+(\cfwidth,-\cfwidth)$) --cycle ;

\shade[left color=consolegray,right color=consolegray!70!black, middle color=consolegray!10!white] (error.north east) -- (error.south east) --
            ($(error.south east)+(-\cfwidth,\cfwidth)$)  -- ($(error.north east)+(-\cfwidth,-\cfwidth)$) --cycle ;

\shade[top color=consolegray,bottom color=consolegray!70!black, middle color=consolegray!10!white] (error.south east) -- (error.south west) --
            ($(error.south west)+(\cfwidth,\cfwidth)$)  -- ($(error.south east)+(-\cfwidth,\cfwidth)$) --cycle ;

\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

答案3

vignette这可能是图书馆的工作tcolorbox

那么以下内容如何:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[vignette,skins]{tcolorbox}

\newtcolorbox{bevel}[1][]{enhanced,
  colback=white,colframe=white,
  sharp corners,boxrule=1mm,#1,
  underlay={\begin{tcbclipframe}\tcbvignette{%
    size=1mm,
    draw method=clipped,
    north style={black!80,path fading=south},
    east style={black!30,path fading=west},
    south style={black!10,path fading=north},
    west style={black!60,path fading=east},
    inside node=frame
  }\end{tcbclipframe}}}

\begin{document}
  \begin{frame}
    \begin{bevel}
      Some text.
     \end{bevel}

    \begin{bevel}[hbox]
      Some text.
    \end{bevel}

    \begin{bevel}[hbox,colback=blue!20,colframe=blue!30]
      Some text.
    \end{bevel}

  \end{frame}
\end{document}

在此处输入图片描述

相关内容