TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I receive the a Reference "LastPage" undefined error when trying to compile a document with this syntax:


What is necesarry to prevent this error? I'm using TeXworks Version 0.4.3 (MiKTeX 2.9) and pdfLaTeX.

share|improve this question
Please supply a MWE, we do not know if you create the label, or if you use any packages, for instance lastpage? – zeroth Jan 20 '12 at 17:18
What is a "MWE"? – powtac Jan 20 '12 at 17:22
Please see this: Welcome and here is the proper link for MWE. – zeroth Jan 20 '12 at 17:23
Great, thanks! Will check it... – powtac Jan 20 '12 at 17:26

\usepackage{lastpage} is required, further you need to compile at least twice. The reason is, that the first compiler run writes the reference for that label to the .aux file, in the second compiler run it can be read in.

The package lastpage defines the label LastPage, and your previous question showed that this package is used. So just compile again.

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.