[Tex/LaTex] tikz and mdframed + shadow drop and shading

mdframedshadingshadowstikz-pgf

I'm interesting in Boxed text between pages 2nd version: exercise box with mdframed.
Ho to add to this :
Vertically shaded frametitle and Vertically shaded box with dropping shadow?

Yes i have seen several examples here for shadows and vertical shading but thay use styles i cannot put in mdframed.

here is another example.
2 questions:
1.ho can i change size of rounded titlebox shadow's size?
2. how can i remove that red titlebox thing? or another alternative would be to start shading from top including rectangular titleframe

\documentclass{article}
\usepackage[a5paper]{geometry}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{amsmath,amssymb}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{shadows}
\usetikzlibrary{calc}
\usepackage{lipsum}
\newcounter{exe}

\newenvironment{Fancybox}[1][.5\textwidth]
{%
    \stepcounter{exe}%
  \mdfsetup{%
      frametitle={%
      \tikz[baseline=(current bounding box.east),outer sep=8pt]
      \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,
                    ]
        {\strut Exercise~\theexe};},%
    skipabove=\topskip,
    skipbelow=\topskip,
    innertopmargin=1pt,
    apptotikzsetting={\tikzset{mdfbackground/.append style={top color=blue!40, bottom color=white}}},
    linecolor=blue,%
    innerlinewidth=1pt,
    topline=true,
    shadow=true,
    rightline=true,innerleftmargin=10,innerrightmargin=10,
    frametitlerule=false,
    frametitlebackgroundcolor=red,
    shadowcolor=blue!40,
    frametitleaboveskip=\dimexpr-\ht\strutbox\relax,
    roundcorner=5pt,
    singleextra={\path let \p1=(P), \p2=(O) in node[fill=blue!40,font=\color{black}] at (P|-0,0.5*\y2+0.5*\y1) {$\clubsuit$};}
  }
  \begin{mdframed}[userdefinedwidth=#1]\allowdisplaybreaks\relax%
}
{\end{mdframed}}

\begin{document}
\lipsum[1-4]
\begin{Fancybox}[1\textwidth]
         \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}[1\textwidth]
         \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}


\end{document}

Best Answer

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}

enter image description here

Related Question