以下是 MWE:
\documentclass{moderncv}
\usepackage{hyperref}
\begin{document}
\cvitem {some text}{\href{url}}{text}
\end{document}
我遇到的问题是:
Option clash for package hyperref
还有第二个错误:
Paragraph ended before \\cvitem was complete.
我做错什么了?
答案1
moderncv
hyperref
使用选项自行加载包unicode
。这些是来自的几行moderncv.cls
。
\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}}}}
因此,如果你再次加载包,错误
Option clash for package hyperref
生成。因此,请\usepackage{hyperref}
从文件中删除该行。另一方面,如果您想更改的某些设置hyperref
,请\hypersetup
在文件中的适当位置使用。
类似地,\cvitem
定义为(在moderncv.cls
)
\newcommand*{\cvitem}[3][.25em]{}
这意味着,\cvitem
接受三个参数,第一个参数是可选的。第一个参数实际上是 s 之间的空格,\cvitem
默认值为0.25em
。但是您使用了三个参数,所有三个参数都是必需的(括在括号中{}
)。删除一个参数。