1

I have a TeX file with an embedded file from the command \embedfile{\jobname.org}. I'd like to stop latexmk from running when the embedded file changes. There is no official option for latexmk to ignore certain files, but it seems like in my specific use case it might be possible with the $hash_calc_ignore_pattern option.

I've added each of the following (one at a time) to my ~/.latexmkrc:

$hash_calc_ignore_pattern{'pdf'} = '^\\embedfile{\\jobname.org}';
$hash_calc_ignore_pattern{'pdf'} = 'jobname.org';
$hash_calc_ignore_pattern{'pdf'} = '.*jobname.org.*';

However, any time I change the .org file, latexmk still runs. Does anyone have any advice how to get this functionality working?

1 Answer 1

4

Here are two solutions, depending on your needs.

Setting the value of $hash_calc_ignore_pattern{'pdf'} is not what you want, because that instructs latexmk to ignore certain lines in .pdf files. Instead you can instruct latexmk to ignore all lines in .org files by

$hash_calc_ignore_pattern{'org'} = '^';

That will apply to all files with extension .org, not just to \jobname.org.

An alternative is to arrange that on each run of pdflatex the symptoms of the use of the embedded file are removed from the .fls file generated by pdflatex. The following in a latexmkrc file worked for me:

$pdflatex = "pdflatex %O %S && ".
"perl -i -p -e \"s[^INPUT (\./|)\"%R\"\\.org\\s*\$][];\" %Y%R.fls";

(I've split the definition across two lines to make copying and pasting safe. There's some UNIX-specific magic to ensure quoting works properly on the command line that is passed to the system.)

3
  • The latexmk command is run on a .tex file exported from Org that includes the .org source. So the hash_calc_ignore_pattern should be {'tex'}. Then I just ignore the embed line. Would this work? Or is this also impacted by the bug.
    – mankoff
    Commented Feb 18, 2016 at 19:00
  • @mankoff No it wouldn't work, and this has nothing to do with the bug. Latexmk determines the names of the source files from the .fls (and also .log) file. It then tracks these files for detecting changes in them. Setting $hash_calc_ignore_pattern{'tex'] as you propose wouldn't change anything about preventing changes in the .org file from causing a rerun of pdflatex. The second solution in my answer solves your problem, as far as I understand it from your question. If it doesn't solve your problem, then your problem is different from the one you stated. Commented Feb 18, 2016 at 19:54
  • I think I stated it correctly. Your 2nd solution works for an MWE TeX or Org file. For some reason on my actual massive Org file w/ lots of LaTeX packages, it does not work. My mgz.fls contains mgz.org 3x as INPUT ./mgz.org and 1x as INPUT mgz.org. I'll wait for the next release of latexmk.
    – mankoff
    Commented Feb 18, 2016 at 20:38

You must log in to answer this question.

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