Is there something like a "post compile hook" for latexmk.

I want to configure latexmk to run some scripts automatically after a compilation process is completed.


Yes. Look at the latexmk documentation for the configuration variables $compiling_cmd, $success_cmd and $failure_cmd.

N.B. In response to a comment: The above only work in preview-continuous mode.

| improve this answer | |
  • Thanks. I just tried to add the example from the manual fur $success_cmd but it didn't work. Then I just tried the more simple variant $success_cmd = "okular"; just to start okular for testing purposes after successful compilation, however this also doesn't work. By the way, it says that the pdflatex rule is out of date... – student Mar 19 '16 at 21:29
  • Sorry. I forgot those only work in preview-continuous mode. I'll amend my answer. Could you describe in more detail what you want to do. Depending on exactly what your needs are, there may be a way of doing what you want without modifying latexmk. – John Collins Mar 19 '16 at 22:18
  • 1
    I have a graphics directory set via texinputs After compiling I want to run a script which creates (or deletes) hardlinks of the pictures used into subdirectory of my project. – student Mar 19 '16 at 22:41

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.