I'm new to emacs and AUCTeX and I'm having a problem with document preview (C-c C-p C-d). My LaTeX file is the following

\documentclass[11pt, a4paper]{report}



\emph{This is important}

e^{\pi i}+1=0



%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

and, of course it compiles. When I try to preview it I get the following messages:

Running `Preview-Ghostscript' with ``/usr/bin/rungs -dOutputFile\=\(pippo.prv/tmp6365EzV/pr1-\%d.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r99.0866x99.0685''

Preview-Ghostscript exited abnormally with code 1 at Thu Feb 15 11:11:16
Unable to read environment locale:exit now.

Preview-Ghostscript exited abnormally with code 1

My emacs version is 25.3.1, GS is 9.22. I read around that there were some incompatibility between such versions. Do you know how to solve the problem?

1 Answer 1


Just update your AUCTeX to the last version 12.1. I suggest you use the version on ELPA. This is the entry in the release note of 11.92:

preview-latex is compatible with Ghostscript 9.22 where the operator .runandhide is removed. All occurrences of .runandhide in preview-latex are replaced by alternative code making it work with Ghostscript 9.22 again.

As a side note, don't use $$...$$ in LaTeX documents. It may result in weird vertical spacing issues. Load the package amsmath and use one of its environments.

  • The version of my AUCTeX (installed with package manager) is 12.1.0. I tried to do the preview again and what I get are work-in-progress triangular symbol instead of formulae. The error is Preview-PDF2DSC exited abnormally with code 1 at Fri Feb 16 10:04:55 PDF2DSC sentinel: Opening input file: No such file or directory, /home/.../main.prv/tmp2757gyG/preview.dsc What should I do? How to remove .runandhide operator?
    – MaPo
    Feb 16, 2018 at 9:08
  • @MaPo - The error you describe is now something different. I suggest you try to construct and show a minimal .tex file exhibiting your problem. Also your .emacs-config reg. AUCTeX might be helpful. Please do M-x list-load-path-shadows RET to see if you have any conflicting versions/files installed. Feb 18, 2018 at 17:34

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.