2

I'm trying to set up Emacs 24.3.1 to work with AUCTeX on Win7. When I try to use the Preview feature on the testing 'circ.tex' file I get the following error:

TeX Output exited as expected with code 1 at Mon Aug 24 18:40:57
LaTeX: preview-image-type setting 'png unsupported by this Emacs

What does that mean? I have GSView, GhostScript 9.09, TeXMaker and TeXLIve 2015 updated from 2013. I have so far followed Sacha Chua's installation instructions and I have created a path called C:\homemacs\. Inside this folder are the .emacs file and the directory .emacs.d. Using M-x package-list I've installed YASnippet 0.8.0, org-mode 8.3.1 and AUCTeX 11.88.7. This is the .emacs file:

;; -*- mode: elisp -*-

;; Disable splash screen (to enable it again, replace t with 0)
(setq inhibit-splash-screen t)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
 '(custom-enabled-themes (quote (tsdh-dark))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "outline" :family "DejaVu Sans Mono")))))

I'm totally new to Emacs so can you PLEASE give me some instructions as to how to configure it to Preview equations on the same buffer? I've downloaded and installed SumatraPDF– has it got anything to do with the error in question?

  • 1
    See point 13 of gnu.org/software/auctex/manual/auctex/… Does this help? Where did you get your Emacs? – giordano Aug 24 '15 at 17:24
  • I don't use preview so this might be a guess: First, your Emacs must be compiled with png support, try C-h v system-configuration-options RET and look for --with-png. Second, you need the right .dll, say libpng16-16.dll, preferably in the directory where emacs.exe resides. Check this document for more information. – Arash Esbati Aug 24 '15 at 17:36
  • @giordano how do I add support for png format? where is this init file? is it the same as .emacs file? In an open tex file I go to to menu Preview > Customise > Browse Options > Preview . I'm given 3 options: (1)Preview appearence (2)Preview gs (3)Preview Latex. Can I use these somehow? – WobblyWindows Aug 24 '15 at 17:50
  • I think Emacs binary should have been compiled with such support. If you don't compile the program by yourself you can't do nothing. Where did you get your Emacs binary? The init(ialization) file is the .emacs. – giordano Aug 24 '15 at 17:54
  • 1
    @WobblyWindows - You've lost me on the way and I don't know what your question is. You can install Emacs on Win7 with: 1) Define a %HOME% environment variable (obviously done with C:\homemacs) 2) Grab the latest Emacs (24.5.) from here and unpack it to a directory of your choice 3) Grab libpng-1.6.12-w32-bin.zip from here, unpack libpng16-16.dll and zlib1.dll into the directory where emacs.exe is. Start Emacs with runemacs.exe and see if preview works. – Arash Esbati Aug 30 '15 at 15:45
3

I got the correct *.dll files and put them in emacs' binaries. I also had to make a clean install of emacs (emacs-24.4-bin-i686-pc-mingw32.zip) and install AUCTeX with M-x package-install RET auctex RET. My emacs file is constructed from different people's emacs.

;;; Schlosser's .emacs
(server-start)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq-default ispell-program-name "aspell")


;;; Brent.Longborough's .emacs
(setq inhibit-splash-screen t); Disable splash screen
(setq visible-bell t); Flashes on error
;(set-face-background hl-line-face "#f2f1f0"); Same color as greyness in gtk
(show-paren-mode 1); Matches parentheses and such in every mode


;;; AUCTeX
;; Customary Customization, p. 1 and 16 in the manual, and http://www.emacswiki.org/emacs/AUCTeX#toc2
(setq TeX-parse-self t); Enable parse on load.
(setq TeX-auto-save t); Enable parse on save.
(setq-default TeX-master nil)

(setq TeX-PDF-mode t); PDF mode (rather than DVI-mode)

(add-hook 'TeX-mode-hook 'flyspell-mode); Enable Flyspell mode for TeX modes such as AUCTeX. Highlights all misspelled words.
(add-hook 'emacs-lisp-mode-hook 'flyspell-prog-mode); Enable Flyspell program mode for emacs lisp mode, which highlights all misspelled words in comments and strings.
(setq ispell-dictionary "english"); Default dictionary. To change do M-x ispell-change-dictionary RET.
(add-hook 'TeX-mode-hook
          (lambda () (TeX-fold-mode 1))); Automatically activate TeX-fold-mode.
(setq LaTeX-babel-hyphen nil); Disable language-specific hyphen insertion.

;; " expands into csquotes macros (for this to work babel must be loaded after csquotes).
(setq LaTeX-csquotes-close-quote "}"
      LaTeX-csquotes-open-quote "\\enquote{")

;; LaTeX-math-mode http://www.gnu.org/s/auctex/manual/auctex/Mathematics.html
(add-hook 'TeX-mode-hook 'LaTeX-math-mode)


(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(preview-default-document-pt 12))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

This is what I have now:emacs with AUCTeX and preview-latex working fine now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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