# New environment special colored box

I would like to construct a new environment that I can call like:

\begin{Box}{*Title of Box*}

** Text **
** Math equations **

\end{Box}


It shall have the following properties:

• The box background shall have a colour.
• The text inside the box shall have a distance of 3 - 5 mm to the boundary.
• Important: It shall break at the end of a page and continue at the next page.

Is there someone who can do that?

• Use the package tcolorbox. – Ulrike Fischer Jun 2 '16 at 11:08
• Welcome to TeX.SE. How wide should be color box be? – Mico Jun 2 '16 at 11:37

This can be achieved with tcolorbox, one of my favourite packages (;-))

\documentclass{article}

\usepackage[most]{tcolorbox}

% Define a new box for this
\newtcolorbox[auto counter]{MyBox}[2][]{%
title={MyBox \thetcbcounter\ #2},
boxsep=1mm,
colback=white!40!yellow,
breakable,
#1
}

\usepackage{blindtext}
\begin{document}

\begin{MyBox}{My nice title box}

\blindtext

$E=mc^2$

\blindtext[3]

\end{MyBox}

\begin{MyBox}[width={0.5\textwidth},coltitle={blue}, colbacktitle={gray},colback={green!60!blue}]{My nice title box, but not so wide}

\blindtext

$E=mc^2$

\blindtext[3]

\end{MyBox}

\end{document}