# afterpage + list = missing \item

I'm trying to use the afterpage package to automatically insert text at the top of each page (please see my other question Section reminders at the top of each page?) but I'm having trouble.

Sometimes I get unlucky and a list environment starts just before a page break. The first \item doesn't appear until just after the page break. When this happens, LaTeX gives me a "missing \item" error message because \afterpage is inserting text right after the start of a list environment.

Here is a minimal example that emulates the problem I'm seeing:

\documentclass{article}
\usepackage{afterpage}
\begin{document}
\afterpage{afterpage-stuff}
before list
\begin{itemize}
\clearpage
\item an item
\end{itemize}
after list
\end{document}


If I remove that \clearpage, then everything works as expected.

Is there something I can pass to \afterpage that would temporarily reset TeX's state so that I can safely insert some vertical mode material (e.g., a minipage) at the top of the next page without interfering with environments that span pages?

-

\afterpage{\hbox{afterpage-stuff}}


gets rid of the error but it depends what you want the spacing to be....

This does allow vertical material for example

\afterpage{\hbox{%
\parbox{\textwidth}{afterpage-stuff

some more}}}

-
that worked beautifully, thank you! –  Richard Hansen Apr 8 '12 at 23:54