SublimeText/LaTeXTools — pull request #18 by williamledoux (2012-02-13 18:46:18+00:00)
Title: Added 3 optional parameters to the make_pdf command

First, thanks (again) for your work !
Second, keep in mind that I am not familiar with python, so you should be double-careful if you merge this (I hope you will). If you don't, please tell me why so that I can fix it.

We needed to have a portable folder that include ST2, MikTex and Sumatra and that will work anywhere without any set up, and that compiles with xelatex. So we had to be able to customize the build system so that we don't need to have anything on the path, any specific environment variable, and any default PDF viewer.

Here are the additionnal parameters that we needed to achieve this:

- env: Update the environment variables before compiling (so that you can set a custom TEXINPUT and BIBINPUT or even tell texify that you want to use xelatex). The actual os.env is updated with the re-encoded provided dictionnary, and then restored (we tried to apply the same logic than for the "path" argument)

- viewer_cmd: Specify which viewer to launch once the compilation suceeded (This allowed to have another viewer as my default pdf viewer)
- postbuild_cmd: Allow to execute a custom step after the log was parsed (eg. Cleaning)

An exemple of build file using this is:

{
// General settings; DO NOT MODIFY!!!
"target": "make_pdf",
"selector": "text.tex.latex",
// Windows-specific settings
// -------------------------
"windows":
{
"cmd": ["texify",
"-b", "-p",
"--tex-option=\"--synctex=1\""
],
"viewer_cmd": ["Q:/ST2/Tools/Sumatra/SumatraPDF.exe", "-reuse-instance"],
"env": {
"PDFLATEX":"xelatex",
"TEXINPUTS":"Q:/@Administration/@Include;Q:/@Documents/@Include;.",
"BIBINPUTS":"Q:/@Documents/@Bibs"
},
"path": "Q:/ST2/Tools/MikTeX/miktex/bin;$PATH",
"file_regex": "^((?:.:)?[^:\n\r]*):([0-9]+):?([0-9]+)?(think) (.*)$"
}
}