I would like to pass specific options to a moderncv document.
The problem is options are already loaded by the moderncv class (file /usr/share/texlive/texmf-dist/tex/latex/moderncv/moderncv.cls on debian).
This moderncv.cls file contains an hyperref setup section:
% hyper links (hyperref is loaded at the end of the preamble to pass options required by loaded packages such as CJK)
\newcommand*\pdfpagemode{UseNone}% do not show thumbnails or bookmarks on opening (on supporting browsers); set \pdfpagemode to "UseOutlines" to show bookmarks
\RequirePackage{url}
\urlstyle{tt}
\AtEndPreamble{
\pagenumbering{arabic}% has to be issued before loading hyperref, as to set \thepage and hence to avoid hyperref issuing a warning and setting pdfpagelabels=false
\RequirePackage[unicode]{hyperref}% unicode is required for unicode pdf metadata
\hypersetup{
breaklinks,
baseurl = http://,
pdfborder = 0 0 0,
pdfpagemode = \pdfpagemode,
pdfstartpage = 1,
pdfcreator = {\LaTeX{} with 'moderncv' package},
% pdfproducer = {\LaTeX{}},% will/should be set automatically to the correct TeX engine used
bookmarksopen = true,
bookmarksdepth= 2,% to show sections and subsections
pdfauthor = {\@firstname{}~\@lastname{}},
pdftitle = {\@firstname{}~\@lastname{}\notblank{\@title}{ -- \@title}{}},
pdfsubject = {Resum\'{e} of \@firstname{}~\@lastname{}},
pdfkeywords = {\@firstname{}~\@lastname{}, curriculum vit\ae{}, resum\'{e}}}}
I do not want to modify this file because it will be erased by updates.
I would rather enter hypersetup options in my .tex document and want them to override the default options described in the .cls file.
In my .tex document, \hypersetup{}
is not recognized. And if I add \usepackage{hyperref}
I have LaTeX Error: Option clash for package hyperref.
because hyperref is called twice (in .cls and in .tex). Here is the complete log:
The package hyperref has already been loaded with options:
[]
There has now been an attempt to load it with options
[unicode]
Adding the global options:
,unicode
to your \documentclass declaration may fix this.
I added "unicode" to \documentclass[11pt,a4paper,roman,unicode]{moderncv}
but I still have the same error.
\AtEndPreamble{
so you can load it before then (includeunicode
option to avoid a clash) or use\hypersetup
inside\AtEndPreamble
so it is executed later, after hyperref is loaded