# Issue with mdframed package

mdframed package creates a beautiful box around the content. And it has the capability to break between pages as in the image below

I have done the decoration of getting the concept 5 : algebraic identities on the box but when the box breaks on the page to carry some part of the content to the next page (as shown in the second image below) the beautiful header "Concept 5 : algebraic identities" blocks the content behind.

My questions are there ways by which we can leave some space post the header or just remove the header in the broken part on the next page. Kindly help me.. apologies if something not clear.

the code to get the required frames is

% Preview preamble

%% LyX 2.0.4 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\RequirePackage{fix-cm}
\documentclass[11pt,a4paper,english,oldfontcommands,openany]{memoir}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\synctex=-1
\usepackage{wrapfig}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fixltx2e}
\OnehalfSpacing

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\@ifundefined{lettrine}{\usepackage{lettrine}}{}
\theoremstyle{definition}
\newtheorem{example}{\protect\examplename}
\theoremstyle{definition}
\newtheorem{defn}{\protect\definitionname}
\theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname}

\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage[T1]{fontenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}

\usepackage[a4paper]{geometry}
\geometry{
left=30mm, %% or inner=20mm
right=15mm, %% or outer=15mm
top=30mm, bottom=25mm,
footskip=13mm
}
\usepackage{multicol}
\usepackage{polynom}
\usepackage{lettrine}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
\usepackage{pgf}
\usepackage{graphicx}
\usetikzlibrary{arrows,mindmap}
\usepgflibrary{arrows}
%\usepackage[framemethod=TikZ]{mdframed}

\usepackage{cwpuzzle}
%\chapterstyle{demo3}
\chapterstyle{verville}
%\chapterstyle{southhall}
%chapterstyle{thatcher}
%\chapterstyle{wilsondob}
%\chapterstyle{pedersen}
%\chapterstyle{bianchi}

\setsubsubsecindent{1cm}
\setaftersubsubsecskip{1cm}
\begin{tikzpicture}
\draw[overlay,remember picture,opacity=0.5] node [right,text width=15cm, rounded corners, fill=gray!30, inner sep=2ex]{};
\draw[thick,overlay,remember picture, gray!50] (0,-.1)--(12.8,-.1);
\draw[ultra thick,overlay,remember picture, gray!70] (0,-.2)--(12.8,-.2);
\draw[thick,overlay,remember picture, gray!40] (0,-.3)--(12.8,-.3);
\draw[ultra thick,overlay,remember picture,gray!70] (0,-.2) -- (-20,-.2);
\end{tikzpicture}
}

\setsubsecindent{0.4cm}
\setbeforesubsecskip{0.5cm}
\setaftersubsecskip{0.5cm}
\begin{tikzpicture}
%\draw[overlay,remember picture,opacity=0.5] node [right,text width=12cm, rounded corners, fill=gray!50, inner sep=2ex]{};
\draw[yshift=-2pt,remember picture, line width=2pt, overlay, gray!30, rounded corners] (12,-.4) -- (0,-.4) -- (0,.8)  -- (12,.8) -- cycle;
\draw[thick,overlay,remember picture, gray!50] (0,-.1)--(12,-.1);
\draw[ultra thick,overlay,remember picture, gray!70] (0,-.2)--(20,-.2);
\draw[thick,overlay,remember picture, gray!40] (0,-.3)--(12,-.3);
\draw[ultra thick,overlay,remember picture,gray!70] (0,-.2) -- (-20,-.2);
\end{tikzpicture}
}

\setsecindent{0.4cm}
\setbeforesecskip{1.5cm}
\setaftersecskip{1cm}
\begin{tikzpicture}
\draw[yshift=6pt,overlay,remember picture,opacity=0.5] node [right,text width=15.5cm, rounded corners, fill=gray!30, inner sep=15pt]{};
\draw[yshift=-2pt,remember picture, line width=4pt, overlay, gray, rounded corners] (16,-.4) -- (-0.5,-.4) -- (-0.5,1)  -- (16,1) -- cycle;
\end{tikzpicture}
}

\setparaindent{1cm}
\begin{tikzpicture}
\draw[overlay,remember picture,opacity=0.5] node [right,text width=0.4\textwidth, rounded corners, fill=gray!30, inner sep=2ex]{};
\draw[thick,overlay,remember picture, gray!50] (0,-.1)--(7.5,-.1);
\draw[ultra thick,overlay,remember picture, gray!70] (0,-.2)--(7.5,-.2);
\draw[thick,overlay,remember picture, gray!40] (0,-.3)--(7.5,-.3);
%\draw[ultra thick,overlay,remember picture,gray!70] (0,-.2) -- (-20,-.2);
\end{tikzpicture}
}

%%%%%%%% This is to get a Concept

\usepackage{lipsum}


% this is the start of the code which is our interest

\newcounter{theorem}
\renewcommand\thetheorem{Concept ~\arabic{theorem}}
\makeatletter
\mdf@dolist{\mdf@do@stringoption}{%
{theoremtitle=={}}%
}
\renewrobustcmd\mdfcreateextratikz{%
\node[anchor=west,rounded corners,draw,thick,shading=axis,left color=gray!20,xshift=10cm,minimum height=.7cm,minimum width=2cm] at (P-|O)
{~\mdf@frametitlefont{\thetheorem}%
\ifdefempty{\mdf@theoremtitle}%
{~}%
{:~\mdf@theoremtitle~}%
};
}
\makeatother
\mdfdefinestyle{theoremstyle}{%
outerlinewidth=1pt,
innerlinewidth=3pt,
roundcorner=5pt,
linecolor=black,
innertopmargin=1.2\baselineskip,
skipabove={\dimexpr0.5\baselineskip+\topskip\relax},
needspace=3\baselineskip,
frametitlefont=\sffamily\bfseries,
settings={\global\stepcounter{theorem}},
}
\newenvironment{concept}[1][]
{\begin{mdframed}[style=theoremstyle,theoremtitle={#1}]
\relax}{
\end{mdframed}
}

\makeatother


%% this is the end of the code which is of our interest

\usepackage{babel}
\providecommand{\definitionname}{Definition}
\providecommand{\examplename}{Example}
\providecommand{\theoremname}{Theorem}

\begin{document}
\chapter{chapter one}
\begin{concept}
.... cotent that gets broken over pages
\end{concept}

\end{document}

-
have solved the problem. –  nichas Oct 9 '12 at 5:48

In mdframe if you want to control the space left before and after the split of a frame across pages (the kind of trouble I was facing above) one can use the options splittopskip=1cm, splitbottomskip=1cm, in the \mdfdefinestyle part of the code above which is diplayed below.

\mdfdefinestyle{theoremstyle}{%
outerlinewidth=1pt,
innerlinewidth=3pt,
roundcorner=5pt,
linecolor=black,
splittopskip=1cm,         % THIS IS THE REQUIRED OPTION FOR SPACE ABOVE THE SPLIT ON THE SECOND PAGE
splitbottomskip=1cm,      % THIS IS THE REQUIRED OPTION FOR SPACE BELOW THE SPLIT ON THE FIRST PAGE