# Printing absolute page numbers

I'm using the pagesel package to output only selected parts of a large document. The page numbers in that document are not absolute page numbers, but pagesel (quite rightly) uses absolute page numbers. So what I'd like to do is, within my document, put a command to list the absolute page number on my TeX log. The pagesel package uses the counter ps@count to keep track of the absolute page number, so I've tried the following two ideas, but neither works:

\makeatletter
\typeout{Absolute Page \value{ps@count}}
\makeatother

\makeatletter
\typeout{Absolute Page \theps@count}
\makeatother


Could someone fix one of these? (I see from another answer How to find absolute page number as an integer? that I could use the zref package, but that seems a lot of work when pagesel already has the counter that I want.)

If you load the pagesel package without specifying any selection options (that's the main purpose of the package), then it virtually "unloads" itself. From the pagesel documentation (section 1 Usage, p 2):

Depending on the options the package works in two modes:

1. If no page selecting option is present, so the package ignores the other options and finishes itself. So no page will be suppressed by the package and auxiliary files will be written.
2. With at least one page selecting option the specified pages are selected and the other are suppressed. The default for this mode is that auxiliary will not be overwritten. (This can be changed by an option.)

You can load pagesel and specify that all pages should be written out using the - option as a page range. Just as an example:

\documentclass{article}
\usepackage[-]{pagesel}% http://ctan.org/pkg/pagesel
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\makeatletter
\EveryShipout{\typeout{Absolute page \theps@count.}}
\makeatother
\begin{document}
\lipsum[1-10]
\end{document}


will output in your .log (somewhere):

ABD: EveryShipout initializing macros
Absolute page 1.
[1

{c:/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Absolute page 2.
[2] )


Note that pagesel uses everyshi to determine the page count at shipout time. That is the only reliable time that you can use the page counter, so you should too.