% \iffalse meta-comment
% !TEX program = pdfLaTeX
%<*internal>
\iffalse
%</internal>
%<*readme>
================================================================
================================================================
Working with the command \fbox or \fcolorbox, one has to
handle page breaks by hand. The present package defines the
environment mdframed which automatically deals with page breaks.

Author's name: Marco Daniel and Elke Schubert (supports tikz implementation)
License type: lppl

================================================================
The revision history is printed in the documentation.

================================================================
The current development is available at github:
https://github.com/marcodaniel/mdframed

================================================================
The package provides 
 * one dtx files,
 * one Makefile (compiling for Linux/Mac),
 * one mdframedmake.bat (compiling for Windows)
 * one personal documentclass ltxmdf.cls 
 * one example picture donald-duck.jpg 

By running the script `make all` you will
produce the following files:
- README.txt
- mdframed.sty
- mdframed.pdf
- md-frame-0.mdf
- md-frame-1.mdf
- md-frame-2.mdf
- md-frame-3.mdf
- mdframed-example-default.tex
- mdframed-example-default.pdf
- mdframed-example-tikz.tex
- mdframed-example-tikz.pdf
- mdframed-example-pstricks.tex
- mdframed-example-pstricks.pdf
- mdframed-example-texsx.tex  
- mdframed-example-texsx.pdf

I recommend the following installation in your texmf-tree:

/doc/latex/mdframed/
- README.txt
- mdframed.pdf
- mdframed-example-default.tex
- mdframed-example-default.pdf
- mdframed-example-tikz.tex
- mdframed-example-tikz.pdf
- mdframed-example-pstricks.tex
- mdframed-example-pstricks.pdf
- mdframed-example-texsx.tex  
- mdframed-example-texsx.pdf
- donald-duck.jpg


/source/latex/mdframed/
- Makefile
- mdframed.dtx

/tex/latex/mdframed
- mdframed.sty
- md-frame-0.mdf
- md-frame-1.mdf
- md-frame-2.mdf
- md-frame-3.mdf
- ltxmdf.cls
================================================================
================================================================
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
----------------------------------------------------------------
Working with the command fbox or fcolorbox, one has to
handle page breaks by hand. The present package defines the
environment mdframed which automatically deals with page breaks.

Author's name: Marco Daniel and Elke Schubert (!new)
License type: lppl

==================================================
========Is based on the idea of framed.sty========
==================================================
===== Currently the package has a beta-Status ====
==================================================
 WITH THANKS TO (alphabetically):
 ROLF NIEPRASCHK
 HEIKO OBERDIEK
 HERBERT VOSS

 Copyright (c) 2010 Marco Daniel

 This package may be distributed under the terms of the LaTeX Project
 Public License, as described in lppl.txt in the base LaTeX distribution.
 Either version 1.0 or, at your option, any later version.


=================================================
 Erstellung eines Rahmens, der am Seitenende keine
 horizontale Linie einfuegt
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
      _______________                            
      |    page 1   |                              
      |    Text     |                            
      |  __Text__   |                            
      |  | Text |   |                            
     P A G E B R E A K                           
      |  | Text |   |                            
      |  |_Text_|   |                            
      |    Text     |                            
      |____page 2___|                            
                                                 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
==================================================

\endpreamble
\postamble

================================================================
Copyright (C) 2012 by Marco Daniel

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) by
Marco Daniel.

Have fun!

