1

How do I set/define the last page of a moderncv documentclass?

I know, that I can change the starting page count by \setcounter{page}{13} which let the document start with 13. However, moderncv displays the pages in the footer in a style like 13/17 for a five page document. Assuming, the CV is part of a larger project, how can I set the "last page" to a fix number like: 13/42?

Minimal example:

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{casual}
\usepackage[utf8]{inputenc}

\firstname{}
\familyname{}
\title{Curriculum Vitae}

\begin{document}
  \makecvtitle
  \setcounter{page}{13}

  Should be 13/42 not 13/17!
  \newpage
  Should be 14/42 not 14/17!
  \newpage
  Should be 15/42 not 15/17!
  \newpage
  Should be 16/42 not 16/17!
  \newpage
  Should be 17/42 not 17/17!
\end{document}
Thanthla
  • 526
  • 1
  • 8
  • 29

1 Answers1

1

You could replace \pageref{lastpage} with 42 in the definition of the footer:

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{casual}
\usepackage[utf8]{inputenc}

\firstname{}
\familyname{}
\title{Curriculum Vitae}


\begin{document}

\fancyfoot[r]{\parbox[b]{\pagenumberwidth}{\color{color2}\pagenumberfont\strut\thepage/42}}% the

  \makecvtitle
  \setcounter{page}{13}

  Should be 13/42 not 13/17!
  \newpage
  Should be 14/42 not 14/17!
  \newpage
  Should be 15/42 not 15/17!
  \newpage
  Should be 16/42 not 16/17!
  \newpage
  Should be 17/42 not 17/17!
\end{document}
  • Totally did the trick! I thought it would be more intuitive like `\setcounter{lastpage}{42}`. I was currently looking into modifying the footer as well, but was struggling with the color scheme. Thx a lot. – Thanthla Jul 07 '21 at 19:54