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
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}
-
1Looks 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 thetablefootnote
package, thus answering your own comment?– MvGMay 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 :) 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}
.– O0123Apr 25, 2016 at 20:43 -
@VincentVerheyen I compiled the code above without any problem. My version is TeXLive 2015. Apr 25, 2016 at 20:51
-
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}
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.
-
2The footnotes of
mdframed
are equal to footnotes insideminipage
ortabular
. May 10, 2013 at 19:07 -
-
@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