I've just run into a problem with mVersion and by extension latexmk. As users of mVersion know, it updates a file version.dat with each run of the pdf/xe/lua/whatever engine. Until I reached the point where I've added the indices and bibliography that was fine. Now however I'm looking at version.dat being changed three times in a single run (minimum of 3). That sadly puts latexmk in a loop and it errors out with:

Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
Latexmk: Maximum runs of pdflatex reached without getting stable files
Latexmk: All targets (Jourdan.pdf) are up-to-date
Latexmk: Did not finish processing file 'Jourdan':
   'pdflatex' needed too many passes
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.

Since I suspect I'm hardly the first to run into this problem, I'm looking to the forum for advice. I'm right now working through the 34-page manual in order to find how to add in my own post-processing (after the first run) Perl script. I'm guessing that creation of a latexmkrc file is part of the solution to several problems here, but I'm a bit out to sea at the moment regarding a solution.

Of course I can resort to a batch file (I'm running under Windows 7) and I will if I have to, but I'm hoping that I can get a leg up on a hardwired solution with latexmk.

tl;dr --- how do I stop shooting myself in the foot with mVersion. The side problem of running a Perl script in mid-stream I'll handle myself.

  • See if you can adapt John Collins' answer to this question. Looks like the same basic problem. Alternatively, if you don't need a numeric version number, would a date/time stamp on the page suffice? Mar 11, 2013 at 11:56
  • @MikeRenfro At the moment I've not be able to get latexmk to pay attention to a local latexmkrc file so I'm a little unsure of what to do next. It seemingly reads the file as I had several go-arounds with the cut and paste copy of the pdf file's (the 'manual' for latexmk) example of commands to place in the local latexmkrc file---took a bit to stamp out the incorrect single quote chars :) But after a clean read it failed to execute the lines there in! Still researching... Don't want date/time stamping, already have that with \date etc. Want version number similar to what I place in my software
    – hsmyers
    Mar 11, 2013 at 12:27
  • @MikeRenfro was going to go on and say following the standard you normally get with --version at the command line.
    – hsmyers
    Mar 11, 2013 at 12:28

1 Answer 1


This MWE


plus this latexmkrc

$hash_calc_ignore_pattern{'dat'} = '^[0-9]';

is working for me. Not sure why it wants to run pdflatex twice, but at least it's not in an infinite loop.

  • 1
    The two runs of pdflatex happen when you do an initial run of latexmk, modify the tex file, and then run latexmk again. On the absolute first run of pdflatex, latexmk does not detect version.dat as a source file, since the file is written before being read. That changes on the run after the change in the tex file. Then latexmk reports that version.dat is changed or newly in use; it's the newly-in-use bit that triggers the extra run of pdflatex. On later runs, the changes are only in the lines of version.dat that latexmk was told to ignore. Mar 12, 2013 at 14:43
  • After thrashing about I've managed to effect the same solution. Excepting that I use '^.*$ as my pattern. I've marked this as the answer. Now back to your regular programming...
    – hsmyers
    Mar 12, 2013 at 18:58

You must log in to answer this question.

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