Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to change the default color of a shadowbox to grey. How to do that with no problem of equation "style"/"management" inside the shadowbox ?

Thank you very much

share|improve this question
    
Please add a fully compilable minimal working example (MWE) that illustrates your problem. –  canaaerus Aug 2 '12 at 12:35
add comment

1 Answer

up vote 4 down vote accepted

Here's one possibility defining commands \Cshadowbox and \@Cshadowbox analogously to \shadowbox and \@shadowbox as implemented in fancybox.sty; the color can be changed using ShadowColor:

\documentclass{article}
\usepackage{xcolor}
\usepackage{fancybox}

\definecolor{ShadowColor}{RGB}{30,150,190}

\makeatletter
\newcommand\Cshadowbox{\VerbBox\@Cshadowbox}
\def\@Cshadowbox#1{%
  \setbox\@fancybox\hbox{\fbox{#1}}%
  \leavevmode\vbox{%
    \offinterlineskip
    \dimen@=\shadowsize
    \advance\dimen@ .5\fboxrule
    \hbox{\copy\@fancybox\kern.5\fboxrule\lower\shadowsize\hbox{%
      \color{ShadowColor}\vrule \@height\ht\@fancybox \@depth\dp\@fancybox \@width\dimen@}}%
    \vskip\dimexpr-\dimen@+0.5\fboxrule\relax
    \moveright\shadowsize\vbox{%
      \color{ShadowColor}\hrule \@width\wd\@fancybox \@height\dimen@}}}
\makeatother

\begin{document}

\shadowbox{$a=b$}

\Cshadowbox{$a=b$}

\definecolor{ShadowColor}{RGB}{90,0,20}

\Cshadowbox{$a=b$}

\colorlet{ShadowColor}{gray}

\Cshadowbox{$a=b$}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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