# Have the leveling commands of the bookmark package any effect on the bookmarks of the standard sections?

I want to style my PDF bookmarks in a way such that I can manipulate the levels of the standard sections as I wish. I thought the bookmark package was the best choice to do this, unfortunately it does not behave as I expected. A MWE of my efforts follows:

\documentclass{book}
\usepackage{hyperref,bookmark}
\begin{document}
\tableofcontents
\bookmarksetup{level=0}
\part{Part}
\chapter{Chapter 1}
\bookmarksetup{rellevel=-1}
\chapter*{Chapter 2}
\bookmarksetup{level=1}
\chapter{Chapter 3}
\end{document}


The pdf bookmark-tree should look like this:

Part

|__Chapter 1

Chapter 2

|__Chapter 3

Obviously I cant use the \boomarksetup{startatroot} command of the bookmark package before Chapter 2 because Chapter 3 would also be pulled out to the root. On the other hand the level options included in the code seem only to have an effect on bookmarks which were manually set with \bookmark. However, I don't want to issue a manual bookmark for every chapter because this would be quite annoying and I would anyway end up with two entries in PDF-bookmarks. The package documentation is not the best and so far I did not figure if it is actually possible to achieve the styling with this package.

The reason why I dont use a part for 'Chapter 2' is that I want it to be typset like a Chapter in the ToC as well as in the body of the document. It is actually the title page of an Appendix.

One option would be to add "Chapter 2" to the ToC as a part instead of as a chapter; this, however, will treat "Chapter 2" as a part in the ToC and this is not desired. To correct the formatting in the ToC, you can use the titletoc package to locally make parts to behave as chapters in the ToC:

\documentclass{book}
\usepackage{titletoc}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\part{Part}
\chapter{Chapter 1}

\begingroup
\titlecontents{part}
[0pt]{\normalsize\bfseries\vskip10pt}{}{}
{\hfill\bfseries\contentspage}

\chapter*{Chapter 2}

Contents of Chapter 2....
\endgroup

\chapter{Chapter 3}

\end{document}


The resulting bookmark tree:

and the resulting ToC:

• Sure, in general this is an option, however, as I stated in my original post I don't want Chapter 2 to be typeset as a "Part" in the ToC. – Paul Hanson Nov 2 '11 at 15:04
• @PaulHanson: Ah... I'm sorry. I overlooked the last paragraph of your question. – Gonzalo Medina Nov 3 '11 at 2:52
• @PaulHanson: see my updated answer for a workaround. – Gonzalo Medina Nov 3 '11 at 3:07
• Thank You. Your solution works fine, even though I'm already using the tocloft package to customize my ToC. – Paul Hanson Nov 4 '11 at 20:56

\bookmarksetup{rellevel=-1}


by

\bookmarksetupnext{rellevel=-1}


to achive the desired effect. Additionally you can remove

\bookmarksetup{level=0}


and

\bookmarksetup{level=1}


and you should note that the header in Chapter 2 will read "Chapter 1" and Chapter 3 will be named "Chapter 2", because you used \chapter*{Chapter 2} instead of \chapter{Chapter 2}, but maybe you want this (and manually change things).