I use latexmk to compile a project. It should run some bash commands before starting to compile.

I tried to add

$compiling_cmd="date >> /tmp/compiled.log";

to the local .latexmkrc file. But it is only evaluated, if I run latexmk with latexmk -pvc but not with latexmk.

There is a similar question about a post compile hook.

  • As you've found, this method only works in preview-continuous mode (as is documented). This is simply because the uses which I designed it for seemed useful only in preview-continuous mode. To have something that works without that restriction would need a modification of latexmk. It seems it would be a useful extension, I agree. – John Collins Jun 30 '19 at 21:47

You can add

system("date >> /tmp/compiled.log");

to your latexmk.rc. The limitation is, that it is executed with every run of latexmk (even when cleaning) and only once per invocation; not with each compilation run. (Your question was not 100% clear on whether this is sufficient). I use this approach to run make from latexmk, as latexmk is integrated into my IDE.

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.