我正在尝试收集一页中提到的水果,并将它们打印在下一页的底部。所有文本始终包含在一个框架中,并且该框架可以跨越多个页面,但收集到的水果在一页中被提及后,始终必须打印在下一页的底部。问题是,如果一页上有两个框架,并且第二个框架内的水果出现在下一页中,它们将与第一个框架的水果一起打印,但事实并非如此。
\documentclass{article}
\usepackage{blindtext}
\usepackage{atbegshi}
\usepackage{picture}
\usepackage{mdframed}
\usepackage{collect}
\newenvironment{fruit} {\begingroup\edef\x{\endgroup\noexpand\collectfruits}\x}{\endcollect}
%to print to bottom of next page after fruits named on page
\newcommand{\printbottomNext}[1]{
{\LARGE print on bottom of next page\\}
\AtBeginShipoutNext{%
\AtBeginShipoutUpperLeft{%
\put(0.1\paperwidth,-0.95\paperheight){#1}%
}%
}
}
\definecollection{fruits}
\newcommand\collectfruits{%
\collect{fruits}
{}
{}
{}%
}
\begin{document}
\begin{mdframed}[frametitle=with apple and orange]
\blindtext[3]
\begin{fruit}
apple
\end{fruit}
\begin{fruit}
orange
\end{fruit}
\printbottomNext{\includecollection{fruits}}
\blindtext[2]
\end{mdframed}
\begin{mdframed}[frametitle=with pineaple and banana]
\blindtext[3]
\begin{fruit}
pineapple
\end{fruit}
\begin{fruit}
banana
\end{fruit}
\printbottomNext{\includecollection{fruits}}
\blindtext[2]
\end{mdframed}
\end{document}