# How can I add Section numbering and a Contents entry to the PDF bookmarks?

I'm having a bit of trouble with the PDF bookmarks. I am trying to

1. Add "Contents" as an entry to the PDF bookmarking.
2. Have numbering for my sections and subsections.

I am looking to achieve something like this (image taken from the bookmarks package documentation):

So far, I have only managed to generate my PDF bookmarks, but not edit them.

I have included a sample of my document with the following note. The code is only an attempt at a MWE, if there are lines of code that are not relevant to this problem then please feel free to edit. Sorry for the length!

\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fnpct}

%\usepackage[numbered]{bookmark}

\usepackage[a4paper]{geometry}
\geometry{top=1.0in, bottom=1.15in, left=1.15in, right=1.15in}

\usepackage[usenames,dvipsnames]{color}
\usepackage{natbib}

\usepackage{footnotebackref}
\newcounter{intro}
\renewcommand{\theintro}{Int.}

\begin{document}

\begin{titlepage} \Huge{\sc{Title}} \end{titlepage}

\thispagestyle{empty}
\newpage
\clearpage
\thispagestyle{empty}
\phantom{a}
\vfill
\newpage
\vfill

\begin{center}
\textbf{\Large{Abstract}} \\
\vspace*{0.43 cm}
\noindent This is the abstract so far.
\end{center}

\thispagestyle{empty}
\newpage

\clearpage
\thispagestyle{empty}
\phantom{a}
\vfill
\newpage
\vfill

\thispagestyle{empty}
\tableofcontents
\newpage

\section*{Introduction}
\refstepcounter{intro}
\label{s:intro}

\section[Title to be added to ToC]{Title to be added to ToC\\ \large{Subtitle only appearing in text}}\label{label1}
\subsection{Subsection name here}
\subsection{Other name here}
\section{Another section}

\bibliographystyle{plain}
\begin{thebibliography}{99}
...
\end{thebibliography}
\end{document}


When I tried to use the bookmark package I got the error that there was an "option clash" between bookmark and hyperref.

• You must load package bookmark after package hyperref. – Mensch Sep 14 '12 at 14:58

Additional bookmarks can be added via \pdfbookmark, see example below. Also I have disabled page anchors for the first pages to avoid duplicate destination names, because some of the pages have the same page number. (Also I have disabled two packages that I do not have installed).

\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{amsmath}
\usepackage{amssymb}
% \usepackage{fnpct}

\usepackage[a4paper]{geometry}
\geometry{top=1.0in, bottom=1.15in, left=1.15in, right=1.15in}

\usepackage[usenames,dvipsnames]{color}
\usepackage{natbib}
urlcolor=Blue}

\usepackage{bookmark}
\bookmarksetup{
numbered,
open,
}

% \usepackage{footnotebackref}
\newcounter{intro}
\renewcommand{\theintro}{Int.}

\begin{document}

\hypersetup{pageanchor=false}

\begin{titlepage} \Huge{\sc{Title}} \end{titlepage}

\thispagestyle{empty}
\newpage
\clearpage
\thispagestyle{empty}
\phantom{a}
\vfill
\newpage
\vfill

\begin{center}
\textbf{\Large{Abstract}} \\
\vspace*{0.43 cm}
\noindent This is the abstract so far.
\end{center}

\thispagestyle{empty}
\newpage

\clearpage
\thispagestyle{empty}
\phantom{a}
\vfill
\newpage

\hypersetup{pageanchor=true}
\thispagestyle{empty}
\pdfbookmark[section]{\contentsname}{toc}
\tableofcontents
\newpage

\section*{Introduction}
\refstepcounter{intro}
\label{s:intro}

\large Subtitle only appearing in text}\label{label1}
% \large does not take an argument
\subsection{Subsection name here}
\subsection{Other name here}
\section{Another section}

\bibliographystyle{plain}
\begin{thebibliography}{99}
...
\end{thebibliography}
\end{document}

• Thank you! I now have numbering of sections as well as the "Contents" entry and, with your example I can make even more. Oh, and thanks for making the package in the first place! – User 17670 Sep 14 '12 at 15:38

As you are using hyperref I dont see the need for any additional package like bookmark For the numbering of regular section : hyperref as has an option bookmarksnumbered which does the job ! For the label of *-section : hyperref also defines a \phantomsectioncommand which creates the expected (unnumbered) bookmark, and which can be used for bookmarking the the toc if you use \addcontentsline{toc}{section}{Contents} to include it in the toc.

Example :

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\begin{document}
\phantomsection
\tableofcontents
\clearpage
\section{first}
some text
\clearpage
\section{second}
another text
\end{document}


where the \clearpage are used only to change the pages of successive sections.

Result :