When install auctex from the Package manager using GNU Archive, I get this error:

forward-sexp: Scan error: "Unbalanced parentheses", 18984, 38451

This always happens to me when I install it using the package manager. If I instead install it manually then everything works. Is there a way to solve the above error ?

  • Not sure what you mean by GNU Archive. I just installed it from elpa, and it installed without a hitch. You might try to turn on debugging (M-x set-variable RET debug-on-error RET t RET) and see if you can learn anything from the backtrace. Failing that, please give us an exact description of the steps you are following to install the package. Jul 14, 2015 at 7:45
  • @HaraldHanche-Olsen Instead of repository Like MELPA, I'm using this archive: "elpa.gnu.org/packages" for installing auctex. That's what I meant by GNU Archive. This is the entire log message from the Messages buffer during installing
    – Sibi
    Jul 14, 2015 at 7:57
  • Sorry, I can't make sense of what you are saying. The page you are pointing at (elpa.gnu.org/packages) is a repository “like MELPA”, except it is ELPA, like I said. If you are fetching the archive from there to install it, it seems to me that you are installing it manually, yet you say that manual installation works, while whatever it is you're doing does not work. Once again, what exactly did you do to get this error? Jul 14, 2015 at 11:43
  • To be precise, I think the best way to install packages from (M)ELPA is to follow the instructions on the Emacs wiki. Jul 14, 2015 at 11:45

1 Answer 1


You probably have the coding system set to a fixed value. E.g. by using

(setq coding-system-for-read 'utf-8)

in your .emacs file. Setting this variable overrides the settings for individual files and lines like -*- coding: iso-2022-jp-unix; -*- get ignored. In my installation this skrewed up the generation of the autoloads for auctex during installation and resulted in the same scan error.

Test if this problem applies to you: locate were the elpa archives are extracted and open then file elpa/auctex-11.89/tex-jp.el. If buffer-buffer-file-coding-system is not set to iso-2022-jp-unix, then this is the problem.

The solution is to not set coding-system-for-read globally. See http://ergoemacs.org/emacs/emacs_encoding_decoding_faq.html for how to set the default coding system properly.

  • Wow, you figured out the root cause of the problem. That's the exact thing I was getting hit with.
    – Sibi
    Nov 29, 2015 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.