[Tex/LaTex] Lifted or curved drop shadow

beamertikz-pgf

Does anyone know if it is possible to create a "lifted corner" or curved drop shadow effect for a text box?

Something similar to this
drop shadow effect

Best Answer

Here's another approach using tcolorbox with version 3.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 option drop lifted shadow, drop small lifted shadow, or drop large lifted shadow:

\documentclass{article}

\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\begin{document}

\tcbox[enhanced,size=fbox,arc=0pt,outer arc=0pt,colback=blue!5!white,
  before=\centering,colframe=blue!15!white,drop small lifted shadow]
  {A small box with a small shadow}

\bigskip

\begin{tcolorbox}[enhanced,colback=white,colframe=black!50!white,boxrule=1pt,
  arc=0pt,outer arc=0pt,drop lifted shadow]
\lipsum[2]
\end{tcolorbox}

\bigskip

\begin{tcolorbox}[enhanced,colback=yellow!5!white,colframe=black!50!yellow,boxrule=1pt,
  drop lifted shadow]
\lipsum[2]
\end{tcolorbox}

\bigskip

\begin{tcolorbox}[enhanced,colback=red!5!white,colframe=black!50!red,boxrule=1pt,
  arc=0pt,outer arc=0pt,drop large lifted shadow]
\lipsum[2]
\end{tcolorbox}

\end{document}

enter image description here

Old version of the answer (valid for tcolorbox older than version 3.05):

The following code adds some new shadow features drop lifted shadow and drop heavy lifted shadow to tcolorbox.

\documentclass{article}

\usepackage[many]{tcolorbox}% until version 3.04
\usepackage{lipsum}

\makeatletter

\def\tcb@shadow@lifted#1#2#3#4{%
  \path[fill,rounded corners=\tcb@outer@arc,#4]
       ([xshift=#1+#3,yshift=#2+#3]frame.south west)
    .. controls ([yshift=\dimexpr#3]frame.south) ..
       ([xshift=-#1-#3,yshift=#2+#3]frame.south east)
    -- ([xshift=-#1-#3,yshift=#2-#3]frame.north east)
    -- ([xshift=#1+#3,yshift=#2-#3]frame.north west)
    -- cycle;
}

\tcbset{
  lifted shadow/.style args={#1#2#3#4}{shad@w app={%
    \begin{scope}[#4]%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr-4\dimexpr#3}{opacity=0.01}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr-3\dimexpr#3}{opacity=0.02}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr-2\dimexpr#3}{opacity=0.04}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr-#3}{opacity=0.07}%
      \tcb@shadow@lifted{#1}{#2}{0pt}{opacity=0.11}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr+#3}{opacity=0.11}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr+2\dimexpr#3}{opacity=0.07}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr+3\dimexpr#3}{opacity=0.04}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr+4\dimexpr#3}{opacity=0.02}%
      \tcb@shadow@lifted{#1}{#2}{\dimexpr+5\dimexpr#3}{opacity=0.01}%
  \end{scope}}},%
  drop lifted shadow/.style={lifted shadow={1.5mm}{-1.5mm}{0.12mm}{#1}},
  drop lifted shadow/.default={black!50!white},%
  drop heavy lifted shadow/.style={lifted shadow={2mm}{-3mm}{0.16mm}{#1}},
  drop heavy lifted shadow/.default={black!50!white},%
}

\makeatother

\begin{document}

\begin{tcolorbox}[enhanced,colback=white,colframe=black!50!white,boxrule=1pt,
  arc=0pt,outer arc=0pt,drop lifted shadow]
\lipsum[2]
\end{tcolorbox}

\bigskip

\begin{tcolorbox}[enhanced,colback=yellow!5!white,colframe=black!50!yellow,boxrule=1pt,
  drop lifted shadow]
\lipsum[2]
\end{tcolorbox}

\bigskip

\begin{tcolorbox}[enhanced,colback=red!5!white,colframe=black!50!red,boxrule=1pt,
  arc=0pt,outer arc=0pt,drop heavy lifted shadow]
\lipsum[2]
\end{tcolorbox}

\end{document}

enter image description here

Related Question