You could use the pgf-blur
package, which gives you this:
In fact, it can add a "faded" drop shadow to pretty much anything:
The shadow fading is not continuous, like in the previously accepted answer. It fades in a number of discrete steps, but that number can be changed, see the documentation.
Here's the code for the examples:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes.symbols}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node[draw=none,shade,
top color=blue!40,
bottom color=blue!5,
rounded corners=6pt,
blur shadow={shadow blur steps=5}
] {\sffamily\bfseries\large A pretty box};
\node[tape,draw=none,shade,
top color=blue!40,
bottom color=blue!5,
rounded corners=1pt,
blur shadow={shadow blur steps=5,shadow blur extra rounding=1.3pt}
] at (5,0){\sffamily\bfseries\large Another pretty box};
\end{tikzpicture}
\end{center}
\end{document}
Edit
Sometimes, PDF renderers will show a dark line in the center of the shadow. This is due to the way they handle anti-aliasing and clipping. To avoid this:
- Use pgf-blur v1.01, which tries hard to hide this artefact
- In Acrobat, turn off the "Page Display" preference "Enhance thin lines". These shadows consist of many thin lines, and they won't look good if Acrobat changes their width
- Don't use too many
blur shadow steps
. It looks best if you have about two pixels per step at viewing resolution.
If I zoom the table on page 8 I don't see any drop shadow and all the rules are black; however, if you want to give a drop shadow to the table, you can put the tabular
inside a \node
and use the shadows
library from TikZ
:
\documentclass[xcolor={dvipsnames,table}]{beamer}
\usepackage{tikz}
\usetikzlibrary{shadows}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\node[drop shadow,fill=white,inner sep=0pt]
{\rowcolors{1}{RoyalBlue!20}{RoyalBlue!5}
\begin{tabular}{|l|c|}\hline
J.\ S.\ Bach & 1685--1750 \\
W.\ A.\ Mozart & 1756--1791 \\
L.\ Beethoven & 1770--1827 \\
F.\ Chopin & 1810--1849 \\
R.\ Schumann & 1810--1856 \\ \hline
\end{tabular}%
};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
On a side note, and just as a personal opinion, I would remove the vertical rules from the table.
Here's another option using \shadowbox
from the fancybox
package:
\documentclass[xcolor={dvipsnames,table}]{beamer}
\usepackage{fancybox}
\begin{document}
\begin{frame}
\begin{center}
\setlength\fboxsep{0pt}
\shadowbox{%
\rowcolors{1}{RoyalBlue!20}{RoyalBlue!5}
\begin{tabular}{|l|c|}\hline
J.\ S.\ Bach & 1685--1750 \\
W.\ A.\ Mozart & 1756--1791 \\
L.\ Beethoven & 1770--1827 \\
F.\ Chopin & 1810--1849 \\
R.\ Schumann & 1810--1856 \\ \hline
\end{tabular}%
}
\end{center}
\end{frame}
\end{document}
Best Answer
Here's another approach using
tcolorbox
with version3.05 (2014/05/28)
or newer. The lifted shadow of the old answer below has become an integrated feature (with different implementation) and is available by the optiondrop lifted shadow
,drop small lifted shadow
, ordrop large lifted shadow
:Old version of the answer (valid for
tcolorbox
older than version 3.05):The following code adds some new shadow features
drop lifted shadow
anddrop heavy lifted shadow
totcolorbox
.