# Small box just surrounding the equation, not the whole line?

The following example makes a huge box that's the full width of the text, including the equation number:

\begin{framed}
$$x=y$$
\end{framed}


Is there a way to get a box just around the equation itself?

Best is to use boxed from amsmath.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Using \verb|boxed| from \verb|amsmath|:
$$\boxed{x=y}$$
Using \verb|fbox|:
$$\fbox{x=y}$$

\end{document}


If you use align and friends from amsamth, you are better off with Aboxed from mathtools package. A relevant and useful reference will be This question and its answers.