当前位置: 首页 » 产品 » 家居百货 » 正文

centos 6.4系统使用vim-latex排版

放大字体  缩小字体 发布日期: 2024-09-25 07:25   来源:http://www.baidu.com/  作者:无忧资讯  浏览次数:26
核心提示:这个工具就写简历来说跟MS word差不多,而我为什么要学这个呢?装13!!关于latex的信息信息自行百度。二、选择工具工具有很多CT

这个工具就写简历来说跟MS word差不多,而我为什么要学这个呢?装13!!关于latex的信息信息自行百度。

二、选择工具

工具有很多CTex,TurboTex,VTex等等,而我作为一个vim的爱好者,当然选择vim-latex这个插件,在vim里面工作了。

三、安装vim-latex

将下载下来的最新版

vim-latex-1.8.23-20130116.788-git2ef9956.tar.gz 直接解压到 ~/.vim 中,如果是vim高级用户可以自己安装到vim的目录中。

[root@localhost Latex]# ls ~/.vim

compiler  ftplugin  latextags  Makefile     plugin

doc       indent    ltags      Makefile.in  view

四、vim配置

(1)vimrc中与latex相关的配置

1 " 使grep总是生成文件名

2 set grepprg=grep -nH $*

3 " vim默认把空的tex文件设为plaintex而不是tex,导致latex-suite不被加载

4 let g:tex_flavor='latex'

5 set iskeyword+=:

6 autocmd BufEnter *.tex set sw=2

(2)修改 ~/.vim/ftplugin/latex-suite/texrc文件

86 if has('macunix')

87     TexLet g:Tex_DefaultTargetFormat='pdf'

88 else

89     TexLet g:Tex_DefaultTargetFormat='pdf' "都生成pdf,也可以是默认的dvi

90 endif

...

115 TexLet g:Tex_CompileRule_pdf='pdflatex -interaction=nonstopmode $*'  "也可以用xelatex等其他的工具进行编译 117行下的工具在linux下一般都有

145 TexLet g:Tex_ViewRule_pdf='evince'  "是使用一个软件来打开pdf文件。这个软件可以自行下载其他的 evince在linux中有

五、配置快捷键

(1)默认快捷键

默认在Normal模式中输入  ll (compile编译tex文件) lv (查看编译出来的pdf文件) 这两个快捷键比较常用,具体快捷键在哪里定义我还不清楚,这两个还是看别人的博客的。在文档里面应该有,不过英语水平有限。关于这个反斜杠 其实是一个<leader> 可以自己定义 let mapleader="," 或 let g:mapleader="," 就变成了  ,ll  ,lv 了。   ll 的定义应该是这样的 nmap <leader>ll  :vim-latex关联上的函数<cr>

(2)其他有用的快捷键 

Ctrl-X Ctrl-K        根据字典补全

K            对当前光标下的单词进行man

nmap <silent> <F2>  :%s//s/+$//<CR>         "删除行末多余空字符

nmap <silent> <F3>  [i                      "显示当前变量的定义

nmap <silent> <F4>  :TlistToggle<CR>        "打开tag窗口

nmap <silent> <F5>  gg=G                  "格式化整个文件,为误用,特意加shift键

nmap <silent> <F6>  =a{                     "格式化当前{}之内的文本

nmap <silent> <F7>  :cs find d <C-R>=expand("<cword>")<CR><CR>       

"查找本函数调用的函数

nmap <silent> <F8>  :cs find c <C-R>=expand("<cword>")<CR><CR>       

"查找调用指定函数的函数

nmap <silent> <F9>  :make<CR>              "make 当前目录的文件

nmap <silent> <F10> :cnext<CR>             "跳到下一个编译错误

nmap <silent> <F11> :cc<CR>                "看完整的错误信息

nmap <silent> <F12> :clist<CR>             "看所有错误信息 

<Ctrl-v>        临时取消快捷键的定义,这个要记住,一般用在缩写ab命令或者<leader>

六、例子

1 % $Id: example1.tex,v 1.2 2004/01/19 23:29:39 edt1023 Exp $

2 % example1.tex

3 documentclass{report}

4 begin{document}

5 This is my first {LaTeX} typesetting example.

6 This is my first LaTeX{} typesetting example.

7 This is my first LaTeX typesetting example.

8 I am Mr. Edward G.J. Lee, G.J. is a abbreviation of my name.

9 I am Mr. Edward G.J. Lee, G.J. is a abbreviation of my name.

10 Please see Appendix A. We will be there soon.

11 Please see Appendix Anull. We will be there soon.

12 end{document}

也可以手动编译

1latex example1.tex=> 产生 example1.dvi

2dvips -Ppdf example1.dvi=> 产生 example1.ps <br>ps2pdf example1.ps=> 产生 example1.pdf <br>dvipdfm[x] example1.dvi=> 由example1.dvi 直接产生 example1.pdf 或<br>pdflatex example1.tex=> 由example1.tex 直接产生 example1.pdf<br>evince example1.pdf 在X11下查看pdf文件

 
 
[ 产品搜索 ]  [ 加入收藏 ]  [ 告诉好友 ]  [ 打印本文 ]  [ 违规举报 ]  [ 关闭窗口 ]

 

 
推荐图文
推荐产品
点击排行
    行业协会  备案信息  可信网站