[Tex/LaTex] Can’t compile XeLaTeX with LaTeXTools for Sublime (OSX)

latextoolssublime-textxetex

LaTeXTools works for me when I do regular LaTeX files. But whenever I try building my XeLaTeX file, I get this output:

[Compiling /some/path/to/file.tex]

SimpleBuilder: pdflatex run 1; done.

Errors:

/usr/local/texlive/2015/texmf-dist/tex/latex/fontspec/fontspec.sty:43: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [ }]


[Done!]

And when I look inside the Sublime console, this is what is written:

<module 'simpleBuilder' from '/Users/me/Library/Application Support/Sublime Text 3/Packages/LaTeXTools/builders/simpleBuilder.py'>
<class 'simpleBuilder.SimpleBuilder'>
5
Welcome to thread Thread-167
['pdflatex', '-interaction=nonstopmode', '-synctex=1', 'resume']
Finished normally
1

Is there something I'm doing wrong? Any help would be appreciated.

Best Answer

You're using the simple builder, which is fine for some situations, but its important to understand that the simple builder really is just that, a simple builder: it builds LaTeX documents using pdflatex and, if necessary, runs bibtex to generate a bibliography. That's it. Its actually intended as an example of how to write a builder than a fully featured builder itself and so there are a range of features that it does not and is unlikely to ever support.

Currently, the only mechanism LaTeXTools provides to build a XeLaTeX document is to use the traditional builder.

You can switch to by changing the builder option in your LaTeXTools.sublime-settings file to traditional or default or even just leaving it blank. You can also tweak this in your project settings file, if you use Sublime Text projects.

Once you are using the traditional builder, you can tell LaTeXTools to use xelatex by either:

  1. Adding a line like %!TEX program = xelatex to the beginning of your document.

or

  1. In the builder_settings section of your LaTeXTools.sublime-settings (or the settings section of your project file) create a program setting and set this to xelatex. It should look something like this:

    "builder_settings": 
    {
        "program": "xelatex"
    }
    
Related Question