# How do I make \widefbox bigger in the vertical direction?

I want to enclose some equations in a widebox, but I need to make the box bigger the the y-direction/vertical direction. How is this done?

A sample code is given below (taken from the empheq manual).

\documentclass{minimal}
\usepackage{empheq}
\begin{document}
\newcommand*\widefbox[1]{\fbox{\hspace{1em}#1\hspace{1em}}}
\begin{empheq}[box=widefbox]{align*}
a&=b \tag{*}\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}
\end{document}


Thank you!

-
Please check your MWE produces the example that you expect. As posted that typesets widefbox before the equation. – David Carlisle Mar 11 '14 at 14:10
Please, don't use the minimal class, even for short examples. – egreg Mar 11 '14 at 14:31

\documentclass{minimal}
\usepackage{empheq}
\begin{document}
\newcommand*\widefbox[1]{\fbox{\rule[-1.8cm]{0pt}{4cm}\hspace{1em}#1\hspace{1em}}}
\begin{empheq}[box=\widefbox]{align*}
a&=b \tag{*}\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}
\end{document}

-

You can \addstackgap in the definition. The optional argument (here 20pt) can be changed to suit. This gap is an addition to the existing equation height/depth (rather than a replacement to it, which a \rule would be).

\documentclass{minimal}
\usepackage{empheq}
\usepackage{stackengine}
\begin{document}
\begin{empheq}[box=\widefbox]{align*}
a&=b \tag{*}\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}
\end{document}

-
1+ This is a more versatile solution! – Gonzalo Medina Mar 11 '14 at 14:19

An indirect solution. Offsets definition provided by hf-tikz allows more flexibility in customizing the frame size.

\documentclass{article}
\usepackage{amsmath}
\usepackage[customcolors]{hf-tikz}

\tikzset{offset definition 1/.style={
above left offset={-0.4,0.6},
below right offset={0.4,-0.5},
},
offset definition 2/.style={
above left offset={-0.4,1.5},
below right offset={0.4,-1.3},
},
filling/.style={
disable rounded corners=true,
set fill color=white,
set border color=black,
},
box it 1/.style={
offset definition 1,
filling
},
box it 2/.style={
offset definition 2,
filling
},
}

\begin{document}

\begin{align*}
\tikzmarkin[box it 1]{a}a&=b \tag{*}\\
E&=mc^2 + \int_a^a x\, dx \tikzmarkend{a}
\end{align*}

\vspace{2cm}

\begin{align*}
\tikzmarkin[box it 2]{b}a&=b \tag{*}\\
E&=mc^2 + \int_a^a x\, dx \tikzmarkend{b}
\end{align*}
\end{document}


The result:

Remember to compile at least twice.

-