I'm using the code below to draw a nice fancy box around some important equations in my documents. I would like to draw a
vertically symetrical box around the equal sign, whatever the symbols entering the equation. Currently, the box is a bit too high above the "=", and I have to hack the equation by adding some invisible symbols (adding \phantom{\frac{1}{2}}, for example, but then the box may become too big). Is there a way to modify the macro so all boxes are perfectly symetrical (vertical symetry !), while not too big at the same time ?
Code: Select all
\documentclass[12pt,letterpaper,twoside]{book}
\usepackage{xcolor}
\usepackage{empheq}
\definecolor{beige}{RGB}{240,235,225}
\newenvironment{important}[2][]{
\setkeys{EmphEqEnv}{#2}
\setkeys{EmphEqOpt}{box={\setlength{\fboxsep}{10pt}\fcolorbox{black}{beige}},#1}
\EmphEqMainEnv}
{\endEmphEqMainEnv}
\begin{document}
\begin{important}{equation}
E = m \, c^2.
\end{important}
\end{document}
Take note that some equations may not have an "=" in them. Also, using other environments like
align (instead of
equation) may cause some problems with the vertical symetry idea. How to define a vertical symetry if there are two aligned equations one on top of another ?