# Equations in fancy boxes

I've checked the post here, where the package empheq is used for embedding equations into coloured boxes.

With that idea, I wrote in my file the following:

% in the preambule
\usepackage{empheq}
\newcommand*\mybox[1]{%
\colorbox{burlywood1}{\hspace{1em}#1\hspace{1em}}}

% in the body
\begin{empheq}[box=\mybox]{align}
...equation here...
\end{empheq}


It works nicely. However, I'd like to create a new environment for such a box... I tried something like,

\newenvironment{colbox}{%
\begin{empheq}[box=\mybox]{align}}{\end{empheq}}


but this doesn't work.

### **Questions**

• Can someone help me to define this environment?
• Is it possible to define an environment which the colour is an argument? So I can use different colours.

Thank you all.

-

Please always make full documents when asking questions, it makes things a lot easier.

It seems that like a lot of environments that grab the environment body you need to use this form when wrapping in environment definitions (AMS display environments have the same feature):

\documentclass{article}

\usepackage{color,empheq}

\newcommand*\mybox[1]{%
\colorbox{yellow}{\hspace{1em}#1\hspace{1em}}}

\newenvironment{colbox}{%
\empheq[box=\mybox]{align}}{\endempheq}

\newenvironment{xcolbox}[1]{%
\def\mybox##1{\colorbox{#1}{\hspace{1em}##1\hspace{1em}}}%
\empheq[box=\mybox]{align}}{\endempheq}

\begin{document}
% in the body
\begin{empheq}[box=\mybox]{align}
...equation here...
\end{empheq}

\begin{colbox}
...equation here...
\end{colbox}

\begin{xcolbox}{red}
...equation here...
\end{xcolbox}

\end{document}

-
Thank you for the quick response. Next time I'll follow your advise about the whole document. Cheers. –  Dox Aug 16 '12 at 13:42