Can somebody help me with this error:

LaTeX /b/c12/cWarning:/b/c0/c Reference `lastpage' on page 1 undefined on input line 24.
/b/c4/cOverfull/b/c0/c \hbox (9.14719pt too wide) has occurred while \output is active
! Missing number, treated as zero.
<to be read again> 
l.24 \newpage

My text in LaTeX is below:

\usepackage[pdfborder={0 0 0}]{hyperref}



\hyphenation{ra-dio-gra-fi-a in-dus-tri-al}




\usepackage{indentfirst} %Determinar que cada primeiro paragrafo seja também indentado


% \widowpenalty=300
% \clubpenalty=300  


          \includegraphics[height=1.59cm,width=3.0cm]{logo} &
          \tiny{SR F.30}&
         { \scriptsize 
PER \numero \\REV. \rev \\Data:\data \\Pagina.\thepage \ de \pageref{lastpage}} \tabularnewline

    \hrulefill \\
    Elaboração: \sprNome \\
    Supervisor de Proteção Radiológica -  \sprRegistro





% \mainmatter
% \newpage

  • 3
    This doesn't seem like a problem (error) with lastpage... Regardless, could you supply us with a minimal working example (MWE) that we can copy-and-paste and replicate the problem? We don't have macros.tex, nor any of the other things you \input. – Werner Feb 5 '14 at 18:51
  • 1
    BTW: Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Feb 5 '14 at 19:34

Please let me first point out this:

Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose.

Unlike any other programming languages, it makes a lot of difference if you change the preamble of your document in terms of the output, such as clashing packages or page settings changed by some detail in the code and so on. That's why we need to have a complete example together with the relevant parts of your preamble included. Otherwise we might not be able to reproduce your problem.

(from Text building blocks)

Compiling your MWE I get LaTeX Error: File ... not found. for macros.tex, capa.tex, and Transporte-body.tex, followed by several Undefined control sequence.-errors.

Nevertheless (if there is no additional issue introduced when loading the missing files), the problem is easily solved:

  1. You need to really load the lastpage package - in your code the \usepackage{lastpage} is commented out (percent-sign before it)!
  2. The reference is not \pageref{lastpage} but \pageref{LastPage}.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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