[Tex/LaTex] Custom Build Settings in Sublime

shell-escapesublime-text

I'm using LatexTools for Sublime 2. I want to add the parameter -shell-escape to the build command, but struggling. The documentation says not to edit 'LaTeX.sublime-build', but to edit 'LaTeXTools.sublime-settings'. I've tried doing this, setting "builder": "script" and the build settings as follows:

"builder_settings" : {

    // General settings:
    // See README or third-party documentation

    // (built-ins): true shows the log of each command in the output panel
    "display_log" : true,   

    // Platform-specific settings:
    "osx" : {
        // See README or third-party documentation
        "program": "pdflatex",
        "command": ["latexmk", "-cd", "-e", "$pdflatex = '%E -interaction=nonstopmode -synctex=1 %S %O'", "-f", "-pdf"]
        // "cmd": ["latexmk", "-cd",
        //  "-e", "\\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S'",
        //  //"-silent",
        //  "-shell-escape",
        //  "-f", "-pdf"]
    },

    "windows" : {
        // See README or third-party documentation
    },

    "linux" : {
        // See README or third-party documentation
    }
},

Which I think is what I need. But now when I try and build something, nothing happens.

Any suggestions on what to do?

Best Answer

What worked for me was adding "options": ["--shell-escape"], to builder_settings. The whole block looks like this for me:

"builder_settings" : {

    // General settings:
    // See README or third-party documentation

    // (built-ins): true shows the log of each command in the output panel
    "display_log" : false,
    "options": ["--shell-escape"],

    // Platform-specific settings:
    "osx" : {
        // See README or third-party documentation
    },

    "windows" : {
        // See README or third-party documentation
    },

    "linux" : {
        // See README or third-party documentation
    }
},

Also, remember to delete all the auxiliary files before trying to build again.