我试图改进一个旧答案,但遇到了一个问题。 \ifinner
告诉我我处于 的外部模式\parbox
。它通常有效,但在这种情况下无效(\@footnotetext
)。
\documentclass{article}
\usepackage{blindtext}
\makeatletter
\newsavebox{\parboxins}
\newcommand{\copyinserts}{\insert\footins{\unvbox\parboxins}}
\newcommand{\global@insert}[2]% #1=box number, #2=vertical list
{\bgroup
\setbox\@tempboxa=\box#1
\global\setbox#1=\vbox{\unvbox\@tempboxa #2}
\egroup}
%{\global\setbox#1=\vbox{\unvbox#1 #2}}
\long\def\@footnotetext#1{\ifinner INNER \global@insert\parboxins
\else OUTER \insert\footins
\fi{%
\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark
}%
\color@begingroup
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
\color@endgroup}}%
%\newcommand{\globalinserts}{\let\@footnotetext=\global@footnotetext}% doesn't work
\makeatother
\begin{document}
\ifinner INNER\else OUTER\fi
\parbox{\textwidth}{\ifinner INNER\else OUTER\fi}
normal\footnote{normal}
\begin{enumerate}
\item\parbox[t]{1in}{parbox\footnote{parbox - \blindtext}}%
\usebox{\parboxins}\copyinserts
\item test
\end{enumerate}
check counter\footnote{after}
\end{document}