Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

So, I was doing something like this:

\cfoot{\color{color2}\itshape John~~Doe}

to get my name centered on bottom of each page. Now I'd like to have it in one line with page number. Now it looks like that:

                 PAGE/PAGE
John Doe

And I'd like to look it like this:

John Doe         PAGE/PAGE

My name, and numbered page in one line. With \lfoot or \cfoot I can't achieve that.

Also, how to start page numbering from page 2? \setcounter{page}{2} does not works. Thanks in advance.

Minimal working example (\newpage's were added ONLY to force page numbers - I don't use them in original document!):

\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{orange}
\usepackage[scale=0.75]{geometry}
\usepackage{fontspec}

\firstname{John}
\familyname{Doe}
%\title{}
\address{street}{postcode city}
\mobile{+4~(11)~311~111}
%\phone{+2~(345)~678~901}
%\fax{+3~(456)~789~012}
\email{mail@yahoo.com}
%\homepage{www.johndoe.com}
\extrainfo{additional info}
\photo[64pt][0.4pt]{picture.png}
%\quote{}

\cfoot{\color{color2}\itshape John~~Doe}

\begin{document}

\section{Expirience}

\subsection{My work}
\cvcomputer{One}{Bla, Bla, Bla}{Two}{Bla,Bla,Bla}

\newpage

\section{Foreign Languages}
\cvitemwithcomment{English}{Fluent}{Some description here}

\newpage

\section{Other Skills}
\cvitemwithcomment{Computers}{Very good}{Some description here}

\end{document}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

It seems to be a bug of moderncv. moderncv puts the page number in a \parbox but doesn't justify them vertical. So you can use the following redefinition:

\makeatletter
\renewcommand*{\nopagenumbers}{\@displaypagenumbersfalse}
\AtEndPreamble{%
  \AtBeginDocument{%
    \if@displaypagenumbers%
      \@ifundefined{r@lastpage}{}{%
        \ifthenelse{\pageref{lastpage}>1}{%
          \settowidth{\pagenumberwidth}{\color{color2}\addressfont\itshape\strut\thepage/\pageref{lastpage}}%
          \fancypagestyle{plain}{%
            \fancyfoot[r]{\parbox[t]{\pagenumberwidth}{\color{color2}\addressfont\itshape\strut\thepage/\pageref{lastpage}}}}% the parbox is required to ensure alignment with a possible center footer (e.g., as in the casual style)
          \pagestyle{plain}}{}}%
      \AtEndDocument{\label{lastpage}}\else\fi}}
\makeatother

enter image description here

share|improve this answer
    
Thanks. This worked like a charm. And how to force moderncv to start counting pages from page 2? I think I could e-mail author of moderncv to fix this bug, of course by pointing him to your message. –  Teddy Apr 20 '12 at 21:30
    
@Teddy: Try at the first page \thispagestyle{empty}. It removes all headers and footers. If you want to suppress only the page numbering you have to set \fancyfoot. –  Marco Daniel Apr 20 '12 at 21:41
    
Bingo! Perfect. :) \thispagestyle{empty} was what I needed. –  Teddy Apr 20 '12 at 21:47
    
I've e-mailed autor of moderncv about this. It seems that we still have no official fix for this. I'd be very happy if I could remove above code suggested by Marco from my .tex document. –  Teddy Jul 20 '12 at 22:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.