Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

With version 4.22, latexmk claims to

[s]upport the use of biber (with the biblatex package) as an alternative to bibtex for generating bibliographies, with automatic determination of whether to use bibtex or biber.

I decided to give it a go. I'm using Windows 7, Strawberry Perl, MiKTeX 2.8 (including latexmk 4.22b), Biber 0.7.3 (registered in the PATH environment variable) and TeXworks r.670 (which includes settings for latexmk). Result: While latexmk generally seemed to work fine, it always called BibTeX as bibliography backend even when the preamble of my LaTeX file embodied \usepackage[backend=biber]{biblatex}. (In contrast, Biber works fine under texify, the MikTeX equivalent to latexmk.) At first, I thought that I had missed something obvious (I'm still open for the possibility), but then I looked at latexmk.pl. Here are code lines 4204--4207:

    my $bib_program = 'bibtex';
    if ( exists $generated_log{"$bbl_base.bcf"} ) {
        $bib_program = 'biber';
}

So Biber should be called if some condition involving a bcf-file (biblatex/Biber control file) is satisfied. In a copy of latexmk.pl in my local texmf tree, I replaced the above code with a test for the existence (or so I think) of said bcf-file:

    my $bib_program = 'bibtex';
    if ( -e "$bbl_base.bcf" ) {
        $bib_program = 'biber';
}

Result: The modified latexmk correctly determines when to use Biber instead of BibTeX. (When switching from Biber to BibTeX, remnant bcf-files must be deleted manually.)

So: Have I discovered a bug in latexmk 4.22b or have I missed something obvious involving my system/TeX distribution/editor?

EDIT: To make my question more focussed: I'm interested to hear if other users of latexmk observe the same behaviour (latexmk never calling Biber). If so, I'd be happy if someone suggested a solution that -- unlike my "quick fix" -- doesn't involve redundant Biber runs.

EDIT 2: Herbert pointed out that Perl may behave differently in Windows vs. Linux. I will report my observations to the author of latexmk after the end of the bounty period; I'm still interested in reports from other users.

share|improve this question
    
what does $generated_log{..} really do? –  Herbert Jan 14 '11 at 16:50
    
@Herbert: According to code lines 3024--3025 (comment): "%generated_log: keys give set of files written by (pdf)latex (e.g., aux, idx) as determined by \openout = ... lines in log file." This function (?) is use three times in latexmk.pl. –  lockstep Jan 14 '11 at 17:01
    
@lockstep: With your solution biber is called everytime, which doesn't really make sense, when nothing changed in the *.bcf file. I thought that $generated_log{..} could do this job to controll changes or not in the bcf file. But from your description it does nothing special, the reason why your -e should do the better job. But this is only a guess, a closer look into the code is needed. –  Herbert Jan 14 '11 at 17:09
    
@Herbert: I should stress that I have absolutely no clue with regards to perl (I only found out about -e by trial and error), so my "description" what $generated_log does may be a comment snippet not relevant for the question at hand. –  lockstep Jan 14 '11 at 17:15
    
@lockstep did you run it with the -diagnostics option to see if there is a path problem somewhere? –  Yiannis Lazarides Jan 18 '11 at 17:35

2 Answers 2

exists $generated_log{"$bbl_base.bcf"} does a test if the list of files %generated_log includes an entry for "$bbl_base.bcf". From my point of view such an entry is missing in the list %generated_log, the reason why the call fails. If you test it with -e which does in general the same, it works in fact of the now missing check of %generated_log. You should report it to the author. It could also be possible that some of the Perl functions have not the same behaviour as with Linux.

share|improve this answer
up vote 3 down vote accepted

Note: This update from January 25th, 2011 was moved to a separate answer.

It turned out that the problem child wasn't Windows, but MiKTeX. Quoting John Collins, the author of latexmk:

A log file produced by MikTeX is missing some information compared with a log file from TeXLive. The missing lines are of the form

 \openout...

that latexmk was using to deduce the names of file written by (pdf)latex.

A new version of latexmk (4.22c) that makes the detection of the use of Biber compatible with MikTeX is available at http://www.phys.psu.edu/~collins/latexmk/versions.html.

share|improve this answer
1  
The current version of latexmk on CTAN is 4.30a, so that should work, too. Btw, the "official" capitalization of latexmk (or at least the one John Collins uses) seems to be like a regular noun, i.e. all lower-case unless it's at the beginning of a sentence. –  doncherry Dec 28 '11 at 17:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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