28

I use TeXLive 2012 and compile with run

latexmk -pvc -pdf -quiet test.tex

later I clean the directory with

latexmk -C

But test.bbl remains. How can I help latexmk to find bbl files?

test.bbl (first lines)

% $ biblatex auxiliary file $
% $ biblatex bbl format version 2.1 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
4
  • 4
    You need the .bbl file for typesetting the document!
    – egreg
    Commented Nov 19, 2012 at 14:27
  • 1
    ...I thought latexmk creates it. I never wrote a .bbl file manually. Commented Nov 19, 2012 at 15:30
  • 2
    If your document is in final form and you don't need to compile it any more, then you can safely delete the .bbl file.
    – egreg
    Commented Nov 19, 2012 at 16:52
  • as long I do not delete it manually with rm latexmk ignores changes I made with jabref. Commented Nov 19, 2012 at 17:35

3 Answers 3

30

By default, latexmk treats .bbl files as non-regeneratable. This is because the .bib from which they are made is not always available. See the documentation for a fuller explanation, especially the explanation of the $bibtex_use variable. To get latexmk -C to delete .bbl files, put the following in an initialization file:

$bibtex_use = 2;
4
  • 4
    Oh my, you were faster than me by 10 seconds. :) In other news, I know that this is probably not the best place to say this, but your awesome work with latexmk inspired me to write arara. I really admire all the effort you've put into the tool. Thanks a million. Commented Nov 19, 2012 at 18:26
  • 7
    Is $bibtex_use = 2; equivalent to -bibtex? Commented Nov 19, 2012 at 18:34
  • 9
    Yes. The option -bibtex simply sets $bibtex_use to 2. Commented Nov 19, 2012 at 22:29
  • Thanks for the answer, what do you mean by " initialization file", the makefile?
    – zyy
    Commented Nov 2, 2022 at 14:43
20

Another option to the presumably canonical answer John gave is specifying $clean_ext in a latexmkrc file, which contains your personalized global options. This file can be in one of the places I outlined in my answer to Latexmk: makeglossaries, Biber and pdfLaTeX / Where to put latexmkrc?. Also see the latexmk manual.

My complete list of extensions looks like this:

$clean_ext = 'synctex.gz synctex.gz(busy) run.xml tex.bak bbl bcf fdb_latexmk run tdo %R-blx.bib'

(As a result of -- I think -- SyncTeX, latexmk, Texmaker, biblatex, Biber, todonotes)

1
  • Just to clarify, in some situations (like, if your .bib file is in a search path, not the current dir, and latexmk doesn't find it), latexmk may sometimes not delete the bbl file even if you have put bbl in the $clean_ext string in .latexmkrc. That is, you'd need to use Johns answer from above to make it clean out bbl files. I think this is explained in the the latexmk docs; see -bibtex-cond.
    – postylem
    Commented Jun 22, 2022 at 15:31
2

Reading from the documentation:

-bibtex-cond1

... .bbl files are only treated as precious if one or more bibfiles fails to exist.

Thus you simply do:

latexmk -bibtex-cond1 -C

You must log in to answer this question.

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