LaTeX 错误:包 hyperref 的选项冲突

发布于 2025-01-10 01:59:14 字数 1977 浏览 1 评论 0原文

\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{[email protected]} 
\extrainfo{\hrefd{xc.com}}    
%\photo[64pt][0.4pt]{photo.jpg} 


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

错误:

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.

当我尝试转换为 pdf 时,我得到一个空的 html 文件。

\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{[email protected]} 
\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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云裳 2025-01-17 01:59:14

moderncv 类自动加载 hyperref 包。您可以使用 \PassOptionsToPackage{hidelinks}{hyperref} 确保它加载了您想要的选项。

(尽管您的 hidelinks 选项不会产生很大的影响,因为 Moderncv 将链接框的线宽设置为零,因此它们已经不可见)

\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{[email protected]} 
%\extrainfo{\hrefd{xc.com}}    
%\photo[64pt][0.4pt]{photo.jpg} 


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

\url{stackoverflow.com}

\end{document}

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{[email protected]} 
%\extrainfo{\hrefd{xc.com}}    
%\photo[64pt][0.4pt]{photo.jpg} 


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

\url{stackoverflow.com}

\end{document}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文