# Beamer: Create box with 'sunken' shadow

I'm currently using the block environment of the beamer class and I wondered whether it is possible to have some kind of 'sunken' shadow.

According to the documentation you can only choose between turning on or off shadows.

It would be really nice for visualizing that something belongs to a 'lower' level similar to box with 'sunken' shadow http://www.html5code.nl/wp-content/uploads/css3_box_shadow8.png

• For all kinds of fancy shadows, simply use a tcolorbox. See texdoc.net/show.php?pkg=tcolorbox for the available shadows (section 10.6.1 and following) and tex.stackexchange.com/questions/202035/… for the application to beamer. Maybe you could specify what you mean by sunken shadow? – samcarter_is_at_topanswers.xyz Dec 12 '16 at 13:07
• Thanks. I looked through the documentation of tcolorbox and it seems like there is not the type of shadow I'd like to have. Should be similar to what you see here: i.stack.imgur.com/FFRLv.png (for the box though, not the text). So the shadow should be 'inside' that box such that it appears to be behind the rest of the slide. – dba Dec 12 '16 at 13:27
• the buzzwords are bevel and emboss – percusse Dec 12 '16 at 17:37
• Thanks! Googling for bevel/embess and latex seems to bring no results. Maybe there is no implementation of this for latex boxes yet? – dba Dec 13 '16 at 14:55

You could fake something similar to your image

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


Perhaps something like this:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\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}


This could be a job for the vignette library of tcolorbox.

How about the following:

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