I styled the theorems in my document a bit, using the mdframed package. I'm glad with the result, but the frame sometimes breaks off incorrectly. I've created a sample to show you what's going wrong.



\textheight 22.4cm
\parskip 12pt
\mdfdefinestyle{mystyle}{ %
    backgroundcolor=lichtgrijs, %
    linewidth=0pt, %
    innertopmargin=10pt, %
    innerbottommargin=10pt %


        This is my theorem.
            \item It breaks of ugly.

As you can see, a gray banner from the theorem is shown on the second page. Obviously, that's not very desirable.

How can I prevent this?


You can add nobreak=true to your definition of `mystyle:

\mdfdefinestyle{mystyle}{ %
    backgroundcolor=lichtgrijs, %
    linewidth=0pt, %
    innertopmargin=10pt, %
    nobreak=true% prevent page breaks in the middle of mystyle

With this your theorem stays on the bottom of the first page:

enter image description here

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.