biblatex
supports multiple bibliographies by looking up the 1) entry type, 2) keyword, or 3) category.
This is all fine, but in the use case of primary sources and secondary sources:
1) the 'type' method doesn't work,
2) it is quite tedious to key in the 'primary' and 'secondary' keywords for each .bib
entry, and
3) declaring the sorting by category would entail typing all the primary keys in the document.
So, if I'm storing all my primary bib entries in one .bib
file, and secondary one in another, is there a bit to tell biblatex
to assign a keyword or category automatically to all the entries from that bib file as it imports them? Done this way, entries can be easily swapped to and from the primary and secondary .bib
files without fiddling individual keywords, and I don't have to type out all the primary and/or secondary entries into categories in each document.
Best Answer
This is now implemented in Biber 0.9.8. Here is how to deal with your question. Given the sample file:
You can automatically add the correct keywords to your data as Biber reads it by using the following biber.conf file:
This will add the necessary keywords based on the datasource names. If you already had a KEYWORD field in your datasources which you wanted to keep, you could use the match/replace functionality instead:
The Biber manual has been updated in 0.9.8 with documentation of the config file format and has more examples. The format of the user config file is a major change from 0.9.6 (and some changes also from 0.9.7) as the older format was a bit of a mess and couldn't be extended to cope with situations like this due to inherent limitations of the format itself. I opted for a real XML format for flexibility. You can also validate your config file now by passing the
--validate_config
option to Biber.EDIT: Since biber 1.3, you there is an "append" mode for setting values in sourcemaps so it's easier like this, which deals with entries with or without an existing KEYWORDS field when you want to keep any existing values:
Here is the same thing using the biblatex macro interface which you can put directly in your document: