Search code examples
latexpdflatexoverleaf

LaTeX Error: Option clash for package hyperref


\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{banking} 
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\usepackage{graphicx}
\usepackage{float}

\usepackage{import}

% links Symbol
\usepackage{bbding,pifont}

\usepackage[hidelinks]{hyperref}

% Redefinition:
\let\orighref\href
\newcommand{\hrefa}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{...code}{#1}}
\newcommand{\hrefb}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{xxx/}{#1}}
\newcommand{\hrefc}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{ccc}{#1}}
\newcommand{\hrefd}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{vvv/}{#1}}
\newcommand{\hrefe}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{vvv}{#1}}
\newcommand{\hreff}[1]{\raisebox{-0.4ex}{\HandRight}\,\orighref{vvv}{#1}}
% end links symbol

% personal data
\name{...}
\title{}                               
\address{..}{}{}
\phone[mobile]{+...4}
\email{xxx@a.com} 
\extrainfo{\hrefd{xc.com}}    
%\photo[64pt][0.4pt]{photo.jpg} 


%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}

Error:

LaTeX Error: Option clash for package hyperref.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.40 \begin{document}
                     
The package hyperref has already been loaded with options:
  [hidelinks]
There has now been an attempt to load it with options
  [unicode]
Adding the global options:
  hidelinks,unicode
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.

when i try to convert to pdf, i get an empty html file.


Solution

  • The moderncv class automatically loads the hyperref package. You can use \PassOptionsToPackage{hidelinks}{hyperref} to make sure it is loaded with the options you want.

    (although your hidelinks option won't make a big difference because moderncv sets the line width of the link boxes to zero, so they are already invisible)

    \PassOptionsToPackage{hidelinks}{hyperref}
    
    \documentclass[11pt,a4paper,sans]{moderncv} 
    \moderncvstyle{banking} 
    \moderncvcolor{blue}
    \usepackage[utf8]{inputenc}
    \usepackage[scale=0.75]{geometry}
    
    \usepackage{graphicx}
    \usepackage{float}
    
    \usepackage{import}
    
    % links Symbol
    \usepackage{bbding,pifont}
    
    % personal data
    \name{...}
    \title{}                               
    \address{..}{}{}
    \phone[mobile]{+...4}
    \email{xxx@a.com} 
    %\extrainfo{\hrefd{xc.com}}    
    %\photo[64pt][0.4pt]{photo.jpg} 
    
    
    %----------------------------------------------------------------------------------
    %            content
    %----------------------------------------------------------------------------------
    \begin{document}
    test
    
    \url{stackoverflow.com}
    
    \end{document}