I'm using latexmk with pdflatex to compile my thesis, with biblatex for references and biber as backend. It compiles fine and creates correct PDF output. If a change to the source files introduces an error the first run of pdflatex fails but a bcf file is created. The run of biber then complains about a malformed bcf file indicating that the last biblatex run failed and the compilation is stopped. However, after fixing the error latexmk thinks the pdflatex run was fine and invokes biber, but the bcf file is still malformed.
latexmk somehow doesn't seem to notice that there were file changes.
Removing the bcf file or cleaning it with latexmk -C makes latexmk call pdflatex first and recreate a correct bcf file. Calling pdflatex manually also work but defeats the purpose of latexmk. I tried to use -halt-on-error as option to pdflatex but that doesn't work. I seem to recall that it worked with TexLive 2014, after a failed attempt to run biber latexmk would run pdflatex first on the next attempt.
I'm using TexLive 2015, the version of latexmk is 4.43a, biber has the version 2.3. The output produced is
Latexmk: This is Latexmk, John Collins, 5 February 2015, version: 4.43a.
Rule 'biber thesis': File changes, etc:
Non-existent destination files:
'thesis.bbl'
------------
Run number 1 of rule 'biber thesis'
------------
------------
Running 'biber "thesis"'
------------
Latexmk: applying rule 'biber thesis'...
INFO - This is Biber 2.3
INFO - Logfile is 'thesis.blg'
ERROR - thesis.bcf is malformed, last biblatex run probably failed. Deleted thesis.bbl
INFO - ERRORS: 1
Latexmk: Failed to find one or more biber source files:
NONE
Collected error summary (may duplicate other messages):
biber thesis: Could not find all biber source files for 'thesis'
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
Biber error: [33] Utils.pm:163> ERROR - thesis.bcf is malformed, last biblatex run probably failed. Deleted thesis.bbl
Latexmk: Errors, so I did not complete making targets
Obligatory mwe.tex:
\documentclass[paper=a4]{scrartcl}
\usepackage[backend=biber]{biblatex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\addbibresource{Bibliography.bib}
\begin{document}
\autocite{smith_pixel_1995}
\end{document}
Bibliography.bib
@article{smith_pixel_1995,
title = {A Pixel Is Not A Little Square, A Pixel Is Not A Little Square, A Pixel Is Not A Little Square!},
volume = {6},
url = {http://ftp.alvyray.com/Memos/CG/Microsoft/6_pixel.pdf},
journaltitle = {Microsoft Computer Graphics, Technical Memo},
author = {Smith, Alvy Ray},
urldate = {2016-02-04},
date = {1995}
}
Steps to reproduce:
- run
latexmk -pdf mwe - introduce an error in
mwe.texlike an undefined control sequence - run
latexmk -pdf mwe - when prompted abort compilation with by pressing
x - fix error
- run
latexmk -pdf mwe-> biber error - run
latexmk -pdf mwe-> same biber error, won't go away
So the question is, how do I get latexmk to re-create the bcf file so that biber can use it without having to manually clean or remove files?
latexmkis not to have to reprocess everything from scratch; as a quick workaround it's still a solution. – alefhar Feb 19 '16 at 11:52latexmkafter the failed Biber run without doing anything else and everything will work fine - provided you have fixed the problem in the TeX file and it compiles without errors. See the discussion in issue #348 at thebiblatexbugtracker. (I think thelatexmkdeveloper is also active here, so he might drop by and give some more info.) – moewe Feb 20 '16 at 08:13biblatexbugs. From what I gather from the comments in the bugreport the endlessbibererror loop affects not only me and is not fixed yet. For now, I'll thinks it's easiest to simply invokelatexmkwith the-ggswitch and recompile everything from scratch. – alefhar Feb 20 '16 at 10:19-ggis a bit of an overkill, just run latexmk again if the compilation stops with the.bcfmalformed error. This places a tiny bit more responsibility on you, but it doesn't force latexmk to redo everything from scratch. – moewe Feb 20 '16 at 16:44biberandlatexmkversions match, thebiblatexversion probably too. That is the bug I was referring to; the circular dependency John Collins describes, that is difficult to resolve correctly, I accept. – alefhar Feb 20 '16 at 17:06latexmkwill still run biber first which aborts due to crippledbcf. Least trouble for me is removing the crippled file. – Johannes_B Feb 20 '16 at 17:12biberversion (2.3), with 1.8 andlatexmkfrom TexLive 2014 on the second trypdflatexwas run. – alefhar Feb 20 '16 at 17:16Latexmk: Use the -f option to force complete processing, unless error was exceeding maximum runs of latex/pdflatex.I don't think that more than this can be done on thelatexmkside. – egreg Feb 20 '16 at 17:17.bcfs was changed with Biber version 2.2/2.3 (or therabouts) and between latexmk 4.39 and 4.43a. I have Biber 2.3,biblatex3.2, latexmk 4.43a. I mght be doing something horribly wrong (or rather right), but I still struggle to reproduce step 7 in your recipe above. – moewe Feb 20 '16 at 17:21latexmkto fix this. Meanwhile, one work around is to delete the offending.bcffile by hand. (Note that how problem shows itself depends on the exact versions of bothlatexmkandbiber.) – John Collins Feb 24 '16 at 13:39latexmkat http://users.phys.psu.edu/~collins/latexmk/ It should fix the problems described in the question, and I plan to submit this to CTAN shortly. But it would be useful for some regular users ofbiberto test the updated version to ensure the fix doesn't cause some other problem. (I am not a regular user ofbiber, so I have only tested the new version on very simple examples.) – John Collins Feb 24 '16 at 15:55latexmkis detecting thatbiberfailed due to a malformedbcffile and is runningpdflatexinstead. Just as I expected. Again, thanks! – alefhar Feb 25 '16 at 08:42