I use mdframed to make boxes and split them across pages. However, sometimes mdframed splits! very strangely across the pages. In this example he prefers splitting, while there is enough space to put it all.

I would like to know where the conflict is. I am not interested to tweaking this example, because I have hundreds of boxes. I need to understand where the problem is and fix it in the whole book at once.
\documentclass[a4paper,10pt,twocolumn]{book}
\usepackage[english]{babel}
\newcommand{\mytext}{uutien gaaaetlmsl t n.tu aii s liwmuarpulfoaf ealiesnPui sutuacttcuMitai ibioErertix}
\usepackage[framemethod=tikz]{mdframed}
\tikzstyle{titregris} =[draw=gray, thick, fill=white,
text=black, rectangle,minimum height=0.7cm]
\mdfdefinestyle{Argumentstyle}{}
\begin{document}
${}$ \vspace{18cm}
\begin{mdframed}[style=Argumentstyle,
firstextra={\node[titregris,xshift=5mm] at (P-|O) {puttetuiroe};},]
\begin {enumerate}
\item \mytext \mytext
\item \mytext \mytext
\item \mytext \mytext
\item \mytext \mytext
\item \mytext \mytext
\end {enumerate}
\end{mdframed}
\end{document}
UPDATE: I saw that the wrong breakings take place when there is empty space before. mdframed seems to calculate the empty space needed, correctly splits the box such that the first part has the right length, but then it starts WRONGLY, ALWAYS, from the beginning of the next page!
UPDATE 2: I think now that the problem is given by the node that defines the title of the box. Namely, it gives extra height which does not fit into calculations... I changed the present form of the title with the usual one (frametitlerule=true, frametitle={MyTitle}), and the problem dissapeared in all the document :) However, I do like the node of the previous form...
UPDATE 3: It seems to be indeed from the title box, which goes up few millimeters and mdframed does not take into account for the calculation of available space. The only workaround I found until now was to move the title box INSIDE the main box... I checked, with this the whole document is OK.


mdframedfor the calculation. It seems that a raised title-box (the one I'm using is an example of the documentation) is throwing the page-break calculations offs.skipaboveandtopinnermargindo somehow help, but the values need to be very high before it works consistently, leading to ugly spacing. – badroit Sep 03 '14 at 16:26skipaboveandtopinnermarginhelps some cases (including the MWE), but for others theskipaboveandtopinnermarginneed to be set very high ... it seems to be a partial workaround rather than a solution. The core problem specifically seems to be thatmdframeddoesn't take the height of the raised title box into account when calculating the page-break. – badroit Sep 04 '14 at 18:15