How can I make emacs execute a script every time when a latex-compilation (via auctex and latexmk) finished successfully? In particular I want to send a SIGHUP signal to mupdf to make it reload my pdf file.

I know that the sighup can be send when using latexmk from commandline with -pvc option and that in this case also a general post compile hook is supported (https://tex.stackexchange.com/questions/299822/post-compile-hook-latexmk), however latexmk -pvc doesn't integrate well in auctex (https://github.com/tom-tan/auctex-latexmk/pull/11), so I am looking for an emacs way for a post compile hook.

1 Answer 1


You can use TeX-after-compilation-finished-functions, as the name suggests it can be used to run functions after the compilation finished successfully. This is its docstring:

Hook being run after TeX/LaTeX/ConTeXt finished successfully. The functions in this hook are run with the DVI/PDF output file given as argument. Using this hook can be useful for updating the viewer automatically after re-compilation of the document.

If you use an emacs-internal viewer such as doc-view-mode or pdf-view-mode, add TeX-revert-document-buffer to this hook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.