I want to get two different page numbers on the same page in LaTeX
. For example, I want to have overall page numbers in the footer and within chapter page numbers in the header. I wonder how to get this one. Any help will be highly appreciated. Thanks.
% Document Class
\documentclass[a4paper,12pt]{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{lastpage}
\fancypagestyle{Special}{%
\fancyhf{}% Clear fancy header/footer
\renewcommand{\headrulewidth}{0.7pt}
\renewcommand{\footrulewidth}{0.7pt}
\fancyhead[r]{Page \thepage\ of \pageref{LastPage}}
\fancyfoot[r]{Page \thepage\ of \pageref{LastPage}}
}
% Begin Document
\begin{document}
\tableofcontents
\mainmatter
\pagestyle{Special}
\chapter{First Chapter}
\section{Introduction}
\subsection{Intro1}
\subsection{Intro2}
% Blind Text
\blindtext[1]
\section{Material \& Method}
% Blind Text
\blindmathpaper
\chapter{Second Chapter}
\section{Introduction}
\subsection{Intro1}
\subsection{Intro2}
% Blind Text
\blindtext[1]
\section{Material \& Method}
% Blind Text
\blindmathpaper
% End Document
\end{document}
Best Answer
I introduce a
\newcounter{pagecntr}[chapter]
which will be set to zero for every new chapter. I did not manage to set it directly to 1. That's why I needed to do the ugly\setcounter{temp}{\thepagecntr}\stepcounter{temp}\thetemp
every time I want to print it. I guess, there are better approaches, but well... doesn't matter, it works.The final trick is to use the package
everyshi
which increments my new counter by one for every page.NB: I would recommend to write something like
\thetemp\ of Ch.\ \thechapter
as two numbers on one page will be confusing if not explained.