2

I'm using biblatex together with titlesec (yes, I know that they don't work well together ...). When I include the titlesec-package the hyperref bookmarks link to the wrong page.

Consider the following MWE:

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book {A,
    author = {Doe, John},
    title = {A title},
    date = {2014},
    location = {A},
}
\end{filecontents}

\usepackage[
    style=authortitle,
    backend=biber,
]{biblatex}

\usepackage[
    bookmarks,
    bookmarksopen,
]{hyperref}

\addbibresource{\jobname.bib}

%\usepackage{titlesec} % uncomment to see the undesired behaviour

\begin{document}

\pagenumbering{Roman}

\tableofcontents
\newpage

\printbibliography[
    heading=bibintoc,
]

\newpage
\pagenumbering{arabic}

\section{My Section}
\cite{A}

\end{document}

Any help is greatly appreciated.

Thorsten
  • 12,872

1 Answers1

5

You should definitely load titlesec before hyperref.

Adding \phantomsection before \printbibliography solves the problem. You can avoid specifying it with a patch:

\documentclass{article}

\begin{filecontents}{\jobname.bib}
@book {A,
    author = {Doe, John},
    title = {A title},
    date = {2014},
    location = {A},
}
\end{filecontents}

\usepackage[
    style=authortitle,
    backend=biber,
]{biblatex}
\makeatletter
\pretocmd{\blx@head@bibintoc}{\phantomsection}{}{\ddt}
\makeatother

\usepackage{titlesec} % uncomment to see the undesired behaviour

\usepackage[
    bookmarks,
    bookmarksopen,
]{hyperref}

\addbibresource{\jobname.bib}

\begin{document}

\pagenumbering{Roman}

\tableofcontents
\newpage

\printbibliography[
    heading=bibintoc,
]

\newpage
\pagenumbering{arabic}

\section{My Section}
\cite{A}

\end{document}
egreg
  • 1,121,712