# Problems with titlesec, hyperref, biblatex and tocbibind

I am using the titlesec package to change the section font to sans-serif. Unfortunately, this breaks the links to "unnumbered" sections both in the TOC and in the bookmarks sidebar of PDF readers. I am using the tocbibind package and the heading=bibintoc setting of biblatex to add both the bibliography and the list of figures to the TOC.

In the following example, only the link to "Section" works. Clicking on "List of Figures" jumps to the TOC instead, clicking on "References" jumps to "Section".

foo.tex

\documentclass{article}
\usepackage[sf,bf]{titlesec}
\usepackage[nottoc]{tocbibind}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\clearpage

\listoffigures

\clearpage

\section{Section}

\clearpage

\nocite{foo}

\end{document}


foo.bib (only needed because biblatex otherwise complains about an empty bibliography)

@book{foo,
author = {foo},
title = {foo}
}


Any way to fix this?

-
Does a \phantomsection in front of \listoffigures resolve your problem? –  Qrrbrbirlbel Sep 28 '12 at 14:15
It does, thanks! –  WakiMiko Sep 28 '12 at 14:19

It seems that there's a problem with titlesec; in this particular case, a possible solution is to use the sectsty package instead; this will produce the correct links without having to manually add \phantomsection (after all, that's part of the role of tocbibind):

\documentclass{article}
\usepackage{sectsty}
\usepackage[nottoc]{tocbibind}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}

\allsectionsfont{\sffamily\bfseries}

\begin{document}

\tableofcontents
\clearpage
\listoffigures
\clearpage
\section{Section}
\clearpage
\nocite{*}

\end{document}

-
That is even better, thanks! –  WakiMiko Sep 28 '12 at 15:03

Add \phantomsection in front of \listoffigures and printbibliography:

\documentclass{article}
\usepackage[sf,bf]{titlesec}
\usepackage[nottoc]{tocbibind}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}

\begin{document}
\tableofcontents\clearpage

\phantomsection
\listoffigures\clearpage

\section{Section}
\clearpage

\nocite{foo} \phantomsection

hyperref manual states:
This sets an anchor at this location. It works similar to \hypertarget{}{} with an automatically chosen anchor name. Often it is used in conjunction with \addcontentsline for sectionlike things (index, bibliography, preface). \addcontentsline refers to the latest previous location where an anchor is set.
You should check that the link to the references, with your example, points to Section 1. Without titlesec all the links are correct without adding \phantomsection. –  egreg Sep 28 '12 at 14:29