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 have the following document (this is an example):

\documentclass{book}

\usepackage[bookmarks=true,pdfborder={0 0 0}]{hyperref}

\title{Sample document}

\begin{document}

\thispagestyle{empty}
\maketitle
\thispagestyle{empty}
\frontmatter

\pagestyle{plain} 
\tableofcontents

\mainmatter
\part{My first part}
\chapter{A chapter}
\section{First section}
A text...
\chapter{Other chapter}
Other text...

\part{My second part}
\chapter{Another chapter}
Yet another text...

\end{document}

And the PDF bookmarks that is being produced do not satisfy my needs. I needed:

  • A root node "Sample document" pointing to the begining of first page of the document (title page)
  • Contents page (TOC) appearing like one document part on bookmarks (but not in TOC, I don't want it to appear in TOC, only in Bookmarks)
  • Instead of "I My first part" I wanted "Part I: My first part" and so on to the other parts
  • Instead of "A chapter" I wanted "1 A chapter", instead of "Other chapter" I wanted "2 Another Chapter" and so on
  • The section would continue to appear as it currently does on bookmarks, with no numbers, only its title

How can I do that?

share|improve this question
add comment

2 Answers 2

up vote 14 down vote accepted

You could use the bookmark package. For example:

\usepackage[numbered]{bookmark}

causes numbered bookmarks, such as the desired 2 Other chapter.

\bookmark[page=1,level=0]{Sample document}

At the beginning gives you the desired first bookmark. It offers many more features described in the documentation. Just follow the link above to CTAN or type texdoc bookmark at the command prompt.

share|improve this answer
    
Thanks, I have solved all the mentioned issues. I will post an answer detailing what I did based on your solution so it may help others too. –  Weslei Feb 24 '11 at 18:42
add comment

I solved my bookmarks problem using Stefan suggestion. I'm posting here what I did, so It may help anyone that comes to this question and is facing the same issues.

Adding the root node:

\bookmark[page=1,level=-2]{Sample document}

Adding the contents page to Bookmarks and not to table of contents:

\hypertarget{tocpage}{}
\tableofcontents
\bookmark[dest=tocpage,level=-1]{Contents}

Changing "I My first part" to "Part I: My first part":

\part*{My first part}
\addcontentsline{toc}{part}{Part I: My first part}

Changing "A chapter" to "1 A chapter" on bookmarks:

\usepackage[numbered]{bookmark}
share|improve this answer
1  
it's great that you post your final solutions! –  Stefan Kottwitz Feb 24 '11 at 18:48
1  
FYI, to add a bookmark linked to the slide with the outline in Beamer, I found it is more appropriate to use \bookmark[page=\thepage,level=-1]{Contents} as it enables to correctly handle outer theme elements. –  AldurDisciple Apr 12 '13 at 16:02
add comment

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.