for everybody who wants some frame DIRECTLY AROUND THE EQUATION, and not over the whole width of the page, AND NUMBERING OUTSIDE THE FRAME, this may be interesting: I've modified some solution (by Phillip Helbig) from the Googlegroups-mail-archieve, which draws the frame in an LaTeX-document, so that it can be used in LyX. All one has to do is:
1. define the following "savebox" the document-header:
\newsavebox{\ggbox}
2. define a new macro by typing:
\newcommand{\equationbox}[1] {\savebox{\ggbox}{$\displaystyle #1$}\fbox{\usebox{\ggbox}}},
there is no difference in using fbox directly
\equationbox{\int\limits_2^{\infty}\frac{1}{x}dx=0.25} \fbox{$\displaystyle\int\limits_2^{\infty}\frac{1}{x}dx=0.25$}
You always use inline math, which is very easy to frame and so there is no need for an separate box. A problem is a framed display math. There is a solution with package varwidth
\usepackage{varwidth} \newcommand{\myMathBox}[1]{% \bgroup \abovedisplayskip=0pt \centerline{\fbox{% \begin{varwidth}[t]{\linewidth} #1 \end{varwidth}% }}% \egroup% }
and then
\myMathBox{\[\int\limits_2^{\infty}\frac{1}{x}dx=0.25\]}
to get a narrower frame is possible, but then we have to rewrite _all_ math environments.
Herbert