# mdframed and minipage

I'm trying to find a way to use mdframed to make separation of the frame to the next page but low knowledge does not help me. My effort is try and effect .... no results so far. I know there have been similar questions. But what I want is a way to keep the environment as shown in the example. Please for help.

\documentclass[b5paper,11pt]{book}
\usepackage{mdframed}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{lipsum}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength{\PlaisioBoxWidth}
\newsavebox{\KokkinoRoundedBox}
\newenvironment{RedBox}[1][\dimexpr\linewidth]
{\setlength{\PlaisioBoxWidth}{\dimexpr#1}
\begin{lrbox}{\KokkinoRoundedBox}
\begin{minipage}
{\PlaisioBoxWidth}   }%
{
\end{minipage}
\end{lrbox}
% \begin{center}
\begin{tikzpicture}%
\draw node[draw=black,fill=red!15,rounded corners,%
inner sep=1ex,text width=\PlaisioBoxWidth]%
{\usebox{\KokkinoRoundedBox}};
\end{tikzpicture}
% \end{center}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\begin{document}
%
\begin{RedBox}
\lipsum[1]
\end{RedBox}
%
\begin{RedBox}
\lipsum[1-6]
\end{RedBox}
%
\end{document}


I am not sure I understand your question, but I think you want to use mdframed. Below i have defined MyRedBox that sort of mimics your minipage but allows breaking over pages. Your minipage is in red, and the mdframed version is in blue:

## Notes:

• The showframe package package was used to show the page margins. Notice that your minipage environment goes into the margin. I assume you don't really want that behaviour so did not adjust the right margin for mdframed.

## Code:

\documentclass[b5paper,11pt]{book}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{lipsum, showframe}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength{\PlaisioBoxWidth}
\newsavebox{\KokkinoRoundedBox}
\newenvironment{RedBox}[1][\dimexpr\linewidth]
{\setlength{\PlaisioBoxWidth}{\dimexpr#1}
\begin{lrbox}{\KokkinoRoundedBox}
\begin{minipage}
{\PlaisioBoxWidth}   }%
{
\end{minipage}
\end{lrbox}
% \begin{center}
\begin{tikzpicture}%
\draw node[draw=black,fill=red!15,rounded corners,%
inner sep=1ex,text width=\PlaisioBoxWidth]%
{\usebox{\KokkinoRoundedBox}};
\end{tikzpicture}
% \end{center}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newmdenv[backgroundcolor=blue!15, roundcorner=5pt, usetwoside=false, leftmargin=0.6cm]{MyRedBox}
\begin{document}
%
\begin{RedBox}
\lipsum[1]
\end{RedBox}
%
\begin{MyRedBox}
\lipsum[1-6]
\end{MyRedBox}
%
\end{document}

• I don't understandstand the question too :-) – Marco Daniel Oct 18 '12 at 8:13
• Exactly what I was looking for, for more than two weeks I trying to fix them. Thank you very much @PeterGrill :-) – karathan Oct 18 '12 at 8:39