转自:http://ilovenn.blog.51cto.com/853223/369646
由于没从源里安装texlive,所以没法直接从源里安装kile、winefish、rubber。首先考虑用gedit编辑latex文档,并 且下了一个gedit的latex插件,但是好像这个插件需要rubber(有没有人能解决这个问题阿,求助!),所以考虑用vim的latex- suite插件。
1、首先,下载这个插件
这个网页下面还给了安装方法,可我还是搞了很多次,终于成功,记录下来。
2、安装
2.1在/home/用户名 (即~目录)目录下新建.vim文件夹,.vimrc文件
2.2 在下载下来的vim-latex-1.5-20091002-r1074.tar.gz上点鼠标右键(我还不是很习惯用命令行作这些“日常事务”,呵呵;-)
选中解压得到的vim-latex-1.5-20091002-r1074文件夹下的所有文件及文件夹,拷贝到新建的~/.vim中
2.3 在~/.vim/ftplugin目录下新建文档tex.vim,输入以下内容(从vim-latex主页上拷贝即可):
" 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,将
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 $*'
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>~ 得到 ~~
分享到:
相关推荐
自己翻译的,给大家凑合看一看。肯定有不少问题,有建议请联系ytyang@tom.com,标题请以"latex-suite"起头。 Latex-Suite是一个帮助在vim下编辑latex文件的一个插件。
GT-suite的GEM3D模块教程,用GT-Power做发动机一维仿真时,切割进气歧管等
jbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3....
GT-suite软件功能介绍,GT-Suite是电子汽车行业使用的主流仿真、建模软件。功能非常强大,对应的使用也非常复杂,所以详细的软件功能介绍还是非常有用的
Blacksmith3D - Suite 可以改造和绘制你的三维立体人物和对象。Blacksmith3D - Suite 2.0允许你采样直观的方式改变对象的形状。你还可以旋转和放置你的对象,选择一个画笔并且直接地在对象的表面上进行绘制。你可以...
springsource-tool-suite-3.9.5.RELEASE-e4.8.0-updatesite springsource-tool-suite-3.9.5版本与eclipse4.8.0版本匹配
spring-tool-suite-3.8.4.RELEASE-e4.6.3-win32-x86_64
GT-SUITE 7.0中文破解教程,每一步轻轻松如果去破解
springsource-tool-suite-3.9.4.RELEASE-e4.6.3-updatesite.zip
springsource-tool-suite-3.9.10.RELEASE-e4.12.0-updatesite.zip
springsource-tool-suite-3.7.3.RELEASE-e4.5.2-updatesite.zip eclipse4.5.2 开发spring 的 插件 只能适用于eclipse4.5.2;里面的readme.txt文件描述如何在eclipse添加该插件
spring-tool-suite-3.9.6,安装配置文档都有
springsource-tool-suite-3.9.9 eclipse的spring组件 版本3.9.9 针对eclipse版本4.11
springsource-tool-suite-3.9.7.RELEASE-e4.8.0-updatesite
spring-tool-suite-4-4.9.0.RELEASE-e4.18.0-win32.win32.x86_64.self-extracting.jar
phoronix-test-suite-4.8.6.tar.gz 性能分析工具
eclipse4.7.1a版本需要的springsource-tool-suite插件,含有eclipse安装spring教程
springsource-tool-suite-3.9.8 eclipse的spring组件 版本3.9.8 针对eclipse版本4.11
eclipse-Mars.4.5.1 版本的springsource-tool-suite。 注意:必须版本对应才行,否则eclipse中集成的maven会消失
总共2部分 亲测可用 用7z工具解压出来 得到zip文件 springsource-tool-suite-3.6.3.RELEASE-e4.4.1-updatesite.7z.001 springsource-tool-suite-3.6.3.RELEASE-e4.4.1-updatesite.7z.002