I have a strange problem. When I set up my AUCTeX configuration for Latex like this
(require 'tex)
(TeX-global-PDF-mode t)
it works for me.
But when I alter the code by putting in a lambda
function
(add-hook LaTeX-mode-hook (lambda ()
(require 'tex)
(TeX-global-PDF-mode t)
))
it won't work.
Could someone help me? Thank you.
Try adding a '
to the immediate left of LaTeX-mode-hook
. Also, you need to (require 'tex)
before using the LaTeX-mode-hook
.
Because the library AUCTeX defines the variable LaTeX-mode-hook
(i.e., brings it into existence), placing (require 'tex)
inside a hook that does not yet exist will not work. [See line 5017 of ~/.emacs.d/elpa/auctex-11.87.3/latex.el
)
(require 'tex)
(add-hook 'LaTeX-mode-hook (lambda ()
(TeX-global-PDF-mode t)
))
Normally, I see this used: (setq TeX-PDF-mode t)
. However, the original poster is correct regarding the existence of a function named TeX-global-PDF-mode
-- see line 1729 of ~/.emacs.d/elpa/auctex-11.87.3/tex.el
.
(source: lawlist.com)