[Tex/LaTex] Sublime Text 2 latex tools/New Build

compilinggregoriosublime-text

Please excuse me if I've posted this in the wrong area. I've just started using Sublime Text 2 for Latex with the LaTeX tools plugin. It's wonderful.
I'm using Mac ox 10.6.8

I'm wondering about adding an engine/build for processing .gabc files. Using gregoriotex I can run this in the command line gregorio *.gabc and it will process the file and output a .tex file.

I can also do this with TeXworks which uses an engine with this :

#!/bin/tcsh

set path= ($path /usr/texbin /usr/local/bin)
set filename = "$1"
set texname = "${filename:r}.tex"
gregorio "$filename"
echo "produced $texname"

any help you can provide would be much appreciated.

Best Answer

  1. Save the script you pasted in your question to a file, say for example at the file /Users/yourusername/bin/run-gregorio and give it execution permission (chmod +x /Users/yourusername/bin/run-gregorio).

  2. In Sublime Text 2, go to Tools -> Build System -> New Build System, this will create a buffer containing:

    {
        "cmd": ["make"]
    }
    
  3. Edit it and change it to:

    {
        "cmd": ["/Users/yourusername/bin/run-gregorio", "$file_name"]
    }
    
  4. Save it as Gregorio.sublime-build (Sublime Text 2 will pick the correct folder for you).

That's all! Now you can choose Gregorio as build system and then build a file. You will see the message produced filename.tex in the console.

Related Question