# How do you place text in a box without capturing footnotes?

I would like to place a light grey box behind paragraphs, or groups of paragraphs (which might include quotes, lists, etc...). Unfortunately mdframed captures the footnotes and brings them into the grey box. My attempt at \colorbox results in the footnote disappearing.

So is there a way to place colour behind paragraphs/lists/quotes and so on, without impacting footnoting?

Update: A the request of Teepeemm, here is a sample minimal document that I don't know how to update to apply a grey box in a way that won't interfere with the footnote.

\documentclass{article}
\begin{document}
This is some text and this is is some more
text.\footnote{This is a footnote} And here
is some text.
\end{document}

• It would help greatly if you gave us a minimal working example that we could start from. – Teepeemm Aug 22 '18 at 1:31
• Yes I know there is that person who wants to tell me to provide sample code. However, the problem is I don't know which approach has even the potential to become a working solution. None of them work as far as I can tell. – Jacob Aug 22 '18 at 1:31
• @Teepeemm What would you like? A sample document with some plain text? Or a sample document showing how to use mdframed? A sample on how to use colorbox? None of them work as far as I can tell – Jacob Aug 22 '18 at 1:32
• Though not ideal, \footnotemark inside and then \footnotetext{...} outside the mdframed env works I think. Possible duplicate: tex.stackexchange.com/q/113640/117534? – Troy Aug 22 '18 at 1:53
• I am disputing the duplicate, because I am not asking how to solve a problem inherent with mdframed. I just want to work out how to add backgrounds. If people would like to see how mdframed works they can surely refer to the post you reference for details, yes? – Jacob Aug 22 '18 at 6:54

Taking the solution from here (thanks to Troy), it seems to be easy to have footnotes in a mdframe-box and I guess, this question really is a duplicate...

\documentclass[]{article}
\usepackage{mdframed}
\usepackage{tablefootnote, blindtext}
\makeatletter
\AfterEndEnvironment{mdframed}{%
\tfn@tablefootnoteprintout%
\gdef\tfn@fnt{0}%
}
\makeatother
\begin{document}
This is some text and this is is some more
text.\footnote{This is a footnote} And here
is some text.
\begin{mdframed}
This is  text inside the frame\tablefootnote{foo}
and some more text inside the frame\tablefootnote{bar}.
\end{mdframed}

This is some text and this is is some more
text.\footnote{This is the laaaaast footnote} And here
is some text.
\end{document}

• This is fine for a short box, but for a longer box all footnotes are placed on the final page of the box. – Andrew Swann Sep 22 '18 at 15:11