3

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?

3
  • 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. Commented 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. Commented 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. Commented Apr 6, 2018 at 14:12

1 Answer 1

2

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 TeX-command-sequence. This forces a complete recompilation of the document, even if the source (.tex) is older than any existing outputs (.pdf etc)." (interactive) (set-file-times (buffer-file-name)) ;; sets mod time to current time (TeX-command-sequence t t)) 
5
  • Due to the modification of the time I have to reread the buffer after each time executing force-compile Commented Apr 6, 2018 at 14:56
  • I don't understand - what does 'reread the buffer' mean? Commented 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? Commented 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 Commented Apr 7, 2018 at 8:02
  • Thanks Tyler and matteol, combining both of your suggestions works perfectly! Commented Apr 9, 2018 at 7:29

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.