Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Aditya Kumar 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.rrzn.uni-hannover.de/pub/mirror/tex-archive/macros/latex/… –  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. –  Aditya Kumar Aug 22 '12 at 20:34

2 Answers 2

up vote 3 down vote accepted

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}
share|improve this answer
    
\phantomsection before \pdfbookmark is 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 –  Aditya Kumar Aug 23 '12 at 5:44
    
@Heiko Thanks for comment. Have now removed \phantomsection from my answer. –  lpdbw Aug 23 '12 at 6:54

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

share|improve this answer
    
Add contents line added another entry into the table of contents. –  Aditya Kumar Aug 22 '12 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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