I think I may have stumbled upon a bug in the mdframed package. I have an mdframed environment with just one align environment inside it. Consider this minimum working example:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{mdframed}
\usepackage{blindtext}
\begin{document}
\blindtext \\ \blindtext \\ \blindtext
\begin{mdframed}
\begin{align*}
x^2 + y^2 = z^2 \\
x^2 + y^2 = z^2 \\
x^2 + y^2 = z^2 \\
x^2 + y^2 = z^2 \\
x^2 + y^2 = z^2 \\
x^2 + y^2 = z^2
\end{align*}
\end{mdframed}
\end{document}
This gives the following output:
As you can see, the \begin{mdframed} command is issued around the bottom of the page. Because align is not splittable, the whole frame plus contents gets placed on the next page, which is absolute what expect to happen. However, extra vertical white space appears on the bottom inside the mdframed environment, so that the mdframed environment is much higher than it should be.
From experimenting a bit, I think that the amount of extra white space is about the same amount of remaining vertical space on the previous page, which implies that the mdframed could be up to twice as high as it should be.
Is there a workaround for this?