0

Specifically, how to put on the top right corner "Page {number} of {number of pages}". Example: Page 1 of 5.

  • 1
    See the lastpage package. The top-right corner (as opposed to the header area) can be reached using \AddToHooks{shipout/background}{...}/ – John Kormylo Sep 27 '22 at 00:07

1 Answers1

2

use lastpage and fancyhdr package, and you need to compile twice. as follow:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{Page \thepage\space of \pageref{LastPage}}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\clearpage
\lipsum[1]
\clearpage
\lipsum[1]
\end{document}

enter image description here

ljguo
  • 1,213
  • 1
  • 4
  • 12