I'm trying to use AUCTeX's C-c C-a (TeX-command-run-all) to invoke the complete compilation chain (includind calling biber) for building the following MWE:


  author  = {Other, Anthony Norman},
  title   = {Some things I did},
  year    = {2014},
  journal = {J.~Irrep. Res.},
  volume  = {1},
  number  = {1},
  pages   = {1-10} 

\usepackage[backend = biber]{biblatex}




However, although the LaTeX documents includes a bibliography, C-c C-a only invokes a single latex run and then opens the viewer. The same happens when using C-c C-c for compiling the document step-by-step: C-c C-c suggests to run latex and then directly view to open the PDF file, without suggesting biberfor building the bibliography.

How can I make AUCTeX to suggest the right building order latex -> biber -> latex -> viewer to compile the document by hitting C-c C-a ?

  • This seems to be the same as tex.stackexchange.com/questions/368708/…
    – egreg
    Commented May 15, 2017 at 9:15
  • Don't use \jobname, use an explicit file name. Also note that the base name of the bibliography file should be different from the file name of the TeX file
    – giordano
    Commented May 15, 2017 at 9:24
  • There seems to be a problem with \addbibresource{mybib.bib}. After replacing it with \bibliography{mybib}, biberis suggested correctly. However, now Viewis never suggested and biber --> latex are repeated forever...
    – Robinaut
    Commented May 15, 2017 at 10:05
  • 1
    Uhm, I can see where's the problem, but that's tricky. AUCTeX tries to determine if the bibliography file has to be run again if the .bib file is newer than the .bbl, but with the filecontents mechanism the .bib file is always newer than the .bbl, after a LaTeX run. C-c C-a is useful when AUCTeX can correctly guess the right sequence of commands to be run, otherwise you can manually run the command you with the good old C-C C-c ;-)
    – giordano
    Commented May 15, 2017 at 10:22
  • 1
    filecontents is useful for preparing self-contained examples, but for real-world documents I'd use a separated bibliography file. AUCTeX doesn't have problems in that case ;-) (The only limitation is that you can't have the bibliography file with the same base name as the TeX file, that was a really bad design decision and this is quite hard to fix.)
    – giordano
    Commented May 15, 2017 at 10:36

1 Answer 1


There are a few issues here on the AUCTeX's side.

The first, most important, is that AUCTeX doesn't handle the case in which the TeX file and the bibliography file share the same base name (e.g., the former is named mydocument.tex, and the latter mydocument.bib). That's an unfortunate design decision taken decades ago, which is difficult to fix nowadays without a substantial rewriting. I'd like to fix this issue, but this would basically be highly backward incompatible.

The second issue is that when AUCTeX parses the file it doesn't translate \jobname with the actual job name. This would be much easier to fix, but \jobname is often used to refer to files with the same base name as the master file, like in this case, so fixing the present issue would be useless, given the issue mentioned above.

The last issue is related to how AUCTeX guesses the command to run. It looks to the .bib and .bbl file: If the .bib file is newer than the .bbl file, it's necessary to run biber (or bibtex or whatever) again. However, if you insert the bibliography database inside the TeX file with the filecontents environment, every time you run latex, the .bib file is regenerated, so it's always newer than the .bbl file, thus confusing the mechanism used in AUCTeX to determine which command to run: AUCTeX would suggest to run the infinite sequence LaTeX (this creates the .bib file), then Biber (because there is no .bbl file), LaTeX (this regenerates the .bib file), Biber (because the .bib file now is newer than the .bbl file), LaTeX (this regenerates the .bib file), Biber (because the .bib file now is newer than the .bbl file), etc... Actually, there will be no infinite loop because AUCTeX will run a sequence of maximum 12 commands, but anyway not very useful.

Moral of this history:

  • Avoid using \jobname if you want to rely on AUCTeX ability to parse the file.
  • Don't use a bibliography file with the same base name as the TeX file, essentially for the same reason as the previous point.
  • If you want to use the filecontents environment you'll need to run latex and biber manually with C-c C-c. Using C-c C-a would enter an infinite loop (not real infinite, it'd be a sequence of LaTeX - Biber repeated 6 times each).

However note that filecontents is usually employed to write simple self-contained examples. Real-world documents, however, have an external bibliography file. In this case, you won't have any problems, provided the bibliography file has a base name different from the TeX file's.


You must log in to answer this question.

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