I apologise in advance because I cannot provide an MWE.
I am writing a book with a custom (Springer) format and I wish to use mdframed
to provide an example environment. I adapted an example from the documentation and came up with this as a first draft:
\documentclass{article}
\usepackage{mdframed}
\usepackage{tikz}
\usepackage{blindtext}
\newcounter{exampl}[section]
\newenvironment{exampl}[1][]{%
\stepcounter{exampl}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=black!10]
{\strut Example~\thesection .\theexampl};},nobreak=false}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=black!10]
{\strut Example~\thesection .\theexampl:~#1};},nobreak=false}%
}%
\mdfsetup{innertopmargin=10pt,linecolor=black!10,nobreak=false,%
linewidth=2pt,topline=true,backgroundcolor=black!05,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax}
\begin{mdframed}[]\relax%
}{\end{mdframed}}
\begin{document}
\section{Introduction}
\blindtext
\blindtext
\blindtext
\begin{exampl}[Lorem ipsum]
\blindtext
\begin{tabular}{cc}
A & Table\\
\end{tabular}
\Blindtext
\end{exampl}
\end{document}
In the MWE provided, the exampl
works fine and uses appropriate page-breaks. However, in the context of the source of the book I'm working on, the same environment will not break.
As per the MWE above, I tried explicitly adding nobreak=false
everywhere to try force the page-break, but to to avail.
I've tried debugging it and working back towards an MWE, but to no avail. I believe it might be something in the custom book template that's causing the problem.
I know that my problem might not be reproducible and thus is not ideal for this site, but I was hoping someone might be able to offer some common reasons as to why an mdframed
environment won't break across pages. I'm hoping for clues to debug the problem.
What are common reasons why page-breaking might stop working in mdframed
?
Any tricks to try force page-breaking again?
framed
package, it breaks across the pages. – skpblack Aug 1 '14 at 19:59mdframed
should also break across pages. – badroit Aug 1 '14 at 20:03