# tikzmark shadow around box

I have drawn a rounded box around my equations using this code :

\usepackage[customcolors]{hf-tikz}
\usepackage[framemethod=tikz]{mdframed}
\hfsetbordercolor{green}
$$\tikzmarkin{g}(0.4,-0.5)(-0.2,0.75)r = \frac{n \sum xy - \sum x \sum y} {\sqrt{[n \sum x^2 - (\sum x)^2][n \sum y^2 - (\sum y)^2]}}\tikzmarkend{g}$$


I'm wandering how I can add a grey shadow around the outline of the box ?

Thanks for any help!

• \tikzmarkin is not a command defined by either the tikzmark libary or TikZ itself, can you add a complete example? Edit: OK, I see it's defined by hf-tikz, but still, an MWE would have been preferable. – Torbjørn T. Nov 29 '15 at 18:50

## 2 Answers

Another solution. This one uses tcolorbox instead of mdframed.

\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}

\tcbset{colback=yellow!20!white,colframe=blue!50!black,
highlight math style={enhanced, drop shadow}
}

\begin{document}
$$\tcbhighmath{r=\frac{n \sum xy - \sum x \sum y} {\sqrt{[n \sum x^2 - (\sum x)^2][n \sum y^2 - (\sum y)^2]}}}$$
\end{document}


Well, this is not rounded box ... but for starting point should serve the following example:

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{fancybox}
\usepackage{empheq}

\usepackage[active,tightpage]{preview}% just to show only equation
\setlength\PreviewBorder{1em}

\begin{document}
\definecolor{shadowcolor}{rgb}{0,.5,.5}
\setlength\shadowsize{2pt}

\begin{preview}
\begin{empheq}[box=\shadowbox*]{gather}
E = mc^2
\end{empheq}
\end{preview}
\end{document}


Which gives:

When you provide MWE or what you try so far, I will try to adopt this answer to your wish.