• 博客访问： 466856
• 博文数量： 137
• 博客积分： 3874
• 博客等级： 中校
• 技术积分： 1475
• 用 户 组： 普通用户
• 注册时间： 2010-07-05 10:50

2011年（37）

2010年（100）

2010-09-07 23:01:19

Latex/Emacs tex mode

A big advantage of latex is that .tex is plain text file so that you can edit latex source files with any text editor. Although vim provides latex syntax-awareness editing, emacs is more widely used because of its tex/latex mode.

The tex mode is installed with emacs and you need to add

(setq tex-dvi-view-command "xdvi")
to your .emacs file so that emacs know how to display dvi file. Two important shortcuts are C-c C-f and C-c C-v. The first shortcut calls latex to compile your tex file and the latter call the xdvi to display the generated dvi file. Note that emacs use its own temporary files and you will have to compile your tex file outside of emacs to get a real dvi file.

There is another tex mode called UltraTex provides some very useful features such as latex command auto completion. (You type \b, if \begin is the only latex command in your tex tree, a term used by UltraTex, \begin will be inserted automatically.) This package is available under helpdesk. To make use of this, add the following lines to your .emacs file:

(require 'light)
(require 'ultex-setup)
You then can start Emacs and customize the packages as desired, by using the commands

M-x customize-group lightning-completion
M-x customize-group ultra-tex
You may need to load the ultex package, say by typing M-x load-library ultex or by opening up a TEX file, before you can do the second customization. Please refer to UltraTex webpage for more information.

chinaunix网友2010-09-10 20:15:57