I checked the documentation and tried some examples. But it doesn't work. biber tells me there are characters of junk in my bib-file. ;)

Isn't there a way to add code-like comments into a bib file?


% This is a comment line
# This is another comment
  • Biber will not say anything about text following %; it will also ignore the characters of junk it complains about. See also Are comments discouraged in a BibTeX file?
    – moewe
    Commented Aug 20, 2016 at 14:21
  • If the answer in the other question does not help you, make your question a bit more specific.
    – moewe
    Commented Aug 20, 2016 at 14:22
  • @moewe -- the answer you cite certainly covers the territory. i'd be happy to remove my answer here if you think it doesn't add anything new. Commented Aug 20, 2016 at 14:29
  • @barbarabeeton Mhhh, I have now added the Biber view to supplement your answer. Let's wait and see what the OP says, we can still close this question as a duplicate later I suppose.
    – moewe
    Commented Aug 20, 2016 at 14:33

2 Answers 2


Biber ignores the characters of junk it complains about, so technically you can consider that still a comment. Biber will (contrary to BibTeX), however, ignore everything after a % without a warning.

So if you start a line (outside an entry) with %, that line is considered a comment by both BibTeX and Biber.

The BibTeX example file xampl.bib (described as "a database file with an example of every standard entry type") starts with

% Copyright (C) 1988, 2010 Oren Patashnik.

so that seems to be an "officially sanctioned" way to add a comment in .bib files.

  • 2
    I agree that Biber ignores stuff following % outside an entry, as it ignores other things. But it still generates a warning complaining about so many characters of junk. It does not, however, complain consistently. I'm not sure what the criteria are for complaining, though. Certainly lines beginning with % at the top of the file appear to be ignored completely, but it also ignores some lines later, especially if there is white space before the %.
    – cfr
    Commented Aug 20, 2016 at 15:39
  • 1
    Or maybe it ignores lines whose first non-white space character is % and which meet some further criterion e.g. absence of some other character. I can't work it out.
    – cfr
    Commented Aug 20, 2016 at 15:40
  • @cfr Interesting, I'd have thought that at least lines with first non-whitespace % would not trigger a warning; I'll check that later.
    – moewe
    Commented Aug 20, 2016 at 15:58
  • 1
    @cfr I did some testing (sorry it took so long) and there everything after a % in a line was ignored and spaces did not trigger "junk character" warnings, so lines having a % as first non-whitespace character are completely (and without junk warning) ignored. That seems to hold for lines within entries as well for those outside. I would be interested to see a line starting with % that still generates a warning.
    – moewe
    Commented Aug 21, 2016 at 6:19
  • 1
    Thanks for testing. Now I'm intrigued because I've always assumed that it is these lines Biber complains about in my .bib files. If it isn't those, I'm wondering which it is!
    – cfr
    Commented Aug 21, 2016 at 13:40

i don't know anything about biber, but here's what the bibtex manual says about comments:

p.13, item 7:

For Scribe compatibility, the database files allow an @COMMENT command; it's not really needed because BibTeX allows in the database files any comment that's not within an entry. If you want to comment out an entry, simply remove the '@' character preceding the entry type.

p.14, item 14:

LaTeX's comment character '%' is not a comment character in the database files.

the conclusion must be that there is no way to have an explicit comment within a bibtex entry, at least not the way that is expected in tex files.

however, if a field name is not recognized by the applicable .bst file, that field is ignored. so using a field name "mycomment" might be worth trying.

You must log in to answer this question.

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