Is there an established way to spell check .bib files? There's a previous question on spell checking TeX files but I could not find much about .bib files.

I use aspell to spell check my .tex files. Running aspell on a .bib file is very tedious as aspell is not aware of the syntax. I tried extracting only the title fields with bash (grep '\btitle = {' bibliography.bib | sed 's/title =//g' | sed 's/{//g' | sed 's/},//g' | sed 's/}//g'), but this is not entirely satisfactory either. My .bib file is rather long (about 26000 lines), and I have many non-English citations. Is there a good way to filter .bib files by language?

Spell checking only the citations used in a particular paper would be more manageable. I've seen recommendations to spell check the .bbl file, but aspell handles this worse than it does .bib files. Limiting just to titles is okay (grep '\field{labeltitle}\|\field{title}' file.bbl | sed 's/\\field{labeltitle}{\([^}]*\)}/\1/g' | sed 's/\\field{title}{\([^}]*\)}/\1/g' | sed 's/{//g' | sed 's/},//g' | sed 's/}//g') but I'd rather spell check the entire citation (without resorting to some absurdly long bash command to parse the .bbl file).

Any ideas would be appreciated.

  • 1
    Mhhh, I guess spell checking for .bib files is not so simple. Only very few of the fields in a .bib file can be spell checked: title, location (maybe journal). Names don't really lend themselves to spell checking, and even the titles of scientific papers may contain many words that are too much for your average spell checker (without you adding them). The second thing is that you have to double check your .bib file for correctness anyway, this is a job that can hardly be automated and involves checking the order of names, the entry type etc. ...
    – moewe
    Feb 8, 2018 at 6:26
  • 1
    ... So when you are doing that you might as well check if the spelling is the same as on the work you cite. That said, Biber and I assume also bibtool can filter .bib files by language and can also remove fields you are not interested in, but they can't do a spell check for you.
    – moewe
    Feb 8, 2018 at 6:26
  • I'll look into filtering and making a better script to extract the fields of interest. Thanks. Feb 9, 2018 at 6:46

2 Answers 2


Some ideas, not a perfect solution:

  • Use \nocite{*} to generate a PDF, then do the spellcheck there. Or, works surprisngly well, open the PDF in Word.
  • Try codespell: https://github.com/codespell-project/codespell
    It will not give perfect results, but can be configured with whitelists an blacklists.

Recently I have found that Pandoc can be used to spell check bibliographies. (I got this idea after reading this post.)

Using the latest version of Pandoc (2.14 as of this writing), the following command will produce the file bibliography.txt which can be easily spell checked:

pandoc -f biblatex bibliography.bib -s --citeproc -t plain -o bibliography.txt

I am using biblatex in this example but the above command should also work for bibtex if the option -f bibtex is used.

You may find it more convenient to spell check the entire document including other elements that may not appear in the TeX source. I use the following

pandoc --bibliography bibliography.bib file.tex -s --citeproc -t plain -o file.txt

One problem with spell checking text produced from the PDF (e.g., via pdftotext) is that the math can get in the way. With Pandoc you can remove the math rather easily from the output.

You must log in to answer this question.

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