- 有一个sublime text编辑器
- 安装一个package: LaTeXTools
- 安装完后,试着用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
},
- 然后ctrl+b进行build,这样会将pdf结果显示在sumatra中。点击sumatra左上角的设置-高级选项配置inverse search(也就是从pdf双击某处能够反向跳到sublime的对应代码处):
InverseSearchCmdLine = "C:\software\Sublime Text 3\sublime_text.exe" "%f:%l"
- 尝试编辑,然后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了。