I want to simply add page numbers to my document in the format: #page out of #pages. I find this:
% This is based on the LLNCS.DEM the demonstration file of
% the LaTeX macro package from Springer-Verlag
% for Lecture Notes in Computer Science,
% version 2.4 for LaTeX2e as of 16. April 2010
%
% See http://www.springer.com/computer/lncs/lncs+authors?SGWID=0-40209-0-0-0
% for the full guidelines.
%
\documentclass{llncs}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{\thepage}
\pagestyle{fancy}
\begin{document}
\cfoot{page \thepage\ of \pageref{LastPage}}
\title{Title}
\author{Author}
\institute{Institute\\
\email{email}}
\maketitle
\begin{abstract}
\end{abstract}
\section{Section1}
\end{document}
But it adds a line at the header. Also, it does not add number for the first page in my document. How can I solve these two issues?
Best Answer
First of all: If this should be submitted to Springer, they will not accept the page number on the first page, most likely, but here you go...
\maketitle
uses\thispagestyle{empty}
(many document classes do so!), so either\renewcommand{\maketitle}
→ tedious\ps@empty
to be\ps@fancy
→ has to be undone later on!\xpatchcmd
fromxpatch
package and replace\thispagestyle{empty}
by nothing or by\thispagestyle{fancy}
.The next issue is the page header rule → use
\renewcommand{\headrulewidth}{0pt}
to get rid off it.The special formatting can be achieved with
lastpage
package and\number\value{page} of \pageref{LastPage} pages}
in\cfoot
. Thelastpage
package places the labelLastPage
(sic!!!) on -- you guess it already -- the last page!