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.
One option using singleextra
, firstextra
to place the title, instead of frametitle
; in this way you can easily obtain the desired shading effect for the background. To control the shadow attributes, you can use all the available keys for example scale
, xshift
, yshift
(refer to the PGF manual). For frames without page breaks a decoration was added midways vertically on the right side (as requested in a comment):
\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage[framemethod=tikz]{mdframed}
\usepackage{amsmath,amssymb}
\usetikzlibrary{calc}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{shadows}
\newcounter{exe}
\newenvironment{Fancybox}[1][\textwidth]
{\stepcounter{exe}%
\mdfsetup{
singleextra={%
\node[draw=blue!40,anchor=east,rectangle, thick,font=\color{black}, double,
top color=blue!40,
bottom color=blue!5,
rounded corners=8pt,
drop shadow={shadow xshift=1.5pt, shadow yshift=-1.5pt},anchor=west
] at ([xshift=20pt]O|-P)
{\strut Example~\theexe};
\path let \p1=(P), \p2=(O) in node[fill=blue!40,font=\color{white}] at (P|-0,0.5*\y2+0.5*\y1) {$\clubsuit$};},%
firstextra={%
\node[draw=blue!40,anchor=east,rectangle, thick,font=\color{black}, double,
top color=blue!40,
bottom color=blue!5,
rounded corners=8pt,
drop shadow={shadow xshift=1.5pt, shadow yshift=-1.5pt},anchor=west
] at ([xshift=20pt]O|-P)
{\strut Example~\theexe};},%
skipabove=\topskip,
skipbelow=\topskip,
innertopmargin=18pt,
linecolor=red,%
innerlinewidth=0.8pt,
topline=true,
apptotikzsetting={\tikzset{mdfbackground/.append style={%
shade,top color=blue!35, bottom color=white}}},
frametitleaboveskip=\dimexpr-\ht\strutbox\relax,
roundcorner=5pt,
linecolor=blue,%
innerlinewidth=1pt,
topline=true,
shadow=true,
rightline=true,innerleftmargin=10,innerrightmargin=10,
shadowcolor=blue!40,
}
\begin{mdframed}[userdefinedwidth=#1]\relax%
}
{\end{mdframed}}
\begin{document}
\begin{Fancybox}
To calculate the horizontal position the kinematic differential
equations are needed:
\begin{align}
\dot{n} &= u\cos\psi -v\sin\psi \\
\dot{e} &= u\sin\psi + v\cos\psi
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\begin{Fancybox}
To calculate the horizontal position the kinematic differential
equations are needed:
\begin{align}
\dot{n} &= u\cos\psi -v\sin\psi \\
\dot{e} &= u\sin\psi + v\cos\psi
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\begin{Fancybox}[7cm]
To calculate the horizontal position the kinematic differential equations are needed:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\end{document}
Best Answer
Completely EDIT 2012-03-04:
I uploaded the new version 1.3 to CTAN. At the moment the files are available at github.
This version provides a key named
shadow
. This allows to draw a shadow. The shadow can be manipulated by the new keysshadowsize
andshadowcolor
If you use
framemethod=tikz
it is important to load the TikZ libraryshadows
.mdframed
can do the job but I don't want to load any libraries.For the methods TikZ and PSTricks I defined a style
mdfshadow
bytikzset
/newpsstyle
. For more settings manipulate this key.Based of the new modification I created the following example:
The result is:
An other example is provided in file
mdframed-example-pstricks.pdf
which usespstricks
andframetitle
: