I'd like to have a footnote that refers to text later in the document, and say "... above ..." or "... below ..." depending on whether the text is on the same page (and thus above) the footnote, or on a later page (and thus below) the footnote. How do I do this? Is there a way to do this without manually writing to the aux file?
(Is it bad practice to refer to future text in a footnote?)
I have it (almost) working with the following code:
Right before the footnote:
\makeatletter
\newcommand{\IfDoAbove}{\ifdoabove\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\immediate\write\@auxout{\noexpand\global\noexpand\newif\noexpand\ifsecondbulletabove}
\edef\relevantfootnotepage{\thepage}
In the footnote, \IfDoAbove{above}{below}
By the text that I care about
\ifnum\relevantfootnotepage=\thepage\relax
\immediate\write\@auxout{\noexpand\global\noexpand\doabovetrue}%
\else
\immediate\write\@auxout{\noexpand\global\noexpand\doabovefalse}%
\fi
But it fails if the text that I care about is in an \item which is the first thing on a new page; \thepage is the same as the old page, not the new page. Why is this?