I'm currently using the mdframed package for a custom environment for my master's thesis. In rare cases, the environment shows some rather strange behaviour — the correctly split environment (i.e. the two, or sometimes even three parts) skips a page!

What I mean by that is, that the environment gets split as it should be, into two or sometimes three parts. However, the first part is not printed on the page were it should be, but on the next page. The second part is then printed on the subsequent page, and so on.

I've been trying to re-create this behaviour for a MWE, but I haven't succeeded yet. I cannot post the LaTeX code of my thesis, but I could post part of the PDF which shows this unwanted behaviour.

The definition of my custom environment might help though — it is largely based on an answer to one of my other questions (see Combining `tikzpicture` and `lstlisting`).



 singleextra={\node[draw, fill=white, thick, anchor=west, xshift=10pt+1pt, font=\bfseries] at (O|-P) {\csname mdf@@codeheading\endcsname \space \theboxnumber};},
 firstextra={\node[draw, fill=white, thick, anchor=west, xshift=10pt+1pt, font=\bfseries] at (O|-P) {\csname mdf@@codeheading\endcsname \space \theboxnumber};}

  • I don't quite understand your question. Can you post a picture of what is happening?
    – dustin
    May 17, 2013 at 19:03
  • 2
    Of course you get the a bad break. The firstextra material isn't in the calculation of the page dimension. Whether you defined the material as overlay you you must modify the dimension splittopskip. May 17, 2013 at 19:07
  • @dustin I uploaded the PDF to my webspace (redpanda.nl/BoxSplines.pdf), see Example 3.18 on page 12.
    – Ailurus
    May 17, 2013 at 19:22
  • 1
    @Ailurus Marco Daniel will probably be your best resource for this issue.
    – dustin
    May 17, 2013 at 19:27
  • 1
    Can you drop me an email with your tex files? May 17, 2013 at 21:09

1 Answer 1


The OP dropped me an email.

The height of the defined node isn't part of the calculation and so there is an extra vertical skip which results to an unwanted page break. The easiest way to fix this issue is by adding the option overlay to the node definition. In this way the extra vertical skip is ignored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.