Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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}
share|improve this answer
    
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 '13 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 '13 at 16:19

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}
share|improve this answer
    
I knew that was a way... :) –  cacamailg May 11 '13 at 16:12
    
@cacamailg: :-) –  Marco Daniel May 11 '13 at 16:13

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.

share|improve this answer
2  
The footnotes of mdframed are equal to footnotes inside minipage or tabular. –  Marco Daniel May 10 '13 at 19:07
    
@MarcoDaniel would they work with tablefootnote package? –  cacamailg May 11 '13 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} –  Marco Daniel May 11 '13 at 7:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.