Hello,
As it was enough for me with the first of the possibilities that Oleg
sent, I have adapted it a little bit
\def\dboxit#1#2{$$\vcenter{\boxit{\hbox{$\displaystyle #1$}}}\eqdef{#2}$$}%
and then use it as
\dboxit{\sum_{i=1}^n a_i = {n(a_l+a_n)\over2}}{sumi}
and it seems it works.
Thank you again,
Juan Mari