Emacs Auctex compile error: "Use M-x make-directory RET RET to create the directory and its parents"

StackOverflow https://stackoverflow.com/questions/17346514

  •  01-06-2022
  •  | 
  •  

문제

I am running emacs 23.3.1 on ubuntu 12.04 with auctex 11.86. Whenever I go to compile a latex document (using C-c C-c), if there are no errors, everything compiles just fine. However, if there are any errors it will tell me to use C-` to view errors, if I do so, I get this error message

Use M-x make-directory RET RET to create the directory and its parents

and it goes away after a couple seconds. Then it takes me to another screen that explains the error in the latex code. However, now I cannot simply do C-x 1 to get back to the latex code. I have to C-x C-c and restart emacs.

This is my .emacs file

(setq backup-by-copying t
      backup-directory-alist '(("." . "~/.emacsBkups"))
      delete-old-versions t
      kept-new-versions 5
      kept-old-versions 2
      version-control t)


(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-PDF-mode t)

;;(require 'ess-site)
;;(ess-toggle-underscore nil)
(require 'whitespace)
(setq whitespace-style '(lines-tail face))

(add-hook 'c-mode-hook 'whitespace-mode)
(add-hook 'c++-mode-hook 'whitespace-mode)
(add-hook 'python-mode-hook 'whitespace-mode)

(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(c-set-offset (quote cpp-macro) 0 nil)



(setq TeX-view-program-list '(("Evince" "evince --page-index=%(outpage) %o")))
(setq TeX-view-program-selection '((output-pdf "Evince")))
도움이 되었습니까?

해결책

Sometimes AUCTeX gets confused parsing the log of (La)TeX compilation and isn't able to guess the correct line raising the error. In some cases AUCTeX issues an obscure message "Error occured after last TeX file closed", when there are unbalanced parentheses, in your case it suggests you to create a new directory. To help AUCTeX finding the correct line raising the error you can add the -file-line-error option to latex or pdflatex by customizing the variable LaTeX-command-style. To do this add the following code to your .emacs:

(setq LaTeX-command-style '(("" "%(PDF)%(latex) -file-line-error %S%(PDFout)")))

See also the AUCTeX FAQ:

8. Why does TeX-next-error (C-c `) fail?

When writing the log file, TeX puts information related to a file, including error messages, between a pair of parentheses. AUCTeX determines the file where the error happened by parsing the log file and counting the parentheses. This can fail when there are other, unbalanced parentheses present.

As a workaround you can activate so-called file:line:error messages for the log file. (Those are are easier to parse, but may lack some details.) Either you do this in the configuration of your TeX system (consult its manual to see where this is) or you add a command line switch to the (la)tex call, e.g. by customizing LaTeX-command-style or TeX-command-list.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top