Suppose that you have two mdframed
environments, one nested inside the other, and a footnote in the first mdframed
environment but not in the second. See the MWE example below.
\documentclass{article}
\usepackage{mdframed}
\begin{document}
\begin{mdframed}
Test frame\footnote{Test footnote}
\begin{mdframed}
Test nested frame
\end{mdframed}
\end{mdframed}
\end{document}
And here is what the same example looks like without the \footnote
command.
There are (at least) two problems here. The first of course is that, with the footnote, the nested mdframed
environment is too large and goes outside the right margin. The second problem is that, as the footnote appears in the first mdframed
environment, it should be appearing at the end of the first mdframed
environment, not the second. I suspect these problems are related (it's probably worth noting that if you move the footnote
command into the second mdframed
environment, everything is the correct size).
Any idea what's going on here or how to fix it?
footnote
package could help you; maybe writing your code intosavebox
environment ...