Emacs latexmk function throws me into an empty buffer

前端 未结 2 1013
梦毁少年i
梦毁少年i 2020-12-10 05:54

This is a follow up to How do I bind latexmk to one key in Emacs and have it show errors if there are any.

I\'m using a function in Emacs to compile LaTeX documents

2条回答
  •  佛祖请我去吃肉
    2020-12-10 06:11

    There is a problem with how latexmk is being invoked. It is invoked with no arguments and so it tries to compile all tex files in the directory including the newly created vc.tex. This of course causes problems because vc.tex can't be compiled and so you get an error every time.

    Starting from the function you have it is fairly easy to fix using TeX-command-expand like:

    (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 %t" 'TeX-master-file)
                     master-file)
        (if (plist-get TeX-error-report-switches (intern master-file))
            (TeX-next-error t)
          (minibuffer-message "latexmk done"))))
    

    EDIT: In order to fix the problem with the "TeX Live 2011" buffer, you have to use the other answer as well.

提交回复
热议问题