I often used \boxed{...}
from the AMS math package to place a box around important equations. However, this approach often produces somewhat awkward looking output. Consider
\documentclass{article}
\pagestyle{empty}
\usepackage{amsmath}
\begin{document}
\[
\boxed{c_i = \sum_jA_{ij}}
\]
\[
\boxed{c_i = \langle\psi|\phi\rangle}
\]
\end{document}
Observe that in the first case the box looks unbalanced while in the second case could do with more padding on both the top and bottom. What is the best way to go about this? I know that I could use a \phantom
but am wondering if more elegant solutions exist.
Best Answer
You can use the
empheq
package and then define your own boxing command. It can be a standard Latex\fbox
or a Tikz box, or any other type of box. Look at the example below. I have defined a color box (to make it more interesting) with two optional arguments for padding the space above and below the equationThe
keyval
package is already loaded so you can make a fancy keyval interface, but I leave that as an exercise to the reader ;-)