The syntax is \myFloat[optArgs left]{text left}[optArgs right]{text right}{caption}{label} the last two can be empty.
\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}% only for demo
\usepackage{xcolor,mdframed,caption}
\makeatletter
\def\myFLoat{\@ifnextchar[{\myFloat@i}{\myFloat@i[]}}
\def\myFloat@i[#1]#2{\@ifnextchar[%
{\myFloat@ii[#1]{#2}}%
{\myFloat@ii[#1]{#2}[]}}
\def\myFloat@ii[#1]#2[#3]#4#5#6{\par\medskip%
% \mdfsetup{innerleftmargin=10pt,innerrightmargin=10pt}%
\noindent\begin{minipage}[t]{0.475\textwidth}\leavevmode
\begin{mdframed}[#1]#2\end{mdframed}
\end{minipage}\hfill
\begin{minipage}[t]{0.475\textwidth}\leavevmode
\begin{mdframed}[#3]#4\end{mdframed}
\end{minipage}
\ifx\relax#5\relax\else\captionof{figure}{#5}\fi%
\ifx\relax#6\relax\else\label{#6}\fi\par}
\makeatother
\begin{document}
\blindtext
\myFLoat[linecolor=blue,linewidth=2pt,backgroundcolor=yellow]{\blindtext}%
[linecolor=red,linewidth=3pt]{\blindtext}%
{my caption for this float}{myLabel}
as seen in my Figure~\ref{myLabel} it works.
\blindtext
\myFLoat[linecolor=blue,linewidth=2pt,backgroundcolor=yellow]{\blindtext}%
[linecolor=red,linewidth=3pt]{\begin{align}y=\int\limits_1^2 f(x)dx\end{align}}%
{my caption for this float}{myLabelB}
\end{document}
You mean the fancybox (not fancyboxes) package? It does not support colors by itself.
I would use the framed package together with xcolor to define the fancy box you want. If you do not require special stuff like verbatim material you could simply go with:
Otherwise define an own framed environment. Then the box will be \textwidth wide by itself. It even support page break, i.e. splits over multiple pages if the internal text does.
Best Answer
One possibility:
The code:
The code for the second one was taken directly from page 133 of the
tcolorbox
manual.