13

If there is a \footnote inside an mdframed environment, then I can control, via the footnoteinside=false flag, whether or not I want those footnotes included inside the frame or outside. But even when typeset outside the frame, they will immediately follow the frame. Is there a way, perhaps using a small hack, to print these footnotes at the end of the (last) page where the frame was included?

3 Answers 3

5

This seems to work.

\documentclass{article}

\usepackage{mdframed}
\usepackage{footnote}
\newenvironment{mdframedwithfoot}
{   
    \savenotes
    \begin{mdframed}
    \stepcounter{footnote}
    \renewcommand{\thempfootnote}{\arabic{footnote}}
    }
{
    \end{mdframed}
    \spewnotes
}
\usepackage{hyperref}


\begin{document}
aa\footnote{test1}

\begin{mdframedwithfoot}
bb\footnote{test2}
\end{mdframedwithfoot}

qq

\begin{mdframed}
cc
\end{mdframed}

dd\footnote{test3}
\end{document}
5
  • 1
    Looks nice, but the manual stepping of the footnote counter means that one still hase to take extra care oneself to not use more than one footnote (which will break my approach as well), and to match environment name to whether or not a footnote was used. However, using \def\@mpfn{footnote} I was able to avoid that explicit stepping, and \let\thempfootnote=\thefootnote will ensure these two always match. Did you develop this answer from a failed attempt with the tablefootnote package, thus answering your own comment?
    – MvG
    May 11, 2013 at 7:17
  • @MvG I remember a similar solution that I have seen in here in tex.sx. I also had a feeling that tablefootnote would work :)
    – cacamailg
    May 11, 2013 at 16:19
  • @cacamailg When I try to compile this, I can not compile, and get the error: Undefined control sequence. \pgfsyspdfmark {pgfid1}{8799518}{42674430}.
    – O0123
    Apr 25, 2016 at 20:43
  • @VincentVerheyen I compiled the code above without any problem. My version is TeXLive 2015.
    – cacamailg
    Apr 25, 2016 at 20:51
  • @cacamailg Ok, it's probably because of my TeX Live 2014.
    – O0123
    Apr 25, 2016 at 20:52
14

The standard behavior of footnotes of mdframed orientates on the standard behaviour of footnotes of minipage. mdframed is using the same counter.

However a simple method to prints footnotes at the bottom of the package is a minor alteration of tablefootnote provided by the package tablefootnotes:

\documentclass[]{article} 
\usepackage[framemethod=tikz]{mdframed} 
\usepackage{tablefootnote} 
\makeatletter 
\AfterEndEnvironment{mdframed}{%
 \tfn@tablefootnoteprintout% 
 \gdef\tfn@fnt{0}% 
}
\makeatother 
\begin{document} 
\begin{mdframed} 
 foo\tablefootnote{foo} 
 bar\tablefootnote{bar} 
\end{mdframed} 
\end{document}
2
  • I knew that was a way... :)
    – cacamailg
    May 11, 2013 at 16:12
  • @cacamailg: :-) May 11, 2013 at 16:13
3

I found out that I could achieve the desired result by writing \footnotemark inside the frame and \footnotetext{…} after it. This had the added benefit of using a numbering scheme consistent with the rest of my document: A footnote set by mdframed used lower case alphabetical numbering, whereas the rest of my document used arabic numbers for footnotes. With the above approach, everything was arabic.

3
  • 2
    The footnotes of mdframed are equal to footnotes inside minipage or tabular. May 10, 2013 at 19:07
  • @MarcoDaniel would they work with tablefootnote package?
    – cacamailg
    May 11, 2013 at 0:46
  • @cacamailg: It works if you add a command to the end of mdframed: \documentclass[]{article} \usepackage[framemethod=tikz]{mdframed} \usepackage{tablefootnote} \makeatletter \AfterEndEnvironment{mdframed}{% \tfn@tablefootnoteprintout% \gdef\tfn@fnt{0}% } \makeatother \begin{document} \begin{mdframed} foo \tablefootnote{foo} bar \tablefootnote{bar} \end{mdframed} \end{document} May 11, 2013 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .