ubuntu下安装与使用vim-latex suite - webdancer's Blog

ubuntu下安装与使用vim-latex suite

webdancer posted @ 2012年5月21日 23:42 in 工具 with tags vim,tex , 5745 阅读
 
1、下载插件
从http://sourceforge.net/projects/vim-latex/files/下载vim-latex插件。
2、安装插件
  1. 解压下载的压缩包到~/.vim目录。
  2. 设置vimrc。详细参见:http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html
  3. 安装help文件。helptags ~/.vim/doc
  4. 设置Vim-latex-suite。使用xelatex命令进行文档的编译,利用evince浏览生成的pdf文档。可以通过修改~/.vim/ftplugin/latex-suite/texrc完成这些操作。
#第88到92行,我进行了如下修改,就是让tex总是被编译成pdf

88 if has('macunix')

89 TexLet g:Tex_DefaultTargetFormat = 'pdf'

90 else

91 TexLet g:Tex_DefaultTargetFormat = 'pdf'

92 endif


#第117行修改,使用xelatex完成 tex -> pdf 的编译

114 " ways to generate pdf files. there are soo many...

115 " NOTE: pdflatex generates the same output as latex. therefore quickfix is

116 "       possible.

117 TexLet g:Tex_CompileRule_pdf = 'xelatex -interaction=nonstopmode $*'



修改147行,指定用evince程序打开pdf文档

144 elseif has('macunix')

145 " Let the system pick.  If you want, you can override the choice here.

146 TexLet g:Tex_ViewRule_ps = ''

147 TexLet g:Tex_ViewRule_pdf = 'evince
 
        5.重启vim。
 
 
==================================转========================================
1. 初用时需熟记的几个键:Ctrl-J,F5, F7,F9,Shift-F5,Shift-F7,\ll (compile快捷键),\lv(view pdf 快捷键),\ls,Ctrl-X Ctrl-K(根据字典补全) 等。
 
2.  写出\cite{ 后按 F9 无反应,没有给出交叉引用,原因在于vim中的Python接口对latex-suite来说有些问题,将其禁用即可。只需要将 ~/.vim/ftplugin/latex-suite/texrc 中默认的打开~/.vim/ftplugin/latex-suite/texrc,将
TexLet g:Tex_UsePython = 1
                         改为
TexLet g:Tex_UsePython = 0
                      就行了!
 
3. 为了能够正向搜索,应设定好参数并使用\ll编译,然而当工作目录下有makefile时,\ll并非执行设定的编译命令,而是执行makefile,于 是导致无法正向搜索,郁闷了半天。其实只要禁用makefile即可,同样~/.vim/ftplugin/latex-suite/texrc中
TexLet g:Tex_UseMakefile = 0
 
4. 正向搜索设置,在 ~/.vim/ftplugin/tex.vim 中指定
let g:Tex_CompileRule_dvi='latex -src-specials -interaction=nonstopmode $*'
说明上说还要设定  :TCTarget dvi ,可是没有设也行,反而把这句话写在上面文件中时运行vi会提示错误,但是在vi中执行该命令却可以,反正能用就不管它了。设定好了以后需重新编译tex文件(用\ll),然后\ls可以搜索并预览。
 
5. 反向搜索,参考了 http://bbs.ctex.org/viewthread.php?tid=39072&extra=&page=1
注意反向搜索仅支持gvim,且gvim要以远程模式启动:
gvim --servername latex-suite --remote-silent   filename.tex
启动后  为了能够使用反向搜索,必须让 xdvi 知道当前编辑器是工作在 remote 模式下的
VIM,以便在用户搜索的时候调用编辑器显示查找结果。在你的 ~/.vimrc 或~/.vim/ftplugin/tex.vim中添加以下内容:
let g:Tex_ViewRule_dvi="xdvi -editor 'gvim --servername latex-suite --remote-silent'"
这样便可\ll编译后\ls查看了,反向搜索时记住要按着Ctrl键双击某处 (似乎左键单击即可),就会跳到tex源文件的相应地方。
 
6.  为了方便,自己也做了一些设置,包括快捷键,在 ~/.vim/ftplugin/tex.vim 中:
map    <F4>   <ESC>:q<CR>      "F4关闭窗口(buffer)
map    <F2>   <ESC>:w<CR>\ll   "F2保存并编译
imap   <F2>   <ESC>:w<CR>\ll
map    <F3>   <ESC>\lv                  "F3查看
imap   <F3>   <ESC>\lv
nmap   <Tab>  <C-j>                    "用Tab键来代替Ctrl-j跳转,方便多了
imap   <Tab>  <C-j>
vmap   <Tab>  <C-j>
set keywordprg=:help         "按K键查找光标处单词的帮助,默认是man
cmap  xxx   !make                
set    iskeyword+=.,_       "便于fig.xx,prl101_12345等形式的搜索补全,否则默认情况下不把fig.xx当成一个词,而是当成fig和xx两个次,中间的“.”被当做词的分隔符了。
 
7. 其实只要  latex -src-specials -interaction=nonstopmode  xxx.tex
编译出的dvi文件,就已经包含了正向与反向搜索的信息,就可以正向或反向搜索,如果是用xdvi打开的话,按Ctrl左键单击便可反向搜索,只不过xdvi默认弹出的是 xterm -e vi 的窗口,其实是可以自己指定编辑器的,比如 
xdvi -editor gedit 
照样反向搜索,至于上面所加的gvim的参数只是保证不是每次反向搜索都要打开一个gvim窗口而已。
 
8. 临时取消快捷键定义,比如你想输入双引号,可是一打出"就自动变成``,那么要怎么禁止自动替换,直接输出"呢?
记住 <Ctrl-v> 即可!
<Ctrl-v>" 得到 "
SS<Ctrl-v>S 得到 SSS
~<Ctrl-v>~ 得到 ~~
 
TBSE 10th Class Syl 说:
2023年9月18日 19:21

Students can go Through the Tripura Board 10th Class Syllabus 2024 Pdf to know the Complete Details about the Examination, which is the Blueprint and the Question Pattern, Down here, we had Provided All the TBSE 10th Class Syllabus 2024 Details about the Tripura Board Class Syllabus 2024 and their PDF Download Links for All the Subjects Bengali, English, Kokborok, Hindi, Mizo , Mathematics, Science, Social Science,TBSE Class new Syllabus 2024 Pdf File Format helps to get an idea About the Concepts and Topics Taught in class for a Subject During this Academic year 2024.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee