Comment out sections of text in bib file
Anything that is not inside a recognized entry is a comment. So just type along! Any .bib
interpreter that complains about it is buggy, as it is not following the rules laid down in btxdoc. However, you can use an entry like @COMMENT
, which will hopefully not trigger any complains.
At least with biber
, you should be able to use the same commenting method as with LaTeX, that is using %
for the commented line.
After a few test comments can be outside entries, within entries (commenting a whole line) or commenting the end of a line.
%%%%%%%%%%%
% PREPRINT
@article{myarticle,
author = {Onymous, A. N.}, %The author
% the title of the article
title = {A Nice title},
}
Should work as expected. However this may not be the case with bibtex
.
I had difficulties commenting out entries in a .bib file (as opposed to adding free-standing comments). Posts to date on this thread did not address this particular problem.
I'm using Overleaf
). What I observed:
bibtex
looks for entries (@blah
) before it checks if the line starts with a%
(or so I figured).- but only that line gets processed; if you commented out the entire entry the rest of it (
title=
, etc) is ignored and you end up with errors ('missing field') attributable to@blah
Sheesh.
This doesn't work:
%@article{foo2019,
% ...
% }
This works (replace the @
):
%%article{foo2019,
% ...
% }
I poked around in Overleaf
and found this explanation (note that mine, above, is a bit different):
% is actually not a comment character in .bib files! So, inserting a % in .bib files not only fails to comment out the line, it also causes some BibTEX errors. To get BibTEX to ignore a particular field we just need to rename the field to something that BibTEX doesn’t recognise. For example, if you want to keep a date field around but prefer that it’s ignored (perhaps because you want BibTEX to use the year field instead) write Tdate = {...} or the more human-readable IGNOREdate = {...}.
To get BibTEX to ignore an entire entry you can remove the @ before the entry type. A valid reference entry always starts with a @ followed by the entry type; without the @ character BibTEX skips the lines until it encounters another @.
bibtex
is very focused on @
; biber
apparently respects %
s (but you'd have to use biblatex
). See pointers provided by moewe (in the comments) for other discussion.