I used Mendeley to export a huge bib file which contains all the articles on my laptop. As expected, there are lots of bad entries of citations such as lacking of author name, etc. The problem is it seems these bad entries prevent biber from generating the reference list. Since there are thousands of such bad entries, I desperately want to find an automatic way of getting rid of them...or maybe my overall strategy is simply wrong?
2 Answers
Ideally Mendeley should produce well-formed .bib files. In my experience it does happen that Mendeley exports the occasional problematic entry, but there shouldn't be lots of bad entries.
There are roughly two types of errors in .bib files
- errors in the BibTeX syntax and
- errors in LaTeX syntax.
While LaTeX syntax errors will go unnoticed by Biber and BibTeX, BibTeX syntax problems will of course be remarked upon in the .blg file.
For BibTeX syntax errors Biber should produce an error with either a line number or the entry key pointing to the malformed entry. The lines numbers are not always completely spot on since errors sometimes only become apparent after some other code has been processed, but they should give you a rough idea where to look.
Unfortunately, Biber can't really skip most errors. There is one way to try and make Biber run for longer after it encountered an error, but that is not at all guaranteed to help here and is generally discouraged, see How do I get biblatex to skip over incorrect BibTeX entries like bibtex always has?.
If the problem is not that the .bib file is syntactically unsound but rather that fields contain wrong LaTeX code, then the error may only come during the LaTeX run, where it can be a bit harder to find the problematic entries. Often the resulting LaTeX error message contains some bit of the surrounding text, which may help you identify the problem.
As always when you try to diagnose errors in LaTeX, the binary search method can be of great help.
Take a copy of your .bib file and delete half of it (say the second half). Remove the temporary .aux, .bbl, .bcf files and compile again. If the error is gone, delete the second half and add the first half back in. If the error is not gone, do nothing. Repeat until you have isolated the problematic entry.
Some .bib file linters are listed in How to validate (check) a biblatex .bib file?. I haven't used any of them and I don't know if they catch all kinds of relevant syntax errors that could be problematic. But they are worth a try.
- 175,683
Thanks for all the tips. I finally got the clue how to handle the problematic bib entries. Here is my way:
- Throw all my paper folders into Mendeley;
- Sort as per Type. Delete all nonPDF entries;
- Sort as per Title. Delete all nonEnglish entries;
- Sort as per Author. Delete all entries with empty author;
- Export the bib file. Open it in Notepad++;
- Run biber -tool -V xx.bib (for windows);
- Fix all the errors maybe some warnings if you like one by one by performing searching replacing in Notepad++.
Comments are welcome :)
- 63