4

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.

With footnote

\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.

Without footnote

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?

  • 1
    For the footnotes, footnote package could help you; maybe writing your code into savebox environment ... – juanuni May 24 '15 at 3:18
2

Use tcolorbox instead of mdframed:

MWE

\documentclass{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[arc=0mm,boxrule=1pt,colback=white]
Test frame\footnote{Test footnote}
\begin{tcolorbox}[arc=0mm,boxrule=1pt,colback=white]
Test nested frame
\end{tcolorbox}
\end{tcolorbox}
\end{document}
  • +1, but un-fortunately I need to be able to have un-break-able boxes inside un-break-able boxes =/ – Jonathan Gleason May 24 '15 at 12:15
  • @JonathanGleason So what? Although tcolorbox can made breakable boxes, by default those like of my MWE are unbreakable. – Fran May 24 '15 at 15:23

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.