[英]Setting up AUCTeX: LaTeX-mode-hook does not work
I have a strange problem. 我有一个奇怪的问题。 When I set up my AUCTeX configuration for Latex like this
当我像这样为Latex设置AUCTeX配置时
(require 'tex)
(TeX-global-PDF-mode t)
it works for me. 这个对我有用。
But when I alter the code by putting in a lambda
function 但是当我通过放入
lambda
函数更改代码时
(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
. 尝试在
LaTeX-mode-hook
左侧添加一个'
。 Also, you need to (require 'tex)
before using the LaTeX-mode-hook
. 另外, 在使用
LaTeX-mode-hook
之前 ,您需要(require 'tex)
。
Because the library AUCTeX defines the variable LaTeX-mode-hook
(ie, brings it into existence), placing (require 'tex)
inside a hook that does not yet exist will not work. 因为库AUCTeX定义了变量
LaTeX-mode-hook
(即使其存在),所以将(require 'tex)
require'tex)放置在尚不存在的钩子中将不起作用。 [See line 5017 of ~/.emacs.d/elpa/auctex-11.87.3/latex.el
) [请参见
~/.emacs.d/elpa/auctex-11.87.3/latex.el
第5017行)
(require 'tex)
(add-hook 'LaTeX-mode-hook (lambda ()
(TeX-global-PDF-mode t)
))
Normally, I see this used: (setq TeX-PDF-mode t)
. 正常情况下,我看到它使用了:
(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
. 但是,关于存在名为
TeX-global-PDF-mode
的功能的原始发布者是正确的-参见~/.emacs.d/elpa/auctex-11.87.3/tex.el
第1729行。
(source: lawlist.com ) (来源: lawlist.com )
Delete following line if you have in your "init.el". 如果您的“ init.el”中有以下行,请删除。
(load "preview-latex.el" nil t t)
Although the line is suggested in"auctex-reademe.txt", I think following is more appropriate. 尽管在“ auctex-reademe.txt”中建议使用该行,但我认为以下更合适。
(load "preview" nil t t)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.