Q: Getting page numbers in plain TeX I know that TeX does not update the page number until it can decide where to break a page. And when I write
\number\count0

\number\count0

\number\count0
% ...

to fill two pages, the second page of the output begins with
1
1
2
2
2
...

Therefore, if something appears on the top of a page, then I can't get the correct page number for it. In LaTeX we have \label and \pageref as a workaround. But is there a way to do this in plain TeX?

A: Yes of course you could implement the same system latex uses, with a two-pass writing to the aux file. You could define some macros just to do this or more simply 
\input eplain

and use the eplain macros which provide various cross referencing features in a more plain style than the latex macros.

A: Yes of course you could implement the same system latex uses, with a two-pass writing to the auxiliary file. You could define some macros just to do this or more simply
\input opmac

and use the opmac macros \ref and \pgref which provide various cross referencing features in a more plain style than the latex macros.
