利用sublime text 3 + LaTexTools + TexLive + SumatraPDF搭建LaTex環(huán)境。
1. 安裝LaTexTools插件
在sublime text 3 中安裝LaTexTools 插件,無(wú)需贅述。
2. 安裝TexLive
可以選擇安裝TexLive或MiKTex作為TeX系統(tǒng)。直接安裝即可。
3. 安裝SumatraPDF
SumatraPDF是一個(gè)簡(jiǎn)潔的PDF閱讀器。這個(gè)軟件的安裝不是必須的,它是LaTexTools推薦的,可以設(shè)置反向搜索,直接由PDF文件跳轉(zhuǎn)到LaTeX代碼。
安裝好以后,將軟件路徑加入環(huán)境變量。
4. LaTexTools設(shè)置
在sublime text 3中選擇Preferences | Package Settings | LaTeXTools | Settings – User,找到如下代碼塊
"windows": {
// Path used when invoking tex & friends; "" is fine for MiKTeX
// For TeXlive 2011 (or other years) use
// "texpath" : "C:\\texlive\\2011\\bin\\win32;$PATH",
"texpath" : "C:\\texlive\\2017\bin\\win32;$PATH",
// TeX distro: "miktex" or "texlive"
"distro" : "TeXlive",
// Command to invoke Sumatra. If blank, "SumatraPDF.exe" is used (it has to be on your PATH)
"sumatra": "C:\\Program Files\\SumatraPDF\\SumatraPDF.exe",
// Command to invoke Sublime Text. Used if the keep_focus toggle is true.
// If blank, "subl.exe" or "sublime_text.exe" will be used.
"sublime_executable": "",
// how long (in seconds) to wait after the jump_to_pdf command completes
// before switching focus back to Sublime Text. This may need to be
// adjusted depending on your machine and configuration.
"keep_focus_delay": 0.5
},
其中texpath、distro根據(jù)實(shí)際情況作相應(yīng)修改即可。
5. 設(shè)置反向搜索
首先編譯一個(gè)latex文件,在sublime text中輸入:
\documentclass{article}
\begin{document}
hello, world
\end{document}
保存為test.tex,按 ctl + b進(jìn)行編譯,編譯完成后會(huì)自動(dòng)跳出一個(gè)PDF文件。選擇設(shè)置|選項(xiàng),在反向代理一欄輸入"C:\Program Files\Sublime Text 3\sublime_text.exe" "%f:%l"
。
LaTex環(huán)境搭建完成,可以開(kāi)心的使用LaTex進(jìn)行寫作了。