使用 KOMA 和 scrbook 我发现目录的 pdf 书签出现在错误的层次结构级别,见下图。
简而言之,按照 Markus Kohm 编写的“指南 - KOMA-Script”2017-08-08 版第 89 页,文档分为三个部分:前言、正文和后记。除目录 (TOC) 外,所有 pdf 书签都位于正确的层次结构级别。在此示例中,TOC 位于“关于作者”下,显然不正确。有人能看出下面代码有什么问题吗?
注意,要为封面添加 PDF 书签条目,我成功使用了
\hypertarget{Cover}{}
\bookmark[level=section,dest=Cover]{Cover}
谢谢
约翰
代码示例(使用 miktex-portable-2.9.6361 编译)
\documentclass[twoside=false]{scrbook}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{bookmark}
\hypersetup{
colorlinks=false,
linkbordercolor=1 1 1,
}
\begin{document}
\frontmatter
%--------------------------------
% 1. Cover (frontmatter)
%--------------------------------
\begingroup
\hypertarget{Cover}{}
\bookmark[level=section,dest=Cover]{Cover}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\draw (current page.center) node []{\Huge\centering\bfseries\sffamily\parbox[c][][t]{\paperwidth}{\centering Lorem ipsum dolor\\[18pt]
{\Large Consectetuer adipiscing elit}\\[20pt]
{\huge J. Appleseed \& B. Doe}}};
\end{tikzpicture}
\vfill
\endgroup
\clearpage
\thispagestyle{empty}
%--------------------------------
% 2. Copyright (frontmatter)
%--------------------------------
\chapter{Copyright}
Copyright 2017 by Authors\\
\noindent This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license. This license is available at\\
\noindent http://creativecommons.org/licenses/by-nc-sa/3.0/
%----------------------------------------------------------------------------------------
% About the Author (frontmatter)
%----------------------------------------------------------------------------------------
\chapter{About the Authors}
\textbf{Johnny Appleseed}
\lipsum[30]
\bigskip
\noindent \textbf{Bob Doe}
\lipsum[31]
\clearpage
\thispagestyle{empty}
%----------------------------------------------------------------------------------------
% Table of contents (frontmatter)
%----------------------------------------------------------------------------------------
\hypertarget{tableofcontents}{}
\bookmark[level=section,dest=tableofcontents]{Table of Contents}
\tableofcontents
%----------------------------------------------------------------------------------------
% Foreword (frontmatter)
%----------------------------------------------------------------------------------------
\chapter{Foreword}
\lipsum[1-3]
\mainmatter
\chapter{Lorem ipsum}
\lipsum[1-2]
\section{Donec felis erat}
\lipsum[3-6]
\chapter{Sed commodo}
\lipsum[7-8]
\section{Pharetra ligula}
\lipsum[9-12]
\backmatter
\end{document}