You could try the following.
We will presume we have two .bib files: \jobname-1.bib and \jobname-2.bib, here created via filecontents*
\begin{filecontents*}{\jobname-1.bib}
@inproceedings{slam2001,
author = {Thomas Ball and Sriram K. Rajamani},
title = {Automatically Validating Temporal Safety Properties of Interfaces},
booktitle = {Proceedings of the 8th International SPIN Workshop on Model Checking of Software},
editor = {Matthew Dwyer},
date = {2001},
}
\end{filecontents*}
\begin{filecontents*}{\jobname-2.bib}
@article{blast2007,
author = {Dirk Beyer and Thomas A. Henzinger and Ranjit Jhala and Rupak Majumdar},
title = {The software model checker {BLAST}},
subtitle = {Applications to software engineering},
journal = {International Journal on Software Tools for Technology Transfer},
date = {2007},
volume = {9},
}
\end{filecontents*}
\addbibresource{\jobname-1.bib}
\addbibresource{\jobname-2.bib}
These two files will be added to different keywords with Biber's sourcemapping
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\perdatasource{\jobname-1.bib}
\step[fieldset=keywords, fieldvalue={, primary}, append]
}
\map{
\perdatasource{\jobname-2.bib}
\step[fieldset=keywords, fieldvalue={, secondary}, append]
}
}
}
\jobname-1.bib gets the keyword primary, \jobname-2.bib gets secondary. (I chose primary and secondary 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 of resetnumbers in case labelprefix is used:
\makeatletter
\providerobustcmd*{\blx@kv@defkey}{\define@key}
\blx@kv@defkey{blx@bib1}{noresetnumbersforlabelprefix}[true]{%
\ifstrequal{#1}{true}
{\let\blx@saved@refcontext@labelprefix\blx@refcontext@labelprefix
\let\blx@saved@refcontext@labelprefix\blx@refcontext@labelprefix@real
\let\blx@refcontext@labelprefix@empty
\let\blx@refcontext@labelprefix@real@empty}
{}}
\blx@kv@defkey{blx@bib2}{noresetnumbersforlabelprefix}[true]{%
\ifstrequal{#1}{true}
{\let\blx@refcontext@labelprefix\blx@saved@refcontext@labelprefix
\let\blx@refcontext@labelprefix@real\blx@saved@refcontext@labelprefix}
{}}
\makeatother
All the entries can be cited via \cite (so the keyword does not matter, there is not \citeA or \citeB).
The bibliography is printed with
\newrefcontext[labelprefix=A]
\printbibliography[keyword=primary, noresetnumbersforlabelprefix, title=Primary]
\newrefcontext[labelprefix=B]
\printbibliography[keyword=secondary, noresetnumbersforlabelprefix, title=Secondary]
That is the first bibliography only contains entries with the keyword primary (effectively that is entries from \joabname-1.bib), while the second contains secondary entries (\jobname-2.bib). I have added prefixes to the labels via the labelprefix option of \newrefcontext (that comes closer to your example).
The heading/title is controlled by the title option.
MWE
\documentclass{article}
\usepackage[style=numeric, defernumbers=true, backend=biber, maxnames=999]{biblatex}
\usepackage{hyperref}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\perdatasource{\jobname-1.bib}
\step[fieldset=keywords, fieldvalue={, primary}, append]
}
\map{
\perdatasource{\jobname-2.bib}
\step[fieldset=keywords, fieldvalue={, secondary}, append]
}
}
}
\makeatletter
\providerobustcmd*{\blx@kv@defkey}{\define@key}
\blx@kv@defkey{blx@bib1}{noresetnumbersforlabelprefix}[true]{%
\ifstrequal{#1}{true}
{\let\blx@saved@refcontext@labelprefix\blx@refcontext@labelprefix
\let\blx@saved@refcontext@labelprefix\blx@refcontext@labelprefix@real
\let\blx@refcontext@labelprefix@empty
\let\blx@refcontext@labelprefix@real@empty}
{}}
\blx@kv@defkey{blx@bib2}{noresetnumbersforlabelprefix}[true]{%
\ifstrequal{#1}{true}
{\let\blx@refcontext@labelprefix\blx@saved@refcontext@labelprefix
\let\blx@refcontext@labelprefix@real\blx@saved@refcontext@labelprefix}
{}}
\makeatother
\begin{filecontents}{\jobname-1.bib}
@inproceedings{slam2001,
author = {Thomas Ball and Sriram K. Rajamani},
title = {Automatically Validating Temporal Safety Properties of Interfaces},
booktitle = {Proceedings of the 8th International SPIN Workshop on Model Checking of Software},
editor = {Matthew Dwyer},
date = {2001},
}
@article{blast2008,
author = {Dirk Beyer and Thomas A. Henzinger and Ranjit Jhala and Rupak Majumdar},
title = {BLAST II},
journal = {International Journal on Software Tools for Technology Transfer},
date = {2008},
volume = {18},
}
\end{filecontents}
\begin{filecontents}{\jobname-2.bib}
@article{blast2007,
author = {Dirk Beyer and Thomas A. Henzinger and Ranjit Jhala and Rupak Majumdar},
title = {The software model checker {BLAST}},
subtitle = {Applications to software engineering},
journal = {International Journal on Software Tools for Technology Transfer},
date = {2007},
volume = {9},
}
@inproceedings{slam2002,
author = {Thomas Ball and Sriram K. Rajamani},
title = {Interfaces are Cool!},
booktitle = {Proceedings of the 8th International SPIN Workshop on Model Checking of Software},
date = {2002},
}
\end{filecontents}
\addbibresource{\jobname-1.bib}
\addbibresource{\jobname-2.bib}
\begin{document}
CiteA~\cite{slam2001,slam2002}, CiteB~\cite{blast2007,blast2008}
\newrefcontext[labelprefix=A]
\printbibliography[keyword=primary, noresetnumbersforlabelprefix, title=Primary]
\newrefcontext[labelprefix=B]
\printbibliography[keyword=secondary, noresetnumbersforlabelprefix, title=Secondary]
\end{document}
![CiteA [A1, B3], CiteB [B4, A2]](../../images/00c1a08a662e87774ec55a368b609864.webp)
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 of biblatex (v3.3 or below), please refer to the edit history.
prefixnumbersoption implicitly callsresetnumbers(causing the numbering to start again from 1), maybe there is a workaround, I'm investigating. – moewe Apr 15 '14 at 13:23resetnumbers=true. – moewe Apr 16 '14 at 05:29\jobname-1(.bib) in the MWE byprimary(.bib) and all of\jobname-2(.bib) bysecondary(.bib). You furthermore cannot use thekeywordsprimaryandsecondaryin any other context (if you want to, you need to replace every occurrence ofprimaryandsecondaryabove by other appropriate keywords). – moewe Apr 17 '14 at 16:35biblatex/Biber are you using (it's version 2.8/1.8 here)? Have you tried an update? – moewe Apr 17 '14 at 16:36filecontentsoverwriting the.bibfiles each time. Building via the commandspdflatex, bibtex, pdflatex, pdflatexeverything works correctly. Sorry for the confusion. – foens Apr 18 '14 at 11:47filecontents, you will just have the two files\jobname-1.biband\jobname-2.bib(whatever their names be) in a place LaTeX can find them. (I'm not even sure you were implying that you usefilecontentsin your actual document, but better safe than sorry, I suppose). – moewe Apr 18 '14 at 12:57\makeatletter .. \makeatotherI still get continuous numbering.... – alexis Jul 22 '20 at 20:27\makeatletter...\makeatothercode does nothing in newer versions ofbiblatex). That should be fixed now, the code should once again produce the result from the screenshot. – moewe Jul 23 '20 at 06:05\makeatletter...\makeatother? It is strange... some times it compiles like that, sometimes puts a lot of zeros.... not sure how to reproduce what I see. Also, is there a way to avoid the B label? (i.e. A0, A1, and then 1, 2, 3)... sorry for ask all this details.. not sure if is better to open a new question. – alexis Jul 23 '20 at 20:53\newrefcontext[labelprefix=A]\printbibliography[keyword=primary, title=Primary]\newrefcontext[]\printbibliography[keyword=secondary, title=Secondary, resetnumbers=true]– alexis Jul 23 '20 at 21:08labelprefixis active,biblatexautomatically resets the numbering of the bibliography entries in each new bibliography (see also my very first comment above). The code in\makeatletter...\makeatotherwas specifically put in to avoid that. Because the MWE usesdefernumbersyou will need an additional LaTeX run to get correctly numbered citations and bibliography entries. Sometimes when things go wrong or you experiment with many options and settings,defernumbersnumbering can 'get stuck' with wrong numbers: possibly all zeros, possibly something more subtle – moewe Jul 24 '20 at 06:43.aux,.bbland.bcffile and recompile. That shouldn't happen often. Instead of\newrefcontext[labelprefix=A] \printbibliography[keyword=primary, title=Primary] \newrefcontext[] \printbibliography[keyword=secondary, title=Secondary, resetnumbers=true]you could also say\begin{refcontext}[labelprefix=A] \printbibliography[keyword=primary, title=Primary] \end{refcontext} \printbibliography[keyword=secondary, title=Secondary, resetnumbers=true]. Which feels more natural will depend on your situation. – moewe Jul 24 '20 at 06:49