配置LaTeXTools插件自定義編譯

Sublime Text安裝LaTeXTools插件後,默認是編譯工具是latexmk (TeXLive),大部分狀況下,latexmk應該夠用,它可以判斷須要編譯的次數,包括使用bibtex編譯引用的參考文獻。但有時候會有須要自定義編譯引擎或者順序。工具

下面以pdflatex+bibtex+pdflatex*2的編譯爲例說明下如何自定義LaTeX編譯。ui

(參考自LaTeXTools)this

在LaTeXTools的安裝目錄(Mac下默認爲~/Library/Application Support/Sublime Text 3/Packages/LaTeXTools)有默認的配置文件LaTeXTools.sublime-settings,將其複製到安裝目錄上一級目錄的Use文件夾下。安裝目錄下的配置文件不建議修改,但複製到User目錄後作用做用戶自定義配置進行修改。打開配置文件可在編譯引擎設置部分看到插件

// Build engine settings
// ------------------------------------------------------------------

        // OPTION: "builder"
        // Specifies a build engine
        // Possible values:
        //
        // "default" or ""      the default built-in build engine; currently
        //                                      this is the same as "traditional"
        //
        // "simple"                     invokes pdflatex 1x or 2x as needed, then
        //                                      bibtex and pdflatex again if needed;
        //                                      intended mainly as a simple example for
        //                                      people writing their own build engines.
        //
        // "traditional"        replicates the 'old' system based on
        //                                      latexmk (TeXLive) / texify (MiKTeX)
        //
        // "script"                     external script: invokes the set of commands
        //                                      specified in the "script_commands" setting
        //                                      in the platform-specific part of the
        //                                      "builder_settings"
        //
        // custom name          you can also use third-party build engines;
        //                                      if so, set the "builder_path" option below
        //
        // NOTE: custom builders CANNOT have the same name as an existing
        // built-in build engine (including "default")

        "builder": "traditional",

默認的編譯引擎是"traditional",即latexmk (TeXLive)。能夠經過設置編譯引擎爲"script",而後設置須要的"script_commands"來自定義編譯。要實現pdflatex+bibtex+pdflatex*2的編譯須要在"builder_settings"相應的平臺條目中加入編譯命令,如我是在Mac下:code

...
"osx" : {
        // See README or third-party documentation
        "script_commands": [
            "pdflatex -synctex=1 -interaction=nonstopmode",
            "bibtex",
            "pdflatex -synctex=1 -interaction=nonstopmode",
            "pdflatex -synctex=1 -interaction=nonstopmode"
        ]
},
...

保存文件。再次編譯tex文件時默認是編譯就是pdflatex+bibtex+pdflatex*2了。orm

相關文章
相關標籤/搜索