使用sublime text打造一个好用的latex编辑器的姿势

  1. 有一个sublime text编辑器
  2. 安装一个package: LaTeXTools
  3. 安装完后,试着用sublime打开一个tex文件。修改latextools的设置,配置texpath和sumatra地址。根据个人情况不同想应配置,我的如下:
	"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:\\software\\MiKTeX\\InstallationFiles\\miktex\\bin\\x64;$PATH",
		// TeX distro: "miktex" or "texlive"
		"distro" : "miktex",
		// Command to invoke Sumatra. If blank, "SumatraPDF.exe" is used (it has to be on your PATH)
		"sumatra": "D:\\software\\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
	},
  1. 然后ctrl+b进行build,这样会将pdf结果显示在sumatra中。点击sumatra左上角的设置-高级选项配置inverse search(也就是从pdf双击某处能够反向跳到sublime的对应代码处):
InverseSearchCmdLine = "C:\software\Sublime Text 3\sublime_text.exe" "%f:%l"
  1. 尝试编辑,然后ctrl+b,你会发现修改的地方并没有在pdf中显示出来,这是因为有些temp文件没有被移除,后来我发现主要是.aux文件。试着手动删掉.aux文件,再ctrl+b,编辑后的结果就能显示出来了。如果不想手动删的画,可以按ctrl+l,然后按backspace(这个快捷键配置可以看latextools的package setting),这时会发现工作文件夹下的好几个temp文件都被自动删掉了。但是每次都要删还是很麻烦,更简单的办法是每次执行ctrl+b的时候自动删除temp文件。实现这个的办法是,看这个issue。 我的做法如下,只删掉了.aux文件(看下面的注释),因为我发现按照作者那样删了太多temp files后,sumatra莫名其妙不能inverse search了,而只删.aux文件就没问题了。
			# --- added by huangh12 from https://github.com/SublimeText/LaTeXTools/issues/323
			view = sublime.active_window().active_view()
			self.file_name = getTeXRoot.get_tex_root(view)
			if not os.path.isfile(self.file_name):
			    sublime.error_message(self.file_name + ": file not found.")
			    return

			self.tex_base, self.tex_ext = os.path.splitext(self.file_name)

			# Delete the files.
			# temp_exts = ['.blg','.bbl','.aux','.log','.brf','.nlo','.out','.dvi','.ps',
			#     '.lof','.toc','.fls','.fdb_latexmk','.pdfsync','.synctex.gz','.ind','.ilg','.idx']

			temp_exts = ['.aux']

			for temp_ext in temp_exts:
			    file_name_to_del = self.tex_base + temp_ext
			    #print file_name_to_del
			    if os.path.exists(file_name_to_del):
			        #print ' deleted '
			        os.remove(file_name_to_del)
			        # pass
			sublime.status_message("Deleted the temp files")
			# ---

以上~

对了,如果想用bibtex来插入citation。做法如:

\bibliographystyle{IEEE}
\bibliography{strings,refs}

只需要一个IEEE.bst文件来规定好格式,然后引用的item写到strings.bib文件中就ok了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值