I am using longtable and want to access the page number from within the longtable, as in this bare-bone example:
\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{longtable}
\begin{document}
\begin{longtable}{l}
longtable header: this is page \thepage
\endhead
A \\
A \\
A \\
... however many rows ...
... needed to exceed one page ...
\end{longtable}
\end{document}
However, the generated PDF always shows this is page 1 in the longtable header, even if it is on page 2.
According to a comment to this question, longtable "saves the head in a box and doesn't re-set it each page". The comment seems to suggest that the rolling page number simply cannot be accessed from within a longtable without a major rewrite. Do I understand that correctly? (I certainly hope that I do not understand it correctly, so there's still some hope that it can be done.)
supertabularpakage as described in this answer: https://tex.stackexchange.com/a/373987/134144. – leandriis Nov 20 '17 at 14:39\pagerefin the body of the table but not in the head. (there is an answer on this site somewhere that has some fragile code that tries to work round this) – David Carlisle Nov 20 '17 at 16:15