歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> LaTeX使用--XeLaTeX入門基礎(二)

LaTeX使用--XeLaTeX入門基礎(二)

日期:2017/2/28 15:50:08   编辑:Linux教程
主機平台:Gentoo Linux 11.2

內核版本:Linux Kernel 3.2.1

編譯環境:XeTeX 3.1415926-2.3-0.9997.5 (TeX Live 2011)

相關閱讀:LaTeX使用--XeLaTeX入門基礎(一) http://www.linuxidc.com/Linux/2012-05/61546.htm

1、首先是vim-latex插件的安裝

http://vim-latex.sourceforge.net/index.php?subject=download&title=Download官方下載插件包

將其解壓到~/.vim目錄下,注意這裡是將包文件加中的文件和文件夾放在.vim目錄下。

追加~/.vimrc中

  1. " REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
  2. filetype plugin on
  3. " IMPORTANT: win32 users will need to have 'shellslash' set so that latex
  4. " can be called correctly.
  5. set shellslash
  6. " IMPORTANT: grep will sometimes skip displaying the file name if you
  7. " search in a singe file. This will confuse Latex-Suite. Set your grep
  8. " program to always generate a file-name.
  9. set grepprg=grep\ -nH\ $*
  10. " OPTIONAL: This enables automatic indentation as you type.
  11. filetype indent on
  12. " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
  13. " 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
  14. " The following changes the default filetype back to 'tex':
  15. let g:tex_flavor='latex'
添加 ~/.vim/ftplugin/tex.vim中
  1. " this is mostly a matter of taste. but LaTeX looks good with just a bit
  2. " of indentation.
  3. set sw=2
  4. " TIP: if you write your \label's as \label{fig:something}, then if you
  5. " type in \ref{fig: and press <C-n> you will automatically cycle through
  6. " all the figure labels. Very useful!
  7. set iskeyword+=:
由於我是使用xelatex編譯pdf文件,然後使用evince查看pdf文件,所以需要修改~/.vim/ftplugin/latex-suite/texrc文件

為了簡單設置所有的TexLet g:Tex_DefaultTargetFormat = 'pdf'

設置所有的TexLet g:Tex_ViewRule_pdf = 'evince'

設置TexLet g:Tex_CompileRule_pdf = 'xelatex -interaction=nonstopmode $*'

重啟vim即可。

常用快捷鍵

\ll 采用xelatex編譯文檔
\lv 使用evince預覽生成的pdf文檔
F5 插入數學公式環境,主要包括eqnarray,equation,align,$$
F7 插入引用,包括footnote,cite,pageref,label
shift+F5 變更插入環境
shift+F7 變更插入引用

下面就使用上面配置的環境來測試學習。

2、交叉引用

  1. \section{交叉引用}
  2. 24 This is a ref \label{sec:this} example.See section~\ref{sec:this} on the page~\pageref{sec:this}

3、強調

  1. \section{強調}
  2. 我的\emph{LinuxIDC.com}地址:\underline{www.linuxidc.com}
Copyright © Linux教程網 All Rights Reserved