1

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

\usepackage[customcolors]{hf-tikz}
\usepackage[framemethod=tikz]{mdframed}
\hfsetbordercolor{green}
\begin{equation}
\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}
\end{equation}

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

Thanks for any help!

  • 2
    \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
3

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}
\begin{equation}
\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{equation}
\end{document}

enter image description here

1

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:

enter image description here

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

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.