3

I finished my cv with moderncv and have some trouble getting rid of the errors, hope someone can help me out. I use moderncv 1.4 and tried to add additional bookmarks to the document for the attachments like in this MWE:

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

\firstname{My}
\familyname{Name}
\address{MyAddress}{MyCity}
\phone{MyPhone}
\mobile{MyMobile}
\email{MyMail}

\moderncvtheme[blue,sans]{casual}

\usepackage{pdfpages}
\usepackage{bookmark}

\begin{document}

\bookmark[page=\thepage,level=0]{First attachment}
attachment 1

\bookmark[page=\thepage,level=0]{Second attachment}
attachment 2

\end{document}

Problem is I get an option clash for package hyperref: "The package hyperref has already been loaded with options: [] There has now been an attempt to load it with options [unicode]". How should I fix this? Another thing that bothers me is that the first bookmark is greyed out, I don´t know what that means in Acrobat Reader, but it can´t be right, can it?

enter image description here

5

The problem is that moderncv loads hyperref forced at the end of the preamble. In other words, it is always loaded after everything else. In the moderncv package, hyperref is loaded with the option unicode for CJK compatibility. This classes with bookmark, because it loads hyperref without the unicode option, and options are only allowed the first time a package is loaded.

You can solve this by enforcing the option unicode is passed to hyperref when loading the package, before the documentclass, etc. is even loaded. For this you need \PassOptionsToPackage{unicode}{hyperref}. The full code becomes as follows, which loads without problems:

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

\firstname{My}
\familyname{Name}
\address{MyAddress}{MyCity}
\phone{MyPhone}
\mobile{MyMobile}
\email{MyMail}

\moderncvtheme[blue,sans]{casual}

\usepackage{pdfpages}
\usepackage{bookmark}

\begin{document}

\bookmark[page=\thepage,level=0]{First attachment}
attachment 1

\bookmark[page=\thepage,level=0]{Second attachment}
attachment 2

\end{document}

The greyed out problem is probably just your pdf viewer, in which one bookmark is selected and the other is not. Its not because the tex code (no problems here with Adobe or Sumatra).

5
  • Thank you very much your help is much appreciated. I tested the document with Adobe Reader on Win8 and MacOSX, the greyed out problem occurs on both systems. Sometimes when I click a bookmark the grey mark jumps to the clicked bookmark, sometimes it doesn´t, very weird. – chris Apr 22 '13 at 9:25
  • @chris; what happens when you have more than 2 bookmarks. Is still only the first one greyed out? Or are all non-selected bookmarks greyed out? or maybe the opposite? It is a weird problem, but I have a feeling it might be intentionally behaving like it is. – Mythio Apr 22 '13 at 9:41
  • I have 15 bookmarks on different levels (depth = 2), when I click through them in 2 out of 5 cases the bookmark isn´t greyed out. When I click on another bookmark and click the same again it is greyed out, so in general it seems to work on every bookmark, but it doesn´t sometimes. – chris Apr 22 '13 at 9:58
  • I think I figured it out. This grey mark just jumps to another bookmark when the clicked bookmark is on another page. Otherwise it stays with the bookmark that was first selected on the current page. Strange behaviour but maybe it´s a feature and not a bug. – chris Apr 22 '13 at 10:41
  • Sounds like it could be both, but definetly not a result if incorrect tex code. Perhaps it will disappear with future updates. – Mythio Apr 22 '13 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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