# How can I write framed formulas in my LaTeX document?

I am interested in this thing because I think that the framed formulas make my document more beautiful. For example how can I make this formula framed?

$F=m\cdot a$


I would like to make a light green frame around it. It does not need to be too wide (I mean it does not need to be as wide as the paper, which is A4 paper). So how can I make this frame? Can I modify the width of it?

• – moewe Aug 22 '15 at 16:17
• Please read the tag excerpts before you use them :) – Sean Allred Aug 22 '15 at 20:02

Here is a simple coloured box around an alignment, made with the help of empheq and xcolor. Needless to load amsmath: empheq loads mathtools, which loads amsmath. I added a quad on each side of the box so it doesn't look too tight.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[x11names]{xcolor}
\usepackage{empheq}
\newcommand*\widefcolorbox[1]{\setlength\fboxrule{0.8pt}\fcolorbox{DarkSeaGreen3}{LemonChiffon1!15!}{\hspace{1em}#1\hspace{1em}}}

\begin{document}

\begin{empheq}[box=\widefcolorbox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\end{document}


You can see much fancier boxes in the empheq documentation, §6.2.

From the empheq package documentation,

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


EDIT:

To get the box in color, you can simply do this:

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


• Could you add the colouring requested and an image of the result? – Andrew Swann Aug 23 '15 at 11:54