In the context of ideas mentioned at How to embed a review in biblatex? one should create a file for each entry key in the bib file. These files will be named to refer to each entry key, names will be like


If bib file contains many entries might be interesting to automate it. How? I checked biber --help but doesn't seem to be something for this purpose there.

  • 1
    What do you want to automate? The creation of those files? Since the contents of those files have to be created manually anyway and biblatex automatically skips over non-existing files, I don't really see a point in creating the files automatically.
    – moewe
    May 4, 2019 at 9:28
  • I was thinking in automate creation of files but after some more thinking I'm realizing this might not be a good thing, as you pointed.
    – KcFnMi
    May 5, 2019 at 5:22

1 Answer 1


Biber certainly does not create these files for you automatically. Your best bet is probably a different programming language like Python or Perl with a library that can read .bib files (https://github.com/sciunto-org/python-bibtexparser, https://pypi.org/project/biblib/, https://metacpan.org/pod/Text::BibTeX, ...).

For example the following Perl script


use strict;
use warnings;
use Text::BibTeX;

my ($bibfilename) = @ARGV;

unless (defined $bibfilename) {
  die "Please provide a file name";

if (-f $bibfilename) {
   print "Processing ${bibfilename}...\n";
} else { 
   die "File ${bibfilename} not found";

my $bibfile = Text::BibTeX::File->new($bibfilename);
my $entry;

while ($entry = Text::BibTeX::Entry->new($bibfile))
   next unless $entry->parse_ok;
   next unless $entry->metatype eq BTE_REGULAR;
   my $key  = $entry->key;
   my $file = "bibannotation-${key}.tex";
   unless (-e $file) {
     open TMPFILE, '>', $file and close TMPFILE
     or die "File error with $file: $!";

when saved as bibannotations.pl and run as

perl bibannotations.pl <mybibfile.bib>

will produce empty files of the form bibannotation-<entrykey>.tex for all entries in the .bib file <mybibfile.bib>.

Technically, you don't even need a different programming language, you can have TeX sort this out. Just load all relevant .bib files in the following file and compile it with LaTeX, Biber, LaTeX.

\usepackage[style=authoryear, backend=biber]{biblatex}



  author  = {Humphrey Appleby},
  title   = {On the Importance of the Civil Service},
  date    = {1980},


Lorem ipsum

I believe, however, that there is little point in creating these files automatically. After all, you'll have to provide the contents of those files manually anyway. At least for the purposes of the loadfiles option discussed in How to embed a review in biblatex? biblatex will just skip over non-existing files meaning that there is no point in having an empty file present.

  • Just curious about lualatex, which comes with some lua language, would this lua help?
    – KcFnMi
    May 6, 2019 at 10:11
  • @KcFnMi Yes, but as the second example shows you don't even need Lua. LaTeX is enough (as long as your entrykeys are well-behaved and don't contain any characters weird for TeX or for your file system: If you stick to ASCII only and avoid /, `, .` and : you are probably fine.)
    – moewe
    May 6, 2019 at 10:16

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.