使用vim-latex排版

  前幾天在某個羣上看到了一篇簡歷,內容不重要,一看排版很漂亮的說。一問才知道是用latex排版工具排版的。一想到我都大三下學期的,也快大四了,是否是要準備一份簡歷。因而就想使用latex這個排版工具來排版。html

  1、簡介linux

    這個工具就寫簡從來說跟MS word差很少,而我爲何要學這個呢?裝13!!關於latex的信息信息自行百度。git

  2、選擇工具vim

    工具備不少CTex,TurboTex,VTex等等,而我做爲一個vim的愛好者,固然選擇vim-latex這個插件,在vim裏面工做了。centos

    CTex的下載地址: http://www.ctex.org/CTeXDownload 函數

    vim-latex的下載地址: http://sourceforge.net/projects/vim-latex/files/工具

  3、安裝vim-latexui

    將下載下來的最新版spa

vim-latex-1.8.23-20130116.788-git2ef9956.tar.gz 直接解壓到 ~/.vim 中,若是是vim高級用戶能夠本身安裝到vim的目錄中。.net

[root@localhost Latex]# ls ~/.vim
compiler  ftplugin  latextags  Makefile     plugin
doc       indent    ltags      Makefile.in  view

  4、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中有

  5、配置快捷鍵

    (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>

  6、例子

 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 A\null. We will be there soon.
12 \end{document}

   下載地址:  http://edt1023.sayya.org/tex/latex123/example1.tex

   也能夠手動編譯

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

  

  7、參考資料

  http://blog.csdn.net/ustc_dylan/article/details/7259512

  http://blog.163.com/lgh_2002/blog/static/4401752620108901643863/ (關於leader)

  http://ishare.iask.sina.com.cn/f/21975389.html (latex入門)

  8、環境

    我是在centos 6.4下vim 7.2,root 用戶。

相關文章
相關標籤/搜索