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.

I want to make a book without chapters are listed. Have an index (also don't want that chapters are listed in the index) and have the bookmark in the file.pdf. The problem is that I appear twice sections in bookmark. I'm using the package bookmark because hyperref not supported \pagenumbering{gobble} and use this command to suppress the numbering of pages and start it again after tableofcontents.

What I can do to have the bookmark, where sections appear only once, and get the index (tableofcontents) with links to each section?

MWE

\documentclass{book} 
...
\usepackage{bookmark}

\begin{document}
  \pagenumbering{gobble}
  \chapter*{Presentation} %Presentation of the book
  \bookmark[page=2,level=0]{Presentation} 

\tableofcontents

 \pagenumbering{arabic}
 \setcounter{page}{4}

  \chapter*{Test 1}
  \bookmark[page=4,level=0]{Test 1} % places the first bookmarks
  \addcontentsline{toc}{chapter}{Test 1} % places the second bookmarks

\end{document}

enter image description here

share|improve this question

1 Answer 1

Some remarks:

  • \addcontentsline{toc}{...}{...} already adds a bookmark.
  • I have disabled the page anchors for the pages with \pagenumbering{gobble} to avoid conflicts with page destinations for different pages, but the same destination name, because \thepage is empty.
  • \pdfbookmark can be used here that automatically sets an anchor and avoids an explicit page number specification.
  • Also I have added \cleardoublepage/\newpage to ensure the correct page, where \pagenumbering or \pdfbookmark are executed.

The example file:

\documentclass{book}
\usepackage{hyperref}
\usepackage{bookmark}

\begin{document}
  % ...
  \cleardoublepage
  \pdfbookmark{Presentation}{Presentation}
  \pagenumbering{gobble}
  \hypersetup{pageanchor=false}
  \chapter*{Presentation} %Presentation of the book

  \tableofcontents

  \newpage
  \hypersetup{pageanchor=true}
  \pagenumbering{arabic}
  \setcounter{page}{4}

  \chapter*{Test 1}
  \addcontentsline{toc}{chapter}{Test 1} % places the second bookmarks

\end{document}
share|improve this answer
    
Thanks @Heiko Oberdiek, your answer helped me a lot. –  lbautista May 14 '13 at 22:42

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.