8

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:

  1. run latexmk -pdf mwe
  2. introduce an error in mwe.tex like an undefined control sequence
  3. run latexmk -pdf mwe
  4. when prompted abort compilation with by pressing x
  5. fix error
  6. run latexmk -pdf mwe -> biber error
  7. 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?

  • I don't use latexmk, but doesn't the option -f as mentioned in your log ("Latexmk: Use the -f option to force complete processing,") work? Or run simply once pdflatex instead of latexmk. – Ulrike Fischer Feb 19 '16 at 11:42
  • @UlrikeFischer Yes, -f works. But as I see it, the point of latexmk is not to have to reprocess everything from scratch; as a quick workaround it's still a solution. – alefhar Feb 19 '16 at 11:52
  • Actually I can't reproduce your problem. If I change the tex-file, e.g. add an x, and then start latexmk it always calls pdflatex first and so also repairs a broken bcf. – Ulrike Fischer Feb 19 '16 at 12:09
  • That's what I feared. Just to be sure, you are using the same version of latexmk as I? – alefhar Feb 19 '16 at 12:13
  • You can just re-run latexmk after 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 the biblatex bugtracker. (I think the latexmk developer is also active here, so he might drop by and give some more info.) – moewe Feb 20 '16 at 8:13
4

As already mentioned in a comment, the solution is to use the new version of latexmk (4.44 at the time I write this answer), which is now available at http://www.ctan.org/pkg/latexmk/

1

Update May 2019:

This is still an issue with current LTS of Ubuntu (bionic, 18.04), because they deliver version 4.41. https://packages.ubuntu.com/bionic/latexmk

As stated by John this is fixed since version 4.4. Newer versions of latexmk are delivered for cosmic, disco,..

I fixed that issue on my machine, by temporarily use the cosmic repository:

  1. edit /etc/apt/sources.list at line of universe repo from bionic to cosmic, save
  2. apt update
  3. apt install latexmk
  4. revert changes in /etc/apt/sources.list
  5. apt update

This is in general not recommended, but latexmk is a very simple app/script with few dependencies. Pinning is not required because hopefully the maintainer won't choose a version between 4.41 and 4.44, current version in cosmic is 4.59.

Another approach would be loading the newest package from its home: How can I upgrade latexmk / why very old version is contained in Ubuntu repository?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.