Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring emacs for latex - void-variable LaTeX-mode-hook

Following this pdf document I added the following to my ~/.emacs file:

(load "auctex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-PDF-mode t) ;; .pdf statt .dvi per default:
;;Zeilenumbruch
;;(add-hook ’LaTeX-mode-hook ’turn-on-auto-fill)
;;Syntax Higlight
(add-hook ’LaTeX-mode-hook ’turn-on-font-lock)
;; Mathe Modus
(add-hook ’LaTeX-mode-hook ’LaTeX-math-mode)
;; Reftex einflechten und laden
(setq reftex-plug-into-AUCTeX t)
(add-hook ’LaTeX-mode-hook ’turn-on-reftex)
;; Satzende ". " statt ". ". " fuer M-k: loeschen bis Satzende usw.
;;(setq sentence-end "[.?!][]\"’)}]*\\($\\| \\| \\)[
;;]*") ;; Da ist ein "Newline in der Zeile!"
;;(setq sentence-end-double-space nil)
;;direkte Rechtschreib Korrektur:
;;(add-hook ’LaTeX-mode-hook ’flyspell-mode)
;; Nur benutzen falls Auctex > 11.81 mit preview-latex:
(load "preview-latex.el" nil t t)
;; aspell ist besser als ispell.
;; Zeile kommentieren, falls nicht installiert:
(setq-default ispell-program-name "aspell")
;; Deutsche Rechtschreibung falls \usepackage{ngerman}
;; oder german benutzt wird
(add-hook ’TeX-language-de-hook
(function (lambda () (ispell-change-dictionary "german8"))))

Unfortunately emacs doesn't start now, instead it gives the error

Warning (initialization): An error occurred while loading `/home/../.emacs':

Symbol's value as variable is void: ’LaTeX-mode-hook

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

When starting with --debug-init it gives the following information

Debugger entered--Lisp error: (void-variable ’LaTeX-mode-hook)
  (add-hook ’LaTeX-mode-hook ’turn-on-font-lock)
  eval-buffer(#<buffer  *load*> nil "/home/../.emacs" nil t)  ; Reading at buffer position 812
  load-with-code-conversion("/home/../.emacs" "/home/../.emacs" t t)
  load("~/.emacs" t t)
...

I tried using latex-mode-hook instead. I searched for a solution, but I seem to be the only one having exactly this problem.

I'm using Ubuntu 12.04 with the latest Emacs and Auctex. If required I'll post version information, but I rather think that something has to be added into the configuration or any package has to be installed instead.

How can I get emacs work with that configuration?

like image 359
Bertram Nudelbach Avatar asked Jun 06 '12 17:06

Bertram Nudelbach


1 Answers

Are you using the wrong single quote character? it seems to be some kind of a backward quote instead of a plain single quote. Try

'LaTeX-mode-hook

instead of

’LaTeX-mode-hook

(and likewise for all other occurrences of that character).

like image 175
Thomas Avatar answered Sep 27 '22 22:09

Thomas