Skip to Main Content

BibTeX, natbib, biblatex: Managing Citations in LaTeX: Troubleshooting

A short guide linking to documentation, resources for bibliographic citation styles, and other useful tools to use when citing sources using .bib files and associated packages.

General Protocols

Using BibTeX, biber, natbib, or biblatex is relatively straightforward, but sometimes, something breaks. Here are some general steps for troubleshooting problems with your bibliography.

  1. Clear your document cache. Most LaTeX writing programs will offer this as a menu option. In TeXmaker, it is under Tools > Clean. In Overleaf, select "recompile from scratch" under the drop-down menu in the green compile button.
  2. Ensure that you are running LaTeX, BibTeX or biber, LaTeX, and then PDFLaTeX (or whichever tool you use to render your PDFs) in the proper order. This doesn't matter as much in Overleaf because the tool is very good at understanding what you want to do.
  3. Check the documentation on CTAN for the citation style you have called or the style file itself, which sometimes contains documentation and package dependency information in the header. Some of them, such as biblatex's APA style, require that you call other packages. You will get errors if you do not include these packages.
  4. If there is nothing in the documentation that you have overlooked when creating your LaTeX document, you have several options:
    • Check the TeX StackExchange web site. It is extremely helpful for seeing different perspectives on a whole host of difficulties. If no one has asked your question, feel free to register and engage with the people there — just make sure that you have documented your error thoroughly.
    • Contact me (at the info on the right) with your problem, and we can set up a time to discuss your BibTeX issue.

You can also talk to a chatbot like ChatGPT, Bing, or Bard. Most chatbots are very skilled at understanding what code is supposed to look like. However, they are limited in that their suggestions are sometimes a bit off — they can make assumptions about what you want to do in your document based on the information in your prompt, and you'll need to use trial-and-error to help them understand what you are looking for. If the question is complex, you are better off contacting a person or posting to a forum.

Known Issues with csquotes

Some tools for generating LaTeX .bst files (bibliographic styles), such as the docstrip utility, have known compatibility issues with the package csquotes. The csquotes package is a robust quotation management tool, with support for multiple languages and advanced quotation elements of interest to those writing formal academic documents. For those writing theses, dissertations, or other formal documents where a robust quotation management package is required, it is an excellent choice.

One problem with many .bst files available online is that they attempt to define something called \enquote within the style. When used without csquotes, this is fine, but csquotes has its own defined variable called \enquote. LaTeX does not appreciate having two variables with the same name, so it will call an error, and the document will refuse to compile.

The error will look like this:

This is BibTeX, Version 0.99d (TeX Live 2014) The top-level auxiliary file: mythesisd2.aux I couldn't open style file ajs.bst ---line 18 of file mythesisd2.aux : \bibstyle{ajs2.bst : } I'm skipping whatever remains of this command I found no style file---while reading file mythesisd2.aux (There were 2 error messages)


And it is resolved by redefining one of these variables. I recommend redefining the one in the .bst file to something like \enquotebst. This can be done very easily to your .bst file using find/replace. The risk of modifying csquotes is that you are tampering with a built-in package that might be updated and reset every time TeX updates are downloaded. For example, in the ajs.bst file commonly found online for sociologists, the \enquote variable appears in two places:


FUNCTION {format.title}
{ title empty$
    { "" }
    { title
      "\enquote{" swap$ *
      add.period$ "}" *
    }
  if$
}


and


FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{}" write$ newline$
  "\newcommand{\enquote}[1]{``#1''}"
  write$ newline$
}


Replace "enquote" with "enquoteFILENAME" or "enquotebst" wherever it appears in the .bst file. The error will stop if \enquote was your problem. If the error continues, ensure that your .bst file is in the correct directory and that you are only calling the bibliography once.

Science Research Support Librarian

Profile Photo
Kayleigh Bohemier
Contact:
Please email me or use the Schedule Appointment button. In-person and virtual (Zoom) appointments are both possible. Please note that Science Hill is a 15-minute walk from central campus, and there is a temporary entrance due to construction.

My default ONSITE days are Tuesday, Wednesday, and Friday. During the semester (not during breaks!), I am onsite on Thursdays. I am OFFSITE most Mondays.

———

Marx Science and Social Science Library (formerly called CSSSI)
Office C41
219 Prospect Street
Concourse Level
Kline Biology Tower
203-432-9519