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

1

1 Answer 1

7

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

1
  • Is this possible to change the rule color for \ovalbox? Please suggest...
    – MadyYuvi
    Commented Jan 31, 2021 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .