2

I'm wondering how to enable the page numbering in moderncv. The default option doesn't show the page numbers.


EDIT

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}

\usepackage{graphicx}
\graphicspath{ {Immagini/} }

\begin{document}
here there is some text    
\end{document}
2
  • Please always post a useful minimal working example (MWE): as it is, graphicx and \graphicspath are not relevant with respect to your question, while -for successful compilation- \name{}{} is required. Commented May 22, 2020 at 11:55
  • Hello AlessandroCuttin and Mensch, thank you very much for your elegant solution. Commented May 22, 2020 at 14:46

3 Answers 3

3

You can use fancyhdr. With the option of the command \fancyfoot you can control the positioning of the page number in the footer

  • L on the left
  • R on the right
  • C in the center

As the argument of the command you can simply give \thepage. This results in

\fancyfoot[C]{\thepage}

You can also achieve something something more elaborated. For example, using the package lastpage you can print something like page 1 of 5, by defining the footer in the following way:

\fancyfoot[C]{\thepage{} of \pageref{LastPage}}

Or (something that I do), you can print in the footer the consent to the personal data processing (when needed).

In the following MWE you can chose between the two

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

\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
% \fancyfoot[C]{\thepage} % only page number
\fancyfoot[C]{\thepage{} of \pageref{LastPage}}

\name{John}{Doe}

\begin{document}
\maketitle
\end{document}

Page number only:

enter image description here

Page 1 of n:

enter image description here

4
  • can you show me also an example with lastpage please? Commented May 22, 2020 at 14:51
  • 1
    Sure! have a look at the most recent edit Commented May 23, 2020 at 20:36
  • Thank you so much @AlessandroCuttin Commented May 23, 2020 at 20:37
  • You are welcome! remember also to upvote/accept the answers that helped you the most ;) Commented May 23, 2020 at 20:38
2

In your used style classic is no footer inserted, it is simply not part of the design of the page or CV.

In style casual an footer, including pagenumber and personal datas, is inserted and part of the layout of that style. Then package fancyhdr is used.

To get a pagenumber in classic style you can simply load and use fancyhdr like:

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

\moderncvstyle{classic}
\moderncvcolor{blue}

\usepackage{graphicx}
\graphicspath{ {Immagini/} }

\usepackage{fancyhdr} % <=============================================== loading package
\pagestyle{plain} % <=================================================== choosing style
\fancyfoot[C]{\thepage} % <============================================= adding page number

\name{John}{Doe}


\begin{document}

here there is some text    
\end{document}

with the resulting pdf:

resulting pdf

Please see that command \nopagenumbers{} is only working with style casual ...

0

Pagenumbering is automatically done in moderncv. If \nopagenumbers{} is not commented out, make sure that \setlength{\footskip}{100pt} has the proper value for the page numbers to be shown, otherwise if the value---in this case 100pt---is too large the page numbers will "drop out" of the paper.

1
  • Welcome to TeX.SE! As far as I know (please see my answer to this question) pagenumbering is only done in style casual automatically. Or is there a newer version of moderncv including the numbering?
    – Mensch
    Commented Mar 11 at 13:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .