TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If you would be so kind to compile this LaTeX document:







You will find that the bottoms of pages 2 and 3 are misaligned as follows:

misaligned pages


  1. Shouldn't the space between the paragraph and the frame on page 3 expand such that the bottoms align? Why does this not take place?

  2. How would you add a flexible (zero, plus something flexible if needed, just like for paragraph spacing) space above the mdframed box too? That would put a less strain on the space between the paragraphs, assuming I resolve question 1 above.

share|improve this question
up vote 13 down vote accepted

For reasons I don't understand, mdframed outputs the first (split) box in a way that the page bottom will be ragged no matter whether \raggedbottom or \flushbottom (default with book) is configured.

You can get a more normal behaviour with the following patches:



\patchcmd\mdf@put@frame@i{\hrule \@height\z@ \@width\hsize\vfill}{}{}{}
\patchcmd\mdf@put@frame@i{\hrule \@height\z@ \@width\hsize\vfill}{}{}{}
\patchcmd\mdf@put@frame@i{\hrule \@height\z@ \@width\hsize\vfill}{}{}{}


As I really don't know what this is supposed to achieve, this will probably break something, but at least, the page bottom is aligned now ;-)

The space above the mdframed box is configured with skipabove, so you get flexible glue by



share|improve this answer
I didn't implement this because I like the alignment at the top ;-) – Marco Daniel Sep 1 '12 at 7:12
@MarcoDaniel Ah, Ok. That's a valid reason I suppose ;-) Is it documented behaviuor? btw, what exactly do you mean by top alignment? Usually one speaks about top/bottom alignment when things are arranged horizontally. – Stephan Lehmke Sep 1 '12 at 9:32
I mean the vertical alignment. – Marco Daniel Sep 1 '12 at 9:34
@MarcoDaniel What do you mean "alignment at the top"? – MayGodBlessKnuth Sep 1 '12 at 10:58
@MarcoDaniel Of course "top" is a vertical alignment, but normally, vertical alignment only makes sense when things are displayed side by side (like parboxes or tables). – Stephan Lehmke Sep 1 '12 at 11:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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