2

Using KOMA and scrbook I find that the pdf bookmark for the table of contents comes in on the wrong hierarchy level, see image below.

Table of Contents is on the wrong hierarchy level in the PDF bookmarks

Briefly, following "The Guide - KOMA-Script" by Markus Kohm version 2017-08-08, page 89, the document is divided into three sections: front matter, main matter, and back matter. All pdf bookmarks are on the correct hierarchy level, except that for Table of Contents (TOC). In this example, TOC is placed under "About the Authors", obviously not correct. Can anyone see what is wrong in the code below?

Note, to add a PDF bookmark entry for the Cover page I successfully used

\hypertarget{Cover}{}
\bookmark[level=section,dest=Cover]{Cover}

Thanks

John

Code example (compiles with 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}
  • 4
    Use level=chapter in the argument of \bookmark. – esdd Sep 26 '17 at 8:41
  • Thanks, problem solved! I guess the pdf bookmark for the cover came out correct because it is the first entry, although it should also be on the chapter level. – John Sep 26 '17 at 10:20
  • Off-topic: Never use \\ at the end of a paragraph. – Schweinebacke Sep 26 '17 at 10:55
2

With scrbook the correct level for ToC (and for cover too) is chapter:

\hypertarget{tableofcontents}{}
\bookmark[level=chapter,dest=tableofcontents]{Table of Contents}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.