Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
Could you include an equation showing your current "emphasis" so the community has a frame of reference (or a \boxed reference :-))? –  Werner Jan 26 '12 at 0:27
    
I added a MWE. \boxed is from amsmath or mathtools. I used kpfonts as that is what I was using there, so if you compile it your equations will look exactly the same. –  Canageek Jan 26 '12 at 0:51

1 Answer 1

up vote 12 down vote accepted

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.

share|improve this answer
    
I like doublebox a lot, thank you. The easier it is for the TA to notice the things that should be me marks, the more likely I am to get them. –  Canageek Jan 26 '12 at 2:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.