1

I want to split the references in bibliography and own publications. I am using biblatex as follows:

\usepackage[%
    backend=biber,      % for sorting the entries and citing information with UTF-8 support
    style=numeric,      % style for citation
    url=false,          % url-field of the bib is not printet in the references
    sorting=none,
    maxalphanames=1,    %
    maxcitenames=1,     %
    isbn=false,
    url=false,
    doi=true,
    abbreviate=false,
    ]%
{biblatex}  %
\addbibresource{bib/references.bib} % Adding the bib-file to reference, if need more copy this command
\addbibresource{bib/publications.bib}

And then:

\printbibliography[title={Bibliography}, heading=bibintoc, keyword={primary}, resetnumbers]%
\printbibliography[title={Publications}, heading=bibintoc, keyword={secondary}, resetnumbers]%

Where references.bib looks like this:

@inproceedings{ref1,
  title={{Title 1}},
  author={{Authos list}},
  booktitle={Conf},
  year={2021},
  keywords={primary}
}

@inproceedings{ref2,
  title={{Title 2}},
  author={{Authos list}},
  booktitle={Conf},
  year={2021},
  keywords={primary}
}

And publications.bib looks like this:

@inproceedings{Pub1,
  title={{Title 1}},
  author={{Authos list}},
  booktitle={Conf},
  year={2021},
  keywords={secondary}
}

@inproceedings{Pub2,
  title={{Title 2}},
  author={{Authos list}},
  booktitle={Conf},
  year={2021},
  keywords={secondary}
}

I have already two different sections printed. However, I would like that they are numbered independently from each other. For references, with numbers in order of appearance (like they are). For publications, also in order of appearance but reset and preceded by MyText:

Bibliography:
[1] Authors,...
[2] Authors,...

Publications:
[MyText1] Authors,...
[MyText2] Authors,...

In the text, the entries are cited in this order: \cite{Pub1}, \cite{ref1}, \cite{ref2}, \cite{Pub2}. However, in the bibliography list, ref1 starts with [2] and Pub1 with [1] even if they are in different .bib files. So,

  1. How to keep separate counters for each .bib file? The resetnumbers option in \printbibliography didn't work.
  2. How can I add MyText to the publications section so they appear in the text when referenced [MyText1], [MyText2]?
  3. Is it possible to avoid using the keywords primary and secondary in each entry and have it "general" for each .bib file?

Thank you for the help.

1 Answer 1

2

For a general bibliography setup split via files, have a look at my recent answer to Separate multiple bib files reference using biblatex (which is based on PLK's answer to biblatex: multiple bibliographies categorised by different .bib files, but uses a new feature). You can use a Biber sourcemap to automatically assign keywords for filtering.

With a numeric style, split bibliographies almost always benefit from setting defernumbers=true, and this is required for resetnumbers to work at all.

You can add "MyText" to the numeric labels of one of the bibliographies via the labelprefix option of \newrefcontext. (See e.g. How to add a prefix to citations and references numbers in latex?, labelprefix to newrefcontext replacing prefixnumbers to printbibliography not working).

You'll probably want to use locallabelwidth option to avoid large labelwidths in the bibliography without the label prefix.

Together you can use something like

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=numeric, sorting=none, defernumbers, locallabelwidth]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \perdatasource{references.bib}
      \step[fieldset=keywords, fieldvalue={, }, appendstrict]
      \step[fieldset=keywords, fieldvalue=references, append]
    }
    \map{
      \perdatasource{publications.bib}
      \step[fieldset=keywords, fieldvalue={, }, appendstrict]
      \step[fieldset=keywords, fieldvalue=publications, append]
    }
  }
}

\begin{filecontents}{references.bib}
@inproceedings{ref1,
  title     = {Title 1},
  author    = {{Author list}},
  booktitle = {Conf},
  year      = {2021},
}
@inproceedings{ref2,
  title     = {Title 2},
  author    = {{Author list}},
  booktitle = {Conf},
  year      = {2021},
}
\end{filecontents}
\addbibresource{references.bib}
\begin{filecontents}{publications.bib}
@inproceedings{Pub1,
  title     = {Title 1},
  author    = {{Author list}},
  booktitle = {Conf},
  year      = {2021},
}
@inproceedings{Pub2,
  title     = {Title 2},
  author    = {{Author list}},
  booktitle = {Conf},
  year      = {2021},
}
\end{filecontents}
\addbibresource{publications.bib}

\begin{document}
Lorem \autocite{Pub1}
ipsum \autocite{ref1}
dolor \autocite{ref2}
sit \autocite{Pub2}

\printbibliography[title={Bibliography}, heading=bibintoc, keyword={references}, resetnumbers]
\newrefcontext[labelprefix=MyText]
\printbibliography[title={Publications}, heading=bibintoc, keyword={publications}, resetnumbers]
\end{document}

Lorem [MyText1] ipsum [1] dolor [2] sit [MyText2]

2
  • Thanks @moewe! I followed your advice but I keep getting a warning Keyword 'references' not found. in both \printbibliography lines.
    – aripod
    May 11, 2021 at 8:57
  • @aripod Do you get that warning when you run the exact code I posted in a new, empty directory? It definitely works for me and throws no such warning. If you try to integrate this code into your actual document keep in mind that the \perdatasource lines must match with your actual file names (as given to \addbibresource).
    – moewe
    May 11, 2021 at 17:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .