I thought I'd solved the footnotes-in-tables problem with \makesavenoteenv
but it interacts badly with the minted package so I thought, since my problem is really "make footnotes work in my box environment", maybe I can create a new footnote command to queue up footnotes which can be added to the page when the environment ends.
\documentclass{article}
% let ASIDE_FOOTNOTES be an empty list
\newcommand\asidefootnote[1]%
{%
\footnotemark{}%
% add #1 to ASIDE_FOOTNOTES list
}
\newcommand\emitasidefootnotes%
{
% where SIZE is the length of the ASIDE_FOOTNOTES list
% \addtocounter{footnote}{-SIZE}
% for each NOTE in ASIDE_FOOTNOTES
% \footnotetext{NOTE}
% let ASIDE_FOOTNOTES be an empty list
}
\newenvironment{aside}[1]
{
\begin{minipage}{0.5\textwidth}
ASIDE (#1) \par
}
{
\end{minipage}
\emitasidefootnotes
}
\begin{document}
Foo\footnote{foonote}
\begin{aside}{advanced}
aaa\asidefootnote{foo aaa} bbb\asidefootnote{foo bbb}
\end{aside}
Bar\footnote{barnote}
\begin{aside}{advanced}
xxx\asidefootnote{foo xxx} zzz\asidefootnote{foo zzz}
\end{aside}
Baz\footnote{baznote}
\end{document}
Basically, I need to turn the above comments into actual code.
- The argument to
\asidefootnote
can be arbitray tex. - It needs to not interfere with other, normal footnotes. In the above example, footnotes 1 through 7 should appear together, in the natural order, at the bottom of the page.
- It doesn't need to work recursively (an
aside
environment will never contain anotheraside
environment, directly or indirectly, nor will it contain any other environment which uses this trick).
How do I implement this? (In other words, how do I add a chunk of tex to a list, pass the size of that list to \addtocounter
, iterate over that list, and empty that list?)