TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to get the exact page number (or several page numbers if it spreads so) in the generated PDF document for a particular LaTeX environment (say, \begin{figure} ...\end{figure}) after compilation? Editing the corresponding LaTeX source file (e.g. injecting some specific marks) is available for that purpose.

Update: Is pdfsync helpful for that?

share|improve this question
I'm not sure what you want to achieve. You can have, when using TeXShop the option of jumping from the .pdf file to the corresponding position in the .tex file. Is this what you meant? – Dror Jul 13 '11 at 10:39
Yes, it is. That's why now I see that pdfsync seems to be relevant. – Nikita Zhiltsov Jul 13 '11 at 11:05
pdfsync (the package) is obsolete. Recent TeX implementations use SyncTeX, how to benefit from it depends on your system configuration. – egreg Jul 13 '11 at 11:45
Welcome to TeX.sx! A tip: you can use backticks ` to mark your inline code as I did in my edit. – Martin Scharrer Jul 13 '11 at 12:03

The zref package (oberdiek bundle) gives you several macros to label and reference basically anything in a document. This includes \zlabel and \zpageref. The zref-abspage and zref-abspos module gives you the exact position in the PDF. These values can be extracted in a plain form and are stored in the .aux file. I used it to jump from my document to specific pages with specific zoom levels in an external PDF which I couldn't influence myself.

Note that the normal \pageref will give you the logical page number, while you most likely need the absolute page number. Both will not be the same of you reset the page number counter, e.g. for roman numbering of the frontmatter.

share|improve this answer

By using labels, you can refer to a specific use of the environment by its page number.

See the use of the \pageref command in http://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.