[Tex/LaTex] Hyperref, Natbib: Curious backref behaviour

back-referencinghyperref

I have prepared the following MWE from the answer I found at formatting-back-references-in-bibliography. If the option backref=page is forwarded to hyperref with \hypersetup then the back references do not appear. But passing this option while calling the package works. Why is this?

MWE

\documentclass{article}

\usepackage[numbers]{natbib}

%\usepackage[backref=page]{hyperref}

\usepackage{hyperref}
\hypersetup{
  backref=page
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
\end{filecontents}

\begin{document}

Some text \citep{A01,B02}.

\clearpage

Some more text \citep{A01}.

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}

Best Answer

Note from the hyperref manual:

Some options can be given at any time, but many are restricted: before \begin{document}, only in \usepackage[...]{hyperref}, before first use, etc.

hyperref disables the backref option when the package is loaded. The reason for this restriction with backref is simply to make the implementation easier. (Note that it is supported to put the \hypersetup{backref} in hyperref.cfg.)

Note the warning you get when attempting to set the backref option after it has been disabled:

Package hyperref Warning: Option `backref' has already been used,
(hyperref)                setting the option has no effect on input line 10.

This is the standard warning text for disabled hyperref options, and is perhaps a bit misleading. It should say that the option has to be specified sooner.