The Thanh Han wrote:
I wonder how Hans and other would solve this problem. tex doesn't have a concept of `current page' while processing the input token list. The page number can be detected reliably only using 2nd pass processing, as the page where some material ends up is known only at shipping phase.
I use two pass solutions for that. I can imagine a primitive \pdfpageobjnum that expands at shipout time, i.e. \pdfobj{.... \pdfpageobjnum\space 0 R} in this case \pdfpageobjnum is like pdfsavepos, during shipout, those placeholders in the shipped out box are resolved; outside the otr/shipout routine it's zero, so \count15=\pdfpageobjnum leads to \count15 being 0 I guess that the reason for this request is that in media objects one needs to refer to the page where the object (or its visualization) ends up, a kin dof circular reference between definition and usage; since these page references remain in the object (and are not used elsewhere) the delayed resolution during shipout is ok;
It is possible to provide a primitive which returns the *next* page object number, but IMHO it doesn't make any sense.
indeed, things can end up many pages later (think of intermediate float flushing) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------