软件包 hyperref 的选项冲突

软件包 hyperref 的选项冲突

我正在尝试在我的 tex 文件中使用 hyperref..这是一个最小的工作示例..它给了我选项冲突错误

\documentclass[12pt]{report}

\usepackage{hyperref}  
\hypersetup{
     colorlinks=true,
     linkcolor=black,
     citecolor=black,
     filecolor=black,
     urlcolor=black,
 } 
\begin{document}



\end{document}

之前一切都运行正常,但我不得不重新安装我的 Ubuntu,现在编译时出现错误,Option clash for package hyperref 我没有明确调用 hyperref 两次。我只想调用一次。问题是我几个月前就修复了这个问题,但现在我记不清是怎么修复的了 :( 这让我抓狂。

更新:

这是使用上述 MWE 从命令行 pdflatex.exe 获得的精确输出。我遇到了与 MWE 相同的错误。下面提到的第 102 行来自 hyperref.sty .. 我通过文件夹中的 grepping 发现了这一点.. 这是什么意思?

! LaTeX Error: Option clash for package hyperref.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.102 \usepackage
                 [numbered]{hypdoc}
? H
The package hyperref has already been loaded with options:
  []
There has now been an attempt to load it with options
  [colorlinks,hyperindex=false,pdfusetitle,pdfpagelabels]
Adding the global options:
  ,colorlinks,hyperindex=false,pdfusetitle,pdfpagelabels
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.

答案1

我猜你有一个过时的系统或者你有一个本地树,其中包含一个过时的包hyperref,调用hypdoc你在错误消息中看到的,你引用了。

使用当前版本的 MiKTeX,pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2015.7.19)我添加了一个命令\listfiles(之前\documentclass{})来获取系统上使用的软件包和版本的列表。您将在文件末尾找到此列表.log

 *File List*
  report.cls    2014/09/29 v1.4h Standard LaTeX document class
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/04/25 v1.12 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/04/25 v1.12 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/04/25 v1.12 Construct package bundles (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
   color.sty    2014/10/28 v1.1a Standard LaTeX Color (DPC)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
supp-pdf.mkii
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)

请与您的系统进行比较。我想您会发现一些差异...

相关内容