Search code examples
latexsublimetext3pdflatexbibtex

Run LaTeX command in Sublime 3


I'm working with LaTeX files in Sublime 3 (3059). Given a main .tex file and a .bib file holding the citations, I'd like to be able to issue the standard:

pdflatex main.tex && bibtex main.aux && pdflatex main.tex && pdflatex main.tex

command after hitting a given shortcut in Sublime.

I know there are tools that can do this (LatexTools, LaTeXing) but since what I need is (I believe) so simple, I'd prefer not to depend on extra packages.

How can I store this command and have Sublime run it following a given key combination?


Edit: Based on the answer given, this is the full command I ended up using:

{
    "cmd": ["pdflatex $file_name && bibtex $file_base_name.aux && pdflatex $file_name && pdflatex $file_name"],
    "shell": true
}

Solution

  • If you want to execute a command you could use Tools > Build System > New Build System to create a file with a content similar to this one:

    {
        "cmd": ["command"]
    }
    

    And then, you should select that as your project Build System. Finally, use ctrl+b to invoke build (invoke your command or script).