Uninformative error message when using AUCTeX

AUCTeX 11.89

Starting from this version of AUCTeX, the option TeX-file-line-error enables by default the file:line:error messages that solve the problem. Thus, from this version you shouldn't run anymore into this kind of problems. I also suggest to revert any change to LaTeX-command-style, in order to be sure to use the default value.

See below for previous versions.


AUCTeX 11.88 or earlier

Instead of editing the texmf.cnf file you can just add -file-line-error option to your TeX processor. 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.

Note: already answered here.


This Gentoo Forum gives a solution that worked for me:

I have discovered that if I comment out

\usepackage{hyperref}

all works as it should. Evidently there is some sort of interaction between emacs, auctex, and hyperref that leads to the problem.

This solution is quick to try, but not ideal (you have to uncomment hyperref later).

A better solution is to follow what is mentioned in the Bug-AUCTeX list, referenced on the previous forum post. Resuming the quick fix:

change file_line_error_style from f to t in the texmf.cnf file.

The location and name of this file may vary. Here are some possible values:

/usr/share/texmf/web2c/texmf.cnf
/usr/share/texlive/texmf/web2c/texmf.cnf
/etc/texmf/texmf.d/95NonPath.cnf

You might need to run update-texmf, though in my TeXLive installation I didn't have to do it. I just uncommented the hyperref line previously commented and it worked.