# Footnotes in multipage environments

I'm in conflict with how mdframed handles footnotes inside environments that span multiple pages. Consider this MWE

\documentclass{article}

\usepackage{lipsum}

\usepackage[framemethod=tikz]{mdframed}
\newmdenv[%
hidealllines=true,
backgroundcolor=blue!10,
]{bluebox}

\begin{document}
\begin{bluebox}
\lipsum[1]
Here comes a footnote.\footnote{Footnote 1.}
\lipsum[2]
Here comes another footnote.\footnotemark
\lipsum[3-5]
\end{bluebox}
\footnotetext{Footnote 2.}
\end{document}


which outputs

My preferred behavior would be for footnotes to appear inside the blue box, but with the same counting scheme (1, 2, 3, ...) as outside the environment and on the same page as the reference in the text. Any ideas how to implement this?

• that isn't really default behaviour, it must be specific footnote code in mdframed package, I assume. – David Carlisle Mar 14 '16 at 8:58
• @DavidCarlisle Changed my wording. – Casimir Mar 14 '16 at 9:07

The problem as I understand is to have the output as shown in this picture:

To produce this with a arabic numbering as seen here:

\thempfootnote


as shown in the code for the desired outcome:

\documentclass{article}

\usepackage{lipsum}
\usepackage[framemethod=tikz]{mdframed}
\newmdenv[%
hidealllines=true,
backgroundcolor=blue!10,
]{bluebox}

\renewcommand{\thempfootnote}{\arabic{mpfootnote}}% <-- This changes to arabic numbers.
\begin{document}

\begin{bluebox}
\lipsum[1]
Here comes a footnote.\footnote{Footnote 1.}
\lipsum[2]
Here comes another footnote.\footnote{Footnote 2.}
\lipsum[3-5]
\end{bluebox}

\end{document}


EDIT: A rather crude, but working way would be:

\enlargethispage{3cm}
\begin{bluebox}
\lipsum[1]
Here comes a footnote.\footnote{Footnote 1.}
\lipsum[2]
Here comes another footnote.\footnote{Footnote 2.}
\lipsum[3-5]
\end{bluebox}
\clearpage

• Yes, but the footnotes should also move up a page to appear at the bottom of the blue box on the first page since that is the page they are referenced on. – Casimir Mar 14 '16 at 10:03
• @Casimir: well, I tried to pack everything inside a minipage, but that only messed up the pagination. – naphaneal Mar 14 '16 at 10:34