I have a document using a labeled version of multibib, i.e. \usepackage[labeled]{multibib}
. However, hyperref
does not work on the cites and according to "Why does hyperlink point to a wrong page when option “labeled” for multibib is activated?", it seems one should use biblatex.
How can I achieve the same result as \usepackage[labeled]{multibib}
using biblatex
and have hyperref
work correctly?
To be concrete, how can the minimal example document below be translated to biblatex?
\documentclass{article}
\usepackage[labeled]{multibib}
\usepackage{hyperref}
\begin{filecontents}{A.bbl}
\begin{thebibliography}{1}
\bibitem{slam2001}
Thomas Ball and Sriram~K. Rajamani.
\newblock Automatically validating temporal safety properties of interfaces.
\newblock In {\em Proceedings of the 8th International SPIN Workshop on Model
Checking of Software}, 2001.
\end{thebibliography}
\end{filecontents}
\begin{filecontents}{B.bbl}
\begin{thebibliography}{1}
\bibitem{blast2007}
Dirk Beyer, Thomas~A. Henzinger, Ranjit Jhala, and Rupak Majumdar.
\newblock The software model checker blast: Applications to software
engineering.
\newblock {\em International Journal on Software Tools for Technology
Transfer}, 2007.
\end{thebibliography}
\end{filecontents}
\newcites{A,B}{Primary,Secondary}
\begin{document}
CiteA~\citeA{slam2001}, CiteB~\citeB{blast2007}
\bibliographyA{refs}
\bibliographyB{refs}
\end{document}
The example produces the following using pdflatex
where the hyperref
does not work correctly on cites:
Best Answer
You could try the following.
We will presume we have two
.bib
files:\jobname-1.bib
and\jobname-2.bib
, here created viafilecontents*
These two files will be added to different keywords with Biber's sourcemapping
\jobname-1.bib
gets thekeyword
primary
,\jobname-2.bib
getssecondary
. (I choseprimary
andsecondary
here, but you can pick anything you like. Just make sure that these keywords are not used for anything else in your.bib
file or in your bibliography setup.) Note that the names of the.bib
files are 'hard-coded' in\perdatasource
. If you have different files names, you need to adapt the code accordingly.If you insist on continuous numbering (i.e. do not want the second bibliography to start at [B1]) we'll need to put an end to
biblatex
's auto-detection ofresetnumbers
in caselabelprefix
is used:All the entries can be cited via
\cite
(so thekeyword
does not matter, there is not\citeA
or\citeB
).The bibliography is printed with
That is the first bibliography only contains entries with the
keyword
primary
(effectively that is entries from\joabname-1.bib
), while the second containssecondary
entries (\jobname-2.bib
). I have added prefixes to the labels via thelabelprefix
option of\newrefcontext
(that comes closer to your example). The heading/title is controlled by thetitle
option.MWE
Hyperlinking seemed to work rather well here.
edit The answer was updated to work with more recent versions of
biblatex
(tested with v3.14, but it should work from v3.12 onward). If you are using an ancient version ofbiblatex
(v3.3 or below), please refer to the edit history.