I defined some time ago a box environment with the following features:
- It has a frame-color and a background color
- It stores the marginnotes, if any, and restore them at the end of the box. I use for this the commands
\mpgmpar@savemarginpars
and\mpgmpar@restoremarginpars
from the packageminipage-marginpar
It worked "perfectly", but now i need to put a very long text in these boxes, and there is not page break. My actual code, which is clearly far from optimal, is :
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{minipage-marginpar}
\usepackage{fancybox}
\newcommand{\strokecolor}{}
\newcommand{\fillcolor}{}
\newlength{\currentparskip}
\makeatletter
\newenvironment{mabox}[3]{%
\renewcommand{\strokecolor}{#2}
\renewcommand{\fillcolor}{#3}
\begin{Sbox}%
\setlength{\currentparskip}{\parskip}% save the value of paragraph skip
\begin{minipage}{#1}%
\setlength{\parskip}{\currentparskip}% restore the value
\mpgmpar@savemarginpars
}%
{\end{minipage}\end{Sbox}\fcolorbox{\strokecolor}{\fillcolor}{\TheSbox} mpgmpar@restoremarginpars}
\makeatother
\begin{document}
\begin{mabox}{10cm}{blue}{gray}
0000
\blindtext \blindtext
11111
\blindtext \blindtext
2222
\blindtext \blindtext
3333
\blindtext \blindtext
\end{mabox}
\end{document}
So, how could I modify the definition of mabox
, so that I keep the present features, and that the box would span several pages if the content is very long ?