5

In my thesis template, the dedication and acknowledgements are chapter*{} while other chapters are chapter{}. The problem comes using the hyperref-bookmarks. What happens is the table of contents, appear nested in the acknowledgement section. The list of figure nests in the table of contents, and the list of tables in list of figures.

A. K.
  • 229
  • What document class are you using? Also, are you only loading hyperref, or bookmark as well? Or how do you add things like \tableofcontents to your bookmarks? – Werner Aug 22 '12 at 19:26
  • I am using \usepackage[bookmarks=true]{hyperref}. The bookmarks get generated automatically when i use the bookmarks=true. I have not done anything on my own. – A. K. Aug 22 '12 at 19:33
  • 6
    You should make a short compileable example file just consisting of the chapter headings which demonstrates the described behaviour. – Stephan Lehmke Aug 22 '12 at 19:36
  • I am not completely sure what your problem is. But you might want to have a look at a recent question of mine tex.stackexchange.com/q/66642/16865 I think your problem is similar. In any case you should load the bookmark package which enables you to influence the behaviour of bookmarks, see ftp://ftp.rrzn.uni-hannover.de/pub/mirror/tex-archive/macros/latex/contrib/oberdiek/bookmark.pdf – lpdbw Aug 22 '12 at 19:49
  • someone just answered that I should put \phantomsection along with the starred chapters . It actually worked!. Please re-write that as the answer. Thanks. – A. K. Aug 22 '12 at 20:34

2 Answers2

3

Maybe not the most elegant solution ...

\documentclass{book}

\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{bookmark}

\begin{document}

\bookmarksetup{depth=-1}

\cleardoublepage
\pdfbookmark[0]{Preface}{preface}
\chapter*{Preface}
\lipsum

\cleardoublepage
\pdfbookmark[0]{Acknowledgments}{acknowledgements}
\chapter*{Acknowledgements}
Thanks to everybody.

\cleardoublepage
\pdfbookmark[0]{Contents}{toc}
\tableofcontents

\bookmarksetup{depth=0} %or a number >0

\chapter{First chapter}
\lipsum

\end{document}
lpdbw
  • 8,330
0

I guess that your problem is the lake of the line \addcontentsline{file}{sec_unit}{entry} after your \chapter*{entry}.

  • file: Refers to the file you want to add a line. In your case, toc, for tableofcontents
  • sec_unit: Sectioning type. In your case a chapter.
  • entry: The line you want to add. Say, the name of the chapter.

I'd illustrate its use with an example. Imagine your stared chapter is called Introduction. Thus, you should add a chapter line to the tableofcontents, called toc, then in your code use this,

\documentclass{report}

\begin{document}

\tableofcontents

\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}

\chapter{First chapter}


\end{document}

Hope it would help!

Cheers

Dox
  • 5,729