[Tex/LaTex] Shadowed box around the text with background color

shadows

I wonder how can I make a box around a text with a grey shadow and colored background. I can do just the shadow or just the background, but I can't make the two together.

Thanks.

Best Answer

Since you seem to be a beginner to these ugly jobs (apologies if not), have a good start. Start with tcolorbox. Details can be found in the manual which can be obtained by running texdoc tcolorbox from command prompt/terminal. Remember that there are many varieties of shadows if you look in to the manual.

\documentclass{article}
\usepackage{kantlipsum}
\usepackage[svgnames]{xcolor}
\usepackage[many]{tcolorbox}

\newtcolorbox{mybox}[1][]{
  drop shadow southeast,
  enhanced,colback=red!5!white,colframe=red!75!black,
  #1
}
\newtcolorbox{fancybox}[1][]{
  enhanced,drop fuzzy midday shadow,
  boxrule=1pt,arc=4pt,boxsep=0pt,
  left=.5em,right=.5em,top=1ex,bottom=1ex,
  colback=olive,#1
}

\newtcolorbox{myotherbox}[1][]{%nobeforeafter,
  enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white,
  bottom color=green!10!white,middle color=green!50!yellow},
  fuzzy halo=3mm with gray,#1}

\begin{document}
  \begin{fancybox}
    \kant[1]
  \end{fancybox}

  \bigskip
  \begin{mybox}
    \kant[2]
  \end{mybox}

  \bigskip
  \begin{myotherbox}
    \kant[3]
  \end{myotherbox}


\end{document}

enter image description here