Skip to content

Instantly share code, notes, and snippets.

@bjmorgan
Forked from dpo/BibTeX.sublime-build
Created December 20, 2012 23:30
Show Gist options
  • Save bjmorgan/4349538 to your computer and use it in GitHub Desktop.
Save bjmorgan/4349538 to your computer and use it in GitHub Desktop.
Build files, keymap entries, and `run_latex_build.py` plugin for adding the option for running bibtex and cleaning up auxiliary files for LaTeX in Sublime Text 2. Added the ability to run bibtex, and changed key bindings.
{
"cmd": ["bibtex", "$file_base_name"],
"path": "$PATH:/usr/texbin:/usr/local/bin",
"file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
"selector": "text.tex.latex"
}
{
"cmd": ["latexmk", "-C", "$file"],
"path": "$PATH:/usr/texbin:/usr/local/bin",
"file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
"selector": "text.tex.latex"
}
[
// Run bibtex
{ "keys": ["super+shift+b"],
"command": "run_latex_build",
"args": {
"build_system": "Packages/User/Bibtex.sublime-build",
"reset_to": "Packages/LaTeXTools/LaTeX.sublime-build"
},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
]
},
// Clean up LaTeX auxiliary files.
{
"keys": ["super+shift+c"],
"command": "run_latex_build",
"args": {
"build_system": "Packages/User/CleanLatexFiles.sublime-build",
"reset_to": "Packages/LaTeXTools/LaTeX.sublime-build"
},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
]
}
]
import sublime
import sublime_plugin
class RunLatexBuildCommand(sublime_plugin.WindowCommand):
def run(self, build_system, reset_to):
self.window.run_command( "set_build_system", {"file": build_system } )
self.window.run_command( "build" )
self.window.run_command( "set_build_system", {"file": reset_to})
@bjmorgan
Copy link
Author

@dpo: I think it was a hangover from running separate LaTeX and BibTeX commands the "old-fashioned" way, but sometimes it's convenient to run just latex or bibtex without invoking the switch in focus to Skim, i.e. if you're essentially just "debugging" the LaTeX source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment