[Tex/LaTex] Footnote disappear in shaded environment

footnotes

My footnote disappear in shaded environment as shown in the following example. How to fix this, please? Thank you!

\documentclass[english]{scrartcl}

\usepackage{graphics}
\usepackage{environ}
\usepackage[round]{natbib}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\setkomafont{disposition}{\normalfont\bfseries}
\usepackage[printwatermark]{xwatermark}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{framed}

\colorlet{shadecolor}{gray!40}

\begin{document}

\title{}
\maketitle

\begin{shaded}
\begin{enumerate}
\item I love my mother.\footnote{Of course.} 
\end{enumerate}
\end{shaded}

\end{document}

Picture

Best Answer

From the framed manual:

The contents of the framed regions are restricted: Floats, footnotes, margin-pars and head-line entries will be lost.

So, simply use \footnotemark inside the shaded environment and \footnotetext{Of course.} just after it.

MWE:

\documentclass[english]{scrartcl}

\usepackage{graphics}
\usepackage{environ}
\usepackage[round]{natbib}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\setkomafont{disposition}{\normalfont\bfseries}
\usepackage[printwatermark]{xwatermark}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{framed}

\colorlet{shadecolor}{gray!40}

\begin{document}

\title{}
\maketitle

\begin{shaded}
\begin{enumerate}
\item I love my mother.\footnotemark
\end{enumerate}
\end{shaded}
\footnotetext{Of course.}

\end{document} 

Output

enter image description here


EDIT

If you have more than one footnote inside the shaded environment, then number your \footnotetexts, as in the following example:

\documentclass[english]{scrartcl}

\usepackage{graphics}
\usepackage{environ}
\usepackage[round]{natbib}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\setkomafont{disposition}{\normalfont\bfseries}
\usepackage[printwatermark]{xwatermark}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{framed}

\colorlet{shadecolor}{gray!40}

\begin{document}

\title{}
\maketitle

\begin{shaded}
\begin{enumerate}
\item I love my mother.\footnotemark
\item And my father,too.\footnotemark
\end{enumerate}
\end{shaded}
\footnotetext[1]{Of course.}
\footnotetext[2]{Of course, again.}

And some text outside\footnote{A footnote}
\end{document}

Output:

enter image description here

Related Question