1

I'm on Windows 7, 32-bit processor and I'm trying to set up emacs and AUCTeX with RefTeX. I've followed Joachim Schlosser's english guide and Youtube tutorial in German (even if I don't understand German).

When I open a *.tex file, there are no Preview or LaTeX menus, instead a spartan TeX menu that doesn't offer the possibility to customize AUCTeX. Can someone please help me get AUCTeX to work the preview-latex feature that is supposed to display math expressions inside the buffer and not in a separate pdf program such as SumatraPDF? I've also downloaded the appropriate png.dll and zlib.dll (see guide above).

where's the LaTeX menu? Or preview-latex sub-menu?

I'm starting to doubt whether I got the right versions of emacs and AUCTeX for my OS. I've got emacs-24.4-bin-i686-pc-mingw32.zip and auctex-11.88-e24.4-msw.zip, are these the correct zip files?

This is my .emacs file which I have created by copy-pasting blocks of code from different places in the net, since I don't know elisp.

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

;;; 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)
  • 3
    Well, configuration looks ok, but I'd say you don't have AUCTeX at all. Are you sure you installed it? By far, the easiest way to install AUCTeX is through elpa: M-x package-install RET auctex RET, restart Emacs just to be sure and you're done. – giordano Sep 7 '15 at 20:20
  • Your question title does not match the actual question. Please change the title to reflect the fact that you are asking about installing AucTex or getting it to work. – Drew Sep 7 '15 at 20:52
  • @giordano I've tried that a few days ago but somehow couldn't get preview-latex to work. That's why I read and followed Mr. Schlosser's guide. He says to download AUCTeX zip file, copy it's content into emacs-24.4 folder under C:\Program Files\ overwriting at least one file/folder. I just did step-by-step what he did in his youtube tutorial. What can I do now? Can I still do M-x package-install or will it affect some internal files? – WobblyWindows Sep 7 '15 at 21:07
  • 1
    No, if possible I'd suggest you to uninstall that Emacs and install a fresh one and the install AUCTeX with Elpa. In this way you'll also updates to the package as soon as they are available. Installation described in that tutorial is pretty outdated nowadays and I don't think upgrading AUCTeX would be easy in that case (but I don't use Windows, so I'm not sure). – giordano Sep 7 '15 at 21:14
  • @giordano Can you please specify which version of emacs for Windows I should download and install in my 32-bit system, on my laptop computer? I'm really confused. Which of the following is it? (a) emacs-24.5-bin-i686-mingw32.zip (b) emacs-24.4-bin-i686-pc-mingw32.zip (c) emacs-24.3-bin-i386.zip link to emacs ftp – WobblyWindows Sep 7 '15 at 21:24
3

I followed @giordano's advice and made a clean install of emacs-24.5-bin-i686-mingw32.zip. I basically still followed Schlosser's youtube tutorial, including the bit where he edits and installs the *.reg file. This time, however, I got the libpng16-16.dll and zlib1.dll files from here and I did NOT extract the AUCTeX zip file's content into emacs' path. I installed AUCTeX from within emacs with M-x package-install RET auctex RET. My .emacs file is basically still the one above.

Once I got everything ready (I already had a working TeXLive distribution, by the way), I tried compiling a test.tex file with AUCTeX. At first I was still getting an error msg "preview imgage not available" but I had mistaken some code. After a few tries I got things right. The Preview and LaTeX menus are there, and I can see math preview inside the buffer! See picture below.

enter image description here

  • 1
    Please note Local variables must be at the end of the file. When you open a file you just have to write where point is, above local variables. – giordano Sep 8 '15 at 9:19

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.