How do you validate the correctness of your BiBTeX files? By validate I mean mainly:

  • Duplicated keys, and maybe also duplicated entries
  • Make sure that all the mandatory fields of each entry (depending on its type) are filled.
  • Make sure that it doesn't contain any bad TeX in it. For example, having something like \emphh{foo bar} in a note field.

I found this site which seems to take care of the first item above. AUCTeX/RefTeX provides bibtex-validate-globally which seems to test for duplications of key (and strings?)

What other tools do you have/use? I am particularly interested in tools that check a given .bib file. As mentioned in the comments - it seems like reference managers can provide a solution as well.

I mainly consider BibTeX and BibLaTeX as management tool.

  • a bib file from external source ? or generated by some jabref/refworks/... type of reference manager, Doesn't the reference manager take care of both cases ? Aug 19, 2013 at 10:49
  • 2
    Checked out the Jabref on my machine (v2.8.1) to make sure not to lie: It actually does cover the first and the second requirement, but not the third one.
    – Ruben
    Aug 19, 2013 at 11:04
  • The problem with 'mandatory' fields is that different .bst files treat them differently. Some work OK, some just give bad output, some give warnings. That's before you get to the 'either-or' cases. So it's very much a 'moving target' to start with.
    – Joseph Wright
    Aug 19, 2013 at 11:19
  • Some util­ity for man­ag­ing BibTEX files at ctan Aug 19, 2013 at 11:31
  • 1
    You should further specify which bibliography management tool (BibTeX, BibLaTeX,...?) you use and what you mean by bad TeX. For instance, some BibLaTeX commands, such as \bibrangedash, are not compatible with BibTeX.
    – jub0bs
    Aug 19, 2013 at 11:51

3 Answers 3


I have some .bib files, some of them have 1000 lines.

To be sure that they are working well I always use this test MWE (package filecontents and sample .bib file added only for a running MWE; delete it and use your own .bib file please):

\RequirePackage{filecontents}        % loading package filecontents
% writing file \jobname.bib, for example mb-bibtex.bib.
  author    = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980}
  author  = {Mezzacapo, F. and Cirac, J. I.},
  title   = {Ground-state properties of the spin-$\frac{1}{2}$ antiferromagnetic Heisenberg 
             model on the triangular lattice: a variational study based on 
             entangled-plaquette states.},
  year    = {2010},
  journal = {New. J. Phys.},
  number  = {12},
  issn    = {103039},


\usepackage[numbers]{natbib}         % bibliography style
\usepackage[colorlinks]{hyperref}    % better urls in bibliography

Test the complete \texttt{.bib} file: \nocite{*}.

\bibliographystyle{plainnat}  % needs package natbib
\bibliography{\jobname}       % uses \jobname.bib, according to \jobname.tex

The sample file includes two errors: key adams you will find twice (that gives an error) and in the Mathetitle there is an field missing (that gives a warning).

The MWE is build to test a .bib file with BibTeX. You have to choose your used bib style (my example uses package natbib with numbers). So this MWE shows you the resulting errors and warnings for the given .bib with BibTeX and perhaps resulting tex errors.

That is my way to be sure there is no bib error or tex error in the .bib file.

  • 1
    +1 This approach works for me, also with a .bib of 1000+ lines, (keywords, notes, abstracts stripped) maintained without a ref manager. As in a previous comment, only TeX can parse .tex, so that's the way to check it out.
    – Chris H
    Sep 9, 2013 at 15:42

You might look into bibtool (website). The documentation (see chapter A.12) specifically describes how to use the application to remove (or just comment out) duplicates. The application can also carry out other semantic checks on entries, but it looks as though you would have to code these yourself (see the check.rule infrastructure in A.12.2).

One nice feature of bibtool is that it can extract the entries that are actually used in a LaTeX document from a large BibTeX database.

  • Is there a way to install this using tlmgr? How do you install it? I tried ./configure and it failed (something with kpathsea library)
    – Dror
    Aug 21, 2013 at 7:25
  • @Dror I don't think that the author distributes binaries; what's your platform?
    – acr
    Aug 22, 2013 at 16:47
  • @Dror On Ubuntu 12.04 (with no exotic alterations), the supplied makefile works out-of-the-box. However, I was using the author's supplied unix makefile; did you try this? (Curiously, if I attempt to generate a makefile via ./config, things fail.)
    – acr
    Aug 22, 2013 at 17:03
  • Well I'm running Mac OS, and simple make didn't work.
    – Dror
    Aug 23, 2013 at 6:02
  • @Dror Which of the supplied makefiles are you using? If you haven't already, try mv makefile.unx makefile before running make. (Also, make sure you are using the version from the site above and not CTAN, which seems out-of-date.)
    – acr
    Aug 23, 2013 at 17:32

betterbib, a small project of mine, can help you getting the contents of your BibTeX files straight; it also checks for duplicate keys.

pip install betterbib
betterbib in.bib out.bib

You must log in to answer this question.

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