Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

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:

enter image description here

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}
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.