The user "Mike" kindly helped me on Latex, Emacs: automatically open TeX Help buffer on error and close it after correction of the error? to create the following function which makes error detection to play nicely together with
(defun run-latexmk () (interactive) (let ((TeX-save-query nil) (TeX-process-asynchronous nil) (master-file (TeX-master-file))) (TeX-save-document "") (TeX-run-TeX "latexmk" (TeX-command-expand "latexmk -pdf %s" 'TeX-master-file) master-file) (if (plist-get TeX-error-report-switches (intern master-file)) (TeX-next-error t) (progn (demolish-tex-help) (minibuffer-message "latexmk: done.")))))
I would like to add another option to the
latexmk call like this:
(TeX-command-expand "latexmk -pdflatex='pdflatex -file-line-error' -pdf %s" 'TeX-master-file)
pdflatex to report not only the line of an error but also the file name (which is crucial for AUCTeX to open the correct buffer in case of an error). The problem is that after I add this option, a compiled
myfile.tex does not have an accompanying
myfile.synctex.gz anymore, which causes forward and backward search to fail (see How to set up Okular for forward/backward search with TeX Live 2011? (not trivial anymore)).
Where is the problem?