2013-3-30 Windows下的Latex环境安装
在Linux下折腾了几天,心力交瘁。网也上不去了。先放一放,Windows下也有比较方便的Latex解决办法。
需要安装软件:
- CTEX套装。里面有Xetex
- Gvim
- Latex-suite
- Sumatra PDF
安装的软件在Baidu云盘中。
使用方法:
默认将Gvim装到C:/vim 中。
解压Latex-suite 将解压的文件放在C:\vim\vimfiles 中。将文件夹合并。
在C:\vim\.vimrc 文件中加入以下命令:
1 " REQUIRED. This makes vim invoke Latex-Suite when you open a tex file. 2 filetype plugin on 3 4 " IMPORTANT: win32 users will need to have 'shellslash' set so that latex 5 " can be called correctly. 6 set shellslash 7 8 " IMPORTANT: grep will sometimes skip displaying the file name if you 9 " search in a singe file. This will confuse Latex-Suite. Set your grep 10 " program to always generate a file-name. 11 set grepprg=grep\ -nH\ $* 12 13 " OPTIONAL: This enables automatic indentation as you type. 14 filetype indent on 15 16 " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to 17 " 'plaintex' instead of 'tex', which results in vim-latex not being loaded. 18 " The following changes the default filetype back to 'tex': 19 let g:tex_flavor='latex'
修改c:\vim\vimfiles\ftplugin\latex-suite\texrc 文件中的几个位置:
if has('macunix') TexLet g:Tex_DefaultTargetFormat = 'pdf' else TexLet g:Tex_DefaultTargetFormat = 'pdf' endif
1 " ------------------------------------------------------------------------------ 2 " Compiler rules {{{ 3 " This is the first thing you should customize. It is set up for most common 4 " values, but if use some other compiler, then you will want to change this. 5 " As CompileFlags value you'd perhaps like to use, e.g., '-src-specials', 6 " but it is known that it can sometimes give different results in the output, 7 " so use it with care. The '-file-line-error' flag helps sanitize LaTeX error 8 " messages for processing by Vim. 9 TexLet g:Tex_CompileRule_dvi = 'latex -interaction=nonstopmode $*' 10 TexLet g:Tex_EscapeChars = '{}\' 11 12 TexLet g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi' 13 14 " ways to generate pdf files. there are soo many... 15 " NOTE: pdflatex generates the same output as latex. therefore quickfix is 16 " possible. 17 TexLet g:Tex_CompileRule_pdf = 'xelatex -interaction=nonstopmode $*' 18 19 " TexLet g:Tex_CompileRule_pdf = 'ps2pdf $*.ps' 20 " TexLet g:Tex_CompileRule_pdf = 'dvipdfm $*.dvi' 21 " TexLet g:Tex_CompileRule_pdf = 'dvipdf $*.dvi' 22 23 TexLet g:Tex_CompileRule_html = 'latex2html $*.tex' 24 25 TexLet g:Tex_CompileRule_bib = g:Tex_BibtexFlavor . ' $*' 26 27 " Set Tex_UseMakefile to 0 if you want to ignore the presence of a Makefile 28 " when deciding how to compile 29 TexLet g:Tex_UseMakefile = 1 30 31 " }}}
1 " Viewer rules {{{ 2 " these programs are for viewing other formats. 3 " NOTE: latex-suite will automatically append file.<format> to these functions 4 " when calling them. The viewer therefore cannot accept arguments after 5 " the filename. 6 " NOTE: Windows users: 7 " Set your $PATH variable to include the full path to these programs. 8 if has('win32') 9 TexLet g:Tex_ViewRule_ps = 'gsview32' 10 TexLet g:Tex_ViewRule_pdf = 'SumatraPDF' 11 TexLet g:Tex_ViewRule_dvi = 'yap -1'
最后写一个tex 文件测试
\documentclass[11pt,a4paper,titlepage]{article} \usepackage{fontspec} \setmainfont{Adobe Song Std} \begin{document} \title{Hello,测试中文} \author{Mike Ma} \maketitle \section{My网址} 网址:http://www.qq.com \subsection{test} 网址:http://www.abc.com \subsection{subsection} 再次测试 \end{document}
测试结果:
还是有很多地方需要弄。一点一点慢慢来吧……