================================================================
\endpostamble
\usedir{tex/latex/mdframed}
\generate{\file{mdframed.sty}{\from{mdframed.dtx}{package}}}
\nopreamble\nopostamble\usedir{tex/latex/mdframed}
\generate{\file{md-frame-0.mdf}{\from{mdframed.dtx}{mdframedefault}}}
\nopreamble\nopostamble\usedir{tex/latex/mdframed}
\generate{\file{md-frame-1.mdf}{\from{mdframed.dtx}{mdframetikz}}}
\nopreamble\nopostamble\usedir{tex/latex/mdframed}
\generate{\file{md-frame-2.mdf}{\from{mdframed.dtx}{mdframepstricks}}}
\nopreamble\nopostamble\usedir{tex/latex/mdframed}
\generate{\file{md-frame-3.mdf}{\from{mdframed.dtx}{mdframepstricks}}}
\Msg{*********************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the}
\Msg{* following file into a directory searched by TeX:}
\Msg{*}
\Msg{* \space\space documentation.sty}
\Msg{*}
\Msg{* To produce the documentation run the file mdframed.dtx}
\Msg{* once through LaTeX. Then, run}
\Msg{*}
\Msg{* \space\space makeindex -s gglo.ist -o mdframed.gls mdframed.glo}
\Msg{* \space\space makeindex -s gind.ist mdframed.idx}
\Msg{*}
\Msg{* through makeIndex to produce the glossary.}
\Msg{* Finally, run PdfLaTeX once again.}
\Msg{*}
\Msg{* To create the examples run (pdf)latex on the tex-files.}
\Msg{*}
\Msg{* That's all!}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*********************************************************}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/mdframed}
\generate{\file{mdframed.ins}
          {\from{mdframed.dtx}{install}}}

\nopreamble\nopostamble\usedir{doc/latex/mdframed}
\generate{\file{README.txt}
          {\from{mdframed.dtx}{readme}}}
\nopreamble\nopostamble\usedir{source/latex/mdframed}
\generate{\file{mdframed-example-default.tex}
          {\from{mdframed.dtx}{mdframed-example-default}}}
\nopreamble\nopostamble\usedir{source/latex/mdframed}
\generate{\file{mdframed-example-tikz.tex}
          {\from{mdframed.dtx}{mdframed-example-tikz}}}
\nopreamble\nopostamble\usedir{source/latex/mdframed}
\generate{\file{mdframed-example-pstricks.tex}
          {\from{mdframed.dtx}{mdframed-example-pstricks}}}
\nopreamble\nopostamble\usedir{source/latex/mdframed}
\generate{\file{mdframed-example-texsx.tex}
          {\from{mdframed.dtx}{mdframed-example-texsx}}}

\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%<*driver>
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
\setcounter{errorcontextlines}{999}
\documentclass[parskip=false,11pt,]{ltxmdf}
\usepackage[framemethod=TikZ]{mdframed}

\GetIdInfo$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
          {documentation of mdframed}

\EnableCrossrefs
\CodelineIndex
%%\RecordChanges
\begin{document}
  \DocInput{mdframed.dtx}
\end{document}
%</driver>
% \fi
%
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \GetFileInfo{mdframed.sty}
%
%
% \title{The \Pack{mdframed} package
%       \footnote{Extending the package \texttt{framed.sty}}}
% \subtitle{auto-split frame environment}
% \author{\href{mailto:marco.daniel@mada-nada.de}{Marco Daniel}%
%        \href{mailto:marco.daniel@mada-nada.de}{Elke Schubert}}
% \version{\mdversion}
% \GetIdInfo$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
%           {documentation of mdframed}
% \date{\ExplFileDate}
% \introduction{The standard methods for framing text (\Cmd{fbox}
%              or \Cmd{fcolorbox}) require you to handle page breaks
%              by hand, meaning that you have to split the \Cmd{fbox}
%              into two. The present package defines the environment 
%              \Pack{mdframed} which automatically deals with pagebreaks
%              in framed text.\par
%              By defining new environments the user may choose between
%              several individual designs.%
%             \par\kern.5\baselineskip\noindent
%             Linked files:\quad
%              \begin{tabular}[t]{ll}
%               \url{mdframed-example-default.pdf} &
%               \url{mdframed-example-tikz.pdf} \\
%               \url{mdframed-example-pstricks.pdf}  &
%               \url{mdframed-example-texsx.pdf}
%              \end{tabular}
%             \par\kern.5\baselineskip\noindent
%             FYI:\quad\parbox[t]{.8\linewidth}{%
%                I create a repository for \Pack{mdframed}
%                on \href{https://github.com/marcodaniel/mdframed}{github}
%                where you can 
%                \href{https://github.com/marcodaniel/mdframed}{download}
%                the current development status.}%
% }
%
% \maketitle
%
% \vspace*{2\baselineskip} 
%
% \section{Motivation}
% Many users wish to (further) emphasize lemmata, definitions, proofs, etc. The
% package \Pack{mdframed} allows you to create environments with breakable 
% frames. I think an example is the best way to demonstrate its properties.
% 
% 
% \newmdtheoremenv[outerlinewidth=2,leftmargin=40,rightmargin=40,%
%   backgroundcolor=yellow,outerlinecolor=blue,innertopmargin=\topskip,%
%   splittopskip=\topskip,skipbelow=\baselineskip,
%   skipabove=\baselineskip,
%   ntheorem,roundcorner=5pt]{theorem}{Theorem}[section]
% 
% \begin{theorem}[Pythagorean theorem]
%  In any right triangle, the area of the square whose side is the hypotenuse 
%  is equal to the sum of the areas of the squares whose sides are the two
%  legs.
%  
% \[ a^2+b^2=c^2 \]
% \end{theorem}
% 
% The frame was defined with the following settings.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
 \newmdtheoremenv[outerlinewidth=2,leftmargin=40,%
     rightmargin=40,backgroundcolor=yellow,%
     outerlinecolor=blue,innertopmargin=\topskip,%
     splittopskip=\topskip,skipbelow=\baselineskip,%
     skipabove=\baselineskip,ntheorem]{theorem}%
     {Theorem}[section]
 \begin{theorem}[Pythagorean theorem]
 ...
 \end{theorem}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% 
% 
% \section{Syntax}\label{sec:syntax}
% 
% \minisec{Loadings \Pack{mdframed}}
% The package itself loads the packages 
%  \begin{itemize}
%   \item \Pack{kvoptions},
%   \item \Pack{xparse} (new),
%   \item \Pack{etoolbox} and
%   \item \Pack{color}.
%  \end{itemize}
% Depending on the options \Pack{mdframed} will load
%  \begin{itemize}
%   \item \Pack{xcolor},
%   \item \Pack{tikz} or
%   \item \Pack{pstricks}.
%  \end{itemize}
% 
% Load the package as usual:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  \usepackage[<GLOBAL OPTIONS>]{mdframed}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% 
% Only the option \Opt{framemethod} should be loaded by the 
% optional argument of \Cmd{usepackage}. All other options
% should be loaded with \Cmd{mdfsetup} or related environments.
% The package should be loaded after \Pack{amsthm} if you need the package.
% \minisec{Provided environment}
% The package defines only one environment with the following syntax:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  \begin{mdframed}[<LOCAL OPTIONS>]
     <CONTENT>
  \end{mdframed}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% To create own environments with \Pack{mdframed} see section \ref{sec:cmds}.
% 
% \minisec{Autodetecting floats}
% \Pack{mdframed} detects whether the environment is used inside \Pack{float}
% or \Pack{minipage} environments. If you use \Pack{mdframed} in such
% an environment \Pack{mdframed} will use the option \Opt{nobreak} 
% automatically. 
% 
% \minisec{Twoside-mode}
% If you are using \Pack{mdframed} inside \Pack{twoside}-mode you can set
% the option \Opt{innermargin} and \Opt{outermargin} (see section %
% \ref{optlength}). The length will be ignored if you use the option 
% \Opt{usetwoside}.
% 
% 
% %%%%%%%%%%%%%%%%%%%%%%%
% \section{The frames}\label{sec:cmds}
% 
% Normally you can say \Pack{mdframed} draws only some lines. 
% To allow page breaks the following designs are supported. 
% If you load the package with \Opt{framemethod=default} you 
% can only draw a single line. Inside the gray box the text
% will be printed.
% \newcommand\Punkt[2][below]{%
% 	\node[label=#1:#2] at (#2){\tikz\fill(0,0)circle(0.05);};}
% \newcommand\Single[1][]{\path[#1] (O)--(O|-P)--(P)--(P|-O)--cycle;}
% \newcommand\FirstSecond[1][]{\path[#1] (O|-P)--(O)--(P|-O)--(P);}
% \newcommand\MiddleFlaeche[1][]{\path[#1] (O)--(O|-P)--(P)--(P|-O);}
% \newcommand\MiddleLinien[1][]{\path[#1] (O)--(O|-P)(P)--(P|-O);}
% \begin{center}
% \vspace*{2\baselineskip}
% \null\hfill
% \begin{tikzpicture}[baseline=(current bounding box.north)]
% 	\coordinate (O) at (0,0);
% 	\pgfmathsetlengthmacro\x{4cm+2mm+6mm}
% 	\pgfmathsetlengthmacro\y{2cm+2mm+6mm}
% 	\coordinate (P) at (\x,\y);
% 	\begin{scope}
% 		\Single[line width=3mm,draw=blue!20]
% 		\Single[clip]
% 		\Single[fill=gray!70]
% 		\Single[line width=7mm,draw=green!20]
% 	\end{scope}
% 	\Single[line width=2mm,draw=red!20,use as bounding box]
% 	\node[anchor=south,font=\bfseries,text width=4cm,align=center] %
%        at (24mm,35mm) {Frame of a single page};
% \end{tikzpicture}%
% \hfill%
% \begin{tikzpicture}[baseline=(current bounding box.north)]
% 	\coordinate (O) at (0,0);
% 	\pgfmathsetlengthmacro\x{4cm+2mm+6mm}
% 	\pgfmathsetlengthmacro\y{-2cm-1mm-3mm}
% 	\coordinate (P) at (\x,\y);
% 	\begin{scope}
% 		\FirstSecond[line width=3mm,draw=blue!20]
% 		\FirstSecond[clip]
% 		\FirstSecond[fill=gray!70]
% 		\FirstSecond[line width=7mm,draw=green!20]
% 	\end{scope}
% 	\FirstSecond[line width=2mm,draw=red!20,use as bounding box]
% 	\node[anchor=south,font=\bfseries,text width=4cm,align=center] 
%            at (2.4,0.7) {First box -- first part of the output};
% \end{tikzpicture}
% \hfill\null
% 
% \vspace{2\baselineskip}
% 
%  \null\hfill
% \begin{tikzpicture}[baseline=(current bounding box.north)]
% 	\coordinate (O) at (0,0);
% 	\pgfmathsetlengthmacro\x{4cm+2mm+6mm}
% 	\pgfmathsetlengthmacro\y{2cm+1mm+3mm}
% 	\coordinate (P) at (\x,\y);
% 	\begin{scope}
% 		\FirstSecond[line width=3mm,draw=blue!20]
% 		\FirstSecond[clip]
% 		\FirstSecond[fill=gray!70]
% 		\FirstSecond[line width=7mm,draw=green!20]
% 	\end{scope}
% 	\FirstSecond[line width=2mm,draw=red!20,use as bounding box]
% 	\node[anchor=south,font=\bfseries,text width=4cm,align=center] %
%        at (24mm,25mm) {Second box -- last part of the output};
% \end{tikzpicture}%
% \hfill%
% \begin{tikzpicture}[baseline=(current bounding box.north)]
% 	\coordinate (O) at (0,0);
% 	\pgfmathsetlengthmacro\x{4cm+2mm+6mm}
% 	\pgfmathsetlengthmacro\y{2cm}
% 	\coordinate (P) at (\x,\y);
% 	\begin{scope}
% 		\MiddleLinien[line width=3mm,draw=blue!20]
% 		\MiddleFlaeche[clip]
% 		\MiddleFlaeche[fill=gray!70]
% 		\MiddleLinien[line width=7mm,draw=green!20]
% 	\end{scope}
% 	\MiddleLinien[line width=2mm,draw=red!20,use as bounding box]
% 	\node[anchor=south,font=\bfseries,text width=4cm,align=center] 
%        at (24mm,25mm) {Middle box -- middle part of the output};
% \end{tikzpicture}
% \hfill\null
% 
% \captionof{figure}{The basic frames}\label{fig:basicframes}
%\end{center} 
% %%%%%%%%%%%%%%%%%%%%%%%
% \section{Commands}\label{sec:cmds}
% The following commands should countenance your by the handling with 
% \Pack{mdframed}.
% 
% \ExplCmd{newmdenv} The command has the following syntax:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
 \newmdenv[<MDFRAMED OPTIONS>]{Name of the environment}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% In this way you can simply use:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  \newmdenv[linecolor=red,frametitle=Infobox]{infobox}
  ...
  \begin{infobox}[backgroundcolor=yellow]
   foo   foo   foo   foo   foo   foo 
  \end{infobox}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% \ExplCmd{renewmdenv} 
%      By using this command you can redefine environments which are created by
%      \Cmd{newmdenv}.
% 
% \ExplCmd{surroundwithmdframed} 
%      Sometimes you have predefined environments. This commands allows you to 
%      set an \Env{environment} surround this predefined environment. To set a 
%      \Env{mdframed} around the environment \Env{verbatim} you can simple say 
%      without changing the original name.
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  \surroundwithmdframed[linewidth=2pt]{verbatim}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
%
% 
% \ExplCmd{mdflength} 
%     If you want to work with length defined by \Pack{mdframed} (for example
%     \Opt{innerleftmargin}) you can now simple use the command \Cmd{mdflength}.
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  Some Text \hspace{\mdflength{innerleftmargin}} Some Text

  \the\mdflength{innerleftmargin}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
%  
%
% 
% \ExplCmd{mdfsetup}To set the options 
% you can use the optional argument of \Cmd{usepackage} or
% you can use the command \Cmd{mdfsetup} which is not limited to the preamble.
% Inside a group the settings work only local.\par
% \textbf{\color{red!70!black}At this point I want to recommend the using of
% the command \Cmd{mdfsetup} instead of setting package option via the optional
% argument of \Cmd{usepackage}. So you are avoiding breaking of non robust 
% commands.}^^A
% \footnote{Thanks to Heiko Oberdiek and Philipp Stephani
% \href{https://groups.google.com/group/de.comp.text.tex/^^A
%       browse_thread/thread/15c5ad290490d426?hl=de}^^A
%       {kvoptions-Declaration von Optionen schl\"agt fehl}}
% 
% \ExplCmd{mdfdefinestyle} 
%      \Cmd{mdfdefinestyle} allows the user to define different styles and use
%      as an option of \Pack{mdframed} via \Opt{style}. The option \Opt{style} 
%      is explained in section \ref{genopt}.
% 
% Here a small example:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}[morekeywords={mystyle}]
 \mdfdefinestyle{mystyle}{leftmargin=0pt,%
                          linecolor=blue}
 ....
 \begin{mdframed}[style=mystyle]
  foo
 \end{mdframed}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% 
% \ExplCmd{mdfapptodefinestyle} 
%      This commands allows to expand a defined style.\footnote{Thanks
%       to Martin Scharrer and Enrico Gregorio:\newline
%      \href{http://tex.stackexchange.com/questions/34684/argument-of-setkeys}
%           {http://tex.stackexchange.com/questions/34684/argument-of-setkeys}}
% 
% 
% 
% %%%%%%%%%%%%%%%%%%%%%%%
% \section{Options}
% The package provides various options to manipulate frames. In the following 
% section all options are listed. Some internal macros which can be manipulated
% are not shown in this documentation.
% The listed options are divided in global and local options. The global 
% options can not be used inside \Cmd{mdfsetup}.
% 
% \subsection{Global Options}\label{globopt}
% The following options are only global options.
% 
% \ExplOpt[none]{xcolor}
% By setting this key, the package \Pack{xcolor} will
% be loaded with the given value(s). Without any value \mbox{\Pack{mdframed}} 
% loads the package \Pack{color} without any options. If the package 
% \Pack{xcolor} is already loaded the given option will be ignored. 
% I recommend to load \Pack{xcolor} before \Pack{mdframed}.
% 
% \ExplOpt[default]{framemethod} 
%     With this key you can change the way frames are drawn. You can decide
%     whether the frame is drawn with
% \begin{enumerate}
%  \item \LaTeX-commands {\small\Cmd{hrule}, \Cmd{vrule}, \Cmd{rule}},
%  \item \Pack{TikZ} {\small(the package \Pack{TikZ} will be loaded)} or
%  \item \Pack{PSTricks} {\small(the package \Pack{pstricks} will be loaded)}.
% \end{enumerate}
% The option \Opt{framemethod} requires a string. Allowed combinations are
% listed in the following table.
% \begin{table}[!ht]
% \centering
% \renewcommand*\arraystretch{1.3}
% \caption{Allowed keys for \Opt{framemethod}}
% \begin{tabular}{@{}>{\small\bfseries}l>{\small\ttfamily}l@{}}
%  \toprule
%   \multicolumn{1}{@{}l}{\textbf{Method}} & \multicolumn{1}{l}{Allowed keys}\\
%  \midrule
%   \LaTeX-commands   & default, tex, latex, none, 0  \\
%   \Pack{TikZ}     & tikz, pgf, 1                  \\
%   \Pack{PSTricks} & pstricks, ps, postscript, 2   \\
%  \bottomrule
% \end{tabular}
% \end{table}
% 
% \minisec{FYI}
% It is independently whether the \texttt{method} is 
% written with no, one or more capital letter.
% 
% \minisec{Note}
% The manipulation of the frames depends on the option \Opt{framemethod}.
% For further information see below.
% 
% \subsection{Global and Local Options}
% The options listed below can be set globally or locally and they are not
% limited to the preamble.
% I tried to define self explained names.
% 
% \subsubsection{Options with lengths}\label{optlength}
% 
% In figure \eqref{fig:laengen} you can see the adjustable lengths 
% (compare also figure \eqref{fig:basicframes}) which will be described below. 
% All lengths accept two kinds of input. The first one is a length (e.g. 2pt) 
% and the second one is a number (e.g. 2) which will be multiplied by 
% \Opt{1 defaultunit}. The figure shows three different colored frames. 
% 
% \ExplOpt[pt]{defaultunit} see the sentence above.
% 
% \begin{center}
% \begin{tikzpicture}[scale=0.9]
%      %Declaration
%      \newlength{\linew}
%      \setlength{\linew}{5pt}
%      \tikzstyle{every node}=[font=\bfseries\large\sffamily]
%      \coordinate (innersep) at (3.2,2.25);
%      \coordinate (outersep) at (3.2,2);
%      %Center
%      \node[fill=green!10,draw=black,framed,rounded corners,
%            minimum width=3cm,minimum height=1.5cm]%
%            (CenterNode) {Contents};
%      
%      %frames
%      \draw[draw=red!70!black,line width=\linew] %
%                ($(CenterNode)+(innersep)$) %
%                rectangle ($(CenterNode)-(innersep)$);
%      \draw[draw=blue!70!black,line width=\linew] %
%                ($(CenterNode)+(innersep)+(\linew,\linew)$)%
%                rectangle ($(CenterNode)-(innersep)+(-\linew,-\linew)$);
%      \draw[draw=yellow!70!black,line width=\linew]
%                ($(CenterNode)+(innersep)+(2\linew,2\linew)$)%
%                rectangle ($(CenterNode)-(innersep)+(-2\linew,-2\linew)$);
%      \draw[draw=black,line width=1] ($(CenterNode)+(innersep)+(outersep)$)%
%                rectangle ($(CenterNode)-(innersep)-(outersep)$);
%      
%      
%      \tikzstyle{every node}=[font=\small\ttfamily]
%      %%innertopmargin
%      \draw[draw=black,triangle 45-triangle 45]let \p1=(innersep) in
%            (CenterNode.north)  -- ($(CenterNode)+(0,\y1)-(0,.5\linew)$) ;
%      \path let \p1=(innersep) in
%            (CenterNode.north)
%            edge 
%            node[align=center,framed,fill=white,draw=white]{innertopmargin} 
%            ($(CenterNode)+(0,\y1)-(0,.5\linew)$) ;
%      %%innerbottommargin
%      \draw[draw=black,triangle 45-triangle 45]let \p1=(innersep) in
%            (CenterNode.south)  -- ($(CenterNode)-(0,\y1)+(0,.5\linew)$) ;
%      \path let \p1=(innersep) in
%            (CenterNode.south)  
%            edge 
%            node[align=center,framed,fill=white,draw=white]{innerbottommargin}
%            ($(CenterNode)-(0,\y1)+(0,.5\linew)$) ;
%      
%      %%innerleftmargin
%      \draw[draw=black,triangle 45-triangle 45]let \p1=(innersep) in
%            (CenterNode.west)  -- ($(CenterNode)-(\x1,0)+(.5\linew,0)$) ;
%      \path let \p1=(innersep) in
%            (CenterNode.west)  edge 
%            node[align=center,rotate=90,framed,fill=white,draw=white]
%                {innerleftmargin}  
%            ($(CenterNode)-(\x1,0)+(.5\linew,0)$) ;
%      %%innerrightmargin
%      \draw[draw=black,triangle 45-triangle 45]let \p1=(innersep) in
%            (CenterNode.east)  -- ($(CenterNode)+(\x1,0)-(.5\linew,0)$) ;
%      \path let \p1=(innersep) in
%            (CenterNode.east)  edge
%            node[align=center,rotate=90,framed,fill=white,draw=white]
%               {innerrightmargin}  
%            ($(CenterNode)+(\x1,0)-(.5\linew,0)$) ;
%      
%      
%      %%leftmargin
%      \draw[draw=black,triangle 45-triangle 45]
%            let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)-(\x1,0)-(2.5\linew,0)$)  --
%            ($(CenterNode)-(\x1,0)-(\x2,0)$) ;
%      \path let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)-(\x1,0)-(2.5\linew,0)$)  edge 
%            node[align=center,rotate=0,framed,fill=white,draw=white]
%                {leftmargin}  
%            ($(CenterNode)-(\x1,0)-(\x2,0)$) ;
%      %%rightmargin
%      \draw[draw=black,triangle 45-triangle 45]
%            let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)+(\x1,0)+(2.5\linew,0)$)  --
%            ($(CenterNode)+(\x1,0)+(\x2,0)$) ;
%      \path let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)+(\x1,0)+(2.5\linew,0)$)  edge 
%            node[align=center,rotate=0,framed,fill=white,draw=white]
%            {rightmargin}  
%            ($(CenterNode)+(\x1,0)+(\x2,0)$)  ;
%      
%      %%skipabove
%      \draw[draw=black,triangle 45-triangle 45]
%            let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)+(0,\y1)+(0,2.5\linew)$)  -- 
%            ($(CenterNode)+(0,\y1)+(0,\y2)$) ;
%      \path let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)+(0,\y1)+(0,2.5\linew)$)  edge 
%            node[align=center,rotate=0,framed,fill=white,draw=white]
%                {skipabove}
%            ($(CenterNode)+(0,\y1)+(0,\y2)$) ;
%      %%skipbelow
%      \draw[draw=black,triangle 45-triangle 45]
%            let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)-(0,\y1)-(0,2.5\linew)$)  -- 
%            ($(CenterNode)-(0,\y1)-(0,\y2)$) ;
%      \path let \p1=(innersep) , \p2=(outersep) in
%            ($(CenterNode)-(0,\y1)-(0,2.5\linew)$)  edge 
%            node[align=center,rotate=0,framed,fill=white,draw=white]
%                {skipbelow}
%            ($(CenterNode)-(0,\y1)-(0,\y2)$) ;
% \end{tikzpicture}
% 
%  \captionof{figure}{adjustable lengths of \Pack{mdframed}}
%  \label{fig:laengen}
% \end{center}
% 
% \ExplOpt[0\,pt]{skipabove} 
%      Sets an additional skip above the frame.
% \ExplOpt[0\,pt]{skipbelow} 
%      Sets an additional skip below the frame.
% \ExplOpt[]{margin} 
%      This option is not longer supported. Use \Opt{leftmargin}
%      and \Opt{rightmargin} instead.
% \ExplOpt[0pt]{leftmargin} 
%      Sets the length of the left margin of the environment. This option has
%      an effect only in singleside-mode or, in twoside-mode, if the option 
%      \Opt{usetwoside=false} has been given.  
%      See also options \Opt{outermargin} and \Opt{innermargin}.
% \ExplOpt[0\,pt]{rightmargin} 
%      Sets the length of the right margin of the environment. This option has 
%      an effect only in singleside-mode or, in twoside-mode, if the option 
%      \Opt{usetwoside=false} has been given.  
%      See also options \Opt{outermargin} and \Opt{innermargin}.
% \ExplOpt[10\,pt]{innerleftmargin} 
%      Sets the length of the inner left margin of the environment.
% \ExplOpt[10\,pt]{innerrightmargin} 
%      Sets the length of the inner right margin of the environment.
% \ExplOpt[.4\textbackslash baselineskip]{innertopmargin} 
%      Sets the length of the inner top margin of the environment.
% \ExplOpt[.4\textbackslash baselineskip]{innerbottommargin} 
%      Sets the length of the inner bottom margin of the environment.
% 
% \paragraph*{The following lengths are not shown in figure
%             \eqref{fig:laengen}.}
% 
% \mbox{}
% \ExplOpt[0\,pt]{userdefinedwidth} 
%      Sets the width of the whole \Pack{mdframed} environment. 
%      The width represent the width including the line width and
%      the inner margins. The outer margins will be ignored.
% \ExplOpt[0\,pt]{outermargin} 
%      Sets the length of the outer margin. This option is only available
%      in \texttt{twoside}-mode.
% \ExplOpt[0\,pt]{innermargin} 
%      Sets the length of the inner margin. This option is only available
%      in \texttt{twoside}-mode.
% \ExplOpt[0\,pt]{splittopskip} 
%      Sets the length of the skip above the split part of the environment.
% \ExplOpt[0\,pt]{splitbottomskip} 
%      Sets the length of the skip below the split part of the environment.
% \ExplOpt[0.4\,pt]{linewidth} 
%      Sets the width of the line around the environment.
%      \limitation[\Opt{default}]
% \ExplOpt[0\,pt]{roundcorner} 
%      Sets the size of the radius of the corners of the frames.
%      \limitation[TikZ or PSTricks]
% \ExplOpt[0\,pt]{innerlinewidth} 
%      Sets the width of the inner line around the environment.
%      \limitation[TikZ or PSTricks]
% \ExplOpt[0\,pt]{outerlinewidth} 
%      Sets the width of the outer line around the environment.
%      \limitation[TikZ or PSTricks]
% \ExplOpt[0.4\,pt]{middlelinewidth} 
%      Sets the width of the middle line around the environment.
%      \limitation[TikZ or PSTricks]
% 
% \subsubsection{Colored Options}
% \ExplOpt[black]{linecolor} 
%      Sets the color of the line around the environment.
% \ExplOpt[white]{backgroundcolor} 
%      Sets the color of the background of the environment.
% \ExplOpt[black]{fontcolor} 
%      Sets the color of the contents of the environment.
% \ExplOpt[linecolor]{innerlinecolor} 
%      Sets the color of the inner line around the environment.
%      \limitation[TikZ or PSTricks]
% \ExplOpt[linecolor]{middlelinecolor} 
%      Sets the color of the middle line around the environment. 
%      \limitation[TikZ or PSTricks]
% \ExplOpt[linecolor]{outerlinecolor} 
%      Sets the color of the outer line around the environment.
%      \limitation[TikZ or PSTricks]
% 
% \subsubsection{General options}\label{genopt}
% 
% 
% \ExplOpt[false]{everyline} 
%      Allows to draw a bottom and a top line at splitted frames.
% \ExplOpt[\{\}]{font} 
%      Sets the font of the environment.
% \ExplOpt[false]{ntheorem} 
%      Before setting this boolean key, you have to load
%      the package \Pack{ntheorem}. With this option you set the
%      values \Cmd{theorempreskipamount} and
%      \Cmd{theorempostskipamount} to 0\,pt.
% \ExplOpt[false]{nobreak} 
%      Sometimes it is useful to prevent a frame from splitting.
%      The \Opt{nobreak} option is used for this purpose. 
%      If you activate this option you can enable it by
%      setting \Opt{nobreak=false}.
% \ExplOpt[true]{usetwoside}
%      If you set the twoside option you can work with \Opt{outermargin}.
%      This option disable this and you work with 
%      \Opt{leftmargin} and \Opt{rightmargin}.
% \ExplOpt[0\,pt]{needspace} 
%      Sometimes it is useful to set a minimum height before a 
%      frame should be splitted. For such cases you can use \Opt{needspace}.
%      The option requires a length which sets the minimum height before
%      a frame will be splitted.
% \ExplOpt{style} 
%      If you define a special style with \Cmd{mdfdefinestyle} you can use
%      the key \Opt{style} to load the style. \Pack{mdframed} has
%      no predefined styles yet.
% \ExplOpt[none]{settings} 
%      This option allows the user to commit some macros. An example is shown
%      in the example files.
% \ExplOpt[left]{align} 
%      Sometimes it is useful to align the environment itself. 
%      For this you have the option \Opt{align} which can be set to the 
%      following strings: 
%      \begin{itemize}
%       \item \Opt{left},
%       \item \Opt{right} and
%       \item \Opt{center}.
%      \end{itemize}
%      The alignments \Opt{left} or \Opt{right} depend on the given lengths
%      \Opt{leftmargin} and \Opt{rightmargin}. Later I will present an example
%      to demonstrate my bad English explanation.
%
% \ExplOpt[false]{ignorelastdescenders} 
%      Try to ignore the last descenders of the environment \Env{mdframed}. The
%      complete idea was inspired by Tobias Weh and the solution was provided
%      by Stefan Lemke. See 
%      \href{http://tex.stackexchange.com/questions/47584/how-to-make-^^A
%            mdframed-ignore-descenders-in-last-line}^^A
%           {How to make mdframed ignore descenders in last line}
%
% \ExplOpt[false]{shadow}
%      Draw a shadow. The shadow doesn't influence the bounding box so the 
%      shadow can be drawn in the margin without any overfull box.
%      Note if you are using the TikZ you must load the library.
%      \Pack{mdframed} doesn't do the job to avoid double loading of a library.
%
% \ExplOpt[8\,pt]{shadowsize}
%      Specify the size of the shadow.
% \ExplOpt[black!50]{shadowcolor}
%      Specify the color of the shadow.
%      
% 
% \ExplOpt[\{\}]{pstrickssetting}
%      With this key you can pass several options to \Cmd{psset}. 
%      For example if you want all lines dashed you will have to set 
%      \Opt{pstrickssetting=\{linestyle=dashed\}}. It is very important
%      to put the options of \Opt{pstrickssetting} in brackets.
%      \limitation[PSTricks]
% \ExplOpt[\{\}]{pstricksappsetting}
%      \Pack{mdframed} works with defined style for the different elements. By 
%      using \Cmd{addtopsstyle} in combination with this option 
%      you can expand the definition. The predefined styles are
%      \begin{itemize}
%       \item \Opt{mdfbackgroundstyle}
%       \item \Opt{mdfframetitlebackgroundstyle}
%       \item \Opt{mdfouterlinestyle}
%       \item \Opt{mdfinnerlinestyle}
%       \item \Opt{mdfmiddlelinestyle}
%      \end{itemize}
%       \textbf{Before you change one please have a look at the file
%               \texttt{md-frame-2.mdf} to see the settings.}
%        \limitation[PSTricks]
% \ExplOpt[\{\}]{tikzsetting}
%      With this key you can pass several options to \Cmd{tikzset}. 
%      Some examples are listed in the next section. It is very important
%      to put the options of \Opt{tikzsetting} in brackets.
%      \limitation
% \ExplOpt[\{\}]{apptotikzsetting}
%      With this key you can add several options to \Opt{tikzsetting}.
%      This key based on the idea of manipulation of predefined keys
%      of \Pack{mdframed}. The package \Pack{mdframed} defines via 
%      \Cmd{tikzset} the following keys to draw frames.
%      \begin{itemize}
%       \item \Cmd{tikzset\{mdfbox/.style\}}
%       \item \Cmd{tikzset\{mdfcorners/.style\}}
%       \item \Cmd{tikzset\{mdfbackground/.style\}}
%       \item \Cmd{tikzset\{mdfinnerline/.style\}}
%       \item \Cmd{tikzset\{mdfouterline/.style\}}
%       \item \Cmd{tikzset\{mdfmiddleline/.style\}}
%       \item \Cmd{tikzset\{mdfframetitlerule/.style\}}
%       \item \Cmd{tikzset\{mdfframetitlebackground/.style\}}
%       \item \Cmd{tikzset\{mdfshadow/.style\}}
%      \end{itemize}
%      \textbf{Before you change one please have a look at the
%              file \texttt{md-frame-1.mdf} to see the settings.}
%      \limitation
% \ExplOpt[\{\}]{singleextra}
%      With this key you can put extra material to the drawing environment of 
%      \Pack{mdframed} only for a non splitted frame. 
%      \limitation[TikZ and PSTricks]
% \ExplOpt[\{\}]{firstextra}
%      With this key you can put extra material to the drawing environment of 
%      \Pack{mdframed} only for the first part of the splitted frame. 
%      \limitation[TikZ and PSTricks]
% \ExplOpt[\{\}]{middleextra}
%      With this key you can put extra material to the drawing environment of 
%      \Pack{mdframed} only for the middle part of the splitted frame. 
%      \limitation[TikZ and PSTricks]
% \ExplOpt[\{\}]{secondextra}
%      With this key you can put extra material to the drawing environment of 
%      \Pack{mdframed} only for the second part of the splitted frame. 
%      \limitation[TikZ and PSTricks]
%
% 
% \subsection{Hidden Lines}
% \ExplOpt[true]{topline} Draws a line at the top.
% \ExplOpt[true]{bottomline} Draws a line at the bottom.
% \ExplOpt[true]{leftline} Draws a line on the left.
% \ExplOpt[true]{rightline} Draws a line on the right.
% \ExplOpt[false]{hidealllines} 
%      With this option you can decide whether all lines should be drawn or 
%      not.
% 
% \subsection{Frametitle}
% In this section all relevant options of the frame title will be presented.
% They are not divided in their properties.
% 
% \ExplOpt[none]{frametitle} 
%      The environment gets a title. To set a title use 
%      \Opt{frametitle=\{The Title of the frame\}} as an option of the 
%      environment.
% \ExplOpt[\Cmd{normalfont}\Cmd{bfseries}]{frametitlefont}
%      Sets the format of the \Opt{frametitle}.
% \ExplOpt[\Cmd{raggedleft}]{frametitlealignment}
%      Align the \Opt{frametitle}. This option must be set via \Cmd{mdfsetup}.
% \ExplOpt[false]{frametitlerule} 
%      Set this key to \Opt{true} to get a line between the frame title
%      and the text.
% \ExplOpt[.2\,pt]{frametitlerulewidth}
%      Sets the width of the line between the text and the title of 
%      \Env{mdframed}.
% \ExplOpt[5\,pt]{frametitleaboveskip}
%      Sets the skip of the frame title to the margin above of \Env{mdframed}.
% \ExplOpt[5\,pt]{frametitlebelowskip}
%      Sets the skip of the frame title to the rule of the frame title.
% \ExplOpt[white]{frametitlebackgroundcolor}
%      Sets the color of the background of the frametitle
% \ExplOpt[false]{repeatframetitle}
%      Repeat the frame title on every frame. 
%
% \minisec{FYI and Note}
% The splitting of the frame title is really a fiddly issue. If you want to use
% the option \Opt{repeatframetitle} a splitting is more than wrong. On the 
% other hand if you use the option \Opt{repeatframetitle} the user must prepare
% the contents well.
%
% The following picture demonstrates the behaviour of the lengths if the option
% \Opt{frametitle} is used.
% 
% \begin{center}
% \begin{tikzpicture}[scale=0.9]
%      %Declaration
%      \tikzstyle{every node}=[font=\bfseries\large\sffamily]
%      \coordinate (innersep) at (3.2,2.25);
%      \coordinate (outersep) at (3.2,2);
%      %Center box
%      \node[fill=green!10,draw=red!70!black,very thick,fill opacity=.2,
%            text opacity=1,minimum width=9cm,minimum height=3cm,]%
%            (CenterNode) {Contents of the box};
%      %frametitle box
%      \node[fill=yellow!70,draw=red!70!black,very thick,fill opacity=.2,
%            text opacity=1,minimum width=9cm,minimum height=3cm,anchor=south]%
%            at (CenterNode.north) (frametitle) {frame title};
% % frametitlerule
%     \draw[line width=3pt,blue!60!black] (frametitle.south west) 
%                                      -- (frametitle.south east)
%              node[pos=1,anchor=west,text width=4cm] 
%                  {\Opt{frametitlerulewidth}\\\Opt{frametitlerule=true}};
% % frametitlebelowskip
%     \draw[very thick,blue!60!black,latex-latex,shorten >=0.2cm] 
%          (frametitle.south) -- (frametitle.center)
%          node[pos=0.5,anchor=west] 
%             {\Opt{ frametitlebelowskip}};
% % frametitleaboveskip
%     \draw[very thick,blue!60!black,latex-latex,shorten >=0.2cm] 
%          (frametitle.north) -- (frametitle.center)
%           node[pos=0.5,anchor=west] {\Opt{ frametitleaboveskip}};
% % innertopmargin
%     \draw[very thick,blue!60!black,latex-latex,shorten >=0.2cm] 
%          (CenterNode.north) -- (CenterNode.center)
%               node[pos=0.5,anchor=west] {\Opt{ innertopmargin}};
% % splittopskip
%     \draw[very thick,blue!60!black,latex-latex,shorten >=0.2cm] 
%          (CenterNode.north) -- (CenterNode.center)
%               node[pos=0.5,anchor=east] {\Opt{splittopskip}};
% % global frame
%  \draw[thick] (-5.5,-2.1) rectangle (9.4,5.5);
% \end{tikzpicture}
%  \captionof{figure}{Behavior of the lengths if \Opt{frametitle} is used}
%  \label{fig:frametitlelaengen}
% \end{center}
% 
%
% \subsection{Title commands inside the environment}
%
% To provide titles inside the environment \Pack{mdframed} you can one of the
% two following commands. The relavant options are listed below.
%
% \ExplCmd{mdfsubtitle} 
%      Set a title inside \Pack{mdframed} of the internal level 1.
%
% \ExplCmd{mdfsubsubtitle}
%     Set a title inside \Pack{mdframed} of the internal level 2.
%
% Both commands have the same syntax. They accept one optional and one 
% mandatory argument. The optional argument sets the option of \Pack{mdframed}
% whereby everything will be local. The second argument of subtitle also allows
% paragraph breaking.
%
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  \mdfsubtitle[<options>]{the subtitle}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
%
%
% \subsubsection{Options related to the title of level 1}
% \ExplOpt[false]{subtitleaboveline}
%     Decide to draw a line above the subtile.
% \ExplOpt[false]{subtitlebelowline}
%     Decide to draw a line below the subtitle.
% \ExplOpt[\string\normalfont\string\bfseries]{subtitlefont}
%     Sets the font for subtitles.
% \ExplOpt[white]{subtitlebackgroundcolor}
%     Sets the background color of the subtitle between the above and below
%     line.
% \ExplOpt[black]{subtitleabovelinecolor}
%     Sets the line color of the line above.
% \ExplOpt[black]{subtitlebelowlinecolor}
%     Sets the line color of the line below.
% \ExplOpt[0.8\,pt]{subtitleabovelinewidth}
%     Sets the line width of the line above.
% \ExplOpt[0.6\,pt]{subtitlebelowlinewidth}
%     Sets the line width of the line below.
% \ExplOpt[\string\baselineskip]{subtitleaboveskip}
%     Sets the skip before the subtitle line above will be drawn.
% \ExplOpt[1.2\string\baselineskip]{subtitlebelowskip}
%     Sets the skip after the subtitle line below is drawn.
% \ExplOpt[0.5\string\baselineskip]{subtitleinneraboveskip}
%     Sets the skip after the line above and the subtitle itself.
% \ExplOpt[0.5\string\baselineskip]{subtitleinnerbelowskip}
%     Sets the skip after the subtitle and the line below.
%
%
%
% \subsubsection{Options related to the title of level 2}
%
% \ExplOpt[false]{subsubtitleaboveline}
%     Decide to draw a line above the subsubtile.
% \ExplOpt[false]{subtitlebelowline}
%     Decide to draw a line below the subsubtitle.
% \ExplOpt[\string\normalfont]{subsubtitlefont}
%     Sets the font for subsubtitles.
% \ExplOpt[white]{subsubtitlebackgroundcolor}
%     Sets the background color of the subsubtitle between the above and below
%     line.
% \ExplOpt[black]{subsubtitleabovelinecolor}
%     Sets the line color of the line above.
% \ExplOpt[black]{subsubtitlebelowlinecolor}
%     Sets the line color of the line below.
% \ExplOpt[0.8\,pt]{subsubtitleabovelinewidth}
%     Sets the line width of the line above.
% \ExplOpt[0.6\,pt]{subsubtitlebelowlinewidth}
%     Sets the line width of the line below.
% \ExplOpt[\string\baselineskip]{subsubtitleaboveskip}
%     Sets the skip before the subsubtitle line above will be drawn.
% \ExplOpt[1.2\string\baselineskip]{subsubtitlebelowskip}
%     Sets the skip after the subsubtitle line below is drawn.
% \ExplOpt[0.5\string\baselineskip]{subsubtitleinneraboveskip}
%     Sets the skip after the line above and the subsubtitle itself.
% \ExplOpt[0.5\string\baselineskip]{subsubtitleinnerbelowskip}
%     Sets the skip after the subsubtitle and the line below.
%
%
%
% \subsection{Theorems}
% In this section is described which commands can help you to define 
% theorem environments with \Pack{mdframed}.
% 
% \ExplCmd{newmdtheoremenv} 
% Since the package is often used to highlight theorem environments, 
% the package providesa command to simplify this process. The command has the 
% following syntax:
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}[deletekeywords={mdframed}]
 \newmdtheoremenv[<mdframed-options>]{<envname>}%
                 [<numberedlike>]{<caption>}[<within>]
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% The last four arguments are equivalent to the command \Cmd{newtheorem}.
% Only the first optional argument is able to pass \Pack{mdframed}-options. A 
% simple example is:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
 \theoremstyle{<some style>}
 \newmdtheoremenv[linecolor=blue]{lemma}%
                 {Lemma}[section]
 ... 
 \begin{lemma}[Some title]
   foo   foo   foo   foo   foo   foo
 \end{lemma}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% So far there is no \Cmd{renewmdtheoremenv}!
%
%
% \ExplCmd{mdtheorem} 
% This is a special kind of \Cmd{newtheorem}. The command has the following 
% syntax.
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}[deletekeywords={mdframed}]
 \mdtheorem[<mdframed-options>]{<envname>}%
                 [<numberedlike>]{<caption>}[<within>]
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% As you can see the arguments are equal to \Cmd{newtheorem} but the
% command ignores every \Cmd{theoremstyle}. This is based on the following
% behavior. 
%
% The command \Cmd{mdtheorem} creates two environments based on the given
% first mandatory argument. The first environment is named like the given
% argument and creates a numbered theorem. The second environment is named
% like the first mandatory argument with a star. This environment has the 
% same formating but isn't numbered.
%
% The syntax of the new defined environments is equal to the normal theorem
% environments.
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}[deletekeywords={mdframed}]
 \begin{environment}[optional title]
  ...
 \end{environment}
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% What happened? The caption of the command will be set as the frame title.
% In this way all options of the frame title are available. Furthermore 
% \Pack{mdframed} provides additional options explained below.
%
% \ExplOpt[\{:\}]{theoremseparator}
%      Sets the separator of the caption and the title of the theorem.
%      The \Opt{theoremseparator} will be printed only if an theorem 
%      title is given.
% \ExplOpt[\{\}]{theoremtitlefont}
%      Via the option \Opt{frametitlefont} you can manipulate the font
%      of the frame title. The option \Opt{theoremtitlefont} allows to
%      set a different font to the title of the theorem. 
% \ExplOpt[\protect\Cmd{space}]{theoremspace}
%      Sets the space after \Opt{theoremseparator}.
%
% Examples can be found in the attached files.
%     
% \subsection{Footnotes}
% Inside the environment you can use the command \Cmd{footnote} as usual.
% \Pack{mdframed} uses the syntax of environment \Pack{minipage} with
% the same counter.
% 
% Every footnote text will be collected inside a box and will be displayed
% at the end of the environment \Pack{mdframed}. 
% 
% \ExplOpt[\mbox{} \Cmd{bigskipamount}]{footnotedistance} 
%      The length is the distance between the end of the environment
%      \Pack{mdframed} and the displaying of the \Cmd{footnoterule}.
% \ExplOpt[true]{footnoteinside} 
%      The position of the footnotes can be changed with the option 
%      \Opt{footnoteinside}. The footnotes will be displayed at the end 
%      of the environment but you can decide whether the output is inside 
%      \Pack{mdframed} or after.
% 
% \minisec{Note}
% The output of the footnotes with the option \Opt{footnoteinside=false}
% are not in a splitted frame. I think it isn't useful because the first line
% of a new page shouldn't be a footnote.
% 
% \section{Examples}
% 
% I outsource the examples in four files to limit the documentation. The files 
% are
% \begin{description}[style=nextline]
% \item[\texttt{mdframed-example-default}] 
%       Demonstration of examples created with \Opt{framemethod=default}.
% \item[\texttt{mdframed-example-tikz}]
%       Demonstration of examples created with \Opt{framemethod=TikZ}.
% \item[\texttt{mdframed-example-pstricks}] 
%       Demonstration of examples created with \Opt{framemethod=pstricks}.
% \item[\texttt{mdframed-example-texsx}] 
%       Demonstration of examples like interaction with \Pack{listings}
% \end{description}
% 
% The examples are often not equivalent but normally they can be adapted to 
% another method.
% So I really recommend to have a look to all example files.
%
% The Korean \TeX Group created a very nice presentation. I want to show the 
% link because it's really a great work:
% \href{http://prezi.com/zc355i9tcsgz/talk-kts-2012-mdframed/}^^A
%      {kts 2012 mdframed}.
% 
% \section{Errors, Warnings and Messages}
% 
% The package \Pack{mdframed} provides different errors, warnings and
% messages in the \texttt{log}-file. Some \LaTeX-editors like
% \TeX Maker or \TeX Studio have a special tab for errors and warnings
% but not for messages. So you should look in the \texttt{log-File} itself.
% 
% The following errors and warnings are generated by \Pack{mdframed}.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
   The package ...  does not exist but
    needed by mdframed
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi        
% To avoid this problem you should install the required
% packages which are listed in section \ref{sec:syntax}.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
   package option style is depreciated
   use framemethod instead style
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi    
% With version 0.9d \Pack{mdframed} changed the meaning of the option 
% \Opt{style}. The option is used to load a defined style by 
% \Cmd{mdfdefinestyle}. Instead use \Opt{framemethod} (see section 
% \ref{globopt}). 
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  Unknown framemethod .... mdframed
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi   
% The input string for the option \Opt{framemethod} is unkown. See section
% \ref{globopt}.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
   You have not loaded ntheorem yet
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi   
% To use the option \Opt{ntheorem} you have to 
% load the package \Pack{ntheorem}.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  You have only a width of 3cm
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi   
% The package \Pack{mdframed} calculates the width of the contents
% based on the given options. If the width of the contents is smaller than
% 3\,cm you will get this warnings. You should change the 
% settings to get a greater width.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  You got a bad break
  you have to change it manually
  by changing the text, the space
  or something else
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi 
% Sometimes you have enough vertical space for the rules and the space
% between the rules and the contents but not for the contents itself.
% In this situation you will get this warning because the contents
% of this box is empty. You have the possibility to change the
% settings or include a \Cmd{clearpage} in front of 
% the environment \Pack{mdframed}.
% So far I have no idea how to avoid such things.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  You got a bad break
  because the split box is empty
  You have to change the page settings
  like enlargethispage or something else
  You got a bad break
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi 
% See the explanation above.
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  You got a bad break
  because the last split box is empty
  You have to change the settings
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi 
% The same reason as above but only in the last box.
% 
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
  Option ... is already consumed
  and has no effect on input line ...
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi 
% If you set a global option inside the document
% body you will get this warning.
% 
% \section{Known Problems}
%  In this section I will collect known problems. In case you encounter
%  any further problems, please drop me an email, 
%  \href{mailto:marco.daniel@mada-nada.de}{marco.daniel at mada-nada.de}.
% 
%    Do you have any ideas / wishes on further extensions to this package?
%    Please let me know!
% 
% \begin{enumerate}
%  \item So far the environment isn't compatible with the package 
%        \Pack{gmverb}.
%  \item If you load the package \Pack{picins} the frame will no be splitted.
%        That based on a problem of the package `picins` which defines
%        \Cmd{@captype} global.
%        To work with the package picins you can use the following hack.
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
\usepackage{picins}
\makeatletter
\let\@captype\@undefined
\def\newcaption{%
 \begingroup%
  \def\@captype{figure}%
  \refstepcounter\@captype\@dblarg{\@newcaption\@captype}%
 \endgroup%
}
\makeatother
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi 
%  \item \Pack{mdframed} can't handle the option \Opt{allowframebreaks} of the
%         class \Pack{beamer}.
% \end{enumerate}
% 
% 
% \section{ToDo}
% \textbf{\color{red} It is important to update the documentation}
% \begin{enumerate}
%   \item see \enquote{Known Problems}.
%   \item So far it isn't possible to combine the environment  
%         \Cmd{begin\{multicols\}} of the package \Pack{multicol} 
%         with \Pack{mdframed} with the whole option list.
%   \item Create new styles.
%   \item Improve page breaks.
%   \item Improve footnotes.
%   \item Improve documentation and examples.
%   \item Create styles for \Opt{frametitle}.
%   \item Create an inline version of \Env{mdframed} that's works like 
%         \Cmd{fbox}
%   \item Add \Cmd{ht}\Cmd{strutbox} to file \Pack{md-frame-1.mdf}
% \end{enumerate}                
% 
% \section{Acknowledgements}
%  \textsf{Dick Nickalls;\quad Dietrich Grau;\quad Piazza Luca;\quad%
%          Jobst Hoffmann;\quad Martin Scharrer;\quad Enrico Gregorio;\quad 
%          Heiko Oberdiek;\quad Philipp Stephani}.
% \medskip
% 
% \noindent Thanks for proofreading 
% 
% \textsf{Alan Munn} and \textsf{Nahid Shajari}
% 
% I hope I forgot nobody. 
% \clearpage
% \appendix
%
% \section{More information}
% %\addtocontents{toc}{\protect\setcounter{tocdepth}{-4}}
% In the following section I want to present how to create
% your own frame.
% \subsection{How does \Pack{mdframed} work?}
% With the environment \Cmd{begin\{mdframed\}} \ldots \Cmd{end\{mdframed\}}
% the whole contents will be saved in a \Cmd{savebox} called 
% \Cmd{mdf@splitbox@one}. After the calculation of the width and the height of 
% the \Cmd{mdf@splitbox@one} (done by \Pack{mdframed.sty}) the box will be set 
% sequently (done by \Pack{md-frame-X.mdf}). The following figure demonstrates 
% this.
% 
% \begin{center}
% \begin{tikzpicture}
% \newcommand{\mybox}[1]{\parbox{3.5cm}{\centering\small #1}}
% \tikzstyle{every node}=[font=\sffamily]
% \tikzset{mymatrixnodes/.style={%
%      matrix of nodes,
%      nodes={framed,draw=black,fill=yellow!10,},
%      column sep=4.5cm,
%      row sep=1.5cm,
%      }}
% \matrix(m)[mymatrixnodes]
%   {%
%    \mybox{read in and save contents in \Cmd{mdf@splitbox@one}}              &
%    \mybox{\Cmd{mdf@putbox@single}}                                         \\
%    \mybox{split \textbackslash mdf@splitbox@one in  \Cmd{mdf@splitbox@two} to
%           the free space of the page}                                       &
%    \mybox{\Cmd{mdf@putbox@first}}                                          \\
%    \mybox{contents of \Cmd{mdf@splitbox@one} have enough space on the new 
%           page}                                                             &
%    \mybox{\Cmd{mdf@putbox@second}}                                         \\
%    \mybox{split \Cmd{mdf@splitbox@one} in \Cmd{mdf@splitbox@two} to the free 
%           space of the page}                                                &
%    \mybox{\Cmd{mdf@putbox@middle}}                                         \\
% };
% 
% \tikzstyle{every path}=[black,-triangle 45,thick,shorten >=4pt,shorten <=4pt]
% \draw  (m-1-1) edge 
%        node[align=center,anchor=south]{enough space on page} (m-1-2);
% \draw  (m-2-1) edge 
%        node[align=center,anchor=south]{type out \Cmd{mdf@splitbox@two}}
%         (m-2-2);
% \draw  (m-3-1) edge 
%        node[align=center,anchor=south]{yes} (m-3-2);
% \draw  (m-4-1) edge 
%        node[align=center,anchor=south]{type out \Cmd{mdf@splitbox@two}}
%         (m-4-2);
% 
% \draw  (m-2-2) edge node[align=center,fill=white]%
%        {calculate the height of the new \Cmd{mdf@splitbox@one}} (m-3-1);
% 
% 
% \draw  (m-1-1) edge 
%        node[align=center,anchor=west]{not enough space on page} (m-2-1);
% \draw  (m-3-1) edge node[align=center,anchor=west]{no} (m-4-1);
% 
% \draw  let \p1=($(m-4-2.south)-(0,1)$), \p2=($(m-3-1.west)-(0.8,0)$) in
%       (m-4-2.south) -- ($(m-4-2.south)+(0,-1)$) --
%            node[align=center,anchor=north]%
%            {calculate the height of the new \Cmd{mdf@splitbox@one}} (\x2,\y1)
%        -- ($(m-3-1.west)-(0.8,0)$)-- ($(m-3-1.west)$) ;
% 
% 
% \end{tikzpicture}
% 
% \captionof{figure}{Setting the contents of \Pack{mdframed}}\label{fig:way}
% \end{center}
% 
% The width of the contents is the result of the settings of
% \Opt{leftmargin}, \Opt{rightmargin}, \Opt{linewidth},
% \Opt{innerleftmargin} and \Opt{innerrightmargin}
% (see figure \eqref{fig:laengen}).
% 
% \subsection{The Framecommands}
% The package \Pack{mdframed} knows four kinds of \enquote{Framecommand}. 
% These commands tell \LaTeX\ how to set the contents of \Pack{mdframed}. 
% \begin{description}
%   \item[\Cmd{mdf@putbox@single}] 
%        This command sets the contents of a single unsplit frame.
%   \item[\Cmd{mdf@putbox@first}]  
%        This command sets the contents of the first frame of a split frame.
%   \item[\Cmd{mdf@putbox@middle}] 
%        This command sets the contents of the middle frame of a split frame.
%   \item[\Cmd{mdf@putbox@second}] 
%        This command sets the contents of the last frame of a split frame.
% \end{description}
% 
% Using the explained commands we give an example. The command \Cmd{box}
% uses the contents of the savebox and types them out. 
% 
% First we want to type out the single box without any settings
% (but with the calculated width).
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
 \makeatletter
  \def\mdf@putbox@single{\box\mdf@splitbox@one}
 \makeatother
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% I am using the command \Cmd{leftline} to start the \enquote{Framecommands} at
% the left.
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}[deletekeywords={leftline},moretexcs={leftline}]
 \makeatletter
  \def\mdf@putbox@single{\leftline{\box\mdf@splitbox@one}}
 \makeatother
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% 
% Now you have to know how the lengths are named. Every length which can be
% modified by the options has the following syntax:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
 \mdf@<Name of the Length>@length
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% For example the leftmargin is:
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}
 \mdf@leftmargin@length
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% 
% To create only a line at the left with the correct \Opt{leftmargin} you
% can set \Cmd{mdf@putboxsingle} as follows
% 
% \iffalse
%<*example>
% \fi
\begin{tltxmdfexample}[deletekeywords={leftline},moretexcs={leftline}]
 \makeatletter
 \def\mdf@putbox@single{%
          \leftline{%
              \hspace*{\mdf@leftmargin@length}%
              \rule[-\dp\mdf@splitbox@one]{\mdf@linewidth}%
                   {\ht\mdf@splitbox@one+\dp\mdf@splitbox@one}%
              \box\mdf@splitbox@one
          }%
 }
 \makeatother
\end{tltxmdfexample}
% \iffalse
%</example>
% \fi
% 
% In this way you can do what you want. If you create your own style you
% can save the file as \Pack{md-frame-X.mdf}.
% \Pack{X} must be an integer. 
% In this way you can use the option \Opt{framemethod} to
% load the file by setting \Opt{framemethod=X}.
% 
% \clearpage
% 
% \subsection{Revision history}\label{rev}
% \raggedright
% \minisec{Version 1.6b submitted 02 Jun 2012}
% \begin{itemize*}
%  \item added commands \Cmd{mdfsubtitle} and \Cmd{mdfsubsubtitle}
%  \item added options \Opt{subtitleaboveline}, \Opt{subtitlebelowline},
%        \Opt{subsubtitleaboveline}, \Opt{subsubtitlebelowline},
%        \Opt{subtitlefont}, \Opt{subsubtitlefont}, 
%        \Opt{subtitlebackgroundcolor},
%        \Opt{subsubtitlebackgroundcolor}, \Opt{subtitleabovelinecolor},
%        \Opt{subtitlebelowlinecolor}, \Opt{subsubtitleabovelinecolor},
%        \Opt{subsubtitlebelowlinecolor}, \Opt{subtitleabovelinewidth}, 
%        \Opt{subtitlebelowlinewidth}, \Opt{subtitleaboveskip},
%        \Opt{subtitlebelowskip}, \Opt{subtitleinneraboveskip},
%        \Opt{subtitleinnerbelowskip}, \Opt{subsubtitleabovelinewidth}, 
%        \Opt{subsubtitlebelowlinewidth}, \Opt{subsubtitleaboveskip}, 
%        \Opt{subsubtitlebelowskip}, \Opt{subsubtitleinneraboveskip},
%        \Opt{subsubtitleinnerbelowskip}
%  \item improved formating of the file \Pack{mdframed.dtx}
%  \item fixed bug in combination with \Cmd{parskip} -- Thanks David Carlisle.
%  \item added extra loop to compute the splitting point.
%  \item improved splitting algorithm
%  \item added new option \Opt{ignorelastdescenders} -- Thanks Stephan Lehmke.
%  \item Improved option \Opt{repeatframetitle}
%  \item fixed bug: \Opt{framemethod=tikz} used wrong computed length by 
%        setting \Opt{everyline=true}
%  \item Tobias Weh inspired the excurs-environment not Tobias Schwan. Sorry,
%        I fixed it.
%  \item Improved \Cmd{mdtheorem} to handle \Cmd{listtheorems} provided by 
%  \Pack{ntheorem}.
% \end{itemize*}
%
% \minisec{Version 1.5 submitted 10 Mar 2012}
% \begin{itemize*}
%  \item fixed bug (Thanks Nicolas Roy)
%  \item expanded documentation (Thanks Martin Wilhelm Leidig)
%  \item added options \Opt{singleextra}, \Opt{firstextra},
%        \Opt{middleextra} and \Opt{secondextra}
%  \item expanded examples
% \end{itemize*}
%
% \minisec{Version 1.4d submitted 30 Mar 2012}
% \begin{itemize*}
%  \item fixed bug (Thanks Nicolas Roy)
%  \item added approach to documentation to work with \Pack{picins}
%  \item new implementation of option \Opt{hidealllines}, now you can set
%        \Cmd{mdfsetup}\Opt{\{hidealllines=true,leftline=true\}} printing
%        only the left line (inspired by Tobias Weh)
%  \item added option \Opt{everyline} to draw a top and bottom line at 
%        splitted frames
% \end{itemize*}
%
% \footnotesize 
% \minisec{Version 1.4 submitted 4 Mar 2012}
% \begin{itemize*}
%  \item fixed bug in combination with \Cmd{marginpar} (Thanks Juan Carlos 
%        Trujillo Ortega)
%  \item fixed bug with option \Opt{font} 
%  \item fixed bug inside \texttt{frametitle} (Thanks Yi, Hoze)
%  \item removed unnessary groups (Thanks Yi, Hoze)
%  \item changed the definition of \Pack{listings} to allow copy paste of the 
%        examples
% \end{itemize*}
%
% \minisec{Version 1.3a submitted 5 Feb 2012}
% \begin{itemize*}
% \item fixed bug (Thanks to Dietrich Grau)
% \end{itemize*}
%
% \minisec{Version 1.3 submitted 4 Feb 2012}
% \begin{itemize*}
% \item fixed documentation (Thanks to Dietrich Grau)
% \item added option \Opt{shadow}
% \item improved handling \Cmd{parindent} and \Cmd{parskip} (Thanks to  Enrico 
%       Gregorio and Joseph Wright)
% \end{itemize*}
%
% \minisec{Version 1.2 submitted 8 Jan 2012}
% \begin{itemize*}
% \item fixed documentation (Thanks to Dietrich Grau)
% \item fixed bug in combination with \Pack{amsthm}
% \item fixed bug in \Cmd{newmdtheoremenv}
% \item defined new styles via \Cmd{newpsstyle}\limitation[PSTricks]
% \item added new commands for interaction with \Pack{TikZ} and \Pack{PSTricks}
% \item expand frame title option by option \Opt{frametitlerule}, 
%       \Opt{frametitlerulewidth}, \Opt{frametitlefont}, 
%       \Opt{frametitleaboveskip}, \Opt{frametitlebelowskip}, 
%       \Opt{frametitlealignment}
% \item removed limitation of three lines for PSTricks
% \item defined new commands \Cmd{surroundwithmdframed}, \Cmd{mdflength}, 
%       \Cmd{mdtheorem}
% \item load \Pack{xparse} by default
% \item changed internal names
% \item expanded examples
% \end{itemize*}
%
% \minisec{Version 1.0b submitted 9 Dec 2011}
% \begin{itemize*}
% \item fixes documentation (Thanks to Dietrich Grau)
% \item fixes bug in \Cmd{newmdtheoremenv}
% \item fixes bug with overfull boxes (Thanks to Dietrich Grau)
% \item defined \Cmd{newpsstyle}\Opt{mdfbackgroundstyle} and \Opt{mdflinestyle}
%       \limitation[PSTricks]
% \item created dtx-file (Thanks to Kevin Godby)
% \item added \Cmd{@parboxrestore} to \Cmd{mdf@lrbox}
% \end{itemize*}
% 
% \minisec{Version 1.0 submitted 13 Nov 2011}
% \begin{itemize*}
% \item add option \Opt{userdefinedwidth}
% \item add option \Opt{align}
% \item add option \Opt{apptotikzsetting}
% \item create new command \Cmd{mdfapptodefinestyle}
% \item changed internal algorithm
% \item removed calc instead using \eTeX\ \verb+\dimexpr+
% \item expand documentation
% \item trying to fixe problems with \Pack{xcolor}
% \item fixed bug with \Opt{framemethod=pstricks}
% \item create file \Pack{mdframed-example-default}
% \item create file \Pack{mdframed-example-tikz}
% \item create file \Pack{mdframed-example-pstricks}
% \item create file \Pack{mdframed-example-texsx} 
%      (texsx stands for tex stackexchange)
% \end{itemize*}
% 
% 
% \minisec{Version 0.9g submitted 08 Oct 2011}
% \begin{itemize*}
% \item fixed documentation
% \item added small footnote compatibility
% \end{itemize*}
% 
% \minisec{Version 0.9f submitted 04 Oct 2011}
% \begin{itemize*}
% \item fixes bugs (thanks to Lars Madsen)
% \item added option \Opt{hidealllines}
% \item fixed documentation
% \end{itemize*}
% 
% 
% \minisec{Version 0.9e submitted 11 Sep 2011}
% \begin{itemize*}
% \item working with \texttt{twoside} modus
% \end{itemize*}
% 
% \minisec{Version 0.9d submitted 10 Sep 2011}
% \begin{itemize*}
% \item \textcolor{red}{changed the meaning of the option 
%        \Opt{style}}!!! (inspired by Lars Madsen)
% \item added option \Opt{framemethod} (inspired by Lars Madsen)
% \item added options \Opt{needspace} (inspired by Lars Madsen)
% \item added new command \Cmd{mdfdefinestyle} (inspired by Lars Madsen)
% \item fixes documentation
% \item renamed \Pack{md-frame-3.mdf} to \Pack{md-frame-2.mdf}
% \end{itemize*}
% 
% 
% 
% \minisec{Version 0.9b submitted 7 Sep 2011}
% \begin{itemize*}
% \item fixes bugs in \Cmd{newmdtheoremenv} (Thanks to Enrico Gregorio)
% \end{itemize*}
% 
% \minisec{Version 0.9a submitted 5 Sep 2011}
% \begin{itemize*}
% \item fixes bugs (Thanks to Lars Madson)
% \item expanded documentation (added revision history)
% \end{itemize*}
% 
% 
% \minisec{Version 0.9 submitted 4 Sep 2011}
% \begin{itemize*}
% \item added option \Opt{nobreak}
% \item detecting float environments to prevent split calculation
% \item expand documentation (Thanks to Alan Munn)
% \end{itemize*}
% 
% \minisec{Version 0.8a}
% \begin{itemize*}
% \item fixes bugs
% \item fixes documentation
% \end{itemize*}
% 
% \minisec{Version 0.8 submitted 22 Aug 2011}
% \begin{itemize*}
% \item  added commands: \Cmd{newmdenv}, \Cmd{renewmdenv}, 
%                        \Cmd{newmdtheoremenv}
% \item fixes bugs
% \item fixes documentation
% \end{itemize*}
% 
% \minisec{Version 0.7a submitted 6 August 2011}
% \begin{itemize*}
% \item added option \Opt{frametitle}
% \item added option \Opt{frametitlefont}
% \item allow twolumn-mode
% \item changed the calculation
% \item added option \Opt{tikzsetting}
% \item added options for hidden lines for all styles
% \item fixes bugs
% \end{itemize*}
% 
% \minisec{Version 0.6a submitted 22 Dec 2010}
% \begin{itemize*}
% \item fixes bugs
% \item added \Cmd{mdfsetup}
% \item expanded documentation
% \end{itemize*}
%
% \clearpage
%
% \section{Implementation}\label{implementation}
%
% And finally, here's how it all works\ldots
%
%\StopEventually{^^A
%  %%\clearpage
%  %%\PrintChanges^^A
%  \clearpage
%  \PrintIndex^^A
%}
%\iffalse
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%\fi
%
% \subsection{The Explanation of mdframed.sty}
%
% %$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
% %$Rev: 426 $
% %$Author: marco $
% %$Date: 2012-06-02 14:18:56 +0200 (Sa, 02 Jun 2012) $
% \begin{macro}{mdversion,mdframedpackagename,mdf@maindate@svn}
% Set package information
%    \begin{macrocode}
\def\mdversion{v1.6b}
\def\mdframedpackagename{mdframed}
\def\mdf@maindate@svn$#1: #2 #3 #4-#5-#6 #7 #8${#4/#5/#6\space }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mdframed}%
     [\mdf@maindate@svn$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $%
      \mdversion: \mdframedpackagename]
%    \end{macrocode}
%
% \begin{macro}{mdf@PackageWarning,mdf@PackageInfo,mdf@LoadFile@IfExist}
%  Set short form of |\PackageError|, |\PackageWarning|, |\PackageInfo| and 
%  |IfFileExists| in combination with |\RequirePackage|.
%    \begin{macrocode}
\newcommand*\mdf@PackageError[1]{\PackageError{\mdframedpackagename}{#1}}
\newcommand*\mdf@PackageWarning[1]{\PackageWarning{\mdframedpackagename}{#1}}
\newcommand*\mdf@PackageInfo[1]{\PackageInfo{\mdframedpackagename}{#1}}
\newcommand*\mdf@LoadFile@IfExist[1]{%
 \IfFileExists{#1.sty}{%
          \RequirePackage{#1}%
        }{%
        \mdf@PackageWarning{The file #1 does not exist\MessageBreak
                           but needed by \mdframedpackagename\MessageBreak
                           see documentation fo further information
                           }%
       }
}
%    \end{macrocode}
% \end{macro}
%
% Loading required packages
%    \begin{macrocode}
\RequirePackage{kvoptions}
\RequirePackage{xparse}
\RequirePackage{etoolbox}[2011/01/03]
\RequirePackage{zref-abspage}
\RequirePackage{color}
%    \end{macrocode}
%
% Set the family and the prefix of all options.
%    \begin{macrocode}
\SetupKeyvalOptions{family=mdf,prefix=mdf@}
%    \end{macrocode}

% \begin{macro}{mdf@iflength,mdf@iflength@check,mdf@iflength@check}
% Command which checks the input of length options. If the length option is
% only a number the |defaultunit| will be used. Syntax: 
% |\mdf@iflength{<Input>}{<length>}{<no length>}|
%    \begin{macrocode}
\newlength{\mdf@templength}
\def\mdf@iflength#1{%
  \afterassignment\mdf@iflength@check%
  \mdf@templength=#1\mdf@defaultunit\relax\relax
  \expandafter\endgroup\next
}
\def\mdf@iflength@check#1{%
  \begingroup
  \ifx\relax#1\@empty
    \def\next{\@secondoftwo}
  \else
    \def\next{\@firstoftwo}
    \expandafter\mdf@iflength@cleanup
  \fi
}
\def\mdf@iflength@cleanup#1\relax{}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@dolist}
%  Loop used by \Pack{mdframed}.
%    \begin{macrocode}
\DeclareListParser*{\mdf@dolist}{,}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@option@length,mdf@define@key@length}
% Command to define a new length width a default value. 
%| \mdf@option@length{<name of length>}{<Defaultwert>}|
%    \begin{macrocode}
\newrobustcmd*{\mdf@option@length}[2]{%
 \expandafter\newlength\csname mdf@#1@length\endcsname%
 \expandafter\setlength\csname mdf@#1@length\endcsname{#2}%
 }
%    \end{macrocode}
%  Command to create a new length option.
%  |\mdf@define@key@length{<name of length option>}|
%    \begin{macrocode}
\newrobustcmd*{\mdf@define@key@length}[1]{%
   \define@key{mdf}{#1}{%
      \def\@tempa{##1}
      \mdf@iflength{\@tempa}%
       {\csxdef{mdfl@#1}{\the\mdf@templength}}%
       {\csxdef{mdfl@#1}{\the\mdf@templength}}%
       \setlength{\csname mdf@#1@length\endcsname}{\csname mdfl@#1\endcsname}%
   }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@do@lengthoption,mdf@lengthoption@doubledo}
% The loop of |\mdf@dolist| expected one argument. So I have to define a 
% command to allow a loop with two arguments. The separation for the input is 
% |==|.
%    \begin{macrocode}
\def\mdf@do@lengthoption#1{%
  \mdf@lengthoption@doubledo#1\@nil%
}
\def\mdf@lengthoption@doubledo#1==#2\@nil{%
   \mdf@option@length{#1}{#2}%
   \mdf@define@key@length{#1}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@do@stringoption,mdf@stringoption@doubledo}
% Same as |\mdf@do@lengthoption| and |\mdf@lengthoption@doubledo|.
%    \begin{macrocode}
\def\mdf@do@stringoption#1{%
   \mdf@stringoption@doubledo#1\@nil%
}
\def\mdf@stringoption@doubledo#1==#2\@nil{%
   \expandafter\gdef\csname mdf@#1\endcsname{#2}%
   \define@key{mdf}{#1}{%
      \csdef{mdf@#1}{##1}%
   }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@do@booloption,mdf@booloption@doubledo}
% Same as |\mdf@do@lengthoption| and |\mdf@lengthoption@doubledo|.
%    \begin{macrocode}
\def\mdf@do@booloption#1{%
   \mdf@booloption@doubledo#1\@nil%
}
\def\mdf@booloption@doubledo#1==#2\@nil{%
   \newbool{mdf@#1}\setbool{mdf@#1}{#2}%
   \define@key{mdf}{#1}[#2]{%
      \setbool{mdf@#1}{##1}%
   }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@do@alignoption,mdf@alignoption@tripledo}
% Same as |\mdf@do@lengthoption| and |\mdf@lengthoption@doubledo|. Here
% three arguments are required.
%    \begin{macrocode}
\def\mdf@do@alignoption#1{%
   \mdf@alignoption@tripledo#1\@nil%
}
\def\mdf@alignoption@tripledo#1==#2==#3\@nil{%
   \csdef{mdf@align@#1@left}{\null\hspace*{#2}}%
   \csdef{mdf@align@#1@right}{\hspace*{#3}\null}%
}
%    \end{macrocode}
% \end{macro}
%
% Start declaration of options
%    \begin{macrocode}
\newcounter{mdf@globalstyle@cnt}
\defcounter{mdf@globalstyle@cnt}{0}
\newcommand*\mdfglobal@style{0}
%    \end{macrocode}
% Only provide to be backward compatible
%    \begin{macrocode}
\define@key{mdf}{style}{%
  \mdf@PackageWarning{package option style is depreciated^^J
                      use framemethod instead\MessageBreak}%
  \renewcommand*\mdfglobal@style{#1}%
  \defcounter{mdf@globalstyle@cnt}{#1}%
  \ifcase\value{mdf@globalstyle@cnt}\relax
     \or\mdf@LoadFile@IfExist{tikz}%=1
     \or\mdf@LoadFile@IfExist{pstricks-add}%=2
     \or\defcounter{mdf@globalstyle@cnt}{2}%=3
        \mdf@LoadFile@IfExist{pst-node}%
     \or\mdf@LoadFile@IfExist{pst-node}%=4
  \else%%>4
     \mdf@PackageWarning{Unknown global style \value{mdf@globalstyle@cnt}}%
  \fi%
}
%    \end{macrocode}
%
% \begin{macro}{mdf@framemethod}
%  Definining the global option \Opt{framemethod}.
%    \begin{macrocode}
\providecommand*\mdf@framemethod{}
\def\mdf@framemethod@i{}%
\def\mdf@framemethod@ii{}%
\def\mdf@framemethod@iii{}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\define@key{mdf}{framemethod}[default]{%
  \lowercase{\def\mdf@tempa{#1}}%lowercase not expandable
  \forcsvlist{\listadd\mdf@framemethod@i}{default,tex,latex,none,0}
  \forcsvlist{\listadd\mdf@framemethod@ii}{pgf,tikz,1}
  \forcsvlist{\listadd\mdf@framemethod@iii}{pstricks,ps,2,postscript}
  \xifinlist{\mdf@tempa}{\mdf@framemethod@i}%
    {\def\mdf@@framemethod{default}\defcounter{mdf@globalstyle@cnt}{0}}%
    {\xifinlist{\mdf@tempa}{\mdf@framemethod@ii}%
       {\def\mdf@@framemethod{tikz}\defcounter{mdf@globalstyle@cnt}{1}}%
       {\xifinlist{\mdf@tempa}{\mdf@framemethod@iii}%
          {\def\mdf@@framemethod{pstricks}\defcounter{mdf@globalstyle@cnt}{2}}%
          {\mdf@LoadFile@IfExist{#1}}%
       }%
    }%
  \ifcase\value{mdf@globalstyle@cnt}\relax%
     \or\mdf@LoadFile@IfExist{tikz}%=1
     \or\mdf@LoadFile@IfExist{pst-node}%=2
     \or\mdf@LoadFile@IfExist{pst-node}%=3
  \fi%
}
%    \end{macrocode}
%
% \begin{macro}{mdf@do@lengthoption}
% Here the declaration of all length options.
%    \begin{macrocode}
\mdf@dolist{\mdf@do@lengthoption}{%
   {skipabove==\z@},%
   {skipbelow==\z@},%
   {leftmargin==\z@},%
   {rightmargin==\z@},%
   {innerleftmargin==10pt},%
   {innerrightmargin==10pt},%
   {innertopmargin==0.4\baselineskip},%
   {innerbottommargin==0.4\baselineskip},%
   {splittopskip==\z@},%
   {splitbottomskip==\z@},%
   {outermargin==\z@},%
   {innermargin==\z@},%
   {linewidth==0.4pt},%
   {innerlinewidth==\z@},%
   {middlelinewidth==\expandafter\mdf@linewidth@length},%
   {outerlinewidth==\z@},%
   {roundcorner==\z@},%
   {footenotedistance==\medskipamount},
   {userdefinedwidth==\linewidth},
   {frametitleaboveskip==5pt},
   {frametitlebelowskip==5pt},
   {frametitlerulewidth==.2pt},
   {frametitleleftmargin==10pt},%
   {frametitlerightmargin==10pt},%
   {shadowsize==8pt},%
   {extratopheight==\z@},%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
% %%subtitle / subsubtitle added 29.05.12%% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
   {subtitleabovelinewidth==.8pt},%
   {subtitlebelowlinewidth==.6pt},%
   {subtitleaboveskip==\baselineskip},%
   {subtitlebelowskip==1.2\baselineskip},%
   {subtitleinneraboveskip==.5\baselineskip},%
   {subtitleinnerbelowskip==.5\baselineskip},%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   {subsubtitleabovelinewidth==.8pt},%
   {subsubtitlebelowlinewidth==.6pt},%
   {subsubtitleaboveskip==\baselineskip},%
   {subsubtitlebelowskip==1.2\baselineskip},%
   {subsubtitleinneraboveskip==.5\baselineskip},%
   {subsubtitleinnerbelowskip==.5\baselineskip},%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@do@lengthoption}
% Here the declaration of the string options.
%    \begin{macrocode}
\mdf@dolist{\mdf@do@stringoption}{%
    {frametitle=={}},%
    {defaultunit==pt},%
    {linecolor==black},%
    {backgroundcolor==white},%
    {fontcolor==black},%
    {frametitlefontcolor==black},%
    {innerlinecolor==\mdf@linecolor},%
    {outerlinecolor==\mdf@linecolor},%
    {middlelinecolor==\mdf@linecolor},%
    {psroundlinecolor==\mdf@backgroundcolor},%
    {frametitlerulecolor==\mdf@linecolor},
    {frametitlebackgroundcolor==\mdf@backgroundcolor},%
    {shadowcolor==black!50},%
    {settings=={}},%
    {frametitlesettings=={}},%
    {font=={}},%
    {frametitlefont==\normalfont\bfseries},%
    {printheight==none},%
    {alignment=={}},%
    {frametitlealignment=={}},%
    {theoremseparator=={:}},%
    {theoremcountersep=={.}},%
    {theoremtitlefont=={}},%
    {theoremspace=={\space}},%
    {singleextra=={}},
    {firstextra=={}},
    {middleextra=={}},
    {secondextra=={}},
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
% %%subtitle / subsubtitle added 29.05.12%% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
    {subtitlefont==\normalfont\bfseries},%
    {subsubtitlefont==\normalfont},%
    {subtitlebackgroundcolor==white},%
    {subsubtitlebackgroundcolor==white},%
    {subtitleabovelinecolor==black},%
    {subtitlebelowlinecolor==black},%
    {subsubtitleabovelinecolor==black},%
    {subsubtitlebelowlinecolor==black},%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@do@booloption}
% Here the declaration of all bool options.
%    \begin{macrocode}
\mdf@dolist{\mdf@do@booloption}{%
    {ntheorem==false},%
    {topline==true},%
    {leftline==true},%
    {bottomline==true},%
    {rightline==true},%
    {frametitletopline==true},%
    {frametitleleftline==true},%
    {frametitlebottomline==true},%
    {frametitlerightline==true},%
    {frametitlerule==false},%
    {nobreak==false},%
    {footnoteinside==true},%
    {usetwoside==true},%
    {repeatframetitle==false},%Noch nicht richtig implementiert
    {shadow==false},%
    {everyline==false},%
    {ignorelastdescenders==false},%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
% %%subtitle / subsubtitle added 29.05.12%% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
    {subtitleaboveline==false},
    {subtitlebelowline==false},
    {subsubtitleaboveline==false},
    {subsubtitlebelowline==false},
}
%%special boolflag hidealllines:
\newbool{mdf@hidealllines}%
\define@key{mdf}{hidealllines}[false]{%
\setbool{mdf@hidealllines}{#1}%
 \ifbool{mdf@hidealllines}{%
   \kvsetkeys{mdf}{leftline=false,topline=false,%
                   rightline=false,bottomline=false}%
 }{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@do@alignoption}
% Here the declaration of all align options.
%    \begin{macrocode}
\mdf@dolist{\mdf@do@alignoption}{%
    {left==\mdf@leftmargin@length==\z@},%
    {center==\fill==\fill},%
    {right==\fill==\mdf@rightmargin@length},%
    {outer==\fill==\mdf@rightmargin@length},%not supported yet
    {outer==\mdf@leftmargin@length==\fill},%not supported yet
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@align,mdf@makeboxalign@left,
%               mdf@makeboxalign@right,mdf@makeboxalign@right}
% Set the alignment.
%    \begin{macrocode}
\newcommand*\mdf@align{}%
\newcommand*\mdf@makeboxalign@left{\null\hspace*{\mdf@leftmargin@length}}%
\newcommand*\mdf@makeboxalign@right{}%
\define@key{mdf}{align}[left]{%
   \ifcsundef{mdf@align@#1@left}{%
       \mdf@PackageWarning{Unknown alignment #1\MessageBreak}%
       \letcs\mdf@makeboxalign@left{mdf@align@left@left}%
       \letcs\mdf@makeboxalign@right{mdf@align@left@right}%
   }{%
       \def\mdf@makeboxalign@left{\csuse{mdf@align@#1@left}}%
       \def\mdf@makeboxalign@right{\csuse{mdf@align@#1@right}}%
   }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@tikzset@local,mdf@psset@local}
% Option to pass options to tikz or pstricks
%    \begin{macrocode}
\def\mdf@tikzset@local{\tikzset{tikzsetting/.style={}}}
\define@key{mdf}{tikzsetting}{%
  \def\mdf@tikzset@local{\tikzset{tikzsetting/.style={#1}}}%
}
\define@key{mdf}{apptotikzsetting}{%
  \appto\mdf@tikzset@local{#1}%
}
\def\mdf@psset@local{}
\define@key{mdf}{pstrickssetting}{%
  \def\mdf@psset@local{#1}
}
\def\mdfpstricks@appendsettings{}
\define@key{mdf}{pstricksappsetting}{%
  \def\mdfpstricks@appendsettings{#1}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@xcolor}
% \textcolor{red}{\bfseries Problem width xcolor. This part must be reworked!}
%    \begin{macrocode}
\def\mdf@xcolor{}
\define@key{mdf}{xcolor}[]{%
  \def\@tempa{#1}%
  \@ifpackageloaded{xcolor}{%
     \let\mdf@xcolor\@empty %ignoriere die Eingabe der Optionen
     \def\@tempa{}%
     }{}%
  \ifx\relax\@tempa\relax\else
     \PassOptionsToPackage{\mdf@xcolor}{xcolor}%
      \RequirePackage{xcolor}%     
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@needspace}
% Defining the option needspace
%    \begin{macrocode}
\define@key{mdf}{needspace}[\z@]{%
     \begingroup%
        \setlength{\dimen@}{#1}%
        \vskip\z@\@plus\dimen@%
        \penalty -100\vskip\z@\@plus -\dimen@%
        \vskip\dimen@%
        \penalty 9999%
        \vskip -\dimen@%
        \vskip\z@skip % hide the previous |\vskip| from |\addvspace|
      \endgroup%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareDefaultOption{%
   \mdf@PackageError{Unknown Option '\CurrentOption' for mdframed}}
\ProcessKeyvalOptions*\relax
%    \end{macrocode}
%
% \begin{macro}{mdfsetup}
% Short form of |\setkeys{mdf}|
%    \begin{macrocode}
\newrobustcmd*{\mdfsetup}{\kvsetkeys{mdf}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@style}
% Redefinition of the option |style| to use the key in combination with 
% |mdfdefinedstyle|.
%    \begin{macrocode}
\define@key{mdf}{style}{%
  \ifcsundef{mdf@definestyle@#1}{%
    \mdf@PackageWarning{Unknown definedstyle #1^^J
                       You have to define a style ^^J
                       via \string\mdfdefinedstyle\MessageBreak
                      }%
   }%
   {\expandafter\expandafter\expandafter\mdfsetup\expandafter%
    \expandafter\expandafter{\csname mdf@definestyle@#1\endcsname}}%
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@print@space}
%  Option to type out the free vertical space of the current page.
%    \begin{macrocode}
\let\mdf@PackageNoInfo\@gobble
\newrobustcmd*\mdf@ifstrequal@expand{%
\expandafter\ifstrequal\expandafter{\mdf@printheight}%
}
\newrobustcmd*\mdf@print@space{%
  %case "none"
  \mdf@ifstrequal@expand{none}{\def\mdf@tempa{NoInfo}}{%
      %case "info"
      \mdf@ifstrequal@expand{info}{\def\mdf@tempa{Info}}{%
         %case "warning"
         \mdf@ifstrequal@expand{warning}{\def\mdf@tempa{Warning}}{%
            %case "unknown"
            \mdf@PackageWarning{Unknown key for printheight=\mdf@printheight^^J
                               use none, info or warning}%
             \def\mdf@tempa{none}%
         }%
      }%
  }%
\def\mdf@PackageInfoSpace{\csname mdf@Package\mdf@tempa\endcsname}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{new...}
%  Initialize all commands and length which will we used later
%    \begin{macrocode}
\newsavebox\mdf@frametitlebox
\newsavebox\mdf@footnotebox
\newsavebox\mdf@splitbox@one
\newsavebox\mdf@splitbox@two
\newsavebox\mdf@splitbox@save
\newlength\mdfsplitboxwidth
\newlength\mdfsplitboxtotalwidth
\newlength\mdfsplitboxheight
\newlength\mdfsplitboxdepth
\newlength\mdfsplitboxtotalheight
\newlength\mdfframetitleboxwidth
\newlength\mdfframetitleboxtotalwidth
\newlength\mdfframetitleboxheight
\newlength\mdfframetitleboxdepth
\newlength\mdfframetitleboxtotalheight
\newlength\mdffootnoteboxwidth
\newlength\mdffootnoteboxtotalwidth
\newlength\mdffootnoteboxheight
\newlength\mdffootnoteboxdepth
\newlength\mdffootnoteboxtotalheight

\newlength\mdftotallinewidth

\newlength\mdfboundingboxwidth
\newlength\mdfboundingboxtotalwidth

\newlength\mdfboundingboxheight
\newlength\mdfboundingboxdepth
\newlength\mdfboundingboxtotalheight

\newlength\mdf@freevspace@length
\newlength\mdf@horizontalwidthofbox@length
\newlength\mdf@verticalmarginwhole@length

\newtoggle{mdf@notfirstframetitle}%
\togglefalse{mdf@notfirstframetitle}%


% Command to expand the tikz code. (see md-frame-1.mdf)
\newrobustcmd\mdfcreateextratikz{}

%    \end{macrocode}
% \end{macro}
%
% \changes{v1.6}{2012/05/11}{Changes the complete definition of
% \protect\Cmd{mdf@lrbox} to fix problem with \protect\Env{itemize}}
% \begin{macro}{mdf@lrbox,endmdf@lrbox}
% Modification of the default |\lrbox| and |\endlrbox|
%    \begin{macrocode}
\def\mdf@lrbox#1{%
%%patch to work with amsthm
  \mdf@patchamsthm
%%%end patch
 \edef\mdf@restoreparams{%
   \parindent=\the\parindent\relax \parskip=\the\parskip\relax}%
 \setbox#1\vbox\bgroup%
   \color@begingroup%
     \mdf@horizontalmargin@equation%
     \columnwidth=\hsize%
     \textwidth=\hsize%
     \let\if@nobreak\iffalse%
     \let\if@noskipsec\iffalse%
     \let\par\@@par%
     \let\-\@dischyph%
     \let\'\@acci\let\`\@accii\let\=\@acciii%
     \parindent\z@ \parskip\z@skip%
     \linewidth\hsize%
     \@totalleftmargin\z@%
     \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip%
     \parfillskip\@flushglue \lineskip\normallineskip%
     \baselineskip\normalbaselineskip%
%%  \sloppy%
     \let\\\@normalcr%
     \mdf@restoreparams\relax%
     \@afterindentfalse%
     \@afterheading%
}

\def\endmdf@lrbox{\color@endgroup\egroup}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@ignorevbadness,mdf@restorevbadness}
% Avoiding warnings during the splitting process by \Cmd{vsplit}.
% see \href{http://tex.stackexchange.com/questions/38496/how-to-avoid-^^A
%           underfull-vbox-in-combination-with-vsplit/38499#38499}^^A
%          {How to avoid underfull vbox in combination with \Cmd{vsplit}?}
%    \begin{macrocode}
\newrobustcmd*\mdf@ignorevbadness{%
   \edef\mdf@currentvbadness{\the\vbadness}%
   \vbadness=\@M%
   \afterassignment\mdf@restorevbadness}
\newrobustcmd*\mdf@restorevbadness{\vbadness=\mdf@currentvbadness\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@patchamsth}
% The package \Pack{amsthm} provides a not compatible starting of theorem. So I
% have to change the header of amsthm.
%    \begin{macrocode}
\@ifpackageloaded{amsthm}%
{%
 \newrobustcmd\mdf@patchamsthm{%
   \let\mdf@deferred@thm@head\deferred@thm@head
   \patchcmd{\deferred@thm@head}{\indent}{}%
      {\mdf@PackageInfo{mdframed detected package amsthm ^^J
                        changed the theoerem header of amsthm\MessageBreak}%
      }{%
       \mdf@PackageError{mdframed detected package amsthm ^^J
                         changed the theoerem header of amsthm
                         failed\MessageBreak}%
       }%
     }%
}{\let\mdf@patchamsthm\relax}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@trivlist,endmdf@trivlist}
% Modification of the default |\trivlist| and |\endtrivlist|.
%    \begin{macrocode}
\def\mdf@trivlist#1{%
  \setlength{\topsep}{#1}%
  \partopsep\z@%
  \parsep\z@%
  \@nmbrlistfalse%
  \@trivlist%
  \labelwidth\z@%
  \leftmargin\z@%
  \itemindent\z@%
  \let\@itemlabel\@empty%
  \def\makelabel##1{##1}%
%%  \item\leavevmode\hrule \@height\z@ \@width\linewidth\relax%
%%  \item\mbox{}\relax% second version
  \item\relax% first Version
}
\let\endmdf@trivlist\endtrivlist
\patchcmd\endmdf@trivlist\@endparenv\mdf@endparenv{%
  \immediate\typeout{^^J****** mdframed patching \string\endmdf@trivlist}%
  \immediate\typeout{^^J****** -- success******^^J}%
  }{%
  \immediate\typeout{^^J****** mdframed patching \string\endmdf@trivlist}%
  \immediate\typeout{^^J****** -- failed******^^J}%
}
\def\mdf@endparenv{%
  \addpenalty\@endparpenalty\addvspace\mdf@skipbelow@length\@endpetrue}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@makebox@out,mdf@makebox@in}
%    \begin{macrocode}
\newrobustcmd*\mdf@makebox@out[2][\linewidth]{%
 \noindent\hb@xt@\z@{%
    \noindent\makebox[\dimexpr #1\relax][l]{#2}%
 \hss}%
}%
\newrobustcmd*\mdf@makebox@in[2][\mdf@userdefinedwidth@length]{%
 \noindent\makebox[\dimexpr #1\relax][l]{#2}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdfdefinestyle,mdfapptodefinestyle}
% See explanation of this commands in the main documenation.
%    \begin{macrocode}
\newrobustcmd*\mdfdefinestyle[2]{%
  \csdef{mdf@definestyle@#1}{#2}%
}
\newrobustcmd*\mdfapptodefinestyle[2]{%
 \ifcsundef{mdf@definestyle@#1}%
   {\mdf@PackageWarning{Unknown style #1}}%
   {\csappto{mdf@definestyle@#1}{,#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdflength,surroundwithmdframed}
% Helper macros to work with mdframed
%    \begin{macrocode}
\newrobustcmd*{\mdflength}[1]{\csuse{mdf@#1@length}}

\newrobustcmd*{\surroundwithmdframed}[2][]{%
  \BeforeBeginEnvironment{#2}{\begin{mdframed}[#1]}%
  \AfterEndEnvironment{#2}{\end{mdframed}}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{newmdenv,renewmdenv,newmdtheoremenv,mdtheorem}
% Defining of the new environment defintions.
%    \begin{macrocode}
\newrobustcmd*\newmdenv[2][]{%
  \newenvironment{#2}{%
     \mdfsetup{#1}%
     \begin{mdframed}%
    }{%
     \end{mdframed}%
  }%
}
\newrobustcmd*\renewmdenv[2][]{%
  \expandafter\let\csname #2\endcsname\relax%
  \expandafter\let\csname end#2\endcsname\relax%
  \newmdenv[#1]{#2}%
  }%
%    \end{macrocode}
%  Definitions of the standard Theoerems surrounded by \Pack{mdframed}.
%    \begin{macrocode}
\DeclareDocumentCommand\newmdtheoremenv{O{} m o m o }{%
 \ifboolexpr{ test {\IfNoValueTF {#3}} and test {\IfNoValueTF {#5}} }%
    {\newtheorem{#2}{#4}}{%
     \IfValueTF{#3}{\newtheorem{#2}[#3]{#4}}{}%
     \IfValueTF{#5}{\newtheorem{#2}{#4}[#5]}{}%
    }%
  \BeforeBeginEnvironment{#2}{%
     \begin{mdframed}[#1]}%
  \AfterEndEnvironment{#2}{%
     \end{mdframed}}%
}
%    \end{macrocode}
% Compatible with \Pack{ntheorem}'s \Cmd{listoftheorems}.
%    \begin{macrocode}
\newrobustcmd*\mdf@thm@caption[2]{}
\AtBeginDocument{%
 \@ifpackageloaded{ntheorem}%
   {\renewrobustcmd*\mdf@thm@caption{\thm@thmcaption}}{}%
 }
%    \end{macrocode}
% Defining a complete new theorem set by \Pack{mdframed}
%    \begin{macrocode}
\DeclareDocumentCommand{\mdtheorem}{ O{} m o m o }%
 {\ifcsdef{#2}%
   {\mdf@PackageWarning{Environment #2 already exits\MessageBreak}}%
   {%
    \IfNoValueTF {#3}%
     {%#3 not given -- number relationship
      \IfNoValueTF {#5}%
        {%#3+#5 not given
        \@definecounter{#2}%
        \expandafter\xdef\csname the#2\endcsname{\@thmcounter{#2}}%
        \newenvironment{#2}[1][]{%
          \refstepcounter{#2}%
          \ifstrempty{##1}%
            {\let\@temptitle\relax}%
            {%
             \def\@temptitle{\mdf@theoremseparator%
                             \mdf@theoremspace%
                             \mdf@theoremtitlefont%
                             ##1}%
             \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
             }%
          \begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
                                          \@temptitle}]}%
          {\end{mdframed}}%
        \newenvironment{#2*}[1][]{%
          \ifstrempty{##1}{\let\@temptitle\relax}{\def\@temptitle{:\ ##1}}%
          \begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
          {\end{mdframed}}%
        }%
        {%#5 given -- reset counter
        \@definecounter{#2}\@newctr{#2}[#5]%
        \expandafter\xdef\csname the#2\endcsname{\@thmcounter{#2}}%
        \expandafter\xdef\csname the#2\endcsname{%
               \expandafter\noexpand\csname the#5\endcsname \@thmcountersep%
                  \@thmcounter{#2}}%
        \newenvironment{#2}[1][]{%
          \refstepcounter{#2}%
          \ifstrempty{##1}%
            {\let\@temptitle\relax}%
            {%
             \def\@temptitle{\mdf@theoremseparator%
                             \mdf@theoremspace%
                             \mdf@theoremtitlefont%
                             ##1}%
             \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
             }
          \begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
                                          \@temptitle}]}%
          {\end{mdframed}}%
        \newenvironment{#2*}[1][]{%
          \ifstrempty{##1}%
            {\let\@temptitle\relax}%
            {%
             \def\@temptitle{\mdf@theoremseparator%
                             \mdf@theoremspace%
                             \mdf@theoremtitlefont%
                             ##1}%
             \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
             }%
          \begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
          {\end{mdframed}}%
        }%
     }%
     {%#3 given -- number relationship
        \global\@namedef{the#2}{\@nameuse{the#3}}%
        \newenvironment{#2}[1][]{%
          \refstepcounter{#3}%
          \ifstrempty{##1}%
            {\let\@temptitle\relax}%
            {%
             \def\@temptitle{\mdf@theoremseparator%
                             \mdf@theoremspace%
                             \mdf@theoremtitlefont%
                             ##1}%
             \mdf@thm@caption{#2}{{#4}{\csname the#2\endcsname}{##1}}%
             }
          \begin{mdframed}[#1,frametitle={\strut#4\ \csname the#2\endcsname%
                                          \@temptitle}]}%
          {\end{mdframed}}%
        \newenvironment{#2*}[1][]{%
          \ifstrempty{##1}{\let\@temptitle\relax}{\def\@temptitle{:\ ##1}}%
          \begin{mdframed}[#1,frametitle={\strut#4\@temptitle}]}%
          {\end{mdframed}}%
     }%
   }%
 }

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdfframedtitleenv,mdf@@frametitle,
%               mdf@setopt@body,mdf@setopt@title}
% Default definition of the frame tile used by |mdframed|.
% \textcolor{red}{\bfseries Need a better documenation and must be improved!!!}
%    \begin{macrocode}
\newrobustcmd\mdfframedtitleenv[1]{%
    \mdf@lrbox{\mdf@frametitlebox}%
     \mdf@frametitlealignment%
       \leavevmode\color{\mdf@frametitlefontcolor}%
           \normalfont\mdf@frametitlefont{#1}
%    \end{macrocode}
% Trying to ignore last descenders of the environment.
%    \begin{macrocode}
       \ifbool{mdf@ignorelastdescenders}%
         {%
          \par\strut\par
          \unskip\unskip\setbox0=\lastbox
          \vspace*{\dimexpr\ht\strutbox-\baselineskip\relax}%
         }{}%
    \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%%
%    \end{macrocode}
%
%    \begin{macrocode}
    \endmdf@lrbox\relax%
   \mdf@ignorevbadness%
   \setbox\mdf@frametitlebox=\vbox{\unvbox\mdf@frametitlebox}%
   \mdfframetitleboxwidth=\wd\mdf@frametitlebox\relax%
   \mdfframetitleboxheight=\ht\mdf@frametitlebox\relax%
   \mdfframetitleboxdepth=\dp\mdf@frametitlebox\relax%
   \mdfframetitleboxtotalheight=\dimexpr
                                  \ht\mdf@frametitlebox
                                  +\dp\mdf@frametitlebox%
                                  +\mdf@frametitleaboveskip@length
                                  +\mdf@frametitlebelowskip@length
                                \relax%
}

\newrobustcmd*\mdf@@frametitle{%
    \mdfframedtitleenv{\mdf@frametitle}%
}

\newrobustcmd*\mdf@@frametitle@use{%
   \parskip\z@\relax%
   \parindent\z@\relax%
   \offinterlineskip\relax%
   \mdf@ignorevbadness%
   \setbox\mdf@splitbox@one=\vbox{%
       \unvcopy\mdf@frametitlebox\relax%
       \mdf@@frametitlerule\relax%
       \unvbox\mdf@splitbox@one\relax%
    }%
   \mdf@ignorevbadness%
   \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one}%
   \mdfsetup{innertopmargin=\mdf@frametitleaboveskip@length}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@checkntheorem}
% Command which checks only |ntheorem|. Later I will support also
% |thmtools|.
%    \begin{macrocode}
\newrobustcmd*\mdf@checkntheorem{%
  \ifbool{mdf@ntheorem}%
    {\ifundef{\theorempreskipamount}%
          {\mdf@PackageWarning{You have not loaded ntheorem yet}}%
          {\setlength{\theorempreskipamount}{\z@}%
           \setlength{\theorempostskipamount}{\z@}%
    }%
  }{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@footnoterule,mdf@footnoteoutput,mdf@footnoteinput}
% Support for footnotes. See source2e.
%    \begin{macrocode}
\newrobustcmd*\mdf@footnoterule{%
    \kern0\p@%
    \hrule \@width 1in \kern 2.6\p@}
\newrobustcmd*\mdf@footnoteoutput{%
     \ifvoid\@mpfootins\else%
          \nobreak%
          \vskip\mdf@footenotedistance@length%
          \normalcolor%
          \mdf@footnoterule%
          \unvbox\@mpfootins%
     \fi%
}
\newrobustcmd*\mdf@footnoteinput{%
   \def\@mpfn{mpfootnote}%
   \def\thempfn{\thempfootnote}%
   \c@mpfootnote\z@%
   \let\@footnotetext\@mpfootnotetext%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@load@style}
% Load the method to draw the frame and set style definition.
%    \begin{macrocode}
\newrobustcmd*\mdf@load@style{%
\ifcase\value{mdf@globalstyle@cnt}\relax%
    \input{md-frame-0.mdf}%
 \or\input{md-frame-1.mdf}%
 \or\input{md-frame-2.mdf}%
 \or\input{md-frame-3.mdf}%
 \else%
    \IfFileExists{md-frame-\value{mdf@globalstyle@cnt}.mdf}%
    {\input{md-frame-\value{mdf@globalstyle@cnt}.mdf}}%
    {%
     \input{md-frame-0.mdf}%
     \mdf@PackageWarning{The style number \value{mdf@globalstyle@cnt}
                         does not exist^^J
                         mdframed ues instead style=0 \mdframedpackagename}%
    }%
\fi%
}%
\mdf@load@style
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@styledefinition}
% The default frame method needs special handling.
%    \begin{macrocode}
\newrobustcmd*\mdf@styledefinition{%AVOID!!!Needed for framemethod=default
    \ifnumequal{\value{mdf@globalstyle@cnt}}{0}%
    {\deflength{\mdf@innerlinewidth@length}{\z@}%
     \deflength{\mdf@middlelinewidth@length}{\mdf@linewidth@length}%
     \deflength{\mdf@outerlinewidth@length}{\z@}%
     \let\mdf@innerlinecolor\mdf@linecolor%
     \let\mdf@middlelinecolor\mdf@linecolor%
     \let\mdf@outerlinecolor\mdf@linecolor%
    }{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{detected@mdf@put@frame}
% Detect whether inside a non breakable environment.
%    \begin{macrocode}
\let\mdf@reserved@a\@empty
\newrobustcmd*\detected@mdf@put@frame{%
  \ifmdf@nobreak%Option nobreak=true?
     \def\mdf@reserved@a{\mdf@put@frame@standalone}%
  \else
     \def\mdf@reserved@a{\mdf@put@frame}%
     \ifx\@captype\@undefined
         \def\mdf@reserved@a{\mdf@put@frame}%
     \else
         \mdf@PackageInfo{mdframed inside float  ^^J
                          mdframed uses option nobreak \mdframedpackagename}%
         \def\mdf@reserved@a{\mdf@put@frame@standalone}% 
     \fi
     \if@minipage%
           \mdf@PackageInfo{mdframed inside minipage  ^^J
                           mdframed uses option nobreak \mdframedpackagename}%
           \def\mdf@reserved@a{\mdf@put@frame@standalone}%
     \fi%
     \ifinner%
          \mdf@PackageInfo{mdframed inside a box ^^J
                          mdframed uses option nobreak \mdframedpackagename}%
          \def\mdf@reserved@a{\mdf@put@frame@standalone}%
     \fi%
  \fi%
\mdf@reserved@a%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdframed}
% The user environement.
%    \begin{macrocode}
\newenvironment{mdframed}[1][]{%
%    \end{macrocode}
% Make everything local
%    \begin{macrocode}
\color@begingroup%
%    \end{macrocode}
% Set all options
%    \begin{macrocode}
   \mdfsetup{userdefinedwidth=\linewidth,#1}%
   \mdf@twoside@checklength%
   \let\width\z@%
   \let\height\z@%
   \mdf@checkntheorem%
   \mdf@styledefinition%
   \mdf@footnoteinput%
   \color{\mdf@fontcolor}%
   \mdf@font%
   \ifvmode\nointerlineskip\fi%
   \mdf@trivlist{\mdf@skipabove@length}%%
   \ifdefempty{\mdf@frametitle}{}{\mdf@@frametitle}%
%    \end{macrocode}
% Special command to allow extra user definitions by the option \Opt{settings}.
%    \begin{macrocode}
   \mdf@settings%
%    \end{macrocode}
% Start save box and save the whole contens in the box \Cmd{mdf@splitbox@one}
%    \begin{macrocode}
   \mdf@lrbox{\mdf@splitbox@one}%
  }%
  {%
%    \end{macrocode}
% Trying to ignore last descenders of the environment.
%    \begin{macrocode}
   \ifbool{mdf@ignorelastdescenders}%
     {%
      \par\strut\par
      \unskip\unskip\setbox0=\lastbox
      \vspace*{\dimexpr\ht\strutbox-\baselineskip\relax}%
     }{}%
    \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%%
%    \end{macrocode}
% End save box in relation to footnotes
%    \begin{macrocode}
    \ifmdf@footnoteinside%
      \def\mdf@reserveda{%
        \mdf@footnoteoutput%
        \endmdf@lrbox%
        \ifdefempty{\mdf@frametitle}{}{\mdf@@frametitle@use}%
        \detected@mdf@put@frame}%
    \else%
      \def\mdf@reserveda{%
        \endmdf@lrbox%
        \ifdefempty{\mdf@frametitle}{}{\mdf@@frametitle@use}%
        \detected@mdf@put@frame%
        \mdf@footnoteoutput%
        }%
    \fi%
    \mdf@reserveda%
    \endmdf@trivlist%
%    \end{macrocode}
% End group and set the command \Cmd{@doendpe} to behave like 
% \Cmd{end\{center\}}
%    \begin{macrocode}
\color@endgroup\@doendpe%
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@twoside@checklength,mdf@zref@label,if@mdf@pageodd,
%               mdf@pageisodd,mdf@pageiseven,mdf@@setzref}
% The whole bunch is used to work width twoside mode and uses the correct
% margins.
%    \begin{macrocode}
\newtoggle{md:checktwoside}
\settoggle{md:checktwoside}{false}
\newrobustcmd*\mdf@twoside@checklength{%
 \if@twoside
   \ifbool{mdf@usetwoside}%
      {\mdf@PackageInfo{mdframed works in twoside mode}%
       \settoggle{md:checktwoside}{true}%
       \setlength\mdf@rightmargin@length{\mdf@outermargin@length}%
       \setlength\mdf@leftmargin@length{\mdf@innermargin@length}%
      }%
      {\mdf@PackageInfo{mdframed inside twoside mode but\MessageBreak
                       works with oneside mode}%
       \settoggle{md:checktwoside}{false}%
      }%
 \fi%
}

\newcounter{mdf@zref@counter}%keine doppelten laebes
\zref@newprop*{mdf@pagevalue}[0]{\number\value{page}}
\zref@addprop{\ZREF@mainlist}{mdf@pagevalue}
\newrobustcmd*\mdf@zref@label{%
   \stepcounter{mdf@zref@counter}
   \zref@label{mdf@pagelabel-\number\value{mdf@zref@counter}}%
}
\newrobustcmd*\if@mdf@pageodd{%
 \zref@refused{mdf@pagelabel-\the\value{mdf@zref@counter}}%
 \ifodd\zref@extract{mdf@pagelabel-\the\value{mdf@zref@counter}}%
                    {mdf@pagevalue}%
    \setlength\mdf@rightmargin@length{\mdf@outermargin@length}%
    \setlength\mdf@leftmargin@length{\mdf@innermargin@length}%
 \else
    \setlength\mdf@rightmargin@length{\mdf@innermargin@length}%
    \setlength\mdf@leftmargin@length{\mdf@outermargin@length}%
 \fi%
}
\newrobustcmd*\mdf@@setzref{%
 \iftoggle{md:checktwoside}{\mdf@zref@label\if@mdf@pageodd}{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@freepagevspace}
%    \begin{macrocode}
\newrobustcmd*\mdf@freepagevspace{%
%    \end{macrocode}
%  The following lines are added by an inspiration of the great package
%  \Pack{multicol}.
%    \begin{macrocode}
     \bgroup\@nobreakfalse\addpenalty\z@\egroup%added 29.5.12
%    \end{macrocode}
%    \begin{macrocode}
     \penalty\@M\relax\vskip 2\baselineskip\relax%
     \penalty9999\relax\vskip -2\baselineskip\relax%
     \penalty9999%
     \ifdimequal{\pagegoal}{\maxdimen}%
          {\mdf@freevspace@length\vsize}%
          {\mdf@freevspace@length=\pagegoal\relax%
           \advance\mdf@freevspace@length by -\pagetotal\relax%
           \addtolength\mdf@freevspace@length{\dimexpr-\parskip\relax}\relax%
          }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@advancelength@horizontalmargin@add,
%               mdf@horizontalspaceofbox,mdf@horizontalmargin@equation}
% Command used for loop
%    \begin{macrocode}
\newrobustcmd*\mdf@advancelength@horizontalmargin@sub[1]{%
  \advance\mdf@horizontalspaceofbox by -\csname mdf@#1@length\endcsname\relax%
}
%    \end{macrocode}
% Compute the width of the box
%    \begin{macrocode}
\newlength\mdf@horizontalspaceofbox
\newrobustcmd*\mdf@horizontalmargin@equation{%
    \setlength{\mdf@horizontalspaceofbox}{\mdf@userdefinedwidth@length}%
    \mdf@dolist{\mdf@advancelength@horizontalmargin@sub}{%
             leftmargin,outerlinewidth,middlelinewidth,%
             innerlinewidth,innerleftmargin,innerrightmargin,%
             innerlinewidth,middlelinewidth,outerlinewidth,%
             rightmargin}%
    \notbool{mdf@leftline}%
       {%
        \advance\mdf@horizontalspaceofbox by \mdf@innerlinewidth@length\relax%
        \advance\mdf@horizontalspaceofbox by \mdf@middlelinewidth@length\relax%
        \advance\mdf@horizontalspaceofbox by \mdf@outerlinewidth@length\relax%
       }{}%      
    \notbool{mdf@rightline}%
       {%
        \advance\mdf@horizontalspaceofbox by \mdf@innerlinewidth@length\relax%
        \advance\mdf@horizontalspaceofbox by \mdf@middlelinewidth@length\relax%
        \advance\mdf@horizontalspaceofbox by \mdf@outerlinewidth@length\relax% 
       }{}%
    \ifdimless{\mdf@horizontalspaceofbox}{3cm}%
      {\mdf@PackageWarning{You have only a width of 3cm}}{}%
    \hsize=\mdf@horizontalspaceofbox%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@keeplines@single}
% Space in relation of horizontal lines.
%    \begin{macrocode}
\newrobustcmd*\mdf@keeplines@single{%
  \notbool{mdf@topline}%
     {%
      \advance\mdf@verticalmarginwhole@length %
               by -\mdf@innerlinewidth@length\relax%
      \advance\mdf@verticalmarginwhole@length %
               by -\mdf@middlelinewidth@length\relax%
      \advance\mdf@verticalmarginwhole@length %
               by -\mdf@outerlinewidth@length\relax%
     }{}%
  \notbool{mdf@bottomline}%
     {%
      \advance\mdf@verticalmarginwhole@length %
               by -\mdf@innerlinewidth@length\relax%
      \advance\mdf@verticalmarginwhole@length %
               by -\mdf@middlelinewidth@length\relax%
      \advance\mdf@verticalmarginwhole@length %
               by -\mdf@outerlinewidth@length\relax%
     }{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@advancelength@verticalmarginwhole,
%               mdf@advancelength@freevspace@sub,
%               mdf@advancelength@freevspace@add}
% Loop macros to calculate the height. Used by |\mdf@dolist|.
%    \begin{macrocode}
\newrobustcmd*\mdf@advancelength@verticalmarginwhole[1]{%
  \advance\mdf@verticalmarginwhole@length %
           by \csname mdf@#1@length\endcsname\relax%
}
\newrobustcmd*\mdf@advancelength@freevspace@sub[1]{%
  \advance\dimen@ by -\csname mdf@#1@length\endcsname\relax%
}
\newrobustcmd*\mdf@advancelength@freevspace@add[1]{%
  \advance\dimen@ by \csname mdf@#1@length\endcsname\relax%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@reset}
% Reset changes
%    \begin{macrocode}
\protected@edef\mdf@reset{\boxmaxdepth\the\boxmaxdepth 
                          \splittopskip\the\splittopskip}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@put@frame@standalone}
% Output of |mdframed| inside a non breakable environement.
%    \begin{macrocode}
\newrobustcmd*\mdf@put@frame@standalone{\relax%
   \ifvoid\mdf@splitbox@one\relax
      \mdf@PackageWarning{The environment is empty\MessageBreak}%
      \let\mdf@reserved@a\relax%
   \else
      %Hier berechnung Box-Inhalt+Rahmen oben und unten
      \setlength{\mdf@verticalmarginwhole@length}%
                 {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
      \mdf@dolist{\mdf@advancelength@verticalmarginwhole}{%
                  outerlinewidth,middlelinewidth,innerlinewidth,%
                  innertopmargin,innerbottommargin,innerlinewidth,%
                  middlelinewidth,outerlinewidth}%
      \mdf@keeplines@single%
      \def\mdf@reserved@a{\mdf@putbox@single}%
   \fi
   \mdf@reserved@a%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@put@frame}
% Output of |mdframed| inside a breakable environement.
% The comparison are only check whether the contents must be split or not.
%    \begin{macrocode}
\def\mdf@put@frame{\relax%
\ifvoid\mdf@splitbox@one\relax
  \mdf@PackageWarning{The environment is empty\MessageBreak}%
  \let\mdf@reserved@a\relax%
\else
  \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
  \mdf@print@space%
  \mdf@freepagevspace%gives \mdf@freevspace@length
  \mdf@PackageInfoSpace{\the\mdf@freevspace@length before the 
                        beginning of \MessageBreak
                        the environment ending on input line \MessageBreak}%
  \ifdimless{\mdf@freevspace@length}{2\baselineskip}
    {%
     \mdf@PackageInfo{Not enough space on this page}
     \vfill\eject%
     \def\mdf@reserved@a{\mdf@put@frame}%
    }{%
      %Hier berechnung Box-Inhalt+Rahmen oben und unten
      \setlength{\mdf@verticalmarginwhole@length}%
                {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
      \mdf@dolist{\mdf@advancelength@verticalmarginwhole}%
                 {%
                  outerlinewidth,middlelinewidth,innerlinewidth,%
                  innertopmargin,innerbottommargin,%
                  innerlinewidth,middlelinewidth,outerlinewidth}%
      \mdf@keeplines@single%
      \ifdimless{\mdf@verticalmarginwhole@length}{\mdf@freevspace@length}%
         {%passt auf Seite%
          \begingroup\mdf@@setzref\mdf@putbox@single\endgroup%Output no break
          \let\mdf@reserved@a\relax%
         }%
         {%
          \def\mdf@reserved@a{\mdf@put@frame@i}%passt nicht auf Seite
         }
    }%
\fi
\mdf@reserved@a%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@put@frame@i}
% Output of the first splitted box.
%    \begin{macrocode}
\def\mdf@put@frame@i{%Box must be splitted
%    \end{macrocode}
% Compute the vertical free space of the current page
%    \begin{macrocode}
 \mdf@freepagevspace%gives \mdf@freevspace@length
%    \end{macrocode}
% Compute whether the width of the lines plus 2 \Cmd{baselineskips} can
% only be set on the current page.
%    \begin{macrocode}
 \dimen@=\the\mdf@freevspace@length\relax%
 \dimen@i=\mdf@innertopmargin@length\relax%
 \advance\dimen@i by \mdf@innerlinewidth@length\relax%
 \advance\dimen@i by \mdf@middlelinewidth@length\relax%
 \advance\dimen@i by \mdf@outerlinewidth@length\relax%
 \advance\dimen@i by 2\baselineskip\relax%
 \ifdimless{\dimen@}{\dimen@i}%
%    \end{macrocode}
% force a page / column break and restart printing of the environment
%    \begin{macrocode}
   {\hrule \@height\z@ \@width\hsize%
    \vfill\eject%
    \def\mdf@reserved@a{\mdf@put@frame}%
   }%
%    \end{macrocode}
% The page has enough space.
%    \begin{macrocode}
   {%
%    \end{macrocode}
% compute the needed vertical space of the first frame. Subtract the dimension
% of the bottom frame
%    \begin{macrocode}
    \mdf@dolist{\mdf@advancelength@freevspace@sub}{%calculate with \dimen@
              outerlinewidth,middlelinewidth,innerlinewidth,%
              innertopmargin,splitbottomskip}%
%    \end{macrocode}
% Reduce vertical space if option \Opt{everyline} is set to \Opt{true}
%    \begin{macrocode}
    \ifbool{mdf@everyline}%
      {%
       \ifbool{mdf@bottomline}%
          {%
           \advance\dimen@ by -\mdf@innerlinewidth@length%
           \advance\dimen@ by -\mdf@middlelinewidth@length%
           \advance\dimen@ by -\mdf@outerlinewidth@length%
          }{}%
      }{}%
%    \end{macrocode}
% Add vertical space if option \Opt{topline} is set to \Opt{false} 
%    \begin{macrocode}
    \notbool{mdf@topline}%
       {%
        \advance\dimen@ by \mdf@innerlinewidth@length%
        \advance\dimen@ by \mdf@middlelinewidth@length%
        \advance\dimen@ by \mdf@outerlinewidth@length%
       }{}%
%    \end{macrocode}
% Add a length of 0.8\Cmd{pageshrink}. I don't know whether it's needed! 
%    \begin{macrocode}
    \advance\dimen@.8\pageshrink
%    \end{macrocode}
% Test whether the contents has enough space and the last frame will be empty
%    \begin{macrocode}
    \ifdimless{\ht\mdf@splitbox@one+\dp\mdf@splitbox@one}{\dimen@}%
       {\mdf@PackageWarning{You got a bad break\MessageBreak
                            because the last box will be empty\MessageBreak
                           you have to change it manually\MessageBreak
                           by changing the text, the space\MessageBreak
                           or something else}%
        \advance\dimen@ by -1.8\baselineskip\relax%needed????????????????????
       }{}%
%    \end{macrocode}
% \begin{itemize}
%   \item save the orginal contents in a new save box,
%   \item set the dimension for splitting
%   \item ignore bad boxes and split
% \end{itemize}
%    \begin{macrocode}
    \setbox\mdf@splitbox@save=\vbox{\unvcopy\mdf@splitbox@one}%
    \splitmaxdepth\z@ \splittopskip\mdf@splittopskip@length%
    \mdf@ignorevbadness%
    \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \dimen@
    \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}%
    \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}%
%    \end{macrocode}
% Test whether the splitted box fits the required dimension
%    \begin{macrocode}
    \ifdimgreater{\ht\mdf@splitbox@two+\dp\mdf@splitbox@two}{\dimen@}%
      {%splitted wrong
       \mdf@PackageInfo{Box was splittet wrong^^M starting loop to iterate 
                        the splitting point\MessageBreak}%
%    \end{macrocode}
% restore save box \Cmd{mdf@splitbox@one} by the save one
% \Cmd{mdf@splitbox@save}
%    \begin{macrocode}
       \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}%
%    \end{macrocode}
% Start loop until splitting fits -- break after 100 attempts 
%    \begin{macrocode}
       \dimen@i=\dimen@%\relax
       \@tempcnta=\z@\relax
       \loop
        \ifdim\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax>\dimen@ 
          \advance\dimen@i by -\p@\relax     
          \advance\@tempcnta by \@ne\relax
          \ifnum\@tempcnta>100
            \let\iterate\relax
            \mdf@PackageWarning{correct box splittet fails^^M
                                It seems you are using a non splittable
                                contents\MessageBreak}
          \fi
%          \immediate\typeout{***mdframed \string\@tempcnta=\the\@tempcnta***}
%          \immediate \typeout{***mdframed \string\dimen@i=\the\dimen@i***}
          \mdf@ignorevbadness%          
          \setbox\mdf@splitbox@one=\vbox{\break\unvcopy\mdf@splitbox@save}%
          \splitmaxdepth\z@ \splittopskip\mdf@splittopskip@length%
          \mdf@ignorevbadness%
          \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \dimen@i\relax%
          \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}%
          \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}%
       \repeat%
      }{}%
%    \end{macrocode}
% Test if the last frame is empty
%    \begin{macrocode}
    \ifvoid\mdf@splitbox@one\relax%
      \mdf@PackageWarning{You got a bad break because the splittet box 
                          is empty^^M
                          You have to change the page settings^^M
                          like enlargethispage or something else^^M
                          the package increases do 
                          \enlargethispage{\baselineskip}\MessageBreak}%
      \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}
      \enlargethispage{\baselineskip}%
      \def\mdf@reserved@a{\mdf@put@frame}%
    \fi%
%    \end{macrocode}
% Test if first splitted frame doesn't have the original with.
%    \begin{macrocode}
    \ifdim\wd\mdf@splitbox@two=\wd\mdf@splitbox@one\relax
    \else%
      \mdf@PackageInfo{You first box width is to small^^M
                       mdframed fixed it\MessageBreak}%
      \setbox\mdf@splitbox@two=\vbox%
                   {%
                    \hrule \@height\z@ \@width\wd\mdf@splitbox@one\relax
                    \unvcopy\mdf@splitbox@two%
                   }%
    \fi%
%    \end{macrocode}
% Test if the first frame is empty
%    \begin{macrocode}
    \ifvoid\mdf@splitbox@two\relax%
        {\hrule \@height\f@size pt \@width\z@%
         \hrule \@height\z@ \@width\hsize}%
         \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}%
         \def\mdf@reserved@a{\mdf@put@frame}%
     \else%
        \ifdimequal{\ht\mdf@splitbox@two}{0pt}%
          {\hrule \@height\z@ \@width\hsize%
           \vfill\eject%
           \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}%
           \def\mdf@reserved@a{\mdf@put@frame}%
          }%
          {%
%    \end{macrocode}
% Output of the first frame
%    \begin{macrocode}
          \begingroup\mdf@@setzref\mdf@putbox@first\endgroup%
          \hrule \@height\z@ \@width\hsize%
          \vfill\eject%
          \def\mdf@reserved@a{\mdf@put@frame@ii}%
%    \end{macrocode}
% 
%    \begin{macrocode}
          }%
     \fi%
   }%
\mdf@reserved@a%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@put@frame@ii}
% Output of the middle and last box.
%    \begin{macrocode}
\def\mdf@put@frame@ii{%
%    \end{macrocode}
% After splitting the vertical free space is \Cmd{vsize} so you can set it
% directly.
%    \begin{macrocode}
  \setlength{\mdf@freevspace@length}{\vsize}%
%    \end{macrocode}
% \textcolor{red}{\bfseries repeating frame title must be improved}
%    \begin{macrocode}
    \ifbool{mdf@repeatframetitle}%
      {%
%    \end{macrocode}
% Remember that the first title was printed
%    \begin{macrocode}
       \toggletrue{mdf@notfirstframetitle}%
%    \end{macrocode}
% remove the vertical skip added by option \Opt{splittopskip} to connect the
% boxes
%    \begin{macrocode}
       \splitmaxdepth\z@ \splittopskip\z@%
       \setbox\mdf@splitbox@one=\vbox{\break\unvbox\mdf@splitbox@one}%
       \mdf@ignorevbadness%
       \setbox0=\vsplit\mdf@splitbox@one to \z@\relax%
       \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one}
%    \end{macrocode}
% combine frame title with the contents of mdframed
%    \begin{macrocode}
       \setbox\mdf@splitbox@one\vbox%
          {%
           \vbox to \mdf@frametitleaboveskip@length{}
           \unvcopy\mdf@frametitlebox\relax%
           \mdf@@frametitlerule\relax%
           \unvbox\mdf@splitbox@one\relax%
          }%
       \setbox\mdf@splitbox@one=\vbox{\unvbox\mdf@splitbox@one}%
      }{}%
%    \end{macrocode}
% \Cmd{dimen@} is equal to the natural height of the rest
%    \begin{macrocode}
  \setlength{\dimen@}{\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
%    \end{macrocode}
% Assume no middle box -- add bottom length to the natural height of the 
% contents
%    \begin{macrocode}
  \mdf@dolist{\mdf@advancelength@freevspace@add}%
        {%used \dimen@
         innerbottommargin,innerlinewidth,middlelinewidth,outerlinewidth,%
        }%
%    \end{macrocode}
% add top length of lines if \Opt{everyline} is set to \Opt{true}
%    \begin{macrocode}
  \ifbool{mdf@everyline}%
    {%
     \ifbool{mdf@topline}%
      {%
       \advance\dimen@ by \mdf@innerlinewidth@length\relax%
       \advance\dimen@ by \mdf@middlelinewidth@length\relax%
       \advance\dimen@ by \mdf@outerlinewidth@length\relax%
      }{}%
    }{}%
%    \end{macrocode}
% remove length of bottom if \Opt{bottomline} is set to \Opt{false}
%    \begin{macrocode}
   \notbool{mdf@bottomline}%
     {%
      \advance\dimen@ by -\mdf@innerlinewidth@length\relax%
      \advance\dimen@ by -\mdf@middlelinewidth@length\relax%
      \advance\dimen@ by -\mdf@outerlinewidth@length\relax%
      \relax%
     }{}%
%    \end{macrocode}
% Test whether the complete height of the frame fits on the current page
%    \begin{macrocode}
   \ifdimgreater{\dimen@}{\mdf@freevspace@length}%
    {%have a middle box
%    \end{macrocode}
% Use \Cmd{mdf@freevspace@length} to compute the splitting dimension. The 
% conditionals \Opt{everyline}, \Opt{topline} and \Opt{bottomline} work
% like the test above.
%    \begin{macrocode}
     \advance\mdf@freevspace@length by -\mdf@splitbottomskip@length\relax%
     \ifbool{mdf@everyline}%
       {%
        \ifbool{mdf@topline}%
          {%
          \advance\mdf@freevspace@length by -\mdf@innerlinewidth@length\relax%
          \advance\mdf@freevspace@length by -\mdf@middlelinewidth@length\relax%
          \advance\mdf@freevspace@length by -\mdf@outerlinewidth@length\relax%
          }{}%
        \ifbool{mdf@bottomline}%
          {%
          \advance\mdf@freevspace@length by -\mdf@innerlinewidth@length\relax%
          \advance\mdf@freevspace@length by -\mdf@middlelinewidth@length\relax%
          \advance\mdf@freevspace@length by -\mdf@outerlinewidth@length\relax%
          \relax
          }{}%
       }{}%
%    \end{macrocode}
% \begin{itemize}
%   \item save the orginal contents in a new save box,
%   \item set the dimension for splitting
%   \item ignore bad boxes and split
% \end{itemize}
%    \begin{macrocode}
     \setbox\mdf@splitbox@save=\vbox{\unvcopy\mdf@splitbox@one}%
     \splitmaxdepth\z@ \splittopskip\mdf@splittopskip@length%
     \mdf@ignorevbadness%
     \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \mdf@freevspace@length
     \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}
     \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}
%    \end{macrocode}
% Test whether the splitted box fits the required dimension
%    \begin{macrocode}
     \ifdimgreater{\ht\mdf@splitbox@two+\dp\mdf@splitbox@two}{\dimen@}%
       {%splitted wrong
        \mdf@PackageInfo{Box was splittet wrong^^M starting loop to iterate 
                         the splitting point\MessageBreak}%
%    \end{macrocode}
% Start loop until splitting fits -- break after 100 attempts 
%    \begin{macrocode}
        \dimen@i=\mdf@freevspace@length%\relax
        \@tempcnta=\z@\relax
        \loop
        \ifdim\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax>%
              \mdf@freevspace@length\relax        
          \advance\dimen@i by -\p@\relax%     
          \advance\@tempcnta by \@ne\relax%
%          \immediate\typeout{***mdframed \string\@tempcnta=\the\@tempcnta***}
%          \immediate \typeout{***mdframed \string\dimen@i=\the\dimen@i***}
          \ifnum\@tempcnta>100
            \let\iterate\relax%
            \mdf@PackageWarning{correct box splittet fails^^M
                                It seems you are using a non splittable
                                contents\MessageBreak}%
          \fi
          \setbox\mdf@splitbox@one=\vbox{\break\unvcopy\mdf@splitbox@save}%
          \splitmaxdepth\z@ \splittopskip\mdf@splittopskip@length%
          \mdf@ignorevbadness%
          \setbox\mdf@splitbox@two\vsplit\mdf@splitbox@one to \dimen@i\relax%
          \setbox\mdf@splitbox@two\vbox{\unvbox\mdf@splitbox@two}%
          \setbox\mdf@splitbox@one\vbox{\unvbox\mdf@splitbox@one}%
        \repeat%
       }{}%
%    \end{macrocode}
% Test whether last frame is empty
%    \begin{macrocode}
     \ifvoid\mdf@splitbox@one\relax%
        \mdf@PackageWarning{You got a bad break because the splittet box is 
                            empty^^M
                            You have to change the page settings^^M
                            like enlargethispage or something else^^M
                            the package increases do 
                            \enlargethispage{\baselineskip}\MessageBreak}%
        \setbox\mdf@splitbox@one=\vbox{\unvcopy\mdf@splitbox@save}%
        \enlargethispage{\baselineskip}%
        \def\mdf@reserved@a{\mdf@put@frame@ii}%
%    \end{macrocode}
% Output of the middle frame
%    \begin{macrocode}
     \else
        \begingroup\mdf@@setzref\mdf@putbox@middle\endgroup%
          \hrule \@height\z@ \@width\hsize%
          \vfill\eject%
          \def\mdf@reserved@a{\mdf@put@frame@ii}%
        \fi
     }%End middle box case
%    \end{macrocode}
% Starting output of last frame
%    \begin{macrocode}
     {%start last box case
      \ifvoid\mdf@splitbox@one
           \mdf@PackageWarning{You got a bad break\MessageBreak
                               because the last split box is empty\MessageBreak
                               You have to change the settings}%%
           \setbox\mdf@splitbox@one=\vbox%
                  {%
                   \unvbox\mdf@splitbox@one%
                   \hrule \@height\z@ \@width\mdfboundingboxwidth
                  }%
      \fi%
%    \end{macrocode}
% \Cmd{ifvoid} isn't enough -- need to test the height
%    \begin{macrocode}
      \ifdimless{\ht\mdf@splitbox@one}{1sp}%
         {%
          \mdf@PackageWarning{You got a bad break\MessageBreak
                              because the last split box is empty\MessageBreak
                              You have to change the settings}%

          \let\mdf@reserved@a\relax%
          \setbox\mdf@splitbox@one=\vbox%
                 {%
                  \unvbox\mdf@splitbox@one%
                  \hrule \@height\z@ \@width\mdfboundingboxwidth
                 }%
         }{}%
%    \end{macrocode}
% Output of the last frame
%    \begin{macrocode}
      \begingroup\mdf@@setzref\mdf@putbox@second\endgroup%
      \hrule \@height\z@ \@width\hsize%
      \let\mdf@reserved@a\relax%
     }%
  \mdf@reserved@a%
}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@test@ltrb,mdf@test@ltr,mdf@test@ltb,mdf@test@trb,^^A
%               mdf@test@lrb,mdf@test@lb,mdf@test@rb,^^A
%               mdf@test@tr,mdf@test@lt,mdf@test@lr,mdf@test@tb,mdf@test@l,^^A
%               mdf@test@r,mdf@test@t,mdf@test@b,mdf@test@noline}
% Short forms of checking the option which lines should be drawn.
%    \begin{macrocode}
%%%%    _____t_____
%%%%   |           |
%%%%   |           |
%%%%   |           |
%%%%  l|           |r
%%%%   |           |
%%%%   |           |
%%%%   |___________|
%%%%         b
%%Zusammenhaenge abfragen:
\newrobustcmd*\mdf@test@ltrb{%
    \ifboolexpr{ (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and (bool {mdf@rightline})}}
%3-set
\newrobustcmd*\mdf@test@ltr{%
    \ifboolexpr{ (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@ltb{%
    \ifboolexpr{ (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@trb{%
    \ifboolexpr{ (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@lrb{%
    \ifboolexpr{ not (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and (bool {mdf@rightline})}}
%2-set
\newrobustcmd*\mdf@test@lb{%
    \ifboolexpr{ not (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@rb{%
    \ifboolexpr{ not (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@tr{%
    \ifboolexpr{ (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@lt{%
    \ifboolexpr{ (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@lr{%
    \ifboolexpr{ not (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@tb{%
    \ifboolexpr{ (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
%Einzellinien
\newrobustcmd*\mdf@test@l{%
    \ifboolexpr{ not (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@r{%
    \ifboolexpr{ not (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@t{%
    \ifboolexpr{ (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@b{%
    \ifboolexpr{ not (bool {mdf@topline}) and (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
%keine Linien
\newrobustcmd*\mdf@test@noline{%
    \ifboolexpr{ not (bool {mdf@topline}) and not (bool {mdf@bottomline})
                 and not (bool {mdf@leftline}) and not (bool {mdf@rightline})}}
\newrobustcmd*\mdf@test@single{%
    \ifboolexpr{ not (test {\mdf@test@ltrb} or test {\mdf@test@ltr} or 
                 test {\mdf@test@ltb} or test {\mdf@test@trb} or 
                 test {\mdf@test@lrb}  or test {\mdf@test@lb} or 
                 test {\mdf@test@rb} or test {\mdf@test@tr} or
                 test {\mdf@test@lt} ) }}
%
%    \end{macrocode}
% \end{macro}
%
%
%
%    \begin{macrocode}
\DisableKeyvalOption[action=warning,package=mdframed]{mdf}{framemethod}%
\DisableKeyvalOption[action=warning,package=mdframed]{mdf}{xcolor}%

 \endinput
%    \end{macrocode}
%
%\iffalse
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%\fi
%
%\iffalse
%    \begin{macrocode}
%<*mdframedefault>
%    \end{macrocode}
%\fi
% \subsection{The Explanation of md-frame-0.mdf}
%    \begin{macrocode}
%% Style file for mdframed for package option `framemethod=default`
%% 
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%%
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
%
%    \end{macrocode}
%
% \begin{macro}{mdframedOpackagename,mdf@frameOdate@svn}
% local settings
%    \begin{macrocode}
\def\mdframedOpackagename{md-frame-0}
\def\mdf@frameOdate@svn$#1: #2 #3 #4-#5-#6 #7 #8${#4/#5/#6\space }
\ProvidesFile{md-frame-0.mdf}%
    [\mdf@frameOdate@svn$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $%
     \mdversion: \mdframedOpackagename]
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@background@default,mdf@linecolor@default,^^A
%               mdf@linecolor@bottom}
% short command
%    \begin{macrocode}
\def\mdf@background@default{\color{\mdf@backgroundcolor}}
\def\mdf@frametitlebackground@default{\color{\mdf@frametitlebackgroundcolor}}
\def\mdf@shadow@default{\color{\mdf@shadowcolor}}
\def\mdf@innerlinecolor@default{\color{\mdf@innerlinecolor}}
\def\mdf@middlelinecolor@default{\color{\mdf@middlelinecolor}}
\def\mdf@outerlinecolor@default{\color{\mdf@outerlinecolor}}
\def\mdf@frametitlerulecolor@default{\color{\mdf@frametitlerulecolor}}
\let\mdf@linecolor@default\mdf@middlelinecolor@default
\def\mdf@@frametitlerule{%
  \ifbool{mdf@frametitlerule}{%
   \vbox{\hsize\mdfframetitleboxwidth%
     \par\unskip\vskip\mdf@frametitlebelowskip@length%
     \rlap{\noindent\hspace*{-\mdf@innerleftmargin@length}%
     \mdf@frametitlerulecolor@default%
     \rule{\dimexpr\mdfframetitleboxwidth%
           +\mdf@innerleftmargin@length
           +\mdf@innerrightmargin@length\relax
          }{\mdf@frametitlerulewidth@length}%
       }\hrule \@height\z@ \@width\hsize}%
  }{%
   \vbox{\hsize\mdfframetitleboxwidth%
     \par\unskip\vskip\mdf@frametitlebelowskip@length%
     \rlap{\noindent\hspace*{-\mdf@innerleftmargin@length}%
     \mdf@frametitlerulecolor@default%
     \rule{\dimexpr\mdfframetitleboxwidth%
           +\mdf@innerleftmargin@length
           +\mdf@innerrightmargin@length\relax
          }{\z@}%
       }\hrule \@height\z@ \@width\hsize}%
    }%
  \iftoggle{mdf@notfirstframetitle}%
    {%
      \par\unskip\vskip\mdf@splittopskip@length%
    }%
    {%
      \par\unskip\vskip\mdf@innertopmargin@length%
    }%
}%
  
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{mdfsubtitle}
% Definition of the command \Cmd{mdfsubtitle}. 
%    \begin{macrocode}
\newrobustcmd\mdfsubtitle[2][]%
{%
%    \end{macrocode}
% Make everything local.
%    \begin{macrocode}
 \begingroup
  \penalty-9995%set a breakpoint before the subtitle
%     \end{macrocode}
% Inside the title we don't need any \Cmd{parindent}. Next set the options of
% the optional argument of \Cmd{mdfsubtitle}.
%     \begin{macrocode}
  \parindent\z@\relax%
  \mdfsetup{#1}%only for subtitle options
%      \end{macrocode}
% Save the complete subtitle inside the save box \Cmd{z@}.
%      \begin{marcocode}
  \setbox\z@=\vbox{\mdf@subtitlefont{#2}\relax}%
%      \end{macrocode}
% Compute the width of the current line including the inner left margin and
% inner right margin (using \Cmd{dimen@}. In the nest step the height and the
% depth of the save box will be saved in \Cmd{dimen@i}.
%      \begin{marcocode}
  \dimen@=\linewidth\relax%
   \advance\dimen@ by \mdf@innerleftmargin@length\relax%
   \advance\dimen@ by \mdf@innerrightmargin@length\relax%
  \dimen@i=\mdf@subtitleinneraboveskip@length\relax%
   \advance\dimen@i by \mdf@subtitleinnerbelowskip@length\relax
   \advance\dimen@i by \ht\z@\relax%
   \advance\dimen@i by \dp\z@\relax%
%      \end{macrocode}
% Test if rules should be drawn. otherwise set the line width to 0\,pt.
%      \begin{macrocode}
  \ifbool{mdf@subtitleaboveline}{}%
         {\mdfsetup{subtitleabovelinewidth=\z@}}%
  \ifbool{mdf@subtitlebelowline}{}%
         {\mdfsetup{subtitlebelowlinewidth=\z@}}%
%      \end{macrocode}
% Start a new line with the given skip \Opt{subtitleaboveskip}.
%      \begin{macrocode}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleaboveskip@length
%      \end{macrocode}
% Drawing the above line of the subtitle.
%      \begin{macrocode}
  \rlap%
  {%
    \hspace*{-\mdf@innerleftmargin@length}%
    \begingroup%
      \color{\mdf@subtitleabovelinecolor}%
      \rule{\dimen@}{\mdf@subtitleabovelinewidth@length}%
    \endgroup%
  }%
%      \end{macrocode}
% space between rule above and subtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleinneraboveskip@length
%      \end{macrocode}
% output of subtitle with a backround. Must think about the \Cmd{hspace}
% combination.
%      \begin{macrocde}
  \leavevmode\rlap%
  {%
   \smash{%
     \hspace*{-\mdf@innerleftmargin@length}%
     \begingroup%
       \color{\mdf@subtitlebackgroundcolor}%
       \rule[\dimexpr-\dp\z@-\mdf@subtitleinnerbelowskip@length\relax]
            {\dimen@}{\dimen@i}%
     \endgroup%
    }%
  }%
  \box\z@\relax%
%      \end{macrocode}
% Skip after subtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleinnerbelowskip@length
%      \end{macrocode}
% Draw rule below of the subtitle.
%      \begin{macrocde}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \color{\mdf@subtitlebelowlinecolor}%
     \rule{\dimen@}{\mdf@subtitlebelowlinewidth@length}%
   \color@endgroup
  }%
%      \end{macrocode}
% Last skip and set a non breaking point.
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitlebelowskip@length
  \penalty 9995
 \endgroup
}

%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdfsubsubtitle}
% Definition of the command \Cmd{mdfsubsubtitle}. 
%    \begin{macrocode}
\newrobustcmd\mdfsubsubtitle[2][]%
{%
%    \end{macrocode}
% Make everything local.
%    \begin{macrocode}
 \begingroup
  \penalty-9995%set a breakpoint before the subsubtitle
%     \end{macrocode}
% Inside the title we don't need any \Cmd{parindent}. Next set the options of
% the optional argument of \Cmd{mdfsubsubtitle}.
%     \begin{macrocode}
  \parindent\z@\relax%
  \mdfsetup{#1}%only for subsubtitle options
%      \end{macrocode}
% Save the complete subsubtitle inside the save box \Cmd{z@}.
%      \begin{marcocode}
  \setbox\z@=\vbox{\mdf@subsubtitlefont{#2}\relax}%
%      \end{macrocode}
% Compute the width of the current line including the inner left margin and
% inner right margin (using \Cmd{dimen@}. In the nest step the height and the
% depth of the save box will be saved in \Cmd{dimen@i}.
%      \begin{marcocode}
  \dimen@=\linewidth\relax%
   \advance\dimen@ by \mdf@innerleftmargin@length\relax%
   \advance\dimen@ by \mdf@innerrightmargin@length\relax%
  \dimen@i=\mdf@subsubtitleinneraboveskip@length\relax%
   \advance\dimen@i by \mdf@subsubtitleinnerbelowskip@length\relax
   \advance\dimen@i by \ht\z@\relax%
   \advance\dimen@i by \dp\z@\relax%
%      \end{macrocode}
% Test if rules should be drawn. otherwise set the line width to 0\,pt.
%      \begin{macrocode}
  \ifbool{mdf@subsubtitleaboveline}{}%
         {\mdfsetup{subsubtitleabovelinewidth=\z@}}%
  \ifbool{mdf@subsubtitlebelowline}{}%
         {\mdfsetup{subsubtitlebelowlinewidth=\z@}}%
%      \end{macrocode}
% Start a new line with the given skip \Opt{subsubtitleaboveskip}.
%      \begin{macrocode}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleaboveskip@length
%      \end{macrocode}
% Drawing the above line of the subsubtitle.
%      \begin{macrocode}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \color{\mdf@subsubtitleabovelinecolor}%
     \rule{\dimen@}{\mdf@subsubtitleabovelinewidth@length}%
   \endgroup%
  }%
%      \end{macrocode}
% space between rule above and subsubtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleinneraboveskip@length
%      \end{macrocode}
% output of subsubtitle with a backround. Must think about the \Cmd{hspace}
% combination.
%      \begin{macrocde}
  \leavevmode\rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \smash{%
    \begingroup%
      \color{\mdf@subsubtitlebackgroundcolor}%
       \rule[\dimexpr-\dp\z@-\mdf@subtitleinnerbelowskip@length\relax]
            {\dimen@}{\dimen@i}%
    \endgroup%
   }%
  }%
  \box\z@\relax%
%      \end{macrocode}
% Skip after subsubtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleinnerbelowskip@length
%      \end{macrocode}
% Draw rule below of the subsubtitle.
%      \begin{macrocde}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \color{\mdf@subsubtitlebelowlinecolor}%
     \rule{\dimen@}{\mdf@subsubtitlebelowlinewidth@length}%
   \endgroup%
  }%
%      \end{macrocode}
% Last skip and set a non breaking point.
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitlebelowskip@length
  \penalty 9995
 \endgroup
}

%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{mdf@putbox@single,mdf@frame@background@single,^^A
%               mdf@frame@topandbottomline@single,mdf@frame@leftline@single,^^A
%               mdf@frame@rightline@single,mdf@frame@rightline@single}
% The frame of of a non splitted contents of mdframed
%    \begin{macrocode}
\def\mdf@frame@background@single{%
  \ifbool{mdf@shadow}%
   {%
    \rlap%
     {%
      \smash%
       {%
        \mdf@shadow@default%
         \rule[\dimexpr
                -\mdfboundingboxdepth
                -\mdf@shadowsize@length
                \ifbool{mdf@bottomline}{-\mdf@middlelinewidth@length}{}
              \relax]%
             {\dimexpr
                \mdfboundingboxtotalwidth
                +\mdf@shadowsize@length
                \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}
              \relax}%
             {\dimexpr
                \mdfboundingboxtotalheight
                +\mdf@shadowsize@length
                \ifbool{mdf@bottomline}{+\mdf@middlelinewidth@length}{}
              \relax}%
       }%
     }%
   }{}%
  \rlap%
   {%
    \mdf@background@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdfboundingboxtotalwidth}%
         {\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@frametitlebackground@single{%
  \rlap%
   {%
    \mdf@frametitlebackground@default%
    \rule[\dimexpr
            -\mdfboundingboxdepth
            +\mdfboundingboxtotalheight
            -\mdfframetitleboxtotalheight
          \relax]%
         {\mdfboundingboxtotalwidth}%
         {\mdfframetitleboxtotalheight}%
   }%
}%
\def\mdf@frame@topline@single{%
  \rlap%
   {%
    \mdf@linecolor@default%
    \ifbool{mdf@topline}%
      {%
       \rule[\dimexpr
               \mdfboundingboxheight
               -\mdfboundingboxdepth%
               +\mdf@innerbottommargin@length
               +\mdf@innertopmargin@length
             \relax]%
            {\mdfboundingboxtotalwidth}%
            {\mdf@middlelinewidth@length}%
      }{}%
   }%
}%
\def\mdf@frame@bottomline@single{%
  \rlap%
   {%
    \ifbool{mdf@leftline}%
      {%
       \hspace*{-\mdf@middlelinewidth@length}%
      }{}%
    \mdf@linecolor@default%
    \ifbool{mdf@bottomline}%
      {%
       \rule[\dimexpr
               -\mdfboundingboxdepth
               -\mdf@middlelinewidth@length
             \relax]%
            {\dimexpr
               \mdfboundingboxtotalwidth
               \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
               \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}%
             \relax}%
            {\mdf@middlelinewidth@length}%
      }{}%
   }%
}%
\def\mdf@frame@leftline@single{%
  \llap%
   {%
    \mdf@linecolor@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\dimexpr
            \mdfboundingboxtotalheight%
            \ifbool{mdf@topline}{+\mdf@middlelinewidth@length}{}%
          \relax}%
   }%
}%
\def\mdf@frame@rightline@single{%
  \rlap%
   {%
    \mdf@linecolor@default%
    \hspace*{\mdfboundingboxwidth}%
    \hspace*{\mdf@innerrightmargin@length}%
    \rule[\dimexpr
            -\mdfboundingboxdepth%
          \relax]%
         {\mdf@middlelinewidth@length}%
         {\dimexpr
            \mdfboundingboxtotalheight%
            \ifbool{mdf@topline}{+\mdf@middlelinewidth@length}{}%
          \relax}%
   }%
}%
\def\mdf@putbox@single{%
  \ifvoid\mdf@splitbox@one\relax
  \else%
    \mdf@makebox@out%
     {%
      \mdf@makeboxalign@left%
      \setlength{\mdfboundingboxwidth}%
                {\wd\mdf@splitbox@one}%
      \setlength{\mdfboundingboxtotalwidth}%
                {\dimexpr
                   \mdfboundingboxwidth
                   +\mdf@innerleftmargin@length%
                   +\mdf@innerrightmargin@length
                 \relax}%
      \setlength{\mdfboundingboxheight}%
                {\dimexpr
                   \ht\mdf@splitbox@one
                   +\dp\mdf@splitbox@one
                 \relax}%
      \setlength{\mdfboundingboxdepth}%
                {\dimexpr
                   \dp\mdf@splitbox@one
                   +\mdf@innerbottommargin@length
                 \relax}%
      \setlength{\mdfboundingboxtotalheight}%
                {\dimexpr
                   \mdfboundingboxheight
                   +\mdf@innertopmargin@length%
                   +\mdf@innerbottommargin@length
                 \relax}%
      \setlength{\mdftotallinewidth}%
                {\dimexpr
                   \mdf@innerlinewidth@length
                   +\mdf@middlelinewidth@length%
                   +\mdf@outerlinewidth@length
                 \relax}%
      \noindent%
      \setlength{\@tempdima}%
                {\dimexpr
                   \mdfboundingboxtotalwidth%
                   \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}%
                   \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}
                 \relax}%
      \mdf@makebox@in[\@tempdima]%
       {%
        \null%
        \ifbool{mdf@leftline}%
          {%
           \hspace*{\mdftotallinewidth}%
           \mdf@frame@leftline@single%
          }{}%
        \mdf@frame@topline@single%
        \mdf@frame@background@single%
        \mdf@frame@bottomline@single%
        \ifdefempty{\mdf@frametitle}{}{\mdf@frame@frametitlebackground@single}%
        \hspace*{\mdf@innerleftmargin@length}%
        \ifbool{mdf@rightline}%
          {%
           \mdf@frame@rightline@single%
          }{}%
        {\box\mdf@splitbox@one}%
       }%
      \mdf@makeboxalign@right%
     }%
  \fi%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@putbox@first,mdf@frame@background@first,^^A
%               mdf@frame@leftline@first,mdf@frame@topline@first,^^A
%               mdf@frame@rightline@first}
% The first frame of of a splitted contents of mdframed
%    \begin{macrocode}
\def\mdf@frame@background@first{%
  \ifbool{mdf@shadow}%
   {%
    \rlap%
     {%
      \smash%
       {%
        \mdf@shadow@default%
        \rule[\dimexpr
                -\mdfboundingboxdepth
                -\mdf@shadowsize@length
              \relax]%
             {\dimexpr
                \mdfboundingboxtotalwidth
                +\mdf@shadowsize@length
                \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}
              \relax}%
             {\dimexpr
                \mdfboundingboxtotalheight
                +\mdf@shadowsize@length
              \relax}%
       }%
     }%
   }{}%
  \rlap%
   {%
    \mdf@background@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdfboundingboxtotalwidth}%
         {\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@frametitlebackground@first{%
 \ifbool{mdf@repeatframetitle}%
  {%repeating title = true
   \rlap%
    {%
     \mdf@frametitlebackground@default%
     \rule[\dimexpr
             -\mdfboundingboxdepth
             +\mdfboundingboxtotalheight
             -\mdfframetitleboxtotalheight
           \relax]%
          {\mdfboundingboxtotalwidth}%
          {\mdfframetitleboxtotalheight}%
    }%
  }%
  {%repeating title = false -- maybe splitted
   \ifdimless{\mdfframetitleboxtotalheight}{\mdfboundingboxtotalheight}%
    {%
     \rlap%
      {%
       \mdf@frametitlebackground@default%
       \rule[\dimexpr
               -\mdfboundingboxdepth
               +\mdfboundingboxtotalheight
               -\mdfframetitleboxtotalheight
             \relax]%
            {\mdfboundingboxtotalwidth}%
            {\mdfframetitleboxtotalheight}%
      }%
     \global\mdfframetitleboxtotalheight=-\p@\relax%
    }%
    {%
     \mdf@PackageWarning{You got a page break inside the title\MessageBreak
                         Current this isn't well supported}%
     \rlap%
      {%
       \mdf@frametitlebackground@default%
       \rule[-\mdfboundingboxdepth]%
            {\mdfboundingboxtotalwidth}%
            {\mdfboundingboxtotalheight}%
      }%
     \global\mdfframetitleboxtotalheight=%
          \dimexpr%
            \mdfframetitleboxtotalheight
            -\mdfboundingboxheight
            +\mdf@frametitlebelowskip@length
            +.5\baselineskip-1pt
%           +\dp\strutbox
          \relax%
    }%
  }%
}%
\def\mdf@frame@leftline@first{%
  \llap%
   {%
    \mdf@linecolor@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\dimexpr
            \mdfboundingboxtotalheight%
            \ifbool{mdf@topline}{+\mdf@middlelinewidth@length}{}
          \relax}%
   }%
}%
\def\mdf@frame@topline@first{%
  \rlap%
   {%
    \mdf@linecolor@default%
    \rule[\dimexpr
            \mdfboundingboxheight
            -\mdfboundingboxdepth
            +\mdf@splitbottomskip@length
            +\mdf@innertopmargin@length
          \relax]%
         {\mdfboundingboxtotalwidth}%
         {\mdf@middlelinewidth@length}%
   }%
}
\def\mdf@frame@rightline@first{%
  \rlap%
   {%
    \mdf@linecolor@default%
    \hspace*{\mdfboundingboxwidth}%
    \hspace*{\mdf@innerrightmargin@length}%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\dimexpr
            \mdfboundingboxtotalheight%
            \ifbool{mdf@topline}{+\mdf@middlelinewidth@length}{}
          \relax}%
   }%
}%
\def\mdf@frame@bottomline@first{%
  \rlap%
   {%
    \ifbool{mdf@leftline}%
      {%
       \hspace*{-\mdf@middlelinewidth@length}%
      }{}%
    \mdf@linecolor@default%
    \ifbool{mdf@bottomline}%
      {%
       \rule[\dimexpr
               -\mdfboundingboxdepth
               -\mdf@middlelinewidth@length
             \relax]%
            {\dimexpr
               \mdfboundingboxtotalwidth
               \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
               \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}
             \relax}%
            {\mdf@middlelinewidth@length}%
      }{}%
   }%
}%
\def\mdf@putbox@first{%
  \ifvoid\mdf@splitbox@two\relax
  \else%
    \mdf@makebox@out[\linewidth]%
     {%
      \mdf@makeboxalign@left%
      \setlength{\mdfboundingboxwidth}
                {\wd\mdf@splitbox@two}%
      \setlength{\mdfboundingboxtotalwidth}%
                {\dimexpr
                   \mdfboundingboxwidth
                   +\mdf@innerleftmargin@length%
                   +\mdf@innerrightmargin@length
                 \relax}%
      \setlength{\mdfboundingboxheight}
                {\dimexpr
                   \ht\mdf@splitbox@two
                   +\dp\mdf@splitbox@two
                 \relax}%
      \setlength{\mdfboundingboxdepth}%
                {\dimexpr
                   \dp\mdf@splitbox@two
                    +\mdf@splitbottomskip@length
                 \relax}%
      \setlength{\mdfboundingboxtotalheight}%
                {\dimexpr
                   \mdfboundingboxheight
                   +\mdf@innertopmargin@length%
                   +\mdf@splitbottomskip@length
                 \relax}%
      \setlength{\@tempdima}%
                {\dimexpr
                   \mdfboundingboxtotalwidth%
                   \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}%
                   \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
                 \relax}%
       \mdf@makebox@in[\@tempdima]%
        {%
         \null%
         \ifbool{mdf@leftline}%
           {%
            \hspace*{\mdf@middlelinewidth@length}%
            \mdf@frame@leftline@first%
           }{}%
         \ifbool{mdf@everyline}%
           {%
            \mdf@frame@bottomline@first%
           }{}%
         \ifbool{mdf@topline}%
           {%
            \mdf@frame@topline@first%
           }{}%
         \mdf@frame@background@first%
         \ifdefempty{\mdf@frametitle}{}{\mdf@frame@frametitlebackground@first}%
         \hspace*{\mdf@innerleftmargin@length}%
         \ifbool{mdf@rightline}%
          {%
           \mdf@frame@rightline@first%
          }{}%
         {\box\mdf@splitbox@two}%
        }%
       \mdf@makeboxalign@right%
     }%
 \fi%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@putbox@second,mdf@frame@background@second,^^A
%               mdf@frame@leftline@second,mdf@frame@bottomline@second,^^A
%               mdf@frame@rightline@second}
% The last frame of of a splitted contents of mdframed
%    \begin{macrocode}
\def\mdf@frame@background@second{%
  \ifbool{mdf@shadow}%
    {%
     \rlap%
      {%
       \smash%
        {%
         \mdf@shadow@default%
         \rule[\dimexpr
                 -\mdfboundingboxdepth
                 -\mdf@shadowsize@length
                 \ifbool{mdf@bottomline}{-\mdf@middlelinewidth@length}{}
               \relax]%
              {\dimexpr
                 \mdfboundingboxtotalwidth
                 +\mdf@shadowsize@length
                 \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}
               \relax}%
              {\dimexpr
                 \mdfboundingboxtotalheight
                 +\mdf@shadowsize@length
                \relax}%
        }%
      }%
    }{}%
  \rlap%
   {%
    \mdf@background@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdfboundingboxtotalwidth}%
         {\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@frametitlebackground@second{%
 \ifbool{mdf@repeatframetitle}%
  {%repeating title = true
   \rlap%
    {%
     \mdf@frametitlebackground@default%
     \rule[\dimexpr
             -\mdfboundingboxdepth
             +\mdfboundingboxtotalheight
             -\mdfframetitleboxtotalheight
           \relax]%
          {\mdfboundingboxtotalwidth}%
          {\mdfframetitleboxtotalheight}%
    }%
  }%
  {%repeating title = false -- maybe splitted
   \ifdimless{\mdfframetitleboxtotalheight}{\z@}%
    {}%
    {%
     \rlap%
      {%
       \mdf@frametitlebackground@default%
       \rule[\dimexpr
               -\mdfboundingboxdepth
               +\mdfboundingboxtotalheight
               -\mdfframetitleboxtotalheight
             \relax]%
            {\mdfboundingboxtotalwidth}%
            {\mdfframetitleboxtotalheight}%
      }%
    }%
  }%
}%
\def\mdf@frame@leftline@second{%
  \llap%
   {%
    \mdf@linecolor@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\dimexpr\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@bottomline@second{%
  \rlap%
   {%
    \ifbool{mdf@leftline}%
      {%
       \hspace*{-\mdf@middlelinewidth@length}%
      }{}%
    \mdf@linecolor@default%
    \rule[\dimexpr
            -\mdfboundingboxdepth
            -\mdf@middlelinewidth@length
          \relax]%
         {\dimexpr
            \mdfboundingboxtotalwidth
            \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}
            \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}
          \relax}%
         {\mdf@middlelinewidth@length}%
   }%
}%
\def\mdf@frame@rightline@second{%
  \rlap%
   {%
    \mdf@linecolor@default\hspace*{\mdfboundingboxwidth}%
    \hspace*{\mdf@innerrightmargin@length}%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@topline@second{%
  \rlap%
   {%
    \ifbool{mdf@leftline}%
      {%
       \hspace*{-\mdf@middlelinewidth@length}%
      }{}%
    \mdf@linecolor@default%
    \ifbool{mdf@topline}%
      {%
       \rule[\dimexpr
               \mdfboundingboxheight
               -\mdfboundingboxdepth%
               +\mdf@innerbottommargin@length
             \relax]%
            {\dimexpr
               \mdfboundingboxtotalwidth
               \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
               \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}
             \relax}%
            {\mdf@middlelinewidth@length}%
      }{}%
   }%
}%

\def\mdf@putbox@second{%
  \ifvoid\mdf@splitbox@one\relax%
  \else
   \mdf@makebox@out%
     {%
      \mdf@makeboxalign@left%
      \setlength{\mdfboundingboxwidth}%
                {\wd\mdf@splitbox@one}%
      \setlength{\mdfboundingboxtotalwidth}%
                {\dimexpr
                   \mdfboundingboxwidth
                   +\mdf@innerleftmargin@length%
                   +\mdf@innerrightmargin@length
                 \relax}%
      \setlength{\mdfboundingboxheight}%
                {\dimexpr
                   \ht\mdf@splitbox@one
                   +\dp\mdf@splitbox@one
                 \relax}%
      \setlength{\mdfboundingboxdepth}%
                {\dimexpr
                   \dp\mdf@splitbox@one
                   +\mdf@innerbottommargin@length
                 \relax}%
      \setlength{\mdfboundingboxtotalheight}%
                {\dimexpr
                   \mdfboundingboxheight
                   +\mdf@innerbottommargin@length
                 \relax}%
      \setlength{\@tempdima}%
                {\dimexpr
                   \mdfboundingboxtotalwidth%
                   \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}%
                   \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
                 \relax}%
      \mdf@makebox@in[\@tempdima]%
       {%
        \null%
        \ifbool{mdf@leftline}%
          {%
           \hspace*{\mdf@middlelinewidth@length}%
           \mdf@frame@leftline@second%
          }{}%
        \ifbool{mdf@everyline}%
          {%
           \mdf@frame@topline@second
          }{}%
        \mdf@frame@background@second%
        \ifbool{mdf@bottomline}%
          {%
           \mdf@frame@bottomline@second%
          }{}%
        \ifdefempty{\mdf@frametitle}{}{\mdf@frame@frametitlebackground@second}%
        \hspace*{\mdf@innerleftmargin@length}%
        \ifbool{mdf@rightline}%
          {%
           \mdf@frame@rightline@second%
          }{}%
        {\box\mdf@splitbox@one}%
       }%
      \mdf@makeboxalign@right%
     }%
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@putbox@middle,mdf@frame@background@middle,^^A
%               mdf@frame@leftline@middle,mdf@frame@rightline@middle}
% The last frame of of a splitted contents of mdframed
%    \begin{macrocode}
\def\mdf@frame@leftline@middle{%
  \llap%
   {%
    \mdf@linecolor@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\mdfboundingboxtotalheight}%
  }%
}%
\def\mdf@frame@background@middle{%
  \ifbool{mdf@shadow}%
    {%
     \rlap%
      {%
       \smash%
        {%
         \mdf@shadow@default%
         \rule[\dimexpr
                 -\mdfboundingboxdepth
                 -\mdf@shadowsize@length
               \relax]%
              {\dimexpr
                 \mdfboundingboxtotalwidth
                 +\mdf@shadowsize@length
                 \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}
               \relax}%
              {\mdfboundingboxtotalheight}%
        }%
      }%
    }{}%
  \rlap%
   {%
    \mdf@background@default%
    \rule[-\mdfboundingboxdepth]%
         {\mdfboundingboxtotalwidth}%
         {\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@frametitlebackground@middle{%
 \ifbool{mdf@repeatframetitle}%
  {%repeating title = true
   \rlap%
    {%
     \mdf@frametitlebackground@default%
     \rule[\dimexpr
             -\mdfboundingboxdepth
             +\mdfboundingboxtotalheight
             -\mdfframetitleboxtotalheight
           \relax]%
          {\mdfboundingboxtotalwidth}%
          {\mdfframetitleboxtotalheight}%
    }%
  }%
  {%repeating title = false -- maybe splitted
   \ifdimless{\mdfframetitleboxtotalheight}{\z@}%
    {}%
    {%
     \rlap%
      {%
       \mdf@frametitlebackground@default%
       \rule[\dimexpr
               -\mdfboundingboxdepth
               +\mdfboundingboxtotalheight
               -\mdfframetitleboxtotalheight
             \relax]%
            {\mdfboundingboxtotalwidth}%
            {\mdfframetitleboxtotalheight}%
      }%
     \global\mdfframetitleboxtotalheight=-\p@\relax%
    }%
    }%
}%
\def\mdf@frame@rightline@middle{%
  \rlap%
   {%
    \mdf@linecolor@default%
    \hspace*{\mdfboundingboxwidth}%
    \hspace*{\mdf@innerrightmargin@length}%
    \rule[-\mdfboundingboxdepth]%
         {\mdf@middlelinewidth@length}%
         {\mdfboundingboxtotalheight}%
   }%
}%
\def\mdf@frame@topline@middle{%
  \rlap%
   {%
    \ifbool{mdf@leftline}%
      {%
       \hspace*{-\mdf@middlelinewidth@length}%
      }{}%
    \mdf@linecolor@default%
    \ifbool{mdf@topline}%
      {%
       \rule[\dimexpr
               \mdfboundingboxtotalheight
               -\mdfboundingboxdepth
             \relax]%
            {\dimexpr
               \mdfboundingboxtotalwidth
               \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
               \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}
             \relax}%
            {\mdf@middlelinewidth@length}%
      }{}%
   }%
}%
\def\mdf@frame@bottomline@middle{%
  \rlap%
   {%
    \ifbool{mdf@leftline}%
      {%
       \hspace*{-\mdf@middlelinewidth@length}%
      }{}%
    \mdf@linecolor@default%
    \ifbool{mdf@bottomline}%
      {%
       \rule[\dimexpr
               -\mdfboundingboxdepth
               -\mdf@middlelinewidth@length
             \relax]%
            {\dimexpr
               \mdfboundingboxtotalwidth
               \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
               \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}
             \relax}%
            {\mdf@middlelinewidth@length}%
      }{}%
   }%
}%

\def\mdf@putbox@middle{%
  \ifvoid\mdf@splitbox@two\relax%
  \else
   \mdf@makebox@out%
     {%
      \mdf@makeboxalign@left%
      \setlength{\mdfboundingboxwidth}
                {\wd\mdf@splitbox@two}%
      \setlength{\mdfboundingboxtotalwidth}%
                {\dimexpr
                   \mdfboundingboxwidth
                   +\mdf@innerleftmargin@length%
                   +\mdf@innerrightmargin@length
                 \relax}%
      \setlength{\mdfboundingboxheight}
                {\dimexpr
                   \ht\mdf@splitbox@two
                   +\dp\mdf@splitbox@two
                 \relax}%
      \setlength{\mdfboundingboxdepth}%
                {\dimexpr
                   \dp\mdf@splitbox@two
                   +\mdf@splitbottomskip@length
                 \relax}%
      \setlength{\mdfboundingboxtotalheight}%
                {\dimexpr
                   \mdfboundingboxheight
                   +\mdf@splitbottomskip@length
                 \relax}%
      \setlength{\@tempdima}
                {\dimexpr
                    \mdfboundingboxtotalwidth%
                    \ifbool{mdf@leftline}{+\mdf@middlelinewidth@length}{}%
                    \ifbool{mdf@rightline}{+\mdf@middlelinewidth@length}{}%
                 \relax}%
      \mdf@makebox@in[\@tempdima]%
        {%
         \null%
         \ifbool{mdf@leftline}%
           {%
            \hspace*{\mdf@middlelinewidth@length}%
            \mdf@frame@leftline@middle%
           }{}%
         \mdf@frame@background@middle%
         \ifbool{mdf@everyline}%
           {%
            \mdf@frame@topline@middle
           }{}%
         \ifdefempty{\mdf@frametitle}{}
                    {\mdf@frame@frametitlebackground@middle}%
         \ifbool{mdf@everyline}%
           {%
            \mdf@frame@bottomline@middle%
           }{}%
         \hspace*{\mdf@innerleftmargin@length}%
         \ifbool{mdf@rightline}%
           {%
            \mdf@frame@rightline@middle%
           }{}%
         {\box\mdf@splitbox@two}%
        }%
      \mdf@makeboxalign@right%
     }%
  \fi%
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
 \endinput
%    \end{macrocode}
%
% \iffalse
%</mdframedefault>
% \fi
%
%
%\iffalse
%    \begin{macrocode}
%<*mdframetikz>
%    \end{macrocode}
%\fi
% \subsection{The Explanation of md-frame-1.mdf}
%    \begin{macrocode}
%% Style file for mdframed for package option `framemethod=default`
%% 
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%%
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
%
%    \end{macrocode}
% \changes{v1.1beta}{2011/12/16}{added lost semicolons}
% \begin{macro}{mdframedIpackagename,mdf@frameIdate@svn}
% local settings
%    \begin{macrocode}
\def\mdframedIpackagename{md-frame-1}
\def\mdf@frameIdate@svn$#1: #2 #3 #4-#5-#6 #7 #8${#4/#5/#6\space }
\ProvidesFile{md-frame-1.mdf}%
      [\mdf@frameIdate@svn$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $ %
       \mdversion: \mdframedIpackagename]
%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@tikz@settings}
% Define settings for tikz
%    \begin{macrocode}
%Allgemeine Einstellungen fuer tikz
\def\mdf@tikz@settings{%
%
  \tikzset{mdfbox/.style={anchor=south west,%
                          inner sep=0pt,%
                          outer sep=0pt,%
                          \mdf@fontcolor,%
                         }%
          }% anchor der Ausgabebox ist unten links
  \tikzset{mdfcorners/.style={rounded corners=\mdf@roundcorner@length}}% 
  \tikzset{mdfbackground/.style={fill=\mdf@backgroundcolor,%
                                 draw=\mdf@backgroundcolor%
                                }%
          }% 
  \tikzset{mdfframetitlebackground/.style=%
                   {%
                    fill=\mdf@frametitlebackgroundcolor,%
                    draw=none,%
                    rounded corners={max(\mdf@roundcorner@length%
                                         -\mdf@innerlinewidth@length%
                                        -.5\mdf@middlelinewidth@length,0)%
                                    }%
                   }%
          }%
%
  \tikzset{mdfouterline/.style={}}%
% nur wenn outerlinewidth>0 wird aussere Linie gezeichnet
  \ifdimgreater{\mdf@outerlinewidth@length}{\z@}
    {\tikzset{mdfouterline/.append style={%
      draw=\mdf@outerlinecolor,%
      line width=2\mdf@outerlinewidth@length+\mdf@middlelinewidth@length}}}{}%
%
  \tikzset{mdfinnerline/.style={}}%
% nur wenn innerlinewidth>0 wird innere Linie gezeichnet
  \ifdimgreater{\mdf@innerlinewidth@length}{\z@}
    {\tikzset{mdfinnerline/.append style={%
      draw=\mdf@innerlinecolor,%
      line width=2\mdf@innerlinewidth@length+\mdf@middlelinewidth@length}}}{}%
%
  \tikzset{mdfshadow/.style={drop shadow={%
                               shadow xshift=\mdf@shadowsize@length-2pt,
                               shadow yshift=-\mdf@shadowsize@length+2pt,
                               fill=\mdf@shadowcolor,
                               every shadow }}}% 
%
  \mdf@tikzset@local
  \tikzset{mdfmiddleline/.style={}}%
% nur wenn middlelinewidth>0 wird mittlere Linie gezeichnet
  \ifdimgreater{\mdf@middlelinewidth@length}{\z@}
    {\tikzset{mdfmiddleline/.append style={%
      preaction={draw=\mdf@middlelinecolor,%
                 line width=\mdf@middlelinewidth@length},%
      line width=\mdf@middlelinewidth@length,%
      tikzsetting}}%
    }{}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@tikzbox@tfl,mdf@tikzbox@otl}
% Befehle fuer Ausgabe von Rahmen und Hintergrund
%    \begin{macrocode}
\newrobustcmd*\mdf@tikzbox@tfl[1]{%three or four borders
    \clip(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
    \begin{scope}[mdfcorners]%
       \clip[preaction=mdfouterline]%
            [postaction=mdfbackground]%
            [postaction=mdfinnerline]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]#1;
  }%



\newrobustcmd*\mdf@tikzbox@otl[2]{%one or two borders
    \clip(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
    \begin{scope}
       \path[mdfouterline,mdfcorners]#1;%
       \clip[postaction=mdfbackground]#2;%
       \path[mdfinnerline,mdfcorners]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]#1;}%
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{mdf@put@frametitlerule}
% frametitlerule with tikz
%    \begin{macrocode}
\tikzset{mdfframetitlerule/.style={%
   draw=none,
   fill=\mdf@frametitlerulecolor,
  }%
}
\def\mdf@@frametitlerule{%
  \ifbool{mdf@frametitlerule}{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{\hspace*{-\mdf@innerleftmargin@length}%
     \begingroup%
     \pgfmathsetlength{\dimen@}{\mdfframetitleboxwidth
                                +\mdf@innerleftmargin@length
                                +\mdf@innerrightmargin@length}%
     \tikz\draw[mdfframetitlerule] (0,0)%
               rectangle (\dimen@,\mdf@frametitlerulewidth@length);
     \endgroup}
   }%
  }{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{}
   }%
  }%
  \iftoggle{mdf@notfirstframetitle}%
    {%
      \par\unskip\vskip\mdf@splittopskip@length%
    }%
    {%
      \par\unskip\vskip\mdf@innertopmargin@length%
    }%
}%
  
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdfsubtitle}
% Definition of the command \Cmd{mdfsubtitle}. Starting with the definition of
% the tikz style for the rule above the subtitle.
%    \begin{macrocode}%
\tikzset{mdfsubtitleaboverule/.style={%
   draw=none,
   fill=\mdf@subtitleabovelinecolor,
  }%
}
%    \end{macrocode}
% Definition of the default style of rule below the subtitle.
%    \begin{macrocode}
\tikzset{mdfsubtitlebelowrule/.style={%
   draw=none,
   fill=\mdf@subtitlebelowlinecolor,
  }%
}
%    \end{macrocode}
% Definition of the default style of the background of the subtitle.
%    \begin{macrocode}
\tikzset{mdfsubtitlebackground/.style={%
   draw=\mdf@subtitlebackgroundcolor,
   fill=\mdf@subtitlebackgroundcolor,
  }%
}
%    \end{macrocode}
% Definition of the command \Cmd{mdfsubtitle}. 
%    \begin{macrocode}
\newrobustcmd\mdfsubtitle[2][]%
{%
%    \end{macrocode}
% Make everything local.
%    \begin{macrocode}
 \begingroup
  \penalty-9995%set a breakpoint before the subtitle
%     \end{macrocode}
% Inside the title we don't need any \Cmd{parindent}. Next set the options of
% the optional argument of \Cmd{mdfsubtitle}.
%     \begin{macrocode}
  \parindent\z@\relax%
  \mdfsetup{#1}%only for subtitle options
%      \end{macrocode}
% Save the complete subtitle inside the save box \Cmd{z@}.
%      \begin{marcocode}
  \setbox\z@=\vbox{\mdf@subtitlefont{#2}\relax}%
%      \end{macrocode}
% Compute the width of the current line including the inner left margin and
% inner right margin (using \Cmd{dimen@}. In the nest step the height and the
% depth of the save box will be saved in \Cmd{dimen@i}.
%      \begin{marcocode}
  \pgfmathsetlength{\dimen@}%
                   {%
                    \linewidth%
                    +\mdf@innerleftmargin@length%
                    +\mdf@innerrightmargin@length%
                   }%
%      \end{macrocode}
% Test if rules should be drawn. otherwise set the line width to 0\,pt.
%      \begin{macrocode}
  \ifbool{mdf@subtitleaboveline}{}%
         {\mdfsetup{subtitleabovelinewidth=\z@}}%
  \ifbool{mdf@subtitlebelowline}{}%
         {\mdfsetup{subtitlebelowlinewidth=\z@}}%
%      \end{macrocode}
% Start a new line with the given skip \Opt{subtitleaboveskip}.
%      \begin{macrocode}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleaboveskip@length
%      \end{macrocode}
% Drawing the above line of the subtitle.
%      \begin{macrocode}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \tikz\draw[mdfsubtitleaboverule] (0,0)%
                rectangle (\dimen@,\mdf@subtitleabovelinewidth@length);
   \endgroup%
  }%
%      \end{macrocode}
% space between rule above and subtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleinneraboveskip@length
%      \end{macrocode}
% output of subtitle with a backround. Must think about the \Cmd{hspace}
% combination.
%      \begin{macrocde}
  \leavevmode\hspace*{-\mdf@innerleftmargin@length}%
  \tikz[overlay]%
       \draw[mdfsubtitlebackground]
            (0,-\mdf@subtitleinnerbelowskip@length-\dp\z@)
            rectangle(\dimen@,\ht\z@+\mdf@subtitleinneraboveskip@length);%
  \hspace*{+\mdf@innerleftmargin@length}%
  \box\z@\relax%
%      \end{macrocode}
% Skip after subtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleinnerbelowskip@length
%      \end{macrocode}
% Draw rule below of the subtitle.
%      \begin{macrocde}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \tikz\draw[mdfsubtitlebelowrule] (0,0)%
                rectangle (\dimen@,\mdf@subtitlebelowlinewidth@length);
   \endgroup%
  }%
%      \end{macrocode}
% Last skip and set a non breaking point.
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitlebelowskip@length
  \penalty 9995
 \endgroup
}

%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdfsubsubtitle}
% Definition of the command \Cmd{mdfsubsubtitle}. Starting with the definition of
% the tikz style for the rule above the subsubtitle.
%    \begin{macrocode}%
\tikzset{mdfsubsubtitleaboverule/.style={%
   draw=none,
   fill=\mdf@subsubtitleabovelinecolor,
  }%
}
%    \end{macrocode}
% Definition of the default style of rule below the subsubtitle.
%    \begin{macrocode}
\tikzset{mdfsubsubtitlebelowrule/.style={%
   draw=none,
   fill=\mdf@subsubtitlebelowlinecolor,
  }%
}
%    \end{macrocode}
% Definition of the default style of the background of the subsubtitle.
%    \begin{macrocode}
\tikzset{mdfsubsubtitlebackground/.style={%
   draw=\mdf@subsubtitlebackgroundcolor,
   fill=\mdf@subsubtitlebackgroundcolor,
  }%
}
%    \end{macrocode}
% Definition of the command \Cmd{mdfsubsubtitle}. 
%    \begin{macrocode}
\newrobustcmd\mdfsubsubtitle[2][]%
{%
%    \end{macrocode}
% Make everything local.
%    \begin{macrocode}
 \begingroup
  \penalty-9995%set a breakpoint before the subsubtitle
%     \end{macrocode}
% Inside the title we don't need any \Cmd{parindent}. Next set the options of
% the optional argument of \Cmd{mdfsubsubtitle}.
%     \begin{macrocode}
  \parindent\z@\relax%
  \mdfsetup{#1}%only for subsubtitle options
%      \end{macrocode}
% Save the complete subsubtitle inside the save box \Cmd{z@}.
%      \begin{marcocode}
  \setbox\z@=\vbox{\mdf@subsubtitlefont{#2}\relax}%
%      \end{macrocode}
% Compute the width of the current line including the inner left margin and
% inner right margin (using \Cmd{dimen@}. In the nest step the height and the
% depth of the save box will be saved in \Cmd{dimen@i}.
%      \begin{marcocode}
  \pgfmathsetlength{\dimen@}%
                   {%
                    \linewidth%
                    +\mdf@innerleftmargin@length%
                    +\mdf@innerrightmargin@length%
                   }%
%      \end{macrocode}
% Test if rules should be drawn. otherwise set the line width to 0\,pt.
%      \begin{macrocode}
  \ifbool{mdf@subsubtitleaboveline}{}%
         {\mdfsetup{subsubtitleabovelinewidth=\z@}}%
  \ifbool{mdf@subsubtitlebelowline}{}%
         {\mdfsetup{subsubtitlebelowlinewidth=\z@}}%
%      \end{macrocode}
% Start a new line with the given skip \Opt{subsubtitleaboveskip}.
%      \begin{macrocode}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleaboveskip@length
%      \end{macrocode}
% Drawing the above line of the subsubtitle.
%      \begin{macrocode}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \tikz\draw[mdfsubsubtitleaboverule] (0,0)%
                rectangle (\dimen@,\mdf@subsubtitleabovelinewidth@length);
   \endgroup%
  }%
%      \end{macrocode}
% space between rule above and subsubtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleinneraboveskip@length
%      \end{macrocode}
% output of subsubtitle with a backround. Must think about the \Cmd{hspace}
% combination.
%      \begin{macrocde}
  \hspace*{-\mdf@innerleftmargin@length}%
  \tikz[overlay]%
       \draw[mdfsubtitlebackground]
            (0,-\mdf@subsubtitleinnerbelowskip@length-\dp\z@)
            rectangle(\dimen@,\ht\z@+\mdf@subsubtitleinneraboveskip@length);%
  \hspace*{+\mdf@innerleftmargin@length}%
  \box\z@\relax%
%      \end{macrocode}
% Skip after subsubtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleinnerbelowskip@length
%      \end{macrocode}
% Draw rule below of the subsubtitle.
%      \begin{macrocde}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \tikz\draw[mdfsubsubtitlebelowrule] (0,0)%
                rectangle (\dimen@,\mdf@subsubtitlebelowlinewidth@length);
   \endgroup%
  }%
%      \end{macrocode}
% Last skip and set a non breaking point.
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitlebelowskip@length
  \penalty 9995
 \endgroup
}

%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{mdf@putbox@single}
%  Output of the non breakable contents.
%    \begin{macrocode}
% Info zu den verwendeten Punkten:
% O ist die untere linke Ecke der Mitte der middleline
% P ist die obere rechte Ecke der Mitte der middleline
% A ist der Punkt fuer den anchor (d.h. die untere linke Ecke) der Ausgabebox
%
\def\mdf@putbox@single{%
  \ifvoid\mdf@splitbox@one
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
    \advance\mdfboundingboxheight by \mdf@innertopmargin@length\relax%
    \advance\mdfboundingboxheight by \mdf@innerbottommargin@length\relax%
    \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]%
      \pgfmathsetlengthmacro\mdf@Ax{+\mdf@innerleftmargin@length}%
      \pgfmathsetlengthmacro\mdf@Ay{+\mdf@innerbottommargin@length}%
      \pgfmathsetlengthmacro\mdf@Ox{+0pt}%
      \pgfmathsetlengthmacro\mdf@Oy{+0pt}%
      \pgfmathsetlengthmacro\mdf@Px{+\mdfboundingboxwidth}%
      \pgfmathsetlengthmacro\mdf@Py{+\mdfboundingboxheight}%
      \ifbool{mdf@leftline}%
        {%
         \pgfmathsetlengthmacro\mdf@Ax%
            {\mdf@Ax+\mdf@outerlinewidth@length+%
             \mdf@middlelinewidth@length+\mdf@innerlinewidth@length}%
         \pgfmathsetlengthmacro\mdf@Ox%
           {\mdf@Ox+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
        }{}%
      \ifbool{mdf@rightline}%
        {%
         \pgfmathsetlengthmacro\mdf@Px%
           {\mdf@Px-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
      \ifbool{mdf@bottomline}%
        {%
         \pgfmathsetlengthmacro\mdf@Ay%
           {\mdf@Ay+\mdf@outerlinewidth@length+\mdf@middlelinewidth@length%
            +\mdf@innerlinewidth@length}%
         \pgfmathsetlengthmacro\mdf@Oy%
           {\mdf@Oy+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
        }{}%
      \ifbool{mdf@topline}%
        {%
         \pgfmathsetlengthmacro\mdf@Py%
           {\mdf@Py-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
%
      \ifbool{mdf@shadow}
         {\path[mdfshadow,mdfcorners](O) rectangle (P);}{}%
%
     \begin{scope}[use as bounding box]
      \mdf@test@ltrb{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)--cycle}}{}%
%
      \mdf@test@ltb{\mdf@tikzbox@tfl{(P|-O)--(O)--(O|-P)--(P)}}{}%
      \mdf@test@trb{\mdf@tikzbox@tfl{(O|-P)--(P)--(P|-O)--(O)}}{}%
      \mdf@test@ltr{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)}}{}%
      \mdf@test@lrb{\mdf@tikzbox@tfl{(P-|O)--(O)--(O-|P)--(P)}}{}%
%
      \mdf@test@lb{\mdf@tikzbox@otl{(P|-O)--(O)--(O|-P)}%
                                 {(P)--(P|-O)[mdfcorners]--(O)--(O|-P)}%
                 }{}%
      \mdf@test@rb{\mdf@tikzbox@otl{(P)--(P|-O)--(O)}%
                                 {(O|-P)--(P)[mdfcorners]--(P|-O)--(O)}%
                 }{}% 
      \mdf@test@tr{\mdf@tikzbox@otl{(O-|P)--(P)--(P-|O)}%
                                 {(O)--(O|-P)[mdfcorners]--(P)--(P|-O)}%
                 }{}%
      \mdf@test@lt{\mdf@tikzbox@otl{(O)--(O|-P)--(P)}%
                                 {(P|-O)--(O)[mdfcorners]--(O|-P)--(P)}%
                 }{}%
      \mdf@test@lr{\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@tb{\mdf@tikzbox@otl{(O)--(O-|P)(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
%
      \mdf@test@l{\mdf@tikzbox@otl{(O)--(O|-P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@r{\mdf@tikzbox@otl{(O-|P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@t{\mdf@tikzbox@otl{(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@b{\mdf@tikzbox@otl{(O)--(O-|P)}%
                                 {(O)rectangle(P)}%
                 }{}%
%
      \mdf@test@noline{\path[mdfbackground,mdfcorners](O)rectangle(P);}{}%
%
        %Frametitlebackground
          \drawbrackgroundframetitle@single
%
      \node[mdfbox]at(\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@one};%output
     \end{scope}
     %HIER KOMMT EIN WEITERES MAKRO
     \mdf@singleextra
     \mdfcreateextratikz
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@single{%
 \ifdefempty{\mdf@frametitle}{}{%
   \drawbrackgroundframetitle@@single%
 }%
}%
\def\drawbrackgroundframetitle@@single{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@topline}{%
         \pgfmathsetlengthmacro\mdf@Py%
            {\mdf@Py-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
            {\mdf@Py-\mdfframetitleboxtotalheight}
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@putbox@first}
%  Output of the first breakable contents.
%    \begin{macrocode}
\def\drawbrackgroundframetitle@first{%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@topline}{%
         \pgfmathsetlengthmacro\mdf@Py%
            {\mdf@Py-\mdf@innerlinewidth@length-.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
     }%
     {%
      \ifdefempty{\mdf@frametitle}{}%
        {%
         \ifdimgreater{\mdfboundingboxheight}{\mdfframetitleboxtotalheight}%
         {%
          \drawbrackgroundframetitle@@first
          \pgfmathsetlength{\global\mdfframetitleboxtotalheight}{-\p@}%
         }{\mdf@PackageWarning%
              {You got a page break inside the frame title\MessageBreak
               Currently this isn't well supported}%
           \drawbrackgroundframetitle@@first
           \pgfmathsetlength{\global\mdfframetitleboxtotalheight}%
                            {\mdfframetitleboxtotalheight
                                    -\mdfboundingboxheight
                             -\mdf@innerlinewidth@length
                             -0.5\mdf@middlelinewidth@length%
                             +\mdf@frametitlebelowskip@length
                             +\mdf@splitbottomskip@length
                             +\mdf@splittopskip@length
                             +\dp\strutbox%
                            }%
          }%
        }%
     }%
 }%
}%
%
\def\drawbrackgroundframetitle@@first{%
 \begin{scope}%background frame title
        \ifbool{mdf@leftline}{%
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@topline}{%
         \pgfmathsetlengthmacro\mdf@Py%
            {\mdf@Py-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {max(0,\mdf@Py-\mdfframetitleboxtotalheight)}
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}%
}%
%
\def\mdf@putbox@first{%
  \ifvoid\mdf@splitbox@two
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@two}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax}%
    \advance\mdfboundingboxheight by \mdf@innertopmargin@length\relax%
    \advance\mdfboundingboxheight by \mdf@splitbottomskip@length\relax%
    \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
    %\ifdimequal{\pagegoal}{\maxdimen}{\enlargethispage{\baselineskip}}{}% ???
    \ifdimgreater{\pagegoal-\maxdimen}{0pt}{}{\enlargethispage{\baselineskip}}%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]
      \pgfmathsetlengthmacro\mdf@Ax{+\mdf@innerleftmargin@length}%
      \pgfmathsetlengthmacro\mdf@Ay{+\mdf@splitbottomskip@length}%
      \pgfmathsetlengthmacro\mdf@Ox{+0pt}%
      \pgfmathsetlengthmacro\mdf@Oy{+0pt}%
      \pgfmathsetlengthmacro\mdf@Px{+\mdfboundingboxwidth}%
      \pgfmathsetlengthmacro\mdf@Py{+\mdfboundingboxheight}%
      \ifbool{mdf@leftline}
        {%
         \pgfmathsetlengthmacro\mdf@Ax%
            {\mdf@Ax+\mdf@outerlinewidth@length+%
             \mdf@middlelinewidth@length+\mdf@innerlinewidth@length}%
         \pgfmathsetlengthmacro\mdf@Ox%
           {\mdf@Ox+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
        }{}%
      \ifbool{mdf@rightline}{%
          \pgfmathsetlengthmacro\mdf@Px%
           {\mdf@Px-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
      \ifbool{mdf@topline}{%
          \pgfmathsetlengthmacro\mdf@Py%
           {\mdf@Py-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
%%
     \ifbool{mdf@everyline}{%
      \ifbool{mdf@bottomline}%
        {%
         \pgfmathsetlengthmacro\mdf@Ay%
            {\mdf@Ay+\mdf@outerlinewidth@length+\mdf@middlelinewidth@length%
              +\mdf@innerlinewidth@length}%
         \pgfmathsetlengthmacro\mdf@Oy%
           {\mdf@Oy+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
        }{}%
     }{}%
%%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}
       {\path[mdfshadow] (O) -- (O|-P) to[mdfcorners] (P) -- (P|-O) -- (O);}{}%
     \begin{scope}[use as bounding box]
%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
      \mdf@test@ltrb{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)--cycle}}{}%
      \mdf@test@ltb{\mdf@tikzbox@tfl{(P|-O)--(O)--(O|-P)--(P)}}{}%
      \mdf@test@trb{\mdf@tikzbox@tfl{(O|-P)--(P)--(P|-O)--(O)}}{}%
      \mdf@test@ltr{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)}}{}%
      \mdf@test@lrb{\mdf@tikzbox@tfl{(P-|O)--(O)--(O-|P)--(P)}}{}%
      \mdf@test@lb{\mdf@tikzbox@otl{(P|-O)--(O)--(O|-P)}%
                                 {(P)--(P|-O)[mdfcorners]--(O)--(O|-P)}%
                 }{}%
      \mdf@test@rb{\mdf@tikzbox@otl{(P)--(P|-O)--(O)}%
                                 {(O|-P)--(P)[mdfcorners]--(P|-O)--(O)}%
                 }{}%
      \mdf@test@tr{\mdf@tikzbox@otl{(O-|P)--(P)--(P-|O)}%
                                 {(O)--(O|-P)[mdfcorners]--(P)--(P|-O)}%
                 }{}%
      \mdf@test@lt{\mdf@tikzbox@otl{(O)--(O|-P)--(P)}%
                                 {(P|-O)--(O)[mdfcorners]--(O|-P)--(P)}%
                 }{}%
      \mdf@test@lr{\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@tb{\mdf@tikzbox@otl{(O)--(O-|P)(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@l{\mdf@tikzbox@otl{(O)--(O|-P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@r{\mdf@tikzbox@otl{(O-|P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@t{\mdf@tikzbox@otl{(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@b{\mdf@tikzbox@otl{(O)--(O-|P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@noline{\path[mdfbackground,mdfcorners](O)rectangle(P);}{}%
    }{
      \ifboolexpr{test {\mdf@test@ltrb} or test {\mdf@test@ltr}}%
        {\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)}}%
        {}%
      \ifboolexpr{test {\mdf@test@ltb} or test {\mdf@test@lt}}%
        {%
         \mdf@tikzbox@otl{(O)--(O|-P)--(P)}
                         {(P|-O)--(O)[mdfcorners]--(O|-P)--(P)}
        }%
        {}%
      \ifboolexpr{test {\mdf@test@trb} or test {\mdf@test@tr}}%
        {%
         \mdf@tikzbox@otl{(O-|P)--(P)--(P-|O)}%
                         {(O)--(O|-P)[mdfcorners]--(P)--(P|-O)}}%
        {}%
      \ifboolexpr{test {\mdf@test@lrb} or test {\mdf@test@lr}}%
        {\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}{(O)rectangle(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@tb} or test {\mdf@test@t}}%
        {\mdf@tikzbox@otl{(O|-P)--(P)}{(O)rectangle(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@lb} or test {\mdf@test@l}}%
        {\mdf@tikzbox@otl{(O)--(O|-P)}{(O)rectangle(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@rb} or test {\mdf@test@r}}%
        {\mdf@tikzbox@otl{(O-|P)--(P)}{(O)rectangle(P)}}%
        {}%
      \mdf@test@b{\path[mdfbackground](O)rectangle(P);}{}%
      \mdf@test@noline{\path[mdfbackground,mdfcorners]%
                             (O)--(O|-P)--(P)--(P|-O);}%
                      {}%
    }
%%%%%%%%%%%%
      \drawbrackgroundframetitle@first
      \node[mdfbox]at(\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@two};%
     \end{scope}
     %HIER KOMMT EIN WEITERES MAKRO
     \mdf@firstextra
     \mdfcreateextratikz%
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@putbox@middle}
%  Output of the middle breakable contents.
%    \begin{macrocode}
\def\drawbrackgroundframetitle@middle{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@everyline}%
          {%
           \ifbool{mdf@topline}{%
            \pgfmathsetlengthmacro\mdf@Py%
               {\mdf@Py-\mdf@innerlinewidth@length%
                       -.5\mdf@middlelinewidth@length}
            }{}%
          }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
     }%
     {%
      \ifdimless{\mdfframetitleboxtotalheight}{\z@} 
        {}%
        {%
         \drawbrackgroundframetitle@@middle%
         \pgfmathsetlength{\global\mdfframetitleboxtotalheight}{-\p@}%
        }%
     }%
   }%
}%
\def\drawbrackgroundframetitle@@middle{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{%
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
         \path[mdfframetitlebackground,rounded corners=\z@]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}%
%
\def\drawbrackgroundframetitle@@middle{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
         \path[mdfframetitlebackground,rounded corners=\z@]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}%
\def\mdf@putbox@middle{%
  \ifvoid\mdf@splitbox@two
  \else%
        \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@two}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax}%
    \advance\mdfboundingboxheight by \mdf@splitbottomskip@length\relax%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]
      \pgfmathsetlengthmacro\mdf@Ax{+\mdf@innerleftmargin@length}%
      \pgfmathsetlengthmacro\mdf@Ay{+\mdf@splitbottomskip@length}%
      \pgfmathsetlengthmacro\mdf@Ox{+0pt}%
      \pgfmathsetlengthmacro\mdf@Oy{+0pt}%
      \pgfmathsetlengthmacro\mdf@Px{+\mdfboundingboxwidth}%
      \pgfmathsetlengthmacro\mdf@Py{+\mdfboundingboxheight}%
      \ifbool{mdf@leftline}%
        {%
         \pgfmathsetlengthmacro\mdf@Ax%
            {\mdf@Ax+\mdf@outerlinewidth@length+%
             \mdf@middlelinewidth@length+\mdf@innerlinewidth@length}%
         \pgfmathsetlengthmacro\mdf@Ox%
           {\mdf@Ox+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
         }{}%
      \ifbool{mdf@rightline}%
         {%
          \pgfmathsetlengthmacro\mdf@Px%
           {\mdf@Px-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
         }{}%
%%
     \ifbool{mdf@everyline}{%
      \ifbool{mdf@bottomline}%
        {%
         \pgfmathsetlengthmacro\mdf@Ay%
            {\mdf@Ay+\mdf@outerlinewidth@length+\mdf@middlelinewidth@length%
              +\mdf@innerlinewidth@length}%
         \pgfmathsetlengthmacro\mdf@Oy%
           {\mdf@Oy+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
        }{}%
      \ifbool{mdf@topline}%
        {%
         \pgfmathsetlengthmacro\mdf@Py%
           {\mdf@Py-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
     }{}%
%%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}
         {\path[mdfshadow](O) rectangle (P);}{}%
     \begin{scope}[use as bounding box]
%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
      \mdf@test@ltrb{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)--cycle}}{}%
      \mdf@test@ltb{\mdf@tikzbox@tfl{(P|-O)--(O)--(O|-P)--(P)}}{}%
      \mdf@test@trb{\mdf@tikzbox@tfl{(O|-P)--(P)--(P|-O)--(O)}}{}%
      \mdf@test@ltr{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)}}{}%
      \mdf@test@lrb{\mdf@tikzbox@tfl{(P-|O)--(O)--(O-|P)--(P)}}{}%
      \mdf@test@lb{\mdf@tikzbox@otl{(P|-O)--(O)--(O|-P)}%
                                 {(P)--(P|-O)[mdfcorners]--(O)--(O|-P)}%
                 }{}%
      \mdf@test@rb{\mdf@tikzbox@otl{(P)--(P|-O)--(O)}%
                                 {(O|-P)--(P)[mdfcorners]--(P|-O)--(O)}%
                 }{}%
      \mdf@test@tr{\mdf@tikzbox@otl{(O-|P)--(P)--(P-|O)}%
                                 {(O)--(O|-P)[mdfcorners]--(P)--(P|-O)}%
                 }{}%
      \mdf@test@lt{\mdf@tikzbox@otl{(O)--(O|-P)--(P)}%
                                 {(P|-O)--(O)[mdfcorners]--(O|-P)--(P)}%
                 }{}%
      \mdf@test@lr{\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@tb{\mdf@tikzbox@otl{(O)--(O-|P)(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@l{\mdf@tikzbox@otl{(O)--(O|-P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@r{\mdf@tikzbox@otl{(O-|P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@t{\mdf@tikzbox@otl{(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@b{\mdf@tikzbox@otl{(O)--(O-|P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@noline{\path[mdfbackground,mdfcorners](O)rectangle(P);}{}%
    }{
      \ifboolexpr{bool {mdf@leftline} and bool {mdf@rightline}}%
               {\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}{(O)rectangle(P)}}{}%
      \ifboolexpr{bool {mdf@leftline} and not (bool {mdf@rightline})}%
               {\mdf@tikzbox@otl{(O)--(O|-P)}{(O)rectangle(P)}}{}%
      \ifboolexpr{not (bool {mdf@leftline}) and bool {mdf@rightline}}%
               {\mdf@tikzbox@otl{(P)--(P|-O)}{(O)rectangle(P)}}{}%
      \ifboolexpr{not (bool {mdf@leftline}) and not (bool {mdf@rightline})}%
               {\path[mdfbackground](O)rectangle(P);}{}%
    }
%%%%%%%%
      \drawbrackgroundframetitle@middle
      \node[mdfbox]at(\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@two};%
     \end{scope}
     \mdf@middleextra
     %HIER KOMMT EIN WEITERES MAKRO
     \mdfcreateextratikz
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@putbox@second}
%  Output of the last breakable contents.
%    \begin{macrocode}
\def\drawbrackgroundframetitle@second{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@everyline}%
          {%
           \ifbool{mdf@topline}{%
            \pgfmathsetlengthmacro\mdf@Py%
               {\mdf@Py-\mdf@innerlinewidth@length%
                       -.5\mdf@middlelinewidth@length}
            }{}%
          }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
         \path[mdfframetitlebackground]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}      
     }%
     {%
       \ifdimless{\mdfframetitleboxtotalheight}{\z@} 
         {}%
         {%
          \drawbrackgroundframetitle@@second%
         }%
     }%
   }%
}%
%
\def\drawbrackgroundframetitle@@second{%
       \begin{scope}%background frame title
        \ifbool{mdf@leftline}{
         \pgfmathsetlengthmacro\mdf@Ox%
            {\mdf@Ox+\mdf@innerlinewidth@length+0.5\mdf@middlelinewidth@length}
         }{}%
        \ifbool{mdf@rightline}{%
         \pgfmathsetlengthmacro\mdf@Px%
            {\mdf@Px-\mdf@innerlinewidth@length-0.5\mdf@middlelinewidth@length}
         }{}%
         \pgfmathsetlengthmacro\mdf@Fy
             {\mdf@Py-\mdfframetitleboxtotalheight}
         \path[mdfframetitlebackground,rounded corners=\z@]
             (\mdf@Ox,\mdf@Fy) -- (\mdf@Ox,\mdf@Py)%
             --(\mdf@Px,\mdf@Py) --(\mdf@Px,\mdf@Fy);
       \end{scope}
}%
\def\mdf@putbox@second{%
  \ifvoid\mdf@splitbox@one
  \else%
        \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \mdf@tikz@settings%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
    \advance\mdfboundingboxheight by \mdf@innerbottommargin@length\relax%
    \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
    \mdf@makebox@in[\mdfboundingboxwidth]{%
    \null%
    \begin{tikzpicture}[remember picture]
      \pgfmathsetlengthmacro\mdf@Ax{+\mdf@innerleftmargin@length}%
      \pgfmathsetlengthmacro\mdf@Ay{+\mdf@innerbottommargin@length}%
      \pgfmathsetlengthmacro\mdf@Ox{+0pt}%
      \pgfmathsetlengthmacro\mdf@Oy{+0pt}%
      \pgfmathsetlengthmacro\mdf@Px{+\mdfboundingboxwidth}%
      \pgfmathsetlengthmacro\mdf@Py{+\mdfboundingboxheight}%
      \ifbool{mdf@leftline}%
        {%
         \pgfmathsetlengthmacro\mdf@Ax%
            {\mdf@Ax+\mdf@outerlinewidth@length+%
             \mdf@middlelinewidth@length+\mdf@innerlinewidth@length}%
          \pgfmathsetlengthmacro\mdf@Ox%
           {\mdf@Ox+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
         }{}%
      \ifbool{mdf@rightline}%
         {%
          \pgfmathsetlengthmacro\mdf@Px%
           {\mdf@Px-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
         }{}%
      \ifbool{mdf@bottomline}%
         {%
          \pgfmathsetlengthmacro\mdf@Ay%
            {\mdf@Ay+\mdf@outerlinewidth@length+%
             \mdf@middlelinewidth@length+\mdf@innerlinewidth@length}%
          \pgfmathsetlengthmacro\mdf@Oy%
           {\mdf@Oy+\mdf@outerlinewidth@length+0.5\mdf@middlelinewidth@length}%
         }{}%
%%
     \ifbool{mdf@everyline}{%
      \ifbool{mdf@topline}%
        {%
         \pgfmathsetlengthmacro\mdf@Py%
           {\mdf@Py-\mdf@outerlinewidth@length-0.5\mdf@middlelinewidth@length}%
        }{}%
     }{}%
%%
      \coordinate(O)at(\mdf@Ox,\mdf@Oy);%
      \coordinate(P)at(\mdf@Px,\mdf@Py);%
      \ifbool{mdf@shadow}
         {%
           \path[mdfshadow]  (O|-P) to[mdfcorners] (O) 
                                    to[mdfcorners] (P|-O) -- (P) -- (O|-P);%
         }{}%
     \begin{scope}[use as bounding box]
%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
      \mdf@test@ltrb{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)--cycle}}{}%
      \mdf@test@ltb{\mdf@tikzbox@tfl{(P|-O)--(O)--(O|-P)--(P)}}{}%
      \mdf@test@trb{\mdf@tikzbox@tfl{(O|-P)--(P)--(P|-O)--(O)}}{}%
      \mdf@test@ltr{\mdf@tikzbox@tfl{(O)--(O|-P)--(P)--(P|-O)}}{}%
      \mdf@test@lrb{\mdf@tikzbox@tfl{(P-|O)--(O)--(O-|P)--(P)}}{}%
      \mdf@test@lb{\mdf@tikzbox@otl{(P|-O)--(O)--(O|-P)}%
                                 {(P)--(P|-O)[mdfcorners]--(O)--(O|-P)}%
                 }{}%
      \mdf@test@rb{\mdf@tikzbox@otl{(P)--(P|-O)--(O)}%
                                 {(O|-P)--(P)[mdfcorners]--(P|-O)--(O)}%
                 }{}%
      \mdf@test@tr{\mdf@tikzbox@otl{(O-|P)--(P)--(P-|O)}%
                                 {(O)--(O|-P)[mdfcorners]--(P)--(P|-O)}%
                 }{}%
      \mdf@test@lt{\mdf@tikzbox@otl{(O)--(O|-P)--(P)}%
                                 {(P|-O)--(O)[mdfcorners]--(O|-P)--(P)}%
                 }{}%
      \mdf@test@lr{\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@tb{\mdf@tikzbox@otl{(O)--(O-|P)(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@l{\mdf@tikzbox@otl{(O)--(O|-P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@r{\mdf@tikzbox@otl{(O-|P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@t{\mdf@tikzbox@otl{(O|-P)--(P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@b{\mdf@tikzbox@otl{(O)--(O-|P)}%
                                 {(O)rectangle(P)}%
                 }{}%
      \mdf@test@noline{\path[mdfbackground,mdfcorners](O)rectangle(P);}{}%
    }{%
      \ifboolexpr{test {\mdf@test@ltrb} or test {\mdf@test@lrb}}%
        {\mdf@tikzbox@tfl{(P-|O)--(O)--(O-|P)--(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@ltb} or test {\mdf@test@lb}}%
        {%
         \mdf@tikzbox@otl{(P-|O)--(O)--(O-|P)}%
                         {(P)--(P|-O)[mdfcorners]--(O)--(O|-P)}%
        }%
        {}%
      \ifboolexpr{test {\mdf@test@trb} or test {\mdf@test@rb}}%
        {%
         \mdf@tikzbox@otl{(P)--(P|-O)--(O)}%
                         {(O|-P)--(P)[mdfcorners]--(P|-O)--(O)}%
        }%
        {}%
      \ifboolexpr{test {\mdf@test@ltr} or test {\mdf@test@lr}}%
        {\mdf@tikzbox@otl{(O)--(O|-P)(P)--(P|-O)}{(O)rectangle(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@tb} or test {\mdf@test@b}}%
        {\mdf@tikzbox@otl{(O)--(O-|P)}{(O)rectangle(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@lt} or test {\mdf@test@l}}%
        {\mdf@tikzbox@otl{(O)--(O|-P)}{(O)rectangle(P)}}%
        {}%
      \ifboolexpr{test {\mdf@test@tr} or test {\mdf@test@r}}%
        {\mdf@tikzbox@otl{(O-|P)--(P)}{(O)rectangle(P)}}%
        {}%
      \mdf@test@t{\path[mdfbackground,mdfcorners](O|-P)--(O)--(O-|P)--(P);}{}%
      \mdf@test@noline{\path[mdfbackground,mdfcorners]%
                            (O|-P)--(O)--(O-|P)--(P);}%
                      {}%
    }%
      \drawbrackgroundframetitle@second
      \node[mdfbox] at (\mdf@Ax,\mdf@Ay){\box\mdf@splitbox@one};%
     \end{scope}
      \mdf@secondextra
     %HIER KOMMT EIN WEITERES MAKRO
     \mdfcreateextratikz
    \end{tikzpicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
 \endinput
%    \end{macrocode}
% \iffalse
%</mdframetikz>
% \fi
%
%
%\iffalse
%    \begin{macrocode}
%<*mdframepstricks>
%    \end{macrocode}
%\fi
% \subsection{The Explanation of md-frame-2.mdf / md-frame-3.mdf}
%    \begin{macrocode}
%% Style file for mdframed for package option `framemethod=default`
%% 
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%%
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
%
%    \end{macrocode}
%
% \begin{macro}{mdframedIIpackagename,mdf@frameIIdate@svn}
% local settings
%    \begin{macrocode}
\def\mdframedIIpackagename{md-frame-2}
\def\mdf@frameIIdate@svn$#1: #2 #3 #4-#5-#6 #7 #8${#4/#5/#6\space }
\ProvidesFile{md-frame-2.mdf}%
      [\mdf@frameIIdate@svn$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $ %
       \mdversion: \mdframedIIpackagename]
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@ptlength@to@pscode,ptTps}
% Command to calculate a latex length to postscript
%    \begin{macrocode}
\def\mdf@ptlength@to@pscode#1{\pst@number{#1} \pst@number\psxunit div }
\def\mdf@ptlength@to@pscode@length#1{%
  \pst@number{\csname mdf@#1@length\endcsname}
  \pst@number\psxunit div\space}
\let\ptTps\mdf@ptlength@to@pscode\relax
\let\ptTpsL\mdf@ptlength@to@pscode@length\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdfbackgroundstyle,mdflinestyle,^^A
%               mdfframetitlerule,mdfframetitlebackground}
% background and line settings for pstricks
%    \begin{macrocode}
\def\mdfpstricks@settings{%expand by \addtopsstyle
  \newpsstyle{mdfbackgroundstyle}% 
    {linecolor=\mdf@backgroundcolor,fillstyle=solid,%
     fillcolor=\mdf@backgroundcolor,linestyle=none,%
    ,dimen=middle,%
    }%
%
  \newpsstyle{mdfframetitlebackgroundstyle}{%
     linecolor=\mdf@frametitlebackgroundcolor,
     fillcolor=\mdf@frametitlebackgroundcolor,
     fillstyle=solid,linestyle=none,
     linearc=\ifdimgreater{\mdf@roundcorner@length%
                          -\mdf@innerlinewidth@length%
                          -.5\mdf@middlelinewidth@length}
                         {\z@}{\dimexpr\mdf@roundcorner@length%
                          -\mdf@innerlinewidth@length%
                          -.5\mdf@middlelinewidth@length}{\z@},
  }
%
  \newpsstyle{mdfouterlinestyle}{linestyle=none}%
  \ifdimgreater{\mdf@outerlinewidth@length}{\z@}
    {\newpsstyle{mdfouterlinestyle}{%
      linecolor=\mdf@outerlinecolor,%
      linewidth=\dimexpr2\mdf@outerlinewidth@length
                        +\mdf@middlelinewidth@length\relax,
      dimen=middle,
      }}{}%
%
  \newpsstyle{mdfinnerlinestyle}{linestyle=none}%
  \ifdimgreater{\mdf@innerlinewidth@length}{\z@}%
    {\newpsstyle{mdfinnerlinestyle}{%
      linecolor=\mdf@innerlinecolor,%
      linewidth=\dimexpr2\mdf@innerlinewidth@length
                        +\mdf@middlelinewidth@length\relax,
      dimen=middle,
      }}{}%
%
  \newpsstyle{mdfmiddlelinestyle}{linestyle=none}%
  \newpsstyle{mdfshadow}{shadow=true,shadowcolor=\mdf@shadowcolor,
                         shadowsize=\mdf@shadowsize@length}%
  \ifdimgreater{\mdf@middlelinewidth@length}{\z@}%
    {\newpsstyle{mdfmiddlelinestyle}{%
      linewidth=\mdf@middlelinewidth@length,%
      linecolor=\mdf@middlelinecolor,dimen=middle
      }}{}%
\mdfpstricks@appendsettings
}%
%
\newrobustcmd*\mdf@pstricksbox@fl[2]{%four lines
  \psframe[style=mdfouterlinestyle](#1)(#2)%aussen=3mm
  \psframe[style=mdfbackgroundstyle](#1)(#2)%Hintergrund
  \psclip{\psframe[style=mdfmiddlelinestyle](#1)(#2)}
   \psframe[style=mdfinnerlinestyle](#1)(#2)%innere=3mm
  \endpsclip
  \psframe[style=mdfmiddlelinestyle](#1)(#2)%mittlere=2mm
  }%
\newrobustcmd*\mdf@pstricksbox@tl[1]{%three lines
  \psline[style=mdfouterlinestyle]#1%aussen=3mm
  \psline[style=mdfbackgroundstyle]#1%Hintergrund
  \psclip{\psline[style=mdfmiddlelinestyle]#1}
    \psline[style=mdfinnerlinestyle]#1%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle]#1%mittlere=2mm
  }%
\newrobustcmd*\mdf@pstricksbox@tcl[2]{%two combined lines
%%#1 background comple
%%#2 line path
  \psline[style=mdfouterlinestyle]#2%aussen=3mm
  \psline[style=mdfbackgroundstyle]#2%Hintergrund
  \psclip{\pscustom[linestyle=none]{
          \psline[style=mdfmiddlelinestyle]#2
          \psline[linestyle=none,linearc=0pt]#1}
          }
    \psframe[style=mdfbackgroundstyle,linearc=0pt](mdf@O)(mdf@P)%Hintergrund
    \psline[style=mdfinnerlinestyle]#2%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle]#2%mittlere=2mm
}%
\newrobustcmd*\mdf@pstricksbox@tncl[2]{%two not combined lines
 \begingroup
  \psset{linearc=0pt}
  \psline[style=mdfouterlinestyle](mdf@O)#1%aussen=3mm
  \psline[style=mdfouterlinestyle](mdf@P)#2%aussen=3mm
  \psclip{
    \pscustom[linestyle=none]{%
        \psline[style=mdfmiddlelinestyle](mdf@O)#1%mittlere=2mm
        \psline[linestyle=none](mdf@O)#2
        \psline[style=mdfmiddlelinestyle](mdf@P)#2%mittlere=2mm
        \psline[linestyle=none](mdf@P)#1
      }%
    }%
    \psframe[style=mdfbackgroundstyle,linearc=0pt](mdf@O)(mdf@P)%Hintergrund
    \psline[style=mdfinnerlinestyle](mdf@O)#1%innere=3mm
    \psline[style=mdfinnerlinestyle](mdf@P)#2%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle](mdf@O)#1%mittlere=2mm
  \psline[style=mdfmiddlelinestyle](mdf@P)#2%mittlere=2mm
 \endgroup
}%
\newrobustcmd*\mdf@pstricksbox@ol[1]{%one line
 \begingroup
  \psset{linearc=0pt}
  \psline[style=mdfouterlinestyle]#1%aussen=3mm
  \psline[style=mdfbackgroundstyle]#1%Hintergrund
  \psclip{\pscustom[linestyle=none]{
          \psline[style=mdfmiddlelinestyle]#1
          \psframe[linestyle=none,fillstyle=none,dimen=inner](mdf@O)(mdf@P)
          }}
    \psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)
    \psline[style=mdfinnerlinestyle]#1%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle]#1%mittlere=2mm
 \endgroup%
}%
           
%
\newpsstyle{mdfframetitlerule}{%
   linecolor=\mdf@frametitlerulecolor,%
   fillcolor=\mdf@frametitlerulecolor,%
   fillstyle=solid,dimen=outer,%
}
%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdf@put@frametitlerule}
% frametitlerule with pstricks
%    \begin{macrocode}
\def\mdf@@frametitlerule{%
  \ifbool{mdf@frametitlerule}{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{%
     \begingroup%
     \begin{pspicture}(0,0)(0,\mdf@frametitlerulewidth@length)
      \psframe[style=mdfframetitlerule]%
              (!\ptTpsL{innerleftmargin} neg 0)%
              (!\ptTpsL{innerrightmargin}
                \ptTps{\mdfframetitleboxwidth} add 
                \ptTpsL{frametitlerulewidth})
     \end{pspicture}
     \endgroup}%
   }%
  }{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{}
   }%
  }%
  \iftoggle{mdf@notfirstframetitle}%
    {%
      \par\unskip\vskip\mdf@splittopskip@length%
    }%
    {%
      \par\unskip\vskip\mdf@innertopmargin@length%
    }%
}%
%
%
%
%
%
% \begin{macro}{mdfsubtitle}
% Definition of the command \Cmd{mdfsubtitle}. Starting with the definition of
% the tikz style for the rule above the subtitle.
%    \begin{macrocode}%
\newpsstyle{mdfsubtitleaboverule}{%
   linecolor=\mdf@subtitleabovelinecolor,
   fillcolor=\mdf@subtitleabovelinecolor,
   fillstyle=solid,dimen=outer,%
}
%    \end{macrocode}
% Definition of the default style of rule below the subtitle.
%    \begin{macrocode}
\newpsstyle{mdfsubtitlebelowrule}{%
   linecolor=\mdf@subtitlebelowlinecolor,
   fillcolor=\mdf@subtitlebelowlinecolor,
   fillstyle=solid,dimen=outer,%
}
%    \end{macrocode}
% Definition of the default style of the background of the subtitle.
%    \begin{macrocode}
\newpsstyle{mdfsubtitlebackground}{%
   linecolor=\mdf@subtitlebackgroundcolor,
   fillcolor=\mdf@subtitlebackgroundcolor,
   fillstyle=solid,linestyle=none,
}
%    \end{macrocode}
% Definition of the command \Cmd{mdfsubtitle}. 
%    \begin{macrocode}
\newrobustcmd\mdfsubtitle[2][]%
{%
%    \end{macrocode}
% Make everything local.
%    \begin{macrocode}
 \begingroup
  \penalty-9995%set a breakpoint before the subtitle
%     \end{macrocode}
% Inside the title we don't need any \Cmd{parindent}. Next set the options of
% the optional argument of \Cmd{mdfsubtitle}.
%     \begin{macrocode}
  \parindent\z@\relax%
  \mdfsetup{#1}%only for subtitle options
%      \end{macrocode}
% Save the complete subtitle inside the save box \Cmd{z@}.
%      \begin{marcocode}
  \setbox\z@=\vbox{\mdf@subtitlefont{#2}\relax}%
%      \end{macrocode}
% Compute the width of the current line including the inner left margin and
% inner right margin (using \Cmd{dimen@}. In the nest step the height and the
% depth of the save box will be saved in \Cmd{dimen@i}.
%      \begin{marcocode}
  \dimen@=\linewidth\relax%
   \advance\dimen@ by \mdf@innerleftmargin@length\relax%
   \advance\dimen@ by \mdf@innerrightmargin@length\relax%
  \dimen@i=\mdf@subtitleinneraboveskip@length\relax%
   \advance\dimen@i by \mdf@subtitleinnerbelowskip@length\relax%
   \advance\dimen@i by \ht\z@\relax%
   \advance\dimen@i by \dp\z@\relax%
%      \end{macrocode}
% Test if rules should be drawn. otherwise set the line width to 0\,pt.
%      \begin{macrocode}
  \ifbool{mdf@subtitleaboveline}{}%
         {\mdfsetup{subtitleabovelinewidth=\z@}}%
  \ifbool{mdf@subtitlebelowline}{}%
         {\mdfsetup{subtitlebelowlinewidth=\z@}}%
%      \end{macrocode}
% Start a new line with the given skip \Opt{subtitleaboveskip}.
%      \begin{macrocode}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleaboveskip@length
%      \end{macrocode}
% Drawing the above line of the subtitle.
%      \begin{macrocode}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \begin{pspicture}(0,0)(\dimen@,\mdf@subtitleabovelinewidth@length)
      \ifbool{mdf@subtitleaboveline}%
       {%
       \psframe[style=mdfsubtitleaboverule]%
              (0,0)(\dimen@,\mdf@subtitleabovelinewidth@length)%
       }{}
     \end{pspicture}
   \endgroup%
  }%
%      \end{macrocode}
% space between rule above and subtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleinneraboveskip@length
%      \end{macrocode}
% output of subtitle with a backround. Must think about the \Cmd{hspace}
% combination.
%      \begin{macrocde}
  \hspace*{-\mdf@innerleftmargin@length}%
     \begin{pspicture}%
        (0,0)%
        (0,\ht\z@)
       \psframe[style=mdfsubtitlebackground]%
              (0,\dimexpr-\dp\z@-\mdf@subtitleinnerbelowskip@length\relax)%
              (\dimen@,\dimen@i)
     \end{pspicture}
  \hspace*{+\mdf@innerleftmargin@length}%
  \box\z@\relax%
%      \end{macrocode}
% Skip after subtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitleinnerbelowskip@length
%      \end{macrocode}
% Draw rule below of the subtitle.
%      \begin{macrocde}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \begin{pspicture}(0,0)(\dimen@,\mdf@subtitlebelowlinewidth@length)
      \ifbool{mdf@subtitlebelowline}%
       {%
       \psframe[style=mdfsubtitlebelowrule]%
              (0,0)(\dimen@,\mdf@subtitlebelowlinewidth@length)%
       }{}%
     \end{pspicture}
   \endgroup%
  }%
%      \end{macrocode}
% Last skip and set a non breaking point.
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subtitlebelowskip@length
  \penalty 9995
 \endgroup
}

%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{mdfsubsubtitle}
% Definition of the command \Cmd{mdfsubsubtitle}. Starting with the definition of
% the tikz style for the rule above the subsubtitle.
%    \begin{macrocode}%
\newpsstyle{mdfsubsubtitleaboverule}{%
   linecolor=\mdf@subtitleabovelinecolor,
   fillcolor=\mdf@subtitleabovelinecolor,
   fillstyle=solid,dimen=outer,%
}
%    \end{macrocode}
% Definition of the default style of rule below the subtitle.
%    \begin{macrocode}
\newpsstyle{mdfsubsubtitlebelowrule}{%
   linecolor=\mdf@subtitlebelowlinecolor,
   fillcolor=\mdf@subtitlebelowlinecolor,
   fillstyle=solid,dimen=outer,%
}
%    \end{macrocode}
% Definition of the default style of the background of the subtitle.
%    \begin{macrocode}
\newpsstyle{mdfsubsubtitlebackground}{%
   linecolor=\mdf@subtitlebackgroundcolor,
   fillcolor=\mdf@subtitlebackgroundcolor,
   fillstyle=solid,linestyle=none,
}
%    \end{macrocode}
% Definition of the command \Cmd{mdfsubsubtitle}. 
%    \begin{macrocode}
\newrobustcmd\mdfsubsubtitle[2][]%
{%
%    \end{macrocode}
% Make everything local.
%    \begin{macrocode}
 \begingroup
  \penalty-9995%set a breakpoint before the subsubtitle
%     \end{macrocode}
% Inside the title we don't need any \Cmd{parindent}. Next set the options of
% the optional argument of \Cmd{mdfsubsubtitle}.
%     \begin{macrocode}
  \parindent\z@\relax%
  \mdfsetup{#1}%only for subsubtitle options
%      \end{macrocode}
% Save the complete subsubtitle inside the save box \Cmd{z@}.
%      \begin{marcocode}
  \setbox\z@=\vbox{\mdf@subsubtitlefont{#2}\relax}%
%      \end{macrocode}
% Compute the width of the current line including the inner left margin and
% inner right margin (using \Cmd{dimen@}. In the nest step the height and the
% depth of the save box will be saved in \Cmd{dimen@i}.
%      \begin{marcocode}
  \dimen@=\linewidth\relax%
   \advance\dimen@ by \mdf@innerleftmargin@length\relax%
   \advance\dimen@ by \mdf@innerrightmargin@length\relax%
  \dimen@i=\mdf@subsubtitleinneraboveskip@length\relax%
   \advance\dimen@i by \mdf@subsubtitleinnerbelowskip@length\relax%
   \advance\dimen@i by \ht\z@\relax%
   \advance\dimen@i by \dp\z@\relax%
%      \end{macrocode}
% Test if rules should be drawn. otherwise set the line width to 0\,pt.
%      \begin{macrocode}
  \ifbool{mdf@subsubtitleaboveline}{}%
         {\mdfsetup{subsubtitleabovelinewidth=\z@}}%
  \ifbool{mdf@subsubtitlebelowline}{}%
         {\mdfsetup{subsubtitlebelowlinewidth=\z@}}%
%      \end{macrocode}
% Start a new line with the given skip \Opt{subsubtitleaboveskip}.
%      \begin{macrocode}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleaboveskip@length
%      \end{macrocode}
% Drawing the above line of the subsubtitle.
%      \begin{macrocode}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \begin{pspicture}(0,0)(\dimen@,\mdf@subsubtitleabovelinewidth@length)
      \ifbool{mdf@subsubtitleaboveline}%
       {%
       \psframe[style=mdfsubsubtitleaboverule]%
              (0,0)(\dimen@,\mdf@subsubtitleabovelinewidth@length)%
       }{}
     \end{pspicture}
   \endgroup%
  }%
%      \end{macrocode}
% space between rule above and subsubtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleinneraboveskip@length
%      \end{macrocode}
% output of subsubtitle with a backround. Must think about the \Cmd{hspace}
% combination.
%      \begin{macrocde}
  \hspace*{-\mdf@innerleftmargin@length}%
   \begin{pspicture}(0,-\dp\z@)(0,\dimen@i
     \begin{pspicture}%
        (0,0)%
        (0,\ht\z@)
       \psframe[style=mdfsubsubtitlebackground]%
              (0,\dimexpr-\dp\z@-\mdf@subsubtitleinnerbelowskip@length\relax)%
              (\dimen@,\dimen@i)
     \end{pspicture}
  \hspace*{+\mdf@innerleftmargin@length}%
  \box\z@\relax%
%      \end{macrocode}
% Skip after subsubtitle
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitleinnerbelowskip@length
%      \end{macrocode}
% Draw rule below of the subsubtitle.
%      \begin{macrocde}
  \rlap%
  {%
   \hspace*{-\mdf@innerleftmargin@length}%
   \begingroup%
     \begin{pspicture}(0,0)(\dimen@,\mdf@subsubtitlebelowlinewidth@length)
      \ifbool{mdf@subsubtitlebelowline}%
       {%
       \psframe[style=mdfsubsubtitlebelowrule]%
              (0,0)(\dimen@,\mdf@subsubtitlebelowlinewidth@length)%
       }{}%
     \end{pspicture}
   \endgroup%
  }%
%      \end{macrocode}
% Last skip and set a non breaking point.
%      \begin{macrocde}
  \par\unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%
  \vskip\mdf@subsubtitlebelowskip@length
  \penalty 9995
 \endgroup
}

%    \end{macrocode}
% \end{macro}
%
%
%
%
%
%
%
%
%
%
% \begin{macro}{mdf@putbox@single}
% Single output
%    \begin{macrocode}
% Info zu den verwendeten Punkten:
% O ist die untere linke Ecke der Mitte der middleline
% P ist die obere rechte Ecke der Mitte der middleline
% A ist der Punkt fuer den anchor (d.h. die untere linke Ecke) der Ausgabebox
\def\mdf@putbox@single{%
  \ifvoid\mdf@splitbox@one\relax
  \else%
   \mdf@makebox@out{%
     \mdf@makeboxalign@left%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
    \advance\mdfboundingboxheight by \mdf@innerbottommargin@length\relax%
    \advance\mdfboundingboxheight by \mdf@innertopmargin@length\relax%
    \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%
   \setlength\mdftotallinewidth{\dimexpr\mdf@innerlinewidth@length%
                                +\mdf@middlelinewidth@length
                                +\mdf@outerlinewidth@length\relax}%
     \psset{unit=1truecm}%
     \mdf@makebox@in[\mdfboundingboxwidth]{%
       \null%
       \begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)
        \mdfpstricks@settings%
        \psset{linearc=\mdf@roundcorner@length,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        \pnode(\mdf@innerleftmargin@length,\mdf@innerbottommargin@length)
              {mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}%
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
         }{}%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}%
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}%
         }{}%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
       \ifbool{mdf@shadow}
           {\psframe[style=mdfshadow](mdf@O)(mdf@P)}{}
%        \psclip{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}
%         }
        %Frametitlebackground
          \drawbrackgroundframetitle@single
        %output%
          \rput[bl](mdf@A){\box\mdf@splitbox@one}
%          \psdot(mdf@A)\uput[90](mdf@A){mdf at A}
%          \psdot(mdf@P)\uput[90](mdf@P){mdf at P}
%          \psdot(mdf@O)\uput[90](mdf@O){mdf at O}
%
%         \endpsclip
          \mdf@singleextra
       \end{pspicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@single{%
 \ifdefempty{\mdf@frametitle}{}{%
   \drawbrackgroundframetitle@@single%
 }%
}%
\def\drawbrackgroundframetitle@@single{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@topline}{%
       \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
               -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@putbox@first}
% First output
%    \begin{macrocode}
\def\mdf@putbox@first{%
  \ifvoid\mdf@splitbox@two
  \else%
   \mdf@makebox@out{%
     \mdf@makeboxalign@left%
     %\ifbool{mdf@leftline}{\hspace*{\mdf@middlelinewidth@length}}{}%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@two}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax}%
    \advance\mdfboundingboxheight by \mdf@innertopmargin@length\relax%
    \advance\mdfboundingboxheight by \mdf@splitbottomskip@length\relax%
    \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
     \psset{linearc=\mdf@roundcorner@length,cornersize=absolute}%
     \expandafter\psset\expandafter{\mdf@psset@local}%
     \mdf@makebox@in[\mdfboundingboxwidth]{%
      \null%
      \psset{unit=1truecm}%
      \ifdimgreater{\mdfboundingboxheight}{\vsize}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\vsize)}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)}
        \mdfpstricks@settings%
        \psset{linearc=\mdf@roundcorner@length,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        \pnode(\mdf@innerleftmargin@length,\mdf@splitbottomskip@length){mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}
         }{}%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
%%%%%%%%%%%
      \ifbool{mdf@everyline}{%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}%
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}%
         }{}%
      }{}%
%%%%%%%%%%
       \ifbool{mdf@shadow}
           {\pscustom[style=mdfshadow,linestyle=none]{%
                \psline[linejoin=2,linecap=1,]%
                       (mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)%
                \psline[linejoin=2,linecap=1,linearc=\z@]%
                       (mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)
                \closedshadow
                }
           }{}
%      \psclip{
%%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }{%
      %Four or Three lines
       \ifboolexpr{test {\mdf@test@ltrb} or test {\mdf@test@ltr}}%
        {\mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}%
        {}%
      %two combinded lines      
      \ifboolexpr{test {\mdf@test@ltb} or test {\mdf@test@lt}}
                 {\mdf@pstricksbox@tcl{(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                                      {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@trb} or test {\mdf@test@tr}}%
                 {\mdf@pstricksbox@tcl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                                      {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
      %two not combinded lines   
      \ifboolexpr{test {\mdf@test@lrb} or test {\mdf@test@lr}}%
                 {\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}}{}
      %single line
      \ifboolexpr{test {\mdf@test@tb} or test {\mdf@test@t}}%
                 {\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@lb} or test {\mdf@test@l}}%
                 {\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@rb} or test {\mdf@test@r}}%
                 {\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
      %no line
      \mdf@test@b{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
      \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }%
%     }
     %Frametitlebackground
       \drawbrackgroundframetitle@first
      %output%
       \rput[bl](mdf@A){\box\mdf@splitbox@two}
%       \psdot(mdf@A)\uput[90](mdf@A){mdf at A}
%       \psdot(mdf@P)\uput[90](mdf@P){mdf at P}
%       \psdot(mdf@O)\uput[90](mdf@O){mdf at O}
%     \endpsclip
      \mdf@firstextra
     \end{pspicture}
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@first{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
      \drawbrackgroundframetitle@@@first
     }%
     {%
      \ifdimgreater{\mdfboundingboxheight}{\mdfframetitleboxtotalheight}%
        {%
         \drawbrackgroundframetitle@@first
         \global\mdfframetitleboxtotalheight=-\p@%
        }{\mdf@PackageWarning{You got a page break inside the frame 
                              title\MessageBreak
                              Currently this isn't well supported}%
          \drawbrackgroundframetitle@@first
          \global\mdfframetitleboxtotalheight=\dimexpr
                          \mdfframetitleboxtotalheight
                          -\mdfboundingboxheight
                          -\mdf@innerlinewidth@length
                          -0.5\mdf@middlelinewidth@length%
                          +\mdf@frametitlebelowskip@length
                          +\mdf@splitbottomskip@length
                          +\mdf@splittopskip@length
                          +\dp\strutbox\relax%
        }%
     }%
  }%
}%
\def\drawbrackgroundframetitle@@first{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@topline}{%
       \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
               -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
       }{}%
 \ifdimgreater{\mdfboundingboxheight}{\mdfframetitleboxtotalheight}
    {\nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}}%
    {\nodexn{(mdf@O)}{mdf@F}}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\drawbrackgroundframetitle@@@first{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@topline}{%
       \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
               -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@putbox@middle}
% Middle output
%    \begin{macrocode}
\def\mdf@putbox@middle{%
  \ifvoid\mdf@splitbox@two
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
%     \ifbool{mdf@leftline}{\hspace*{\mdf@middlelinewidth@length}}{}%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@two}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax}%
    \advance\mdfboundingboxheight by \mdf@splitbottomskip@length\relax%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
     \psset{unit=1truecm}%
     \mdf@makebox@in[\mdfboundingboxwidth]{%
      \null%
      \ifdimgreater{\mdfboundingboxheight}{\vsize}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\vsize)}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)}
        \mdfpstricks@settings%
        \psset{linearc=0pt,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        %%%%
        \pnode(\mdf@innerleftmargin@length,\mdf@splitbottomskip@length){mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}
         }{}%
      %%
%%%%%%%%%%%
      \ifbool{mdf@everyline}{%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}%
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}%
         }{}%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
       }{}%
%%%%%%%%%%
      %%
      \ifbool{mdf@shadow}
         {\psframe[style=mdfshadow](mdf@O)(mdf@P)}{}
%%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl{(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }{%
      \ifboolexpr{bool {mdf@leftline} and bool {mdf@rightline}}%
               {\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}}{}%
      \ifboolexpr{bool {mdf@leftline} and not (bool {mdf@rightline})}%
               {\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}%
      \ifboolexpr{not (bool {mdf@leftline}) and bool {mdf@rightline}}%
               {\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}%
      \ifboolexpr{not (bool {mdf@leftline}) and not (bool {mdf@rightline})}%
               {\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
    }%
     %Frametitlebackground
       \drawbrackgroundframetitle@middle
      %output%
       \rput[bl](mdf@A){\box\mdf@splitbox@two}
       %\psdot(mdf@A)\uput[90](mdf@A){mdf at A}
       %\psdot(mdf@P)\uput[90](mdf@P){mdf at P}
       %\psdot(mdf@O)\uput[90](mdf@O){mdf at O}
      \mdf@middleextra
     \end{pspicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@middle{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
      \drawbrackgroundframetitle@@@middle
     }%
     {%
      \ifdimless{\mdfframetitleboxtotalheight}{\z@}
        {}%
        {%
          \drawbrackgroundframetitle@@middle
          \global\mdfframetitleboxtotalheight=-\p@\relax%
        }%
     }%
 }%
}%
\def\drawbrackgroundframetitle@@middle{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle,linearc=\z@]%
         (mdf@O|mdf@F)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\drawbrackgroundframetitle@@@middle{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@everyline}%
    {%
     \ifbool{mdf@topline}{%
        \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
                -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
        }{}%
     }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{mdf@putbox@second}
% Last output
%    \begin{macrocode}
\def\mdf@putbox@second{
  \ifvoid\mdf@splitbox@one
  \else%
   \mdf@makebox@out{%
     \mdf@makeboxalign@left%
%     \ifbool{mdf@leftline}{\hspace*{\mdf@middlelinewidth@length}}{}%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
    \advance\mdfboundingboxheight by \mdf@innerbottommargin@length\relax%
    \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
     \psset{unit=1truecm}%
   \mdf@makebox@in[\mdfboundingboxwidth]{%
       \null%
       \begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)
        \mdfpstricks@settings%
        \psset{linearc=\mdf@roundcorner@length,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        \pnode(\mdf@innerleftmargin@length,\mdf@innerbottommargin@length)
              {mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}
         }{}%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}
         }{}%
%%%%%%%%%%%
      \ifbool{mdf@everyline}{%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
       }{}%
%%%%%%%%%%
      %%
       \ifbool{mdf@shadow}
           {\pscustom[style=mdfshadow,linestyle=none]{%
                \psline[linejoin=2,linecap=1,](mdf@O|mdf@P)(mdf@O)%
                                              (mdf@P|mdf@O)(mdf@P)%
                \psline[linejoin=2,linecap=1,linearc=\z@](mdf@O|mdf@P)(mdf@P)
                \closedshadow
                }
           }{}
%%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }{%
      %Four + Three
      \ifboolexpr{test {\mdf@test@ltrb} or test {\mdf@test@lrb}}%
        {\mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
     %Two combinded
      \ifboolexpr{test {\mdf@test@ltb} or test {\mdf@test@lb}}%
        {\mdf@pstricksbox@tcl{(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                             {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
      \ifboolexpr{test {\mdf@test@trb} or test {\mdf@test@rb}}%
        {\mdf@pstricksbox@tcl{(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                             {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
     %Two not combinded
      \ifboolexpr{test {\mdf@test@ltr} or test {\mdf@test@lr}}%
        {\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}}{}%
     %one line
      \ifboolexpr{test {\mdf@test@tb} or test {\mdf@test@b}}%
        {\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
      \ifboolexpr{test {\mdf@test@lt} or test {\mdf@test@l}}%
        {\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@tr} or test {\mdf@test@r}}%
        {\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
     %no line
      \mdf@test@t{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
      \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
    }%
     %Frametitlebackground
       \drawbrackgroundframetitle@second
      %output%
       \rput[bl](mdf@A){\box\mdf@splitbox@one}
      \mdf@secondextra
%       \psdot(mdf@A)\uput[90](mdf@A){mdf at A}
%       \psdot(mdf@P)\uput[90](mdf@P){mdf at P}
%       \psdot(mdf@O)\uput[90](mdf@O){mdf at O}
     \end{pspicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@second{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
      \drawbrackgroundframetitle@@@second
     }%
     {%
      \ifdimless{\mdfframetitleboxtotalheight}{\z@}
        {}{%
          \drawbrackgroundframetitle@@second
        }%
     }%
 }%
}%
\def\drawbrackgroundframetitle@@second{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle,linearc=\z@]%
         (mdf@O|mdf@F)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\drawbrackgroundframetitle@@@second{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@everyline}%
    {%
     \ifbool{mdf@topline}{%
        \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
                -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
        }{}%
     }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
 \endinput
%eof
%    \end{macrocode}
% \iffalse
%</mdframepstricks>
% \fi
%
%
%
%\iffalse
%    \begin{macrocode}
%<*mdframed-example-default>
%    \end{macrocode}
%\fi
%
% \section{The file mdframed-example-default}
%
%    \begin{macrocode}
%Documenation of the package mdframed
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
\setcounter{errorcontextlines}{999}
\documentclass[parskip=false,english,11pt]{ltxmdf}
\GetIdInfo$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
          {documentation of mdframed}

\usepackage{showexpl}
\lstset{style=lstltxmdf,explpreset={pos=b,rframe={}},}

\newcommand\Loadedframemethod{default}
\usepackage[framemethod=\Loadedframemethod]{mdframed}

\title{The \Pack{mdframed} package}
\subtitle{Examples for \Opt{framemethod=\Loadedframemethod}}
\author{\href{mailto:marco.daniel@mada-nada.de}{Marco Daniel}}
\date{\ExplFileDate}
\version{\mdversion}
\introduction{In this document I collect various examples for 
              \Opt{framemethod=\Loadedframemethod}.
              Some presented examples are more or less exorbitant.}

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
        An \textit{inhomogeneous linear} differential equation has the form
         \begin{align}
            L[v ] = f,
         \end{align}
        where $L$ is a linear differential operator, $v$ is
        the dependent variable, and $f$ is a given non-zero
        function of the independent variables alone.
}

\newcounter{examplecount}
\setcounter{examplecount}{0}
\renewcommand\thesubsection{}
\newcommand\Examplesec[1]{%
\stepcounter{examplecount}%
\subsection{Example~\arabic{examplecount}~--~#1\relax}%
}

\begin{document}
\maketitle
\section{Loading}
In the preamble only the package \Pack{mdframed} width the option 
\Opt{framemethod=\Loadedframemethod} is loaded. All other modifications will be
done by \Cmd{mdfdefinestyle} or \Cmd{mdfsetup}.

{\large\color{red!50!black}
\NOTE Every \Cmd{global} inside the examples is necessary to work with the 
package \Pack{showexpl}.}

\section{Examples}
All examples have the following settings:

\begin{tltxmdfexample}
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation
has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is
the dependent variable, and $f$ is a given non-zero
function of the independent variables alone.
}
\end{tltxmdfexample}
\clearpage
\Examplesec{very simple}
\begin{LTXexample}
\global\mdfdefinestyle{exampledefault}{%
     linecolor=red,linewidth=3pt,%
     leftmargin=1cm,rightmargin=1cm
}
\begin{mdframed}[style=exampledefault]
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{hidden line + frame title}
\begin{LTXexample}
\global\mdfapptodefinestyle{exampledefault}{%
 topline=false,rightline=true,bottomline=false}
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}]
\ExampleText
\end{mdframed}
\end{LTXexample}
\clearpage

\Examplesec{colored frame title}
\begin{LTXexample}

\global\mdfapptodefinestyle{exampledefault}{%
   rightline=true,innerleftmargin=10,innerrightmargin=10,
   frametitlerule=true,frametitlerulecolor=green,
   frametitlebackgroundcolor=yellow,
   frametitlerulewidth=2pt}
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}]
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{framed picture which is centered}
\begin{LTXexample}
\begin{mdframed}[userdefinedwidth=6cm,align=center,
                 linecolor=blue,linewidth=4pt]
\IfFileExists{donald-duck.jpg}%
 {\includegraphics[width=\linewidth]{donald-duck}}%
 {\rule{\linewidth}{4cm}}%
\end{mdframed}
\end{LTXexample}

\clearpage
\Examplesec{Theorem environments}
\begin{LTXexample}
\mdfdefinestyle{theoremstyle}{%
     linecolor=red,linewidth=2pt,%
     frametitlerule=true,%
     frametitlebackgroundcolor=gray!20,
     innertopmargin=\topskip,
   }
\mdtheorem[style=theoremstyle]{definition}{Definition}
\begin{definition}
\ExampleText
\end{definition}
\begin{definition}[Inhomogeneous linear]
\ExampleText
\end{definition}
\begin{definition*}[Inhomogeneous linear]
\ExampleText
\end{definition*}
\end{LTXexample}


\clearpage
\Examplesec{theorem with separate header and the help of TikZ (complex)}
\begin{LTXexample}
\newcounter{theo}[section]
\newenvironment{theo}[1][]{%
 \stepcounter{theo}%
  \ifstrempty{#1}%
  {\mdfsetup{%
    frametitle={%
       \tikz[baseline=(current bounding box.east),outer sep=0pt]
        \node[anchor=east,rectangle,fill=blue!20]
        {\strut Theorem~\thetheo};}}
  }%
  {\mdfsetup{%
     frametitle={%
       \tikz[baseline=(current bounding box.east),outer sep=0pt]
        \node[anchor=east,rectangle,fill=blue!20]
        {\strut Theorem~\thetheo:~#1};}}%
   }%
   \mdfsetup{innertopmargin=10pt,linecolor=blue!20,%
             linewidth=2pt,topline=true,
             frametitleaboveskip=\dimexpr-\ht\strutbox\relax,}
   \begin{mdframed}[]\relax%
   }{\end{mdframed}}
\begin{theo}[Inhomogeneous Linear]
\ExampleText
\end{theo}

\begin{theo}
\ExampleText
\end{theo}
\end{LTXexample}

\clearpage
\Examplesec{hide only a part of a line}
The example below is inspired by the following post on StackExchange 
\href{http://tex.stackexchange.com/questions/24101/theorem-decorations^^A
      -that-stay-with-theorem-environment}%
     {Theorem decorations that stay with theorem environment}
\begin{LTXexample}
\makeatletter
\newlength{\interruptlength}
\setlength{\interruptlength}{2.5ex}
\newrobustcmd\overlaplines{%
 \appto\mdf@frame@leftline@single{%
   \llap{\color{white}%
      \rule[\dimexpr-\mdfboundingboxdepth+\interruptlength\relax]%
           {\mdf@middlelinewidth@length}%
           {\dimexpr\mdfboundingboxtotalheight%
            \ifbool{mdf@topline}{+\mdf@middlelinewidth@length}{}
            -2\interruptlength\relax}%
   }%
 }%
 \appto\mdf@frame@rightline@single{%
   \rlap{\color{white}%
      \hspace*{\mdfboundingboxwidth}%
      \hspace*{\mdf@innerrightmargin@length}%
      \rule[\dimexpr-\mdfboundingboxdepth%
            +\interruptlength\relax]%
           {\mdf@middlelinewidth@length}%
           {\dimexpr\mdfboundingboxtotalheight%
            +\ifbool{mdf@topline}{\mdf@middlelinewidth@length}{0pt}
            -2\interruptlength\relax}%
   }%
 }%
}
\makeatother
\overlaplines

\begin{mdframed}[linecolor=blue,linewidth=8pt]
\ExampleText
\end{mdframed}
\end{LTXexample}
\end{document}
 \endinput
%    \end{macrocode}
%
%\iffalse
%    \begin{macrocode}
%</mdframed-example-default>
%    \end{macrocode}
%\fi
%
%\iffalse
%    \begin{macrocode}
%<*mdframed-example-tikz>
%    \end{macrocode}
%\fi
%
% \section{The file mdframed-example-tikz}
%
%    \begin{macrocode}
%Documenation of the package mdframed
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
\setcounter{errorcontextlines}{999}
\documentclass[parskip=false,english,11pt]{ltxmdf}
\GetIdInfo$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
          {documentation of mdframed}


\usepackage{showexpl}
\lstset{style=lstltxmdf,explpreset={pos=b,rframe={}},}

\newcommand\Loadedframemethod{TikZ}
\usepackage[framemethod=\Loadedframemethod]{mdframed}

\title{The \Pack{mdframed} package}
\subtitle{Examples for \Opt{framemethod=\Loadedframemethod}}
\author{\href{mailto:marco.daniel@mada-nada.de}{Marco Daniel}}
\date{\ExplFileDate}
\version{\mdversion}
\introduction{In this document I collect various examples for
              \Opt{framemethod=\Loadedframemethod}.
              Some presented examples are more or less exorbitant.}

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
        An \textit{inhomogeneous linear} differential equation has the form
         \begin{align}
            L[v ] = f,
         \end{align}
        where $L$ is a linear differential operator, $v$ is
        the dependent variable, and $f$ is a given non-zero
        function of the independent variables alone.
}

\newcounter{examplecount}
\setcounter{examplecount}{0}
\renewcommand\thesubsection{}
\newcommand\Examplesec[1]{%
\stepcounter{examplecount}%
\subsection{Example~\arabic{examplecount}~--~#1\relax}%
}

\begin{document}
\maketitle
\section{Loading}
In the preamble only the package \Pack{mdframed} width the option 
\Opt{framemethod=\Loadedframemethod} is loaded. All other modifications will be
done by \Cmd{mdfdefinestyle} or \Cmd{mdfsetup}.

{\large\color{red!50!black}
\NOTE Every \Cmd{global} inside the examples is necessary to work with the 
package \Pack{showexpl}.}

\section{Examples}
All examples have the following settings:

\begin{tltxmdfexample}
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation
has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is
the dependent variable, and $f$ is a given non-zero
function of the independent variables alone.
}
\end{tltxmdfexample}
\clearpage
\ExampleText{round corner}
\begin{LTXexample}
\global\mdfdefinestyle{exampledefault}{%
     outerlinewidth=5pt,innerlinewidth=0pt,
     outerlinecolor=red,roundcorner=5pt
}
\begin{mdframed}[style=exampledefault]
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{hidden line + frame title}
\begin{LTXexample}
\global\mdfapptodefinestyle{exampledefault}{%
 topline=false,leftline=false,}
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}]
\ExampleText
\end{mdframed}
\end{LTXexample}
\clearpage
\Examplesec{framed picture which is centered}
\begin{LTXexample}
\begin{mdframed}[userdefinedwidth=6cm,align=center,
                 linecolor=blue,middlelinewidth=4pt,roundcorner=5pt]
\IfFileExists{donald-duck.jpg}%
 {\includegraphics[width=\linewidth]{donald-duck}}%
 {\rule{\linewidth}{4cm}}%
\end{mdframed}
\end{LTXexample}

\Examplesec{Gimmick}
\begin{LTXexample}
\mdfsetup{splitbottomskip=0.8cm,splittopskip=0cm,
          innerrightmargin=2cm,innertopmargin=1cm,%
          innerlinewidth=2pt,outerlinewidth=2pt,
          middlelinewidth=10pt,backgroundcolor=red,
          linecolor=blue,middlelinecolor=gray,
          tikzsetting={draw=yellow,line width=3pt,%
                    dashed,%
                    dash pattern= on 10pt off 3pt},
          rightline=false,bottomline=false}
\begin{mdframed}
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{complex example with TikZ}

\begin{tltxmdfexample}
\tikzstyle{titregris} =
     [draw=gray, thick, fill=white, shading = exersicetitle, %
      text=gray, rectangle, rounded corners, right,minimum height=.7cm]

\pgfdeclarehorizontalshading{exersicebackground}{100bp}
          {color(0bp)=(green!40); color(100bp)=(black!5)}

\pgfdeclarehorizontalshading{exersicetitle}{100bp}
          {color(0bp)=(red!40);color(100bp)=(black!5)}

\newcounter{exercise}
\renewcommand*\theexercise{Exercise~n\arabic{exercise}}
\makeatletter
\def\mdf@@exercisepoints{}%new mdframed key:
\define@key{mdf}{exercisepoints}{%
    \def\mdf@@exercisepoints{#1}
}
\makeatother

\mdfdefinestyle{exercisestyle}{%
  outerlinewidth=1pt,innerlinewidth=0pt,
  roundcorner=2pt,linecolor=gray,
  tikzsetting={shading = exersicebackground},
  innertopmargin=1.2\baselineskip,
  skipabove={\dimexpr0.5\baselineskip+\topskip\relax},
  needspace=3\baselineskip,
  frametitlefont=\sffamily\bfseries,
  settings={\global\stepcounter{exercise}},
  singleextra={%
        \node[titregris,xshift=1cm] at (P-|O) %
           {~\mdf@frametitlefont{\theexercise}~};
      \ifdefempty{\mdf@@exercisepoints}%
      {}%
      {\node[titregris,left,xshift=-1cm] at (P)%
        {~\mdf@frametitlefont{\mdf@@exercisepoints points}~};}%
   },
  firstextra={%
        \node[titregris,xshift=1cm] at (P-|O) %
           {~\mdf@frametitlefont{\theexercise}~};
      \ifdefempty{\mdf@@exercisepoints}%
      {}%
      {\node[titregris,left,xshift=-1cm] at (P)%
        {~\mdf@frametitlefont{\mdf@@exercisepoints points}~};}%
   },
}
\begin{mdframed}[style=exercisestyle,]
\ExampleText
\end{mdframed}

\begin{mdframed}[style=exercisestyle,exercisepoints=10]
\ExampleText
\end{mdframed}
\end{tltxmdfexample}
\clearpage
\Examplesec{Theorem environments}
\begin{LTXexample}
\mdfdefinestyle{theoremstyle}{%
     linecolor=red,linewidth=2pt,%
     frametitlerule=true,%
     apptotikzsetting={\tikzset{mdfframetitlebackground/.append style={%
                         shade,left color=white, right color=blue!20}}},
     frametitlerulecolor=green!60,
     frametitlerulewidth=1pt,
     innertopmargin=\topskip,
   }
\mdtheorem[style=theoremstyle]{definition}{Definition}
\begin{definition}[Inhomogeneous linear]
\ExampleText
\end{definition}
\begin{definition*}[Inhomogeneous linear]
\ExampleText
\end{definition*}
\end{LTXexample}

\end{document}
 \endinput
%    \end{macrocode}
%
%\iffalse
%    \begin{macrocode}
%</mdframed-example-tikz>
%    \end{macrocode}
%\fi
%
%\iffalse
%    \begin{macrocode}
%<*mdframed-example-pstricks>
%    \end{macrocode}
%\fi
%
% \section{The file mdframed-example-pstricks}
%
%    \begin{macrocode}
%Documenation of the package mdframed
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
\setcounter{errorcontextlines}{999}
\documentclass[parskip=false,english,11pt]{ltxmdf}
\GetIdInfo$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
          {documentation of mdframed}

\lstDeleteShortInline{|}
\newcommand\Loadedframemethod{PSTricks}
\usepackage[framemethod=\Loadedframemethod]{mdframed}

\usepackage{showexpl}
\lstset{style=lstltxmdf,explpreset={pos=b,rframe={}},}

\title{The \Pack{mdframed} package}
\subtitle{Examples for \Opt{framemethod=\Loadedframemethod}}
\author{\href{mailto:marco.daniel@mada-nada.de}{Marco Daniel}}
\date{\ExplFileDate}
\version{\mdversion}
\introduction{In this document I collect various examples for 
              \Opt{framemethod=\Loadedframemethod}.
              Some presented examples are more or less exorbitant.}

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
        An \textit{inhomogeneous linear} differential equation has the form
         \begin{align}
            L[v ] = f,
         \end{align}
        where $L$ is a linear differential operator, $v$ is
        the dependent variable, and $f$ is a given non-zero
        function of the independent variables alone.
}

\newcounter{examplecount}
\setcounter{examplecount}{0}
\renewcommand\thesubsection{}
\newcommand\Examplesec[1]{%
\stepcounter{examplecount}%
\subsection{Example~\arabic{examplecount}~--~#1\relax}%
}

\begin{document}
\maketitle
\section{Loading}
In the preamble only the package \Pack{mdframed} width the option 
\Opt{framemethod=\Loadedframemethod} is loaded. All other modifications will be
done by \Cmd{mdfdefinestyle} or \Cmd{mdfsetup}.

{\large\color{red!50!black}
\NOTE Every \Cmd{global} inside the examples is necessary to work with the 
package \Pack{showexpl}.}
X
\section{Examples}
All examples have the following settings:

\begin{tltxmdfexample}
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation
has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is
the dependent variable, and $f$ is a given non-zero
function of the independent variables alone.
}
\end{tltxmdfexample}
\clearpage

\Examplesec{very simple}
\begin{LTXexample}
\global\mdfdefinestyle{exampledefault}{%
     linecolor=red,middlelinewidth=3pt,%
     leftmargin=1cm,rightmargin=1cm
}
\begin{mdframed}[style=exampledefault,roundcorner=5]
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{hidden line + frame title}
\begin{LTXexample}
\global\mdfapptodefinestyle{exampledefault}{%
 topline=false,rightline=false,bottomline=false,
 frametitlerule=true,innertopmargin=6pt,
 outerlinewidth=6pt,outerlinecolor=blue,
 pstricksappsetting={\addtopsstyle{mdfouterlinestyle}{linestyle=dashed}},
 innerlinecolor=yellow,innerlinewidth=5pt}%
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}]
\ExampleText
\end{mdframed}
\end{LTXexample}

\clearpage

\Examplesec{Dash Lines}
\begin{LTXexample}
\global\mdfdefinestyle{exampledefault}{%
   pstrickssetting={linestyle=dashed,},linecolor=red,linewidth=5pt}
\begin{mdframed}[style=exampledefault,]
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{Double Lines}
\begin{LTXexample}
\global\mdfdefinestyle{exampledefault}{%
   pstrickssetting={doubleline=true,doublesep=6pt},
   linecolor=red,linewidth=5pt,middlelinewidth=4pt}
\begin{mdframed}[style=exampledefault,]
\ExampleText
\end{mdframed}
\end{LTXexample}

\Examplesec{Shadow frame}
\begin{LTXexample}
\newmdenv[shadow=true,
          shadowsize=11pt,
          linewidth=8pt,
          frametitlerule=true,
          roundcorner=10pt,
          ]{myshadowbox}
\begin{myshadowbox}[frametitle={Inhomogeneous linear}]
\ExampleText
\end{myshadowbox}
\end{LTXexample}
\end{document}
 \endinput
%    \end{macrocode}
%
%\iffalse
%    \begin{macrocode}
%</mdframed-example-pstricks>
%    \end{macrocode}
%\fi
%
%\iffalse
%    \begin{macrocode}
%<*mdframed-example-texsx>
%    \end{macrocode}
%\fi
%
% \section{The file mdframed-example-texsx}

%    \begin{macrocode}
%Documenation of the package mdframed
%%$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
\setcounter{errorcontextlines}{999}
\documentclass[parskip=false,english,11pt,lipsum=true]{ltxmdf}
\GetIdInfo$Id: mdframed.dtx 426 2012-06-02 12:18:56Z marco $
          {documentation of mdframed}


\usepackage{showexpl}
\lstset{style=lstltxmdf,explpreset={pos=b,rframe={}},}
\usepackage{tikz}
\usetikzlibrary{calc,arrows,shadings,shadows}
\newcommand\Loadedframemethod{tikz}
\usepackage[framemethod=\Loadedframemethod]{mdframed}

\title{The \Pack{mdframed} package}
\subtitle{Examples for \Opt{framemethod=\Loadedframemethod}}
\author{\href{mailto:marco.daniel@mada-nada.de}{Marco Daniel}}
\date{\ExplFileDate}
\version{\mdversion}
\introduction{In this document I collect various examples for 
              \Opt{framemethod=\Loadedframemethod}.
              Some presented examples are more or less exorbitant.}

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
        An \textit{inhomogeneous linear} differential equation has the form
         \begin{align}
            L[v ] = f,
         \end{align}
        where $L$ is a linear differential operator, $v$ is
        the dependent variable, and $f$ is a given non-zero
        function of the independent variables alone.
}

\newcounter{examplecount}
\setcounter{examplecount}{0}
\renewcommand\thesubsection{}
\newcommand\Examplesec[1]{%
\stepcounter{examplecount}%
\subsection{Example~\arabic{examplecount}~--~#1\relax}%
}

\begin{document}
\maketitle
\section{Loading}
In the preamble only the package \Pack{mdframed} width the option 
\Opt{framemethod=\Loadedframemethod} is loaded. All other modifications will be
done by \Cmd{mdfdefinestyle} or \Cmd{mdfsetup}.

{\large\color{red!50!black}
\NOTE Every \Cmd{global} inside the examples is necessary to work with the 
package \Pack{showexpl}.}

\section{Examples}
All examples have the following settings:

\begin{tltxmdfexample}
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation
has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is
the dependent variable, and $f$ is a given non-zero
function of the independent variables alone.
}
\end{tltxmdfexample}
\clearpage
\Examplesec{Package listings}
The example below is inspired by the following post on StackExchange 
\href{http://tex.stackexchange.com/questions/27673/background-overflows-^^A
      when-using-rounded-corners-for-listings-package-listings}%
     {Background overflows when using rounded corners for listings 
      (package: `listings`)}

Here the solution which can be decorate as usual.

\begin{tltxmdfexample}[moretexcs={BeforeBeginEnvironment,AfterEndEnvironment},
                       morekeywords={lstlisting}]
\BeforeBeginEnvironment{lstlisting}{%
    \begin{mdframed}[<modification>]%
    \vspace{-0.7em}}
\AfterEndEnvironment{lstlisting}{%
    \vspace{-0.5em}%
    \end{mdframed}}
\end{tltxmdfexample}

With the new command \Cmd{surroundwithmdframed} you can use
\begin{tltxmdfexample}[moretexcs={BeforeBeginEnvironment,AfterEndEnvironment},
                       morekeywords={lstlisting}]
\surroundwithmdframed{listings}
\end{tltxmdfexample}

\Examplesec{Package multicol}
How I wrote in \enquote{Known Problems} you can't combine \Pack{multicol}  with
\Pack{mdframed}. In a simple way without any breaks you can use:
\begin{LTXexample}
\begin{multicols}{2}
\lipsum[1]
\begin{mdframed}
\ExampleText
\end{mdframed}
\lipsum[2]
\end{multicols}
\end{LTXexample}
\clearpage
\twocolumn[\Examplesec{Working in twocolumn mode}]
\begin{tltxmdfexample}
\twocolumn[%
  \Examplesec{Working in
          twocolumn mode}]
\lipsum[1]\lipsum[2]
\begin{mdframed}[%
   leftmargin=10pt,%
   rightmargin=10pt,%
   linecolor=red,
   backgroundcolor=yellow]
\ExampleText
\end{mdframed}
\lipsum[2]
\end{tltxmdfexample}
\lipsum[1]\lipsum[2]
\begin{mdframed}[leftmargin=10pt,%
                 rightmargin=10pt,%
                 linecolor=red,
                 backgroundcolor=yellow]
\ExampleText
\end{mdframed}
\lipsum[2]
\clearpage
\onecolumn
\Examplesec{Working inside enumerate}
\begin{LTXexample}
Text Text Text Text Text Text Text Text
\begin{enumerate}
\item in the following \ldots
      \begin{mdframed}[linecolor=blue,linewidth=2]
         \ExampleText
      \end{mdframed}
\item \lipsum[2]
\end{enumerate}
Text Text Text Text Text Text
\end{LTXexample}
\clearpage
\Examplesec{Position a specific symbol at a line}
\begin{LTXexample}
\tikzset{
  warningsymbol/.style={
      rectangle,draw=red,
      fill=white,scale=1,
      overlay}}
\mdfdefinestyle{warning}{%
 hidealllines=true,leftline=true,
 skipabove=12,skipbelow=12pt,
 innertopmargin=0.4em,%
 innerbottommargin=0.4em,%
 innerrightmargin=0.7em,%
 rightmargin=0.7em,%
 innerleftmargin=1.7em,%
 leftmargin=0.7em,%
 middlelinewidth=.2em,%
 linecolor=red,%
 fontcolor=red,%
 firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\$};},%
 secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\$};},%
 middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\$};},%
 singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\$};},%
}
\begin{mdframed}[style=warning]
\ExampleText
\end{mdframed}
\end{LTXexample}

\clearpage
\Examplesec{digression-environement inspired by Tobias Weh}
\begin{lstlisting}
\usetikzlibrary{calc,arrows}
\tikzset{
   excursus arrow/.style={%
      line width=2pt,
      draw=gray!40,
      rounded corners=2ex,
   },
   excursus head/.style={
      fill=white,
      font=\bfseries\sffamily,
      text=gray!80,
      anchor=base west,
   },
}
\mdfdefinestyle{digressionarrows}{%
 singleextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path let \p1=(Q), \p2=(O) in (\x1,{(\y1-\y2)/2}) coordinate (M);
      \path [excursus arrow, round cap-to]
         ($(O)+(5em,0ex)$) -| (M) |- %
         ($(Q)+(12em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
         ++(23em,2ex);
      \node [excursus head] at ($(Q)+(2.5em,-0.75pt)$) {Digression};},
 firstextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path [excursus arrow,-to]
         (O) |- %
         ($(Q)+(12em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
         ++(23em,2ex);
      \node [excursus head] at ($(Q)+(2.5em,-2pt)$) {Digression};},
 secondextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path [excursus arrow,round cap-]
         ($(O)+(5em,0ex)$) -| (Q);},
 middleextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path [excursus arrow]
         (O) -- (Q);},
   middlelinewidth=2.5em,middlelinecolor=white,
   hidealllines=true,topline=true,
   innertopmargin=0.5ex,
   innerbottommargin=2.5ex,
   innerrightmargin=2pt,
   innerleftmargin=2ex,
   skipabove=0.87\baselineskip,
   skipbelow=0.62\baselineskip,
}

\begin{mdframed}[style=digressionarrows]
         \ExampleText
\end{mdframed}
\end{lstlisting}

\tikzset{
   excursus arrow/.style={%
      line width=2pt,
      draw=gray!40,
      rounded corners=2ex,
   },
   excursus head/.style={
      fill=white,
      font=\bfseries\sffamily,
      text=gray!80,
      anchor=base west,
   },
}
\mdfdefinestyle{digressionarrows}{%
 singleextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path let \p1=(Q), \p2=(O) in (\x1,{(\y1-\y2)/2}) coordinate (M);
      \path [excursus arrow, round cap-to]
         ($(O)+(5em,0ex)$) -| (M) |- %
         ($(Q)+(12em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
         ++(23em,2ex);
      \node [excursus head] at ($(Q)+(2.5em,-0.75pt)$) {Digression};},
 firstextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path [excursus arrow,-to]
         (O) |- %
         ($(Q)+(12em,0ex)$) .. controls +(0:16em) and +(185:6em) .. %
         ++(23em,2ex);
      \node [excursus head] at ($(Q)+(2.5em,-2pt)$) {Digression};},
 secondextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path [excursus arrow,round cap-]
         ($(O)+(5em,0ex)$) -| (Q);},
 middleextra={%
      \path let \p1=(P), \p2=(O) in (\x2,\y1) coordinate (Q);
      \path [excursus arrow]
         (O) -- (Q);},
   middlelinewidth=2.5em,middlelinecolor=white,
   hidealllines=true,topline=true,
   innertopmargin=0.5ex,
   innerbottommargin=2.5ex,
   innerrightmargin=2pt,
   innerleftmargin=2ex,
   skipabove=0.87\baselineskip,
   skipbelow=0.62\baselineskip,
}

\begin{mdframed}[style=digressionarrows]
         \ExampleText
\end{mdframed}

\Examplesec{Theorem style shading background}
\begin{LTXexample}
%\usetikzlibrary{shadings,shadows}% loaded in the header
\mdtheorem[%
 apptotikzsetting={\tikzset{mdfbackground/.append style =%
                              {top color=yellow!40!white,
                               bottom color=yellow!80!black},
                            mdfframetitlebackground/.append style =%
                               {top color=purple!40!white,
                                bottom color=purple!80!black}
                           }
                    },
  ,roundcorner=10pt,middlelinewidth=2pt,
  shadow=true,frametitlerule=true,frametitlerulewidth=4pt,
  innertopmargin=10pt,%
  ]{alternativtheorem}{Theorem}
\begin{alternativtheorem}[Inhomogeneous linear]
\ExampleText
\end{alternativtheorem}
\end{LTXexample}
\end{document}
 \endinput
%    \end{macrocode}
%
%\iffalse
%    \begin{macrocode}
%</mdframed-example-texsx>
%    \end{macrocode}
%\fi
%
%
%
% \Finale
%
\endinput


