2

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.

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Feb 5 '15 at 11:34
6

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.