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.
Asked
Active
Viewed 2.1k times
2 Answers
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
-
\phantomsectionbefore\pdfbookmarkis not needed, because the letter already sets an anchor. – Heiko Oberdiek Aug 22 '12 at 22:37 -
your solution helped me get what i wanted. using \phantomsection was enough. Thanks – A. K. Aug 23 '12 at 05:44
-
@Heiko Thanks for comment. Have now removed
\phantomsectionfrom my answer. – lpdbw Aug 23 '12 at 06:54
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, fortableofcontents - 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
hyperref, orbookmarkas well? Or how do you add things like\tableofcontentsto your bookmarks? – Werner Aug 22 '12 at 19:26bookmarkpackage 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