3

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

6

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

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.