Auctex and beamer: TeX-error: Error occured after last TeX file closed [closed]

I use Auctex to create a beamer document. Frequently I run into this rather uninformative error message:

TeX-error: Error occured after last TeX file closed

I found a similar thread here and followed the suggestions to include this

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


in my .emacs. This solved the issue for me in the past but does not help in all cases. How to proceed If I still get this error?

• Got that sometimes too, never been bothered enough to investigate it. What you can do when it happens is open the log file <document>.log and C-s for error, for example. There will be a few useless matches in the preamble, then you should find your error. Without knowing what was the error and where it occurred exactly, it may be hard to give you a definite answer. – T. Verron Oct 10 '14 at 14:53
• Thanks. This seems a bit "quick and dirty" but it is effective in getting a hint about the error. In this case the error was caused by a missing \end{}. Is there anything I can do to get helpful error messages without inspecting *.log? – TexNewbi Oct 13 '14 at 16:38
• A missing end is a lost cause as far as I understand: it is perfectly legal to open an environment in an input file, and close it in the main file; so indeed "the error appeared after the last file closed". Also, (afaicr) this error appears at the next end environment, which can very well be the end of the document! – T. Verron Oct 13 '14 at 23:26
• However, maybe auctex could be patched to display the error message even if it doesn't know where the error appeared (or if the error appeared in a non-document file... I won't edit a .sty to fix an error in my code...). Maybe that's something that could be suggested on the auctex development mailing list: dir.gmane.org/gmane.emacs.auctex.devel – T. Verron Oct 13 '14 at 23:28
• I'm voting to close this question as off-topic because sounds like a bug report for auctex – samcarter_is_at_topanswers.xyz Sep 20 '16 at 16:29