[Tex/LaTex] multibib and links to bibliography (with hyperref, natbib)

hyperreflinksmultibibnatbibsubdividing

I'm using the multibib package but cannot get links to work with it and hyperref. Is this combination possible? A sample document follows:

If I add a \usepackage{natbib} in the preamble then links do work, but the custom labeling provided by multibib is removed. For example, without natbib the citations are [F3] and [B2] and no links. With natbib, citations are (3) and (2) and do link.

The multibib documentation (PDF) has a section (3) on how to handle packages which modify \@citex, but I am not sure how to use the information there to solve this problem.

% multibiblinktest.tex

\documentclass[10pt,letter]{article}

\usepackage[labeled,resetlabels]{multibib}
\newcites{F}{Foo}
\newcites{B}{Bar}

\usepackage{hyperref}
\hypersetup{
  colorlinks = true,
  linkcolor=blue,   % color of internal links
  citecolor=blue,   % color of links to bibliography
  urlcolor=blue,    % color of external links
  pagebackref=true,
  implicit=false,
  bookmarks=true,
  bookmarksopen=true,
  pdfdisplaydoctitle=true
}

% \usepackage{natbib} % links work, citations not formatted by multibib...

\begin{document}

\nociteF{ref1}
\nociteF{ref2}
\nociteB{ref3}

A link to \citeF{ref4} and \citeB{ref5} goes here.

\bibliographystyleF{unsrt}
\bibliographyF{test.bib}

\bibliographystyleB{unsrt}
\bibliographyB{test.bib}

\end{document}

And the bibliography file:

% test.bib
@Article {ref1, author = Author1, title = Title1, year = 2010}
@Article {ref2, author = Author2, title = Title2, year = 2010}
@Article {ref3, author = Author3, title = Title3, year = 2010}
@Article {ref4, author = Author4, title = Title4, year = 2010}
@Article {ref5, author = Author5, title = Title5, year = 2010}

And to compile the document:

pdflatex multibiblinktest
pdflatex multibiblinktest
pdflatex multibiblinktest
bibtex F
bibtex B
pdflatex multibiblinktest
pdflatex multibiblinktest
pdflatex multibiblinktest
open multibiblinktest.pdf

Best Answer

You are using a standard BibTeX style with natbib. You should be using the unsrtnat style rather than unsrt as you are using the natbib package.