5

I need to do some pre-processing to a bib file that is generated by a reference manager before passing it to biblatex. So I have created a script to this and tried to automate the call to this script with latexmk.

Since add_cus_dep only handles extensions and not whole file names, I have tried something like this:

  • thesis.bibinput is my unprocessed source file
  • I want to generate thesis.bib

I have added the following fragment to latexmkrc:

add_cus_dep('bibinput', 'bib', 1, 'bibfix');
sub bibfix {
    system("bibfix -x bibfix_transform.py \"$_[0]\" thesis.bib");
}

However, when compiling the document, the custom step is not called and the bib file is not generated.

I am using biblatex with biber and latexmk correctly outputs that biber didn't find the input file:

Biber error: [244] Utils.pm:180> ERROR - Cannot find 'thesis.bib'!
Latexmk: Biber did't find bib file [thesis.bib]
Latexmk: Summary of warnings:
  Latex failed to resolve 36 citation(s)

How can I convince latexmk to generate my bib file?

3
  • Just wondering, is there supposed to be a space between - and x in the above?
    – daleif
    May 2, 2017 at 16:57
  • oops, no. But the command should fail in this case and latexmk would have to raise the error. Even this didn't happen.
    – languitar
    May 2, 2017 at 21:35
  • $_[0] is missing the extension, but that's not your problem I guess. Can you produce a minimal complete example?
    – Michaël
    Jan 15, 2018 at 22:47

1 Answer 1

1

Just use the following code in the rc file will work for you

system("bibfix -x bibfix_transform.py thesis.bibinput thesis.bib");

By the way, I don't think the custom dependency rule could do this job in current latexmk, unless you change the source code of latexmk, i.e., latexmk.pl.

I would recommend you to use make, or other tools.

You must log in to answer this question.

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