[Tex/LaTex] Black and white emphasis for \boxed

equationsframed

I am using \boxed to place emphasis on important equations in an assignment I am typing up, and would like to give the final answer a bit of extra emphasis. I'm using \begin{equation} ... \end{equation} to number each line, so that I can put in references in the text.

There are some very nice looking boxes in the answers to Attractive Boxed Equations and framed equations, but both rely on colour, when I have a black and white printer. I was thinking of a double line around the final equation, but I'll take other answers if they are easier to code or look better.

I would love it if either the balanced boxes or the full width boxes were incorporated into the answer, but this is optional. It is a class assignment that the TA will look at for all of 10 minutes, not a publication.

Minimal Working Example:

\documentclass[letterpaper]{article}
\usepackage{kpfonts}
\usepackage{amssymb,mathtools}

\begin{document}
\begin{equation} \frac{M}{R} \propto R^2 \rho  \end{equation}
\begin{equation} \label{eqn:density} \boxed{ \rho \propto \frac{M}{R^3} } \end{equation}
\end{document}

Best Answer

You can use the predefined boxes from the fancybox package, which you can wrap around equations via the empheq package:

\documentclass[letterpaper]{article}
\usepackage{kpfonts,amssymb,empheq,fancybox}

\newsavebox{\mybox}

\newcommand{\raisedshadowbox}[1]{%
\sbox\mybox{\shadowbox{#1}}%
\raisebox{-0.5\ht\mybox-0.5\shadowsize+0.6ex}{\usebox\mybox}%
}

\begin{document}

A double box

\begin{empheq}[box=\doublebox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

An oval box (cheesy)

\begin{empheq}[box=\ovalbox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

A shadowbox, which has some vertical alignment problems \ldots

\begin{empheq}[box=\shadowbox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\ldots which apparently can be fixed by sticking it into a raisebox. 

\begin{empheq}[box=\raisedshadowbox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\end{document}

This gives

enter image description here

Note that the definition of \raisedshadowbox contains a fudge factor of 0.6ex for the vertical offset correction. I don't know what this compensates for, but it does seem to work across different font sizes, line heights as well as \shadowbox, \fboxsep and \fboxrule settings.