1

I'm trying to customise the build function on Sublime text 3 to include separate outputs for the build files and the pdf. I am using Miktex and xelatex (by adding %!TEX program = xelatex) at the top of my document. How would I customise the Latextools compiler to add,

-aux_directory=../intfiles

and

-output-directory=../pdffiles

Which I believe will do this?

1

Update: LaTeXTools now supports aux_directory and output_directory via settings or using comments such as %!TEX output_directory = out_dir. There are a few caveats to this support which are included in the documentation.


LaTeXTools doesn't support -aux-directory or -output-directory (yet). However, if you can stomach having a couple of symbolic links in the same directory as your main tex document, you can use something like roeeebar's suggestion from this issue, which adds a settings block to your sublime-project file (I've modified this for Windows, but I haven't tested it).

"settings": {
    "builder": "script",
    "builder_settings":
        "windows": {
            "script_commands": [
                "latexmk -cd -f -xelatex -synctex=1 -interaction=nonstopmode -auxdir=Aux -outdir=Output $file_name",
                "mklink Output\\$file_base_name.pdf .",
                "mklink Output\\$file_base_name.synctex.gz .",
                "mklink Aux\\$file_base_name.log ."
            ]
        }
    }
}

This basically places symbolic links to the appropriate files where LaTeXTools expects to find them, so it should continue to work as expected.

A couple of notes:

  1. latexmk is not installed by default on MiKTeX. It's easily installable using the package manager, but because it's a Perl script, you'll also need a version of Perl, such as Active Perl or Strawberry installed and on your %PATH% to get it working. Unfortunately, the usual builder LaTeXTools uses on MiKTeX (texify) will stop with a fatal error if you try to pass it the -aux-directory or -output-directory flags.

  2. You may need to alter the latexmk command of you are not using xelatex.

  • I installed Strawberry Perl, but how would you install it on your '%PATH%' to get it working? – Pravin Singh Apr 7 '16 at 22:40
  • @JindhaSingh it should do it automatically. Try typing perl -version in a cmd.exe window. If you get an error, see this answer on superuser. – ig0774 Apr 7 '16 at 23:20
  • @JindhaSingh any progress? – ig0774 Apr 9 '16 at 0:19
  • Yeah i cant get it to work unfortunately. Im still trying, but yeah it wont compile. – Pravin Singh Apr 9 '16 at 2:28
  • Do you get an error of some sort? – ig0774 Apr 24 '16 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.