技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機(jī)純凈版,64位旗艦版,綠色軟件,免費(fèi)軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 服務(wù)器類 >

centos 6.4系統(tǒng)使用vim-latex排版

來源:技術(shù)員聯(lián)盟┆發(fā)布時間:2018-09-01 12:05┆點擊:

這個工具就寫簡歷來說跟MS word差不多,而我為什么要學(xué)這個呢?裝13!!關(guān)于latex的信息信息自行百度。

二、選擇工具

工具有很多CTex,TurboTex,VTex等等,而我作為一個vim的愛好者,當(dāng)然選擇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相關(guān)的配置

1 " 使grep總是生成文件名

2 set grepprg=grep -nH $*

3 " vim默認(rèn)把空的tex文件設(shè)為plaintex而不是tex,導(dǎo)致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,也可以是默認(rèn)的dvi

90 endif

...

115 TexLet g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*'  "也可以用xelatex等其他的工具進(jìn)行編譯 117行下的工具在linux下一般都有

145 TexLet g:Tex_ViewRule_pdf = 'evince'  "是使用一個軟件來打開pdf文件。這個軟件可以自行下載其他的 evince在linux中有

五、配置快捷鍵

(1)默認(rèn)快捷鍵

默認(rèn)在Normal模式中輸入  ll (compile編譯tex文件) lv (查看編譯出來的pdf文件) 這兩個快捷鍵比較常用,具體快捷鍵在哪里定義我還不清楚,這兩個還是看別人的博客的。在文檔里面應(yīng)該有,不過英語水平有限。關(guān)于這個反斜杠 其實是一個<leader> 可以自己定義 let mapleader = "," 或 let g:mapleader="," 就變成了  ,ll  ,lv 了。   ll 的定義應(yīng)該是這樣的 nmap <leader>ll  :vim-latex關(guān)聯(lián)上的函數(shù)<cr>

(2)其他有用的快捷鍵 

Ctrl-X Ctrl-K        根據(jù)字典補(bǔ)全

K            對當(dāng)前光標(biāo)下的單詞進(jìn)行man

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

nmap <silent> <F3>  [i                      "顯示當(dāng)前變量的定義

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

nmap <silent> <F5>  gg=G                  "格式化整個文件,為誤用,特意加shift鍵

nmap <silent> <F6>  =a{                     "格式化當(dāng)前{}之內(nèi)的文本

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

"查找本函數(shù)調(diào)用的函數(shù)

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

"查找調(diào)用指定函數(shù)的函數(shù)

nmap <silent> <F9>  :make<CR>              "make 當(dāng)前目錄的文件

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 => 產(chǎn)生 example1.dvi

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