I have several bib files, and I want to handle them slightly differently. I think the most obvious way would be to put them in different categories (\DeclareBibliographyCategory), and then handle the issue in \printbibliography.

My questions are the following:

  • given 1.bib and 2.bib how can I automatically assign all entries in one file to a specific category? Based on the documentation \addtocategory only takes keys, and thus I would have to manually list all of them.
  • given a third file, 3.bib, after assigning manually a few entries from 3.bib to a category, how could I assign all other entries in 3.bib to a another category?

Basically, I'm trying to automatize splitting the three files into 4 categories.

  • 4
    With Biber, you can use the Sourcemapping feature, which can be specified by a perdatasource option, and create keywords for all entries in each .bib file. Then print by keywords. ... (Edit) Hmm, actually, this is a 'related' question already. – jon Apr 4 '17 at 16:24
  • and for the second question I guess I could somehow add entries to the few specific elements and then filter out the ones without or something? – fbence Apr 4 '17 at 16:39
  • You have access to regexp with Biber, so I assume you can do what you like with 3.bib, but it's hard to say what to do given the information provided so far. – jon Apr 4 '17 at 17:02
  • You can assign databases locally to a refsegment or refsection and then print bibliographies for particular bits of the document. – cfr Apr 5 '17 at 0:35

99 per cent of what you want to do is answered in this question. Use the sourcemapping technique at the end of that answer to add suitable keywords to your files. Let's suppose you have then "cata" as one keyword (mapped to your files 1.bib and 2.bib, and "catb" as another keyword (mapped automatically to your file 3.bib

The only remaining problem you have then is the file where you want some assigned to one category, and some to another. With that file, assign manually to the keyword field to "cata, " and also allow biber to add its own extra keyword catb.

You now have three categories:

  • Entries in two files with keywords set only to "cata".

  • Entries in two files with keywords set to "catb".

  • Some entries in one of those files with keywords set to BOTH "cata" (manually) and "catb" (automatically).

Now all you do is filter for keyword=cata in your first bibliography, and for keyword=catb, notkeyword=cata in your second. The first picks up both the automatically encoded file and the manually added one, the second picks up all the automatically encoded files but then excludes the one you manually assigned to the first category.

Only trick is you need to put a comma after the manually assigned keyword.

    author = "Anonymous, Author",
    title  = "First Bibliography: Category 1",
    date   = {2000},
    author = "Writer, William",
    title = "Second Bibliography: Category 2",
    date = {2010},
    author = "Scribbler, Steven",
    title  = "First Bibliography Again: Category A and B",
    date = {1899},
    keywords = {cata,},
    author = "Poetaster, Peter",
    title = "Second Bibliography Again: Category B",
    date = {1767},

  \maps[datatype=bibtex,overwrite] {
      \step[fieldset=KEYWORDS, fieldvalue=cata, append]
      \step[fieldset=KEYWORDS, fieldvalue=catb, append]
      \step[fieldset=KEYWORDS, fieldvalue=catb, append]





\printbibliography[keyword=catb, notkeyword=cata]


screenshot of output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.