3

I am working with a

\moderncvstyle{casual} 

template to create my CV. The template includes automatic page numbering, which is styled like this: 1/5, 2/5, 3/5 ....

I don't want this style, I just want plain numbers for each page, like this: 1, 2, 3

However, there is no indication where I can modify the page numbering style.

I can turn off page numbering by using

\nopagenumbers{}

but that's all I can do.

I have tried

\pagenumbers{plain}

which causes the error:

)) (./moderncvcolorblue.sty)
./main.tex:24:Undefined control sequence.
<recently read> \pagenumbers

l.24 \pagenumbers
    {Plain}
uncomment to sup....%
?

I also looked through the moderncvcolorblue.sty file and found nothing that indicates page numbers in any way. Equally so for the other sty files I searched.

Please do you have any ideas how I can modify the page number style?

Many thanks.

8
  • You need to read moderncv.cls. There you'll find \thepage/\pageref{lastpage} which produces the page number from the total number of pages.
    – Sigur
    Dec 31, 2014 at 13:20
  • \renewcommand{\thepage}{\arabic{page}} for example in the preamble of the document should do, or, if available, \pagenumbering{arabic} right at the document start
    – user31729
    Dec 31, 2014 at 13:21
  • @ChristianHupfer, the OP wants to change the format defined on that page style.
    – Sigur
    Dec 31, 2014 at 13:24
  • @Sigur: the \renewcommand style should do, \pagenumbering{arabic} as well or am I completely misled?
    – user31729
    Dec 31, 2014 at 13:25
  • @ChristianHupfer, since the class is making use of \thepage/\pageref{lastpage} inside the page style I guess that your suggestion will not change the effect 1/5...
    – Sigur
    Dec 31, 2014 at 13:31

2 Answers 2

4

I don't know why, but I don't get the page numbers printed (although they should be there).

For a reference of the issue, see Page numbers with moderncv package on MacTeX 2014 don't show.

I assume that you have some packages older than mines.

Anyway, to have the numbers as you want them in the moderncv style, add the following lines in your preamble:

\nopagenumbers
\AtEndPreamble{%
  \AtBeginDocument{%
          \newlength{\pagenumberwidth}%
          \settowidth{\pagenumberwidth}{\color{color2}\addressfont\itshape\thepage}%
          \fancypagestyle{plain}{%
            \fancyfoot[r]{\parbox[b]{\pagenumberwidth}{\color{color2}\pagenumberfont\thepage}}}
          \pagestyle{plain}}}

MWE (excerpt of the template)

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

\usepackage[utf8]{inputenc}

\moderncvstyle{casual}                             % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue}                               % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'


% personal data
\name{John}{Doe}
\title{Resumé title}                               % optional, remove / comment the line if not wanted
\address{street and number}{postcode city}{country}% optional, remove / comment the line if not wanted; the "postcode city" and "country" arguments can be omitted or provided empty
\phone[mobile]{+1~(234)~567~890}                   % optional, remove / comment the line if not wanted; the optional "type" of the phone can be "mobile" (default), "fixed" or "fax"
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}                               % optional, remove / comment the line if not wanted
\homepage{www.johndoe.com}                         % optional, remove / comment the line if not wanted
\social[linkedin]{john.doe}                        % optional, remove / comment the line if not wanted
\social[twitter]{jdoe}                             % optional, remove / comment the line if not wanted
\social[github]{jdoe}                              % optional, remove / comment the line if not wanted
\extrainfo{additional information}                 % optional, remove / comment the line if not wanted

\nopagenumbers
\AtEndPreamble{%
  \AtBeginDocument{%
          \newlength{\pagenumberwidth}%
          \settowidth{\pagenumberwidth}{\color{color2}\addressfont\itshape\thepage}%
          \fancypagestyle{plain}{%
            \fancyfoot[r]{\parbox[b]{\pagenumberwidth}{\color{color2}\pagenumberfont\thepage}}}
          \pagestyle{plain}}}


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}

\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}

\section{Computer skills}
\cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
\cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

\section{Interests}
\cvitem{hobby 1}{Description}
\cvitem{hobby 2}{Description}
\cvitem{hobby 3}{Description}

\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3. This item is particularly long and therefore normally spans over several lines. Did you notice the indentation when the line wraps?}

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5\cite{book1}}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

\end{document} 

Output:

enter image description here

3
  • @Sigur - I investigated the moderncv.cls file but could not find \thepage/\pageref{lastpage} There was only a reference to \hypersetup
    – Manou
    Jan 2, 2015 at 10:40
  • @Andrew Swann - yes this works, I get the page numbers as per your example. Thanks!
    – Manou
    Jan 2, 2015 at 10:41
  • yep, this is the way I went because it's in the style of the moderncv{casual}. Many thanks!
    – Manou
    Jan 2, 2015 at 10:42
3

In the standard casual template there are no page numbers. Anyway, regardless you can add simple page numbers by putting

\fancyfoot[r]{\thepage}

just after \begin{document}. This prints the page number in the lower right hand corner.

Sample output

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

\moderncvstyle{casual}  

\usepackage[utf8]{inputenc} 
\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}                   
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}                               
\homepage{www.johndoe.com}                         
\social[linkedin]{john.doe}                        
\social[twitter]{jdoe}                             
\social[github]{jdoe}                              
\extrainfo{additional information}                 
\photo[64pt][0.4pt]{example-image-a}               
\quote{Some quote}                                 

\usepackage{lipsum}

\begin{document}
\fancyfoot[r]{\thepage}
\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\lipsum[1-20]
\end{document}
1
  • In the standard casual template there should be page numbers. I don't know why, with the same package (1.5.1), I used to get page numbers a few time ago, but I don't get them anymore... See also tex.stackexchange.com/q/207374/27635 Dec 31, 2014 at 15:43

You must log in to answer this question.

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