3

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?

7

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} 

enter image description here

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

4

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}

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.