3

In my document, I use this script:

%the template
\documentclass{llncs}
\usepackage{blindtext}
\usepackage{xpatch}

%for foot page numdering
\usepackage{fancyhdr} 
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\cfoot{\number\value{page} of \pageref{LastPage}}
\pagestyle{fancy}  
\xpatchcmd{\maketitle}{\thispagestyle{empty}}{}{}{}             
%end page numbering

\begin{document}

%\includepdf[pages={17-23}]{master_paper.pdf}
\title{Document Title}
\author{Name Here}
%\\Supervised by: Prof. Cas Cremers
\institute{Institution)\\
\email{zz@yy.com}}

\maketitle 

\begin{abstract}
Abstract goes here..
\end{abstract}


\section Section Here

\end{document}

The problem is that, when I view the document in PDF format, at the buttom of the page, the page numdering does not appear properly. It appears as: 1 of ?? i.e. it does not show the total number of pages as supposed.

user6875880
  • 2,183
  • try add \usepackage{lastpage} into your preamble ... – Zarko Dec 31 '16 at 22:36
  • Did you compile the document twice? The first run saves the number of pages while the second ``replaces'' the ?? by the proper number. I don't have that document class so can't test myself. – Herb Schulz Dec 31 '16 at 23:25

1 Answers1

3

The \usepackage{lastpage} was missing, so \pageref{LastPage} provides nothing than ??

Alternatively, I have shown the way with xassoccnt and its TotalDocumentCounter feature, associated to the page counter. This has the advantage that even after an eventual \pagenumbering{...} command the total page numbers is not affected, but LastPage would show a different value.

In both cases, compiling twice is necessary!

\documentclass{llncs}
\usepackage{blindtext}
\usepackage{lastpage}
\usepackage{xpatch}

\usepackage{fancyhdr} 
\usepackage{xassoccnt}

\NewTotalDocumentCounter{totalpages}
\DeclareAssociatedCounters{page}{totalpages}

%for foot page numdering
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\cfoot{\number\value{page} of \TotalValue{totalpages} or with LastPage reference: \pageref{LastPage}}
\pagestyle{fancy}  
\xpatchcmd{\maketitle}{\thispagestyle{empty}}{}{}{}             
%end page numbering

\begin{document}

%\includepdf[pages={17-23}]{master_paper.pdf}
\title{Document Title}
\author{Name Here}
%\\Supervised by: Prof. Cas Cremers
\institute{Institution)\\
\email{zz@yy.com}}

\maketitle 

\begin{abstract}
Abstract goes here..
\end{abstract}


\section Section Here


\blindtext[5]

\end{document}

enter image description here