转自:http://ilovenn.blog.51cto.com/853223/369646
" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set sw=2
" TIP: if you write your /label's as /label{fig:something}, then if you
" type in /ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:
2.4 在新建的~/.vimrc文档中输入以下内容,告诉vim加载latex-suite插件(也可以从主页上copy;-)
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep/ -nH/ $*
" OPTIONAL: This enables automatic indentation as you type.
filetype indent on
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
2.5 设置Vim-latex-suite
我现在使用xelatex命令进行文档的编译,利用evince浏览生成的pdf文档。可以通过修改
~/.vim/ftplugin/latex-suite/texrc完成这些操作。
第88到92行,我进行了如下修改
88 if has('macunix')
89 TexLet g:Tex_DefaultTargetFormat = 'pdf'
90 else
91 TexLet g:Tex_DefaultTargetFormat = 'pdf'
92 endif
就是让tex总是被编译成pdf
第117行修改为
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 $*'
使用xelatex完成 tex -> pdf 的编译
修改147行:
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'
指定用evince程序打开pdf文档。
2.4 重启vim
话说怎么个重启法?我就直接注销,然后重新登录了,呵呵呵,很笨很傻很有效;-)
(关闭Vim程序再打开,就算重启一次了,不必注销那么麻烦)
这时候用vim打开一个后缀为.tex的文档,就可以在vim中看到关于latex的工具栏选项了。
使用过程中的几个“窍门”:
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,将