When editing .eps- or .tikz-files I want to run TeX-command-run-all using the binding C-c C-a but since the LaTeX-file did not change (I only edited the .eps for example) I have to run my LaTeX command chain manually using C-c C-c.

What do I have to change to be able to run TeX-command-run-all even when there are no changes in the LaTeX-file?

  • If you've only modified included images, you shouldn't need to run your whole chain. I think C-c C-c LaTeX will recompile your document, inserting the modified images.
    – Tyler
    Apr 5, 2018 at 13:56
  • Using psfrag with images I would like to see the final result of the modification for which I need the whole chain.
    – quark
    Apr 6, 2018 at 8:23
  • I see. When I run into this, I usually add and remove a character and resave, to trick AucTeX into recompiling. I don't see anything in the documentation to force compilation of an apparently unchanged file, unfortunately.
    – Tyler
    Apr 6, 2018 at 14:12

1 Answer 1


I don't see any built-in ways to modify this behaviour. However, the underlying logic checks the modification time of your source file and any related outputs, and skips the compilation whenever the source is older than all outputs. We can modify the modification time from Emacs, which suggests the following work-around:

(defun force-compile ()
  "Set the file modification times on the current file, then call
This forces a complete recompilation of the document, even if the source
(.tex) is older than any existing outputs (.pdf etc)."
  (set-file-times (buffer-file-name)) ;; sets mod time to current time
  (TeX-command-sequence t t))
  • Due to the modification of the time I have to reread the buffer after each time executing force-compile
    – quark
    Apr 6, 2018 at 14:56
  • I don't understand - what does 'reread the buffer' mean?
    – Tyler
    Apr 6, 2018 at 15:00
  • When changing the time Emacs thinks that the current opened buffer is not the newest one. Therefore when making further changes in the file and executing force-compile again the warning pops up: xxx changed on disk; really edit the buffer?
    – quark
    Apr 6, 2018 at 15:04
  • You can replace (set-file-times (buffer-file-name)) with (set-buffer-modified-p t) (save-buffer) to avoid the warning
    – matteol
    Apr 7, 2018 at 8:02
  • Thanks Tyler and matteol, combining both of your suggestions works perfectly!
    – quark
    Apr 9, 2018 at 7:29

Your Answer

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

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