I use mdframed for my theorems like this
\mdfdefinestyle{theoremstyle}{%
%adjustable lengths
%inner margins
innertopmargin=\topskip,
% outter margins
skipabove= 0.1in,
skipbelow= 0.1in,
% colrs
linecolor=red!60,
middlelinewidth=2pt,%
roundcorner=5pt,
apptotikzsetting={\tikzset{mdfframetitlebackground/.append style={%
shade,left color=white, right color=blue!20}}},
% Title
frametitlefont=\TheoremHeaderFont\bfseries,
frametitlerule=true,%
frametitlerulecolor=orange!60,
frametitlerulewidth=2pt,
% Miscellaneous
nobreak=false,
}
Sometimes page break occurs right after the theorem title. How I can prevent to break the frame between title and content?
EDIT BY yori. I'm having the same problem, so here is a MWE:
\documentclass{article}
\usepackage{lipsum}
\usepackage{mdframed}
\usepackage[a4paper,margin=1.75in]{geometry}
\begin{document}
\lipsum[1-5]
\begin{mdframed}[frametitle={The title}]%
\[
x^2+y^2=z^2.
\]
\end{mdframed}
\end{document}
\documentclass{...}and ending with\end{document}, not just a snippet. – Aradnix Sep 17 '14 at 05:38needspaceoption, but this is a bit of an unsatisfactory solution, because it does not really express the intention, and it needs manual tweaking in the case of multi-line titles. – yori Sep 28 '14 at 12:21nobreakoption manually per-theorem when needed. Of course this would disallow pagebreaks in the middle of the box content. – Bordaigorl Sep 29 '14 at 15:43mdframed's title at all, and manually insert the title instead (in my own environment) and put a\nobreakafter the title. This works well. – yori Sep 29 '14 at 19:02needspaceoption? If express it globally asneedspace=5\baselineskipfor the style you use for these boxes, then you will not have to tweak each environment. – Andrew Swann Sep 30 '14 at 11:49xforneedspacehas to be large enough so that the lines of the title + the first line of the contents is covered. On the one hand, I have mdframes with titles that take two lines, and that have contents that sometimes start with (display) equations. On the other hand, I have mdframes which have a title that fits on one line, and contents that fits on another. Settingxtoo low means breaking the first case, settingxtoo high leaves too much whitespace on the previous page. In my case, there is no value forxfor which neither situation happens. – yori Sep 30 '14 at 15:58