欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

win10配置Sublime Text 3作为latex的编辑器

程序员文章站 2022-06-25 21:44:44
...

1. 安装Sublime Text 3

① 下载Sublime Text 3
② 安装Sublime Text 3
  • 安装方式很傻瓜,一路next就行了,也可以根据需要选择对应的安装目录。
  • 以下内容,我进行了勾选:
    win10配置Sublime Text 3作为latex的编辑器
③ 安装Package Control
  • 网上好多都说的是通过console进行安装,我不知为啥没成功。
  • 解决办法: 在菜单栏,选择Tools --> Install Package Control,成功安装Package Control
    win10配置Sublime Text 3作为latex的编辑器
  • 验证方法: Preferences菜单下看到Package Control,代表安装成功。
③ 安装LaTeXTools 插件
  • 使用快捷键Ctrl+Shift+P 打开命令框,输入Install Package,在列表中选择Package Control: Install Package注意: 也可以在 菜单栏中选择Preferences ---> Package Control
    win10配置Sublime Text 3作为latex的编辑器
  • 在弹出的窗口中输入LaTeXTools,选择安装。
    win10配置Sublime Text 3作为latex的编辑器
  • 安装成功,会有提示:
    win10配置Sublime Text 3作为latex的编辑器

2. 安装SumatraPDF

  • 官网下载安装包:
    win10配置Sublime Text 3作为latex的编辑器
    win10配置Sublime Text 3作为latex的编辑器
  • 点击应用程序进行安装,可以点击选项自定义安装目录。
    win10配置Sublime Text 3作为latex的编辑器
  • SumatraPDF的界面超级有趣,是我见过的非常cute的安装界面。

3. LatexTools 配置

  • 在 Sublime 中依次选择 Preferences > Package Settings > LatexTools > Settings - User。将会打开这样一个文件:
    win10配置Sublime Text 3作为latex的编辑器
  • 快捷键Ctrl + F,打开搜索窗口,并输入windows作为关键字,查找到以下内容:
    win10配置Sublime Text 3作为latex的编辑器
  • 对内容进行配置,本人的配置内容如下。注意: 文件路径中\一定是双斜杠\\,表示转义字符。
"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" : "D:\\texlive\\2019\\bin\\win32",
		// 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": "D:\\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
	},

4. 配置SumatraPDF,实现反向搜索

① 进行反向搜索配置
  • SumatraPDF的路径加入到环境变量中:
    win10配置Sublime Text 3作为latex的编辑器
  • 打开cmd,输入以下命令,其中E:\SublimeText 3\sublime_text.exe需要替换成自己对应的位置。
sumatrapdf.exe -inverse-search "\"E:\SublimeText 3\sublime_text.exe" \"%f:%l\""
② 检验
  • Sublime Text 3中新建tex文件,内容如下:
\documentclass{article}
\title{Title}
\author{Your Name} 
\begin{document}  
\maketitle{}
\section{Introduction}
This is where you will write your content. 
\end{document}
  • 保存后,通过快捷键Ctrl + B进行编译,编译成功后,会在SumatraPDF中展示编译好的PDF文件。
    win10配置Sublime Text 3作为latex的编辑器
  • 双击pdf文件的任意一处,会打开对应tex文件。(反向搜索打开的,原本Sublime Text 3已经被关闭)
    win10配置Sublime Text 3作为latex的编辑器

参考链接:

  1. Win10 配置 LaTeX(TeX Live + Sublime Text 3 + Sumatra PDF)
  2. Sublime Text3 如何安装、删除及更新插件
  3. LaTeX Sumatra Sublime反向搜索
相关标签: 论文