PDF 包含不正确的书签层次结构

PDF 包含不正确的书签层次结构

将我的 LaTeX 文档编译为 PDF 后,我注意到其内部书签使用了不正确的层次结构。将书签树与下面的目录进行比较:

目录                   书签

这是怎么回事?我该如何解决?我从来没有手动修改过书签系统。


这是一个最小的工作示例:

\documentclass[a4paper,oneside]{report}
\usepackage[a4paper]{geometry}
\usepackage[dutch,english]{babel}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage[font={it,sf},labelfont=bf]{caption}
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage[colorlinks=true,linkcolor=black,citecolor=red,urlcolor=red]{hyperref}
\title{AAA}
\author{AAA}
\date{AAA}

\begin{document}
\maketitle

\null
\vfill
\thispagestyle{empty}


\abstract

\chapter*{Introduction}
\addtolength{\parskip}{10px}
\setlength{\parindent}{0cm}
\pagenumbering{roman}

\newpage
\selectlanguage{english}
\addtolength{\parskip}{-10px}
\tableofcontents

\addtolength{\parskip}{10px}
\chapter{A}
\pagenumbering{arabic}

\section{AA}


\subsection{AAA}


\subsection{AAB}


\section{AB}


\section{AC}


\subsection{ACA}


\subsection{ACB}


\section{AD}


\newpage
\section{AE}


\chapter{B}

\section{BA}


\section{BB}


\subsection{BBA}


\section{BC}


\subsection{BCA}


\section{BD}


\subsection{BDA}


\subsection{BDB}


\subsection{BDC}


\section{BE}

\chapter{C}

\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}
\chapter{D}
\selectlanguage{dutch}
\section{DA}

\subsection{DAA}


\subsection{DAB}


\subsection{DAC}


\subsection{DAD}


\subsection{DAE}


\subsection{DAF}


\subsection{DAG}

\newpage
\bibliographystyle{plain}

\end{document}

文件列表如下:

 *File List*
  report.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
geometry.sty    2010/09/12 v5.6 Page Geometry
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
geometry.cfg
   babel.sty    2008/07/08 v3.8m The Babel package
 bblopts.cfg    2006/07/31 v1.0 MiKTeX 'babel' configuration
   dutch.ldf    2005/03/30 v3.8i Dutch support from the babel system
 english.ldf    2005/03/30 v3.3o English support from the babel system
subfigure.sty    2002/07/30 v2.1.4 subfigure package
subfigure.cfg
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
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)
  lscape.sty    2000/10/22 v3.01 Landscape Pages (DPC)
 caption.sty    2012/02/19 v3.2f Customizing captions (AR)
caption3.sty    2012/01/12 v1.4b caption3 kernel (AR)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
dvipsnam.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
hyperref.sty    2012/05/13 v6.82q 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)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (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)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/05/13 v6.82q Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2006/04/12  ver 3.3  Verb mode for urls, etc.
 hpdftex.def    2012/05/13 v6.82q Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
supp-pdf.tex
 nameref.sty    2010/04/30 v2.40 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
 problem.out
 problem.out
 ***********

看起来这两行正在造成严重破坏:

\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}

答案1

该包hyperref应作为最后一个包加载。请参阅:

哪些包应该在 hyperref 之后加载而不是之前加载?

该包subfigure已过时,请改用subcaptionsubfig

如何跟上软件包并知道哪些已经过时了?

使用以下标题我没有遇到任何问题:

\documentclass[a4paper,oneside]{report}
\usepackage[a4paper]{geometry}
\usepackage[dutch,english]{babel}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage[font={it,sf},labelfont=bf]{caption}
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage[colorlinks=true,linkcolor=black,citecolor=red,urlcolor=red]{hyperref}

编辑

添加文件列表后,即可比较版本hyperref

我在用:

hyperref.sty    2012/05/13 v6.82q Hypertext links for LaTeX

您正在使用:

hyperref.sty    2010/03/30 v6.80u Hypertext links for LaTeX

您可以看到您需要更新您的 LaTeX 发行版。


编辑2

根据新信息,基于以下设置的问题:

\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}

这其实并不出乎意料。此时,hyperref每章都查找两次,然后您会收到警告:

pdfTeX warning (ext4): destination with the same identifier

为了解决这个问题,你必须\theHchapter以合适的方式重新定义。这里有一个建议:

\setcounter{chapter}{0}
\renewcommand{\theHchapter}{\Alph{chapter}}
\renewcommand{\thechapter}{\Alph{chapter}}

另一个提示:如果你用 XeLaTeX 编译,你就不能使用单位px
我不知道为什么

最后是完整的例子:

\documentclass[a4paper,oneside]{report}
\usepackage[a4paper]{geometry}
\usepackage[dutch,english]{babel}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage[font={it,sf},labelfont=bf]{caption}
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage[colorlinks=true,linkcolor=black,citecolor=red,urlcolor=red,plainpages=false,pdfpagelabels=true]{hyperref}
\title{AAA}
\author{AAA}
\date{AAA}

\begin{document}
\maketitle

\null
\vfill
\thispagestyle{empty}

\abstract

\chapter*{Introduction}
\addtolength{\parskip}{10pt}
\setlength{\parindent}{0cm}
\pagenumbering{roman}

\newpage
\selectlanguage{english}
\addtolength{\parskip}{-10pt}
\tableofcontents

\addtolength{\parskip}{10pt}
\chapter{A}
\pagenumbering{arabic}

\section{AA}


\subsection{AAA}


\subsection{AAB}


\section{AB}


\section{AC}


\subsection{ACA}


\subsection{ACB}


\section{AD}


\newpage
\section{AE}


\chapter{B}

\section{BA}


\section{BB}


\subsection{BBA}


\section{BC}


\subsection{BCA}


\section{BD}


\subsection{BDA}


\subsection{BDB}


\subsection{BDC}


\section{BE}

\chapter{C}

\setcounter{chapter}{0}
\renewcommand{\theHchapter}{\Alph{chapter}}
\renewcommand{\thechapter}{\Alph{chapter}}
\chapter{D}
\selectlanguage{dutch}
\section{DA}

\subsection{DAA}


\subsection{DAB}


\subsection{DAC}


\subsection{DAD}


\subsection{DAE}


\subsection{DAF}


\subsection{DAG}

\newpage
\bibliographystyle{plain}

\end{document}

答案2

在 hyperref 之后包含书签包(正如 @user45891 在最后一条评论中所建议的那样)解决了我的书签层次结构不正确的问题(与此处发布的问题不完全相同)。

相关内容