0

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> 
                   w
l.24 \newpage

My text in LaTeX is below:

\documentclass[a4paper,11pt,oneside]{book}
\usepackage[pdftex]{graphicx}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{epsfig}
\usepackage{float}
%\usepackage{multicol}
\usepackage{array}
\usepackage[table]{xcolor}
%\usepackage{multirow}
%\usepackage{lastpage}
%\usepackage{amsmath}
\usepackage{caption}
\usepackage[portuguese,brazilian]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{fancyhdr}
\usepackage{tikz}

\usepackage{afterpage}

\newcommand\blankpage{%
    \null
    \thispagestyle{empty}%
    \addtocounter{page}{-1}%
    \newpage}

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

%\usepackage{helvet}
%\renewcommand{\familydefault}{\sfdefault}

\usetikzlibrary{matrix,arrows,shapes.geometric,positioning}

\usepackage[hmargin=2cm,top=4cm,headheight=2cm,footskip=1cm,height=23cm]{geometry}
\renewcommand{\headrulewidth}{}

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

\newenvironment{tquote}{\begin{list}{}
   {\setlength{\leftmargin}{13mm}
   \setlength{\rightmargin}{0mm}}
   \item[]}{\end{list}}

% \widowpenalty=300
% \clubpenalty=300  

\input{macros}

\pagestyle{fancy}
\fancypagestyle{plain}{%
    \fancyhf{}
    \fancyhead[c]{%
    \centering
          \begin{tabular}{|m{3.5cm}|m{10.0cm}|m{2.5cm}|}
          \hline
          \centering
          \includegraphics[height=1.59cm,width=3.0cm]{logo} &
          \centering
          \Large{PROCEDIMENTO ESPECIFICO DE \\ PROTECAO RADIOLOGICA} \\
          \tiny{SR F.30}&
          \centering
         { \scriptsize 
PER \numero \\REV. \rev \\Data:\data \\Pagina.\thepage \ de \pageref{lastpage}} \tabularnewline
          \hline
          \end{tabular}
    }

    \fancyfoot[R]{
    \hrulefill \\
    {\scriptsize
    Elaboração: \sprNome \\
    Supervisor de Proteção Radiológica -  \sprRegistro
    }
    }


}

\pagestyle{plain}
\begin{document}

\input{capa}

\newpage 
\tableofcontents

% \mainmatter
% \newpage

\input{Transporte-body}
\end{document}
  • 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
1

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}.

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.