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.

Whenever I compile a CV with moderncv, I get four warnings by hyperref. There don't seem to be any serious problems connected to them, yet they bug me. I like my documents to compile without warnings. How can I avoid these warnings? (Preferably without patching moderncv.cls itself, I'd rather add a few lines in each of my CVs.)

MWE:

\documentclass{moderncv}

\firstname{John}
\familyname{Doe}

\begin{document} 
\maketitle

\cvline{always}{King of the World}

\end{document}

The warnings:

Package hyperref Warning: Option `pdfpagelabels' is turned off
(hyperref)                because \thepage is undefined.

Package hyperref Warning: Option `baseurl' has already been used,
(hyperref)                setting the option has no effect on input line 6.

Package hyperref Warning: Option `pdfpagemode' has already been used,
(hyperref)                setting the option has no effect on input line 6.

Package hyperref Warning: Option `pdfstartpage' has already been used,
(hyperref)                setting the option has no effect on input line 6.

UPDATE:

Version 0.19 (2012/02/06) of moderncv only produces these warnings, the latter of which appears to be new:

Package hyperref Warning: Option `pdfpagelabels' is turned off
(hyperref)                because \thepage is undefined.

Package hyperref Warning: Option `pdfpagelabels' has already been used,
(hyperref)                setting the option has no effect on input line 6.
share|improve this question

closed as too localized by doncherry, Torbjørn T., Werner, Thorsten, zeroth Oct 16 '12 at 6:20

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
<rant>I find it easier to not to use moderncv than fix all its bugs.</rant> –  Andrey Vihrov Nov 15 '11 at 12:50
    
@AndreyVihrov: Well, but not every LaTeX user has the level of expertise and the typesetting skills you have ;) –  doncherry Nov 15 '11 at 12:52
1  
I put together a smashing custom CV, and I'm hardly an expert. You should give it a go! –  qubyte Nov 15 '11 at 12:57
    
I'm voting to close this question as too localized because it doesn't apply to current systems anymore (cf. my answer). It makes my heart bleed to have a question of mine closed for the first time on tex.sx, but alas ... –  doncherry Oct 16 '12 at 2:44

4 Answers 4

You can avoid the first warning by setting the option before \documentclass:

\PassOptionsToPackage{pdfpagelabels=false}{hyperref} 

You can't avoid the other three without patching moderncv. moderncv sets some hyperref options incorrectly in a \AtBeginDocument.

share|improve this answer
    
Do you have any idea why these incorrect options aren't patched? The latest version of moderncv was deployed not even a week ago. –  doncherry Nov 16 '11 at 11:40
    
Probably nobody told the author about the problem. Did you write him? –  Ulrike Fischer Nov 16 '11 at 12:55
    
I just e-mailed him. Let's see what happens. –  doncherry Nov 16 '11 at 15:07

You may deactivate all warnings of package hyperref before loading the class:

\RequirePackage{etoolbox}
\pretocmd\PackageWarning{%
  \edef\pkgname{#1}\edef\hyperrefname{hyperref}%
  \ifx\pkgname\hyperrefname
    \expandafter\gobblethree
  \fi
}{}{\undefined}
\newcommand*{\gobblethree}[3]{}

\documentclass{moderncv}

\firstname{John}
\familyname{Doe}

\begin{document} 
\maketitle

\cvline{always}{King of the World}

\end{document}

Nevertheless moderncv does some strange things (e.g. forcing option pdftex).

share|improve this answer
    
While this works, I'd still like to get actual warnings by hyperref, I guess I should've specified that; i.e. I'm looking for a way to rule out the reasons for the warnings. –  doncherry Nov 16 '11 at 11:38
    
In this case best would be to fix the buggy class, e.g., write a bug report to the author. –  Schweinebacke Nov 16 '11 at 14:56

(A bit late, but it might still be helpful for someone...)

Using the latest version (1.0, released in March 2012) of moderncv from CTAN removed all but the first warning.

For some reason, setting the pdfpagelabels option with \PassOptionsToPackage did not work for me. I finally decided to use the silence package to silence all warnings from the hyperref package, by placing the following code before \documentclass:

\RequirePackage[]{silence}

\WarningsOff[hyperref]

It is not perfect, but I consider it acceptable until moderncv gets better at playing nice with others...

share|improve this answer
up vote 1 down vote accepted

With the advent of moderncv version 1.1.3, all of these warnings have disappeared. If you still get them, update your moderncv!

Changelog:

version 1.1.3 (10 Aug 2012) - corrected a longstanding issue causing hyperref to issue two warnings regarding its "pdfpagelabels" option, as pointed out and solved by P. Leifeld (launchpad bug #1035466).

The minimal code requirements seem to have changed as well, you now need to declare a \moderncvstyle; \maketitle now is called \makecvtitle, which isn't necessary for an MWE however (I don't recall if it was earlier or if I had put it there for looks).

\documentclass{moderncv}

\moderncvstyle{casual}

\firstname{John}
\familyname{Doe}

\begin{document} 

%\makecvtitle

\cvline{always}{King of the World}

\end{document}
share|improve this answer

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